@privy-io/react-auth 1.64.1 → 1.64.2-beta-20240516031853
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 +129 -115
- package/dist/index.js +162 -148
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var q3=Object.create;var ms=Object.defineProperty;var $3=Object.getOwnPropertyDescriptor;var K3=Object.getOwnPropertyNames;var j3=Object.getPrototypeOf,Y3=Object.prototype.hasOwnProperty;var Z3=(e,t)=>{for(var r in t)ms(e,r,{get:t[r],enumerable:!0})},Wp=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of K3(t))!Y3.call(e,n)&&n!==r&&ms(e,n,{get:()=>t[n],enumerable:!(o=$3(t,n))||o.enumerable});return e};var m=(e,t,r)=>(r=e!=null?q3(j3(e)):{},Wp(t||!e||!e.__esModule?ms(r,"default",{value:e,enumerable:!0}):r,e)),J3=e=>Wp(ms({},"__esModule",{value:!0}),e);var Kc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Lp=(e,t,r)=>(Kc(e,t,"read from private field"),r?r.call(e):t.get(e)),fs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},jc=(e,t,r,o)=>(Kc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Op=(e,t,r)=>(Kc(e,t,"access private method"),r);var e5={};Z3(e5,{AsExternalProvider:()=>Jr,Captcha:()=>Tl,ConnectorManager:()=>xi,PrivyClient:()=>_i,PrivyProvider:()=>u3,PrivyProxyProvider:()=>Ze,SUPPORTED_CHAINS:()=>Ti,VERSION:()=>Ws,WalletConnector:()=>Zt,addRpcUrlOverrideToChain:()=>B3,errorIndicatesMaxMfaRetries:()=>$l,errorIndicatesMfaTimeout:()=>mn,errorIndicatesMfaVerificationFailed:()=>fn,getAccessToken:()=>Oe,useConnectWallet:()=>P3,useCreateWallet:()=>S3,useExperimentalFarcasterSigner:()=>F3,useFundWallet:()=>x3,useLinkAccount:()=>b3,useLogin:()=>f3,useLoginWithEmail:()=>v3,useLoginWithOAuth:()=>g3,useLoginWithSms:()=>C3,useLogout:()=>y3,useMfa:()=>oa,useMfaEnrollment:()=>qr,useModalStatus:()=>N3,usePrivy:()=>H,useRegisterMfaListener:()=>Al,useSendTransaction:()=>k3,useSetWalletPassword:()=>R3,useSignMessage:()=>M3,useSignTypedData:()=>L3,useToken:()=>U3,useWallets:()=>ua});module.exports=J3(e5);var ds=require("@ethersproject/address"),Vc=require("@ethersproject/providers"),s3=require("mipd"),ie=require("react");var Np=require("ofetch"),at=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Yr=class extends at{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},T=class extends at{constructor(r,o,n){super(r,o,n);this.type="client_error"}},hs=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var de=class extends at{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},Ce=e=>{if(e instanceof at)return e;if(!(e instanceof Np.FetchError))return Ft(e);if(!e.response)return new Yr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yr(t||"ApiError",e.response.status,r||o,e,n)},Ft=e=>e instanceof at?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var tn=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Yt=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ys=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mo=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var gs="/api/v1/sessions",vs="/api/v1/sessions/logout",Dp="/api/v1/sessions/fork",Cs="/api/v1/sessions/fork/recover",Up="/api/v1/siwe/init",Fp="/api/v1/siwe/authenticate",Bp="/api/v1/siwe/link",Hp="/api/v1/siwe/unlink",Gp="/api/v1/farcaster/init",Vp="/api/v1/farcaster/authenticate",zp="/api/v1/farcaster/link",qp="/api/v1/farcaster/status",$p="/api/v1/farcaster/unlink",Kp="/api/v1/passwordless/init",jp="/api/v1/passwordless/authenticate",Yp="/api/v1/passwordless/link",Zp="/api/v1/passwordless/unlink",Jp="/api/v1/passwordless/update",Qp="/api/v1/passwordless_sms/init",Xp="/api/v1/passwordless_sms/link",eu="/api/v1/passwordless_sms/unlink",tu="/api/v1/passwordless_sms/authenticate",ru="/api/v1/oauth/init",ou="/api/v1/oauth/authenticate",nu="/api/v1/oauth/link",iu="/api/v1/oauth/unlink",au="/api/v1/recovery/oauth/init",su="/api/v1/recovery/oauth/authenticate",lu="/api/v1/passkeys/link/init",cu="/api/v1/passkeys/authenticate/init",du="/api/v1/passkeys/link",pu="/api/v1/passkeys/authenticate",uu="/api/v1/passkeys/unlink";var mu="/api/v1/mfa/passwordless_sms/init",fu="/api/v1/mfa/passkeys/init",hu="/api/v1/users/me/accept_terms",ws="/api/v1/analytics_events",yu="/api/v1/plugins/moonpay_on_ramp/sign",gu="/api/v1/custom_jwt_account/authenticate";var di=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(gu,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){throw new Error("Unimplemented")}};var rn=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(jp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Yp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw Ce(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Kp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw Ce(o)}}},bs=class extends rn{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Jp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw Ce(r)}}};var Is=require("react-device-detect");var Yc=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Es=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Zc(){try{let e="privy:__session_storage__test",t="blobby",r=new Es;return r.put(e,t),r.del(e),!0}catch{return!1}}function Q3(){return typeof window<"u"&&window.localStorage?new Es:new Yc}var oe=Q3();var pi=require("@ethersproject/providers");function vu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ps=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Jc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ps(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Jc(r))return!1}return!0},on=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Cu=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var wu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Ts=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,}))$/),bu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},nn=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},Qc=e=>new Promise(t=>setTimeout(t,e));function Eu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var Pu=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Qc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},Ss=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var Tu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Wn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Su(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of vu()){let u=Ps(c);if(!l.some(f=>f.info.name===u)){if(Jc(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(f=>f.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function ui(e){return`eip155:${String(Number(e))}`}var xs=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new de(`No RPC url found for ${e}`);return a},xu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new de(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Wo=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new pi.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new pi.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new pi.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new pi.StaticJsonRpcProvider(i.rpcUrls.public.http[0]):a=new pi.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new de(`No RPC url found for ${e}`);return a},_s=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ks=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(As))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var As={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function X3(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function _u(e,t){let r=X3(t);if(r.deepLink)return Mu(r.deepLink,e);if(r.universalLink)return Wu(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var ku="WALLETCONNECT_DEEPLINK_CHOICE";function Au(){try{localStorage.removeItem(ku)}catch{}}function Ru({href:e,name:t}){try{localStorage.setItem(ku,JSON.stringify({href:e,name:t}))}catch{}}function Iu(e){return e.startsWith("http://")||e.startsWith("https://")}function Mu(e,t){if(Iu(e))return Wu(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Wu(e,t){if(!Iu(e))return Mu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Rs(e,t){window.open(e,t,"noreferrer noopener")}var et=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 ha=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new et(this._startChannelOnce.bind(this)),this.pollForReady=new et(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Vp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(zp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw Ce(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Gp,{token:this.captchaToken});Is.isMobile&&!Is.isIOS&&t.connect_uri&&Rs(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(qp,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var Lu="1.64.1";var Ou="34357d3c125c2bcf2ce2bc3309d98715",Ms="https://auth.privy.io",Nu=2e4,st=1400,Du=2500,Ws=Lu;var Ln="privy:token",Xc="privy-token",Ls="privy:refresh_token",ed="privy-refresh-token",Os="privy-session",ya="privy:session_transfer_token",t0="privy:wallet",ga="privy:caid",On="privy:state_code",Nn="privy:code_verifier",Dn="privy:headless_oauth",Ns=e=>`${t0}:${e}`,td="privy:connectors",rd="privy:connections";var Un=12e4,Lo=1,od="0x1",mi=3e4,Uu="https://api.moonpay.com/v1",Fu="https://api.moonpay.com/v1",Bu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Hu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Gu="0x420000000000000000000000000000000000000F",Vu=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var nd=require("jose");async function zu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function qu(e){return crypto.getRandomValues(new Uint8Array(e))}var r0="S256",o0="S256";function va(){return nd.base64url.encode(qu(36))}function Ds(){return va()}async function Us(e,t=r0){if(t==o0){let r=await zu(e);return nd.base64url.encode(r)}else return e}function $u(){let e=oe.get(Nn);if(!e)throw new T("Authentication error.");return e}function Fs(){return!!oe.get(Dn)}var fo=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Fs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=$u();try{let r=await this.api.post(ou,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(Nn),this.meta.headless&&oe.del(Dn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=Ce(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=oe.get(Nn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(nu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(Nn),r}catch(r){throw Ce(r)}}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=va();oe.put(Nn,t);let r=Ds();oe.put(On,r);let o=await Us(t);this.meta.headless&&oe.put(Dn,!0);try{return await this.api.post(ru,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw Ce(n)}}};function id(e){return e.charAt(0).toUpperCase()+e.slice(1)}var Ca=require("react/jsx-runtime"),Bs=({style:e,...t})=>(0,Ca.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,Ca.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,Ca.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 an=require("react/jsx-runtime"),Hs=({style:e,...t})=>(0,an.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,an.jsx)("g",{clipPath:"url(#clip0)",children:(0,an.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,an.jsx)("defs",{children:(0,an.jsx)("clipPath",{id:"clip0",children:(0,an.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var ad=require("react/jsx-runtime"),Gs=({style:e,...t})=>(0,ad.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,ad.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});var Fn=require("react/jsx-runtime"),Vs=({style:e,...t})=>(0,Fn.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,Fn.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,Fn.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,Fn.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,Fn.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 bt=require("react/jsx-runtime");function zs(e){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[(0,bt.jsxs)("defs",{children:[(0,bt.jsxs)("linearGradient",{id:"b",children:[(0,bt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,bt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,bt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,bt.jsxs)("linearGradient",{id:"a",children:[(0,bt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,bt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,bt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,bt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,bt.jsx)("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),(0,bt.jsx)("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),(0,bt.jsx)("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,bt.jsx)("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,bt.jsx)("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}var wa=require("react/jsx-runtime");function qs({style:e,...t}){return(0,wa.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,wa.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,wa.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,wa.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var ba=require("react/jsx-runtime");function $s(e){return(0,ba.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,ba.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,ba.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var fi=require("react/jsx-runtime");function Ks(e){return(0,fi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,fi.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,fi.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,fi.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var sd=require("react/jsx-runtime"),js=({style:e,...t})=>(0,sd.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,sd.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});var n0={google:{name:"Google",component:Vs},discord:{name:"Discord",component:Hs},github:{name:"Github",component:Gs},linkedin:{name:"LinkedIn",component:qs},twitter:{name:"Twitter",component:js},spotify:{name:"Spotify",component:$s},instagram:{name:"Instagram",component:zs},tiktok:{name:"Tiktok",component:Ks},apple:{name:"Apple",component:Bs}},Ea=e=>n0[e];function Ku(e,t){let r={detail:"",retryable:!1},o=id(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=Ea(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Ea(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Pa(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Fs(),popupFlow:window.opener!==null}}function Bn(){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"),oe.del(On),window.history.replaceState({},"",e)}var Hn=class{constructor(t){this.initAuthenticateOnce=new et(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new et(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(pu,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):Ce(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(du,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):Ce(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(cu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(lu,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Gn=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var q3=Object.create;var fs=Object.defineProperty;var $3=Object.getOwnPropertyDescriptor;var K3=Object.getOwnPropertyNames;var j3=Object.getPrototypeOf,Y3=Object.prototype.hasOwnProperty;var Z3=(e,t)=>{for(var r in t)fs(e,r,{get:t[r],enumerable:!0})},Wp=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of K3(t))!Y3.call(e,n)&&n!==r&&fs(e,n,{get:()=>t[n],enumerable:!(o=$3(t,n))||o.enumerable});return e};var m=(e,t,r)=>(r=e!=null?q3(j3(e)):{},Wp(t||!e||!e.__esModule?fs(r,"default",{value:e,enumerable:!0}):r,e)),J3=e=>Wp(fs({},"__esModule",{value:!0}),e);var Kc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Lp=(e,t,r)=>(Kc(e,t,"read from private field"),r?r.call(e):t.get(e)),hs=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},jc=(e,t,r,o)=>(Kc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Op=(e,t,r)=>(Kc(e,t,"access private method"),r);var o5={};Z3(o5,{AsExternalProvider:()=>Jr,Captcha:()=>Sl,ConnectorManager:()=>xi,PrivyClient:()=>_i,PrivyProvider:()=>u3,PrivyProxyProvider:()=>Je,SUPPORTED_CHAINS:()=>Ti,VERSION:()=>Ls,WalletConnector:()=>Zt,addRpcUrlOverrideToChain:()=>B3,errorIndicatesMaxMfaRetries:()=>Kl,errorIndicatesMfaTimeout:()=>mn,errorIndicatesMfaVerificationFailed:()=>fn,getAccessToken:()=>Oe,useConnectWallet:()=>P3,useCreateWallet:()=>S3,useExperimentalFarcasterSigner:()=>F3,useFundWallet:()=>x3,useLinkAccount:()=>b3,useLogin:()=>f3,useLoginWithEmail:()=>v3,useLoginWithOAuth:()=>g3,useLoginWithSms:()=>C3,useLogout:()=>y3,useMfa:()=>oa,useMfaEnrollment:()=>$r,useModalStatus:()=>N3,usePrivy:()=>H,useRegisterMfaListener:()=>Rl,useSendTransaction:()=>k3,useSetWalletPassword:()=>R3,useSignMessage:()=>M3,useSignTypedData:()=>L3,useToken:()=>U3,useWallets:()=>ua});module.exports=J3(o5);var ps=require("@ethersproject/address"),Vc=require("@ethersproject/providers"),s3=require("mipd"),ie=require("react");var Np=require("ofetch"),at=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Yr=class extends at{constructor(r,o,n,i,a){super(n,i,a);this.type=r;this.status=o}},T=class extends at{constructor(r,o,n){super(r,o,n);this.type="client_error"}},ys=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var de=class extends at{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},Ce=e=>{if(e instanceof at)return e;if(!(e instanceof Np.FetchError))return Ft(e);if(!e.response)return new Yr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yr(t||"ApiError",e.response.status,r||o,e,n)},Ft=e=>e instanceof at?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var tn=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Yt=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},gs=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mo=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var vs="/api/v1/sessions",Cs="/api/v1/sessions/logout",Dp="/api/v1/sessions/fork",ws="/api/v1/sessions/fork/recover",Up="/api/v1/siwe/init",Fp="/api/v1/siwe/authenticate",Bp="/api/v1/siwe/link",Hp="/api/v1/siwe/unlink",Gp="/api/v1/farcaster/init",Vp="/api/v1/farcaster/authenticate",zp="/api/v1/farcaster/link",qp="/api/v1/farcaster/status",$p="/api/v1/farcaster/unlink",Kp="/api/v1/passwordless/init",jp="/api/v1/passwordless/authenticate",Yp="/api/v1/passwordless/link",Zp="/api/v1/passwordless/unlink",Jp="/api/v1/passwordless/update",Qp="/api/v1/passwordless_sms/init",Xp="/api/v1/passwordless_sms/link",eu="/api/v1/passwordless_sms/unlink",tu="/api/v1/passwordless_sms/authenticate",ru="/api/v1/oauth/init",ou="/api/v1/oauth/authenticate",nu="/api/v1/oauth/link",iu="/api/v1/oauth/unlink",au="/api/v1/recovery/oauth/init",su="/api/v1/recovery/oauth/authenticate",lu="/api/v1/passkeys/link/init",cu="/api/v1/passkeys/authenticate/init",du="/api/v1/passkeys/link",pu="/api/v1/passkeys/authenticate",uu="/api/v1/passkeys/unlink";var mu="/api/v1/mfa/passwordless_sms/init",fu="/api/v1/mfa/passkeys/init",hu="/api/v1/users/me/accept_terms",bs="/api/v1/analytics_events",yu="/api/v1/plugins/moonpay_on_ramp/sign",gu="/api/v1/custom_jwt_account/authenticate";var di=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(gu,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){throw new Error("Unimplemented")}};var rn=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(jp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Yp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw Ce(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Kp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw Ce(o)}}},Es=class extends rn{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Jp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw Ce(r)}}};var Ms=require("react-device-detect");var Yc=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ps=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function Zc(){try{let e="privy:__session_storage__test",t="blobby",r=new Ps;return r.put(e,t),r.del(e),!0}catch{return!1}}function Q3(){return typeof window<"u"&&window.localStorage?new Ps:new Yc}var oe=Q3();var pi=require("@ethersproject/providers");function vu(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ts=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var Jc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ts(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Jc(r))return!1}return!0},on=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Cu=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var wu=(e,t)=>{let r=[],o=[];for(let[n,i]of e.entries())n<t?r.push(i):o.push(i);return[r,o]},Ss=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,}))$/),bu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},nn=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let i=e.slice(0,o+t),a=e.slice(e.length-r,e.length);return`${i}...${a}`},Qc=e=>new Promise(t=>setTimeout(t,e));function Eu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let i=0,a,l=()=>{if(i>=r){n("Max attempts reached without result");return}if(a=e(),i+=t,a!=null){o(a);return}setTimeout(l,t)};l()})}var Pu=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,i)=>{let a=!1,l=0;for(;!a&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{a=!0,n()},(...s)=>{a=!0,i(...s)}),l+=1,await Qc(r)}a||i(new Error("Exceeded max attempts before resolving function"))})},xs=(e,t,r={})=>{let o=new URL(t,e);for(let[n,i]of Object.entries(r))o.searchParams.set(n,i);return o.href};var Tu=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),Wn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Su(e,t,r=3e3){let o=!1,n=window;return new Promise(i=>{n.ethereum?a():(window.addEventListener("ethereum#initialized",a,{once:!0}),setTimeout(()=>{a()},r));function a(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",a);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of vu()){let u=Ts(c);if(!l.some(f=>f.info.name===u)){if(Jc(c,!0)&&!s.find(f=>f.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(f=>f.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(f=>f.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(f=>f.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}i(s)}})}function ui(e){return`eip155:${String(Number(e))}`}var _s=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0])a=i.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])a=r.rpcUrls[n];else if(i.rpcUrls.privy?.http[0]){let l=new URL(i.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),a=l.toString()}else i.rpcUrls.public?.http[0]?a=i.rpcUrls.public.http[0]:a=i.rpcUrls.default?.http[0];if(!a)throw new de(`No RPC url found for ${e}`);return a},xu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new de(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Wo=(e,t,r,o)=>{let n=Number(e),i=t.find(l=>l.id===n);if(!i)throw new de(`Unsupported chainId ${e}`,4901);let a;if(i.rpcUrls.privyWalletOverride&&i.rpcUrls.privyWalletOverride.http[0]?a=new pi.StaticJsonRpcProvider(i.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?a=new pi.StaticJsonRpcProvider(r.rpcUrls[n]):i.rpcUrls.privy?.http[0]?a=new pi.StaticJsonRpcProvider({url:i.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):i.rpcUrls.public?.http[0]?a=new pi.StaticJsonRpcProvider(i.rpcUrls.public.http[0]):a=new pi.StaticJsonRpcProvider(i.rpcUrls.default?.http[0]),!a)throw new de(`No RPC url found for ${e}`);return a},ks=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var As=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rs))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rs={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function X3(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function _u(e,t){let r=X3(t);if(r.deepLink)return Mu(r.deepLink,e);if(r.universalLink)return Wu(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var ku="WALLETCONNECT_DEEPLINK_CHOICE";function Au(){try{localStorage.removeItem(ku)}catch{}}function Ru({href:e,name:t}){try{localStorage.setItem(ku,JSON.stringify({href:e,name:t}))}catch{}}function Iu(e){return e.startsWith("http://")||e.startsWith("https://")}function Mu(e,t){if(Iu(e))return Wu(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Wu(e,t){if(!Iu(e))return Mu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Is(e,t){window.open(e,t,"noreferrer noopener")}var et=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 ya=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new et(this._startChannelOnce.bind(this)),this.pollForReady=new et(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Vp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(zp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw Ce(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Gp,{token:this.captchaToken});Ms.isMobile&&!Ms.isIOS&&t.connect_uri&&Is(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(qp,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var Lu="1.64.2-beta-20240516031853";var Ou="34357d3c125c2bcf2ce2bc3309d98715",Ws="https://auth.privy.io",Nu=2e4,st=1400,Du=2500,Ls=Lu;var Ln="privy:token",Xc="privy-token",Os="privy:refresh_token",ed="privy-refresh-token",Ns="privy-session",ga="privy:session_transfer_token",t0="privy:wallet",va="privy:caid",On="privy:state_code",Nn="privy:code_verifier",Dn="privy:headless_oauth",Ds=e=>`${t0}:${e}`,td="privy:connectors",rd="privy:connections";var Un=12e4,Lo=1,od="0x1",mi=3e4,Uu="https://api.moonpay.com/v1",Fu="https://api.moonpay.com/v1",Bu="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Hu="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Gu="0x420000000000000000000000000000000000000F",Vu=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var nd=require("jose");async function zu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function qu(e){return crypto.getRandomValues(new Uint8Array(e))}var r0="S256",o0="S256";function Ca(){return nd.base64url.encode(qu(36))}function Us(){return Ca()}async function Fs(e,t=r0){if(t==o0){let r=await zu(e);return nd.base64url.encode(r)}else return e}function $u(){let e=oe.get(Nn);if(!e)throw new T("Authentication error.");return e}function Bs(){return!!oe.get(Dn)}var fo=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Bs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=$u();try{let r=await this.api.post(ou,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(Nn),this.meta.headless&&oe.del(Dn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user,oauth_provider_tokens:r.oauth_provider_tokens}}catch(r){let o=Ce(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=oe.get(Nn);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(nu,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return oe.del(Nn),r}catch(r){throw Ce(r)}}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=Ca();oe.put(Nn,t);let r=Us();oe.put(On,r);let o=await Fs(t);this.meta.headless&&oe.put(Dn,!0);try{return await this.api.post(ru,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw Ce(n)}}};function id(e){return e.charAt(0).toUpperCase()+e.slice(1)}var wa=require("react/jsx-runtime"),Hs=({style:e,...t})=>(0,wa.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,wa.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,wa.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 an=require("react/jsx-runtime"),Gs=({style:e,...t})=>(0,an.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,an.jsx)("g",{clipPath:"url(#clip0)",children:(0,an.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,an.jsx)("defs",{children:(0,an.jsx)("clipPath",{id:"clip0",children:(0,an.jsx)("rect",{width:"71",height:"55",fill:"white"})})})]});var ad=require("react/jsx-runtime"),Vs=({style:e,...t})=>(0,ad.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,ad.jsx)("path",{d:"M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z",fill:"#171515"})});var Fn=require("react/jsx-runtime"),zs=({style:e,...t})=>(0,Fn.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,Fn.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,Fn.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,Fn.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,Fn.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 bt=require("react/jsx-runtime");function qs(e){return(0,bt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:26,height:26,viewBox:"0 0 140 140",x:"0px",y:"0px",fill:"none",...e,children:[(0,bt.jsxs)("defs",{children:[(0,bt.jsxs)("linearGradient",{id:"b",children:[(0,bt.jsx)("stop",{offset:"0",stopColor:"#3771c8"}),(0,bt.jsx)("stop",{stopColor:"#3771c8",offset:".128"}),(0,bt.jsx)("stop",{offset:"1",stopColor:"#60f",stopOpacity:"0"})]}),(0,bt.jsxs)("linearGradient",{id:"a",children:[(0,bt.jsx)("stop",{offset:"0",stopColor:"#fd5"}),(0,bt.jsx)("stop",{offset:".1",stopColor:"#fd5"}),(0,bt.jsx)("stop",{offset:".5",stopColor:"#ff543e"}),(0,bt.jsx)("stop",{offset:"1",stopColor:"#c837ab"})]}),(0,bt.jsx)("radialGradient",{id:"c",cx:"158.429",cy:"578.088",r:"65",xlinkHref:"#a",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(0 -1.98198 1.8439 0 -1031.402 454.004)",fx:"158.429",fy:"578.088"}),(0,bt.jsx)("radialGradient",{id:"d",cx:"147.694",cy:"473.455",r:"65",xlinkHref:"#b",gradientUnits:"userSpaceOnUse",gradientTransform:"matrix(.17394 .86872 -3.5818 .71718 1648.348 -458.493)",fx:"147.694",fy:"473.455"})]}),(0,bt.jsx)("path",{fill:"url(#c)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,bt.jsx)("path",{fill:"url(#d)",d:"M65.03 0C37.888 0 29.95.028 28.407.156c-5.57.463-9.036 1.34-12.812 3.22-2.91 1.445-5.205 3.12-7.47 5.468C4 13.126 1.5 18.394.595 24.656c-.44 3.04-.568 3.66-.594 19.188-.01 5.176 0 11.988 0 21.125 0 27.12.03 35.05.16 36.59.45 5.42 1.3 8.83 3.1 12.56 3.44 7.14 10.01 12.5 17.75 14.5 2.68.69 5.64 1.07 9.44 1.25 1.61.07 18.02.12 34.44.12 16.42 0 32.84-.02 34.41-.1 4.4-.207 6.955-.55 9.78-1.28 7.79-2.01 14.24-7.29 17.75-14.53 1.765-3.64 2.66-7.18 3.065-12.317.088-1.12.125-18.977.125-36.81 0-17.836-.04-35.66-.128-36.78-.41-5.22-1.305-8.73-3.127-12.44-1.495-3.037-3.155-5.305-5.565-7.624C116.9 4 111.64 1.5 105.372.596 102.335.157 101.73.027 86.19 0H65.03z",transform:"translate(1.004 1)"}),(0,bt.jsx)("path",{fill:"#fff",d:"M66.004 18c-13.036 0-14.672.057-19.792.29-5.11.234-8.598 1.043-11.65 2.23-3.157 1.226-5.835 2.866-8.503 5.535-2.67 2.668-4.31 5.346-5.54 8.502-1.19 3.053-2 6.542-2.23 11.65C18.06 51.327 18 52.964 18 66s.058 14.667.29 19.787c.235 5.11 1.044 8.598 2.23 11.65 1.227 3.157 2.867 5.835 5.536 8.503 2.667 2.67 5.345 4.314 8.5 5.54 3.054 1.187 6.543 1.996 11.652 2.23 5.12.233 6.755.29 19.79.29 13.037 0 14.668-.057 19.788-.29 5.11-.234 8.602-1.043 11.656-2.23 3.156-1.226 5.83-2.87 8.497-5.54 2.67-2.668 4.31-5.346 5.54-8.502 1.18-3.053 1.99-6.542 2.23-11.65.23-5.12.29-6.752.29-19.788 0-13.036-.06-14.672-.29-19.792-.24-5.11-1.05-8.598-2.23-11.65-1.23-3.157-2.87-5.835-5.54-8.503-2.67-2.67-5.34-4.31-8.5-5.535-3.06-1.187-6.55-1.996-11.66-2.23-5.12-.233-6.75-.29-19.79-.29zm-4.306 8.65c1.278-.002 2.704 0 4.306 0 12.816 0 14.335.046 19.396.276 4.68.214 7.22.996 8.912 1.653 2.24.87 3.837 1.91 5.516 3.59 1.68 1.68 2.72 3.28 3.592 5.52.657 1.69 1.44 4.23 1.653 8.91.23 5.06.28 6.58.28 19.39s-.05 14.33-.28 19.39c-.214 4.68-.996 7.22-1.653 8.91-.87 2.24-1.912 3.835-3.592 5.514-1.68 1.68-3.275 2.72-5.516 3.59-1.69.66-4.232 1.44-8.912 1.654-5.06.23-6.58.28-19.396.28-12.817 0-14.336-.05-19.396-.28-4.68-.216-7.22-.998-8.913-1.655-2.24-.87-3.84-1.91-5.52-3.59-1.68-1.68-2.72-3.276-3.592-5.517-.657-1.69-1.44-4.23-1.653-8.91-.23-5.06-.276-6.58-.276-19.398s.046-14.33.276-19.39c.214-4.68.996-7.22 1.653-8.912.87-2.24 1.912-3.84 3.592-5.52 1.68-1.68 3.28-2.72 5.52-3.592 1.692-.66 4.233-1.44 8.913-1.655 4.428-.2 6.144-.26 15.09-.27zm29.928 7.97c-3.18 0-5.76 2.577-5.76 5.758 0 3.18 2.58 5.76 5.76 5.76 3.18 0 5.76-2.58 5.76-5.76 0-3.18-2.58-5.76-5.76-5.76zm-25.622 6.73c-13.613 0-24.65 11.037-24.65 24.65 0 13.613 11.037 24.645 24.65 24.645C79.617 90.645 90.65 79.613 90.65 66S79.616 41.35 66.003 41.35zm0 8.65c8.836 0 16 7.163 16 16 0 8.836-7.164 16-16 16-8.837 0-16-7.164-16-16 0-8.837 7.163-16 16-16z"})]})}var ba=require("react/jsx-runtime");function $s({style:e,...t}){return(0,ba.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0,0,256,256",style:{height:"26px",width:"26px",...e},...t,children:(0,ba.jsx)("g",{fill:"#0077b5",strokeWidth:"1",strokeLinecap:"butt",strokeLinejoin:"miter",strokeMiterlimit:"10",style:{mixBlendMode:"normal"},children:(0,ba.jsx)("g",{transform:"scale(5.12,5.12)",children:(0,ba.jsx)("path",{d:"M41,4h-32c-2.76,0 -5,2.24 -5,5v32c0,2.76 2.24,5 5,5h32c2.76,0 5,-2.24 5,-5v-32c0,-2.76 -2.24,-5 -5,-5zM17,20v19h-6v-19zM11,14.47c0,-1.4 1.2,-2.47 3,-2.47c1.8,0 2.93,1.07 3,2.47c0,1.4 -1.12,2.53 -3,2.53c-1.8,0 -3,-1.13 -3,-2.53zM39,39h-6c0,0 0,-9.26 0,-10c0,-2 -1,-4 -3.5,-4.04h-0.08c-2.42,0 -3.42,2.06 -3.42,4.04c0,0.91 0,10 0,10h-6v-19h6v2.56c0,0 1.93,-2.56 5.81,-2.56c3.97,0 7.19,2.73 7.19,8.26z"})})})})}var Ea=require("react/jsx-runtime");function Ks(e){return(0,Ea.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 496 512",...e,children:[(0,Ea.jsx)("path",{fill:"#1ed760",d:"M248 8C111.1 8 0 119.1 0 256s111.1 248 248 248 248-111.1 248-248S384.9 8 248 8Z"}),(0,Ea.jsx)("path",{d:"M406.6 231.1c-5.2 0-8.4-1.3-12.9-3.9-71.2-42.5-198.5-52.7-280.9-29.7-3.6 1-8.1 2.6-12.9 2.6-13.2 0-23.3-10.3-23.3-23.6 0-13.6 8.4-21.3 17.4-23.9 35.2-10.3 74.6-15.2 117.5-15.2 73 0 149.5 15.2 205.4 47.8 7.8 4.5 12.9 10.7 12.9 22.6 0 13.6-11 23.3-23.2 23.3zm-31 76.2c-5.2 0-8.7-2.3-12.3-4.2-62.5-37-155.7-51.9-238.6-29.4-4.8 1.3-7.4 2.6-11.9 2.6-10.7 0-19.4-8.7-19.4-19.4s5.2-17.8 15.5-20.7c27.8-7.8 56.2-13.6 97.8-13.6 64.9 0 127.6 16.1 177 45.5 8.1 4.8 11.3 11 11.3 19.7-.1 10.8-8.5 19.5-19.4 19.5zm-26.9 65.6c-4.2 0-6.8-1.3-10.7-3.6-62.4-37.6-135-39.2-206.7-24.5-3.9 1-9 2.6-11.9 2.6-9.7 0-15.8-7.7-15.8-15.8 0-10.3 6.1-15.2 13.6-16.8 81.9-18.1 165.6-16.5 237 26.2 6.1 3.9 9.7 7.4 9.7 16.5s-7.1 15.4-15.2 15.4z"})]})}var fi=require("react/jsx-runtime");function js(e){return(0,fi.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",imageRendering:"optimizeQuality",shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",viewBox:"0 0 293768 333327",width:24,height:24,...e,children:[(0,fi.jsx)("path",{fill:"#26f4ee",d:"M204958 0c5369 45832 32829 78170 77253 81022v43471l-287 27V87593c-44424-2850-69965-30183-75333-76015l-47060-1v192819c6791 86790-60835 89368-86703 56462 30342 18977 79608 6642 73766-68039V0h58365zM78515 319644c-26591-5471-50770-21358-64969-44588-34496-56437-3401-148418 96651-157884v54345l-164 27v-40773C17274 145544 7961 245185 33650 286633c9906 15984 26169 27227 44864 33011z"}),(0,fi.jsx)("path",{fill:"#fb2c53",d:"M218434 11587c3505 29920 15609 55386 35948 70259-27522-10602-43651-34934-47791-70262l11843 3zm63489 82463c3786 804 7734 1348 11844 1611v51530c-25770 2537-48321-5946-74600-21749l4034 88251c0 28460 106 41467-15166 67648-34260 58734-95927 63376-137628 35401 54529 22502 137077-4810 136916-103049v-96320c26279 15803 48830 24286 74600 21748V94050zm-171890 37247c5390-1122 11048-1985 16998-2548v54345c-21666 3569-35427 10222-41862 22528-20267 38754 5827 69491 35017 74111-33931 5638-73721-28750-49999-74111 6434-12304 18180-18959 39846-22528v-51797zm64479-119719h1808-1808z"}),(0,fi.jsx)("path",{d:"M206590 11578c5369 45832 30910 73164 75333 76015v51528c-25770 2539-48321-5945-74600-21748v96320c206 125717-135035 135283-173673 72939-25688-41449-16376-141089 76383-155862v52323c-21666 3569-33412 10224-39846 22528-39762 76035 98926 121273 89342-1225V11577l47060 1z",fill:"#000000"})]})}var sd=require("react/jsx-runtime"),Ys=({style:e,...t})=>(0,sd.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",width:"24px",...e},...t,children:(0,sd.jsx)("path",{d:"M 14.285156 10.171875 L 23.222656 0 L 21.105469 0 L 13.34375 8.832031 L 7.148438 0 L 0 0 L 9.371094 13.355469 L 0 24.019531 L 2.117188 24.019531 L 10.308594 14.691406 L 16.851562 24.019531 L 24 24.019531 M 2.878906 1.5625 L 6.132812 1.5625 L 21.101562 22.535156 L 17.851562 22.535156",fill:"#000000"})});var n0={google:{name:"Google",component:zs},discord:{name:"Discord",component:Gs},github:{name:"Github",component:Vs},linkedin:{name:"LinkedIn",component:$s},twitter:{name:"Twitter",component:Ys},spotify:{name:"Spotify",component:Ks},instagram:{name:"Instagram",component:qs},tiktok:{name:"Tiktok",component:js},apple:{name:"Apple",component:Hs}},Pa=e=>n0[e];function Ku(e,t){let r={detail:"",retryable:!1},o=id(t);if(e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="too_many_requests"&&e.message.includes("provider rate limit")){let n=Pa(t).name;r.detail=`Request limit reached for ${n}. Please wait a moment and try again.`}if(e?.privyErrorCode==="oauth_account_suspended"){let n=Pa(t).name;r.detail=`Your ${n} account is suspended. Please try another login method.`}return r}function Ta(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:Bs(),popupFlow:window.opener!==null}}function Bn(){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"),oe.del(On),window.history.replaceState({},"",e)}var Hn=class{constructor(t){this.initAuthenticateOnce=new et(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new et(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(pu,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):Ce(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(du,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):Ce(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(cu,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(lu,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var Gn=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,i,a,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${r}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -9,7 +9,7 @@ Chain ID: ${t}
|
|
|
9
9
|
Nonce: ${a}
|
|
10
10
|
Issued At: ${i}
|
|
11
11
|
Resources:
|
|
12
|
-
- https://privy.io`;this.getNonceOnce=new et(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Fp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});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 T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Bp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw Ce(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Up,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){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,r,n,i,l,o,a)}};var Vn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(tu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Xp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw Ce(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Qp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw Ce(o)}}};var Gm=require("uuid");function X(e){return e?new Date(e*1e3):null}function i0(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let f={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let w={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(w);break;case"apple_oauth":let v={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let k={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(k);break;case"passkey":let P={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(P);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function yr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Ge=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,a0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Wr=(e,t)=>t==="all-users"&&!Ge(e)||t==="users-without-wallets"&&!a0(e)?.length;function Lr(e){if(!e)return null;let t=i0(e.linked_accounts),r=yr(t,"wallet"),o=yr(t,"email"),n=yr(t,"phone"),i=yr(t,"google_oauth"),a=yr(t,"twitter_oauth"),l=yr(t,"discord_oauth"),s=yr(t,"github_oauth"),c=yr(t,"spotify_oauth"),u=yr(t,"instagram_oauth"),f=yr(t,"tiktok_oauth"),y=yr(t,"linkedin_oauth"),g=yr(t,"apple_oauth"),w=yr(t,"farcaster"),v=e.mfa_methods.map(({type:P,verified_at:b})=>({type:P,verifiedAt:X(b)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},mfaMethods:v.map(P=>P.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var fd=require("@ethersproject/address"),Nm=require("@ethersproject/bytes"),Dm=m(require("eventemitter3"));var rm=m(require("@coinbase/wallet-sdk"));var Ta=require("react/jsx-runtime"),Ys=({style:e,...t})=>(0,Ta.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,Ta.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Ta.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 Qr=require("@ethersproject/address"),ld=require("@ethersproject/providers"),tm=m(require("eventemitter3"));var Zu=m(require("eventemitter3"));var s0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],ju=e=>s0.includes(e);var Yu=require("@ethersproject/logger");var hi=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},yi=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},Zr=e=>{if(e instanceof de)return e;if(e?.code&&e?.reason){let t=new tt(e);return e.code===Yu.ErrorCode.ACTION_REJECTED&&(t.details=Wt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new tt(e):new de("Unknown connector error",e)},gr=class extends at{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},tt=class extends gr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Wt).find(i=>i.eipCode===o.code);this.details=n||Wt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Wt.E32002_CONNECTION_ALREADY_PENDING:this.details=Wt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Wt.E32002_WALLET_LOCKED))}},l0={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}},c0={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},d0={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}},Wt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...d0,...c0},Oo={...l0,...Wt};var Ze=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new hi,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Un,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new de(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Zr(r)})}},sn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Zs=class extends Zu.default{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Wo(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=gi(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Oe()||!this.address)throw new sn("Disconnected",4900);return(await Xu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new sn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Wo(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await Ju(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Qu(_s(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:Wn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Wn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(ju(r.method)){let o=await Oe();if(await em(),!o||!this.address)throw new sn("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new sn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Oe();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Jr=class extends Ze{constructor(r){super(r,r.rpcTimeoutDuration)}},ln=class extends Ze{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var p0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Zt=class extends tm.default{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=ui(r),this.walletClientType==="privy"&&oe.put(Ns(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=gi(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>(0,Qr.getAddress)(a.address)===(0,Qr.getAddress)(r));return{address:(0,Qr.getAddress)(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new de("Wallet is not currently connected.");let l=this.wallets.find(y=>(0,Qr.getAddress)(y.address)===(0,Qr.getAddress)(r))?.chainId;if(!l)throw new de("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===ui(s))return;let u=this.chains.find(y=>y.id===c);if(!u)throw new de(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(y){if(p0(y,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&y.message?.includes("wallet_switchEthereumChain")?new de(`Rainbow does not support the chainId ${o}`):y}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return new ld.Web3Provider(new Jr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return new ln(this.proxyProvider)},sign:async a=>{if(!await i())throw new de("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=(0,Qr.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=oe.get(Ns(i));this.chains.find(u=>u.id===Number(c))||(oe.del(Ns(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${od}`,c),l=od}let s=ui(l);if(!a.find(c=>(0,Qr.getAddress)(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet((0,Qr.getAddress)(n),s,c))}Js(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,Qr.getAddress)(n)===(0,Qr.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new ld.Web3Provider(new Jr(this.proxyProvider)).getSigner().signMessage(r)}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 vi={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},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 u0=(e,t)=>{let o=xs(1,[vi],{},t);return e.makeWeb3Provider(o,1)},Qs,Xs=class extends Zt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;Qs||(Qs=new rm.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(u0(Qs,i))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Qs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Ys,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}};var cd=require("react/jsx-runtime"),el=({...e})=>(0,cd.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,cd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var tl=class extends Zt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Wn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:el,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var dd=require("react/jsx-runtime"),Ci=({style:e,...t})=>(0,dd.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,dd.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var Bt=require("react/jsx-runtime"),wi=({style:e,...t})=>(0,Bt.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,Bt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,Bt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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 Sa=require("react/jsx-runtime"),ho=({style:e,...t})=>(0,Sa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,Sa.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,Sa.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Ei=class extends Zt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}},bi,Pi=class extends Zt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";fs(this,bi,void 0);this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?jc(this,bi,{name:"MetaMask",icon:wi,id:"io.metamask"}):a==="phantom"&&jc(this,bi,{name:"Phantom",icon:ho,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Lp(this,bi)??{name:"Browser Extension",icon:Ci,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}};bi=new WeakMap;var m0=require("@ethersproject/address"),f0=require("@ethersproject/providers"),om=require("react-device-detect");var rl=class extends Ei{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{om.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Zr(t)}}};var ol=class extends Zt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Ze(void 0,Un);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var nl=class extends ol{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:ho,id:"phantom"}}};var Si=require("@walletconnect/ethereum-provider"),Lm=require("react-device-detect");var Nr=require("react");var nm=require("react/jsx-runtime");function il({src:e,...t}){return(0,nm.jsx)("img",{src:e,...t,style:{display:"none"}})}var yo=require("react"),km=require("react");var vr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Ou,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var im=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var h0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),am=e=>h0.has(e),sm=(e,t,r)=>r.indexOf(e)===t,lm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(am).filter(sm):e?e.filter(am).filter(sm):vr.appearance.walletList;var al={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},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 sl={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var ll={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var cm={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var dm={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var cl={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var dl={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var pl={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var pm={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var um={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var mm={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var fm={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 hm={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var ym={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var gm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},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 vm={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Cm={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var wm={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ul={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},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 ml={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var fl={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var xa={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},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 _a={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},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 bm={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Em={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Pm={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var hl={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var yl={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var gl={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Ti=[al,sl,ll,gm,Pm,vi,ul,ml,fl,xa,_a,um,mm,fm,hm,cl,dl,pl,pm,Cm,wm,cm,dm,hl,gl,yl,vm,bm,ym,Em],$b=new Set(Ti.map(e=>e.id));var cn=m(require("tinycolor2")),Tm="#FFFFFF",y0="#000000",g0=Tm,v0="#1E1E1D";function C0(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function No(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,cn.default)({...e.toHsl(),l:r})}function Sm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Tm,blackHex:a=y0}){let l;switch(e){case"light":l=g0;break;case"dark":l=v0;break;default:l=e;break}let s=(0,cn.default)(l),c=(0,cn.default)(t),u=(0,cn.default)(r),f=(0,cn.default)(o),y=(0,cn.default)(n),g=C0(s.getLuminance()),w=No(s,g==="light"?-.04:.11),v=No(s,g==="light"?-.88:.87),k=No(s,g==="light"?-.77:.75),P=No(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=No(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),A=No(c,.15),R=No(c,-.06),N=No(y,.3),L=(0,cn.default)(c.getLuminance()>.5?a:i),I=No(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:w.toHslString(),foreground:v.toHslString(),foreground2:k.toHslString(),foreground3:P.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:A.toHslString(),accentDark:R.toHslString(),foregroundAccent:L.toHslString(),success:u.toHslString(),successDark:I.toHslString(),error:y.toHslString(),errorLight:N.toHslString(),warn:f.toHslString()}}function pd(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","instagram","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(Mt=>n.includes(Mt)),a,l,s,c,u,f,y,g,w,v,k,P,b,A;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=i?.includes("google"),f=i?.includes("twitter"),y=i?.includes("discord"),w=i?.includes("spotify"),v=i?.includes("instagram"),g=i?.includes("tiktok"),P=i?.includes("github"),k=i?.includes("linkedin"),b=i?.includes("apple"),A=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,f=e.twitterOAuth,y=e.discordOAuth,P=e.githubOAuth,w=e.spotifyOAuth,v=e.instagramOAuth,g=e.tiktokOAuth,k=e.linkedinOAuth,b=e.appleOAuth,A=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let R=[a,l].filter(Boolean),N=[u,f,y,P,w,v,g,k,b,A].filter(Boolean),L=[c].filter(Boolean);if(R.length+N.length+L.length===0)throw new Error("You must enable at least one login method");let I=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;I&&L.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&N.length+R.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let q=lm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),J=im({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:M,defaultChain:ne}=w0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),B=!!t?.defaultChain,be=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,fe,ve=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?be?fe=t?.embeddedWallets?.noPromptOnSignature??!0:fe=t?.embeddedWallets?.noPromptOnSignature??ve:fe=ve,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&fe!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Ee,...ae}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??vr.appearance.landingHeader,palette:Sm({backgroundTheme:t?.appearance?.theme??vr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??vr.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:q},loginMethods:{wallet:c,email:a,sms:l,passkey:s,google:u,twitter:f,discord:y,github:P,spotify:w,instagram:v,tiktok:g,linkedin:k,apple:b,farcaster:A},loginMethodsAndOrder:J,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??vr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??vr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??vr.rpcConfig.rpcTimeouts},chains:M,defaultChain:ne,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:B,captchaEnabled:e.captchaEnabled??vr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof Ee=="boolean"?{requireUserOwnedRecoveryOnCreate:Ee}:{},...be?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ae,noPromptOnSignature:fe},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:be?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??vr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??vr._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??vr._render.inParentNodeId}}}function xm(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function w0({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Ti.find(u=>u.id===s.id)??s)}else n=Ti.concat(e??[]);let i=t?n[0]:vi,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var _m=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};var Im=require("react/jsx-runtime"),Am={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},ud=pd(Am,void 0,!1),md=(0,km.createContext)({appConfig:ud,isServerConfigLoaded:!1}),Rm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,yo.useState)(null),a=(0,yo.useMemo)(()=>pd(n??Am,o,!!n),[n,o]);return(0,yo.useEffect)(()=>{if(!n)return;let l=xm(o,t),s=_m(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),(0,yo.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,Im.jsx)(md.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Or=()=>{let{appConfig:e}=(0,yo.useContext)(md);return e},vl=()=>{let{isServerConfigLoaded:e}=(0,yo.useContext)(md);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var Cl=require("react/jsx-runtime"),Mm=(0,Nr.createContext)({ready:!1,app:ud,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),b0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Wm=e=>{let t=Or(),r=e.authenticated,[o,n]=(0,Nr.useState)(e.initialScreen);(0,Nr.useEffect)(()=>{!r&&!b0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,Nr.useRef)(null);(0,Nr.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,Nr.useEffect)(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return(0,Cl.jsxs)(Mm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,Cl.jsx)(il,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>(0,Nr.useContext)(Mm);var Do=require("react/jsx-runtime"),ka=({style:e,...t})=>{let{app:r}=_();return(0,Do.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,Do.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Do.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Do.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,Do.jsx)("defs",{children:(0,Do.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Do.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var go=class extends Zt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Ze(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=As[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=ks(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:wi,id:"io.metamask"}:{name:Tu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||ka,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=As[r],this.walletClientType=r,this.redirectUri=void 0,Au(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new yi)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new de("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=ks(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=gi(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Zr(a));return}o(new de("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=xs(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Si.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Si.OPTIONAL_EVENTS,optionalMethods:Si.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Lm.isMobile&&this.walletEntry){let{redirect:l,href:s}=_u(a,this.walletEntry);Ru({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Rs(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=ks(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var hd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,Nm.isHexString)(o)).map(o=>(0,fd.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},gi=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Un:Un,xi=class extends Dm.default{constructor(r,o,n,i,a,l,s,c,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new Ze:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.privyAppName=u,this.storedConnections=Om()}get wallets(){let r=new Set,o=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 r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;oe.get(td)&&(oe.getKeys().forEach(o=>{o.startsWith("walletconnect")&&oe.del(o)}),oe.del(td));let r=Su(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!on()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new Zs(r,o,this.rpcConfig,this.chains,i,n.id),s=new tl(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Om(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof go&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new rl(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ei(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new Xs(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new nl(this.defaultChain):new go(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));oe.put(rd,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,fd.getAddress)(r),this.emit("walletsUpdated")}};function Js(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var E0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Om=()=>{let e=oe.get(rd);return e&&Array.isArray(e)&&e.map(o=>E0(o)).every(Boolean)?e:[]};var Um=require("ofetch");var P0=[gs,Cs,vs,ws],wl=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Ws,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Um.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=P0.includes(n.toString());if(!a.has("authorization")){let s=await this.client.getAccessToken({disableAutoRefresh:l});s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new hs}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw Ce(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw Ce(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw Ce(o)}}};var Fm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});var dn=m(require("js-cookie"));function Bm(e){return e instanceof rn?"email":e instanceof Vn?"sms":e instanceof Gn?"siwe":e instanceof di?"custom_auth":e instanceof fo?e.meta.provider:null}var Hm=m(require("jose")),vo=class{static parse(t){try{return new vo(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Hm.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 r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var T0=30,bl=class{constructor(){this.authenticateOnce=new et(async t=>this._authenticate(t)),this.linkOnce=new et(async t=>this._link(t)),this.refreshOnce=new et(this._refresh.bind(this)),this.destroyOnce=new et(this._destroy.bind(this)),this.forkSessionOnce=new et(this._forkSession.bind(this))}get token(){try{let t=oe.get(Ln);return typeof t=="string"?new vo(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=oe.get(Ls);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=oe.get(ya);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=dn.default.get(Os);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=vo.parse(this.token);return t!==null&&!t.isExpired(T0)}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 r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,l=Bm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Lr(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),Ft(r)}}async _link(t){try{let r=await t.link();return Lr(r)}catch(r){throw console.warn("Error linking account"),Ft(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(gs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(Cs,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Lr(n.user)}catch(n){if(n instanceof Yr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ft(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(vs,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Dp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw Ft(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=oe.get(Ln);if(oe.put(Ln,t),!this.client?.useServerCookies){let o=vo.parse(t)?.expiration;dn.default.set(Xc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else oe.del(Ln),dn.default.remove(Xc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(oe.put(Ls,t),this.client?.useServerCookies||(dn.default.set(Os,"t",{sameSite:"Strict",secure:!0,expires:30}),dn.default.set(ed,t,{sameSite:"Strict",secure:!0,expires:30}))):(oe.del(Ls),dn.default.remove(ed),dn.default.remove(Os))}clearForkedToken(){oe.del(ya)}};var yd,El,Vm,_i=class{constructor(t){fs(this,El);this.apiUrl=t.apiUrl||Ms,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Nu,this.appId=t.appId,this.clientAnalyticsId=Op(this,El,Vm).call(this),yd||(yd=new bl),this.session=yd,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new xi(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new wl(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(mu,{action:"verify"})}catch(t){throw Ce(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(fu,{});return Fm(t.options)}catch(t){throw Ce(t)}}async unlinkEmail(t){try{let r=await this.api.post(Zp,{address:t});return Lr(r)}catch(r){throw Ft(r)}}async acceptTerms(){try{let t=await this.api.post(hu,{});return Lr(t)}catch(t){throw Ft(t)}}async unlinkPhone(t){try{let r=await this.api.post(eu,{phoneNumber:t});return Lr(r)}catch(r){throw Ft(r)}}async unlinkWallet(t){try{let r=await this.api.post(Hp,{address:t});return Lr(r)}catch(r){throw Ft(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(iu,{provider:t,subject:r});return Lr(o)}catch(o){throw Ft(o)}}async unlinkFarcaster(t){try{let r=await this.api.post($p,{fid:t});return Lr(r)}catch(r){throw Ft(r)}}async unlinkPasskey(t){try{let r=await this.api.post(uu,{credential_id:t});return Lr(r)}catch(r){throw Ft(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(ws,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(yu,t)}catch(r){throw Ft(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?vo.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t});return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config}}catch(t){throw Ft(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};El=new WeakSet,Vm=function(){if(typeof window>"u")return null;try{let r=oe.get(ga);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Gm.v4)();try{return oe.put(ga,t),t}catch{return t}};var Km=require("@marsidev/react-turnstile"),Pl=require("react");var Dr=require("react");var $m=require("react/jsx-runtime"),zm=(0,Dr.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Xr=class extends at{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},qm=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,Dr.useRef)(null),[i,a]=(0,Dr.useState)(),[l,s]=(0,Dr.useState)(),[c,u]=(0,Dr.useState)(!1),f=(0,Dr.useMemo)(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return(0,$m.jsx)(zm.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Eu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Xr("Captcha failed",null,"captcha_timeout")}}},children:e})},Me=()=>(0,Dr.useContext)(zm);var gd=require("react/jsx-runtime"),Tl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Me(),[,s]=(0,Pl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Pl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,gd.jsx)("div",{className:"hidden h-0 w-0",children:(0,gd.jsx)(Km.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var Xo=require("react"),e3=m(require("react-dom"));var Sl=require("react");var vd=(0,Sl.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E}),W=()=>(0,Sl.useContext)(vd);var xl=require("react");var xe=(0,xl.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>(0,xl.useContext)(xe);var _l=require("react"),jm=e=>{let[t,r]=(0,_l.useState)("auto");return(0,_l.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var ki=require("react"),Ym={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Cd=(0,ki.createContext)(void 0),Zm=()=>(0,ki.useContext)(Cd);function rt(e,t){if(!t)return;let o=Zm().current[e];return(0,ki.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function kl(){let e=Zm();return(t,r,...o)=>U(e,t,r,...o)}function Al(e){rt("configureMfa",e)}var Sd=m(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),nf=m(require("@heroicons/react/24/solid/DocumentCheckIcon")),af=m(require("styled-components"));var Ur=m(require("styled-components"));var Rl=m(require("styled-components")),pn=require("react/jsx-runtime"),Ht=({success:e,fail:t})=>(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(Et,{className:e?"success":t?"fail":""}),(0,pn.jsx)(wd,{className:e?"success":t?"fail":""})]}),Et=Rl.default.span`
|
|
12
|
+
- https://privy.io`;this.getNonceOnce=new et(this._getNonceOnce.bind(this)),this.wallet=t,this.captchaToken=r}get meta(){return{connectorType:this.wallet.connectorType,walletClientType:this.wallet.walletClientType}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign(),o=await this.api.post(Fp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType});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 T("Auth flow has no API instance");try{let{message:t,signature:r}=await this.sign();return await this.api.post(Bp,{message:t,signature:r,chainId:this.wallet.chainId,walletClientType:this.wallet.walletClientType,connectorType:this.wallet.connectorType})}catch(t){throw Ce(t)}}async sign(){if(!this.api)throw new T("Auth flow has no API instance");if(await this.buildSiweMessage(),!this.preparedMessage)throw new T("Could not prepare SIWE message");let t=await this.wallet.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async _getNonceOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address;return(await this.api.post(Up,{address:t,token:this.captchaToken})).nonce}async buildSiweMessage(){if(!this.api)throw new T("Auth flow has no API instance");let t=this.wallet.address,r=this.wallet.chainId.replace("eip155:","");return this.nonce||(this.nonce=await this.getNonceOnce.execute()),this.preparedMessage=this.prepareMessage(r,t,this.nonce),this.preparedMessage}prepareMessage(t,r,o){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,r,n,i,l,o,a)}};var Vn=class{constructor(t,r){this.meta={phoneNumber:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{let t=await this.api.post(tu,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw Ce(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new T("phone number and sms code must be set prior to calling authenticate.");try{return await this.api.post(Xp,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})}catch(t){throw Ce(t)}}async sendSmsCode(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),r&&(this.meta.captchaToken=r),!this.meta.phoneNumber)throw new T("phone nNumber must be set when initialzing authentication.");try{return await this.api.post(Qp,{phoneNumber:this.meta.phoneNumber,token:this.meta.captchaToken})}catch(o){throw Ce(o)}}};var Gm=require("uuid");function X(e){return e?new Date(e*1e3):null}function i0(e){let t=[];for(let r of e){let o=r.type;switch(r.type){case"wallet":let n={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),chainType:"ethereum",chainId:r.chain_id,walletClient:r.wallet_client_type==="privy"?"privy":"unknown",walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method};t.push(n);break;case"email":let i={address:r.address,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(i);break;case"phone":let a={number:r.phoneNumber,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let s={subject:r.subject,email:r.email,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(s);break;case"instagram_oauth":let c={subject:r.subject,username:r.username,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(c);break;case"twitter_oauth":let u={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(u);break;case"discord_oauth":let f={subject:r.subject,username:r.username,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(f);break;case"github_oauth":let y={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(y);break;case"tiktok_oauth":let g={subject:r.subject,username:r.username,name:r.name,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(g);break;case"linkedin_oauth":let w={subject:r.subject,name:r.name,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(w);break;case"apple_oauth":let v={subject:r.subject,email:r.email,type:r.type,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(v);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)});break;case"farcaster":let k={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(k);break;case"passkey":let P={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,verifiedAt:X(r.verified_at),firstVerifiedAt:X(r.first_verified_at),latestVerifiedAt:X(r.latest_verified_at)};t.push(P);break;default:console.warn(`Unrecognized account type: ${o}. Please consider upgrading the Privy SDK.`)}}return t}function gr(e,t){return e.slice().sort((r,o)=>(o.firstVerifiedAt??o.verifiedAt).getTime()-(r.firstVerifiedAt??r.verifiedAt).getTime()).find(r=>r.type===t)}var Ve=e=>e?.linkedAccounts.find(t=>t.type==="wallet"&&t.walletClientType==="privy")||null,a0=e=>e.linkedAccounts.filter(t=>t.type==="wallet"),Lr=(e,t)=>t==="all-users"&&!Ve(e)||t==="users-without-wallets"&&!a0(e)?.length;function Or(e){if(!e)return null;let t=i0(e.linked_accounts),r=gr(t,"wallet"),o=gr(t,"email"),n=gr(t,"phone"),i=gr(t,"google_oauth"),a=gr(t,"twitter_oauth"),l=gr(t,"discord_oauth"),s=gr(t,"github_oauth"),c=gr(t,"spotify_oauth"),u=gr(t,"instagram_oauth"),f=gr(t,"tiktok_oauth"),y=gr(t,"linkedin_oauth"),g=gr(t,"apple_oauth"),w=gr(t,"farcaster"),v=e.mfa_methods.map(({type:P,verified_at:b})=>({type:P,verifiedAt:X(b)}));return{id:e.id,createdAt:X(e.created_at),linkedAccounts:t,email:o&&{address:o?.address},phone:n&&{number:n?.number},wallet:r&&{address:r.address,chainType:r.chainType,chainId:r.chainId,walletClient:r.walletClient,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.recoveryMethod},google:i&&{subject:i.subject,email:i.email,name:i.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:s&&{subject:s.subject,username:s.username,name:s.name,email:s.email},spotify:c&&{subject:c.subject,email:c.email,name:c.name},instagram:u&&{subject:u.subject,username:u.username},tiktok:f&&{subject:f.subject,username:f.username,name:f.name},linkedin:y&&{subject:y.subject,name:y.name,email:y.email},apple:g&&{subject:g.subject,email:g.email},farcaster:w&&{fid:w.fid,ownerAddress:w.ownerAddress,displayName:w.displayName,username:w.username,bio:w.bio,pfp:w.pfp,url:w.url,signerPublicKey:w.signerPublicKey},mfaMethods:v.map(P=>P.type),hasAcceptedTerms:e.has_accepted_terms??!1}}var fd=require("@ethersproject/address"),Nm=require("@ethersproject/bytes"),Dm=m(require("eventemitter3"));var rm=m(require("@coinbase/wallet-sdk"));var Sa=require("react/jsx-runtime"),Zs=({style:e,...t})=>(0,Sa.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,Sa.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Sa.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 Qr=require("@ethersproject/address"),ld=require("@ethersproject/providers"),tm=m(require("eventemitter3"));var Zu=m(require("eventemitter3"));var s0=["eth_sign","eth_populateTransactionRequest","eth_signTransaction","personal_sign","eth_signTypedData_v4"],ju=e=>s0.includes(e);var Yu=require("@ethersproject/logger");var hi=class extends de{constructor(){super("Wallet timeout");this.type="wallet_error"}},yi=class extends de{constructor(){super("User rejected connection");this.type="wallet_error"}},Zr=e=>{if(e instanceof de)return e;if(e?.code&&e?.reason){let t=new tt(e);return e.code===Yu.ErrorCode.ACTION_REJECTED&&(t.details=Wt.E4001_USER_REJECTED_REQUEST),t}return e?.code?new tt(e):new de("Unknown connector error",e)},vr=class extends at{constructor(r,o,n){super(r);this.type="provider_error";this.code=o,this.data=n}},tt=class extends vr{constructor(r){let o=r;super(o.message,o.code,o.data);let n=Object.values(Wt).find(i=>i.eipCode===o.code);this.details=n||Wt.UNKNOWN_ERROR,o.code===-32002&&(o.message?.includes("already pending for origin")?o.message?.includes("wallet_requestPermissions")?this.details=Wt.E32002_CONNECTION_ALREADY_PENDING:this.details=Wt.E32002_REQUEST_ALREADY_PENDING:o.message?.includes("Already processing")&&o.message.includes("eth_requestAccounts")&&(this.details=Wt.E32002_WALLET_LOCKED))}},l0={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}},c0={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},d0={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}},Wt={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...d0,...c0},Oo={...l0,...Wt};var Je=class{constructor(t,r){this.removeListener=(t,r)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(t,r)}catch{console.warn("Unable to remove wallet provider listener")}};this.walletTimeout=(t=new hi,r=this.rpcTimeoutDuration)=>new Promise((o,n)=>setTimeout(()=>{n(t)},r));this.setWalletProvider=t=>{this.walletProvider&&this._subscriptions.forEach(r=>{this.removeListener(r.eventName,r.listener)}),this.walletProvider=t,this._subscriptions.forEach(r=>{this.walletProvider?.on(r.eventName,r.listener)})};this.walletProvider=t,this.rpcTimeoutDuration=r||Un,this._subscriptions=[]}on(t,r){if(this.walletProvider)return this.walletProvider.on(t,r);this._subscriptions.push({eventName:t,listener:r})}async request(t){if(!this.walletProvider)throw new de(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),this.walletTimeout()]).catch(r=>{throw Zr(r)})}},sn=class extends Error{constructor(r,o,n){super(r);this.code=o,this.data=n}},Js=class extends Zu.default{constructor(r,o,n,i,a,l=1){super();this.walletProxy=r,this.address=o,this.chainId=l,this.rpcConfig=n,this.chains=i,this.provider=Wo(l,this.chains,n,{appId:a}),this.rpcTimeoutDuration=gi(n,"privy"),this.appId=a}async handleSendTransaction(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o=r.params[0];if(!await Oe()||!this.address)throw new sn("Disconnected",4900);return(await Xu(o)).hash}handleSwitchEthereumChain(r){if(!r.params||!Array.isArray(r.params))throw new sn(`Invalid params for ${r.method}`,4200);let o;if(typeof r.params[0]=="string")o=r.params[0];else if("chainId"in r.params[0]&&typeof r.params[0].chainId=="string")o=r.params[0].chainId;else throw new sn(`Invalid params for ${r.method}`,4200);this.chainId=Number(o),this.provider=Wo(this.chainId,this.chains,this.rpcConfig,{appId:this.appId}),this.emit("chainChanged",o)}async handlePersonalSign(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for personal_sign");let o=r.params[0];return await Ju(o)}async handleSignedTypedData(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_signTypedData_v4");let o=typeof r.params[1]=="string"?JSON.parse(r.params[1]):r.params[1];return await Qu(ks(o))}async handleEstimateGas(r){if(!r.params||!Array.isArray(r.params))throw new Error("Invalid params for eth_estimateGas");delete r.params[0].gasPrice,delete r.params[0].maxFeePerGas,delete r.params[0].maxPriorityFeePerGas;let o={...r.params[0],chainId:Wn(this.chainId)};try{return await this.provider.send("eth_estimateGas",[o])}catch{return delete o.from,await this.provider.send("eth_estimateGas",[o])}}async request(r){switch(console.debug("Embedded1193Provider.request() called with args",r),r.method){case"eth_accounts":case"eth_requestAccounts":return this.address?[this.address]:[];case"eth_chainId":return Wn(this.chainId);case"eth_estimateGas":return this.handleEstimateGas(r);case"eth_sendTransaction":return this.handleSendTransaction(r);case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(r);case"personal_sign":return this.handlePersonalSign(r);case"eth_signTypedData_v4":return this.handleSignedTypedData(r);default:break}if(ju(r.method)){let o=await Oe();if(await em(),!o||!this.address)throw new sn("Disconnected",4900);try{return(await this.walletProxy.rpc({address:this.address,accessToken:o,request:{method:r.method,params:r.params}})).response.data}catch(n){throw console.error(n),new sn("Disconnected",4900)}}else return this.provider.send(r.method,r.params)}async connect(){let r=await Oe();if(!r||!this.address)return null;try{return(await this.walletProxy.connect({address:this.address,accessToken:r})).address}catch(o){return console.error(o),null}}},Jr=class extends Je{constructor(r){super(r,r.rpcTimeoutDuration)}},ln=class extends Je{constructor(t){super(t,t.rpcTimeoutDuration)}sendAsync(t,r){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var p0=(e,t)=>{switch(t){case"coinbase_wallet":return e.message.includes("addEthereumChain");default:return e.code===4902||e.message?.includes("4902")}},Zt=class extends tm.default{constructor(r,o,n,i){super();this.onAccountsChanged=r=>{r.length===0?this.onDisconnect():this.syncAccounts(r)};this.onChainChanged=r=>{this.wallets.forEach(o=>{o.chainId=ui(r),this.walletClientType==="privy"&&oe.put(Ds(o.address),r)}),this.emit("walletsUpdated")};this.onDisconnect=()=>{this.connected=!1,this.wallets=[],this.emit("walletsUpdated")};this.onConnect=()=>{this.connected=!0,this.syncAccounts()};this.wallets=[],this.walletClientType=r,this.chains=o,this.defaultChain=n,this.rpcConfig=i,this.rpcTimeoutDuration=gi(i,r),this.connected=!1,this.initialized=!1}buildConnectedWallet(r,o,n){let i=async()=>!!this.wallets.find(a=>(0,Qr.getAddress)(a.address)===(0,Qr.getAddress)(r));return{address:(0,Qr.getAddress)(r),chainId:o,meta:n,switchChain:async a=>{if(!i)throw new de("Wallet is not currently connected.");let l=this.wallets.find(y=>(0,Qr.getAddress)(y.address)===(0,Qr.getAddress)(r))?.chainId;if(!l)throw new de("Unable to determine current chainId.");let s,c;if(typeof a=="number"?(s=`0x${a.toString(16)}`,c=a):(s=a,c=Number(a)),l===ui(s))return;let u=this.chains.find(y=>y.id===c);if(!u)throw new de(`Unsupported chainId: ${a}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:s}]})};try{return await f()}catch(y){if(p0(y,this.walletClientType))return await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:s,chainName:u.name,nativeCurrency:u.nativeCurrency,rpcUrls:[u.rpcUrls.default?.http[0]??""],blockExplorerUrls:[u.blockExplorers?.default.url??""]}]}),f();throw this.walletClientType==="rainbow"&&y.message?.includes("wallet_switchEthereumChain")?new de(`Rainbow does not support the chainId ${o}`):y}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return this.proxyProvider},getEthersProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return new ld.Web3Provider(new Jr(this.proxyProvider))},getWeb3jsProvider:async()=>{if(!await i())throw new de("Wallet is not currently connected.");return new ln(this.proxyProvider)},sign:async a=>{if(!await i())throw new de("Wallet is not currently connected.");return await this.sign(a)},disconnect:()=>{this.disconnect()}}}async syncAccounts(r){let o=r;try{if(o===void 0){let c=await this.proxyProvider.request({method:"eth_accounts"});Array.isArray(c)&&(o=c)}}catch{console.warn("Wallet did not respond to eth_accounts. Defaulting to prefetched accounts.")}if(!o||!Array.isArray(o)||o.length<=0||!o[0])return;let n=o[0],i=(0,Qr.getAddress)(n),a=[],l;if(this.walletClientType==="privy"){let c=oe.get(Ds(i));this.chains.find(u=>u.id===Number(c))||(oe.del(Ds(i)),c=null),l=c||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:l}]})}catch{console.warn(`Unable to switch embedded wallet to chain ID ${l} on initialization`)}}else try{let c=await this.proxyProvider.request({method:"eth_chainId"});if(typeof c=="string")l=c;else if(typeof c=="number")l=`0x${c.toString(16)}`;else throw new Error("Invalid chainId returned from provider")}catch(c){console.warn(`Failed to get chainId from provider, defaulting to ${od}`,c),l=od}let s=ui(l);if(!a.find(c=>(0,Qr.getAddress)(c.address)===i)){let c={name:this.walletBranding.name,icon:typeof this.walletBranding.icon=="string"?this.walletBranding.icon:void 0,id:this.walletBranding.id};a.push(this.buildConnectedWallet((0,Qr.getAddress)(n),s,c))}Qs(a,this.wallets)||(this.wallets=a,this.emit("walletsUpdated"))}async getConnectedWallet(){let r=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((o,n)=>n.connectedAt-o.connectedAt).find(o=>r.find(n=>(0,Qr.getAddress)(n)===(0,Qr.getAddress)(o.address)))||null}async isConnected(){let r=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(r)&&r.length>0}async sign(r){return await this.connect({showPrompt:!1}),new ld.Web3Provider(new Jr(this.proxyProvider)).getSigner().signMessage(r)}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 vi={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},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 u0=(e,t)=>{let o=_s(1,[vi],{},t);return e.makeWeb3Provider(o,1)},Xs,el=class extends Zt{constructor(r,o,n,i,a){super("coinbase_wallet",r,o,n);this.connectorType="coinbase_wallet";this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners();let l=window.matchMedia("(display-mode: standalone)").matches;Xs||(Xs=new rm.default({appName:a,darkMode:!1,headlessMode:!1,enableMobileWalletLink:l})),this.proxyProvider.setWalletProvider(u0(Xs,i))}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}disconnect(){Xs.disconnect(),this.onDisconnect()}get walletBranding(){return{name:"Coinbase Wallet",icon:Zs,id:"com.coinbase.wallet"}}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");this.connected=!0,await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}};var cd=require("react/jsx-runtime"),tl=({...e})=>(0,cd.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,cd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.37126 11.0323C2.37126 12.696 3.90598 13.4421 5.40654 13.4468C8.91753 13.4468 12.8021 11.2897 12.7819 7.67984C12.7673 5.07728 10.3748 2.86167 7.54357 2.88296C4.8495 2.88296 2.21821 4.6411 2.21803 7.03628C2.21803 7.67951 2.58722 8.30178 3.55231 8.37184C2.74763 9.16826 2.37126 10.1225 2.37126 11.0323ZM7.55283 8.68012C8.11562 8.68012 8.57186 8.13217 8.57186 7.45624C8.57186 6.78032 8.11562 6.23237 7.55283 6.23237C6.99003 6.23237 6.53379 6.78032 6.53379 7.45624C6.53379 8.13217 6.99003 8.68012 7.55283 8.68012ZM10.4747 8.68012C11.0375 8.68012 11.4937 8.13217 11.4937 7.45625C11.4937 6.78032 11.0375 6.23237 10.4747 6.23237C9.91186 6.23237 9.45562 6.78032 9.45562 7.45625C9.45562 8.13217 9.91186 8.68012 10.4747 8.68012Z",fill:e.color||"var(--privy-color-foreground-3)"})});var rl=class extends Zt{constructor(r,o,n,i){super("privy",o,n,i);this.connectorType="embedded";this.proxyProvider=r,this.subscribeListeners()}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return await this.isConnected()?(await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[Wn(r?.chainId||"0x1")]}),this.getConnectedWallet()):null}get walletBranding(){return{name:"Privy Wallet",icon:tl,id:"io.privy.wallet"}}disconnect(){this.connected=!1}async promptConnection(){}};var dd=require("react/jsx-runtime"),Ci=({style:e,...t})=>(0,dd.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24",style:{...e},...t,children:(0,dd.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 01-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0115 18.257V17.25m6-12V15a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 15V5.25m18 0A2.25 2.25 0 0018.75 3H5.25A2.25 2.25 0 003 5.25m18 0V12a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 12V5.25"})});var Bt=require("react/jsx-runtime"),wi=({style:e,...t})=>(0,Bt.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,Bt.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,Bt.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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,Bt.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 xa=require("react/jsx-runtime"),ho=({style:e,...t})=>(0,xa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"108",height:"108",viewBox:"0 0 108 108",fill:"none",style:{height:"28px",width:"28px",...e},...t,children:[(0,xa.jsx)("rect",{width:"108",height:"108",rx:"23",fill:"#AB9FF2"}),(0,xa.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M46.5267 69.9229C42.0054 76.8509 34.4292 85.6182 24.348 85.6182C19.5824 85.6182 15 83.6563 15 75.1342C15 53.4305 44.6326 19.8327 72.1268 19.8327C87.768 19.8327 94 30.6846 94 43.0079C94 58.8258 83.7355 76.9122 73.5321 76.9122C70.2939 76.9122 68.7053 75.1342 68.7053 72.314C68.7053 71.5783 68.8275 70.7812 69.0719 69.9229C65.5893 75.8699 58.8685 81.3878 52.5754 81.3878C47.993 81.3878 45.6713 78.5063 45.6713 74.4598C45.6713 72.9884 45.9768 71.4556 46.5267 69.9229ZM83.6761 42.5794C83.6761 46.1704 81.5575 47.9658 79.1875 47.9658C76.7816 47.9658 74.6989 46.1704 74.6989 42.5794C74.6989 38.9885 76.7816 37.1931 79.1875 37.1931C81.5575 37.1931 83.6761 38.9885 83.6761 42.5794ZM70.2103 42.5795C70.2103 46.1704 68.0916 47.9658 65.7216 47.9658C63.3157 47.9658 61.233 46.1704 61.233 42.5795C61.233 38.9885 63.3157 37.1931 65.7216 37.1931C68.0916 37.1931 70.2103 38.9885 70.2103 42.5795Z",fill:"#FFFDF8"})]});var Ei=class extends Zt{constructor(r,o,n,i,a){super(a||"unknown",r,o,n);this.connectorType="injected";this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.providerDetail=i;let l=i.provider;this.proxyProvider.setWalletProvider(l)}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return{name:this.providerDetail.info.name,icon:this.providerDetail.info.icon,id:this.providerDetail.info.rdns}}disconnect(){console.warn(`Programmatic disconnect with ${this.providerDetail.info.name} is not yet supported.`)}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}},bi,Pi=class extends Zt{constructor(r,o,n,i,a){super(a??"unknown",r,o,n);this.connectorType="injected";hs(this,bi,void 0);this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),this.subscribeListeners(),this.proxyProvider.setWalletProvider(i),a==="metamask"?jc(this,bi,{name:"MetaMask",icon:wi,id:"io.metamask"}):a==="phantom"&&jc(this,bi,{name:"Phantom",icon:ho,id:"phantom"})}async initialize(){await this.syncAccounts(),this.initialized=!0,this.emit("initialized")}async connect(r){return r.showPrompt&&await this.promptConnection(),await this.isConnected()?this.getConnectedWallet():null}get walletBranding(){return Lp(this,bi)??{name:"Browser Extension",icon:Ci,id:"extension"}}disconnect(){console.warn("Programmatic disconnect with browser wallets is not yet supported.")}async promptConnection(){try{let r=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!r||r.length===0||!r[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([r[0]])}catch(r){throw Zr(r)}}};bi=new WeakMap;var m0=require("@ethersproject/address"),f0=require("@ethersproject/providers"),om=require("react-device-detect");var ol=class extends Ei{disconnect(){console.warn("MetaMask does not support programmatic disconnect.")}async promptConnection(){try{om.isMobile||await this.proxyProvider.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]});let t=await this.proxyProvider.request({method:"eth_requestAccounts"});if(!t||t.length===0||!t[0])throw new de("Unable to retrieve accounts");await this.syncAccounts([t[0]])}catch(t){throw Zr(t)}}};var nl=class extends Zt{constructor(r,o){super(r,[],o,{});this.connectorType="null";this.proxyProvider=new Je(void 0,Un);this.connectorType=r}get walletBranding(){return{name:"Wallet",id:""}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw new Error("connect called for an uninstalled wallet via the NullConnector")}disconnect(){throw new Error("disconnect called for an uninstalled wallet via the NullConnector")}promptConnection(r){throw new Error(`promptConnection called for an uninstalled wallet via the NullConnector for ${r}`)}};var il=class extends nl{constructor(t){super("phantom",t)}get walletBranding(){return{name:"Phantom",icon:ho,id:"phantom"}}};var Si=require("@walletconnect/ethereum-provider"),Lm=require("react-device-detect");var Dr=require("react");var nm=require("react/jsx-runtime");function al({src:e,...t}){return(0,nm.jsx)("img",{src:e,...t,style:{display:"none"}})}var yo=require("react"),km=require("react");var Cr={appearance:{landingHeader:"Log in or sign up",theme:"light",accentColor:"#676FFF",walletList:["detected_wallets","metamask","coinbase_wallet","rainbow","wallet_connect"]},walletConnectCloudProjectId:Ou,rpcConfig:{rpcUrls:{},rpcTimeouts:{}},captchaEnabled:!1,_render:{inDialog:!0,inParentNodeId:null},fiatOnRamp:{useSandbox:!1}};var im=({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`");for(let o of e.primary.slice(1))t.includes(o)?console.warn(`Duplicated login method: ${o}`):t.push(o);for(let o of e.overflow??[])!t.includes(o)&&!r.includes(o)?r.push(o):console.warn(`Duplicated login method: ${o}`);return{primary:t,overflow:r}};var h0=new Set(["coinbase_wallet","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","wallet_connect","detected_wallets"]),am=e=>h0.has(e),sm=(e,t,r)=>r.indexOf(e)===t,lm=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(am).filter(sm):e?e.filter(am).filter(sm):Cr.appearance.walletList;var sl={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},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 ll={id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"AGOR",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io/"}},testnet:!0};var cl={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0};var cm={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}};var dm={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0};var dl={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},blast:{http:["https://base-mainnet.blastapi.io"],webSocket:["wss://base-mainnet.blastapi.io"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}},testnet:!0};var pl={id:84531,network:"base-goerli",name:"Base Goerli Testnet",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://base-goerli.blastapi.io"],webSocket:["wss://base-goerli.blastapi.io"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},testnet:!0};var ul={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0};var pm={id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0};var um={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1};var mm={id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0};var fm={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 hm={id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}};var ym={id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}};var gm={id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://goerli.rpc.privy.systems"]},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 vm={id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}};var Cm={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1};var wm={id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0};var ml={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},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 fl={id:420,name:"Optimism Goerli Testnet",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},testnet:!0};var hl={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0};var _a={id:137,name:"Polygon Mainnet",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},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 ka={id:80001,name:"Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-mumbai.rpc.privy.systems"]},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 bm={id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}};var Em={id:17001,name:"Redstone Holesky",network:"redstone-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.holesky.redstone.xyz"]},public:{http:["https://rpc.holesky.redstone.xyz"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"},default:{name:"EtherScan",url:"https://explorer.holesky.redstone.xyz"}}};var Pm={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0};var yl={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}};var gl={id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0};var vl={id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0};var Ti=[sl,ll,cl,gm,Pm,vi,ml,fl,hl,_a,ka,um,mm,fm,hm,dl,pl,ul,pm,Cm,wm,cm,dm,yl,vl,gl,vm,bm,ym,Em],Yb=new Set(Ti.map(e=>e.id));var cn=m(require("tinycolor2")),Tm="#FFFFFF",y0="#000000",g0=Tm,v0="#1E1E1D";function C0(e){return e<.8&&e>.2&&console.warn("Background color is not light or dark enough, which could lead to accessibility issues."),e>.5?"light":"dark"}function No(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,cn.default)({...e.toHsl(),l:r})}function Sm({backgroundTheme:e,accentHex:t,successHex:r="#51BA81",warnHex:o="#FFB74D",errorHex:n="#EC6351",whiteHex:i=Tm,blackHex:a=y0}){let l;switch(e){case"light":l=g0;break;case"dark":l=v0;break;default:l=e;break}let s=(0,cn.default)(l),c=(0,cn.default)(t),u=(0,cn.default)(r),f=(0,cn.default)(o),y=(0,cn.default)(n),g=C0(s.getLuminance()),w=No(s,g==="light"?-.04:.11),v=No(s,g==="light"?-.88:.87),k=No(s,g==="light"?-.77:.75),P=No(s,g==="light"?-.43:.45).desaturate(g==="light"?60:20),b=No(s,g==="light"?-.08:.25).desaturate(g==="light"?60:20),A=No(c,.15),R=No(c,-.06),N=No(y,.3),L=(0,cn.default)(c.getLuminance()>.5?a:i),I=No(u,-.16);return{colorScheme:g,background:s.toHslString(),background2:w.toHslString(),foreground:v.toHslString(),foreground2:k.toHslString(),foreground3:P.toHslString(),foreground4:b.toHslString(),accent:c.toHslString(),accentLight:A.toHslString(),accentDark:R.toHslString(),foregroundAccent:L.toHslString(),success:u.toHslString(),successDark:I.toHslString(),error:y.toHslString(),errorLight:N.toHslString(),warn:f.toHslString()}}function pd(e,t,r){let o=r?console.warn:()=>{},n=["google","twitter","discord","spotify","instagram","tiktok","linkedin","github","apple","farcaster"],i=t?.loginMethods?.filter(Mt=>n.includes(Mt)),a,l,s,c,u,f,y,g,w,v,k,P,b,A;t?.loginMethods?(a=t.loginMethods.includes("email"),l=t.loginMethods.includes("sms"),c=t.loginMethods.includes("wallet"),u=i?.includes("google"),f=i?.includes("twitter"),y=i?.includes("discord"),w=i?.includes("spotify"),v=i?.includes("instagram"),g=i?.includes("tiktok"),P=i?.includes("github"),k=i?.includes("linkedin"),b=i?.includes("apple"),A=i?.includes("farcaster")):(a=e.emailAuth,l=e.smsAuth,c=e.walletAuth,u=e.googleOAuth,f=e.twitterOAuth,y=e.discordOAuth,P=e.githubOAuth,w=e.spotifyOAuth,v=e.instagramOAuth,g=e.tiktokOAuth,k=e.linkedinOAuth,b=e.appleOAuth,A=e.farcasterAuth),typeof window<"u"&&typeof window.PublicKeyCredential!="function"?s=!1:e.passkeyAuth&&(s=!0);let R=[a,l].filter(Boolean),N=[u,f,y,P,w,v,g,k,b,A].filter(Boolean),L=[c].filter(Boolean);if(R.length+N.length+L.length===0)throw new Error("You must enable at least one login method");let I=t?.appearance?.showWalletLoginFirst!==void 0?t?.appearance?.showWalletLoginFirst:e.showWalletLoginFirst;I&&L.length===0?(o("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),I=!1):!I&&N.length+R.length===0&&(o("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),I=!0),t?.loginMethods&&t.loginMethodsAndOrder&&o("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let q=lm({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder}),J=im({input:t?.loginMethodsAndOrder}),j=t?.intl?.defaultCountry??"US",{chains:M,defaultChain:ne}=w0({additionalChains:t?.additionalChains,supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain,hasRpcConfigDefined:Object.keys(t?.rpcConfig?.rpcUrls??{}).length>0}),B=!!t?.defaultChain,be=t?.customAuth?.getCustomAccessToken&&t?.customAuth?.enabled!==!1,fe,ve=!(e.enforceWalletUis??!0);if(e.legacyWalletUiConfig??!0?be?fe=t?.embeddedWallets?.noPromptOnSignature??!0:fe=t?.embeddedWallets?.noPromptOnSignature??ve:fe=ve,t?.embeddedWallets?.waitForTransactionConfirmation===!1&&fe!==!0)throw new Error("Overriding `config.embeddedWallets.waitForTransactionConfirmation` requires that you disable wallet UIs in the dashboard.");let{requireUserPasswordOnCreate:Ee,...ae}=t?.embeddedWallets??{};return{id:e.id,name:e.name,allowlistConfig:e.allowlistConfig,legacyWalletUiConfig:e.legacyWalletUiConfig,appearance:{logo:t?.appearance?.logo??e.logoUrl,landingHeader:t?.appearance?.landingHeader??Cr.appearance.landingHeader,palette:Sm({backgroundTheme:t?.appearance?.theme??Cr.appearance.theme,accentHex:t?.appearance?.accentColor??e.accentColor??Cr.appearance.accentColor}),loginGroupPriority:I?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:q},loginMethods:{wallet:c,email:a,sms:l,passkey:s,google:u,twitter:f,discord:y,github:P,spotify:w,instagram:v,tiktok:g,linkedin:k,apple:b,farcaster:A},loginMethodsAndOrder:J,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.termsAndConditionsUrl,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacyPolicyUrl,requireUsersAcceptTerms:e.requireUsersAcceptTerms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.walletConnectCloudProjectId??Cr.walletConnectCloudProjectId,rpcConfig:{rpcUrls:t?.rpcConfig?.rpcUrls??Cr.rpcConfig.rpcUrls,rpcTimeouts:t?.rpcConfig?.rpcTimeouts??Cr.rpcConfig.rpcTimeouts},chains:M,defaultChain:ne,intl:{defaultCountry:j},shouldEnforceDefaultChainOnConnect:B,captchaEnabled:e.captchaEnabled??Cr.captchaEnabled,captchaSiteKey:e.captchaSiteKey,embeddedWallets:{...e.embeddedWalletConfig,...typeof Ee=="boolean"?{requireUserOwnedRecoveryOnCreate:Ee}:{},...be?{createOnLogin:"all-users",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]}:{},waitForTransactionConfirmation:!0,priceDisplay:{primary:"fiat-currency",secondary:"native-token"},...ae,noPromptOnSignature:fe},mfa:{methods:e.mfaMethods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},customAuth:be?{enabled:!0,...t.customAuth}:void 0,fiatOnRamp:{enabled:e.fiatOnRampEnabled,useSandbox:t?.fiatOnRamp?.useSandbox??Cr.fiatOnRamp.useSandbox},loginConfig:{twitterOAuthOnMobileEnabled:e.twitterOAuthOnMobileEnabled??!1},headless:!!t?.headless,render:{inDialog:t?._render?.inDialog??Cr._render.inDialog,inParentNodeId:t?._render?.inParentNodeId??Cr._render.inParentNodeId}}}function xm(e,t){if(!e)return{legacyCreateEmbeddedWalletFlag:t};let{appearance:r,additionalChains:o,supportedChains:n,defaultChain:i,...a}=e;return{...a,...o?{additionalChains:o.map(s=>s.id)}:void 0,...n?{supportedChains:n.map(s=>s.id)}:void 0,...i?{defaultChain:i.id}:void 0,...r?{...r,...r.logo&&typeof r.logo?{logo:"component"}:void 0}:void 0,legacyCreateEmbeddedWalletFlag:t}}function w0({additionalChains:e,supportedChains:t,defaultChainFromConfig:r,hasRpcConfigDefined:o}){let n;if(e&&t&&console.warn("You should only specify one of `additionalChains` or `supportedChains`. Using `supportedChains`."),t){if(t.length===0)throw new Error("`supportedChains` must contain at least one chain");t.filter(s=>s.rpcUrls.privyWalletOverride).length>0&&o&&console.warn("You have specified at least one `supportedChain` with `privyWalletOverride` but also have `rpcConfig` defined. The `rpcConfig` will be ignored. `rpcConfig` is deprecated and you should use `privyWalletOverride` in a `supportedChain`."),n=t.map(s=>s.rpcUrls.privyWalletOverride?s:Ti.find(u=>u.id===s.id)??s)}else n=Ti.concat(e??[]);let i=t?n[0]:vi,a=r??i;if(!n.find(l=>l.id===a.id))throw new Error("`defaultChain` must be included in `supportedChains`");return{chains:n,defaultChain:a}}var _m=function(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0,i;n<e.length;n++)i=e.charCodeAt(n),r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>13,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&o)+(r>>>0)};var Im=require("react/jsx-runtime"),Am={showWalletLoginFirst:!0,allowlistConfig:{errorTitle:null,errorDetail:null,errorCtaText:null,errorCtaLink:null},walletAuth:!0,emailAuth:!0,smsAuth:!1,googleOAuth:!1,twitterOAuth:!1,discordOAuth:!1,githubOAuth:!1,linkedinOAuth:!1,appleOAuth:!1,termsAndConditionsUrl:null,privacyPolicyUrl:null,embeddedWalletConfig:{createOnLogin:"off",requireUserOwnedRecoveryOnCreate:!1,userOwnedRecoveryOptions:["user-passcode"]},fiatOnRampEnabled:!1,captchaEnabled:!1,captchaSiteKey:""},ud=pd(Am,void 0,!1),md=(0,km.createContext)({appConfig:ud,isServerConfigLoaded:!1}),Rm=({children:e,legacyCreateEmbeddedWalletFlag:t,client:r,clientConfig:o})=>{let[n,i]=(0,yo.useState)(null),a=(0,yo.useMemo)(()=>pd(n??Am,o,!!n),[n,o]);return(0,yo.useEffect)(()=>{if(!n)return;let l=xm(o,t),s=_m(JSON.stringify(l)).toString(),c=`privy:sent:${n.id}:${s}`;localStorage.getItem(c)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:l}),localStorage.setItem(c,"t"))},[o,t,n]),(0,yo.useEffect)(()=>{n||(async()=>{try{let s=await r.getServerConfig();s.customApiUrl&&r.updateApiUrl(s.customApiUrl),i(s)}catch(s){console.warn("Error generating app config: ",s)}})()},[]),(0,Im.jsx)(md.Provider,{value:{appConfig:a,isServerConfigLoaded:!!n},children:e})},Nr=()=>{let{appConfig:e}=(0,yo.useContext)(md);return e},Cl=()=>{let{isServerConfigLoaded:e}=(0,yo.useContext)(md);return e};var E=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var wl=require("react/jsx-runtime"),Mm=(0,Dr.createContext)({ready:!1,app:ud,currentScreen:null,lastScreen:null,navigate:E,navigateBack:E,resetNavigation:E,setModalData:E,onUserCloseViaDialogOrKeybindRef:void 0}),b0=["LANDING","CONNECT_ONLY_LANDING_SCREEN",null],Wm=e=>{let t=Nr(),r=e.authenticated,[o,n]=(0,Dr.useState)(e.initialScreen);(0,Dr.useEffect)(()=>{!r&&!b0.includes(e.initialScreen)&&e.setInitialScreen(null)},[r]);let i=(0,Dr.useRef)(null);(0,Dr.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,Dr.useEffect)(()=>{i.current=null},[e.initialScreen]);let a={ready:!!t.id,app:t,data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(l,s=!0)=>{e.setInitialScreen(l),s&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return(0,wl.jsxs)(Mm.Provider,{value:a,children:[(typeof t.appearance.logo=="string"||t.appearance.logo?.type==="img")&&(0,wl.jsx)(al,{src:typeof t.appearance.logo=="string"?t.appearance.logo:t.appearance.logo.props.src}),e.children]})},_=()=>(0,Dr.useContext)(Mm);var Do=require("react/jsx-runtime"),Aa=({style:e,...t})=>{let{app:r}=_();return(0,Do.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,Do.jsx)("rect",{width:"28",height:"28",rx:"3",fill:r?.appearance.palette.colorScheme==="dark"?"#3396ff":"#141414"}),(0,Do.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,Do.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,Do.jsx)("defs",{children:(0,Do.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,Do.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})};var go=class extends Zt{constructor(r,o,n,i,a,l,s){super(s||"unknown",n,i,o);this.connectorType="wallet_connect_v2";this.privyAppId=l,this.walletConnectCloudProjectId=r,this.rpcConfig=o,this.shouldEnforceDefaultChainOnConnect=a,this.proxyProvider=new Je(void 0,this.rpcTimeoutDuration),s&&(this.walletEntry=Rs[s],this.walletClientType=s)}async initialize(){let r=await this.createProvider();if(this.provider=r,this.proxyProvider.setWalletProvider(r),this.subscribeListeners(),r.session){if(this.walletProvider?.session?.peer.metadata.url){let n=As(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=n?.entry,this.walletClientType=n?.walletClientType||"unknown"}this.connected=!0,await this.syncAccounts()}this.initialized=!0,this.emit("initialized");let{WalletConnectModal:o}=await import("@walletconnect/modal");this.modal=new o({projectId:this.walletConnectCloudProjectId,themeVariables:{"--wcm-z-index":"1000000"}}),this.modal.subscribeModal(n=>{!n.open&&!this.walletProvider?.session&&this.onQrModalClosed&&this.onQrModalClosed()})}async connect(r){return r.showPrompt&&await this.promptConnection(),this.getConnectedWallet()}async isConnected(){return!!this.walletProvider?.connected}get walletBranding(){return this.walletClientType==="metamask"?{name:"MetaMask",icon:wi,id:"io.metamask"}:{name:Tu(this.walletProvider?.session?.peer.metadata.name||"")||"WalletConnect",icon:this.walletProvider?.session?.peer.metadata.icons?.[0]||Aa,id:this.walletProvider?.session?.peer.metadata.name.toLowerCase()||"wallet_connect_v2"}}async resetConnection(r){this.walletProvider&&this.walletProvider.connected&&(await this.walletProvider.disconnect(),this.walletProvider.signer.session=void 0,this.walletEntry=Rs[r],this.walletClientType=r,this.redirectUri=void 0,Au(),this.onDisconnect())}async promptConnection(){if(this.provider)return new Promise((r,o)=>{let n=()=>{o(new yi)};this.onQrModalClosed=n,(async()=>{let a="",l=await Promise.race([this.walletProvider?.enable(),this.proxyProvider.walletTimeout()]);if(l?.length&&(a=l[0]),!a||a==="")throw new de("Unable to retrieve address");if(this.walletProvider?.session?.peer.metadata.url){let s=As(this.walletProvider?.session?.peer.metadata.url);this.walletEntry=s?.entry,this.walletClientType=s?.walletClientType||"unknown",this.proxyProvider.rpcTimeoutDuration=gi(this.rpcConfig,this.walletClientType)}this.connected=!0,await this.syncAccounts(l),r()})().catch(a=>{if(a){o(Zr(a));return}o(new de("Unknown error during connection"))}).finally(()=>this.modal?.closeModal())})}disconnect(){this.walletProvider?.disconnect().then(()=>this.onDisconnect()).catch(()=>console.warn("Unable to disconnect Wallet Connect provider"))}get walletProvider(){return this.proxyProvider.walletProvider}setWalletProvider(r){this.proxyProvider.setWalletProvider(r)}async createProvider(){let r={};for(let a of this.chains){let l=_s(a.id,this.chains,this.rpcConfig,this.privyAppId);l&&(r[a.id]=l)}let o=this.shouldEnforceDefaultChainOnConnect?[this.defaultChain.id]:[],n=this.chains.map(a=>a.id),i=await Si.EthereumProvider.init({projectId:this.walletConnectCloudProjectId,chains:o,optionalChains:n,optionalEvents:Si.OPTIONAL_EVENTS,optionalMethods:Si.OPTIONAL_METHODS,rpcMap:r,showQrModal:!1});return i.on("display_uri",a=>{if(i.signer.abortPairingAttempt(),Lm.isMobile&&this.walletEntry){let{redirect:l,href:s}=_u(a,this.walletEntry);Ru({href:s,name:this.walletEntry.displayName}),this.redirectUri=l,Is(l,"_self")}else this.modal?.openModal({uri:a,chains:[this.defaultChain.id]})}),i.on("connect",()=>{if(this.modal?.closeModal(),i.session?.peer.metadata.url){let a=As(i.session?.peer.metadata.url);this.walletEntry=a?.entry,this.walletClientType=a?.walletClientType||"unknown"}}),i}async enableProvider(){return this.walletProvider?.connected?Promise.resolve(this.walletProvider.accounts):await this.walletProvider?.enable()}};var hd=e=>{let t=localStorage.getItem("-walletlink:https://www.walletlink.org:Addresses")?.split(" ").filter(o=>(0,Nm.isHexString)(o)).map(o=>(0,fd.getAddress)(o));return t?.length?!!e?.linkedAccounts.filter(o=>o.type=="wallet"&&t.includes(o.address)).length:!1},gi=(e,t)=>e.rpcTimeouts?e.rpcTimeouts[t]||Un:Un,xi=class extends Dm.default{constructor(r,o,n,i,a,l,s,c,u){super();this.getEthereumProvider=()=>{let r=this.wallets[0],o=this.walletConnectors.find(n=>n.wallets.find(i=>i.address===r?.address));return!r||!o?new Je:o.proxyProvider};this.privyAppId=r,this.walletConnectCloudProjectId=o,this.rpcConfig=n,this.chains=i,this.defaultChain=a,this.walletConnectors=[],this.initialized=!1,this.store=l,this.walletList=s,this.shouldEnforceDefaultChainOnConnect=c,this.privyAppName=u,this.storedConnections=Om()}get wallets(){let r=new Set,o=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 r.has(a)?!1:(r.add(a),!0)}),n=o.findIndex(i=>i.address===(this.activeWallet?this.activeWallet:"unknown"));return n>=0&&o.unshift(o.splice(n,1)[0]),o}async initialize(){if(this.initialized)return;oe.get(td)&&(oe.getKeys().forEach(o=>{o.startsWith("walletconnect")&&oe.del(o)}),oe.del(td));let r=Su(this.store,this.walletList).then(o=>{o.forEach(({type:n,eip6963InjectedProvider:i,legacyInjectedProvider:a})=>{this.createWalletConnector("injected",n,{eip6963InjectedProvider:i,legacyInjectedProvider:a})})});this.walletList.includes("coinbase_wallet")&&this.createWalletConnector("coinbase_wallet","coinbase_wallet"),!on()&&this.walletList.includes("phantom")&&this.createWalletConnector("phantom","phantom"),this.createWalletConnector("wallet_connect_v2","unknown"),await r,this.initialized=!0}findWalletConnector(r,o){return r==="wallet_connect_v2"?this.walletConnectors.find(n=>n.connectorType===r)||null:this.walletConnectors.find(n=>n.connectorType===r&&n.walletClientType===o)||null}onInitialized(r){r.wallets.forEach(o=>{let n=this.storedConnections.find(i=>i.address===o.address&&i.connectorType===o.connectorType&&i.walletClientType===o.walletClientType);n&&(o.connectedAt=n.connectedAt)}),this.saveConnectionHistory(),this.emit("walletsUpdated"),this.emit("connectorInitialized")}onWalletsUpdated(r){r.initialized&&(this.saveConnectionHistory(),this.emit("walletsUpdated"))}addEmbeddedWalletConnector(r,o,n,i){let a=this.findWalletConnector("embedded","privy");if(a)a.proxyProvider.walletProxy=r;else{let l=new Js(r,o,this.rpcConfig,this.chains,i,n.id),s=new rl(l,this.chains,n,this.rpcConfig);this.addWalletConnector(s)}}removeEmbeddedWalletConnector(){let r=this.findWalletConnector("embedded","privy");if(r){let o=this.walletConnectors.indexOf(r);this.walletConnectors.splice(o,1),this.saveConnectionHistory(),this.storedConnections=Om(),this.emit("walletsUpdated")}}async createWalletConnector(r,o,n){let i=this.findWalletConnector(r,o);if(i)return i instanceof go&&i.resetConnection(o),i;let l=(()=>{if(r==="injected"){if(o==="metamask"&&n?.eip6963InjectedProvider)return new ol(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,"metamask");if(o==="metamask"&&n?.legacyInjectedProvider)return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"metamask");if(o==="phantom"&&n?.legacyInjectedProvider)return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider,"phantom");if(n?.legacyInjectedProvider&&o==="unknown_browser_extension")return new Pi(this.chains,this.defaultChain,this.rpcConfig,n?.legacyInjectedProvider);if(n?.eip6963InjectedProvider)return new Ei(this.chains,this.defaultChain,this.rpcConfig,n?.eip6963InjectedProvider,o)}else return r==="coinbase_wallet"?new el(this.chains,this.defaultChain,this.rpcConfig,this.privyAppId,this.privyAppName):r==="phantom"?new il(this.defaultChain):new go(this.walletConnectCloudProjectId,this.rpcConfig,this.chains,this.defaultChain,this.shouldEnforceDefaultChainOnConnect,this.privyAppId,o)})();return l&&this.addWalletConnector(l),l||null}addWalletConnector(r){this.walletConnectors.push(r),r.on("initialized",()=>this.onInitialized(r)),r.on("walletsUpdated",()=>this.onWalletsUpdated(r)),r.initialize()}saveConnectionHistory(){let r=this.wallets.map(o=>({address:o.address,connectorType:o.connectorType,walletClientType:o.walletClientType,connectedAt:o.connectedAt}));oe.put(rd,r)}async activeWalletSign(r){let o=this.wallets,n=o.length>0?o[0]:null;return n?n.sign(r):null}setActiveWallet(r){this.activeWallet=(0,fd.getAddress)(r),this.emit("walletsUpdated")}};function Qs(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],n=t[r];if(o?.address!==n?.address||o?.chainId!==n?.chainId||o?.connectorType!==n?.connectorType||o?.connectedAt!==n?.connectedAt||o?.walletClientType!==n?.walletClientType||o?.isConnected!==n?.isConnected||o?.linked!==n?.linked)return!1}return!0}var E0=e=>e&&typeof e.address=="string"&&typeof e.connectorType=="string"&&typeof e.walletClientType=="string"&&typeof e.connectedAt=="number",Om=()=>{let e=oe.get(rd);return e&&Array.isArray(e)&&e.map(o=>E0(o)).every(Boolean)?e:[]};var Um=require("ofetch");var P0=[vs,ws,Cs,bs],bl=class{constructor(t,r,o){this.appId=t,this.clientAnalyticsId=r.clientAnalyticsId,this.sdkVersion=Ls,this.client=r,this.defaults=o,this.fallbackApiUrl=r.fallbackApiUrl,this.baseFetch=Um.ofetch.create({baseURL:this.defaults.baseURL,timeout:this.defaults.timeout,retry:3,retryDelay:500,retryStatusCodes:[408,409,425,500,502,503,504],credentials:"include",onRequest:async({request:n,options:i})=>{let a=new Headers(i.headers);a.set("privy-app-id",this.appId),a.set("privy-ca-id",this.clientAnalyticsId||""),a.set("privy-client",`react-auth:${this.sdkVersion}`);let l=P0.includes(n.toString());if(!a.has("authorization")){let s=await this.client.getAccessToken({disableAutoRefresh:l});s!==null&&a.set("authorization",`Bearer ${s}`)}i.headers=a,i.retryDelay&&(i.retryDelay=i.retryDelay*3)},onRequestError:({error:n})=>{if(n instanceof DOMException&&n.name==="AbortError")throw new ys}})}async get(t,r){try{return await this.baseFetch(t,r)}catch(o){throw Ce(o)}}async post(t,r,o){try{return await this.baseFetch(t,{method:"POST",...r?{body:r}:{},...o})}catch(n){throw Ce(n)}}async delete(t,r){try{return await this.baseFetch(t,{method:"DELETE",...r})}catch(o){throw Ce(o)}}};var Fm=e=>({challenge:e.challenge,allowCredentials:e.allow_credentials?.map(t=>({id:t.id,type:t.type,transports:t.transports}))||[],timeout:e.timeout,extensions:{appid:e.extensions?.app_id,credProps:e.extensions?.cred_props,hmacCreateSecret:e.extensions?.hmac_create_secret},userVerification:e.user_verification});var dn=m(require("js-cookie"));function Bm(e){return e instanceof rn?"email":e instanceof Vn?"sms":e instanceof Gn?"siwe":e instanceof di?"custom_auth":e instanceof fo?e.meta.provider:null}var Hm=m(require("jose")),vo=class{static parse(t){try{return new vo(t)}catch{return null}}constructor(t){this.value=t,this._decoded=Hm.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 r=Date.now(),o=(this.expiration-t)*1e3;return r>=o}};var T0=30,El=class{constructor(){this.authenticateOnce=new et(async t=>this._authenticate(t)),this.linkOnce=new et(async t=>this._link(t)),this.refreshOnce=new et(this._refresh.bind(this)),this.destroyOnce=new et(this._destroy.bind(this)),this.forkSessionOnce=new et(this._forkSession.bind(this))}get token(){try{let t=oe.get(Ln);return typeof t=="string"?new vo(t).value:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get refreshToken(){try{let t=oe.get(Os);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get forkedToken(){try{let t=oe.get(ga);return typeof t=="string"?t:null}catch(t){return console.error(t),this.destroyLocalState(),null}}get mightHaveServerCookies(){try{let t=dn.default.get(Ns);return t!==void 0&&t.length>0}catch(t){console.error(t)}return!1}hasRefreshCredentials(){return this.mightHaveServerCookies||typeof this.token=="string"&&typeof this.refreshToken=="string"}hasRecoveryCredentials(){return typeof this.forkedToken=="string"}hasActiveToken(){let t=vo.parse(this.token);return t!==null&&!t.isExpired(T0)}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 r=await t.authenticate(),{user:o,is_new_user:n,oauth_provider_tokens:i}=r;this.handleTokenResponse(r);let a=i?{provider:i.provider,accessToken:i.access_token,accessTokenExpiresInSeconds:i.access_token_expires_in_seconds,refreshToken:i.refresh_token,scopes:i.scopes}:void 0,l=Bm(t);return l&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate",payload:{method:l,isNewUser:n}}),l==="siwe"&&this.client&&this.client.createAnalyticsEvent({eventName:"sdk_authenticate_siwe",payload:{connectorType:t.meta.connectorType,walletClientType:t.meta.walletClientType}}),{user:Or(o),isNewUser:n,oAuthProviderTokens:a}}catch(r){throw console.warn("Error authenticating session"),Ft(r)}}async _link(t){try{let r=await t.link();return Or(r)}catch(r){throw console.warn("Error linking account"),Ft(r)}}async _refresh(){if(!this.api)throw new T("Session has no API instance");if(!this.client)throw new T("Session has no PrivyClient instance");await this.client.getAccessToken({disableAutoRefresh:!0});let t=this.token,r=this.refreshToken,o=this.forkedToken;try{let n;if(t&&r||this.mightHaveServerCookies){let i={};t&&(i.authorization=`Bearer ${t}`);let a=r?{refresh_token:r}:{};n=await this.api.post(vs,a,{headers:i}),o&&this.clearForkedToken()}else if(o)n=await this.api.post(ws,{refresh_token:o}),this.clearForkedToken();else return null;return this.handleTokenResponse(n),Or(n.user)}catch(n){if(n instanceof Yr&&n.privyErrorCode==="missing_or_invalid_token")return console.warn("Unable to refresh tokens - token is missing or no longer valid"),this.destroyLocalState(),null;throw Ft(n)}}handleTokenResponse(t){t.session_update_action?t.session_update_action==="set"?(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token)):t.session_update_action==="clear"?this.destroyLocalState():t.session_update_action==="ignore"&&t.token&&this.storeToken(t.token):(this.storeRefreshToken(t.refresh_token),this.storeToken(t.token))}async _destroy(){try{await this.api?.post(Cs,{refresh_token:this.refreshToken})}catch{console.warn("Error destroying session")}this.destroyLocalState()}async _forkSession(){if(!this.api)throw new T("Session has no API instance");let t=this.refreshToken;try{let r=await this.api.post(Dp,{refresh_token:t});return this.storeRefreshToken(r.refresh_token),this.storeToken(r.token),r.new_session_refresh_token}catch(r){throw Ft(r)}}destroyLocalState(){this.storeRefreshToken(null),this.storeToken(null),this.clearForkedToken()}storeToken(t){if(typeof t=="string"){let r=oe.get(Ln);if(oe.put(Ln,t),!this.client?.useServerCookies){let o=vo.parse(t)?.expiration;dn.default.set(Xc,t,{sameSite:"Strict",secure:!0,expires:o?new Date(o*1e3):void 0})}r!==t&&this.client?.onStoreToken?.(t)}else oe.del(Ln),dn.default.remove(Xc),this.client?.onDeleteToken?.()}storeRefreshToken(t){typeof t=="string"?(oe.put(Os,t),this.client?.useServerCookies||(dn.default.set(Ns,"t",{sameSite:"Strict",secure:!0,expires:30}),dn.default.set(ed,t,{sameSite:"Strict",secure:!0,expires:30}))):(oe.del(Os),dn.default.remove(ed),dn.default.remove(Ns))}clearForkedToken(){oe.del(ga)}};var yd,Pl,Vm,_i=class{constructor(t){hs(this,Pl);this.apiUrl=t.apiUrl||Ws,this.fallbackApiUrl=this.apiUrl,this.useServerCookies=!1,this.timeout=t.timeout||Nu,this.appId=t.appId,this.clientAnalyticsId=Op(this,Pl,Vm).call(this),yd||(yd=new El),this.session=yd,this.api=this.generateApi(),this.session.client=this}initializeConnectorManager({walletConnectCloudProjectId:t,rpcConfig:r,chains:o,defaultChain:n,store:i,walletList:a,shouldEnforceDefaultChainOnConnect:l,appName:s}){this.connectors||(this.connectors=new xi(this.appId,t,r,o,n,i,a,l,s))}sessionHasActiveToken(){return this.session.hasActiveToken()}generateApi(){let t=new bl(this.appId,this,{baseURL:this.apiUrl,timeout:this.timeout});return this.session.api=t,t}updateApiUrl(t){this.apiUrl=t||this.fallbackApiUrl,this.api=this.generateApi(),t&&(this.useServerCookies=!0)}authenticate(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.authenticate(this.authFlow)}link(){if(!this.authFlow)throw new T("No auth flow in progress.");return this.session.link(this.authFlow)}async logout(){await this.session.destroy(),this.authFlow=void 0}startAuthFlow(t){return t.api=this.api,this.authFlow=t,this.authFlow}async initMfaSmsVerification(){try{await this.api.post(mu,{action:"verify"})}catch(t){throw Ce(t)}}async initMfaPasskeyVerification(){try{let t=await this.api.post(fu,{});return Fm(t.options)}catch(t){throw Ce(t)}}async unlinkEmail(t){try{let r=await this.api.post(Zp,{address:t});return Or(r)}catch(r){throw Ft(r)}}async acceptTerms(){try{let t=await this.api.post(hu,{});return Or(t)}catch(t){throw Ft(t)}}async unlinkPhone(t){try{let r=await this.api.post(eu,{phoneNumber:t});return Or(r)}catch(r){throw Ft(r)}}async unlinkWallet(t){try{let r=await this.api.post(Hp,{address:t});return Or(r)}catch(r){throw Ft(r)}}async unlinkOAuth(t,r){try{let o=await this.api.post(iu,{provider:t,subject:r});return Or(o)}catch(o){throw Ft(o)}}async unlinkFarcaster(t){try{let r=await this.api.post($p,{fid:t});return Or(r)}catch(r){throw Ft(r)}}async unlinkPasskey(t){try{let r=await this.api.post(uu,{credential_id:t});return Or(r)}catch(r){throw Ft(r)}}async createAnalyticsEvent({eventName:t,payload:r,timestamp:o,options:n}){if(!(typeof window>"u"))try{this.clientAnalyticsId||console.warn("No client analytics id set, refusing to send analytics event"),await this.api.post(bs,{event_name:t,client_id:this.clientAnalyticsId,payload:{...r||{},clientTimestamp:o?o.toISOString():new Date().toISOString()}},{retry:-1,keepalive:n?.keepAlive??!1})}catch{}}async signMoonpayOnRampUrl(t){try{return this.api.post(yu,t)}catch(r){throw Ft(r)}}async getAuthenticatedUser(){return this.session.hasRefreshCredentials()||this.session.hasRecoveryCredentials()?this.session.refresh():null}async getAccessToken(t){return this.session.hasActiveToken()?vo.parse(this.session.token)?.audience!==this.appId?(await this.logout(),null):this.session.token:!t?.disableAutoRefresh&&this.session.hasRefreshCredentials()?(await this.session.refresh(),this.session.token):null}async getServerConfig(){try{let t={},r=this.session.token;r&&(t.authorization=`Bearer ${r}`);let o=await this.api.get(`/api/v1/apps/${this.appId}`,{baseURL:this.fallbackApiUrl,headers:t});return{id:o.id,name:o.name,verificationKey:o.verification_key,logoUrl:o.logo_url||void 0,accentColor:o.accent_color||void 0,showWalletLoginFirst:o.show_wallet_login_first,allowlistConfig:{errorTitle:o.allowlist_config.error_title,errorDetail:o.allowlist_config.error_detail,errorCtaText:o.allowlist_config.cta_text,errorCtaLink:o.allowlist_config.cta_link},walletAuth:o.wallet_auth,emailAuth:o.email_auth,smsAuth:o.sms_auth,googleOAuth:o.google_oauth,twitterOAuth:o.twitter_oauth,discordOAuth:o.discord_oauth,githubOAuth:o.github_oauth,spotifyOAuth:o.spotify_oauth,instagramOAuth:o.instagram_oauth,tiktokOAuth:o.tiktok_oauth,linkedinOAuth:o.linkedin_oauth,appleOAuth:o.apple_oauth,farcasterAuth:o.farcaster_auth,passkeyAuth:o.passkey_auth,termsAndConditionsUrl:o.terms_and_conditions_url,embeddedWalletConfig:{createOnLogin:o.embedded_wallet_config?.create_on_login,userOwnedRecoveryOptions:o.embedded_wallet_config.user_owned_recovery_options,requireUserOwnedRecoveryOnCreate:o.embedded_wallet_config.require_user_owned_recovery_on_create},privacyPolicyUrl:o.privacy_policy_url,requireUsersAcceptTerms:o.require_users_accept_terms,customApiUrl:o.custom_api_url,walletConnectCloudProjectId:o.wallet_connect_cloud_project_id,fiatOnRampEnabled:o.fiat_on_ramp_enabled,captchaEnabled:o.captcha_enabled,captchaSiteKey:o.captcha_site_key,twitterOAuthOnMobileEnabled:o.twitter_oauth_on_mobile_enabled,createdAt:new Date(o.created_at*1e3),updatedAt:new Date(o.updated_at*1e3),mfaMethods:o.mfa_methods,enforceWalletUis:o.enforce_wallet_uis,legacyWalletUiConfig:o.legacy_wallet_ui_config}}catch(t){throw Ft(t)}}async getUsdTokenPrice(t){try{return(await this.api.get(`/api/v1/token_price?chainId=${t.id}&tokenSymbol=${t.nativeCurrency.symbol}`)).usd}catch{console.error(`Unable to fetch token price for chain with id ${t.id}`);return}}async requestFarcasterSignerStatus(t){try{return await this.api.post("/api/v1/farcaster/signer/status",{ed25519_public_key:t})}catch(r){throw console.error("Unable to fetch Farcaster signer status"),r}}async forkSession(){return await this.session.forkSession()}};Pl=new WeakSet,Vm=function(){if(typeof window>"u")return null;try{let r=oe.get(va);if(typeof r=="string"&&r.length>0)return r}catch{}let t=(0,Gm.v4)();try{return oe.put(va,t),t}catch{return t}};var Km=require("@marsidev/react-turnstile"),Tl=require("react");var Ur=require("react");var $m=require("react/jsx-runtime"),zm=(0,Ur.createContext)({siteKey:"",enabled:!1,appId:void 0,token:void 0,error:void 0,status:"disabled",setToken:E,setError:E,setExecuting:E,waitForResult:()=>Promise.resolve(""),ref:{current:null},remove:E,reset:E,execute:E}),Xr=class extends at{constructor(r,o,n){super(r||"Captcha failed");this.type="Captcha";o instanceof Error&&(this.cause=o),this.privyErrorCode=n}},qm=({children:e,id:t,captchaSiteKey:r,captchaEnabled:o})=>{let n=(0,Ur.useRef)(null),[i,a]=(0,Ur.useState)(),[l,s]=(0,Ur.useState)(),[c,u]=(0,Ur.useState)(!1),f=(0,Ur.useMemo)(()=>o?!c&&!i&&!l?{status:"ready"}:c&&!i&&!l?{status:"loading"}:i&&!l?{status:"success",token:i}:l?{status:"error",error:l}:{status:"ready"}:{status:"disabled"},[o,i,l,c]);return(0,$m.jsx)(zm.Provider,{value:{...f,ref:n,enabled:o,siteKey:r,appId:t,setToken:a,setError:s,setExecuting:u,remove(){o&&(n.current?.remove(),u(!1),s(void 0),a(void 0))},reset(){o&&(n.current?.reset(),u(!1),s(void 0),a(void 0))},execute(){o&&(u(!0),n.current?.execute())},async waitForResult(){if(!o)return"";try{return await Eu(()=>n.current?.getResponse(),{interval:200,timeout:2e4})}catch{throw new Xr("Captcha failed",null,"captcha_timeout")}}},children:e})},Me=()=>(0,Ur.useContext)(zm);var gd=require("react/jsx-runtime"),Sl=e=>{let{enabled:t,siteKey:r,appId:o,setError:n,setToken:i,setExecuting:a,ref:l}=Me(),[,s]=(0,Tl.useMemo)(()=>r?.split("t:")||[],[r]);if((0,Tl.useEffect)(()=>l.current?.remove,[]),!t)return null;if(!s)throw new Error("Unsupported captcha site key");return(0,gd.jsx)("div",{className:"hidden h-0 w-0",children:(0,gd.jsx)(Km.Turnstile,{...e,ref:l,siteKey:s,options:{action:o,size:"invisible",...e.delayedExecution?{appearance:"execute",execution:"execute"}:{appearance:"always",execution:"render"}},onUnsupported:()=>{e.onUnsupported?.(),console.warn("Browser does not support Turnstile.")},onError:()=>{e.onError?.(),n("Captcha failed"),a(!1)},onSuccess:c=>{e.onSuccess?.(c),i(c),a(!1)},onExpire:()=>{e.onExpire?.();try{l.current?.reset(),n(void 0),i(void 0)}catch{n("expired_and_failed_reset")}}})})};var Xo=require("react"),e3=m(require("react-dom"));var xl=require("react");var vd=(0,xl.createContext)({isNewUserThisSession:!1,linkingHint:null,walletConnectionStatus:null,mipdStore:null,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,appId:"notAdded",nativeTokenSymbolForChainId:E,initializeWalletProxy:E,getAuthMeta:E,getAuthFlow:E,closePrivyModal:E,openPrivyModal:E,connectWallet:E,initLoginWithWallet:E,loginWithWallet:E,initLoginWithFarcaster:E,loginWithFarcaster:E,loginWithCode:E,initLoginWithEmail:E,initLoginWithSms:E,initUpdateEmail:E,resendEmailCode:E,resendSmsCode:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,initLoginWithOAuth:E,recoveryOAuthFlow:E,loginWithOAuth:E,initLoginWithPasskey:E,loginWithPasskey:E,initLinkWithPasskey:E,linkWithPasskey:E,refreshUser:E,walletProxy:null,createAnalyticsEvent:E,acceptTerms:E,getUsdTokenPrice:E,recoverEmbeddedWallet:E,getFiatOnRampConfig:E,updateWallets:E,fundWallet:E,setReadyToTrue:E,requestFarcasterSignerStatus:E}),W=()=>(0,xl.useContext)(vd);var _l=require("react");var xe=(0,_l.createContext)({ready:!1,authenticated:!1,user:null,walletConnectors:null,connectWallet:E,login:E,connectOrCreateWallet:E,linkEmail:E,linkPhone:E,linkFarcaster:E,linkWallet:E,linkGoogle:E,linkTwitter:E,linkDiscord:E,linkGithub:E,linkSpotify:E,linkInstagram:E,linkTiktok:E,linkLinkedIn:E,linkApple:E,linkPasskey:E,updateEmail:E,logout:E,getAccessToken:E,getEthereumProvider:E,getEthersProvider:E,getWeb3jsProvider:E,unlinkEmail:E,unlinkPhone:E,unlinkWallet:E,unlinkGoogle:E,unlinkTwitter:E,unlinkDiscord:E,unlinkGithub:E,unlinkSpotify:E,unlinkInstagram:E,unlinkTiktok:E,unlinkLinkedIn:E,unlinkApple:E,unlinkFarcaster:E,unlinkPasskey:E,setActiveWallet:E,forkSession:E,createWallet:E,signMessage:E,signTypedData:E,enrollInMfa:E,initEnrollmentWithSms:E,initEnrollmentWithTotp:E,initEnrollmentWithPasskey:E,promptMfa:E,init:E,submitEnrollmentWithSms:E,submitEnrollmentWithTotp:E,submitEnrollmentWithPasskey:E,unenroll:E,submit:E,cancel:E,sendTransaction:E,exportWallet:E,setWalletPassword:E,requestFarcasterSignerFromWarpcast:E,getFarcasterSignerPublicKey:E,signFarcasterMessage:E,initLoginWithEmail:E,initLoginWithSms:E,otpState:{status:"initial"},loginWithCode:E,fundWallet:E,initLoginWithHeadlessOAuth:E,loginWithHeadlessOAuth:E,isHeadlessOAuthLoading:!1,isModalOpen:!1}),H=()=>(0,_l.useContext)(xe);var kl=require("react"),jm=e=>{let[t,r]=(0,kl.useState)("auto");return(0,kl.useEffect)(()=>{let o=new ResizeObserver(n=>{r(n[0]?.contentRect.height??"auto")});return e.current&&o.observe(e.current),()=>{e.current&&o.unobserve(e.current)}},[e.current]),t};var ki=require("react"),Ym={login:{onComplete:[],onError:[],onOAuthLoginComplete:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]}},Cd=(0,ki.createContext)(void 0),Zm=()=>(0,ki.useContext)(Cd);function rt(e,t){if(!t)return;let o=Zm().current[e];return(0,ki.useEffect)(()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))o.hasOwnProperty(n)||console.warn(`Invalid event type "${n}" for action "${e}"`),o[n]=o[n]?.filter(a=>a!==i)}},[t])}function U(e,t,r,...o){for(let n of e.current[t][r])n(...o)}function Al(){let e=Zm();return(t,r,...o)=>U(e,t,r,...o)}function Rl(e){rt("configureMfa",e)}var Sd=m(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),nf=m(require("@heroicons/react/24/solid/DocumentCheckIcon")),af=m(require("styled-components"));var Fr=m(require("styled-components"));var Il=m(require("styled-components")),pn=require("react/jsx-runtime"),Ht=({success:e,fail:t})=>(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(Et,{className:e?"success":t?"fail":""}),(0,pn.jsx)(wd,{className:e?"success":t?"fail":""})]}),Et=Il.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
|
-
`,wd=(0,
|
|
45
|
+
`,wd=(0,Il.default)(Et)`
|
|
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
|
-
`,Uo=e=>(0,pn.jsx)(S0,{color:e.color||"var(--privy-color-foreground-3)"}),S0=(0,
|
|
51
|
+
`,Uo=e=>(0,pn.jsx)(S0,{color:e.color||"var(--privy-color-foreground-3)"}),S0=(0,Il.default)(Et)`
|
|
52
52
|
&& {
|
|
53
53
|
height: 0.9rem;
|
|
54
54
|
width: 0.9rem;
|
|
@@ -57,7 +57,7 @@ Resources:
|
|
|
57
57
|
/* Override default Loader to match button transitions */
|
|
58
58
|
transition: border-color 200ms ease;
|
|
59
59
|
}
|
|
60
|
-
`;var Pt=require("react/jsx-runtime"),
|
|
60
|
+
`;var Pt=require("react/jsx-runtime"),Ml=Fr.default.button`
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: row;
|
|
63
63
|
align-items: center;
|
|
@@ -85,13 +85,13 @@ Resources:
|
|
|
85
85
|
color: var(--privy-color-foreground-3);
|
|
86
86
|
cursor: not-allowed;
|
|
87
87
|
}
|
|
88
|
-
`,O=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Pt.jsx)(Jm,{disabled:t||r,...n,children:t?(0,Pt.jsxs)("span",{children:[(0,Pt.jsx)(Uo,{}),o?(0,Pt.jsx)("span",{children:o}):null]}):e}),
|
|
89
|
-
${e=>e.hideAnimations&&
|
|
88
|
+
`,O=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Pt.jsx)(Jm,{disabled:t||r,...n,children:t?(0,Pt.jsxs)("span",{children:[(0,Pt.jsx)(Uo,{}),o?(0,Pt.jsx)("span",{children:o}):null]}):e}),NE=(0,Fr.default)(O)`
|
|
89
|
+
${e=>e.hideAnimations&&Fr.css`
|
|
90
90
|
&& {
|
|
91
91
|
transition: none;
|
|
92
92
|
}
|
|
93
93
|
`}
|
|
94
|
-
`,
|
|
94
|
+
`,Wl=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Pt.jsx)(Jm,{as:"a",disabled:t||r,...n,children:t?(0,Pt.jsxs)("span",{children:[(0,Pt.jsx)(Uo,{}),o?(0,Pt.jsx)("span",{children:o}):null]}):e}),Jm=(0,Fr.default)(Ml)`
|
|
95
95
|
position: relative;
|
|
96
96
|
|
|
97
97
|
&& {
|
|
@@ -117,7 +117,7 @@ Resources:
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/* If an anchor tag, :disabled isn't a thing, so manually set state */
|
|
120
|
-
${e=>e.disabled?
|
|
120
|
+
${e=>e.disabled?Fr.css`
|
|
121
121
|
&&&,
|
|
122
122
|
&&&:hover,
|
|
123
123
|
&&&:active {
|
|
@@ -136,7 +136,7 @@ Resources:
|
|
|
136
136
|
opacity: 1;
|
|
137
137
|
animation: fadein 200ms ease;
|
|
138
138
|
}
|
|
139
|
-
`,eo=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Pt.jsx)(x0,{disabled:t||r,...n,children:t?(0,Pt.jsxs)("span",{children:[(0,Pt.jsx)(Uo,{}),o?(0,Pt.jsx)("span",{children:o}):null]}):e}),x0=(0,
|
|
139
|
+
`,eo=({children:e,loading:t,disabled:r,loadingText:o="Loading...",...n})=>(0,Pt.jsx)(x0,{disabled:t||r,...n,children:t?(0,Pt.jsxs)("span",{children:[(0,Pt.jsx)(Uo,{}),o?(0,Pt.jsx)("span",{children:o}):null]}):e}),x0=(0,Fr.default)(Ml)`
|
|
140
140
|
&& {
|
|
141
141
|
border-width: 1px;
|
|
142
142
|
border-color: ${e=>e.warn?"var(--privy-color-error)":"var(--privy-color-foreground-4)"};
|
|
@@ -165,7 +165,7 @@ Resources:
|
|
|
165
165
|
opacity: 1;
|
|
166
166
|
animation: fadein 200ms ease;
|
|
167
167
|
}
|
|
168
|
-
`,
|
|
168
|
+
`,Ll=Fr.default.button`
|
|
169
169
|
&& {
|
|
170
170
|
padding: 12px 16px;
|
|
171
171
|
font-weight: 500;
|
|
@@ -178,7 +178,7 @@ Resources:
|
|
|
178
178
|
transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease;
|
|
179
179
|
user-select: none;
|
|
180
180
|
|
|
181
|
-
${e=>e.invisible&&
|
|
181
|
+
${e=>e.invisible&&Fr.css`
|
|
182
182
|
pointer-events: none;
|
|
183
183
|
`}
|
|
184
184
|
|
|
@@ -196,10 +196,10 @@ Resources:
|
|
|
196
196
|
cursor: not-allowed;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
`,
|
|
199
|
+
`,DE=Fr.default.div`
|
|
200
200
|
/* Set to match height of SoftCtaButton to avoid reflow if conditionally rendered */
|
|
201
201
|
height: 44px;
|
|
202
|
-
`,Ai=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Pt.jsxs)(_0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,Pt.jsx)("span",{children:e}),(0,Pt.jsx)("span",{children:(0,Pt.jsx)(Uo,{})})]}),_0=
|
|
202
|
+
`,Ai=({children:e,onClick:t,disabled:r,isSubmitting:o,...n})=>(0,Pt.jsxs)(_0,{isSubmitting:o,onClick:t,disabled:r,...n,children:[(0,Pt.jsx)("span",{children:e}),(0,Pt.jsx)("span",{children:(0,Pt.jsx)(Uo,{})})]}),_0=Fr.default.button`
|
|
203
203
|
&& {
|
|
204
204
|
color: var(--privy-color-accent);
|
|
205
205
|
font-size: 16px;
|
|
@@ -250,7 +250,7 @@ Resources:
|
|
|
250
250
|
&& > a {
|
|
251
251
|
color: var(--privy-color-accent);
|
|
252
252
|
}
|
|
253
|
-
`;function Ri(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,rr.jsx)(bd,{});if(!r&&!t)return(0,rr.jsx)(bd,{});let n=!!(t&&r);return(0,rr.jsxs)(bd,{children:["By logging in I agree to the"," ",r&&(0,rr.jsx)("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,rr.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var V=({protectedByPrivy:e})=>(0,rr.jsx)(z,{children:e?(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(
|
|
253
|
+
`;function Ri(e){let{legal:{privacyPolicyUrl:t,termsAndConditionsUrl:r,requireUsersAcceptTerms:o}}=e.app;if(o&&!e.alwaysShowImplicitConsent)return(0,rr.jsx)(bd,{});if(!r&&!t)return(0,rr.jsx)(bd,{});let n=!!(t&&r);return(0,rr.jsxs)(bd,{children:["By logging in I agree to the"," ",r&&(0,rr.jsx)("a",{href:r,target:"_blank",children:n?"Terms":"Terms of Service"}),n&&" & ",t&&(0,rr.jsx)("a",{href:t,target:"_blank",children:"Privacy Policy"})]})}var V=({protectedByPrivy:e})=>(0,rr.jsx)(z,{children:e?(0,rr.jsxs)(rr.Fragment,{children:[(0,rr.jsx)(tl,{className:"hide-on-mobile"}),(0,rr.jsx)("span",{className:"hide-on-mobile",children:(0,rr.jsx)("a",{href:"https://www.privy.io/",target:"_blank",children:"Protected by Privy"})})]}):null}),z=Ed.default.div`
|
|
254
254
|
display: flex;
|
|
255
255
|
align-items: center;
|
|
256
256
|
justify-content: center;
|
|
@@ -328,10 +328,10 @@ Resources:
|
|
|
328
328
|
text-overflow: ellipsis;
|
|
329
329
|
text-align: center;
|
|
330
330
|
color: var(--privy-color-foreground-2);
|
|
331
|
-
`;var Co=m(require("styled-components")),
|
|
331
|
+
`;var Co=m(require("styled-components")),Ol=Co.default.div`
|
|
332
332
|
text-align: left;
|
|
333
333
|
flex-grow: 1;
|
|
334
|
-
`,
|
|
334
|
+
`,Nl=Co.default.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
flex-direction: column;
|
|
337
337
|
justify-content: flex-end;
|
|
@@ -394,7 +394,7 @@ Resources:
|
|
|
394
394
|
max-width: 24px;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
`,
|
|
397
|
+
`,je=Co.default.button`
|
|
398
398
|
${rf}
|
|
399
399
|
`,Td=Co.default.a`
|
|
400
400
|
${rf}
|
|
@@ -419,7 +419,7 @@ Resources:
|
|
|
419
419
|
font-size: 0.875rem;
|
|
420
420
|
|
|
421
421
|
text-align: center;
|
|
422
|
-
`,
|
|
422
|
+
`,Br=vt.default.div`
|
|
423
423
|
display: flex;
|
|
424
424
|
flex-direction: column;
|
|
425
425
|
align-items: center;
|
|
@@ -461,7 +461,7 @@ Resources:
|
|
|
461
461
|
flex-direction: column;
|
|
462
462
|
gap: 10px;
|
|
463
463
|
padding-top: 20px;
|
|
464
|
-
`,
|
|
464
|
+
`,Dl=vt.default.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
flex-direction: column;
|
|
467
467
|
align-items: stretch;
|
|
@@ -469,11 +469,11 @@ Resources:
|
|
|
469
469
|
padding: 1rem 0rem 0rem;
|
|
470
470
|
flex-grow: 1;
|
|
471
471
|
width: 100%;
|
|
472
|
-
`,
|
|
472
|
+
`,Ul=vt.default.div`
|
|
473
473
|
display: flex;
|
|
474
474
|
gap: 5px;
|
|
475
475
|
width: 100%;
|
|
476
|
-
`,
|
|
476
|
+
`,Fl=vt.default.button`
|
|
477
477
|
&& {
|
|
478
478
|
background-color: transparent;
|
|
479
479
|
color: var(--privy-color-foreground-3);
|
|
@@ -491,7 +491,7 @@ Resources:
|
|
|
491
491
|
&&:hover {
|
|
492
492
|
color: var(--privy-color-error);
|
|
493
493
|
}
|
|
494
|
-
`,
|
|
494
|
+
`,Bl=vt.default.div`
|
|
495
495
|
display: flex;
|
|
496
496
|
align-items: center;
|
|
497
497
|
gap: 0.5rem;
|
|
@@ -515,7 +515,7 @@ Resources:
|
|
|
515
515
|
display: flex !important;
|
|
516
516
|
align-items: flex-end;
|
|
517
517
|
}
|
|
518
|
-
`,
|
|
518
|
+
`,Hl=vt.default.div`
|
|
519
519
|
width: 100%;
|
|
520
520
|
display: flex;
|
|
521
521
|
justify-content: space-between;
|
|
@@ -523,7 +523,7 @@ Resources:
|
|
|
523
523
|
text-align: left;
|
|
524
524
|
width: 100%;
|
|
525
525
|
color: var(--privy-color-foreground-3) !important;
|
|
526
|
-
`,
|
|
526
|
+
`,Ra=vt.default.button`
|
|
527
527
|
display: flex;
|
|
528
528
|
flex-direction: row;
|
|
529
529
|
align-items: center;
|
|
@@ -568,12 +568,12 @@ Resources:
|
|
|
568
568
|
width: auto !important;
|
|
569
569
|
color: white;
|
|
570
570
|
}
|
|
571
|
-
`,
|
|
571
|
+
`,Gl=vt.default.div`
|
|
572
572
|
color: var(--privy-color-error);
|
|
573
|
-
`;var Ct=require("react/jsx-runtime"),sf=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=W(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&
|
|
573
|
+
`;var Ct=require("react/jsx-runtime"),sf=()=>{let{user:e,logout:t}=H(),{app:r,onUserCloseViaDialogOrKeybindRef:o,setModalData:n,navigate:i}=_(),{acceptTerms:a,closePrivyModal:l,createAnalyticsEvent:s}=W(),c=f=>{f?.preventDefault(),l({shouldCallAuthOnSuccess:!1}),t()};o.current=c;let u=async f=>{f.preventDefault(),await a(),e&&Lr(e,r?.embeddedWallets?.createOnLogin)?(n({createWallet:{onSuccess:()=>{},onFailure:y=>{console.error(y),s({eventName:"embedded_wallet_creation_failure_logout",payload:{error:y,screen:"AffirmativeConsentScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")):l()};return(0,Ct.jsx)(N0,{termsAndConditionsUrl:r?.legal.termsAndConditionsUrl,privacyPolicyUrl:r?.legal.privacyPolicyUrl,onAccept:u,onDecline:c})},N0=({termsAndConditionsUrl:e,privacyPolicyUrl:t,onAccept:r,onDecline:o})=>(0,Ct.jsxs)(Ct.Fragment,{children:[(0,Ct.jsx)(S,{closeable:!1}),(0,Ct.jsx)(nf.default,{width:56,height:56,fill:"var(--privy-color-accent)",style:{margin:"auto"}}),(0,Ct.jsx)(he,{style:{marginTop:24},children:"One last step"}),(0,Ct.jsx)(ge,{children:"By signing up, you agree to our terms and privacy policy."}),(0,Ct.jsxs)(to,{style:{marginTop:24},children:[e&&(0,Ct.jsxs)(Td,{target:"_blank",href:e,children:["View Terms ",(0,Ct.jsx)(Sd.default,{style:{marginLeft:"auto"}})]}),t&&(0,Ct.jsxs)(Td,{target:"_blank",href:t,children:["View Privacy Policy ",(0,Ct.jsx)(Sd.default,{style:{marginLeft:"auto"}})]})]}),(0,Ct.jsxs)(D0,{style:{marginTop:24},children:[(0,Ct.jsx)(eo,{onClick:o,children:"No thanks"}),(0,Ct.jsx)(O,{onClick:r,children:"Accept"})]}),(0,Ct.jsx)(V,{protectedByPrivy:!0})]}),D0=af.default.div`
|
|
574
574
|
display: flex;
|
|
575
575
|
gap: 10px;
|
|
576
|
-
`;var _d=m(require("styled-components"));var lf=m(require("styled-components")),
|
|
576
|
+
`;var _d=m(require("styled-components"));var lf=m(require("styled-components")),Vl=lf.default.span`
|
|
577
577
|
&& {
|
|
578
578
|
width: 82px;
|
|
579
579
|
height: 82px;
|
|
@@ -611,7 +611,7 @@ Resources:
|
|
|
611
611
|
left: -19px;
|
|
612
612
|
top: -19px;
|
|
613
613
|
}
|
|
614
|
-
`,Vt=U0;var xd=require("react/jsx-runtime"),
|
|
614
|
+
`,Vt=U0;var xd=require("react/jsx-runtime"),zl=({style:e,...t})=>(0,xd.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,xd.jsx)("path",{fillRule:"evenodd",d:"M12 1.5a5.25 5.25 0 00-5.25 5.25v3a3 3 0 00-3 3v6.75a3 3 0 003 3h10.5a3 3 0 003-3v-6.75a3 3 0 00-3-3v-3c0-2.9-2.35-5.25-5.25-5.25zm3.75 8.25v-3a3.75 3.75 0 10-7.5 0v3h7.5z",clipRule:"evenodd"})});var mt=require("react/jsx-runtime"),df=()=>{let{navigate:e,app:t}=_(),r=t?.allowlistConfig.errorTitle||"You don't have access to this app",o=t?.allowlistConfig.errorDetail||"Have you been invited?",n=t?.allowlistConfig.errorCtaText||"Try another account";return(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)(S,{}),(0,mt.jsxs)(F0,{children:[(0,mt.jsx)(Vt,{children:(0,mt.jsxs)("div",{children:[(0,mt.jsx)(Vl,{}),(0,mt.jsx)(zl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})]})}),(0,mt.jsxs)(B0,{children:[typeof r=="string"?(0,mt.jsx)("h3",{children:r}):(0,mt.jsx)(mt.Fragment,{children:r}),typeof o=="string"?(0,mt.jsx)("p",{children:o}):(0,mt.jsx)(mt.Fragment,{children:o})]}),t?.allowlistConfig.errorCtaLink?(0,mt.jsx)(O,{as:"a",href:t.allowlistConfig.errorCtaLink,children:n}):(0,mt.jsx)(O,{onClick:()=>{e("LANDING")},children:n})]})]})},F0=_d.default.div`
|
|
615
615
|
display: flex;
|
|
616
616
|
flex-direction: column;
|
|
617
617
|
align-items: center;
|
|
@@ -623,7 +623,7 @@ Resources:
|
|
|
623
623
|
display: flex;
|
|
624
624
|
flex-direction: column;
|
|
625
625
|
gap: 8px;
|
|
626
|
-
`;var vf=m(require("@heroicons/react/24/outline/EnvelopeIcon")),Cf=m(require("@heroicons/react/24/outline/PhoneIcon")),un=require("react"),wf=require("react-device-detect"),Mi=m(require("styled-components"));var ir=m(require("styled-components")),
|
|
626
|
+
`;var vf=m(require("@heroicons/react/24/outline/EnvelopeIcon")),Cf=m(require("@heroicons/react/24/outline/PhoneIcon")),un=require("react"),wf=require("react-device-detect"),Mi=m(require("styled-components"));var ir=m(require("styled-components")),Hr=ir.default.div`
|
|
627
627
|
display: flex;
|
|
628
628
|
flex-direction: column;
|
|
629
629
|
align-items: flex-start;
|
|
@@ -655,7 +655,7 @@ Resources:
|
|
|
655
655
|
display: flex;
|
|
656
656
|
flex-direction: column;
|
|
657
657
|
gap: 8px;
|
|
658
|
-
`,
|
|
658
|
+
`,u9=ir.default.div`
|
|
659
659
|
display: flex;
|
|
660
660
|
flex-direction: column;
|
|
661
661
|
justify-content: space-between;
|
|
@@ -697,9 +697,9 @@ Resources:
|
|
|
697
697
|
border-radius: 50%;
|
|
698
698
|
border-color: white;
|
|
699
699
|
border-width: 2px !important;
|
|
700
|
-
`;var
|
|
700
|
+
`;var ql=m(require("styled-components")),oo=require("react/jsx-runtime"),Ia=({title:e,description:t,children:r,...o})=>(0,oo.jsx)(hf,{...o,children:(0,oo.jsxs)(oo.Fragment,{children:[(0,oo.jsx)("h3",{children:e}),typeof t=="string"?(0,oo.jsx)("p",{children:t}):t,r]})}),wo=(0,ql.default)(Ia)`
|
|
701
701
|
margin-bottom: 24px;
|
|
702
|
-
`,De=({title:e,description:t,icon:r,children:o,...n})=>(0,oo.jsxs)(H0,{...n,children:[r||null,(0,oo.jsx)("h3",{children:e}),typeof t=="string"?(0,oo.jsx)("p",{children:t}):t,o]}),hf=
|
|
702
|
+
`,De=({title:e,description:t,icon:r,children:o,...n})=>(0,oo.jsxs)(H0,{...n,children:[r||null,(0,oo.jsx)("h3",{children:e}),typeof t=="string"?(0,oo.jsx)("p",{children:t}):t,o]}),hf=ql.default.div`
|
|
703
703
|
display: flex;
|
|
704
704
|
flex-direction: column;
|
|
705
705
|
justify-content: flex-start;
|
|
@@ -719,7 +719,7 @@ Resources:
|
|
|
719
719
|
color: var(--privy-color-foreground-2);
|
|
720
720
|
font-size: 14px;
|
|
721
721
|
}
|
|
722
|
-
`,H0=(0,
|
|
722
|
+
`,H0=(0,ql.default)(hf)`
|
|
723
723
|
align-items: center;
|
|
724
724
|
text-align: center;
|
|
725
725
|
gap: 16px;
|
|
@@ -727,7 +727,7 @@ Resources:
|
|
|
727
727
|
h3 {
|
|
728
728
|
margin-bottom: 24px;
|
|
729
729
|
}
|
|
730
|
-
`;var Te=require("react/jsx-runtime"),Ad=6,yf=new Array(Ad).fill(""),G0=1400;var bf=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=W(),{authenticated:y,logout:g,user:w}=H(),[v,k]=(0,un.useState)(yf),[P,b]=(0,un.useState)(!1),[A,R]=(0,un.useState)(null),[N,L]=(0,un.useState)(null);n.current=()=>null;let I=s()?.email?0:1,q=e?.render.inDialog?st:0,J=e?.render.inDialog?q-500:0;(0,un.useEffect)(()=>{if(y&&P&&w){if(e?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let fe=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(fe)}if(
|
|
730
|
+
`;var Te=require("react/jsx-runtime"),Ad=6,yf=new Array(Ad).fill(""),G0=1400;var bf=()=>{let{app:e,navigate:t,navigateBack:r,setModalData:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{closePrivyModal:i,resendEmailCode:a,resendSmsCode:l,getAuthMeta:s,loginWithCode:c,updateWallets:u,createAnalyticsEvent:f}=W(),{authenticated:y,logout:g,user:w}=H(),[v,k]=(0,un.useState)(yf),[P,b]=(0,un.useState)(!1),[A,R]=(0,un.useState)(null),[N,L]=(0,un.useState)(null);n.current=()=>null;let I=s()?.email?0:1,q=e?.render.inDialog?st:0,J=e?.render.inDialog?q-500:0;(0,un.useEffect)(()=>{if(y&&P&&w){if(e?.legal.requireUsersAcceptTerms&&!w.hasAcceptedTerms){let fe=setTimeout(()=>{t("AFFIRMATIVE_CONSENT_SCREEN")},J);return()=>clearTimeout(fe)}if(Lr(w,e?.embeddedWallets?.createOnLogin)){let fe=setTimeout(()=>{o({createWallet:{onSuccess:()=>{},onFailure:ve=>{console.error(ve),f({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ve,screen:"AwaitingPasswordlessCodeScreen"}}),g()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},J);return()=>clearTimeout(fe)}else{u();let fe=setTimeout(()=>i({shouldCallAuthOnSuccess:!0,isSuccess:!0}),q);return()=>clearTimeout(fe)}}},[y,P,w]),(0,un.useEffect)(()=>{if(A&&N===0){let be=setTimeout(()=>{k(yf),R(null),document.querySelector("input[name=code-0]")?.focus()},G0);return()=>clearTimeout(be)}},[A]);let j=be=>{be.preventDefault();let fe=be.currentTarget.value.replace(" ","");if(fe==="")return;if(isNaN(Number(fe))){R("Code should be numeric"),L(1);return}R(null),L(null);let ve=Number(be.currentTarget.name?.charAt(5)),Ee=[...fe||[""]].slice(0,Ad-ve),ae=[...v.slice(0,ve),...Ee,...v.slice(ve+Ee.length)];k(ae);let It=Ee.length,Mt=Math.min(Math.max(ve+It,0),Ad-1);isNaN(Number(be.currentTarget.value))||document.querySelector(`input[name=code-${Mt}]`)?.focus(),ae.every(er=>er&&!isNaN(+er))&&(document.querySelector(`input[name=code-${Mt}]`)?.blur(),c(ae.join("")).then(()=>b(!0)).catch(wt=>{if(wt?.status===422)R("Invalid or expired verification code");else if(wt instanceof Yr&&wt.privyErrorCode==="cannot_link_more_of_type")R(wt.message);else if(wt instanceof Yr&&wt.privyErrorCode==="max_accounts_reached"){console.error(new mo(wt).toString()),t("USER_LIMIT_REACHED_SCREEN");return}else R("Issue verifying code");L(0)}))},M=be=>{N===1&&(R(null),L(null));let fe=[...v.slice(0,be),"",...v.slice(be+1)];k(fe),be>0&&document.querySelector(`input[name=code-${be-1}]`)?.focus()},ne=I==0?(0,Te.jsx)(vf.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"}):(0,Te.jsx)(Cf.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),B=I==0?(0,Te.jsxs)("p",{children:["Please check ",(0,Te.jsx)(gf,{children:s()?.email})," for an email from privy.io and enter your code below."]}):(0,Te.jsxs)("p",{children:["Please check ",(0,Te.jsx)(gf,{children:s()?.phoneNumber})," for a message from ",e?.name||"Privy"," and enter your code below."]});return(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)(S,{backFn:()=>r()},"header"),(0,Te.jsxs)(V0,{children:[(0,Te.jsx)(De,{title:"Enter confirmation code",description:B,icon:ne}),(0,Te.jsxs)(pf,{children:[(0,Te.jsxs)(z0,{children:[(0,Te.jsx)(q0,{fail:!!A,success:P,children:(0,Te.jsx)("span",{children:A||(P?"Success!":"")})}),(0,Te.jsx)("div",{children:v.map((be,fe)=>(0,Te.jsx)("input",{name:`code-${fe}`,type:"text",value:v[fe],onChange:j,onKeyUp:ve=>{ve.key==="Backspace"&&M(fe)},inputMode:"numeric",autoFocus:fe===0,pattern:"[0-9]",className:`${P?"success":""} ${A?"fail":""}`,autoComplete:wf.isMobile?"one-time-code":"off"},fe))})]}),(0,Te.jsx)($0,{children:I==0?(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("span",{children:"Didn't get an email?"}),(0,Te.jsx)("button",{onClick:a,children:"Resend code"})]}):(0,Te.jsxs)(Te.Fragment,{children:[(0,Te.jsx)("span",{children:"Didn't get a message?"}),(0,Te.jsx)("button",{onClick:l,children:"Resend code"})]})})]})]}),(0,Te.jsx)(V,{protectedByPrivy:!0})]})},V0=Mi.default.div`
|
|
731
731
|
display: flex;
|
|
732
732
|
flex-direction: column;
|
|
733
733
|
align-items: flex-start;
|
|
@@ -816,7 +816,7 @@ Resources:
|
|
|
816
816
|
`,gf=Mi.default.span`
|
|
817
817
|
font-weight: 500;
|
|
818
818
|
word-break: break-all;
|
|
819
|
-
`;var Sf=m(require("@heroicons/react/24/solid/CheckCircleIcon")),xf=m(require("@heroicons/react/24/solid/XCircleIcon")),
|
|
819
|
+
`;var Sf=m(require("@heroicons/react/24/solid/CheckCircleIcon")),xf=m(require("@heroicons/react/24/solid/XCircleIcon")),wr=require("react"),_f=m(require("styled-components"));var Ef=m(require("styled-components"));var no=require("react/jsx-runtime"),Pf=({icon:e})=>{let t=e;return(0,no.jsx)(no.Fragment,{children:(0,no.jsx)(K0,{children:(0,no.jsxs)("div",{children:[(0,no.jsx)(Ht,{}),typeof t=="string"?(0,no.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):t?(0,no.jsx)(t,{style:{width:"38px",height:"38px"}}):(0,no.jsx)("span",{})]})})})},K0=Ef.default.div`
|
|
820
820
|
display: flex;
|
|
821
821
|
flex-direction: column;
|
|
822
822
|
justify-content: center;
|
|
@@ -839,14 +839,14 @@ Resources:
|
|
|
839
839
|
left: -19px;
|
|
840
840
|
top: -19px;
|
|
841
841
|
}
|
|
842
|
-
`;var xt=require("react/jsx-runtime"),kf=500,Tf=kf*2,Af=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Me(),f=(0,
|
|
842
|
+
`;var xt=require("react/jsx-runtime"),kf=500,Tf=kf*2,Af=()=>{let{lastScreen:e,currentScreen:t,data:r,navigateBack:o,navigate:n,setModalData:i}=_(),{status:a,token:l,waitForResult:s,reset:c,execute:u}=Me(),f=(0,wr.useRef)([]),y=ne=>{f.current=[ne,...f.current]},[g,w]=(0,wr.useState)(!0);(0,wr.useEffect)(()=>{let ne=setTimeout(w,Tf,!1);return y(ne),()=>{f.current.forEach(B=>clearTimeout(B)),f.current=[]}},[]);let[v,k]=(0,wr.useState)(""),[P,b]=(0,wr.useState)("Checking that you are a human..."),[A,R]=(0,wr.useState)((0,xt.jsx)(O,{onClick:()=>{},disabled:!0,children:"Continue"})),[N,L]=(0,wr.useState)(!1),[I,q]=(0,wr.useState)(3),J=r?.captchaModalData,j=async ne=>{try{await J?.callback(ne),J?.onSuccessNavigateTo&&n(J?.onSuccessNavigateTo,!1)}catch(B){if(B instanceof Xr)return;{let be={error:B,previousScreen:e||"LANDING"};i({errorModalData:be}),n(J?.onErrorNavigateTo||"ERROR_SCREEN",!1)}}};(0,wr.useEffect)(()=>{if(a==="success"){let ne=setTimeout(async()=>{let B=await s();!B||J?.userIntentRequired||j(B)},Tf);y(ne)}else if(a==="ready"){let ne=setTimeout(()=>{a==="ready"&&u()},kf);y(ne)}},[a]),(0,wr.useEffect)(()=>{if(!g)switch(a){case"success":k("Success!"),b("CAPTCHA passed successfully."),R((0,xt.jsx)(O,{onClick:()=>{L(!0),j(l)},disabled:!J?.userIntentRequired,loading:N,children:J?.userIntentRequired?"Continue":"Continuing..."}));break;case"loading":k(""),b("Checking that you are a human..."),R((0,xt.jsx)(O,{onClick:()=>{},disabled:!0,children:"Continue"}));break;case"error":k("Something went wrong"),I<=0?(b("If you use an adblocker or VPN, try disabling and re-attempting."),R(null)):(b("You did not pass CAPTCHA. Please try again."),R((0,xt.jsx)(O,{onClick:M,children:"Retry"})));break;case"ready":default:break}},[a,g,N]);let M=async()=>{if(I<=0)return;q(B=>B-1),c(),u();let ne=await s();!ne||J?.userIntentRequired||j(ne)};return(0,xt.jsxs)(xt.Fragment,{children:[(0,xt.jsx)(S,{backFn:!e||t===e?void 0:o}),(0,xt.jsxs)(j0,{children:[a==="success"?(0,xt.jsx)(Sf.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}):a==="error"?(0,xt.jsx)(xf.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}):(0,xt.jsx)(Pf,{}),(0,xt.jsxs)(St,{children:[v?(0,xt.jsx)("h3",{children:v}):null,(0,xt.jsx)("p",{children:P})]}),A]}),(0,xt.jsx)(z,{})]})},j0=_f.default.div`
|
|
843
843
|
display: flex;
|
|
844
844
|
flex-direction: column;
|
|
845
845
|
align-items: center;
|
|
846
846
|
justify-content: center;
|
|
847
847
|
gap: 24px;
|
|
848
848
|
width: 100%;
|
|
849
|
-
`;var Of=m(require("@heroicons/react/24/outline/WalletIcon")),Nf=require("react-device-detect"),Df=m(require("styled-components"));var Qt=require("react/jsx-runtime"),Rf=({...e})=>(0,Qt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,Qt.jsx)("defs",{children:(0,Qt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,Qt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,Qt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,Qt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,Qt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,Qt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,Qt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,Qt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,Qt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,Qt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,Qt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var _t=require("react/jsx-runtime"),If=({style:e,...t})=>(0,_t.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,_t.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,_t.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,_t.jsxs)("defs",{children:[(0,_t.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,_t.jsx)("stop",{"stop-color":"#002D72"}),(0,_t.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,_t.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,_t.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,_t.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var Y=require("react/jsx-runtime"),Mf=({style:e,...t})=>(0,Y.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Y.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,Y.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,Y.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,Y.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,Y.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,Y.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,Y.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,Y.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,Y.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,Y.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,Y.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,Y.jsxs)("defs",{children:[(0,Y.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#174299"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,Y.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,Y.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Y.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FF4000"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Y.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#8754C9"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,Y.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,Y.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,Y.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,Y.jsx)("stop",{stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,Y.jsx)("stop",{stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsx)("clipPath",{id:"clip0_5_32",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,Y.jsx)("clipPath",{id:"clip1_5_32",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var ar=require("react/jsx-runtime"),Wf=({style:e,...t})=>(0,ar.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,ar.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,ar.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,ar.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var Bo=require("react/jsx-runtime"),Lf=({style:e,...t})=>(0,Bo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Bo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,Bo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,Bo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,Bo.jsx)("defs",{children:(0,Bo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,Bo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var Ho=require("react/jsx-runtime"),bo={coinbase_wallet:{logo:Ys,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:wi,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:ho,displayName:"Phantom"},rainbow:{logo:Mf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:ka,displayName:"WalletConnect"},zerion:{logo:Lf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Rf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:If,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Wf,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},Kn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{on()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Nf.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,Ho.jsxs)(Q0,{onClick:s,children:[(0,Ho.jsx)(J0,{icon:Z0(e,n.connectorType)??r,name:n.walletClientType}),(0,Ho.jsx)("span",{children:Y0(e,n.connectorType)||t||n.walletClientType}),(0,Ho.jsx)("span",{id:"connect-text",children:"Connect"})]})},Y0=(e,t)=>{if(bo[e]?.displayName)return bo[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Z0=(e,t)=>{if(bo[e]?.logo)return bo[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return ka},J0=({icon:e,name:t})=>typeof e=="string"?(0,Ho.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,Ho.jsx)(Of.default,{}):e?(0,Ho.jsx)(e,{}):null,Q0=(0,Df.default)(Ke)`
|
|
849
|
+
`;var Of=m(require("@heroicons/react/24/outline/WalletIcon")),Nf=require("react-device-detect"),Df=m(require("styled-components"));var Qt=require("react/jsx-runtime"),Rf=({...e})=>(0,Qt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 436.49 511.97",height:"24",width:"24",...e,children:[(0,Qt.jsx)("defs",{children:(0,Qt.jsxs)("linearGradient",{id:"brave-linear-gradient",x1:"-18.79",y1:"359.73",x2:"194.32",y2:"359.73",gradientTransform:"matrix(2.05, 0, 0, -2.05, 38.49, 992.77)",gradientUnits:"userSpaceOnUse",children:[(0,Qt.jsx)("stop",{offset:"0",stopColor:"#f1562b"}),(0,Qt.jsx)("stop",{offset:"0.3",stopColor:"#f1542b"}),(0,Qt.jsx)("stop",{offset:"0.41",stopColor:"#f04d2a"}),(0,Qt.jsx)("stop",{offset:"0.49",stopColor:"#ef4229"}),(0,Qt.jsx)("stop",{offset:"0.5",stopColor:"#ef4029"}),(0,Qt.jsx)("stop",{offset:"0.56",stopColor:"#e83e28"}),(0,Qt.jsx)("stop",{offset:"0.67",stopColor:"#e13c26"}),(0,Qt.jsx)("stop",{offset:"1",stopColor:"#df3c26"})]})}),(0,Qt.jsx)("path",{style:{fill:"url(#brave-linear-gradient)"},d:"M436.49,165.63,420.7,122.75l11-24.6A8.47,8.47,0,0,0,430,88.78L400.11,58.6a48.16,48.16,0,0,0-50.23-11.66l-8.19,2.89L296.09.43,218.25,0,140.4.61,94.85,50.41l-8.11-2.87A48.33,48.33,0,0,0,36.19,59.3L5.62,90.05a6.73,6.73,0,0,0-1.36,7.47l11.47,25.56L0,165.92,56.47,380.64a89.7,89.7,0,0,0,34.7,50.23l111.68,75.69a24.73,24.73,0,0,0,30.89,0l111.62-75.8A88.86,88.86,0,0,0,380,380.53l46.07-176.14Z"}),(0,Qt.jsx)("path",{style:{fill:"#fff"},d:"M231,317.33a65.61,65.61,0,0,0-9.11-3.3h-5.49a66.08,66.08,0,0,0-9.11,3.3l-13.81,5.74-15.6,7.18-25.4,13.24a4.84,4.84,0,0,0-.62,9l22.06,15.49q7,5,13.55,10.76l6.21,5.35,13,11.37,5.89,5.2a10.15,10.15,0,0,0,12.95,0l25.39-22.18,13.6-10.77,22.06-15.79a4.8,4.8,0,0,0-.68-8.93l-25.36-12.8L244.84,323ZM387.4,175.2l.8-2.3a61.26,61.26,0,0,0-.57-9.18,73.51,73.51,0,0,0-8.19-15.44l-14.35-21.06-10.22-13.88-19.23-24a69.65,69.65,0,0,0-5.7-6.67h-.4L321,84.25l-42.27,8.14a33.49,33.49,0,0,1-12.59-1.84l-23.21-7.5-16.61-4.59a70.52,70.52,0,0,0-14.67,0L195,83.1l-23.21,7.54a33.89,33.89,0,0,1-12.59,1.84l-42.22-8-8.54-1.58h-.4a65.79,65.79,0,0,0-5.7,6.67l-19.2,24Q77.81,120.32,73,127.45L58.61,148.51l-6.78,11.31a51,51,0,0,0-1.94,13.35l.8,2.3A34.51,34.51,0,0,0,52,179.81l11.33,13,50.23,53.39a14.31,14.31,0,0,1,2.55,14.34L107.68,280a25.23,25.23,0,0,0-.39,16l1.64,4.52a43.58,43.58,0,0,0,13.39,18.76l7.89,6.43a15,15,0,0,0,14.35,1.72L172.62,314A70.38,70.38,0,0,0,187,304.52l22.46-20.27a9,9,0,0,0,3-6.36,9.08,9.08,0,0,0-2.5-6.56L159.2,237.18a9.83,9.83,0,0,1-3.09-12.45l19.66-36.95a19.21,19.21,0,0,0,1-14.67A22.37,22.37,0,0,0,165.58,163L103.94,139.8c-4.44-1.6-4.2-3.6.51-3.88l36.2-3.59a55.9,55.9,0,0,1,16.9,1.5l31.5,8.8a9.64,9.64,0,0,1,6.74,10.76L183.42,221a34.72,34.72,0,0,0-.61,11.41c.5,1.61,4.73,3.6,9.36,4.73l19.19,4a46.38,46.38,0,0,0,16.86,0l17.26-4c4.64-1,8.82-3.23,9.35-4.85a34.94,34.94,0,0,0-.63-11.4l-12.45-67.59a9.66,9.66,0,0,1,6.74-10.76l31.5-8.83a55.87,55.87,0,0,1,16.9-1.5l36.2,3.37c4.74.44,5,2.2.54,3.88L272,162.79a22.08,22.08,0,0,0-11.16,10.12,19.3,19.3,0,0,0,1,14.67l19.69,36.95A9.84,9.84,0,0,1,278.45,237l-50.66,34.23a9,9,0,0,0,.32,12.78l.15.14,22.49,20.27a71.46,71.46,0,0,0,14.35,9.47l28.06,13.35a14.89,14.89,0,0,0,14.34-1.76l7.9-6.45a43.53,43.53,0,0,0,13.38-18.8l1.65-4.52a25.27,25.27,0,0,0-.39-16l-8.26-19.49a14.4,14.4,0,0,1,2.55-14.35l50.23-53.45,11.3-13a35.8,35.8,0,0,0,1.54-4.24Z"})]});var _t=require("react/jsx-runtime"),If=({style:e,...t})=>(0,_t.jsxs)("svg",{width:"400",height:"400",viewBox:"0 0 400 400",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"}),(0,_t.jsx)("mask",{id:"mask0_16909_31415",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"400",height:"400",children:(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M260.543 0C300.7 0 320.773 0 342.39 6.83333C365.99 15.4233 384.577 34.01 393.167 57.61C400 79.2233 400 99.3033 400 139.457V260.543C400 300.7 400 320.773 393.167 342.39C384.577 365.99 365.99 384.577 342.39 393.163C320.773 400 300.7 400 260.543 400H139.457C99.3 400 79.2233 400 57.61 393.163C34.01 384.577 15.4233 365.99 6.83333 342.39C0 320.773 0 300.7 0 260.543V139.457C0 99.3033 0 79.2233 6.83333 57.61C15.4233 34.01 34.01 15.4233 57.61 6.83333C79.2233 0 99.3 0 139.457 0H260.543Z",fill:"white"})}),(0,_t.jsxs)("g",{mask:"url(#mask0_16909_31415)",children:[(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501Z",fill:"#FEFEFE"}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M199.804 39.8501L59.3756 119.957V280.18L199.804 360.297L340.23 280.18V119.957L199.804 39.8501ZM144.359 109.116H254.873L268.197 164.788H131.538L144.359 109.116ZM176.201 204.291L164.148 173.197H235.711L223.913 204.291L227.339 239.028L199.804 239.154H172.522L176.201 204.291ZM211.354 275.892V264.862L236.093 241.414V204.417L268.451 183.607L305.376 211.066L255.119 297.589H235.203L211.354 275.892ZM94.2395 211.066L131.282 183.857L164.021 204.417V241.414L188.76 264.862V275.892L164.913 297.84H144.734L94.2395 211.066Z",fill:"#002D72"}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M255.12 297.589H235.202L211.355 275.892V264.862L236.094 241.414V204.417L268.45 183.607L305.377 211.066L255.12 297.589ZM199.803 39.8498V109.117H254.872L268.198 164.789H199.803V173.199H235.712L223.914 204.291L227.338 239.028L199.803 239.153V360.296L340.231 280.181V119.957L199.803 39.8498Z",fill:"url(#paint0_linear_16909_31415)",style:{mixBlendMode:"multiply"}}),(0,_t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M188.761 275.892L164.912 297.84H144.734L94.2389 211.066L131.283 183.858L164.022 204.417V241.414L188.761 264.862V275.892ZM172.522 239.153L176.2 204.291L164.149 173.199H199.803V164.789H131.537L144.36 109.117H199.803V39.8498L59.375 119.957V280.181L199.803 360.296V239.153H172.522Z",fill:"url(#paint1_linear_16909_31415)",style:{mixBlendMode:"multiply"}})]}),(0,_t.jsxs)("defs",{children:[(0,_t.jsxs)("linearGradient",{id:"paint0_linear_16909_31415",x1:"325.255",y1:"325.727",x2:"325.255",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,_t.jsx)("stop",{"stop-color":"#002D72"}),(0,_t.jsx)("stop",{offset:"1","stop-color":"#002D72","stop-opacity":"0.01"})]}),(0,_t.jsxs)("linearGradient",{id:"paint1_linear_16909_31415",x1:"184.827",y1:"325.727",x2:"184.827",y2:"73.6291",gradientUnits:"userSpaceOnUse",children:[(0,_t.jsx)("stop",{"stop-color":"#002D72","stop-opacity":"0.01"}),(0,_t.jsx)("stop",{offset:"1","stop-color":"#002D72"})]})]})]});var Y=require("react/jsx-runtime"),Mf=({style:e,...t})=>(0,Y.jsxs)("svg",{width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Y.jsx)("g",{clipPath:"url(#clip0_5_32)",children:(0,Y.jsxs)("g",{clipPath:"url(#clip1_5_32)",children:[(0,Y.jsx)("mask",{id:"mask0_5_32",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"120",height:"120",children:(0,Y.jsx)("path",{d:"M78.163 0H41.837C29.79 0 23.767 0 17.283 2.04999C10.203 4.62701 4.627 10.203 2.05 17.283C0 23.767 0 29.791 0 41.837V78.163C0 90.21 0 96.232 2.05 102.717C4.627 109.797 10.203 115.373 17.283 117.949C23.767 120 29.79 120 41.837 120H78.163C90.21 120 96.232 120 102.717 117.949C109.797 115.373 115.373 109.797 117.95 102.717C120 96.232 120 90.21 120 78.163V41.837C120 29.791 120 23.767 117.95 17.283C115.373 10.203 109.797 4.62701 102.717 2.04999C96.232 0 90.21 0 78.163 0Z",fill:"black"})}),(0,Y.jsx)("g",{mask:"url(#mask0_5_32)",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"url(#paint0_linear_5_32)"})}),(0,Y.jsx)("path",{d:"M20 38H26C56.9279 38 82 63.0721 82 94V100H94C97.3137 100 100 97.3137 100 94C100 53.1309 66.8691 20 26 20C22.6863 20 20 22.6863 20 26V38Z",fill:"url(#paint1_radial_5_32)"}),(0,Y.jsx)("path",{d:"M84 94H100C100 97.3137 97.3137 100 94 100H84V94Z",fill:"url(#paint2_linear_5_32)"}),(0,Y.jsx)("path",{d:"M26 20L26 36H20L20 26C20 22.6863 22.6863 20 26 20Z",fill:"url(#paint3_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 36H26C58.0325 36 84 61.9675 84 94V100H66V94C66 71.9086 48.0914 54 26 54H20V36Z",fill:"url(#paint4_radial_5_32)"}),(0,Y.jsx)("path",{d:"M68 94H84V100H68V94Z",fill:"url(#paint5_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 52L20 36L26 36L26 52H20Z",fill:"url(#paint6_linear_5_32)"}),(0,Y.jsx)("path",{d:"M20 62C20 65.3137 22.6863 68 26 68C40.3594 68 52 79.6406 52 94C52 97.3137 54.6863 100 58 100H68V94C68 70.804 49.196 52 26 52H20V62Z",fill:"url(#paint7_radial_5_32)"}),(0,Y.jsx)("path",{d:"M52 94H68V100H58C54.6863 100 52 97.3137 52 94Z",fill:"url(#paint8_radial_5_32)"}),(0,Y.jsx)("path",{d:"M26 68C22.6863 68 20 65.3137 20 62L20 52L26 52L26 68Z",fill:"url(#paint9_radial_5_32)"})]})}),(0,Y.jsxs)("defs",{children:[(0,Y.jsxs)("linearGradient",{id:"paint0_linear_5_32",x1:"60",y1:"0",x2:"60",y2:"120",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#174299"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#001E59"})]}),(0,Y.jsxs)("radialGradient",{id:"paint1_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(74)",children:[(0,Y.jsx)("stop",{offset:"0.770277",stopColor:"#FF4000"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Y.jsxs)("linearGradient",{id:"paint2_linear_5_32",x1:"83",y1:"97",x2:"100",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FF4000"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#8754C9"})]}),(0,Y.jsxs)("linearGradient",{id:"paint3_linear_5_32",x1:"23",y1:"20",x2:"23",y2:"37",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#8754C9"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF4000"})]}),(0,Y.jsxs)("radialGradient",{id:"paint4_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(58)",children:[(0,Y.jsx)("stop",{offset:"0.723929",stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("linearGradient",{id:"paint5_linear_5_32",x1:"68",y1:"97",x2:"84",y2:"97",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("linearGradient",{id:"paint6_linear_5_32",x1:"23",y1:"52",x2:"23",y2:"36",gradientUnits:"userSpaceOnUse",children:[(0,Y.jsx)("stop",{stopColor:"#FFF700"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#FF9901"})]}),(0,Y.jsxs)("radialGradient",{id:"paint7_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(26 94) rotate(-90) scale(42)",children:[(0,Y.jsx)("stop",{offset:"0.59513",stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsxs)("radialGradient",{id:"paint8_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(51 97) scale(17 45.3333)",children:[(0,Y.jsx)("stop",{stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsxs)("radialGradient",{id:"paint9_radial_5_32",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(23 69) rotate(-90) scale(17 322.37)",children:[(0,Y.jsx)("stop",{stopColor:"#00AAFF"}),(0,Y.jsx)("stop",{offset:"1",stopColor:"#01DA40"})]}),(0,Y.jsx)("clipPath",{id:"clip0_5_32",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"white"})}),(0,Y.jsx)("clipPath",{id:"clip1_5_32",children:(0,Y.jsx)("rect",{width:"120",height:"120",fill:"white"})})]})]});var ar=require("react/jsx-runtime"),Wf=({style:e,...t})=>(0,ar.jsxs)("svg",{width:"96",height:"96",viewBox:"0 0 96 96",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,ar.jsx)("rect",{width:"96",height:"96",rx:"18",fill:"#FEF4FF"}),(0,ar.jsxs)("g",{filter:"url(#filter0_d_12393_20043)",children:[(0,ar.jsx)("path",{d:"M71.9367 18.39C72.0482 16.4526 72.3145 15.1746 72.8497 14.0075C73.0616 13.5456 73.2601 13.1675 73.2907 13.1675C73.3214 13.1675 73.2293 13.5085 73.086 13.9252C72.6969 15.0578 72.633 16.607 72.901 18.4094C73.2413 20.6963 73.4348 21.0263 75.8841 23.4967C77.0329 24.6554 78.3692 26.1168 78.8536 26.7443L79.7343 27.8851L78.8536 27.0698C77.7764 26.0728 75.2992 24.1283 74.7521 23.8503C74.3852 23.6639 74.3306 23.6671 74.1043 23.8894C73.8958 24.0943 73.8519 24.4021 73.8229 25.8572C73.7778 28.125 73.4646 29.5807 72.7087 31.0362C72.2998 31.8234 72.2354 31.6554 72.6053 30.7668C72.8816 30.1034 72.9096 29.8117 72.9076 27.6163C72.9033 23.2052 72.3727 22.1447 69.2607 20.3281C68.4724 19.8678 67.1734 19.2041 66.3742 18.8531C65.575 18.502 64.9401 18.1962 64.9633 18.1734C65.0514 18.0868 68.0863 18.961 69.3077 19.4247C71.1247 20.1145 71.4247 20.2039 71.6454 20.1207C71.7933 20.0649 71.8648 19.6398 71.9367 18.39Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M33.5466 11.9727C32.4688 11.808 32.4233 11.7887 32.9306 11.7119C33.9026 11.5647 36.1979 11.7653 37.7796 12.1358C41.4722 13.0004 44.8322 15.2153 48.4188 19.1488L49.3717 20.1938L50.7348 19.978C56.4773 19.0689 62.3192 19.7914 67.2054 22.0148C68.5495 22.6265 70.6689 23.8441 70.9337 24.157C71.018 24.2568 71.173 24.8987 71.2779 25.5837C71.6408 27.9534 71.4591 29.7699 70.7234 31.1265C70.3229 31.8648 70.3006 32.0988 70.5698 32.7306C70.7847 33.2348 71.3838 33.608 71.9771 33.6072C73.1913 33.6056 74.4983 31.6721 75.1038 28.9818L75.3443 27.9131L75.8209 28.4448C78.4346 31.3619 80.4876 35.34 80.8403 38.1716L80.9321 38.9099L80.4928 38.2387C79.7366 37.0838 78.9769 36.2976 78.0041 35.6635C76.2504 34.5205 74.3961 34.1315 69.4853 33.8766C65.0501 33.6464 62.5399 33.2732 60.0509 32.4737C55.816 31.1137 53.6812 29.3023 48.6508 22.8012C46.4164 19.9135 45.0354 18.3159 43.6616 17.0293C40.5401 14.1058 37.4729 12.5726 33.5466 11.9727Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M35.6404 25.9564C33.4522 22.9889 32.0983 18.4391 32.3914 15.0379L32.482 13.9854L32.9801 14.0749C33.9155 14.243 35.5283 14.8343 36.2835 15.2861C38.3559 16.5259 39.253 18.1582 40.1658 22.3496C40.4332 23.5773 40.7839 24.9666 40.9454 25.437C41.2052 26.194 42.1871 27.9624 42.9854 29.1109C43.5605 29.938 43.1785 30.33 41.9074 30.217C39.9662 30.0444 37.3367 28.2568 35.6404 25.9564Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M69.2799 48.0419C59.0538 43.9862 55.4521 40.4658 55.4521 34.5259C55.4521 33.6517 55.4827 32.9365 55.5199 32.9365C55.5572 32.9365 55.9528 33.225 56.3991 33.5776C58.4728 35.216 60.7949 35.9157 67.2233 36.8395C71.0061 37.3831 73.1349 37.8222 75.0986 38.4637C81.3402 40.5027 85.2018 44.6406 86.1227 50.2766C86.3903 51.9143 86.2334 54.9854 85.7995 56.6039C85.457 57.8824 84.4118 60.1868 84.1346 60.2751C84.0578 60.2996 83.9824 60.0094 83.9626 59.6147C83.8575 57.4983 82.7718 55.438 80.9485 53.8946C78.8754 52.1399 76.0901 50.7428 69.2799 48.0419Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M62.1008 49.7268C61.9727 48.9758 61.7505 48.0167 61.607 47.5954L61.3461 46.8296L61.8307 47.3655C62.5014 48.107 63.0314 49.0559 63.4806 50.3197C63.8234 51.2843 63.862 51.5711 63.8594 53.1386C63.8568 54.6774 63.814 55 63.4974 55.8682C62.9983 57.2373 62.3788 58.208 61.3392 59.2501C59.4712 61.1228 57.0696 62.1596 53.6039 62.5896C53.0015 62.6643 51.2456 62.7902 49.7019 62.8693C45.8118 63.0686 43.2515 63.4803 40.9508 64.276C40.6201 64.3905 40.3247 64.4601 40.2948 64.4305C40.2017 64.3393 41.768 63.4195 43.0618 62.8056C44.8862 61.94 46.7021 61.4676 50.7709 60.8002C52.7809 60.4704 54.8566 60.0704 55.3837 59.9112C60.3612 58.4079 62.9197 54.5286 62.1008 49.7268Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M66.7886 57.9275C65.4299 55.0505 65.1179 52.2726 65.8623 49.6821C65.942 49.4053 66.07 49.1787 66.1471 49.1787C66.224 49.1787 66.5447 49.3495 66.8594 49.5581C67.4855 49.9732 68.7412 50.6725 72.0866 52.4692C76.2612 54.7111 78.6414 56.4472 80.2599 58.4306C81.6775 60.1677 82.5547 62.1459 82.9769 64.5583C83.2159 65.9248 83.0759 69.2128 82.7199 70.5889C81.5975 74.9275 78.9889 78.3356 75.2682 80.3242C74.7231 80.6155 74.2337 80.8547 74.1807 80.8558C74.1278 80.8569 74.3264 80.3594 74.6222 79.7503C75.8738 77.173 76.0163 74.6661 75.07 71.8756C74.4906 70.1671 73.3092 68.0823 70.924 64.5588C68.1507 60.4623 67.4708 59.3721 66.7886 57.9275Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{d:"M28.3782 73.4506C32.173 70.2943 36.8948 68.0521 41.1958 67.3639C43.0494 67.0672 46.1372 67.185 47.8537 67.6178C50.605 68.3113 53.0662 69.8648 54.3462 71.7156C55.5971 73.5245 56.1338 75.1008 56.6925 78.6081C56.913 79.9916 57.1527 81.3809 57.2252 81.6954C57.6449 83.5131 58.4614 84.966 59.4733 85.6957C61.0805 86.8544 63.8479 86.9265 66.5704 85.8804C67.0325 85.7028 67.4336 85.5801 67.4618 85.6078C67.5605 85.7044 66.1896 86.6083 65.2225 87.0842C63.9212 87.7245 62.8864 87.972 61.5115 87.972C59.0181 87.972 56.948 86.7226 55.2206 84.175C54.8807 83.6736 54.1167 82.1718 53.5228 80.8378C51.699 76.7403 50.7984 75.4921 48.6809 74.126C46.8381 72.9374 44.4615 72.7245 42.6736 73.588C40.325 74.7223 39.6698 77.6786 41.3518 79.5521C42.0204 80.2967 43.2671 80.939 44.2865 81.0638C46.1936 81.2975 47.8326 79.8684 47.8326 77.9717C47.8326 76.7402 47.352 76.0374 46.1423 75.4996C44.4901 74.7652 42.7141 75.6237 42.7226 77.1526C42.7263 77.8045 43.0145 78.214 43.6779 78.5097C44.1036 78.6994 44.1134 78.7144 43.7664 78.6434C42.2504 78.3337 41.8952 76.5335 43.1141 75.3383C44.5776 73.9036 47.6037 74.5367 48.6428 76.4951C49.0794 77.3177 49.1301 78.956 48.7495 79.9452C47.8976 82.1593 45.4138 83.3237 42.8941 82.6901C41.1787 82.2587 40.4801 81.7915 38.4119 79.6931C34.8179 76.0462 33.4226 75.3396 28.2413 74.5428L27.2484 74.3902L28.3782 73.4506Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.5147 8.18128C23.517 22.5305 31.7835 28.4507 32.7022 29.7015C33.4607 30.7343 33.1752 31.6628 31.8758 32.3905C31.1532 32.7951 29.6676 33.205 28.9238 33.205C28.0825 33.205 27.7936 32.8853 27.7936 32.8853C27.3058 32.4296 27.0311 32.5093 24.5261 28.1293C21.0483 22.8137 18.1379 18.4041 18.0585 18.3303C17.8749 18.1596 17.878 18.1653 24.1715 29.2574C25.1883 31.5693 24.3737 32.4179 24.3737 32.7471C24.3737 33.417 24.1882 33.7691 23.3494 34.6907C21.951 36.2274 21.3259 37.954 20.8746 41.5274C20.3687 45.5332 18.9462 48.3629 15.0041 53.2057C12.6965 56.0406 12.3189 56.5602 11.7366 57.7028C11.0032 59.1416 10.8015 59.9475 10.7198 61.7645C10.6334 63.6855 10.8016 64.9265 11.3975 66.7632C11.9191 68.3712 12.4636 69.433 13.8555 71.5567C15.0568 73.3894 15.7484 74.7513 15.7484 75.2841C15.7484 75.708 15.8306 75.7085 17.692 75.2945C22.1466 74.3036 25.7638 72.5609 27.7981 70.4252C29.0571 69.1033 29.3527 68.3733 29.3623 66.5619C29.3686 65.377 29.3263 65.1289 29.0011 64.4473C28.4718 63.3379 27.5083 62.4154 25.3845 60.9853C22.6019 59.1115 21.4133 57.603 21.085 55.5285C20.8157 53.8263 21.1282 52.6253 22.6676 49.4472C24.2609 46.1575 24.6558 44.7557 24.9229 41.4399C25.0954 39.2977 25.3343 38.4528 25.9591 37.7747C26.6108 37.0676 27.1975 36.8281 28.8103 36.611C31.4396 36.2572 33.1139 35.5871 34.4901 34.3379C35.6839 33.2543 36.1835 32.2101 36.2602 30.6382L36.3184 29.4468L35.6512 28.6806C33.2352 25.9057 9.89667 6 9.74799 6C9.71623 6 10.5113 6.98164 11.5147 8.18128ZM17.1047 63.9381C17.6509 62.9852 17.3607 61.7601 16.447 61.1617C15.5836 60.5962 14.2424 60.8625 14.2424 61.5994C14.2424 61.8243 14.3687 61.9879 14.6532 62.1322C15.1322 62.375 15.167 62.648 14.7901 63.2061C14.4084 63.7712 14.4392 64.2681 14.877 64.6057C15.5826 65.15 16.5815 64.8507 17.1047 63.9381Z",fill:"#F50DB4"}),(0,ar.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M37.9777 37.236C36.7433 37.6095 35.5435 38.8981 35.172 40.2493C34.9454 41.0736 35.074 42.5196 35.4134 42.9662C35.9617 43.6874 36.492 43.8774 37.9277 43.8675C40.7388 43.8482 43.1825 42.6606 43.4666 41.176C43.6994 39.9591 42.6262 38.2726 41.1478 37.5321C40.385 37.1502 38.7626 36.9987 37.9777 37.236ZM41.2638 39.7671C41.6973 39.1604 41.5076 38.5047 40.7704 38.0611C39.3664 37.2167 37.2432 37.9155 37.2432 39.222C37.2432 39.8724 38.3504 40.5819 39.3653 40.5819C40.0408 40.5819 40.9652 40.1851 41.2638 39.7671Z",fill:"#F50DB4"})]})]});var Bo=require("react/jsx-runtime"),Lf=({style:e,...t})=>(0,Bo.jsxs)("svg",{width:"176",height:"176",viewBox:"0 0 176 176",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:24,width:24,...e},...t,children:[(0,Bo.jsxs)("g",{clipPath:"url(#clip0_1704_1423)",children:[(0,Bo.jsx)("path",{d:"M126.233 176H49.7672C22.287 176 0 153.723 0 126.233V49.7673C0 22.287 22.2769 0 49.7672 0H126.233C153.713 0 176 22.277 176 49.7673V126.233C176 153.723 153.713 176 126.233 176Z",fill:"#2461ED"}),(0,Bo.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M100.667 85.6591C83.4133 76.3353 62.4196 64.2443 46.6192 54.3891C41.9573 51.0306 44.3234 43.9023 49.9578 43.9023H128.138C132.499 43.9023 135.416 48.7648 133.231 52.4442C127.977 61.5174 120.308 73.0368 113.901 82.1702C110.462 87.0727 104.858 87.9149 100.667 85.6591ZM75.5031 88.6867C92.1858 97.5795 115.566 111.104 132.178 121.33C137.311 124.498 135.266 132.098 129.271 132.098C119.46 132.098 103.518 132.1 87.6592 132.103C71.9639 132.105 56.3497 132.108 46.8398 132.108C42.0476 132.108 39.5913 127.135 41.6265 123.666C48.5041 111.946 56.2338 100.116 62.6603 91.2834C65.5176 87.3433 71.3325 86.461 75.5031 88.6867Z",fill:"white"})]}),(0,Bo.jsx)("defs",{children:(0,Bo.jsx)("clipPath",{id:"clip0_1704_1423",children:(0,Bo.jsx)("rect",{width:"176",height:"176",fill:"white"})})})]});var Ho=require("react/jsx-runtime"),bo={coinbase_wallet:{logo:Zs,displayName:"Coinbase Wallet",rdns:"com.coinbase.wallet"},metamask:{logo:wi,displayName:"MetaMask",rdns:"io.metamask"},phantom:{logo:ho,displayName:"Phantom"},rainbow:{logo:Mf,displayName:"Rainbow",rdns:"me.rainbow"},wallet_connect:{logo:Aa,displayName:"WalletConnect"},zerion:{logo:Lf,displayName:"Zerion",rdns:"io.zerion.wallet"},brave_wallet:{logo:Rf,displayName:"Brave Wallet",rdns:"com.brave.wallet"},cryptocom:{logo:If,displayName:"Crypto.com DeFi Wallet"},uniswap:{logo:Wf,displayName:"Uniswap Wallet",rdns:"org.uniswap.app"},okx_wallet:{displayName:"OKX Wallet",rdns:"com.okex.wallet",logo:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="}},Kn=({provider:e,displayName:t,logo:r,connectOnly:o,connector:n})=>{let{navigate:i}=_(),{connectWallet:a}=W(),l=n.connectorType==="wallet_connect_v2"?e:n.walletClientType,s;return n.connectorType==="phantom"?s=()=>{on()?(a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")):i(Nf.isMobile?"PHANTOM_INTERSTITIAL_SCREEN":"INSTALL_PHANTOM_SCREEN")}:s=()=>{a(n,l),i(o?"AWAITING_CONNECT_ONLY_CONNECTION":"AWAITING_CONNECTION")},(0,Ho.jsxs)(Q0,{onClick:s,children:[(0,Ho.jsx)(J0,{icon:Z0(e,n.connectorType)??r,name:n.walletClientType}),(0,Ho.jsx)("span",{children:Y0(e,n.connectorType)||t||n.walletClientType}),(0,Ho.jsx)("span",{id:"connect-text",children:"Connect"})]})},Y0=(e,t)=>{if(bo[e]?.displayName)return bo[e].displayName;if(t==="wallet_connect_v2"&&e==="wallet_connect")return"Wallet Connect"},Z0=(e,t)=>{if(bo[e]?.logo)return bo[e].logo;if(t==="wallet_connect_v2"&&e==="wallet_connect")return Aa},J0=({icon:e,name:t})=>typeof e=="string"?(0,Ho.jsx)("img",{alt:`${t||"wallet"} logo`,src:e,style:{height:24,width:24,borderRadius:4}}):typeof e===void 0?(0,Ho.jsx)(Of.default,{}):e?(0,Ho.jsx)(e,{}):null,Q0=(0,Df.default)(je)`
|
|
850
850
|
/* Show "Connect" on hover */
|
|
851
851
|
> #connect-text {
|
|
852
852
|
font-weight: 500;
|
|
@@ -868,7 +868,7 @@ Resources:
|
|
|
868
868
|
display: none;
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
`;var io=require("react/jsx-runtime"),X0=["coinbase_wallet"],ev=["metamask","okx_wallet","rainbow","uniswap","zerion"],tv=["cryptocom"],rv=["phantom"],Wi=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=_(),o=
|
|
871
|
+
`;var io=require("react/jsx-runtime"),X0=["coinbase_wallet"],ev=["metamask","okx_wallet","rainbow","uniswap","zerion"],tv=["cryptocom"],rv=["phantom"],Wi=({connectOnly:e})=>{let{connectors:t}=W(),{app:r}=_(),o=Ma(r.appearance.walletList,t,e,r.appearance.walletList);return(0,io.jsxs)(io.Fragment,{children:[...o]})},Ma=(e,t,r,o)=>{let n=[],i=[],a=[],l=t.find(s=>s.connectorType==="wallet_connect_v2");for(let s of e)if(s==="detected_wallets"){let c=t.filter(({connectorType:u,walletClientType:f})=>f==="uniswap_wallet_extension"?!o.includes("uniswap"):u==="injected"&&!o.includes(f));for(let u of c){let{walletClientType:f,walletBranding:y}=u;(f==="unknown"?i:n).push((0,io.jsx)(Kn,{connectOnly:r,provider:f,logo:y.icon,displayName:y.name,connector:u},`${s}-${f}`))}}else if(rv.includes(s)){let c=t.find(u=>u.connectorType==="injected"&&u.walletClientType===s||u.connectorType===s);c&&n.push((0,io.jsx)(Kn,{connectOnly:r,provider:s,connector:c},s))}else if(ev.includes(s)){let c=t.find(u=>s==="uniswap"?u.walletClientType==="uniswap_wallet_extension":u.connectorType==="injected"&&u.walletClientType===s)??l;c&&n.push((0,io.jsx)(Kn,{connectOnly:r,provider:s,connector:c},s))}else if(X0.includes(s)){let c=t.find(({connectorType:u})=>u===s);c&&n.push((0,io.jsx)(Kn,{connectOnly:r,provider:s,connector:c},s))}else tv.includes(s)?l&&a.push((0,io.jsx)(Kn,{connectOnly:r,provider:s,connector:l},s)):s==="wallet_connect"&&l&&a.push((0,io.jsx)(Kn,{connectOnly:r,provider:s,connector:l},s));return[...i,...n,...a]};var Eo=require("react/jsx-runtime"),Uf=()=>{let{app:e}=_(),t=`Connect a wallet to ${e?.name}`;return(0,Eo.jsxs)(Eo.Fragment,{children:[(0,Eo.jsx)(S,{},"header"),(0,Eo.jsx)(wo,{title:"Connect your wallet",description:t}),(0,Eo.jsx)(to,{children:(0,Eo.jsx)(Wi,{connectOnly:!0})}),(0,Eo.jsx)(V,{protectedByPrivy:!0})]})};var Vf=m(require("styled-components"));var Gf=m(require("styled-components"));var Ff=m(require("react"));var Hf=require("react/jsx-runtime"),Bf=()=>{let{app:e}=_(),t=e?.appearance?.logo,r=`${e?.name} logo`,o={maxHeight:"90px",maxWidth:"180px"};return t?typeof t=="string"?(0,Hf.jsx)("img",{src:t,alt:r,style:o}):t.type==="svg"||t.type==="img"?Ff.default.cloneElement(t,{alt:r,style:o}):(console.warn("`config.appearance.logo` must be a string, or an SVG / IMG element. Nothing will be rendered."),null):null};var Rd=require("react/jsx-runtime"),Li=e=>{let{app:t}=_();return t?.appearance.logo?(0,Rd.jsx)(ov,{...e,children:(0,Rd.jsx)(Bf,{})}):null},ov=Gf.default.div`
|
|
872
872
|
display: flex;
|
|
873
873
|
flex-direction: column;
|
|
874
874
|
align-items: center;
|
|
@@ -877,7 +877,7 @@ Resources:
|
|
|
877
877
|
justify-content: center;
|
|
878
878
|
`;var ao=require("react/jsx-runtime"),zf=()=>{let{app:e}=_();return(0,ao.jsxs)(ao.Fragment,{children:[(0,ao.jsx)(S,{},"header"),(0,ao.jsx)(nv,{}),(0,ao.jsx)(to,{children:(0,ao.jsx)(Wi,{connectOnly:!0})}),e&&(0,ao.jsx)(Ri,{app:e,alwaysShowImplicitConsent:!0}),(0,ao.jsx)(V,{protectedByPrivy:!0})]})},nv=(0,Vf.default)(Li)`
|
|
879
879
|
margin-bottom: 16px;
|
|
880
|
-
`;var Ni=require("react"),jf=require("react-device-detect"),Yf=m(require("styled-components"));var
|
|
880
|
+
`;var Ni=require("react"),jf=require("react-device-detect"),Yf=m(require("styled-components"));var Gr=require("react"),La=require("react-device-detect"),Md=m(require("styled-components"));var Wa=require("react"),iv=(e,t)=>{let r=(0,Wa.useRef)(()=>{});(0,Wa.useEffect)(()=>{r.current=e}),(0,Wa.useEffect)(()=>{if(t!==null){let o=setInterval(()=>r.current(),t||0);return()=>clearInterval(o)}},[t])},qf=iv;var Oi=require("react");function $f(){let[e,t]=(0,Oi.useState)(!1),r=(0,Oi.useCallback)(()=>{document.hidden&&t(!0)},[]);return(0,Oi.useEffect)(()=>(document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)),[r]),{hasTabbedAway:e,reset:()=>t(!1)}}var Ue=require("react/jsx-runtime"),Id=2,Wd=e=>e?.privyErrorCode==="linked_to_another_user"?Oo.ERROR_USER_EXISTS:e instanceof tt&&!e.details.default?e.details:e instanceof hi?Oo.ERROR_TIMED_OUT:e instanceof yi?Oo.ERROR_USER_REJECTED_CONNECTION:Oo.ERROR_WALLET_CONNECTION,Kf=()=>{let[e,t]=(0,Gr.useState)(!1),[r,o]=(0,Gr.useState)(!1),[n,i]=(0,Gr.useState)(void 0),{authenticated:a,logout:l}=H(),{app:s,navigate:c,navigateBack:u,lastScreen:f,currentScreen:y,setModalData:g}=_(),{getAuthFlow:w,walletConnectionStatus:v,closePrivyModal:k,initLoginWithWallet:P,loginWithWallet:b,updateWallets:A,createAnalyticsEvent:R}=W(),{walletConnectors:N}=H(),[L,I]=(0,Gr.useState)(0),{user:q}=H(),[J]=(0,Gr.useState)(q?.linkedAccounts.length||0),[j,M]=(0,Gr.useState)(""),[ne,B]=(0,Gr.useState)(!1),{hasTabbedAway:be}=$f(),{enabled:fe,token:ve}=Me(),Ee=La.isMobile&&v?.connector?.connectorType==="wallet_connect_v2"||La.isMobile&&v?.connector?.connectorType==="coinbase_wallet"||La.isMobile&&v?.connector?.connectorType==="injected"&&v?.connector?.walletClientType==="phantom",ae=v?.status==="connected",It=v?.status==="switching_to_supported_chain";(0,Gr.useEffect)(()=>{let Re=w();if(ae&&!Re&&(fe&&!ve&&!a?(g({captchaModalData:{callback:se=>P(v.connectedWallet,se).then(()=>{B(!0)}),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN",!1)):P(v.connectedWallet,ve).then(()=>{B(!0)})),Re&&Ee&&ae&&!Re.preparedMessage){Re.buildSiweMessage();return}!Re||Ee||!ae||r||(async()=>{o(!0),i(void 0);try{v?.connector?.connectorType==="wallet_connect_v2"&&v?.connector?.walletClientType==="metamask"&&await Qc(2500),await er()}catch(se){console.warn("Auto-prompted signature failed",se)}finally{o(!1)}})()},[L,ae,ne]),(0,Gr.useEffect)(()=>{if(q&&e){let Re=s?.render.inDialog?st:0,se=s?.render.inDialog?Re-500:0;if(s?.legal.requireUsersAcceptTerms&&!q.hasAcceptedTerms){let Ie=setTimeout(()=>{c("AFFIRMATIVE_CONSENT_SCREEN")},se);return()=>clearTimeout(Ie)}if(Lr(q,s?.embeddedWallets?.createOnLogin)){let Ie=setTimeout(()=>{g({createWallet:{onSuccess:()=>{},onFailure:Xe=>{console.error(Xe),R({eventName:"embedded_wallet_creation_failure_logout",payload:{error:Xe,screen:"ConnectionStatusScreen"}}),l()},callAuthOnSuccessOnClose:!0}}),c("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},se);return()=>clearTimeout(Ie)}A();let le=setTimeout(()=>k({shouldCallAuthOnSuccess:!0,isSuccess:!0}),st);return()=>clearTimeout(le)}},[q,e]);let Mt=Re=>{if(Re?.privyErrorCode==="allowlist_rejected"){c("ALLOWLIST_REJECTION_SCREEN");return}else if(Re?.privyErrorCode==="max_accounts_reached"){console.error(new mo(Re).toString()),c("USER_LIMIT_REACHED_SCREEN");return}i(Wd(Re))};async function er(){try{if(await b(),!s?.render.inDialog)return k({shouldCallAuthOnSuccess:!0,isSuccess:!0});t(!0)}catch(Re){Mt(Re)}finally{o(!1)}}(0,Gr.useEffect)(()=>{v?.connectError&&Mt(v?.connectError)},[v]),qf(()=>{let Re=wt==="wallet_connect_v2"&&v?.connector instanceof go?v.connector.redirectUri:void 0;Re&&M(Re)},v?.connector instanceof go&&!j?500:null);let wt=v?.connector?.connectorType||"injected",Rr=v?.connector?.walletClientType||"unknown",$e=bo[Rr]?.displayName||v?.connector?.walletBranding.name||"Browser Extension",pt=bo[Rr]?.logo||v?.connector?.walletBranding.icon||(Re=>(0,Ue.jsx)(Ci,{...Re})),Ir=$e==="Browser Extension"?$e.toLowerCase():$e,tr;e?tr=`Successfully connected with ${Ir}`:n?tr=n.message:It?tr="Switching networks":ae?tr=r&&Ee?"Signing":"Sign to verify":tr=`Waiting for ${Ir}`;let it="Don\u2019t see your wallet? Check your other browser windows.";if(e){let Re=q?.linkedAccounts.length||0;J===Re?it="Wallet was already linked.":it="You\u2019re good to go!"}else L>=Id&&n?it="Unable to connect wallet":n?it=n.detail:It?it="Switch your wallet to the requested network.":ae&&Ee?it="Sign the message in your wallet to verify it belongs to you.":Rr==="metamask"&&La.isMobile?it="Click continue to open and connect MetaMask.":Rr==="metamask"?it="For the best experience, connect only one wallet at a time.":wt==="wallet_connect"?it="Open your mobile wallet app to continue":wt==="coinbase_wallet"&&(Cu()||(hd(q)?it="Continue with the Coinbase app. Not the right wallet? Reset your connection below.":it="Open the Coinbase app on your phone to continue."));let D=N?.walletConnectors?.find(Re=>Re.walletClientType==="coinbase_wallet"),Rn=Rr==="coinbase_wallet"&&(hd(q)||n===Oo.ERROR_USER_EXISTS);return(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(S,{backFn:!f||y===f?void 0:u}),(0,Ue.jsxs)(av,{children:[(0,Ue.jsx)(Ld,{walletLogo:pt,success:e,fail:!!n}),(0,Ue.jsxs)(St,{children:[(0,Ue.jsx)("h3",{children:tr}),(0,Ue.jsx)("p",{children:it}),!ae&&j&&!be?(0,Ue.jsxs)("p",{children:["Still here?"," ",(0,Ue.jsx)("a",{href:j,target:"_blank",style:{textDecoration:"underline"},children:"Try again"})]}):null]}),Rn?(0,Ue.jsx)(O,{onClick:()=>D&&D?.disconnect(),disabled:e,children:"Use a different wallet"}):n==Oo.ERROR_USER_EXISTS&&y!==f?(0,Ue.jsx)(O,{onClick:u,children:"Use a different wallet"}):ae&&!e&&Ee?(0,Ue.jsx)(O,{onClick:()=>{o(!0),er()},disabled:r,children:r?"Signing":"Sign with your wallet"}):!e&&n?.retryable&&L<Id?(0,Ue.jsx)(O,{onClick:()=>{I(L+1),i(void 0),ae?(o(!0),er()):v?.connectRetry()},disabled:!e&&(!n?.retryable||L>=Id),children:"Retry"}):!e&&!n?(0,Ue.jsx)(O,{onClick:()=>{},disabled:!0,children:"Connecting"}):null]}),(0,Ue.jsx)(z,{})]})},av=Md.default.div`
|
|
881
881
|
display: flex;
|
|
882
882
|
flex-direction: column;
|
|
883
883
|
align-items: center;
|
|
@@ -907,14 +907,14 @@ Resources:
|
|
|
907
907
|
left: -19px;
|
|
908
908
|
top: -19px;
|
|
909
909
|
}
|
|
910
|
-
`,Ld=e=>{let t=e.walletLogo;return(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsx)(sv,{children:(0,Ue.jsxs)("div",{children:[(0,Ue.jsx)(Ht,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ue.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ue.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var zt=require("react/jsx-runtime")
|
|
910
|
+
`,Ld=e=>{let t=e.walletLogo;return(0,Ue.jsx)(Ue.Fragment,{children:(0,Ue.jsx)(sv,{children:(0,Ue.jsxs)("div",{children:[(0,Ue.jsx)(Ht,{success:e.success,fail:e.fail}),typeof t=="string"?(0,Ue.jsx)("span",{style:{background:`url('${t}')`,height:"38px",width:"38px",borderRadius:"6px",margin:"auto",backgroundSize:"cover"}}):(0,Ue.jsx)(t,{style:{width:"38px",height:"38px"}})]})})})};var zt=require("react/jsx-runtime"),$l=2,Zf=()=>{let{navigateBack:e,lastScreen:t,currentScreen:r}=_(),{walletConnectionStatus:o,closePrivyModal:n}=W(),[i,a]=(0,Ni.useState)(void 0),[l,s]=(0,Ni.useState)(0),c=o?.status==="connected",u=o?.status==="switching_to_supported_chain";(0,Ni.useEffect)(()=>{if(c){let A=setTimeout(n,st);return()=>clearTimeout(A)}},[c]);let f=A=>{a(Wd(A))};(0,Ni.useEffect)(()=>{o?.connectError&&f(o?.connectError)},[o]);let y=o?.connector?.connectorType||"injected",g=o?.connector?.walletClientType||"unknown",w=bo[g]?.displayName||o?.connector?.walletBranding.name||"Browser Extension",v=bo[g]?.logo||o?.connector?.walletBranding.icon||(A=>(0,zt.jsx)(Ci,{...A})),k=w==="Browser Extension"?w.toLowerCase():w,P;c?P=`Successfully connected with ${k}`:i?P=i.message:u?P="Switching networks":P=`Waiting for ${k}`;let b="Don\u2019t see your wallet? Check your other browser windows.";return c?b="You\u2019re good to go!":l>=$l&&i?b="Unable to connect wallet":i?b=i.detail:u?b="Switch your wallet to the requested network.":g==="metamask"&&jf.isMobile?b="Click to continue to open and connect MetaMask.":g==="metamask"?b="For the best experience, connect only one wallet at a time.":y==="wallet_connect_v2"?b="Open your mobile wallet app to continue":y==="coinbase_wallet"&&(b="Open the Coinbase app on your phone to continue."),(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(S,{backFn:r===t?void 0:e}),(0,zt.jsxs)(lv,{children:[(0,zt.jsx)(Ld,{walletLogo:v,success:c,fail:!!i}),(0,zt.jsxs)(St,{children:[(0,zt.jsx)("h3",{children:P}),(0,zt.jsx)("p",{children:b})]}),i==Oo.ERROR_USER_EXISTS?(0,zt.jsx)(O,{onClick:e,children:"Use a different wallet"}):!c&&i?.retryable&&l<$l?(0,zt.jsx)(O,{onClick:()=>{s(l+1),a(void 0),o?.connectRetry()},disabled:!c&&(!i?.retryable||l>=$l),children:"Retry"}):!c&&i&&l>=$l?(0,zt.jsx)(O,{onClick:e,children:"Use a different wallet"}):null]}),(0,zt.jsx)(z,{})]})},lv=Yf.default.div`
|
|
911
911
|
display: flex;
|
|
912
912
|
flex-direction: column;
|
|
913
913
|
align-items: center;
|
|
914
914
|
justify-content: center;
|
|
915
915
|
gap: 24px;
|
|
916
916
|
width: 100%;
|
|
917
|
-
`;var oh=m(require("@heroicons/react/24/solid/XCircleIcon")),Hi=require("react"),nh=m(require("styled-components"));var
|
|
917
|
+
`;var oh=m(require("@heroicons/react/24/solid/XCircleIcon")),Hi=require("react"),nh=m(require("styled-components"));var Oa=m(require("styled-components")),Di=require("react/jsx-runtime"),Ui=()=>(0,Di.jsx)(cv,{children:(0,Di.jsxs)(dv,{children:[(0,Di.jsx)(pv,{}),(0,Di.jsx)(uv,{})]})}),cv=Oa.default.div`
|
|
918
918
|
display: flex;
|
|
919
919
|
justify-content: center;
|
|
920
920
|
align-items: center;
|
|
@@ -926,14 +926,14 @@ Resources:
|
|
|
926
926
|
@media all and (display-mode: standalone) {
|
|
927
927
|
margin-bottom: 30px;
|
|
928
928
|
}
|
|
929
|
-
`,dv=
|
|
929
|
+
`,dv=Oa.default.div`
|
|
930
930
|
position: relative;
|
|
931
931
|
height: 140px;
|
|
932
932
|
width: 140px;
|
|
933
933
|
|
|
934
934
|
opacity: 1;
|
|
935
935
|
animation: fadein 200ms ease;
|
|
936
|
-
`,pv=
|
|
936
|
+
`,pv=Oa.default.div`
|
|
937
937
|
position: absolute;
|
|
938
938
|
top: 0;
|
|
939
939
|
right: 0;
|
|
@@ -946,7 +946,7 @@ Resources:
|
|
|
946
946
|
border: 4px solid var(--privy-color-accent-light);
|
|
947
947
|
border-radius: 50%;
|
|
948
948
|
}
|
|
949
|
-
`,uv=
|
|
949
|
+
`,uv=Oa.default.div`
|
|
950
950
|
position: absolute;
|
|
951
951
|
top: 0;
|
|
952
952
|
right: 0;
|
|
@@ -970,9 +970,9 @@ Resources:
|
|
|
970
970
|
transform: rotate(360deg);
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
`;var Jf=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ot=class extends Error{constructor(r,o){super(o);this.type=r}};function Fi(e){let t=e.type;return typeof t=="string"&&Jf.includes(t)}function mv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Bi(e){return Fi(e)&&e.type==="wallet_not_on_device"}function Qf(e){return Fi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function mn(e){return!!(Fi(e)&&e.type==="mfa_timeout")}function fn(e){return!!(Fi(e)&&e.type==="missing_or_invalid_mfa")}function
|
|
973
|
+
`;var Jf=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","missing_or_invalid_mfa","mfa_verification_max_attempts_reached","mfa_timeout","twilio_verification_failed"];var ot=class extends Error{constructor(r,o){super(o);this.type=r}};function Fi(e){let t=e.type;return typeof t=="string"&&Jf.includes(t)}function mv(e){let t=e.type;return typeof t=="string"&&t==="client_error"}function Bi(e){return Fi(e)&&e.type==="wallet_not_on_device"}function Qf(e){return Fi(e)&&(e.type==="invalid_recovery_pin"||e.type==="invalid_request_arguments")}function mn(e){return!!(Fi(e)&&e.type==="mfa_timeout")}function fn(e){return!!(Fi(e)&&e.type==="missing_or_invalid_mfa")}function Kl(e){return!!(Fi(e)&&e.type==="mfa_verification_max_attempts_reached")}function jl(e){return!!(Fi(e)&&e.message.includes("code 429"))}function Yl(e){return!!(mv(e)&&e.message==="MFA canceled")}function Xf(e,t){return t.length>1?"EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN":e==="create"?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"}function Zl(e){switch(e){case"user-passcode":return"EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN";case"google-drive":return"EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN";default:throw new Error("Recovery method not supported")}}async function eh({api:e,provider:t}){let r=Ca(),o=Us(),n=await Fs(r);try{return{url:(await e.post(au,{redirect_to:window.location.href,code_challenge:n,state_code:o,provider:t})).url,codeVerifier:r,stateCode:o}}catch(i){throw Ce(i)}}async function th({api:e,provider:t,stateCode:r,codeVerifier:o,authorizationCode:n}){if(!n||!r)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if(n==="undefined")throw new T("User denied confirmation during OAuth flow");try{return(await e.post(su,{authorization_code:n,state_code:r,code_verifier:o,provider:t})).access_token}catch(i){let a=Ce(i);throw a.privyErrorCode?new T(a.message||"Invalid code during OAuth flow.",void 0,a.privyErrorCode):a.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}var sr=require("react/jsx-runtime"),rh=1,ih=()=>{let{authenticated:e,user:t,getAccessToken:r}=H(),{closePrivyModal:o,createAnalyticsEvent:n,walletProxy:i}=W(),{navigate:a,data:l,setModalData:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=(0,Hi.useMemo)(()=>Date.now(),[]),[f,y]=(0,Hi.useState)(!1),{onCompleteNavigateTo:g,onFailure:w,shouldForceMFA:v}=l?.connectWallet,k=b=>{f||(y(!0),w(typeof b=="string"?new Error(b):b))};(0,Hi.useEffect)(()=>{let b=Ve(t),A;return!e||!b?k("User must be authenticated and have a Privy wallet before it can be connected"):i?((async()=>{let N=await r();if(!N)return k("User must be authenticated and have a Privy wallet before it can be connected");try{await i.connect({accessToken:N,address:b.address}),v&&await i.verifyMfa({accessToken:N});let L=(Date.now()-u)/1e3;g==="EMBEDDED_WALLET_KEY_EXPORT_SCREEN"&&L<rh?A=setTimeout(()=>{a(g)},(rh-L)*1e3):a(g)}catch(L){if(Bi(L)&&b.recoveryMethod==="privy"){let I=await r();if(!I)return k("User must be authenticated and have a Privy wallet before it can be recovered");try{n({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:b.address}}),(await i?.recover({address:b.address,accessToken:I}))?.address||k(new Error("Unable to recover wallet")),g?a(g):o({shouldCallAuthOnSuccess:!1}),n({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:b.address}}),a(g)}catch{k("An error has occurred, please try again.")}}else if(Bi(L)){s({...l,recoverWallet:{privyWallet:b,onCompleteNavigateTo:g,onFailure:w},recoveryOAuthStatus:{provider:"google-drive",action:"recover",isInAccountCreateFlow:!1}});let I=Zl(b.recoveryMethod);a(I)}else k(L)}})(),()=>clearTimeout(A)):void 0},[e,t,i]);let P=()=>{k("User exited before wallet could be connected"),o({shouldCallAuthOnSuccess:!1})};return c.current=P,(0,sr.jsxs)(sr.Fragment,{children:[(0,sr.jsx)(S,{onClose:P}),f?(0,sr.jsxs)(sr.Fragment,{children:[(0,sr.jsxs)(ro,{children:[(0,sr.jsx)(oh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,sr.jsx)(De,{title:"Something went wrong",description:"We\u2019re on it. Please try again later."})]}),(0,sr.jsx)(O,{onClick:()=>o({shouldCallAuthOnSuccess:!1}),children:"Close"})]}):(0,sr.jsx)(Ui,{}),(0,sr.jsx)(fv,{})]})},fv=nh.default.div`
|
|
974
974
|
height: 44px;
|
|
975
|
-
`;var ah=m(require("@heroicons/react/24/solid/CheckCircleIcon")),sh=require("react");var
|
|
975
|
+
`;var ah=m(require("@heroicons/react/24/solid/CheckCircleIcon")),sh=require("react");var Vr=require("react/jsx-runtime"),lh=()=>{let{user:e}=H(),{closePrivyModal:t,isNewUserThisSession:r,updateWallets:o}=W(),{app:n,data:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s,callAuthOnSuccessOnClose:c}=i.createWallet,u=()=>{let f=Ve(e);f?(o(),l(f)):s(new Error("Failed to create wallet")),t({shouldCallAuthOnSuccess:c})};return(0,sh.useEffect)(()=>{let f=setTimeout(u,Du);return()=>clearTimeout(f)},[]),a.current=u,(0,Vr.jsxs)(Vr.Fragment,{children:[(0,Vr.jsx)(S,{onClose:u}),(0,Vr.jsx)(ce,{}),(0,Vr.jsxs)(ro,{children:[(0,Vr.jsx)(ah.default,{fill:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Vr.jsx)(De,{title:r?`Welcome${n?.name?` to ${n?.name}`:""}`:"All set!",description:r?"You\u2019ve successfully created an account.":"Your account is secured."})]}),(0,Vr.jsx)(ye,{}),(0,Vr.jsx)(V,{protectedByPrivy:!0})]})};var ph=m(require("@heroicons/react/20/solid/ExclamationTriangleIcon")),uh=m(require("@heroicons/react/24/outline/ArrowRightOnRectangleIcon")),Go=require("react"),Vo=m(require("styled-components"));var we=require("react/jsx-runtime"),mh=()=>{let[e,t]=(0,Go.useState)(null),{authenticated:r,user:o,getAccessToken:n}=H(),{closePrivyModal:i,createAnalyticsEvent:a,clientAnalyticsId:l}=W(),{data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),u=Ve(o)?.address,{onFailure:f,onSuccess:y,origin:g,appId:w}=s.keyExport,v=P=>{i({shouldCallAuthOnSuccess:!1}),f(typeof P=="string"?new Error(P):P)},k=()=>{i({shouldCallAuthOnSuccess:!1}),y(),a({eventName:"embedded_wallet_key_export_completed",payload:{walletAddress:u}})};return(0,Go.useEffect)(()=>{let P=Ve(o);if(!r||!P)return v("User must be authenticated before exporting their wallet");n().then(t,v)},[r,o]),c.current=k,(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(S,{onClose:k}),(0,we.jsxs)(gv,{children:[(0,we.jsxs)(De,{icon:(0,we.jsx)(uh.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"}),title:"Transfer Wallet",children:[(0,we.jsxs)(bv,{children:[(0,we.jsx)(yv,{style:{marginRight:6}}),nn(u)]}),(0,we.jsx)("p",{children:"You can bring your account with you to another site using an external wallet."})]}),(0,we.jsxs)(vv,{children:[(0,we.jsxs)(ch,{children:[(0,we.jsx)(dh,{children:"1"}),(0,we.jsxs)("span",{children:[(0,we.jsx)("a",{href:"https://privy-io.notion.site/Transferring-your-account-9dab9e16c6034a7ab1ff7fa479b02828",target:"blank",rel:"noopener noreferrer",children:"Follow the guide"})," ","to transfer your account to your wallet of choice."]})]}),(0,we.jsxs)(ch,{children:[(0,we.jsx)(dh,{children:"2"}),(0,we.jsx)("span",{children:"Copy this key into your other wallet"})]})]}),(0,we.jsx)("div",{style:{width:"100%"},children:e&&(0,we.jsx)(hv,{origin:g,appId:w,accessToken:e,clientAnalyticsId:l,address:u,dimensions:{height:"44px"}})}),(0,we.jsxs)(Ev,{children:[(0,we.jsxs)("div",{children:[(0,we.jsx)(ph.default,{viewBox:"0 0 20 18"}),(0,we.jsx)("h4",{children:"Warning"})]}),(0,we.jsx)("p",{children:"Never share your private key with anyone! It controls your account."})]})]}),(0,we.jsx)(V,{protectedByPrivy:!0})]})};function hv(e){let[t,r]=(0,Go.useState)(e.dimensions.width),[o,n]=(0,Go.useState)(void 0),i=(0,Go.useRef)(null);return(0,Go.useEffect)(()=>{if(i.current&&t===void 0){let{width:l}=i.current.getBoundingClientRect();r(l)}let a=getComputedStyle(document.documentElement);n({background2:a.getPropertyValue("--privy-color-background-2"),foreground3:a.getPropertyValue("--privy-color-foreground-3"),foregroundAccent:a.getPropertyValue("--privy-color-foreground-accent"),accent:a.getPropertyValue("--privy-color-accent"),accentDark:a.getPropertyValue("--privy-color-accent-dark"),success:a.getPropertyValue("--privy-color-success")})},[]),(0,we.jsx)("div",{ref:i,children:t&&(0,we.jsxs)(Cv,{children:[(0,we.jsx)("iframe",{style:{position:"absolute",zIndex:1},width:t,height:e.dimensions.height,allow:"clipboard-write self *",src:xs(e.origin,`/apps/${e.appId}/embedded-wallets/export`,{token:e.accessToken,address:e.address,width:`${t}px`,caid:e.clientAnalyticsId,...o})}),(0,we.jsx)(wv,{children:"Loading..."})]})})}function yv(e){return(0,we.jsx)("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e.style,children:(0,we.jsx)("path",{d:"M14 8.81335C14 7.98493 13.3284 7.31335 12.5 7.31335H10C10 8.41792 9.10457 9.31335 8 9.31335C6.89543 9.31335 6 8.41792 6 7.31335H3.5C2.67157 7.31335 2 7.98493 2 8.81335M14 8.81335V12.8134C14 13.6418 13.3284 14.3134 12.5 14.3134H3.5C2.67157 14.3134 2 13.6418 2 12.8134V8.81335M14 8.81335V6.81335M2 8.81335V6.81335M14 6.81335C14 5.98493 13.3284 5.31335 12.5 5.31335H3.5C2.67157 5.31335 2 5.98493 2 6.81335M14 6.81335V4.81335C14 3.98493 13.3284 3.31335 12.5 3.31335H3.5C2.67157 3.31335 2 3.98493 2 4.81335V6.81335",stroke:"var(--privy-color-foreground-3)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var gv=Vo.default.div`
|
|
976
976
|
display: flex;
|
|
977
977
|
flex-direction: column;
|
|
978
978
|
text-align: left;
|
|
@@ -1057,7 +1057,7 @@ Resources:
|
|
|
1057
1057
|
color: var(--privy-color-error);
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
|
-
`;var fh=m(require("@heroicons/react/24/solid/XCircleIcon")),
|
|
1060
|
+
`;var fh=m(require("@heroicons/react/24/solid/XCircleIcon")),Na=require("react"),hh=m(require("styled-components"));var Jl=require("react");function Ql(){let{refreshUser:e,createAnalyticsEvent:t,initializeWalletProxy:r}=W(),o=(0,Jl.useRef)(!1);return{createWallet:(0,Jl.useCallback)(async i=>{let a=await Oe();if(!a)throw t({eventName:"embedded_wallet_creation_failed",payload:{error:"Missing access token for user."}}),new Error("An error has occured, please login again.");try{t({eventName:"embedded_wallet_creation_started"});let l=await r(mi);if(!l)throw new Error("walletProxy does not exist.");let s=1e4,c=new Promise((g,w)=>{setTimeout(()=>{w(new Error("walletProxy.create timed out."))},s)});if(!await Promise.race([l.create({accessToken:a,recoveryPassword:i}),c]))throw new Error("walletProxy.create did not send a response.");let f=await e();if(!f)throw new Error("Failed to refresh user.");let y=Ve(f);if(!y)throw new Error("Updated user is missing embedded wallet.");return t({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:y.address}}),o.current=!0,y}catch(l){if(o.current)return;throw t({eventName:"embedded_wallet_creation_failed",payload:{error:l.toString()}}),console.warn(l),l}},[])}}var zr=require("react/jsx-runtime"),yh=()=>{let{app:e,setModalData:t,navigate:r,data:o,onUserCloseViaDialogOrKeybindRef:n}=_(),[i,a]=(0,Na.useState)(""),{embeddedWallets:l}=Nr(),{authenticated:s}=H(),{closePrivyModal:c}=W(),{onSuccess:u,onFailure:f,callAuthOnSuccessOnClose:y}=o.createWallet,g=e?.embeddedWallets.requireUserOwnedRecoveryOnCreate===!0,{createWallet:w}=Ql(),[v,k]=(0,Na.useState)(null),P=new et(async()=>{try{let A=await w();if(!A)return;k(A),r("EMBEDDED_WALLET_CREATED_SCREEN")}catch(A){a(A.message)}});(0,Na.useEffect)(()=>{if(!s){r("LANDING"),f(new Error("User must be authenticated before creating a Privy wallet"));return}if(g){t({...o,recoverySelection:{...o?.recoverySelection,isInAccountCreateFlow:!0}});let A=Xf("create",l.userOwnedRecoveryOptions);return r(A)}P.execute()},[g,s]);let b=()=>{v?(u(v),c({shouldCallAuthOnSuccess:y})):(f(new Yt("User wallet creation failed")),c({shouldCallAuthOnSuccess:!1}))};return n.current=()=>null,i?(0,zr.jsxs)(zr.Fragment,{children:[(0,zr.jsx)(S,{closeable:!1}),(0,zr.jsxs)(ro,{children:[(0,zr.jsx)(fh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,zr.jsx)(De,{title:"Something went wrong",description:i})]}),(0,zr.jsx)(O,{onClick:b,children:"Close"}),(0,zr.jsx)(Pv,{})]}):(0,zr.jsx)(Ui,{})},Pv=hh.default.div`
|
|
1061
1061
|
height: 44px;
|
|
1062
1062
|
`;var jn=require("react");var Yi=require("react");var Th=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),$i=require("react");var gh=m(require("@heroicons/react/24/outline/ArrowPathIcon")),vh=m(require("@heroicons/react/24/outline/EyeIcon")),Ch=m(require("@heroicons/react/24/outline/EyeSlashIcon")),lt=m(require("styled-components"));var Tv=lt.css`
|
|
1063
1063
|
font-size: 14px;
|
|
@@ -1067,7 +1067,7 @@ Resources:
|
|
|
1067
1067
|
letter-spacing: -0.008px;
|
|
1068
1068
|
text-align: left;
|
|
1069
1069
|
transition: color 0.1s ease-in;
|
|
1070
|
-
`,
|
|
1070
|
+
`,Xl=lt.default.span`
|
|
1071
1071
|
${Tv}
|
|
1072
1072
|
transition: color 0.1s ease-in;
|
|
1073
1073
|
color: ${({error:e})=>e?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
@@ -1144,12 +1144,12 @@ Resources:
|
|
|
1144
1144
|
font-weight: 400;
|
|
1145
1145
|
line-height: 20px;
|
|
1146
1146
|
}
|
|
1147
|
-
`,
|
|
1147
|
+
`,Da=lt.default.div`
|
|
1148
1148
|
display: flex;
|
|
1149
1149
|
flex-direction: column;
|
|
1150
1150
|
gap: 10px;
|
|
1151
1151
|
padding-bottom: 1rem;
|
|
1152
|
-
`,
|
|
1152
|
+
`,Ua=lt.default.div`
|
|
1153
1153
|
display: flex;
|
|
1154
1154
|
text-align: left;
|
|
1155
1155
|
align-items: center;
|
|
@@ -1169,13 +1169,13 @@ Resources:
|
|
|
1169
1169
|
> :first-child {
|
|
1170
1170
|
min-width: 24px;
|
|
1171
1171
|
}
|
|
1172
|
-
`,
|
|
1172
|
+
`,uS=lt.default.div`
|
|
1173
1173
|
height: var(--privy-height-modal-full);
|
|
1174
1174
|
|
|
1175
1175
|
@media (max-width: 440px) {
|
|
1176
1176
|
height: var(--privy-height-modal-compact);
|
|
1177
1177
|
}
|
|
1178
|
-
`,Od=(0,lt.default)(
|
|
1178
|
+
`,Od=(0,lt.default)(Ml)`
|
|
1179
1179
|
display: flex;
|
|
1180
1180
|
flex: 1;
|
|
1181
1181
|
gap: 4px;
|
|
@@ -1238,7 +1238,7 @@ Resources:
|
|
|
1238
1238
|
transition: all 0.1s ease-out;
|
|
1239
1239
|
background: ${({label:e})=>e==="Strong"&&"#78dca6"||e==="Medium"&&"var(--privy-color-warn)"||"var(--privy-color-error)"};
|
|
1240
1240
|
}
|
|
1241
|
-
`;var ct=require("react/jsx-runtime"),Sh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,$i.useState)(!0),[l,s]=(0,$i.useState)(!1),[c,u]=(0,$i.useState)(""),f=r===c;return(0,$i.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsx)(S,{title:"Confirm Password",closeable:!1,backFn:n}),(0,ct.jsx)(ce,{}),(0,ct.jsxs)(hn,{children:[(0,ct.jsxs)(vn,{children:[(0,ct.jsx)(Th.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ct.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,ct.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,ct.jsxs)(gn,{children:[(0,ct.jsx)(Gi,{value:c,onChange:y=>u(y.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),(0,ct.jsx)(Vi,{style:{right:"0.75rem"},children:i?(0,ct.jsx)(zi,{onClick:()=>a(!1)}):(0,ct.jsx)(qi,{onClick:()=>a(!0)})})]}),(0,ct.jsx)(
|
|
1241
|
+
`;var ct=require("react/jsx-runtime"),Sh=({buttonHideAnimations:e,buttonLoading:t,password:r,onSubmit:o,onBack:n})=>{let[i,a]=(0,$i.useState)(!0),[l,s]=(0,$i.useState)(!1),[c,u]=(0,$i.useState)(""),f=r===c;return(0,$i.useEffect)(()=>{c&&!l&&s(!0)},[c]),(0,ct.jsxs)(ct.Fragment,{children:[(0,ct.jsx)(S,{title:"Confirm Password",closeable:!1,backFn:n}),(0,ct.jsx)(ce,{}),(0,ct.jsxs)(hn,{children:[(0,ct.jsxs)(vn,{children:[(0,ct.jsx)(Th.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,ct.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm your password"}),(0,ct.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please re-enter your password below to continue."})]}),(0,ct.jsxs)(gn,{children:[(0,ct.jsx)(Gi,{value:c,onChange:y=>u(y.target.value),onBlur:()=>s(!0),placeholder:"confirm your password",type:i?"password":"text",style:{paddingRight:"2.3rem"}}),(0,ct.jsx)(Vi,{style:{right:"0.75rem"},children:i?(0,ct.jsx)(zi,{onClick:()=>a(!1)}):(0,ct.jsx)(qi,{onClick:()=>a(!0)})})]}),(0,ct.jsx)(Xl,{"aria-hidden":!l||f,error:!0,children:"Passwords do not match"})]}),(0,ct.jsx)(yn,{onClick:o,loading:t,disabled:!f,hideAnimations:e,children:"Continue"}),(0,ct.jsx)(ye,{}),(0,ct.jsx)(V,{protectedByPrivy:!0})]})};var Ah=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Rh=require("react"),Ih=m(require("styled-components"));var Ki=m(require("styled-components")),Cn=require("react/jsx-runtime"),xh=({className:e,checked:t,color:r="var(--privy-color-accent)",...o})=>(0,Cn.jsx)("label",{children:(0,Cn.jsxs)(Sv,{className:e,children:[(0,Cn.jsx)(kh,{checked:t,...o}),(0,Cn.jsx)(xv,{color:r,checked:t,children:(0,Cn.jsx)(_h,{viewBox:"0 0 24 24",children:(0,Cn.jsx)("polyline",{points:"20 6 9 17 4 12"})})})]})});var wS=Ki.default.label`
|
|
1242
1242
|
&& {
|
|
1243
1243
|
cursor: pointer;
|
|
1244
1244
|
display: flex;
|
|
@@ -1290,21 +1290,21 @@ Resources:
|
|
|
1290
1290
|
${_h} {
|
|
1291
1291
|
visibility: ${e=>e.checked?"visible":"hidden"};
|
|
1292
1292
|
}
|
|
1293
|
-
`;var nt=require("react/jsx-runtime"),Mh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=(0,Rh.useState)(!1);return(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)(S,{title:"Confirm Password",closeable:!1,backFn:o}),(0,nt.jsx)(ce,{}),(0,nt.jsxs)(hn,{children:[(0,nt.jsxs)(vn,{children:[(0,nt.jsx)(Ah.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,nt.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,nt.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,nt.jsx)(
|
|
1293
|
+
`;var nt=require("react/jsx-runtime"),Mh=({buttonHideAnimations:e,buttonLoading:t,onSubmit:r,onBack:o,config:n})=>{let[i,a]=(0,Rh.useState)(!1);return(0,nt.jsxs)(nt.Fragment,{children:[(0,nt.jsx)(S,{title:"Confirm Password",closeable:!1,backFn:o}),(0,nt.jsx)(ce,{}),(0,nt.jsxs)(hn,{children:[(0,nt.jsxs)(vn,{children:[(0,nt.jsx)(Ah.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-error)"}),(0,nt.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Confirm you have saved"}),(0,nt.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Losing access to your password means you will lose access to your account."})]}),(0,nt.jsx)(Da,{children:(0,nt.jsxs)(Ua,{style:{color:"var(--privy-color-error)",cursor:"pointer"},onClick:l=>{l.preventDefault(),a(s=>!s)},children:[(0,nt.jsx)(xh,{color:"var(--privy-color-error)",checked:i}),(0,nt.jsx)(nt.Fragment,{children:"I understand that if I lose my password and device, I will lose access to my account and my assets."})]})})]}),(0,nt.jsxs)(_v,{children:[n.initiatedBy==="user"&&(0,nt.jsx)(eo,{onClick:n.onCancel,disabled:t,children:"Cancel"}),(0,nt.jsx)(yn,{onClick:r,loading:t,hideAnimations:e,disabled:!i,children:"Set Password"})]}),(0,nt.jsx)(ye,{}),(0,nt.jsx)(V,{protectedByPrivy:!0})]})},_v=Ih.default.div`
|
|
1294
1294
|
display: flex;
|
|
1295
1295
|
gap: 10px;
|
|
1296
|
-
`;var Hh=m(require("@heroicons/react/24/outline/KeyIcon")),Nd=m(require("@heroicons/react/24/solid/CheckCircleIcon")),zo=require("react"),Dd=m(require("styled-components"));var Wh=m(require("fast-password-entropy")),Lh=m(require("secure-password-utilities")),Oh=require("secure-password-utilities/wordlists"),kv=95,Av=8,Rv=3,Iv=.3,Mv=/[a-z]/,Wv=/[A-Z]/,Lv=/[0-9]/,Ov="a-zA-Z0-9",Nh="!@#$%^&*()\\-_+.",Dh=`${Ov}${Nh}`,Nv=new RegExp(`[${Nh}]`),Dv=new RegExp(`[${Dh}]`),Uh=new RegExp(`^[${Dh}]{6,}$`),Fh=(e="")=>{let t=e.split("").filter(r=>!Dv.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},
|
|
1296
|
+
`;var Hh=m(require("@heroicons/react/24/outline/KeyIcon")),Nd=m(require("@heroicons/react/24/solid/CheckCircleIcon")),zo=require("react"),Dd=m(require("styled-components"));var Wh=m(require("fast-password-entropy")),Lh=m(require("secure-password-utilities")),Oh=require("secure-password-utilities/wordlists"),kv=95,Av=8,Rv=3,Iv=.3,Mv=/[a-z]/,Wv=/[A-Z]/,Lv=/[0-9]/,Ov="a-zA-Z0-9",Nh="!@#$%^&*()\\-_+.",Dh=`${Ov}${Nh}`,Nv=new RegExp(`[${Nh}]`),Dv=new RegExp(`[${Dh}]`),Uh=new RegExp(`^[${Dh}]{6,}$`),Fh=(e="")=>{let t=e.split("").filter(r=>!Dv.test(r)).map(r=>r.replace(" ","SPACE"));return[...new Set(t)]},ec=()=>Lh.generatePassphrase(4,Oh.DEFAULT_WORDLIST);function Uv(e){return e>.9?"Strong":e>.5?"Medium":"Weak"}function Fv(e){if(e.length<Av)return 0;let t=0;Mv.test(e)&&(t+=1),Wv.test(e)&&(t+=1),Lv.test(e)&&(t+=1),Nv.test(e)&&(t+=1);let r=t/Rv;return Math.max(0,Math.min(1,r))}function Bv(e=""){let t=Fv(e),r=(0,Wh.default)(e)/kv;return(t*Iv+r)/2}function Bh(e=""){let t=Bv(e);return{value:t,label:Uv(t)}}var Se=require("react/jsx-runtime"),Gh=({buttonHideAnimations:e,buttonLoading:t,password:r="",config:o,onSubmit:n,onClose:i,onBack:a,onPasswordChange:l,onPasswordGenerate:s})=>{let[c,u]=(0,zo.useState)(!1),[f,y]=(0,zo.useState)(!1);(0,zo.useEffect)(()=>{r&&!f&&y(!0)},[r]);let g=(0,zo.useMemo)(()=>f?(r?.length||0)<6?"Password must be at least 6 characters":Uh.test(r||"")?null:`Invalid characters used ( ${Fh(r).join(" ")} )`:null,[r,f]),w=(0,zo.useMemo)(()=>g?{value:0,label:"Weak"}:Bh(r),[r,g]),v=(0,zo.useMemo)(()=>!!(!r?.length||g),[g,r]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(S,{onClose:i,title:"Secure your account",closeable:o.initiatedBy==="user",backFn:a}),(0,Se.jsx)(ce,{}),(0,Se.jsxs)(hn,{children:[(0,Se.jsxs)(vn,{children:[(0,Se.jsx)(Hh.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,Se.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Set your password"}),(0,Se.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Select a strong, memorable password to secure your account."})]}),(0,Se.jsxs)(gn,{children:[(0,Se.jsx)(Gi,{value:r,onChange:k=>l(k.target.value),placeholder:"enter or generate a strong password",type:c?"password":"text",style:{paddingRight:"3.8rem"}}),(0,Se.jsxs)(Vi,{style:{width:"3.5rem"},children:[c?(0,Se.jsx)(zi,{onClick:()=>u(!1)}):(0,Se.jsx)(qi,{onClick:()=>u(!0)}),(0,Se.jsx)(Eh,{onClick:s})]})]}),(0,Se.jsx)(Ph,{value:w.value===0?.01:w.value,label:w.label}),(0,Se.jsx)(Xl,{error:!!g,children:g||`Password Strength: ${f?w.label:"--"}`}),(0,Se.jsxs)(Gv,{children:[(0,Se.jsx)(Hv,{children:(0,Se.jsxs)(Da,{children:[(0,Se.jsxs)(Ua,{children:[(0,Se.jsx)(Nd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"This password is used to secure your account."]}),(0,Se.jsxs)(Ua,{children:[(0,Se.jsx)(Nd.default,{width:24,height:24,fill:"var(--privy-color-accent)"}),"Use it to log in on a new environment, like another browser or device."]})]})}),(0,Se.jsx)(yn,{onClick:n,loading:t,disabled:v,hideAnimations:e,children:"Continue"})]})]}),(0,Se.jsx)(ye,{}),(0,Se.jsx)(V,{protectedByPrivy:!0})]})},Hv=(0,Dd.default)(Da)`
|
|
1297
1297
|
flex: 1;
|
|
1298
1298
|
padding-top: 1rem;
|
|
1299
1299
|
`,Gv=Dd.default.div`
|
|
1300
1300
|
display: flex;
|
|
1301
1301
|
flex-direction: column;
|
|
1302
1302
|
height: 100%;
|
|
1303
|
-
`;var Vh=m(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),zh=m(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),qh=m(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),$h=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),
|
|
1303
|
+
`;var Vh=m(require("@heroicons/react/24/outline/ArrowDownTrayIcon")),zh=m(require("@heroicons/react/24/outline/ClipboardDocumentCheckIcon")),qh=m(require("@heroicons/react/24/outline/DocumentDuplicateIcon")),$h=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),Fa=require("react");var Fe=require("react/jsx-runtime"),Kh=({buttonHideAnimations:e,buttonLoading:t,appName:r,password:o,onSubmit:n,onBack:i})=>{let[a,l]=(0,Fa.useState)(!1),s=(0,Fa.useCallback)(()=>{l(!0),o&&navigator.clipboard.writeText(o)},[o]),c=(0,Fa.useCallback)(()=>{let u=document.createElement("a"),f=r.toLowerCase().replace(/[^a-z\s]/g,"").replace(/\s/g,"-"),y=new Blob([Vv(r,o)],{type:"text/plain"}),g=URL.createObjectURL(y);u.href=g,u.target="_blank",u.download=`${f}-privy-wallet-recovery.txt`,document.body.appendChild(u),u.click(),setTimeout(()=>{u.remove(),URL.revokeObjectURL(g)},5e3)},[o]);return(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(S,{backFn:i,title:"Save Password",closeable:!1}),(0,Fe.jsx)(ce,{}),(0,Fe.jsxs)(hn,{children:[(0,Fe.jsxs)(vn,{children:[(0,Fe.jsx)($h.default,{height:48,width:48,stroke:"var(--privy-color-background)",fill:"var(--privy-color-accent)"}),(0,Fe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Save your password"}),(0,Fe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"For your security, this password cannot be reset, so keep it somewhere safe."})]}),(0,Fe.jsx)(gn,{centered:!0,children:(0,Fe.jsx)(bh,{children:o})}),(0,Fe.jsxs)("div",{style:{display:"flex",margin:"12px 0",gap:"12px"},children:[(0,Fe.jsx)(Od,{onClick:s,children:a?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(zh.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copied"]}):(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsx)(qh.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Copy"]})}),(0,Fe.jsxs)(Od,{onClick:c,children:[(0,Fe.jsx)(Vh.default,{style:{width:24,height:24},stroke:"var(--privy-color-accent)"}),"Download"]})]})]}),(0,Fe.jsx)(yn,{onClick:n,loading:t,hideAnimations:e,children:"Continue"}),(0,Fe.jsx)(ye,{}),(0,Fe.jsx)(V,{protectedByPrivy:!0})]})},Vv=(e,t)=>`Your wallet recovery password for ${e} is
|
|
1304
1304
|
|
|
1305
1305
|
${t}
|
|
1306
1306
|
|
|
1307
|
-
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var jh=m(require("@heroicons/react/24/solid/CheckCircleIcon")),Yh=m(require("@heroicons/react/24/solid/XCircleIcon"));var qt=require("react/jsx-runtime"),Zh=({error:e,onClose:t})=>(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)(S,{closeable:!1}),(0,qt.jsx)(ce,{}),e?(0,qt.jsxs)(ro,{children:[(0,qt.jsx)(Yh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,qt.jsx)(De,{title:"Something went wrong",description:e})]}):(0,qt.jsxs)(ro,{children:[(0,qt.jsx)(jh.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,qt.jsx)(De,{title:"Success"})]}),(0,qt.jsx)(O,{onClick:t,children:"Close"}),(0,qt.jsx)(ye,{}),(0,qt.jsx)(V,{protectedByPrivy:!0})]});var Jh=require("react"),zv=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Qh=()=>{let[e,t]=(0,Jh.useReducer)(zv,"creating");return{send:t,state:e}};var ji=require("react/jsx-runtime"),
|
|
1307
|
+
You will need this password to access your ${e} wallet on a new device. Please keep it somewhere safe.`;var jh=m(require("@heroicons/react/24/solid/CheckCircleIcon")),Yh=m(require("@heroicons/react/24/solid/XCircleIcon"));var qt=require("react/jsx-runtime"),Zh=({error:e,onClose:t})=>(0,qt.jsxs)(qt.Fragment,{children:[(0,qt.jsx)(S,{closeable:!1}),(0,qt.jsx)(ce,{}),e?(0,qt.jsxs)(ro,{children:[(0,qt.jsx)(Yh.default,{fill:"var(--privy-color-error)",width:"64px",height:"64px"}),(0,qt.jsx)(De,{title:"Something went wrong",description:e})]}):(0,qt.jsxs)(ro,{children:[(0,qt.jsx)(jh.default,{fill:"var(--privy-color-success)",width:"64px",height:"64px"}),(0,qt.jsx)(De,{title:"Success"})]}),(0,qt.jsx)(O,{onClick:t,children:"Close"}),(0,qt.jsx)(ye,{}),(0,qt.jsx)(V,{protectedByPrivy:!0})]});var Jh=require("react"),zv=(e,t)=>{switch(e){case"creating":return t==="back"?e:"saving";case"saving":return t==="back"?"creating":"confirming";case"confirming":return t==="back"?"saving":"finalizing";case"finalizing":return t==="back"?"confirming":"done";default:return e}},Qh=()=>{let[e,t]=(0,Jh.useReducer)(zv,"creating");return{send:t,state:e}};var ji=require("react/jsx-runtime"),tc=({onSubmit:e,...t})=>{let{lastScreen:r,navigate:o}=_(),{send:n,state:i}=Qh(),a=(0,Yi.useCallback)(async()=>{i==="finalizing"&&await e(),n("next")},[i,n,e]);(0,Yi.useEffect)(()=>{let c;return i==="done"&&t.config.initiatedBy==="automatic"&&(c=setTimeout(()=>t.onClose?.(),st)),()=>{c&&clearTimeout(c)}},[i,t.config.initiatedBy,t.onClose]);let l=(0,Yi.useCallback)(()=>{n("back")},[n]),s=(0,Yi.useCallback)(()=>{o("EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN")},[r,o]);return i==="creating"?(0,ji.jsx)(Gh,{...t,onSubmit:a,onBack:r==="EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"?s:void 0}):i==="saving"?(0,ji.jsx)(Kh,{...t,onSubmit:a,onBack:l}):i==="confirming"?(0,ji.jsx)(Sh,{...t,onSubmit:a,onBack:l}):i==="finalizing"?(0,ji.jsx)(Mh,{...t,onSubmit:a,onBack:l}):i==="done"?(0,ji.jsx)(Zh,{...t,onSubmit:a}):null};var ey=require("react/jsx-runtime"),Xh=()=>{let[e,t]=(0,jn.useState)(null),[r,o]=(0,jn.useState)(!1),[n,i]=(0,jn.useState)(null),[a,l]=(0,jn.useState)(""),{authenticated:s,getAccessToken:c,user:u}=H(),{walletProxy:f,refreshUser:y,closePrivyModal:g,createAnalyticsEvent:w}=W(),{app:v,navigate:k,data:P,onUserCloseViaDialogOrKeybindRef:b}=_(),{onSuccess:A,onFailure:R}=P.createWallet,N=Ve(u),L=e?.recoveryMethod==="user-passcode";(0,jn.useEffect)(()=>{s||(k("LANDING"),R(new gs("User must be authenticated before setting a password on a Privy wallet")))},[s]);let I=()=>{if(n){R(n),g({shouldCallAuthOnSuccess:!1});return}if(!L){R(new Yt("Exited before password was added to wallet")),g({shouldCallAuthOnSuccess:!1});return}A(e),g({shouldCallAuthOnSuccess:!1})};b.current=I;let q=async()=>{let j=await c();if(j&&N?.address&&a&&f)try{if(w({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:N.address}}),!(await f.setRecoveryPassword({accessToken:j,address:N.address,recoveryPassword:a})).address){i(new Yt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:"error setting password"}});return}let ne=await y(),B=Ve(ne);if(!B){i(new Yt("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:"wallet disconnected"}});return}t(B),w({eventName:"embedded_wallet_set_password_completed",payload:{walletAddress:N.address}})}catch(M){console.warn(M),i(M instanceof Error?M:new Error("Error setting password on privy wallet")),w({eventName:"embedded_wallet_set_password_failed",payload:{walletAddress:N.address,reason:M}})}},J=async()=>{L?(A(e),g({shouldCallAuthOnSuccess:!1})):(o(!0),i(null),await q(),o(!1))};return(0,ey.jsx)(tc,{appName:v?.name||"privy",config:{initiatedBy:"user",onCancel:I},error:n?"An error has occurred, please try again.":void 0,buttonLoading:r,buttonHideAnimations:!1,password:a,onPasswordGenerate:()=>l(ec()),onPasswordChange:l,onSubmit:J,onClose:I})};var ty=m(require("@heroicons/react/24/outline/UserCircleIcon")),ry=m(require("@heroicons/react/24/solid/LockClosedIcon"));var Lt=require("react/jsx-runtime"),oy=()=>{let{user:e}=H(),{closePrivyModal:t,createAnalyticsEvent:r}=W(),{data:o,setModalData:n,navigate:i,onUserCloseViaDialogOrKeybindRef:a}=_(),{onSuccess:l,onFailure:s}=o.setWalletPassword,c=()=>{s(new Yt("Exited before password was added to wallet")),t({shouldCallAuthOnSuccess:!1})};return a.current=c,(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)(S,{onClose:c}),(0,Lt.jsx)(ce,{}),(0,Lt.jsxs)(ro,{children:[(0,Lt.jsxs)(mf,{children:[(0,Lt.jsx)(ty.default,{stroke:"var(--privy-color-accent)",width:"64px",height:"64px"}),(0,Lt.jsx)(ff,{style:{width:24,height:24,position:"absolute",bottom:0,right:0},children:(0,Lt.jsx)(ry.default,{width:"12px",height:"12px",fill:"white"})})]}),(0,Lt.jsxs)(De,{title:"Secure Your Account",children:["Please set a password to secure your account.",(0,Lt.jsx)("p",{children:"Losing access to this password and this device will make your account inaccessible."})]})]}),(0,Lt.jsx)(O,{onClick:()=>{let f=Ve(e);r({eventName:"embedded_wallet_set_password_started",payload:{walletAddress:f?.address}}),n({createWallet:{onFailure:s,onSuccess:l,callAuthOnSuccessOnClose:!1,addPasswordToExistingWallet:!0}}),i("EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:"Add password"}),(0,Lt.jsx)(ye,{}),(0,Lt.jsx)(V,{protectedByPrivy:!0})]})};var ny=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),iy=m(require("@heroicons/react/24/outline/PhoneIcon")),Ud=m(require("styled-components"));var ft=require("react/jsx-runtime"),qv=e=>{let t=(0,ft.jsx)(ny.default,{height:38,width:38,stroke:"var(--privy-color-error)"});if(e instanceof T)switch(e.privyErrorCode){case"client_request_timeout":return{title:"Timed out",detail:e.message,ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else{if(e instanceof ot&&e.type==="twilio_verification_failed")return{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:(0,ft.jsx)(iy.default,{height:38,width:38,stroke:"var(--privy-color-error)"})};if(e instanceof at)switch(e.privyErrorCode){case"invalid_captcha":return{title:"Something went wrong",detail:"Please try again.",ctaText:"Try again",icon:t};case"disallowed_login_method":return{title:"Not allowed",detail:e.message,ctaText:"Try another method",icon:t};case"allowlist_rejected":return{title:"You don't have access to this app",detail:"Have you been invited?",ctaText:"Try another account",icon:(0,ft.jsx)(zl,{style:{width:"38px",height:"38px",strokeWidth:"1",stroke:"var(--privy-color-accent)",fill:"var(--privy-color-accent)"}})};case"captcha_failure":return{title:"Something went wrong",detail:"You did not pass CAPTCHA. Please try again.",ctaText:"Try again",icon:(0,ft.jsx)("span",{})};case"captcha_timeout":return{title:"Something went wrong",detail:"Something went wrong! Please try again later.",ctaText:"Try again",icon:(0,ft.jsx)("span",{})};case"linked_to_another_user":return{title:"Authentication failed",detail:"This account has already been linked to another user.",ctaText:"Try again",icon:t};default:return{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}else return e instanceof Yr&&e.status===422?{title:"Something went wrong",detail:e.message,ctaText:"Try again",icon:t}:{title:"Something went wrong",detail:"Try again later",ctaText:"Try again",icon:t}}},ay=()=>{let{navigate:e,navigateBack:t,data:r,lastScreen:o,currentScreen:n}=_();return(0,ft.jsx)(Ba,{error:r?.errorModalData?.error||new Error,backFn:!o||n===o?void 0:t,onClick:()=>e(o||"LANDING",!1)})},Ba=({error:e,backFn:t,onClick:r})=>{let{reset:o}=Me(),n=qv(e),i=()=>{e instanceof at&&e.privyErrorCode==="invalid_captcha"&&o(),r?.()};return(0,ft.jsxs)(ft.Fragment,{children:[(0,ft.jsx)(S,{backFn:t}),(0,ft.jsxs)($v,{children:[(0,ft.jsx)(Vt,{children:(0,ft.jsxs)("div",{children:[(0,ft.jsx)(Vl,{color:"var(--privy-color-error)"}),n.icon]})}),(0,ft.jsxs)(Kv,{children:[(0,ft.jsx)("h3",{children:n.title}),(0,ft.jsx)("p",{children:n.detail})]}),(0,ft.jsx)(O,{color:"var(--privy-color-error)",onClick:i,children:n.ctaText})]})]})},$v=Ud.default.div`
|
|
1308
1308
|
display: flex;
|
|
1309
1309
|
flex-direction: column;
|
|
1310
1310
|
align-items: center;
|
|
@@ -1316,7 +1316,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1316
1316
|
display: flex;
|
|
1317
1317
|
flex-direction: column;
|
|
1318
1318
|
gap: 8px;
|
|
1319
|
-
`;var qo=require("react"),
|
|
1319
|
+
`;var qo=require("react"),Ga=require("react-device-detect"),Gd=m(require("styled-components"));var ly=require("react"),cy=m(require("styled-components"));var Fd=require("react/jsx-runtime"),rc=({style:e,color:t,...r})=>(0,Fd.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:t||"currentColor",style:{height:"1.5rem",width:"1.5rem",...e},...r,children:(0,Fd.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})});var oc=require("react/jsx-runtime"),sy=({color:e,...t})=>(0,oc.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,oc.jsx)("g",{children:(0,oc.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 Ha=require("react/jsx-runtime"),wn=e=>{let[t,r]=(0,ly.useState)(!1);return(0,Ha.jsxs)(jv,{color:e.color,onClick:()=>{r(!0),navigator.clipboard.writeText(e.text),setTimeout(()=>r(!1),1500)},justCopied:t,children:[t?(0,Ha.jsx)(rc,{style:{height:"14px",width:"14px"},strokeWidth:"2"}):(0,Ha.jsx)(sy,{style:{height:"14px",width:"14px"}}),t?"Copied":"Copy"," ",e.itemName?e.itemName:"to Clipboard"]})},jv=cy.default.button`
|
|
1320
1320
|
display: flex;
|
|
1321
1321
|
align-items: center;
|
|
1322
1322
|
gap: 6px;
|
|
@@ -1354,7 +1354,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1354
1354
|
width: 14px;
|
|
1355
1355
|
height: 14px;
|
|
1356
1356
|
}
|
|
1357
|
-
`;var dy=require("react"),py=m(require("styled-components")),uy=require("react/jsx-runtime"),
|
|
1357
|
+
`;var dy=require("react"),py=m(require("styled-components")),uy=require("react/jsx-runtime"),nc=e=>{let[t,r]=(0,dy.useState)(!1);return(0,uy.jsx)(Yv,{color:e.color,href:e.url,target:"_blank",rel:"noreferrer noopener",onClick:()=>{r(!0),setTimeout(()=>r(!1),1500)},justOpened:t,children:e.text})},Yv=py.default.a`
|
|
1358
1358
|
display: flex;
|
|
1359
1359
|
align-items: center;
|
|
1360
1360
|
gap: 6px;
|
|
@@ -1392,7 +1392,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1392
1392
|
width: 14px;
|
|
1393
1393
|
height: 14px;
|
|
1394
1394
|
}
|
|
1395
|
-
`;var hy=m(require("qrcode")),yy=m(require("react")),gy=m(require("styled-components"));var Bd=require("react/jsx-runtime"),my=()=>(0,Bd.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Bd.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var
|
|
1395
|
+
`;var hy=m(require("qrcode")),yy=m(require("react")),gy=m(require("styled-components"));var Bd=require("react/jsx-runtime"),my=()=>(0,Bd.jsx)("svg",{width:"200",height:"200",viewBox:"-77 -77 200 200",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px"},children:(0,Bd.jsx)("rect",{width:"50",height:"50",fill:"black",rx:10,ry:10})});var Ye=require("react/jsx-runtime"),br=7,Hd=(e,t,r,o,n)=>{for(let i=t;i<t+o;i++)for(let a=r;a<r+n;a++){let l=e?.[a];l&&l[i]&&(l[i]=0)}return e},Zv=e=>{let t=hy.default.create(e,{errorCorrectionLevel:"high"}).modules,r=bu(Array.from(t.data),t.size);return r=Hd(r,0,0,br,br),r=Hd(r,r.length-br,0,br,br),r=Hd(r,0,r.length-br,br,br),r},Jv=({x:e,y:t,cellSize:r,bgColor:o,fgColor:n})=>(0,Ye.jsx)(Ye.Fragment,{children:[0,1,2].map(i=>(0,Ye.jsx)("circle",{r:r*(br-i*2)/2,cx:e+r*br/2,cy:t+r*br/2,fill:i%2!==0?o:n},`finder-${e}-${t}-${i}`))}),Qv=({cellSize:e,matrixSize:t,bgColor:r,fgColor:o})=>{let n=[[0,0],[(t-br)*e,0],[0,(t-br)*e]];return(0,Ye.jsx)(Ye.Fragment,{children:n.map(([i,a])=>(0,Ye.jsx)(Jv,{x:i,y:a,cellSize:e,bgColor:r,fgColor:o},`finder-${i}-${a}`))})},Xv=({matrix:e,cellSize:t,color:r})=>(0,Ye.jsx)(Ye.Fragment,{children:e.map((o,n)=>o.map((i,a)=>i?(0,Ye.jsx)("circle",{r:t/2.5,cx:n*t+t/2,cy:a*t+t/2,fill:r},`circle-${n}-${a}`):(0,Ye.jsx)(yy.default.Fragment,{},`circle-${n}-${a}`)))}),fy=(e,t)=>e-e%t,eC=({outputSize:e,cellSize:t,element:r,size:o,padding:n,bgColor:i})=>{if(!r)return(0,Ye.jsx)(Ye.Fragment,{});let a=o||40,l=n||4,s=r,c=e/2-a/2-l;return(0,Ye.jsxs)(Ye.Fragment,{children:[(0,Ye.jsx)("rect",{x:fy(c,t),y:fy(c,t),width:a+l*2+(c%t?t+.5:.5),height:a+l*2+(c%t?t+.5:.5),fill:i}),(0,Ye.jsx)(s,{x:e/2-a/2,y:e/2-a/2,height:a,width:a})]})},tC=e=>{let t=e.outputSize,r=Zv(e.url),o=t/r.length;return(0,Ye.jsxs)("svg",{height:e.outputSize,width:e.outputSize,viewBox:`0 0 ${e.outputSize} ${e.outputSize}`,style:{height:"100%",width:"100%"},children:[(0,Ye.jsx)(Xv,{matrix:r,cellSize:o,color:e.fgColor}),(0,Ye.jsx)(Qv,{cellSize:o,matrixSize:r.length,fgColor:e.fgColor,bgColor:e.bgColor}),(0,Ye.jsx)(eC,{outputSize:e.outputSize,cellSize:o,element:e.logo?.element,bgColor:e.bgColor})]})},rC=gy.default.div`
|
|
1396
1396
|
display: flex;
|
|
1397
1397
|
justify-content: center;
|
|
1398
1398
|
align-items: center;
|
|
@@ -1407,7 +1407,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1407
1407
|
border-color: ${e=>e.fgColor};
|
|
1408
1408
|
border-radius: var(--privy-border-radius-md);
|
|
1409
1409
|
}
|
|
1410
|
-
`,Zi=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return(0,
|
|
1410
|
+
`,Zi=e=>{let t=e.bgColor||"#FFFFFF",r=e.fgColor||"#000000",o=e.size||160;return(0,Ye.jsx)(rC,{size:o,bgColor:t,fgColor:r,children:(0,Ye.jsx)(tC,{url:e.url,logo:{element:e.squareLogoElement??my},outputSize:o,bgColor:t,fgColor:r})})};var Yn=require("react/jsx-runtime"),Po=({style:e,...t})=>(0,Yn.jsxs)("svg",{width:"1000",height:"1000",viewBox:"0 0 1000 1000",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"24px",...e},...t,children:[(0,Yn.jsx)("rect",{width:"1000",height:"1000",rx:"200",fill:"#855DCD"}),(0,Yn.jsx)("path",{d:"M257.778 155.556H742.222V844.444H671.111V528.889H670.414C662.554 441.677 589.258 373.333 500 373.333C410.742 373.333 337.446 441.677 329.586 528.889H328.889V844.444H257.778V155.556Z",fill:"white"}),(0,Yn.jsx)("path",{d:"M128.889 253.333L157.778 351.111H182.222V746.667C169.949 746.667 160 756.616 160 768.889V795.556H155.556C143.283 795.556 133.333 805.505 133.333 817.778V844.444H382.222V817.778C382.222 805.505 372.273 795.556 360 795.556H355.556V768.889C355.556 756.616 345.606 746.667 333.333 746.667H306.667V253.333H128.889Z",fill:"white"}),(0,Yn.jsx)("path",{d:"M675.556 746.667C663.283 746.667 653.333 756.616 653.333 768.889V795.556H648.889C636.616 795.556 626.667 805.505 626.667 817.778V844.444H875.556V817.778C875.556 805.505 865.606 795.556 853.333 795.556H848.889V768.889C848.889 756.616 838.94 746.667 826.667 746.667V351.111H851.111L880 253.333H702.222V746.667H675.556Z",fill:"white"})]});var te=require("react/jsx-runtime"),vy="#8a63d2",wy=1e3,oC=wy*2,nC=wy*120,by=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{lastScreen:n,navigate:i,navigateBack:a,setModalData:l,app:s}=_(),{getAuthFlow:c,loginWithFarcaster:u,closePrivyModal:f,createAnalyticsEvent:y}=W(),[g,w]=(0,qo.useState)(void 0),[v,k]=(0,qo.useState)(!1),[P,b]=(0,qo.useState)(!1),A=(0,qo.useRef)([]),R=s?.render.inDialog?st:0,N=c(),L=N?.meta.connectUri;return(0,qo.useEffect)(()=>{let I=Date.now(),q=setInterval(async()=>{let J=await N.pollForReady.execute(),j=Date.now()-I;if(J){clearInterval(q),k(!0);try{await u(),b(!0)}catch(M){let ne={retryable:!1,message:"Authentication failed"};if(M?.privyErrorCode==="allowlist_rejected"){i("ALLOWLIST_REJECTION_SCREEN");return}else if(M?.privyErrorCode==="max_accounts_reached"){console.error(new mo(M).toString()),i("USER_LIMIT_REACHED_SCREEN");return}else M?.privyErrorCode==="linked_to_another_user"?ne.detail="This account has already been linked to another user.":M?.privyErrorCode==="invalid_credentials"?(ne.retryable=!0,ne.detail="Something went wrong. Try again."):M?.privyErrorCode==="too_many_requests"&&(ne.detail="Too many requests. Please wait before trying again.");w(ne)}}else j>nC&&(clearInterval(q),w({retryable:!0,message:"Authentication failed",detail:"The request timed out. Try again."}))},oC);return()=>{clearInterval(q),A.current.forEach(J=>clearTimeout(J))}},[]),(0,qo.useEffect)(()=>{if(r&&e&&P&&o){if(s?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let q=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(q)}P&&(Lr(o,s?.embeddedWallets.createOnLogin)?A.current.push(setTimeout(()=>{l({createWallet:{onSuccess:()=>{},onFailure:q=>{console.error(q),y({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,screen:"FarcasterConnectStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R)):A.current.push(setTimeout(()=>f({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R)))}},[P,r,e,o]),Ga.isMobile||v?(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(S,{backFn:n?a:void 0,onClose:f},"header"),(0,te.jsx)(ce,{}),Ga.isIOS?(0,te.jsx)(te.Fragment,{children:(0,te.jsxs)(iC,{children:[(0,te.jsx)(Vt,{children:(0,te.jsxs)("div",{children:[(0,te.jsx)(Ht,{success:P,fail:!!g}),(0,te.jsx)(Po,{style:{width:"38px",height:"38px"}})]})}),(0,te.jsxs)(St,{children:[(0,te.jsx)(he,{children:g?g.message:"Sign in with Farcaster"}),(0,te.jsx)(ge,{children:g?g.detail:"To sign in with Farcaster, please open the Warpcast app."})]}),L&&(0,te.jsx)(O,{onClick:I=>{I.preventDefault(),window.location.href=L},children:"Open Warpcast app"})]})}):(0,te.jsx)(te.Fragment,{children:(0,te.jsxs)(Cy,{children:[(0,te.jsx)(Vt,{children:(0,te.jsxs)("div",{children:[(0,te.jsx)(Ht,{success:P,fail:!!g}),(0,te.jsx)(Po,{style:{width:"38px",height:"38px"}})]})}),(0,te.jsxs)(St,{children:[(0,te.jsx)(he,{children:g?g.message:"Signing in with Farcaster"}),(0,te.jsx)(ge,{children:g?g.detail:"This should only take a moment"}),(0,te.jsx)(Jt,{children:L&&Ga.isMobile&&(0,te.jsx)(nc,{text:"Take me to Warpcast",url:L,color:vy})})]})]})}),(0,te.jsx)(z,{})]}):(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)(S,{backFn:n?a:void 0,onClose:f},"header"),(0,te.jsx)(ce,{}),(0,te.jsx)(Cy,{children:(0,te.jsxs)("div",{children:[(0,te.jsx)(he,{children:"Sign in with Farcaster"}),(0,te.jsx)(ge,{children:"Scan with your phone's camera to continue."}),(0,te.jsx)(Ii,{children:L?(0,te.jsx)(Zi,{url:L,size:275,squareLogoElement:Po}):(0,te.jsx)(Et,{})}),(0,te.jsxs)(Jt,{children:[(0,te.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),L&&(0,te.jsx)(wn,{text:L,itemName:"link",color:vy})]})]})}),(0,te.jsx)(z,{})]})},Cy=Gd.default.div`
|
|
1411
1411
|
display: flex;
|
|
1412
1412
|
flex-direction: column;
|
|
1413
1413
|
align-items: center;
|
|
@@ -1422,7 +1422,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1422
1422
|
justify-content: center;
|
|
1423
1423
|
gap: 24px;
|
|
1424
1424
|
width: 100%;
|
|
1425
|
-
`;var bn=require("react"),
|
|
1425
|
+
`;var bn=require("react"),Va=require("react-device-detect"),Vd=m(require("styled-components"));var re=require("react/jsx-runtime"),Ey="#8a63d2",Ty=1e3,aC=Ty*2,sC=Ty*300,Sy=()=>{let{lastScreen:e,navigateBack:t,data:r,app:o}=_(),{requestFarcasterSignerStatus:n,closePrivyModal:i}=W(),[a,l]=(0,bn.useState)(void 0),[s,c]=(0,bn.useState)(!1),[u,f]=(0,bn.useState)(!1),y=(0,bn.useRef)([]),g=o?.render.inDialog?st:0,w=r?.farcasterSigner;(0,bn.useEffect)(()=>{let k=Date.now(),P=setInterval(async()=>{if(!w?.public_key){clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"Something went wrong. Please try again."});return}w.status==="approved"&&(clearInterval(P),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g)));let b=await n(w?.public_key),A=Date.now()-k;b.status==="approved"?(clearInterval(P),c(!1),f(!0),y.current.push(setTimeout(()=>i({shouldCallAuthOnSuccess:!1,isSuccess:!0}),g))):A>sC?(clearInterval(P),l({retryable:!0,message:"Connect failed",detail:"The request timed out. Try again."})):b.status==="revoked"&&(clearInterval(P),l({retryable:!0,message:"Request rejected",detail:"The request was rejected. Please try again."}))},aC);return()=>{clearInterval(P),y.current.forEach(b=>clearTimeout(b))}},[]);let v=w?.status==="pending_approval"?w.signer_approval_url:void 0;return Va.isMobile||s?(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(S,{backFn:e?t:void 0,onClose:i},"header"),(0,re.jsx)(ce,{}),Va.isIOS?(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(lC,{children:[(0,re.jsx)(Vt,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(Ht,{success:u,fail:!!a}),(0,re.jsx)(Po,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(St,{children:[(0,re.jsx)(he,{children:a?a.message:"Add a signer to Farcaster"}),(0,re.jsx)(ge,{children:a?a.detail:"This will allow "+o.name+" to add casts, likes, follows, and more on your behalf."})]}),v&&(0,re.jsx)(O,{onClick:k=>{k.preventDefault(),window.location.href=v},children:"Open Warpcast app"})]})}):(0,re.jsx)(re.Fragment,{children:(0,re.jsxs)(Py,{children:[(0,re.jsx)(Vt,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(Ht,{success:u,fail:!!a}),(0,re.jsx)(Po,{style:{width:"38px",height:"38px"}})]})}),(0,re.jsxs)(St,{children:[(0,re.jsx)(he,{children:a?a.message:"Requesting signer from Farcaster"}),(0,re.jsx)(ge,{children:a?a.detail:"This should only take a moment"}),(0,re.jsx)(Jt,{children:v&&Va.isMobile&&(0,re.jsx)(nc,{text:"Take me to Warpcast",url:v,color:Ey})})]})]})}),(0,re.jsx)(z,{})]}):(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(S,{backFn:e?t:void 0,onClose:i},"header"),(0,re.jsx)(ce,{}),(0,re.jsx)(Py,{children:(0,re.jsxs)("div",{children:[(0,re.jsx)(he,{children:"Add a signer to Farcaster"}),(0,re.jsxs)(ge,{children:["This will allow ",o.name," to add casts, likes, follows, and more on your behalf."]}),(0,re.jsx)(Ii,{children:w?.status==="pending_approval"?(0,re.jsx)(Zi,{url:w.signer_approval_url,size:275,squareLogoElement:Po}):(0,re.jsx)(Et,{})}),(0,re.jsxs)(Jt,{children:[(0,re.jsx)(ge,{children:"Or copy this link and paste it into a phone browser to open the Warpcast app."}),w?.status==="pending_approval"&&(0,re.jsx)(wn,{text:w.signer_approval_url,itemName:"link",color:Ey})]})]})}),(0,re.jsx)(z,{})]})},Py=Vd.default.div`
|
|
1426
1426
|
display: flex;
|
|
1427
1427
|
flex-direction: column;
|
|
1428
1428
|
align-items: center;
|
|
@@ -1437,7 +1437,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1437
1437
|
justify-content: center;
|
|
1438
1438
|
gap: 24px;
|
|
1439
1439
|
width: 100%;
|
|
1440
|
-
`;var xy=m(require("@heroicons/react/24/outline/ClockIcon")),_y=m(require("@heroicons/react/24/outline/EyeSlashIcon")),ky=m(require("@heroicons/react/24/outline/LinkIcon")),so=m(require("styled-components"));var Ji=require("react/jsx-runtime"),
|
|
1440
|
+
`;var xy=m(require("@heroicons/react/24/outline/ClockIcon")),_y=m(require("@heroicons/react/24/outline/EyeSlashIcon")),ky=m(require("@heroicons/react/24/outline/LinkIcon")),so=m(require("styled-components"));var Ji=require("react/jsx-runtime"),ic=({size:e=61,...t})=>(0,Ji.jsx)("svg",{width:e,height:e,viewBox:"0 0 61 61",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Ji.jsxs)("g",{id:"moonpay_symbol_wht 2",children:[(0,Ji.jsx)("rect",{x:"1.3374",y:"1",width:"59",height:"59",rx:"11.5",fill:"#7715F5"}),(0,Ji.jsx)("path",{id:"Vector",d:"M43.8884 23.3258C45.0203 23.3258 46.1268 22.9901 47.068 22.3613C48.0091 21.7324 48.7427 20.8386 49.1759 19.7928C49.6091 18.747 49.7224 17.5962 49.5016 16.4861C49.2807 15.3759 48.7357 14.3561 47.9353 13.5557C47.1349 12.7553 46.1151 12.2102 45.0049 11.9893C43.8947 11.7685 42.7439 11.8819 41.6982 12.3151C40.6524 12.7482 39.7585 13.4818 39.1297 14.423C38.5008 15.3641 38.1651 16.4707 38.1651 17.6026C38.165 18.3542 38.3131 19.0985 38.6007 19.7929C38.8883 20.4873 39.3098 21.1182 39.8413 21.6496C40.3728 22.1811 41.0037 22.6027 41.6981 22.8903C42.3925 23.1778 43.1367 23.3259 43.8884 23.3258ZM26.3395 49.1017C23.5804 49.1017 20.8832 48.2836 18.5891 46.7507C16.295 45.2178 14.5069 43.039 13.4511 40.49C12.3952 37.9409 12.1189 35.1359 12.6572 32.4298C13.1955 29.7237 14.5241 27.238 16.4751 25.287C18.4262 23.336 20.9118 22.0074 23.6179 21.4691C26.324 20.9308 29.129 21.2071 31.6781 22.2629C34.2272 23.3189 36.406 25.1069 37.9389 27.401C39.4717 29.6952 40.2899 32.3923 40.2899 35.1514C40.2899 36.9835 39.9291 38.7975 39.2281 40.49C38.527 42.1826 37.4994 43.7205 36.204 45.0159C34.9086 46.3113 33.3707 47.3389 31.6781 48.04C29.9856 48.741 28.1715 49.1018 26.3395 49.1017Z",fill:"white"})]})});var Be=require("react/jsx-runtime"),zd=({title:e,desc:t,icon:r})=>(0,Be.jsxs)(fC,{children:[(0,Be.jsx)(yC,{children:r}),(0,Be.jsxs)(hC,{children:[(0,Be.jsx)(uC,{children:e}),(0,Be.jsx)(mC,{children:t})]})]}),Ay=({app:e,signedUrl:t,onContinue:r})=>(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsxs)(dC,{children:[(0,Be.jsx)(ic,{size:"3.75rem"}),(0,Be.jsxs)(pC,{children:[e?.name," uses ",(0,Be.jsx)("span",{style:{fontWeight:"bold"},children:"Moonpay"})," to fund your account"]}),(0,Be.jsxs)(gC,{children:[(0,Be.jsx)(zd,{icon:(0,Be.jsx)(ky.default,{width:"1rem"}),title:"Purchase assets to fund your account",desc:(0,Be.jsxs)(Be.Fragment,{children:["Connect a payment method (",(0,Be.jsx)("strong",{children:"debit card recommended"}),") to purchase digital assets."]})}),(0,Be.jsx)(zd,{icon:(0,Be.jsx)(xy.default,{width:"1rem"}),title:"Compliance takes time",desc:"Funding a new account may take a few hours. You'll be good to go thereafter."}),(0,Be.jsx)(zd,{icon:(0,Be.jsx)(_y.default,{width:"1rem"}),title:"Your data belongs to you",desc:"MoonPay does not sell your data and will only use it with your permission."})]}),(0,Be.jsx)(vC,{className:"mobile-only"})]}),(0,Be.jsx)(cC,{children:"By clicking continue, you will be taken to MoonPay in a new tab."}),(0,Be.jsx)(Wl,{href:t,target:"_blank",rel:"noopener noreferrer",onClick:r,children:"Continue to Moonpay"})]}),cC=so.default.span`
|
|
1441
1441
|
display: inline-block;
|
|
1442
1442
|
color: var(--privy-color-foreground-3);
|
|
1443
1443
|
text-align: center;
|
|
@@ -1493,7 +1493,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1493
1493
|
margin: 0 0.5rem;
|
|
1494
1494
|
`,vC=so.default.div`
|
|
1495
1495
|
margin: 30px 0;
|
|
1496
|
-
`;var Iy=require("ofetch"),Qi=require("react");var
|
|
1496
|
+
`;var Iy=require("ofetch"),Qi=require("react");var ac="moonpay",Ry="sdk_fiat_on_ramp_completed_with_status";async function My(e,t,r,o,n=!1){let i=r.currencyCode?{}:{defaultCurrencyCode:"ETH_ETHEREUM"},a=r.uiConfig||{accentColor:o.accent,theme:o.colorScheme};return e.signMoonpayOnRampUrl({address:t,useSandbox:n,config:{...r,...i,...a}})}async function CC(e,t){let r=t?Fu:Uu,o=t?Hu:Bu;return(0,Iy.ofetch)(`${r}/transactions/ext/${e}`,{query:{apiKey:o}})}function Wy(e,t=!1){let[r,o]=(0,Qi.useState)(null),{createAnalyticsEvent:n}=W(),i=(0,Qi.useRef)(0);return(0,Qi.useEffect)(()=>{let a=setInterval(async()=>{if(e)try{let[l]=await CC(e,t),s=l.status==="waitingAuthorization"&&l.paymentMethod==="credit_debit_card"?"pending":l.status;o(s),["failed","completed","awaitingAuthorization"].includes(s)&&(n({eventName:Ry,payload:{status:s,provider:ac,paymentMethod:l.paymentMethod,cardPaymentType:l.cardPaymentType,currency:l.currency?.code,baseCurrencyAmount:l.baseCurrencyAmount,quoteCurrencyAmount:l.quoteCurrencyAmount,feeAmount:l.feeAmount,extraFeeAmount:l.extraFeeAmount,networkFeeAmount:l.networkFeeAmount}}),clearInterval(a))}catch(l){l.response?.status!==404&&(i.current+=1),i.current>=3&&(o("serviceFailure"),n({eventName:Ry,payload:{status:"serviceFailure",provider:ac}}),clearInterval(a))}},3e3);return()=>clearInterval(a)},[e,i]),r}var En=require("react/jsx-runtime"),Ly=()=>{let{app:e,data:t,navigate:r}=_(),{createAnalyticsEvent:o}=W(),{signedUrl:n}=t.fiatOnRampPrompt;return!e||!n?null:(0,En.jsxs)(En.Fragment,{children:[(0,En.jsx)(S,{title:"Fund account"},"header"),(0,En.jsx)(Ay,{app:e,signedUrl:n,onContinue:()=>{o({eventName:"sdk_fiat_on_ramp_started",payload:{provider:ac}}),r("FIAT_ON_RAMP_STATUS_SCREEN")}}),(0,En.jsx)(V,{protectedByPrivy:!0})]})};var Oy=m(require("@heroicons/react/24/solid/ArrowsRightLeftIcon")),Ny=m(require("@heroicons/react/24/solid/CheckCircleIcon")),Dy=m(require("@heroicons/react/24/solid/XCircleIcon")),Uy=require("react"),qd=m(require("styled-components"));var We=require("react/jsx-runtime"),Fy=()=>{let{app:e,data:t}=_(),{closePrivyModal:r}=W(),{externalTransactionId:o}=t?.fiatOnRampStatus,n=Wy(o||null,e.fiatOnRamp.useSandbox);return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsx)(S,{title:"Fund account"},"header"),(0,We.jsx)(bC,{status:n,onClickCta:r}),(0,We.jsx)(V,{protectedByPrivy:!0})]})},wC=e=>{switch(e){case"completed":return{title:"You've funded your account!",body:"It may take a few minutes for the assets to appear.",cta:"Continue"};case"failed":return{title:"Something went wrong!",body:(0,We.jsxs)(We.Fragment,{children:[(0,We.jsxs)("p",{children:["It looks like there was an issue with your payment. Please contact"," ",(0,We.jsx)("a",{href:"https://support.moonpay.com/hc/en-gb",target:"_blank",rel:"noreferrer noopener",style:{textDecoration:"underline"},children:"Moonpay support"})," ","for assistance."]}),(0,We.jsx)("p",{style:{fontStyle:"italic"},children:"Note that debit cards typically work better than credit cards here."})]}),cta:"Done"};case"serviceFailure":return{title:"Something went wrong!",body:"MoonPay ran into an error when processing your transaction. Try again?",cta:"Done"};case"waitingAuthorization":return{title:"Processing payment",body:"This may take up to a few hours. You will receive an email when the purchase is complete.",cta:"Continue"};default:return{title:"In Progress",body:"Go back to MoonPay to finish funding your account.",cta:""}}},bC=({status:e,onClickCta:t})=>{let{title:r,body:o,cta:n}=(0,Uy.useMemo)(()=>wC(e),[e]);return(0,We.jsxs)(We.Fragment,{children:[(0,We.jsxs)(xC,{children:[(0,We.jsx)(TC,{status:e}),(0,We.jsxs)(St,{children:[(0,We.jsx)("h3",{children:r}),(0,We.jsx)(SC,{children:o})]})]}),n&&(0,We.jsx)(O,{onClick:t,children:n})]})},EC=e=>e?{completed:"var(--privy-color-success)",failed:"var(--privy-color-error)",serviceFailure:"var(--privy-color-error)",waitingAuthorization:"var(--privy-color-accent)",pending:"var(--privy-color-foreground-4)"}[e]:"var(--privy-color-foreground-4)",PC=e=>{switch(e){case"serviceFailure":case"failed":return Dy.default;case"completed":return Ny.default;case"waitingAuthorization":return()=>(0,We.jsx)(Oy.default,{width:"3rem",height:"3rem",style:{backgroundColor:"var(--privy-color-foreground-4)",color:"var(--privy-color-background)",borderRadius:"100%",padding:"0.5rem",margin:"0.5rem"}});default:return}},TC=({status:e})=>{if(!e||e==="pending"){let o="var(--privy-color-foreground-4)";return(0,We.jsxs)("div",{style:{position:"relative"},children:[(0,We.jsx)(Et,{color:o,style:{position:"absolute"}}),(0,We.jsx)(wd,{color:o}),(0,We.jsx)(ic,{size:"3rem",style:{position:"absolute",top:"1rem",left:"1rem"}})]})}let t=PC(e),r=EC(e);return(0,We.jsx)("div",{style:{borderColor:r,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"100%",borderWidth:2,padding:"0.5rem",marginBottom:"0.5rem"},children:t&&(0,We.jsx)(t,{width:"4rem",height:"4rem",color:r})})},SC=qd.default.p`
|
|
1497
1497
|
font-size: 1rem;
|
|
1498
1498
|
color: var(--privy-color-foreground-3);
|
|
1499
1499
|
margin-bottom: 1rem;
|
|
@@ -1508,7 +1508,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1508
1508
|
margin-left: 1.75rem;
|
|
1509
1509
|
margin-right: 1.75rem;
|
|
1510
1510
|
padding: 2rem 0;
|
|
1511
|
-
`;var By=m(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Hy=m(require("styled-components"));var
|
|
1511
|
+
`;var By=m(require("@heroicons/react/24/outline/ArrowTopRightOnSquareIcon")),Hy=m(require("styled-components"));var Er=require("react/jsx-runtime"),Gy=()=>{let{closePrivyModal:e}=W();return(0,Er.jsxs)(Er.Fragment,{children:[(0,Er.jsx)(S,{},"header"),(0,Er.jsx)(_C,{children:(0,Er.jsx)(By.default,{style:{width:32,height:32}})}),(0,Er.jsx)(wo,{title:"Could not log in with provider",description:"It looks like you're using an in-app browser. To log in, please try again using an external browser.",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center"}}),(0,Er.jsx)(Hr,{children:(0,Er.jsx)(O,{onClick:()=>e(),children:"Close"})}),(0,Er.jsx)(ye,{}),(0,Er.jsx)(V,{protectedByPrivy:!0})]})},_C=Hy.default.div`
|
|
1512
1512
|
border-radius: 50%;
|
|
1513
1513
|
height: 68px;
|
|
1514
1514
|
width: 68px;
|
|
@@ -1518,18 +1518,18 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1518
1518
|
background-color: var(--privy-color-accent);
|
|
1519
1519
|
color: white;
|
|
1520
1520
|
margin: 0 auto 24px auto;
|
|
1521
|
-
`;var qy=m(require("react-device-detect")),$y=m(require("styled-components"));var
|
|
1521
|
+
`;var qy=m(require("react-device-detect")),$y=m(require("styled-components"));var sc=m(require("styled-components"));var $d=require("react/jsx-runtime"),Vy=({style:e,...t})=>(0,$d.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"17",height:"17",viewBox:"0 0 17 17",style:{height:"1.25rem",width:"1.25rem",...e},...t,children:(0,$d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",fillRule:"evenodd",clipRule:"evenodd",d:"M16.5 8.67993C16.5 9.82986 15.853 10.8287 14.9032 11.3322C15.2188 12.3599 14.97 13.5237 14.1569 14.3368C13.3437 15.1499 12.18 15.3987 11.1523 15.0831C10.6488 16.0329 9.64993 16.6799 8.5 16.6799C7.35007 16.6799 6.35126 16.0329 5.84771 15.0831C4.82003 15.3987 3.65627 15.1499 2.84314 14.3368C2.03001 13.5237 1.78124 12.3599 2.09681 11.3322C1.14699 10.8287 0.5 9.82986 0.5 8.67993C0.5 7.53 1.14699 6.53119 2.0968 6.02764C1.78125 4.99996 2.03003 3.83621 2.84315 3.02309C3.65627 2.20997 4.82002 1.96119 5.8477 2.27675C6.35125 1.32692 7.35007 0.679932 8.5 0.679932C9.64992 0.679932 10.6487 1.32691 11.1523 2.27672C12.18 1.96115 13.3437 2.20993 14.1569 3.02305C14.97 3.83618 15.2188 4.99996 14.9032 6.02764C15.853 6.53119 16.5 7.53 16.5 8.67993ZM12.2659 6.68856C12.5654 6.40238 12.5761 5.92763 12.29 5.62818C12.0038 5.32873 11.529 5.31797 11.2296 5.60416C9.73022 7.03711 8.40877 8.65489 7.3018 10.4211L5.78033 8.89963C5.48744 8.60673 5.01256 8.60673 4.71967 8.89963C4.42678 9.19252 4.42678 9.66739 4.71967 9.96029L6.92031 12.1609C7.08544 12.3261 7.31807 12.4048 7.54957 12.374C7.78106 12.3432 7.98499 12.2064 8.1012 12.0038C9.23027 10.0356 10.6362 8.24613 12.2659 6.68856Z",fill:"var(--privy-color-accent)"})});var cc=require("react/jsx-runtime"),zy=sc.default.div`
|
|
1522
1522
|
display: flex;
|
|
1523
1523
|
flex-direction: column;
|
|
1524
1524
|
justify-content: flex-start;
|
|
1525
1525
|
gap: 4px;
|
|
1526
|
-
`,Kd=
|
|
1526
|
+
`,Kd=sc.default.div`
|
|
1527
1527
|
&&& {
|
|
1528
1528
|
margin-left: 7px; /* TODO: This is a total hack */
|
|
1529
1529
|
border-left: 2px solid var(--privy-color-foreground-4);
|
|
1530
1530
|
height: 12px;
|
|
1531
1531
|
}
|
|
1532
|
-
`,
|
|
1532
|
+
`,lc=({children:e})=>(0,cc.jsxs)(kC,{children:[(0,cc.jsx)(Vy,{style:{width:"16px",height:"16px"}}),e]}),kC=sc.default.div`
|
|
1533
1533
|
display: flex;
|
|
1534
1534
|
justify-content: flex-start;
|
|
1535
1535
|
justify-items: center;
|
|
@@ -1547,13 +1547,13 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1547
1547
|
margin-bottom: auto;
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
|
-
`;var
|
|
1550
|
+
`;var ze=require("react/jsx-runtime"),AC=()=>(0,ze.jsxs)(RC,{children:[(0,ze.jsx)(Ia,{title:"Create a Phantom wallet",description:"Follow the instructions below to get started."}),(0,ze.jsx)(Jt,{children:(0,ze.jsx)(ho,{style:{width:"152px",height:"152px"}})}),(0,ze.jsxs)(zy,{children:[(0,ze.jsx)(lc,{children:(0,ze.jsxs)("div",{children:[(0,ze.jsx)("span",{children:"Install the "}),(0,ze.jsx)("a",{href:qy.isFirefox?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",target:"_blank",children:"Phantom browser extension"})]})}),(0,ze.jsx)(Kd,{}),(0,ze.jsx)(lc,{children:"Set up your first wallet"}),(0,ze.jsx)(Kd,{}),(0,ze.jsx)(lc,{children:"Store your recovery phrase in a safe place!"})]}),(0,ze.jsx)(Ll,{onClick:()=>window.location.reload(),children:"Reload the page to use your wallet"})]}),Ky=()=>{let{navigateBack:e}=_();return(0,ze.jsxs)(ze.Fragment,{children:[(0,ze.jsx)(S,{backFn:e},"header"),(0,ze.jsx)(ce,{}),(0,ze.jsx)(AC,{}),(0,ze.jsx)(ye,{}),(0,ze.jsxs)(z,{children:[(0,ze.jsx)("span",{children:"Still not sure? "}),(0,ze.jsx)("a",{target:"_blank",href:"https://ethereum.org/en/wallets/",children:"Learn more"})]})]})},RC=(0,$y.default)(Jt)`
|
|
1551
1551
|
gap: 30px;
|
|
1552
1552
|
|
|
1553
1553
|
> :first-child > svg {
|
|
1554
1554
|
margin-top: 20px;
|
|
1555
1555
|
}
|
|
1556
|
-
`;var l1=m(require("@heroicons/react/24/outline/UserCircleIcon"))
|
|
1556
|
+
`;var l1=m(require("@heroicons/react/24/outline/UserCircleIcon")),Ka=require("react"),c1=require("react-device-detect"),d1=m(require("styled-components"));var Yy=m(require("@heroicons/react/24/outline/EnvelopeIcon")),Zy=require("react");var jy=m(require("@heroicons/react/24/outline/EnvelopeIcon")),za=require("react"),jd=m(require("styled-components"));var lo=require("react/jsx-runtime"),dc=(0,za.forwardRef)((e,t)=>{let[r,o]=(0,za.useState)(""),[n,i]=(0,za.useState)(!1),{authenticated:a}=H(),{initLoginWithEmail:l}=W(),{navigate:s,setModalData:c,currentScreen:u}=_(),{enabled:f,token:y}=Me(),g=Ss(r),w=n,v=n||!g,k=b=>{i(!0),l(r,b).then(()=>{s("AWAITING_PASSWORDLESS_CODE")}).catch(A=>{c({errorModalData:{error:A,previousScreen:u||"LANDING"}}),s("ERROR_SCREEN")}).finally(()=>{i(!1)})},P=()=>{f&&!y&&!a?(c({captchaModalData:{callback:b=>l(r,b),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),s("CAPTCHA_SCREEN")):k(y)};return(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)(IC,{children:(0,lo.jsxs)(MC,{stacked:e.stacked,children:[(0,lo.jsx)(jy.default,{}),(0,lo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:b=>o(b.target.value),onKeyUp:b=>{b.key==="Enter"&&P()},value:r,autoComplete:"email"}),e.stacked?null:(0,lo.jsx)(Ai,{isSubmitting:w,onClick:P,disabled:v,children:"Submit"})]})}),e.stacked?(0,lo.jsx)(O,{loadingText:null,loading:w,disabled:v,onClick:P,children:"Submit"}):null]})}),IC=jd.default.div`
|
|
1557
1557
|
width: 100%;
|
|
1558
1558
|
`,MC=jd.default.label`
|
|
1559
1559
|
display: block;
|
|
@@ -1616,7 +1616,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1616
1616
|
&& > input::placeholder {
|
|
1617
1617
|
color: var(--privy-color-foreground-3);
|
|
1618
1618
|
}
|
|
1619
|
-
`;var To=require("react/jsx-runtime"),
|
|
1619
|
+
`;var To=require("react/jsx-runtime"),pc=({isEditable:e,setIsEditable:t})=>{let r=(0,Zy.useRef)(null);return(0,To.jsxs)(To.Fragment,{children:[(0,To.jsx)(Fo,{if:!e,children:(0,To.jsx)(dc,{ref:r})}),(0,To.jsx)(Fo,{if:e,children:(0,To.jsxs)(je,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,To.jsx)(Yy.default,{})," Continue with Email"]})})]})};var Jy=require("react");var Xi=require("react/jsx-runtime"),uc=()=>{let[e,t]=(0,Jy.useState)(!1),{currentScreen:r,navigate:o,setModalData:n}=_(),{enabled:i,token:a}=Me(),{initLoginWithFarcaster:l}=W();return(0,Xi.jsxs)(je,{onClick:async()=>{t(!0);try{i&&!a?(n({captchaModalData:{callback:c=>l(c),userIntentRequired:!0,onSuccessNavigateTo:"AWAITING_FARCASTER_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):(await l(a),o("AWAITING_FARCASTER_CONNECTION"))}catch(c){n({errorModalData:{error:c,previousScreen:r||"LANDING"}}),o("ERROR_SCREEN")}finally{t(!1)}},disabled:!1,children:[(0,Xi.jsx)(Po,{})," Farcaster",e&&(0,Xi.jsx)("span",{children:(0,Xi.jsx)(Uo,{})})]})};var mc=m(require("styled-components"));var Qy=require("react/jsx-runtime"),fc=()=>{let{enabled:e,token:t}=Me(),{navigate:r,setModalData:o}=_(),{initLoginWithPasskey:n}=W();return(0,Qy.jsx)(LC,{onClick:async()=>{e&&!t?(o({captchaModalData:{callback:a=>n(a),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSKEY_SYSTEM_DIALOGUE",onErrorNavigateTo:"ERROR_SCREEN"}}),r("CAPTCHA_SCREEN")):(await n(),r("AWAITING_PASSKEY_SYSTEM_DIALOGUE"))},children:"I have a passkey"})},WC=mc.css`
|
|
1620
1620
|
&& {
|
|
1621
1621
|
width: 100%;
|
|
1622
1622
|
font-size: 0.875rem;
|
|
@@ -1641,9 +1641,9 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1641
1641
|
box-shadow: none;
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
|
-
`,LC=
|
|
1644
|
+
`,LC=mc.default.button`
|
|
1645
1645
|
${WC}
|
|
1646
|
-
`;var n1=m(require("@heroicons/react/24/outline/PhoneIcon")),i1=require("react");var ea=require("react"),Yd=m(require("styled-components"));var Xy=m(require("libphonenumber-js/examples.mobile.json")),
|
|
1646
|
+
`;var n1=m(require("@heroicons/react/24/outline/PhoneIcon")),i1=require("react");var ea=require("react"),Yd=m(require("styled-components"));var Xy=m(require("libphonenumber-js/examples.mobile.json")),Pr=require("libphonenumber-js/min"),yc=require("react/jsx-runtime");var qa=(e,t)=>(0,Pr.isPossiblePhoneNumber)(String(e),t),hc=(e,t)=>`+${(0,Pr.getCountryCallingCode)(t)} ${e}`,e1=e=>`*${e.replaceAll("-","").slice(-4)}`,t1=e=>new Pr.AsYouType(e),OC=(0,Pr.getCountries)().map(e=>({code:e,callCode:(0,Pr.getCountryCallingCode)(e)})),r1=e=>{let t=(0,Pr.getExampleNumber)(e,Xy.default)?.formatInternational();return t?.substring(t.indexOf(" ")+1)},o1=({value:e,onChange:t})=>(0,yc.jsx)("select",{value:e,onChange:t,children:OC.map(r=>(0,yc.jsxs)("option",{value:r.code,children:[r.code," +",r.callCode]},r.code))});var co=require("react/jsx-runtime"),ta=(0,ea.forwardRef)((e,t)=>{let{app:r}=_(),[o,n]=(0,ea.useState)(""),[i,a]=(0,ea.useState)(r?.intl.defaultCountry??"US"),l=qa(o,i),s=t1(i),c=r1(i),u=(0,Pr.getCountryCallingCode)(i),f=!l,[y,g]=(0,ea.useState)(!1),w=u.length,v=b=>{let A=b.target.value;a(A),n(""),e.onChange&&e.onChange({rawPhoneNumber:o,qualifiedPhoneNumber:hc(o,A),countryCode:A,isValid:qa(o,i)})},k=b=>{try{let A=b.replace(/\D/g,""),R=o.replace(/\D/g,""),N=A===R?b:s.input(b);n(N),e.onChange&&e.onChange({rawPhoneNumber:N,qualifiedPhoneNumber:hc(b,i),countryCode:i,isValid:qa(b,i)})}catch(A){console.error("Error processing phone number:",A)}},P=()=>{g(!0);let b=hc(o,i);e.onSubmit({rawPhoneNumber:o,qualifiedPhoneNumber:b,countryCode:i,isValid:qa(o,i)}).finally(()=>g(!1))};return(0,co.jsxs)(co.Fragment,{children:[(0,co.jsx)(NC,{children:(0,co.jsxs)(DC,{callingCodeLength:w,stacked:e.stacked,children:[(0,co.jsx)(o1,{value:i,onChange:v}),(0,co.jsx)("input",{ref:t,id:"phone-number-input",type:"tel",placeholder:c,onChange:b=>{k(b.target.value)},onKeyUp:b=>{b.key==="Enter"&&P()},value:o,autoComplete:"tel"}),!e.stacked&&!e.noIncludeSubmitButton?(0,co.jsx)(Ai,{isSubmitting:y,onClick:P,disabled:f,children:"Submit"}):null]})}),e.stacked&&!e.noIncludeSubmitButton?(0,co.jsx)(O,{loading:y,loadingText:null,onClick:P,disabled:f,children:"Submit"}):null]})}),NC=Yd.default.div`
|
|
1647
1647
|
width: 100%;
|
|
1648
1648
|
`,DC=Yd.default.label`
|
|
1649
1649
|
--country-code-dropdown-width: calc(54px + calc(12 * ${e=>e.callingCodeLength}px));
|
|
@@ -1732,11 +1732,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1732
1732
|
&& > input::placeholder {
|
|
1733
1733
|
color: var(--privy-color-foreground-3);
|
|
1734
1734
|
}
|
|
1735
|
-
`;var So=require("react/jsx-runtime"),
|
|
1735
|
+
`;var So=require("react/jsx-runtime"),gc=({isEditable:e,setIsEditable:t})=>{let r=(0,i1.useRef)(null),{authenticated:o}=H(),{navigate:n,setModalData:i,currentScreen:a}=_(),{initLoginWithSms:l}=W(),{enabled:s,token:c}=Me();async function u({qualifiedPhoneNumber:f}){if(s&&!c&&!o)i({captchaModalData:{callback:y=>l(f,y),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),n("CAPTCHA_SCREEN");else try{await l(f,c),n("AWAITING_PASSWORDLESS_CODE")}catch(y){i({errorModalData:{error:y,previousScreen:a||"LANDING"}}),n("ERROR_SCREEN")}}return(0,So.jsxs)(So.Fragment,{children:[(0,So.jsx)(Fo,{if:!e,children:(0,So.jsx)(ta,{ref:r,onSubmit:u})}),(0,So.jsx)(Fo,{if:e,children:(0,So.jsxs)(je,{onClick:()=>{t(),setTimeout(()=>{r.current?.focus()},0)},children:[(0,So.jsx)(n1.default,{})," Continue with SMS"]})})]})};var a1=require("react");var qr=require("react/jsx-runtime"),UC={apple:{logo:(0,qr.jsx)(Hs,{}),displayName:"Apple"},discord:{logo:(0,qr.jsx)(Gs,{}),displayName:"Discord"},github:{logo:(0,qr.jsx)(Vs,{}),displayName:"GitHub"},google:{logo:(0,qr.jsx)(zs,{}),displayName:"Google"},linkedin:{logo:(0,qr.jsx)($s,{}),displayName:"LinkedIn"},spotify:{logo:(0,qr.jsx)(Ks,{}),displayName:"Spotify"},instagram:{logo:(0,qr.jsx)(qs,{}),displayName:"Instagram"},twitter:{logo:(0,qr.jsx)(Ys,{}),displayName:"Twitter"},tiktok:{logo:(0,qr.jsx)(js,{}),displayName:"TikTok"}},kt=({provider:e})=>{let{enabled:t,token:r}=Me(),{navigate:o,setModalData:n}=_(),[i,a]=(0,a1.useState)(!1),{initLoginWithOAuth:l}=W(),{displayName:s,logo:c}=UC[e];return(0,qr.jsxs)(je,{onClick:()=>{a(!0),t&&!r?(n({captchaModalData:{callback:f=>l(e,f),userIntentRequired:!0,onSuccessNavigateTo:null,onErrorNavigateTo:"ERROR_SCREEN"}}),o("CAPTCHA_SCREEN")):l(e)},disabled:i,children:[c," ",s]})};var s1=m(require("@heroicons/react/24/outline/ChevronRightIcon"));var $a=require("react/jsx-runtime"),vc=({onClick:e,text:t,icon:r})=>(0,$a.jsxs)(je,{onClick:e,children:[r,(0,$a.jsx)(Ol,{children:t}),(0,$a.jsx)(s1.default,{})]});var Le=require("react/jsx-runtime"),wc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{appearance:{palette:{colorScheme:i}}}=Nr(),a=o.loginMethodsAndOrder?.primary??[],l=o.loginMethodsAndOrder?.overflow??[],s=[...a,...l],c=o.loginMethods.passkey,[u,f]=(0,Ka.useState)("default"),[y,g]=(0,Ka.useState)("email");(0,Ka.useEffect)(()=>{let I=s.indexOf("sms"),q=s.indexOf("email");I>-1&&I<q&&g("sms")},[a,l]);let w=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{f("default")},150)};n.current=w;let v=I=>I==="email"?(0,Le.jsx)(pc,{isEditable:y==="email",setIsEditable:()=>{g("email")}},I):I==="sms"?(0,Le.jsx)(gc,{isEditable:y==="sms",setIsEditable:()=>{g("sms")}},I):I==="apple"?(0,Le.jsx)(kt,{provider:"apple"},I):I==="discord"?(0,Le.jsx)(kt,{provider:"discord"},I):I==="farcaster"?(0,Le.jsx)(uc,{},I):I==="github"?(0,Le.jsx)(kt,{provider:"github"},I):I==="google"?(0,Le.jsx)(kt,{provider:"google"},I):I==="linkedin"?(0,Le.jsx)(kt,{provider:"linkedin"},I):I==="tiktok"?(0,Le.jsx)(kt,{provider:"tiktok"},I):I==="twitter"&&(!c1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)?(0,Le.jsx)(kt,{provider:"twitter"},I):Ma([I],r,e,s),k=a.map(v).flat(),P=l.map(v).flat(),b=[...k,...P],A=FC({primary:k.length,overflow:P.length}),[R,N]=wu(b,A),L=u==="default"?void 0:()=>{f("default")};return(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)(S,{title:o.appearance.landingHeader,onClose:w,backFn:L}),u==="default"&&(0,Le.jsx)(BC,{}),(0,Le.jsx)(Nl,{style:{overflow:"hidden"},children:(0,Le.jsxs)(tf,{colorScheme:i,style:{maxHeight:400,overflowY:"scroll",padding:2},children:[u==="default"&&(0,Le.jsxs)(Le.Fragment,{children:[...R,N.length>0&&(0,Le.jsx)(vc,{text:"More options",icon:(0,Le.jsx)(l1.default,{}),onClick:()=>f("overflow")})]}),u==="overflow"&&(0,Le.jsxs)(Le.Fragment,{children:[...N]}),c&&u==="default"&&(0,Le.jsx)(fc,{})]})}),o&&(0,Le.jsx)(Ri,{app:o}),(0,Le.jsx)(V,{protectedByPrivy:!0})]})},Cc=5,FC=({primary:e,overflow:t})=>e<Cc?e:e===Cc&&t===0?Cc:Cc-1,BC=(0,d1.default)(Li)`
|
|
1736
1736
|
margin-bottom: 16px;
|
|
1737
|
-
`;var h1=m(require("@heroicons/react/24/outline/EnvelopeIcon")),y1=m(require("@heroicons/react/24/outline/PhoneIcon")),g1=m(require("@heroicons/react/24/outline/UserCircleIcon")),
|
|
1737
|
+
`;var h1=m(require("@heroicons/react/24/outline/EnvelopeIcon")),y1=m(require("@heroicons/react/24/outline/PhoneIcon")),g1=m(require("@heroicons/react/24/outline/UserCircleIcon")),ja=require("react"),v1=require("react-device-detect"),C1=m(require("styled-components"));var $o=require("react/jsx-runtime"),p1=({...e})=>(0,$o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"25",height:"25",viewBox:"0 0 25 25",fill:"none",...e,children:[(0,$o.jsxs)("g",{clipPath:"url(#clip0_2856_1743)",children:[(0,$o.jsx)("path",{d:"M22.1673 8.24075V16.3642C22.1673 17.3256 21.3421 18.105 20.3241 18.105H17.0028M22.1673 8.24075C22.1673 7.27936 21.3421 6.5 20.3241 6.5H11.5302M22.1673 8.24075V8.42852C22.1673 9.03302 21.8352 9.59423 21.2901 9.91105L15.1463 13.4818C14.5539 13.8261 13.8067 13.8261 13.2143 13.4818L10.1621 11.5401",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,$o.jsx)("path",{d:"M3.12913 6.64816C0.508085 12.9507 3.49251 20.1847 9.79504 22.8057L11.5068 23.5176C12.4522 23.9108 13.7783 23.2222 14.1714 22.2768L14.6054 21.2333C14.7687 20.8406 14.6438 20.3871 14.3024 20.1334L11.2872 17.8927C10.9878 17.6702 10.5843 17.6488 10.2632 17.8384L9.11575 18.5156C8.78274 18.7121 8.3597 18.6844 8.07552 18.4221C5.94293 16.4542 4.77629 13.6264 4.90096 10.7273C4.91757 10.3409 5.19796 10.023 5.57269 9.92753L6.86381 9.59869C7.22522 9.50664 7.49627 9.20696 7.55169 8.83815L8.10986 5.12321C8.17306 4.70259 7.94188 4.29293 7.54915 4.1296L6.50564 3.69564C5.56026 3.30248 4.23416 3.99103 3.84101 4.9364L3.12913 6.64816Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,$o.jsx)("defs",{children:(0,$o.jsx)("clipPath",{id:"clip0_2856_1743",children:(0,$o.jsx)("rect",{x:"0.5",y:"0.5",width:"24",height:"24",rx:"6",fill:"white"})})})]});var u1=m(require("@heroicons/react/24/outline/ChevronRightIcon")),m1=m(require("@heroicons/react/24/outline/WalletIcon"));var ra=require("react/jsx-runtime"),f1=({onClick:e,text:t})=>(0,ra.jsxs)(je,{onClick:e,children:[(0,ra.jsx)(m1.default,{}),(0,ra.jsx)(Ol,{children:t}),(0,ra.jsx)(u1.default,{})]});var ue=require("react/jsx-runtime"),bc=({connectOnly:e})=>{let{closePrivyModal:t,connectors:r}=W(),{app:o,onUserCloseViaDialogOrKeybindRef:n}=_(),{email:i,sms:a,google:l,twitter:s,discord:c,github:u,spotify:f,instagram:y,tiktok:g,linkedin:w,apple:v,wallet:k,farcaster:P,passkey:b}=o?.loginMethods??{},A=o?.appearance.loginGroupPriority||"web2-first",R=o?.appearance.hideDirectWeb2Inputs,[N,L]=(0,ja.useState)("default"),[I,q]=(0,ja.useState)(i?"email":"sms");(0,ja.useEffect)(()=>{q(i?"email":"sms")},[i]);let J=()=>{t({shouldCallAuthOnSuccess:!0}),setTimeout(()=>{L("default")},150)};n.current=J;let j=[i&&(0,ue.jsx)(pc,{isEditable:I==="email",setIsEditable:()=>{q("email")}}),a&&(0,ue.jsx)(gc,{isEditable:I==="sms",setIsEditable:()=>{q("sms")}})].filter(Boolean),M=[l&&(0,ue.jsx)(kt,{provider:"google"}),s&&(!v1.isMobile||o?.loginConfig.twitterOAuthOnMobileEnabled)&&(0,ue.jsx)(kt,{provider:"twitter"}),c&&(0,ue.jsx)(kt,{provider:"discord"}),u&&(0,ue.jsx)(kt,{provider:"github"}),f&&(0,ue.jsx)(kt,{provider:"spotify"}),y&&(0,ue.jsx)(kt,{provider:"instagram"}),g&&(0,ue.jsx)(kt,{provider:"tiktok"}),w&&(0,ue.jsx)(kt,{provider:"linkedin"}),v&&(0,ue.jsx)(kt,{provider:"apple"}),P&&(0,ue.jsx)(uc,{})].filter(Boolean),ne=Ma(o.appearance.walletList,r,e,o.appearance.walletList),B=N==="default"?void 0:()=>{L("default")},be=GC({priority:A,email:i,sms:a,social:M}),fe=VC({priority:A,email:i,sms:a,social:M}),ve=zC({priority:A,email:i,sms:a,social:M}),Ee=(0,ue.jsx)(f1,{text:ve,onClick:()=>L("web3-overflow")}),ae=(0,ue.jsx)(vc,{text:be,icon:fe,onClick:()=>L("web2-overflow")}),It=R?0:1;return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsx)(S,{title:o.appearance.landingHeader,onClose:J,backFn:B}),N==="default"&&(0,ue.jsx)(HC,{}),(0,ue.jsx)(Nl,{style:{overflow:"hidden",padding:2},children:(0,ue.jsxs)(to,{children:[N==="default"&&A==="web2-first"&&(0,ue.jsxs)(ue.Fragment,{children:[...j,...M.length+j.length>4?M.slice(0,3-j.length):M,j.length+M.length>4&&ae,k&&Ee]}),N==="default"&&A==="web3-first"&&(0,ue.jsxs)(ue.Fragment,{children:[k&&(0,ue.jsxs)(ue.Fragment,{children:[...ne.length>4?ne.slice(0,3):ne,ne.length>4&&Ee]}),j.length+M.length>It&&ae,j.length+M.length===It&&j.length?j[0]:null,j.length+M.length===It&&M.length?M[0]:null]}),N==="web2-overflow"&&(0,ue.jsxs)(ue.Fragment,{children:[...A==="web3-first"?j:[],...M]}),...N==="web3-overflow"?ne:[],b&&N==="default"&&(0,ue.jsx)(fc,{})]})}),o&&(0,ue.jsx)(Ri,{app:o}),(0,ue.jsx)(V,{protectedByPrivy:!0})]})},HC=(0,C1.default)(Li)`
|
|
1738
1738
|
margin-bottom: 16px;
|
|
1739
|
-
`,GC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",VC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,ue.jsx)(g1.default,{}):t&&r?(0,ue.jsx)(p1,{}):t?(0,ue.jsx)(h1.default,{}):r?(0,ue.jsx)(y1.default,{}):null,zC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Zd=require("react/jsx-runtime"),w1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Zd.jsx)(Cc,{connectOnly:!0}):(0,Zd.jsx)(wc,{connectOnly:!0})};var Jd=require("react/jsx-runtime"),b1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Jd.jsx)(Cc,{connectOnly:!1}):(0,Jd.jsx)(wc,{connectOnly:!1})};var E1=m(require("@heroicons/react/24/outline/EnvelopeIcon"));var Pr=require("react/jsx-runtime"),P1=()=>{let{app:e}=_();return(0,Pr.jsxs)(Pr.Fragment,{children:[(0,Pr.jsx)(S,{},"header"),(0,Pr.jsx)(ce,{}),(0,Pr.jsx)(De,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Pr.jsx)(E1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Pr.jsx)(Br,{children:(0,Pr.jsx)(cc,{stacked:!0})}),(0,Pr.jsx)(ye,{}),(0,Pr.jsx)(V,{protectedByPrivy:!0})]})};var x1=m(require("@heroicons/react/24/outline/ClockIcon")),_1=m(require("@heroicons/react/24/outline/TrashIcon")),k1=m(require("@heroicons/react/24/solid/CheckBadgeIcon")),A1=m(require("@heroicons/react/24/solid/CheckCircleIcon")),R1=m(require("@heroicons/react/24/solid/LockClosedIcon")),Pn=require("react"),$t=m(require("styled-components"));var Qd=require("react/jsx-runtime"),Zn=({style:e,...t})=>(0,Qd.jsx)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Qd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});var _e=require("react/jsx-runtime"),Jn=({style:e,...t})=>(0,_e.jsxs)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,_e.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,_e.jsx)("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),(0,_e.jsx)("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),(0,_e.jsx)("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),(0,_e.jsx)("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),(0,_e.jsx)("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),(0,_e.jsx)("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),(0,_e.jsx)("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),(0,_e.jsx)("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),(0,_e.jsx)("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),(0,_e.jsx)("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),(0,_e.jsx)("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),(0,_e.jsx)("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),(0,_e.jsx)("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),(0,_e.jsx)("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),(0,_e.jsx)("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),(0,_e.jsx)("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),(0,_e.jsx)("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),(0,_e.jsx)("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),(0,_e.jsx)("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),(0,_e.jsx)("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),(0,_e.jsx)("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),(0,_e.jsx)("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),(0,_e.jsx)("defs",{children:(0,_e.jsx)("clipPath",{id:"clip0_113_33841",children:(0,_e.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var $=require("react/jsx-runtime"),T1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=(0,Pn.useState)([]),a=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{i(u=>u.concat([c])),await r(c),i(u=>u.filter(f=>f!==c))};return(0,$.jsxs)("div",{children:[(0,$.jsx)(JC,{children:"Your passkeys"}),(0,$.jsxs)(M1,{children:[e.slice(0,a).map(c=>(0,$.jsxs)(e4,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)(QC,{children:l(c)}),(0,$.jsxs)(XC,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),(0,$.jsx)(r4,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?(0,$.jsx)(Uo,{}):(0,$.jsx)(_1.default,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&(0,$.jsx)(jC,{onClick:o,children:"View all"})]})]})},qC=()=>(0,$.jsxs)(M1,{children:[(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(k1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(R1.default,{})}),"More secure than a password."]}),(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(x1.default,{})}),"Takes seconds to set up and use."]})]}),I1=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=W(),n=e?.linkedAccounts.filter(v=>v.type==="passkey"),[i,a]=(0,Pn.useState)(!1),[l,s]=(0,Pn.useState)(""),[c,u]=(0,Pn.useState)(!1),[f,y]=(0,Pn.useState)(!1);(0,Pn.useEffect)(()=>{n.length===0&&y(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(v=>{if(v instanceof at){if(v.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(v.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},w=async v=>(a(!0),await t(v).then(()=>u(!0)).catch(k=>{if(k instanceof at&&k.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{onClose:()=>o()},"header"),(0,$.jsx)(Ne,{children:(0,$.jsx)(Qe,{status:"success",children:(0,$.jsx)(A1.default,{})})}),(0,$.jsx)(S1,{children:"Passkey added"}),(0,$.jsx)(YC,{children:"From now on, you can use your passkey to log in."}),(0,$.jsx)(Gt,{children:(0,$.jsx)(O,{onClick:()=>o(),children:"Done"})}),(0,$.jsx)(z,{})]}):f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{backFn:()=>y(!1),onClose:()=>o()},"header"),(0,$.jsx)(T1,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>y(!0)}),(0,$.jsx)(z,{})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{onClose:()=>o()},"header"),(0,$.jsx)(Ne,{children:(0,$.jsxs)(bc,{children:[(0,$.jsx)(Zn,{}),(0,$.jsx)(Jn,{})]})}),(0,$.jsx)(S1,{children:"Secure your account with a passkey"}),(0,$.jsx)(ZC,{}),n.length===0?(0,$.jsx)(qC,{}):(0,$.jsx)(T1,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>y(!0)}),(0,$.jsxs)(Gt,{style:{marginTop:"12px"},children:[l&&(0,$.jsx)($C,{fail:!0,children:l}),(0,$.jsx)(O,{onClick:g,loading:i,children:"Add new passkey"})]}),(0,$.jsx)(z,{})]})},bc=$t.default.div`
|
|
1739
|
+
`,GC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"?"Other socials":t&&r&&o.length>0||t&&o.length>0?"Log in with email or socials":r&&o.length>0?"Log in with sms or socials":t&&r?"Continue with email or sms":t?"Continue with email":r?"Continue with sms":"Log in with a social account",VC=({priority:e,email:t,sms:r,social:o})=>e==="web2-first"||o.length>0?(0,ue.jsx)(g1.default,{}):t&&r?(0,ue.jsx)(p1,{}):t?(0,ue.jsx)(h1.default,{}):r?(0,ue.jsx)(y1.default,{}):null,zC=({priority:e})=>e==="web2-first"?"Continue with a wallet":"Other wallets";var Zd=require("react/jsx-runtime"),w1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Zd.jsx)(wc,{connectOnly:!0}):(0,Zd.jsx)(bc,{connectOnly:!0})};var Jd=require("react/jsx-runtime"),b1=()=>{let{app:e}=_();return e.loginMethodsAndOrder&&e.loginMethodsAndOrder.primary.length>0?(0,Jd.jsx)(wc,{connectOnly:!1}):(0,Jd.jsx)(bc,{connectOnly:!1})};var E1=m(require("@heroicons/react/24/outline/EnvelopeIcon"));var Tr=require("react/jsx-runtime"),P1=()=>{let{app:e}=_();return(0,Tr.jsxs)(Tr.Fragment,{children:[(0,Tr.jsx)(S,{},"header"),(0,Tr.jsx)(ce,{}),(0,Tr.jsx)(De,{title:"Connect your email",description:`Add your email to your ${e?.name} account`,icon:(0,Tr.jsx)(E1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,Tr.jsx)(Hr,{children:(0,Tr.jsx)(dc,{stacked:!0})}),(0,Tr.jsx)(ye,{}),(0,Tr.jsx)(V,{protectedByPrivy:!0})]})};var x1=m(require("@heroicons/react/24/outline/ClockIcon")),_1=m(require("@heroicons/react/24/outline/TrashIcon")),k1=m(require("@heroicons/react/24/solid/CheckBadgeIcon")),A1=m(require("@heroicons/react/24/solid/CheckCircleIcon")),R1=m(require("@heroicons/react/24/solid/LockClosedIcon")),Pn=require("react"),$t=m(require("styled-components"));var Qd=require("react/jsx-runtime"),Zn=({style:e,...t})=>(0,Qd.jsx)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...t,children:(0,Qd.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.71369 17.5625V10.375C3.71369 6.44625 6.85845 3.25 10.7238 3.25H17.7953C18.6783 3.25 19.3941 2.52244 19.3941 1.625C19.3941 0.727562 18.6783 0 17.7953 0H10.7238C5.09529 0 0.516113 4.65419 0.516113 10.375V17.5625C0.516113 18.4599 1.23194 19.1875 2.1149 19.1875C2.99787 19.1875 3.71369 18.4599 3.71369 17.5625ZM17.7953 60.7501C18.6783 60.7501 19.3941 61.4777 19.3941 62.3751C19.3941 63.2726 18.6783 64.0001 17.7953 64.0001H10.7238C5.09529 64.0001 0.516113 59.3459 0.516113 53.6251V46.4376C0.516113 45.5402 1.23194 44.8126 2.1149 44.8126C2.99787 44.8126 3.71369 45.5402 3.71369 46.4376V53.6251C3.71369 57.5538 6.85845 60.7501 10.7238 60.7501H17.7953ZM63.4839 46.4376V53.6251C63.4839 59.3459 58.9048 64.0001 53.2763 64.0001H46.2047C45.3217 64.0001 44.6059 63.2726 44.6059 62.3751C44.6059 61.4777 45.3217 60.7501 46.2047 60.7501H53.2763C57.1416 60.7501 60.2864 57.5538 60.2864 53.6251V46.4376C60.2864 45.5402 61.0022 44.8126 61.8851 44.8126C62.7681 44.8126 63.4839 45.5402 63.4839 46.4376ZM63.4839 10.375V17.5625C63.4839 18.4599 62.7681 19.1875 61.8851 19.1875C61.0022 19.1875 60.2864 18.4599 60.2864 17.5625V10.375C60.2864 6.44625 57.1416 3.25 53.2763 3.25H46.2047C45.3217 3.25 44.6059 2.52244 44.6059 1.625C44.6059 0.727562 45.3217 0 46.2047 0H53.2763C58.9048 0 63.4839 4.65419 63.4839 10.375ZM43.0331 47.3022C43.7067 46.6698 43.7483 45.6022 43.1262 44.9176C42.5039 44.233 41.4536 44.1906 40.78 44.823C38.3832 47.0732 35.265 48.3125 31.9997 48.3125C28.7344 48.3125 25.6162 47.0732 23.2194 44.823C22.5457 44.1906 21.4955 44.233 20.8732 44.9176C20.251 45.6022 20.2927 46.6698 20.9663 47.3022C23.9784 50.1301 27.8968 51.6875 31.9997 51.6875C36.1026 51.6875 40.021 50.1301 43.0331 47.3022ZM35.3207 24.1249V36.1249C35.3207 38.5029 33.4173 40.4374 31.0777 40.4374H29.7249C28.8079 40.4374 28.0646 39.6819 28.0646 38.7499C28.0646 37.8179 28.8079 37.0624 29.7249 37.0624H31.0777C31.5863 37.0624 32.0001 36.6419 32.0001 36.1249V24.1249C32.0001 23.1929 32.7434 22.4374 33.6604 22.4374C34.5774 22.4374 35.3207 23.1929 35.3207 24.1249ZM46.7581 28.8437V24.0312C46.7581 23.151 46.056 22.4374 45.19 22.4374C44.324 22.4374 43.622 23.151 43.622 24.0312V28.8437C43.622 29.7239 44.324 30.4374 45.19 30.4374C46.056 30.4374 46.7581 29.7239 46.7581 28.8437ZM17.6109 28.8437C17.6109 29.7239 18.313 30.4374 19.1789 30.4374C20.0449 30.4374 20.747 29.7239 20.747 28.8437V24.0312C20.747 23.151 20.0449 22.4374 19.1789 22.4374C18.313 22.4374 17.6109 23.151 17.6109 24.0312V28.8437Z"})});var _e=require("react/jsx-runtime"),Jn=({style:e,...t})=>(0,_e.jsxs)("svg",{x:0,y:0,width:"65",height:"64",viewBox:"0 0 65 64",style:{height:"64px",width:"65px",...e},xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,_e.jsxs)("g",{clipPath:"url(#clip0_113_33841)",children:[(0,_e.jsx)("path",{d:"M39.1193 0.943398C34.636 -0.174912 29.9185 -0.334713 25.328 0.656273C24.9732 0.732859 24.7477 1.08253 24.8243 1.43729C24.9009 1.79205 25.2506 2.01756 25.6053 1.94097C30.0015 0.991934 34.53 1.14842 38.8375 2.22802C49.1385 4.80983 57.7129 12.5548 60.9786 22.6718C62.2416 26.5843 62.7781 30.7505 62.8855 35.1167C62.8945 35.4795 63.1958 35.7664 63.5586 35.7575C63.9215 35.7485 64.2083 35.4472 64.1994 35.0843C64.0905 30.6582 63.5477 26.3849 62.2536 22.3432C58.8621 11.7515 49.9005 3.63265 39.1193 0.943398Z"}),(0,_e.jsx)("path",{d:"M21.9931 2.93163C22.343 2.83511 22.5484 2.47325 22.4518 2.12339C22.3553 1.77352 21.9935 1.56815 21.6436 1.66466C16.8429 2.98903 10.0898 7.56519 5.91628 13.6786C5.91465 13.681 5.91304 13.6834 5.91145 13.6858C2.24684 19.2083 -0.0503572 26.1484 0.591012 32.8828C0.591623 32.8892 0.592328 32.8956 0.593127 32.902C0.746837 34.1317 1.00488 35.3591 1.26323 36.5879C1.80735 39.1761 2.35282 41.7706 1.92765 44.4064C1.86986 44.7647 2.11347 45.102 2.47177 45.1598C2.83007 45.2176 3.16738 44.974 3.22518 44.6157C3.66961 41.8605 3.11776 39.173 2.56581 36.4851C2.31054 35.2419 2.05525 33.9987 1.89847 32.7486C1.29525 26.3851 3.46802 19.7466 7.00418 14.416C11.0189 8.5373 17.5201 4.16562 21.9931 2.93163Z"}),(0,_e.jsx)("path",{d:"M30.6166 4.39985C38.8671 3.89603 47.1159 7.26314 52.6556 13.7139C52.8921 13.9893 52.8605 14.4042 52.5852 14.6406C52.3099 14.8771 51.895 14.8455 51.6585 14.5702C46.3904 8.43576 38.541 5.23144 30.6927 5.71195C30.6899 5.71212 30.6871 5.71227 30.6843 5.71241C20.7592 6.19265 11.4643 12.9257 8.04547 22.3603C7.92183 22.7016 7.54498 22.8779 7.20375 22.7543C6.86253 22.6306 6.68616 22.2538 6.80981 21.9126C10.4114 11.9735 20.1717 4.90702 30.6166 4.39985Z"}),(0,_e.jsx)("path",{d:"M54.6576 16.5848C54.4553 16.2836 54.047 16.2033 53.7457 16.4057C53.4444 16.608 53.3642 17.0163 53.5665 17.3176C56.6376 21.8904 57.9074 26.8665 58.4094 32.7717C58.4401 33.1333 58.7582 33.4016 59.1199 33.3708C59.4815 33.3401 59.7497 33.022 59.719 32.6604C59.206 26.6261 57.8965 21.4076 54.6576 16.5848Z"}),(0,_e.jsx)("path",{d:"M59.2796 35.4504C59.6419 35.4277 59.9539 35.703 59.9765 36.0653C60.2242 40.0279 60.2265 44.5112 59.7881 47.8243C59.7405 48.1841 59.4102 48.4372 59.0504 48.3896C58.6906 48.342 58.4376 48.0117 58.4852 47.6519C58.9077 44.4586 58.91 40.0704 58.6648 36.1473C58.6421 35.785 58.9174 35.473 59.2796 35.4504Z"}),(0,_e.jsx)("path",{d:"M7.05311 25.5432C7.13829 25.1904 6.92135 24.8354 6.56855 24.7502C6.21576 24.665 5.86071 24.882 5.77553 25.2348C5.2932 27.2325 5.0428 29.2847 5.03288 31.3388C5.02266 33.4559 5.41742 35.5225 5.81234 37.5899C6.1354 39.2811 6.45855 40.9728 6.5602 42.6932C6.69373 44.9531 6.21839 47.2163 5.39698 49.3703C5.26766 49.7094 5.43774 50.0891 5.77685 50.2184C6.11596 50.3477 6.4957 50.1777 6.62502 49.8386C7.49325 47.5617 8.01954 45.1092 7.87221 42.6157C7.77126 40.9071 7.44813 39.2252 7.12512 37.5439C6.73099 35.4925 6.33704 33.442 6.34716 31.3451C6.35659 29.3933 6.59455 27.4425 7.05311 25.5432Z"}),(0,_e.jsx)("path",{d:"M24.2964 10.94C24.4317 11.2768 24.2683 11.6595 23.9315 11.7947C17.1187 14.5307 12.0027 20.7047 10.959 27.9852C10.523 31.0269 10.9941 34.0398 11.465 37.052C11.7303 38.7483 11.9954 40.4443 12.0985 42.1451C12.3221 45.833 11.902 49.8839 9.50192 53.5696C9.30387 53.8737 8.89677 53.9597 8.59264 53.7617C8.28851 53.5636 8.20251 53.1565 8.40056 52.8524C10.5873 49.4944 11.0012 45.7644 10.7867 42.2246C10.6821 40.499 10.4185 38.7833 10.1552 37.0686C9.68265 33.9923 9.21067 30.9195 9.65804 27.7987C10.7724 20.025 16.221 13.4748 23.4417 10.5751C23.7785 10.4399 24.1612 10.6032 24.2964 10.94Z"}),(0,_e.jsx)("path",{d:"M47.3662 14.6814C41.9915 9.64741 34.2017 7.89046 27.122 9.4433C26.7675 9.52105 26.5432 9.87147 26.6209 10.226C26.6987 10.5805 27.0491 10.8048 27.4036 10.7271C34.1075 9.25665 41.4426 10.934 46.4677 15.6406C50.7033 19.6077 53.1628 25.38 53.8066 31.6779C53.8435 32.0389 54.1661 32.3017 54.5272 32.2648C54.8883 32.2279 55.151 31.9053 55.1141 31.5442C54.4456 25.0047 51.8822 18.9111 47.3662 14.6814Z"}),(0,_e.jsx)("path",{d:"M54.9766 34.6738C55.3376 34.6368 55.6604 34.8994 55.6975 35.2604C56.3216 41.337 56.0526 47.9003 55.1104 54.2496C55.0571 54.6086 54.7229 54.8565 54.3639 54.8032C54.0049 54.7499 53.7571 54.4157 53.8103 54.0567C54.7394 47.7957 55.001 41.3439 54.39 35.3947C54.353 35.0336 54.6156 34.7109 54.9766 34.6738Z"}),(0,_e.jsx)("path",{d:"M32.0659 13.3553C21.9959 13.3553 13.814 21.3892 13.814 31.3219C13.814 32.3829 13.9081 33.4225 14.0876 34.4334C14.1511 34.7907 14.4922 35.029 14.8495 34.9655C15.2069 34.9021 15.4451 34.561 15.3817 34.2036C15.2155 33.2677 15.1283 32.305 15.1283 31.3219C15.1283 22.1352 22.7014 14.6696 32.0659 14.6696C36.2978 14.6696 40.1642 16.1949 43.1319 18.7152C43.4086 18.9501 43.8233 18.9163 44.0582 18.6396C44.2931 18.363 44.2593 17.9483 43.9827 17.7134C40.7847 14.9975 36.6188 13.3553 32.0659 13.3553Z"}),(0,_e.jsx)("path",{d:"M45.455 20.1635C45.717 19.9123 46.133 19.921 46.3842 20.183C49.2843 23.2072 50.2126 27.9605 50.8269 31.9494C51.5188 36.4426 51.6244 40.826 51.6244 42.8585C51.6244 43.2214 51.3302 43.5156 50.9673 43.5156C50.6044 43.5156 50.3101 43.2214 50.3101 42.8585C50.3101 40.8589 50.2055 36.5497 49.5279 32.1494C48.9577 28.4462 48.1356 23.9082 45.4356 21.0927C45.1844 20.8307 45.1931 20.4147 45.455 20.1635Z"}),(0,_e.jsx)("path",{d:"M51.4576 46.6219C51.4864 46.2601 51.2165 45.9435 50.8547 45.9146C50.493 45.8858 50.1763 46.1557 50.1474 46.5175C49.8247 50.5654 49.403 54.6088 48.5474 58.3439C48.4663 58.6977 48.6874 59.0502 49.0412 59.1312C49.3949 59.2123 49.7474 58.9912 49.8285 58.6374C50.7067 54.8039 51.134 50.6806 51.4576 46.6219Z"}),(0,_e.jsx)("path",{d:"M15.1454 36.852C15.5015 36.7819 15.847 37.0137 15.9171 37.3698C17.3066 44.4257 16.3467 50.8355 12.6672 56.4502C12.4682 56.7537 12.0609 56.8385 11.7573 56.6396C11.4538 56.4407 11.369 56.0333 11.5679 55.7298C15.0299 50.4469 15.9617 44.3985 14.6276 37.6238C14.5575 37.2677 14.7893 36.9221 15.1454 36.852Z"}),(0,_e.jsx)("path",{d:"M32.0659 17.631C25.5291 17.631 19.1165 22.691 18.462 29.0504C18.1754 31.8345 18.578 34.5769 18.9807 37.3204C19.3323 39.7159 19.684 42.1124 19.5772 44.5381C19.3328 50.0898 17.7039 54.6726 14.905 58.4471C14.6888 58.7386 14.7499 59.1502 15.0414 59.3663C15.333 59.5825 15.7445 59.5214 15.9607 59.2299C18.9293 55.2266 20.6354 50.386 20.8903 44.5959C20.9966 42.1811 20.6438 39.7923 20.2912 37.4051C19.888 34.6752 19.4851 31.9473 19.7694 29.1849C20.3444 23.5983 26.0946 18.9453 32.0659 18.9453C34.851 18.9453 42.057 20.4534 44.3492 27.9205C45.7856 32.5998 46.1774 38.9326 45.8295 45.0849C45.4816 51.2364 44.3994 57.12 42.9442 60.8928C42.8136 61.2314 42.9822 61.6118 43.3208 61.7424C43.6594 61.873 44.0398 61.7044 44.1704 61.3658C45.6929 57.4186 46.7895 51.386 47.1417 45.1591C47.4938 38.9329 47.1068 32.4249 45.6056 27.5348C43.0612 19.2461 35.0851 17.631 32.0659 17.631Z"}),(0,_e.jsx)("path",{d:"M21.9529 56.4512C22.2569 56.6494 22.3426 57.0566 22.1444 57.3606C21.7369 57.9854 21.3784 58.6391 21.0199 59.2928C20.6614 59.9465 20.3028 60.6004 19.8953 61.2253C19.697 61.5293 19.2898 61.615 18.9858 61.4167C18.6819 61.2184 18.5962 60.8113 18.7944 60.5073C19.2019 59.8825 19.5604 59.2288 19.9189 58.5751C20.2774 57.9213 20.636 57.2675 21.0435 56.6426C21.2418 56.3386 21.649 56.2529 21.9529 56.4512Z"}),(0,_e.jsx)("path",{d:"M27.5799 24.4525C27.8816 24.2508 27.9625 23.8426 27.7608 23.541C27.559 23.2393 27.1509 23.1583 26.8492 23.3601C24.247 25.1006 22.6505 27.494 22.6505 31.0002C22.6505 33.088 23.0203 34.7946 23.3997 36.5449C23.9674 39.1641 24.3524 41.7777 24.2832 44.468C24.1992 47.7349 23.56 50.7201 22.3313 53.564C22.1873 53.8971 22.3407 54.2839 22.6739 54.4278C23.0071 54.5718 23.3938 54.4184 23.5378 54.0852C24.8369 51.0784 25.509 47.9266 25.5971 44.5018C25.6689 41.7062 25.2732 38.9892 24.6845 36.267C24.3042 34.509 23.9648 32.9394 23.9648 31.0002C23.9648 27.9961 25.2863 25.9866 27.5799 24.4525Z"}),(0,_e.jsx)("path",{d:"M30.1447 22.1436C32.8717 21.5877 35.8061 22.2746 37.966 24.0228C41.8241 27.1455 42.3372 32.8403 42.753 37.4549L42.7742 37.69C43.3115 43.6385 42.6964 49.4163 41.4575 55.2186C41.3817 55.5736 41.0326 55.7999 40.6776 55.7241C40.3227 55.6483 40.0964 55.2991 40.1722 54.9442C41.3926 49.2288 41.9873 43.5885 41.4652 37.8082C41.4479 37.6169 41.4307 37.4228 41.4133 37.2264L41.4131 37.2235C41.0438 33.0534 40.5812 27.8304 37.1392 25.0444C35.2926 23.5498 32.7599 22.9518 30.4073 23.4314C30.0517 23.5039 29.7046 23.2744 29.6321 22.9188C29.5596 22.5632 29.7891 22.2161 30.1447 22.1436Z"}),(0,_e.jsx)("path",{d:"M40.5287 58.4885C40.6183 58.1368 40.4057 57.7791 40.054 57.6896C39.7023 57.6 39.3446 57.8126 39.2551 58.1643C38.8578 59.7247 38.2456 61.1333 37.4695 62.4301C37.2831 62.7415 37.3844 63.145 37.6958 63.3314C38.0072 63.5178 38.4108 63.4165 38.5972 63.1051C39.4336 61.7075 40.0977 60.1816 40.5287 58.4885Z"}),(0,_e.jsx)("path",{d:"M37.3152 48.9521C37.6756 48.9948 37.9332 49.3215 37.8906 49.682C37.2699 54.9267 35.8688 59.6042 33.6205 63.6613C33.4446 63.9787 33.0446 64.0934 32.7272 63.9175C32.4097 63.7416 32.295 63.3417 32.4709 63.0242C34.6226 59.1416 35.9811 54.6339 36.5854 49.5275C36.6281 49.1671 36.9548 48.9095 37.3152 48.9521Z"}),(0,_e.jsx)("path",{d:"M37.1798 30.6556C36.7242 28.2212 34.6349 26.3591 32.0985 26.3591C28.6638 26.3591 26.254 29.8212 27.1032 33.0422C28.54 38.7279 28.7759 44.2077 27.8032 49.4855L27.8025 49.4893C26.9584 54.228 25.3374 58.4908 23.1263 62.1031C22.9368 62.4127 23.0342 62.8172 23.3437 63.0067C23.6533 63.1962 24.0578 63.0988 24.2473 62.7893C26.5488 59.0292 28.2249 54.6109 29.0961 49.7218C30.106 44.2403 29.8558 38.5684 28.3765 32.7168L28.3748 32.7099C27.7378 30.3005 29.5133 27.6734 32.0985 27.6734C33.9641 27.6734 35.5393 29.0459 35.8871 30.8929C36.8436 36.4411 37.3418 41.5862 36.9871 46.016C36.9581 46.3778 37.2279 46.6945 37.5897 46.7235C37.9515 46.7525 38.2682 46.4827 38.2972 46.1209C38.6649 41.5294 38.1459 36.2576 37.1815 30.6648C37.1809 30.6617 37.1804 30.6586 37.1798 30.6556Z"}),(0,_e.jsx)("path",{d:"M30.1376 59.1171C30.4604 59.283 30.5876 59.6792 30.4217 60.002L28.6804 63.3906C28.5145 63.7134 28.1184 63.8406 27.7956 63.6747C27.4728 63.5088 27.3456 63.1127 27.5114 62.7899L29.2527 59.4013C29.4186 59.0785 29.8147 58.9513 30.1376 59.1171Z"}),(0,_e.jsx)("path",{d:"M32.5872 31.2892C32.5042 30.9359 32.1505 30.7168 31.7972 30.7998C31.4439 30.8828 31.2247 31.2365 31.3077 31.5898C33.5238 41.0232 33.2194 49.3066 30.5201 56.363C30.3905 56.702 30.5602 57.0819 30.8991 57.2115C31.2381 57.3412 31.618 57.1715 31.7477 56.8326C34.5622 49.475 34.8483 40.9141 32.5872 31.2892Z"})]}),(0,_e.jsx)("defs",{children:(0,_e.jsx)("clipPath",{id:"clip0_113_33841",children:(0,_e.jsx)("rect",{width:"64",height:"64",fill:"white",transform:"translate(0.483887)"})})})]});var $=require("react/jsx-runtime"),T1=({passkeys:e,expanded:t,onUnlink:r,onExpand:o})=>{let[n,i]=(0,Pn.useState)([]),a=t?e.length:2,l=c=>c.authenticatorName?c.createdWithBrowser?`${c.authenticatorName} on ${c.createdWithBrowser}`:c.authenticatorName:c.createdWithBrowser?c.createdWithOs?`${c.createdWithBrowser} on ${c.createdWithOs}`:`${c.createdWithBrowser}`:"Unknown device",s=async c=>{i(u=>u.concat([c])),await r(c),i(u=>u.filter(f=>f!==c))};return(0,$.jsxs)("div",{children:[(0,$.jsx)(JC,{children:"Your passkeys"}),(0,$.jsxs)(M1,{children:[e.slice(0,a).map(c=>(0,$.jsxs)(e4,{children:[(0,$.jsxs)("div",{children:[(0,$.jsx)(QC,{children:l(c)}),(0,$.jsxs)(XC,{children:["Last used: ",(c.latestVerifiedAt??c.verifiedAt).toLocaleString()]})]}),(0,$.jsx)(r4,{disabled:n.includes(c.credentialId),onClick:()=>s(c.credentialId),children:n.includes(c.credentialId)?(0,$.jsx)(Uo,{}):(0,$.jsx)(_1.default,{height:"1.6em"})})]},c.credentialId)),e.length>2&&!t&&(0,$.jsx)(jC,{onClick:o,children:"View all"})]})]})},qC=()=>(0,$.jsxs)(M1,{children:[(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(k1.default,{})}),"Log in with Touch ID, Face ID, or a security key."]}),(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(R1.default,{})}),"More secure than a password."]}),(0,$.jsxs)(nr,{children:[(0,$.jsx)(or,{children:(0,$.jsx)(x1.default,{})}),"Takes seconds to set up and use."]})]}),I1=()=>{let{user:e,unlinkPasskey:t}=H(),{linkWithPasskey:r,closePrivyModal:o}=W(),n=e?.linkedAccounts.filter(v=>v.type==="passkey"),[i,a]=(0,Pn.useState)(!1),[l,s]=(0,Pn.useState)(""),[c,u]=(0,Pn.useState)(!1),[f,y]=(0,Pn.useState)(!1);(0,Pn.useEffect)(()=>{n.length===0&&y(!1)},[n.length]);let g=()=>{a(!0),r().then(()=>u(!0)).catch(v=>{if(v instanceof at){if(v.privyErrorCode==="cannot_link_more_of_type"){s("Cannot link more passkeys to account.");return}else if(v.privyErrorCode==="passkey_not_allowed"){s("Passkey request timed out or rejected by user.");return}}s("Unknown error occurred.")}).finally(()=>{a(!1)})},w=async v=>(a(!0),await t(v).then(()=>u(!0)).catch(k=>{if(k instanceof at&&k.privyErrorCode==="missing_or_invalid_mfa"){s("Cannot unlink a passkey enrolled in MFA");return}s("Unknown error occurred.")}).finally(()=>{a(!1)}));return c?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{onClose:()=>o()},"header"),(0,$.jsx)(Ne,{children:(0,$.jsx)(Qe,{status:"success",children:(0,$.jsx)(A1.default,{})})}),(0,$.jsx)(S1,{children:"Passkey added"}),(0,$.jsx)(YC,{children:"From now on, you can use your passkey to log in."}),(0,$.jsx)(Gt,{children:(0,$.jsx)(O,{onClick:()=>o(),children:"Done"})}),(0,$.jsx)(z,{})]}):f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{backFn:()=>y(!1),onClose:()=>o()},"header"),(0,$.jsx)(T1,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>y(!0)}),(0,$.jsx)(z,{})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(S,{onClose:()=>o()},"header"),(0,$.jsx)(Ne,{children:(0,$.jsxs)(Ec,{children:[(0,$.jsx)(Zn,{}),(0,$.jsx)(Jn,{})]})}),(0,$.jsx)(S1,{children:"Secure your account with a passkey"}),(0,$.jsx)(ZC,{}),n.length===0?(0,$.jsx)(qC,{}):(0,$.jsx)(T1,{passkeys:n,expanded:f,onUnlink:w,onExpand:()=>y(!0)}),(0,$.jsxs)(Gt,{style:{marginTop:"12px"},children:[l&&(0,$.jsx)($C,{fail:!0,children:l}),(0,$.jsx)(O,{onClick:g,loading:i,children:"Add new passkey"})]}),(0,$.jsx)(z,{})]})},Ec=$t.default.div`
|
|
1740
1740
|
display: flex;
|
|
1741
1741
|
align-items: center;
|
|
1742
1742
|
justify-content: center;
|
|
@@ -1857,7 +1857,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1857
1857
|
}
|
|
1858
1858
|
`,r4=$t.default.button`
|
|
1859
1859
|
${t4}
|
|
1860
|
-
`;var W1=m(require("@heroicons/react/24/outline/PhoneIcon"));var
|
|
1860
|
+
`;var W1=m(require("@heroicons/react/24/outline/PhoneIcon"));var Sr=require("react/jsx-runtime"),L1=()=>{let{app:e,currentScreen:t,data:r,navigate:o,setModalData:n}=_(),{initLoginWithSms:i}=W();async function a({qualifiedPhoneNumber:l}){try{await i(l),o("AWAITING_PASSWORDLESS_CODE")}catch(s){n({errorModalData:{error:s,previousScreen:r?.errorModalData?.previousScreen||t||"LINK_PHONE_SCREEN"}}),o("ERROR_SCREEN")}}return(0,Sr.jsxs)(Sr.Fragment,{children:[(0,Sr.jsx)(S,{},"header"),(0,Sr.jsx)(ce,{}),(0,Sr.jsx)(De,{title:"Connect your phone",description:`Add your number to your ${e?.name} account`,icon:(0,Sr.jsx)(W1.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"40px",width:"40px"})}),(0,Sr.jsx)(Hr,{children:(0,Sr.jsx)(ta,{stacked:!0,onSubmit:a})}),(0,Sr.jsx)(ye,{}),(0,Sr.jsx)(V,{protectedByPrivy:!0})]})};var xo=require("react/jsx-runtime"),O1=()=>{let{linkingHint:e}=W(),{app:t}=_(),r=e?`Select the wallet with ${nn(e)} and follow the instructions to reconnect your wallet${t?.name?` to ${t.name}.`:"."}`:`Link a wallet to your ${t?.name} account`;return(0,xo.jsxs)(xo.Fragment,{children:[(0,xo.jsx)(S,{},"header"),(0,xo.jsx)(wo,{title:`${e?"Reconnect":"Connect"} your wallet`,description:r}),(0,xo.jsx)(to,{children:(0,xo.jsx)(Wi,{connectOnly:!1})}),(0,xo.jsx)(V,{protectedByPrivy:!0})]})};var Ya=require("react/jsx-runtime"),N1=({style:e,...t})=>(0,Ya.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,Ya.jsx)("circle",{cx:"82",cy:"82",r:"80",stroke:"#EC6351","stroke-width":"4","stroke-linecap":"round"}),(0,Ya.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M81.9999 100.788C93.3288 100.788 102.513 91.6043 102.513 80.2754C102.513 68.9465 93.3288 59.7626 81.9999 59.7626C70.671 59.7626 61.4871 68.9465 61.4871 80.2754C61.4871 91.6043 70.671 100.788 81.9999 100.788ZM88.3236 71.8304C88.9093 71.2446 89.8591 71.2446 90.4449 71.8304C91.0307 72.4161 91.0307 73.3659 90.4449 73.9517L84.121 80.2756L90.445 86.5996C91.0308 87.1854 91.0308 88.1351 90.445 88.7209C89.8592 89.3067 88.9095 89.3067 88.3237 88.7209L81.9997 82.3969L75.6756 88.7209C75.0899 89.3067 74.1401 89.3067 73.5543 88.7209C72.9685 88.1351 72.9685 87.1854 73.5543 86.5996L79.8783 80.2756L73.5544 73.9517C72.9686 73.3659 72.9686 72.4161 73.5544 71.8304C74.1402 71.2446 75.09 71.2446 75.6758 71.8304L81.9997 78.1543L88.3236 71.8304Z",fill:"#EC6351"})]});var lr=require("react/jsx-runtime"),D1=()=>{let{closePrivyModal:e}=W(),{navigate:t}=_();return(0,lr.jsxs)(lr.Fragment,{children:[(0,lr.jsx)(S,{},"header"),(0,lr.jsx)(ce,{}),(0,lr.jsx)(N1,{style:{width:"160px",height:"160px",margin:"0 auto 20px"}}),(0,lr.jsx)(wo,{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,lr.jsxs)(Hr,{children:[(0,lr.jsx)(O,{onClick:()=>t("LANDING"),children:"Try again"}),(0,lr.jsx)(eo,{onClick:()=>e(),children:"Cancel"})]}),(0,lr.jsx)(ye,{}),(0,lr.jsx)(V,{protectedByPrivy:!0})]})};var ug=m(require("@heroicons/react/24/solid/CheckBadgeIcon")),mg=m(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),fg=m(require("@heroicons/react/24/solid/IdentificationIcon")),hg=m(require("@heroicons/react/24/solid/PhoneIcon")),yg=m(require("@heroicons/react/24/solid/QuestionMarkCircleIcon")),op=m(require("@heroicons/react/24/solid/ShieldCheckIcon")),jo=require("react");var U1=require("react");function oa(){let{promptMfa:e,init:t,submit:r,cancel:o}=(0,U1.useContext)(xe);return{promptMfa:e,init:t,submit:r,cancel:o}}var F1=require("react");function $r(){let{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenroll:a,enrollInMfa:l}=(0,F1.useContext)(xe);return{initEnrollmentWithSms:e,initEnrollmentWithTotp:t,initEnrollmentWithPasskey:r,submitEnrollmentWithSms:o,submitEnrollmentWithTotp:n,submitEnrollmentWithPasskey:i,unenrollWithSms:()=>a("sms"),unenrollWithTotp:()=>a("totp"),unenrollWithPasskey:()=>a("passkey"),showMfaEnrollmentModal:()=>l(!0),closeMfaEnrollmentModal:()=>l(!1)}}var B1=m(require("styled-components")),Za=require("react/jsx-runtime"),H1=e=>(0,Za.jsxs)(o4,{xmlns:"http://www.w3.org/2000/svg",fill:"none",width:"88",height:"89",viewBox:"0 0 88 89",...e,children:[(0,Za.jsx)("rect",{y:"0.666016",width:"88",height:"88",rx:"44"}),(0,Za.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M45.2463 20.9106C44.5473 20.2486 43.4527 20.2486 42.7537 20.9106C37.8798 25.5263 31.3034 28.3546 24.0625 28.3546C23.9473 28.3546 23.8323 28.3539 23.7174 28.3525C22.9263 28.3427 22.2202 28.8471 21.9731 29.5987C20.9761 32.6311 20.4375 35.8693 20.4375 39.2297C20.4375 53.5896 30.259 65.651 43.5482 69.0714C43.8446 69.1477 44.1554 69.1477 44.4518 69.0714C57.741 65.651 67.5625 53.5896 67.5625 39.2297C67.5625 35.8693 67.0239 32.6311 66.0269 29.5987C65.7798 28.8471 65.0737 28.3427 64.2826 28.3525C64.1677 28.3539 64.0527 28.3546 63.9375 28.3546C56.6966 28.3546 50.1202 25.5263 45.2463 20.9106ZM52.7249 40.2829C53.3067 39.4683 53.1181 38.3363 52.3035 37.7545C51.4889 37.1726 50.3569 37.3613 49.7751 38.1759L41.9562 49.1223L38.0316 45.1977C37.3238 44.4899 36.1762 44.4899 35.4684 45.1977C34.7605 45.9056 34.7605 47.0532 35.4684 47.761L40.9059 53.1985C41.2826 53.5752 41.806 53.7671 42.337 53.7232C42.868 53.6792 43.3527 53.4039 43.6624 52.9704L52.7249 40.2829Z"})]}),o4=B1.default.svg`
|
|
1861
1861
|
height: 90px;
|
|
1862
1862
|
width: 90px;
|
|
1863
1863
|
|
|
@@ -1868,7 +1868,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1868
1868
|
> path {
|
|
1869
1869
|
fill: white;
|
|
1870
1870
|
}
|
|
1871
|
-
`;var
|
|
1871
|
+
`;var Pc=m(require("@heroicons/react/20/solid/CheckIcon")),G1=m(require("@heroicons/react/24/outline/ChevronRightIcon")),V1=m(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),z1=m(require("@heroicons/react/24/outline/FingerPrintIcon")),q1=m(require("@heroicons/react/24/outline/PhoneIcon")),Tc=m(require("@heroicons/react/24/outline/TrashIcon")),$1=m(require("@heroicons/react/24/solid/ShieldCheckIcon"));var Q=require("react/jsx-runtime"),K1=({showIntro:e,userMfaMethods:t,appMfaMethods:r,userHasAuthSms:o,isTotpLoading:n,isPasskeyLoading:i,error:a,onClose:l,onBackToIntro:s,handleSelectMethod:c,setRemovingMfaMethod:u})=>{let f=t.reduce((g,w)=>({...g,[w]:!0}),{}),y=r.reduce((g,w)=>({...g,[w]:!0}),{});return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{backFn:e?s:void 0,onClose:l},"header"),(0,Q.jsx)(Ne,{children:(0,Q.jsx)(Qe,{children:(0,Q.jsx)($1.default,{})})}),(0,Q.jsx)(he,{children:"Choose a verification method"}),t.length>0?(0,Q.jsx)(ge,{children:"To add or delete verification methods, verification is required."}):(0,Q.jsx)(ge,{children:"How would you like to verify your identity? You can change this later."}),a&&(0,Q.jsx)(Gl,{style:{marginTop:"1.25rem"},children:a.message}),(0,Q.jsxs)(Dl,{children:[(y.totp||f.totp)&&(0,Q.jsxs)(Ul,{children:[(0,Q.jsx)(je,{style:{justifyContent:"center"},disabled:f.totp||n,onClick:()=>c("totp"),children:n?(0,Q.jsx)(Et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,Q.jsxs)(Hl,{children:[(0,Q.jsxs)(Bl,{children:[(0,Q.jsx)(V1.default,{}),"Authenticator App"]}),f.totp?(0,Q.jsxs)($n,{children:[(0,Q.jsx)(Pc.default,{}),"Added"]}):(0,Q.jsx)($n,{children:"Recommended"})]})}),f.totp&&(0,Q.jsx)(Fl,{onClick:()=>u("totp"),children:(0,Q.jsx)(Tc.default,{})})]},"totp"),(y.sms||f.sms)&&(0,Q.jsxs)(Ul,{children:[(0,Q.jsx)(je,{disabled:f.sms||o,onClick:()=>c("sms"),children:(0,Q.jsxs)(Hl,{children:[(0,Q.jsxs)(Bl,{children:[(0,Q.jsx)(q1.default,{}),"SMS"]}),f.sms&&(0,Q.jsxs)($n,{children:[(0,Q.jsx)(Pc.default,{}),"Added"]}),o&&(0,Q.jsx)($n,{children:"Disabled"})]})}),f.sms&&(0,Q.jsx)(Fl,{onClick:()=>u("sms"),children:(0,Q.jsx)(Tc.default,{})})]},"sms"),(y.passkey||f.passkey)&&(0,Q.jsxs)(Ul,{children:[(0,Q.jsx)(je,{style:{justifyContent:"center"},onClick:()=>c("passkey"),disabled:f.passkey||i,children:i?(0,Q.jsx)(Et,{style:{height:24,width:24,borderWidth:2},color:"var(--privy-color-foreground-3)"}):(0,Q.jsxs)(Hl,{children:[(0,Q.jsxs)(Bl,{children:[(0,Q.jsx)(z1.default,{}),"Passkey"]}),f.passkey?(0,Q.jsxs)($n,{children:[(0,Q.jsx)(Pc.default,{}),"Added"]}):(0,Q.jsx)($n,{isAccent:!0,children:(0,Q.jsx)(G1.default,{})})]})}),f.passkey&&(0,Q.jsx)(Fl,{onClick:()=>u("passkey"),children:(0,Q.jsx)(Tc.default,{})})]},"passkey")]}),(0,Q.jsx)(z,{})]})};var Y1=m(require("@heroicons/react/24/outline/ArrowRightEndOnRectangleIcon")),Z1=m(require("@heroicons/react/24/outline/ClockIcon")),J1=m(require("@heroicons/react/24/outline/ShieldCheckIcon")),Q1=m(require("@heroicons/react/24/solid/CheckCircleIcon")),Tn=require("react"),Ja=m(require("styled-components"));var K=require("react/jsx-runtime"),X1=({onComplete:e,onClose:t,onReset:r})=>{let{user:o}=H(),{data:n}=_(),{initLinkWithPasskey:i,linkWithPasskey:a}=W(),{initEnrollmentWithPasskey:l,submitEnrollmentWithPasskey:s}=$r(),[c,u]=(0,Tn.useState)(!1),[f,y]=(0,Tn.useState)(!1),[g,w]=(0,Tn.useState)(!1),[v,k]=(0,Tn.useState)(null),P=(0,Tn.useMemo)(()=>o?.linkedAccounts.filter(N=>N.type==="passkey")??[],[o]),b=()=>{n?.mfaEnrollmentFlow?.onSuccess(),e()},A=async N=>{u(!0);try{await l(),await s({credentialIds:N}),w(!0)}catch(L){k(L)}finally{u(!1)}},R=async()=>{y(!0),k(null);try{await i();let L=(await a())?.linkedAccounts.filter(I=>I.type==="passkey").map(I=>I.credentialId)??[];await A(L)}catch(N){k(N)}finally{y(!1)}};return P.length===0||f?(0,K.jsx)(n4,{onReset:r,onClose:t,onClick:R,isCreating:f}):g?(0,K.jsx)(a4,{onClick:b,onClose:b}):v?(0,K.jsx)(Ba,{error:v,backFn:()=>k(null),onClick:()=>k(null)}):(0,K.jsx)(i4,{passkeys:P,isSubmitting:c,isCreating:f,onReset:r,onClose:t,onSubmitEnrollment:()=>A(P.map(N=>N.credentialId)),onAddPasskey:R})},n4=({onReset:e,onClose:t,onClick:r,isCreating:o})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(S,{backFn:e,onClose:t},"header"),(0,K.jsx)(Ne,{children:(0,K.jsxs)(Ec,{children:[(0,K.jsx)(Zn,{}),(0,K.jsx)(Jn,{})]})}),(0,K.jsx)(he,{children:"Set up paskey verification"}),(0,K.jsxs)(qn,{children:[(0,K.jsxs)(nr,{children:[(0,K.jsx)(or,{children:(0,K.jsx)(J1.default,{})}),"Verify with Touch ID, Face ID, PIN, or hardware key"]}),(0,K.jsxs)(nr,{children:[(0,K.jsx)(or,{children:(0,K.jsx)(Z1.default,{})}),"Takes seconds to set up and use"]}),(0,K.jsxs)(nr,{children:[(0,K.jsx)(or,{children:(0,K.jsx)(Y1.default,{})}),"Use your passkey to verify transactions and login to your account"]})]}),(0,K.jsx)(O,{style:{marginTop:"2.25rem"},onClick:r,loading:o,children:"Add a new passkey"}),(0,K.jsx)(z,{})]}),i4=({onReset:e,onClose:t,onAddPasskey:r,onSubmitEnrollment:o,passkeys:n,isSubmitting:i,isCreating:a})=>{let[l,s]=(0,Tn.useState)(!1),c=l?n.length:n.length>3?2:3;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(S,{backFn:l?()=>s(!1):e,onClose:t},"header"),!l&&(0,K.jsx)(Ne,{children:(0,K.jsxs)(Ec,{children:[(0,K.jsx)(Zn,{}),(0,K.jsx)(Jn,{})]})}),(0,K.jsx)(he,{children:"Enable your passkeys for verification"}),(0,K.jsxs)(qn,{children:[n.slice(0,c).map(u=>(0,K.jsxs)(s4,{children:[(0,K.jsx)(l4,{children:d4(u)}),(0,K.jsxs)(c4,{children:["Last used: ",u.latestVerifiedAt?.toLocaleString()]})]},u.credentialId)),!l&&n.length>3&&(0,K.jsx)(j1,{onClick:()=>s(!0),children:"View All"})]}),(0,K.jsx)(O,{style:{marginTop:"1.5rem"},onClick:o,loading:i,children:"Enable passkeys"}),n.length<5&&(0,K.jsx)(j1,{style:{marginTop:"0.5rem"},onClick:r,disabled:a,children:a?(0,K.jsx)(Et,{style:{height:"1rem",width:"1rem",borderWidth:2}}):"Add new passkey"}),(0,K.jsx)(z,{})]})},a4=({onClick:e,onClose:t})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(S,{onClose:t},"header"),(0,K.jsx)(Ne,{children:(0,K.jsx)(Qe,{status:"success",children:(0,K.jsx)(Q1.default,{})})}),(0,K.jsx)(he,{children:"Passkey verification added"}),(0,K.jsx)(ge,{children:"From now on, you'll use the passkey whenever you use your Privy wallet."}),(0,K.jsx)(Gt,{children:(0,K.jsx)(O,{onClick:e,children:"Done"})}),(0,K.jsx)(z,{})]}),s4=Ja.default.div`
|
|
1872
1872
|
&& {
|
|
1873
1873
|
padding: 0.75rem 1rem;
|
|
1874
1874
|
text-align: left;
|
|
@@ -1876,19 +1876,19 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1876
1876
|
border: 1px solid var(--privy-color-foreground-4);
|
|
1877
1877
|
width: 100%;
|
|
1878
1878
|
}
|
|
1879
|
-
`,l4=
|
|
1879
|
+
`,l4=Ja.default.div`
|
|
1880
1880
|
font-size: 0.875rem;
|
|
1881
1881
|
line-height: 1.375rem;
|
|
1882
1882
|
font-weight: 500;
|
|
1883
1883
|
|
|
1884
1884
|
color: var(--privy-color-foreground-1);
|
|
1885
|
-
`,c4=
|
|
1885
|
+
`,c4=Ja.default.div`
|
|
1886
1886
|
font-size: 0.75rem;
|
|
1887
1887
|
font-weight: 400;
|
|
1888
1888
|
line-height: 1.125rem;
|
|
1889
1889
|
|
|
1890
1890
|
color: var(--privy-color-foreground-2);
|
|
1891
|
-
`,d4=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",j1=
|
|
1891
|
+
`,d4=e=>e.authenticatorName?e.createdWithBrowser?`${e.authenticatorName} on ${e.createdWithBrowser}`:e.authenticatorName:e.createdWithBrowser?e.createdWithOs?`${e.createdWithBrowser} on ${e.createdWithOs}`:`${e.createdWithBrowser}`:"Unknown device",j1=Ja.default.button`
|
|
1892
1892
|
&& {
|
|
1893
1893
|
width: 100%;
|
|
1894
1894
|
font-size: 0.875rem;
|
|
@@ -1913,7 +1913,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
1913
1913
|
box-shadow: none;
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
|
-
`;var ng=m(require("@heroicons/react/24/solid/CheckCircleIcon")),tp=m(require("@heroicons/react/24/solid/PhoneIcon")),
|
|
1916
|
+
`;var ng=m(require("@heroicons/react/24/solid/CheckCircleIcon")),tp=m(require("@heroicons/react/24/solid/PhoneIcon")),Xa=require("react");var xc=require("react"),og=require("react-device-detect"),ep=m(require("styled-components"));var Qn=require("@headlessui/react"),Sc=m(require("react")),Xn=m(require("styled-components")),Ko=require("react/jsx-runtime"),eg=({children:e,open:t,onClick:r,...o})=>(0,Ko.jsx)(Qn.Transition,{show:t,as:Sc.default.Fragment,children:(0,Ko.jsxs)(Qn.Dialog,{onClose:r,...o,as:u4,children:[(0,Ko.jsx)(Qn.Transition.Child,{as:Sc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Ko.jsx)(p4,{id:"privy-dialog-backdrop","aria-hidden":"true"})}),(0,Ko.jsx)(m4,{children:(0,Ko.jsx)(Qn.Transition.Child,{as:Sc.default.Fragment,enterFrom:"entering",leaveTo:"leaving",children:(0,Ko.jsx)(Qn.Dialog.Panel,{as:f4,children:e})})})]})}),na=Xn.default.div`
|
|
1917
1917
|
display: flex;
|
|
1918
1918
|
flex-direction: column;
|
|
1919
1919
|
text-align: center;
|
|
@@ -2013,7 +2013,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2013
2013
|
align-items: center;
|
|
2014
2014
|
justify-content: center;
|
|
2015
2015
|
height: 100%;
|
|
2016
|
-
`;var _o=require("react/jsx-runtime"),
|
|
2016
|
+
`;var _o=require("react/jsx-runtime"),Qa=6,h4=new Array(Qa).fill("");function y4(e){return e.replace(/\s+/g,"")}function Xd(e){return/^[0-9]{1}$/.test(e)}function rg(e){return e.length===Qa&&e.every(Xd)}function g4(e,t){return e.reduce((r,o)=>r+Number(t(o)),0)}var ei=({onChange:e,disabled:t,errorReasonOverride:r,success:o})=>{let[n,i]=(0,xc.useState)(h4),[a,l]=(0,xc.useState)(null),[s,c]=(0,xc.useState)(null),u=async w=>{w.preventDefault();let v=y4(w.currentTarget.value);if(v==="")return;let k=g4(n,Xd),P=v.split(""),b=!P.every(Xd),A=P.length+k>Qa;if(b){l("Passcode can only be numbers"),c(1);return}if(A){l("Passcode must be exactly 6 numbers"),c(1);return}l(null),c(null);let R=Number(w.currentTarget.name?.charAt(4)),N=[...v||[""]].slice(0,Qa-R),L=[...n.slice(0,R),...N,...n.slice(R+N.length)];i(L);let I=N.length,q=Math.min(Math.max(R+I,0),Qa-1);if(document.querySelector(`input[name=pin-${q}]`)?.focus(),rg(L))try{await e(L.join("")),document.querySelector(`input[name=pin-${q}]`)?.blur()}catch(j){c(1),l(j.message)}else try{await e(null)}catch(j){c(1),l(j.message)}},f=w=>{s===1&&(l(null),c(null));let v=[...n.slice(0,w),"",...n.slice(w+1)];i(v),w>0&&document.querySelector(`input[name=pin-${w-1}]`)?.focus(),rg(v)?e(v.join("")):e(null)},g=o?"success":!!(r||a)?"fail":"";return(0,_o.jsx)(_o.Fragment,{children:(0,_o.jsxs)(v4,{children:[(0,_o.jsx)("div",{children:n.map((w,v)=>(0,_o.jsx)("input",{name:`pin-${v}`,type:"text",value:n[v],onChange:u,onKeyUp:k=>{k.key==="Backspace"&&f(v)},inputMode:"numeric",autoFocus:v===0,pattern:"[0-9]",className:g,autoComplete:og.isMobile?"one-time-code":"off",disabled:t},v))}),(0,_o.jsx)("div",{children:(0,_o.jsx)(C4,{fail:!!r||!!a,children:r||a})})]})})},v4=ep.default.div`
|
|
2017
2017
|
display: flex;
|
|
2018
2018
|
flex-direction: column;
|
|
2019
2019
|
width: 100%;
|
|
@@ -2092,7 +2092,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2092
2092
|
width: 100%;
|
|
2093
2093
|
|
|
2094
2094
|
color: ${e=>e.fail?"var(--privy-color-error)":"var(--privy-color-foreground-3)"};
|
|
2095
|
-
`;var pe=require("react/jsx-runtime"),ig=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,Qa.useState)(""),[i,a]=(0,Qa.useState)(!1),[l,s]=(0,Qa.useState)(null),[c,u]=(0,Qa.useState)("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:y}=qr(),{app:g,data:w}=_();function v(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function k({qualifiedPhoneNumber:A}){try{await f({phoneNumber:A}),n(A),u("verify")}catch(R){s(R)}}async function P(A){try{if(!A)return;await y({phoneNumber:o,mfaCode:A}),a(!0)}catch(R){throw Kl(R)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(R)?new Error("The code you entered is not valid"):mn(R)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):jl(R)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return l?(0,pe.jsx)(Fa,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{backFn:t,onClose:r},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{children:(0,pe.jsx)(tp.default,{})})}),(0,pe.jsx)(he,{children:"Set up SMS verification"}),(0,pe.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,pe.jsxs)(Fr,{children:[(0,pe.jsx)(ta,{onSubmit:k}),(0,pe.jsxs)(of,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,pe.jsx)(z,{})]}):i?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{onClose:v},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{status:"success",children:(0,pe.jsx)(ng.default,{})})}),(0,pe.jsx)(he,{children:"SMS verification added"}),(0,pe.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,pe.jsx)(Gt,{children:(0,pe.jsx)(O,{onClick:v,children:"Done"})}),(0,pe.jsx)(z,{})]}):(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{backFn:b,onClose:r},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{children:(0,pe.jsx)(tp.default,{})})}),(0,pe.jsx)(he,{children:"Enter enrollment code"}),(0,pe.jsxs)(Fr,{children:[(0,pe.jsx)(ei,{onChange:P}),(0,pe.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,pe.jsx)("strong",{children:e1(o)})]})]}),(0,pe.jsx)(z,{})]})};var cg=m(require("@heroicons/react/24/solid/CheckCircleIcon")),dg=m(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),rp=require("react");var ag=m(require("@heroicons/react/24/solid/ShieldCheckIcon"));var lg=require("react/jsx-runtime");var sg=({size:e,authUrl:t})=>(0,lg.jsx)(Zi,{url:t,squareLogoElement:ag.default,size:e,fgColor:"#1F1F1F"});var me=require("react/jsx-runtime"),pg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=(0,rp.useState)("enroll"),[a,l]=(0,rp.useState)(!1),{submitEnrollmentWithTotp:s}=qr(),{data:c}=_();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function y(w){try{if(!w)return;await s({mfaCode:w}),l(!0)}catch(v){throw Kl(v)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(v)?new Error("The code you entered is not valid"):mn(v)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):jl(v)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{backFn:r,onClose:t},"header"),(0,me.jsx)(he,{children:"Scan QR code"}),(0,me.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,me.jsx)(Ii,{children:(0,me.jsx)(sg,{authUrl:o.authUrl,size:200})}),(0,me.jsxs)(Gt,{children:[(0,me.jsx)(Jt,{children:(0,me.jsx)(wn,{itemName:"secret",text:o.secret})}),(0,me.jsx)(O,{onClick:f,children:"Continue"})]}),(0,me.jsx)(z,{})]}):a?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{onClose:u},"header"),(0,me.jsx)(Ne,{children:(0,me.jsx)(Qe,{status:"success",children:(0,me.jsx)(cg.default,{})})}),(0,me.jsx)(he,{children:"Authenticator app verification added"}),(0,me.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,me.jsx)(Gt,{children:(0,me.jsx)(O,{onClick:u,children:"Done"})}),(0,me.jsx)(z,{})]}):(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{backFn:g,onClose:t},"header"),(0,me.jsx)(Ne,{children:(0,me.jsx)(Qe,{children:(0,me.jsx)(dg.default,{})})}),(0,me.jsx)(he,{children:"Enter enrollment code"}),(0,me.jsx)(Fr,{children:(0,me.jsx)(ei,{onChange:y})}),(0,me.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,me.jsx)("strong",{children:"authenticator app"})]}),(0,me.jsx)(z,{})]})};var F=require("react/jsx-runtime"),gg=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=(0,jo.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=qr(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=_(),{closePrivyModal:f}=W(),{promptMfa:y}=oa(),{initEnrollmentWithTotp:g}=qr(),[w,v]=(0,jo.useState)(!1),[k,P]=(0,jo.useState)(null),[b,A]=(0,jo.useState)(null),R=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),P(null)},500)},{initEnrollmentWithPasskey:N,submitEnrollmentWithPasskey:L}=qr(),[I,q]=(0,jo.useState)(!1),[J,j]=(0,jo.useState)(null);u.current=R;let M=e?.mfaMethods.includes("sms"),ne=!!e?.phone,B=e?.mfaMethods.includes("totp"),be=e?.mfaMethods.includes("passkey"),fe=M||B||be,ve=e?.linkedAccounts.filter(pt=>pt.type==="passkey").map(pt=>pt.credentialId)??[];(0,jo.useEffect)(()=>{fe&&v(!0)},[fe]);function Ee(){o(null),P(null)}function ae(){v(!1)}async function It(){q(!0);try{await N(),await L({credentialIds:ve})}catch(pt){j(pt)}finally{q(!1)}}async function Mt(pt){if(await y().catch(j),pt==="totp"){P(pt),A(null),g().then(Rr=>{A(Rr)}).catch(()=>{A(null),Ee()});return}if(pt==="passkey"&&ve.length===1)return await It();P(pt)}if(!s||!e||!l)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(H1,{})}),(0,F.jsx)(Fr,{children:(0,F.jsx)(Et,{})}),(0,F.jsx)(z,{})]});async function er(){o(null);try{await n()}catch{o(null)}}async function wt(){o(null);try{await i()}catch{o(null)}}async function Ar(){o(null);try{await y(),await a()}catch{o(null)}}if(r==="sms")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(hg.default,{})})}),(0,F.jsx)(he,{children:"Remove SMS verification?"}),(0,F.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:er,children:"Remove SMS for MFA"})}),(0,F.jsx)(z,{})]});if(r==="totp")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(mg.default,{})})}),(0,F.jsx)(he,{children:"Remove Authenticator App verification?"}),(0,F.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:wt,children:"Remove Authenticator App for MFA"})}),(0,F.jsx)(z,{})]});if(r==="passkey")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(yg.default,{})})}),(0,F.jsx)(he,{children:"Are you sure you want to remove passkey verification?"}),(0,F.jsx)(ge,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:Ar,children:"Yes, remove"})}),(0,F.jsx)(z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!fe)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(op.default,{})})}),(0,F.jsx)(he,{children:"Add more security"}),(0,F.jsxs)(ge,{children:[l?.name," does not have any verification methods enabled."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{onClick:R,children:"Close"})}),(0,F.jsx)(z,{})]});let qe=!fe&&!w;return qe?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(op.default,{})})}),(0,F.jsx)(he,{children:"Transaction Protection"}),(0,F.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,F.jsxs)(qn,{children:[(0,F.jsxs)(nr,{children:[(0,F.jsx)(or,{children:(0,F.jsx)(ug.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,F.jsxs)(nr,{children:[(0,F.jsx)(or,{children:(0,F.jsx)(fg.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,F.jsxs)(Gt,{children:[(0,F.jsx)(O,{onClick:()=>v(!0),children:"Continue"}),(0,F.jsx)(eo,{onClick:R,children:"Not now"})]}),(0,F.jsx)(z,{})]}):k==="sms"?(0,F.jsx)(ig,{onComplete:R,onReset:Ee,onClose:R}):k==="totp"&&b?(0,F.jsx)(pg,{onComplete:R,onClose:R,onReset:Ee,totpInfo:b}):k==="passkey"?(0,F.jsx)(X1,{onComplete:R,onReset:Ee,onClose:R}):(0,F.jsx)(K1,{showIntro:qe,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:ne,onBackToIntro:ae,handleSelectMethod:Mt,isTotpLoading:k==="totp"&&!b,isPasskeyLoading:I,error:J,onClose:R,setRemovingMfaMethod:o})};var n2=m(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),i2=m(require("@heroicons/react/24/outline/FingerPrintIcon")),a2=m(require("@heroicons/react/24/outline/PhoneIcon")),s2=m(require("@heroicons/react/24/outline/ShieldCheckIcon")),l2=m(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),c2=m(require("@heroicons/react/24/solid/PhoneIcon")),xn=require("react");var oi=require("react"),Xg=m(require("styled-components"));var dp=m(require("styled-components"));var np=m(require("styled-components")),Xa=require("react/jsx-runtime"),xc=({label:e,children:t,valueStyles:r})=>(0,Xa.jsxs)(w4,{children:[(0,Xa.jsx)("div",{children:e}),(0,Xa.jsx)(b4,{style:{...r},children:t})]}),w4=np.default.div`
|
|
2095
|
+
`;var pe=require("react/jsx-runtime"),ig=({onComplete:e,onReset:t,onClose:r})=>{let[o,n]=(0,Xa.useState)(""),[i,a]=(0,Xa.useState)(!1),[l,s]=(0,Xa.useState)(null),[c,u]=(0,Xa.useState)("enroll"),{initEnrollmentWithSms:f,submitEnrollmentWithSms:y}=$r(),{app:g,data:w}=_();function v(){w?.mfaEnrollmentFlow?.onSuccess(),e()}async function k({qualifiedPhoneNumber:A}){try{await f({phoneNumber:A}),n(A),u("verify")}catch(R){s(R)}}async function P(A){try{if(!A)return;await y({phoneNumber:o,mfaCode:A}),a(!0)}catch(R){throw jl(R)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(R)?new Error("The code you entered is not valid"):mn(R)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Yl(R)?new Error("Verification canceled"):new Error("Unknown error")}}function b(){c==="verify"?u("enroll"):t()}return l?(0,pe.jsx)(Ba,{error:l,backFn:()=>s(null),onClick:()=>s(null)}):c==="enroll"?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{backFn:t,onClose:r},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{children:(0,pe.jsx)(tp.default,{})})}),(0,pe.jsx)(he,{children:"Set up SMS verification"}),(0,pe.jsx)(ge,{children:"We'll text a verification code to this mobile device whenever you use your Privy wallet."}),(0,pe.jsxs)(Br,{children:[(0,pe.jsx)(ta,{onSubmit:k}),(0,pe.jsxs)(of,{children:["By providing your mobile number, you agree to receive text messages from ",g?.name,". Some carrier charges may apply"]})]}),(0,pe.jsx)(z,{})]}):i?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{onClose:v},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{status:"success",children:(0,pe.jsx)(ng.default,{})})}),(0,pe.jsx)(he,{children:"SMS verification added"}),(0,pe.jsx)(ge,{children:"From now on, you'll enter the verification code sent to your mobile device whenever you use your Privy wallet."}),(0,pe.jsx)(Gt,{children:(0,pe.jsx)(O,{onClick:v,children:"Done"})}),(0,pe.jsx)(z,{})]}):(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(S,{backFn:b,onClose:r},"header"),(0,pe.jsx)(Ne,{children:(0,pe.jsx)(Qe,{children:(0,pe.jsx)(tp.default,{})})}),(0,pe.jsx)(he,{children:"Enter enrollment code"}),(0,pe.jsxs)(Br,{children:[(0,pe.jsx)(ei,{onChange:P}),(0,pe.jsxs)(ge,{children:["To continue, enter the 6-digit code sent to ",(0,pe.jsx)("strong",{children:e1(o)})]})]}),(0,pe.jsx)(z,{})]})};var cg=m(require("@heroicons/react/24/solid/CheckCircleIcon")),dg=m(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),rp=require("react");var ag=m(require("@heroicons/react/24/solid/ShieldCheckIcon"));var lg=require("react/jsx-runtime");var sg=({size:e,authUrl:t})=>(0,lg.jsx)(Zi,{url:t,squareLogoElement:ag.default,size:e,fgColor:"#1F1F1F"});var me=require("react/jsx-runtime"),pg=({onComplete:e,onClose:t,onReset:r,totpInfo:o})=>{let[n,i]=(0,rp.useState)("enroll"),[a,l]=(0,rp.useState)(!1),{submitEnrollmentWithTotp:s}=$r(),{data:c}=_();function u(){c?.mfaEnrollmentFlow?.onSuccess(),e()}function f(){i("verify")}async function y(w){try{if(!w)return;await s({mfaCode:w}),l(!0)}catch(v){throw jl(v)?new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds."):fn(v)?new Error("The code you entered is not valid"):mn(v)?new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds."):Yl(v)?new Error("Verification canceled"):new Error("Unknown error")}}function g(){n==="verify"?i("enroll"):r()}return n==="enroll"?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{backFn:r,onClose:t},"header"),(0,me.jsx)(he,{children:"Scan QR code"}),(0,me.jsx)(ge,{children:"Open your authenticator app and scan the QR code to continue."}),(0,me.jsx)(Ii,{children:(0,me.jsx)(sg,{authUrl:o.authUrl,size:200})}),(0,me.jsxs)(Gt,{children:[(0,me.jsx)(Jt,{children:(0,me.jsx)(wn,{itemName:"secret",text:o.secret})}),(0,me.jsx)(O,{onClick:f,children:"Continue"})]}),(0,me.jsx)(z,{})]}):a?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{onClose:u},"header"),(0,me.jsx)(Ne,{children:(0,me.jsx)(Qe,{status:"success",children:(0,me.jsx)(cg.default,{})})}),(0,me.jsx)(he,{children:"Authenticator app verification added"}),(0,me.jsx)(ge,{children:"From now on, you'll enter the verification code generated by your authenticator app whenever you use your Privy wallet."}),(0,me.jsx)(Gt,{children:(0,me.jsx)(O,{onClick:u,children:"Done"})}),(0,me.jsx)(z,{})]}):(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)(S,{backFn:g,onClose:t},"header"),(0,me.jsx)(Ne,{children:(0,me.jsx)(Qe,{children:(0,me.jsx)(dg.default,{})})}),(0,me.jsx)(he,{children:"Enter enrollment code"}),(0,me.jsx)(Br,{children:(0,me.jsx)(ei,{onChange:y})}),(0,me.jsxs)(ge,{children:["To continue, enter the 6-digit code generated from your ",(0,me.jsx)("strong",{children:"authenticator app"})]}),(0,me.jsx)(z,{})]})};var F=require("react/jsx-runtime"),gg=()=>{let{user:e,enrollInMfa:t}=H(),[r,o]=(0,jo.useState)(null),{unenrollWithSms:n,unenrollWithTotp:i,unenrollWithPasskey:a}=$r(),{app:l,ready:s,data:c,onUserCloseViaDialogOrKeybindRef:u}=_(),{closePrivyModal:f}=W(),{promptMfa:y}=oa(),{initEnrollmentWithTotp:g}=$r(),[w,v]=(0,jo.useState)(!1),[k,P]=(0,jo.useState)(null),[b,A]=(0,jo.useState)(null),R=()=>{f({shouldCallAuthOnSuccess:!0}),t(!1),setTimeout(()=>{o(null),P(null)},500)},{initEnrollmentWithPasskey:N,submitEnrollmentWithPasskey:L}=$r(),[I,q]=(0,jo.useState)(!1),[J,j]=(0,jo.useState)(null);u.current=R;let M=e?.mfaMethods.includes("sms"),ne=!!e?.phone,B=e?.mfaMethods.includes("totp"),be=e?.mfaMethods.includes("passkey"),fe=M||B||be,ve=e?.linkedAccounts.filter(pt=>pt.type==="passkey").map(pt=>pt.credentialId)??[];(0,jo.useEffect)(()=>{fe&&v(!0)},[fe]);function Ee(){o(null),P(null)}function ae(){v(!1)}async function It(){q(!0);try{await N(),await L({credentialIds:ve})}catch(pt){j(pt)}finally{q(!1)}}async function Mt(pt){if(await y().catch(j),pt==="totp"){P(pt),A(null),g().then(Ir=>{A(Ir)}).catch(()=>{A(null),Ee()});return}if(pt==="passkey"&&ve.length===1)return await It();P(pt)}if(!s||!e||!l)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(H1,{})}),(0,F.jsx)(Br,{children:(0,F.jsx)(Et,{})}),(0,F.jsx)(z,{})]});async function er(){o(null);try{await n()}catch{o(null)}}async function wt(){o(null);try{await i()}catch{o(null)}}async function Rr(){o(null);try{await y(),await a()}catch{o(null)}}if(r==="sms")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(hg.default,{})})}),(0,F.jsx)(he,{children:"Remove SMS verification?"}),(0,F.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:er,children:"Remove SMS for MFA"})}),(0,F.jsx)(z,{})]});if(r==="totp")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(mg.default,{})})}),(0,F.jsx)(he,{children:"Remove Authenticator App verification?"}),(0,F.jsxs)(ge,{children:["MFA adds an extra layer of security to your ",l?.name," account. Make sure you have other methods to secure your account."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:wt,children:"Remove Authenticator App for MFA"})}),(0,F.jsx)(z,{})]});if(r==="passkey")return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{backFn:Ee,onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(yg.default,{})})}),(0,F.jsx)(he,{children:"Are you sure you want to remove passkey verification?"}),(0,F.jsx)(ge,{children:"This will disable any passkeys you have set up for verification. You\u2019ll still be able to login with your passkeys if you\u2019ve set up passkey login."}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{warn:!0,onClick:Rr,children:"Yes, remove"})}),(0,F.jsx)(z,{})]});if(c.mfaEnrollmentFlow.mfaMethods.length===0&&!fe)return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(op.default,{})})}),(0,F.jsx)(he,{children:"Add more security"}),(0,F.jsxs)(ge,{children:[l?.name," does not have any verification methods enabled."]}),(0,F.jsx)(Gt,{children:(0,F.jsx)(O,{onClick:R,children:"Close"})}),(0,F.jsx)(z,{})]});let $e=!fe&&!w;return $e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(S,{onClose:R},"header"),(0,F.jsx)(Ne,{children:(0,F.jsx)(Qe,{children:(0,F.jsx)(op.default,{})})}),(0,F.jsx)(he,{children:"Transaction Protection"}),(0,F.jsx)(ge,{children:"Set up transaction protection to add an extra layer of security to your account"}),(0,F.jsxs)(qn,{children:[(0,F.jsxs)(nr,{children:[(0,F.jsx)(or,{children:(0,F.jsx)(ug.default,{})}),"Enable 2-Step verification for your ",l?.name," wallet."]}),(0,F.jsxs)(nr,{children:[(0,F.jsx)(or,{children:(0,F.jsx)(fg.default,{})}),"You'll be prompted to authenticate to complete transactions."]})]}),(0,F.jsxs)(Gt,{children:[(0,F.jsx)(O,{onClick:()=>v(!0),children:"Continue"}),(0,F.jsx)(eo,{onClick:R,children:"Not now"})]}),(0,F.jsx)(z,{})]}):k==="sms"?(0,F.jsx)(ig,{onComplete:R,onReset:Ee,onClose:R}):k==="totp"&&b?(0,F.jsx)(pg,{onComplete:R,onClose:R,onReset:Ee,totpInfo:b}):k==="passkey"?(0,F.jsx)(X1,{onComplete:R,onReset:Ee,onClose:R}):(0,F.jsx)(K1,{showIntro:$e,userMfaMethods:e.mfaMethods,appMfaMethods:l.mfa.methods,userHasAuthSms:ne,onBackToIntro:ae,handleSelectMethod:Mt,isTotpLoading:k==="totp"&&!b,isPasskeyLoading:I,error:J,onClose:R,setRemovingMfaMethod:o})};var n2=m(require("@heroicons/react/24/outline/DevicePhoneMobileIcon")),i2=m(require("@heroicons/react/24/outline/FingerPrintIcon")),a2=m(require("@heroicons/react/24/outline/PhoneIcon")),s2=m(require("@heroicons/react/24/outline/ShieldCheckIcon")),l2=m(require("@heroicons/react/24/solid/DevicePhoneMobileIcon")),c2=m(require("@heroicons/react/24/solid/PhoneIcon")),xn=require("react");var oi=require("react"),Xg=m(require("styled-components"));var dp=m(require("styled-components"));var np=m(require("styled-components")),es=require("react/jsx-runtime"),_c=({label:e,children:t,valueStyles:r})=>(0,es.jsxs)(w4,{children:[(0,es.jsx)("div",{children:e}),(0,es.jsx)(b4,{style:{...r},children:t})]}),w4=np.default.div`
|
|
2096
2096
|
display: flex;
|
|
2097
2097
|
align-items: center;
|
|
2098
2098
|
justify-content: space-between;
|
|
@@ -2116,28 +2116,28 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2116
2116
|
border-radius: var(--privy-border-radius-full);
|
|
2117
2117
|
background-color: var(--privy-color-background-2);
|
|
2118
2118
|
padding: 4px 8px;
|
|
2119
|
-
`;var
|
|
2119
|
+
`;var rs=m(require("styled-components"));var ip=require("@ethersproject/bignumber"),ap=require("@ethersproject/units");var ts=(e,t)=>{let r=(t*parseFloat((0,ap.formatEther)(e))).toFixed(2);return r!=="0.00"?`$${r}`:"<$0.01"},ko=(e,t,r=6,o=!1)=>{let i=parseFloat((0,ap.formatEther)(e)).toFixed(r).replace(/0+$/,"").replace(/\.$/,"");return o?`${i} ${t}`:`${i==="0"?"<0.001":i} ${t}`},sp=e=>e.map(Kt).reduce((t,r)=>t.add(r),ip.BigNumber.from(0)).toHexString(),vg=(e,t)=>{let{chains:r}=W(),o=`https://etherscan.io/address/${t}`,n=`${xu(e,r)}/address/${t}`;if(!n)return o;try{new URL(n)}catch{return o}return n},Kt=e=>ip.BigNumber.from(e);var Ao=require("react/jsx-runtime"),Cg=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=sp(e),n=t?ts(o,t):void 0,i=ko(o,r);return(0,Ao.jsx)(wg,{children:n||i})},lp=({weiQuantities:e,tokenPrice:t,tokenSymbol:r})=>{let o=sp(e),n=t?ts(o,t):void 0,i=ko(o,r);return(0,Ao.jsx)(wg,{children:n?(0,Ao.jsxs)(Ao.Fragment,{children:[(0,Ao.jsx)(E4,{children:"USD"}),n==="<$0.01"?(0,Ao.jsxs)(T4,{children:[(0,Ao.jsx)(P4,{children:"<"}),"$0.01"]}):n]}):i})},wg=rs.default.span`
|
|
2120
2120
|
font-size: 14px;
|
|
2121
2121
|
line-height: 140%;
|
|
2122
2122
|
display: flex;
|
|
2123
2123
|
gap: 4px;
|
|
2124
2124
|
align-items: center;
|
|
2125
|
-
`,E4=
|
|
2125
|
+
`,E4=rs.default.span`
|
|
2126
2126
|
font-size: 12px;
|
|
2127
2127
|
line-height: 12px;
|
|
2128
2128
|
color: var(--privy-color-foreground-3);
|
|
2129
|
-
`,P4=
|
|
2129
|
+
`,P4=rs.default.span`
|
|
2130
2130
|
font-size: 10px;
|
|
2131
|
-
`,T4=
|
|
2131
|
+
`,T4=rs.default.span`
|
|
2132
2132
|
display: flex;
|
|
2133
2133
|
align-items: center;
|
|
2134
|
-
`;var
|
|
2134
|
+
`;var kc=m(require("styled-components"));var cr=require("react/jsx-runtime"),bg=({gas:e,tokenPrice:t,tokenSymbol:r})=>(0,cr.jsxs)(kd,{style:{paddingBottom:"12px"},children:[(0,cr.jsxs)(Pg,{children:[(0,cr.jsx)(Sg,{children:"Est. Fees"}),(0,cr.jsx)("div",{children:(0,cr.jsx)(lp,{weiQuantities:[e],tokenPrice:t,tokenSymbol:r})})]}),t&&(0,cr.jsx)(Tg,{children:`${ko(e,r)}`})]}),Eg=({transactionData:e,gas:t,tokenPrice:r,tokenSymbol:o})=>{let n=Kt(e.value||0).add(Kt(t)).toHexString();return(0,cr.jsxs)(kd,{children:[(0,cr.jsxs)(Pg,{children:[(0,cr.jsx)(Sg,{children:"Total (including fees)"}),(0,cr.jsx)("div",{children:(0,cr.jsx)(lp,{weiQuantities:[e.value||0,t],tokenPrice:r,tokenSymbol:o})})]}),r&&(0,cr.jsx)(Tg,{children:ko(n,o)})]})},Pg=kc.default.div`
|
|
2135
2135
|
display: flex;
|
|
2136
2136
|
flex-direction: row;
|
|
2137
2137
|
justify-content: space-between;
|
|
2138
2138
|
align-items: center;
|
|
2139
2139
|
padding-top: 4px;
|
|
2140
|
-
`,Tg=
|
|
2140
|
+
`,Tg=kc.default.div`
|
|
2141
2141
|
display: flex;
|
|
2142
2142
|
flex-direction: row;
|
|
2143
2143
|
height: 12px;
|
|
@@ -2146,11 +2146,11 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2146
2146
|
line-height: 12px;
|
|
2147
2147
|
color: var(--privy-color-foreground-3);
|
|
2148
2148
|
font-weight: 400;
|
|
2149
|
-
`,Sg=
|
|
2149
|
+
`,Sg=kc.default.div`
|
|
2150
2150
|
font-size: 14px;
|
|
2151
2151
|
line-height: 22.4px;
|
|
2152
2152
|
font-weight: 400;
|
|
2153
|
-
`;var xg=m(require("@heroicons/react/24/outline/ChevronDownIcon")),Ro=require("react"),Yo=m(require("styled-components"));var
|
|
2153
|
+
`;var xg=m(require("@heroicons/react/24/outline/ChevronDownIcon")),Ro=require("react"),Yo=m(require("styled-components"));var Ac=require("react"),ia=(0,Ac.createContext)(void 0);var os=(0,Ac.createContext)(void 0);var Ot=require("react/jsx-runtime"),_g=({defaultValue:e,children:t})=>{let[r,o]=(0,Ro.useState)(e||null),n=i=>{o(r===i?null:i)};return(0,Ot.jsx)(ia.Provider,{value:{activePanel:r,togglePanel:n},children:(0,Ot.jsx)(S4,{children:t})})},kg=({value:e,children:t})=>{let{activePanel:r,togglePanel:o}=(0,Ro.useContext)(ia),n=r===e;return(0,Ot.jsx)(os.Provider,{value:{onToggle:()=>o(e),value:e},children:(0,Ot.jsx)(A4,{isActive:n,"data-open":n,children:t})})},Ag=({children:e})=>{let{activePanel:t}=(0,Ro.useContext)(ia),{onToggle:r,value:o}=(0,Ro.useContext)(os),n=t===o;return(0,Ot.jsxs)(Ot.Fragment,{children:[(0,Ot.jsxs)(x4,{onClick:r,"data-open":n,children:[(0,Ot.jsx)(k4,{children:e}),(0,Ot.jsx)(I4,{isactive:n,children:(0,Ot.jsx)(xg.default,{height:"16px",width:"16px",strokeWidth:"2"})})]}),(0,Ot.jsx)(_4,{})]})},Rg=({children:e})=>{let{activePanel:t}=(0,Ro.useContext)(ia),{value:r}=(0,Ro.useContext)(os);return(0,Ot.jsx)(R4,{"data-open":t===r,children:(0,Ot.jsx)(Mg,{children:e})})},Ig=({children:e})=>{let{activePanel:t}=(0,Ro.useContext)(ia),{value:r}=(0,Ro.useContext)(os);return(0,Ot.jsx)(Mg,{children:typeof e=="function"?e({isActive:t===r}):e})},S4=Yo.default.div`
|
|
2154
2154
|
display: flex;
|
|
2155
2155
|
flex-direction: column;
|
|
2156
2156
|
width: 100%;
|
|
@@ -2212,7 +2212,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2212
2212
|
&:hover {
|
|
2213
2213
|
text-decoration: underline;
|
|
2214
2214
|
}
|
|
2215
|
-
`;var At=require("react/jsx-runtime"),aa=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return(0,At.jsx)(_g,{children:(0,At.jsxs)(kg,{value:"details",children:[(0,At.jsx)(Ag,{children:(0,At.jsxs)(W4,{children:[(0,At.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,At.jsx)(L4,{children:(0,At.jsx)(Cg,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,At.jsxs)(Rg,{children:[(0,At.jsx)(
|
|
2215
|
+
`;var At=require("react/jsx-runtime"),aa=({from:e,to:t,txn:r,transactionInfo:o,tokenPrice:n,gas:i,tokenSymbol:a})=>{let l=r?.value||0;return(0,At.jsx)(_g,{children:(0,At.jsxs)(kg,{value:"details",children:[(0,At.jsx)(Ag,{children:(0,At.jsxs)(W4,{children:[(0,At.jsx)("div",{children:o?.title||o?.actionDescription||"Details"}),(0,At.jsx)(L4,{children:(0,At.jsx)(Cg,{weiQuantities:[l],tokenPrice:n,tokenSymbol:a})})]})}),(0,At.jsxs)(Rg,{children:[(0,At.jsx)(_c,{label:"From",children:(0,At.jsx)(cp,{walletAddress:e,chainId:r.chainId||Lo})}),(0,At.jsx)(_c,{label:"To",children:(0,At.jsx)(cp,{walletAddress:t,chainId:r.chainId||Lo})}),o&&o.action&&(0,At.jsx)(_c,{label:"Action",children:o.action}),i&&(0,At.jsx)(bg,{transactionData:r,gas:i,tokenPrice:n,tokenSymbol:a})]}),(0,At.jsx)(Ig,{children:({isActive:s})=>(0,At.jsx)(Eg,{transactionData:r,displayFee:s,gas:i||"0x0",tokenPrice:n,tokenSymbol:a})})]})})},W4=dp.default.div`
|
|
2216
2216
|
display: flex;
|
|
2217
2217
|
flex-direction: row;
|
|
2218
2218
|
justify-content: space-between;
|
|
@@ -2260,7 +2260,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2260
2260
|
overflow: hidden;
|
|
2261
2261
|
max-width: 275px;
|
|
2262
2262
|
text-overflow: ellipsis;
|
|
2263
|
-
`;var Og=m(require("@heroicons/react/24/outline/WalletIcon")),
|
|
2263
|
+
`;var Og=m(require("@heroicons/react/24/outline/WalletIcon")),Rc=m(require("styled-components"));var ti=require("react/jsx-runtime"),Ng=({address:e,txn:t,balance:r,hasFunds:o})=>{let n=!!r,{nativeTokenSymbolForChainId:i}=W(),a=i(t.chainId)||"ETH";return(0,ti.jsxs)(B4,{children:[(0,ti.jsxs)(H4,{children:[(0,ti.jsx)(Og.default,{strokeWidth:"2",width:"16px",height:"16px"}),(0,ti.jsx)("div",{children:nn(e)})]}),(0,ti.jsxs)(G4,{displayBalanceColor:n,hasFunds:o,children:[r?ko(r,a,6,!0):0," available"]})]})},B4=Rc.default.div`
|
|
2264
2264
|
display: flex;
|
|
2265
2265
|
flex-direction: row;
|
|
2266
2266
|
justify-content: space-between;
|
|
@@ -2273,12 +2273,12 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2273
2273
|
border: 1px solid var(--privy-color-foreground-4);
|
|
2274
2274
|
border-radius: var(--privy-border-radius-md);
|
|
2275
2275
|
}
|
|
2276
|
-
`,H4=
|
|
2276
|
+
`,H4=Rc.default.div`
|
|
2277
2277
|
display: flex;
|
|
2278
2278
|
flex-direction: row;
|
|
2279
2279
|
align-items: center;
|
|
2280
2280
|
gap: 8px;
|
|
2281
|
-
`,G4=
|
|
2281
|
+
`,G4=Rc.default.div`
|
|
2282
2282
|
display: flex;
|
|
2283
2283
|
align-items: center;
|
|
2284
2284
|
justify-content: center;
|
|
@@ -2288,35 +2288,35 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2288
2288
|
background-color: var(--privy-color-background-2);
|
|
2289
2289
|
padding: 5px 8px;
|
|
2290
2290
|
color: ${e=>e.displayBalanceColor?e.hasFunds?"var(--privy-color-success-dark)":"var(--privy-color-error)":"inherit"};
|
|
2291
|
-
`;var
|
|
2291
|
+
`;var ns=m(require("styled-components"));var Kr=require("react/jsx-runtime"),Ug=({description:e,txn:t,tokenSymbol:r,tokenPrice:o})=>{let n=t.value||0,i=o?ts(n,o):void 0,a=ko(n,r);return(0,Kr.jsxs)(V4,{children:[i?(0,Kr.jsxs)(Kr.Fragment,{children:[(0,Kr.jsx)(Dg,{children:i}),(0,Kr.jsx)(z4,{children:a})]}):(0,Kr.jsx)(Kr.Fragment,{children:(0,Kr.jsx)(Dg,{children:a})}),(0,Kr.jsx)(q4,{children:e})]})},V4=ns.default.div`
|
|
2292
2292
|
display: flex;
|
|
2293
2293
|
flex-direction: column;
|
|
2294
2294
|
align-items: center;
|
|
2295
2295
|
margin-bottom: 20px;
|
|
2296
|
-
`,Dg=
|
|
2296
|
+
`,Dg=ns.default.h2`
|
|
2297
2297
|
&& {
|
|
2298
2298
|
font-size: 48px;
|
|
2299
2299
|
line-height: 48px;
|
|
2300
2300
|
margin: 8px auto;
|
|
2301
2301
|
}
|
|
2302
|
-
`,z4=
|
|
2302
|
+
`,z4=ns.default.p`
|
|
2303
2303
|
margin-bottom: 12px;
|
|
2304
2304
|
&& {
|
|
2305
2305
|
font-size: 17px;
|
|
2306
2306
|
line-height: 17px;
|
|
2307
2307
|
color: var(--privy-color-foreground-3);
|
|
2308
2308
|
}
|
|
2309
|
-
`,q4=
|
|
2309
|
+
`,q4=ns.default.div`
|
|
2310
2310
|
font-size: 16px;
|
|
2311
2311
|
line-height: 22.4px;
|
|
2312
2312
|
font-weight: 400;
|
|
2313
2313
|
overflow: hidden;
|
|
2314
2314
|
max-width: 275px;
|
|
2315
2315
|
text-overflow: ellipsis;
|
|
2316
|
-
`;var Zg=require("@ethersproject/abstract-signer"),j4=require("@ethersproject/providers");var up=require("@ethersproject/bignumber");var ri=require("@ethersproject/bignumber"),Fg=require("@ethersproject/contracts"),Bg=require("@ethersproject/transactions");var la=e=>[
|
|
2316
|
+
`;var Zg=require("@ethersproject/abstract-signer"),j4=require("@ethersproject/providers");var up=require("@ethersproject/bignumber");var ri=require("@ethersproject/bignumber"),Fg=require("@ethersproject/contracts"),Bg=require("@ethersproject/transactions");var la=e=>[dl.id,pl.id,ul.id,ml.id,fl.id,hl.id,yl.id,vl.id,gl.id].includes(e),Hg=async(e,t)=>{if(!la(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let i=ri.BigNumber.from(r).mul(ri.BigNumber.from(126)).div(ri.BigNumber.from(100)).add(ri.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=is(i)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function Gg(e,t){if(!e.chainId||e.chainId&&!la(e.chainId))return ri.BigNumber.from(0);let r=ri.BigNumber.from(0);try{let o=new Fg.Contract(Gu,Vu,t),n=Vg(e),i=(0,Bg.serialize)(n);r=await o.getL1Fee(i)}catch{}return r}async function zg(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var qg=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function ca(e,t){if(!e.gasLimit)throw new tt("gasLimit was not successfully set for transaction.");let r=Kt(e.gasLimit),o=up.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=Kt(e.maxFeePerGas);else throw new tt("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Kt(e.gasPrice);else throw new tt("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),i=up.BigNumber.from(0);if(e.chainId&&la(e.chainId))try{i=await Gg(e,t),n=n.add(i)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:i}}var Ic=require("@ethersproject/bignumber");var mp=e=>[sl.id,ll.id,cl.id].includes(e),$g=async(e,t)=>{if(!mp(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Ic.BigNumber.from(120)).div(Ic.BigNumber.from(100));e.maxFeePerGas=is(o),e.maxPriorityFeePerGas=is(Ic.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var fp=e=>[56,97].includes(e),Kg=async(e,t)=>{if(!fp(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};var gp=require("@ethersproject/units"),jg=require("ofetch");var hp={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var vp=e=>[_a.id,ka.id,hp.id].includes(e),yp=e=>({maxPriorityFee:(0,gp.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,gp.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),$4=e=>({safeLow:yp(e.safeLow),standard:yp(e.standard),fast:yp(e.fast)}),K4=async e=>{let t="";switch(e){case _a.id:t="https://gasstation.polygon.technology/v2";break;case ka.id:t="https://gasstation-testnet.polygon.technology/v2";break;case hp.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return $4(await(0,jg.ofetch)(t))};async function Yg(e){if(!vp(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await K4(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function is(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function Vg(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Kt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Kt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Kt(e.gasPrice)),e.value!==void 0&&(t.value=Kt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Kt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Kt(e.maxPriorityFeePerGas)),t}async function da(e,t,r){if(t.chainId=Number(t.chainId),Jg(t),t.from||(t.from=e),!t.nonce){let o=new Zg.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await zg(t,r)),typeof t.type=="string"&&Qg(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),vp(t.chainId)?t=await Yg(t):mp(t.chainId)?t=await $g(t,r):la(t.chainId)?t=await Hg(t,r):fp(t.chainId)?t=await Kg(t,r):t=await qg(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function Mc(e,t,r,o,n){o=Object.assign({chainId:Lo},o),Jg(o);let a=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(a)}async function Wc(e,t,r,o){let n=await o.getBalance(e),i=t.value||0,l=!n.sub(Kt(i)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Jg(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!Y4(o))throw new Error(`Transaction request property '${r}' 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 Y4(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Qg(e);return t||r||o}function Qg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Lc(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var pa=require("react");var Oc=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,i]=(0,pa.useState)(!0),[a,l]=(0,pa.useState)(void 0),[s,c]=(0,pa.useState)(void 0);return(0,pa.useEffect)(()=>{let u=e.chainId||Lo,f=o.find(g=>g.id===Number(u));if(!f)throw new de(`Unsupported chain: ${u}`);(async()=>{if(!t){i(!1);return}try{i(!0);let g=await r(f);g?c(g):l(new Error(`Unable to fetch token price on chain id ${f.id}`))}catch(g){l(g)}finally{i(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:a}};var Nc=require("react"),Cp=(0,Nc.createContext)(null);function ua(){let e=(0,Nc.useContext)(Cp);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var wp=require("react/jsx-runtime"),as=({pendingTransaction:e})=>{let{getAccessToken:t}=H(),{wallets:r}=ua(),{walletProxy:o,rpcConfig:n,chains:i,appId:a,nativeTokenSymbolForChainId:l}=W(),[s,c]=(0,oi.useState)(null),[u,f]=(0,oi.useState)(e),{tokenPrice:y}=Oc(u),g=l(e.chainId)||"ETH",w=(0,oi.useMemo)(()=>r.find(v=>v.walletClientType==="privy"),[r]);return(0,oi.useEffect)(()=>{async function v(){if(!await t()||!o||!w)return u;let P=Wo(u.chainId,i,n,{appId:a}),b=await da(w.address,u,P),{totalGasEstimate:A}=await ca(b,P);return c(A.toHexString()),b}v().then(f).catch(console.error)},[o]),w?(0,wp.jsx)(Z4,{children:(0,wp.jsx)(aa,{from:w.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:y,tokenSymbol:g})}):null},Z4=Xg.default.div`
|
|
2317
2317
|
width: 100%;
|
|
2318
2318
|
padding: 1rem 0;
|
|
2319
|
-
`;var e2=m(require("@heroicons/react/24/outline/CalendarIcon")),t2=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),r2=m(require("@heroicons/react/24/outline/ShieldCheckIcon"));var He=require("react/jsx-runtime"),o2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=W();return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(S,{onClose:r},"header"),(0,He.jsx)(Vt,{children:(0,He.jsxs)("div",{children:[(0,He.jsx)(Ht,{success:a,fail:!!t}),t?(0,He.jsx)(t2.default,{style:{width:"38px",height:"38px"}}):(0,He.jsx)(Zn,{style:{width:"38px",height:"38px"}})]})}),(0,He.jsx)(he,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,He.jsxs)(qn,{children:[(0,He.jsxs)(nr,{children:[(0,He.jsx)(or,{children:(0,He.jsx)(r2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,He.jsxs)(nr,{children:[(0,He.jsx)(or,{children:(0,He.jsx)(e2.default,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,He.jsx)(
|
|
2319
|
+
`;var e2=m(require("@heroicons/react/24/outline/CalendarIcon")),t2=m(require("@heroicons/react/24/outline/ExclamationTriangleIcon")),r2=m(require("@heroicons/react/24/outline/ShieldCheckIcon"));var He=require("react/jsx-runtime"),o2=({hasBlockingError:e,error:t,onClose:r,onBack:o,handleSubmit:n,account:i,submitSuccess:a})=>{let{pendingTransaction:l}=W();return(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(S,{onClose:r},"header"),(0,He.jsx)(Vt,{children:(0,He.jsxs)("div",{children:[(0,He.jsx)(Ht,{success:a,fail:!!t}),t?(0,He.jsx)(t2.default,{style:{width:"38px",height:"38px"}}):(0,He.jsx)(Zn,{style:{width:"38px",height:"38px"}})]})}),(0,He.jsx)(he,{style:{marginTop:"1rem"},children:"Verifying with passkey"}),(0,He.jsxs)(qn,{children:[(0,He.jsxs)(nr,{children:[(0,He.jsx)(or,{children:(0,He.jsx)(r2.default,{})}),"Approve this action using your touch, face, PIN, or hardware key."]}),(0,He.jsxs)(nr,{children:[(0,He.jsx)(or,{children:(0,He.jsx)(e2.default,{})}),"You last added a passkey on"," ",i?.firstVerifiedAt?.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),"."]})]}),l&&(0,He.jsx)(Br,{children:(0,He.jsx)(as,{pendingTransaction:l})}),t&&(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)(Gl,{style:{marginTop:"1.25rem"},children:t.message}),(0,He.jsx)(O,{disabled:e,onClick:n,style:{marginTop:"1.25rem"},children:"Try again"})]}),o&&(0,He.jsx)(Ra,{style:{marginTop:"1rem"},onClick:o,children:"Choose another method"}),(0,He.jsx)(z,{})]})};var Z=require("react/jsx-runtime"),bp=({open:e,onClose:t})=>{let{user:r}=H(),[o,n]=(0,xn.useState)(null),{init:i,cancel:a,submit:l}=oa(),[s,c]=(0,xn.useState)(!1),[u,f]=(0,xn.useState)(!1),[y,g]=(0,xn.useState)(null),[w,v]=(0,xn.useState)(null);(0,xn.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?b(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);let k=N=>Kl(N)?(c(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):fn(N)?(c(!1),new Error("The code you entered is not valid")):mn(N)?(c(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(console.error(N),c(!1),new Error("Something went wrong."));async function P(N){v(null);try{if(!N||!o)return;await l(o,N),f(!0),c(!1),t()}catch(L){throw k(L)}}async function b(N){if(N==="passkey"){try{n(N);let L=await i(N);if(!L)throw new Error("something went wrong");g(L),await l(N,L),f(!0),c(!1),t()}catch(L){v(k(L))}return}try{n(N),await i(N)}catch(L){console.error(L)}}let A=()=>{n(null),v(null),a(),t()},R=()=>{n(null),v(null)};if(!e||!r)return null;if(o==="passkey"){let N=r.linkedAccounts.filter(L=>L.type==="passkey"&&L.enrolledInMfa).sort((L,I)=>I.firstVerifiedAt.valueOf()-L.firstVerifiedAt.valueOf())[0];return(0,Z.jsx)(o2,{account:N,selectedMethod:o,submitSuccess:u,hasBlockingError:s,error:w,onClose:A,onBack:R,handleSubmit:()=>P(y).catch(v)})}return o?(0,Z.jsx)(J4,{submitSuccess:u,hasBlockingError:s,handleSubmitCode:P,selectedMethod:o,onClose:A,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{onClose:A},"header"),(0,Z.jsx)(Ne,{children:(0,Z.jsx)(Qe,{children:(0,Z.jsx)(s2.default,{})})}),(0,Z.jsx)(he,{children:"Verify your identity"}),(0,Z.jsx)(ge,{children:"Choose a verification method"}),(0,Z.jsxs)(Dl,{children:[r.mfaMethods.includes("totp")&&(0,Z.jsxs)(je,{onClick:()=>b("totp"),children:[(0,Z.jsx)(n2.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,Z.jsxs)(je,{onClick:()=>b("sms"),children:[(0,Z.jsx)(a2.default,{}),"SMS"]},"sms"),r.mfaMethods.includes("passkey")&&(0,Z.jsxs)(je,{onClick:()=>b("passkey"),children:[(0,Z.jsx)(i2.default,{}),"Passkey"]},"passkey")]}),(0,Z.jsx)(z,{})]})},J4=({selectedMethod:e,submitSuccess:t,hasBlockingError:r,onClose:o,onBack:n,handleSubmitCode:i})=>{let{app:a}=_(),{pendingTransaction:l}=W();switch(e){case"sms":return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{onClose:o},"header"),(0,Z.jsx)(Ne,{children:(0,Z.jsx)(Qe,{children:(0,Z.jsx)(c2.default,{})})}),(0,Z.jsx)(he,{children:"Enter verification code"}),(0,Z.jsxs)(Br,{children:[(0,Z.jsx)(ei,{success:t,disabled:r,onChange:i}),(0,Z.jsxs)(ge,{children:["To continue, please enter the 6-digit code sent to your ",(0,Z.jsx)("strong",{children:"mobile device"})]}),l&&(0,Z.jsx)(as,{pendingTransaction:l})]}),n&&(0,Z.jsx)(Ra,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Z.jsx)(eo,{onClick:o,children:"Not now"}),(0,Z.jsx)(z,{})]});case"totp":return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(S,{onClose:o},"header"),(0,Z.jsx)(Ne,{children:(0,Z.jsx)(Qe,{children:(0,Z.jsx)(l2.default,{})})}),(0,Z.jsx)(he,{children:"Enter verification code"}),(0,Z.jsxs)(Br,{children:[(0,Z.jsx)(ei,{success:t,disabled:r,onChange:i}),(0,Z.jsxs)(ge,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,Z.jsx)("strong",{children:"authenticator app"})]}),l&&(0,Z.jsx)(as,{pendingTransaction:l})]}),n&&(0,Z.jsx)(Ra,{theme:a?.appearance.palette.colorScheme,onClick:n,children:"Choose another method"}),(0,Z.jsx)(eo,{onClick:o,children:"Not now"}),(0,Z.jsx)(z,{})]});default:return null}};var ma=require("react"),d2=m(require("styled-components"));var Rt=require("react/jsx-runtime"),p2=()=>{let{authenticated:e,logout:t,ready:r,user:o}=H(),{app:n,setModalData:i,navigate:a,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:f,setReadyToTrue:y,closePrivyModal:g,createAnalyticsEvent:w}=W(),[v,k]=(0,ma.useState)(!1),[P,b]=(0,ma.useState)(void 0),A=s()?.provider||"google",{name:R,component:N}=Pa(A),L=Al(),I=n?.render.inDialog?st:0;(0,ma.useEffect)(()=>{u(A).then(j=>{k(!0),y(!0),j&&L("login","onOAuthLoginComplete",j)}).catch(j=>{if(j?.privyErrorCode==="allowlist_rejected"){b(void 0),l(),a("ALLOWLIST_REJECTION_SCREEN");return}if(j?.privyErrorCode==="max_accounts_reached"){console.error(new mo(j).toString()),b(void 0),l(),a("USER_LIMIT_REACHED_SCREEN");return}let{retryable:M,detail:ne}=Ku(j,A);b({retryable:M,detail:ne,message:"Authentication failed"}),y(!1)}).finally(()=>{Bn()})},[R,A]),(0,ma.useEffect)(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let M=setTimeout(()=>{a("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout(M)}if(Lr(o,n?.embeddedWallets?.createOnLogin)){let M=setTimeout(()=>{i({createWallet:{onSuccess:()=>{},onFailure:ne=>{console.error(ne),w({eventName:"embedded_wallet_creation_failure_logout",payload:{error:ne,provider:A,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),a("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout(M)}else{let M=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I);return f(),()=>clearTimeout(M)}}},[r,e,v,o]);let q=v?`Successfully connected with ${R}`:P?P.message:`Verifying connection to ${R}`,J="";return v?J="You\u2019re good to go!":P?J=P.detail:J="Just a few moments more",(0,Rt.jsxs)(Rt.Fragment,{children:[(0,Rt.jsx)(S,{}),(0,Rt.jsx)(ce,{}),(0,Rt.jsxs)(Q4,{children:[(0,Rt.jsx)(Vt,{children:(0,Rt.jsxs)("div",{children:[(0,Rt.jsx)(Ht,{success:v,fail:!!P}),(0,Rt.jsx)(N,{style:{width:"38px",height:"38px"}})]})}),(0,Rt.jsxs)(St,{children:[(0,Rt.jsx)("h3",{children:q}),(0,Rt.jsx)("p",{children:J})]}),P&&P?.retryable?(0,Rt.jsx)(Ll,{onClick:()=>{Bn(),c(A),b(void 0)},disabled:!v&&!P?.retryable,children:"Retry"}):null]}),(0,Rt.jsx)(ye,{}),(0,Rt.jsx)(z,{})]})},Q4=d2.default.div`
|
|
2320
2320
|
display: flex;
|
|
2321
2321
|
flex-direction: column;
|
|
2322
2322
|
align-items: center;
|
|
@@ -2334,7 +2334,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2334
2334
|
justify-content: center;
|
|
2335
2335
|
gap: 24px;
|
|
2336
2336
|
width: 100%;
|
|
2337
|
-
`,
|
|
2337
|
+
`,kL=Ep.default.div`
|
|
2338
2338
|
display: flex;
|
|
2339
2339
|
align-items: center;
|
|
2340
2340
|
justify-content: center;
|
|
@@ -2350,9 +2350,9 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2350
2350
|
stroke: var(--privy-color-accent) !important;
|
|
2351
2351
|
fill: var(--privy-color-accent) !important;
|
|
2352
2352
|
}
|
|
2353
|
-
`;var
|
|
2353
|
+
`;var ss=require("react"),h2=m(require("styled-components"));var m2=require("react-device-detect");var f2=(e,t)=>{let r=new URL(window.location.href),o=encodeURIComponent(r.href.replace(/\/$/g,"")+`?privy_token=${e}&privy_connector=injected&privy_wallet_client=phantom`);if(!on()&&m2.isMobile)return`${t?"phantom://":"https://phantom.app/ul/"}browse/${o}?ref=${o}`};var Xt=require("react/jsx-runtime"),y2=()=>{let{forkSession:e,ready:t,authenticated:r}=H(),[o,n]=(0,ss.useState)(""),[i,a]=(0,ss.useState)(!1);(0,ss.useEffect)(()=>{t&&r&&e().then(n)},[t,r]);let l=f2(o,!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,Xt.jsxs)(Xt.Fragment,{children:[(0,Xt.jsx)(S,{},"header"),(0,Xt.jsx)(ce,{}),(0,Xt.jsx)(wo,{title:s.title,description:s.description}),(0,Xt.jsxs)(Hr,{children:[(0,Xt.jsx)(ew,{children:(0,Xt.jsx)(ho,{style:{width:"72px",height:"72px"}})}),(0,Xt.jsx)(Wl,{href:l,onClick:()=>{setTimeout(()=>a(!0),1e3)},loading:t&&!l,children:i?"Go to App Store":"Continue"}),s.footnote?(0,Xt.jsx)("p",{children:s.footnote}):null]}),(0,Xt.jsx)(ye,{}),(0,Xt.jsx)(V,{protectedByPrivy:!0})]})},ew=(0,h2.default)(Jt)`
|
|
2354
2354
|
margin: 16px auto;
|
|
2355
|
-
`;var g2=m(require("@heroicons/react/24/outline/ShieldCheckIcon")),ni=require("react"),ii=m(require("styled-components"));var
|
|
2355
|
+
`;var g2=m(require("@heroicons/react/24/outline/ShieldCheckIcon")),ni=require("react"),ii=m(require("styled-components"));var qe=require("react/jsx-runtime"),v2=()=>{let[e,t]=(0,ni.useState)(!0),{authenticated:r,getAccessToken:o}=H(),{walletProxy:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),{navigate:l,data:s,onUserCloseViaDialogOrKeybindRef:c}=_(),[u,f]=(0,ni.useState)(void 0),[y,g]=(0,ni.useState)(""),[w,v]=(0,ni.useState)(!1),{privyWallet:k,onCompleteNavigateTo:P,onSuccess:b,onFailure:A}=s.recoverWallet,R=(I="User exited before their wallet could be recovered")=>{i({shouldCallAuthOnSuccess:!1}),A(typeof I=="string"?new Yt(I):I)};c.current=R,(0,ni.useEffect)(()=>{if(!r||!k)return R("User must be authenticated and have a Privy wallet before it can be recovered")},[r]);let N=I=>{I&&f(I)};return(0,qe.jsxs)(qe.Fragment,{children:[(0,qe.jsx)(S,{onClose:R}),(0,qe.jsx)(ce,{}),(0,qe.jsxs)(rw,{children:[(0,qe.jsxs)(tw,{children:[(0,qe.jsx)(g2.default,{height:48,width:48,stroke:"var(--privy-color-accent)"}),(0,qe.jsx)("h3",{style:{color:"var(--privy-color-foreground)"},children:"Load your account"}),(0,qe.jsx)("p",{style:{color:"var(--privy-color-foreground-2)"},children:"Please provision your account on this new device. To continue, enter your recovery password."})]}),(0,qe.jsxs)("div",{children:[(0,qe.jsxs)(gn,{children:[(0,qe.jsx)(Gi,{type:e?"password":"text",onChange:I=>N(I.target.value),disabled:w,style:{paddingRight:"2.3rem"}}),(0,qe.jsx)(Vi,{style:{right:"0.75rem"},children:e?(0,qe.jsx)(zi,{onClick:()=>t(!1)}):(0,qe.jsx)(qi,{onClick:()=>t(!0)})})]}),!!y&&(0,qe.jsx)(ow,{children:y})]}),(0,qe.jsxs)("div",{children:[(0,qe.jsxs)(uf,{children:[(0,qe.jsx)("h4",{children:"Why is this necessary?"}),(0,qe.jsx)("p",{children:"You previously set a password for this wallet. This helps ensure only you can access it"})]}),(0,qe.jsx)(nw,{loading:w||!n,disabled:!u,onClick:async()=>{v(!0);let I=await o();if(I&&k&&u!==null)try{a({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:k.address}}),await n?.recover({address:k.address,accessToken:I,recoveryPin:u}),g(""),P?l(P):i({shouldCallAuthOnSuccess:!1}),b?.(k),a({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:k.address}})}catch(q){Qf(q)?g("Invalid recovery password, please try again."):g("An error has occurred, please try again.")}finally{v(!1)}else return R("User must be authenticated and have a Privy wallet before it can be recovered")},warn:!1,hideAnimations:!k&&w,children:"Recover your account"})]})]}),(0,qe.jsx)(ye,{}),(0,qe.jsx)(V,{protectedByPrivy:!0})]})},tw=ii.default.div`
|
|
2356
2356
|
display: flex;
|
|
2357
2357
|
flex-direction: column;
|
|
2358
2358
|
align-items: center;
|
|
@@ -2393,7 +2393,7 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2393
2393
|
transition: none;
|
|
2394
2394
|
}
|
|
2395
2395
|
`}
|
|
2396
|
-
`;var Jo=require("react");var
|
|
2396
|
+
`;var Jo=require("react");var xr=require("react/jsx-runtime"),Dc=({style:e,...t})=>(0,xr.jsxs)("svg",{width:"16",height:"14",style:e,viewBox:"0 0 16 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[(0,xr.jsxs)("g",{clipPath:"url(#clip0_2115_829)",children:[(0,xr.jsx)("path",{d:"M2.34709 12.9404L2.3471 12.9404L2.34565 12.938L1.64031 11.7448L1.64004 11.7444L0.651257 10.0677C0.640723 10.0496 0.630746 10.0314 0.621325 10.0129H4.16461L2.39424 13.0139C2.3775 12.9901 2.36178 12.9656 2.34709 12.9404Z",fill:"#0066DA",stroke:"#6366F1"}),(0,xr.jsx)("path",{d:"M8 4.48713L5.47995 0.215332C5.23253 0.358922 5.02176 0.556358 4.87514 0.80764L0.219931 8.70508C0.076007 8.95094 0.000191627 9.22937 0 9.51277H5.04009L8 4.48713Z",fill:"#00AC47"}),(0,xr.jsx)("path",{d:"M13.48 13.7847C13.7274 13.6411 13.9382 13.4437 14.0848 13.1924L14.3781 12.6988L15.7801 10.3206C15.9267 10.0693 16.0001 9.79114 16.0001 9.51294H10.9596L12.0321 11.577L13.48 13.7847Z",fill:"#EA4335"}),(0,xr.jsx)("path",{d:"M8.00003 4.48718L10.5201 0.215385C10.2726 0.0717949 9.98857 0 9.69533 0H6.30472C6.01148 0 5.7274 0.0807692 5.47998 0.215385L8.00003 4.48718Z",fill:"#00832D"}),(0,xr.jsx)("path",{d:"M10.9599 9.51294H5.04007L2.52002 13.7847C2.76744 13.9283 3.05152 14.0001 3.34476 14.0001H12.6552C12.9484 14.0001 13.2325 13.9194 13.4799 13.7847L10.9599 9.51294Z",fill:"#2684FC"}),(0,xr.jsx)("path",{d:"M13.4525 4.75636L11.1249 0.80764C10.9782 0.556358 10.7675 0.358922 10.52 0.215332L8 4.48713L10.9599 9.51277H15.9908C15.9908 9.23456 15.9175 8.95636 15.7709 8.70508L13.4525 4.75636Z",fill:"#FFBA00"})]}),(0,xr.jsx)("defs",{children:(0,xr.jsx)("clipPath",{id:"clip0_2115_829",children:(0,xr.jsx)("rect",{width:"16",height:"14",fill:"white"})})})]});var Pp=m(require("styled-components")),ls=Pp.default.div`
|
|
2397
2397
|
display: flex;
|
|
2398
2398
|
flex-direction: column;
|
|
2399
2399
|
gap: 12px;
|
|
@@ -2401,24 +2401,24 @@ You will have to sign up with another method first to register a passkey for you
|
|
|
2401
2401
|
padding-bottom: 24px;
|
|
2402
2402
|
`,C2=Pp.default.div`
|
|
2403
2403
|
padding-bottom: 24px;
|
|
2404
|
-
`;var Dt=require("react/jsx-runtime"),w2={"google-drive":{name:"Google Drive",component:
|
|
2405
|
-
backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.jsx)(V,{protectedByPrivy:!0})]})};var Qo=require("react");var P2=require("react/jsx-runtime"),E2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=(0,Qo.useState)(""),[a,l]=(0,Qo.useState)(!1),[s,c]=(0,Qo.useState)(),[u,f]=(0,Qo.useState)(null),{authenticated:y}=H(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:v}=W(),{onSuccess:k,onFailure:P,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:A}=
|
|
2404
|
+
`;var Dt=require("react/jsx-runtime"),w2={"google-drive":{name:"Google Drive",component:Dc}},b2=()=>{let{logout:e}=H(),{navigate:t,setModalData:r,data:o}=_(),{recoveryOAuthFlow:n,closePrivyModal:i,createAnalyticsEvent:a}=W(),[l,s]=(0,Jo.useState)(!1),{provider:c,action:u,isInAccountCreateFlow:f}=o?.recoveryOAuthStatus,[y,g]=(0,Jo.useState)(void 0),[w,v]=(0,Jo.useState)(u==="create-wallet"),k=w2[c].name,P=w2[c].component,b=o?.recoverWallet?.onCompleteNavigateTo,A=new et(async(I="create-wallet")=>(v(!0),new Promise((q,J)=>{setTimeout(async()=>{try{let j=window.open();await n(c,I,j),s(!0),q()}catch{g({message:`${I==="recover"?"Recovery":"Back up"} with ${k} unsuccessful`,detail:u==="recover"?`Please verify that you are selecting the ${k} account associated with your backup.`:"Something went wrong.",retryable:!0}),J()}},0)})));(0,Jo.useEffect)(()=>{u==="create-wallet"&&A.execute("create-wallet")},[]),(0,Jo.useEffect)(()=>{if(!l)return;let I=setTimeout(()=>{f?(r({createWallet:{onSuccess:()=>{},onFailure:q=>{a({eventName:"embedded_wallet_creation_failure_logout",payload:{error:q,screen:"RecoveryOAuthScreen"}}),e()},callAuthOnSuccessOnClose:!0}}),t("EMBEDDED_WALLET_CREATED_SCREEN")):i({shouldCallAuthOnSuccess:!1})},st);return()=>clearTimeout(I)},[l]);let R=(0,Jo.useCallback)(async()=>{await A.execute("recover"),b?t(b):s(!0)},[]),N=l?"Success!":y?y.message:`Verifying connection to ${k}`,L="";return y?L=y.detail:l?L=`Successfully ${u==="recover"?"recovered":"backed up"} with Google.`:L=`${u==="recover"?"Recovering":"Backing up"} with Google...`,(0,Dt.jsxs)(Dt.Fragment,{children:[(0,Dt.jsx)(S,{}),w?(0,Dt.jsx)(Dt.Fragment,{children:(0,Dt.jsxs)(ls,{children:[(0,Dt.jsx)(De,{title:N,icon:(0,Dt.jsx)(P,{style:{width:"38px",height:"38px"}}),description:L}),y&&y?.retryable?(0,Dt.jsx)(O,{onClick:()=>{Bn(),g(void 0),u==="create-wallet"?A.execute("create-wallet"):R()},disabled:!l&&!y?.retryable,children:"Try again"}):null]})}):(0,Dt.jsxs)(ls,{children:[(0,Dt.jsx)(De,{title:"Confirm it's really you",icon:(0,Dt.jsx)(P,{style:{height:42,width:48}}),description:`To confirm your identity, please log in to Google Drive where your account is
|
|
2405
|
+
backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.jsx)(V,{protectedByPrivy:!0})]})};var Qo=require("react");var P2=require("react/jsx-runtime"),E2=()=>{let{app:e,navigate:t,data:r,onUserCloseViaDialogOrKeybindRef:o}=_(),[n,i]=(0,Qo.useState)(""),[a,l]=(0,Qo.useState)(!1),[s,c]=(0,Qo.useState)(),[u,f]=(0,Qo.useState)(null),{authenticated:y}=H(),{closePrivyModal:g,isNewUserThisSession:w,initializeWalletProxy:v}=W(),{onSuccess:k,onFailure:P,callAuthOnSuccessOnClose:b}=r.createWallet,{createWallet:A}=Ql(),[R,N]=(0,Qo.useState)(null),L=new et(async()=>{try{let J=await A(s);if(!J)return;N(J),w?t("EMBEDDED_WALLET_CREATED_SCREEN"):(k(J),g({shouldCallAuthOnSuccess:b}))}catch(J){i(J.message)}});(0,Qo.useEffect)(()=>{u||v(3e4).then(J=>f(J))},[u]),(0,Qo.useEffect)(()=>{if(!y){t("LANDING"),P(new Error("User must be authenticated before creating a Privy wallet"));return}},[y]);let I=()=>{R&&R?.recoveryMethod!=="user-passcode"?(P(new Yt("User created a wallet but failed to set a password for it")),g({shouldCallAuthOnSuccess:!1})):R?(k(R),g({shouldCallAuthOnSuccess:b})):(P(new Yt("User wallet creation failed")),g({shouldCallAuthOnSuccess:!1}))};o.current=()=>null;let q=async()=>{l(!0);let J=250;return L.execute().then(()=>new Promise(j=>setTimeout(j,J))).finally(()=>l(!1))};return(0,P2.jsx)(tc,{config:{initiatedBy:"automatic"},appName:e?.name||"privy",loading:!u,buttonLoading:a,buttonHideAnimations:!R&&a,error:n,password:s||"",onClose:I,onPasswordChange:c,onPasswordGenerate:()=>c(ec()),onSubmit:q})};var T2=m(require("@heroicons/react/24/outline/LockClosedIcon")),S2=m(require("@heroicons/react/24/outline/PencilSquareIcon")),x2=m(require("@heroicons/react/24/outline/QuestionMarkCircleIcon")),_2=require("react");var Ze=require("react/jsx-runtime"),iw=({onClose:e})=>(0,Ze.jsxs)(C2,{children:[(0,Ze.jsx)(De,{title:"Why do I need to secure my account?",icon:(0,Ze.jsx)(x2.default,{width:48}),description:(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)("p",{children:"Your app uses cryptography to secure your account. App secrets are split and encrypted so only you can access them."}),(0,Ze.jsx)("p",{children:"To use this app on new devices, secure account secrets using a password, your Google or your Apple account. It\u2019s important you don\u2019t lose access to the method you choose."})]})}),(0,Ze.jsx)(O,{onClick:e,children:"Select backup method"})]}),k2=()=>{let{navigate:e,setModalData:t,data:r}=_(),{user:o}=H(),{embeddedWallets:n}=Nr(),a=Ve(o)===null,[l,s]=(0,_2.useState)(!1);return(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)(S,{backFn:l?()=>s(!1):void 0,infoFn:l?void 0:()=>s(!0)},"header"),l?(0,Ze.jsx)(iw,{onClose:()=>s(!1)}):(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)(De,{title:"Secure your account",icon:(0,Ze.jsx)(T2.default,{width:48}),description:"Select a method for logging in on new devices and recovering your account."}),(0,Ze.jsx)(ls,{children:n.userOwnedRecoveryOptions.map(c=>{switch(c){case"google-drive":return(0,Ze.jsxs)(je,{onClick:async()=>{t({recoveryOAuthStatus:{provider:"google-drive",action:a?"create-wallet":"set-recovery",isInAccountCreateFlow:r?.recoverySelection?.isInAccountCreateFlow??!1}}),e("EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN")},children:[(0,Ze.jsx)(Dc,{style:{width:18}})," Back up to Google Drive"]},c);case"user-passcode":return(0,Ze.jsxs)(je,{onClick:()=>{e(a?"EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN":"EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN")},children:[(0,Ze.jsx)(S2.default,{style:{width:18}})," Set a password"]},c);default:return null}})})]}),(0,Ze.jsx)(V,{protectedByPrivy:!0})]})};var Tp=require("@ethersproject/bignumber"),ht=require("react"),ai=m(require("styled-components"));function A2(e){return e.to&&e.data?"CONTRACT_CALL":e.to&&e.value?"SEND":"UNKNOWN"}var fa=require("@heroicons/react/24/outline"),O2=require("react"),dr=m(require("styled-components"));var cs=require("@ethersproject/logger"),aw=new Set([cs.ErrorCode.CALL_EXCEPTION,cs.ErrorCode.NONCE_EXPIRED,cs.ErrorCode.REPLACEMENT_UNDERPRICED,cs.ErrorCode.TRANSACTION_REPLACED]),R2=e=>{let t;return e.code&&e.code!==-32e3&&aw.has(e.code)&&(t=e.transactionHash),t},I2=e=>e.code==="SERVER_ERROR"?e.error?.message??e.reason??e.message??"unknown error":e.error?.code==="SERVER_ERROR"?e.error?.error?.message??e.reason??e.message??"unknown error":e.reason??e.message??"unknown error";var Ge=require("react/jsx-runtime"),sw=e=>{let t=e.code?e.code?.toString().charAt(0)+e.code?.toString().slice(1).replace("_"," ").toLowerCase():"Something went wrong.",r=R2(e),o=I2(e);return{errorCode:t,transactionHash:r,errorMessage:o}},lw=()=>(0,Ge.jsxs)(uw,{children:[(0,Ge.jsx)(fw,{}),(0,Ge.jsx)(mw,{})]}),N2=({transactionError:e,chainId:t,onClose:r,onRetry:o})=>{let{chains:n}=W(),[i,a]=(0,O2.useState)(!1),{errorCode:l,transactionHash:s,errorMessage:c}=sw(e),u=n.find(f=>f.id===t)?.blockExplorers?.default.url??"https://etherscan.io";return(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(S,{onClose:r}),(0,Ge.jsxs)(cw,{children:[(0,Ge.jsx)(lw,{}),(0,Ge.jsx)(dw,{children:l}),(0,Ge.jsx)(pw,{children:"Please try again."}),(0,Ge.jsxs)(W2,{children:[(0,Ge.jsx)(M2,{children:"Error message"}),(0,Ge.jsx)(L2,{clickable:!1,children:c})]}),s&&(0,Ge.jsxs)(W2,{children:[(0,Ge.jsx)(M2,{children:"Transaction hash"}),(0,Ge.jsxs)(yw,{children:["Copy this hash to view details about the transaction on a"," ",(0,Ge.jsx)("u",{children:(0,Ge.jsx)("a",{href:u,children:"block explorer"})}),"."]}),(0,Ge.jsxs)(L2,{clickable:!0,onClick:async()=>{await navigator.clipboard.writeText(s),a(!0)},children:[s,(0,Ge.jsx)(Cw,{clicked:i})]})]}),(0,Ge.jsx)(hw,{onClick:o,children:"Retry transaction"})]}),(0,Ge.jsx)(z,{})]})},cw=dr.default.div`
|
|
2406
2406
|
display: flex;
|
|
2407
2407
|
flex-direction: column;
|
|
2408
2408
|
align-items: center;
|
|
2409
2409
|
justify-content: center;
|
|
2410
|
-
`,dw=
|
|
2411
|
-
color: var(--privy-color-
|
|
2410
|
+
`,dw=dr.default.span`
|
|
2411
|
+
color: var(--privy-color-foreground);
|
|
2412
2412
|
text-align: center;
|
|
2413
2413
|
font-size: 1.125rem;
|
|
2414
2414
|
font-weight: 500;
|
|
2415
2415
|
line-height: 1.25rem; /* 111.111% */
|
|
2416
2416
|
text-align: center;
|
|
2417
2417
|
margin: 10px;
|
|
2418
|
-
`,pw=
|
|
2418
|
+
`,pw=dr.default.span`
|
|
2419
2419
|
margin-top: 4px;
|
|
2420
2420
|
margin-bottom: 10px;
|
|
2421
|
-
color: var(--privy-color-foreground);
|
|
2421
|
+
color: var(--privy-color-foreground-3);
|
|
2422
2422
|
text-align: center;
|
|
2423
2423
|
|
|
2424
2424
|
font-size: 0.875rem;
|
|
@@ -2426,7 +2426,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2426
2426
|
font-weight: 400;
|
|
2427
2427
|
line-height: 20px; /* 142.857% */
|
|
2428
2428
|
letter-spacing: -0.008px;
|
|
2429
|
-
`,uw=
|
|
2429
|
+
`,uw=dr.default.div`
|
|
2430
2430
|
position: relative;
|
|
2431
2431
|
width: 60px;
|
|
2432
2432
|
height: 60px;
|
|
@@ -2434,42 +2434,49 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2434
2434
|
display: flex;
|
|
2435
2435
|
justify-content: center;
|
|
2436
2436
|
align-items: center;
|
|
2437
|
-
`,mw=(0,
|
|
2437
|
+
`,mw=(0,dr.default)(fa.ExclamationCircleIcon)`
|
|
2438
2438
|
position: absolute;
|
|
2439
2439
|
width: 35px;
|
|
2440
2440
|
height: 35px;
|
|
2441
2441
|
color: var(--privy-color-error);
|
|
2442
|
-
`,fw=
|
|
2442
|
+
`,fw=dr.default.div`
|
|
2443
2443
|
position: absolute;
|
|
2444
2444
|
width: 60px;
|
|
2445
2445
|
height: 60px;
|
|
2446
2446
|
border-radius: 50%;
|
|
2447
2447
|
background-color: var(--privy-color-error);
|
|
2448
2448
|
opacity: 0.1;
|
|
2449
|
-
`,hw=(0,
|
|
2449
|
+
`,hw=(0,dr.default)(O)`
|
|
2450
2450
|
&& {
|
|
2451
2451
|
margin-top: 24px;
|
|
2452
2452
|
}
|
|
2453
2453
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2454
|
-
`,M2=
|
|
2454
|
+
`,M2=dr.default.span`
|
|
2455
2455
|
width: 100%;
|
|
2456
2456
|
text-align: left;
|
|
2457
2457
|
font-size: 0.825rem;
|
|
2458
2458
|
color: var(--privy-color-foreground);
|
|
2459
2459
|
padding: 4px;
|
|
2460
|
-
`,W2=
|
|
2460
|
+
`,W2=dr.default.div`
|
|
2461
2461
|
width: 100%;
|
|
2462
|
-
margin:
|
|
2462
|
+
margin: 5px;
|
|
2463
2463
|
display: flex;
|
|
2464
2464
|
flex-direction: column;
|
|
2465
2465
|
justify-content: center;
|
|
2466
2466
|
align-items: center;
|
|
2467
|
-
`,
|
|
2467
|
+
`,yw=dr.default.text`
|
|
2468
2468
|
position: relative;
|
|
2469
2469
|
width: 100%;
|
|
2470
|
-
|
|
2471
|
-
padding: 8px 40px 8px 12px;
|
|
2470
|
+
padding: 5px;
|
|
2472
2471
|
font-size: 0.8rem;
|
|
2472
|
+
color: var(--privy-color-foreground-3);
|
|
2473
|
+
text-align: left;
|
|
2474
|
+
word-wrap: break-word;
|
|
2475
|
+
`,L2=dr.default.span`
|
|
2476
|
+
position: relative;
|
|
2477
|
+
width: 100%;
|
|
2478
|
+
background-color: var(--privy-color-background-2);
|
|
2479
|
+
padding: 8px 12px;
|
|
2473
2480
|
border-radius: 10px;
|
|
2474
2481
|
margin-top: 5px;
|
|
2475
2482
|
font-size: 14px;
|
|
@@ -2478,63 +2485,70 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2478
2485
|
word-wrap: break-word;
|
|
2479
2486
|
${e=>e.clickable&&`cursor: pointer;
|
|
2480
2487
|
transition: background-color 0.3s;
|
|
2488
|
+
padding-right: 45px;
|
|
2481
2489
|
|
|
2482
2490
|
&:hover {
|
|
2483
2491
|
background-color: var(--privy-color-foreground-4);
|
|
2484
2492
|
}`}
|
|
2485
|
-
`,
|
|
2493
|
+
`,gw=(0,dr.default)(fa.ClipboardDocumentIcon)`
|
|
2494
|
+
position: absolute;
|
|
2495
|
+
top: 13px;
|
|
2496
|
+
right: 13px;
|
|
2497
|
+
width: 24px;
|
|
2498
|
+
height: 24px;
|
|
2499
|
+
`,vw=(0,dr.default)(fa.ClipboardDocumentCheckIcon)`
|
|
2486
2500
|
position: absolute;
|
|
2487
2501
|
top: 13px;
|
|
2488
2502
|
right: 13px;
|
|
2489
|
-
width:
|
|
2490
|
-
height:
|
|
2491
|
-
|
|
2503
|
+
width: 24px;
|
|
2504
|
+
height: 24px;
|
|
2505
|
+
`,Cw=({clicked:e})=>e?(0,Ge.jsx)(vw,{}):(0,Ge.jsx)(gw,{});var Uc=require("@ethersproject/bignumber"),D2=m(require("styled-components"));var Io=require("react/jsx-runtime"),ww=(e,t)=>{if(e.gasUsed&&e.effectiveGasPrice)try{let r=Uc.BigNumber.from(e.gasUsed),o=Uc.BigNumber.from(e.effectiveGasPrice),n=r.mul(o);if(t){let i=Uc.BigNumber.from(t);n=n.add(i)}return n.toString()}catch{return}else return},U2=({txn:e,receipt:t,transactionInfo:r,onClose:o,tokenPrice:n,tokenSymbol:i,l1GasEstimate:a,receiptHeader:l,receiptDescription:s})=>(0,Io.jsxs)(Io.Fragment,{children:[(0,Io.jsx)(S,{onClose:o}),(0,Io.jsx)(Ia,{title:l??"Transaction complete!",description:s??"You're all set."}),(0,Io.jsx)(aa,{tokenPrice:n,from:t.from,to:t.to,gas:ww(t,a),txn:e,transactionInfo:r,tokenSymbol:i}),(0,Io.jsx)(bw,{loading:!1,onClick:o,children:"All Done"}),(0,Io.jsx)(z,{})]}),bw=(0,D2.default)(O)`
|
|
2492
2506
|
&& {
|
|
2493
2507
|
margin-top: 24px;
|
|
2494
2508
|
}
|
|
2495
2509
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2496
|
-
`;var ke=require("react/jsx-runtime");var
|
|
2510
|
+
`;var ke=require("react/jsx-runtime");var Ew=({txn:e,txnFamily:t,uiOptions:r,tokenSymbol:o,tokenPrice:n})=>{if(t==="CONTRACT_CALL"){if(r.transactionInfo?.contractInfo)return(0,ke.jsx)(pp,{contractInfo:r.transactionInfo.contractInfo,description:r.description});if(r.senderInfo)return(0,ke.jsx)(pp,{contractInfo:r.senderInfo,description:r.description||r.senderInfo.actionText})}return(0,ke.jsx)(ke.Fragment,{children:(0,ke.jsx)(Ug,{description:r.description||r.transactionInfo?.description||"",txn:e,tokenSymbol:o,tokenPrice:n})})},B2=()=>{let{authenticated:e,getAccessToken:t}=H(),{wallets:r}=ua(),{walletProxy:o,closePrivyModal:n,getFiatOnRampConfig:i,rpcConfig:a,chains:l,nativeTokenSymbolForChainId:s,appId:c}=W(),{app:u,navigate:f,data:y,onUserCloseViaDialogOrKeybindRef:g,setModalData:w}=_(),{transactionRequest:v,onSuccess:k,onFailure:P,uiOptions:b,fundWalletConfig:A}=y.sendTransaction,[R,N]=(0,ht.useState)(null),[L,I]=(0,ht.useState)(null),[q,J]=(0,ht.useState)(""),[j,M]=(0,ht.useState)(),[ne,B]=(0,ht.useState)(),[be,fe]=(0,ht.useState)(!1),ve=()=>{J(""),M(void 0),B(void 0)},Ee=(Ut,fr,jr)=>{J(Ut),M(new tt(new vr(fr??Ut,jr??Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))},[ae,It]=(0,ht.useState)(!1),[Mt,er]=(0,ht.useState)(!0),[wt,Rr]=(0,ht.useState)(null),[$e,pt]=(0,ht.useState)(v),{tokenPrice:Ir,isTokenPriceLoading:tr}=Oc($e),it=s(v.chainId)||"ETH",[D,Rn]=(0,ht.useState)(null),[Re,se]=(0,ht.useState)(null),[le,Ie]=(0,ht.useState)(!0);(0,ht.useEffect)(()=>{e||(f("LANDING"),P(new Error("User must be authenticated before transacting with a Privy wallet")))},[e]);let Xe=(0,ht.useMemo)(()=>r.find(Ut=>Ut.walletClientType==="privy"),[r]),zc=async()=>{if(!Xe)return console.warn("No privy wallet found, cannot fund wallet.");let{signedUrl:Ut,externalTransactionId:fr}=await i(Xe.address,{config:A?.config||{}});w({fiatOnRampPrompt:{signedUrl:Ut},fiatOnRampStatus:{externalTransactionId:fr}}),f("FIAT_ON_RAMP_PROMPT_SCREEN")},si=(0,ht.useMemo)(()=>Wo($e.chainId,l,a,{appId:c}),[$e.chainId,a]);async function li(){let Ut=$e;if(!await t()||!o||!Xe)return;try{Ut=await da(Xe.address,$e,si),pt(Ut)}catch(Mo){console.error(Mo),Ee("There was an error preparing your transaction. Your transaction request will likely fail.",Mo.reason)}let jr=Tp.BigNumber.from(0),Mn=Tp.BigNumber.from(0);try{({totalGasEstimate:jr,l1ExecutionFeeEstimate:Mn}=await ca(Ut,si)),Rn(jr.toHexString()),se(Mn.toHexString())}catch{Rn(null)}try{let{balance:Mo,hasSufficientFunds:ms}=await Wc(Xe.address,Ut,jr,si);Rr(Mo.toHexString()),ms||(er(!1),Ee("Wallet has insufficient funds for this transaction."),u?.fiatOnRamp.enabled&&fe(!0))}catch(Mo){console.warn(`Failed to fetch wallet balance with error: ${Mo}`)}Ie(!1)}(0,ht.useEffect)(()=>{li()},[o]);let In=A2($e),qc=In==="SEND"?`Send ${it}`:"Review transaction",yt={modalTitle:b.header||b.modalTitle||qc,buttonText:b.buttonText||"Submit"},en=()=>{ae||(L?k(L):P(j||new tt(new vr("The user rejected the request",Wt.E4001_USER_REJECTED_REQUEST.eipCode))),n({shouldCallAuthOnSuccess:!1}))};return g.current=en,Ir===void 0&&tr||le?(0,ke.jsxs)(ke.Fragment,{children:[b.transactionInfo?.contractInfo?.imgUrl&&(0,ke.jsx)(al,{src:b.transactionInfo?.contractInfo?.imgUrl}),(0,ke.jsx)(S,{title:yt.modalTitle,onClose:en}),(0,ke.jsx)(F2,{children:(0,ke.jsx)(Ui,{})})]}):R!==null?(0,ke.jsx)(U2,{txn:$e,onClose:en,receipt:R,transactionInfo:b.transactionInfo,tokenPrice:Ir,tokenSymbol:it,l1GasEstimate:Re,receiptHeader:b.successHeader,receiptDescription:b.successDescription}):ne?(0,ke.jsx)(N2,{transactionError:ne,chainId:$e.chainId,onClose:en,onRetry:()=>{ve(),li()}}):(0,ke.jsxs)(ke.Fragment,{children:[(0,ke.jsx)(S,{title:yt.modalTitle,onClose:en}),(0,ke.jsxs)(F2,{children:[(0,ke.jsxs)(xw,{children:[(0,ke.jsx)(Ew,{txn:$e,txnFamily:In,uiOptions:b,tokenSymbol:it,tokenPrice:Ir}),Xe?(0,ke.jsx)(aa,{from:Xe.address,to:$e.to,txn:$e,transactionInfo:b.transactionInfo,gas:D||void 0,tokenPrice:Ir,tokenSymbol:it}):null]}),(0,ke.jsxs)(_w,{children:[(0,ke.jsx)(Pw,{children:q}),(0,ke.jsx)(Ng,{txn:$e,address:Xe?.address??"",hasFunds:Mt,balance:wt}),(0,ke.jsxs)(Tw,{children:[be&&(0,ke.jsx)(O,{onClick:zc,children:"Add Funds"}),(0,ke.jsx)(Sw,{disabled:ae||!Mt,loading:!o||ae,loadingText:ae?"Submitting (may take a few moments)...":"Loading...",onClick:async()=>{It(!0);let Ut=await t();if(Ut&&!ae&&Xe)try{let fr=await Mc(Ut,Xe.address,o,$e,si);I(fr);let jr=await fr.wait();N(Lc(jr)),ve()}catch(fr){console.warn({transaction:$e,error:fr}),B(fr),M(new tt(new vr(fr.reason??"Error processing transaction",Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}finally{It(!1)}},children:yt.buttonText})]})]})]})]})},F2=ai.default.div`
|
|
2497
2511
|
display: flex;
|
|
2498
2512
|
flex-direction: column;
|
|
2499
2513
|
justify-content: space-between;
|
|
2500
2514
|
flex-grow: 1;
|
|
2501
2515
|
padding-bottom: 16px;
|
|
2502
|
-
`,
|
|
2516
|
+
`,Pw=ai.default.div`
|
|
2503
2517
|
font-size: 13px;
|
|
2504
2518
|
color: var(--privy-color-error);
|
|
2505
2519
|
width: 100%;
|
|
2506
2520
|
margin-top: 16px;
|
|
2507
|
-
`,
|
|
2521
|
+
`,Tw=ai.default.div`
|
|
2508
2522
|
display: flex;
|
|
2509
2523
|
direction: row;
|
|
2510
2524
|
justify-content: space-between;
|
|
2511
2525
|
align-items: center;
|
|
2512
2526
|
gap: 8px;
|
|
2513
|
-
`,
|
|
2527
|
+
`,Sw=(0,ai.default)(O)`
|
|
2514
2528
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2515
|
-
`,
|
|
2529
|
+
`,xw=ai.default.div`
|
|
2516
2530
|
height: 100%;
|
|
2517
2531
|
display: flex;
|
|
2518
2532
|
flex-direction: column;
|
|
2519
2533
|
justify-content: space-evenly;
|
|
2520
2534
|
flex-grow: 1;
|
|
2521
|
-
`,
|
|
2535
|
+
`,_w=ai.default.div`
|
|
2522
2536
|
display: flex;
|
|
2523
2537
|
flex-direction: column;
|
|
2524
2538
|
gap: 8px;
|
|
2525
|
-
`;var H2=require("@ethersproject/bytes"),G2=require("@ethersproject/strings"),_n=require("react"),po=m(require("styled-components"));var Ae=require("react/jsx-runtime"),
|
|
2539
|
+
`;var H2=require("@ethersproject/bytes"),G2=require("@ethersproject/strings"),_n=require("react"),po=m(require("styled-components"));var Ae=require("react/jsx-runtime"),kw=e=>{if(!(0,H2.isHexString)(e))return e;try{return(0,G2.toUtf8String)(e)}catch{return e}},Aw=e=>JSON.stringify(e,null,2),Rw=({data:e})=>{let t=r=>typeof r=="object"&&r!==null?(0,Ae.jsx)(Ow,{children:Object.entries(r).map(([o,n])=>(0,Ae.jsxs)("li",{children:[(0,Ae.jsxs)("strong",{children:[o,":"]})," ",t(n)]},o))}):(0,Ae.jsx)("span",{children:String(r)});return(0,Ae.jsx)("div",{children:t(e)})},Iw=e=>{let{types:t,primaryType:r,...o}=e.typedData;return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(z2,{children:(0,Ae.jsx)(Rw,{data:o})}),(0,Ae.jsx)(wn,{text:Aw(e.typedData),itemName:"full payload to clipboard"})," "]})},V2=()=>{let{authenticated:e}=H(),{initializeWalletProxy:t,closePrivyModal:r}=W(),{navigate:o,data:n,onUserCloseViaDialogOrKeybindRef:i}=_(),[a,l]=(0,_n.useState)(!0),[s,c]=(0,_n.useState)(""),[u,f]=(0,_n.useState)(),[y,g]=(0,_n.useState)(null),w=y!==null;(0,_n.useEffect)(()=>{e||o("LANDING")},[e]),(0,_n.useEffect)(()=>{t(mi).then(I=>{l(!1),I||(c("An error has occurred, please try again."),f(new tt(new vr(s,Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))))})},[]);let{method:v,data:k,confirmAndSign:P,onSuccess:b,onFailure:A,uiOptions:R}=n.signMessage,N={title:R.title||"Sign message",description:R.description||"Signing this message will not cost you any fees.",buttonText:R.buttonText||"Sign and continue"},L=I=>{I?b(I):A(u||new tt(new vr("The user rejected the request.",Wt.E4001_USER_REJECTED_REQUEST.eipCode))),r({shouldCallAuthOnSuccess:!1}),g(null),c(""),f(void 0)};return i.current=()=>{L(y)},(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsx)(S,{onClose:()=>L(y)}),(0,Ae.jsx)(ce,{}),(0,Ae.jsxs)(Mw,{children:[(0,Ae.jsx)(Ww,{children:N.title}),(0,Ae.jsx)(Lw,{children:N.description}),v==="personal_sign"&&(0,Ae.jsx)(z2,{children:kw(k)}),v==="eth_signTypedData_v4"&&(0,Ae.jsx)(Iw,{typedData:k}),(0,Ae.jsx)(Nw,{fail:!0,children:s}),(0,Ae.jsx)(Uw,{success:w,loading:a,disabled:w,onClick:async()=>{try{let I=await P();g(I),c(""),setTimeout(()=>{L(I)},st)}catch{c("An error has occurred, please try again."),f(new tt(new vr(s,Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode)))}},children:w?(0,Ae.jsxs)(Dw,{children:[(0,Ae.jsx)(rc,{style:{height:"0.9rem",width:"0.9rem"},strokeWidth:2})," ",(0,Ae.jsx)("span",{children:"Success"})]}):N.buttonText})]}),(0,Ae.jsx)(ye,{}),(0,Ae.jsx)(V,{protectedByPrivy:!0})]})},Mw=po.default.div`
|
|
2526
2540
|
display: flex;
|
|
2527
2541
|
flex-direction: column;
|
|
2528
2542
|
align-items: center;
|
|
2529
2543
|
justify-content: center;
|
|
2530
|
-
`,
|
|
2544
|
+
`,Ww=po.default.span`
|
|
2531
2545
|
color: var(--privy-color-foreground);
|
|
2532
2546
|
text-align: center;
|
|
2533
2547
|
font-size: 1.125rem;
|
|
2534
2548
|
font-weight: 500;
|
|
2535
2549
|
line-height: 1.25rem; /* 111.111% */
|
|
2536
2550
|
text-align: center;
|
|
2537
|
-
`,
|
|
2551
|
+
`,Lw=po.default.span`
|
|
2538
2552
|
margin-top: 4px;
|
|
2539
2553
|
color: var(--privy-color-foreground);
|
|
2540
2554
|
text-align: center;
|
|
@@ -2563,7 +2577,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2563
2577
|
display: none; /* Safari and Chrome */
|
|
2564
2578
|
}
|
|
2565
2579
|
}
|
|
2566
|
-
`,
|
|
2580
|
+
`,Ow=po.default.ul`
|
|
2567
2581
|
margin-left: 12px !important;
|
|
2568
2582
|
white-space: nowrap;
|
|
2569
2583
|
|
|
@@ -2575,7 +2589,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2575
2589
|
font-weight: 500 !important;
|
|
2576
2590
|
}
|
|
2577
2591
|
}
|
|
2578
|
-
`,
|
|
2592
|
+
`,Nw=po.default.div`
|
|
2579
2593
|
line-height: 20px;
|
|
2580
2594
|
height: 20px;
|
|
2581
2595
|
font-size: 13px;
|
|
@@ -2585,11 +2599,11 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2585
2599
|
width: 100%;
|
|
2586
2600
|
margin-top: 16px;
|
|
2587
2601
|
margin-bottom: 4px;
|
|
2588
|
-
`,
|
|
2602
|
+
`,Dw=po.default.span`
|
|
2589
2603
|
display: flex;
|
|
2590
2604
|
align-items: center;
|
|
2591
2605
|
gap: 8px;
|
|
2592
|
-
`,
|
|
2606
|
+
`,Uw=(0,po.default)(O)`
|
|
2593
2607
|
transition: color 350ms ease, background-color 350ms ease;
|
|
2594
2608
|
|
|
2595
2609
|
${e=>e.success&&po.css`
|
|
@@ -2598,9 +2612,9 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2598
2612
|
color: #ffffff;
|
|
2599
2613
|
}
|
|
2600
2614
|
`}
|
|
2601
|
-
`;var K2=m(require("@heroicons/react/24/outline/EnvelopeIcon"));var q2=m(require("@heroicons/react/24/outline/EnvelopeIcon")),
|
|
2615
|
+
`;var K2=m(require("@heroicons/react/24/outline/EnvelopeIcon"));var q2=m(require("@heroicons/react/24/outline/EnvelopeIcon")),ds=require("react"),Sp=m(require("styled-components"));var uo=require("react/jsx-runtime"),$2=(0,ds.forwardRef)((e,t)=>{let[r,o]=(0,ds.useState)(""),[n,i]=(0,ds.useState)(!1),{authenticated:a,user:l}=H(),{initUpdateEmail:s}=W(),{navigate:c,setModalData:u,currentScreen:f}=_(),{enabled:y,token:g}=Me(),w=Ss(r),v=n,k=n||!w,P=async A=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");i(!0);try{await s(l.email.address,r,A),c("AWAITING_PASSWORDLESS_CODE")}catch(R){u({errorModalData:{error:R,previousScreen:f||"LANDING"}})}i(!1)},b=()=>{y&&!g&&!a?(u({captchaModalData:{callback:A=>{if(!l?.email)throw new Error("User is required to have an email address to update it.");return s(l.email.address,r,A)},userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_PASSWORDLESS_CODE",onErrorNavigateTo:"ERROR_SCREEN"}}),c("CAPTCHA_SCREEN")):P(g)};return(0,uo.jsxs)(uo.Fragment,{children:[(0,uo.jsx)(Fw,{children:(0,uo.jsxs)(Bw,{children:[(0,uo.jsx)(q2.default,{}),(0,uo.jsx)("input",{ref:t,id:"email-input",type:"email",placeholder:"your@email.com",onChange:A=>o(A.target.value),onKeyUp:A=>{A.key==="Enter"&&b()},value:r,autoComplete:"email"}),e.stacked?null:(0,uo.jsx)(Ai,{isSubmitting:v,onClick:b,disabled:k,children:"Submit"})]})}),e.stacked?(0,uo.jsx)(O,{loadingText:null,loading:v,disabled:k,onClick:b,children:"Submit"}):null]})}),Fw=Sp.default.div`
|
|
2602
2616
|
width: 100%;
|
|
2603
|
-
`,
|
|
2617
|
+
`,Bw=Sp.default.label`
|
|
2604
2618
|
display: block;
|
|
2605
2619
|
position: relative;
|
|
2606
2620
|
width: 100%;
|
|
@@ -2658,7 +2672,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2658
2672
|
&& > input::placeholder {
|
|
2659
2673
|
color: var(--privy-color-foreground-3);
|
|
2660
2674
|
}
|
|
2661
|
-
`;var
|
|
2675
|
+
`;var _r=require("react/jsx-runtime"),j2=()=>(0,_r.jsxs)(_r.Fragment,{children:[(0,_r.jsx)(S,{},"header"),(0,_r.jsx)(ce,{}),(0,_r.jsx)(De,{title:"Update your email",description:"Add the email address you'd like to use going forward. We'll send you a confirmation code",icon:(0,_r.jsx)(K2.default,{color:"var(--privy-color-accent)",strokeWidth:2,height:"48px",width:"48px"})}),(0,_r.jsx)(Hr,{children:(0,_r.jsx)($2,{stacked:!0})}),(0,_r.jsx)(ye,{}),(0,_r.jsx)(V,{protectedByPrivy:!0})]});var Fc=m(require("styled-components"));var xp=require("react/jsx-runtime"),Y2=({style:e,...t})=>(0,xp.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"38px",width:"38px",...e},...t,children:(0,xp.jsx)("path",{d:"M20 13.6V20M20 26.4H20.016M36 20C36 28.8365 28.8366 36 20 36C11.1635 36 4.00001 28.8365 4.00001 20C4.00001 11.1634 11.1635 3.99999 20 3.99999C28.8366 3.99999 36 11.1634 36 20Z",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round"})});var pr=require("react/jsx-runtime"),Z2=()=>{let{navigate:e}=_();return(0,pr.jsxs)(pr.Fragment,{children:[(0,pr.jsx)(S,{}),(0,pr.jsxs)(Hw,{children:[(0,pr.jsx)(Gw,{children:(0,pr.jsx)(Y2,{})}),(0,pr.jsxs)(Vw,{children:[(0,pr.jsx)("h3",{children:"Unable to sign in"}),(0,pr.jsx)("p",{children:"This application has reached its user limit and cannot sign in new users."})]}),(0,pr.jsx)(O,{onClick:()=>{e("LANDING")},children:"Go back"})]}),(0,pr.jsx)(V,{protectedByPrivy:!0})]})},Hw=Fc.default.div`
|
|
2662
2676
|
display: flex;
|
|
2663
2677
|
flex-direction: column;
|
|
2664
2678
|
align-items: center;
|
|
@@ -2667,7 +2681,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2667
2681
|
width: 100%;
|
|
2668
2682
|
padding-top: 8px;
|
|
2669
2683
|
padding-bottom: 32px;
|
|
2670
|
-
`,
|
|
2684
|
+
`,Gw=Fc.default.div`
|
|
2671
2685
|
display: flex;
|
|
2672
2686
|
align-items: center;
|
|
2673
2687
|
justify-content: center;
|
|
@@ -2676,11 +2690,11 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2676
2690
|
color: var(--privy-color-error);
|
|
2677
2691
|
background-color: var(--privy-color-error-light);
|
|
2678
2692
|
border-radius: 50%;
|
|
2679
|
-
`,
|
|
2693
|
+
`,Vw=Fc.default.div`
|
|
2680
2694
|
display: flex;
|
|
2681
2695
|
flex-direction: column;
|
|
2682
2696
|
gap: 8px;
|
|
2683
|
-
`;var Bc=m(require("styled-components"));var
|
|
2697
|
+
`;var Bc=m(require("styled-components"));var zw=`
|
|
2684
2698
|
*,
|
|
2685
2699
|
::before,
|
|
2686
2700
|
::after {
|
|
@@ -2910,7 +2924,7 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
2910
2924
|
[hidden] {
|
|
2911
2925
|
display: none;
|
|
2912
2926
|
}
|
|
2913
|
-
`,J2=
|
|
2927
|
+
`,J2=zw;var Q2=Bc.createGlobalStyle`
|
|
2914
2928
|
:root {
|
|
2915
2929
|
// Borders
|
|
2916
2930
|
--privy-border-radius-sm: 6px;
|
|
@@ -3005,4 +3019,4 @@ backed up.`}),(0,Dt.jsx)(O,{onClick:R,children:"Confirm with Google"})]}),(0,Dt.
|
|
|
3005
3019
|
opacity: 1;
|
|
3006
3020
|
}
|
|
3007
3021
|
}
|
|
3008
|
-
`;var dt=require("react/jsx-runtime"),Gw={["LANDING"]:b1,["CONNECT_OR_CREATE"]:w1,["AWAITING_PASSWORDLESS_CODE"]:bf,["AWAITING_CONNECTION"]:Kf,["AWAITING_CONNECT_ONLY_CONNECTION"]:Zf,["AWAITING_FARCASTER_CONNECTION"]:by,["AWAITING_FARCASTER_SIGNER"]:Sy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:u2,["PHANTOM_INTERSTITIAL_SCREEN"]:y2,["LOGIN_FAILED_SCREEN"]:D1,["AWAITING_OAUTH_SCREEN"]:p2,["ALLOWLIST_REJECTION_SCREEN"]:df,["USER_LIMIT_REACHED_SCREEN"]:Z2,["INSTALL_PHANTOM_SCREEN"]:Ky,["LINK_EMAIL_SCREEN"]:P1,["LINK_PHONE_SCREEN"]:L1,["LINK_WALLET_SCREEN"]:O1,["LINK_PASSKEY_SCREEN"]:I1,["UPDATE_EMAIL_SCREEN"]:j2,["CONNECT_ONLY_LANDING_SCREEN"]:zf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Uf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:yh,["EMBEDDED_WALLET_CREATED_SCREEN"]:lh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ih,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:v2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:k2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:b2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:mh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:V2,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:B2,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ly,["FIAT_ON_RAMP_STATUS_SCREEN"]:Fy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:oy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Xh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:E2,["MFA_ENROLLMENT_FLOW_SCREEN"]:gg,["CAPTCHA_SCREEN"]:Af,["ERROR_SCREEN"]:ay,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Gy,["AFFIRMATIVE_CONSENT_SCREEN"]:sf},Vw=["LANDING","AWAITING_CONNECTION"],zw=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=Or(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=Me(),f=(0,Xo.useRef)(null),y=jm(f),g=o&&a&&Vw.includes(a)&&!n&&l==="ready";if((0,Xo.useEffect)(()=>{g&&s()},[g]),(0,Xo.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,dt.jsxs)(na,{id:"privy-modal-content",children:[(0,dt.jsx)(S,{}),(0,dt.jsx)(ce,{}),(0,dt.jsx)(tg,{children:(0,dt.jsx)(Et,{})}),(0,dt.jsx)(ye,{}),(0,dt.jsx)(z,{})]});if(!a&&e)return(0,dt.jsx)(na,{style:{height:y},id:"privy-modal-conent",children:(0,dt.jsx)("div",{ref:f,children:(0,dt.jsx)(bp,{open:e,onClose:t})})});if(!a)return null;let w=Gw[a];return(0,dt.jsx)(na,{style:{height:y},id:"privy-modal-content",children:(0,dt.jsxs)("div",{ref:f,children:[(0,dt.jsx)(Fo,{if:!!e,children:(0,dt.jsx)(w,{})}),(0,dt.jsx)(Fo,{if:!e,children:(0,dt.jsx)(bp,{open:e,onClose:t})})]})})},qw=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,Xo.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},t3=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=qw(),[o,n]=(0,Xo.useState)(!1);Al({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,dt.jsx)(X2,{children:(0,dt.jsx)(zw,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,dt.jsx)(eg,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return e3.default.createPortal(l,s)}return l};var r3=require("react"),fa=require("react");var Hc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function kn(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ot("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((y,g)=>{r.current={resolve:y,reject:g};let w=1e3*60*5;setTimeout(()=>{let v=new ot("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},w)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let u=new ot("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var n3=require("react/jsx-runtime"),$w=function(e){return()=>`id-${e++}`}(0);function Kw(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function _r(e){return e.error!==void 0}var pr=new Hc,_p=new Map,jw=(e,t)=>typeof t=="bigint"?t.toString():t,Yw=(e,t)=>`${e}${JSON.stringify(t,jw)}`;function kr(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=Yw(e,t);if(e==="privy:wallet:create"){let l=_p.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=$w();pr.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{_p.delete(i)});return _p.set(i,a),a}function Zw(e){switch(e.event){case"privy:iframe:ready":let t=pr.dequeue(e.event,e.id);return _r(e)?t.reject(new ot(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=pr.dequeue(e.event,e.id);return _r(e)?r.reject(new ot(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=pr.dequeue(e.event,e.id);return _r(e)?o.reject(new ot(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=pr.dequeue(e.event,e.id);return _r(e)?n.reject(new ot(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=pr.dequeue(e.event,e.id);return _r(e)?i.reject(new ot(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=pr.dequeue(e.event,e.id);return _r(e)?a.reject(new ot(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=pr.dequeue(e.event,e.id);return _r(e)?l.reject(new ot(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=pr.dequeue(e.event,e.id);return _r(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function o3(e){let t=(0,fa.useRef)(null),r=(0,fa.useRef)(e.mfaMethods),o=kl(),[n,i]=(0,r3.useState)(!1);return(0,fa.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,fa.useEffect)(()=>{if(!n)return;let a=t.current;if(!a)return;function l(y){y&&y.origin===e.origin&&Kw(y.data)&&Zw(y.data)}let s={create(y){return kr("privy:wallet:create",y,a,e.origin)},connect(y){return kr("privy:wallet:connect",y,a,e.origin)},recover(y){return kn(g=>kr("privy:wallet:recover",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(y){return kn(g=>kr("privy:wallet:rpc",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(y){return kn(g=>kr("privy:wallet:set-recovery-password",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(y){return kn(g=>kr("privy:mfa:verify",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(y){return kn(g=>kr("privy:mfa:init-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(y){return kn(g=>kr("privy:mfa:submit-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(y){return kn(g=>kr("privy:mfa:unenroll",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(y){return kr("privy:mfa:clear",y,a,e.origin)},initFarcasterSigner(y){return kr("privy:farcaster:init-signer",y,a,e.origin)},signFarcasterMessage(y){return kr("privy:farcaster:sign",y,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...y)=>{console.warn("Privy iframe failed to load: ",...y),e.onLoadFailed()},f=new AbortController;return Pu(()=>kr("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),(0,n3.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:Ss(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Gc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function i3({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var a3=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});var ur=require("react/jsx-runtime"),An;function Jw(e){return typeof e=="string"&&e.length===25}function Oe(){if(!An){let e=oe.get(Ln);return Promise.resolve(e||null)}return An.getAccessToken()}var l3,Ju=(e,t)=>l3(e,t),c3,Qu=(e,t)=>c3(e,t),d3,Xu=(e,t)=>d3(e,t),p3,em=()=>p3(),Qw=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;oe.put(ya,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},u3=({config:e,...t})=>{if(!Jw(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");An||(An=new _i({appId:t.appId,apiUrl:t.apiUrl||Ms}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,ur.jsx)(Rm,{client:An,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,ur.jsx)(Xw,{...t,client:An})})},Xw=e=>{let t=e.client,[r,o]=(0,ie.useState)(!1),[n,i]=(0,ie.useState)(!1),[a,l]=(0,ie.useState)(!1),[s,c]=(0,ie.useState)(null),[u,f]=(0,ie.useState)([]),y=(0,ie.useRef)(u),[g,w]=(0,ie.useState)(!1),[v,k]=(0,ie.useState)(null),[P,b]=(0,ie.useState)(!1),[A,R]=(0,ie.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[N,L]=(0,ie.useState)({status:"initial"}),[I,q]=(0,ie.useState)(null),[J,j]=(0,ie.useState)(null),[M,ne]=(0,ie.useState)(null),B=Or(),be=vl(),[fe,ve]=(0,ie.useState)(!0),[Ee,ae]=(0,ie.useState)({}),[It,Mt]=(0,ie.useState)(null),[er,wt]=(0,ie.useState)(null),[Ar,qe]=(0,ie.useState)(!1),[pt,Rr]=(0,ie.useState)(!1),tr=(0,ie.useRef)(null),it=(0,ie.useRef)(null),D=(0,ie.useRef)(Ym),[Rn,Re]=(0,ie.useState)(!1);t.onStoreToken=d=>{d&&U(D,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(D,"accessToken","onAccessTokenRemoved")};let se=(0,ie.useRef)(null),le=(0,ie.useRef)(null),Ie=d=>{k(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},Xe=d=>{B.embeddedWallets.createOnLogin!=="off"&&ve(!0),Ie(d)};(0,ie.useEffect)(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),(0,ie.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!M){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(M,d.address,B.defaultChain,e.appId)},[M,s]),(0,ie.useEffect)(()=>{M&&er?.(M)},[M]),(0,ie.useEffect)(()=>{(async()=>{if(!B.customAuth?.enabled)return;ve(!0);let{getCustomAccessToken:p,isLoading:h}=B.customAuth;if(!(!n||h))try{let C=await p();if(!C&&a){await ci.logout();return}if(!C||a)return;t.startAuthFlow(new di(C));let{user:x,isNewUser:G}=await t.authenticate();if(!x){await ci.logout();return}c(x||null),w(G||!1),l(!0),Rr(!0)}catch(C){console.warn(C),a&&await ci.logout()}})()},[B.customAuth?.enabled,B.customAuth?.getCustomAccessToken,B.customAuth?.isLoading,n,a]),(0,ie.useEffect)(()=>{pt&&M&&s&&Wr(s,B.embeddedWallets.createOnLogin)&&(Rr(!1),us(s,mi).catch(console.error))},[pt&&M&&s]),(0,ie.useEffect)(()=>{async function d(){let p=zc();Qw();let h=(0,s3.createStore)();q(h),t.initializeConnectorManager({walletConnectCloudProjectId:B.walletConnectCloudProjectId,rpcConfig:B.rpcConfig,chains:B.chains,defaultChain:B.defaultChain,store:h,walletList:B.appearance.walletList,shouldEnforceDefaultChainOnConnect:B.shouldEnforceDefaultChainOnConnect,appName:B.name??"Privy"});let C;t.connectors?.on("connectorInitialized",()=>{C&&clearTimeout(C);let G=t.connectors.walletConnectors.length,ee=t.connectors.walletConnectors.reduce((ut,gt)=>ut+(gt.initialized?1:0),0);ee===G?Re(!0):C=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:ee,expected:G}),Re(!0)},1500)}),t.connectors?.initialize().then(()=>{qc()});let x=await t.getAuthenticatedUser();B.customAuth?.enabled||(l(!!x),x&&U(D,"login","onComplete",x,!1,!0,null,null),c(x)),p||Pe.setReadyToTrue(!!x),p&&(x?le.current="link":le.current="login")}!n&&be&&d()},[t,It,n,be]),(0,ie.useEffect)(()=>{if(!n)return;if(!s){qe(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){qe(!0);return}let p=!!u.find(h=>h.walletClientType==="privy");qe(p)},[n,s,u]);let zc=()=>{let d=Pa();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new fo(d)),Xe("AWAITING_OAUTH_SCREEN"),!0)},si=async(d,p,h,C)=>{let x=await t.connectors?.createWalletConnector(d,p)||null;li(x,p,h,C)};async function li(d,p,h,C){if(d)R({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return R({status:"disconnected",connectedWallet:null,connectError:new de("Unable to connect to wallet."),connector:null,connectRetry:E}),C?.(null,h);d instanceof go&&p&&await d.resetConnection(p),R({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>li(d,p,h,C)});try{let x=await d.connect({showPrompt:!0});if(B.shouldEnforceDefaultChainOnConnect&&!B.chains.find(G=>G.id===Number(x?.chainId))&&!(x?.connectorType==="wallet_connect_v2"&&x?.walletClientType==="metamask")){R(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await x?.switchChain(B.defaultChain.id),x&&(x.chainId=ui(Wn(B.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${B.defaultChain.id}`)}}return R(G=>({...G,status:"connected",connectedWallet:x,connectError:null,connectRetry:E})),x&&!le.current&&U(D,"connectWallet","onSuccess",x),C?.(x,h)}catch(x){return x instanceof at?(console.warn(x.cause?x.cause:x.message),le.current||U(D,"connectWallet","onError",x.privyErrorCode||"generic_connect_wallet_error")):(console.warn(x),le.current||U(D,"connectWallet","onError","unknown_connect_wallet_error")),R(G=>({...G,status:"disconnected",connectedWallet:null,connectError:x})),C?.(null,h)}}let In=async(d,p)=>{if(d===null)return;let h=new Gn(d,p);t.startAuthFlow(h)},qc=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!on()&&Xe("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");Ie("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),si(p,h,void 0,In)};(0,ie.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let yt=()=>{if(!a)throw U(D,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},en=()=>{yt(),se.current="siwe",le.current="link",Ie("LINK_WALLET_SCREEN")},Ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},mr=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(R(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),B.captchaEnabled&&!a){let h={callback:C=>In(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ae({captchaModalData:h}),Xe("CAPTCHA_SCREEN")}else await In(d),Xe("AWAITING_CONNECTION")},jr=async(d,p)=>{if(!B.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:h,externalTransactionId:C}=await My(t,d,p?.config??{},B.appearance.palette,B.fiatOnRamp.useSandbox);return{signedUrl:h,externalTransactionId:C}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Mn=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:Ut(h),loginOrLink:async()=>{if(!await h.isConnected())throw new T("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");mr(h)},fund:async C=>{let{signedUrl:x,externalTransactionId:G}=await jr(h.address,C);ae({fiatOnRampPrompt:{signedUrl:x},fiatOnRampStatus:{externalTransactionId:G}}),Ie("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new T("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(h.address);c(C)}}))||[];return Js(d,p)?d:p})};(0,ie.useEffect)(()=>{Mn()},[s?.linkedAccounts,a,n]),(0,ie.useEffect)(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Mn(),t.connectors.on("walletsUpdated",Mn)}},[n]);let Mo=()=>{Ie(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ie.useEffect)(()=>{if(!u[0])return;let d=u[0],p=y.current.find(C=>C.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&h){let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(C)}y.current=u},[u]);let us=async(d,p)=>{if(Ge(d))throw U(D,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,x]=await Promise.all([Pe.initializeWalletProxy(p),Oe()]);if(!C&&B.customAuth?.enabled)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!x||B.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((G,ee)=>{ve(!0),ae({createWallet:{onSuccess:gt=>{U(D,"createWallet","onSuccess",gt),G(gt)},onFailure:gt=>{U(D,"createWallet","onError","unknown_embedded_wallet_error"),ee(gt)},callAuthOnSuccessOnClose:!1}}),Ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:x});let G=await Pe.refreshUser(),ee=Ge(G);if(!ee)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(D,"createWallet","onSuccess",ee),ee}},H3=d=>{if(!B.chains.map(p=>p.id).includes(d))throw new de(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Rp=(d,p,h)=>new Promise(async(C,x)=>{if(!a||!s){U(D,"sendTransaction","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=Ge(s);if(!G){U(D,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}ve(!0);let ee=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ut=d.chainId?Number(d.chainId):ee.chainId;H3(ut);let gt=Object.assign({},d,{chainId:ut}),Ir=async()=>{let $e=await Oe();if(!$e||!M){U(D,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Pe.recoverEmbeddedWallet()){U(D,"sendTransaction","onError","unknown_connect_wallet_error"),x(new Error("Unable to connect to wallet"));return}let jt=Wo(gt.chainId,B.chains,B.rpcConfig,{appId:e.appId}),$c=await da(G.address,gt,jt);if(B.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:V3}=await ca($c,jt),{hasSufficientFunds:z3}=await Mc(G.address,$c,V3,jt);if(!z3)throw new tt(new gr("Wallet has insufficient funds for this transaction.",Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Mp=await Ic($e,G.address,M,$c,jt);U(D,"sendTransaction","onSuccess",Mp),C(Mp)}catch(hr){U(D,"sendTransaction","onError","transaction_failure"),x(hr)}};if(B.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Ir();else{let $e={transactionRequest:gt,onSuccess:jt=>{U(D,"sendTransaction","onSuccess",jt),C(jt)},onFailure:jt=>{U(D,"sendTransaction","onError","transaction_failure"),x(jt)},uiOptions:p||{},fundWalletConfig:h},hr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:jt=>{U(D,"sendTransaction","onError","unknown_connect_wallet_error"),x(jt)}};ae({connectWallet:hr,sendTransaction:$e}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ip(){return new Promise(async(d,p)=>{let h=await Oe();if(!h||!M)throw new Error("Must have valid access token to enroll in MFA");try{await M.verifyMfa({accessToken:h}),d()}catch(C){p(C)}})}let fr=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(D,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw U(D,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},ci={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Mo,linkWallet:en,linkEmail:()=>{yt(),fr("email"),se.current="email",le.current="link",Ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{yt(),fr("phone"),se.current="sms",le.current="link",Ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{yt(),fr("google"),le.current="link",await Pe.initLoginWithOAuth("google")},linkTwitter:async()=>{yt(),fr("twitter"),le.current="link",await Pe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{yt(),fr("discord"),le.current="link",await Pe.initLoginWithOAuth("discord")},linkGithub:async()=>{yt(),fr("github"),le.current="link",await Pe.initLoginWithOAuth("github")},linkSpotify:async()=>{yt(),fr("spotify"),le.current="link",await Pe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{yt(),fr("instagram"),le.current="link",await Pe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{yt(),fr("tiktok"),le.current="link",await Pe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{yt(),fr("linkedin"),le.current="link",await Pe.initLoginWithOAuth("linkedin")},linkApple:async()=>{yt(),fr("apple"),le.current="link",await Pe.initLoginWithOAuth("apple")},linkPasskey:async()=>{yt(),fr("passkey"),await Pe.initLinkWithPasskey(),Ie("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{yt(),fr("farcaster"),await Pe.initLoginWithFarcaster(),le.current="link",se.current="farcaster",Ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(yt(),!s?.email)throw new T("User does not have an email linked to their account.");le.current="link",se.current="email",Ie("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(h=>{Mt(C=>h.bind(C))});if(Mt(null),p){console.warn(d);return}}if(a){console.warn(d);return}le.current="login",Xe("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Mt(()=>d)}),Mt(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Xe("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&M)try{await M.clearMfa({userId:s.id})}catch{}c(null),l(!1),k(null),U(D,"logout","onSuccess"),le.current=null,se.current=null,o(!1),oe.del(ga)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Ze;let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new Ze:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Vc.Web3Provider(new Jr(new Ze));let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new Vc.Web3Provider(new Jr(new Ze)):new Vc.Web3Provider(new Jr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ln(new Ze);let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new ln(new Ze):new ln(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(C=>(0,ds.getAddress)(C.address)===(0,ds.getAddress)(d)),h=s?.linkedAccounts.find(C=>C.type==="wallet"&&(0,ds.getAddress)(C.address)===(0,ds.getAddress)(d));if(!p||!await p.isConnected())j(d),en();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(D,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return us(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw U(D,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Ge(s);if(!d||!M)throw U(D,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw U(D,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Ip()}catch(p){throw U(D,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,h)=>{ve(!0);let C={onSuccess:G=>{U(D,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{U(D,"setWalletPassword","onError","user_exited_set_password_flow"),h(G)},callAuthOnSuccessOnClose:!1},x={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{U(D,"setWalletPassword","onError","unknown_connect_wallet_error"),h(G)}};ae({setWalletPassword:C,connectWallet:x}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(h,C)=>{if(!a||!s){U(D,"signMessage","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=Ge(s);if(!x){U(D,"signMessage","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(D,"signMessage","onError","invalid_message"),C(new Error("Message must be a non-empty string"));return}ve(!0);let G=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ee=await Oe();if(!M||!ee)throw new Error("Unable to connect to wallet");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:x.address}});let{response:gt}=await M.rpc({accessToken:ee,address:x.address,request:{method:"personal_sign",params:[d,x.address]}}),Ir=gt.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:x.address}}),Ir};if(B.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ee=await G();U(D,"signMessage","onSuccess",ee),h(ee)}catch(ee){U(D,"signMessage","onError","unable_to_sign"),C(ee??new tt("Unable to sign message"))}}else{let gt={method:"personal_sign",data:d,confirmAndSign:G,onSuccess:$e=>{U(D,"signMessage","onSuccess",$e),h($e)},onFailure:$e=>{U(D,"signMessage","onError","unable_to_sign"),C($e)},uiOptions:p||{}},Ir={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:$e=>{U(D,"signMessage","onError","unknown_connect_wallet_error"),C($e)}};ae({signMessage:gt,connectWallet:Ir}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,C)=>{if(!a||!s){U(D,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=Ge(s);if(!x){U(D,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}ve(!0);let G=_s(d),ee=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ut=await Oe();if(!M||!ut)throw new Error("Unable to connect to wallet");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:x.address}});let{response:Ir}=await M.rpc({accessToken:ut,address:x.address,request:{method:"eth_signTypedData_v4",params:[x.address,G]}}),$e=Ir.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:x.address}}),$e};if(B.embeddedWallets.noPromptOnSignature||(B.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ut=await ee();U(D,"signTypedData","onSuccess",ut),h(ut)}catch(ut){U(D,"signTypedData","onError","unable_to_sign"),C(ut??new tt("Unable to sign message"))}}else{let Ir={method:"eth_signTypedData_v4",data:G,confirmAndSign:ee,onSuccess:hr=>{U(D,"signTypedData","onSuccess",hr),h(hr)},onFailure:hr=>{U(D,"signTypedData","onError","unable_to_sign"),C(hr)},uiOptions:p||{}},$e={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:hr=>{U(D,"signMessage","onError","unknown_connect_wallet_error"),C(hr)}};ae({signMessage:Ir,connectWallet:$e}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let x=await(await Rp(d,p,h)).wait();return Wc(x)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Ge(s)){p(new Error("Must have a Privy wallet before exporting"));return}ve(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ae(Ee),!await Oe()||!M){p(new Error("Must have valid access token to enroll in MFA"));return}if(!M){p(new Error("Must have a Privy wallet before exporting"));return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ae({keyExport:G,connectWallet:C}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ip,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new T("Invalid MFA code");tr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((G,ee)=>{it.current={resolve:G,reject:ee}});break;case"passkey":if(typeof p=="string")throw new T("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),x=a3(C);tr.current?.resolve({mfaMethod:d,mfaCode:x,relyingParty:window.origin}),await new Promise((G,ee)=>{it.current={resolve:G,reject:ee}});break;default:throw tr.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){tr.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){Pe.closePrivyModal(),p();return}B.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ae({mfaEnrollmentFlow:{mfaMethods:B.mfa.methods,onSuccess:p,onFailure:h}}),Ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Oe();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");let p=await M.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await M.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await M.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Oe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await M.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}ae({farcasterSigner:C}),Ie("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Oe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(x=>Uint8Array.from(x.match(/.{1,2}/g).map(G=>parseInt(G,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Oe(),h=s?.linkedAccounts.find(ee=>ee.type==="wallet"&&ee.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let x=await import("@simplewebauthn/browser"),G=await M.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:x.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(x.base64URLStringToBuffer(G.signature))},isHeadlessOAuthLoading:P,loginWithCode(d){return Pe.loginWithCode(d)},initLoginWithEmail(d){return Pe.initLoginWithEmail(d)},initLoginWithSms(d){return Pe.initLoginWithSms(d)},otpState:N,fundWallet(d,p){return Pe.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Pe.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Pe.loginWithHeadlessOAuth(d)},isModalOpen:r};l3=ci.signMessage,c3=ci.signTypedData,d3=async(...d)=>{let p=await Rp(...d);return B.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Pe=(()=>({isNewUserThisSession:g,linkingHint:J,pendingTransaction:null,walletConnectionStatus:A,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:B.rpcConfig,chains:B.chains,appId:e.appId,showFiatPrices:B.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>B.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(M)return M;let p=new Promise(x=>{wt(()=>G=>x(G))}),h=new Promise(x=>setTimeout(()=>x(null),d)),C=await Promise.race([p,h]);return wt(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;p&&se.current&&(h=s?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,x)=>x.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),le.current==="login"&&se.current?d.shouldCallAuthOnSuccess&&p?(U(D,"login","onComplete",s,g,!1,se.current,h??null),e.onSuccess?.(s,g)):U(D,"login","onError","exited_auth_flow"):le.current==="link"&&se.current&&h&&(d.isSuccess&&p?U(D,"linkAccount","onSuccess",s,se.current,h):U(D,"linkAccount","onError","exited_link_flow")),j(null),le.current=null,se.current=null,w(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:Ie,connectWallet:li,initLoginWithWallet:async(d,p)=>{se.current="siwe",In(d,p)},loginWithWallet:async()=>{if(!n)throw new tn;if(!(t.authFlow instanceof Gn))throw new T("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),se.current="siwe"}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:d,isNewUser:p}=await t.authenticate()),se.current="siwe"}catch(h){throw U(D,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),w(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ha(d);t.startAuthFlow(p);try{se.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw le.current==="login"?U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error"),h}},loginWithFarcaster:async()=>{if(!n)throw new tn;if(!(t.authFlow instanceof ha))throw new T("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),se.current="farcaster"}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:d,isNewUser:p}=await t.authenticate()),se.current="farcaster"}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),w(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(se.current=d,Zc()){if(d==="google"&&Gc(window.navigator.userAgent)){Xe("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Xe("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}oe.del(Dn);let h=new fo({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},async recoveryOAuthFlow(d,p,h){let{url:C,codeVerifier:x,stateCode:G}=await eh({api:An.api,provider:d});if(!C)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new T("Recovery OAuth failed");let ee,ut;try{let $e=await i3({url:C,popup:h});if(ee=$e.stateCode,ut=$e.authorizationCode,ee!==G)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:G??"",returnedStateCode:ee??""}}),new T("Unexpected auth flow. This may be a phishing attempt.")}catch($e){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:$e.toString(),provider:d}}),new T("Recovery OAuth failed")}let[gt,Ir]=await Promise.all([Oe(),th({api:An.api,provider:d,codeVerifier:x,stateCode:ee,authorizationCode:ut})]);if(!M)throw new T("Cannot connect to wallet proxy");switch(p){case"recover":let $e=Ee.recoverWallet?.privyWallet?.address;if(!$e)throw new T("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:$e,recoveryMethod:d}}),await M.recover({address:$e,accessToken:gt,recoveryAccessToken:Ir,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:$e,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await M.create({accessToken:gt,recoveryAccessToken:Ir,recoveryMethod:d});let hr=await Pe.refreshUser(),jt=Ge(hr);if(!jt)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:jt.address}}),U(D,"createWallet","onSuccess",jt);break;default:throw new T("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof fo))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=oe.get(On),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new T("Unexpected auth flow. This may be a phishing attempt.");let C,x,G;if(a)try{C=await t.link(),se.current=d}catch(ee){throw U(D,"linkAccount","onError",ee.privyErrorCode||"failed_to_link_account"),ee}else try{let ee=await t.authenticate();C=ee.user,x=ee.isNewUser,G=ee.oAuthProviderTokens,se.current=d}catch(ee){throw le.current==="login"?U(D,"login","onError",ee.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",ee.privyErrorCode||"failed_to_link_account"),ee}return c(C),w(x||!1),l(!0),G},async initLoginWithPasskey(d){let p=new Hn(d);t.startAuthFlow(p),le.current="login";try{se.current="passkey",await p.initAuthenticationFlow()}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new tn;if(!(t.authFlow instanceof Hn))throw new T("Must initialize Passkey flow first.");if(se.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d,p;try{se.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),w(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Hn(d);t.startAuthFlow(p),le.current="link",se.current="passkey";try{await p.initLinkFlow()}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error"),h}},async linkWithPasskey(){if(!n)throw new tn;if(!(t.authFlow instanceof Hn))throw new T("Must initialize Passkey flow first.");if(se.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d;try{se.current="passkey",d=await t.link()}catch(p){throw U(D,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(Zc()){if(d==="google"&&Gc(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new fo({provider:d,headless:!0});p&&h.addCaptchaToken(p);let C=await t.startAuthFlow(h).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){b(!0),t.startAuthFlow(new fo(d));let p=oe.get(On),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),b(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let C,x;if(a)try{C=await t.link(),se.current=d.provider}catch(G){throw U(D,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:C,isNewUser:x}=await t.authenticate()),se.current=d.provider}catch(G){throw le.current==="login"?U(D,"login","onError",G.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(C),w(x||!1),l(!0),b(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let h=new rn(d,p);t.startAuthFlow(h);try{se.current="email",await h.sendCodeEmail()}catch(C){throw le.current==="login"?U(D,"login","onError",C.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,h)=>{let C=new bs(d,p,h);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{L({status:"sending-code"});let h=new Vn(d,p);t.startAuthFlow(h);try{se.current="sms",await h.sendSmsCode(),L({status:"awaiting-code-input"})}catch(C){throw L({status:"error",error:C}),le.current==="login"?U(D,"login","onError",C.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(L({status:"submitting-code"}),!n){let x=new tn;throw L({status:"error",error:x}),x}if(t.authFlow instanceof rn)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Vn)t.authFlow.meta.smsCode=d.trim();else{let x=new T("Must initialize a passwordless code flow first");throw L({status:"error",error:x}),x}let p=await Oe(),h,C;if(p&&t.sessionHasActiveToken())try{h=await t.link()}catch(x){throw L({status:"error",error:x}),U(D,"linkAccount","onError",x.privyErrorCode||"failed_to_link_account"),x}else try{({user:h,isNewUser:C}=await t.authenticate())}catch(x){throw L({status:"error",error:x}),U(D,"login","onError",x.privyErrorCode||"unknown_auth_error"),x}c(h||s||null),w(C||!1),l(!0),L({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:M,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let h=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy"),C=await Oe();if(!C||!M||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ve(!0);try{await M.connect({accessToken:C,address:h.address}),d(!0)}catch(x){if(Bi(x)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await M.recover({address:h.address,accessToken:C})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(Bi(x)){ae({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let G=Yl(h.recoveryMethod);Ie(G)}else p(x)}}),getFiatOnRampConfig:jr,setReadyToTrue:d=>{i(!0),It?.(d)},updateWallets:()=>Mn(),fundWallet:async(d,p)=>{let{signedUrl:h,externalTransactionId:C}=await jr(d,p);ae({fiatOnRampPrompt:{signedUrl:h},fiatOnRampStatus:{externalTransactionId:C}}),Ie("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Oe(),h=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let C=await t.requestFarcasterSignerStatus(d);if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}return C}}))();p3=Pe.recoverEmbeddedWallet;let G3=(0,ie.useMemo)(()=>({wallets:u,ready:Ar&&Rn}),[u,Ar,Rn]);return(0,ur.jsx)(xe.Provider,{value:ci,children:(0,ur.jsx)(Cd.Provider,{value:D,children:(0,ur.jsx)(Cp.Provider,{value:G3,children:(0,ur.jsxs)(qm,{...B,children:[e.children,(0,ur.jsxs)(vd.Provider,{value:Pe,children:[!B.headless&&B.captchaEnabled&&n&&!a&&(0,ur.jsx)(Tl,{delayedExecution:!1}),(0,ur.jsx)(Q2,{theme:{...B.appearance.palette||{}}}),(0,ur.jsx)(Wm,{data:Ee,setModalData:ae,setInitialScreen:k,initialScreen:v,authenticated:a,open:r,children:(0,ur.jsx)(t3,{open:r})}),fe&&be?(0,ur.jsx)(o3,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:tr,mfaSubmitPromise:it,onLoad:ne,onLoadFailed:()=>null}):null]})]})})})})};var m3=require("react");function f3(e){let{login:t}=(0,m3.useContext)(xe);return rt("login",e),{login:t}}var h3=require("react");function y3(e){let{logout:t}=(0,h3.useContext)(xe);return rt("logout",e),{logout:t}}var ps=require("react");function g3(){let e=Me(),t=vl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=(0,ps.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new Xr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,ps.useCallback)(async()=>{let c=Pa();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(u){throw u}finally{Bn()}},[o]);return(0,ps.useEffect)(()=>{let c=Pa();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var kp=require("react");var v3=()=>{let e=Me(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=(0,kp.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,kp.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Xr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var Ap=require("react");var C3=()=>{let e=Me(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=(0,Ap.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=(0,Ap.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Xr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};var w3=require("react");function b3(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:y,linkFarcaster:g}=(0,w3.useContext)(xe);return rt("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:y,linkFarcaster:g}}var E3=require("react");function P3(e){let{connectWallet:t}=(0,E3.useContext)(xe);return rt("connectWallet",e),{connectWallet:t}}var T3=require("react");function S3(e){let{createWallet:t}=(0,T3.useContext)(xe);return rt("createWallet",e),{createWallet:t}}var x3=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var _3=require("react");function k3(e){let{sendTransaction:t}=(0,_3.useContext)(xe);return rt("sendTransaction",e),{sendTransaction:t}}var A3=require("react");function R3(e){let{setWalletPassword:t}=(0,A3.useContext)(xe);return rt("setWalletPassword",e),{setWalletPassword:t}}var I3=require("react");function M3(e){let{signMessage:t}=(0,I3.useContext)(xe);return rt("signMessage",e),{signMessage:t}}var W3=require("react");function L3(e){let{signTypedData:t}=(0,W3.useContext)(xe);return rt("signTypedData",e),{signTypedData:t}}var O3=require("react");var N3=()=>{let{isModalOpen:e}=(0,O3.useContext)(xe);return{isOpen:e}};var D3=require("react");function U3(e){let{getAccessToken:t}=(0,D3.useContext)(xe);return rt("accessToken",e),{getAccessToken:t}}function F3(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function B3(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
|
|
3022
|
+
`;var dt=require("react/jsx-runtime"),qw={["LANDING"]:b1,["CONNECT_OR_CREATE"]:w1,["AWAITING_PASSWORDLESS_CODE"]:bf,["AWAITING_CONNECTION"]:Kf,["AWAITING_CONNECT_ONLY_CONNECTION"]:Zf,["AWAITING_FARCASTER_CONNECTION"]:by,["AWAITING_FARCASTER_SIGNER"]:Sy,["AWAITING_PASSKEY_SYSTEM_DIALOGUE"]:u2,["PHANTOM_INTERSTITIAL_SCREEN"]:y2,["LOGIN_FAILED_SCREEN"]:D1,["AWAITING_OAUTH_SCREEN"]:p2,["ALLOWLIST_REJECTION_SCREEN"]:df,["USER_LIMIT_REACHED_SCREEN"]:Z2,["INSTALL_PHANTOM_SCREEN"]:Ky,["LINK_EMAIL_SCREEN"]:P1,["LINK_PHONE_SCREEN"]:L1,["LINK_WALLET_SCREEN"]:O1,["LINK_PASSKEY_SCREEN"]:I1,["UPDATE_EMAIL_SCREEN"]:j2,["CONNECT_ONLY_LANDING_SCREEN"]:zf,["CONNECT_ONLY_AUTHENTICATED_SCREEN"]:Uf,["EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN"]:yh,["EMBEDDED_WALLET_CREATED_SCREEN"]:lh,["EMBEDDED_WALLET_CONNECTING_SCREEN"]:ih,["EMBEDDED_WALLET_PASSWORD_RECOVERY_SCREEN"]:v2,["EMBEDDED_WALLET_RECOVERY_SELECTION_SCREEN"]:k2,["EMBEDDED_WALLET_RECOVERY_OAUTH_SCREEN"]:b2,["EMBEDDED_WALLET_KEY_EXPORT_SCREEN"]:mh,["EMBEDDED_WALLET_SIGN_REQUEST_SCREEN"]:V2,["EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN"]:B2,["FIAT_ON_RAMP_PROMPT_SCREEN"]:Ly,["FIAT_ON_RAMP_STATUS_SCREEN"]:Fy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN"]:oy,["EMBEDDED_WALLET_PASSWORD_UPDATE_SCREEN"]:Xh,["EMBEDDED_WALLET_PASSWORD_CREATE_SCREEN"]:E2,["MFA_ENROLLMENT_FLOW_SCREEN"]:gg,["CAPTCHA_SCREEN"]:Af,["ERROR_SCREEN"]:ay,["IN_APP_BROWSER_LOGIN_NOT_POSSIBLE"]:Gy,["AFFIRMATIVE_CONSENT_SCREEN"]:sf},$w=["LANDING","AWAITING_CONNECTION"],Kw=({isMfaVerifying:e,onMfaVerificationComplete:t})=>{let{ready:r,isModalOpen:o}=H(),{headless:n}=Nr(),{ready:i,currentScreen:a}=_(),{status:l,execute:s,reset:c,enabled:u}=Me(),f=(0,Xo.useRef)(null),y=jm(f),g=o&&a&&$w.includes(a)&&!n&&l==="ready";if((0,Xo.useEffect)(()=>{g&&s()},[g]),(0,Xo.useEffect)(()=>{!o&&u&&c()},[o,u]),(!r||!i)&&a!=="AWAITING_OAUTH_SCREEN")return(0,dt.jsxs)(na,{id:"privy-modal-content",children:[(0,dt.jsx)(S,{}),(0,dt.jsx)(ce,{}),(0,dt.jsx)(tg,{children:(0,dt.jsx)(Et,{})}),(0,dt.jsx)(ye,{}),(0,dt.jsx)(z,{})]});if(!a&&e)return(0,dt.jsx)(na,{style:{height:y},id:"privy-modal-conent",children:(0,dt.jsx)("div",{ref:f,children:(0,dt.jsx)(bp,{open:e,onClose:t})})});if(!a)return null;let w=qw[a];return(0,dt.jsx)(na,{style:{height:y},id:"privy-modal-content",children:(0,dt.jsxs)("div",{ref:f,children:[(0,dt.jsx)(Fo,{if:!!e,children:(0,dt.jsx)(w,{})}),(0,dt.jsx)(Fo,{if:!e,children:(0,dt.jsx)(bp,{open:e,onClose:t})})]})})},jw=()=>{let{closePrivyModal:e}=W(),{onUserCloseViaDialogOrKeybindRef:t}=_();return{gracefulClosePrivyModal:(0,Xo.useCallback)(()=>{if(t?.current)t.current();else return e({shouldCallAuthOnSuccess:!1})},[e])}},t3=({open:e})=>{let{app:t}=_(),{gracefulClosePrivyModal:r}=jw(),[o,n]=(0,Xo.useState)(!1);Rl({onMfaRequired:()=>{t?.mfa.noPromptOnMfaRequired||n(!0)}});let i=(0,dt.jsx)(X2,{children:(0,dt.jsx)(Kw,{isMfaVerifying:o,onMfaVerificationComplete:()=>n(!1)})}),a=e||o,l=t?.render.inDialog?(0,dt.jsx)(eg,{open:a,id:"privy-dialog","aria-label":"log in or sign up","aria-labelledby":"privy-dialog-title",onClick:()=>r(),children:i}):i;if(typeof window<"u"&&t?.render.inParentNodeId){let s=document.getElementById(t.render.inParentNodeId);if(s)return e3.default.createPortal(l,s)}return l};var r3=require("react"),ha=require("react");var Hc=class{constructor(){this.callbacks={}}enqueue(t,r){this.callbacks[t]=r}dequeue(t,r){let o=this.callbacks[r];if(!o)throw new Error(`cannot dequeue ${t} event: no event found for id ${r}`);switch(delete this.callbacks[r],t){case"privy:iframe:ready":return o;case"privy:wallet:create":return o;case"privy:wallet:connect":return o;case"privy:wallet:recover":return o;case"privy:wallet:rpc":return o;case"privy:wallet:set-recovery-password":return o;case"privy:mfa:verify":return o;case"privy:mfa:init-enrollment":return o;case"privy:mfa:submit-enrollment":return o;case"privy:mfa:unenroll":return o;case"privy:mfa:clear":return o;case"privy:farcaster:init-signer":return o;case"privy:farcaster:sign":return o;default:throw new Error(`invalid wallet event type ${t}`)}}};async function kn(e,t,r,o,n,i=!1){let a=i,l=async u=>{if(a&&t&&t.length>0){u===(i?0:1)?n("configureMfa","onMfaRequired",t):o.current?.reject(new ot("missing_or_invalid_mfa","MFA verification failed, retry."));let f=await new Promise((y,g)=>{r.current={resolve:y,reject:g};let w=1e3*60*5;setTimeout(()=>{let v=new ot("mfa_timeout","Timed out waiting for MFA code");o.current?.reject(v),g(v)},w)});return await e(f)}return await e()},s=4,c=null;for(let u=0;u<s;u++)try{c=await l(u),o.current?.resolve(void 0);break}catch(f){if(f.type==="missing_or_invalid_mfa")a=!0;else throw o.current?.resolve(void 0),f}if(c===null){let u=new ot("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw o.current?.reject(u),u}return c}var n3=require("react/jsx-runtime"),Yw=function(e){return()=>`id-${e++}`}(0);function Zw(e){return typeof e.event=="string"&&/^privy:.+/.test(e.event)}function kr(e){return e.error!==void 0}var ur=new Hc,_p=new Map,Jw=(e,t)=>typeof t=="bigint"?t.toString():t,Qw=(e,t)=>`${e}${JSON.stringify(t,Jw)}`;function Ar(e,t,r,o){let n=r.contentWindow;if(!n)throw new Error("iframe not initialized");let i=Qw(e,t);if(e==="privy:wallet:create"){let l=_p.get(i);if(l)return l}let a=new Promise((l,s)=>{let c=Yw();ur.enqueue(c,{resolve:l,reject:s}),n.postMessage({id:c,event:e,data:t},o)}).finally(()=>{_p.delete(i)});return _p.set(i,a),a}function Xw(e){switch(e.event){case"privy:iframe:ready":let t=ur.dequeue(e.event,e.id);return kr(e)?t.reject(new ot(e.error.type,e.error.message)):t.resolve(e.data);case"privy:wallet:create":let r=ur.dequeue(e.event,e.id);return kr(e)?r.reject(new ot(e.error.type,e.error.message)):r.resolve(e.data);case"privy:wallet:connect":let o=ur.dequeue(e.event,e.id);return kr(e)?o.reject(new ot(e.error.type,e.error.message)):o.resolve(e.data);case"privy:wallet:recover":let n=ur.dequeue(e.event,e.id);return kr(e)?n.reject(new ot(e.error.type,e.error.message)):n.resolve(e.data);case"privy:wallet:rpc":let i=ur.dequeue(e.event,e.id);return kr(e)?i.reject(new ot(e.error.type,e.error.message)):i.resolve(e.data);case"privy:wallet:set-recovery-password":let a=ur.dequeue(e.event,e.id);return kr(e)?a.reject(new ot(e.error.type,e.error.message)):a.resolve(e.data);case"privy:mfa:verify":let l=ur.dequeue(e.event,e.id);return kr(e)?l.reject(new ot(e.error.type,e.error.message)):l.resolve(e.data);case"privy:mfa:init-enrollment":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:submit-enrollment":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:unenroll":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:mfa:clear":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:init-signer":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}case"privy:farcaster:sign":{let s=ur.dequeue(e.event,e.id);return kr(e)?s.reject(new ot(e.error.type,e.error.message)):s.resolve(e.data)}default:console.warn("Unsupported wallet proxy method:",e)}}function o3(e){let t=(0,ha.useRef)(null),r=(0,ha.useRef)(e.mfaMethods),o=Al(),[n,i]=(0,r3.useState)(!1);return(0,ha.useEffect)(()=>{r.current=e.mfaMethods},[e.mfaMethods]),(0,ha.useEffect)(()=>{if(!n)return;let a=t.current;if(!a)return;function l(y){y&&y.origin===e.origin&&Zw(y.data)&&Xw(y.data)}let s={create(y){return Ar("privy:wallet:create",y,a,e.origin)},connect(y){return Ar("privy:wallet:connect",y,a,e.origin)},recover(y){return kn(g=>Ar("privy:wallet:recover",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},rpc(y){return kn(g=>Ar("privy:wallet:rpc",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},setRecoveryPassword(y){return kn(g=>Ar("privy:wallet:set-recovery-password",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},verifyMfa(y){return kn(g=>Ar("privy:mfa:verify",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},initEnrollMfa(y){return kn(g=>Ar("privy:mfa:init-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},submitEnrollMfa(y){return kn(g=>Ar("privy:mfa:submit-enrollment",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o)},unenrollMfa(y){return kn(g=>Ar("privy:mfa:unenroll",{...y,...g},a,e.origin),r.current,e.mfaPromise,e.mfaSubmitPromise,o,!0)},clearMfa(y){return Ar("privy:mfa:clear",y,a,e.origin)},initFarcasterSigner(y){return Ar("privy:farcaster:init-signer",y,a,e.origin)},signFarcasterMessage(y){return Ar("privy:farcaster:sign",y,a,e.origin)}};window.addEventListener("message",l);let c=()=>e.onLoad(s),u=(...y)=>{console.warn("Privy iframe failed to load: ",...y),e.onLoadFailed()},f=new AbortController;return Pu(()=>Ar("privy:iframe:ready",{},a,e.origin),{abortSignal:f.signal}).then(c,u),()=>{window.removeEventListener("message",l),f.abort()}},[n]),(0,n3.jsx)("iframe",{ref:t,width:"0",height:"0",style:{display:"none",height:"0px",width:"0px"},onLoad:()=>i(!0),src:xs(e.origin,`/apps/${e.appId}/embedded-wallets`,{caid:e.clientAnalyticsId})})}function Gc(e){let t=e.toLowerCase();return["fbav","fban","instagram","snapchat"].some(o=>t.includes(o))}async function i3({url:e,popup:t}){return t.location=e,new Promise((o,n)=>{function i(){t?.close(),window.removeEventListener("message",a)}function a(l){l.data&&(l.data.type==="PRIVY_OAUTH_RESPONSE"?(o(l.data),i()):l.data.type==="PRIVY_OAUTH_ERROR"&&(n(l.data.error),i()))}window.addEventListener("message",a)})}var a3=e=>({id:e.id,raw_id:e.rawId,response:{client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,signature:e.response.signature,user_handle:e.response.userHandle},authenticator_attachment:e.authenticatorAttachment,client_extension_results:{app_id:e.clientExtensionResults.appid,cred_props:e.clientExtensionResults.credProps,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret},type:e.type});var mr=require("react/jsx-runtime"),An;function e5(e){return typeof e=="string"&&e.length===25}function Oe(){if(!An){let e=oe.get(Ln);return Promise.resolve(e||null)}return An.getAccessToken()}var l3,Ju=(e,t)=>l3(e,t),c3,Qu=(e,t)=>c3(e,t),d3,Xu=(e,t)=>d3(e,t),p3,em=()=>p3(),t5=()=>{let t=new URLSearchParams(window.location.search).get("privy_token");if(!t)return;oe.put(ga,t);let r=new URL(window.location.href);r.searchParams.delete("privy_token"),window.history.pushState({},"",r)},u3=({config:e,...t})=>{if(!e5(t.appId))throw new T("Cannot initialize the Privy provider with an invalid Privy app ID");An||(An=new _i({appId:t.appId,apiUrl:t.apiUrl||Ws}));let r=Object.assign({},e);return t.createPrivyWalletOnLogin!==void 0&&r.embeddedWallets?.createOnLogin===void 0&&(r.embeddedWallets||(r.embeddedWallets={}),r.embeddedWallets.createOnLogin=t.createPrivyWalletOnLogin?"users-without-wallets":"off"),t.createPrivyWalletOnLogin!==void 0&&e?.embeddedWallets?.createOnLogin&&console.warn("Both `createPrivyWalletOnLogin` and `config.embeddedWallets.createOnLogin` are set. `createPrivyWalletOnLogin` is deprecated and should be removed."),(0,mr.jsx)(Rm,{client:An,clientConfig:r,legacyCreateEmbeddedWalletFlag:t.createPrivyWalletOnLogin,children:(0,mr.jsx)(r5,{...t,client:An})})},r5=e=>{let t=e.client,[r,o]=(0,ie.useState)(!1),[n,i]=(0,ie.useState)(!1),[a,l]=(0,ie.useState)(!1),[s,c]=(0,ie.useState)(null),[u,f]=(0,ie.useState)([]),y=(0,ie.useRef)(u),[g,w]=(0,ie.useState)(!1),[v,k]=(0,ie.useState)(null),[P,b]=(0,ie.useState)(!1),[A,R]=(0,ie.useState)({status:"disconnected",connectedWallet:null,connectError:null,connector:null,connectRetry:E}),[N,L]=(0,ie.useState)({status:"initial"}),[I,q]=(0,ie.useState)(null),[J,j]=(0,ie.useState)(null),[M,ne]=(0,ie.useState)(null),B=Nr(),be=Cl(),[fe,ve]=(0,ie.useState)(!0),[Ee,ae]=(0,ie.useState)({}),[It,Mt]=(0,ie.useState)(null),[er,wt]=(0,ie.useState)(null),[Rr,$e]=(0,ie.useState)(!1),[pt,Ir]=(0,ie.useState)(!1),tr=(0,ie.useRef)(null),it=(0,ie.useRef)(null),D=(0,ie.useRef)(Ym),[Rn,Re]=(0,ie.useState)(!1);t.onStoreToken=d=>{d&&U(D,"accessToken","onAccessTokenGranted",d)},t.onDeleteToken=()=>{c(null),l(!1),U(D,"accessToken","onAccessTokenRemoved")};let se=(0,ie.useRef)(null),le=(0,ie.useRef)(null),Ie=d=>{k(d),setTimeout(()=>{o(!0)},15),t.createAnalyticsEvent({eventName:"modal_open",payload:{initialScreen:d}})},Xe=d=>{B.embeddedWallets.createOnLogin!=="off"&&ve(!0),Ie(d)};(0,ie.useEffect)(()=>{let d=()=>{document.visibilityState==="hidden"&&t.createAnalyticsEvent({eventName:"page_hidden",options:{keepAlive:!0}})};return document.addEventListener("visibilitychange",d),()=>{document.removeEventListener("visibilitychange",d)}},[]),(0,ie.useEffect)(()=>{if(!s){t.connectors?.removeEmbeddedWalletConnector();return}let d=s.linkedAccounts.find(p=>p.type==="wallet"&&p.walletClientType==="privy");if(!d){t.connectors?.removeEmbeddedWalletConnector();return}if(!t.connectors){console.warn("Failed to add embedded wallet connector: Client connectors not initialized");return}if(!M){console.warn("Failed to add embedded wallet connector: Wallet proxy not initialized");return}t.connectors.addEmbeddedWalletConnector(M,d.address,B.defaultChain,e.appId)},[M,s]),(0,ie.useEffect)(()=>{M&&er?.(M)},[M]),(0,ie.useEffect)(()=>{(async()=>{if(!B.customAuth?.enabled)return;ve(!0);let{getCustomAccessToken:p,isLoading:h}=B.customAuth;if(!(!n||h))try{let C=await p();if(!C&&a){await ci.logout();return}if(!C||a)return;t.startAuthFlow(new di(C));let{user:x,isNewUser:G}=await t.authenticate();if(!x){await ci.logout();return}c(x||null),w(G||!1),l(!0),Ir(!0)}catch(C){console.warn(C),a&&await ci.logout()}})()},[B.customAuth?.enabled,B.customAuth?.getCustomAccessToken,B.customAuth?.isLoading,n,a]),(0,ie.useEffect)(()=>{pt&&M&&s&&Lr(s,B.embeddedWallets.createOnLogin)&&(Ir(!1),ms(s,mi).catch(console.error))},[pt&&M&&s]),(0,ie.useEffect)(()=>{async function d(){let p=zc();t5();let h=(0,s3.createStore)();q(h),t.initializeConnectorManager({walletConnectCloudProjectId:B.walletConnectCloudProjectId,rpcConfig:B.rpcConfig,chains:B.chains,defaultChain:B.defaultChain,store:h,walletList:B.appearance.walletList,shouldEnforceDefaultChainOnConnect:B.shouldEnforceDefaultChainOnConnect,appName:B.name??"Privy"});let C;t.connectors?.on("connectorInitialized",()=>{C&&clearTimeout(C);let G=t.connectors.walletConnectors.length,ee=t.connectors.walletConnectors.reduce((ut,gt)=>ut+(gt.initialized?1:0),0);ee===G?Re(!0):C=setTimeout(()=>{console.warn({message:"Unable to initialized all expected connectors before timeout",initialized:ee,expected:G}),Re(!0)},1500)}),t.connectors?.initialize().then(()=>{qc()});let x=await t.getAuthenticatedUser();B.customAuth?.enabled||(l(!!x),x&&U(D,"login","onComplete",x,!1,!0,null,null),c(x)),p||Pe.setReadyToTrue(!!x),p&&(x?le.current="link":le.current="login")}!n&&be&&d()},[t,It,n,be]),(0,ie.useEffect)(()=>{if(!n)return;if(!s){$e(!0);return}if(!!!s.linkedAccounts.find(h=>h.type==="wallet"&&h.walletClientType==="privy")){$e(!0);return}let p=!!u.find(h=>h.walletClientType==="privy");$e(p)},[n,s,u]);let zc=()=>{let d=Ta();if(d.inProgress&&d.popupFlow){if(window.opener.location.origin!==window.location.origin){window.opener.postMessage({type:"PRIVY_OAUTH_ERROR",error:"Origins between parent and child windows do not match."});return}window.opener.postMessage({type:"PRIVY_OAUTH_RESPONSE",stateCode:d.stateCode,authorizationCode:d.authorizationCode});return}return!d.inProgress||d.headless?!1:(t.startAuthFlow(new fo(d)),Xe("AWAITING_OAUTH_SCREEN"),!0)},si=async(d,p,h,C)=>{let x=await t.connectors?.createWalletConnector(d,p)||null;li(x,p,h,C)};async function li(d,p,h,C){if(d)R({status:"disconnected",connectedWallet:null,connectError:null,connector:d,connectRetry:E});else return R({status:"disconnected",connectedWallet:null,connectError:new de("Unable to connect to wallet."),connector:null,connectRetry:E}),C?.(null,h);d instanceof go&&p&&await d.resetConnection(p),R({connector:d,status:"connecting",connectedWallet:null,connectError:null,connectRetry:()=>li(d,p,h,C)});try{let x=await d.connect({showPrompt:!0});if(B.shouldEnforceDefaultChainOnConnect&&!B.chains.find(G=>G.id===Number(x?.chainId))&&!(x?.connectorType==="wallet_connect_v2"&&x?.walletClientType==="metamask")){R(G=>({...G,connector:d,status:"switching_to_supported_chain",connectedWallet:null,connectError:null,connectRetry:E}));try{await x?.switchChain(B.defaultChain.id),x&&(x.chainId=ui(Wn(B.defaultChain.id)))}catch{console.warn(`Unable to switch to default chain: ${B.defaultChain.id}`)}}return R(G=>({...G,status:"connected",connectedWallet:x,connectError:null,connectRetry:E})),x&&!le.current&&U(D,"connectWallet","onSuccess",x),C?.(x,h)}catch(x){return x instanceof at?(console.warn(x.cause?x.cause:x.message),le.current||U(D,"connectWallet","onError",x.privyErrorCode||"generic_connect_wallet_error")):(console.warn(x),le.current||U(D,"connectWallet","onError","unknown_connect_wallet_error")),R(G=>({...G,status:"disconnected",connectedWallet:null,connectError:x})),C?.(null,h)}}let In=async(d,p)=>{if(d===null)return;let h=new Gn(d,p);t.startAuthFlow(h)},qc=()=>{let d=new URLSearchParams(window.location.search),p=d.get("privy_connector"),h=d.get("privy_wallet_client");if(!p||!h)return;if(h==="phantom"&&!on()&&Xe("LOGIN_FAILED_SCREEN"),!t.connectors)throw new T("Connector not initialized");Ie("AWAITING_CONNECTION");let C=new URL(window.location.href);C.searchParams.delete("privy_connector"),C.searchParams.delete("privy_wallet_client"),window.history.pushState({},"",C),si(p,h,void 0,In)};(0,ie.useEffect)(()=>{n&&a&&s===null&&t.getAuthenticatedUser().then(c)},[n,a,s,t]);let yt=()=>{if(!a)throw U(D,"linkAccount","onError","must_be_authenticated"),new T("User must be authenticated before linking an account.")},en=()=>{yt(),se.current="siwe",le.current="link",Ie("LINK_WALLET_SCREEN")},Ut=d=>{if(!a||!s)return!1;if(d.walletClientType==="privy")return!0;for(let p of s.linkedAccounts)if(p.type==="wallet"&&p.address===d.address&&p.walletClientType!=="privy")return!0;return!1},fr=async d=>{if(!t.connectors)throw new T("Connector not initialized");let p=t.connectors.findWalletConnector(d.connectorType,d.walletClientType)||null;if(R(h=>({...h,connector:p,status:"connected",connectedWallet:d,connectError:null,connectRetry:E})),B.captchaEnabled&&!a){let h={callback:C=>In(d,C),userIntentRequired:!1,onSuccessNavigateTo:"AWAITING_CONNECTION",onErrorNavigateTo:"ERROR_SCREEN"};ae({captchaModalData:h}),Xe("CAPTCHA_SCREEN")}else await In(d),Xe("AWAITING_CONNECTION")},jr=async(d,p)=>{if(!B.fiatOnRamp.enabled)throw new T("Fiat on-ramp is not enabled");if(!p||!p.provider||p.provider==="moonpay"){let{signedUrl:h,externalTransactionId:C}=await My(t,d,p?.config??{},B.appearance.palette,B.fiatOnRamp.useSandbox);return{signedUrl:h,externalTransactionId:C}}else throw new T("Unsupported fund provider. Currently supported option is `moonpay`.")},Mn=()=>{f(d=>{let p=t.connectors?.wallets.map(h=>({...h,linked:Ut(h),loginOrLink:async()=>{if(!await h.isConnected())throw new T("Wallet is not connected");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new T("Cannot link or login with embedded wallet");fr(h)},fund:async C=>{let{signedUrl:x,externalTransactionId:G}=await jr(h.address,C);ae({fiatOnRampPrompt:{signedUrl:x},fiatOnRampStatus:{externalTransactionId:G}}),Ie("FIAT_ON_RAMP_PROMPT_SCREEN")},unlink:async()=>{if(!a)throw new T("User is not authenticated.");if(h.connectorType==="embedded"&&h.walletClientType==="privy")throw new T("Cannot unlink an embedded wallet");let C=await t.unlinkWallet(h.address);c(C)}}))||[];return Qs(d,p)?d:p})};(0,ie.useEffect)(()=>{Mn()},[s?.linkedAccounts,a,n]),(0,ie.useEffect)(()=>{if(n){if(!t.connectors)throw new T("Connector not initialized");Mn(),t.connectors.on("walletsUpdated",Mn)}},[n]);let Mo=()=>{Ie(a?"CONNECT_ONLY_AUTHENTICATED_SCREEN":"CONNECT_ONLY_LANDING_SCREEN")};(0,ie.useEffect)(()=>{if(!u[0])return;let d=u[0],p=y.current.find(C=>C.address===d.address),h;if(d.walletClientType==="privy"?h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType==="privy"):h=s?.linkedAccounts.find(C=>C.type==="wallet"&&C.address===d.address&&C.walletClientType!=="privy"),!p&&h){let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(C)}y.current=u},[u]);let ms=async(d,p)=>{if(Ve(d))throw U(D,"createWallet","onError","embedded_wallet_already_exists"),new Error("Only one Privy wallet per user is currently allowed");let[C,x]=await Promise.all([Pe.initializeWalletProxy(p),Oe()]);if(!C&&B.customAuth?.enabled)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to connect to wallet proxy");if(!C||!x||B.embeddedWallets?.requireUserOwnedRecoveryOnCreate)return new Promise((G,ee)=>{ve(!0),ae({createWallet:{onSuccess:gt=>{U(D,"createWallet","onSuccess",gt),G(gt)},onFailure:gt=>{U(D,"createWallet","onError","unknown_embedded_wallet_error"),ee(gt)},callAuthOnSuccessOnClose:!1}}),Ie("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")});{await C.create({accessToken:x});let G=await Pe.refreshUser(),ee=Ve(G);if(!ee)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");return U(D,"createWallet","onSuccess",ee),ee}},H3=d=>{if(!B.chains.map(p=>p.id).includes(d))throw new de(`Chain ID ${d} is not supported. It must be added to the config.supportedChains property of the PrivyProvider.`,"unsupported_chain_id")},Rp=(d,p,h)=>new Promise(async(C,x)=>{if(!a||!s){U(D,"sendTransaction","onError","must_be_authenticated"),x(new Error("User must be authenticated before signing with a Privy wallet"));return}let G=Ve(s);if(!G){U(D,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have a Privy wallet before signing"));return}ve(!0);let ee=t.connectors?.findWalletConnector("embedded","privy")?.proxyProvider,ut=d.chainId?Number(d.chainId):ee.chainId;H3(ut);let gt=Object.assign({},d,{chainId:ut}),Mr=async()=>{let Ke=await Oe();if(!Ke||!M){U(D,"sendTransaction","onError","embedded_wallet_not_found"),x(new Error("Must have valid access token and Privy wallet to send transaction"));return}try{if(!await Pe.recoverEmbeddedWallet()){U(D,"sendTransaction","onError","unknown_connect_wallet_error"),x(new Error("Unable to connect to wallet"));return}let jt=Wo(gt.chainId,B.chains,B.rpcConfig,{appId:e.appId}),$c=await da(G.address,gt,jt);if(B.embeddedWallets.noPromptOnSignature){let{totalGasEstimate:V3}=await ca($c,jt),{hasSufficientFunds:z3}=await Wc(G.address,$c,V3,jt);if(!z3)throw new tt(new vr("Wallet has insufficient funds for this transaction.",Wt.E32603_DEFAULT_INTERNAL_ERROR.eipCode))}let Mp=await Mc(Ke,G.address,M,$c,jt);U(D,"sendTransaction","onSuccess",Mp),C(Mp)}catch(yr){U(D,"sendTransaction","onError","transaction_failure"),x(yr)}};if(B.embeddedWallets.noPromptOnSignature)p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config"),Mr();else{let Ke={transactionRequest:gt,onSuccess:jt=>{U(D,"sendTransaction","onSuccess",jt),C(jt)},onFailure:jt=>{U(D,"sendTransaction","onError","transaction_failure"),x(jt)},uiOptions:p||{},fundWalletConfig:h},yr={onCompleteNavigateTo:"EMBEDDED_WALLET_SEND_TRANSACTION_SCREEN",onFailure:jt=>{U(D,"sendTransaction","onError","unknown_connect_wallet_error"),x(jt)}};ae({connectWallet:yr,sendTransaction:Ke}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}});function Ip(){return new Promise(async(d,p)=>{let h=await Oe();if(!h||!M)throw new Error("Must have valid access token to enroll in MFA");try{await M.verifyMfa({accessToken:h}),d()}catch(C){p(C)}})}let hr=d=>{if(d==="passkey"){if(s&&s.linkedAccounts.filter(p=>p.type==="passkey").length>=5)throw U(D,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)}else if(s?.[d])throw U(D,"linkAccount","onError","cannot_link_more_of_type"),new T(`User already has an account of type ${d} linked.`)},ci={ready:n,authenticated:a,user:s,walletConnectors:t.connectors||null,connectWallet:Mo,linkWallet:en,linkEmail:()=>{yt(),hr("email"),se.current="email",le.current="link",Ie("LINK_EMAIL_SCREEN")},linkPhone:()=>{yt(),hr("phone"),se.current="sms",le.current="link",Ie("LINK_PHONE_SCREEN")},linkGoogle:async()=>{yt(),hr("google"),le.current="link",await Pe.initLoginWithOAuth("google")},linkTwitter:async()=>{yt(),hr("twitter"),le.current="link",await Pe.initLoginWithOAuth("twitter")},linkDiscord:async()=>{yt(),hr("discord"),le.current="link",await Pe.initLoginWithOAuth("discord")},linkGithub:async()=>{yt(),hr("github"),le.current="link",await Pe.initLoginWithOAuth("github")},linkSpotify:async()=>{yt(),hr("spotify"),le.current="link",await Pe.initLoginWithOAuth("spotify")},linkInstagram:async()=>{yt(),hr("instagram"),le.current="link",await Pe.initLoginWithOAuth("instagram")},linkTiktok:async()=>{yt(),hr("tiktok"),le.current="link",await Pe.initLoginWithOAuth("tiktok")},linkLinkedIn:async()=>{yt(),hr("linkedin"),le.current="link",await Pe.initLoginWithOAuth("linkedin")},linkApple:async()=>{yt(),hr("apple"),le.current="link",await Pe.initLoginWithOAuth("apple")},linkPasskey:async()=>{yt(),hr("passkey"),await Pe.initLinkWithPasskey(),Ie("LINK_PASSKEY_SCREEN")},linkFarcaster:async()=>{yt(),hr("farcaster"),await Pe.initLoginWithFarcaster(),le.current="link",se.current="farcaster",Ie("AWAITING_FARCASTER_CONNECTION")},updateEmail:()=>{if(yt(),!s?.email)throw new T("User does not have an email linked to their account.");le.current="link",se.current="email",Ie("UPDATE_EMAIL_SCREEN")},login:async()=>{let d="Attempted to log in, but user is already logged in. Use a `link` helper instead.";if(!n){let p=await new Promise(h=>{Mt(C=>h.bind(C))});if(Mt(null),p){console.warn(d);return}}if(a){console.warn(d);return}le.current="login",Xe("LANDING")},connectOrCreateWallet:async()=>{if(n||(await new Promise(d=>{Mt(()=>d)}),Mt(null)),a){console.warn("User must be unauthenticated to `connectOrCreateWallet`");return}if(u[0]){console.warn("User must have no connected wallets to `connectOrCreateWallet`");return}Xe("CONNECT_OR_CREATE")},logout:async()=>{if(await t.logout(),s&&M)try{await M.clearMfa({userId:s.id})}catch{}c(null),l(!1),k(null),U(D,"logout","onSuccess"),le.current=null,se.current=null,o(!1),oe.del(va)},getAccessToken:()=>t.getAccessToken(),getEthereumProvider:()=>{if(!s||!s.wallet)return new Je;let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new Je:p.proxyProvider},getEthersProvider:()=>{if(!s||!s.wallet)return new Vc.Web3Provider(new Jr(new Je));let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new Vc.Web3Provider(new Jr(new Je)):new Vc.Web3Provider(new Jr(p.proxyProvider))},getWeb3jsProvider:()=>{if(!s||!s.wallet)return new ln(new Je);let d=u.find(h=>s.wallet&&h.address===s.wallet.address),p=t.connectors?.walletConnectors.find(h=>h.wallets.find(C=>C.address===d?.address));return!d||!p?new ln(new Je):new ln(p.proxyProvider)},unlinkWallet:async d=>{let p=await t.unlinkWallet(d);return c(p),p},unlinkEmail:async d=>{let p=await t.unlinkEmail(d);return c(p),p},unlinkPhone:async d=>{let p=await t.unlinkPhone(d);return c(p),p},unlinkGoogle:async d=>{let p=await t.unlinkOAuth("google",d);return c(p),p},unlinkTwitter:async d=>{let p=await t.unlinkOAuth("twitter",d);return c(p),p},unlinkDiscord:async d=>{let p=await t.unlinkOAuth("discord",d);return c(p),p},unlinkGithub:async d=>{let p=await t.unlinkOAuth("github",d);return c(p),p},unlinkSpotify:async d=>{let p=await t.unlinkOAuth("spotify",d);return c(p),p},unlinkInstagram:async d=>{let p=await t.unlinkOAuth("instagram",d);return c(p),p},unlinkTiktok:async d=>{let p=await t.unlinkOAuth("tiktok",d);return c(p),p},unlinkLinkedIn:async d=>{let p=await t.unlinkOAuth("linkedin",d);return c(p),p},unlinkApple:async d=>{let p=await t.unlinkOAuth("apple",d);return c(p),p},unlinkFarcaster:async d=>{let p=await t.unlinkFarcaster(d);return c(p),p},unlinkPasskey:async d=>{let p=await t.unlinkPasskey(d);return c(p),p},setActiveWallet:async d=>{let p=u.find(C=>(0,ps.getAddress)(C.address)===(0,ps.getAddress)(d)),h=s?.linkedAccounts.find(C=>C.type==="wallet"&&(0,ps.getAddress)(C.address)===(0,ps.getAddress)(d));if(!p||!await p.isConnected())j(d),en();else if(!p.linked)p.loginOrLink();else{let C=Object.assign({},s);C.wallet=h&&{address:h.address,chainType:h.chainType,chainId:h.chainId,walletClient:h.walletClient,walletClientType:h.walletClientType,connectorType:h.connectorType},c(C)}},forkSession:()=>t.forkSession(),createWallet:async()=>{if(!a||!s)throw U(D,"createWallet","onError","must_be_authenticated"),new Error("User must be authenticated before creating a Privy wallet");return ms(s,15e3)},setWalletPassword:async()=>{if(!a||!s)throw U(D,"setWalletPassword","onError","must_be_authenticated"),new Error("User must be authenticated before adding password to Privy wallet");let d=Ve(s);if(!d||!M)throw U(D,"setWalletPassword","onError","embedded_wallet_not_found"),new Error("Must have a Privy wallet to add a password");if(d.recoveryMethod==="user-passcode")throw U(D,"setWalletPassword","onError","embedded_wallet_password_already_exists"),new Error("Cannot set password. Embedded wallet already has a password.");try{await Ip()}catch(p){throw U(D,"setWalletPassword","onError","missing_or_invalid_mfa"),p}return new Promise((p,h)=>{ve(!0);let C={onSuccess:G=>{U(D,"setWalletPassword","onSuccess",G),p(G)},onFailure:G=>{U(D,"setWalletPassword","onError","user_exited_set_password_flow"),h(G)},callAuthOnSuccessOnClose:!1},x={onCompleteNavigateTo:"EMBEDDED_WALLET_PASSWORD_UPDATE_SPLASH_SCREEN",onFailure:G=>{U(D,"setWalletPassword","onError","unknown_connect_wallet_error"),h(G)}};ae({setWalletPassword:C,connectWallet:x}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")})},signMessage:(d,p)=>new Promise(async(h,C)=>{if(!a||!s){U(D,"signMessage","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=Ve(s);if(!x){U(D,"signMessage","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}if(typeof d!="string"||d.length<1){U(D,"signMessage","onError","invalid_message"),C(new Error("Message must be a non-empty string"));return}ve(!0);let G=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ee=await Oe();if(!M||!ee)throw new Error("Unable to connect to wallet");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_started",payload:{walletAddress:x.address}});let{response:gt}=await M.rpc({accessToken:ee,address:x.address,request:{method:"personal_sign",params:[d,x.address]}}),Mr=gt.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_message_completed",payload:{walletAddress:x.address}}),Mr};if(B.embeddedWallets.noPromptOnSignature){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ee=await G();U(D,"signMessage","onSuccess",ee),h(ee)}catch(ee){U(D,"signMessage","onError","unable_to_sign"),C(ee??new tt("Unable to sign message"))}}else{let gt={method:"personal_sign",data:d,confirmAndSign:G,onSuccess:Ke=>{U(D,"signMessage","onSuccess",Ke),h(Ke)},onFailure:Ke=>{U(D,"signMessage","onError","unable_to_sign"),C(Ke)},uiOptions:p||{}},Mr={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:Ke=>{U(D,"signMessage","onError","unknown_connect_wallet_error"),C(Ke)}};ae({signMessage:gt,connectWallet:Mr}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),signTypedData:(d,p)=>new Promise(async(h,C)=>{if(!a||!s){U(D,"signTypedData","onError","must_be_authenticated"),C(new Error("User must be authenticated before signing with a Privy wallet"));return}let x=Ve(s);if(!x){U(D,"signTypedData","onError","embedded_wallet_not_found"),C(new Error("Must have a Privy wallet before signing"));return}ve(!0);let G=ks(d),ee=async()=>{if(!a)throw new Error("User must be authenticated before signing with a Privy wallet");let ut=await Oe();if(!M||!ut)throw new Error("Unable to connect to wallet");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_started",payload:{walletAddress:x.address}});let{response:Mr}=await M.rpc({accessToken:ut,address:x.address,request:{method:"eth_signTypedData_v4",params:[x.address,G]}}),Ke=Mr.data;return t.createAnalyticsEvent({eventName:"embedded_wallet_sign_typed_data_completed",payload:{walletAddress:x.address}}),Ke};if(B.embeddedWallets.noPromptOnSignature||(B.legacyWalletUiConfig??!1)){p&&console.warn("uiOptions defined with `noPromptOnSignature` set to true in app config");try{let ut=await ee();U(D,"signTypedData","onSuccess",ut),h(ut)}catch(ut){U(D,"signTypedData","onError","unable_to_sign"),C(ut??new tt("Unable to sign message"))}}else{let Mr={method:"eth_signTypedData_v4",data:G,confirmAndSign:ee,onSuccess:yr=>{U(D,"signTypedData","onSuccess",yr),h(yr)},onFailure:yr=>{U(D,"signTypedData","onError","unable_to_sign"),C(yr)},uiOptions:p||{}},Ke={onCompleteNavigateTo:"EMBEDDED_WALLET_SIGN_REQUEST_SCREEN",onFailure:yr=>{U(D,"signMessage","onError","unknown_connect_wallet_error"),C(yr)}};ae({signMessage:Mr,connectWallet:Ke}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}}),sendTransaction:async(d,p,h)=>{let x=await(await Rp(d,p,h)).wait();return Lc(x)},exportWallet:()=>new Promise(async(d,p)=>{if(!a||!s){p(new Error("User must be authenticated before exporting their Privy wallet"));return}if(!Ve(s)){p(new Error("Must have a Privy wallet before exporting"));return}ve(!0);let C={onCompleteNavigateTo:"EMBEDDED_WALLET_KEY_EXPORT_SCREEN",onFailure:p,shouldForceMFA:!0};if(ae(Ee),!await Oe()||!M){p(new Error("Must have valid access token to enroll in MFA"));return}if(!M){p(new Error("Must have a Privy wallet before exporting"));return}let G={appId:e.appId,origin:t.apiUrl,onSuccess:d,onFailure:p};ae({keyExport:G,connectWallet:C}),Ie("EMBEDDED_WALLET_CONNECTING_SCREEN")}),promptMfa:Ip,async init(d){switch(d){case"sms":await t.initMfaSmsVerification();return;case"passkey":return await t.initMfaPasskeyVerification();case"totp":return;default:throw new Error(`Unsupported MFA method: ${d}`)}},async submit(d,p){switch(d){case"totp":case"sms":if(typeof p!="string")throw new T("Invalid MFA code");tr.current?.resolve({mfaMethod:d,mfaCode:p,relyingParty:window.origin}),await new Promise((G,ee)=>{it.current={resolve:G,reject:ee}});break;case"passkey":if(typeof p=="string")throw new T("Invalid authenticator response");let C=await(await import("@simplewebauthn/browser")).startAuthentication(p),x=a3(C);tr.current?.resolve({mfaMethod:d,mfaCode:x,relyingParty:window.origin}),await new Promise((G,ee)=>{it.current={resolve:G,reject:ee}});break;default:throw tr.current?.reject(new T("Unsupported MFA method")),new T(`Unsupported MFA method: ${d}`)}},cancel(){tr.current?.reject(new T("MFA canceled"))},async initEnrollmentWithSms(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.initEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber})},enrollInMfa(d){return new Promise((p,h)=>{if(!d){Pe.closePrivyModal(),p();return}B.mfa.noPromptOnMfaRequired&&console.warn("[Privy Warning] Triggering the 'showMfaEnrollmentModal' function when 'noPromptOnMfaRequired' is set to true is unexpected. If this is intentional, ensure that you are building custom UIs for MFA verification."),ae({mfaEnrollmentFlow:{mfaMethods:B.mfa.methods,onSuccess:p,onFailure:h}}),Ie("MFA_ENROLLMENT_FLOW_SCREEN")})},async initEnrollmentWithTotp(){let d=await Oe();if(!d||!M)throw new Error("Must have valid access token to enroll in MFA");let p=await M.initEnrollMfa({method:"totp",accessToken:d});return{secret:p.secret,authUrl:p.authUrl}},async submitEnrollmentWithSms(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"sms",accessToken:p,phoneNumber:d.phoneNumber,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async submitEnrollmentWithTotp(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"totp",accessToken:p,code:d.mfaCode});let h=await t.getAuthenticatedUser();c(h)},async initEnrollmentWithPasskey(){},async submitEnrollmentWithPasskey({credentialIds:d}){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to enroll in MFA");await M.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:d});let h=await t.getAuthenticatedUser();c(h)},async unenroll(d){let p=await Oe();if(!p||!M)throw new Error("Must have valid access token to remove MFA");d==="passkey"?await M.submitEnrollMfa({method:"passkey",accessToken:p,credentialIds:[]}):await M.unenrollMfa({method:d,accessToken:p});let h=await t.getAuthenticatedUser();c(h)},requestFarcasterSignerFromWarpcast:async()=>{let d=await Oe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");let C=await M.initFarcasterSigner({address:p.address,hdWalletIndex:null,accessToken:d,mfaCode:null,mfaMethod:null,relyingParty:window.origin});if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}ae({farcasterSigner:C}),Ie("AWAITING_FARCASTER_SIGNER")},getFarcasterSignerPublicKey:async()=>{let d=await Oe(),p=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!d)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!p)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");return(x=>Uint8Array.from(x.match(/.{1,2}/g).map(G=>parseInt(G,16))))(s.farcaster.signerPublicKey.slice(2))},signFarcasterMessage:async d=>{let p=await Oe(),h=s?.linkedAccounts.find(ee=>ee.type==="wallet"&&ee.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");if(!await Pe.recoverEmbeddedWallet())throw new Error("Unable to connect to wallet");if(!s.farcaster?.signerPublicKey)throw new Error("Must have a Farcaster signer public key to sign");let x=await import("@simplewebauthn/browser"),G=await M.signFarcasterMessage({address:h.address,hdWalletIndex:null,accessToken:p,mfaCode:null,mfaMethod:null,payload:{hash:x.bufferToBase64URLString(d)},fid:BigInt(s.farcaster.fid),relyingParty:window.origin});return new Uint8Array(x.base64URLStringToBuffer(G.signature))},isHeadlessOAuthLoading:P,loginWithCode(d){return Pe.loginWithCode(d)},initLoginWithEmail(d){return Pe.initLoginWithEmail(d)},initLoginWithSms(d){return Pe.initLoginWithSms(d)},otpState:N,fundWallet(d,p){return Pe.fundWallet(d,p)},initLoginWithHeadlessOAuth(d,p){return Pe.initLoginWithHeadlessOAuth(d,p)},loginWithHeadlessOAuth(d){return Pe.loginWithHeadlessOAuth(d)},isModalOpen:r};l3=ci.signMessage,c3=ci.signTypedData,d3=async(...d)=>{let p=await Rp(...d);return B.embeddedWallets.waitForTransactionConfirmation&&await p.wait(),p};let Pe=(()=>({isNewUserThisSession:g,linkingHint:J,pendingTransaction:null,walletConnectionStatus:A,mipdStore:I,connectors:t.connectors?.walletConnectors??[],rpcConfig:B.rpcConfig,chains:B.chains,appId:e.appId,showFiatPrices:B.embeddedWallets.priceDisplay.primary!=="native-token",clientAnalyticsId:t.clientAnalyticsId,nativeTokenSymbolForChainId:d=>B.chains.find(p=>p.id===Number(d))?.nativeCurrency.symbol,initializeWalletProxy:async d=>{if(M)return M;let p=new Promise(x=>{wt(()=>G=>x(G))}),h=new Promise(x=>setTimeout(()=>x(null),d)),C=await Promise.race([p,h]);return wt(null),C},getAuthFlow:()=>t.authFlow,getAuthMeta:()=>t.authFlow?.meta,closePrivyModal:(d={shouldCallAuthOnSuccess:!0,isSuccess:!1})=>{let p=n&&a&&s,h;p&&se.current&&(h=s?.linkedAccounts.filter(C=>C.latestVerifiedAt!==null&&!(C.type==="wallet"&&C.walletClientType==="privy")).sort((C,x)=>x.latestVerifiedAt.getTime()-C.latestVerifiedAt.getTime())[0]),le.current==="login"&&se.current?d.shouldCallAuthOnSuccess&&p?(U(D,"login","onComplete",s,g,!1,se.current,h??null),e.onSuccess?.(s,g)):U(D,"login","onError","exited_auth_flow"):le.current==="link"&&se.current&&h&&(d.isSuccess&&p?U(D,"linkAccount","onSuccess",s,se.current,h):U(D,"linkAccount","onError","exited_link_flow")),j(null),le.current=null,se.current=null,w(!1),o(!1),setTimeout(()=>{t.authFlow=void 0},200),t.createAnalyticsEvent({eventName:"modal_closed"})},openPrivyModal:Ie,connectWallet:li,initLoginWithWallet:async(d,p)=>{se.current="siwe",In(d,p)},loginWithWallet:async()=>{if(!n)throw new tn;if(!(t.authFlow instanceof Gn))throw new T("Must initialize SIWE flow first.");let d,p;if(a)try{d=await t.link(),se.current="siwe"}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:d,isNewUser:p}=await t.authenticate()),se.current="siwe"}catch(h){throw U(D,"login","onError",h.privyErrorCode||"generic_connect_wallet_error"),h}c(d||s||null),w(p||!1),l(!0)},initLoginWithFarcaster:async d=>{let p=new ya(d);t.startAuthFlow(p);try{se.current="farcaster",await p.initializeFarcasterConnect()}catch(h){throw le.current==="login"?U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error"),h}},loginWithFarcaster:async()=>{if(!n)throw new tn;if(!(t.authFlow instanceof ya))throw new T("Must initialize Farcaster flow first.");let d,p;if(a)try{d=await t.link(),se.current="farcaster"}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"failed_to_link_account"),h}else try{({user:d,isNewUser:p}=await t.authenticate()),se.current="farcaster"}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d||null),w(p||!1),l(!0)},async initLoginWithOAuth(d,p){if(se.current=d,Zc()){if(d==="google"&&Gc(window.navigator.userAgent)){Xe("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}}else{Xe("IN_APP_BROWSER_LOGIN_NOT_POSSIBLE");return}oe.del(Dn);let h=new fo({provider:d});p&&h.addCaptchaToken(p),t.startAuthFlow(h);let C=await t.authFlow.getAuthorizationUrl();C&&C.url&&window.location.assign(C.url)},async recoveryOAuthFlow(d,p,h){let{url:C,codeVerifier:x,stateCode:G}=await eh({api:An.api,provider:d});if(!C)throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:"Unable to open recovery OAuth popup",provider:d}}),new T("Recovery OAuth failed");let ee,ut;try{let Ke=await i3({url:C,popup:h});if(ee=Ke.stateCode,ut=Ke.authorizationCode,ee!==G)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:G??"",returnedStateCode:ee??""}}),new T("Unexpected auth flow. This may be a phishing attempt.")}catch(Ke){throw t.createAnalyticsEvent({eventName:"recovery_oauth_error",payload:{error:Ke.toString(),provider:d}}),new T("Recovery OAuth failed")}let[gt,Mr]=await Promise.all([Oe(),th({api:An.api,provider:d,codeVerifier:x,stateCode:ee,authorizationCode:ut})]);if(!M)throw new T("Cannot connect to wallet proxy");switch(p){case"recover":let Ke=Ee.recoverWallet?.privyWallet?.address;if(!Ke)throw new T("Recovery OAuth failed");t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_started",payload:{walletAddress:Ke,recoveryMethod:d}}),await M.recover({address:Ke,accessToken:gt,recoveryAccessToken:Mr,recoveryMethod:d}),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:Ke,recoveryMethod:d}});break;case"create-wallet":t.createAnalyticsEvent({eventName:"embedded_wallet_creation_started"}),await M.create({accessToken:gt,recoveryAccessToken:Mr,recoveryMethod:d});let yr=await Pe.refreshUser(),jt=Ve(yr);if(!jt)throw U(D,"createWallet","onError","unknown_embedded_wallet_error"),new Error("Failed to create wallet");t.createAnalyticsEvent({eventName:"embedded_wallet_creation_completed",payload:{walletAddress:jt.address}}),U(D,"createWallet","onSuccess",jt);break;default:throw new T("Unsupported recovery action")}},async loginWithOAuth(d){if(!(t.authFlow instanceof fo))throw new T("Must initialize OAuth flow before calling loginWithOAuth");let p=oe.get(On),h=t.authFlow.meta.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d,storedStateCode:p??"",returnedStateCode:h??""}}),new T("Unexpected auth flow. This may be a phishing attempt.");let C,x,G;if(a)try{C=await t.link(),se.current=d}catch(ee){throw U(D,"linkAccount","onError",ee.privyErrorCode||"failed_to_link_account"),ee}else try{let ee=await t.authenticate();C=ee.user,x=ee.isNewUser,G=ee.oAuthProviderTokens,se.current=d}catch(ee){throw le.current==="login"?U(D,"login","onError",ee.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",ee.privyErrorCode||"failed_to_link_account"),ee}return c(C),w(x||!1),l(!0),G},async initLoginWithPasskey(d){let p=new Hn(d);t.startAuthFlow(p),le.current="login";try{se.current="passkey",await p.initAuthenticationFlow()}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}},async loginWithPasskey(){if(!n)throw new tn;if(!(t.authFlow instanceof Hn))throw new T("Must initialize Passkey flow first.");if(se.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d,p;try{se.current="passkey",{user:d,isNewUser:p}=await t.authenticate()}catch(h){throw U(D,"login","onError",h.privyErrorCode||"unknown_auth_error"),h}c(d),w(p||!1),l(!0)},async initLinkWithPasskey(d){let p=new Hn(d);t.startAuthFlow(p),le.current="link",se.current="passkey";try{await p.initLinkFlow()}catch(h){throw U(D,"linkAccount","onError",h.privyErrorCode||"unknown_auth_error"),h}},async linkWithPasskey(){if(!n)throw new tn;if(!(t.authFlow instanceof Hn))throw new T("Must initialize Passkey flow first.");if(se.current!=="passkey")throw new T("Must init login with Passkey flow first.");let d;try{se.current="passkey",d=await t.link()}catch(p){throw U(D,"linkAccount","onError",p.privyErrorCode||"failed_to_link_account"),p}return c(d||s||null),d},async initLoginWithHeadlessOAuth(d,p){if(Zc()){if(d==="google"&&Gc(window.navigator.userAgent))throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.")}else throw Error("It looks like you're using an in-app browser. To log in, please try again using an external browser.");let h=new fo({provider:d,headless:!0});p&&h.addCaptchaToken(p);let C=await t.startAuthFlow(h).getAuthorizationUrl();C?.url&&window.location.assign(C.url)},async loginWithHeadlessOAuth(d){b(!0),t.startAuthFlow(new fo(d));let p=oe.get(On),h=d.stateCode;if(p!==h)throw t.createAnalyticsEvent({eventName:"possible_phishing_attempt",payload:{provider:d.provider,storedStateCode:p??"",returnedStateCode:h??""}}),b(!1),new T("Unexpected auth flow. This may be a phishing attempt.");let C,x;if(a)try{C=await t.link(),se.current=d.provider}catch(G){throw U(D,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}else try{({user:C,isNewUser:x}=await t.authenticate()),se.current=d.provider}catch(G){throw le.current==="login"?U(D,"login","onError",G.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",G.privyErrorCode||"failed_to_link_account"),G}return c(C),w(x||!1),l(!0),b(!1),C??void 0},initLoginWithEmail:async(d,p)=>{let h=new rn(d,p);t.startAuthFlow(h);try{se.current="email",await h.sendCodeEmail()}catch(C){throw le.current==="login"?U(D,"login","onError",C.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},initUpdateEmail:async(d,p,h)=>{let C=new Es(d,p,h);t.startAuthFlow(C),await C.sendCodeEmail()},initLoginWithSms:async(d,p)=>{L({status:"sending-code"});let h=new Vn(d,p);t.startAuthFlow(h);try{se.current="sms",await h.sendSmsCode(),L({status:"awaiting-code-input"})}catch(C){throw L({status:"error",error:C}),le.current==="login"?U(D,"login","onError",C.privyErrorCode||"unknown_auth_error"):le.current==="link"&&U(D,"linkAccount","onError",C.privyErrorCode||"failed_to_link_account"),C}},resendEmailCode:async()=>{await t.authFlow?.sendCodeEmail()},resendSmsCode:async()=>{await t.authFlow?.sendSmsCode()},loginWithCode:async d=>{if(L({status:"submitting-code"}),!n){let x=new tn;throw L({status:"error",error:x}),x}if(t.authFlow instanceof rn)t.authFlow.meta.emailCode=d.trim();else if(t.authFlow instanceof Vn)t.authFlow.meta.smsCode=d.trim();else{let x=new T("Must initialize a passwordless code flow first");throw L({status:"error",error:x}),x}let p=await Oe(),h,C;if(p&&t.sessionHasActiveToken())try{h=await t.link()}catch(x){throw L({status:"error",error:x}),U(D,"linkAccount","onError",x.privyErrorCode||"failed_to_link_account"),x}else try{({user:h,isNewUser:C}=await t.authenticate())}catch(x){throw L({status:"error",error:x}),U(D,"login","onError",x.privyErrorCode||"unknown_auth_error"),x}c(h||s||null),w(C||!1),l(!0),L({status:"done"})},refreshUser:async()=>{let d=await t.getAuthenticatedUser();return c(d),d},walletProxy:M,createAnalyticsEvent:({eventName:d,payload:p,timestamp:h})=>t.createAnalyticsEvent({eventName:d,payload:p,timestamp:h}),acceptTerms:async()=>{let d=await t.acceptTerms();return c(d),d},getUsdTokenPrice:d=>t.getUsdTokenPrice(d),recoverEmbeddedWallet:async()=>new Promise(async(d,p)=>{let h=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy"),C=await Oe();if(!C||!M||!h){p(new Error("Must have valid access token and Privy wallet to recover wallet"));return}ve(!0);try{await M.connect({accessToken:C,address:h.address}),d(!0)}catch(x){if(Bi(x)&&h.recoveryMethod==="privy")t.createAnalyticsEvent({eventName:"embedded_wallet_pinless_recovery_started",payload:{walletAddress:h.address}}),(await M.recover({address:h.address,accessToken:C})).address||p(new Error("Unable to recover wallet")),t.createAnalyticsEvent({eventName:"embedded_wallet_recovery_completed",payload:{walletAddress:h.address}}),d(!0);else if(Bi(x)){ae({recoverWallet:{privyWallet:h,onFailure:p,onSuccess:()=>d(!0)},recoveryOAuthStatus:{provider:"google-drive",action:"recover"}});let G=Zl(h.recoveryMethod);Ie(G)}else p(x)}}),getFiatOnRampConfig:jr,setReadyToTrue:d=>{i(!0),It?.(d)},updateWallets:()=>Mn(),fundWallet:async(d,p)=>{let{signedUrl:h,externalTransactionId:C}=await jr(d,p);ae({fiatOnRampPrompt:{signedUrl:h},fiatOnRampStatus:{externalTransactionId:C}}),Ie("FIAT_ON_RAMP_PROMPT_SCREEN")},requestFarcasterSignerStatus:async d=>{let p=await Oe(),h=s?.linkedAccounts.find(x=>x.type==="wallet"&&x.walletClientType==="privy");if(!p)throw new Error("Must have valid access token to connect with Farcaster");if(!M||!h)throw new Error("Must have an embedded wallet to use Farcaster signers");if(!s?.farcaster?.fid)throw new Error("Must have Farcaster account to use Farcaster signers");let C=await t.requestFarcasterSignerStatus(d);if(C.status==="approved"){let x=await t.getAuthenticatedUser();c(x||s||null)}return C}}))();p3=Pe.recoverEmbeddedWallet;let G3=(0,ie.useMemo)(()=>({wallets:u,ready:Rr&&Rn}),[u,Rr,Rn]);return(0,mr.jsx)(xe.Provider,{value:ci,children:(0,mr.jsx)(Cd.Provider,{value:D,children:(0,mr.jsx)(Cp.Provider,{value:G3,children:(0,mr.jsxs)(qm,{...B,children:[e.children,(0,mr.jsxs)(vd.Provider,{value:Pe,children:[!B.headless&&B.captchaEnabled&&n&&!a&&(0,mr.jsx)(Sl,{delayedExecution:!1}),(0,mr.jsx)(Q2,{theme:{...B.appearance.palette||{}}}),(0,mr.jsx)(Wm,{data:Ee,setModalData:ae,setInitialScreen:k,initialScreen:v,authenticated:a,open:r,children:(0,mr.jsx)(t3,{open:r})}),fe&&be?(0,mr.jsx)(o3,{appId:e.appId,clientAnalyticsId:t.clientAnalyticsId,origin:t.apiUrl,mfaMethods:s?.mfaMethods,mfaPromise:tr,mfaSubmitPromise:it,onLoad:ne,onLoadFailed:()=>null}):null]})]})})})})};var m3=require("react");function f3(e){let{login:t}=(0,m3.useContext)(xe);return rt("login",e),{login:t}}var h3=require("react");function y3(e){let{logout:t}=(0,h3.useContext)(xe);return rt("logout",e),{logout:t}}var us=require("react");function g3(){let e=Me(),t=Cl(),{initLoginWithHeadlessOAuth:r,loginWithHeadlessOAuth:o,isHeadlessOAuthLoading:n,ready:i,user:a}=H(),l=(0,us.useCallback)(async c=>{if(e.enabled&&e.status!=="success")throw new Xr(e.error,null,"captcha_failure");return r(c.provider,e.token)},[r,e]),s=(0,us.useCallback)(async()=>{let c=Ta();if(a)return console.warn("Cannot login with OAuth when already logged in"),a;if(!c.inProgress)throw new Error("Cannot login with OAuth because no OAuth flow is in progress");if(!c.popupFlow)try{return await o(c)}catch(u){throw u}finally{Bn()}},[o]);return(0,us.useEffect)(()=>{let c=Ta();i&&t&&c.inProgress&&c.headless&&!c.popupFlow&&s()},[i,t]),{initOAuth:l,loginWithOAuth:s,loading:n}}var kp=require("react");var v3=()=>{let e=Me(),{initLoginWithEmail:t,loginWithCode:r}=H(),o=(0,kp.useCallback)(async({email:i})=>{if(!i)throw new Error("Email required to send OTP code");return t(i)},[t]),n=(0,kp.useCallback)(async({code:i})=>{if(e.enabled&&e.status==="error")throw new Xr(e.error,null,"captcha_failure");return r(i)},[r,e.status]);return{sendCode:o,loginWithCode:n}};var Ap=require("react");var C3=()=>{let e=Me(),{initLoginWithSms:t,loginWithCode:r,otpState:o}=H(),n=(0,Ap.useCallback)(async({phoneNumber:a})=>{if(!a)throw new Error("SMS required to send OTP code");return t(a)},[t]),i=(0,Ap.useCallback)(async({code:a})=>{if(e.enabled&&e.status!=="success")throw new Xr(e.error,null,"captcha_failure");return r(a)},[r,e.status]);return{sendCode:n,loginWithCode:i,state:o}};var w3=require("react");function b3(e){let{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:y,linkFarcaster:g}=(0,w3.useContext)(xe);return rt("linkAccount",e),{linkEmail:t,linkPhone:r,linkWallet:o,linkGoogle:n,linkApple:i,linkTwitter:a,linkDiscord:l,linkGithub:s,linkLinkedIn:c,linkTiktok:u,linkSpotify:f,linkInstagram:y,linkFarcaster:g}}var E3=require("react");function P3(e){let{connectWallet:t}=(0,E3.useContext)(xe);return rt("connectWallet",e),{connectWallet:t}}var T3=require("react");function S3(e){let{createWallet:t}=(0,T3.useContext)(xe);return rt("createWallet",e),{createWallet:t}}var x3=()=>{let{fundWallet:e}=H();return{fundWallet:e}};var _3=require("react");function k3(e){let{sendTransaction:t}=(0,_3.useContext)(xe);return rt("sendTransaction",e),{sendTransaction:t}}var A3=require("react");function R3(e){let{setWalletPassword:t}=(0,A3.useContext)(xe);return rt("setWalletPassword",e),{setWalletPassword:t}}var I3=require("react");function M3(e){let{signMessage:t}=(0,I3.useContext)(xe);return rt("signMessage",e),{signMessage:t}}var W3=require("react");function L3(e){let{signTypedData:t}=(0,W3.useContext)(xe);return rt("signTypedData",e),{signTypedData:t}}var O3=require("react");var N3=()=>{let{isModalOpen:e}=(0,O3.useContext)(xe);return{isOpen:e}};var D3=require("react");function U3(e){let{getAccessToken:t}=(0,D3.useContext)(xe);return rt("accessToken",e),{getAccessToken:t}}function F3(){let{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}=H();return{getFarcasterSignerPublicKey:e,signFarcasterMessage:t,requestFarcasterSignerFromWarpcast:r}}function B3(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}0&&(module.exports={AsExternalProvider,Captcha,ConnectorManager,PrivyClient,PrivyProvider,PrivyProxyProvider,SUPPORTED_CHAINS,VERSION,WalletConnector,addRpcUrlOverrideToChain,errorIndicatesMaxMfaRetries,errorIndicatesMfaTimeout,errorIndicatesMfaVerificationFailed,getAccessToken,useConnectWallet,useCreateWallet,useExperimentalFarcasterSigner,useFundWallet,useLinkAccount,useLogin,useLoginWithEmail,useLoginWithOAuth,useLoginWithSms,useLogout,useMfa,useMfaEnrollment,useModalStatus,usePrivy,useRegisterMfaListener,useSendTransaction,useSetWalletPassword,useSignMessage,useSignTypedData,useToken,useWallets});
|