@privy-io/react-auth 1.28.2-beta.1 → 1.28.2-beta.2
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 +43 -43
- package/dist/index.js +46 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var jc=Object.create;var
|
|
1
|
+
"use strict";var jc=Object.create;var Fr=Object.defineProperty;var Kc=Object.getOwnPropertyDescriptor;var Yc=Object.getOwnPropertyNames;var Qc=Object.getPrototypeOf,Zc=Object.prototype.hasOwnProperty;var Jc=(e,t)=>{for(var o in t)Fr(e,o,{get:t[o],enumerable:!0})},da=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yc(t))!Zc.call(e,n)&&n!==o&&Fr(e,n,{get:()=>t[n],enumerable:!(r=Kc(t,n))||r.enumerable});return e};var T=(e,t,o)=>(o=e!=null?jc(Qc(e)):{},da(t||!e||!e.__esModule?Fr(o,"default",{value:e,enumerable:!0}):o,e)),Xc=e=>da(Fr({},"__esModule",{value:!0}),e);var lm={};Jc(lm,{AsExternalProvider:()=>Xe,ConnectorManager:()=>Io,PrivyClient:()=>Wo,PrivyProvider:()=>$c,PrivyProxyProvider:()=>J,VERSION:()=>$r,WalletConnector:()=>Se,getAccessToken:()=>So,usePrivy:()=>G,useWallets:()=>Hc});module.exports=Xc(lm);var Mr=require("@ethersproject/address"),oi=require("@ethersproject/providers"),H=require("react");var P=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var pa=require("ofetch"),Ze=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}]`:""}`}},wo=class extends Ze{constructor(o,r,n,i,a){super(n,i,a);this.type=o;this.status=r}},A=class extends Ze{constructor(o,r,n){super(o,r,n);this.type="client_error"}},Gr=class extends A{constructor(){super("Request timed out",void 0,tr.CLIENT_REQUEST_TIMEOUT)}};var Y=class extends Ze{constructor(o,r,n){super(o,r,n);this.type="connector_error"}},ce=e=>{if(e instanceof Ze)return e;if(!(e instanceof pa.FetchError))return Ge(e);if(!e.response)return new wo("api_error",null,e.message,e);let{type:t,message:o,error:r,code:n}=e.data;return new wo(t||"ApiError",e.response.status,o||r,e,n)},Ge=e=>e instanceof Ze?e:e instanceof Error?new A(e.message,e):new A(`Internal error: ${e}`),tr=(a=>(a.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",a.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",a.INVALID_DATA="invalid_data",a.LINKED_TO_ANOTHER_USER="linked_to_another_user",a.ALLOWLIST_REJECTED="allowlist_rejected",a.CLIENT_REQUEST_TIMEOUT="client_request_timeout",a))(tr||{});var Hr=()=>"/api/v1/sessions",ua=()=>"/api/v1/sessions/logout",ma=()=>"/api/v1/sessions/fork",zr=()=>"/api/v1/sessions/fork/recover",ha=()=>"/api/v1/siwe/init",fa=()=>"/api/v1/siwe/authenticate",ya=()=>"/api/v1/siwe/link",ga=()=>"/api/v1/passwordless/init",va=()=>"/api/v1/passwordless/authenticate",ba=()=>"/api/v1/passwordless/link",wa=()=>"/api/v1/passwordless_sms/init",Ca=()=>"/api/v1/passwordless_sms/authenticate",Ea=()=>"/api/v1/passwordless_sms/link",xa=()=>"/api/v1/oauth/init",Ta=()=>"/api/v1/oauth/authenticate",Pa=()=>"/api/v1/oauth/link",_a=()=>"/api/v1/siwe/unlink",Aa=()=>"/api/v1/passwordless/unlink",Sa=()=>"/api/v1/passwordless_sms/unlink",ka=()=>"/api/v1/oauth/unlink",Ra=()=>"/api/v1/analytics_events";var Xt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new A("Email and email code must be set prior to calling authenticate.");try{let t=va(),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 ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new A("Email and email code must be set prior to calling authenticate.");try{let t=ba();return await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ce(t)}}async sendCodeEmail(t){if(!this.api)throw new A("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new A("Email must be set when initialzing authentication.");try{let o=ga();return await this.api.post(o,{email:this.meta.email})}catch(o){throw ce(o)}}};var Dt=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new A("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new A("User denied confirmation during OAuth flow");try{let t=Ta(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(t){throw ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new A("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new A("User denied confirmation during OAuth flow");try{let t=Pa();return await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})}catch(t){throw ce(t)}}async getAuthorizationUrl(){var t;if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.provider)throw new A("Provider must be set when initialzing OAuth authentication.");try{let o=xa();return await this.api.post(o,{provider:this.meta.provider,redirect_to:window.location.href},{baseURL:(t=this.api)==null?void 0:t.fallbackApiUrl})}catch(o){throw ce(o)}}};var eo=class{constructor(t){this.createSiweMessage=(t,o,r,n,i,a,l)=>`${r} wants you to sign in with your Ethereum account:
|
|
2
2
|
${o}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${a}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(fa(),{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 ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(ya(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ce(t)}}async sign(){if(!this.api)throw new A("Auth flow has no API instance");if(this.preparedMessage||await this.buildSiweMessage(),!this.preparedMessage)throw new A("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(){if(!this.api)throw new A("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:",""),r=await this.api.post(ha(),{address:t});return this.preparedMessage=this.prepareMessage(o,t,r.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 to=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new A("phone number and sms code must be set prior to calling authenticate.");try{let t=Ca(),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 ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new A("phone number and sms code must be set prior to calling authenticate.");try{let t=Ea();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ce(t)}}async sendSmsCode(t){if(!this.api)throw new A("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new A("phone nNumber must be set when initialzing authentication.");try{let o=wa();return await this.api.post(o,{phoneNumber:this.meta.phoneNumber})}catch(o){throw ce(o)}}};function Et(e){return new Date(e*1e3)}function ed(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,verifiedAt:Et(o.verified_at)};t.push(s);break;case"discord_oauth":let u={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(u);break;case"github_oauth":let h={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(h);break;case"apple_oauth":let E={subject:o.subject,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(E);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Ut(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var te=e=>e==null?void 0:e.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClient==="privy"),td=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Co=(e,t)=>{var o;return t==="all-users"&&!te(e)||t==="users-without-wallets"&&!((o=td(e))!=null&&o.length)};function xt(e){if(!e)return null;let t=ed(e.linked_accounts),o=Ut(t,"wallet"),r=Ut(t,"email"),n=Ut(t,"phone"),i=Ut(t,"google_oauth"),a=Ut(t,"twitter_oauth"),l=Ut(t,"discord_oauth"),s=Ut(t,"github_oauth"),u=Ut(t,"apple_oauth");return{id:e.id,createdAt:Et(e.created_at),linkedAccounts:t,email:r&&{address:r==null?void 0:r.address},phone:n&&{number:n==null?void 0:n.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},apple:u&&{subject:u.subject,email:u.email}}}var bi=require("@ethersproject/address"),Es=T(require("eventemitter3"));var Ia="1.28.2-beta.1";var Eo="4df5e2316331463a9130964bd6078dfa",Wa="34357d3c125c2bcf2ce2bc3309d98715",zr="https://auth.privy.io",Na=1e4,Je=1400,La=4500,Vr=Ia;var xo="privy:token",ii="privy-token",$r="privy:refresh_token",ai="privy-refresh-token",or="privy:session_transfer_token",si="privy:connectors",li="privy:connections";var He=1;var ci=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)}},di=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function rd(){return typeof window<"u"&&window.localStorage?new di:new ci}var Z=rd();var Ka=require("libphonenumber-js/min");var Ma={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 Oa={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",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 Da={id:84531,network:"base-goerli",name:"Base Goerli",nativeCurrency:{name:"Base Goerli",symbol:"ETH",decimals:18},rpcUrls:{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 Ua={id:42220,name:"Celo",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 Ba={id:44787,name:"Alfajores",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-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 Fa={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 Ga={id:314159,name:"Filecoin Calibration",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 Ha={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 za={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 Va={id:10,name:"Optimism",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 $a={id:420,name:"Optimism Goerli",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 qa={id:137,name:"Polygon",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 ja={id:80001,name:"Polygon 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 qr=[Ma,Oa,Ha,za,Va,$a,qa,ja,Ua,Ba,Fa,Ga,Da];var Kr=()=>{let e=window;if(!e.ethereum)return!1;if(jr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(jr(t,!0))return!0}return!1},rr=()=>{let e=window;if(!e.ethereum)return!1;if(jr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(jr(t,!1))return!0}return!1},jr=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isTokenPocket||e.isTokenary||e.isZerion):!1,ze=()=>{var e,t;if("phantom"in window){let o=window;if((t=(e=o==null?void 0:o.phantom)==null?void 0:e.ethereum)!=null&&t.isPhantom)return!0}return!1},Bt=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t.isCoinbaseWallet)return!0}return!1};var Ya=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,}))$/),Qa=e=>(0,Ka.isPossiblePhoneNumber)(String(e),"US"),Za=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},To=(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}`},nd=e=>new Promise(t=>setTimeout(t,e)),Ja=(e,t={})=>{let o=t.delayMs||40,r=t.maxAttempts||1e3;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<r;)e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await nd(o);a||i(new Error("Exceeded max attempts before resolving function"))})},Yr=(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 pi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),nr=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Xa(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];Kr()&&i.push("metamask"),ze()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function ui(e){return`eip155:${String(Number(e))}`}var oo=e=>{var o;let t=qr.find(r=>r.id===e);if(!t)throw new Y(`Unsupported chainId ${e}`,4901);return((o=t.rpcUrls.infura)==null?void 0:o.http[0])+`/${Eo}`};var ls=T(require("@coinbase/wallet-sdk"));var ir=require("react/jsx-runtime"),Ve=({style:e,...t})=>(0,ir.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,ir.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,ir.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 Pt=require("@ethersproject/address"),yi=require("@ethersproject/providers"),ss=T(require("eventemitter3"));var os=require("@ethersproject/bytes"),hi=require("@ethersproject/providers"),rs=require("@ethersproject/strings"),ns=T(require("eventemitter3"));var id=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],es=e=>id.includes(e);var ts=require("@ethersproject/logger");var Po=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},_o=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},lt=e=>{if(e instanceof Y)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Ao(e);return e.code===ts.ErrorCode.ACTION_REJECTED&&(t.details=ro.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Ao(e):new Y("Unknown connector error",e)},mi=class extends Ze{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ao=class extends mi{constructor(o){var i,a,l;let r=o;super(r.message,r.code,r.data);let n=Object.values(ro).find(s=>s.eipCode===r.code);this.details=n||ro.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=ro.E32002_CONNECTION_ALREADY_PENDING:this.details=ro.E32002_REQUEST_ALREADY_PENDING:(l=r.message)!=null&&l.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=ro.E32002_WALLET_LOCKED))}},ad={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}},sd={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},ld={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}},ro={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...ld,...sd},Tt={...ad,...ro};var cd=12e4,fi=(e=new Po,t=cd)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),J=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new Y(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),fi()]).catch(o=>{throw lt(o)})}},Ft=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Qr=class extends ns.default{constructor(o,r,n=1){super();this.walletProxy=o,this.address=r,this.chainId=n,this.provider=new hi.JsonRpcProvider(oo(n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Ft(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await So()||!this.address)throw new Ft("Disconnected",4900);return(await as(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Ft(`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 Ft(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new hi.JsonRpcProvider(oo(this.chainId)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0],n=(0,os.isHexString)(r)?(0,rs.toUtf8String)(r):r;return await is(n)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r={...o.params[0],chainId:nr(this.chainId)};return this.provider.send("eth_estimateGas",[r])}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return nr(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(es(o.method)){let r=await So();if(!r||!this.address)throw new Ft("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 Ft("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await So();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}}},Xe=class extends J{constructor(o){super(o)}},Gt=class extends J{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Se=class extends ss.default{constructor(o){super();this.onAccountsChanged=o=>{this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=ui(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.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>(0,Pt.getAddress)(i.address)===(0,Pt.getAddress)(o));return{address:(0,Pt.getAddress)(o),chainId:r,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return new yi.Web3Provider(new Xe(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return new Gt(this.proxyProvider)},sign:async i=>{if(!await n())throw new Y("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let l=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(l)&&(r=l)}if(r===void 0||!Array.isArray(r)||r.length<=0)return;let n=[],i=await this.proxyProvider.request({method:"eth_chainId"}),a=ui(i);for(let l of r)n.find(s=>(0,Pt.getAddress)(s.address)===(0,Pt.getAddress)(l))||n.push(this.buildConnectedWallet((0,Pt.getAddress)(l),a));Zr(n,this.wallets)||(this.wallets=n,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,Pt.getAddress)(n)===(0,Pt.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 yi.Web3Provider(new Xe(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 dd=e=>{let t=`https://mainnet.infura.io/v3/${Eo}`,o=1;return e.makeWeb3Provider(t,o)},Jr,Xr=class extends Se{constructor(){super("coinbase_wallet");this.connectorType="coinbase_wallet";this.proxyProvider=new J,this.subscribeListeners(),Jr||(Jr=new ls.default({appName:"Privy",darkMode:!1,headlessMode:!1})),this.proxyProvider.setWalletProvider(dd(Jr)),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(){Jr.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ve}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(o.length===0)throw new Y("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts(o)}catch(o){throw lt(o)}}};var gi=require("react/jsx-runtime"),ko=({style:e,...t})=>(0,gi.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,gi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99555 0.929932C-1.12055 1.31799 -0.499722 9.15734 2.17445 8.76915C0.0807959 10.5544 -0.960455 16.6416 6.01654 16.0265C10.6356 15.9489 15.5635 12.2232 15.5635 8.1095C15.5635 2.63748 10.7516 0.929932 7.99555 0.929932ZM9.47052 7.53055C9.47052 8.49933 8.81856 9.28468 8.01433 9.28468C7.2101 9.28468 6.55814 8.49933 6.55814 7.53055C6.55814 6.56176 7.2101 5.77641 8.01433 5.77641C8.81856 5.77641 9.47052 6.56176 9.47052 7.53055ZM12.3171 9.28468C13.1213 9.28468 13.7733 8.49933 13.7733 7.53055C13.7733 6.56176 13.1213 5.77641 12.3171 5.77641C11.5129 5.77641 10.8609 6.56176 10.8609 7.53055C10.8609 8.49933 11.5129 9.28468 12.3171 9.28468Z",fill:t.color||"var(--privy-color-foreground-3)"})});var en=class extends Se{constructor(o){super("privy");this.connectorType="embedded";this.proxyProvider=o,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[nr((o==null?void 0:o.chainId)||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ko}}disconnect(){this.connected=!1}async promptConnection(){}};var pd=require("@ethersproject/address"),ud=require("@ethersproject/providers"),cs=require("react-device-detect");var ve=require("react/jsx-runtime"),be=({style:e,...t})=>(0,ve.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,ve.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,ve.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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 tn=class extends Se{constructor(){super("metamask");this.connectorType="injected";this.proxyProvider=new J,this.subscribeListeners();let o=window,r=o.ethereum,n=o.ethereum.providers||[];for(let i of n)if(i.isMetaMask){r=i;break}this.proxyProvider.setWalletProvider(r),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:be}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!cs.isMobile&&Kr()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0)throw new Y("Unable to retrieve accounts");await this.syncAccounts(o)}catch(o){throw lt(o)}}};var $e=require("react/jsx-runtime"),ct=({style:e,...t})=>(0,$e.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,$e.jsx)("rect",{width:"28",height:"28",rx:"6",fill:"url(#paint0_linear_1765_9937)"}),(0,$e.jsx)("path",{d:"M24.0223 14.1704H21.5542C21.5542 9.14083 17.4627 5.06372 12.4151 5.06372C7.43008 5.06372 3.37717 9.04101 3.27798 13.9845C3.17536 19.0945 7.98653 23.5318 13.1154 23.5318H13.7605C18.2822 23.5318 24.3426 20.0047 25.2895 15.7072C25.4643 14.9151 24.8364 14.1704 24.0223 14.1704ZM8.74752 14.3945C8.74752 15.0671 8.19544 15.6172 7.52045 15.6172C6.84545 15.6172 6.29341 15.0669 6.29341 14.3945V12.4165C6.29341 11.7439 6.84545 11.1938 7.52045 11.1938C8.19544 11.1938 8.74752 11.7439 8.74752 12.4165V14.3945ZM13.0083 14.3945C13.0083 15.0671 12.4563 15.6172 11.7813 15.6172C11.1063 15.6172 10.5543 15.0669 10.5543 14.3945V12.4165C10.5543 11.7439 11.1065 11.1938 11.7813 11.1938C12.4563 11.1938 13.0083 11.7439 13.0083 12.4165V14.3945Z",fill:"url(#paint1_linear_1765_9937)"}),(0,$e.jsxs)("defs",{children:[(0,$e.jsxs)("linearGradient",{id:"paint0_linear_1765_9937",x1:"14",y1:"0",x2:"14",y2:"28",gradientUnits:"userSpaceOnUse",children:[(0,$e.jsx)("stop",{stopColor:"#534BB1"}),(0,$e.jsx)("stop",{offset:"1",stopColor:"#551BF9"})]}),(0,$e.jsxs)("linearGradient",{id:"paint1_linear_1765_9937",x1:"14.2976",y1:"5.06372",x2:"14.2976",y2:"23.5318",gradientUnits:"userSpaceOnUse",children:[(0,$e.jsx)("stop",{stopColor:"white"}),(0,$e.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0.82"})]})]})]});var on=class extends Se{constructor(){super("phantom");this.connectorType="injected";this.proxyProvider=new J,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:ct}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});await this.syncAccounts(o)}catch(o){throw lt(o)}}};var Cs=require("@walletconnect/ethereum-provider"),an=T(require("@walletconnect/qrcode-modal")),sn=require("react-device-detect");var et=require("react");var ps=require("react/jsx-runtime");function ds(e){return(0,ps.jsx)("link",{rel:"prefetch",href:e.src})}var rn=require("react/jsx-runtime"),_t="LANDING",us=(0,et.createContext)({ready:!1,app:null,currentScreen:_t,lastScreen:_t,navigate:P,navigateBack:P,setModalData:P}),ms=e=>{var h,E,w;let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=(0,et.useState)(e.initialScreen||_t),[a,l]=(0,et.useState)(e.initialScreen||_t);(0,et.useEffect)(()=>{o||i(_t)},[o]),(0,et.useEffect)(()=>{r||(l(_t),i(_t))},[r]),(0,et.useEffect)(()=>{e.initialScreen&&n===_t&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===_t?e.initialScreen:n,u={ready:!!(t!=null&&t.id),app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:m=>{l(n),i(m)},navigateBack:()=>{i(a)}};return(0,rn.jsxs)(us.Provider,{value:u,children:[(typeof((h=t==null?void 0:t.appearance)==null?void 0:h.logo)=="string"||((w=(E=t==null?void 0:t.appearance)==null?void 0:E.logo)==null?void 0:w.type)==="img")&&(0,rn.jsx)(ds,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},b=()=>(0,et.useContext)(us);var At=require("react/jsx-runtime"),Ro=({style:e,...t})=>{let{app:o}=b();return(0,At.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,At.jsx)("rect",{width:"28",height:"28",rx:"3",fill:(o==null?void 0:o.appearance.palette.colorScheme)==="dark"?"#3396ff":"#141414"}),(0,At.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,At.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,At.jsx)("defs",{children:(0,At.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,At.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var no=require("react-device-detect");var nn=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(fs))if(r.hostname===t)return{walletClientType:o,entry:r}};var fs={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},ys=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function vi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function md(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>vi(o))}function gs(){return md(fs)}function vs(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function bs(e,t){return no.isAndroid?e:vs(e,vi(t))}var ws="WALLETCONNECT_DEEPLINK_CHOICE";function hs(e){let t=e.href.split("?")[0];Z.put(ws,{...e,href:t})}var ar=(e,t)=>{if(!e||no.isDesktop){Z.del(ws);return}if(no.isAndroid){hs({name:"Unknown",href:t||"wc:"});return}else if(no.isMobileOnly){let o=vs(t||"wc:",vi(e));hs({name:(e==null?void 0:e.displayName)||"",href:o})}};var sr=class extends Se{constructor(o,r){super(r||"unknown");this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.proxyProvider=new J,this.createProvider().then(n=>{var i,a;if(this.provider=n,this.proxyProvider.setWalletProvider(n),this.subscribeListeners(),n.session){if((i=this.walletProvider.session)!=null&&i.peer.metadata.url){let l=nn((a=this.walletProvider.session)==null?void 0:a.peer.metadata.url);this.walletEntry=l==null?void 0:l.entry,this.walletClientType=(l==null?void 0:l.walletClientType)||"unknown",ar(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){var o,r,n;return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?be:ys(this.walletEntry.image_id)}:{name:pi(((o=this.walletProvider.session)==null?void 0:o.peer.metadata.name)||"")||"WalletConnect",icon:((n=(r=this.walletProvider.session)==null?void 0:r.peer.metadata.icons)==null?void 0:n[0])||Ro}}resetConnection(){this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,ar(void 0),this.onDisconnect())}async promptConnection(){if(!!this.provider)return new Promise((o,r)=>{let n=()=>{r(new _o)};this.onQrModalClosed=n,(async()=>{var s,u;let a="",l=await Promise.race([this.walletProvider.enable(),fi()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new Y("Unable to retrieve address");if((s=this.walletProvider.session)!=null&&s.peer.metadata.url){let h=nn((u=this.walletProvider.session)==null?void 0:u.peer.metadata.url);this.walletEntry=h==null?void 0:h.entry,this.walletClientType=(h==null?void 0:h.walletClientType)||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(lt(a));return}r(new Y("Unknown error during connection"))}).finally(()=>an.default.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){var n,i;let o={};for(let a of qr){let l=(i=(n=a.rpcUrls.infura)==null?void 0:n.http)==null?void 0:i[0];l&&(o[a.id]=l+"/"+Eo)}let r=await Cs.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:[1],rpcMap:o,showQrModal:!1});return r.on("display_uri",a=>{if(sn.isAndroid)window.open(a,"_self");else if(sn.isMobile&&this.walletEntry){ar(this.walletEntry,a);let s=bs(a,this.walletEntry);window.open(s,"_self","noopener,noreferrer")}else an.default.open(a,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:gs().map(l=>l.name)})}),r.on("connect",()=>{var a,l;if(an.default.close(),(a=r.session)!=null&&a.peer.metadata.url){let s=nn((l=r.session)==null?void 0:l.peer.metadata.url);this.walletEntry=s==null?void 0:s.entry,this.walletClientType=(s==null?void 0:s.walletClientType)||"unknown",ar(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var wi=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!(e==null?void 0:e.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===(0,bi.getAddress)(t)).length):!1},Io=class extends Es.default{constructor(o){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===(o==null?void 0:o.address)));return!o||!r?new J:r.proxyProvider};this.walletConnectCloudProjectId=o,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||(Z.get(si)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(si)),Xa().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(Bt()||Z.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r){if(!this.findWalletConnector("embedded","privy")){let i=new Qr(o,r),a=new en(i);this.addWalletConnector(a)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof sr&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return ze()?new on:null;case"metamask":default:return rr()?new tn:null}case"coinbase_wallet":return new Xr;case"wallet_connect_v2":return new sr(this.walletConnectCloudProjectId)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=Z.get(li);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));Z.put(li,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,bi.getAddress)(o),this.emit("walletsUpdated")}};function Zr(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==null?void 0:r.address)!==(n==null?void 0:n.address)||(r==null?void 0:r.chainId)!==(n==null?void 0:n.chainId)||(r==null?void 0:r.connectorType)!==(n==null?void 0:n.connectorType)||(r==null?void 0:r.connectedAt)!==(n==null?void 0:n.connectedAt)||(r==null?void 0:r.walletClientType)!==(n==null?void 0:n.walletClientType)||(r==null?void 0:r.isConnected)!==(n==null?void 0:n.isConnected)||(r==null?void 0:r.linked)!==(n==null?void 0:n.linked))return!1}return!0}var xs=require("ofetch");var hd=[Gr(),Hr()],ln=class{constructor(t,o,r){this.appId=t,this.sdkVersion=Vr,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=xs.ofetch.create({baseURL:this.defaults.baseURL,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!hd.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=AbortSignal.timeout(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Fr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ce(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ce(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ce(r)}}};var lr=T(require("js-cookie"));function Ts(e){return e instanceof Xt?"email":e instanceof to?"sms":e instanceof eo?"siwe":e instanceof Dt?e.meta.provider:null}var dt=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 Ps=T(require("jose")),pt=class{static parse(t){try{return new pt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Ps.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 fd=30,cn=class{constructor(){this.authenticateOnce=new dt(async t=>this._authenticate(t)),this.linkOnce=new dt(async t=>this._link(t)),this.refreshOnce=new dt(this._refresh.bind(this)),this.destroyOnce=new dt(this._destroy.bind(this)),this.forkSessionOnce=new dt(this._forkSession.bind(this))}get token(){try{let t=Z.get(xo);return typeof t=="string"?new pt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get($r);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(or);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=pt.parse(this.token);return t!==null&&!t.isExpired(fd)}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=Ts(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:xt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Ge(o)}}async _link(t){try{let o=await t.link();return xt(o)}catch(o){throw console.warn("Error linking account"),Ge(o)}}async _refresh(){if(!this.api)throw new A("Session has no API instance");if(!this.client)throw new A("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)n=await this.api.post(Gr(),{refresh_token:o},{headers:{authorization:`Bearer ${t}`}}),r&&this.clearForkedToken();else if(r)n=await this.api.post(Hr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),xt(n.user)}catch(n){if(n instanceof wo&&n.status===400&&n.message==="Invalid auth token")return this.destroyLocalState(),null;throw Ge(n)}}async _destroy(){var t;try{await((t=this.api)==null?void 0:t.post(ua(),{refresh_token:this.refreshToken}))}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new A("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ma(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Ge(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){var o;if(typeof t=="string"){Z.put(xo,t);let r=(o=pt.parse(t))==null?void 0:o.expiration;lr.default.set(ii,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}else Z.del(xo),lr.default.remove(ii)}storeRefreshToken(t){typeof t=="string"?(Z.put($r,t),lr.default.set(ai,t,{sameSite:"Strict",secure:!0,expires:30})):(Z.del($r),lr.default.remove(ai))}clearForkedToken(){Z.del(or)}};var Ci,Wo=class{constructor(t){this.apiUrl=t.apiUrl||zr,this.fallbackApiUrl=this.apiUrl,this.timeout=t.timeout||Na,this.appId=t.appId,this.clientAnalyticsId=typeof window>"u"?null:crypto.randomUUID(),Ci||(Ci=new cn),this.session=Ci,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t){this.connectors||(this.connectors=new Io(t))}generateApi(){let t=new ln(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()}authenticate(){if(!this.authFlow)throw new A("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new A("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Aa(),{address:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkPhone(t){try{let o=await this.api.post(Sa(),{phoneNumber:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkWallet(t){try{let o=await this.api.post(_a(),{address:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(ka(),{provider:t,subject:o});return xt(r)}catch(r){throw Ge(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.error("No client analytics id set, refusing to send analytics event"),await this.api.post(Ra(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch(n){console.error("Failed to create analytics event",n)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){var o;return this.session.hasActiveToken()?((o=pt.parse(this.session.token))==null?void 0:o.audience)!==this.appId?(await this.logout(),null):this.session.token:!(t!=null&&t.disableAutoRefresh)&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){var t,o;try{let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,appleOAuth:r.apple_oauth,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:(t=r.embedded_wallet_config)==null?void 0:t.create_on_login,requireUserPasswordOnCreate:(o=r.embedded_wallet_config)==null?void 0:o.require_user_password_on_create},privacyPolicyUrl:r.privacy_policy_url,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,createdAt:new Date(r.created_at*1e3),updatedAt:new Date(r.updated_at*1e3)}}catch(r){throw Ge(r)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t}`);return}}async forkSession(){return await this.session.forkSession()}};var j4=require("wicg-inert"),Yn=require("body-scroll-lock"),Qn=require("react"),sa=require("react"),Mc=T(require("react-dom")),Zn=T(require("styled-components"));var dn=require("react");var Ei=(0,dn.createContext)({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,getAuthMeta:P,getAuthFlow:P,closePrivyModal:P,connectWallet:P,initLoginWithWallet:P,loginWithWallet:P,loginWithCode:P,initLoginWithEmail:P,initLoginWithSms:P,resendEmailCode:P,resendSmsCode:P,initLoginWithOAuth:P,loginWithOAuth:P,refreshUser:P,walletProxy:null,createAnalyticsEvent:P,getUsdTokenPrice:P,recoverEmbeddedWallet:P}),W=()=>(0,dn.useContext)(Ei);var pn=require("react");var xi=(0,pn.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:P,login:P,linkEmail:P,linkPhone:P,linkWallet:P,linkGoogle:P,linkTwitter:P,linkDiscord:P,linkGithub:P,linkApple:P,logout:P,getAccessToken:P,getEthereumProvider:P,getEthersProvider:P,getWeb3jsProvider:P,unlinkEmail:P,unlinkPhone:P,unlinkWallet:P,unlinkGoogle:P,unlinkTwitter:P,unlinkDiscord:P,unlinkGithub:P,unlinkApple:P,setActiveWallet:P,forkSession:P,createWallet:P,signMessage:P,sendTransaction:P,exportWallet:P}),G=()=>(0,pn.useContext)(xi);var yn=T(require("styled-components"));var St=T(require("styled-components"));var un=T(require("styled-components")),Ht=require("react/jsx-runtime"),mn=({success:e,fail:t})=>(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(cr,{className:e?"success":t?"fail":""}),(0,Ht.jsx)(yd,{className:e?"success":t?"fail":""})]}),cr=un.default.span`
|
|
12
|
+
- https://privy.io`;this.wallet=t}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(fa(),{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 ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign();return await this.api.post(ya(),{message:t,signature:o,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw ce(t)}}async sign(){if(!this.api)throw new A("Auth flow has no API instance");if(this.preparedMessage||await this.buildSiweMessage(),!this.preparedMessage)throw new A("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(){if(!this.api)throw new A("Auth flow has no API instance");let t=this.wallet.address,o=this.wallet.chainId.replace("eip155:",""),r=await this.api.post(ha(),{address:t});return this.preparedMessage=this.prepareMessage(o,t,r.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 to=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new A("phone number and sms code must be set prior to calling authenticate.");try{let t=Ca(),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 ce(t)}}async link(){if(!this.api)throw new A("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new A("phone number and sms code must be set prior to calling authenticate.");try{let t=Ea();return await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw ce(t)}}async sendSmsCode(t){if(!this.api)throw new A("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new A("phone nNumber must be set when initialzing authentication.");try{let o=wa();return await this.api.post(o,{phoneNumber:this.meta.phoneNumber})}catch(o){throw ce(o)}}};function Et(e){return new Date(e*1e3)}function ed(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,verifiedAt:Et(o.verified_at)};t.push(s);break;case"discord_oauth":let u={subject:o.subject,username:o.username,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(u);break;case"github_oauth":let h={subject:o.subject,username:o.username,name:o.name,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(h);break;case"apple_oauth":let E={subject:o.subject,email:o.email,type:o.type,verifiedAt:Et(o.verified_at)};t.push(E);break;default:console.warn(`Unrecognized account type: ${r}. Please consider upgrading the Privy SDK.`)}}return t}function Ut(e,t){return e.sort((o,r)=>r.verifiedAt.getTime()-o.verifiedAt.getTime()),e.find(o=>o.type===t)}var te=e=>e==null?void 0:e.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClient==="privy"),td=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Co=(e,t)=>{var o;return t==="all-users"&&!te(e)||t==="users-without-wallets"&&!((o=td(e))!=null&&o.length)};function xt(e){if(!e)return null;let t=ed(e.linked_accounts),o=Ut(t,"wallet"),r=Ut(t,"email"),n=Ut(t,"phone"),i=Ut(t,"google_oauth"),a=Ut(t,"twitter_oauth"),l=Ut(t,"discord_oauth"),s=Ut(t,"github_oauth"),u=Ut(t,"apple_oauth");return{id:e.id,createdAt:Et(e.created_at),linkedAccounts:t,email:r&&{address:r==null?void 0:r.address},phone:n&&{number:n==null?void 0:n.number},wallet:o&&{address:o.address,chainType:o.chainType,chainId:o.chainId,walletClient:o.walletClient,walletClientType:o.walletClientType,connectorType:o.connectorType,recoveryMethod:o.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},apple:u&&{subject:u.subject,email:u.email}}}var bi=require("@ethersproject/address"),Es=T(require("eventemitter3"));var Ia="1.28.2-beta.2";var Eo="4df5e2316331463a9130964bd6078dfa",Wa="34357d3c125c2bcf2ce2bc3309d98715",Vr="https://auth.privy.io",Na=1e4,Je=1400,La=4500,$r=Ia;var xo="privy:token",ii="privy-token",qr="privy:refresh_token",ai="privy-refresh-token",or="privy:session_transfer_token",si="privy:connectors",li="privy:connections";var He=1;var ci=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)}},di=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function rd(){return typeof window<"u"&&window.localStorage?new di:new ci}var Z=rd();var Ka=require("libphonenumber-js/min");var Ma={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 Oa={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",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 Da={id:84531,network:"base-goerli",name:"Base Goerli",nativeCurrency:{name:"Base Goerli",symbol:"ETH",decimals:18},rpcUrls:{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 Ua={id:42220,name:"Celo",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 Ba={id:44787,name:"Alfajores",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-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 Fa={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 Ga={id:314159,name:"Filecoin Calibration",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 Ha={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 za={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 Va={id:10,name:"Optimism",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 $a={id:420,name:"Optimism Goerli",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 qa={id:137,name:"Polygon",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 ja={id:80001,name:"Polygon 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 rr=[Ma,Oa,Ha,za,Va,$a,qa,ja,Ua,Ba,Fa,Ga,Da];var Kr=()=>{let e=window;if(!e.ethereum)return!1;if(jr(window.ethereum,!0))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(jr(t,!0))return!0}return!1},nr=()=>{let e=window;if(!e.ethereum)return!1;if(jr(window.ethereum,!1))return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(jr(t,!1))return!0}return!1},jr=(e,t)=>e.isMetaMask?e.isMetaMask&&!t?!0:!(e.isBraveWallet&&!e._events&&!e._state||e.isApexWallet||e.isAvalanche||e.isBitKeep||e.isBlockWallet||e.isKuCoinWallet||e.isMathWallet||e.isOkxWallet||e.isOKExWallet||e.isOneInchIOSWallet||e.isOneInchAndroidWallet||e.isOpera||e.isPhantom||e.isPortal||e.isRabby||e.isTokenPocket||e.isTokenary||e.isZerion):!1,ze=()=>{var e,t;if("phantom"in window){let o=window;if((t=(e=o==null?void 0:o.phantom)==null?void 0:e.ethereum)!=null&&t.isPhantom)return!0}return!1},Bt=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t.isCoinbaseWallet)return!0}return!1};var Ya=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,}))$/),Qa=e=>(0,Ka.isPossiblePhoneNumber)(String(e),"US"),Za=(e,t)=>{let o=e.slice(0),r=[];for(;o.length;)r.push(o.splice(0,t));return r},To=(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}`},nd=e=>new Promise(t=>setTimeout(t,e)),Ja=(e,t={})=>{let o=t.delayMs||40,r=t.maxAttempts||1e3;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<r;)e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await nd(o);a||i(new Error("Exceeded max attempts before resolving function"))})},Yr=(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 pi=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),ir=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Xa(e=3e3){let t=!1,o=window;return new Promise(r=>{o.ethereum?n():(window.addEventListener("ethereum#initialized",n,{once:!0}),setTimeout(()=>{n()},e));function n(){if(t)return;t=!0,window.removeEventListener("ethereum#initialized",n);let i=[];Kr()&&i.push("metamask"),ze()&&i.push("phantom"),o.ethereum&&o.ethereum.isBraveWallet&&i.push("brave"),r(i)}})}function ui(e){return`eip155:${String(Number(e))}`}var oo=e=>{var o;let t=rr.find(r=>r.id===e);if(!t)throw new Y(`Unsupported chainId ${e}`,4901);return((o=t.rpcUrls.infura)==null?void 0:o.http[0])+`/${Eo}`};var ls=T(require("@coinbase/wallet-sdk"));var ar=require("react/jsx-runtime"),Ve=({style:e,...t})=>(0,ar.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,ar.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,ar.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 Pt=require("@ethersproject/address"),yi=require("@ethersproject/providers"),ss=T(require("eventemitter3"));var os=require("@ethersproject/bytes"),hi=require("@ethersproject/providers"),rs=require("@ethersproject/strings"),ns=T(require("eventemitter3"));var id=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign"],es=e=>id.includes(e);var ts=require("@ethersproject/logger");var Po=class extends Y{constructor(){super("Wallet timeout");this.type="wallet_error"}},_o=class extends Y{constructor(){super("User rejected connection");this.type="wallet_error"}},lt=e=>{if(e instanceof Y)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Ao(e);return e.code===ts.ErrorCode.ACTION_REJECTED&&(t.details=ro.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Ao(e):new Y("Unknown connector error",e)},mi=class extends Ze{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Ao=class extends mi{constructor(o){var i,a,l;let r=o;super(r.message,r.code,r.data);let n=Object.values(ro).find(s=>s.eipCode===r.code);this.details=n||ro.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=ro.E32002_CONNECTION_ALREADY_PENDING:this.details=ro.E32002_REQUEST_ALREADY_PENDING:(l=r.message)!=null&&l.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=ro.E32002_WALLET_LOCKED))}},ad={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}},sd={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},ld={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}},ro={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...ld,...sd},Tt={...ad,...ro};var cd=12e4,fi=(e=new Po,t=cd)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),J=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,o)}catch{console.warn("Unable to remove wallet provider listener")}};this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(o=>{this.removeListener(o.eventName,o.listener)}),this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new Y(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),fi()]).catch(o=>{throw lt(o)})}},Ft=class extends Error{constructor(o,r,n){super(o);this.code=r,this.data=n}},Qr=class extends ns.default{constructor(o,r,n=1){super();this.walletProxy=o,this.address=r,this.chainId=n,this.provider=new hi.JsonRpcProvider(oo(n))}async handleSendTransaction(o){if(!o.params||!Array.isArray(o.params))throw new Ft(`Invalid params for ${o.method}`,4200);let r=o.params[0];if(!await So()||!this.address)throw new Ft("Disconnected",4900);return(await as(r)).transactionHash}handleSwitchEthereumChain(o){if(!o.params||!Array.isArray(o.params))throw new Ft(`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 Ft(`Invalid params for ${o.method}`,4200);this.chainId=Number(r),this.provider=new hi.JsonRpcProvider(oo(this.chainId)),this.emit("chainChanged",r)}async handlePersonalSign(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r=o.params[0],n=(0,os.isHexString)(r)?(0,rs.toUtf8String)(r):r;return await is(n)}async handleEstimateGas(o){if(!o.params||!Array.isArray(o.params))throw new Error("Invalid params for eth_estimateGas");let r={...o.params[0],chainId:ir(this.chainId)};return this.provider.send("eth_estimateGas",[r])}async request(o){switch(console.debug("Embedded1193Provider.request() called with args",o),o.method){case"eth_accounts":return this.address?[this.address]:[];case"eth_chainId":return ir(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(o);case"eth_sendTransaction":return this.handleSendTransaction(o);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(o);case"personal_sign":return this.handlePersonalSign(o);default:break}if(es(o.method)){let r=await So();if(!r||!this.address)throw new Ft("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 Ft("Disconnected",4900)}}else return this.provider.send(o.method,o.params)}async connect(){let o=await So();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}}},Xe=class extends J{constructor(o){super(o)}},Gt=class extends J{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Se=class extends ss.default{constructor(o){super();this.onAccountsChanged=o=>{this.syncAccounts(o)};this.onChainChanged=o=>{this.wallets.forEach(r=>{r.chainId=ui(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.connected=!1,this.initialized=!1}buildConnectedWallet(o,r){let n=async()=>!!this.wallets.find(i=>(0,Pt.getAddress)(i.address)===(0,Pt.getAddress)(o));return{address:(0,Pt.getAddress)(o),chainId:r,connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:n,getEthereumProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return new yi.Web3Provider(new Xe(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await n())throw new Y("Wallet is not currently connected.");return new Gt(this.proxyProvider)},sign:async i=>{if(!await n())throw new Y("Wallet is not currently connected.");return await this.sign(i)},disconnect:()=>{this.disconnect()}}}async syncAccounts(o){let r=o;if(r===void 0){let l=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(l)&&(r=l)}if(r===void 0||!Array.isArray(r)||r.length<=0)return;let n=[],i=await this.proxyProvider.request({method:"eth_chainId"}),a=ui(i);for(let l of r)n.find(s=>(0,Pt.getAddress)(s.address)===(0,Pt.getAddress)(l))||n.push(this.buildConnectedWallet((0,Pt.getAddress)(l),a));Zr(n,this.wallets)||(this.wallets=n,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,Pt.getAddress)(n)===(0,Pt.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 yi.Web3Provider(new Xe(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 dd=e=>{let t=`https://mainnet.infura.io/v3/${Eo}`,o=1;return e.makeWeb3Provider(t,o)},Jr,Xr=class extends Se{constructor(){super("coinbase_wallet");this.connectorType="coinbase_wallet";this.proxyProvider=new J,this.subscribeListeners(),Jr||(Jr=new ls.default({appName:"Privy",darkMode:!1,headlessMode:!1})),this.proxyProvider.setWalletProvider(dd(Jr)),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(){Jr.disconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ve}}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(o.length===0)throw new Y("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts(o)}catch(o){throw lt(o)}}};var gi=require("react/jsx-runtime"),ko=({style:e,...t})=>(0,gi.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,gi.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.99555 0.929932C-1.12055 1.31799 -0.499722 9.15734 2.17445 8.76915C0.0807959 10.5544 -0.960455 16.6416 6.01654 16.0265C10.6356 15.9489 15.5635 12.2232 15.5635 8.1095C15.5635 2.63748 10.7516 0.929932 7.99555 0.929932ZM9.47052 7.53055C9.47052 8.49933 8.81856 9.28468 8.01433 9.28468C7.2101 9.28468 6.55814 8.49933 6.55814 7.53055C6.55814 6.56176 7.2101 5.77641 8.01433 5.77641C8.81856 5.77641 9.47052 6.56176 9.47052 7.53055ZM12.3171 9.28468C13.1213 9.28468 13.7733 8.49933 13.7733 7.53055C13.7733 6.56176 13.1213 5.77641 12.3171 5.77641C11.5129 5.77641 10.8609 6.56176 10.8609 7.53055C10.8609 8.49933 11.5129 9.28468 12.3171 9.28468Z",fill:t.color||"var(--privy-color-foreground-3)"})});var en=class extends Se{constructor(o){super("privy");this.connectorType="embedded";this.proxyProvider=o,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[ir((o==null?void 0:o.chainId)||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:ko}}disconnect(){this.connected=!1}async promptConnection(){}};var pd=require("@ethersproject/address"),ud=require("@ethersproject/providers"),cs=require("react-device-detect");var ve=require("react/jsx-runtime"),be=({style:e,...t})=>(0,ve.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,ve.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,ve.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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,ve.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 tn=class extends Se{constructor(){super("metamask");this.connectorType="injected";this.proxyProvider=new J,this.subscribeListeners();let o=window,r=o.ethereum,n=o.ethereum.providers||[];for(let i of n)if(i.isMetaMask){r=i;break}this.proxyProvider.setWalletProvider(r),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"MetaMask",icon:be}}disconnect(){console.warn("Metamask does not support programmatic disconnect.")}async promptConnection(){try{!cs.isMobile&&Kr()&&await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let o=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!o||o.length===0)throw new Y("Unable to retrieve accounts");await this.syncAccounts(o)}catch(o){throw lt(o)}}};var $e=require("react/jsx-runtime"),ct=({style:e,...t})=>(0,$e.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,$e.jsx)("rect",{width:"28",height:"28",rx:"6",fill:"url(#paint0_linear_1765_9937)"}),(0,$e.jsx)("path",{d:"M24.0223 14.1704H21.5542C21.5542 9.14083 17.4627 5.06372 12.4151 5.06372C7.43008 5.06372 3.37717 9.04101 3.27798 13.9845C3.17536 19.0945 7.98653 23.5318 13.1154 23.5318H13.7605C18.2822 23.5318 24.3426 20.0047 25.2895 15.7072C25.4643 14.9151 24.8364 14.1704 24.0223 14.1704ZM8.74752 14.3945C8.74752 15.0671 8.19544 15.6172 7.52045 15.6172C6.84545 15.6172 6.29341 15.0669 6.29341 14.3945V12.4165C6.29341 11.7439 6.84545 11.1938 7.52045 11.1938C8.19544 11.1938 8.74752 11.7439 8.74752 12.4165V14.3945ZM13.0083 14.3945C13.0083 15.0671 12.4563 15.6172 11.7813 15.6172C11.1063 15.6172 10.5543 15.0669 10.5543 14.3945V12.4165C10.5543 11.7439 11.1065 11.1938 11.7813 11.1938C12.4563 11.1938 13.0083 11.7439 13.0083 12.4165V14.3945Z",fill:"url(#paint1_linear_1765_9937)"}),(0,$e.jsxs)("defs",{children:[(0,$e.jsxs)("linearGradient",{id:"paint0_linear_1765_9937",x1:"14",y1:"0",x2:"14",y2:"28",gradientUnits:"userSpaceOnUse",children:[(0,$e.jsx)("stop",{stopColor:"#534BB1"}),(0,$e.jsx)("stop",{offset:"1",stopColor:"#551BF9"})]}),(0,$e.jsxs)("linearGradient",{id:"paint1_linear_1765_9937",x1:"14.2976",y1:"5.06372",x2:"14.2976",y2:"23.5318",gradientUnits:"userSpaceOnUse",children:[(0,$e.jsx)("stop",{stopColor:"white"}),(0,$e.jsx)("stop",{offset:"1",stopColor:"white",stopOpacity:"0.82"})]})]})]});var on=class extends Se{constructor(){super("phantom");this.connectorType="injected";this.proxyProvider=new J,this.subscribeListeners(),this.proxyProvider.setWalletProvider(window.phantom.ethereum),this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:"Phantom",icon:ct}}disconnect(){console.warn("Phantom does not support programmatic disconnect.")}async promptConnection(){try{let o=await this.proxyProvider.request({method:"eth_requestAccounts"});await this.syncAccounts(o)}catch(o){throw lt(o)}}};var Cs=require("@walletconnect/ethereum-provider"),an=T(require("@walletconnect/qrcode-modal")),sn=require("react-device-detect");var et=require("react");var ps=require("react/jsx-runtime");function ds(e){return(0,ps.jsx)("link",{rel:"prefetch",href:e.src})}var rn=require("react/jsx-runtime"),_t="LANDING",us=(0,et.createContext)({ready:!1,app:null,currentScreen:_t,lastScreen:_t,navigate:P,navigateBack:P,setModalData:P}),ms=e=>{var h,E,w;let t=e.appConfig,o=e.authenticated,r=e.visible,[n,i]=(0,et.useState)(e.initialScreen||_t),[a,l]=(0,et.useState)(e.initialScreen||_t);(0,et.useEffect)(()=>{o||i(_t)},[o]),(0,et.useEffect)(()=>{r||(l(_t),i(_t))},[r]),(0,et.useEffect)(()=>{e.initialScreen&&n===_t&&(i(e.initialScreen),l(e.initialScreen))},[e.initialScreen]);let s=e.initialScreen&&n===_t?e.initialScreen:n,u={ready:!!(t!=null&&t.id),app:t,data:e.data,setModalData:e.setModalData,currentScreen:s,lastScreen:a,navigate:m=>{l(n),i(m)},navigateBack:()=>{i(a)}};return(0,rn.jsxs)(us.Provider,{value:u,children:[(typeof((h=t==null?void 0:t.appearance)==null?void 0:h.logo)=="string"||((w=(E=t==null?void 0:t.appearance)==null?void 0:E.logo)==null?void 0:w.type)==="img")&&(0,rn.jsx)(ds,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},b=()=>(0,et.useContext)(us);var At=require("react/jsx-runtime"),Ro=({style:e,...t})=>{let{app:o}=b();return(0,At.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,At.jsx)("rect",{width:"28",height:"28",rx:"3",fill:(o==null?void 0:o.appearance.palette.colorScheme)==="dark"?"#3396ff":"#141414"}),(0,At.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,At.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,At.jsx)("defs",{children:(0,At.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,At.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var no=require("react-device-detect");var nn=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[o,r]of Object.entries(fs))if(r.hostname===t)return{walletClientType:o,entry:r}};var fs={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",image_id:"5195e9db-94d8-4579-6f11-ef553be95100",hostname:"metamask.io",mobile:{native:"metamask:"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",image_id:"0528ee7e-16d1-4089-21e3-bbfb41933100",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",image_id:"a1cb2777-f8f9-49b0-53fd-443d20ee0b00",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",image_id:"7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",hostname:"rainbow.me",mobile:{universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",image_id:"bff9cf1f-df19-42ce-f62a-87f04df13c00",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",image_id:"f216b371-96cf-409a-9d88-296392b85800",hostname:"zerion.io",mobile:{universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",image_id:"215158d2-614b-49c9-410f-77aa661c3900",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",image_id:"1bf33a89-b049-4a1c-d1f6-4dd7419ee400",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",image_id:"2cd67b4c-282b-4809-e7c0-a88cd5116f00",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",image_id:"7c5ff577-a68d-49c5-02cd-3d83637b0b00",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",image_id:"6f913b80-86c0-46f9-61ca-cc90a1805900",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",image_id:"252753e7-b783-4e03-7f77-d39864530900",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",image_id:"3f7075d0-4ab7-4db5-404d-3e4c05e6fe00",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",image_id:"cfc07342-23ea-4f3f-f071-ec9d2cd86b00",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",image_id:"52b1da3c-9e72-40ae-5dac-6142addd9c00",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",image_id:"ebac7b39-688c-41e3-7912-a4fefba74600",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",image_id:"4c16cad4-cac9-4643-6726-c696efaf5200",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",image_id:"e2024511-2c9b-46d7-3111-52df3d241700",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",image_id:"5b1cddfb-056e-4e78-029a-54de5d70c500",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",image_id:"dda0f0fb-34e8-4a57-dcea-b008e7d1ff00",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",image_id:"26a8f588-3231-4411-60ce-5bb6b805a700",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",image_id:"4725dda0-4471-4d0f-7adf-6bbe8b929c00",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",image_id:"61abe2ca-b06d-4a8b-de3e-8326f523e900",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",image_id:"c39b3a16-1a38-4588-f089-cb7aeb584700",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",image_id:"204b2240-5ce4-4996-6ec4-f06a22726900",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",image_id:"fc460647-ea95-447a-99f0-1bff8fa4be00",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",image_id:"f9854c79-14ba-4987-42e1-4a82abbf5700",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",image_id:"f78dab27-7165-4a3d-fdb1-fcff06c0a700",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",image_id:"79285c9f-2630-451e-0680-c71b42fb7400",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",image_id:"2d8006c3-852b-458a-d6b0-916c5ba76800",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",image_id:"339b9e9d-e2a7-46eb-4ed3-272321257a00",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",image_id:"cae1be94-9f53-4eba-b915-f6e381d5a500",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",image_id:"7eec7187-3f48-4fda-53bb-b0ad55749a00",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",image_id:"add9626b-a5fa-4c12-178c-e5584e6dcd00",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",image_id:"c268e78d-ffb0-4c8b-5cad-04c3add48500",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",image_id:"a7106965-91cc-4a73-4688-c5c72ae0ed00",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",image_id:"f90bc33f-f085-40cf-7538-fae5ae84f900",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",image_id:"691c0716-5213-4b99-e837-079268313800",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",image_id:"a5d9dd15-8cef-42de-8bed-09e01a8b0200",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",image_id:"b57b2163-1bd8-4f6b-3311-470767e6d200",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",image_id:"3ccbd966-97e8-45a0-1ceb-6141a8978e00",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",image_id:"6487869b-1165-4f30-aa3a-115665be8300",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",image_id:"10c75467-6612-48ad-b97b-63985e922200",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",image_id:"363fae03-882a-4d81-a721-6e6f6e9ac500",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",image_id:"32e89601-0490-42fc-0cc4-8627d62a2000",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",image_id:"98183be0-3125-45ee-a6b6-fbd47ebefd00",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",image_id:"75dd1471-77e9-4811-ce57-ec8fc980ec00",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",image_id:"374258d3-c749-4f37-7815-77e61f798c00",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",image_id:"ea0140c7-787c-43a4-838f-d5ab6a342000",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}}},ys=(e,t="md")=>`https://registry.walletconnect.com/v2/logo/${t}/${e}`;function vi(e){return{name:e.displayName||"",universalLink:e.mobile.universal||"",deepLink:e.mobile.native||""}}function md(e){let t="mobile";return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>vi(o))}function gs(){return md(fs)}function vs(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${e}`:""}function bs(e,t){return no.isAndroid?e:vs(e,vi(t))}var ws="WALLETCONNECT_DEEPLINK_CHOICE";function hs(e){let t=e.href.split("?")[0];Z.put(ws,{...e,href:t})}var sr=(e,t)=>{if(!e||no.isDesktop){Z.del(ws);return}if(no.isAndroid){hs({name:"Unknown",href:t||"wc:"});return}else if(no.isMobileOnly){let o=vs(t||"wc:",vi(e));hs({name:(e==null?void 0:e.displayName)||"",href:o})}};var lr=class extends Se{constructor(o,r){super(r||"unknown");this.connectorType="wallet_connect_v2";this.walletConnectCloudProjectId=o,this.proxyProvider=new J,this.createProvider().then(n=>{var i,a;if(this.provider=n,this.proxyProvider.setWalletProvider(n),this.subscribeListeners(),n.session){if((i=this.walletProvider.session)!=null&&i.peer.metadata.url){let l=nn((a=this.walletProvider.session)==null?void 0:a.peer.metadata.url);this.walletEntry=l==null?void 0:l.entry,this.walletClientType=(l==null?void 0:l.walletClientType)||"unknown",sr(this.walletEntry)}this.connected=!0,this.syncAccounts().then(()=>{this.emit("initialized"),this.initialized=!0})}else this.emit("initialized"),this.initialized=!0})}async connect(o){return o.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return this.walletProvider.connected}get walletBranding(){var o,r,n;return this.walletEntry?{name:this.walletEntry.displayName,icon:this.walletClientType==="metamask"?be:ys(this.walletEntry.image_id)}:{name:pi(((o=this.walletProvider.session)==null?void 0:o.peer.metadata.name)||"")||"WalletConnect",icon:((n=(r=this.walletProvider.session)==null?void 0:r.peer.metadata.icons)==null?void 0:n[0])||Ro}}resetConnection(){this.walletProvider.connected&&(this.walletProvider.signer.session=void 0,this.walletEntry=void 0,sr(void 0),this.onDisconnect())}async promptConnection(){if(!!this.provider)return new Promise((o,r)=>{let n=()=>{r(new _o)};this.onQrModalClosed=n,(async()=>{var s,u;let a="",l=await Promise.race([this.walletProvider.enable(),fi()]);if(l.length>0&&(a=l[0]),!a||a==="")throw new Y("Unable to retrieve address");if((s=this.walletProvider.session)!=null&&s.peer.metadata.url){let h=nn((u=this.walletProvider.session)==null?void 0:u.peer.metadata.url);this.walletEntry=h==null?void 0:h.entry,this.walletClientType=(h==null?void 0:h.walletClientType)||"unknown"}this.connected=!0,await this.syncAccounts(l),o()})().catch(a=>{if(a){r(lt(a));return}r(new Y("Unknown error during connection"))}).finally(()=>an.default.close())})}disconnect(){this.walletProvider.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(o){this.proxyProvider.setWalletProvider(o)}async createProvider(){var n,i;let o={};for(let a of rr){let l=(i=(n=a.rpcUrls.infura)==null?void 0:n.http)==null?void 0:i[0];l&&(o[a.id]=l+"/"+Eo)}let r=await Cs.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:[1],optionalChains:rr.map(a=>a.id),rpcMap:o,showQrModal:!1});return r.on("display_uri",a=>{if(sn.isAndroid)window.open(a,"_self");else if(sn.isMobile&&this.walletEntry){sr(this.walletEntry,a);let s=bs(a,this.walletEntry);window.open(s,"_self","noopener,noreferrer")}else an.default.open(a,()=>{this.onQrModalClosed&&this.onQrModalClosed()},{mobileLinks:gs().map(l=>l.name)})}),r.on("connect",()=>{var a,l;if(an.default.close(),(a=r.session)!=null&&a.peer.metadata.url){let s=nn((l=r.session)==null?void 0:l.peer.metadata.url);this.walletEntry=s==null?void 0:s.entry,this.walletClientType=(s==null?void 0:s.walletClientType)||"unknown",sr(this.walletEntry)}}),r}async enableProvider(){return this.walletProvider.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider.enable()}};var wi=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses");return t?!!(e==null?void 0:e.linkedAccounts.filter(r=>r.type=="wallet"&&r.address===(0,bi.getAddress)(t)).length):!1},Io=class extends Es.default{constructor(o){super();this.getEthereumProvider=()=>{let o=this.wallets[0],r=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===(o==null?void 0:o.address)));return!o||!r?new J:r.proxyProvider};this.walletConnectCloudProjectId=o,this.walletConnectors=[],this.initialized=!1,this.storedConnections=this.loadConnectionHistory()}get wallets(){let o=new Set,r=this.walletConnectors.flatMap(i=>i.wallets).sort((i,a)=>i.connectedAt&&a.connectedAt?a.connectedAt-i.connectedAt:0).filter(i=>{let a=`${i.address}${i.walletClientType}${i.connectorType}`;return o.has(a)?!1:(o.add(a),!0)}),n=r.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&r.unshift(r.splice(n,1)[0]),r}initialize(){this.initialized||(Z.get(si)&&(Z.getKeys().forEach(o=>{o.startsWith("walletconnect")&&Z.del(o)}),Z.del(si)),Xa().then(o=>o.forEach(r=>{switch(r){case"metamask":this.createWalletConnector("injected","metamask");break;case"phantom":this.createWalletConnector("injected","phantom");break;case"unknown":default:break}})),(Bt()||Z.getKeys().find(o=>o.startsWith("-walletlink")))&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),this.createWalletConnector("wallet_connect_v2","unknown"),this.initialized=!0)}findWalletConnector(o,r){return o==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===o)||null:this.walletConnectors.find(n=>n.connectorType===o&&n.walletClientType===r)||null}onInitialized(o){o.wallets.forEach(r=>{let n=this.storedConnections.find(i=>i.address===r.address&&i.connectorType===r.connectorType&&i.walletClientType===r.walletClientType);n&&(r.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated")}onWalletsUpdated(o){o.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(o,r){if(!this.findWalletConnector("embedded","privy")){let i=new Qr(o,r),a=new en(i);this.addWalletConnector(a)}}removeEmbeddedWalletConnector(){let o=this.findWalletConnector("embedded","privy");if(o){let r=this.walletConnectors.indexOf(o);this.walletConnectors.splice(r,1),this.saveConnectionHistory(),this.emit("walletsUpdated")}}async createWalletConnector(o,r){let n=this.findWalletConnector(o,r);if(n)return n instanceof lr&&n.resetConnection(),n;let a=(()=>{switch(o){case"injected":switch(r){case"phantom":return ze()?new on:null;case"metamask":default:return nr()?new tn:null}case"coinbase_wallet":return new Xr;case"wallet_connect_v2":return new lr(this.walletConnectCloudProjectId)}})();return a&&this.addWalletConnector(a),a||null}addWalletConnector(o){this.walletConnectors.push(o),o.on("initialized",()=>this.onInitialized(o)),o.on("walletsUpdated",()=>this.onWalletsUpdated(o))}loadConnectionHistory(){let o=a=>a&&typeof a.address=="string"&&typeof a.connectorType=="string"&&typeof a.walletClientType=="string"&&typeof a.connectedAt=="number",r=Z.get(li);return r&&Array.isArray(r)&&r.map(a=>o(a)).every(Boolean)?r:[]}saveConnectionHistory(){let o=this.wallets.map(r=>({address:r.address,connectorType:r.connectorType,walletClientType:r.walletClientType,connectedAt:r.connectedAt}));Z.put(li,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,bi.getAddress)(o),this.emit("walletsUpdated")}};function Zr(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==null?void 0:r.address)!==(n==null?void 0:n.address)||(r==null?void 0:r.chainId)!==(n==null?void 0:n.chainId)||(r==null?void 0:r.connectorType)!==(n==null?void 0:n.connectorType)||(r==null?void 0:r.connectedAt)!==(n==null?void 0:n.connectedAt)||(r==null?void 0:r.walletClientType)!==(n==null?void 0:n.walletClientType)||(r==null?void 0:r.isConnected)!==(n==null?void 0:n.isConnected)||(r==null?void 0:r.linked)!==(n==null?void 0:n.linked))return!1}return!0}var xs=require("ofetch");var hd=[Hr(),zr()],ln=class{constructor(t,o,r){this.appId=t,this.sdkVersion=$r,this.client=o,this.defaults=r,this.fallbackApiUrl=o.fallbackApiUrl,this.baseFetch=xs.ofetch.create({baseURL:this.defaults.baseURL,credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=!hd.includes(n.toString());if(!a.has("authorization")&&l){let s=await this.client.getAccessToken();s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.signal||(i.signal=AbortSignal.timeout(this.defaults.timeout))},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new Gr}})}async get(t,o){try{return await this.baseFetch(t,o)}catch(r){throw ce(r)}}async post(t,o,r){try{return await this.baseFetch(t,{method:"POST",...o?{body:o}:{},...r})}catch(n){throw ce(n)}}async delete(t,o){try{return await this.baseFetch(t,{method:"DELETE",...o})}catch(r){throw ce(r)}}};var cr=T(require("js-cookie"));function Ts(e){return e instanceof Xt?"email":e instanceof to?"sms":e instanceof eo?"siwe":e instanceof Dt?e.meta.provider:null}var dt=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 Ps=T(require("jose")),pt=class{static parse(t){try{return new pt(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Ps.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 fd=30,cn=class{constructor(){this.authenticateOnce=new dt(async t=>this._authenticate(t)),this.linkOnce=new dt(async t=>this._link(t)),this.refreshOnce=new dt(this._refresh.bind(this)),this.destroyOnce=new dt(this._destroy.bind(this)),this.forkSessionOnce=new dt(this._forkSession.bind(this))}get token(){try{let t=Z.get(xo);return typeof t=="string"?new pt(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=Z.get(qr);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=Z.get(or);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}hasRefreshCredentials(){return typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=pt.parse(this.token);return t!==null&&!t.isExpired(fd)}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=Ts(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:xt(n),isNewUser:i}}catch(o){throw console.warn("Error authenticating session"),Ge(o)}}async _link(t){try{let o=await t.link();return xt(o)}catch(o){throw console.warn("Error linking account"),Ge(o)}}async _refresh(){if(!this.api)throw new A("Session has no API instance");if(!this.client)throw new A("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)n=await this.api.post(Hr(),{refresh_token:o},{headers:{authorization:`Bearer ${t}`}}),r&&this.clearForkedToken();else if(r)n=await this.api.post(zr(),{refresh_token:r}),this.clearForkedToken();else return null;return this.storeToken(n.token),this.storeRefreshToken(n.refresh_token),xt(n.user)}catch(n){if(n instanceof wo&&n.status===400&&n.message==="Invalid auth token")return this.destroyLocalState(),null;throw Ge(n)}}async _destroy(){var t;try{await((t=this.api)==null?void 0:t.post(ua(),{refresh_token:this.refreshToken}))}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new A("Session has no API instance");let t=this.refreshToken;try{let o=await this.api.post(ma(),{refresh_token:t});return this.storeToken(o.token),this.storeRefreshToken(o.refresh_token),o.new_session_refresh_token}catch(o){throw Ge(o)}}destroyLocalState(){this.storeToken(null),this.storeRefreshToken(null),this.clearForkedToken()}storeToken(t){var o;if(typeof t=="string"){Z.put(xo,t);let r=(o=pt.parse(t))==null?void 0:o.expiration;cr.default.set(ii,t,{sameSite:"Strict",secure:!0,expires:r?new Date(r*1e3):void 0})}else Z.del(xo),cr.default.remove(ii)}storeRefreshToken(t){typeof t=="string"?(Z.put(qr,t),cr.default.set(ai,t,{sameSite:"Strict",secure:!0,expires:30})):(Z.del(qr),cr.default.remove(ai))}clearForkedToken(){Z.del(or)}};var Ci,Wo=class{constructor(t){this.apiUrl=t.apiUrl||Vr,this.fallbackApiUrl=this.apiUrl,this.timeout=t.timeout||Na,this.appId=t.appId,this.clientAnalyticsId=typeof window>"u"?null:crypto.randomUUID(),Ci||(Ci=new cn),this.session=Ci,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager(t){this.connectors||(this.connectors=new Io(t))}generateApi(){let t=new ln(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()}authenticate(){if(!this.authFlow)throw new A("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new A("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){t.api=this.api,this.authFlow=t}async unlinkEmail(t){try{let o=await this.api.post(Aa(),{address:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkPhone(t){try{let o=await this.api.post(Sa(),{phoneNumber:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkWallet(t){try{let o=await this.api.post(_a(),{address:t});return xt(o)}catch(o){throw Ge(o)}}async unlinkOAuth(t,o){try{let r=await this.api.post(ka(),{provider:t,subject:o});return xt(r)}catch(r){throw Ge(r)}}async createAnalyticsEvent(t,o,r){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.error("No client analytics id set, refusing to send analytics event"),await this.api.post(Ra(),{event_name:t,client_id:this.clientAnalyticsId,payload:{...o||{},clientTimestamp:r?r.toISOString():new Date().toISOString()}})}catch(n){console.error("Failed to create analytics event",n)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){var o;return this.session.hasActiveToken()?((o=pt.parse(this.session.token))==null?void 0:o.audience)!==this.appId?(await this.logout(),null):this.session.token:!(t!=null&&t.disableAutoRefresh)&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){var t,o;try{let r=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl});return{id:r.id,name:r.name,verificationKey:r.verification_key,logoUrl:r.logo_url||void 0,accentColor:r.accent_color||void 0,showWalletLoginFirst:r.show_wallet_login_first,allowlistConfig:{errorTitle:r.allowlist_config.error_title,errorDetail:r.allowlist_config.error_detail,errorCtaText:r.allowlist_config.cta_text,errorCtaLink:r.allowlist_config.cta_link},walletAuth:r.wallet_auth,emailAuth:r.email_auth,smsAuth:r.sms_auth,googleOAuth:r.google_oauth,twitterOAuth:r.twitter_oauth,discordOAuth:r.discord_oauth,githubOAuth:r.github_oauth,appleOAuth:r.apple_oauth,termsAndConditionsUrl:r.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:(t=r.embedded_wallet_config)==null?void 0:t.create_on_login,requireUserPasswordOnCreate:(o=r.embedded_wallet_config)==null?void 0:o.require_user_password_on_create},privacyPolicyUrl:r.privacy_policy_url,customApiUrl:r.custom_api_url,walletConnectCloudProjectId:r.wallet_connect_cloud_project_id,createdAt:new Date(r.created_at*1e3),updatedAt:new Date(r.updated_at*1e3)}}catch(r){throw Ge(r)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t}`);return}}async forkSession(){return await this.session.forkSession()}};var j4=require("wicg-inert"),Yn=require("body-scroll-lock"),Qn=require("react"),sa=require("react"),Mc=T(require("react-dom")),Zn=T(require("styled-components"));var dn=require("react");var Ei=(0,dn.createContext)({isNewUserThisSession:!1,isLinking:!1,linkingHint:null,walletConnectionStatus:null,getAuthMeta:P,getAuthFlow:P,closePrivyModal:P,connectWallet:P,initLoginWithWallet:P,loginWithWallet:P,loginWithCode:P,initLoginWithEmail:P,initLoginWithSms:P,resendEmailCode:P,resendSmsCode:P,initLoginWithOAuth:P,loginWithOAuth:P,refreshUser:P,walletProxy:null,createAnalyticsEvent:P,getUsdTokenPrice:P,recoverEmbeddedWallet:P}),W=()=>(0,dn.useContext)(Ei);var pn=require("react");var xi=(0,pn.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:P,login:P,linkEmail:P,linkPhone:P,linkWallet:P,linkGoogle:P,linkTwitter:P,linkDiscord:P,linkGithub:P,linkApple:P,logout:P,getAccessToken:P,getEthereumProvider:P,getEthersProvider:P,getWeb3jsProvider:P,unlinkEmail:P,unlinkPhone:P,unlinkWallet:P,unlinkGoogle:P,unlinkTwitter:P,unlinkDiscord:P,unlinkGithub:P,unlinkApple:P,setActiveWallet:P,forkSession:P,createWallet:P,signMessage:P,sendTransaction:P,exportWallet:P}),G=()=>(0,pn.useContext)(xi);var yn=T(require("styled-components"));var St=T(require("styled-components"));var un=T(require("styled-components")),Ht=require("react/jsx-runtime"),mn=({success:e,fail:t})=>(0,Ht.jsxs)(Ht.Fragment,{children:[(0,Ht.jsx)(dr,{className:e?"success":t?"fail":""}),(0,Ht.jsx)(yd,{className:e?"success":t?"fail":""})]}),dr=un.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
|
-
`,yd=(0,un.default)(
|
|
45
|
+
`,yd=(0,un.default)(dr)`
|
|
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
|
-
`,tt=e=>(0,Ht.jsx)(gd,{color:e.color||"var(--privy-color-background-2)"}),gd=(0,un.default)(
|
|
51
|
+
`,tt=e=>(0,Ht.jsx)(gd,{color:e.color||"var(--privy-color-background-2)"}),gd=(0,un.default)(dr)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -299,7 +299,7 @@ Resources:
|
|
|
299
299
|
left: -19px;
|
|
300
300
|
top: -19px;
|
|
301
301
|
}
|
|
302
|
-
`;var zt=require("react"),Ds=require("react-device-detect"),Lo=T(require("styled-components"));var
|
|
302
|
+
`;var zt=require("react"),Ds=require("react-device-detect"),Lo=T(require("styled-components"));var pr=T(require("styled-components")),Ce=pr.default.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
flex-direction: column;
|
|
305
305
|
align-items: flex-start;
|
|
@@ -307,16 +307,16 @@ Resources:
|
|
|
307
307
|
margin-top: auto;
|
|
308
308
|
gap: 16px;
|
|
309
309
|
flex-grow: 100;
|
|
310
|
-
`,io=
|
|
310
|
+
`,io=pr.default.div`
|
|
311
311
|
display: flex;
|
|
312
312
|
flex-direction: column;
|
|
313
313
|
align-items: center;
|
|
314
314
|
justify-content: center;
|
|
315
315
|
height: 100%;
|
|
316
316
|
width: 100%;
|
|
317
|
-
`,No=(0,
|
|
317
|
+
`,No=(0,pr.default)(io)`
|
|
318
318
|
gap: 16px;
|
|
319
|
-
`,k1=
|
|
319
|
+
`,k1=pr.default.div`
|
|
320
320
|
display: flex;
|
|
321
321
|
flex-direction: column;
|
|
322
322
|
width: 100%;
|
|
@@ -353,9 +353,9 @@ Resources:
|
|
|
353
353
|
@media (max-width: 440px) {
|
|
354
354
|
display: ${e=>e.hideOnMobile?"none":"inherit"};
|
|
355
355
|
}
|
|
356
|
-
`;var
|
|
356
|
+
`;var ur=T(require("styled-components")),je=require("react/jsx-runtime"),Ee=({title:e,description:t,children:o,...r})=>(0,je.jsx)(Ms,{...r,children:(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)("h3",{children:e}),typeof t=="string"?(0,je.jsx)("p",{children:t}):t,o]})}),ut=(0,ur.default)(Ee)`
|
|
357
357
|
margin-bottom: 24px;
|
|
358
|
-
`,Ke=({title:e,description:t,icon:o,children:r,...n})=>(0,je.jsxs)(Sd,{...n,children:[o?(0,je.jsx)(kd,{children:o}):null,(0,je.jsx)("h3",{children:e}),typeof t=="string"?(0,je.jsx)("p",{children:t}):null,r]}),Ms=
|
|
358
|
+
`,Ke=({title:e,description:t,icon:o,children:r,...n})=>(0,je.jsxs)(Sd,{...n,children:[o?(0,je.jsx)(kd,{children:o}):null,(0,je.jsx)("h3",{children:e}),typeof t=="string"?(0,je.jsx)("p",{children:t}):null,r]}),Ms=ur.default.div`
|
|
359
359
|
display: flex;
|
|
360
360
|
flex-direction: column;
|
|
361
361
|
justify-content: flex-start;
|
|
@@ -375,7 +375,7 @@ Resources:
|
|
|
375
375
|
color: var(--privy-color-foreground-2);
|
|
376
376
|
font-size: 14px;
|
|
377
377
|
}
|
|
378
|
-
`,Sd=(0,
|
|
378
|
+
`,Sd=(0,ur.default)(Ms)`
|
|
379
379
|
align-items: center;
|
|
380
380
|
text-align: center;
|
|
381
381
|
gap: 16px;
|
|
@@ -383,7 +383,7 @@ Resources:
|
|
|
383
383
|
h3 {
|
|
384
384
|
margin-bottom: 24px;
|
|
385
385
|
}
|
|
386
|
-
`,kd=
|
|
386
|
+
`,kd=ur.default.div`
|
|
387
387
|
padding: 14px;
|
|
388
388
|
border-radius: 50%;
|
|
389
389
|
&& {
|
|
@@ -492,11 +492,11 @@ Resources:
|
|
|
492
492
|
word-break: break-all;
|
|
493
493
|
`;var vn=require("react"),Gs=T(require("styled-components"));var Bs=require("react-device-detect");var Fs=e=>{let t=new URL(window.location.href);if(!Bt()&&Bs.isMobile)return`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(`${t.href.replace(/\/$/g,"")}?privy_connector=coinbase_wallet&privy_wallet_client=coinbase_wallet${e?`&privy_token=${e}`:""}`)}`};var We=require("react/jsx-runtime"),Hs=()=>{let{forkSession:e,ready:t,authenticated:o}=G(),{closePrivyModal:r}=W(),[n,i]=(0,vn.useState)("");(0,vn.useEffect)(()=>{t&&o&&e().then(s=>i(s))},[o,t]);let a=Fs(n),l={title:"Redirecting to Coinbase Wallet",description:"We'll take you to the Coinbase Wallet app to continue your login experience.",footnote:""};return t&&o&&(l.description="For the best experience, we'll automatically log you into the Coinbase Wallet in-app browser.",l.footnote="Once you're done, you can always return here and refresh to view your updated account."),(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(_,{},"header"),(0,We.jsx)(ut,{title:l.title,description:l.description}),(0,We.jsxs)(Ce,{children:[(0,We.jsx)(Od,{children:(0,We.jsx)(Ve,{style:{width:"72px",height:"72px"}})}),(0,We.jsx)(hn,{href:a,onClick:()=>{r()},loading:t&&o&&!n,children:"Continue"}),l.footnote?(0,We.jsx)("p",{children:l.footnote}):null]}),(0,We.jsx)(F,{protectedByPrivy:!0})]})},Od=(0,Gs.default)(io)`
|
|
494
494
|
margin: 16px auto;
|
|
495
|
-
`;var
|
|
495
|
+
`;var mr=require("react-device-detect"),ki=T(require("styled-components"));var zs=T(require("styled-components")),Vs=zs.default.span`
|
|
496
496
|
@media (max-width: 440px) {
|
|
497
497
|
display: none;
|
|
498
498
|
}
|
|
499
|
-
`;var ae=require("react/jsx-runtime"),Vt=({connectOnly:e})=>{let{navigate:t}=b(),{initLoginWithWallet:o,connectWallet:r}=W();return(0,ae.jsxs)(Dd,{children:[(0,ae.jsxs)(bn,{onClick:()=>{
|
|
499
|
+
`;var ae=require("react/jsx-runtime"),Vt=({connectOnly:e})=>{let{navigate:t}=b(),{initLoginWithWallet:o,connectWallet:r}=W();return(0,ae.jsxs)(Dd,{children:[(0,ae.jsxs)(bn,{onClick:()=>{nr()?e?(r("injected","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","metamask"),t("AWAITING_CONNECTION")):mr.isMobile?e?(r("wallet_connect_v2","metamask"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","metamask"),t("AWAITING_CONNECTION")):t("INSTALL_METAMASK_SCREEN")},children:[(0,ae.jsx)(be,{}),(0,ae.jsx)("span",{children:"Metamask"}),(0,ae.jsx)("span",{children:nr()?"Connect":"Install"})]}),(0,ae.jsxs)(bn,{onClick:()=>{Bt()?e?(r("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECTION")):mr.isMobile?t("COINBASE_INTERSTITIAL_SCREEN"):e?(r("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("coinbase_wallet","coinbase_wallet"),t("AWAITING_CONNECTION"))},children:[(0,ae.jsx)(Ve,{}),(0,ae.jsxs)("span",{children:["Coinbase",(0,ae.jsx)(Vs,{children:" Wallet"})]}),(0,ae.jsx)("span",{children:"Connect"})]}),(mr.isMobile||ze())&&(0,ae.jsxs)(bn,{id:"privy-phantom-button",onClick:()=>{ze()?e?(r("injected","phantom"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("injected","phantom"),t("AWAITING_CONNECTION")):t(mr.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")},children:[(0,ae.jsx)(ct,{}),(0,ae.jsx)("span",{children:"Phantom"}),(0,ae.jsx)("span",{children:ze()?"Connect":"Install"})]}),(0,ae.jsxs)(bn,{onClick:()=>{e?(r("wallet_connect_v2","unknown"),t("AWAITING_CONNECT_ONLY_CONNECTION")):(o("wallet_connect_v2","unknown"),t("AWAITING_CONNECTION"))},children:[(0,ae.jsx)(Ro,{}),(0,ae.jsx)("span",{children:"WalletConnect"}),(0,ae.jsx)("span",{children:"Connect"})]})]})},Dd=ki.default.div`
|
|
500
500
|
display: flex;
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
align-items: flex-start;
|
|
@@ -555,7 +555,7 @@ Resources:
|
|
|
555
555
|
display: none;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
`;var $s=T(require("styled-components"));var
|
|
558
|
+
`;var $s=T(require("styled-components"));var hr=require("react/jsx-runtime"),$t=()=>{let{navigate:e}=b();return(0,hr.jsxs)(Ud,{children:[(0,hr.jsx)("span",{children:"Don\u2019t have a wallet? "}),(0,hr.jsx)("button",{onClick:()=>{e("WALLET_EDUCATION")},children:"Create one now."})]})},Ud=$s.default.div`
|
|
559
559
|
font-size: 13px;
|
|
560
560
|
color: var(--privy-color-foreground-3);
|
|
561
561
|
|
|
@@ -602,7 +602,7 @@ Resources:
|
|
|
602
602
|
@media (max-width: 440px) {
|
|
603
603
|
padding: 10px 10px 20px;
|
|
604
604
|
}
|
|
605
|
-
`;var Oo=require("react"),Ni=T(require("styled-components"));var mt=require("react"),xn=require("react-device-detect"),Tn=T(require("styled-components"));var Q=require("react/jsx-runtime"),En=2,
|
|
605
|
+
`;var Oo=require("react"),Ni=T(require("styled-components"));var mt=require("react"),xn=require("react-device-detect"),Tn=T(require("styled-components"));var Q=require("react/jsx-runtime"),En=2,fr={metamask:{name:"MetaMask",component:be},phantom:{name:"Phantom",component:ct},coinbase_wallet:{name:"Coinbase Wallet",component:Ve},wallet_connect:{name:"WalletConnect",component:Ro},embedded:{name:"Privy Wallet",component:ko}},Ii=e=>(e==null?void 0:e.privyErrorCode)==="linked_to_another_user"?Tt.ERROR_USER_EXISTS:e instanceof Ao&&!e.details.default?e.details:e instanceof Po?Tt.ERROR_TIMED_OUT:e instanceof _o?Tt.ERROR_USER_REJECTED_CONNECTION:Tt.ERROR_WALLET_CONNECTION,Ys=()=>{var Mt,pe,ue,Ot,yo,Jo,go,Dr,Xo,Ur,Br;let[e,t]=(0,mt.useState)(!1),[o,r]=(0,mt.useState)(!1),[n,i]=(0,mt.useState)(void 0),{app:a,navigate:l,navigateBack:s,lastScreen:u,currentScreen:h,setModalData:E}=b(),{getAuthFlow:w,walletConnectionStatus:m,closePrivyModal:f,loginWithWallet:p}=W(),{walletConnectors:C}=G(),[S,N]=(0,mt.useState)(0),{user:x}=G(),[k]=(0,mt.useState)((x==null?void 0:x.linkedAccounts.length)||0),I=w(),O=xn.isMobile&&((Mt=m==null?void 0:m.connector)==null?void 0:Mt.connectorType)==="wallet_connect_v2"||xn.isMobile&&((pe=m==null?void 0:m.connector)==null?void 0:pe.connectorType)==="coinbase_wallet"||xn.isMobile&&((ue=m==null?void 0:m.connector)==null?void 0:ue.connectorType)==="injected"&&((Ot=m==null?void 0:m.connector)==null?void 0:Ot.walletClientType)==="phantom",L=(m==null?void 0:m.status)==="connected";(0,mt.useEffect)(()=>{if(I&&O&&L&&!I.preparedMessage){I.buildSiweMessage();return}!I||O||!L||(r(!0),i(void 0),X().catch(se=>console.warn("Auto-prompted signature failed",se)).finally(()=>r(!1)))},[S,L]),(0,mt.useEffect)(()=>{var se;if(x&&e){let Jt;if(Co(x,(se=a==null?void 0:a.embeddedWallets)==null?void 0:se.createOnLogin)){let ri=a!=null&&a.render.inDialog?Je:0,er=a!=null&&a.render.inDialog?ri-500:0;Jt=setTimeout(()=>{E({createWallet:{onSuccess:()=>{},onFailure:ca=>console.error(ca),callAuthOnSuccessOnClose:!0}}),l("EMBEDDED_WALLET_SCREEN")},er)}else Jt=setTimeout(f,Je);return()=>clearTimeout(Jt)}},[x,e]);let he=se=>{if((se==null?void 0:se.privyErrorCode)==="allowlist_rejected"){l("ALLOWLIST_REJECTION_SCREEN");return}i(Ii(se))};async function X(){try{if(await p(),!(a!=null&&a.render.inDialog))return f();t(!0)}catch(se){he(se)}finally{r(!1)}}(0,mt.useEffect)(()=>{m!=null&&m.connectError&&he(m==null?void 0:m.connectError)},[m]);let ge=((yo=m==null?void 0:m.connector)==null?void 0:yo.connectorType)||"metamask",ee=((Jo=m==null?void 0:m.connector)==null?void 0:Jo.walletClientType)||"metamask",R=((go=m==null?void 0:m.connector)==null?void 0:go.walletBranding.name)||((Dr=fr[ee])==null?void 0:Dr.name)||"Metamask",z=((Xo=m==null?void 0:m.connector)==null?void 0:Xo.walletBranding.icon)||((Ur=fr[ee])==null?void 0:Ur.component)||(se=>(0,Q.jsx)(be,{...se})),B=e?`Successfully connected with ${R}`:n?n.message:L?o&&O?"Signing":"Sign to verify":`Waiting for ${R}`,ne="Don\u2019t see your wallet modal? Check your other browser windows.";if(e){let se=(x==null?void 0:x.linkedAccounts.length)||0;k===se?ne="Wallet was already linked.":ne="You\u2019re good to go!"}else S>=En&&n?ne="Unable to connect wallet":n?ne=n.detail:L&&O?ne="Sign the message in your wallet to verify it belongs to you.":ee==="metamask"?ne="For the best experience, connect only one wallet at a time.":ge==="wallet_connect"?ne="Open your mobile wallet app to continue":ge==="coinbase_wallet"&&(Bt()||(wi(x)?ne="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":ne="Open the Coinbase app on your phone to continue."));let de=(Br=C==null?void 0:C.walletConnectors)==null?void 0:Br.find(se=>se.walletClientType==="coinbase_wallet"),Lt=ee==="coinbase_wallet"&&(wi(x)||n===Tt.ERROR_USER_EXISTS);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_,{backFn:h===u?void 0:s}),(0,Q.jsxs)(Hd,{children:[(0,Q.jsx)(Wi,{walletLogo:z,success:e,fail:!!n}),(0,Q.jsxs)(zd,{children:[(0,Q.jsx)("h3",{children:B}),(0,Q.jsx)("p",{children:ne})]}),(0,Q.jsx)(fn,{children:Lt?(0,Q.jsx)(fe,{onClick:()=>de&&(de==null?void 0:de.disconnect()),invisible:e,disabled:e,children:"Use a different wallet"}):n==Tt.ERROR_USER_EXISTS&&h!==u?(0,Q.jsx)(fe,{onClick:s,children:"Use a different wallet"}):L&&!e&&O?(0,Q.jsx)(fe,{onClick:()=>{r(!0),X()},disabled:o,children:o?"Signing":"Sign with your wallet"}):!e&&(n==null?void 0:n.retryable)&&S<En?(0,Q.jsx)(fe,{onClick:()=>{N(S+1),i(void 0),L?(r(!0),X()):m==null||m.connectRetry()},invisible:e||!(n!=null&&n.retryable)||S>=En,disabled:!e&&(!(n!=null&&n.retryable)||S>=En),children:"Retry"}):null})]})]})},Hd=Tn.default.div`
|
|
606
606
|
display: flex;
|
|
607
607
|
flex-direction: column;
|
|
608
608
|
align-items: center;
|
|
@@ -640,7 +640,7 @@ Resources:
|
|
|
640
640
|
left: -19px;
|
|
641
641
|
top: -19px;
|
|
642
642
|
}
|
|
643
|
-
`,Wi=e=>{let t=e.walletLogo;return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(Vd,{children:(0,Q.jsxs)("div",{children:[(0,Q.jsx)(mn,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Q.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Q.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var Pe=require("react/jsx-runtime"),Pn=2,Qs=()=>{var S,N,x,k,I,O;let{navigateBack:e,lastScreen:t,currentScreen:o}=b(),{walletConnectionStatus:r,closePrivyModal:n}=W(),[i,a]=(0,Oo.useState)(void 0),[l,s]=(0,Oo.useState)(0),u=(r==null?void 0:r.status)==="connected";(0,Oo.useEffect)(()=>{if(u){let L=setTimeout(n,Je);return()=>clearTimeout(L)}},[u]);let h=L=>{a(Ii(L))};(0,Oo.useEffect)(()=>{r!=null&&r.connectError&&h(r==null?void 0:r.connectError)},[r]);let E=((S=r==null?void 0:r.connector)==null?void 0:S.connectorType)||"metamask",w=((N=r==null?void 0:r.connector)==null?void 0:N.walletClientType)||"metamask",m=((x=r==null?void 0:r.connector)==null?void 0:x.walletBranding.name)||((k=
|
|
643
|
+
`,Wi=e=>{let t=e.walletLogo;return(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsx)(Vd,{children:(0,Q.jsxs)("div",{children:[(0,Q.jsx)(mn,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Q.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Q.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var Pe=require("react/jsx-runtime"),Pn=2,Qs=()=>{var S,N,x,k,I,O;let{navigateBack:e,lastScreen:t,currentScreen:o}=b(),{walletConnectionStatus:r,closePrivyModal:n}=W(),[i,a]=(0,Oo.useState)(void 0),[l,s]=(0,Oo.useState)(0),u=(r==null?void 0:r.status)==="connected";(0,Oo.useEffect)(()=>{if(u){let L=setTimeout(n,Je);return()=>clearTimeout(L)}},[u]);let h=L=>{a(Ii(L))};(0,Oo.useEffect)(()=>{r!=null&&r.connectError&&h(r==null?void 0:r.connectError)},[r]);let E=((S=r==null?void 0:r.connector)==null?void 0:S.connectorType)||"metamask",w=((N=r==null?void 0:r.connector)==null?void 0:N.walletClientType)||"metamask",m=((x=r==null?void 0:r.connector)==null?void 0:x.walletBranding.name)||((k=fr[w])==null?void 0:k.name)||"Metamask",f=((I=r==null?void 0:r.connector)==null?void 0:I.walletBranding.icon)||((O=fr[w])==null?void 0:O.component)||(L=>(0,Pe.jsx)(be,{...L})),p=u?`Successfully connected with ${m}`:i?i.message:`Waiting for ${m}`,C="Don\u2019t see your wallet modal? Check your other browser windows.";return u?C="You\u2019re good to go!":l>=Pn&&i?C="Unable to connect wallet":i?C=i.detail:w==="metamask"?C="For the best experience, connect only one wallet at a time.":E==="wallet_connect_v2"?C="Open your mobile wallet app to continue":E==="coinbase_wallet"&&(C="Open the Coinbase app on your phone to continue."),(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)(_,{backFn:o===t?void 0:e}),(0,Pe.jsxs)($d,{children:[(0,Pe.jsx)(Wi,{walletLogo:f,success:u,fail:!!i}),(0,Pe.jsxs)(qd,{children:[(0,Pe.jsx)("h3",{children:p}),(0,Pe.jsx)("p",{children:C})]}),(0,Pe.jsx)(fn,{children:i==Tt.ERROR_USER_EXISTS?(0,Pe.jsx)(fe,{onClick:e,children:"Use a different wallet"}):!u&&(i==null?void 0:i.retryable)&&l<Pn?(0,Pe.jsx)(fe,{onClick:()=>{s(l+1),a(void 0),r==null||r.connectRetry()},invisible:u||!(i!=null&&i.retryable)||l>=Pn,disabled:!u&&(!(i!=null&&i.retryable)||l>=Pn),children:"Retry"}):null})]})]})},$d=Ni.default.div`
|
|
644
644
|
display: flex;
|
|
645
645
|
flex-direction: column;
|
|
646
646
|
align-items: center;
|
|
@@ -655,20 +655,20 @@ Resources:
|
|
|
655
655
|
/* Very specifically chosen to be the height if 2 lines h3 and 1 line p.
|
|
656
656
|
If we then switch to 1 line h3 and 2 lines p, we don't resize. */
|
|
657
657
|
min-height: 76px;
|
|
658
|
-
`;var tl=require("@heroicons/react/24/solid"),Bo=require("react"),ol=T(require("styled-components"));var
|
|
658
|
+
`;var tl=require("@heroicons/react/24/solid"),Bo=require("react"),ol=T(require("styled-components"));var yr=T(require("styled-components")),Do=require("react/jsx-runtime"),Uo=({children:e})=>(0,Do.jsx)(jd,{children:(0,Do.jsxs)(Kd,{children:[e,(0,Do.jsx)(Yd,{}),(0,Do.jsx)(Qd,{})]})}),jd=yr.default.div`
|
|
659
659
|
height: 100%;
|
|
660
660
|
display: flex;
|
|
661
661
|
justify-content: center;
|
|
662
662
|
align-items: center;
|
|
663
663
|
flex-grow: 1;
|
|
664
|
-
`,Kd=
|
|
664
|
+
`,Kd=yr.default.div`
|
|
665
665
|
position: relative;
|
|
666
666
|
height: 160px;
|
|
667
667
|
width: 160px;
|
|
668
668
|
|
|
669
669
|
opacity: 1;
|
|
670
670
|
animation: fadein 200ms ease;
|
|
671
|
-
`,Yd=
|
|
671
|
+
`,Yd=yr.default.div`
|
|
672
672
|
position: absolute;
|
|
673
673
|
top: 0;
|
|
674
674
|
right: 0;
|
|
@@ -681,7 +681,7 @@ Resources:
|
|
|
681
681
|
border: 4px solid var(--privy-color-accent-light);
|
|
682
682
|
border-radius: 50%;
|
|
683
683
|
}
|
|
684
|
-
`,Qd=
|
|
684
|
+
`,Qd=yr.default.div`
|
|
685
685
|
position: absolute;
|
|
686
686
|
top: 0;
|
|
687
687
|
right: 0;
|
|
@@ -941,7 +941,7 @@ Resources:
|
|
|
941
941
|
transition: none;
|
|
942
942
|
}
|
|
943
943
|
`}
|
|
944
|
-
`;var vl=require("@heroicons/react/24/outline"),Rt=require("react"),Vo=T(require("styled-components"));var fl=require("react"),yl=T(require("styled-components"));var Sn=require("react/jsx-runtime"),hl=({color:e,...t})=>(0,Sn.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,Sn.jsx)("g",{children:(0,Sn.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
|
|
944
|
+
`;var vl=require("@heroicons/react/24/outline"),Rt=require("react"),Vo=T(require("styled-components"));var fl=require("react"),yl=T(require("styled-components"));var Sn=require("react/jsx-runtime"),hl=({color:e,...t})=>(0,Sn.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,Sn.jsx)("g",{children:(0,Sn.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 gr=require("react/jsx-runtime"),gl=e=>{let[t,o]=(0,fl.useState)(!1);return(0,gr.jsxs)(Cp,{onClick:()=>{o(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>o(!1),1500)},justCopied:t,children:[t?(0,gr.jsx)(Fo,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,gr.jsx)(hl,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},Cp=yl.default.button`
|
|
945
945
|
display: flex;
|
|
946
946
|
align-items: center;
|
|
947
947
|
gap: 6px;
|
|
@@ -1156,7 +1156,7 @@ Resources:
|
|
|
1156
1156
|
display: flex;
|
|
1157
1157
|
justify-content: center;
|
|
1158
1158
|
flex-grow: 1;
|
|
1159
|
-
`;var gt=require("react/jsx-runtime"),Nl=()=>{let{navigateBack:e}=b();return(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsx)(_,{backFn:e},"header"),(0,gt.jsx)(Vi,{}),(0,gt.jsxs)(ot,{children:[(0,gt.jsx)("span",{children:"Still not sure? "}),(0,gt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var vt=require("react/jsx-runtime"),Ll=()=>{let{navigateBack:e}=b();return(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(_,{backFn:e},"header"),(0,vt.jsx)(Hi,{}),(0,vt.jsxs)(ot,{children:[(0,vt.jsx)("span",{children:"Still not sure? "}),(0,vt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var bt=require("react/jsx-runtime"),Ml=()=>{let{navigateBack:e}=b();return(0,bt.jsxs)(bt.Fragment,{children:[(0,bt.jsx)(_,{backFn:e},"header"),(0,bt.jsx)(zi,{}),(0,bt.jsxs)(ot,{children:[(0,bt.jsx)("span",{children:"Still not sure? "}),(0,bt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var Ul=require("react"),Ji=require("react-device-detect"),lo=T(require("styled-components"));var $o=require("react"),
|
|
1159
|
+
`;var gt=require("react/jsx-runtime"),Nl=()=>{let{navigateBack:e}=b();return(0,gt.jsxs)(gt.Fragment,{children:[(0,gt.jsx)(_,{backFn:e},"header"),(0,gt.jsx)(Vi,{}),(0,gt.jsxs)(ot,{children:[(0,gt.jsx)("span",{children:"Still not sure? "}),(0,gt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var vt=require("react/jsx-runtime"),Ll=()=>{let{navigateBack:e}=b();return(0,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(_,{backFn:e},"header"),(0,vt.jsx)(Hi,{}),(0,vt.jsxs)(ot,{children:[(0,vt.jsx)("span",{children:"Still not sure? "}),(0,vt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var bt=require("react/jsx-runtime"),Ml=()=>{let{navigateBack:e}=b();return(0,bt.jsxs)(bt.Fragment,{children:[(0,bt.jsx)(_,{backFn:e},"header"),(0,bt.jsx)(zi,{}),(0,bt.jsxs)(ot,{children:[(0,bt.jsx)("span",{children:"Still not sure? "}),(0,bt.jsx)("a",{target:"_blank",href:"https://join.tell.ie/blog/explaining-web3-wallets",children:"Learn more"})]})]})};var Ul=require("react"),Ji=require("react-device-detect"),lo=T(require("styled-components"));var $o=require("react"),vr=T(require("styled-components"));var ji=require("react/jsx-runtime"),Wn=({style:e,...t})=>(0,ji.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,ji.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75v10.5a2.25 2.25 0 01-2.25 2.25h-15a2.25 2.25 0 01-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25m19.5 0v.243a2.25 2.25 0 01-1.07 1.916l-7.5 4.615a2.25 2.25 0 01-2.36 0L3.32 8.91a2.25 2.25 0 01-1.07-1.916V6.75"})});var Me=require("react/jsx-runtime"),Nn=e=>{let[t,o]=(0,$o.useState)(""),[r,n]=(0,$o.useState)(!1),[i,a]=(0,$o.useState)(null),{isLinking:l,initLoginWithEmail:s}=W(),{app:u,navigate:h}=b(),E=(u==null?void 0:u.loginMethods.wallet)??!1;(0,$o.useEffect)(()=>{let p=document.querySelector("#email-input");p==null||p.focus()},[]);let w=Ya(t),m=()=>{n(!0),s(t).then(()=>{h("AWAITING_PASSWORDLESS_CODE")}).catch(p=>{(p==null?void 0:p.status)===422?a(p.message):(p==null?void 0:p.privyErrorCode)==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):a("Issue submitting email"),n(!1)})},f="Get started without a wallet.";return i?f=i:l?f="Easily connect an email":E||(f="Get started quickly with email"),(0,Me.jsxs)(Me.Fragment,{children:[(0,Me.jsxs)(Bp,{stacked:e.stacked,children:[(0,Me.jsxs)(Gp,{standalone:e.stacked,children:[(0,Me.jsx)(Wn,{}),(0,Me.jsx)("input",{id:"email-input",type:"email",placeholder:"your@email.com",onChange:p=>o(p.target.value),onKeyUp:p=>{p.key==="Enter"&&m()},value:t,autoComplete:"email"})]}),e.stacked?null:(0,Me.jsx)(Fp,{disabled:r||!w,onClick:m,children:r?(0,Me.jsx)(tt,{}):"Submit"})]}),(0,Me.jsx)(Hp,{fail:!!i,children:f}),e.stacked?(0,Me.jsx)(oe,{loading:r,loadingText:null,disabled:r||!w,onClick:m,children:"Submit"}):null]})},Bp=vr.default.div`
|
|
1160
1160
|
width: 100%;
|
|
1161
1161
|
height: ${e=>e.stacked?"100%":"auto"};
|
|
1162
1162
|
|
|
@@ -1168,7 +1168,7 @@ Resources:
|
|
|
1168
1168
|
@media (max-width: 440px) {
|
|
1169
1169
|
margin-top: 20px;
|
|
1170
1170
|
}
|
|
1171
|
-
`,Fp=
|
|
1171
|
+
`,Fp=vr.default.button`
|
|
1172
1172
|
display: flex;
|
|
1173
1173
|
flex-direction: row;
|
|
1174
1174
|
align-items: center;
|
|
@@ -1199,7 +1199,7 @@ Resources:
|
|
|
1199
1199
|
color: var(--privy-color-foreground-3);
|
|
1200
1200
|
cursor: not-allowed;
|
|
1201
1201
|
}
|
|
1202
|
-
`,Gp=
|
|
1202
|
+
`,Gp=vr.default.label`
|
|
1203
1203
|
display: flex;
|
|
1204
1204
|
flex-direction: row;
|
|
1205
1205
|
align-items: center;
|
|
@@ -1236,7 +1236,7 @@ Resources:
|
|
|
1236
1236
|
line-height: 24px;
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
`,Hp=
|
|
1239
|
+
`,Hp=vr.default.div`
|
|
1240
1240
|
line-height: 20px;
|
|
1241
1241
|
height: 20px;
|
|
1242
1242
|
font-size: 13px;
|
|
@@ -1249,7 +1249,7 @@ Resources:
|
|
|
1249
1249
|
> a {
|
|
1250
1250
|
text-decoration: underline;
|
|
1251
1251
|
}
|
|
1252
|
-
`;var qo=require("react"),
|
|
1252
|
+
`;var qo=require("react"),br=T(require("styled-components"));var Ki=require("react/jsx-runtime"),Ln=({style:e,...t})=>(0,Ki.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 20 20",strokeWidth:1.5,stroke:"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...t,children:(0,Ki.jsx)("path",{d:"M2.5 4.16667C2.5 3.72464 2.67559 3.30072 2.98816 2.98816C3.30072 2.67559 3.72464 2.5 4.16667 2.5H6.9C7.07483 2.50013 7.24519 2.55525 7.38696 2.65754C7.52874 2.75984 7.63475 2.90413 7.69 3.07L8.93833 6.81417C9.00158 7.00445 8.9941 7.21116 8.91726 7.39637C8.84042 7.58158 8.69938 7.73288 8.52 7.8225L6.63917 8.76417C7.5611 10.8046 9.19538 12.4389 11.2358 13.3608L12.1775 11.48C12.2671 11.3006 12.4184 11.1596 12.6036 11.0827C12.7888 11.0059 12.9956 10.9984 13.1858 11.0617L16.93 12.31C17.096 12.3653 17.2404 12.4714 17.3427 12.6134C17.445 12.7553 17.5 12.9259 17.5 13.1008V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H15C8.09667 17.5 2.5 11.9033 2.5 5V4.16667Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Oe=require("react/jsx-runtime"),Mn=e=>{let[t,o]=(0,qo.useState)(""),[r,n]=(0,qo.useState)(!1),[i,a]=(0,qo.useState)(null),{isLinking:l,initLoginWithSms:s}=W(),{app:u,navigate:h}=b(),E=(u==null?void 0:u.loginMethods.wallet)??!1;(0,qo.useEffect)(()=>{let p=document.querySelector("#phone-number-input");p==null||p.focus()},[]);let w=Qa(t),m=()=>{n(!0),s(t).then(()=>{h("AWAITING_PASSWORDLESS_CODE")}).catch(p=>{(p==null?void 0:p.status)===422?a(p.message):(p==null?void 0:p.privyErrorCode)==="allowlist_rejected"?h("ALLOWLIST_REJECTION_SCREEN"):a("Issue submitting phone number"),n(!1)})},f="Get started without a wallet.";return i?f=i:l?f="Easily connect a phone number":E||(f="Get started quickly with your phone"),(0,Oe.jsxs)(Oe.Fragment,{children:[(0,Oe.jsxs)(zp,{stacked:e.stacked,children:[(0,Oe.jsxs)($p,{standalone:e.stacked,children:[(0,Oe.jsx)(Ln,{}),(0,Oe.jsx)("input",{id:"phone-number-input",type:"tel",placeholder:"555 555 5555",onChange:p=>{o(p.target.value)},onKeyUp:p=>{p.key==="Enter"&&m()},value:t,autoComplete:"tel"})]}),e.stacked?null:(0,Oe.jsx)(Vp,{disabled:r||!w,onClick:m,children:r?(0,Oe.jsx)(tt,{}):"Submit"})]}),(0,Oe.jsx)(qp,{fail:!!i,children:f}),e.stacked?(0,Oe.jsx)(oe,{loading:r,loadingText:null,disabled:r||!w,onClick:m,children:"Submit"}):null]})},zp=br.default.div`
|
|
1253
1253
|
display: flex;
|
|
1254
1254
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1255
1255
|
width: 100%;
|
|
@@ -1263,7 +1263,7 @@ Resources:
|
|
|
1263
1263
|
@media (max-width: 440px) {
|
|
1264
1264
|
margin-top: 20px;
|
|
1265
1265
|
}
|
|
1266
|
-
`,Vp=
|
|
1266
|
+
`,Vp=br.default.button`
|
|
1267
1267
|
display: flex;
|
|
1268
1268
|
flex-direction: row;
|
|
1269
1269
|
align-items: center;
|
|
@@ -1294,7 +1294,7 @@ Resources:
|
|
|
1294
1294
|
color: var(--privy-color-foreground-3);
|
|
1295
1295
|
cursor: not-allowed;
|
|
1296
1296
|
}
|
|
1297
|
-
`,$p=
|
|
1297
|
+
`,$p=br.default.label`
|
|
1298
1298
|
display: flex;
|
|
1299
1299
|
flex-direction: row;
|
|
1300
1300
|
align-items: center;
|
|
@@ -1331,7 +1331,7 @@ Resources:
|
|
|
1331
1331
|
line-height: 24px;
|
|
1332
1332
|
}
|
|
1333
1333
|
}
|
|
1334
|
-
`,qp=
|
|
1334
|
+
`,qp=br.default.div`
|
|
1335
1335
|
line-height: 20px;
|
|
1336
1336
|
height: 20px;
|
|
1337
1337
|
font-size: 13px;
|
|
@@ -1344,12 +1344,12 @@ Resources:
|
|
|
1344
1344
|
> a {
|
|
1345
1345
|
text-decoration: underline;
|
|
1346
1346
|
}
|
|
1347
|
-
`;var Zi=T(require("styled-components"));var
|
|
1347
|
+
`;var Zi=T(require("styled-components"));var wr=require("react/jsx-runtime"),On=({style:e,...t})=>(0,wr.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,wr.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,wr.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 Kt=require("react/jsx-runtime"),Dn=({style:e,...t})=>(0,Kt.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,Kt.jsx)("g",{clipPath:"url(#clip0)",children:(0,Kt.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,Kt.jsx)("defs",{children:(0,Kt.jsx)("clipPath",{id:"clip0",children:(0,Kt.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var Yi=require("react/jsx-runtime"),Un=({style:e,...t})=>(0,Yi.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,Yi.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:"currentColor"})});var so=require("react/jsx-runtime"),Bn=({style:e,...t})=>(0,so.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,so.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,so.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,so.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,so.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 Qi=require("react/jsx-runtime"),Fn=({style:e,...t})=>(0,Qi.jsx)("svg",{width:"24",height:"20",viewBox:"0 0 24 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"26px",width:"26px",...e},...t,children:(0,Qi.jsx)("path",{d:"M7.54311 19.7551C16.5973 19.7551 21.5516 12.2467 21.5516 5.74656C21.5516 5.53533 21.5516 5.32409 21.542 5.11286C22.5021 4.42156 23.3375 3.54783 24 2.55888C23.1166 2.95254 22.1661 3.21178 21.1675 3.3366C22.1853 2.73171 22.963 1.76196 23.3375 0.609788C22.3869 1.17627 21.3308 1.57953 20.2074 1.80037C19.3049 0.840223 18.0279 0.244934 16.6165 0.244934C13.8993 0.244934 11.6909 2.45326 11.6909 5.17047C11.6909 5.55453 11.7389 5.92898 11.8157 6.29384C7.72554 6.09221 4.09619 4.12391 1.66703 1.14747C1.24457 1.87718 1.00453 2.72211 1.00453 3.62464C1.00453 5.3337 1.87826 6.84112 3.19366 7.72445C2.38714 7.69565 1.62862 7.47481 0.966125 7.10996C0.966125 7.12916 0.966125 7.14837 0.966125 7.17717C0.966125 9.55833 2.66558 11.5554 4.91232 12.0067C4.49945 12.1219 4.06739 12.1795 3.61612 12.1795C3.29927 12.1795 2.99203 12.1507 2.69438 12.0931C3.31848 14.0518 5.14275 15.4728 7.29347 15.5112C5.60362 16.8362 3.4817 17.6235 1.17736 17.6235C0.783698 17.6235 0.390039 17.6043 0.00598145 17.5563C2.17591 18.9389 4.76829 19.7551 7.54311 19.7551Z",fill:"#1da1f2"})});var De=require("react/jsx-runtime"),Ol=({showGoogle:e,showTwitter:t,showDiscord:o,showGithub:r,showApple:n})=>{let{initLoginWithOAuth:i}=W(),{app:a}=b(),l=a==null?void 0:a.appearance.palette.colorScheme;return(0,De.jsxs)(jp,{children:[e&&(0,De.jsx)(Cr,{onClick:()=>{i("google")},children:(0,De.jsx)(Bn,{})}),t&&(0,De.jsx)(Cr,{onClick:()=>{i("twitter")},children:(0,De.jsx)(Fn,{})}),o&&(0,De.jsx)(Cr,{onClick:()=>{i("discord")},children:(0,De.jsx)(Dn,{})}),r&&(0,De.jsx)(Cr,{onClick:()=>{i("github")},children:(0,De.jsx)(Un,{style:{color:l==="light"?"#000":"#fff"}})}),n&&(0,De.jsx)(Cr,{onClick:()=>{i("apple")},children:(0,De.jsx)(On,{style:{color:l==="light"?"#000":"#fff"}})})]})},jp=Zi.default.div`
|
|
1348
1348
|
display: flex;
|
|
1349
1349
|
justify-content: space-between;
|
|
1350
1350
|
width: 100%;
|
|
1351
1351
|
gap: 4px;
|
|
1352
|
-
`,
|
|
1352
|
+
`,Cr=Zi.default.div`
|
|
1353
1353
|
border-radius: var(--privy-border-radius-sm);
|
|
1354
1354
|
cursor: pointer;
|
|
1355
1355
|
height: 44px;
|
|
@@ -1422,7 +1422,7 @@ Resources:
|
|
|
1422
1422
|
}
|
|
1423
1423
|
`,Xp=(0,lo.default)(Ce)`
|
|
1424
1424
|
flex-direction: ${e=>e.reverse?"column-reverse":"column"};
|
|
1425
|
-
`;var it=require("react/jsx-runtime"),Hl=()=>{let{app:e}=b();return(0,it.jsxs)(it.Fragment,{children:[(0,it.jsx)(_,{},"header"),(0,it.jsx)(Ke,{title:"Connect your email",description:`Add your email to your ${e==null?void 0:e.name} account`,icon:(0,it.jsx)(Wn,{})}),(0,it.jsx)(Ce,{children:(0,it.jsx)(Nn,{stacked:!0})}),(0,it.jsx)(F,{protectedByPrivy:!0})]})};var at=require("react/jsx-runtime"),zl=()=>{let{app:e}=b();return(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(_,{},"header"),(0,at.jsx)(Ke,{title:"Connect your phone",description:`Add your number to your ${e==null?void 0:e.name} account`,icon:(0,at.jsx)(Ln,{})}),(0,at.jsx)(Ce,{children:(0,at.jsx)(Mn,{stacked:!0})}),(0,at.jsx)(F,{protectedByPrivy:!0})]})};var st=require("react/jsx-runtime"),Vl=()=>{let{linkingHint:e}=W(),{app:t}=b(),o=e?`Select the wallet with ${To(e)} and follow the instructions to reconnect your wallet${t!=null&&t.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t==null?void 0:t.name} account`;return(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)(_,{},"header"),(0,st.jsx)(ut,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),(0,st.jsxs)(Ce,{children:[(0,st.jsx)(Vt,{connectOnly:!1}),(0,st.jsx)($t,{})]}),(0,st.jsx)(F,{protectedByPrivy:!0})]})};var
|
|
1425
|
+
`;var it=require("react/jsx-runtime"),Hl=()=>{let{app:e}=b();return(0,it.jsxs)(it.Fragment,{children:[(0,it.jsx)(_,{},"header"),(0,it.jsx)(Ke,{title:"Connect your email",description:`Add your email to your ${e==null?void 0:e.name} account`,icon:(0,it.jsx)(Wn,{})}),(0,it.jsx)(Ce,{children:(0,it.jsx)(Nn,{stacked:!0})}),(0,it.jsx)(F,{protectedByPrivy:!0})]})};var at=require("react/jsx-runtime"),zl=()=>{let{app:e}=b();return(0,at.jsxs)(at.Fragment,{children:[(0,at.jsx)(_,{},"header"),(0,at.jsx)(Ke,{title:"Connect your phone",description:`Add your number to your ${e==null?void 0:e.name} account`,icon:(0,at.jsx)(Ln,{})}),(0,at.jsx)(Ce,{children:(0,at.jsx)(Mn,{stacked:!0})}),(0,at.jsx)(F,{protectedByPrivy:!0})]})};var st=require("react/jsx-runtime"),Vl=()=>{let{linkingHint:e}=W(),{app:t}=b(),o=e?`Select the wallet with ${To(e)} and follow the instructions to reconnect your wallet${t!=null&&t.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t==null?void 0:t.name} account`;return(0,st.jsxs)(st.Fragment,{children:[(0,st.jsx)(_,{},"header"),(0,st.jsx)(ut,{title:`${e?"Reconnect":"Connect"} your wallet`,description:o}),(0,st.jsxs)(Ce,{children:[(0,st.jsx)(Vt,{connectOnly:!1}),(0,st.jsx)($t,{})]}),(0,st.jsx)(F,{protectedByPrivy:!0})]})};var Er=require("react/jsx-runtime"),$l=({style:e,...t})=>(0,Er.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,Er.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,Er.jsx)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var Ye=require("react/jsx-runtime"),ql=()=>{let{closePrivyModal:e}=W(),{navigate:t}=b();return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)(_,{},"header"),(0,Ye.jsx)($l,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,Ye.jsx)(ut,{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,Ye.jsxs)(Ce,{children:[(0,Ye.jsx)(oe,{onClick:()=>t("LANDING"),children:"Try again"}),(0,Ye.jsx)(Ss,{onClick:()=>e(),children:"Cancel"})]}),(0,Ye.jsx)(F,{protectedByPrivy:!0})]})};var jo=require("react"),Gn=T(require("styled-components"));var Ae=require("react/jsx-runtime"),jl={google:{name:"Google",component:Bn},discord:{name:"Discord",component:Dn},github:{name:"Github",component:Un},twitter:{name:"Twitter",component:Fn},apple:{name:"Apple",component:On}},eu=e=>e.charAt(0).toUpperCase()+e.slice(1),Xi=()=>{let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),window.history.pushState({},"",e)},Kl=()=>{var k;let{ready:e,user:t,authenticated:o}=G(),{app:r,setModalData:n,navigate:i}=b(),{getAuthMeta:a,initLoginWithOAuth:l,loginWithOAuth:s,closePrivyModal:u}=W(),[h,E]=(0,jo.useState)(!1),[w,m]=(0,jo.useState)(void 0),f=((k=a())==null?void 0:k.provider)||"google",p=jl[f].name,C=jl[f].component,S=r!=null&&r.render.inDialog?Je:0;(0,jo.useEffect)(()=>{!e||s().then(()=>{Xi(),E(!0)}).catch(I=>{let O={retryable:!1,message:"Authentication failed."};I.message.includes("Another user has already linked this")?O.detail="This account has already been linked to another user.":I.message==="Invalid code during oauth flow."?(O.retryable=!0,O.detail="Something went wrong. Try again."):I.message==="User denied confirmation during OAuth flow"&&(O.detail=`Retry and check ${eu(f)} to finish connecting your account.`,O.retryable=!0),Xi(),m(O)})},[e]),(0,jo.useEffect)(()=>{var O;if(!!(o&&h&&t))if(Co(t,(O=r==null?void 0:r.embeddedWallets)==null?void 0:O.createOnLogin)){let L=setTimeout(()=>{n({createWallet:{onSuccess:()=>{},onFailure:he=>console.error(he),callAuthOnSuccessOnClose:!0}}),console.log("Navigating to wallet creation flow"),i("EMBEDDED_WALLET_SCREEN")},S);return()=>clearTimeout(L)}else{let L=setTimeout(u,S);return()=>clearTimeout(L)}},[o,h,t]);let N=h?`Successfully connected with ${p}`:w?w.message:`Verifying connection to ${p}`,x="";return h?x="You\u2019re good to go!":w?x=w.detail:x="Just a few moments more",(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(_,{}),(0,Ae.jsxs)(tu,{children:[(0,Ae.jsx)(ru,{children:(0,Ae.jsxs)("div",{children:[(0,Ae.jsx)(mn,{success:h,fail:!!w}),(0,Ae.jsx)(C,{style:{width:"38px",height:"38px"}})]})}),(0,Ae.jsxs)(ou,{children:[(0,Ae.jsx)("h3",{children:N}),(0,Ae.jsx)("p",{children:x})]}),(0,Ae.jsx)(fe,{onClick:()=>{Xi(),l(f),m(void 0)},invisible:h||!(w!=null&&w.retryable),disabled:!h&&!(w!=null&&w.retryable),children:"Retry"})]})]})},tu=Gn.default.div`
|
|
1426
1426
|
display: flex;
|
|
1427
1427
|
flex-direction: column;
|
|
1428
1428
|
align-items: center;
|
|
@@ -1457,9 +1457,9 @@ Resources:
|
|
|
1457
1457
|
left: -19px;
|
|
1458
1458
|
top: -19px;
|
|
1459
1459
|
}
|
|
1460
|
-
`;var
|
|
1460
|
+
`;var xr=require("react"),Zl=T(require("styled-components"));var Yl=require("react-device-detect");var Ql=(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(!ze()&&Yl.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${r}?ref=${r}`};var Ue=require("react/jsx-runtime"),Jl=()=>{let{forkSession:e,ready:t,authenticated:o}=G(),[r,n]=(0,xr.useState)(""),[i,a]=(0,xr.useState)(!1);(0,xr.useEffect)(()=>{t&&o&&e().then(n)},[t,o]);let l=Ql(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,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(_,{},"header"),(0,Ue.jsx)(ut,{title:s.title,description:s.description}),(0,Ue.jsxs)(Ce,{children:[(0,Ue.jsx)(nu,{children:(0,Ue.jsx)(ct,{style:{width:"72px",height:"72px"}})}),(0,Ue.jsx)(hn,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,Ue.jsx)("p",{children:s.footnote}):null]}),(0,Ue.jsx)(F,{protectedByPrivy:!0})]})},nu=(0,Zl.default)(io)`
|
|
1461
1461
|
margin: 16px auto;
|
|
1462
|
-
`;var Nt=require("react"),mo=T(require("styled-components"));var na=T(require("styled-components"));var ea=T(require("styled-components")),
|
|
1462
|
+
`;var Nt=require("react"),mo=T(require("styled-components"));var na=T(require("styled-components"));var ea=T(require("styled-components")),Tr=require("react/jsx-runtime"),Pr=({label:e,children:t,valueStyles:o})=>(0,Tr.jsxs)(iu,{children:[(0,Tr.jsx)("div",{children:e}),(0,Tr.jsx)(au,{style:{...o},children:t})]}),iu=ea.default.div`
|
|
1463
1463
|
display: flex;
|
|
1464
1464
|
align-items: center;
|
|
1465
1465
|
justify-content: space-between;
|
|
@@ -1481,7 +1481,7 @@ Resources:
|
|
|
1481
1481
|
border-radius: var(--privy-border-radius-md);
|
|
1482
1482
|
background-color: var(--privy-color-background-2);
|
|
1483
1483
|
padding: 4px 8px;
|
|
1484
|
-
`;var rc=require("@ethersproject/bignumber");var Xl=require("@ethersproject/bignumber"),ec=require("@ethersproject/bytes"),tc=require("@ethersproject/providers"),ta=require("@ethersproject/units"),Hn=(e,t)=>(t*parseFloat((0,ta.formatEther)(e))).toFixed(2),co=(e,t=8)=>parseFloat((0,ta.formatEther)(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),oc=(e,t)=>{(0,ec.isHexString)(e)&&(e=Number(e));let o=(0,tc.getNetwork)(e);return`https://${o.name==="homestead"?"www":o.name}.etherscan.io/address/${t}`},Be=e=>Xl.BigNumber.from(e);var zn=require("react/jsx-runtime"),
|
|
1484
|
+
`;var rc=require("@ethersproject/bignumber");var Xl=require("@ethersproject/bignumber"),ec=require("@ethersproject/bytes"),tc=require("@ethersproject/providers"),ta=require("@ethersproject/units"),Hn=(e,t)=>(t*parseFloat((0,ta.formatEther)(e))).toFixed(2),co=(e,t=8)=>parseFloat((0,ta.formatEther)(e)).toFixed(t).replace(/0+$/,"").replace(/\.$/,""),oc=(e,t)=>{(0,ec.isHexString)(e)&&(e=Number(e));let o=(0,tc.getNetwork)(e);return`https://${o.name==="homestead"?"www":o.name}.etherscan.io/address/${t}`},Be=e=>Xl.BigNumber.from(e);var zn=require("react/jsx-runtime"),_r=({weiQuantities:e,tokenPrice:t})=>{let o=e.map(Be).reduce((n,i)=>n.add(i),rc.BigNumber.from(0)),r=Hn(o.toHexString(),t);return(0,zn.jsx)(zn.Fragment,{children:r==="0.00"?"< USD $0.01":`USD $${r}`})};var po=T(require("styled-components"));var me=require("react/jsx-runtime"),lc=({transactionData:e,displayFee:t=!1,gas:o,tokenPrice:r,isLoading:n=!1})=>(0,me.jsxs)(su,{children:[(0,me.jsx)(lu,{"data-open":t,children:(0,me.jsxs)(nc,{children:[(0,me.jsxs)(ic,{children:[(0,me.jsx)(sc,{children:"Est. Fees"}),(0,me.jsx)("div",{children:n?(0,me.jsx)(tt,{color:"var(--privy-color-accent)"}):(0,me.jsx)(_r,{weiQuantities:[o],tokenPrice:r})})]}),(0,me.jsx)(ac,{children:`ETH ${co(Be(o).toHexString())}`})]})}),(0,me.jsxs)(nc,{children:[(0,me.jsxs)(ic,{children:[(0,me.jsx)(sc,{children:"Total (including fees)"}),(0,me.jsx)("div",{children:n||!e.value?(0,me.jsx)(tt,{color:"var(--privy-color-accent)"}):(0,me.jsx)(_r,{weiQuantities:[e.value,o],tokenPrice:r})})]}),(0,me.jsx)(ac,{children:e.value?`ETH ${co(Be(e.value).add(Be(o)).toHexString())}`:null})]})]}),su=po.default.div`
|
|
1485
1485
|
display: flex;
|
|
1486
1486
|
flex-direction: column;
|
|
1487
1487
|
gap: 4px;
|
|
@@ -1519,7 +1519,7 @@ Resources:
|
|
|
1519
1519
|
&[data-open='false'] {
|
|
1520
1520
|
max-height: 0;
|
|
1521
1521
|
}
|
|
1522
|
-
`;var wt=require("react"),Yt=T(require("styled-components"));var oa=require("react/jsx-runtime"),cc=({style:e,...t})=>(0,oa.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,oa.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})});var Vn=require("react"),Ko=(0,Vn.createContext)(void 0);var
|
|
1522
|
+
`;var wt=require("react"),Yt=T(require("styled-components"));var oa=require("react/jsx-runtime"),cc=({style:e,...t})=>(0,oa.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,oa.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})});var Vn=require("react"),Ko=(0,Vn.createContext)(void 0);var Ar=(0,Vn.createContext)(void 0);var Fe=require("react/jsx-runtime"),dc=({defaultValue:e,children:t})=>{let[o,r]=(0,wt.useState)(e||null),n=i=>{r(o===i?null:i)};return(0,Fe.jsx)(Ko.Provider,{value:{activePanel:o,togglePanel:n},children:(0,Fe.jsx)(cu,{children:t})})},pc=({value:e,children:t})=>{let{activePanel:o,togglePanel:r}=(0,wt.useContext)(Ko),n=o===e;return(0,Fe.jsx)(Ar.Provider,{value:{onToggle:()=>r(e),value:e},children:(0,Fe.jsx)(uu,{isActive:n,"data-open":n,children:t})})},uc=({children:e})=>{let{activePanel:t}=(0,wt.useContext)(Ko),{onToggle:o,value:r}=(0,wt.useContext)(Ar),n=t===r;return(0,Fe.jsxs)(du,{onClick:o,"data-open":n,children:[(0,Fe.jsx)(pu,{children:e}),(0,Fe.jsx)(hu,{isactive:n,children:(0,Fe.jsx)(cc,{})})]})},mc=({children:e})=>{let{activePanel:t}=(0,wt.useContext)(Ko),{value:o}=(0,wt.useContext)(Ar);return(0,Fe.jsx)(mu,{"data-open":t===o,children:(0,Fe.jsx)(fc,{children:e})})},hc=({children:e})=>{let{activePanel:t}=(0,wt.useContext)(Ko),{value:o}=(0,wt.useContext)(Ar);return(0,Fe.jsx)(fc,{children:typeof e=="function"?e({isActive:t===o}):e})},cu=Yt.default.div`
|
|
1523
1523
|
display: flex;
|
|
1524
1524
|
flex-direction: column;
|
|
1525
1525
|
width: 100%;
|
|
@@ -1579,7 +1579,7 @@ Resources:
|
|
|
1579
1579
|
&:hover {
|
|
1580
1580
|
text-decoration: underline;
|
|
1581
1581
|
}
|
|
1582
|
-
`;var re=require("react/jsx-runtime"),$n=e=>{var o,r,n;let t=!!(((o=e.txn)==null?void 0:o.value)&&e.gas);return(0,re.jsx)(dc,{children:(0,re.jsxs)(pc,{value:"details",children:[(0,re.jsx)(uc,{children:(0,re.jsxs)(yu,{children:[(0,re.jsx)("div",{children:((r=e.transactionInfo)==null?void 0:r.actionDescription)||"Details"}),((n=e.txn)==null?void 0:n.value)&&e.tokenPrice?(0,re.jsx)(gu,{children:(0,re.jsx)(
|
|
1582
|
+
`;var re=require("react/jsx-runtime"),$n=e=>{var o,r,n;let t=!!(((o=e.txn)==null?void 0:o.value)&&e.gas);return(0,re.jsx)(dc,{children:(0,re.jsxs)(pc,{value:"details",children:[(0,re.jsx)(uc,{children:(0,re.jsxs)(yu,{children:[(0,re.jsx)("div",{children:((r=e.transactionInfo)==null?void 0:r.actionDescription)||"Details"}),((n=e.txn)==null?void 0:n.value)&&e.tokenPrice?(0,re.jsx)(gu,{children:(0,re.jsx)(_r,{weiQuantities:[e.txn.value],tokenPrice:e.tokenPrice})}):null]})}),(0,re.jsxs)(mc,{children:[(0,re.jsx)(Pr,{label:"From",children:(0,re.jsx)(ra,{walletAddress:e.from,chainId:e.txn.chainId||He})}),(0,re.jsx)(Pr,{label:"To",children:(0,re.jsx)(ra,{walletAddress:e.to,chainId:e.txn.chainId||He})}),t&&e.transactionInfo&&e.transactionInfo.action&&(0,re.jsx)(Pr,{label:"Action",children:e.transactionInfo.action})]}),(0,re.jsx)(hc,{children:({isActive:i})=>t&&e.gas?(0,re.jsx)(lc,{transactionData:e.txn,displayFee:i,gas:e.gas,tokenPrice:e.tokenPrice}):(0,re.jsx)(re.Fragment,{children:e.transactionInfo&&e.transactionInfo.action&&(0,re.jsx)(Pr,{label:"Action",children:e.transactionInfo.action})})})]})})},yu=na.default.div`
|
|
1583
1583
|
display: flex;
|
|
1584
1584
|
flex-direction: row;
|
|
1585
1585
|
justify-content: space-between;
|
|
@@ -1625,7 +1625,7 @@ Resources:
|
|
|
1625
1625
|
white-space: nowrap;
|
|
1626
1626
|
max-width: 275px;
|
|
1627
1627
|
text-overflow: ellipsis;
|
|
1628
|
-
`;var
|
|
1628
|
+
`;var kr=require("react"),qn=T(require("styled-components"));var Sr=require("@ethersproject/providers");async function bc(e,t,o,r){return r=Object.assign({chainId:He},r),r.chainId=Number(r.chainId),xc(r),(await o.rpc({address:t,accessToken:e,request:{method:"eth_populateTransactionRequest",params:[r]}})).response.data}async function wc(e,t,o,r){r=Object.assign({chainId:He},r),xc(r);let i=(await o.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[r]}})).response.data,l=await(await xu(r.chainId,i)).wait();return _u(l)}function xu(e,t){return new Sr.JsonRpcProvider(oo(e)).sendTransaction(t)}async function Cc(e,t=He){return await new Sr.JsonRpcProvider(oo(t)).getBalance(e)}async function Ec(e){return delete e.from,await new Sr.JsonRpcProvider(oo(Number(e.chainId)||He)).estimateGas(e)}function xc(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let o of t){let r=e[o];if(!(typeof r>"u")&&!Tu(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 Tu(e){let t=typeof e=="number",o=typeof e=="bigint",r=typeof e=="string"&&Pu(e);return t||o||r}function Pu(e){return/^-?0x[a-f0-9]+$/i.test(e)}function _u(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.toHexString()}}var ia=require("react/jsx-runtime"),Tc=({style:e,...t})=>(0,ia.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,ia.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a2.25 2.25 0 00-2.25-2.25H15a3 3 0 11-6 0H5.25A2.25 2.25 0 003 12m18 0v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 9m18 0V6a2.25 2.25 0 00-2.25-2.25H5.25A2.25 2.25 0 003 6v3"})});var uo=require("react/jsx-runtime"),Pc=({wallet:e,txnValue:t,chainId:o})=>{let[r,n]=(0,kr.useState)(),[i,a]=(0,kr.useState)(!1);return(0,kr.useEffect)(()=>{(async s=>{try{let u=await Cc(s,o);t&&u.sub(Be(t)).isNegative()&&a(!0),n(u.toHexString())}catch(u){console.warn(u)}})(e.address)},[e,t]),(0,uo.jsxs)(Au,{children:[(0,uo.jsxs)(Su,{children:[(0,uo.jsx)(Tc,{style:{height:"12px",width:"12px"}}),(0,uo.jsx)("div",{children:To(e==null?void 0:e.address)})]}),(0,uo.jsxs)(ku,{displayBalanceColor:!!t,hasFunds:!i,children:[r?co(r):0," ETH"]})]})},Au=qn.default.div`
|
|
1629
1629
|
display: flex;
|
|
1630
1630
|
flex-direction: row;
|
|
1631
1631
|
justify-content: space-between;
|
|
@@ -1650,25 +1650,25 @@ Resources:
|
|
|
1650
1650
|
background-color: var(--privy-color-background-2);
|
|
1651
1651
|
padding: 4px 12px;
|
|
1652
1652
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"green":"red":"inherit"};
|
|
1653
|
-
`;var
|
|
1653
|
+
`;var Rr=T(require("styled-components"));var Wt=require("react");var jn=e=>{let{getUsdTokenPrice:t}=W(),[o,r]=(0,Wt.useState)(!1),[n,i]=(0,Wt.useState)(!1),[a,l]=(0,Wt.useState)(void 0),[s,u]=(0,Wt.useState)(void 0),[h,E]=(0,Wt.useState)(null);return(0,Wt.useEffect)(()=>{let w=e.chainId||He;(async()=>{try{r(!0);let f=await t(w);u(f)}catch(f){l(f)}finally{r(!1)}})()},[]),(0,Wt.useEffect)(()=>{(async()=>{try{i(!0);let m=await Ec(e);E(m.toBigInt())}catch(m){l(m)}finally{i(!1)}})()},[e]),{tokenPrice:s,estimatedGas:h,isLoading:o||n,error:a}};var Qo=require("react/jsx-runtime"),_c=e=>{var o,r;let{tokenPrice:t}=jn(e.txn);return(0,Qo.jsxs)(Ru,{children:[(0,Qo.jsxs)(Iu,{children:["$",((o=e.txn)==null?void 0:o.value)&&t?Hn(Be(e.txn.value).toHexString(),t):"--"]}),(0,Qo.jsxs)(Wu,{children:[(r=e.txn)!=null&&r.value?co(Be(e.txn.value).toHexString()):"--"," ","ETH"]}),(0,Qo.jsx)(Nu,{children:e.description})]})},Ru=Rr.default.div`
|
|
1654
1654
|
display: flex;
|
|
1655
1655
|
flex-direction: column;
|
|
1656
1656
|
align-items: center;
|
|
1657
1657
|
margin-bottom: 20px;
|
|
1658
|
-
`,Iu=
|
|
1658
|
+
`,Iu=Rr.default.h2`
|
|
1659
1659
|
&& {
|
|
1660
1660
|
font-size: 48px;
|
|
1661
1661
|
line-height: 48px;
|
|
1662
1662
|
margin: 8px auto;
|
|
1663
1663
|
}
|
|
1664
|
-
`,Wu=
|
|
1664
|
+
`,Wu=Rr.default.p`
|
|
1665
1665
|
margin-bottom: 12px;
|
|
1666
1666
|
&& {
|
|
1667
1667
|
font-size: 17px;
|
|
1668
1668
|
line-height: 17px;
|
|
1669
1669
|
color: var(--privy-color-foreground-3);
|
|
1670
1670
|
}
|
|
1671
|
-
`,Nu=
|
|
1671
|
+
`,Nu=Rr.default.div`
|
|
1672
1672
|
font-size: 16px;
|
|
1673
1673
|
line-height: 22.4px;
|
|
1674
1674
|
font-weight: 400;
|
|
@@ -1715,7 +1715,7 @@ Resources:
|
|
|
1715
1715
|
display: flex;
|
|
1716
1716
|
flex-direction: column;
|
|
1717
1717
|
gap: 8px;
|
|
1718
|
-
`;var
|
|
1718
|
+
`;var Ir=require("react"),Zt=T(require("styled-components"));var xe=require("react/jsx-runtime"),Ic=()=>{let{authenticated:e,getAccessToken:t,user:o}=G(),{walletProxy:r,closePrivyModal:n,createAnalyticsEvent:i}=W(),{navigate:a,data:l}=b(),[s,u]=(0,Ir.useState)(!1),[h,E]=(0,Ir.useState)("");(0,Ir.useEffect)(()=>{e||(a("LANDING"),f(new Error("User must be authenticated before signing with a Privy wallet")))},[e]);let{message:w,onSuccess:m,onFailure:f,uiOptions:p}=l.signMessage,C=te(o),S=!r,N={title:p.title||"Sign message",description:p.description||"Signing this message will not cost you any fees.",buttonText:p.buttonText||"Sign and continue"};return(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(_,{onClose:()=>n({shouldCallAuthOnSuccess:!1})}),(0,xe.jsxs)(Hu,{children:[(0,xe.jsxs)("div",{children:[(0,xe.jsx)(Ee,{title:N.title,description:N.description}),(0,xe.jsx)(zu,{children:w}),(0,xe.jsx)(Vu,{fail:!0,children:h})]}),(0,xe.jsx)(qu,{success:s,loading:S,disabled:s,onClick:async()=>{let x=await t();if(x&&!S&&C)try{i("embedded_wallet_sign_message_started",{walletAddress:C.address});let{response:k}=await r.rpc({accessToken:x,address:C==null?void 0:C.address,request:{method:"eth_sign",params:[C.address,w]}}),I=k.data;E(""),m(I),i("embedded_wallet_sign_message_completed",{walletAddress:C.address}),u(!0),setTimeout(()=>{n({shouldCallAuthOnSuccess:!1})},Je)}catch(k){E("An error has occurred, please try again."),f(k)}},children:s?(0,xe.jsxs)($u,{children:[(0,xe.jsx)(Fo,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,xe.jsx)("span",{children:"Success"})]}):N.buttonText})]}),(0,xe.jsx)(F,{protectedByPrivy:!0})]})},Hu=Zt.default.div`
|
|
1719
1719
|
display: flex;
|
|
1720
1720
|
height: 100%;
|
|
1721
1721
|
flex-direction: column;
|
|
@@ -2076,7 +2076,7 @@ Resources:
|
|
|
2076
2076
|
opacity: 1;
|
|
2077
2077
|
}
|
|
2078
2078
|
}
|
|
2079
|
-
`;var M=require("react/jsx-runtime"),Ku=()=>{let{ready:e}=G(),{isLinking:t}=W(),{ready:o,currentScreen:r,app:n}=b(),i=!!(n!=null&&n.loginMethods.wallet),a=!!((n==null?void 0:n.loginMethods.email)||(n==null?void 0:n.loginMethods.sms)),l=i!==a,s;return["AWAITING_CONNECTION","AWAITING_CONNECT_ONLY_CONNECTION","CONNECT_ONLY_LANDING_SCREEN","AWAITING_OAUTH_SCREEN","ALLOWLIST_REJECTION_SCREEN"].includes(r)||l&&r==="LANDING"?s="compact":"WALLET_EDUCATION"===r?s="full":t&&r!=="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"?s="medium":s="full",!e||!o?(0,M.jsxs)(Mo,{"data-height":s,children:[(0,M.jsx)(_,{}),(0,M.jsx)(Zu,{children:(0,M.jsx)(
|
|
2079
|
+
`;var M=require("react/jsx-runtime"),Ku=()=>{let{ready:e}=G(),{isLinking:t}=W(),{ready:o,currentScreen:r,app:n}=b(),i=!!(n!=null&&n.loginMethods.wallet),a=!!((n==null?void 0:n.loginMethods.email)||(n==null?void 0:n.loginMethods.sms)),l=i!==a,s;return["AWAITING_CONNECTION","AWAITING_CONNECT_ONLY_CONNECTION","CONNECT_ONLY_LANDING_SCREEN","AWAITING_OAUTH_SCREEN","ALLOWLIST_REJECTION_SCREEN"].includes(r)||l&&r==="LANDING"?s="compact":"WALLET_EDUCATION"===r?s="full":t&&r!=="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"?s="medium":s="full",!e||!o?(0,M.jsxs)(Mo,{"data-height":s,children:[(0,M.jsx)(_,{}),(0,M.jsx)(Zu,{children:(0,M.jsx)(dr,{})}),(0,M.jsx)(ot,{})]}):(0,M.jsxs)(Mo,{"data-height":s,children:[r==="LANDING"&&(0,M.jsx)(Bl,{}),r==="AWAITING_PASSWORDLESS_CODE"&&(0,M.jsx)(Us,{}),r==="WALLET_EDUCATION"&&(0,M.jsx)(Wl,{}),r==="AWAITING_CONNECTION"&&(0,M.jsx)(Ys,{}),r==="AWAITING_CONNECT_ONLY_CONNECTION"&&(0,M.jsx)(Qs,{}),r==="COINBASE_INTERSTITIAL_SCREEN"&&(0,M.jsx)(Hs,{}),r==="PHANTOM_INTERSTITIAL_SCREEN"&&(0,M.jsx)(Jl,{}),r==="LOGIN_FAILED_SCREEN"&&(0,M.jsx)(ql,{}),r==="AWAITING_OAUTH_SCREEN"&&(0,M.jsx)(Kl,{}),r==="ALLOWLIST_REJECTION_SCREEN"&&(0,M.jsx)(Ls,{}),r==="INSTALL_METAMASK_SCREEN"&&(0,M.jsx)(Ll,{}),r==="INSTALL_PHANTOM_SCREEN"&&(0,M.jsx)(Ml,{}),r==="INSTALL_COINBASE_WALLET_SCREEN"&&(0,M.jsx)(Nl,{}),r==="LINK_EMAIL_SCREEN"&&(0,M.jsx)(Hl,{}),r==="LINK_PHONE_SCREEN"&&(0,M.jsx)(zl,{}),r==="LINK_WALLET_SCREEN"&&(0,M.jsx)(Vl,{}),r==="CONNECT_ONLY_LANDING_SCREEN"&&(0,M.jsx)(Ks,{}),r==="CONNECT_ONLY_AUTHENTICATED_SCREEN"&&(0,M.jsx)(qs,{}),r==="EMBEDDED_WALLET_SCREEN"&&(0,M.jsx)(bl,{}),r==="EMBEDDED_WALLET_CREATED_SCREEN"&&(0,M.jsx)(al,{}),r==="EMBEDDED_WALLET_CONNECTING_SCREEN"&&(0,M.jsx)(rl,{}),r==="EMBEDDED_WALLET_RECOVERY_SCREEN"&&(0,M.jsx)(ml,{}),r==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&(0,M.jsx)(dl,{}),r==="EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"&&(0,M.jsx)(Ic,{}),r==="EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"&&(0,M.jsx)(Rc,{})]})},Oc=()=>{let{closePrivyModal:e}=W(),{app:t}=b(),o=(0,Qn.useCallback)(i=>{i.key==="Escape"&&(t==null?void 0:t.render.inDialog)&&e()},[t==null?void 0:t.render.inDialog]);(0,sa.useEffect)(()=>(document.addEventListener("keydown",o,!1),()=>{document.removeEventListener("keydown",o,!1)}),[o]);let r=(0,M.jsx)(Lc,{onClick:i=>i.stopPropagation(),children:(0,M.jsx)(Ku,{})}),n=t!=null&&t.render.inDialog?(0,M.jsx)(Qu,{id:"privy-dialog",onClick:()=>e(),children:r}):r;return Mc.default.createPortal(n,t!=null&&t.render.inParentNodeId&&document.getElementById(t.render.inParentNodeId)||document.body)},Yu=({children:e,...t})=>{let o=(0,Qn.useRef)(null);return(0,sa.useEffect)(()=>{var n;(n=document==null?void 0:document.activeElement)==null||n.blur();let r=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));if(!!r)return r.setAttribute("inert","true"),(0,Yn.disableBodyScroll)(o==null?void 0:o.current),()=>{let i=(document==null?void 0:document.getElementById("root"))||(document==null?void 0:document.getElementById("__next"));!i||(i.removeAttribute("inert"),(0,Yn.clearAllBodyScrollLocks)())}},[t.open,t.onClose]),(0,M.jsx)("dialog",{open:!0,role:"dialog",...t,ref:o,children:e})},Qu=(0,Zn.default)(Yu)`
|
|
2080
2080
|
position: fixed;
|
|
2081
2081
|
top: 0;
|
|
2082
2082
|
left: 0;
|
|
@@ -2135,4 +2135,4 @@ Resources:
|
|
|
2135
2135
|
align-items: center;
|
|
2136
2136
|
justify-content: center;
|
|
2137
2137
|
height: 100%;
|
|
2138
|
-
`;var fo=T(require("tinycolor2")),Dc="#FFFFFF",Ju="#000000",Xu=Dc,em="#1E1E1D";function tm(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 ho(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,fo.default)({...e.toHsl(),l:o})}function Uc({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",errorHex:r="#EC6351",whiteHex:n=Dc,blackHex:i=Ju}){let a;switch(e){case"light":a=Xu;break;case"dark":a=em;break;default:a=e;break}let l=(0,fo.default)(a),s=(0,fo.default)(t),u=(0,fo.default)(o),h=(0,fo.default)(r),E=tm(l.getLuminance()),w=ho(l,E==="light"?-.04:.11),m=ho(l,E==="light"?-.88:.87),f=ho(l,E==="light"?-.77:.75),p=ho(l,E==="light"?-.43:.45).desaturate(E==="light"?60:20),C=ho(l,E==="light"?-.13:.25).desaturate(E==="light"?60:20),S=ho(s,.15),N=ho(s,-.06),x=(0,fo.default)(s.getLuminance()>.5?i:n);return{colorScheme:E,background:l.toHslString(),background2:w.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:p.toHslString(),foreground4:C.toHslString(),accent:s.toHslString(),accentLight:S.toHslString(),accentDark:N.toHslString(),foregroundAccent:x.toHslString(),success:u.toHslString(),error:h.toHslString()}}var Ir={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:Wa,_render:{inDialog:!0,inParentNodeId:null}};function Jn(e,t){var E,w,m,f,p,C,S,N,x,k;let o,r,n,i,a,l,s,u;if(t!=null&&t.loginMethods?(o=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),n=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),a=t.loginMethods.includes("twitter"),l=t.loginMethods.includes("discord"),s=t.loginMethods.includes("github"),u=t.loginMethods.includes("apple")):(o=e.emailAuth,r=e.smsAuth,n=e.walletAuth,i=e.googleOAuth,a=e.twitterOAuth,l=e.discordOAuth,s=e.githubOAuth,u=e.appleOAuth),o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),!o&&!r&&[i,a,l,s,u].some(I=>I))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![o,r,n,i,a,l,s,u].some(I=>I))throw new Error("You must enable at least one login method");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:((E=t==null?void 0:t.appearance)==null?void 0:E.logo)??e.logoUrl,palette:Uc({backgroundTheme:((w=t==null?void 0:t.appearance)==null?void 0:w.theme)??Ir.appearance.theme,accentHex:((m=t==null?void 0:t.appearance)==null?void 0:m.accentColor)??e.accentColor??Ir.appearance.accentColor}),showWalletLoginFirst:((f=t==null?void 0:t.appearance)==null?void 0:f.showWalletLoginFirst)??e.showWalletLoginFirst},loginMethods:{wallet:n,email:o,sms:r,google:i,twitter:a,discord:l,github:s,apple:u},legal:{termsAndConditionsUrl:((p=t==null?void 0:t.legal)==null?void 0:p.termsAndConditionsUrl)??e.termsAndConditionsUrl,privacyPolicyUrl:((C=t==null?void 0:t.legal)==null?void 0:C.privacyPolicyUrl)??e.privacyPolicyUrl},walletConnectCloudProjectId:(t==null?void 0:t.walletConnectCloudProjectId)??e.walletConnectCloudProjectId??Ir.walletConnectCloudProjectId,embeddedWallets:{createOnLogin:((S=t==null?void 0:t.embeddedWallets)==null?void 0:S.createOnLogin)??e.embeddedWalletConfig.createOnLogin,requireUserPasswordOnCreate:((N=t==null?void 0:t.embeddedWallets)==null?void 0:N.requireUserPasswordOnCreate)??e.embeddedWalletConfig.requireUserPasswordOnCreate},render:{inDialog:((x=t==null?void 0:t._render)==null?void 0:x.inDialog)??Ir._render.inDialog,inParentNodeId:((k=t==null?void 0:t._render)==null?void 0:k.inParentNodeId)??Ir._render.inParentNodeId}}}function Bc(e,t){var o;return((o=e==null?void 0:e.appearance)==null?void 0:o.logo)&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}var ei=require("react");var Xn=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;default:throw new Error(`invalid wallet event type ${t}`)}}};var Gc=require("react/jsx-runtime"),om=function(e){return()=>`id-${e++}`}(0);function rm(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Wr(e){return e.error!==void 0}var Zo=new Xn;function Nr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");return new Promise((n,i)=>{let a=om();Zo.enqueue(a,{resolve:n,reject:i}),r.postMessage({id:a,event:e,data:t},"*")})}function nm(e){switch(e.event){case"privy:iframe:ready":let t=Zo.dequeue(e.event,e.id);return Wr(e)?t.reject(new qt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Zo.dequeue(e.event,e.id);return Wr(e)?o.reject(new qt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Zo.dequeue(e.event,e.id);return Wr(e)?r.reject(new qt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Zo.dequeue(e.event,e.id);return Wr(e)?n.reject(new qt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Zo.dequeue(e.event,e.id);return Wr(e)?i.reject(new qt(e.error.type,e.error.message)):i.resolve(e.data)}}function Fc(e){let t=(0,ei.useRef)(null);return(0,ei.useEffect)(()=>{let o=t.current;if(!o)return;function r(l){l&&l.origin===e.origin&&rm(l.data)&&nm(l.data)}let n={create(l){return Nr("privy:wallet:create",l,o)},connect(l){return Nr("privy:wallet:connect",l,o)},recover(l){return Nr("privy:wallet:recover",l,o)},rpc(l){return Nr("privy:wallet:rpc",l,o)}};window.addEventListener("message",r);let i=()=>e.onLoad(n),a=(...l)=>{console.error("privy iframe failed to load: ",...l),e.onLoadFailed()};return Ja(()=>Nr("privy:iframe:ready",{},o)).then(i,a),()=>window.removeEventListener("message",r)},[t.current]),(0,Gc.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:Yr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}var ti=require("react"),la=(0,ti.createContext)({wallets:[]});function Hc(){return(0,ti.useContext)(la)}var Ct=require("react/jsx-runtime");function im(e){return typeof e=="string"&&e.length===25}var Mr;function So(){if(!Mr){let e=Z.get(xo);return Promise.resolve(e||null)}return Mr.getAccessToken()}var zc,is=(e,t)=>zc(e,t),Vc,as=(e,t)=>Vc(e,t),am=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(or,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},$c=({config:e,...t})=>{var r,n;if(!im(t.appId))throw new A("Cannot initialize the Privy provider with an invalid Privy app ID");Mr||(Mr=new Wo({appId:t.appId,apiUrl:t.apiUrl||zr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&((r=o.embeddedWallets)==null?void 0:r.createOnLogin)===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&((n=e==null?void 0:e.embeddedWallets)==null?void 0:n.createOnLogin)&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Ct.jsx)(sm,{...t,config:o,client:Mr})},sm=e=>{let t=e.client,[o,r]=(0,H.useState)(!1),[n,i]=(0,H.useState)(!1),[a,l]=(0,H.useState)(!1),[s,u]=(0,H.useState)(null),[h,E]=(0,H.useState)([]),w=(0,H.useRef)(h),[m,f]=(0,H.useState)(!1),[p,C]=(0,H.useState)(null),[S,N]=(0,H.useState)(!1),[x,k]=(0,H.useState)({status:"disconnected",connectError:null,connector:null,connectRetry:P}),[I,O]=(0,H.useState)(null),[L,he]=(0,H.useState)(null),[X,ge]=(0,H.useState)({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,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1}}),[ee,R]=(0,H.useState)(()=>{let c=Bc(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",c),Jn(X,e.config)}),[z,B]=(0,H.useState)(!0),[ne,de]=(0,H.useState)({}),[Lt,Mt]=(0,H.useState)(null),pe=c=>{c&&C(c),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:c})},ue=c=>{ee.embeddedWallets.createOnLogin!=="off"&&B(!0),pe(c)};(0,H.useEffect)(()=>{var d,v;if(!L||!s){(d=t.connectors)==null||d.removeEmbeddedWalletConnector();return}let c=s==null?void 0:s.linkedAccounts.filter(g=>g.type==="wallet"&&g.walletClient==="privy");if(c&&c.length>0){let g=c[0].address;(v=t.connectors)==null||v.addEmbeddedWalletConnector(L,g)}},[L,s]),(0,H.useEffect)(()=>{async function c(){var bo;let d=await t.getServerConfig();ge(d);let v=Jn(d,e.config);R(v),d.customApiUrl&&t.updateApiUrl(d.customApiUrl),t.initializeConnectorManager(v.walletConnectCloudProjectId),(bo=t.connectors)==null||bo.initialize();let g=Ot();am();let le=await t.getAuthenticatedUser();l(!!le),u(le),i(!0),Lt==null||Lt(),g&&le&&N(!0),Or()}c()},[t,Lt,n]),(0,H.useEffect)(()=>{let c=Jn(X,e.config);R(c)},[e.config]);let Ot=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_oauth_code"),v=c.get("privy_oauth_state"),g=c.get("privy_oauth_provider");return d&&v&&g?(t.startAuthFlow(new Dt(g,d,v)),ue("AWAITING_OAUTH_SCREEN"),!0):!1},yo=async(c,d,v)=>{var le;let g=await((le=t.connectors)==null?void 0:le.createWalletConnector(c,d))||null;Jo(g,v)};async function Jo(c,d){if(!c)return k({status:"disconnected",connectError:new Y("Unable to connect to wallet."),connector:null,connectRetry:P}),d==null?void 0:d(null);k({connector:c,status:"connecting",connectError:null,connectRetry:()=>Jo(c,d)});try{let v=await c.connect({showPrompt:!0});return k(g=>({...g,status:"connected",connectError:null,connectRetry:P})),d==null?void 0:d(v)}catch(v){return v instanceof Ze?console.error(v.cause?v.cause:v.message):console.error(v),k(g=>({...g,status:"disconnected",connectError:v})),d==null?void 0:d(null)}}let go=c=>{c!==null&&t.startAuthFlow(new eo(c))},Or=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_connector"),v=c.get("privy_wallet_client");if(!d||!v)return;if(v==="phantom"&&!ze()&&ue("LOGIN_FAILED_SCREEN"),!t.connectors)throw new A("Connector not initialized");pe("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),yo(d,v,go)};(0,H.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(u)},[n,a,s,t]);let Xo=()=>{N(!0),pe("LINK_WALLET_SCREEN")},Dr=c=>{if(!a||!s)return!1;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===c.address)return!0;return!1},Ur=async c=>{if(!t.connectors)throw new A("Connector not initialized");N(!!a);let d=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;k(v=>({...v,connector:d,status:"connected",connectError:null,connectRetry:P})),go(c),ue("AWAITING_CONNECTION")},se=async(c,d)=>{if(!t.connectors)throw new A("Connector not initialized");N(!!a),await yo(c,d,go)},Jt=()=>{E(c=>{var v;let d=((v=t.connectors)==null?void 0:v.wallets.map(g=>({...g,linked:Dr(g),loginOrLink:async()=>{if(!await g.isConnected())throw new A("Wallet is not connected");if(g.connectorType==="embedded"&&g.walletClientType==="privy")throw new A("Cannot link or login with embedded wallet");Ur(g)},unlink:async()=>{if(!a)throw new A("User is not authenticated.");if(g.connectorType==="embedded"&&g.walletClientType==="privy")throw new A("Cannot unlink an embedded wallet");let le=await t.unlinkWallet(g.address);u(le)}})))||[];return Zr(c,d)?c:d})};(0,H.useEffect)(()=>{Jt()},[s==null?void 0:s.linkedAccounts]),(0,H.useEffect)(()=>{if(n){if(!t.connectors)throw new A("Connector not initialized");Jt(),t.connectors.on("walletsUpdated",Jt)}},[n]);let ri=()=>{pe(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,H.useEffect)(()=>{if(!h[0])return;let c=h[0],d=w.current.find(g=>g.address===c.address),v=s==null?void 0:s.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address);if(!d&&v){let g=Object.assign({},s);g.wallet=v&&{address:v.address,chainType:v.chainType,chainId:v.chainId,walletClient:v.walletClient,walletClientType:v.walletClientType,connectorType:v.connectorType},u(g)}w.current=h},[h]);let er={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:ri,linkWallet:Xo,linkEmail:()=>{N(!0),pe("LINK_EMAIL_SCREEN")},linkPhone:()=>{N(!0),pe("LINK_PHONE_SCREEN")},linkGoogle:async()=>{await vo.initLoginWithOAuth("google")},linkTwitter:async()=>{await vo.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await vo.initLoginWithOAuth("discord")},linkGithub:async()=>{await vo.initLoginWithOAuth("github")},linkApple:async()=>{await vo.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(c=>{Mt(()=>c)}),Mt(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}ue()},logout:async()=>{await t.logout(),u(null),l(!1),C(null),N(!1),r(!1)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{var v;if(!s||!s.wallet)return new J;let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new J:d.proxyProvider},getEthersProvider:()=>{var v;if(!s||!s.wallet)return new oi.Web3Provider(new Xe(new J));let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new oi.Web3Provider(new Xe(new J)):new oi.Web3Provider(new Xe(d.proxyProvider))},getWeb3jsProvider:()=>{var v;if(!s||!s.wallet)return new Gt(new J);let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new Gt(new J):new Gt(d.proxyProvider)},unlinkWallet:async c=>{let d=await t.unlinkWallet(c);return u(d),d},unlinkEmail:async c=>{let d=await t.unlinkEmail(c);return u(d),d},unlinkPhone:async c=>{let d=await t.unlinkPhone(c);return u(d),d},unlinkGoogle:async c=>{let d=await t.unlinkOAuth("google",c);return u(d),d},unlinkTwitter:async c=>{let d=await t.unlinkOAuth("twitter",c);return u(d),d},unlinkDiscord:async c=>{let d=await t.unlinkOAuth("discord",c);return u(d),d},unlinkGithub:async c=>{let d=await t.unlinkOAuth("github",c);return u(d),d},unlinkApple:async c=>{let d=await t.unlinkOAuth("apple",c);return u(d),d},setActiveWallet:async c=>{let d=h.find(g=>(0,Lr.getAddress)(g.address)===(0,Lr.getAddress)(c)),v=s==null?void 0:s.linkedAccounts.find(g=>g.type==="wallet"&&(0,Lr.getAddress)(g.address)===(0,Lr.getAddress)(c));if(!d||!await d.isConnected())O(c),Xo();else if(!d.linked)d.loginOrLink();else{let g=Object.assign({},s);g.wallet=v&&{address:v.address,chainType:v.chainType,chainId:v.chainId,walletClient:v.walletClient,walletClientType:v.walletClientType,connectorType:v.connectorType},u(g)}},forkSession:()=>t.forkSession(),createWallet:()=>new Promise((c,d)=>{if(!a||!s){d(new Error("User must be authenticated before creating a Privy wallet"));return}if(te(s)){d(new Error("Only one Privy wallet per user is currently allowed"));return}B(!0),de({createWallet:{onSuccess:c,onFailure:d,callAuthOnSuccessOnClose:!1}}),pe("EMBEDDED_WALLET_SCREEN")}),signMessage:(c,d)=>new Promise((v,g)=>{if(!a||!s){g(new Error("User must be authenticated before signing with a Privy wallet"));return}if(!te(s)){g(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){g(new Error("Message must be a non-empty string"));return}B(!0);let bo={message:c,onSuccess:v,onFailure:g,uiOptions:d||{}},ni={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:g};de({signMessage:bo,connectWallet:ni}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),sendTransaction:(c,d)=>new Promise(async(v,g)=>{if(!a||!s){g(new Error("User must be authenticated before signing with a Privy wallet"));return}if(!te(s)){g(new Error("Must have a Privy wallet before signing"));return}B(!0);let bo={transactionRequest:c,onSuccess:v,onFailure:g,uiOptions:d||{}},ni={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:g};de({connectWallet:ni,sendTransaction:bo}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),exportWallet:()=>new Promise((c,d)=>{if(!a||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!te(s)){d(new Error("Must have a Privy wallet before exporting"));return}B(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},le={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:d};de({keyExport:le,connectWallet:g}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")})};zc=er.signMessage,Vc=er.sendTransaction;let vo=(()=>({isNewUserThisSession:m,isLinking:S,linkingHint:I,walletConnectionStatus:x,getAuthFlow:()=>t.authFlow,getAuthMeta:()=>{var c;return(c=t.authFlow)==null?void 0:c.meta},closePrivyModal:(c={shouldCallAuthOnSuccess:!0})=>{var v;let d=n&&a&&s;c.shouldCallAuthOnSuccess&&d&&((v=e.onSuccess)==null||v.call(e,s,m)),t.authFlow=void 0,O(null),C(null),N(!1),f(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:yo,initLoginWithWallet:se,loginWithWallet:async()=>{if(!(t.authFlow instanceof eo))throw new A("Must initialize SIWE flow first.");let c,d;S?c=await t.link():{user:c,isNewUser:d}=await t.authenticate(),u(c||s||null),f(d||!1),l(!0)},initLoginWithOAuth:async c=>{t.startAuthFlow(new Dt(c));let d=await t.authFlow.getAuthorizationUrl();d&&d.url&&window.location.assign(d.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Dt))throw new A("Must initialize OAuth flow before calling loginWithOAuth");let c,d;n&&a?c=await t.link():{user:c,isNewUser:d}=await t.authenticate(),u(c),f(d||!1),l(!0)},initLoginWithEmail:async c=>{let d=new Xt(c);t.startAuthFlow(d),await d.sendCodeEmail()},initLoginWithSms:async c=>{let d=new to(c);t.startAuthFlow(d),await d.sendSmsCode()},resendEmailCode:async()=>{var c;await((c=t.authFlow)==null?void 0:c.sendCodeEmail())},resendSmsCode:async()=>{var c;await((c=t.authFlow)==null?void 0:c.sendSmsCode())},loginWithCode:async c=>{if(t.authFlow instanceof Xt)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof to)t.authFlow.meta.smsCode=c.trim();else throw new A("Must initialize a passwordless code flow first");let d,v;S?d=await t.link():{user:d,isNewUser:v}=await t.authenticate(),u(d||s||null),f(v||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return u(c),c},walletProxy:L,createAnalyticsEvent:(c,d,v)=>t.createAnalyticsEvent(c,d,v),getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:c=>new Promise((d,v)=>{if(!a||!s){v(new Error("User must be authenticated before recovering the Privy wallet"));return}let g=te(s);if(!g){v(new Error("Must have a Privy wallet in order to recover it"));return}B(!0),de({recoverWallet:{privyWallet:g,onCompleteNavigateTo:c,onFailure:v,onSuccess:d}}),pe("EMBEDDED_WALLET_RECOVERY_SCREEN")})}))(),qc=(0,H.useMemo)(()=>({wallets:h}),[h]);return(0,Ct.jsx)(xi.Provider,{value:er,children:(0,Ct.jsxs)(la.Provider,{value:qc,children:[e.children,(0,Ct.jsxs)(Ei.Provider,{value:vo,children:[(0,Ct.jsx)(Nc,{theme:{...ee.appearance.palette||{}}}),(0,Ct.jsx)(ms,{appConfig:ee,data:ne,setModalData:de,initialScreen:p,visible:o,authenticated:a,children:o&&(0,Ct.jsx)(Oc,{})}),z&&(0,Ct.jsx)(Fc,{appId:e.appId,origin:t.apiUrl,onLoad:he,onLoadFailed:()=>null})]})]})})};0&&(module.exports={AsExternalProvider,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,VERSION,WalletConnector,getAccessToken,usePrivy,useWallets});
|
|
2138
|
+
`;var fo=T(require("tinycolor2")),Dc="#FFFFFF",Ju="#000000",Xu=Dc,em="#1E1E1D";function tm(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 ho(e,t){let o=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,fo.default)({...e.toHsl(),l:o})}function Uc({backgroundTheme:e,accentHex:t,successHex:o="#51BA81",errorHex:r="#EC6351",whiteHex:n=Dc,blackHex:i=Ju}){let a;switch(e){case"light":a=Xu;break;case"dark":a=em;break;default:a=e;break}let l=(0,fo.default)(a),s=(0,fo.default)(t),u=(0,fo.default)(o),h=(0,fo.default)(r),E=tm(l.getLuminance()),w=ho(l,E==="light"?-.04:.11),m=ho(l,E==="light"?-.88:.87),f=ho(l,E==="light"?-.77:.75),p=ho(l,E==="light"?-.43:.45).desaturate(E==="light"?60:20),C=ho(l,E==="light"?-.13:.25).desaturate(E==="light"?60:20),S=ho(s,.15),N=ho(s,-.06),x=(0,fo.default)(s.getLuminance()>.5?i:n);return{colorScheme:E,background:l.toHslString(),background2:w.toHslString(),foreground:m.toHslString(),foreground2:f.toHslString(),foreground3:p.toHslString(),foreground4:C.toHslString(),accent:s.toHslString(),accentLight:S.toHslString(),accentDark:N.toHslString(),foregroundAccent:x.toHslString(),success:u.toHslString(),error:h.toHslString()}}var Wr={appearance:{theme:"light",accentColor:"#676FFF"},walletConnectCloudProjectId:Wa,_render:{inDialog:!0,inParentNodeId:null}};function Jn(e,t){var E,w,m,f,p,C,S,N,x,k;let o,r,n,i,a,l,s,u;if(t!=null&&t.loginMethods?(o=t.loginMethods.includes("email"),r=t.loginMethods.includes("sms"),n=t.loginMethods.includes("wallet"),i=t.loginMethods.includes("google"),a=t.loginMethods.includes("twitter"),l=t.loginMethods.includes("discord"),s=t.loginMethods.includes("github"),u=t.loginMethods.includes("apple")):(o=e.emailAuth,r=e.smsAuth,n=e.walletAuth,i=e.googleOAuth,a=e.twitterOAuth,l=e.discordOAuth,s=e.githubOAuth,u=e.appleOAuth),o&&r&&(console.warn("Enabling both email and SMS passwordless is not currently supported. Disabling SMS."),r=!1),!o&&!r&&[i,a,l,s,u].some(I=>I))throw new Error("To enable social logins you must also enable either SMS or Email login");if(![o,r,n,i,a,l,s,u].some(I=>I))throw new Error("You must enable at least one login method");return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,appearance:{logo:((E=t==null?void 0:t.appearance)==null?void 0:E.logo)??e.logoUrl,palette:Uc({backgroundTheme:((w=t==null?void 0:t.appearance)==null?void 0:w.theme)??Wr.appearance.theme,accentHex:((m=t==null?void 0:t.appearance)==null?void 0:m.accentColor)??e.accentColor??Wr.appearance.accentColor}),showWalletLoginFirst:((f=t==null?void 0:t.appearance)==null?void 0:f.showWalletLoginFirst)??e.showWalletLoginFirst},loginMethods:{wallet:n,email:o,sms:r,google:i,twitter:a,discord:l,github:s,apple:u},legal:{termsAndConditionsUrl:((p=t==null?void 0:t.legal)==null?void 0:p.termsAndConditionsUrl)??e.termsAndConditionsUrl,privacyPolicyUrl:((C=t==null?void 0:t.legal)==null?void 0:C.privacyPolicyUrl)??e.privacyPolicyUrl},walletConnectCloudProjectId:(t==null?void 0:t.walletConnectCloudProjectId)??e.walletConnectCloudProjectId??Wr.walletConnectCloudProjectId,embeddedWallets:{createOnLogin:((S=t==null?void 0:t.embeddedWallets)==null?void 0:S.createOnLogin)??e.embeddedWalletConfig.createOnLogin,requireUserPasswordOnCreate:((N=t==null?void 0:t.embeddedWallets)==null?void 0:N.requireUserPasswordOnCreate)??e.embeddedWalletConfig.requireUserPasswordOnCreate},render:{inDialog:((x=t==null?void 0:t._render)==null?void 0:x.inDialog)??Wr._render.inDialog,inParentNodeId:((k=t==null?void 0:t._render)==null?void 0:k.inParentNodeId)??Wr._render.inParentNodeId}}}function Bc(e,t){var o;return((o=e==null?void 0:e.appearance)==null?void 0:o.logo)&&typeof e.appearance.logo=="object"&&(e.appearance.logo="component"),{...e,legacyCreateEmbeddedWalletFlag:t}}var ei=require("react");var Xn=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;default:throw new Error(`invalid wallet event type ${t}`)}}};var Gc=require("react/jsx-runtime"),om=function(e){return()=>`id-${e++}`}(0);function rm(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function Nr(e){return e.error!==void 0}var Zo=new Xn;function Lr(e,t,o){let r=o.contentWindow;if(!r)throw new Error("iframe not initialized");return new Promise((n,i)=>{let a=om();Zo.enqueue(a,{resolve:n,reject:i}),r.postMessage({id:a,event:e,data:t},"*")})}function nm(e){switch(e.event){case"privy:iframe:ready":let t=Zo.dequeue(e.event,e.id);return Nr(e)?t.reject(new qt(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let o=Zo.dequeue(e.event,e.id);return Nr(e)?o.reject(new qt(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:connect":let r=Zo.dequeue(e.event,e.id);return Nr(e)?r.reject(new qt(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:recover":let n=Zo.dequeue(e.event,e.id);return Nr(e)?n.reject(new qt(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=Zo.dequeue(e.event,e.id);return Nr(e)?i.reject(new qt(e.error.type,e.error.message)):i.resolve(e.data)}}function Fc(e){let t=(0,ei.useRef)(null);return(0,ei.useEffect)(()=>{let o=t.current;if(!o)return;function r(l){l&&l.origin===e.origin&&rm(l.data)&&nm(l.data)}let n={create(l){return Lr("privy:wallet:create",l,o)},connect(l){return Lr("privy:wallet:connect",l,o)},recover(l){return Lr("privy:wallet:recover",l,o)},rpc(l){return Lr("privy:wallet:rpc",l,o)}};window.addEventListener("message",r);let i=()=>e.onLoad(n),a=(...l)=>{console.error("privy iframe failed to load: ",...l),e.onLoadFailed()};return Ja(()=>Lr("privy:iframe:ready",{},o)).then(i,a),()=>window.removeEventListener("message",r)},[t.current]),(0,Gc.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},src:Yr(e.origin,`/apps/${e.appId}/embedded-wallets`)})}var ti=require("react"),la=(0,ti.createContext)({wallets:[]});function Hc(){return(0,ti.useContext)(la)}var Ct=require("react/jsx-runtime");function im(e){return typeof e=="string"&&e.length===25}var Or;function So(){if(!Or){let e=Z.get(xo);return Promise.resolve(e||null)}return Or.getAccessToken()}var zc,is=(e,t)=>zc(e,t),Vc,as=(e,t)=>Vc(e,t),am=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;Z.put(or,t);let o=new URL(window.location.href);o.searchParams.delete("privy_token"),window.history.pushState({},"",o)},$c=({config:e,...t})=>{var r,n;if(!im(t.appId))throw new A("Cannot initialize the Privy provider with an invalid Privy app ID");Or||(Or=new Wo({appId:t.appId,apiUrl:t.apiUrl||Vr}));let o=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&((r=o.embeddedWallets)==null?void 0:r.createOnLogin)===void 0&&(o.embeddedWallets||(o.embeddedWallets={}),o.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&((n=e==null?void 0:e.embeddedWallets)==null?void 0:n.createOnLogin)&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,Ct.jsx)(sm,{...t,config:o,client:Or})},sm=e=>{let t=e.client,[o,r]=(0,H.useState)(!1),[n,i]=(0,H.useState)(!1),[a,l]=(0,H.useState)(!1),[s,u]=(0,H.useState)(null),[h,E]=(0,H.useState)([]),w=(0,H.useRef)(h),[m,f]=(0,H.useState)(!1),[p,C]=(0,H.useState)(null),[S,N]=(0,H.useState)(!1),[x,k]=(0,H.useState)({status:"disconnected",connectError:null,connector:null,connectRetry:P}),[I,O]=(0,H.useState)(null),[L,he]=(0,H.useState)(null),[X,ge]=(0,H.useState)({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,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserPasswordOnCreate:!1}}),[ee,R]=(0,H.useState)(()=>{let c=Bc(e.config,e.createPrivyWalletOnLogin);return t.createAnalyticsEvent("sdk_initialize",c),Jn(X,e.config)}),[z,B]=(0,H.useState)(!0),[ne,de]=(0,H.useState)({}),[Lt,Mt]=(0,H.useState)(null),pe=c=>{c&&C(c),r(!0),t.createAnalyticsEvent("modal_open",{initialScreen:c})},ue=c=>{ee.embeddedWallets.createOnLogin!=="off"&&B(!0),pe(c)};(0,H.useEffect)(()=>{var d,v;if(!L||!s){(d=t.connectors)==null||d.removeEmbeddedWalletConnector();return}let c=s==null?void 0:s.linkedAccounts.filter(g=>g.type==="wallet"&&g.walletClient==="privy");if(c&&c.length>0){let g=c[0].address;(v=t.connectors)==null||v.addEmbeddedWalletConnector(L,g)}},[L,s]),(0,H.useEffect)(()=>{async function c(){var bo;let d=await t.getServerConfig();ge(d);let v=Jn(d,e.config);R(v),d.customApiUrl&&t.updateApiUrl(d.customApiUrl),t.initializeConnectorManager(v.walletConnectCloudProjectId),(bo=t.connectors)==null||bo.initialize();let g=Ot();am();let le=await t.getAuthenticatedUser();l(!!le),u(le),i(!0),Lt==null||Lt(),g&&le&&N(!0),Dr()}c()},[t,Lt,n]),(0,H.useEffect)(()=>{let c=Jn(X,e.config);R(c)},[e.config]);let Ot=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_oauth_code"),v=c.get("privy_oauth_state"),g=c.get("privy_oauth_provider");return d&&v&&g?(t.startAuthFlow(new Dt(g,d,v)),ue("AWAITING_OAUTH_SCREEN"),!0):!1},yo=async(c,d,v)=>{var le;let g=await((le=t.connectors)==null?void 0:le.createWalletConnector(c,d))||null;Jo(g,v)};async function Jo(c,d){if(!c)return k({status:"disconnected",connectError:new Y("Unable to connect to wallet."),connector:null,connectRetry:P}),d==null?void 0:d(null);k({connector:c,status:"connecting",connectError:null,connectRetry:()=>Jo(c,d)});try{let v=await c.connect({showPrompt:!0});return k(g=>({...g,status:"connected",connectError:null,connectRetry:P})),d==null?void 0:d(v)}catch(v){return v instanceof Ze?console.error(v.cause?v.cause:v.message):console.error(v),k(g=>({...g,status:"disconnected",connectError:v})),d==null?void 0:d(null)}}let go=c=>{c!==null&&t.startAuthFlow(new eo(c))},Dr=()=>{let c=new URLSearchParams(window.location.search),d=c.get("privy_connector"),v=c.get("privy_wallet_client");if(!d||!v)return;if(v==="phantom"&&!ze()&&ue("LOGIN_FAILED_SCREEN"),!t.connectors)throw new A("Connector not initialized");pe("AWAITING_CONNECTION");let g=new URL(window.location.href);g.searchParams.delete("privy_connector"),g.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",g),yo(d,v,go)};(0,H.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(u)},[n,a,s,t]);let Xo=()=>{N(!0),pe("LINK_WALLET_SCREEN")},Ur=c=>{if(!a||!s)return!1;for(let d of s.linkedAccounts)if(d.type==="wallet"&&d.address===c.address)return!0;return!1},Br=async c=>{if(!t.connectors)throw new A("Connector not initialized");N(!!a);let d=t.connectors.findWalletConnector(c.connectorType,c.walletClientType)||null;k(v=>({...v,connector:d,status:"connected",connectError:null,connectRetry:P})),go(c),ue("AWAITING_CONNECTION")},se=async(c,d)=>{if(!t.connectors)throw new A("Connector not initialized");N(!!a),await yo(c,d,go)},Jt=()=>{E(c=>{var v;let d=((v=t.connectors)==null?void 0:v.wallets.map(g=>({...g,linked:Ur(g),loginOrLink:async()=>{if(!await g.isConnected())throw new A("Wallet is not connected");if(g.connectorType==="embedded"&&g.walletClientType==="privy")throw new A("Cannot link or login with embedded wallet");Br(g)},unlink:async()=>{if(!a)throw new A("User is not authenticated.");if(g.connectorType==="embedded"&&g.walletClientType==="privy")throw new A("Cannot unlink an embedded wallet");let le=await t.unlinkWallet(g.address);u(le)}})))||[];return Zr(c,d)?c:d})};(0,H.useEffect)(()=>{Jt()},[s==null?void 0:s.linkedAccounts]),(0,H.useEffect)(()=>{if(n){if(!t.connectors)throw new A("Connector not initialized");Jt(),t.connectors.on("walletsUpdated",Jt)}},[n]);let ri=()=>{pe(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,H.useEffect)(()=>{if(!h[0])return;let c=h[0],d=w.current.find(g=>g.address===c.address),v=s==null?void 0:s.linkedAccounts.find(g=>g.type==="wallet"&&g.address===c.address);if(!d&&v){let g=Object.assign({},s);g.wallet=v&&{address:v.address,chainType:v.chainType,chainId:v.chainId,walletClient:v.walletClient,walletClientType:v.walletClientType,connectorType:v.connectorType},u(g)}w.current=h},[h]);let er={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:ri,linkWallet:Xo,linkEmail:()=>{N(!0),pe("LINK_EMAIL_SCREEN")},linkPhone:()=>{N(!0),pe("LINK_PHONE_SCREEN")},linkGoogle:async()=>{await vo.initLoginWithOAuth("google")},linkTwitter:async()=>{await vo.initLoginWithOAuth("twitter")},linkDiscord:async()=>{await vo.initLoginWithOAuth("discord")},linkGithub:async()=>{await vo.initLoginWithOAuth("github")},linkApple:async()=>{await vo.initLoginWithOAuth("apple")},login:async()=>{if(n||(await new Promise(c=>{Mt(()=>c)}),Mt(null)),a){console.warn("Attempted to log in, but user is already logged in. Use a `link` helper instead.");return}ue()},logout:async()=>{await t.logout(),u(null),l(!1),C(null),N(!1),r(!1)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{var v;if(!s||!s.wallet)return new J;let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new J:d.proxyProvider},getEthersProvider:()=>{var v;if(!s||!s.wallet)return new oi.Web3Provider(new Xe(new J));let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new oi.Web3Provider(new Xe(new J)):new oi.Web3Provider(new Xe(d.proxyProvider))},getWeb3jsProvider:()=>{var v;if(!s||!s.wallet)return new Gt(new J);let c=h.find(g=>s.wallet&&g.address===s.wallet.address),d=(v=t.connectors)==null?void 0:v.walletConnectors.find(g=>g.wallets.find(le=>le.address===(c==null?void 0:c.address)));return!c||!d?new Gt(new J):new Gt(d.proxyProvider)},unlinkWallet:async c=>{let d=await t.unlinkWallet(c);return u(d),d},unlinkEmail:async c=>{let d=await t.unlinkEmail(c);return u(d),d},unlinkPhone:async c=>{let d=await t.unlinkPhone(c);return u(d),d},unlinkGoogle:async c=>{let d=await t.unlinkOAuth("google",c);return u(d),d},unlinkTwitter:async c=>{let d=await t.unlinkOAuth("twitter",c);return u(d),d},unlinkDiscord:async c=>{let d=await t.unlinkOAuth("discord",c);return u(d),d},unlinkGithub:async c=>{let d=await t.unlinkOAuth("github",c);return u(d),d},unlinkApple:async c=>{let d=await t.unlinkOAuth("apple",c);return u(d),d},setActiveWallet:async c=>{let d=h.find(g=>(0,Mr.getAddress)(g.address)===(0,Mr.getAddress)(c)),v=s==null?void 0:s.linkedAccounts.find(g=>g.type==="wallet"&&(0,Mr.getAddress)(g.address)===(0,Mr.getAddress)(c));if(!d||!await d.isConnected())O(c),Xo();else if(!d.linked)d.loginOrLink();else{let g=Object.assign({},s);g.wallet=v&&{address:v.address,chainType:v.chainType,chainId:v.chainId,walletClient:v.walletClient,walletClientType:v.walletClientType,connectorType:v.connectorType},u(g)}},forkSession:()=>t.forkSession(),createWallet:()=>new Promise((c,d)=>{if(!a||!s){d(new Error("User must be authenticated before creating a Privy wallet"));return}if(te(s)){d(new Error("Only one Privy wallet per user is currently allowed"));return}B(!0),de({createWallet:{onSuccess:c,onFailure:d,callAuthOnSuccessOnClose:!1}}),pe("EMBEDDED_WALLET_SCREEN")}),signMessage:(c,d)=>new Promise((v,g)=>{if(!a||!s){g(new Error("User must be authenticated before signing with a Privy wallet"));return}if(!te(s)){g(new Error("Must have a Privy wallet before signing"));return}if(typeof c!="string"||c.length<1){g(new Error("Message must be a non-empty string"));return}B(!0);let bo={message:c,onSuccess:v,onFailure:g,uiOptions:d||{}},ni={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:g};de({signMessage:bo,connectWallet:ni}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),sendTransaction:(c,d)=>new Promise(async(v,g)=>{if(!a||!s){g(new Error("User must be authenticated before signing with a Privy wallet"));return}if(!te(s)){g(new Error("Must have a Privy wallet before signing"));return}B(!0);let bo={transactionRequest:c,onSuccess:v,onFailure:g,uiOptions:d||{}},ni={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:g};de({connectWallet:ni,sendTransaction:bo}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")}),exportWallet:()=>new Promise((c,d)=>{if(!a||!s){d(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!te(s)){d(new Error("Must have a Privy wallet before exporting"));return}B(!0);let g={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:d},le={appId:e.appId,origin:t.apiUrl,onSuccess:c,onFailure:d};de({keyExport:le,connectWallet:g}),pe("EMBEDDED_WALLET_CONNECTING_SCREEN")})};zc=er.signMessage,Vc=er.sendTransaction;let vo=(()=>({isNewUserThisSession:m,isLinking:S,linkingHint:I,walletConnectionStatus:x,getAuthFlow:()=>t.authFlow,getAuthMeta:()=>{var c;return(c=t.authFlow)==null?void 0:c.meta},closePrivyModal:(c={shouldCallAuthOnSuccess:!0})=>{var v;let d=n&&a&&s;c.shouldCallAuthOnSuccess&&d&&((v=e.onSuccess)==null||v.call(e,s,m)),t.authFlow=void 0,O(null),C(null),N(!1),f(!1),r(!1),t.createAnalyticsEvent("modal_closed")},connectWallet:yo,initLoginWithWallet:se,loginWithWallet:async()=>{if(!(t.authFlow instanceof eo))throw new A("Must initialize SIWE flow first.");let c,d;S?c=await t.link():{user:c,isNewUser:d}=await t.authenticate(),u(c||s||null),f(d||!1),l(!0)},initLoginWithOAuth:async c=>{t.startAuthFlow(new Dt(c));let d=await t.authFlow.getAuthorizationUrl();d&&d.url&&window.location.assign(d.url)},loginWithOAuth:async()=>{if(!(t.authFlow instanceof Dt))throw new A("Must initialize OAuth flow before calling loginWithOAuth");let c,d;n&&a?c=await t.link():{user:c,isNewUser:d}=await t.authenticate(),u(c),f(d||!1),l(!0)},initLoginWithEmail:async c=>{let d=new Xt(c);t.startAuthFlow(d),await d.sendCodeEmail()},initLoginWithSms:async c=>{let d=new to(c);t.startAuthFlow(d),await d.sendSmsCode()},resendEmailCode:async()=>{var c;await((c=t.authFlow)==null?void 0:c.sendCodeEmail())},resendSmsCode:async()=>{var c;await((c=t.authFlow)==null?void 0:c.sendSmsCode())},loginWithCode:async c=>{if(t.authFlow instanceof Xt)t.authFlow.meta.emailCode=c.trim();else if(t.authFlow instanceof to)t.authFlow.meta.smsCode=c.trim();else throw new A("Must initialize a passwordless code flow first");let d,v;S?d=await t.link():{user:d,isNewUser:v}=await t.authenticate(),u(d||s||null),f(v||!1),l(!0)},refreshUser:async()=>{let c=await t.getAuthenticatedUser();return u(c),c},walletProxy:L,createAnalyticsEvent:(c,d,v)=>t.createAnalyticsEvent(c,d,v),getUsdTokenPrice:c=>t.getUsdTokenPrice(c),recoverEmbeddedWallet:c=>new Promise((d,v)=>{if(!a||!s){v(new Error("User must be authenticated before recovering the Privy wallet"));return}let g=te(s);if(!g){v(new Error("Must have a Privy wallet in order to recover it"));return}B(!0),de({recoverWallet:{privyWallet:g,onCompleteNavigateTo:c,onFailure:v,onSuccess:d}}),pe("EMBEDDED_WALLET_RECOVERY_SCREEN")})}))(),qc=(0,H.useMemo)(()=>({wallets:h}),[h]);return(0,Ct.jsx)(xi.Provider,{value:er,children:(0,Ct.jsxs)(la.Provider,{value:qc,children:[e.children,(0,Ct.jsxs)(Ei.Provider,{value:vo,children:[(0,Ct.jsx)(Nc,{theme:{...ee.appearance.palette||{}}}),(0,Ct.jsx)(ms,{appConfig:ee,data:ne,setModalData:de,initialScreen:p,visible:o,authenticated:a,children:o&&(0,Ct.jsx)(Oc,{})}),z&&(0,Ct.jsx)(Fc,{appId:e.appId,origin:t.apiUrl,onLoad:he,onLoadFailed:()=>null})]})]})})};0&&(module.exports={AsExternalProvider,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,VERSION,WalletConnector,getAccessToken,usePrivy,useWallets});
|