PageSourceSearch

https://fanable.io/_next/static/chunks/7379.bebc849ed548eae3.js

js fanable.io collected 2026-10-05 23:07:41 UTC 210,458 bytes, 25 lines download raw bytes

1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="54de918b-aff7-4988-a398-eb287dac42d7",e._sentryDebugIdIdentifier="sentry-dbid-54de918b-aff7-4988-a398-eb287dac42d7")}()}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7379],{2191:(e,t,r)=>{"use strict";r.d(t,{A:()=>tN});let n={path:"/api/v1/apps/:app_id/smart_wallets",method:"GET"};class i{getConfig(){return this._privyInternal.config}async getSmartWalletConfig(){return this._smartWalletConfig||(this._smartWalletConfig=await this._privyInternal.fetch(n,{params:{app_id:this.appId}})),this._smartWalletConfig}get appId(){return this._privyInternal.appId}constructor(e){this._privyInternal=e}}let s={path:"/api/v1/apps/:app_id/cross-app/connections",method:"GET"};var a=r(81365);class o{static parse(e){try{return new o(e)}catch(e){return null}}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(e=0){return Date.now()>=1e3*(this.expiration-e)}constructor(e){this.value=e,this._decoded=a.decodeJwt(e)}}class l{async updateOnCrossAppAuthentication(e,t){let r=t.access_token,n=l.providerAccessTokenStorageKey(e);await this._storage.put(n,r)}async getProviderAccessToken(e){let t=l.providerAccessTokenStorageKey(e),r=await this._storage.get(t);if("string"!=typeof r)return null;try{if(new o(r).isExpired())throw Error("JWT is expired");return r}catch{return await this._storage.del(t),null}}async getCrossAppConnections(){return await this._privyInternal.fetch(s,{params:{app_id:this._privyInternal.appId}})}constructor(e,t){this._privyInternal=e,this._storage=t}}l.providerAccessTokenStorageKey=e=>`privy:cross-app:${e}`;var c=r(44555);class d{async revoke(){await this._privyInternal.fetch(c.xh,{})}constructor(e){this._privyInternal=e}}var u=r(40488),h=r(70235),p=r(32688);let y=e=>!!e.id&&"privy-v2"===e.recovery_method;class _{async sign({message:e}){return await this.request({method:"sign",params:{message:new TextDecoder("utf8").decode(e)}})}async signTransaction({psbt:e}){return await this.request({method:"signTransaction",params:{psbt:e}})}async request(e){if(y(this._account))throw new p.wE({code:"unsupported_wallet_type",error:"Bitcoin wallet providers are only supported for on-device execution and this app uses TEE execution. Use the useSignRawHash hook from @privy-io/expo/extended-chains to sign over a hash with this wallet. Learn more at https://docs.privy.io/recipes/tee-wallet-migration-guide"});if(!await this._privyInternal.getAccessTokenInternal())throw new p.wE({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return this.handleIFrameRpc(e)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing access token. User must be authenticated.");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address}),(await this._proxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:this._account.chain_type})).response.data}catch(r){console.error(r);let t=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:t}),new p.wE({code:"embedded_wallet_request_error",error:t})}}toJSON(){return`PrivyEmbeddedBitcoinProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:n,entropyIdVerifier:i}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=n,this._entropyIdVerifier=i}}var f=r(28505),m=r(91413);async function g({context:e,chainType:t}){return{wallet:await (0,m.v)(e,{request:{chain_type:t,owner_id:void 0}})}}var w=r(6161);function v(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class b{enqueue(e,t){this.callbacks[e]=t}dequeue(e,t){let r=this.callbacks[t];if(!r)throw Error(`cannot dequeue ${e} event: no event found for id ${t}`);switch(delete this.callbacks[t],e){case"privy:iframe:ready":case"privy:wallets:create":case"privy:user-signer:sign":case"privy:wallets:add":case"privy:wallets:set-recovery":case"privy:wallets:connect":case"privy:wallets:recover":case"privy:wallets:rpc":case"privy:wallet:create":case"privy:wallet:connect":case"privy:wallet:recover":case"privy:wallet:rpc":case"privy:solana-wallet:create":case"privy:solana-wallet:create-additional":case"privy:solana-wallet:connect":case"privy:solana-wallet:recover":case"privy:solana-wallet:rpc":case"privy:delegated-actions:consent":case"privy:mfa:verify":case"privy:mfa:init-enrollment":case"privy:mfa:submit-enrollment":case"privy:mfa:unenroll":case"privy:mfa:clear":return r;default:throw Error(`invalid wallet event type ${e}`)}}constructor(){this.callbacks={}}}async function k(e,t,r,n,i=!1,s,a){let o=i,l=async s=>
1{if(o){s===+!i?n():r.current?.reject(new f.Pi("missing_or_invalid_mfa","MFA verification failed, retry."));let o=await new Promise((e,n)=>{t.current={resolve:e,reject:n},setTimeout(()=>{let e=new f.Pi("mfa_timeout","Timed out waiting for MFA code");r.current?.reject(e),n(e)},a)});return await e(o)}return await e()},c=null;for(let e=0;e<s;e++)try{c=await l(e),r.current?.resolve(void 0);break}catch(e){if("missing_or_invalid_mfa"!==e.type)throw r.current?.resolve(void 0),e;o=!0}if(null===c){let e=new f.Pi("mfa_verification_max_attempts_reached","Max MFA verification attempts reached");throw r.current?.reject(e),e}return c}let I=($=0,()=>"id-"+$++),E=(e,t)=>"bigint"==typeof t?t.toString():t,A=(e,{ms:t,msg:r})=>Promise.race([e,v(t??15e3).then(()=>Promise.reject(Error(r)))]),T=new b;class S{invokeWithMfa(e,t){return A(k(r=>A(this.waitForReady().then(()=>e(r)),{msg:t.timeoutMsg,ms:t.timeoutMs}),this.mfa.rootPromise,this.mfa.submitPromise,()=>this.mfa.emit("mfaRequired"),t.mfaAlwaysRequired??!1,4,3e5),{msg:"Operation reached timeout: MFA verification",ms:126e4})}reload(){return this.ready=!1,this._embeddedWalletMessagePoster.reload()}ping(e=15e3){return A(this.invoke("privy:iframe:ready",{}),{msg:"Ping reached timeout",ms:e})}create(e){return A(this.waitForReady().then(()=>this.invoke("privy:wallet:create",e)),{msg:"Operation reached timeout: create"})}rpc(e){return this.invokeWithMfa(t=>this.invoke("privy:wallet:rpc",{...t,...e}),{timeoutMsg:"Operation reached timeout: rpc"})}createSolana(e){return this.invokeWithMfa(t=>this.invoke("privy:solana-wallet:create",{...t,...e}),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}createAdditionalSolana(e){return A(this.waitForReady().then(()=>this.invoke("privy:solana-wallet:create-additional",e)),{msg:"Operation reached timeout: create"})}solanaRpc(e){return this.invokeWithMfa(t=>this.invoke("privy:solana-wallet:rpc",{...t,...e}),{timeoutMsg:"Operation reached timeout: solana-rpc"})}delegateWallets(e){return this.invokeWithMfa(t=>this.invoke("privy:delegated-actions:consent",{...t,...e}),{timeoutMsg:"Operation reached timeout: delegated-actions:consent"})}verifyMfa(e){return this.invokeWithMfa(t=>this.invoke("privy:mfa:verify",{...t,...e}),{timeoutMsg:"Operation reached timeout: mfa:verify",mfaAlwaysRequired:!0})}initEnrollMfa(e){return this.invokeWithMfa(t=>this.invoke("privy:mfa:init-enrollment",{...t,...e}),{timeoutMsg:"Operation reached timeout: mfa:init-enrollment"})}submitEnrollMfa(e){return this.invokeWithMfa(t=>this.invoke("privy:mfa:submit-enrollment",{...t,...e}),{timeoutMsg:"Operation reached timeout: mfa:submit-enrollment"})}unenrollMfa(e){return this.invokeWithMfa(t=>this.invoke("privy:mfa:unenroll",{...t,...e}),{timeoutMsg:"Operation reached timeout: mfa:unenroll",mfaAlwaysRequired:!0})}clearMfa(e){return A(this.waitForReady().then(()=>this.invoke("privy:mfa:clear",e)),{msg:"Operation reached timeout: mfa:clear"})}createWallet(e){return this.invokeWithMfa(t=>this.invoke("privy:wallets:create",{...t,...e}),{timeoutMsg:"Operation reached timeout: create",timeoutMs:6e4})}signWithUserSigner(e){return this.invokeWithMfa(t=>this.invoke("privy:user-signer:sign",{...t,...e}),{timeoutMsg:"Operation reached timeout: user-signer:sign"})}addWallet(e){return A(this.waitForReady().then(()=>this.invoke("privy:wallets:add",e)),{msg:"Operation reached timeout: wallets:add"})}setRecovery(e){return this.invokeWithMfa(t=>this.invoke("privy:wallets:set-recovery",{...t,...e}),{timeoutMsg:"Operation reached timeout: wallets:set-recovery",timeoutMs:6e4})}connect(e){return A(this.waitForReady().then(()=>this.invoke("privy:wallets:connect",e)),{msg:"Operation reached timeout: wallets:connect"})}recover(e){return this.invokeWithMfa(t=>this.invoke("privy:wallets:recover",{...t,...e}),{timeoutMsg:"Operation reached timeout: wallets:recover",timeoutMs:6e4})}rpcWallet(e){return this.invokeWithMfa(t=>this.invoke("privy:wallets:rpc",{...t,...e}),{timeoutMsg:"Operation reached timeout: wallets:rpc"})}handleEmbeddedWalletMessages(e){let{reject:t,resolve:r}=T.dequeue(e.event,e.id);return void 0!==e.error?t(new f.Pi(e.error.type,e.error.message)):r(e.data)}waitForReady(){return this.ready?Promise.resolve():new Promise(async(e,t)=>{for(;!this.ready;)this.invoke("privy:iframe:ready",{}).then(()=>{this.ready=!0,e()}).catch(t),await v(150)})}invoke(e,t){let r=`${e}${JSON.stringify(t,E)}`;if("privy:wallet:create"===e||"privy:solana-wallet:create"===e){let e=this.cache.get(r);if(e)return e}let n=new Promise((r,n)=>{let i=I();T.enqueue(i,{resolve:r,reject:n}),this._embeddedWalletMessagePoster.postMessage(JSON.stringify({id:i,event:e,data:t}),"*")}).finally(()=>{this.cache.delete(r)});return this.cache.set(r,n),n}constructor(e,t){this.ready=!1,this.cache=new Map,this._embeddedWalletMessagePoster=e,this.mfa=t}}var x=r(52212),C=r(9858),R=r(11957),P=r(51642).Buffer;let O=e=>/^0x[0-9a-fA-F]*$/.test(e),M=e=>P.from(e,"utf8"),L=e=>`0x${e.toString("hex")}`;var N=r(86976),D=r(51642).Buffer;function U(e){return"number"==typeof e||"bigint"==typeof e?`0x${BigInt(e).toString(16)}`:"string"==typeof e?O(e)?e:L(M(e)):void 0}async function W({context:e,account:t,rpcRequest:r}){switch(r.chainType){case"ethereum":return async function({context:e,account:t,rpcRequest:r}){var n;switch(r.method){case"personal_sign":{let[n]=r.params,i=await (0,N._)(e,e.signRequest,{chain_type:"ethereum",method:"personal_sign",wallet_id:t.id,params:n.startsWith("0x")?{message:n.slice(2),encoding:"hex"}:{message:n,encoding:"utf-8"}});if("personal_sign"!==i.method)throw Error("Unable to sign message");return{data:i.data.signature}}case"eth_signTransaction":{let[n]=r.params,i=await (0,N._)(e,e.signRequest,{chain_type:"ethereum",method:"eth_signTransaction",wallet_id:t.id,params:{transaction:{from:n.from,to:n.to??void 0,nonce:U(n.nonce),chain_id:U(n.chainId),data:function(e){if(void 0!==e)return"string"==typeof e?O(e)?e:L(M(e)):L(D.from(Uint8Array.from(e)))}(n.data),value:U(n.value),type:n.type,gas_limit:U(n.gasLimit),gas_price:U(n.gasPrice),max_fee_per_gas:U(n.maxFeePerGas),max_priority_fee_per_gas:U(n.maxPriorityFeePerGas)}}});if("eth_signTransaction"!==i.method)throw Error("Unable to sign transaction");return{data:i.data.signed_transaction}}case"eth_signTypedData_v4":{let[,i]=r.params,s=await (0,N._)(e,e.signRequest,{chain_type:"ethereum",method:r.method,wallet_id:t.id,params:{typed_data:("string"==typeof(n=i)&&(n=JSON.parse(n)),{types:n.types,primary_type:String(n.primaryType),domain:n.domain,message:n.message})}});if("eth_signTypedData_v4"!==s.method)throw Error("Unable to sign typed data");return{data:s.data.signature}}case"eth_sign":{let[,n]=r.params,i=await (0,N._)(e,e.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:t.id,params:{hash:O(n)?n:L(M(n))}});if("secp256k1_sign"!==i.method)throw Error("Unable to sign message");return{data:i.data.signature}}case"secp256k1_sign":{let[n]=r.params,i=await (0,N._)(e,e.signRequest,{chain_type:"ethereum",method:"secp256k1_sign",wallet_id:t.id,params:{hash:O(n)?n:L(M(n))}});if("secp256k1_sign"!==i.method)throw Error("Unable to sign message");return{data:i.data.signature}}case"csw_signUserOperation":case"eth_sendTransaction":case"eth_populateTransactionRequest":throw Error(`This wallet does not support the method: ${r.method}`)}}({context:e,account:t,rpcRequest:r.request});case"solana":return async function({context:e,account:t,rpcRequest:r}){if("signMessage"===r.method){let{message:n}=r.params,i=await (0,N._)(e,e.signRequest,{chain_type:"solana",method:"signMessage",wallet_id:t.id,params:{message:n,encoding:"base64"}});if("signMessage"!==i.method)throw Error("Unable to sign message");return{data:i.data.signature}}}({context:e,account:t,rpcRequest:r.request})}}r(52180);let j=new Set(["eth_sign","personal_sign","eth_signTypedData_v4","csw_signUserOperation","secp256k1_sign"]);class F extends x.A{async request(e){if(j.has(e.method))return this.handleIFrameRpc(e);switch(e.method){case"eth_accounts":case"eth_requestAccounts":return this._account.address?[this._account.address]:[];case"eth_chainId":return`0x${this._chainId.toString(16)}`;case"wallet_switchEthereumChain":return this.handleSwitchEthereumChain(e);case"eth_estimateGas":return this.handleEstimateGas(e);case"eth_signTransaction":{let t=e.params?.[0];return this.handleSignTransaction(t)}case"eth_sendTransaction":{let t=e.params?.[0];return this.handleSendTransaction(t)}case"eth_populateTransactionRequest":{let t=e.params?.[0];return this.handlePopulateTransaction(t)}default:return this.handleJsonRpc(e)}}ensureChainId(e){let t={chainId:this._chainId,...e};return this.internalSwitchEthereumChain(t.chainId),t}internalSwitchEthereumChain(e){e&&Number(e)!==this._chainId&&(this._chainId=Number(e),this._client=(0,w.Bm)(this._chainId,this._chains,{rpcUrls:[]},{appId:this._privyInternal.appId}
1),this.emit("chainChanged",e))}async handlePopulateTransaction(e){let t=(0,R._)(this.ensureChainId(e)),{type:r,...n}=await this._client.prepareTransactionRequest(t);return{...n,type:R.k[r]}}async handleSignTransaction(e){let t={...e};for(let e of Object.keys(t)){let r=t[e];r&&"bigint"==typeof r&&(t[e]=(0,C.nj)(r))}return await this.handleIFrameRpc({method:"eth_signTransaction",params:[t]})}async handleSendTransaction(e){let t=await this.handlePopulateTransaction(e),r=await this.handleSignTransaction(t);return await this.handleJsonRpc({method:"eth_sendRawTransaction",params:[r]})}async handleEstimateGas(e){if(!e.params||!Array.isArray(e.params))throw Error("Invalid params for eth_estimateGas");let t=e.params?.[0],r=(0,R._)(this.ensureChainId(t));return await this._client.estimateGas(r)}handleSwitchEthereumChain(e){let t;if(!e.params||!Array.isArray(e.params))throw new f.sj(`Invalid params for ${e.method}`,4200);if("string"==typeof e.params[0])t=e.params[0];else{if(!("chainId"in e.params[0])||"string"!=typeof e.params[0].chainId)throw new f.sj(`Invalid params for ${e.method}`,4200);t=e.params[0].chainId}this.internalSwitchEthereumChain(t)}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address});let r=this._account;if(y(r)){let{data:n}=await W({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._walletProxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"ethereum",request:e}});return n}try{await this._walletProxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t})}catch(r){let e=(0,f.pO)(r);if(e&&"privy"===this._account.recovery_method)await this._walletProxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:t});else{if(!e||!this._onNeedsRecovery)throw r;{let e;await new Promise(async(t,r)=>{e=setTimeout(()=>r(new p.wE({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"})),12e4),await this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)})}).finally(()=>clearTimeout(e))}}}return(await this._walletProxy.rpcWallet({accessToken:t,request:e,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,hdWalletIndex:this._account.wallet_index,chainType:"ethereum"})).response.data}catch(r){console.error(r);let t=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:t}),new p.wE({code:"embedded_wallet_request_error",error:t})}}async handleJsonRpc(e){return this._client.request(e)}toJSON(){return`PrivyEIP1193Provider { address: '${this._account.address}', chainId: ${this._chainId}, request: [Function] }`}constructor({walletProxy:e,privyInternal:t,account:r,entropyId:n,entropyIdVerifier:i,chains:s,onNeedsRecovery:a,chainId:o=s[0].id,appApi:l}){super(),this._walletProxy=e,this._privyInternal=t,this._account=r,this._entropyId=n,this._entropyIdVerifier=i,this._chainId=o,this._chains=s,this._onNeedsRecovery=a,this._client=(0,w.Bm)(o,s,{rpcUrls:[]},{appId:l.appId}),this._appApi=l}}function q(e){return"version"in e}function B(e,t){let r=(q(e)?e.message:e.compileMessage()).staticAccountKeys.find(e=>e.toBase58()===t);if(!r)throw Error(`Transaction does not contain public key ${t}`);return r}var z=r(51642).Buffer;class H{async request(e){if(!await this._privyInternal.getAccessTokenInternal())throw new p.wE({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});switch(e.method){case"signAndSendTransaction":return await this.handleSignAndSendTransaction(e);case"signTransaction":return await this.handleSignTransaction(e);default:return await this.handleIFrameRpc(e)}}get _publicKey(){return this._account.address}
1async connectAndRecover(e){if("privy-v2"!==this._account.recovery_method)try{await this._proxy.connect({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:e})}catch(r){let t=(0,f.pO)(r);if(t&&"privy"===this._account.recovery_method)await this._proxy.recover({entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier,accessToken:e});else{if(!t||!this._onNeedsRecovery)throw r;{let e;await new Promise(async(t,r)=>{e=setTimeout(()=>r(new p.wE({code:"embedded_wallet_recovery_error",error:"User-owned recovery timed out"})),12e4),await this._onNeedsRecovery?.({recoveryMethod:this._account.recovery_method,onRecovered:()=>t(!0)})}).finally(()=>clearTimeout(e))}}}}async signMessageRpc(e,t){let r=this._account;if(!y(r))return(await this._proxy.rpcWallet({accessToken:t,request:e,chainType:"solana",hdWalletIndex:this._account.wallet_index,entropyId:this._entropyId,entropyIdVerifier:this._entropyIdVerifier})).response.data;{let{data:n}=await W({context:{app:this._app,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e),signRequest:({message:e})=>this._proxy.signWithUserSigner({accessToken:t,message:e})},account:r,rpcRequest:{chainType:"solana",request:e}});return{signature:n}}}async handleIFrameRpc(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address}),await this.connectAndRecover(t),await this.signMessageRpc(e,t)}catch(r){console.error(r);let t=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:t}),new p.wE({code:"embedded_wallet_request_error",error:t})}}async handleSignAndSendTransaction(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address}),await this.connectAndRecover(t);let{transaction:r,connection:n,options:i}=e.params,s=B(r,this._account.address),a=q(r)?z.from(r.message.serialize()):r.serializeMessage(),{signature:o}=await this.signMessageRpc({method:"signMessage",params:{message:a.toString("base64")}},t);return r.addSignature(s,z.from(o,"base64")),{signature:await n.sendRawTransaction(r.serialize(),i)}}catch(r){console.error(r);let t=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.address,error:t}),new p.wE({code:"embedded_wallet_request_error",error:t})}}async handleSignTransaction(e){try{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw Error("Missing privy token. User must be logged in");this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_started",{method:e.method,address:this._account.address}),await this.connectAndRecover(t);let{transaction:r}=e.params,n=B(r,this._account.address),i=q(r)?z.from(r.message.serialize()):r.serializeMessage(),{signature:s}=await this.signMessageRpc({method:"signMessage",params:{message:i.toString("base64")}},t);return r.addSignature(n,z.from(s,"base64")),{signedTransaction:r}}catch(r){console.error(r);let t=r instanceof Error?r.message:"Unable to make wallet request";throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_rpc_failed",{method:e.method,address:this._account.wallet_index,error:t}),new p.wE({code:"embedded_wallet_request_error",error:t})}}toJSON(){return`PrivyEmbeddedSolanaProvider { address: '${this._account.address}', request: [Function] }`}constructor({proxy:e,privyInternal:t,account:r,entropyId:n,entropyIdVerifier:i,onNeedsRecovery:s,app:a}){this._proxy=e,this._privyInternal=t,this._account=r,this._entropyId=n,this._entropyIdVerifier=i,this._onNeedsRecovery=s,this._app=a}}
1class K{setMessagePoster(e){this._proxy=new S(e,this._mfaPromises),this._mfa.setProxy(this._proxy)}async signWithUserSigner(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw new p.wE({error:"User must be logged in to sign a message with the user signer",code:"user_signer_sign_error"});let{signature:r}=await this._proxy.signWithUserSigner({accessToken:t,message:e.message});return{signature:r}}async add(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await g({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:e.chainType});else{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw new p.wE({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.addWallet({accessToken:t,...e})}let{user:t}=await this._privyInternal.refreshSession();return{user:t}}async getBitcoinProvider({wallet:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:n,recoveryAccessToken:i,recoverySecretOverride:s}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return y(e)||await this._load({entropyId:t,entropyIdVerifier:r,wallet:e,recoveryPassword:n,recoveryAccessToken:i,recoverySecretOverride:s}),new _({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:t,entropyIdVerifier:r})}async create({password:e,recoveryMethod:t,recoveryToken:r,recoveryKey:n,recoverySecretOverride:i,iCloudRecordNameOverride:s,solanaAccount:a,skipCallbacks:o}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode){if(t&&!t.startsWith("privy"))throw new p.wE({error:"User-controlled server wallets do not support custom recovery methods",code:"embedded_wallet_creation_error"});await g({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"ethereum"})}else{let o;if(o=t||(e?"user-passcode":"privy"),e&&"string"!=typeof e)throw Error("Invalid recovery password, must be a string");if("privy"===o&&this._privyInternal.config?.embedded_wallet_config.require_user_password_on_create)throw Error("Password not provided yet is required by App configuration");let l=await this._privyInternal.getAccessTokenInternal();if(!l)throw Error("User must be logged in to create an embedded wallet");let{address:c}=await this._proxy.create({accessToken:l,recoveryMethod:o,recoveryKey:n,recoveryPassword:e,recoveryAccessToken:r,recoverySecretOverride:i,iCloudRecordNameOverride:s,solanaAddress:a?.address});if(!c)throw Error("Failed to create wallet")}return await this._privyInternal.refreshSession(o)}async createSolana(e){if(!this._proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});if("user-controlled-server-wallets-only"===this._privyInternal.config?.embedded_wallet_config.mode)await g({context:{app:this._appApi,fetchPrivyRoute:(...e)=>this._privyInternal.fetch(...e),getCompiledPath:(...e)=>this._privyInternal.getPath(...e)},chainType:"solana"});else{let t=await this._privyInternal.getAccessTokenInternal();if(!t)throw new p.wE({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});e?.ethereumAccount&&await this.getProvider(e.ethereumAccount);let{publicKey:r}=await this._proxy.createSolana({accessToken:t,ethereumAddress:e?.ethereumAccount?.address});if(!r)throw new p.wE({error:"Failed to create wallet",code:"embedded_wallet_creation_error"})}return await this._privyInternal.refreshSession()}async delegateWallets({delegatedWallets:e,rootWallet:t}){if(!this._proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_creation_error"});let r=await this._privyInternal.getAccessTokenInternal();if(!r)throw new p.wE({error:"User must be logged in to create an embedded wallet",code:"embedded_wallet_creation_error"});await this._proxy.delegateWallets({accessToken:r,delegatedWallets:e,rootWallet:t})}async getProvider(e,t,r,n,i){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");
1return y(e)||await this._load({wallet:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",recoveryPassword:t,recoveryKey:i,recoveryAccessToken:r,recoverySecretOverride:n}),new F({account:e,entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}async getEthereumProvider({wallet:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:n,recoveryAccessToken:i,recoverySecretOverride:s,recoveryKey:a,onNeedsRecovery:o}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(!await this._privyInternal.getAccessTokenInternal())throw Error("User must be logged in to create an embedded wallet");return y(e)||(!o||n||i||s||a)&&await this._load({entropyId:t,entropyIdVerifier:r,wallet:e,recoveryPassword:n,recoveryAccessToken:i,recoverySecretOverride:s,recoveryKey:a}),new F({account:e,entropyId:t,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,onNeedsRecovery:o,appApi:this._appApi})}async getSolanaProvider(e,t,r,n,i,s,a){if(!this._proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return y(e)||(!a||n||i||s)&&await this._load({wallet:e,entropyId:t,entropyIdVerifier:r,recoveryPassword:n,recoveryAccessToken:i,recoverySecretOverride:s}),new H({account:e,privyInternal:this._privyInternal,proxy:this._proxy,entropyId:t,entropyIdVerifier:r,onNeedsRecovery:a,app:this._appApi})}async setRecovery(e){let{wallet:t,...r}=e;if(!this._proxy)throw Error("Embedded wallet proxy not initialized");if(y(t))throw new p.wE({error:"This wallet does not support setting recovery methods",code:"unsupported_recovery_method"});(0,w.Di)({currentRecoveryMethod:t.recovery_method,upgradeToRecoveryMethod:"icloud-native"===r.recoveryMethod?"icloud":r.recoveryMethod}),await this._load("solana"===t.chain_type?{wallet:t,entropyId:t.address,entropyIdVerifier:"solana-address-ver
1ifier"}:{wallet:t,entropyId:t.address,entropyIdVerifier:"ethereum-address-verifier"});let n=await this._privyInternal.getAccessTokenInternal();if(!n)throw Error("User must be logged in to interact with embedded wallets");let i=t.recovery_method;this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_started",{address:t.address,target_recovery_method:r.recoveryMethod,existing_recovery_method:i});try{let e;if("user-passcode"===r.recoveryMethod)e={recoveryMethod:"user-passcode",recoveryPassword:r.password};else if("google-drive"===r.recoveryMethod)e={recoveryMethod:"google-drive",recoveryAccessToken:r.recoveryAccessToken};else if("icloud"===r.recoveryMethod)e={recoveryMethod:"icloud",recoveryAccessToken:r.recoveryAccessToken};else if("icloud-native"===r.recoveryMethod)e={recoveryMethod:"icloud-native",iCloudRecordNameOverride:r.iCloudRecordNameOverride,recoverySecretOverride:r.recoverySecretOverride};else if("recovery-encryption-key"===r.recoveryMethod)e={recoveryMethod:"recovery-encryption-key",recoveryKey:r.recoveryKey};else{if("privy"!==r.recoveryMethod)throw Error(`Unknown recovery method: ${r.recoveryMethod}`);e={recoveryMethod:"privy"}}await this._proxy.setRecovery({accessToken:n,entropyId:t.address,entropyIdVerifier:"solana"===t.chain_type?"solana-address-ver
1ifier":"ethereum-address-verifier",...e}),this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_completed",{address:t.address,target_recovery_method:r.recoveryMethod,existing_recovery_method:i});let{user:s}=await this._privyInternal.refreshSession();return{user:s,provider:"ethereum"!==t.chain_type?null:new F({account:t,entropyId:t.address,entropyIdVerifier:"ethereum-address-verifier",privyInternal:this._privyInternal,chains:this._chains,walletProxy:this._proxy,appApi:this._appApi})}}catch(e){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_set_recovery_failed",{address:t.address,recovery_method:t.recovery_method,error:e instanceof Error?e.message:"Unable to recover wallet"}),e}}getURL(){let e=new URL(`${this._privyInternal.baseUrl}/apps/${this._privyInternal.appId}/embedded-wallets`);return this._privyInternal.caid&&e.searchParams.append("caid",this._privyInternal.caid),this._privyInternal.appClientId&&e.searchParams.append("client_id",this._privyInternal.appClientId),e.href}get chains(){return this._chains}onMessage(e){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return this._proxy.handleEmbeddedWalletMessages(e)}reload(){this._proxy?this._proxy.reload():console.warn("Attempted to reload proxy before initialized")}async ping(e){try{if(!this._proxy)throw Error("Embedded wallet proxy not initialized");return await this._proxy.ping(e),!0}catch(e){return console.error(e),!1}}async _load({entropyId:e,entropyIdVerifier:t,wallet:r,recoveryPassword:n,recoveryKey:i,recoveryAccessToken:s,recoverySecretOverride:a}){if(!this._proxy)throw Error("Embedded wallet proxy not initialized");let o=await this._privyInternal.getAccessTokenInternal();if(!o)throw Error("User must be logged in to interact with embedded wallets");try{return await this._proxy.connect({accessToken:o,entropyId:e,entropyIdVerifier:t}),e}catch(l){if((0,f.pO)(l))try{if("privy"===r.recovery_method){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:r.address,recovery_method:r.recovery_method});let n=await this._proxy.recover({accessToken:o,entropyId:e,entropyIdVerifier:t});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:r.address,recovery_method:r.recovery_method}),n.entropyId}if("user-passcode"===r.recovery_method&&n){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:r.address,recovery_method:r.recovery_method});let i=await this._proxy.recover({accessToken:o,recoveryPassword:n,entropyId:e,entropyIdVerifier:t});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:r.address,recovery_method:r.recovery_method}),i.entropyId}if(["google-drive","icloud"].includes(r.recovery_method)&&s){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:r.address,recovery_method:r.recovery_method});let n=await this._proxy.recover({accessToken:o,recoveryAccessToken:s,entropyId:e,entropyIdVerifier:t});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:r.address,recovery_method:r.recovery_method}),n.entropyId}if("icloud"===r.recovery_method&&a){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:r.address,recovery_method:"icloud-native"});let n=await this._proxy.recover({accessToken:o,recoverySecretOverride:a,entropyId:e,entropyIdVerifier:t});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:r.address,recovery_method:"icloud-native"}),n.entropyId}if("recovery-encryption-key"===r.recovery_method&&i){this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_started",{address:r.address,recovery_method:r.recovery_method});let n=await this._proxy.recover({accessToken:o,recoveryKey:i,entropyId:e,entropyIdVerifier:t});return this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_completed",{address:r.address,recovery_method:r.recovery_method}),n.entropyId}}catch(t){throw this._privyInternal.createAnalyticsEvent("embedded_wallet_sdk_recovery_failed",{address:r.address,recovery_method:r.re
1covery_method,error:t instanceof Error?t.message:`Unable to recover wallet: ${e}`}),t}throw l}}constructor(e,t,r,n,i,s){if(this._chains=Array.from(u.m),this._privyInternal=e,t&&(this._proxy=new S(t,i),n.setProxy(this._proxy)),r){let e=(0,h._)(r);this._chains=e}this._mfa=n,this._mfaPromises=i,this._appApi=s}}class V extends x.A{constructor(){super(),this.rootPromise={current:null},this.submitPromise={current:null}}}var $,G,Y=r(86023),J=r(29911),Z=((G={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",G.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",G.MISSING_OR_INVALID_PRIVY_CLIENT_ID="missing_or_invalid_privy_client_id",G.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",G.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",G.MISSING_MFA_ENROLLMENT="missing_mfa_enrollment",G.MISSING_OR_INVALID_MFA="missing_or_invalid_mfa",G.EXPIRED_OR_INVALID_MFA_TOKEN="expired_or_invalid_mfa_token",G.INVALID_DATA="invalid_data",G.INVALID_CREDENTIALS="invalid_credentials",G.INVALID_CAPTCHA="invalid_captcha",G.LINKED_TO_ANOTHER_USER="linked_to_another_user",G.ALLOWLIST_REJECTED="allowlist_rejected",G.CANNOT_UNLINK_EMBEDDED_WALLET="cannot_unlink_embedded_wallet",G.CANNOT_UNLINK_SOLE_ACCOUNT="cannot_unlink_sole_account",G.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",G.LINKED_ACCOUNT_NOT_FOUND="linked_account_not_found",G.TOO_MANY_REQUESTS="too_many_requests",G.RESOURCE_CONFLICT="resource_conflict",G.INVALID_ORIGIN="invalid_origin",G.MISSING_ORIGIN="missing_origin",G.INVALID_NATIVE_APP_ID="invalid_native_app_id",G.TOKEN_ALREADY_USED="token_already_used",G.ALREADY_LOGGED_OUT="already_logged_out",G.NOT_SUPPORTED="not_supported",G.USER_UNSUBSCRIBED="user_unsubscribed",G.MAX_APPS_REACHED="max_apps_reached",G.USER_LIMIT_REACHED="max_accounts_reached",G.DEVICE_REVOKED="device_revoked",G.WALLET_PASSWORD_EXISTS="wallet_password_exists",G.OAUTH_STATE_MISMATCH="oauth_state_mismatch",G.MAX_DENYLIST_ENTRIES_REACHED="max_denylist_entries_reached",G.MAX_TEST_ACCOUNTS_REACHED="max_test_accounts_reached",G.DISALLOWED_LOGIN_METHOD="disallowed_login_method",G.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",G.DISALLOWED_RECOVERY_METHOD="disallowed_recovery_method",G.LEGACY_DASHBOARD_LOGIN_CONFIGURATION="legacy_dashboard_login_configuration",G.CANNOT_SET_PASSWORD="cannot_set_password",G.INVALID_PKCE_PARAMETERS="invalid_pkce_parameters",G.INVALID_APP_URL_SCHEME_CONFIGURATION="invalid_app_url_scheme_configuration",G.CROSS_APP_CONNECTION_NOT_ALLOWED="cross_app_connection_not_allowed",G.USER_DOES_NOT_EXIST="user_does_not_exist",G.ALREADY_EXISTS="resource_already_exists",G.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",G.USER_HAS_NOT_DELEGATED_WALLET="user_has_not_delegated_wallet",G.FEATURE_NOT_ENABLED="feature_not_enabled",G.INSUFFICIENT_FUNDS="insufficient_funds",G.TRANSACTION_BROADCAST_FAILURE="transaction_broadcast_failure",G.INVALID_POLICY_FORMAT="invalid_policy_format",G.POLICY_VIOLATION="policy_violation",G.AUTHORIZATION_KEY_HAS_ASSOCIATED_WALLETS="authorization_key_has_associated_wallets",G.INVALID_REQUEST="invalid_request",G.SIGNUP_DISABLED="signup_disabled",G);let X={path:"/api/v1/apps/:app_id",method:"GET"},Q={path:"/api/v1/analytics_events",method:"POST"},ee={path:"/api/v1/sessions",method:"POST"},et={path:"/api/v1/sessions/logout",method:"POST"};var er=r(46887);let en=Promise.allSettled.bind(Promise)??(e=>Promise.all(e.map(e=>e.then(e=>({status:"fulfilled",value:e})).catch(e=>({status:"rejected",reason:e}))))),ei="privy:token",es="privy-token",ea="privy:pat",eo="privy:refresh_token",el="privy-refresh-token",ec="privy:id-token",ed="privy-id-token",eu="privy-session";class eh extends x.A{set isUsingServerCookies(e){this._isUsingServerCookies=e}async getCustomerAccessToken(){let e=await this._storage.get(ei);try{return"string"==typeof e?new o(e).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getPrivyAccessToken(){let e=await this._storage.get(ea);try{return"string"==typeof e?new o(e).value:null}catch(e){return console.error(e),await this.destroyLocalState({reason:"getToken_error"}),null}}async getRefreshToken(){let e=await this._storage.get(eo);return"string"==typeof e?e:null}async getIdentityToken(){let e=await this._storage.get(ec);return"string"==typeof e?e:null}get mightHaveServerCookies(){try{let e=er.A.get(eu);return void 0!==e&&e.length>0}catch(e){console.error(e)}return!1}hasRefreshCredentials(e,t){return this.mightHaveServerCookies||"string"==typeof e&&"string"==typeof t}tokenIsActive(e){if(!e)return!1;
1let t=o.parse(e);return null!==t&&!t.isExpired(30)}async destroyLocalState(e){await en([this._storage.del(ei),this._storage.del(eo),this._storage.del(ec),this._storage.del(this.GUEST_CREDENTIAL_STORAGE_KEY)]),er.A.remove(es),er.A.remove(el),er.A.remove(ed),er.A.remove(eu),e?.reason&&this.emit("storage_cleared",{reason:e.reason})}async storeCustomerAccessToken(e){if("string"==typeof e){let t=await this._storage.get(ei);if(await this._storage.put(ei,e),!this._isUsingServerCookies){let t=o.parse(e)?.expiration;er.A.set(es,e,{sameSite:"Strict",secure:!0,expires:t?new Date(1e3*t):void 0})}t!==e&&this.emit("token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(ei);await this._storage.del(ei),er.A.remove(es),null!==e&&this.emit("token_cleared",{reason:"set_with_non_string_value"})}}async storePrivyAccessToken(e){"string"==typeof e?await this._storage.put(ea,e):await this._storage.del(ea)}async storeRefreshToken(e){"string"==typeof e?(await this._storage.put(eo,e),this._isUsingServerCookies||(er.A.set(eu,"t",{sameSite:"Strict",secure:!0,expires:30}),er.A.set(el,e,{sameSite:"Strict",secure:!0,expires:30})),this.emit("refresh_token_stored",{cookiesEnabled:this._isUsingServerCookies})):(await this._storage.del(eo),er.A.remove(el),er.A.remove(eu),this.emit("refresh_token_cleared",{reason:"set_with_non_string_value"}))}async updateWithTokensResponse(e){let t=(await en([this.storeCustomerAccessToken(e.token),this.storePrivyAccessToken(e.privy_access_token),this.storeRefreshToken(e.refresh_token),this.storeIdentityToken(e.identity_token),this.processOAuthTokens(e.oauth_tokens)])).filter(e=>"rejected"===e.status);t.length>0&&this.emit("error_storing_tokens",t.map(e=>String(e.reason)).join(", "))}async processOAuthTokens(e){e&&this.emit("oauth_tokens_granted",e)}async storeIdentityToken(e){if("string"==typeof e){let t=await this._storage.get(ec);if(await this._storage.put(ec,e),!this._isUsingServerCookies){let t=o.parse(e)?.expiration;er.A.set(ed,e,{sameSite:"Strict",secure:!0,expires:t?new Date(1e3*t):void 0})}t!==e&&this.emit("identity_token_stored",{cookiesEnabled:this._isUsingServerCookies})}else{let e=await this._storage.get(ec);await this._storage.del(ec),er.A.remove(ed),null!==e&&this.emit("identity_token_cleared",{reason:"set_with_non_string_value"})}}async getOrCreateGuestCredential(){let e=this._storage.get(this.GUEST_CREDENTIAL_STORAGE_KEY);if(e&&"string"==typeof e)return e;let t=a.base64url.encode(crypto.getRandomValues(new Uint8Array(32)));return await this._storage.put(this.GUEST_CREDENTIAL_STORAGE_KEY,t),t}constructor(e){super(),this._isUsingServerCookies=!1,this._storage=e.storage,this.GUEST_CREDENTIAL_STORAGE_KEY=`privy:guest:${e.appId}`}}eh.events=["storage_cleared","token_cleared","refresh_token_cleared","identity_token_cleared","token_stored","refresh_token_stored","identity_token_stored","oauth_tokens_granted","error_storing_tokens"];let ep=()=>{},ey={NONE:-1/0,ERROR:1,WARN:2,INFO:3,DEBUG:1/0},e_="privy:caid";class ef{setCallbacks(e){this.callbacks={...this.callbacks,...e}}get isReady(){return!!this._config}get config(){return this._config}get caid(){return this._analyticsId}async _initialize(){if(this.isReady)this.callbacks?.setIsReady?.(!0);else{if(!await this.isStorageAccessible())throw new p.wE({code:"storage_error",error:"Unable to access storage"});this._config=await this.getAppConfig(),this._config?.custom_api_url&&(this.baseUrl=this._config.custom_api_url,this.session.isUsingServerCookies=!0),this.callbacks?.setIsReady?.(!0),this._sdkVersion.startsWith("react-auth:")||this.createAnalyticsEvent("sdk_initialize",{})}}getPath(e,{params:t,query:r}){let n;return`${this.baseUrl}${n=e.path,t?Object.entries(t).reduce((e,[t,r])=>e.replace(`:${t}`,`${r}`),n):n}${function(e){let t=new URLSearchParams;for(let r in e)null!=e[r]&&t.append(r,String(e[r]));return Array.from(t).length?"?"+t.toString():""}(r)}`}async fetch(e,{body:t,params:r,query:n,headers:i,onRequest:s=this._beforeRequest.bind(this)}){let a=new Request(this.getPath(e,{params:r,query:n}),{method:e.method,body:JSON.stringify(t),headers:i}),o=await s(a),l=await this._fetch(a,o),c=await l.json();if(l.status>299)throw new p.VQ(c);return c}async _beforeRequestWithoutInitialize(e){let t,r=await this.session.getPrivyAccessToken()??await this.session.getCustomerAccessToken(),n=new Headers(e.headers);n.set("privy-app-id",this.appId),this.appClientId&&n.set("privy-client-id",this.appClientId),n.set("privy-client",this._sdkVersion),r&&n.set("Authorization",`Bearer ${r}`),n.set("Content-Type","application/json"),n.set("Accept","application/json");let i=await this._getOrGenerateClientAnalyticsId();return i&&n.set("privy-ca-id",i),this.nativeAppIdentifier&&n.set("x-native-app-identifier",this.nativeAppIdentifier),{signal:(t=new AbortController,setTimeout(()=>t.abort(),2e4),t.signal),headers:n,credentials:"include"}}async beforeRequestWithoutRefresh(e){return await this._initialize(),this._beforeRequestWithoutInitialize(e)}async _beforeRequest(e){return await this._initialize(),await this.getAccessTokenInternal(),this.beforeRequestWithoutRefresh(e)}async getAppConfig(){return await this.fetch(X,{params:{app_id:this.appId},onRequest:this._beforeRequestWithoutInitialize.bind(this)})}async _getOrGenerateClientAnalyticsId(){if(this._analyticsId)return this._analyticsId;try{let e=await this._storage.get(e_);if("string"==typeof e&&e.length>0)return this._analyticsId=e,e}catch(e){this.logger.error("Unable to load clientId",e)}try{this._analyticsId=(0,J.A)()}catch(e){this.logger.error("Unable to generate uuidv4",e)}if(!this._analyticsId)return null;try{await this._storage.put(e_,this._analyticsId)}catch(e){this.logger.error(`Unable to store clientId: ${this._analyticsId}`,e)}return this._analyticsId}async destroyClientAnalyticsId(){try{return await this._storage.del(e_)}catch(e){this.logger.error("Unable to delete clientId",e)}}async createAnalyticsEvent(e,t){try{await this.fetch(Q,{body:{event_name:e,client_id:await this._getOrGenerateClientAnalyticsId(),payload:t},onRequest:this.beforeRequestWithoutRefresh.bind(this)})}catch(e){}}async refreshSession(e=!1){if(!await this.isStorageAccessible())throw new p.wE({code:"storage_error",error:"Unable to access storage"});let t=await this.session.getRefreshToken()??void 0,r=t??"key",n=this._cache.get(r);if(n)return this.logger.debug("[privy:refresh] found in-flight session refresh request, deduping"),await n;let i=this._refreshSession(t,e);this._cache.set(r,i);try{return await i}finally{this._cache.delete(r)}}async _refreshSession(e,t){let r=await this.session.getCustomerAccessToken();if(!this.session.hasRefreshCredentials(r,e??null))throw this.logger.debug("[privy:refresh] missing tokens, skipping request"),await this._initialize(),new p.VQ({code:Z.MISSING_OR_INVALID_TOKEN,error:"No tokens found in storage"});try{this.logger.debug(`[privy:refresh] fetching: ${ee.path}`);let r=await this.fetch(ee,{body:{refresh_token:e},onRequest:this.beforeRequestWithoutRefresh.bind(this)}),n=r.session_update_action;return this.logger.debug(`[privy:refresh] response: ${n}`),t||this.callbacks?.setUser?.(r.user),"set"===n&&(await this.session.updateWithTokensResponse(r),this.logger.debug("[privy:refresh] tokens stored")),"clear"===n&&(await this.session.destroyLocalState(),this.logger.debug("[privy:refresh] tokens cleared"),t||this.callbacks?.setUser?.(null)),"ignore"===n&&r.token&&(await this.session.storeCustomerAccessToken(r.token),await this.session.storePrivyAccessToken(r.privy_access_token),this.logger.debug("[privy:refresh] access token stored"),r.identity_token&&(this.logger.debug("[privy:refresh] identity token stored"),await this.session.storeIdentityToken(r.identity_token))),this.logger.debug("[privy:refresh] returning response"),r}catch(e){throw this.logger.debug(`[privy:refresh] error: ${e.message??"unknown error"}`),e instanceof p.VQ&&e.code===Z.MISSING_OR_INVALID_TOKEN&&(await this.session.destroyLocalState(),t||this.callbacks?.setUser?.(null)),e}}
1async getAccessToken(){let[e,t]=await Promise.all([this.session.getCustomerAccessToken(),this.session.getRefreshToken()]);if(!this.session.tokenIsActive(e)&&this.session.hasRefreshCredentials(e,t)){let t=await this.refreshSession(),r=await this.session.getCustomerAccessToken();return t.token||this.logger.debug("[privy:getAccessToken] expected token received null"),t.token===e&&this.logger.debug("[privy:getAccessToken] expected new token in response received existing"),r===e&&this.logger.debug("[privy:getAccessToken] expected new token in storage received existing"),t.token??r}return e}async getAccessTokenInternal(){let e=await this.getAccessToken();return await this.session.getPrivyAccessToken()??e}async getIdentityToken(){return await this.session.getIdentityToken()}async isStorageAccessible(){try{let e=`privy:__storage__test-${(0,J.A)()}`,t="blobby";await this._storage.put(e,t);let r=await this._storage.get(e);return await this._storage.del(e),r===t}catch(e){return this.logger.error(e),!1}}constructor(e){this._sdkVersion="js-sdk-core:0.56.3",this._cache=new Map,this.logger=(({level:e}={level:"ERROR"})=>({get level(){return e},error:ey[e]>=ey.ERROR?console.error:ep,warn:ey[e]>=ey.WARN?console.warn:ep,info:ey[e]>=ey.INFO?console.info:ep,debug:ey[e]>=ey.DEBUG?console.debug:ep}))({level:e.logLevel??"ERROR"}),this._storage=e.storage,this._analyticsId=null,this._getOrGenerateClientAnalyticsId(),this.baseUrl=e.baseUrl??"https://auth.privy.io",this.appId=e.appId,this.appClientId=e.appClientId,this._sdkVersion=e.sdkVersion??this._sdkVersion,this.callbacks=e.callbacks,this.nativeAppIdentifier=e.nativeAppIdentifier,this.session=new eh({storage:this._storage,isUsingServerCookies:!1,appId:e.appId}),this._fetch=Y(globalThis.fetch,{retries:3,retryDelay:e=>3**e*500,retryOn:[408,409,425,500,502,503,504]}),this.session.on("error_storing_tokens",e=>{this.createAnalyticsEvent("error_updating_tokens_in_storage",{reason:e})})}}let em={path:"/api/v1/users/me/accept_terms",method:"POST"};class eg{async get(){let{user:e}=await this._privyInternal.refreshSession();return{user:e}}async acceptTerms(){return{user:await this._privyInternal.fetch(em,{})}}constructor(e){this._privyInternal=e}}let ew={path:"/api/v1/custom_jwt_account/authenticate",method:"POST"},ev=e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type,eb=e=>e?e.linked_accounts.filter(ev).filter(e=>"ethereum"===e.chain_type).sort((e,t)=>e.wallet_index-t.wallet_index):[],ek=e=>eb(e).find(e=>0===e.wallet_index)??null,eI=e=>e?e.linked_accounts.filter(ev).filter(e=>"solana"===e.chain_type).sort((e,t)=>e.wallet_index-t.wallet_index):[],eE=async(e,t,r)=>{let n=((e,t)=>!("off"===t||eb(e).length>0||e.linked_accounts.filter(e=>"wallet"===e.type&&"ethereum"===e.chain_type).length>0&&"all-users"!==t))(t.user,r?.ethereum?.createOnLogin??"off"),i=((e,t)=>!("off"===t||eI(e).length>0||e.linked_accounts.filter(e=>"wallet"===e.type&&"solana"===e.chain_type).length>0&&"all-users"!==t))(t.user,r?.solana?.createOnLogin??"off");if(n&&i){let r=await e.create({recoveryMethod:"privy",skipCallbacks:!0});return{...await e.createSolana({ethereumAccount:ek(r.user)??void 0}),is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}}return n?{...await e.create({recoveryMethod:"privy",solanaAccount:eI(t.user).find(e=>0===e.wallet_index)??null??void 0}),is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}:i?{...await e.createSolana({ethereumAccount:ek(t.user)??void 0}),is_new_user:t.is_new_user,oauth_tokens:t.oauth_tokens}:t};class eA{async syncWithToken(e,t,r){let n=await this._privyInternal.fetch(ew,{body:{token:e,mode:r}});await this._privyInternal.session.updateWithTokensResponse(n);let i=await eE(this._embedded,n,t?.embedded);return this._privyInternal.callbacks?.setUser?.(i.user),i}constructor(e,t){this._privyInternal=e,this._embedded=t}}let eT={path:"/api/v1/passwordless/authenticate",method:"POST"},eS={path:"/api/v1/passwordless/init",method:"POST"},ex={path:"/api/v1/passwordless/link",method:"POST"},eC={path:"/api/v1/passwordless/unlink",method:"POST"},eR={path:"/api/v1/passwordless/update",method:"POST"};class eP{async sendCode(e,t){return this._privyInternal.fetch(eS,{body:{email:e,token:t}})}async loginWithCode(e,t,r,n){let i=await this._privyInternal.fetch(eT,{body:{email:e,code:t,mode:r}});await this._privyInternal.session.updateWithTokensResponse(i);let s=await eE(this._embedded,i,n?.embedded);return this._privyInternal.callbacks?.setUser?.(s.user),s}async linkWithCode(e,t){await this._privyInternal.fetch(ex,{body:{email:e,code:t}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updateEmail({oldEmailAddress:e,newEmailAddress:t,code:r}){await this._privyInternal.fetch(eR,{body:{oldAddress:e,newAddress:t,code:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink(e){await this._privyInternal.fetch(eC,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}let eO={path:"/api/v1/farcaster/init",method:"POST"},eM={path:"/api/v1/farcaster/authenticate",method:"POST"},eL={path:"/api/v1/farcaster/link",method:"POST"},eN={path:"/api/v1/farcaster/unlink",method:"POST"},eD={path:"/api/v1/farcaster/status",method:"GET"},eU={path:"/api/v2/farcaster/init",method:"POST"},eW={path:"/api/v2/farcaster/authenticate",method:"POST"};class ej{async initializeAuth({relyingParty:e,redirectUrl:t,token:r}){return await this._privyInternal.fetch(eO,{body:{relying_party:e,redirect_url:t,token:r}})}async getFarcasterStatus({channel_token:e}){return await this._privyInternal.fetch(eD,{headers:{"farcaster-channel-token":e}})}async authenticate({channel_token:e,message:t,signature:r,fid:n,mode:i},s){let a=await this._privyInternal.fetch(eM,{body:{channel_token:e,message:t,signature:r,fid:n,mode:i}});
1await this._privyInternal.session.updateWithTokensResponse(a);let o=await eE(this._embedded,a,s?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async link({channel_token:e,message:t,signature:r,fid:n}){await this._privyInternal.fetch(eL,{body:{channel_token:e,message:t,signature:r,fid:n}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async unlink({fid:e}){await this._privyInternal.fetch(eN,{body:{fid:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}class eF{async initializeAuth(){return await this._privyInternal.fetch(eU,{body:{}})}async authenticate({message:e,signature:t,fid:r},n){let i=await this._privyInternal.fetch(eW,{body:{message:e,signature:t,fid:r}});await this._privyInternal.session.updateWithTokensResponse(i);let s=await eE(this._embedded,i,n?.embedded);return this._privyInternal.callbacks?.setUser?.(s.user),s}constructor(e,t){this._privyInternal=e,this._embedded=t}}let eq={path:"/api/v1/guest/authenticate",method:"POST"};class eB{async create(e){let t=await this._privyInternal.session.getOrCreateGuestCredential(),r=await this._privyInternal.fetch(eq,{body:{guest_credential:t}});await this._privyInternal.session.updateWithTokensResponse(r);let n=await eE(this._embedded,r,e?.embedded);return this._privyInternal.callbacks?.setUser?.(n.user),n}constructor(e,t){this._privyInternal=e,this._embedded=t}}let ez={path:"/api/v1/oauth/authenticate",method:"POST"},eH={path:"/api/v1/oauth/init",method:"POST"},eK={path:"/api/v1/oauth/link",method:"POST"},eV={path:"/api/v1/oauth/unlink",method:"POST"},e$="privy:state_code",eG="privy:code_verifier";async function eY(e,t){let r=(new TextEncoder).encode(e);return new Uint8Array(await t("SHA-256",r))}function eJ(){return a.base64url.encode(crypto.getRandomValues(new Uint8Array(36)))}async function eZ({codeVerifier:e,method:t="S256",digest:r=crypto.subtle.digest.bind(crypto.subtle)}){if("S256"!=t)return e;{let t=await eY(e,r);return a.base64url.encode(t)}}class eX{async generateURL(e,t){let r=eJ(),n=eJ(),i=await eZ({codeVerifier:r,digest:this._crypto?.digest});return await Promise.all([this._storage.put(eG,r),this._storage.put(e$,n)]),this._privyInternal.fetch(eH,{body:{redirect_to:t,provider:e,code_challenge:i,state_code:n}})}async loginWithCode(e,t,r,n,i,s){let[a,o]=await Promise.all([this._storage.get(eG),this._storage.get(e$)]);if(o!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:r,storedStateCode:o??"",returnedStateCode:t??""}),new p.wE({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let l=await this._privyInternal.fetch(ez,{body:{authorization_code:e,code_type:n,state_code:o,code_verifier:a,mode:i}});await this._privyInternal.session.updateWithTokensResponse(l);let c=await eE(this._embedded,l,s?.embedded);return await Promise.all([this._storage.del(eG),this._storage.del(e$)]),this._privyInternal.callbacks?.setUser?.(c.user),c}async linkWithCode(e,t,r,n){let[i,s]=await Promise.all([this._storage.get(eG),this._storage.get(e$)]);if(s!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"oauth",provider:r,storedStateCode:s??"",returnedStateCode:t??""}),new p.wE({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let a=await this._privyInternal.fetch(eK,{body:{authorization_code:e,code_type:n,state_code:s,code_verifier:i}});await this._privyInternal.session.processOAuthTokens(a.oauth_tokens);let o=await this._privyInternal.refreshSession();return await Promise.all([this._storage.del(eG),this._storage.del(e$)]),{user:o.user,identity_token:o.identity_token}}async unlink(e,t){await this._privyInternal.fetch(eV,{body:{provider:e,subject:t}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}constructor(e,t,r,n){this._privyInternal=e,this._embedded=t,this._storage=r,this._crypto=n}}let eQ={path:"/api/v1/passkeys/link",method:"POST"},e0={path:"/api/v1/passkeys/authenticate",method:"POST"},e1={path:"/api/v1/passkeys/register",method:"POST"},e2={path:"/api/v1/passkeys/authenticate/init",method:"POST"},e5={path:"/api/v1/passkeys/register/init",method:"POST"},e3={path:"/api/v1/passkeys/link/init",method:"POST"};class e4{async generateRegistrationOptions(e){return await this._privyInternal.fetch(e3,{body:{relying_party:e}})}async generateAuthenticationOptions(e){return await this._privyInternal.fetch(e2,{body:{relying_party:e}})}async generateSignupOptions(e){return await this._privyInternal.fetch(e5,{body:{relying_party:e}})}async loginWithPasskey(e,t,r,n){let i=await this._privyInternal.fetch(e0,{body:{relying_party:r,challenge:t,authenticator_response:this._transformAuthenticationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(i);let s=await eE(this._embedded,i,n?.embedded);return this._privyInternal.callbacks?.setUser?.(s.user),s}async signupWithPasskey(e,t,r){let n=await this._privyInternal.fetch(e1,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});await this._privyInternal.session.updateWithTokensResponse(n);let i=await eE(this._embedded,n,r?.embedded);return this._privyInternal.callbacks?.setUser?.(i.user),i}async linkWithPasskey(e,t){await this._privyInternal.fetch(eQ,{body:{relying_party:t,authenticator_response:this._transformRegistrationResponseToSnakeCase(e)}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}_transformRegistrationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_i
1d:e.rawId,response:{client_data_json:e.response.clientDataJSON,attestation_object:e.response.attestationObject,authenticator_data:e.response.authenticatorData||void 0,transports:e.response.transports||void 0,public_key:e.response.publicKey||void 0,public_key_algorithm:e.response.publicKeyAlgorithm||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}_transformAuthenticationResponseToSnakeCase(e){return{type:e.type,id:e.id,raw_id:e.rawId,response:{signature:e.response.signature,client_data_json:e.response.clientDataJSON,authenticator_data:e.response.authenticatorData,user_handle:e.response.userHandle||void 0},authenticator_attachment:e.authenticatorAttachment||void 0,client_extension_results:{app_id:e.clientExtensionResults.appid||void 0,cred_props:e.clientExtensionResults.credProps||void 0,hmac_create_secret:e.clientExtensionResults.hmacCreateSecret||void 0}}}constructor(e,t){this._privyInternal=e,this._embedded=t}}let e7={path:"/api/v1/passwordless_sms/authenticate",method:"POST"},e8={path:"/api/v1/passwordless_sms/init",method:"POST"},e6={path:"/api/v1/passwordless_sms/link",method:"POST"},e9={path:"/api/v1/passwordless_sms/unlink",method:"POST"},te={path:"/api/v1/passwordless_sms/update",method:"POST"};class tt{async sendCode(e,t){return this._privyInternal.fetch(e8,{body:{phoneNumber:e,token:t}})}async loginWithCode(e,t,r,n){let i=await this._privyInternal.fetch(e7,{body:{phoneNumber:e,code:t,mode:r}});await this._privyInternal.session.updateWithTokensResponse(i);let s=await eE(this._embedded,i,n?.embedded);return this._privyInternal.callbacks?.setUser?.(s.user),s}async linkWithCode(e,t){await this._privyInternal.fetch(e6,{body:{phoneNumber:e,code:t}});let r=await this._privyInternal.refreshSession();return{user:r.user,identity_token:r.identity_token}}async updatePhone({oldPhoneNumber:e,newPhoneNumber:t,code:r}){await this._privyInternal.fetch(te,{body:{old_phone_number:e,new_phone_number:t,code:r}});let n=await this._privyInternal.refreshSession();return{user:n.user,identity_token:n.identity_token}}async unlink(e){await this._privyInternal.fetch(e9,{body:{phoneNumber:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}constructor(e,t){this._privyInternal=e,this._embedded=t}}let tr={path:"/api/v1/siwe/init",method:"POST"},tn={path:"/api/v1/siwe/authenticate",method:"POST"},ti={path:"/api/v1/siwe/link",method:"POST"},ts={path:"/api/v1/siwe/link_smart_wallet",method:"POST"},ta={path:"/api/v1/siwe/unlink",method:"POST"};class to{async unlinkWallet(e){await this._privyInternal.fetch(ta,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}async linkWithSiwe(e,t,r){let n=t||this._wallet,i=r||this._preparedMessage;if(!n)throw Error("A wallet must be provided in the init step or as an argument to linkWithSiwe");if(!i)throw Error("A message must be generated and signed before being used to link a wallet to privy");await this._privyInternal.fetch(ti,{body:{message:i,signature:e,chainId:n.chainId,walletClientType:n.walletClientType,connectorType:n.connectorType}});let s=await this._privyInternal.refreshSession();return{user:s.user,identity_token:s.identity_token}}async loginWithSiwe(e,t,r,n,i){let s=t||this._wallet,a=r||this._preparedMessage;if(!s)throw Error("A wallet must be provided in the init step or as an argument to loginWithSiwe");if(!a)throw Error("A message must be generated and signed before being used to login to privy with a wallet");let o=await this._privyInternal.fetch(tn,{body:{signature:e,message:a,chainId:s.chainId,walletClientType:s.walletClientType,connectorType:s.connectorType,mode:n}});await this._privyInternal.session.updateWithTokensResponse(o);let l=await eE(this._embedded,o,i?.embedded);return this._privyInternal.callbacks?.setUser?.(l.user),l}async init(e,t,r){var n;this._wallet=e;let{nonce:i}=await this._privyInternal.fetch(tr,{body:{address:e.address}}),s=`${(n={chainId:e.chainId.toString().replace("eip155:",""),address:e.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:t,nonce:i,uri:r}).domain} wants you to sign in with your Ethereum account:
2${n.address}
3
4${n.statement}
5
6URI: ${n.uri}
7Version: 1
8Chain ID: ${n.chainId}
9Nonce: ${n.nonce}
10Issued At: ${n.issuedAt}
11Resources:
12- https://privy.io`;return this._preparedMessage=s,{nonce:i,message:s}}constructor(e,t){this._wallet=void 0,this._privyInternal=e,this._embedded=t}}let tl={path:"/api/v1/siws/init",method:"POST"},tc={path:"/api/v1/siws/authenticate",method:"POST"},td={path:"/api/v1/siws/link",method:"POST"},tu={path:"/api/v1/siws/unlink",method:"POST"};class th{async unlink({address:e}){await this._privyInternal.fetch(tu,{body:{address:e}});let t=await this._privyInternal.refreshSession();return{user:t.user,identity_token:t.identity_token}}async link({message:e,signature:t,walletClientType:r,connectorType:n}){await this._privyInternal.fetch(td,{body:{message:e,signature:t,walletClientType:r,connectorType:n}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async login({mode:e,message:t,signature:r,walletClientType:n,connectorType:i,opts:s}){let a=await this._privyInternal.fetch(tc,{body:{signature:r,message:t,walletClientType:n,connectorType:i,mode:e}});
12await this._privyInternal.session.updateWithTokensResponse(a);let o=await eE(this._embedded,a,s?.embedded);return this._privyInternal.callbacks?.setUser?.(o.user),o}async fetchNonce({address:e}){let{nonce:t}=await this._privyInternal.fetch(tl,{body:{address:e}});return{nonce:t}}constructor(e,t){this._privyInternal=e,this._embedded=t}}class tp{async link(e,t,r,n){await this._privyInternal.fetch(ts,{body:{message:e,signature:t,smart_wallet_type:r,smart_wallet_version:n}});let i=await this._privyInternal.refreshSession();return{user:i.user,identity_token:i.identity_token}}async init(e){var t;let{nonce:r}=await this._privyInternal.fetch(tr,{body:{address:e.address}});return{nonce:r,message:`${(t={chainId:e.chainId.toString().replace("eip155:",""),address:e.address,issuedAt:(new Date).toISOString(),statement:"By signing, you are proving you own this wallet and logging in. This does not initiate a transaction or cost any fees.",domain:"privy.io",uri:"https://auth.privy.io",nonce:r}).domain} wants you to sign in with your Ethereum account:
13${t.address}
14
15${t.statement}
16
17URI: ${t.uri}
18Version: 1
19Chain ID: ${t.chainId}
20Nonce: ${t.nonce}
21Issued At: ${t.issuedAt}
22Resources:
23- https://privy.io`}}constructor(e){this._privyInternal=e}}class ty{async logout(){try{let e=await this._privyInternal.session.getRefreshToken()??void 0;await this._privyInternal.fetch(et,{body:{refresh_token:e}})}catch(e){console.warn("Error destroying session")}await Promise.all([this._privyInternal.session.destroyLocalState({reason:"logout"}),this._privyInternal.destroyClientAnalyticsId()]),this._privyInternal.callbacks?.setUser?.(null)}constructor(e,t,r,n){this._privyInternal=e,this.customProvider=new eA(this._privyInternal,t),this.phone=new tt(this._privyInternal,t),this.email=new eP(this._privyInternal,t),this.oauth=new eX(this._privyInternal,t,r,n),this.guest=new eB(this._privyInternal,t),this.siwe=new to(this._privyInternal,t),this.siws=new th(this._privyInternal,t),this.smartWallet=new tp(this._privyInternal),this.passkey=new e4(this._privyInternal,t),this.farcaster=new ej(this._privyInternal,t),this.farcasterV2=new eF(this._privyInternal,t)}}let t_={path:"/api/v1/funding/coinbase_on_ramp/init",method:"POST"},tf={path:"/api/v1/funding/coinbase_on_ramp/status",method:"GET"};class tm{async initOnRampSession(e){return await this._privyInternal.fetch(t_,{body:e})}async getStatus(e){return await this._privyInternal.fetch(tf,{query:{partnerUserId:e}})}constructor(e){this._privyInternal=e}}let tg={path:"/api/v1/plugins/moonpay_on_ramp/sign",method:"POST"};var tw=r(63627);let tv=class{async sign(e){return await this._privyInternal.fetch(tg,{body:e})}async getTransactionStatus({transactionId:e,useSandbox:t}){let{url:r,key:n}=tw.IX[t?"sandbox":"prod"],i=await Y(fetch,{retries:3,retryDelay:500})(`${r}/transactions/ext/${e}?apiKey=${n}`);if(!i.ok)throw new p.gn({error:`Failed to fetch transaction status for Transaction ${e}`,code:"failed_to_fetch_moonpay_transaction_status",response:i});let s=await i.json();return Array.isArray(s)?s.at(0):void 0}constructor(e){this._privyInternal=e}};class tb{constructor(e){this.moonpay=new tv(e),this.coinbase=new tm(e)}}let tk={path:"/api/v1/mfa/passkeys/init",method:"POST"},tI=class{async generateAuthenticationOptions(e){return await this._privyInternal.fetch(tk,{body:e})}constructor(e){this._privyInternal=e}},tE={path:"/api/v1/mfa/passwordless_sms/init",method:"POST"};class tA{async sendCode(e){return await this._privyInternal.fetch(tE,{body:e})}constructor(e){this._privyInternal=e}}class tT{setProxy(e){this.proxy=e}async getAccessTokenInternal(){let e=await this.privyInternal.getAccessTokenInternal();if(!e)throw new p.wE({error:"Missing access token",code:"attempted_rpc_call_before_logged_in"});return e}async verifyMfa(){if(!this.proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.verifyMfa({accessToken:await this.getAccessTokenInternal()})}async initEnrollMfa(e){if(!this.proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.initEnrollMfa({...e,accessToken:await this.getAccessTokenInternal()})}async submitEnrollMfa(e){if(!this.proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.submitEnrollMfa({...e,accessToken:await this.getAccessTokenInternal()});return await this.privyInternal.refreshSession(),t}async unenrollMfa(e){if(!this.proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});let t=await this.proxy.unenrollMfa({method:e,accessToken:await this.getAccessTokenInternal()});return await this.privyInternal.refreshSession(),t}async clearMfa(e){if(!this.proxy)throw new p.wE({error:"Embedded wallet proxy not initialized",code:"embedded_wallet_webview_not_loaded"});return await this.proxy.clearMfa(e)}constructor(e,t){this.proxy=t,this.privyInternal=e,this.sms=new tA(e),this.passkey=new tI(e)}}let tS={path:"/api/v1/embedded_wallets/:address/recovery/key_material",method:"POST"},tx={path:"/api/v1/recovery/oauth/init",method:"POST"},tC={path:"/api/v1/recovery/oauth/authenticate",method:"POST"},tR={path:"/api/v1/recovery/oauth/init_icloud",method:"POST"},tP={path:"/api/v1/recovery/configuration_icloud",method:"POST"};class tO{async init(e){return this._privyInternal.fetch(tR,{body:{client_type:e}})}async getICloudConfiguration(e){return this._privyInternal.fetch(tP,{body:{client_type:e}})}constructor(e){this._privyInternal=e}}class tM{async generateURL(e){let t=eJ(),r=eJ(),n=await eZ({codeVerifier:t,digest:this._crypto?.digest});return await Promise.all([this._storage.put(eG,t),this._storage.put(e$,r)]),this._privyInternal.fetch(tx,{body:{redirect_to:e,code_challenge:n,state_code:r}})}async authorize(e,t){let[r,n]=await Promise.all([this._storage.get(eG),this._storage.get(e$)]);if(n!==t)throw this._privyInternal.createAnalyticsEvent("possible_phishing_attempt",{flow:"recovery_oauth",storedStateCode:n??"",returnedStateCode:t??""}),new p.wE({code:"pkce_state_code_mismatch",error:"Unexpected auth flow. This may be a phishing attempt."});let i=await this._privyInternal.fetch(tC,{body:{authorization_code:e,state_code:n,code_verifier:r}});return await Promise.all([this._storage.del(eG),this._storage.del(e$)]),i}constructor(e,t,r){this._privyInternal=e,this._storage=t,this._crypto=r}}class tL{async getRecoveryKeyMaterial(e,t){return this._privyInternal.fetch(tS,{body:{chain_type:t},params:{address:e}})}constructor(e,t,r){this._privyInternal=e,this.auth=new tM(this._privyInternal,t,r),this.icloudAuth=new tO(this._privyInternal)}}class tN{async initialize(){await this._privyInternal._initialize()}setMessagePoster(e){this.embeddedWallet.setMessagePoster(e)}addOAuthTokensListener(e){return this._privyInternal.session.on("oauth_tokens_granted",e),{unsubscribe:()=>{this._privyInternal.session.removeListener("oauth_tokens_granted",e)}}}setCallbacks(e){this._privyInternal.setCallbacks(e)}getAccessToken(){return this._privyInternal.getAccessToken()}getIdentityToken(){return this._privyInternal.getIdentityToken()}getCompiledPath(e,t){return this._privyInternal.getPath(e,t)}
23async fetchPrivyRoute(e,t){return this._privyInternal.fetch(e,t)}get logger(){return this._privyInternal.logger}constructor({clientId:e,...t}){this._privyInternal=new ef({...t,appClientId:e}),this.mfa=new tT(this._privyInternal),this.mfaPromises=new V,this.app=new i(this._privyInternal),this.embeddedWallet=new K(this._privyInternal,t.embeddedWalletMessagePoster,t.supportedChains,this.mfa,this.mfaPromises,this.app),this.user=new eg(this._privyInternal),this.auth=new ty(this._privyInternal,this.embeddedWallet,t.storage,t.crypto),this.recovery=new tL(this._privyInternal,t.storage,t.crypto),this.funding=new tb(this._privyInternal),this.delegated=new d(this._privyInternal),this.crossApp=new l(this._privyInternal,t.storage)}}},6014:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(5078).A)("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]])},9585:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{fillRule:"evenodd",d:"M4.5 3.75a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h15a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3h-15Zm4.125 3a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm-3.873 8.703a4.126 4.126 0 0 1 7.746 0 .75.75 0 0 1-.351.92 7.47 7.47 0 0 1-3.522.877 7.47 7.47 0 0 1-3.522-.877.75.75 0 0 1-.351-.92ZM15 8.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15ZM14.25 12a.75.75 0 0 1 .75-.75h3.75a.75.75 0 0 1 0 1.5H15a.75.75 0 0 1-.75-.75Zm.75 2.25a.75.75 0 0 0 0 1.5h3.75a.75.75 0 0 0 0-1.5H15Z",clipRule:"evenodd"}))})},9973:(e,t,r)=>{"use strict";r.d(t,{u:()=>s});var n=r(55729),i=r(28950);let s=()=>{let{walletProxy:e,client:t}=(0,i.u)();return(0,n.useMemo)(()=>({signWithUserSigner:async({message:r})=>{if(!e)throw Error("Wallet proxy not initialized");let n=await t.getAccessToken();if(!n)throw Error("User must be authenticated");let{signature:i}=await e.signWithUserSigner({accessToken:n,message:r});return{signature:i}}}),[e,t])}},13200:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15M12 9l3 3m0 0-3 3m3-3H2.25"}))})},13536:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},15686:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(5078).A)("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},18731:(e,t,r)=>{"use strict";r.d(t,{t:()=>s});var n=r(95196),i=r(3505);function s(e){if("string"==typeof e){if(!(0,i.P)(e,{strict:!1}))throw new n.M({address:e});return{address:e,type:"json-rpc"}}if(!(0,i.P)(e.address,{strict:!1}))throw new n.M({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,signAuthorization:e.signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:"custom",type:"local"}}},20587:(e,t,r)=>{"use strict";r.d(t,{_:()=>T,e:()=>S});var n=r(55729),i=r(8363),s=r(49076),a=r(45997),o=r(40076),l=r(98907),c=r(63804),d=r(59772),u=r(77960),h=r(23126),p=r(20746),y=r(81022),_=r(35521);function f(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!(0,_.zv)(null!=(t=e.as)?t:k)||1===n.Children.count(e.children)}let m=(0,n.createContext)(null);m.displayName="TransitionContext";var g=(e=>(e.Visible="visible",e.Hidden="hidden",e))(g||{});let w=(0,n.createContext)(null);function v(e){return"children"in e?v(e.children):e.current.filter(e=>{let{el:t}=e;return null!==t.current}).filter(e=>{let{state:t}=e;return"visible"===t}).length>0}function b(e,t){let r=(0,l.Y)(e),o=(0,n.useRef)([]),c=(0,a.a)(),d=(0,i.L)(),u=(0,s._)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.mK.Hidden,n=o.current.findIndex(t=>{let{el:r}=t;return r===e});-1!==n&&((0,y.Y)(t,{[_.mK.Unmount](){o.current.splice(n,1)},[_.mK.Hidden](){o.current[n].state="hidden"}}),d.microTask(()=>{var e;!v(o)&&c.current&&(null==(e=r.current)||e.call(r))}))}),h=(0,s._)(e=>
23{let t=o.current.find(t=>{let{el:r}=t;return r===e});return t?"visible"!==t.state&&(t.state="visible"):o.current.push({el:e,state:"visible"}),()=>u(e,_.mK.Unmount)}),p=(0,n.useRef)([]),f=(0,n.useRef)(Promise.resolve()),m=(0,n.useRef)({enter:[],leave:[]}),g=(0,s._)((e,r,n)=>{p.current.splice(0),t&&(t.chains.current[r]=t.chains.current[r].filter(t=>{let[r]=t;return r!==e})),null==t||t.chains.current[r].push([e,new Promise(e=>{p.current.push(e)})]),null==t||t.chains.current[r].push([e,new Promise(e=>{Promise.all(m.current[r].map(e=>{let[t,r]=e;return r})).then(()=>e())})]),"enter"===r?f.current=f.current.then(()=>null==t?void 0:t.wait.current).then(()=>n(r)):n(r)}),w=(0,s._)((e,t,r)=>{Promise.all(m.current[t].splice(0).map(e=>{let[t,r]=e;return r})).then(()=>{var e;null==(e=p.current.shift())||e()}).then(()=>r(t))});return(0,n.useMemo)(()=>({children:o,register:h,unregister:u,onStart:g,onStop:w,wait:f,chains:m}),[h,u,o,g,w,m,f])}w.displayName="NestingContext";let k=n.Fragment,I=_.Ac.RenderStrategy,E=(0,_.FX)(function(e,t){let{show:r,appear:i=!1,unmount:a=!0,...l}=e,u=(0,n.useRef)(null),p=f(e),y=(0,d.P)(...p?[u,t]:null===t?[]:[t]);(0,c.g)();let g=(0,h.O_)();if(void 0===r&&null!==g&&(r=(g&h.Uw.Open)===h.Uw.Open),void 0===r)throw Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[k,E]=(0,n.useState)(r?"visible":"hidden"),T=b(()=>{r||E("hidden")}),[S,x]=(0,n.useState)(!0),C=(0,n.useRef)([r]);(0,o.s)(()=>{!1!==S&&C.current[C.current.length-1]!==r&&(C.current.push(r),x(!1))},[C,r]);let R=(0,n.useMemo)(()=>({show:r,appear:i,initial:S}),[r,i,S]);(0,o.s)(()=>{r?E("visible"):v(T)||null===u.current||E("hidden")},[r,T]);let P={unmount:a},O=(0,s._)(()=>{var t;S&&x(!1),null==(t=e.beforeEnter)||t.call(e)}),M=(0,s._)(()=>{var t;S&&x(!1),null==(t=e.beforeLeave)||t.call(e)}),L=(0,_.Ci)();return n.createElement(w.Provider,{value:T},n.createElement(m.Provider,{value:R},L({ourProps:{...P,as:n.Fragment,children:n.createElement(A,{ref:y,...P,...l,beforeEnter:O,beforeLeave:M})},theirProps:{},defaultTag:n.Fragment,features:I,visible:"visible"===k,name:"Transition"})))}),A=(0,_.FX)(function(e,t){var r,i;let{transition:a=!0,beforeEnter:l,afterEnter:g,beforeLeave:E,afterLeave:A,enter:T,enterFrom:S,enterTo:x,entered:C,leave:R,leaveFrom:P,leaveTo:O,...M}=e,[L,N]=(0,n.useState)(null),D=(0,n.useRef)(null),U=f(e),W=(0,d.P)(...U?[D,t,N]:null===t?[]:[t]),j=null==(r=M.unmount)||r?_.mK.Unmount:_.mK.Hidden,{show:F,appear:q,initial:B}=function(){let e=(0,n.useContext)(m);if(null===e)throw Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),[z,H]=(0,n.useState)(F?"visible":"hidden"),K=function(){let e=(0,n.useContext)(w);if(null===e)throw Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}(),{register:V,unregister:$}=K;(0,o.s)(()=>V(D),[V,D]),(0,o.s)(()=>{if(j===_.mK.Hidden&&D.current)return F&&"visible"!==z?void H("visible"):(0,y.Y)(z,{hidden:()=>$(D),visible:()=>V(D)})},[z,D,V,$,F,j]);let G=(0,c.g)();(0,o.s)(()=>{if(U&&G&&"visible"===z&&null===D.current)throw Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[D,z,G,U]);let Y=B&&!q,J=q&&F&&B,Z=(0,n.useRef)(!1),X=b(()=>{Z.current||(H("hidden"),$(D))},K),Q=(0,s._)(e=>{Z.current=!0,X.onStart(D,e?"enter":"leave",e=>{"enter"===e?null==l||l():"leave"===e&&(null==E||E())})}),ee=(0,s._)(e=>{let t=e?"enter":"leave";Z.current=!1,X.onStop(D,t,e=>{"enter"===e?null==g||g():"leave"===e&&(null==A||A())}),"leave"!==t||v(X)||(H("hidden"),$(D))});(0,n.useEffect)(()=>{U&&a||(Q(F),ee(F))},[F,U,a]);let et=!(!a||!U||!G||Y),[,er]=(0,u.p)(et,L,F,{start:Q,end:ee}),en=(0,_.oE)({ref:W,className:(null==(i=(0,p.x)(M.className,J&&T,J&&S,er.enter&&T,er.enter&&er.closed&&S,er.enter&&!er.closed&&x,er.leave&&R,er.leave&&!er.closed&&P,er.leave&&er.closed&&O,!er.transition&&F&&C))?void 0:i.trim())||void 0,...(0,u.B)(er)}),ei=0;"visible"===z&&(ei|=h.Uw.Open),"hidden"===z&&(ei|=h.Uw.Closed),F&&"hidden"===z&&(ei|=h.Uw.Opening),F||"visible"!==z||(ei|=h.Uw.Closing);let es=(0,_.Ci)();return n.createElement(w.Provider,{value:X},n.createElement(h.El,{value:ei},es({ourProps:en,theirProps:M,defaultTag:k,features:I,visible:"visible"===z,name:"Transition.Child"})))}),T=(0,_.FX)(function(e,t){let r=null!==(0,n.useContext)(m),i=null!==(0,h.O_)();return n.createElement(n.Fragment,null,!r&&i?n.createElement(E,{ref:t,...e}):n.createElement(A,{ref:t,...e}))}),S=Object.assign(E,{Child:T,Root:E})},22043:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var n=r(25218);
23class i{async init(){if(!this.api)throw new n.P("Auth flow has no API instance");let{nonce:e,expires_at:t}=await this.api.post(n.ak,{});return{nonce:e,expiresAt:t}}async authenticate(){if(!this.message||!this.signature||!this.fid)throw new n.P("Auth flow has no message, signature, or fid");if(!this.api)throw new n.P("Auth flow has no API instance");try{let e=await this.api.post(n.al,{message:this.message,signature:this.signature,fid:this.fid});if(!e)throw new n.P("No response from authentication");return e}catch(e){throw(0,n.f)(e)}}async link(){throw Error("Not implemented")}setAuthData({message:e,signature:t,fid:r}){this.message=e,this.signature=t,this.fid=r}constructor(){this.meta={}}}},24474:(e,t,r)=>{"use strict";r.d(t,{_:()=>tq});class n{constructor(e,t){this.scope=e,this.module=t}storeObject(e,t){this.setItem(e,JSON.stringify(t))}loadObject(e){let t=this.getItem(e);return t?JSON.parse(t):void 0}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){let e=this.scopedKey(""),t=[];for(let r=0;r<localStorage.length;r++){let n=localStorage.key(r);"string"==typeof n&&n.startsWith(e)&&t.push(n)}t.forEach(e=>localStorage.removeItem(e))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new n("CBWSDK").clear(),new n("walletlink").clear()}}let i={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}},s={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}},a="Unspecified error message.";function o(e,t=a){if(e&&Number.isInteger(e)){var r;let t=e.toString();if(c(s,t))return s[t].message;if((r=e)>=-32099&&r<=-32e3)return"Unspecified server error."}return t}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function d(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}let u={rpc:{parse:e=>h(i.rpc.parse,e),invalidRequest:e=>h(i.rpc.invalidRequest,e),invalidParams:e=>h(i.rpc.invalidParams,e),methodNotFound:e=>h(i.rpc.methodNotFound,e),internal:e=>h(i.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum RPC Server errors must provide single object argument.");let{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw Error('"code" must be an integer such that: -32099 <= code 
23<= -32005');return h(t,e)},invalidInput:e=>h(i.rpc.invalidInput,e),resourceNotFound:e=>h(i.rpc.resourceNotFound,e),resourceUnavailable:e=>h(i.rpc.resourceUnavailable,e),transactionRejected:e=>h(i.rpc.transactionRejected,e),methodNotSupported:e=>h(i.rpc.methodNotSupported,e),limitExceeded:e=>h(i.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>p(i.provider.userRejectedRequest,e),unauthorized:e=>p(i.provider.unauthorized,e),unsupportedMethod:e=>p(i.provider.unsupportedMethod,e),disconnected:e=>p(i.provider.disconnected,e),chainDisconnected:e=>p(i.provider.chainDisconnected,e),unsupportedChain:e=>p(i.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Ethereum Provider custom errors must provide single object argument.");let{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw Error('"message" must be a nonempty string');return new f(t,r,n)}}};function h(e,t){let[r,n]=y(t);return new _(e,r||o(e),n)}function p(e,t){let[r,n]=y(t);return new f(e,r||o(e),n)}function y(e){if(e){if("string"==typeof e)return[e];else if("object"==typeof e&&!Array.isArray(e)){let{message:t,data:r}=e;if(t&&"string"!=typeof t)throw Error("Must specify string message.");return[t||void 0,r]}}return[]}class _ extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}}class f extends _{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function m(e){return Math.floor(e)}var g=r(51642).Buffer;let w=/^[0-9]*$/,v=/^[a-f0-9]*$/;function b(e){return k(crypto.getRandomValues(new Uint8Array(e)))}function k(e){return[...e].map(e=>e.toString(16).padStart(2,"0")).join("")}function I(e){return new Uint8Array(e.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function E(e,t=!1){let r=e.toString("hex");return t?`0x${r}`:r}function A(e){return E(L(e),!0)}function T(e){return e.toString(10)}function S(e){return`0x${BigInt(e).toString(16)}`}function x(e){return e.startsWith("0x")||e.startsWith("0X")}function C(e){return x(e)?e.slice(2):e}function R(e){return x(e)?`0x${e.slice(2)}`:`0x${e}`}function P(e){if("string"!=typeof e)return!1;let t=C(e).toLowerCase();return v.test(t)}function O(e,t=!1){let r=function(e,t=!1){if("string"==typeof e){let r=C(e).toLowerCase();if(v.test(r))return t?`0x${r}`:r}throw u.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}(e,!1);return r.length%2==1&&(r=`0${r}`),t?`0x${r}`:r}function M(e){if("string"==typeof e){let t=C(e).toLowerCase();if(P(t)&&40===t.length)return R(t)}throw u.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}function L(e){if(g.isBuffer(e))return e;if("string"==typeof e){if(P(e)){let t=O(e,!1);return g.from(t,"hex")}return g.from(e,"utf8")}throw u.rpc.invalidParams(`Not binary data: ${String(e)}`)}function N(e){if("number"==typeof e&&Number.isInteger(e))return m(e);if("string"==typeof e){if(w.test(e))return m(Number(e));if(P(e))return m(Number(BigInt(O(e,!0))))}throw u.rpc.invalidParams(`Not an integer: ${String(e)}`)}function D(e){if(null!==e&&("bigint"==typeof e||function(e){if(null==e||"function"!=typeof e.constructor)return!1;let{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(N(e));if("string"==typeof e){if(w.test(e))return BigInt(e);if(P(e))return BigInt(O(e,!0))}throw u.rpc.invalidParams(`Not an integer: ${String(e)}`)}async function U(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function W(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function j(e,t){let r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:r},e,new TextEncoder().encode(t));return{iv:r,cipherText:n}}async function F(e,{iv:t,cipherText:r}
vendor: 6,791 bytes, line 23
23){let n=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,r);return new TextDecoder().decode(n)}function q(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}async function B(e,t){let r=q(e);return k(new Uint8Array(await crypto.subtle.exportKey(r,t)))}async function z(e,t){let r=q(e),n=I(t).buffer;return await crypto.subtle.importKey(r,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])}async function H(e,t){return j(t,JSON.stringify(e,(e,t)=>t instanceof Error?Object.assign(Object.assign({},t.code?{code:t.code}:{}),{message:t.message}):t))}async function K(e,t){return JSON.parse(await F(t,e))}let V={storageKey:"ownPrivateKey",keyType:"private"},$={storageKey:"ownPublicKey",keyType:"public"},G={storageKey:"peerPublicKey",keyType:"public"};class Y{constructor(){this.storage=new n("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(G,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem($.storageKey),this.storage.removeItem(V.storageKey),this.storage.removeItem(G.storageKey)}async generateKeyPair(){let e=await U();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(V,e.privateKey),await this.storeKey($,e.publicKey)}async loadKeysIfNeeded(){null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(V)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey($)),(null===this.ownPrivateKey||null===this.ownPublicKey)&&await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(G)),null===this.sharedSecret&&null!==this.ownPrivateKey&&null!==this.peerPublicKey&&(this.sharedSecret=await W(this.ownPrivateKey,this.peerPublicKey))}async loadKey(e){let t=this.storage.getItem(e.storageKey);return t?z(e.keyType,t):null}async storeKey(e,t){let r=await B(e.keyType,t);this.storage.setItem(e.storageKey,r)}}let J="4.3.2",Z="@coinbase/wallet-sdk";async function X(e,t){let r=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(t,{method:"POST",body:JSON.stringify(r),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":J,"X-Cbw-Sdk-Platform":Z}}),{result:i,error:s}=await n.json();if(s)throw s;return i}let Q="accounts",ee="activeChain",et="availableChains",er="walletCapabilities";class en{constructor(e){var t,r,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new Y,this.storage=new n("CBWSDK","SCWStateManager"),this.accounts=null!=(t=this.storage.loadObject(Q))?t:[],this.chain=this.storage.loadObject(ee)||{id:null!=(i=null==(r=e.metadata.appChainIds)?void 0:r[0])?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var t,r,n,i;await (null==(r=(t=this.communicator).waitForPopupLoaded)?void 0:r.call(t));let s=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,null!=(n=e.params)?n:{})}}),a=await this.communicator.postRequestAndWaitForResponse(s);if("failure"in a.content)throw a.content.failure;let o=await z("public",a.sender);await this.keyManager.setPeerPublicKey(o);let l=(await this.decryptResponseMessage(a)).result;if("error"in l)throw l.error;if("eth_requestAccounts"===e.method){let e=l.value;this.accounts=e,this.storage.storeObject(Q,e),null==(i=this.callback)||i.call(this,"accountsChanged",e)}}async request(e){var t;if(0===this.accounts.length)if("wallet_sendCalls"===e.method)return this.sendRequestToPopup(e);else throw u.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return null==(t=this.callback)||t.call(this,"connect",{chainId:S(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return S(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(er);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_sign":case"wallet_sign":case"personal_ecRecover":case"eth_signTransaction":case"eth_sendTransaction":case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":case"wallet_addEthereumChain":case"wallet_watchAsset":case"wallet_sendCalls":case"wallet_showCallsStatus":case"wallet_grantPermissions":return this.sendRequestToPopup(e);default:if(!this.chain.rpcUrl)throw u.rpc.internal("No RPC URL set for chain");return X(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var t,r;await (null==(r=(t=this.communicator).waitForPopupLoaded)?void 0:r.call(t));let n=await this.sendEncryptedRequest(e),i=(await this.decryptResponseMessage(n)).result;if("error"in i)throw i.error;return i.value}async cleanup(){var e,t;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:null!=(t=null==(e=this.metadata.appChainIds)?void 0:e[0])?t:1}}async handleSwitchChainRequest(e){var t;let r=e.params;if(!r||!(null==(t=r[0])?void 0:t.chainId))throw u.rpc.invalidParams();let n=N(r[0].chainId);if(this.updateChain(n))return null;let i=await this.sendRequestToPopup(e);return null===i&&this.updateChain(n),i}async sendEncryptedRequest(e){let t=await this.keyManager.getSharedSecret();if(!t)throw u.provider.unauthorized("No valid session found, try requestAccounts before other methods");let r=await H({action:e,chainId:this.chain.id},t),n=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(n)}async createRequestMessage(e){let t=await B("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){var t,r;let n=e.content;if("failure"in n)throw n.failure;let i=await this.keyManager.getSharedSecret();if(!i)throw u.provider.unauthorized("Invalid session");let s=await K(n.encrypted,i),a=null==(t=s.data)?void 0:t.chains;if(a){let e=Object.entries(a).map(([e,t])=>({id:Number(e),rpcUrl:t}));this.storage.storeObject(et,e),this.updateChain(this.chain.id,e)}let o=null==(r=s.data)?void 0:r.capabilities;return o&&this.storage.storeObject(er,o),s}updateChain(e,t){var r;let n=null!=t?t:this.storage.loadObject(et),i=null==n?void 0:n.find(t=>
vendor: 2,638 bytes, line 23
23t.id===e);return!!i&&(i!==this.chain&&(this.chain=i,this.storage.storeObject(ee,i),null==(r=this.callback)||r.call(this,"chainChanged",S(i.id))),!0)}}var ei=r(94622);let es="Addresses";function ea(e){return void 0!==e.errorMessage}class eo{constructor(e){this.secret=e}async encrypt(e){let t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");let r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.importKey("raw",I(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,s=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},n,i.encode(e)),a=s.slice(s.byteLength-16),o=s.slice(0,s.byteLength-16),l=new Uint8Array(a),c=new Uint8Array(o);return k(new Uint8Array([...r,...l,...c]))}async decrypt(e){let t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise((r,n)=>{!async function(){let i=await crypto.subtle.importKey("raw",I(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=I(e),a=s.slice(0,12),o=s.slice(12,28),l=new Uint8Array([...s.slice(28),...o]),c={name:"AES-GCM",iv:new Uint8Array(a)};try{let e=await window.crypto.subtle.decrypt(c,i,l),t=new TextDecoder;r(t.decode(e))}catch(e){n(e)}}()})}}class el{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;let n=`${t}:${r}`;this.auth=`Basic ${btoa(n)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(e=>console.error("Unabled to mark event as failed:",e))}async fetchUnseenEvents(){var e;let t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){let{events:r,error:n}=await t.json();if(n)throw Error(`Check unseen events failed: ${n}`);let i=null!=(e=null==r?void 0:r.filter(e=>"Web3Response"===e.event).map(e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data})))?e:[];return this.markUnseenEventsAsSeen(i),i}throw Error(`Check unseen events failed: ${t.status}`)}}!function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"}(eb||(eb={}));class ec{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw Error("webSocket object is not null");return new Promise((e,t)=>{var r;let n;try{this.webSocket=n=new this.WebSocketClass(this.url)}catch(e){t(e);return}null==(r=this.connectionStateListener)||r.call(this,eb.CONNECTING),n.onclose
23=e=>{var r;this.clearWebSocket(),t(Error(`websocket error ${e.code}: ${e.reason}`)),null==(r=this.connectionStateListener)||r.call(this,eb.DISCONNECTED)},n.onopen=t=>{var r;e(),null==(r=this.connectionStateListener)||r.call(this,eb.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(e=>this.sendData(e)),this.pendingData=[])},n.onmessage=e=>{var t,r;if("h"===e.data)null==(t=this.incomingDataListener)||t.call(this,{type:"Heartbeat"});else try{let t=JSON.parse(e.data);null==(r=this.incomingDataListener)||r.call(this,t)}catch(e){}}})}disconnect(){var e;let{webSocket:t}=this;if(t){this.clearWebSocket(),null==(e=this.connectionStateListener)||e.call(this,eb.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(e){}}}sendData(e){let{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){let{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}class ed{constructor({session:e,linkAPIUrl:t,listener:r}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=m(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{e&&new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach((t,r)=>{let n=e[r];void 0!==n&&t(n)})},this.handleDestroyed=e=>{var t;"1"===e&&(null==(t=this.listener)||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;let r=await this.cipher.decrypt(e);null==(t=this.listener)||t.accountUpdated(r)},this.handleMetadataUpdated=async(e,t)=>{var r;let n=await this.cipher.decrypt(t);null==(r=this.listener)||r.metadataUpdated(e,n)},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated("walletUsername",e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated("AppVersion",e)},this.handleChainUpdated=async(e,t)=>{var r;let n=await this.cipher.decrypt(e),i=await this.cipher.decrypt(t);null==(r=this.listener)||r.chainUpdated(n,i)},this.session=e,this.cipher=new eo(e.secret),this.listener=r;let n=new ec(`${t}/rpc`,WebSocket);n.setConnectionStateListener(async e=>{let t=!1;switch(e){case eb.DISCONNECTED:if(!this.destroyed){let e=async()=>{await new Promise(e=>setTimeout(e,5e3)),this.destroyed||n.connect().catch(()=>{e()})};e()}break;case eb.CONNECTED:t=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case eb.CONNECTING:}this.connected!==t&&(this.connected=t)}),n.setIncomingDataListener(e=>{var t;switch(e.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{let t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null==(t=this.requestResolutions.get(e.id))||t(e))}),this.ws=n,this.http=new el(t,e.id,e.key)}connect(){if(this.destroyed)throw Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:m(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&(null==(t=this.onceLinked)||t.call(this)),null==(r=this.listener)||r.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if("Event"!==e.type||"Web3Response"!==e.event)return;let r=JSON.parse(await this.cipher.decrypt(e.data));if("WEB3_RESPONSE"!==r.type)return;let{id:n,response:i}=r;null==(t=this.listener)||t.handleWeb3ResponseMessage(n,i)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEac
vendor: 6,545 bytes, line 23
23h(e=>this.handleIncomingEvent(e))}async publishEvent(e,t,r=!1){let n=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:m(this.nextReqId++),sessionId:this.session.id,event:e,data:n,callWebhook:r};return this.setOnceLinked(async()=>{let e=await this.makeRequest(i);if("Fail"===e.type)throw Error(e.error||"failed to publish event");return e.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)return void this.ws.disconnect();try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t={timeout:6e4}){let r,n=e.id;return this.sendData(e),Promise.race([new Promise((e,i)=>{r=window.setTimeout(()=>{i(Error(`request ${n} timed out`))},t.timeout)}),new Promise(e=>{this.requestResolutions.set(n,t=>{clearTimeout(r),e(t),this.requestResolutions.delete(n)})})])}async handleConnected(){return"Fail"!==(await this.makeRequest({type:"HostSession",id:m(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type&&(this.sendData({type:"IsLinked",id:m(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:m(this.nextReqId++),sessionId:this.session.id}),!0)}}class eu{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%0x7fffffff;let e=this._nextRequestId,t=R(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}var eh=r(59e3),ep=r(9291);let ey="session:id",e_="session:secret",ef="session:linked";class em{constructor(e,t,r,n=!1){this.storage=e,this.id=t,this.secret=r,this.key=(0,ep.My)((0,eh.sc)(`${t}, ${r} WalletLink`)),this._linked=!!n}static create(e){return new em(e,b(16),b(32)).save()}static load(e){let t=e.getItem(ey),r=e.getItem(ef),n=e.getItem(e_);return t&&n?new em(e,t,n,"1"===r):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ey,this.id),this.storage.setItem(e_,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(ef,this._linked?"1":"0")}}function eg(){var e,t;return null!=(t=null==(e=null==window?void 0:window.matchMedia)?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&t}function ew(){let e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode('@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}')),document.documentElement.appendChild(e)}function ev(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=function e(t){var r,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t))for(r=0;r<t.length;r++)t[r]&&(n=e(t[r]))&&(i&&(i+=" "),i+=n);else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(n&&(n+=" "),n+=t);return n}var eb,ek,eI,eE,eA,eT,eS,ex,eC,eR,eP,eO,eM={},eL=[],eN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,eD=Array.isArray;function eU(e,t){for(var r in t)e[r]=t[r];return e}function eW(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ej(e,t,r){var n,i,s,a={};for(s in t)"key"==s?n=t[s]:"ref"==s?i=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>
vendor: 14,102 bytes, line 23
233?ek.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return eF(e,a,n,i,null)}function eF(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++eE:i,__i:-1,__u:0};return null==i&&null!=eI.vnode&&eI.vnode(s),s}function eq(e){return e.children}function eB(e,t){this.props=e,this.context=t}function ez(e,t){if(null==t)return e.__?ez(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if(null!=(r=e.__k[t])&&null!=r.__e)return r.__e;return"function"==typeof e.type?ez(e):null}function eH(e){(!e.__d&&(e.__d=!0)&&eA.push(e)&&!eK.__r++||eT!=eI.debounceRendering)&&((eT=eI.debounceRendering)||eS)(eK)}function eK(){for(var e,t,r,n,i,s,a=1;eA.length;)eA.length>a&&eA.sort(ex),e=eA.shift(),a=eA.length,e.__d&&(t=void 0,r=void 0,n=(r=e.__v).__e,i=[],s=[],e.__P&&((t=eU({},r)).__v=r.__v+1,eI.vnode&&eI.vnode(t),eJ(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[n]:null,i,null==n?ez(r):n,!!(32&r.__u),s),t.__v=r.__v,t.__.__k[t.__i]=t,eX(i,t,s),r.__e=r.__=null,t.__e!=n&&function e(t){var r,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,r=0;r<t.__k.length;r++)if(null!=(n=t.__k[r])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return e(t)}}(t)));eK.__r=0}function eV(e,t,r,n,i,s,a,o,l,c,d){var u,h,p,y,_,f,m,g=n&&n.__k||eL,w=t.length;for(l=function(e,t,r,n,i){var s,a,o,l,c,d=r.length,u=d,h=0;for(e.__k=Array(i),s=0;s<i;s++)null!=(a=t[s])&&"boolean"!=typeof a&&"function"!=typeof a?(l=s+h,(a=e.__k[s]="string"==typeof a||"number"==typeof a||"bigint"==typeof a||a.constructor==String?eF(null,a,null,null,null):eD(a)?eF(eq,{children:a},null,null,null):null==a.constructor&&a.__b>0?eF(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,o=null,-1!=(c=a.__i=function(e,t,r,n){var i,s,a,o=e.key,l=e.type,c=t[r],d=null!=c&&0==(2&c.__u);if(null===c&&null==e.key||d&&o==c.key&&l==c.type)return r;if(n>+!!d){for(i=r-1,s=r+1;i>=0||s<t.length;)if(null!=(c=t[a=i>=0?i--:s++])&&0==(2&c.__u)&&o==c.key&&l==c.type)return a}return -1}(a,r,l,u))&&(u--,(o=r[c])&&(o.__u|=2)),null==o||null==o.__v?(-1==c&&(i>d?h--:i<d&&h++),"function"!=typeof a.type&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[s]=null;if(u)for(s=0;s<d;s++)null!=(o=r[s])&&0==(2&o.__u)&&(o.__e==n&&(n=ez(o)),function e(t,r,n){var i,s;if(eI.unmount&&eI.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||eQ(i,null,r)),null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){eI.__e(e,r)}i.base=i.__P=null}if(i=t.__k)for(s=0;s<i.length;s++)i[s]&&e(i[s],r,n||"function"!=typeof t.type);n||eW(t.__e),t.__c=t.__=t.__e=void 0}(o,o));return n}(r,t,g,l,w),u=0;u<w;u++)null!=(p=r.__k[u])&&(h=-1==p.__i?eM:g[p.__i]||eM,p.__i=u,f=eJ(e,p,h,i,s,a,o,l,c,d),y=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&eQ(h.ref,null,p),d.push(p.ref,p.__c||y,p)),null==_&&null!=y&&(_=y),(m=!!(4&p.__u))||h.__k===p.__k?l=function e(t,r,n,i){var s,a;if("function"==typeof t.type){for(s=t.__k,a=0;s&&a<s.length;a++)s[a]&&(s[a].__=t,r=e(s[a],r,n,i));return r}t.__e!=r&&(i&&(r&&t.type&&!r.parentNode&&(r=ez(t)),n.insertBefore(t.__e,r||null)),r=t.__e);do r=r&&r.nextSibling;while(null!=r&&8==r.nodeType);return r}(p,l,e,m):"function"==typeof p.type&&void 0!==f?l=f:y&&(l=y.nextSibling),p.__u&=-7);return r.__e=_,l}function e$(e,t,r){"-"==t[0]?e.setProperty(t,null==r?"":r):e[t]=null==r?"":"number"!=typeof r||eN.test(t)?r:r+"px"}function eG(e,t,r,n,i){var s,a;e:if("style"==t)if("string"==typeof r)e.style.cssText=r;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||e$(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||e$(e.style,t,r[t])}else if("o"==t[0]&&"n"==t[1])s=t!=(t=t.replace(eC,"$1")),t=(a=t.toLowerCase())in e||"onFocusOut"==t||"onFocusIn"==t?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.u=n.u:(r.u=eR,e.addEventListener(t,s?eO:eP,s)):e.removeEventListener(t,s?eO:eP,s);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==r?"":r;break e}catch(e){}"function"==typeof r||(null==r||!1===r&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==r?"":r))}}function eY(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t.t)t.t=eR++;else if(t.t<r.u)return;return r(eI.event?eI.event(t):t)}}}function eJ(e,t,r,n,i,s,a,o,l,c){var d,u,h,p,y,_,f,m,g,w,v,b,k,I,E,A,T,S=t.type;if(null!=t.constructor)return null;128&r.__u&&(l=!!(32&r.__u),s=[o=t.__e=r.__e]),(d=eI.__b)&&d(t);e:if("function"==typeof S)try{if(m=t.props,g="prototype"in S&&S.prototype.render,w=(d=S.contextType)&&n[d.__c],v=d?w?w.props.value:d.__:n,r.__c?f=(u=t.__c=r.__c).__=u.__E:(g?t.__c=u=new S(m,v):(t.__c=u=new eB(m,v),u.constructor=S,u.render=e0),w&&w.sub(u),u.props=m,u.state||(u.state={}),u.context=v,u.__n=n,h=u.__d=!0,u.__h=[],u._sb=[]),g&&null==u.__s&&(u.__s=u.state),g&&null!=S.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=eU({},u.__s)),eU(u.__s,S.getDerivedStateFromProps(m,u.__s))),p=u.props,y=u.state,u.__v=t,h)g&&null==S.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),g&&null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(g&&null==S.getDerivedStateFromProps&&m!==p&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(m,v),!u.__e&&null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(m,u.__s,v)||t.__v==r.__v){for(t.__v!=r.__v&&(u.props=m,u.state=u.__s,u.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),b=0;b<u._sb.length;b++)u.__h.push(u._sb[b]);u._sb=[],u.__h.length&&a.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(m,u.__s,v),g&&null!=u.componentDidUpdate&&u.__h.push(function(){u.componentDidUpdate(p,y,_)})}if(u.context=v,u.props=m,u.__P=e,u.__e=!1,k=eI.__r,I=0,g){for(u.state=u.__s,u.__d=!1,k&&k(t),d=u.render(u.props,u.state,u.context),E=0;E<u._sb.length;E++)u.__h.push(u._sb[E]);u._sb=[]}else do u.__d=!1,k&&k(t),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++I<25);u.state=u.__s,null!=u.getChildContext&&(n=eU(eU({},n),u.getChildContext())),g&&!h&&null!=u.getSnapshotBeforeUpdate&&(_=u.getSnapshotBeforeUpdate(p,y)),A=d,null!=d&&d.type===eq&&null==d.key&&(A=function e(t){return"object"!=typeof t||null==t||t.__b&&t.__b>0?t:eD(t)?t.map(e):eU({},t)}(d.props.children)),o=eV(e,eD(A)?A:[A],t,r,n,i,s,a,o,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),f&&(u.__E=u.__=null)}catch(e){if(t.__v=null,l||null!=s)if(e.then){for(t.__u|=l?160:128;o&&8==o.nodeType&&o.nextSibling;)o=o.nextSibling;s[s.indexOf(o)]=null,t.__e=o}else{for(T=s.length;T--;)eW(s[T]);eZ(t)}else t.__e=r.__e,t.__k=r.__k,e.then||eZ(t);eI.__e(e,t,r)}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):o=t.__e=function(e,t,r,n,i,s,a,o,l){var c,d,u,h,p,y,_,f=r.props,m=t.props,g=t.type;if("svg"==g?i="http://www.w3.org/2000/svg":"math"==g?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=s){for(c=0;c<s.length;c++)if((p=s[c])&&"setAttribute"in p==!!g&&(g?p.localName==g:3==p.nodeType)){e=p,s[c]=null;break}}if(null==e){if(null==g)return document.createTextNode(m);e=document.createElementNS(i,g,m.is&&m),o&&(eI.__m&&eI.__m(t,s),o=!1),s=null}if(null==g)f===m||o&&e.data==m||(e.data=m);else{if(s=s&&ek.call(e.childNodes),f=r.props||eM,!o&&null!=s)for(f={},c=0;c<e.attributes.length;c++)f[(p=e.attributes[c]).name]=p.value;for(c in f)if(p=f[c],"children"==c);else if("dangerouslySetInnerHTML"==c)u=p;else if(!(c in m)){if("value"==c&&"defaultValue"in m||"checked"==c&&"defaultChecked"in m)continue;eG(e,c,null,p,i)}for(c in m)p=m[c],"children"==c?h=p:"dangerouslySetInnerHTML"==c?d=p:"value"==c?y=p:"checked"==c?_=p:o&&"function"!=typeof p||f[c]===p||eG(e,c,p,f[c],i);if(d)o||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(u&&(e.innerHTML=""),eV("template"==t.type?e.content:e,eD(h)?h:[h],t,r,n,"foreignObject"==g?"http://www.w3.org/1999/xhtml":i,s,a,s?s[0]:r.__k&&ez(r,0),o,l),null!=s)for(c=s.length;c--;)eW(s[c]);o||(c="value","progress"==g&&null==y?e.removeAttribute("value"):null==y||y===e[c]&&("progress"!=g||y)&&("option"!=g||y==f[c])||eG(e,c,y,f[c],i),c="checked",null!=_&&_!=e[c]&&eG(e,c,_,f[c],i))}return e}(r.__e,t,r,n,i,s,a,l,c);return(d=eI.diffed)&&d(t),128&t.__u?void 0:o}function eZ(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(eZ)}function eX(e,t,r){for(var n=0;n<r.length;n++)eQ(r[n],r[++n],r[++n]);eI.__c&&eI.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){eI.__e(e,t.__v)}})}function eQ(e,t,r){try{if("function"==typeof e){var n="function"==typeof e.__u;n&&e.__u(),n&&null==t||(e.__u=e(t))}else e.current=t}catch(e){eI.__e(e,r)}}function e0(e,t,r){return this.constructor(e,r)}function e1(e,t,r){var n,i,s,a;t==document&&(t=document.documentElement),eI.__&&eI.__(e,t),i=(n="function"==typeof r)?null:r&&r.__k||t.__k,s=[],a=[],eJ(t,e=(!n&&r||t).__k=ej(eq,null,[e]),i||eM,eM,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?ek.call(t.childNodes):null,s,!n&&r?r:i?i.__e:t.firstChild,n,a),eX(s,e,a)}ek=eL.slice,eI={__e:function(e,t,r,n){for(var i,s,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&null!=s.getDerivedStateFromError&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(t){e=t}throw e}},eE=0,eB.prototype.setState=function(e,t){var r;r=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=eU({},this.state),"function"==typeof e&&(e=e(eU({},r),this.props)),e&&eU(r,e),null!=e&&this.__v&&(t&&this._sb.push(t),eH(this))},eB.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),eH(this))},eB.prototype.render=eq,eA=[],eS="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ex=function(e,t){return e.__v.__b-t.__v.__b},eK.__r=0,eC=/(PointerCapture)$|Capture$/i,eR=0,eP=eY(!1),eO=eY(!0);var e2,e5,e3,e4,e7=0,e8=[],e6=eI,e9=e6.__b,te=e6.__r,tt=e6.diffed,tr=e6.__c,tn=e6.unmount,ti=e6.__;function ts(e,t){e6.__h&&e6.__h(e5,e,e7||t),e7=0;var r=e5.__H||(e5.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ta(e,t,r){var n=ts(e2++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):tu(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=e5,!e5.__f)){var i=function(e,t,r){if(!n.__c.__H)return!0;var i=n.__c.__H.__.filter(function(e){return!!e.__c});if(i.every(function(e){return!e.__N}))return!s||s.call(this,e,t,r);var a=n.__c.props!==e;return i.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}}),s&&s.call(this,e,t,r)||a};e5.__f=!0;var s=e5.shouldComponentUpdate,a=e5.componentWillUpdate;e5.componentWillUpdate=function(e,t,r){if(this.__e){var n=s;s=void 0,i(e,t,r),s=n}a&&a.call(this,e,t,r)},e5.shouldComponentUpdate=i}return n.__N||n.__}function to(){for(var e;e=e8.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(tc),e.__H.__h.forEach(td),e.__H.__h=[]}catch(t){e.__H.__h=[],e6.__e(t,e.__v)}}e6.__b=function(e){e5=null,e9&&e9(e)},e6.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ti&&ti(e,t)},e6.__r=function(e){te&&te(e),e2=0;var t=(e5=e.__c).__H;t&&(e3===e5?(t.__h=[],e5.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.forEach(tc),t.__h.forEach(td),t.__h=[],e2=0)),e3=e5},e6.diffed=function(e){tt&&tt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==e8.push(t)&&e4===e6.requestAnimationFrame||((e4=e6.requestAnimationFrame)||function(e){var t,r=function(){clearTimeout(n),tl&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);tl&&(t=requestAnimationFrame(r))})(to)),t.__H.__.forEach(function(e){e.u&&(e.__H=e.u),e.u=void 0})),e3=e5=null},e6.__c=function(e,t){t.some(function(e){try{e.__h.forEach(tc),e.__h=e.__h.filter(function(e){return!e.__||td(e)})}catch(r){t.some(function(e){e.__h&&(e.__h=[])}),t=[],e6.__e(r,e.__v)}}),tr&&tr(e,t)},e6.unmount=function(e){tn&&tn(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(e){try{tc(e)}catch(e){t=e}}),r.__H=void 0,t&&e6.__e(t,r.__v))};var tl="function"==typeof requestAnimationFrame;function tc(e){var t=e5,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),e5=t}function td(e){var t=e5;e.__c=e.__(),e5=t}function tu(e,t){return"function"==typeof t?t(e):t}class th{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=eg()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){let t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&e1(ej("div",null,ej(tp,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,t])=>ej(ty,Object.assign({},t,{key:e}))))),this.root)}}let tp=e=>ej("div",{class:ev("-cbwsdk-snackbar-container")},ej("style",null,".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;
23cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}"),ej("div",{class:"-cbwsdk-snackbar"},e.children)),ty=({autoExpand:e,message:t,menuItems:r})=>{let[n,i]=(e7=1,ta(tu,!0)),[s,a]=(e7=1,ta(tu,null!=e&&e));return!function(e,t){var r,n,i=ts(e2++,3);!e6.__s&&(r=i.__H,n=void 0,!r||r.length!==n.length||n.some(function(e,t){return e!==r[t]}))&&(i.__=e,i.u=void 0,e5.__H.__h.push(i))}(()=>{let e=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{e.forEach(window.clearTimeout)}}),ej("div",{class:ev("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",s&&"-cbwsdk-snackbar-instance-expanded")},ej("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{a(!s)}},ej("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",ej("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),ej("div",{class:"-gear-container"},!s&&ej("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ej("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),ej("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwu
23NTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&ej("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map((e,t)=>ej("div",{class:ev("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},ej("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ej("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),ej("span",{class:ev("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info)))))},t_="M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z";class tf{constructor(){this.attached=!1,this.snackbar=new th}attach(){if(this.attached)throw Error("Coinbase Wallet SDK UI is already attached");let e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,ew()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:t_,defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}}class tm{constructor(){this.root=null,this.darkMode=eg()}attach(){let e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),ew()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(e1(null,this.root),e&&e1(ej(tg,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}let tg=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>ej(tp,{darkMode:r},ej("div",{class:"-cbwsdk-redirect-dialog"},ej("style",null,".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}
23.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}"),ej("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),ej("div",{class:ev("-cbwsdk-redirect-dialog-box",r?"dark":"light")},ej("p",null,e),ej("button",{onClick:n},t)))),tw="https://www.walletlink.org";class tv{constructor(){this.attached=!1,this.redirectDialog=new tm}attach(){if(this.attached)throw Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){let t=new URL("https://go.cb-w.com/walletlink");t.searchParams.append("redirect_url",function(){try{if(function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top)return window.top.location;return window.location}catch(e){return window.location}}().href),e&&t.searchParams.append("wl_url",e);let r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class tb{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null==(e=null==window?void 0:window.navigator)?void 0:e.userAgent)}(),this.linkedUpdated=e=>{this.isLinked=e;let t=this.storage.getItem(es);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){let r=t.split(" "),n="true"===this.storage.getItem("IsStandaloneSigning");""===r[0]||e||!this._session.linked||n||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{(this.chainCallbackParams.chainId!==e||this.chainCallbackParams.jsonRpcUrl!==t)&&(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(t,Number.parseInt(e,10)))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),tb.accountRequestCallbackIds.size>0&&(Array.from(tb.accountRequestCallbackIds.values()).forEach(t=>{this.invokeCallback(t,{method:"requestEthereumAccounts",result:[e]})}),tb.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;let{session:t,ui:r,connection:n}=this.subscribe();this._session=t,this.connection=n,this.relayEventManager=new eu,this.ui=r,this.ui.attach()}subscribe(){let e=em.load(this.storage)||em.create(this.storage),{linkAPIUrl:t}=this,r=new ed({session:e,linkAPIUrl:t,listener:this}),n=this.isMobileWeb?new tv:new tf;return r.connect(),{session:e,ui:n,connection:r}}resetAndReload(){this.connection.destroy().then(()=>{let e=em.load(this.storage);(null==e?void 0:e.id)===this._session.id&&n.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:T(e.weiValue),data:E(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?T(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?T(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?T(e.gasPriceInWei):null,gasLimit:e.gasLim
vendor: 4,172 bytes, line 23
23it?T(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:T(e.weiValue),data:E(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?T(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?T(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?T(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?T(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:E(e,!0),chainId:t}})}getWalletLinkSession(){return this._session}sendRequest(e){let t=null,r=b(8),n=n=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,n),null==t||t()};return new Promise((i,s)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:n,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,e=>{if(null==t||t(),ea(e))return s(Error(e.errorMessage));i(e)}),this.publishWeb3RequestEvent(r,e)})}publishWeb3RequestEvent(e,t){let r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(e=>{}).catch(e=>{this.handleWeb3ResponseMessage(r.id,{method:t.method,errorMessage:e.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof tv)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){this.publishEvent("Web3RequestCanceled",{type:"WEB3_REQUEST_CANCELED",id:e},!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e,t){if("requestEthereumAccounts"===t.method){tb.accountRequestCallbackIds.forEach(e=>this.invokeCallback(e,t)),tb.accountRequestCallbackIds.clear();return}this.invokeCallback(e,t)}handleErrorResponse(e,t,r){var n;let i=null!=(n=null==r?void 0:r.message)?n:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:t,errorMessage:i})}invokeCallback(e,t){let r=this.relayEventManager.callbacks.get(e);r&&(r(t),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){let{appName:e,appLogoUrl:t}=this.metadata,r={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:t}},n=b(8);return new Promise((e,t)=>{this.relayEventManager.callbacks.set(n,r=>{if(ea(r))return t(Error(r.errorMessage));e(r)}),tb.accountRequestCallbackIds.add(n),this.publishWeb3RequestEvent(n,r)})}watchAsset(e,t,r,n,i,s){let a={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:n,image:i},chainId:s}},o=null,l=b(8),c=e=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:c,onResetConnection:this.resetAndReload}),new Promise((e,t)=>{this.relayEventManager.callbacks.set(l,r=>{if(null==o||o(),ea(r))return t(Error(r.errorMessage));e(r)}),this.publishWeb3RequestEvent(l,a)})}addEthereumChain(e,t,r,n,i,s){let a={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:n,chainName:i,iconUrls:r,nativeCurrency:s}},o=null,l=b(8),c=e=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:c,onResetConnection:this.resetAndReload}),new Promise((e,t)=>{this.relayEventManager.callbacks.set(l,r=>{if(null==o||o(),ea(r))return t(Error(r.errorMessage));e(r)}),this.publishWeb3RequestEvent(l,a)})}switchEthereumChain(e,t){let r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},n=null,i=b(8),s=e=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,r.method,e),null==n||n()};return n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),new Promise((e,t)=>
23{this.relayEventManager.callbacks.set(i,r=>(null==n||n(),ea(r)&&r.errorCode)?t(u.provider.custom({code:r.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):ea(r)?t(Error(r.errorMessage)):void e(r)),this.publishWeb3RequestEvent(i,r)})}}tb.accountRequestCallbackIds=new Set;var tk=r(51642).Buffer;let tI="DefaultChainId",tE="DefaultJsonRpcUrl";class tA{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new n("walletlink",tw),this.callback=e.callback||null;let t=this._storage.getItem(es);if(t){let e=t.split(" ");""!==e[0]&&(this._addresses=e.map(e=>M(e)))}this.initializeRelay()}getSession(){let{id:e,secret:t}=this.initializeRelay().getWalletLinkSession();return{id:e,secret:t}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!=(e=this._storage.getItem(tE))?e:void 0}set jsonRpcUrl(e){this._storage.setItem(tE,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;let n=this.getChainId();this._storage.setItem(tI,t.toString(10)),N(t)!==n&&(null==(r=this.callback)||r.call(this,"chainChanged",S(t)))}async watchAsset(e){let t=Array.isArray(e)?e[0]:e;if(!t.type)throw u.rpc.invalidParams("Type is required");if((null==t?void 0:t.type)!=="ERC20")throw u.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw u.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw u.rpc.invalidParams("Address is required");let r=this.getChainId(),{address:n,symbol:i,image:s,decimals:a}=t.options,o=this.initializeRelay(),l=await o.watchAsset(t.type,n,i,a,s,null==r?void 0:r.toString());return!ea(l)&&!!l.result}async addEthereumChain(e){var t,r;let n=e[0];if((null==(t=n.rpcUrls)?void 0:t.length)===0)throw u.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!n.chainName||""===n.chainName.trim())throw u.rpc.invalidParams("chainName is a required field");if(!n.nativeCurrency)throw u.rpc.invalidParams("nativeCurrency is a required field");let i=Number.parseInt(n.chainId,16);if(i===this.getChainId())return!1;let s=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:o=[],chainName:l,iconUrls:c=[],nativeCurrency:d}=n,h=await s.addEthereumChain(i.toString(),a,c,o,l,d);if(ea(h))return!1;if((null==(r=h.result)?void 0:r.isApproved)===!0)return this.updateProviderInfo(a[0],i),null;throw u.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){let t=Number.parseInt(e[0].chainId,16),r=this.initializeRelay(),n=await r.switchEthereumChain(t.toString(10),this.selectedAddress||void 0);if(ea(n))throw n;let i=n.result;return i.isApproved&&i.rpcUrl.length>0&&this.updateProviderInfo(i.rpcUrl,t),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,t){var r;if(!Array.isArray(e))throw Error("addresses is not an array");let n=e.map(e=>M(e));JSON.stringify(n)!==JSON.stringify(this._addresses)&&(this._addresses=n,null==(r=this.callback)||r.call(this,"accountsChanged",n),this._storage.setItem(es,n.join(" ")))}async request(e){let t=e.params||[];switch(e.method){case"eth_accounts":return[...this._addresses];case"eth_coinbase":return this.selectedAddress||null;case"net_version":return this.getChainId().toString(10);case"eth_chainId":return S(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(t);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(t);case"eth_sendTransaction":return this._eth_sendTransaction(t);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(t);case"wallet_switchEthereumChain":return this.switchEthereumChain(t);case"wallet_watchAsset":return this.watchAsset(t);default:if(!this.jsonRpcUrl)throw u.rpc.internal("No RPC URL set for chain");return X(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){let t=M(e);if(!this._addresses.map(e=>M(e)).includes(t))throw Error("Unknown Ethereum address")}_prepareTransactionParams(e){let t=e.from?M(e.from):this.selectedAddress;if(!t)throw Error("Ethereum address is unavailable");this._ensureKnownAddress(t);let r=e.to?M(e.to):null,n=null!=e.value?D(e.value):BigInt(0),i=e.data?L(e.data):tk.alloc(0),s=null!=e.nonce?N(e.n
vendor: 4,121 bytes, lines 23-25
23once):null,a=null!=e.gasPrice?D(e.gasPrice):null,o=null!=e.maxFeePerGas?D(e.maxFeePerGas):null,l=null!=e.maxPriorityFeePerGas?D(e.maxPriorityFeePerGas):null;return{fromAddress:t,toAddress:r,weiValue:n,data:i,nonce:s,gasPriceInWei:a,maxFeePerGas:o,maxPriorityFeePerGas:l,gasLimit:null!=e.gas?D(e.gas):null,chainId:e.chainId?N(e.chainId):this.getChainId()}}async ecRecover(e){let{method:t,params:r}=e;if(!Array.isArray(r))throw u.rpc.invalidParams();let n=this.initializeRelay(),i=await n.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:A(r[0]),signature:A(r[1]),addPrefix:"personal_ecRecover"===t}});if(ea(i))throw i;return i.result}getChainId(){var e;return Number.parseInt(null!=(e=this._storage.getItem(tI))?e:"1",10)}async _eth_requestAccounts(){var e,t;if(this._addresses.length>0)return null==(e=this.callback)||e.call(this,"connect",{chainId:S(this.getChainId())}),this._addresses;let r=this.initializeRelay(),n=await r.requestEthereumAccounts();if(ea(n))throw n;if(!n.result)throw Error("accounts received is empty");return this._setAddresses(n.result),null==(t=this.callback)||t.call(this,"connect",{chainId:S(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw u.rpc.invalidParams();let t=e[1],r=e[0];this._ensureKnownAddress(t);let n=this.initializeRelay(),i=await n.sendRequest({method:"signEthereumMessage",params:{address:M(t),message:A(r),addPrefix:!0,typedDataJson:null}});if(ea(i))throw i;return i.result}async _eth_signTransaction(e){let t=this._prepareTransactionParams(e[0]||{}),r=this.initializeRelay(),n=await r.signEthereumTransaction(t);if(ea(n))throw n;return n.result}async _eth_sendRawTransaction(e){let t=L(e[0]),r=this.initializeRelay(),n=await r.submitEthereumTransaction(t,this.getChainId());if(ea(n))throw n;return n.result}async _eth_sendTransaction(e){let t=this._prepareTransactionParams(e[0]||{}),r=this.initializeRelay(),n=await r.signAndSubmitEthereumTransaction(t);if(ea(n))throw n;return n.result}async signTypedData(e){let{method:t,params:r}=e;if(!Array.isArray(r))throw u.rpc.invalidParams();let n=r[+("eth_signTypedData_v1"===t)],i=r[+("eth_signTypedData_v1"!==t)];this._ensureKnownAddress(n);let s=this.initializeRelay(),a=await s.sendRequest({method:"signEthereumMessage",params:{address:M(n),message:E(({eth_signTypedData_v1:ei.hashForSignTypedDataLegacy,eth_signTypedData_v3:ei.hashForSignTypedData_v3,eth_signTypedData_v4:ei.hashForSignTypedData_v4,eth_signTypedData:ei.hashForSignTypedData_v4})[t]({data:function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw u.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}(i)}),!0),typedDataJson:JSON.stringify(i,null,2),addPrefix:!1}});if(ea(a))throw a;return a.result}initializeRelay(){return this._relay||(this._relay=new tb({linkAPIUrl:tw,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}let tT="SignerType",tS=new n("CBWSDK","SignerConfigurator");async function tx(e){let{communicator:t,metadata:r,handshakeRequest:n,callback:i}=e;tC(t,r,i).catch(()=>{});let s={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},e.preference),{handshakeRequest:n})},{data:a}=await t.postRequestAndWaitForResponse(s);return a}async function tC(e,t,r){await e.onMessage(({event:e})=>"WalletLinkSessionRequest"===e);let n=new tA({metadata:t,callback:r});e.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}let tR=`Coinbase Wallet SDK requires the Cross-Origin-Opener-Policy header to not be set to 'same-origin'. This is to ensure that the SDK can communicate with the Coinbase Smart Wallet app.
24
25Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,{checkCrossOriginOpenerPolicy:tP,getCrossOriginOpenerPolicy:tO}=(()=>{let e;return{getCrossOriginOpenerPolicy:()=>void 0===e?"undefined":e,checkCrossOriginOpenerPolicy:async()=>
25{if("undefined"==typeof window){e="non-browser-env";return}try{let t=`${window.location.origin}${window.location.pathname}`,r=await fetch(t,{method:"HEAD"});if(!r.ok)throw Error(`HTTP error! status: ${r.status}`);let n=r.headers.get("Cross-Origin-Opener-Policy");e=null!=n?n:"null","same-origin"===e&&console.error(tR)}catch(t){console.error("Error checking Cross-Origin-Opener-Policy:",t.message),e="error"}}}})(),tM={isRed:!1,info:"Retry",svgWidth:"10",svgHeight:"11",path:t_,defaultFillRule:"evenodd",defaultClipRule:"evenodd"},tL=null;class tN{constructor({url:e="https://keys.coinbase.com/connect",metadata:t,preference:r}){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{let t=this.onMessage(({requestId:t})=>t===e.id);return this.postMessage(e),await t},this.onMessage=async e=>new Promise((t,r)=>{let n=r=>{if(r.origin!==this.url.origin)return;let i=r.data;e(i)&&(t(i),window.removeEventListener("message",n),this.listeners.delete(n))};window.addEventListener("message",n),this.listeners.set(n,{reject:r})}),this.disconnect=()=>{!function(e){e&&!e.closed&&e.close()}(this.popup),this.popup=null,this.listeners.forEach(({reject:e},t)=>{e(u.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=await function(e){let t=(window.innerWidth-420)/2+window.screenX,r=(window.innerHeight-540)/2+window.screenY;function n(){let n=`wallet_${crypto.randomUUID()}`,i=window.open(e,n,`width=420, height=540, left=${t}, top=${r}`);return(null==i||i.focus(),i)?i:null}var i=e;for(let[e,t]of Object.entries({sdkName:Z,sdkVersion:J,origin:window.location.origin,coop:tO()}))i.searchParams.append(e,t.toString());let s=n();if(!s){let e=function(){if(!tL){let e=document.createElement("div");e.className="-cbwsdk-css-reset",document.body.appendChild(e),(tL=new th).attach(e)}return tL}();return new Promise((t,r)=>{e.presentItem({autoExpand:!0,message:"Popup was blocked. Try again.",menuItems:[Object.assign(Object.assign({},tM),{onClick:()=>{(s=n())?t(s):r(u.rpc.internal("Popup window was blocked")),e.clear()}})]})})}return Promise.resolve(s)}(this.url),this.onMessage(({event:e})=>"PopupUnload"===e).then(this.disconnect).catch(()=>{}),this.onMessage(({event:e})=>"PopupLoaded"===e).then(e=>{this.postMessage({requestId:e.id,data:{version:J,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw u.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=t,this.preference=r}}var tD=r(52212);class tU extends tD.b{}var tW=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r};class tj extends tU{constructor(e){var{metadata:t}=e,r=e.preference,{keysUrl:n}=r,i=tW(r,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=t,this.preference=i,this.communicator=new tN({url:n,metadata:t,preference:i});let s=tS.getItem(tT);s&&(this.signer=this.initSigner(s))}async request(e){try{if(!e||"object"!=typeof e||Array.isArray(e))throw u.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});let{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw u.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw u.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e});switch(t){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw u.provider.unsupportedMethod()}if(!this.signer)switch(e.method){case"eth_requestAccounts":{let t=await this.requestSignerSelection(e),r=this.initSigner(t);await r.handshake(e),this.signer=r,tS.setItem(tT,t);break}case"wallet_sendCalls":{let t=this.initSigner("scw");await t.handshake({method:"handshake"});let r=await t.request(e);return await t.cleanup(),r}case"wallet_getCallsStatus":return X(e,"https://rpc.wallet.coinbase.com");case"net_version":return 1;case"eth_chainId":return S(1);default:throw u.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(e)}catch(t){let{code:e}=t;return e===i.provider.unauthorized&&this.disconnect(),Promise.reject(function(e){let t=function(e,{shouldIncludeStack:t=!1}={}){var r,n;let u={};if(e&&"object"==typeof e&&!Array.isArray(e)&&c(e,"code")&&Number.isInteger(r=e.code)&&(s[r.toString()]||(n=r)>=-32099&&n<=-32e3))u.code=e.code,e.message&&"string"==typeof e.message?(u.message=e.message,c(e,"data")&&(u.data=e.data)):(u.message=o(u.code),u.data={originalError:l(e)});else u.code=i.rpc.internal,u.message=d(e,"message")?e.message:a,u.data={originalError:l(e)};return t&&(u.stack=d(e,"stack")?e.stack:void 0),u}(function(e){var t;if("string"==typeof e)return{message:e,code:i.rpc.internal};if(ea(e)){let r=e.errorMessage,n=null!=(t=e.errorCode)?t:r.match(/(denied|rejected)/i)?i.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},e),{message:r,code:n,data:{method:e.method}})}return e}(e),{shouldIncludeStack:!0}
25),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return r.searchParams.set("version",J),r.searchParams.set("code",t.code.toString()),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}(t))}}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){var e;await (null==(e=this.signer)?void 0:e.cleanup()),this.signer=null,n.clearAll(),this.emit("disconnect",u.provider.disconnected("User initiated disconnection"))}requestSignerSelection(e){return tx({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:e,callback:this.emit.bind(this)})}initSigner(e){let{signerType:t,metadata:r,communicator:n,callback:i}={signerType:e,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)};switch(t){case"scw":return new en({metadata:r,callback:i,communicator:n});case"walletlink":return new tA({metadata:r,callback:i})}}}let tF={options:"all"};function tq(e){new n("CBWSDK").setItem("VERSION",J),tP();let t={metadata:{appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||"",appChainIds:e.appChainIds||[]},preference:Object.assign(tF,null!=(r=e.preference)?r:{})};var r,i=t.preference;if(i){if(!["all","smartWalletOnly","eoaOnly"].includes(i.options))throw Error(`Invalid options: ${i.options}`);if(i.attribution&&void 0!==i.attribution.auto&&void 0!==i.attribution.dataSuffix)throw Error("Attribution cannot contain both auto and dataSuffix properties")}let s=null;return{getProvider:()=>(s||(s=function(e){var t;let r={metadata:e.metadata,preference:e.preference};return null!=(t=function({metadata:e,preference:t}){var r,n;let{appName:i,appLogoUrl:s,appChainIds:a}=e;if("smartWalletOnly"!==t.options){let e=globalThis.coinbaseWalletExtension;if(e)return null==(r=e.setAppInfo)||r.call(e,i,s,a,t),e}let o=function(){var e,t;try{let r=globalThis;return null!=(e=r.ethereum)?e:null==(t=r.top)?void 0:t.ethereum}catch(e){return}}();if(null==o?void 0:o.isCoinbaseBrowser)return null==(n=o.setAppInfo)||n.call(o,i,s,a,t),o}(r))?t:new tj(r)}(t)),s)}}},25182:(e,t,r)=>{"use strict";r.d(t,{ii:()=>s,kc:()=>n,rN:()=>a,xF:()=>i});let n={path:"/api/v1/mfa_auth/totp/enroll",method:"POST"},i={path:"/api/v1/mfa_auth/totp/verify",method:"POST"},s={path:"/api/v1/mfa_auth/totp/init",method:"POST"},a={path:"/api/v1/mfa_auth/totp/unenroll",method:"POST"}},25920:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{fillRule:"evenodd",d:"M12.516 2.17a.75.75 0 0 0-1.032 0 11.209 11.209 0 0 1-7.877 3.08.75.75 0 0 0-.722.515A12.74 12.74 0 0 0 2.25 9.75c0 5.942 4.064 10.933 9.563 12.348a.749.749 0 0 0 .374 0c5.499-1.415 9.563-6.406 9.563-12.348 0-1.39-.223-2.73-.635-3.985a.75.75 0 0 0-.722-.516l-.143.001c-2.996 0-5.717-1.17-7.734-3.08Zm3.094 8.016a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))})},28018:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))})},29911:(e,t,r)=>{"use strict";let n;r.d(t,{A:()=>o});let i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},s=new Uint8Array(16),a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));let o=function(e,t,r){if(i.randomUUID&&!t&&!e)return i.randomUUID();let o=(e=e||{}).random||(e.rng||function(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(s)})();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=o[e];return t}
25return function(e,t=0){return a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]}(o)}},31526:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 1.5H8.25A2.25 2.25 0 0 0 6 3.75v16.5a2.25 2.25 0 0 0 2.25 2.25h7.5A2.25 2.25 0 0 0 18 20.25V3.75a2.25 2.25 0 0 0-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"}))})},32688:(e,t,r)=>{"use strict";r.d(t,{VQ:()=>n,gn:()=>s,wE:()=>i});class n extends Error{constructor({error:e,code:t}){super(e),this.error=e,this.code=t}}class i extends Error{constructor({error:e,code:t}){super(e),this.code=t,this.error=e}}class s extends Error{constructor({error:e,code:t,response:r}){super(e),this.code=t,this.error=e,this.response=r}}},36054:(e,t,r)=>{"use strict";r.d(t,{u:()=>s});var n=r(64919),i=r(9858);function s(e){let{r:t,s:r}=n.secp256k1.Signature.fromCompact(e.slice(2,130)),s=Number(`0x${e.slice(130)}`),[a,o]=(()=>{if(0===s||1===s)return[void 0,s];if(27===s)return[BigInt(s),0];if(28===s)return[BigInt(s),1];throw Error("Invalid yParityOrV value")})();return void 0!==a?{r:(0,i.cK)(t,{size:32}),s:(0,i.cK)(r,{size:32}),v:a,yParity:o}:{r:(0,i.cK)(t,{size:32}),s:(0,i.cK)(r,{size:32}),yParity:o}}},39105:(e,t,r)=>{"use strict";r.d(t,{Rn:()=>n,Vm:()=>s,yE:()=>i});let n={path:"/api/v1/mfa_auth/passkeys/init",method:"POST"},i={path:"/api/v1/mfa_auth/passkeys/verify",method:"POST"},s={path:"/api/v1/mfa_auth/passkeys/enrollment",method:"POST"}},42270:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=void 0,t.keccakP=w;let n=r(67247),i=r(72274),s=BigInt(0),a=BigInt(1),o=BigInt(2),l=BigInt(7),c=BigInt(256),d=BigInt(113),u=[],h=[],p=[];for(let e=0,t=a,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],u.push(2*(5*n+r)),h.push((e+1)*(e+2)/2%64);let i=s;for(let e=0;e<7;e++)(t=(t<<a^(t>>l)*d)%c)&o&&(i^=a<<(a<<BigInt(e))-a);p.push(i)}let y=(0,n.split)(p,!0),_=y[0],f=y[1],m=(e,t,r)=>r>32?(0,n.rotlBH)(e,t,r):(0,n.rotlSH)(e,t,r),g=(e,t,r)=>r>32?(0,n.rotlBL)(e,t,r):(0,n.rotlSL)(e,t,r);function w(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,s=r[i],a=r[i+1],o=m(s,a,1)^r[n],l=g(s,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=o,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=h[r],s=m(t,i,n),a=g(t,i,n),o=u[r];t=e[o],i=e[o+1],e[o]=s,e[o+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=_[n],e[1]^=f[n]}(0,i.clean)(r)}class v extends i.Hash{constructor(e,t,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,(0,i.anumber)(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.swap32IfBE)(this.state32),w(this.state32,this.rounds),(0,i.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.aexists)(this),e=(0,i.toBytes)(e),(0,i.abytes)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.aexists)(this,!1),(0,i.abytes)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.aoutput)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.clean)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new v(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}t.Keccak=v;let b=(e,t,r)=>(0,i.createHasher)(()=>new v(t,e,r));t.sha3_224=b(6,144,28),t.sha3_256=b(6,136,32),t.sha3_384=b(6,104,48),t.sha3_512=b(6,72,64),t.keccak_224=b(1,144,28),t.keccak_256=b(1,136,32),t.keccak_384=b(1,104,48),t.keccak_512=b(1,72,64);let k=(e,t,r)=>(0,i.createXOFer)((n={})=>new v(t,e,void 0===n.dkLen?r:n.dkLen,!0));t.shake128=k(31,168,16),t.shake256=k(31,136,32)},45488:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(5078).A)("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]])},45997:(e,t,r)=>{"use strict";r.d(t,{a:()=>s});var n=r(55729),i=r(40076);function s(){let e=(0,n.useRef)(!1);return(0,i.s)(()=>(e.current=!0,()=>{e.current=!1}),[]),e}},46887:(e,t,r)=>{"use strict";function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}r.d(t,{A:()=>i});var i=function e(t,r){function i(e,i,s){if("undefined"!=typeof document){"number"==typeof(s=n({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decode
25URIComponent).replace(/[()]/g,escape);var a="";for(var o in s)s[o]&&(a+="; "+o,!0!==s[o]&&(a+="="+s[o].split(";")[0]));return document.cookie=e+"="+t.write(i,e)+a}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],n={},i=0;i<r.length;i++){var s=r[i].split("="),a=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(n[o]=t.read(a,o),e===o)break}catch(e){}}return e?n[e]:n}},remove:function(e,t){i(e,"",n({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,n({},this.attributes,t))},withConverter:function(t){return e(n({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})},52180:e=>{"use strict";e.exports=function e(t){if("number"==typeof t&&isNaN(t))throw Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw Error("Infinity is not allowed");if(null===t||"object"!=typeof t)return JSON.stringify(t);if(t.toJSON instanceof Function)return e(t.toJSON());if(Array.isArray(t)){let r=t.reduce((t,r,n)=>`${t}${0===n?"":","}${e(void 0===r||"symbol"==typeof r?null:r)}`,"");return`[${r}]`}let r=Object.keys(t).sort().reduce((r,n)=>{if(void 0===t[n]||"symbol"==typeof t[n])return r;let i=0===r.length?"":",";return`${r}${i}${e(n)}:${e(t[n])}`},"");return`{${r}}`}},54258:(e,t,r)=>{"use strict";function n(){let e=new Set,t=[],r=()=>(function(e){if("undefined"==typeof window)return;let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(r=>{t.some(({info:e})=>e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))}),n=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),n?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),n?.(),n=r()},subscribe:(r,{emitImmediately:n}={})=>(e.add(r),n&&r(t,{added:t}),()=>e.delete(r))}}r.d(t,{y:()=>n})},55267:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"}))})},61982:(e,t,r)=>{"use strict";r.d(t,{lG:()=>ea,Lj:()=>es});var n=r(55729),i=r(81665),s=r(98907);function a(e,t,r,i){let a=(0,s.Y)(r);(0,n.useEffect)(()=>{function r(e){a.current(e)}return(e=null!=e?e:window).addEventListener(t,r,i),()=>e.removeEventListener(t,r,i)},[e,t,i])}var o=r(12054),l=r(49076),c=r(36628),d=r(40076),u=r(4993),h=r(69294),p=r(15779),y=r(35521),_=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(_||{});let f=(0,y.FX)(function(e,t){var r;let{features:n=1,...i}=e,s={ref:t,"aria-hidden":(2&n)==2||(null!=(r=i["aria-hidden"])?r:void 0),hidden:(4&n)==4||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(4&n)==4&&(2&n)!=2&&{display:"none"}}};return(0,y.Ci)()({ourProps:s,theirProps:i,slot:{},defaultTag:"span",name:"Hidden"})});var m=r(10899),g=r(83048);let w=(0,n.createContext)(null);function v(e){let{children:t,node:r}=e,[i,s]=(0,n.useState)(null),a=b(null!=r?r:i);return n.createElement(w.Provider,{value:a},t,null===a&&n.createElement(f,{features:_.Hidden,ref:e=>{var t,r;if(e){for(let n of null!=(r=null==(t=(0,g.TW)(e))?void 0:t.querySelectorAll("html > *, body > *"))?r:[])if(n!==document.body&&n!==document.head&&m.vq(n)&&null!=n&&n.contains(e)){s(n);break}}}}))}function b(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null!=(e=(0,n.useContext)(w))?e:t}
25var k=r(11925),I=r(63804),E=r(31724),A=r(59772);let T=(0,n.createContext)(()=>{});function S(e){let{value:t,children:r}=e;return n.createElement(T.Provider,{value:t},r)}var x=r(23126),C=r(19582),R=r(56894),P=r(38064),O=r(81022),M=r(12871),L=r(8363),N=r(45997),D=r(5372),U=r(58921),W=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(W||{});function j(e,t){let r=(0,n.useRef)([]),i=(0,l._)(e);(0,n.useEffect)(()=>{let e=[...r.current];for(let[n,s]of t.entries())if(r.current[n]!==s){let n=i(t,e);return r.current=t,n}},[i,...t])}var F=r(62125);let q=[];!function(e){function t(){"loading"!==document.readyState&&(e(),document.removeEventListener("DOMContentLoaded",t))}"undefined"!=typeof document&&(document.addEventListener("DOMContentLoaded",t),t())}(()=>{function e(e){if(!m.Lk(e.target)||e.target===document.body||q[0]===e.target)return;let t=e.target;t=t.closest(F.Uo),q.unshift(null!=t?t:e.target),(q=q.filter(e=>null!=e&&e.isConnected)).splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});var B=r(36507);function z(e){if(!e)return new Set;if("function"==typeof e)return new Set(e());let t=new Set;for(let r of e.current)m.vq(r.current)&&t.add(r.current);return t}var H=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(H||{});let K=Object.assign((0,y.FX)(function(e,t){let r,i=(0,n.useRef)(null),s=(0,A.P)(i,t),{initialFocus:c,initialFocusFallback:d,containers:u,features:h=15,...w}=e;(0,I.g)()||(h=0);let v=(0,p.g)(i.current);!function(e,t){let{ownerDocument:r}=t,i=!!(8&e),s=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,n.useRef)(q.slice());return j((e,r)=>
25{let[n]=e,[i]=r;!0===i&&!1===n&&(0,B._)(()=>{t.current.splice(0)}),!1===i&&!0===n&&(t.current=q.slice())},[e,q,t]),(0,l._)(()=>{var e;return null!=(e=t.current.find(e=>null!=e&&e.isConnected))?e:null})}(i);j(()=>{i||(0,g.X7)(null==r?void 0:r.body)&&(0,F.pW)(s())},[i]),(0,D.X)(()=>{i&&(0,F.pW)(s())})}(h,{ownerDocument:v});let b=function(e,t){let{ownerDocument:r,container:i,initialFocus:s,initialFocusFallback:a}=t,l=(0,n.useRef)(null),c=(0,o.S)(!!(1&e),"focus-trap#initial-focus"),d=(0,N.a)();return j(()=>{if(0===e)return;if(!c){null!=a&&a.current&&(0,F.pW)(a.current);return}let t=i.current;t&&(0,B._)(()=>{if(!d.current)return;let n=null==r?void 0:r.activeElement;if(null!=s&&s.current){if((null==s?void 0:s.current)===n){l.current=n;return}}else if(t.contains(n)){l.current=n;return}if(null!=s&&s.current)(0,F.pW)(s.current);else{if(16&e){if((0,F.CU)(t,F.BD.First|F.BD.AutoFocus)!==F.Me.Error)return}else if((0,F.CU)(t,F.BD.First)!==F.Me.Error)return;if(null!=a&&a.current&&((0,F.pW)(a.current),(null==r?void 0:r.activeElement)===a.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}l.current=null==r?void 0:r.activeElement})},[a,c,e]),l}(h,{ownerDocument:v,container:i,initialFocus:c,initialFocusFallback:d});!function(e,t){let{ownerDocument:r,container:n,containers:i,previousActiveElement:s}=t,o=(0,N.a)(),l=!!(4&e);a(null==r?void 0:r.defaultView,"focus",e=>{if(!l||!o.current)return;let t=z(i);m.sb(n.current)&&t.add(n.current);let r=s.current;if(!r)return;let a=e.target;m.sb(a)?V(t,a)?(s.current=a,(0,F.pW)(a)):(e.preventDefault(),e.stopPropagation(),(0,F.pW)(r)):(0,F.pW)(s.current)},!0)}(h,{ownerDocument:v,container:i,containers:u,previousActiveElement:b});let k=(r=(0,n.useRef)(0),(0,U.M)(!0,"keydown",e=>{"Tab"===e.key&&(r.current=+!!e.shiftKey)},!0),r),E=(0,l._)(e=>{if(!m.sb(i.current))return;let t=i.current;(0,O.Y)(k.current,{[W.Forwards]:()=>{(0,F.CU)(t,F.BD.First,{skipElements:[e.relatedTarget,d]})},[W.Backwards]:()=>{(0,F.CU)(t,F.BD.Last,{skipElements:[e.relatedTarget,d]})}})}),T=(0,o.S)(!!(2&h),"focus-trap#tab-lock"),S=(0,L.L)(),x=(0,n.useRef)(!1),C=(0,y.Ci)();return n.createElement(n.Fragment,null,T&&n.createElement(f,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:_.Focusable}),C({ourProps:{ref:s,onKeyDown(e){"Tab"==e.key&&(x.current=!0,S.requestAnimationFrame(()=>{x.current=!1}))},onBlur(e){if(!(4&h))return;let t=z(u);m.sb(i.current)&&t.add(i.current);let r=e.relatedTarget;m.Lk(r)&&"true"!==r.dataset.headlessuiFocusGuard&&(V(t,r)||(x.current?(0,F.CU)(i.current,(0,O.Y)(k.current,{[W.Forwards]:()=>F.BD.Next,[W.Backwards]:()=>F.BD.Previous})|F.BD.WrapAround,{relativeTo:e.target}):m.Lk(e.target)&&(0,F.pW)(e.target)))}},theirProps:w,defaultTag:"div",name:"FocusTrap"}),T&&n.createElement(f,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:E,features:_.Focusable}))}),{features:H});function V(e,t){for(let r of e)if(r.contains(t))return!0;return!1}var $=r(55741),G=r(20587),Y=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Y||{}),J=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(J||{});let Z={0:(e,t)=>e.titleId===t.id?e:{...e,titleId:t.id}},X=(0,n.createContext)(null);function Q(e){let t=(0,n.useContext)(X);if(null===t){let t=Error("<".concat(e," /> is missing a parent <Dialog /> component."));throw Error.captureStackTrace&&Error.captureStackTrace(t,Q),t}return t}function ee(e,t){return(0,O.Y)(t.type,Z,e,t)}X.displayName="DialogContext";let et=(0,y.FX)(function(e,t){let r=(0,n.useId)(),{id:s="headlessui-dialog-".concat(r),open:_,onClose:f,initialFocus:w,role:v="dialog",autoFocus:T=!0,__demoMode:O=!1,unmount:L=!1,...N}=e,D=(0,n.useRef)(!1);v="dialog"===v||"alertdialog"===v?v:(D.current||(D.current=!0,console.warn("Invalid role [".concat(v,"] passed to <Dialog />. Only `dialog` and and `alertdialog` are supported. Using `dialog` instead."))),"dialog");let U=(0,x.O_)();void 0===_&&null!==U&&(_=(U&x.Uw.Open)===x.Uw.Open);let W=(0,n.useRef)(null),j=(0,A.P)(W,t),F=(0,p.g)(W.current),q=+!_,[B,z]=(0,n.useReducer)(ee,{titleId:null,descriptionId:null,panelRef:(0,n.createRef)()}),V=(0,l._)(()=>f(!1)),G=(0,l._)(e=>z({type:0,id:e})),Y=!!(0,I.g)()&&0===q,[J,Z]=(0,$.k2)(),Q=b(),{resolveContainers:et}=function(){let{defaultContainers:e=[],portals:t,mainTreeNode:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(0,l._)(()=>{var n,i;let s=(0,g.TW)(r),a=[];for(let t of e)null!==t&&(m.vq(t)?a.push(t):"current"in t&&m.vq(t.current)&&a.push(t.current));if(null!=t&&t.current)for(let e of t.current)a.push(e);for(let e of null!=(n=null==s?void 0:s.querySelectorAll("html > *, body > *"))?n:[])e!==document.body&&e!==document.head&&m.vq(e)&&"headlessui-portal-root"!==e.id&&(r&&(e.contains(r)||e.contains(null==(i=null==r?void 0:r.getRootNode())?void 0:i.host))||a.some(t=>e.contains(t))||a.push(e));return a});
25return{resolveContainers:n,contains:(0,l._)(e=>n().some(t=>t.contains(e)))}}({mainTreeNode:Q,portals:J,defaultContainers:[{get current(){var ei;return null!=(ei=B.panelRef.current)?ei:W.current}}]}),es=null!==U&&(U&x.Uw.Closing)===x.Uw.Closing;(0,c.v)(!O&&!es&&Y,{allowed:(0,l._)(()=>{var e,t;return[null!=(t=null==(e=W.current)?void 0:e.closest("[data-headlessui-portal]"))?t:null]}),disallowed:(0,l._)(()=>{var e;return[null!=(e=null==Q?void 0:Q.closest("body > *:not(#headlessui-portal-root)"))?e:null]})});let ea=R.D.get(null);(0,d.s)(()=>{if(Y)return ea.actions.push(s),()=>ea.actions.pop(s)},[ea,s,Y]);let eo=(0,P.y)(ea,(0,n.useCallback)(e=>ea.selectors.isTop(e,s),[ea,s]));(0,h.j)(eo,et,e=>{e.preventDefault(),V()}),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"undefined"!=typeof document?document.defaultView:null,r=arguments.length>2?arguments[2]:void 0,n=(0,o.S)(e,"escape");a(t,"keydown",e=>{n&&(e.defaultPrevented||e.key===i.D.Escape&&r(e))})}(eo,null==F?void 0:F.defaultView,e=>{e.preventDefault(),e.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&"function"==typeof document.activeElement.blur&&document.activeElement.blur(),V()}),(0,k.K)(!O&&!es&&Y,F,et),(0,u.O)(Y,W,V);let[el,ec]=(0,M.rU)(),ed=(0,n.useMemo)(()=>[{dialogState:q,close:V,setTitleId:G,unmount:L},B],[q,V,G,L,B]),eu=(0,E._)({open:0===q}),eh={ref:j,id:s,role:v,tabIndex:-1,"aria-modal":O?void 0:0===q||void 0,"aria-labelledby":B.titleId,"aria-describedby":el,unmount:L},ep=!function(){var e;let[t]=(0,n.useState)(()=>"function"==typeof window.matchMedia?window.matchMedia("(pointer: coarse)"):null),[r,i]=(0,n.useState)(null!=(e=null==t?void 0:t.matches)&&e);return(0,d.s)(()=>{if(t)return t.addEventListener("change",e),()=>t.removeEventListener("change",e);function e(e){i(e.matches)}},[t]),r}(),ey=H.None;Y&&!O&&(ey|=H.RestoreFocus,ey|=H.TabLock,T&&(ey|=H.AutoFocus),ep&&(ey|=H.InitialFocus));let e_=(0,y.Ci)();return n.createElement(x.$x,null,n.createElement(C.a,{force:!0},n.createElement($.ZL,null,n.createElement(X.Provider,{value:ed},n.createElement($.Ee,{target:W},n.createElement(C.a,{force:!1},n.createElement(ec,{slot:eu},n.createElement(Z,null,n.createElement(K,{initialFocus:w,initialFocusFallback:W,containers:et,features:ey},n.createElement(S,{value:V},e_({ourProps:eh,theirProps:N,slot:eu,defaultTag:er,features:en,visible:0===q,name:"Dialog"})))))))))))}),er="div",en=y.Ac.RenderStrategy|y.Ac.Static,ei=(0,y.FX)(function(e,t){let{transition:r=!1,open:i,...s}=e,a=(0,x.O_)(),o=e.hasOwnProperty("open")||null!==a,l=e.hasOwnProperty("onClose");if(!o&&!l)throw Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)throw Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!a&&"boolean"!=typeof e.open)throw Error("You provided an `open` prop to the `Dialog`, but the value is not a boolean. Received: ".concat(e.open));if("function"!=typeof e.onClose)throw Error("You provided an `onClose` prop to the `Dialog`, but the value is not a function. Received: ".concat(e.onClose));return(void 0!==i||r)&&!s.static?n.createElement(v,null,n.createElement(G.e,{show:i,transition:r,unmount:s.unmount},n.createElement(et,{ref:t,...s}))):n.createElement(v,null,n.createElement(et,{ref:t,open:i,...s}))}),es=(0,y.FX)(function(e,t){let r=(0,n.useId)(),{id:i="headlessui-dialog-panel-".concat(r),transition:s=!1,...a}=e,[{dialogState:o,unmount:c},d]=Q("Dialog.Panel"),u=(0,A.P)(t,d.panelRef),h=(0,E._)({open:0===o}),p=(0,l._)(e=>{e.stopPropagation()}),_=s?G._:n.Fragment,f=(0,y.Ci)();return n.createElement(_,{...s?{unmount:c}:{}},f({ourProps:{ref:u,id:i,onClick:p},theirProps:a,slot:h,defaultTag:"div",name:"Dialog.Panel"}))}),ea=Object.assign(ei,{Panel:es,Title:((0,y.FX)(function(e,t){let{transition:r=!1,...i}=e,[{dialogState:s,unmount:a}]=Q("Dialog.Backdrop"),o=(0,E._)({open:0===s}),l=r?G._:n.Fragment,c=(0,y.Ci)();return n.createElement(l,{...r?{unmount:a}:{}},c({ourProps:{ref:t,"aria-hidden":!0},theirProps:i,slot:o,defaultTag:"div",name:"Dialog.Backdrop"}))}),(0,y.FX)(function(e,t){let r=(0,n.useId)(),{id:i="headlessui-dialog-title-".concat(r),...s}=e,[{dialogState:a,setTitleId:o}]=Q("Dialog.Title"),l=(0,A.P)(t);(0,n.useEffect)(()=>(o(i),()=>o(null)),[i,o]);let c=(0,E._)({open:0===a});return(0,y.Ci)()({ourProps:{ref:l,id:i},theirProps:s,slot:c,defaultTag:"h2",name:"Dialog.Title"})})),Description:M.VY})},63804:(e,t,r)=>{"use strict";r.d(t,{g:()=>a});var n,i=r(55729),s=r(71200);function a(){let e,t=(e="undefined"==typeof document,(0,(n||(n=r.t(i,2))).useSyncExternalStore)(()=>()=>{},()=>!1,()=>!e)),[a,o]=i.useState(s._.isHandoffComplete);return a&&!1===s._.isHandoffComplete&&o(!1),i.useEffect(()=>{!0!==a&&o(!0)},[a]),i.useEffect(()=>s._.handoff(),[]),!t&&a}},65970:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});
25let n=(0,r(5078).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},66349:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var n=r(52180),i=r(32688),s=r(51642).Buffer;async function a(e,t){let r=n(t);if(void 0===r)throw new i.wE({error:"Failed to prepare the payload for signing",code:"invalid_input"});let a=s.from(r).toString("base64"),{signature:o}=await e({message:a});return{signature:o}}},67247:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=w,t.fromBig=i,t.split=s;let r=BigInt(0x100000000-1),n=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function s(e,t=!1){let r=e.length,n=new Uint32Array(r),a=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:o}=i(e[s],t);[n[s],a[s]]=[r,o]}return[n,a]}let a=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=a;let o=(e,t,r)=>e>>>r;t.shrSH=o;let l=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=l;let c=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=c;let d=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=d;let u=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=u;let h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;let p=(e,t)=>t;t.rotr32H=p;let y=(e,t)=>e;t.rotr32L=y;let _=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=_;let f=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=f;let m=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=m;let g=(e,t,r)=>e<<r-32|t>>>64-r;function w(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/0x100000000|0)|0,l:0|i}}t.rotlBL=g;let v=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=v;let b=(e,t,r,n)=>t+r+n+(e/0x100000000|0)|0;t.add3H=b;let k=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=k;let I=(e,t,r,n,i)=>t+r+n+i+(e/0x100000000|0)|0;t.add4H=I;let E=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);t.add5L=E;let A=(e,t,r,n,i,s)=>t+r+n+i+s+(e/0x100000000|0)|0;t.add5H=A,t.default={fromBig:i,split:s,toBig:a,shrSH:o,shrSL:l,rotrSH:c,rotrSL:d,rotrBH:u,rotrBL:h,rotr32H:p,rotr32L:y,rotlSH:_,rotlSL:f,rotlBH:m,rotlBL:g,add:w,add3L:v,add3H:b,add4L:k,add4H:I,add5H:A,add5L:E}},69710:(e,t,r)=>{"use strict";r.d(t,{B:()=>s});var n=r(44555),i=r(66349);async function s(e,{wallet_id:t},r,s){let a={version:1,url:e.getCompiledPath(n.zv,{params:{wallet_id:t}}),method:n.zv.method,headers:{"privy-app-id":e.app.appId},body:s},{signature:o}=await (0,i.p)(r,a);return await e.fetchPrivyRoute(n.zv,{params:{wallet_id:t},body:s,headers:{"privy-authorization-signature":o}})}r(52180)},71707:(e,t,r)=>{"use strict";r.d(t,{Q:()=>i});var n=r(44555);async function i(e,{wallet_id:t}){return await e.fetchPrivyRoute(n.yG,{params:{wallet_id:t}})}},72274:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=i,t.anumber=s,t.abytes=a,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");s(e.outputLen),s(e.blockLen)},t.aexists=function(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")},t.aoutput=function(e,t){a(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=o,t.byteSwap32=l,t.bytesToHex=function(e){if(a(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=d[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=h(e.charCodeAt(i)),s=h(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n},t.asyncLoop=p,t.utf8ToBytes=y,t.bytesToUtf8=function(e){return new TextDecoder().decode(e)},t.toBytes=_,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=y(e)),a(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];a(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!==({}).toString.call(t))throw Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=m,t.createOptHasher=g,t.createXOFer=w,t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));if(n.crypto&&"function"==typeof n.crypto.randomBytes)return Uint8Array.from(n.crypto.randomBytes(e));throw Error("crypto.getRandomValues must be defined")};let n=r(13536);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function s(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function a(e,...t){if(!i(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e){return e<<24&0xff000000|e<<8&0xff0000|e>>>8&65280|e>>>24&255}function l(e){for(let t=0;t<e.length;t++)e[t]=o(e[t]);return e}t.isLE=68===new Uint8Array(new Uint32Array([0x11223344]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>o(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:l;let c="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,d=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),u={_0:48,_9:57,A:65,F:70,a:97,f:102};function h(e){return e>=u._0&&e<=u._9?e-u._0:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}async function p(e,r,n){let i=Date.now();for(let s=0;s<e;s++){n(s);let e=Date.now()-i;e>=0&&e<r||(await (0,t.nextTick)(),i+=e)}}function y(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function _(e){return"string"==typeof e&&(e=y(e)),a(e),e}t.nextTick=async()=>{};class f{}function m(e){let t=t=>e().update(_(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function g(e){let t=(t,r)=>e(r).update(_(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function w(e){let t=(t,r)=>e(r).update(_(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.Hash=f,t.wrapConstructor=m,t.wrapConstructorWithOpts=g,t.wrapXOFConstructorWithOpts=w},73354:(e,t,r)=>{"use strict";function n(e,t){return{...e,rpcUrls:{...e.rpcUrls,privyWalletOverride:{http:[t]}}}}r.d(t,{M:()=>n})},73509:(e,t,r)=>{"use strict";r.r(t),r.d(t,{DEFAULT_CONTAINER_ID:()=>c,DEFAULT_ONLOAD_NAME:()=>d,DEFAULT_SCRIPT_ID:()=>l,SCRIPT_URL:()=>o,Turnstile:()=>_});var n,i=r(55729),s=r(6029),a=(0,i.forwardRef)(({as:e="div",...t},r)=>(0,s.jsx)(e,{...t,ref:r})),o="https://challenges.cloudflare.com/turnstile/v0/api.js",l="cf-turnstile-script",c="cf-turnstile",d="onloadTurnstileCallback",u=e=>!!document.getElementById(e),h={normal:{width:300,height:65},compact:{width:150,height:140},invisible:{width:0,height:0,overflow:"hidden"},flexible:{minWidth:300,width:"100%",height:65},interactionOnly:{width:"fit-content",height:"auto",display:"flex"}},p="unloaded",y=new Promise((e,t)=>
25{n={resolve:e,reject:t},"ready"===p&&e(void 0)}),_=(0,i.forwardRef)((e,t)=>{let{scriptOptions:r,options:_={},siteKey:f,onWidgetLoad:m,onSuccess:g,onExpire:w,onError:v,onBeforeInteractive:b,onAfterInteractive:k,onUnsupported:I,onTimeout:E,onLoadScript:A,id:T,style:S,as:x="div",injectScript:C=!0,rerenderOnCallbackChange:R=!1,...P}=e,O=_.size,M=(0,i.useCallback)(()=>typeof O>"u"?{}:"execute"===_.execution?h.invisible:"interaction-only"===_.appearance?h.interactionOnly:h[O],[_.execution,O,_.appearance]),[L,N]=(0,i.useState)(M()),D=(0,i.useRef)(null),[U,W]=(0,i.useState)(!1),j=(0,i.useRef)(),F=(0,i.useRef)(!1),q=T||c,B=(0,i.useRef)({onSuccess:g,onError:v,onExpire:w,onBeforeInteractive:b,onAfterInteractive:k,onUnsupported:I,onTimeout:E});(0,i.useEffect)(()=>{R||(B.current={onSuccess:g,onError:v,onExpire:w,onBeforeInteractive:b,onAfterInteractive:k,onUnsupported:I,onTimeout:E})});let z=r?.id||l,H=function(e=l){let[t,r]=(0,i.useState)(!1);return(0,i.useEffect)(()=>{let t=()=>{u(e)&&r(!0)},n=new MutationObserver(t);return n.observe(document,{childList:!0,subtree:!0}),t(),()=>{n.disconnect()}},[e]),t}(z),K=r?.onLoadCallbackName||d,V=_.appearance||"always",$=(0,i.useMemo)(()=>({sitekey:f,action:_.action,cData:_.cData,theme:_.theme||"auto",language:_.language||"auto",tabindex:_.tabIndex,"response-field":_.responseField,"response-field-name":_.responseFieldName,size:function(e){if("invisible"!==e&&"interactionOnly"!==e)return e}(O),retry:_.retry||"auto","retry-interval":_.retryInterval||8e3,"refresh-expired":_.refreshExpired||"auto","refresh-timeout":_.refreshTimeout||"auto",execution:_.execution||"render",appearance:_.appearance||"always","feedback-enabled":_.feedbackEnabled||!0,callback:e=>{F.current=!0,R?g?.(e):B.current.onSuccess?.(e)},"error-callback":R?v:(...e)=>B.current.onError?.(...e),"expired-callback":R?w:(...e)=>B.current.onExpire?.(...e),"before-interactive-callback":R?b:(...e)=>B.current.onBeforeInteractive?.(...e),"after-interactive-callback":R?k:(...e)=>B.current.onAfterInteractive?.(...e),"unsupported-callback":R?I:(...e)=>B.current.onUnsupported?.(...e),"timeout-callback":R?E:(...e)=>B.current.onTimeout?.(...e)}),[_.action,_.appearance,_.cData,_.execution,_.language,_.refreshExpired,_.responseField,_.responseFieldName,_.retry,_.retryInterval,_.tabIndex,_.theme,_.feedbackEnabled,_.refreshTimeout,f,O,R,R?g:null,R?v:null,R?w:null,R?b:null,R?k:null,R?I:null,R?E:null]),G=(0,i.useCallback)(()=>"u">typeof window&&!!window.turnstile,[]);return(0,i.useEffect)(function(){C&&!U&&(({render:e="explicit",onLoadCallbackName:t=d,scriptOptions:{nonce:r="",defer:n=!0,async:i=!0,id:s="",appendTo:a,onError:c,crossOrigin:h=""}={}})=>{let p=s||l;if(u(p))return;let y=document.createElement("script");y.id=p,y.src=`${o}?onload=${t}&render=${e}`,document.querySelector(`script[src="${y.src}"]`)||(y.defer=!!n,y.async=!!i,r&&(y.nonce=r),h&&(y.crossOrigin=h),c&&(y.onerror=c,delete window[t]),("body"===a?document.body:document.getElementsByTagName("head")[0]).appendChild(y))})({onLoadCallbackName:K,scriptOptions:{...r,id:z}})},[C,U,r,z]),(0,i.useEffect)(function(){"ready"!==p&&((e=d)=>("unloaded"===p&&(p="loading",window[e]=()=>{n.resolve(),p="ready",delete window[e]}),y))(K).then(()=>W(!0)).catch(console.error)},[]),(0,i.useEffect)(function(){if(!D.current||!U)return;let e=!1;return(async()=>{!e&&D.current&&(j.current=window.turnstile.render(D.current,$),j.current&&m?.(j.current))})(),()=>{e=!0,j.current&&(window.turnstile.remove(j.current),F.current=!1)}},[q,U,$]),(0,i.useImperativeHandle)(t,()=>{let{turnstile:e}=window;return{getResponse:()=>e?.getResponse&&j.current&&G()?e.getResponse(j.current):void console.warn("Turnstile has not been loaded"),getResponsePromise:async(e=3e4,t=100)=>new Promise((r,n)=>{let i,s=async()=>{if(F.current&&window.turnstile&&j.current)try{let e=window.turnstile.getResponse(j.current);return i&&clearTimeout(i),e?r(e):n(Error("No response received"))}catch(e){return i&&clearTimeout(i),console.warn("Failed to get response",e),n(Error("Failed to get response"))}i||(i=setTimeout(()=>{i&&clearTimeout(i),n(Error("Timeout"))},e)),await new Promise(e=>setTimeout(e,t)),await s()};s()}),reset(){if(!e?.reset||!j.current||!G())return void console.warn("Turnstile has not been loaded");"execute"===_.execution&&N(h.invisible);try{F.current=!1,e.reset(j.current)}catch(e){console.warn(`Failed to reset Turnstile widget ${j}`,e)}},remove(){if(!e?.remove||!j.current||!G())return void console.warn("Turnstile has not been loaded");N(h.invisible),F.current=!1,e.remove(j.current),j.current=null}
25,render(){if(!e?.render||!D.current||!G()||j.current)return void console.warn("Turnstile has not been loaded or container not found");let t=e.render(D.current,$);return j.current=t,j.current&&m?.(j.current),"execute"!==_.execution&&N(O?h[O]:{}),t},execute:()=>"execute"!==_.execution?void console.warn('Execution mode is not set to "execute"'):e?.execute&&D.current&&j.current&&G()?void(e.execute(D.current,$),N(O?h[O]:{})):void console.warn("Turnstile has not been loaded or container not found"),isExpired:()=>e?.isExpired&&j.current&&G()?e.isExpired(j.current):(console.warn("Turnstile has not been loaded"),!1)}},[j,_.execution,O,$,D,G,U,m]),(0,i.useEffect)(()=>{H&&!U&&window.turnstile&&W(!0)},[U,H]),(0,i.useEffect)(()=>{N(M())},[_.execution,O,V]),(0,i.useEffect)(()=>{H&&"function"==typeof A&&A()},[H]),(0,s.jsx)(a,{ref:D,as:x,id:q,style:{...L,...S},...P})});_.displayName="Turnstile"},77582:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})},77816:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{fillRule:"evenodd",d:"M8.603 3.799A4.49 4.49 0 0 1 12 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 0 1 3.498 1.307 4.491 4.491 0 0 1 1.307 3.497A4.49 4.49 0 0 1 21.75 12a4.49 4.49 0 0 1-1.549 3.397 4.491 4.491 0 0 1-1.307 3.497 4.491 4.491 0 0 1-3.497 1.307A4.49 4.49 0 0 1 12 21.75a4.49 4.49 0 0 1-3.397-1.549 4.49 4.49 0 0 1-3.498-1.306 4.491 4.491 0 0 1-1.307-3.498A4.49 4.49 0 0 1 2.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 0 1 1.307-3.497 4.49 4.49 0 0 1 3.497-1.307Zm7.007 6.387a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))})},82260:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(55729);let i=n.forwardRef(function(e,t){let{title:r,titleId:i,...s}=e;return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":i},s),r?n.createElement("title",{id:i},r):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))})},83412:(e,t,r)=>{var n=r(51642).Buffer;let{keccak_256:i}=r(42270);function s(e){return n.allocUnsafe(e).fill(0)}function a(e,t){let r=e.toString(16);r.length%2!=0&&(r="0"+r);let i=r.match(/.{1,2}/g).map(e=>parseInt(e,16));for(;i.length<t;)i.unshift(0);return n.from(i)}function o(e,t,r){let n=s(t);return(e=l(e),r)?e.length<t?(e.copy(n),n):e.slice(0,t):e.length<t?(e.copy(n,t-e.length),n):e.slice(-t)}function l(e){if(!n.isBuffer(e))if(Array.isArray(e))e=n.from(e);else if("string"==typeof e){var t;e=c(e)?n.from((t=d(e)).length%2?"0"+t:t,"hex"):n.from(e)}else if("number"==typeof e)e=intToBuffer(e);else if(null==e)e=n.allocUnsafe(0);else if("bigint"==typeof e)e=a(e);else if(e.toArray)e=n.from(e.toArray());else throw Error("invalid type");return e}function c(e){return"string"==typeof e&&e.match(/^0x[0-9A-Fa-f]*$/)}function d(e){return"string"==typeof e&&e.startsWith("0x")?e.slice(2):e}e.exports={zeros:s,setLength:o,setLengthRight:function(e,t){return o(e,t,!0)},isHexString:c,stripHexPrefix:d,toBuffer:l,bufferToHex:function(e){return"0x"+(e=l(e)).toString("hex")},keccak:function(e,t){if(e=l(e),t||(t=256),256!==t)throw Error("unsupported");return n.from(i(new Uint8Array(e)))},bitLengthFromBigInt:function(e){return e.toString(2).length},bufferBEFromBigInt:a,twosFromBigInt:function(e,t){return(e<0n?(~e&(1n<<BigInt(t))-1n)+1n:e)&(1n<<BigInt(t))-1n}}},83468:(e,t,r)=>{var n=r(51642).Buffer;let i=r(83412);function s(e){if(e.startsWith("int["))return"int256"+e.slice(3);if("int"===e)return"int256";if(e.startsWith("uint["))return"uint256"+e.slice(4);if("uint"===e)return"uint256";if(e.startsWith("fixed["))return"fixed128x128"+e.slice(5);else if("fixed"===e)return"fixed128x128";else if(e.startsWith("ufixed["))return"ufixed128x128"+e.slice(6);else if("ufixed"===e)return"ufixed128x128";return e}function a(e){return Number.parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function o(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[Number.parseInt(t[1],10),Number.parseInt(t[2],10)]}function l(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?""===t[2]?"dynamic":Number.parseInt(t[2],10):null}function c(e){var t=typeof e;if("string"===t||"number"===t)return BigInt(e);if("bigint"===t)return e;throw Error("Argument is not a number")}function d(e,t){if("address"===e)return d("uint160",c(t));if("bool"===e)return d("uint8",+!!t);if("string"===e)return d("bytes",new n(t,"utf8"));if((p=e).lastIndexOf("]")===p.length-1){if(void 0===t.length)throw Error("Not an array?");if("dynamic"!==(r=l(e))&&0!==r&&t.length>r)throw Error("Elements exceed array size: "+r);for(h in u=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)u.push(d(e,t[h]));if("dynamic"===r){var r,s,u,h,p,y=d("uint256",t.length);u.unshift(y)}return n.concat(u)}else if("bytes"===e)return t=new n(t),u=n.concat([d("uint256",t.length),t]),t.length%32!=0&&(u=n.concat([u,i.zeros(32-t.length%32)])),u;else if(e.startsWith("bytes")){if((r=a(e))<1||r>32)throw Error("Invalid bytes<N> width: "+r);
25return i.setLengthRight(t,32)}else if(e.startsWith("uint")){if((r=a(e))%8||r<8||r>256)throw Error("Invalid uint<N> width: "+r);s=c(t);let n=i.bitLengthFromBigInt(s);if(n>r)throw Error("Supplied uint exceeds width: "+r+" vs "+n);if(s<0)throw Error("Supplied uint is negative");return i.bufferBEFromBigInt(s,32)}else if(e.startsWith("int")){if((r=a(e))%8||r<8||r>256)throw Error("Invalid int<N> width: "+r);s=c(t);let n=i.bitLengthFromBigInt(s);if(n>r)throw Error("Supplied int exceeds width: "+r+" vs "+n);let o=i.twosFromBigInt(s,256);return i.bufferBEFromBigInt(o,32)}else if(e.startsWith("ufixed")){if(r=o(e),(s=c(t))<0)throw Error("Supplied ufixed is negative");return d("uint256",s*BigInt(2)**BigInt(r[1]))}else if(e.startsWith("fixed"))return r=o(e),d("int256",c(t)*BigInt(2)**BigInt(r[1]));throw Error("Unsupported or invalid type: "+e)}function u(e,t){if(e.length!==t.length)throw Error("Number of types are not matching the values");for(var r,o,l=[],d=0;d<e.length;d++){var u=s(e[d]),h=t[d];if("bytes"===u)l.push(h);else if("string"===u)l.push(new n(h,"utf8"));else if("bool"===u)l.push(new n(h?"01":"00","hex"));else if("address"===u)l.push(i.setLength(h,20));else if(u.startsWith("bytes")){if((r=a(u))<1||r>32)throw Error("Invalid bytes<N> width: "+r);l.push(i.setLengthRight(h,r))}else if(u.startsWith("uint")){if((r=a(u))%8||r<8||r>256)throw Error("Invalid uint<N> width: "+r);o=c(h);let e=i.bitLengthFromBigInt(o);if(e>r)throw Error("Supplied uint exceeds width: "+r+" vs "+e);l.push(i.bufferBEFromBigInt(o,r/8))}else if(u.startsWith("int")){if((r=a(u))%8||r<8||r>256)throw Error("Invalid int<N> width: "+r);o=c(h);let e=i.bitLengthFromBigInt(o);if(e>r)throw Error("Supplied int exceeds width: "+r+" vs "+e);let t=i.twosFromBigInt(o,r);l.push(i.bufferBEFromBigInt(t,r/8))}else throw Error("Unsupported or invalid type: "+u)}return n.concat(l)}e.exports={rawEncode:function(e,t){var r=[],i=[],a=32*e.length;for(var o in e){var c=s(e[o]),u=d(c,t[o]);"string"===c||"bytes"===c||"dynamic"===l(c)?(r.push(d("uint256",a)),i.push(u),a+=u.length):r.push(u)}return n.concat(r.concat(i))},solidityPack:u,soliditySHA3:function(e,t){return i.keccak(u(e,t))}}},86023:function(e){e.exports=function(){"use strict";function e(e){return Number.isInteger(e)&&e>=0}function t(e){this.name="ArgumentError",this.message=e}return function(r,n){if(n=n||{},"function"!=typeof r)throw new t("fetch must be a function");if("object"!=typeof n)throw new t("defaults must be an object");if(void 0!==n.retries&&!e(n.retries))throw new t("retries must be a positive integer");if(void 0!==n.retryDelay&&!e(n.retryDelay)&&"function"!=typeof n.retryDelay)throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(void 0!==n.retryOn&&!Array.isArray(n.retryOn)&&"function"!=typeof n.retryOn)throw new t("retryOn property expects an array or function");return n=Object.assign({retries:3,retryDelay:1e3,retryOn:[]},n),function(i,s){var a=n.retries,o=n.retryDelay,l=n.retryOn;if(s&&void 0!==s.retries)if(e(s.retries))a=s.retries;else throw new t("retries must be a positive integer");if(s&&void 0!==s.retryDelay)if(e(s.retryDelay)||"function"==typeof s.retryDelay)o=s.retryDelay;else throw new t("retryDelay must be a positive integer or a function returning a positive integer");if(s&&s.retryOn)if(Array.isArray(s.retryOn)||"function"==typeof s.retryOn)l=s.retryOn;else throw new t("retryOn property expects an array or function");return new Promise(function(e,t){var n=function(n){r("undefined"!=typeof Request&&i instanceof Request?i.clone():i,s).then(function(r){if(Array.isArray(l)&&-1===l.indexOf(r.status))e(r);else if("function"==typeof l)try{return Promise.resolve(l(n,null,r)).then(function(t){t?c(n,null,r):e(r)}).catch(t)}catch(e){t(e)}else n<a?c(n,null,r):e(r)}).catch(function(e){if("function"==typeof l)try{Promise.resolve(l(n,e,null)).then(function(r){r?c(n,e,null):t(e)}).catch(function(e){t(e)})}catch(e){t(e)}else n<a?c(n,e,null):t(e)})};function c(e,t,r){setTimeout(function(){n(++e)},"function"==typeof o?o(e,t,r):o)}n(0)})}}}()},86976:(e,t,r)=>{"use strict";r.d(t,{_:()=>s});var n=r(44555),i=r(66349);async function s(e,t,{wallet_id:r,...s}){let a={version:1,url:e.getCompiledPath(n.H_,{params:{wallet_id:r}}),method:n.H_.method,headers:{"privy-app-id":e.app.appId},body:{...s}},{signature:o}=await (0,i.p)(t,a);
25return await e.fetchPrivyRoute(n.H_,{body:s,params:{wallet_id:r},headers:{"privy-authorization-signature":o}})}r(52180)},87173:(e,t,r)=>{"use strict";function n(e){return e.find(e=>"privy"===e.walletClientType&&"embedded"===e.connectorType&&!e.imported)??null}r.d(t,{g:()=>n})},94622:(e,t,r)=>{var n=r(51642).Buffer;let i=r(83412),s=r(83468),a={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},o={encodeData(e,t,r,a=!0){let o=["bytes32"],l=[this.hashType(e,r)];if(a){let c=(e,t,o)=>{if(void 0!==r[t])return["bytes32",null==o?"0x0000000000000000000000000000000000000000000000000000000000000000":i.keccak(this.encodeData(t,o,r,a))];if(void 0===o)throw Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",i.keccak(o)];if("string"===t)return"string"==typeof o&&(o=n.from(o,"utf8")),["bytes32",i.keccak(o)];if(t.lastIndexOf("]")===t.length-1){let r=t.slice(0,t.lastIndexOf("[")),n=o.map(t=>c(e,r,t));return["bytes32",i.keccak(s.rawEncode(n.map(([e])=>e),n.map(([,e])=>e)))]}return[t,o]};for(let n of r[e]){let[e,r]=c(n.name,n.type,t[n.name]);o.push(e),l.push(r)}}else for(let s of r[e]){let e=t[s.name];if(void 0!==e)if("bytes"===s.type)o.push("bytes32"),e=i.keccak(e),l.push(e);else if("string"===s.type)o.push("bytes32"),"string"==typeof e&&(e=n.from(e,"utf8")),e=i.keccak(e),l.push(e);else if(void 0!==r[s.type])o.push("bytes32"),e=i.keccak(this.encodeData(s.type,e,r,a)),l.push(e);else if(s.type.lastIndexOf("]")===s.type.length-1)throw Error("Arrays currently unimplemented in encodeData");else o.push(s.type),l.push(e)}return s.rawEncode(o,l)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(t=>t!==e);for(let i of n=[e].concat(n.sort())){if(!t[i])throw Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:e,type:t})=>t+" "+e).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||void 0===t[e])return r;for(let n of(r.push(e),t[e]))for(let e of this.findTypeDependencies(n.type,t,r))r.includes(e)||r.push(e);return r},hashStruct(e,t,r,n=!0){return i.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return i.keccak(this.encodeType(e,t))},sanitizeData(e){let t={};for(let r in a.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){let r=this.sanitizeData(e),s=[n.from("1901","hex")];return s.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),"EIP712Domain"!==r.primaryType&&s.push(this.hashStruct(r.primaryType,r.message,r.types,t)),i.keccak(n.concat(s))}};e.exports={TYPED_MESSAGE_SCHEMA:a,TypedDataUtils:o,hashForSignTypedDataLegacy:function(e){return function(e){let t=Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;let r=e.map(function(e){return"bytes"===e.type?i.toBuffer(e.value):e.value}),n=e.map(function(e){return e.type}),a=e.map(function(e){if(!e.name)throw t;return e.type+" "+e.name});return s.soliditySHA3(["bytes32","bytes32"],[s.soliditySHA3(Array(e.length).fill("string"),a),s.soliditySHA3(n,r)])}(e.data)},hashForSignTypedData_v3:function(e){return o.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return o.hash(e.data)}}},96271:(e,t,r)=>{"use strict";r.d(t,{C:()=>d,a:()=>c,b:()=>u,c:()=>h,d:()=>p,e:()=>y,u:()=>l});var n=r(55729),i=r(78785),s=r(44688),a=r(5042),o=r(28950);let l=e=>{let[t,r]=(0,n.useState)("auto");return(0,n.useEffect)(()=>{let t=new ResizeObserver(e=>{r(e[0]?.contentRect.height??"auto")});return e.current&&t.observe(e.current),()=>{e.current&&t.unobserve(e.current)}},[e.current]),t};function c(e){let{logout:t}=(0,n.useContext)(s.P);return(0,i.aa)("logout",e),{logout:t}}let d=a.styled.div.withConfig({displayName:"Column",componentId:"sc-cfc52180-0"})(["display:flex;flex-direction:column;"]);function u(e){let{login:t}=(0,n.useContext)(s.P);return(0,i.aa)("login",e),{login:t}}
25function h(e){let{connectWallet:t}=(0,n.useContext)(s.P);return(0,i.aa)("connectWallet",e),{connectWallet:t}}let p=e=>{(0,i.aa)("fundWallet",e);let{fundWallet:t}=(0,o.u)();return{fundWallet:({address:e,options:r})=>t(e,r)}},y=()=>{let e=(0,i.an)(),{wallets:t}=(0,i.af)(),{connectors:r}=(0,o.u)(),s=(0,n.useMemo)(()=>r.filter(i.z).flatMap(e=>e.wallets),[r]),a=(0,i.cv)(e=>e.wallet);(0,n.useEffect)(()=>{if(!e.id)return;let t=i.f.get((0,i.cw)(e.id));i.cv.setState({wallet:t})},[e.id]);let l=(0,n.useMemo)(()=>{if(!a)return;let[,e]=a.split(":");return t.find(t=>t.address===e)||s.find(t=>t.address===e)},[a,t,s]),c=(0,n.useMemo)(()=>l?"ethereum"===l.type?l.chainId:"solana":void 0,[l]);return{connect:async r=>{r?.reset&&(i.f.del((0,i.cw)(e.id)),i.cv.setState({wallet:void 0}));let{wallet:n}=await (0,i.cx)();if(!n)return{};let[,a]=n.split(":"),o=t.find(e=>e.address===a);if(o)return{wallet:o,network:o.chainId};let l=s.find(e=>e.address===a);return l?{wallet:l,network:"solana"}:{}},setActiveWallet:(0,n.useCallback)(t=>{(0,i.cr)({address:t.address,client:t.walletClientType,appId:e.id})},[e.id]),wallet:l,network:c}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.