PageSourceSearch

https://www.copus.io/assets/index-Cdem1tOp.js

js copus.io collected 2026-09-24 13:36:11 UTC 95,499 bytes, 1 lines download raw bytes

1import{a8 as O,h as ae}from"./index-7UG5XKey.js";import{g as bn}from"./react-vendor-D8m9dEpm.js";import{b as wn,s as vn}from"./sha256-aQhKOutc.js";import{E as kn}from"./en_US-AV7YDYDW-DulvRgeE.js";import"./router-vendor-Dd05clGk.js";import"./antd-vendor-DHL82ETZ.js";import"./celo-E6XU57FO-D5Lm5Mni.js";class z{constructor(e,n){this.scope=e,this.module=n}storeObject(e,n){this.setItem(e,JSON.stringify(n))}loadObject(e){const n=this.getItem(e);return n?JSON.parse(n):void 0}setItem(e,n){localStorage.setItem(this.scopedKey(e),n)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),n=[];for(let s=0;s<localStorage.length;s++){const r=localStorage.key(s);typeof r=="string"&&r.startsWith(e)&&n.push(r)}n.forEach(s=>localStorage.removeItem(s))}scopedKey(e){return"-".concat(this.scope).concat(this.module?":".concat(this.module):"",":").concat(e)}static clearAll(){new z("CBWSDK").clear(),new z("walletlink").clear()}}const j={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}},Te={"-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."}},Ut="Unspecified error message.",En="Unspecified server error.";function qe(t,e=Ut){if(t&&Number.isInteger(t)){const n=t.toString();if(Ne(Te,n))return Te[n].message;if(jt(t))return En}return e}function In(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(Te[e]||jt(t))}function Sn(t,{shouldIncludeStack:e=!1}={}){const n={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Ne(t,"code")&&In(t.code)){const s=t;n.code=s.code,s.message&&typeof s.message=="string"?(n.message=s.message,Ne(s,"data")&&(n.data=s.data)):(n.message=qe(n.code),n.data={originalError:et(t)})}else n.code=j.rpc.internal,n.message=tt(t,"message")?t.message:Ut,n.data={originalError:et(t)};return e&&(n.stack=tt(t,"stack")?t.stack:void 0),n}function jt(t){return t>=-32099&&t<=-32e3}function et(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Ne(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function tt(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const M={rpc:{parse:t=>K(j.rpc.parse,t),invalidRequest:t=>K(j.rpc.invalidRequest,t),invalidParams:t=>K(j.rpc.invalidParams,t),methodNotFound:t=>K(j.rpc.methodNotFound,t),internal:t=>K(j.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code 
1<= -32005');return K(e,t)},invalidInput:t=>K(j.rpc.invalidInput,t),resourceNotFound:t=>K(j.rpc.resourceNotFound,t),resourceUnavailable:t=>K(j.rpc.resourceUnavailable,t),transactionRejected:t=>K(j.rpc.transactionRejected,t),methodNotSupported:t=>K(j.rpc.methodNotSupported,t),limitExceeded:t=>K(j.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>ne(j.provider.userRejectedRequest,t),unauthorized:t=>ne(j.provider.unauthorized,t),unsupportedMethod:t=>ne(j.provider.unsupportedMethod,t),disconnected:t=>ne(j.provider.disconnected,t),chainDisconnected:t=>ne(j.provider.chainDisconnected,t),unsupportedChain:t=>ne(j.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:n,data:s}=t;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new Ht(e,n,s)}}};function K(t,e){const[n,s]=Bt(e);return new Wt(t,n||qe(t),s)}function ne(t,e){const[n,s]=Bt(e);return new Ht(t,n||qe(t),s)}function Bt(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:n}=t;
1if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,n]}}return[]}class Wt extends Error{constructor(e,n,s){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=e,s!==void 0&&(this.data=s)}}class Ht extends Wt{constructor(e,n,s){if(!Cn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,n,s)}}function Cn(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function Ke(){return t=>t}const le=Ke(),An=Ke(),Ln=Ke();function $(t){return Math.floor(t)}const qt=/^[0-9]*$/,Kt=/^[a-f0-9]*$/;function ee(t){return Fe(crypto.getRandomValues(new Uint8Array(t)))}function Fe(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function _e(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function ce(t,e=!1){const n=t.toString("hex");return le(e?"0x".concat(n):n)}function Ie(t){return ce(Oe(t),!0)}function F(t){return Ln(t.toString(10))}function Q(t){return le("0x".concat(BigInt(t).toString(16)))}function Ft(t){return t.startsWith("0x")||t.startsWith("0X")}function ze(t){return Ft(t)?t.slice(2):t}function zt(t){return Ft(t)?"0x".concat(t.slice(2)):"0x".concat(t)}function ve(t){if(typeof t!="string")return!1;const e=ze(t).toLowerCase();return Kt.test(e)}function xn(t,e=!1){if(typeof t=="string"){const n=ze(t).toLowerCase();if(Kt.test(n))return le(e?"0x".concat(n):n)}throw M.rpc.invalidParams('"'.concat(String(t),'" is not a hexadecimal string'))}function $e(t,e=!1){let n=xn(t,!1);return n.length%2===1&&(n=le("0".concat(n))),e?le("0x".concat(n)):n}function V(t){if(typeof t=="string"){const e=ze(t).toLowerCase();if(ve(e)&&e.length===40)return An(zt(e))}throw M.rpc.invalidParams("Invalid Ethereum address: ".concat(String(t)))}function Oe(t){if(O.isBuffer(t))return t;if(typeof t=="string"){if(ve(t)){const e=$e(t,!1);return O.from(e,"hex")}return O.from(t,"utf8")}throw M.rpc.invalidParams("Not binary data: ".concat(String(t)))}function de(t){if(typeof t=="number"&&Number.isInteger(t))return $(t);if(typeof t=="string"){if(qt.test(t))return $(Number(t));if(ve(t))return $(Number(BigInt($e(t,!0))))}throw M.rpc.invalidParams("Not an integer: ".concat(String(t)))}function re(t){if(t!==null&&(typeof t=="bigint"||Pn(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(de(t));if(typeof t=="string"){if(qt.test(t))return BigInt(t);if(ve(t))return BigInt($e(t,!0))}throw M.rpc.invalidParams("Not an integer: ".concat(String(t)))}function Mn(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw M.rpc.invalidParams("Not a JSON string or an object: ".concat(String(t)))}function Pn(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}async function Rn(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Tn(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function Nn(t,e){const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.encrypt({name:"AES-GCM",iv:n},t,new TextEncoder().encode(e));return{iv:n,cipherText:s}}async function On(t,{iv:e,cipherText:n}){const s=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,n);return new TextDecoder().decode(s)}function $t(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Gt(t,e){const n=$t(t),s=await crypto.subtle.exportKey(n,e);return Fe(new Uint8Array(s))}async function Yt(t,e){const n=$t(t),s=_e(e).buffer;return await crypto.subtle.importKey(n,new Uint8Array(s),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Dn(t,e){const n=JSON.stringify(t,(s,r)=>{if(!(r instanceof Error))return r;const i=r;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return Nn(e,n)}async function Un(t,e){return JSON.parse(await On(e,t))}const Se={storageKey:"ownPrivateKey",keyType:"private"},Ce={storageKey:"ownPublicKey",keyType:"public"},Ae={storageKey:"peerPublicKey",keyType:"public"};
1class jn{constructor(){this.storage=new z("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(Ae,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(Ce.storageKey),this.storage.removeItem(Se.storageKey),this.storage.removeItem(Ae.storageKey)}async generateKeyPair(){const e=await Rn();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Se,e.privateKey),await this.storeKey(Ce,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Se)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(Ce)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ae)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Tn(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const n=this.storage.getItem(e.storageKey);return n?Yt(e.keyType,n):null}async storeKey(e,n){const s=await Gt(e.keyType,n);this.storage.setItem(e.storageKey,s)}}const he="4.3.0",Vt="@coinbase/wallet-sdk";async function Ge(t,e){const n=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),s=await window.fetch(e,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":he,"X-Cbw-Sdk-Platform":Vt}}),{result:r,error:i}=await s.json();if(i)throw i;return r}function Bn(){return globalThis.coinbaseWalletExtension}function Wn(){var t,e;try{const n=globalThis;return(t=n.ethereum)!==null&&t!==void 0?t:(e=n.top)===null||e===void 0?void 0:e.ethereum}catch(n){return}}function Hn({metadata:t,preference:e}){var n,s;const{appName:r,appLogoUrl:i,appChainIds:o}=t;if(e.options!=="smartWalletOnly"){const u=Bn();if(u)return(n=u.setAppInfo)===null||n===void 0||n.call(u,r,i,o,e),u}const a=Wn();if(a!=null&&a.isCoinbaseBrowser)return(s=a.setAppInfo)===null||s===void 0||s.call(a,r,i,o,e),a}function qn(t){if(!t||typeof t!="object"||Array.isArray(t))throw M.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:n}=t;if(typeof e!="string"||e.length===0)throw M.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw M.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw M.provider.unsupportedMethod()}}const nt="accounts",st="activeChain",it="availableChains",rt="walletCapabilities";class Kn{constructor(e){var n,s,r;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new jn,this.storage=new z("CBWSDK","SCWStateManager"),this.accounts=(n=this.storage.loadObject(nt))!==null&&n!==void 0?n:[],this.chain=this.storage.loadObject(st)||{id:(r=(s=e.metadata.appChainIds)===null||s===void 0?void 0:s[0])!==null&&r!==void 0?r: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 n,s,r,i;await((s=(n=this.communicator).waitForPopupLoaded)===null||s===void 0?void 0:s.call(n));const o=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(r=e.params)!==null&&r!==void 0?r:{})}}),a=await this.communicator.postRequestAndWaitForResponse(o);if("failure"in a.content)throw a.content.failure;const u=await Yt("public",a.sender);await this.keyManager.setPeerPublicKey(u);
1const _=(await this.decryptResponseMessage(a)).result;if("error"in _)throw _.error;switch(e.method){case"eth_requestAccounts":{const l=_.value;this.accounts=l,this.storage.storeObject(nt,l),(i=this.callback)===null||i===void 0||i.call(this,"accountsChanged",l);break}}}async request(e){var n;if(this.accounts.length===0)switch(e.method){case"wallet_sendCalls":return this.sendRequestToPopup(e);default:throw M.provider.unauthorized()}switch(e.method){case"eth_requestAccounts":return(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:Q(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 Q(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(rt);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 M.rpc.internal("No RPC URL set for chain");return Ge(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var n,s;await((s=(n=this.communicator).waitForPopupLoaded)===null||s===void 0?void 0:s.call(n));const r=await this.sendEncryptedRequest(e),o=(await this.decryptResponseMessage(r)).result;if("error"in o)throw o.error;return o.value}async cleanup(){var e,n;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(n=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&n!==void 0?n:1}}async handleSwitchChainRequest(e){var n;const s=e.params;if(!s||!(!((n=s[0])===null||n===void 0)&&n.chainId))throw M.rpc.invalidParams();const r=de(s[0].chainId);if(this.updateChain(r))return null;const o=await this.sendRequestToPopup(e);return o===null&&this.updateChain(r),o}async sendEncryptedRequest(e){const n=await this.keyManager.getSharedSecret();if(!n)throw M.provider.unauthorized("No valid session found, try requestAccounts before other methods");const s=await Dn({action:e,chainId:this.chain.id},n),r=await this.createRequestMessage({encrypted:s});return this.communicator.postRequestAndWaitForResponse(r)}async createRequestMessage(e){const n=await Gt("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:n,content:e,timestamp:new Date}}async decryptResponseMessage(e){var n,s;const r=e.content;if("failure"in r)throw r.failure;const i=await this.keyManager.getSharedSecret();if(!i)throw M.provider.unauthorized("Invalid session");const o=await Un(r.encrypted,i),a=(n=o.data)===null||n===void 0?void 0:n.chains;if(a){const f=Object.entries(a).map(([_,l])=>({id:Number(_),rpcUrl:l}));this.storage.storeObject(it,f),this.updateChain(this.chain.id,f)}const u=(s=o.data)===null||s===void 0?void 0:s.capabilities;return u&&this.storage.storeObject(rt,u),o}updateChain(e,n){var s;const r=n!=null?n:this.storage.loadObject(it),i=r==null?void 0:r.find(o=>o.id===e);return i?(i!==this.chain&&(this.chain=i,this.storage.storeObject(st,i),(s=this.callback)===null||s===void 0||s.call(this,"chainChanged",Q(i.id))),!0):!1}}var N={},J={},ot;function Jt(){if(ot)return J;ot=1,Object.defineProperty(J,"__esModule",{value:!0}),J.anumber=t,J.abytes=n,J.ahash=s,J.aexists=r,J.aoutput=i;function t(o){if(!Number.isSafeInteger(o)||o<0)throw new Error("positive integer expected, got "+o)}function e(o){return o instanceof Uint8Array||ArrayBuffer.isView(o)&&o.constructor.name==="Uint8Array"}function n(o,...a){if(!e(o))throw new Error("Uint8Array expected");if(a.length>0&&!a.includes(o.length))throw new Error("Uint8Array expected of length "+a+", got length="+o.length)}function s(o){if(typeof o!="function"||typeof o.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");t(o.outputLen),t(o.blockLen)}function r(o,a=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(a&&o.finished)throw new Error("Hash#digest() has already been called")}function i(o,a){n(o);const u=a.outputLen;if(o.length<u)throw new Error("digestInto() expects output buffer of length at least "+u)}return J}var A={},at;function Fn(){if(at)return A;
1at=1,Object.defineProperty(A,"__esModule",{value:!0}),A.add5L=A.add5H=A.add4H=A.add4L=A.add3H=A.add3L=A.rotlBL=A.rotlBH=A.rotlSL=A.rotlSH=A.rotr32L=A.rotr32H=A.rotrBL=A.rotrBH=A.rotrSL=A.rotrSH=A.shrSL=A.shrSH=A.toBig=void 0,A.fromBig=n,A.split=s,A.add=v;const t=BigInt(2**32-1),e=BigInt(32);function n(y,g=!1){return g?{h:Number(y&t),l:Number(y>>e&t)}:{h:Number(y>>e&t)|0,l:Number(y&t)|0}}function s(y,g=!1){let d=new Uint32Array(y.length),m=new Uint32Array(y.length);for(let C=0;C<y.length;C++){const{h:L,l:U}=n(y[C],g);[d[C],m[C]]=[L,U]}return[d,m]}const r=(y,g)=>BigInt(y>>>0)<<e|BigInt(g>>>0);A.toBig=r;const i=(y,g,d)=>y>>>d;A.shrSH=i;const o=(y,g,d)=>y<<32-d|g>>>d;A.shrSL=o;const a=(y,g,d)=>y>>>d|g<<32-d;A.rotrSH=a;const u=(y,g,d)=>y<<32-d|g>>>d;A.rotrSL=u;const f=(y,g,d)=>y<<64-d|g>>>d-32;A.rotrBH=f;const _=(y,g,d)=>y>>>d-32|g<<64-d;A.rotrBL=_;const l=(y,g)=>g;A.rotr32H=l;const h=(y,g)=>y;A.rotr32L=h;const c=(y,g,d)=>y<<d|g>>>32-d;A.rotlSH=c;const p=(y,g,d)=>g<<d|y>>>32-d;A.rotlSL=p;const I=(y,g,d)=>g<<d-32|y>>>64-d;A.rotlBH=I;const w=(y,g,d)=>y<<d-32|g>>>64-d;A.rotlBL=w;function v(y,g,d,m){const C=(g>>>0)+(m>>>0);return{h:y+d+(C/2**32|0)|0,l:C|0}}const k=(y,g,d)=>(y>>>0)+(g>>>0)+(d>>>0);A.add3L=k;const P=(y,g,d,m)=>g+d+m+(y/2**32|0)|0;A.add3H=P;const E=(y,g,d,m)=>(y>>>0)+(g>>>0)+(d>>>0)+(m>>>0);A.add4L=E;const b=(y,g,d,m,C)=>g+d+m+C+(y/2**32|0)|0;A.add4H=b;const S=(y,g,d,m,C)=>(y>>>0)+(g>>>0)+(d>>>0)+(m>>>0)+(C>>>0);A.add5L=S;const x=(y,g,d,m,C,L)=>g+d+m+C+L+(y/2**32|0)|0;A.add5H=x;const R={fromBig:n,split:s,toBig:r,shrSH:i,shrSL:o,rotrSH:a,rotrSL:u,rotrBH:f,rotrBL:_,rotr32H:l,rotr32L:h,rotlSH:c,rotlSL:p,rotlBH:I,rotlBL:w,add:v,add3L:k,add3H:P,add4L:E,add4H:b,add5H:x,add5L:S};return A.default=R,A}var Le={},oe={},ct;function zn(){return ct||(ct=1,Object.defineProperty(oe,"__esModule",{value:!0}),oe.crypto=void 0,oe.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),oe}var dt;function $n(){return dt||(dt=1,function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.Hash=t.nextTick=t.byteSwapIfBE=t.isLE=void 0,t.isBytes=s,t.u8=r,t.u32=i,t.createView=o,t.rotr=a,t.rotl=u,t.byteSwap=f,t.byteSwap32=_,t.bytesToHex=h,t.hexToBytes=I,t.asyncLoop=v,t.utf8ToBytes=k,t.toBytes=P,t.concatBytes=E,t.checkOpts=S,t.wrapConstructor=x,t.wrapConstructorWithOpts=R,t.wrapXOFConstructorWithOpts=y,t.randomBytes=g;const e=zn(),n=Jt();function s(d){return d instanceof Uint8Array||ArrayBuffer.isView(d)&&d.constructor.name==="Uint8Array"}function r(d){return new Uint8Array(d.buffer,d.byteOffset,d.byteLength)}function i(d){return new Uint32Array(d.buffer,d.byteOffset,Math.floor(d.byteLength/4))}function o(d){return new DataView(d.buffer,d.byteOffset,d.byteLength)}function a(d,m){return d<<32-m|d>>>m}function u(d,m){return d<<m|d>>>32-m>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function f(d){return d<<24&4278190080|d<<8&16711680|d>>>8&65280|d>>>24&255}t.byteSwapIfBE=t.isLE?d=>d:d=>f(d);function _(d){for(let m=0;m<d.length;m++)d[m]=f(d[m])}const l=Array.from({length:256},(d,m)=>m.toString(16).padStart(2,"0"));function h(d){(0,n.abytes)(d);let m="";for(let C=0;C<d.length;C++)m+=l[d[C]];return m}const c={_0:48,_9:57,A:65,F:70,a:97,f:102};function p(d){if(d>=c._0&&d<=c._9)return d-c._0;if(d>=c.A&&d<=c.F)return d-(c.A-10);if(d>=c.a&&d<=c.f)return d-(c.a-10)}function I(d){if(typeof d!="string")throw new Error("hex string expected, got "+typeof d);const m=d.length,C=m/2;if(m%2)throw new Error("hex string expected, got unpadded hex of length "+m);const L=new Uint8Array(C);for(let U=0,q=0;U<C;U++,q+=2){const X=p(d.charCodeAt(q)),Xe=p(d.charCodeAt(q+1));if(X===void 0||Xe===void 0){const yn=d[q]+d[q+1];throw new Error('hex string expected, got non-hex character "'+yn+'" at index '+q)}L[U]=X*16+Xe}return L}const w=async()=>{};t.nextTick=w;async function v(d,m,C){let L=Date.now();for(let U=0;U<d;U++){C(U);const q=Date.now()-L;q>=0&&q<m||(await(0,t.nextTick)(),L+=q)}}function k(d){if(typeof d!="string")throw new Error("utf8ToBytes expected string, got "+typeof d);return new Uint8Array(new TextEncoder().encode(d))}
1function P(d){return typeof d=="string"&&(d=k(d)),(0,n.abytes)(d),d}function E(...d){let m=0;for(let L=0;L<d.length;L++){const U=d[L];(0,n.abytes)(U),m+=U.length}const C=new Uint8Array(m);for(let L=0,U=0;L<d.length;L++){const q=d[L];C.set(q,U),U+=q.length}return C}class b{clone(){return this._cloneInto()}}t.Hash=b;function S(d,m){if(m!==void 0&&{}.toString.call(m)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(d,m)}function x(d){const m=L=>d().update(P(L)).digest(),C=d();return m.outputLen=C.outputLen,m.blockLen=C.blockLen,m.create=()=>d(),m}function R(d){const m=(L,U)=>d(U).update(P(L)).digest(),C=d({});return m.outputLen=C.outputLen,m.blockLen=C.blockLen,m.create=L=>d(L),m}function y(d){const m=(L,U)=>d(U).update(P(L)).digest(),C=d({});return m.outputLen=C.outputLen,m.blockLen=C.blockLen,m.create=L=>d(L),m}function g(d=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(d));if(e.crypto&&typeof e.crypto.randomBytes=="function")return e.crypto.randomBytes(d);throw new Error("crypto.getRandomValues must be defined")}}(Le)),Le}var lt;function Gn(){if(lt)return N;lt=1,Object.defineProperty(N,"__esModule",{value:!0}),N.shake256=N.shake128=N.keccak_512=N.keccak_384=N.keccak_256=N.keccak_224=N.sha3_512=N.sha3_384=N.sha3_256=N.sha3_224=N.Keccak=void 0,N.keccakP=w;const t=Jt(),e=Fn(),n=$n(),s=[],r=[],i=[],o=BigInt(0),a=BigInt(1),u=BigInt(2),f=BigInt(7),_=BigInt(256),l=BigInt(113);for(let E=0,b=a,S=1,x=0;E<24;E++){[S,x]=[x,(2*S+3*x)%5],s.push(2*(5*x+S)),r.push((E+1)*(E+2)/2%64);let R=o;for(let y=0;y<7;y++)b=(b<<a^(b>>f)*l)%_,b&u&&(R^=a<<(a<<BigInt(y))-a);i.push(R)}const[h,c]=(0,e.split)(i,!0),p=(E,b,S)=>S>32?(0,e.rotlBH)(E,b,S):(0,e.rotlSH)(E,b,S),I=(E,b,S)=>S>32?(0,e.rotlBL)(E,b,S):(0,e.rotlSL)(E,b,S);function w(E,b=24){const S=new Uint32Array(10);for(let x=24-b;x<24;x++){for(let g=0;g<10;g++)S[g]=E[g]^E[g+10]^E[g+20]^E[g+30]^E[g+40];for(let g=0;g<10;g+=2){const d=(g+8)%10,m=(g+2)%10,C=S[m],L=S[m+1],U=p(C,L,1)^S[d],q=I(C,L,1)^S[d+1];for(let X=0;X<50;X+=10)E[g+X]^=U,E[g+X+1]^=q}let R=E[2],y=E[3];for(let g=0;g<24;g++){const d=r[g],m=p(R,y,d),C=I(R,y,d),L=s[g];R=E[L],y=E[L+1],E[L]=m,E[L+1]=C}for(let g=0;g<50;g+=10){for(let d=0;d<10;d++)S[d]=E[g+d];for(let d=0;d<10;d++)E[g+d]^=~S[(d+2)%10]&S[(d+4)%10]}E[0]^=h[x],E[1]^=c[x]}S.fill(0)}class v extends n.Hash{constructor(b,S,x,R=!1,y=24){if(super(),this.blockLen=b,this.suffix=S,this.outputLen=x,this.enableXOF=R,this.rounds=y,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,t.anumber)(x),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,n.u32)(this.state)}keccak(){n.isLE||(0,n.byteSwap32)(this.state32),w(this.state32,this.rounds),n.isLE||(0,n.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(b){(0,t.aexists)(this);const{blockLen:S,state:x}=this;b=(0,n.toBytes)(b);const R=b.length;for(let y=0;y<R;){const g=Math.min(S-this.pos,R-y);for(let d=0;d<g;d++)x[this.pos++]^=b[y++];this.pos===S&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:b,suffix:S,pos:x,blockLen:R}=this;b[x]^=S,(S&128)!==0&&x===R-1&&this.keccak(),b[R-1]^=128,this.keccak()}writeInto(b){(0,t.aexists)(this,!1),(0,t.abytes)(b),this.finish();const S=this.state,{blockLen:x}=this;for(let R=0,y=b.length;R<y;){this.posOut>=x&&this.keccak();const g=Math.min(x-this.posOut,y-R);b.set(S.subarray(this.posOut,this.posOut+g),R),this.posOut+=g,R+=g}return b}xofInto(b){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(b)}xof(b){return(0,t.anumber)(b),this.xofInto(new Uint8Array(b))}digestInto(b){if((0,t.aoutput)(b,this),this.finished)throw new Error("digest() was already called");return this.writeInto(b),this.destroy(),b}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(b){const{blockLen:S,suffix:x,outputLen:R,rounds:y,enableXOF:g}=this;return b||(b=new v(S,x,R,g,y)),b.state32.set(this.state32),b.pos=this.pos,b.posOut=this.posOut,b.finished=this.finished,b.rounds=y,b.suffix=x,b.outputLen=R,b.enableXOF=g,b.destroyed=this.destroyed,b}}N.Keccak=v;const k=(E,b,S)=>(0,n.wrapConstructor)(()=>new v(b,E,S));N.sha3_224=k(6,144,224/8),N.sha3_256=k(6,136,256/8),N.sha3_384=k(6,104,384/8),N.sha3_512=k(6,72,512/8),N.keccak_224=k(1,144,224/8),N.keccak_256=k(1,136,256/8),N.keccak_384=k(1,104,384/8),N.keccak_512=k(1,72,512/8);const P=(E,b,S)=>(0,n.wrapXOFConstructorWithOpts)((x={})=>new v(b,E,x.dkLen===void 0?S:x.dkLen,!0));return N.shake128=P(31,168,128/8),N.shake256=P(31,136,256/8),N}var xe,ut;function Qt(){if(ut)return xe;ut=1;const{keccak_256:t}=Gn();function e(c){return O.allocUnsafe(c).fill(0)}function n(c){return c.toString(2).length}function s(c,p){let I=c.toString(16);I.length%2!==0&&(I="0"+I);const w=I.match(/.{1,2}
1/g).map(v=>parseInt(v,16));for(;w.length<p;)w.unshift(0);return O.from(w)}function r(c,p){const I=c<BigInt(0);let w;if(I){const v=(BigInt(1)<<BigInt(p))-BigInt(1);w=(~c&v)+BigInt(1)}else w=c;return w&=(BigInt(1)<<BigInt(p))-BigInt(1),w}function i(c,p,I){const w=e(p);return c=a(c),I?c.length<p?(c.copy(w),w):c.slice(0,p):c.length<p?(c.copy(w,p-c.length),w):c.slice(-p)}function o(c,p){return i(c,p,!0)}function a(c){if(!O.isBuffer(c))if(Array.isArray(c))c=O.from(c);else if(typeof c=="string")l(c)?c=O.from(_(h(c)),"hex"):c=O.from(c);else if(typeof c=="number")c=intToBuffer(c);else if(c==null)c=O.allocUnsafe(0);else if(typeof c=="bigint")c=s(c);else if(c.toArray)c=O.from(c.toArray());else throw new Error("invalid type");return c}function u(c){return c=a(c),"0x"+c.toString("hex")}function f(c,p){if(c=a(c),p||(p=256),p!==256)throw new Error("unsupported");return O.from(t(new Uint8Array(c)))}function _(c){return c.length%2?"0"+c:c}function l(c){return typeof c=="string"&&c.match(/^0x[0-9A-Fa-f]*$/)}function h(c){return typeof c=="string"&&c.startsWith("0x")?c.slice(2):c}return xe={zeros:e,setLength:i,setLengthRight:o,isHexString:l,stripHexPrefix:h,toBuffer:a,bufferToHex:u,keccak:f,bitLengthFromBigInt:n,bufferBEFromBigInt:s,twosFromBigInt:r},xe}var Me,ht;function Yn(){if(ht)return Me;ht=1;const t=Qt();function e(h){return h.startsWith("int[")?"int256"+h.slice(3):h==="int"?"int256":h.startsWith("uint[")?"uint256"+h.slice(4):h==="uint"?"uint256":h.startsWith("fixed[")?"fixed128x128"+h.slice(5):h==="fixed"?"fixed128x128":h.startsWith("ufixed[")?"ufixed128x128"+h.slice(6):h==="ufixed"?"ufixed128x128":h}function n(h){return Number.parseInt(/^\D+(\d+)$/.exec(h)[1],10)}function s(h){var c=/^\D+(\d+)x(\d+)$/.exec(h);return[Number.parseInt(c[1],10),Number.parseInt(c[2],10)]}function r(h){var c=h.match(/(.*)\[(.*?)\]$/);return c?c[2]===""?"dynamic":Number.parseInt(c[2],10):null}function i(h){var c=typeof h;if(c==="string"||c==="number")return BigInt(h);if(c==="bigint")return h;throw new Error("Argument is not a number")}function o(h,c){var p,I,w,v;if(h==="address")return o("uint160",i(c));if(h==="bool")return o("uint8",c?1:0);if(h==="string")return o("bytes",new O(c,"utf8"));if(u(h)){if(typeof c.length>"u")throw new Error("Not an array?");if(p=r(h),p!=="dynamic"&&p!==0&&c.length>p)throw new Error("Elements exceed array size: "+p);w=[],h=h.slice(0,h.lastIndexOf("[")),typeof c=="string"&&(c=JSON.parse(c));for(v in c)w.push(o(h,c[v]));if(p==="dynamic"){var k=o("uint256",c.length);w.unshift(k)}return O.concat(w)}else{if(h==="bytes")return c=new O(c),w=O.concat([o("uint256",c.length),c]),c.length%32!==0&&(w=O.concat([w,t.zeros(32-c.length%32)])),w;if(h.startsWith("bytes")){if(p=n(h),p<1||p>32)throw new Error("Invalid bytes<N> width: "+p);return t.setLengthRight(c,32)}else if(h.startsWith("uint")){if(p=n(h),p%8||p<8||p>256)throw new Error("Invalid uint<N> width: "+p);I=i(c);const P=t.bitLengthFromBigInt(I);if(P>p)throw new Error("Supplied uint exceeds width: "+p+" vs "+P);if(I<0)throw new Error("Supplied uint is negative");return t.bufferBEFromBigInt(I,32)}else if(h.startsWith("int")){if(p=n(h),p%8||p<8||p>256)throw new Error("Invalid int<N> width: "+p);I=i(c);const P=t.bitLengthFromBigInt(I);if(P>p)throw new Error("Supplied int exceeds width: "+p+" vs "+P);const E=t.twosFromBigInt(I,256);return t.bufferBEFromBigInt(E,32)}else if(h.startsWith("ufixed")){if(p=s(h),I=i(c),I<0)throw new Error("Supplied ufixed is negative");return o("uint256",I*BigInt(2)**BigInt(p[1]))}else if(h.startsWith("fixed"))return p=s(h),o("int256",i(c)*BigInt(2)**BigInt(p[1]))}throw new Error("Unsupported or invalid type: "+h)}function a(h){return h==="string"||h==="bytes"||r(h)==="dynamic"}function u(h){return h.lastIndexOf("]")===h.length-1}function f(h,c){var p=[],I=[],w=32*h.length;for(var v in h){var k=e(h[v]),P=c[v],E=o(k,P);a(k)?(p.push(o("uint256",w)),I.push(E),w+=E.length):p.push(E)}return O.concat(p.concat(I))}function _(h,c){if(h.length!==c.length)throw new Error("Number of types are not matching the values");for(var p,I,w=[],v=0;v<h.length;v++){var k=e(h[v]),P=c[v];if(k==="bytes")w.push(P);else if(k==="string")w.push(new O(P,"utf8"));else if(k==="bool")w.push(new O(P?"01":"00","hex"));else if(k==="address")w.push(t.setLength(P,20));else if(k.startsWith("bytes")){if(p=n(k),p<1||p>32)throw new Error("Invalid bytes<N> width: "+p);w.push(t.setLengthRight(P,p))}else if(k.startsWith("uint")){if(p=n(k),p%8||p<8||p>256)throw new Error("Invalid uint<N> width: "+p);I=i(P);const E=t.bitLengthFromBigInt(I);if(E>p)throw new Error("Supplied uint exceeds width: "+p+" vs "+E);w.push(t.bufferBEFromBigInt(I,p/8))}else if(k.startsWith("int")){if(p=n(k),p%8||p<8||p>256)throw new Error("Invalid int<N> width: "+p);I=i(P);const E=t.bitLengthFromBigInt(I);if(E>p)throw new Error("Supplied int exceeds width: "+p+" vs "+E);
1const b=t.twosFromBigInt(I,p);w.push(t.bufferBEFromBigInt(b,p/8))}else throw new Error("Unsupported or invalid type: "+k)}return O.concat(w)}function l(h,c){return t.keccak(_(h,c))}return Me={rawEncode:f,solidityPack:_,soliditySHA3:l},Me}var Pe,ft;function Vn(){if(ft)return Pe;ft=1;const t=Qt(),e=Yn(),n={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"]},s={encodeData(i,o,a,u=!0){const f=["bytes32"],_=[this.hashType(i,a)];if(u){const l=(h,c,p)=>{if(a[c]!==void 0)return["bytes32",p==null?"0x0000000000000000000000000000000000000000000000000000000000000000":t.keccak(this.encodeData(c,p,a,u))];if(p===void 0)throw new Error("missing value for field ".concat(h," of type ").concat(c));if(c==="bytes")return["bytes32",t.keccak(p)];if(c==="string")return typeof p=="string"&&(p=O.from(p,"utf8")),["bytes32",t.keccak(p)];if(c.lastIndexOf("]")===c.length-1){const I=c.slice(0,c.lastIndexOf("[")),w=p.map(v=>l(h,I,v));return["bytes32",t.keccak(e.rawEncode(w.map(([v])=>v),w.map(([,v])=>v)))]}return[c,p]};for(const h of a[i]){const[c,p]=l(h.name,h.type,o[h.name]);f.push(c),_.push(p)}}else for(const l of a[i]){let h=o[l.name];if(h!==void 0)if(l.type==="bytes")f.push("bytes32"),h=t.keccak(h),_.push(h);else if(l.type==="string")f.push("bytes32"),typeof h=="string"&&(h=O.from(h,"utf8")),h=t.keccak(h),_.push(h);else if(a[l.type]!==void 0)f.push("bytes32"),h=t.keccak(this.encodeData(l.type,h,a,u)),_.push(h);else{if(l.type.lastIndexOf("]")===l.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");f.push(l.type),_.push(h)}}return e.rawEncode(f,_)},encodeType(i,o){let a="",u=this.findTypeDependencies(i,o).filter(f=>f!==i);u=[i].concat(u.sort());for(const f of u){if(!o[f])throw new Error("No type definition specified: "+f);a+=f+"("+o[f].map(({name:l,type:h})=>h+" "+l).join(",")+")"}return a},findTypeDependencies(i,o,a=[]){if(i=i.match(/^\w*/)[0],a.includes(i)||o[i]===void 0)return a;a.push(i);for(const u of o[i])for(const f of this.findTypeDependencies(u.type,o,a))!a.includes(f)&&a.push(f);return a},hashStruct(i,o,a,u=!0){return t.keccak(this.encodeData(i,o,a,u))},hashType(i,o){return t.keccak(this.encodeType(i,o))},sanitizeData(i){const o={};for(const a in n.properties)i[a]&&(o[a]=i[a]);return o.types&&(o.types=Object.assign({EIP712Domain:[]},o.types)),o},hash(i,o=!0){const a=this.sanitizeData(i),u=[O.from("1901","hex")];return u.push(this.hashStruct("EIP712Domain",a.domain,a.types,o)),a.primaryType!=="EIP712Domain"&&u.push(this.hashStruct(a.primaryType,a.message,a.types,o)),t.keccak(O.concat(u))}};Pe={TYPED_MESSAGE_SCHEMA:n,TypedDataUtils:s,hashForSignTypedDataLegacy:function(i){return r(i.data)},hashForSignTypedData_v3:function(i){return s.hash(i.data,!1)},hashForSignTypedData_v4:function(i){return s.hash(i.data)}};function r(i){const o=new Error("Expect argument to be non-empty array");if(typeof i!="object"||!i.length)throw o;const a=i.map(function(_){return _.type==="bytes"?t.toBuffer(_.value):_.value}),u=i.map(function(_){return _.type}),f=i.map(function(_){if(!_.name)throw o;return _.type+" "+_.name});return e.soliditySHA3(["bytes32","bytes32"],[e.soliditySHA3(new Array(i.length).fill("string"),f),e.soliditySHA3(u,a)])}return Pe}var Jn=Vn();const fe=bn(Jn),Qn="walletUsername",De="Addresses",Zn="AppVersion";function H(t){return t.errorMessage!==void 0}class Xn{constructor(e){this.secret=e}async encrypt(e){const n=this.secret;if(n.length!==64)throw Error("secret must be 256 bits");const s=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.importKey("raw",_e(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:s},r,i.encode(e)),a=16,u=o.slice(o.byteLength-a),f=o.slice(0,o.byteLength-a),_=new Uint8Array(u),l=new Uint8Array(f),h=new Uint8Array([...s,..._,...l]);return Fe(h)}async decrypt(e){const n=this.secret;if(n.length!==64)throw Error("secret must be 256 bits");return new Promise((s,r)=>{(async function(){const i=await crypto.subtle.importKey("raw",_e(n),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=_e(e),a=o.slice(0,12),u=o.slice(12,28),f=o.slice(28),_=new Uint8Array([...f,...u]),l={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(l,i,_),c=new TextDecoder;s(c.decode(h))}catch(h){r(h)}})()})}}class es{constructor(e,n,s){this.linkAPIUrl=e,this.sessionId=n;const r="".concat(n,":").concat(s);this.auth="Basic ".concat(btoa(r))}async markUnseenEventsAsSeen(e){return Promise.all(e.map(n=>fetch("".concat(this.linkAPIUrl,"/events/").concat(n.eventId,"/seen"),{method:"POST",headers:{Authorization:this.auth}}))).catch(n=>console.error("Unabled to mark event as failed:",n))}async fetchUnseenEvents(){var e;const n=await fetch("".concat(this.linkAPIUrl,"/events?unseen=true"),{headers:{Authorization:this.auth}});if(n.ok){const{events:s,error:r}=await n.json();if(r)throw new Error("Check unseen events failed: ".concat(r));const i=(e=s==null?void 0:s.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error("Check unseen events failed: ".concat(n.status))}}var Y;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Y||(Y={}));class ts{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,n=WebSocket){this.WebSocketClass=n,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}
1async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,n)=>{var s;let r;try{this.webSocket=r=new this.WebSocketClass(this.url)}catch(i){n(i);return}(s=this.connectionStateListener)===null||s===void 0||s.call(this,Y.CONNECTING),r.onclose=i=>{var o;this.clearWebSocket(),n(new Error("websocket error ".concat(i.code,": ").concat(i.reason))),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Y.DISCONNECTED)},r.onopen=i=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,Y.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(u=>this.sendData(u)),this.pendingData=[])},r.onmessage=i=>{var o,a;if(i.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const u=JSON.parse(i.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,u)}catch(u){}}})}disconnect(){var e;const{webSocket:n}=this;if(n){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Y.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{n.close()}catch(s){}}}sendData(e){const{webSocket:n}=this;if(!n){this.pendingData.push(e),this.connect();return}n.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const pt=1e4,ns=6e4;class ss{constructor({session:e,linkAPIUrl:n,listener:s}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=$(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=i=>{if(!i)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",a=>i.JsonRpcUrl&&this.handleChainUpdated(a,i.JsonRpcUrl)]]).forEach((a,u)=>{const f=i[u];f!==void 0&&a(f)})},this.handleDestroyed=i=>{var o;i==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async i=>{var o;const a=await this.cipher.decrypt(i);(o=this.listener)===null||o===void 0||o.accountUpdated(a)},this.handleMetadataUpdated=async(i,o)=>{var a;const u=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.metadataUpdated(i,u)},this.handleWalletUsernameUpdated=async i=>{this.handleMetadataUpdated(Qn,i)},this.handleAppVersionUpdated=async i=>{this.handleMetadataUpdated(Zn,i)},this.handleChainUpdated=async(i,o)=>{var a;const u=await this.cipher.decrypt(i),f=await this.cipher.decrypt(o);(a=this.listener)===null||a===void 0||a.chainUpdated(u,f)},this.session=e,this.cipher=new Xn(e.secret),this.listener=s;const r=new ts("".concat(n,"/rpc"),WebSocket);r.setConnectionStateListener(async i=>{let o=!1;switch(i){case Y.DISCONNECTED:if(!this.destroyed){const a=async()=>{await new Promise(u=>setTimeout(u,5e3)),this.destroyed||r.connect().catch(()=>{a()})};a()}break;case Y.CONNECTED:o=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},pt),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Y.CONNECTING:break}this.connected!==o&&(this.connected=o)}),r.setIncomingDataListener(i=>{var o;switch(i.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const a=i.type==="IsLinkedOK"?i.linked:void 0;this.linked=a||i.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(i.metadata);break}case"Event":{this.handleIncomingEvent(i);break}}i.id!==void 0&&((o=this.requestResolutions.get(i.id))===null||o===void 0||o(i))}),this.ws=r,this.http=new es(n,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:$(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 n,s;this._linked=e,e&&((n=this.onceLinked)===null||n===void 0||n.call(this)),(s=this.listener)===null||s===void 0||s.linkedUpdated(e)}setOnceLinked(e){return new Promise(n=>{this.linked?e().then(n):this.onceLinked=()=>{e().then(n),this.onceLinked=void 0}})}async handleIncomingEvent(e){var n;if(e.type!=="Event"||e.event!=="Web3Response")return;const s=await this.cipher.decrypt(e.data),r=JSON.parse(s);if(r.type!=="WEB3_RESPONSE")return;const{id:i,response:o}=r;(n=this.listener)===null||n===void 0||n.handleWeb3ResponseMessage(i,o)}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
1h(n=>this.handleIncomingEvent(n))}async publishEvent(e,n,s=!1){const r=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},n),{origin:location.origin,location:location.href,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:$(this.nextReqId++),sessionId:this.session.id,event:e,data:r,callWebhook:s};return this.setOnceLinked(async()=>{const o=await this.makeRequest(i);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>pt*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,n={timeout:ns}){const s=e.id;this.sendData(e);let r;return Promise.race([new Promise((i,o)=>{r=window.setTimeout(()=>{o(new Error("request ".concat(s," timed out")))},n.timeout)}),new Promise(i=>{this.requestResolutions.set(s,o=>{clearTimeout(r),i(o),this.requestResolutions.delete(s)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:$(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:$(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:$(this.nextReqId++),sessionId:this.session.id}),!0)}}class is{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,n=zt(e.toString(16));return this.callbacks.get(n)&&this.callbacks.delete(n),e}}const _t="session:id",gt="session:secret",mt="session:linked";class se{constructor(e,n,s,r=!1){this.storage=e,this.id=n,this.secret=s,this.key=wn(vn("".concat(n,", ").concat(s," WalletLink"))),this._linked=!!r}static create(e){const n=ee(16),s=ee(32);return new se(e,n,s).save()}static load(e){const n=e.getItem(_t),s=e.getItem(mt),r=e.getItem(gt);return n&&r?new se(e,n,r,s==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(_t,this.id),this.storage.setItem(gt,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(mt,this._linked?"1":"0")}}function rs(){try{return window.frameElement!==null}catch(t){return!1}}function os(){try{return rs()&&window.top?window.top.location:window.location}catch(t){return window.location}}function as(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function Zt(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const cs='@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}';function Xt(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(cs)),document.documentElement.appendChild(t)}var ke,D,en,te,yt,tn,nn,sn,Ye,Ue,je,ue={},rn=[],ds=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ve=Array.isArray;function Z(t,e){for(var n in e)t[n]=e[n];return t}function Je(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function T(t,e,n){var s,r,i,o={};for(i in e)i=="key"?s=e[i]:i=="ref"?r=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?ke.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return ge(t,o,s,r,null)}function ge(t,e,n,s,r){var i={type:t,props:e,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r==null?++en:r,__i:-1,__u:0};return r==null&&D.vnode!=null&&D.vnode(i),i}function Ee(t){return t.children}function me(t,e){this.props=t,this.context=e}function ie(t,e){if(e==null)return t.__?ie(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?ie(t):null}function on(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return on(t)}}function bt(t){(!t.__d&&(t.__d=!0)&&te.push(t)&&!be.__r++||yt!==D.debounceRendering)&&((yt=D.debounceRendering)||tn)(be)}function be(){for(var t,e,n,s,r,i,o,a=1;te.length;)te.length>a&&te.sort(nn),t=te.shift(),a=te.length,t.__d&&(n=void 0,r=(s=(e=t).__v).__e,i=[],o=[],e.__P&&((n=Z({},s)).__v=s.__v+1,D.vnode&&D.vnode(n),Qe(e.__P,n,s,e.__n,e.__P.namespaceURI,32&s.__u?[r]:null,i,r==null?ie(s):r,!!(32&s.__u),o),n.__v=s.__v,n.__.__k[n.__i]=n,dn(i,n,o),n.__e!=r&&on(n)));be.__r=0}function an(t,e,n,s,r,i,o,a,u,f,_){var l,h,c,p,I,w,v=s&&s.__k||rn,k=e.length;for(u=ls(n,e,v,u,k),l=0;l<k;l++)(c=n.__k[l])!=null&&(h=c.__i===-1?ue:v[c.__i]||ue,c.__i=l,w=Qe(t,c,h,r,i,o,a,u,f,_),p=c.__e,c.ref&&h.ref!=c.ref&&(h.ref&&Ze(h.ref,null,c),_.push(c.ref,c.__c||p,c)),I==null&&p!=null&&(I=p),4&c.__u||h.__k===c.__k?u=cn(c,u,t):typeof c.type=="function"&&w!==void 0?u=w:p&&(u=p.nextSibling),c.__u&=-7
1);return n.__e=I,u}function ls(t,e,n,s,r){var i,o,a,u,f,_=n.length,l=_,h=0;for(t.__k=new Array(r),i=0;i<r;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=i+h,(o=t.__k[i]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?ge(null,o,null,null,null):Ve(o)?ge(Ee,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?ge(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,a=null,(f=o.__i=us(o,n,u,l))!==-1&&(l--,(a=n[f])&&(a.__u|=2)),a==null||a.__v===null?(f==-1&&h--,typeof o.type!="function"&&(o.__u|=4)):f!=u&&(f==u-1?h--:f==u+1?h++:(f>u?h--:h++,o.__u|=4))):t.__k[i]=null;if(l)for(i=0;i<_;i++)(a=n[i])!=null&&(2&a.__u)==0&&(a.__e==s&&(s=ie(a)),ln(a,a));return s}function cn(t,e,n){var s,r;if(typeof t.type=="function"){for(s=t.__k,r=0;s&&r<s.length;r++)s[r]&&(s[r].__=t,e=cn(s[r],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=ie(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function us(t,e,n,s){var r,i,o=t.key,a=t.type,u=e[n];if(u===null||u&&o==u.key&&a===u.type&&(2&u.__u)==0)return n;if(s>(u!=null&&(2&u.__u)==0?1:0))for(r=n-1,i=n+1;r>=0||i<e.length;){if(r>=0){if((u=e[r])&&(2&u.__u)==0&&o==u.key&&a===u.type)return r;r--}if(i<e.length){if((u=e[i])&&(2&u.__u)==0&&o==u.key&&a===u.type)return i;i++}}return-1}function wt(t,e,n){e[0]=="-"?t.setProperty(e,n==null?"":n):t[e]=n==null?"":typeof n!="number"||ds.test(e)?n:n+"px"}function pe(t,e,n,s,r){var i;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof s=="string"&&(t.style.cssText=s=""),s)for(e in s)n&&e in n||wt(t.style,e,"");if(n)for(e in n)s&&n[e]===s[e]||wt(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(sn,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?s?n.u=s.u:(n.u=Ye,t.addEventListener(e,i?je:Ue,i)):t.removeEventListener(e,i?je:Ue,i);else{if(r=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n==null?"":n;break e}catch(o){}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function vt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Ye++;else if(e.t<n.u)return;return n(D.event?D.event(e):e)}}}function Qe(t,e,n,s,r,i,o,a,u,f){var _,l,h,c,p,I,w,v,k,P,E,b,S,x,R,y,g,d,m=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),i=[a=e.__e=n.__e]),(_=D.__b)&&_(e);e:if(typeof m=="function")try{if(v=e.props,k="prototype"in m&&m.prototype.render,P=(_=m.contextType)&&s[_.__c],E=_?P?P.props.value:_.__:s,n.__c?w=(l=e.__c=n.__c).__=l.__E:(k?e.__c=l=new m(v,E):(e.__c=l=new me(v,E),l.constructor=m,l.render=fs),P&&P.sub(l),l.props=v,l.state||(l.state={}),l.context=E,l.__n=s,h=l.__d=!0,l.__h=[],l._sb=[]),k&&l.__s==null&&(l.__s=l.state),k&&m.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=Z({},l.__s)),Z(l.__s,m.getDerivedStateFromProps(v,l.__s))),c=l.props,p=l.state,l.__v=e,h)k&&m.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),k&&l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(k&&m.getDerivedStateFromProps==null&&v!==c&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(v,E),!l.__e&&(l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(v,l.__s,E)===!1||e.__v==n.__v)){for(e.__v!=n.__v&&(l.props=v,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(C){C&&(C.__=e)}),b=0;b<l._sb.length;b++)l.__h.push(l._sb[b]);l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(v,l.__s,E),k&&l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(c,p,I)})}if(l.context=E,l.props=v,l.__P=t,l.__e=!1,S=D.__r,x=0,k){for(l.state=l.__s,l.__d=!1,S&&S(e),_=l.render(l.props,l.state,l.context),R=0;R<l._sb.length;R++)l.__h.push(l._sb[R]);l._sb=[]}else do l.__d=!1,S&&S(e),_=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++x<25);l.state=l.__s,l.getChildContext!=null&&(s=Z(Z({},s),l.getChildContext())),k&&!h&&l.getSnapshotBeforeUpdate!=null&&(I=l.getSnapshotBeforeUpdate(c,p)),g=(y=_!=null&&_.type===Ee&&_.key==null)?_.props.children:_,y&&(_.props.children=null),a=an(t,Ve(g)?g:[g],e,n,s,r,i,o,a,u,f),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),w&&(l.__E=l.__=null)}catch(C){if(e.__v=null,u||i!=null)if(C.then){for(e.__u|=u?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else for(d=i.length;d--;)Je(i[d]);else e.__e=n.__e,e.__k=n.__k;D.__e(C,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=hs(n.__e,e,n,s,r,i,o,u,f);return(_=D.diffed)&&_(e),128&e.__u?void 0:a}function dn(t,e,n){for(var s=0;s<n.length;s++)Ze(n[s],n[++s],n[++s]);D.__c&&D.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(i){i.call(r)})}catch(i){D.__e(i,r.__v)}})}function hs(t,e,n,s,r,i,o,a,u){var f,_,l,h,c,p,I,w=n.props,v=e.props,k=e.type;if(k=="svg"?r="http://www.w3.org/2000/svg":k=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),i!=null){for(f=0;f<i.length;f++)if((c=i[f])&&"setAttribute"in c==!!k&&(k?c.localName==k:c.nodeType==3)){t=c,i[f]=null;break}}if(t==null){if(k==null)return document.createTextNode(v);
1t=document.createElementNS(r,k,v.is&&v),a&&(D.__m&&D.__m(e,i),a=!1),i=null}if(k===null)w===v||a&&t.data===v||(t.data=v);else{if(i=i&&ke.call(t.childNodes),w=n.props||ue,!a&&i!=null)for(w={},f=0;f<t.attributes.length;f++)w[(c=t.attributes[f]).name]=c.value;for(f in w)if(c=w[f],f!="children"){if(f=="dangerouslySetInnerHTML")l=c;else if(!(f in v)){if(f=="value"&&"defaultValue"in v||f=="checked"&&"defaultChecked"in v)continue;pe(t,f,null,c,r)}}for(f in v)c=v[f],f=="children"?h=c:f=="dangerouslySetInnerHTML"?_=c:f=="value"?p=c:f=="checked"?I=c:a&&typeof c!="function"||w[f]===c||pe(t,f,c,w[f],r);if(_)a||l&&(_.__html===l.__html||_.__html===t.innerHTML)||(t.innerHTML=_.__html),e.__k=[];else if(l&&(t.innerHTML=""),an(e.type==="template"?t.content:t,Ve(h)?h:[h],e,n,s,k=="foreignObject"?"http://www.w3.org/1999/xhtml":r,i,o,i?i[0]:n.__k&&ie(n,0),a,u),i!=null)for(f=i.length;f--;)Je(i[f]);a||(f="value",k=="progress"&&p==null?t.removeAttribute("value"):p!==void 0&&(p!==t[f]||k=="progress"&&!p||k=="option"&&p!==w[f])&&pe(t,f,p,w[f],r),f="checked",I!==void 0&&I!==t[f]&&pe(t,f,I,w[f],r))}return t}function Ze(t,e,n){try{if(typeof t=="function"){var s=typeof t.__u=="function";s&&t.__u(),s&&e==null||(t.__u=t(e))}else t.current=e}catch(r){D.__e(r,n)}}function ln(t,e,n){var s,r;if(D.unmount&&D.unmount(t),(s=t.ref)&&(s.current&&s.current!==t.__e||Ze(s,null,e)),(s=t.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){D.__e(i,e)}s.base=s.__P=null}if(s=t.__k)for(r=0;r<s.length;r++)s[r]&&ln(s[r],e,n||typeof t.type!="function");n||Je(t.__e),t.__c=t.__=t.__e=void 0}function fs(t,e,n){return this.constructor(t,n)}function Be(t,e,n){var s,r,i,o;e==document&&(e=document.documentElement),D.__&&D.__(t,e),r=(s=!1)?null:e.__k,i=[],o=[],Qe(e,t=e.__k=T(Ee,null,[t]),r||ue,ue,e.namespaceURI,r?null:e.firstChild?ke.call(e.childNodes):null,i,r?r.__e:e.firstChild,s,o),dn(i,t,o)}ke=rn.slice,D={__e:function(t,e,n,s){for(var r,i,o;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(t)),o=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(t,s||{}),o=r.__d),o)return r.__E=r}catch(a){t=a}throw t}},en=0,me.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Z({},this.state),typeof t=="function"&&(t=t(Z({},n),this.props)),t&&Z(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),bt(this))},me.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),bt(this))},me.prototype.render=Ee,te=[],tn=typeof Promise=="function"?Promise.prototype.then.bind(Prom
vendor: 4,324 bytes, line 1
1ise.resolve()):setTimeout,nn=function(t,e){return t.__v.__b-e.__v.__b},be.__r=0,sn=/(PointerCapture)$|Capture$/i,Ye=0,Ue=vt(!1),je=vt(!0);var we,B,Re,kt,We=0,un=[],W=D,Et=W.__b,It=W.__r,St=W.diffed,Ct=W.__c,At=W.unmount,Lt=W.__;function hn(t,e){W.__h&&W.__h(B,t,We||e),We=0;var n=B.__H||(B.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function xt(t){return We=1,ps(fn,t)}function ps(t,e,n){var s=hn(we++,2);if(s.t=t,!s.__c&&(s.__=[fn(void 0,e),function(a){var u=s.__N?s.__N[0]:s.__[0],f=s.t(u,a);u!==f&&(s.__N=[f,s.__[1]],s.__c.setState({}))}],s.__c=B,!B.__f)){var r=function(a,u,f){if(!s.__c.__H)return!0;var _=s.__c.__H.__.filter(function(h){return!!h.__c});if(_.every(function(h){return!h.__N}))return!i||i.call(this,a,u,f);var l=s.__c.props!==a;return _.forEach(function(h){if(h.__N){var c=h.__[0];h.__=h.__N,h.__N=void 0,c!==h.__[0]&&(l=!0)}}),i&&i.call(this,a,u,f)||l};B.__f=!0;var i=B.shouldComponentUpdate,o=B.componentWillUpdate;B.componentWillUpdate=function(a,u,f){if(this.__e){var _=i;i=void 0,r(a,u,f),i=_}o&&o.call(this,a,u,f)},B.shouldComponentUpdate=r}return s.__N||s.__}function _s(t,e){var n=hn(we++,3);!W.__s&&ys(n.__H,e)&&(n.__=t,n.u=e,B.__H.__h.push(n))}function gs(){for(var t;t=un.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ye),t.__H.__h.forEach(He),t.__H.__h=[]}catch(e){t.__H.__h=[],W.__e(e,t.__v)}}W.__b=function(t){B=null,Et&&Et(t)},W.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lt&&Lt(t,e)},W.__r=function(t){It&&It(t),we=0;var e=(B=t.__c).__H;e&&(Re===B?(e.__h=[],B.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(ye),e.__h.forEach(He),e.__h=[],we=0)),Re=B},W.diffed=function(t){St&&St(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(un.push(e)!==1&&kt===W.requestAnimationFrame||((kt=W.requestAnimationFrame)||ms)(gs)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Re=B=null},W.__c=function(t,e){e.some(function(n){try{n.__h.forEach(ye),n.__h=n.__h.filter(function(s){return!s.__||He(s)})}catch(s){e.some(function(r){r.__h&&(r.__h=[])}),e=[],W.__e(s,n.__v)}}),Ct&&Ct(t,e)},W.unmount=function(t){At&&At(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(s){try{ye(s)}catch(r){e=r}}),n.__H=void 0,e&&W.__e(e,n.__v))};var Mt=typeof requestAnimationFrame=="function";function ms(t){var e,n=function(){clearTimeout(s),Mt&&cancelAnimationFrame(e),setTimeout(t)},s=setTimeout(n,100);Mt&&(e=requestAnimationFrame(n))}function ye(t){var e=B,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),B=e}function He(t){var e=B;t.__c=t.__(),B=e}function ys(t,e){return!t||t.length!==e.length||e.some(function(n,s){return n!==t[s]})}function fn(t,e){return typeof e=="function"?e(t):e}const bs=".-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;cursor: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}
1.-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}",ws="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",vs="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class ks{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=Zt()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const n=this.nextItemKey++;return this.items.set(n,e),this.render(),()=>{this.items.delete(n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Be(T("div",null,T(pn,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,n])=>T(Es,Object.assign({},n,{key:e}))))),this.root)}}const pn=t=>T("div",{class:ae("-cbwsdk-snackbar-container")},T("style",null,bs),T("div",{class:"-cbwsdk-snackbar"},t.children)),Es=({autoExpand:t,message:e,menuItems:n})=>{const[s,r]=xt(!0),[i,o]=xt(t!=null?t:!1);_s(()=>{const u=[window.setTimeout(()=>{r(!1)}
1,1),window.setTimeout(()=>{o(!0)},1e4)];return()=>{u.forEach(window.clearTimeout)}});const a=()=>{o(!i)};return T("div",{class:ae("-cbwsdk-snackbar-instance",s&&"-cbwsdk-snackbar-instance-hidden",i&&"-cbwsdk-snackbar-instance-expanded")},T("div",{class:"-cbwsdk-snackbar-instance-header",onClick:a},T("img",{src:ws,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",T("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),T("div",{class:"-gear-container"},!i&&T("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),T("img",{src:vs,class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&T("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map((u,f)=>T("div",{class:ae("-cbwsdk-snackbar-instance-menu-item",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:u.onClick,key:f},T("svg",{width:u.svgWidth,height:u.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},T("path",{"fill-rule":u.defaultFillRule,"clip-rule":u.defaultClipRule,d:u.path,fill:"#AAAAAA"})),T("span",{class:ae("-cbwsdk-snackbar-instance-menu-item-info",u.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},u.info)))))};class Is{constructor(){this.attached=!1,this.snackbar=new ks}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,n=document.createElement("div");n.className="-cbwsdk-css-reset",e.appendChild(n),this.snackbar.attach(n),this.attached=!0,Xt()}showConnecting(e){let n;return e.isUnlinkedErrorState?n={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}]}:n={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:"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}]},this.snackbar.presentItem(n)}}const Ss=".-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}
1.-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}";class Cs{constructor(){this.root=null,this.darkMode=Zt()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Xt()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Be(null,this.root),e&&Be(T(As,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const As=({title:t,buttonText:e,darkMode:n,onButtonClick:s,onDismiss:r})=>{const i=n?"dark":"light";return T(pn,{darkMode:n},T("div",{class:"-cbwsdk-redirect-dialog"},T("style",null,Ss),T("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:r}),T("div",{class:ae("-cbwsdk-redirect-dialog-box",i)},T("p",null,t),T("button",{onClick:s},e))))},Ls="https://keys.coinbase.com/connect",xs="http://rpc.wallet.coinbase.com",Pt="https://www.walletlink.org",Ms="https://go.cb-w.com/walletlink";class Rt{constructor(){this.attached=!1,this.redirectDialog=new Cs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const n=new URL(Ms);n.searchParams.append("redirect_url",os().href),e&&n.searchParams.append("wl_url",e);const s=document.createElement("a");s.target="cbw-opener",s.href=n.href,s.rel="noreferrer noopener",s.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 G{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=as(),this.linkedUpdated=i=>{this.isLinked=i;const o=this.storage.getItem(De);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,o){const a=o.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";a[0]!==""&&!i&&this._session.linked&&!u&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,o)=>{this.storage.setItem(i,o)},this.chainUpdated=(i,o)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:i,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(o,Number.parseInt(i,10)))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),G.accountRequestCallbackIds.size>0&&(Array.from(G.accountRequestCallbackIds.values()).forEach(o=>{this.invokeCallback(o,{method:"requestEthereumAccounts",result:[i]})}),G.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;const{session:n,ui:s,connection:r}=this.subscribe();this._session=n,this.connection=r,this.relayEventManager=new is,this.ui=s,this.ui.attach()}subscribe(){const e=se.load(this.storage)||se.create(this.storage),{linkAPIUrl:n}=this,s=new ss({session:e,linkAPIUrl:n,listener:this}),r=this.isMobileWeb?new Rt:new Is;return s.connect(),{session:e,ui:r,connection:s}}resetAndReload(){this.connection.destroy().then(()=>{const e=se.load(this.storage);(e==null?void 0:e.id)===this._session.id&&z.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:F(e.weiValue),data:ce(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?F(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?F(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?F(e.gasPriceInWei):null,gasLimit:e.gasLim
1it?F(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:F(e.weiValue),data:ce(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?F(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?F(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?F(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?F(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,n){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:ce(e,!0),chainId:n}})}getWalletLinkSession(){return this._session}sendRequest(e){let n=null;const s=ee(8),r=i=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,e.method,i),n==null||n()};return new Promise((i,o)=>{n=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:r,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(s,a=>{if(n==null||n(),H(a))return o(new Error(a.errorMessage));i(a)}),this.publishWeb3RequestEvent(s,e)})}publishWeb3RequestEvent(e,n){const s={type:"WEB3_REQUEST",id:e,request:n};this.publishEvent("Web3Request",s,!0).then(r=>{}).catch(r=>{this.handleWeb3ResponseMessage(s.id,{method:n.method,errorMessage:r.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(n.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof Rt)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const n={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",n,!1).then()}publishEvent(e,n,s){return this.connection.publishEvent(e,n,s)}handleWeb3ResponseMessage(e,n){if(n.method==="requestEthereumAccounts"){G.accountRequestCallbackIds.forEach(s=>this.invokeCallback(s,n)),G.accountRequestCallbackIds.clear();return}this.invokeCallback(e,n)}handleErrorResponse(e,n,s){var r;const i=(r=s==null?void 0:s.message)!==null&&r!==void 0?r:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:n,errorMessage:i})}invokeCallback(e,n){const s=this.relayEventManager.callbacks.get(e);s&&(s(n),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:n}=this.metadata,s={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:n}},r=ee(8);return new Promise((i,o)=>{this.relayEventManager.callbacks.set(r,a=>{if(H(a))return o(new Error(a.errorMessage));i(a)}),G.accountRequestCallbackIds.add(r),this.publishWeb3RequestEvent(r,s)})}watchAsset(e,n,s,r,i,o){const a={method:"watchAsset",params:{type:e,options:{address:n,symbol:s,decimals:r,image:i},chainId:o}};let u=null;const f=ee(8),_=l=>{this.publishWeb3RequestCanceledEvent(f),this.handleErrorResponse(f,a.method,l),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:_,onResetConnection:this.resetAndReload}),new Promise((l,h)=>{this.relayEventManager.callbacks.set(f,c=>{if(u==null||u(),H(c))return h(new Error(c.errorMessage));l(c)}),this.publishWeb3RequestEvent(f,a)})}addEthereumChain(e,n,s,r,i,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:n,blockExplorerUrls:r,chainName:i,iconUrls:s,nativeCurrency:o}};let u=null;const f=ee(8),_=l=>{this.publishWeb3RequestCanceledEvent(f),this.handleErrorResponse(f,a.method,l),u==null||u()};return u=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:_,onResetConnection:this.resetAndReload}),new Promise((l,h)=>{this.relayEventManager.callbacks.set(f,c=>{if(u==null||u(),H(c))return h(new Error(c.errorMessage));l(c)}),this.publishWeb3RequestEvent(f,a)})}switchEthereumChain(e,n){const s={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:n})};let r=null;const i=ee(8),o=a=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,s.method,a),r==null||r()};return r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:o,onResetConnection:this.resetAndReload}),new Promise((a,u)=>{this.relayEventManager.callbacks.set(i,f=>{if(r==null||r(),H(f)&&f.errorCode)return u(M.provider.custom({code:f.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(H(f))return u(new Error(f.errorMessage));a(f)}),this.publishWeb3RequestEvent(i,s)})}}G.accountRequestCallbackIds=new Set;const Tt="DefaultChainId",Nt="DefaultJsonRpcUrl";class _n{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new z("walletlink",Pt),this.callback=e.callback||null;const n=this._storage.getItem(De);if(n){const s=n.split(" ");s[0]!==""&&(this._addresses=s.map(r=>V(r)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:n,secret:s}=e.getWalletLinkSession();return{id:n,secret:s}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(Nt))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(Nt,e)}updateProviderInfo(e,n){var s;this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(Tt,n.toString(10)),de(n)!==r&&((s=this.callback)===null||s===void 0||s.call(this,"chainChanged",Q(n)))}async watchAsset(e){const n=Array.isArray(e)?e[0]:e;if(!n.type)throw M.rpc.invalidParams("Type is required");if((n==null?void 0:n.type)!=="ERC20")throw M.rpc.invalidParams("Asset of type '".concat(n.type,"' is not supported"));if(!(n!=null&&n.options))throw M.rpc.invalidParams("Options are required");if(!(n!=null&&n.options.address))throw M.rpc.invalidParams("Address is required");const s=this.getChainId(),{address:r,symbol:i,image:o,decimals:a}=n.options,f=await this.initializeRelay().watchAsset(n.type,r,i,a,o,s==null?void 0:s.toString());return H(f)?!1:!!f.result}async addEthereumChain(e){var n,s;const r=e[0];if(((n=r.rpcUrls)===null||n===void 0?void 0:n.length)===0)throw M.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!r.chainName||r.chainName.trim()==="")throw M.rpc.invalidParams("chainName is a required field");if(!r.nativeCurrency)throw M.rpc.invalidParams("nativeCurrency is a required field");const i=Number.parseInt(r.chainId,16);if(i===this.getChainId())return!1;const o=this.initializeRelay(),{rpcUrls:a=[],blockExplorerUrls:u=[],chainName:f,iconUrls:_=[],nativeCurrency:l}=r,h=await o.addEthereumChain(i.toString(),a,_,u,f,l);if(H(h))return!1;if(((s=h.result)===null||s===void 0?void 0:s.isApproved)===!0)return this.updateProviderInfo(a[0],i),null;throw M.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const n=e[0],s=Number.parseInt(n.chainId,16),i=await this.initializeRelay().switchEthereumChain(s.toString(10),this.selectedAddress||void 0);if(H(i))throw i;const o=i.result;return o.isApproved&&o.rpcUrl.length>0&&this.updateProviderInfo(o.rpcUrl,s),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,n){var s;if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map(i=>V(i));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,(s=this.callback)===null||s===void 0||s.call(this,"accountsChanged",r),this._storage.setItem(De,r.join(" ")))}async request(e){const n=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 Q(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(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);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(n);case"wallet_switchEthereumChain":return this.switchEthereumChain(n);case"wallet_watchAsset":return this.watchAsset(n);default:if(!this.jsonRpcUrl)throw M.rpc.internal("No RPC URL set for chain");return Ge(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const n=V(e);if(!this._addresses.map(r=>V(r)).includes(n))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const n=e.from?V(e.from):this.selectedAddress;if(!n)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(n);const s=e.to?V(e.to):null,r=e.value!=null?re(e.value):BigInt(0),i=e.data?Oe(e.data):O.alloc(0),o=e.nonce!=null?de(e.nonce):null,a=e.gasPrice!=null?re(e.gasPrice):null,u=e.maxFeePerGas!=null?re(e.maxFeePerGas):null,f=e.maxPriorityFeePerGas!=null?re(e.maxPriorityFeePerGas):null,_=e.gas!=null?re(e.gas):null,l=e.chainId?de(e.chainId):this.getChainId();return{fromAddress:n,toAddress:s,weiValue:r,data:i,nonce:o,gasPriceInWei:a,maxFeePerGas:u,maxPriorityFeePerGas:f,gasLimit:_,chainId:l}}async ecRecover(e){const{method:n,params:s}=e;if(!Array.isArray(s))throw M.rpc.invalidParams();const i=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:Ie(s[0]),signature:Ie(s[1]),addPrefix:n==="personal_ecRecover"}});if(H(i))throw i;return i.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(Tt))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,n;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:Q(this.getChainId())}),this._addresses;const r=await this.initializeRelay().requestEthereumAccounts();if(H(r))throw r;if(!r.result)throw new Error("accounts received is empty");return this._setAddresses(r.result),(n=this.callback)===null||n===void 0||n.call(this,"connect",{chainId:Q(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw M.rpc.invalidParams();const n=e[1],s=e[0];this._ensureKnownAddress(n);const i=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:V(n),message:Ie(s),addPrefix:!0,typedDataJson:null}});if(H(i))throw i;return i.result}async _eth_signTransaction(e){const n=this._prepareTransactionParams(e[0]||{}),r=await this.initializeRelay().signEthereumTransaction(n);if(H(r))throw r;return r.result}async _eth_sendRawTransaction(e){const n=Oe(e[0]),r=await this.initializeRelay().submitEthereumTransaction(n,this.getChainId());if(H(r))throw r;return r.result}async _eth_sendTransaction(e){const n=this._prepareTransactionParams(e[0]||{}),r=await this.initializeRelay().signAndSubmitEthereumTransaction(n);if(H(r))throw r;return r.result}async signTypedData(e){const{method:n,params:s}=e;if(!Array.isArray(s))throw M.rpc.invalidParams();const r=f=>{const _={eth_signTypedData_v1:fe.hashForSignTypedDataLegacy,eth_signTypedData_v3:fe.hashForSignTypedData_v3,eth_signTypedData_v4:fe.hashForSignTypedData_v4,eth_signTypedData:fe.hashForSignTypedData_v4};return ce(_[n]({data:Mn(f)}),!0)},i=s[n==="eth_signTypedData_v1"?1:0],o=s[n==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(i);const u=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:V(i),message:r(o),typedDataJson:JSON.stringify(o,null,2),addPrefix:!1}});if(H(u))throw u;return u.result}initializeRelay(){return this._relay||(this._relay=new G({linkAPIUrl:Pt,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const gn="SignerType",mn=new z("CBWSDK","SignerConfigurator");function Ps(){return mn.getItem(gn)}function Rs(t){mn.setItem(gn,t)}async function Ts(t){const{communicator:e,metadata:n,handshakeRequest:s,callback:r}=t;Os(e,n,r).catch(()=>{});const i={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:s})},{data:o}=await e.postRequestAndWaitForResponse(i);return o}function Ns(t){const{signerType:e,metadata:n,communicator:s,callback:r}=t;switch(e){case"scw":return new Kn({metadata:n,callback:r,communicator:s});case"walletlink":return new _n({metadata:n,callback:r})}}async function Os(t,e,n){await t.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const s=new _n({metadata:e,callback:n});
1t.postMessage({event:"WalletLinkUpdate",data:{session:s.getSession()}}),await s.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const Ds="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.\n\nPlease see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.",Us=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e="".concat(window.location.origin).concat(window.location.pathname),n=await fetch(e,{method:"HEAD"});if(!n.ok)throw new Error("HTTP error! status: ".concat(n.status));const s=n.headers.get("Cross-Origin-Opener-Policy");t=s!=null?s:"null",t==="same-origin"&&console.error(Ds)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:js,getCrossOriginOpenerPolicy:Bs}=Us(),Ot=420,Dt=540;function Ws(t){const e=(window.innerWidth-Ot)/2+window.screenX,n=(window.innerHeight-Dt)/2+window.screenY;qs(t);const s="wallet_".concat(crypto.randomUUID()),r=window.open(t,s,"width=".concat(Ot,", height=").concat(Dt,", left=").concat(e,", top=").concat(n));if(r==null||r.focus(),!r)throw M.rpc.internal("Pop up window failed to open");return r}function Hs(t){t&&!t.closed&&t.close()}function qs(t){const e={sdkName:Vt,sdkVersion:he,origin:window.location.origin,coop:Bs()};for(const[n,s]of Object.entries(e))t.searchParams.append(n,s.toString())}class Ks{constructor({url:e=Ls,metadata:n,preference:s}){this.popup=null,this.listeners=new Map,this.postMessage=async r=>{(await this.waitForPopupLoaded()).postMessage(r,this.url.origin)},this.postRequestAndWaitForResponse=async r=>{const i=this.onMessage(({requestId:o})=>o===r.id);return this.postMessage(r),await i},this.onMessage=async r=>new Promise((i,o)=>{const a=u=>{if(u.origin!==this.url.origin)return;const f=u.data;r(f)&&(i(f),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:o})}),this.disconnect=()=>{Hs(this.popup),this.popup=null,this.listeners.forEach(({reject:r},i)=>{r(M.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",i)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=Ws(this.url),this.onMessage(({event:r})=>r==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:r})=>r==="PopupLoaded").then(r=>{this.postMessage({requestId:r.id,data:{version:he,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw M.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=n,this.preference=s}}function Fs(t){const e=Sn(zs(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return n.searchParams.set("version",he),n.searchParams.set("code",e.code.toString()),n.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:n.href})}function zs(t){var e;if(typeof t=="string")return{message:t,code:j.rpc.internal};if(H(t)){const n=t.errorMessage,s=(e=t.errorCode)!==null&&e!==void 0?e:n.match(/(denied|rejected)/i)?j.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:n,code:s,data:{method:t.method}})}return t}class $s extends kn{}var Gs=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(t);r<s.length;r++)e.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(n[s[r]]=t[s[r]]);return n};class Ys extends $s{constructor(e){var{metadata:n}=e,s=e.preference,{keysUrl:r}=s,i=Gs(s,["keysUrl"]);super(),this.signer=null,this.isCoinbaseWallet=!0,this.metadata=n,this.preference=i,this.communicator=new Ks({url:r,metadata:n,preference:i});const o=Ps();o&&(this.signer=this.initSigner(o))}async request(e){try{if(qn(e),!this.signer)switch(e.method){case"eth_requestAccounts":{const n=await this.requestSignerSelection(e),s=this.initSigner(n);await s.handshake(e),this.signer=s,Rs(n);break}case"wallet_sendCalls":{const n=this.initSigner("scw");await n.handshake({method:"handshake"});const s=await n.request(e);return await n.cleanup(),s}case"wallet_getCallsStatus":return Ge(e,xs);case"net_version":return 1;case"eth_chainId":return Q(1);default:throw M.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")}return await this.signer.request(e)}catch(n){const{code:s}=n;return s===j.provider.unauthorized&&this.disconnect(),Promise.reject(Fs(n))}}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((e=this.signer)===null||e===void 0?void 0:e.cleanup()),this.signer=null,z.clearAll(),this.emit
1("disconnect",M.provider.disconnected("User initiated disconnection"))}requestSignerSelection(e){return Ts({communicator:this.communicator,preference:this.preference,metadata:this.metadata,handshakeRequest:e,callback:this.emit.bind(this)})}initSigner(e){return Ns({signerType:e,metadata:this.metadata,communicator:this.communicator,callback:this.emit.bind(this)})}}function Vs(t){if(t){if(!["all","smartWalletOnly","eoaOnly"].includes(t.options))throw new Error("Invalid options: ".concat(t.options));if(t.attribution&&t.attribution.auto!==void 0&&t.attribution.dataSuffix!==void 0)throw new Error("Attribution cannot contain both auto and dataSuffix properties")}}function Js(t){var e;const n={metadata:t.metadata,preference:t.preference};return(e=Hn(n))!==null&&e!==void 0?e:new Ys(n)}const Qs={options:"all"};function ri(t){var e;new z("CBWSDK").setItem("VERSION",he),js();const s={metadata:{appName:t.appName||"Dapp",appLogoUrl:t.appLogoUrl||"",appChainIds:t.appChainIds||[]},preference:Object.assign(Qs,(e=t.preference)!==null&&e!==void 0?e:{})};Vs(s.preference);let r=null;return{getProvider:()=>(r||(r=Js(s)),r)}}export{ri as createCoinbaseWalletSDK};

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.