diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json index 48a758a..dc04230 100644 --- a/buddybook/.vite/manifest.json +++ b/buddybook/.vite/manifest.json @@ -1,6 +1,6 @@ { - "_events-DT22ZwC4.js": { - "file": "assets/events-DT22ZwC4.js", + "_events-2fANA2U5.js": { + "file": "assets/events-2fANA2U5.js", "name": "events", "imports": [ "index.html" @@ -10,8 +10,8 @@ "file": "assets/hooks.module-D0gf0yJl.js", "name": "hooks.module" }, - "_index-3RtEhhzm.js": { - "file": "assets/index-3RtEhhzm.js", + "_index-BhMsHqT3.js": { + "file": "assets/index-BhMsHqT3.js", "name": "index", "isDynamicEntry": true, "imports": [ @@ -21,53 +21,53 @@ "node_modules/@walletconnect/modal-ui/dist/index.js" ] }, - "_index-BeN-aFbA.js": { - "file": "assets/index-BeN-aFbA.js", + "_index-DQD5FJy6.js": { + "file": "assets/index-DQD5FJy6.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html", - "_index-BnSaZ_jt.js", - "_events-DT22ZwC4.js" + "_inherits_browser-CgLO5vwk.js", + "_hooks.module-D0gf0yJl.js", + "_events-2fANA2U5.js" ] }, - "_index-BnSaZ_jt.js": { - "file": "assets/index-BnSaZ_jt.js", + "_index-DTOI1f4O.js": { + "file": "assets/index-DTOI1f4O.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html" ] }, - "_index-D6MJTicx.js": { - "file": "assets/index-D6MJTicx.js", + "_index-IqLj3ThH.js": { + "file": "assets/index-IqLj3ThH.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html", - "_inherits_browser-BKdA78FI.js", - "_hooks.module-D0gf0yJl.js", - "_events-DT22ZwC4.js" + "_index-DTOI1f4O.js", + "_events-2fANA2U5.js" ] }, - "_inherits_browser-BKdA78FI.js": { - "file": "assets/inherits_browser-BKdA78FI.js", + "_inherits_browser-CgLO5vwk.js": { + "file": "assets/inherits_browser-CgLO5vwk.js", "name": "inherits_browser", "imports": [ "index.html" ] }, "index.html": { - "file": "assets/index-CBcRH9LY.js", + "file": "assets/index-D-Yr2Iya.js", "name": "index", "src": "index.html", "isEntry": true, "dynamicImports": [ "node_modules/viem/_esm/utils/ccip.js", "node_modules/@coinbase/wallet-sdk/dist/index.js", - "_index-D6MJTicx.js", - "_index-BnSaZ_jt.js", - "_index-BeN-aFbA.js", + "_index-DQD5FJy6.js", + "_index-DTOI1f4O.js", + "_index-IqLj3ThH.js", "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" ], "css": [ @@ -75,7 +75,7 @@ ] }, "node_modules/@coinbase/wallet-sdk/dist/index.js": { - "file": "assets/index-9j2nEnjI.js", + "file": "assets/index-DyOq0GRj.js", "name": "index", "src": "node_modules/@coinbase/wallet-sdk/dist/index.js", "isDynamicEntry": true, @@ -85,31 +85,31 @@ ] }, "node_modules/@walletconnect/ethereum-provider/dist/index.es.js": { - "file": "assets/index.es-CRyabuk4.js", + "file": "assets/index.es-1pglYqns.js", "name": "index.es", "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", "isDynamicEntry": true, "imports": [ "index.html", - "_events-DT22ZwC4.js", - "_inherits_browser-BKdA78FI.js" + "_events-2fANA2U5.js", + "_inherits_browser-CgLO5vwk.js" ], "dynamicImports": [ - "_index-3RtEhhzm.js" + "_index-BhMsHqT3.js" ] }, "node_modules/@walletconnect/modal-ui/dist/index.js": { - "file": "assets/index-BLeCt1zy.js", + "file": "assets/index-DwTiVe8d.js", "name": "index", "src": "node_modules/@walletconnect/modal-ui/dist/index.js", "isDynamicEntry": true, "imports": [ - "_index-3RtEhhzm.js", + "_index-BhMsHqT3.js", "index.html" ] }, "node_modules/viem/_esm/utils/ccip.js": { - "file": "assets/ccip-Uzdhqpi0.js", + "file": "assets/ccip-C6hySDZB.js", "name": "ccip", "src": "node_modules/viem/_esm/utils/ccip.js", "isDynamicEntry": true, diff --git a/buddybook/assets/ccip-Uzdhqpi0.js b/buddybook/assets/ccip-C6hySDZB.js similarity index 97% rename from buddybook/assets/ccip-Uzdhqpi0.js rename to buddybook/assets/ccip-C6hySDZB.js index ab6ef15..62cd0b8 100644 --- a/buddybook/assets/ccip-Uzdhqpi0.js +++ b/buddybook/assets/ccip-C6hySDZB.js @@ -1 +1 @@ -import{i as h,I as m,B as p,x as w,s as g,y as E,z as O,c as x,e as b,H as y,A as M}from"./index-CBcRH9LY.js";function R(r,a){if(!h(r,{strict:!1}))throw new m({address:r});if(!h(a,{strict:!1}))throw new m({address:a});return r.toLowerCase()===a.toLowerCase()}class S extends p{constructor({callbackSelector:a,cause:t,data:n,extraData:i,sender:d,urls:s}){var c;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(c=t.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(f=>` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let d=0;d0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;ri.map(i=>d[i]); -import{_ as pe}from"./index-CBcRH9LY.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function be(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-BLeCt1zy.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DwTiVe8d.js","assets/index-D-Yr2Iya.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-D-Yr2Iya.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function be(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-DwTiVe8d.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/buddybook/assets/index-CBcRH9LY.js b/buddybook/assets/index-D-Yr2Iya.js similarity index 99% rename from buddybook/assets/index-CBcRH9LY.js rename to buddybook/assets/index-D-Yr2Iya.js index e2c1e2e..d40216c 100644 --- a/buddybook/assets/index-CBcRH9LY.js +++ b/buddybook/assets/index-D-Yr2Iya.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-9j2nEnjI.js","assets/hooks.module-D0gf0yJl.js","assets/index-D6MJTicx.js","assets/inherits_browser-BKdA78FI.js","assets/events-DT22ZwC4.js","assets/index-BeN-aFbA.js","assets/index-BnSaZ_jt.js","assets/index.es-CRyabuk4.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DyOq0GRj.js","assets/hooks.module-D0gf0yJl.js","assets/index-DQD5FJy6.js","assets/inherits_browser-CgLO5vwk.js","assets/events-2fANA2U5.js","assets/index-IqLj3ThH.js","assets/index-DTOI1f4O.js","assets/index.es-1pglYqns.js"])))=>i.map(i=>d[i]); var au=Object.defineProperty;var Us=o=>{throw TypeError(o)};var cu=(o,et,tt)=>et in o?au(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt;var Ct=(o,et,tt)=>cu(o,typeof et!="symbol"?et+"":et,tt),is=(o,et,tt)=>et.has(o)||Us("Cannot "+tt);var jt=(o,et,tt)=>(is(o,et,"read from private field"),tt?tt.call(o):et.get(o)),pn=(o,et,tt)=>et.has(o)?Us("Cannot add the same private member more than once"):et instanceof WeakSet?et.add(o):et.set(o,tt),un=(o,et,tt,nt)=>(is(o,et,"write to private field"),nt?nt.call(o,tt):et.set(o,tt),tt),gn=(o,et,tt)=>(is(o,et,"access private method"),tt);var br=(o,et,tt,nt)=>({set _(rt){un(o,et,rt,tt)},get _(){return jt(o,et,nt)}});function _mergeNamespaces(o,et){for(var tt=0;ttnt[rt]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const et=document.createElement("link").relList;if(et&&et.supports&&et.supports("modulepreload"))return;for(const rt of document.querySelectorAll('link[rel="modulepreload"]'))nt(rt);new MutationObserver(rt=>{for(const ot of rt)if(ot.type==="childList")for(const it of ot.addedNodes)it.tagName==="LINK"&&it.rel==="modulepreload"&&nt(it)}).observe(document,{childList:!0,subtree:!0});function tt(rt){const ot={};return rt.integrity&&(ot.integrity=rt.integrity),rt.referrerPolicy&&(ot.referrerPolicy=rt.referrerPolicy),rt.crossOrigin==="use-credentials"?ot.credentials="include":rt.crossOrigin==="anonymous"?ot.credentials="omit":ot.credentials="same-origin",ot}function nt(rt){if(rt.ep)return;rt.ep=!0;const ot=tt(rt);fetch(rt.href,ot)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var et=o.default;if(typeof et=="function"){var tt=function nt(){return this instanceof nt?Reflect.construct(et,arguments,this.constructor):et.apply(this,arguments)};tt.prototype=et.prototype}else tt={};return Object.defineProperty(tt,"__esModule",{value:!0}),Object.keys(o).forEach(function(nt){var rt=Object.getOwnPropertyDescriptor(o,nt);Object.defineProperty(tt,nt,rt.get?rt:{enumerable:!0,get:function(){return o[nt]}})}),tt}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js @@ -75,7 +75,7 @@ Error generating stack: `+ot.message+` `).slice(0,-1)}function serializeStateMapping(o){if(!(!o||o.length===0))return o.reduce((et,{slot:tt,value:nt})=>{if(tt.length!==66)throw new InvalidBytesLengthError({size:tt.length,targetSize:66,type:"hex"});if(nt.length!==66)throw new InvalidBytesLengthError({size:nt.length,targetSize:66,type:"hex"});return et[tt]=nt,et},{})}function serializeAccountStateOverride(o){const{balance:et,nonce:tt,state:nt,stateDiff:rt,code:ot}=o,it={};if(ot!==void 0&&(it.code=ot),et!==void 0&&(it.balance=numberToHex(et)),tt!==void 0&&(it.nonce=numberToHex(tt)),nt!==void 0&&(it.state=serializeStateMapping(nt)),rt!==void 0){if(it.state)throw new StateAssignmentConflictError;it.stateDiff=serializeStateMapping(rt)}return it}function serializeStateOverride(o){if(!o)return;const et={};for(const{address:tt,...nt}of o){if(!isAddress(tt,{strict:!1}))throw new InvalidAddressError({address:tt});if(et[tt])throw new AccountStateConflictError({address:tt});et[tt]=serializeAccountStateOverride(nt)}return et}async function getBalance$1(o,{address:et,blockNumber:tt,blockTag:nt="latest"}){const rt=tt?numberToHex(tt):void 0,ot=await o.request({method:"eth_getBalance",params:[et,rt||nt]});return BigInt(ot)}function blobsToCommitments(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(ot=>hexToBytes$3(ot)):o.blobs,rt=[];for(const ot of nt)rt.push(Uint8Array.from(et.blobToKzgCommitment(ot)));return tt==="bytes"?rt:rt.map(ot=>bytesToHex$4(ot))}function blobsToProofs(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(it=>hexToBytes$3(it)):o.blobs,rt=typeof o.commitments[0]=="string"?o.commitments.map(it=>hexToBytes$3(it)):o.commitments,ot=[];for(let it=0;itbytesToHex$4(it))}function setBigUint64$1(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=nt?4:0,ct=nt?0:4;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}const Chi=(o,et,tt)=>o&et^~o&tt,Maj=(o,et,tt)=>o&et^o&tt^et&tt;class HashMD extends Hash{constructor(et,tt,nt,rt){super(),this.blockLen=et,this.outputLen=tt,this.padOffset=nt,this.isLE=rt,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(et),this.view=createView$1(this.buffer)}update(et){exists$1(this);const{view:tt,buffer:nt,blockLen:rt}=this;et=toBytes$2(et);const ot=et.length;for(let it=0;itrt-it&&(this.process(nt,0),it=0);for(let dt=it;dtlt.length)throw new Error("_sha2: outputLen bigger than state");for(let dt=0;dt>>3,pt=rotr(ft,17)^rotr(ft,19)^ft>>>10;SHA256_W[dt]=pt+SHA256_W[dt-7]+mt+SHA256_W[dt-16]|0}let{A:nt,B:rt,C:ot,D:it,E:st,F:at,G:ct,H:lt}=this;for(let dt=0;dt<64;dt++){const ht=rotr(st,6)^rotr(st,11)^rotr(st,25),ft=lt+ht+Chi(st,at,ct)+SHA256_K[dt]+SHA256_W[dt]|0,pt=(rotr(nt,2)^rotr(nt,13)^rotr(nt,22))+Maj(nt,rt,ot)|0;lt=ct,ct=at,at=st,st=it+ft|0,it=ot,ot=rt,rt=nt,nt=ft+pt|0}nt=nt+this.A|0,rt=rt+this.B|0,ot=ot+this.C|0,it=it+this.D|0,st=st+this.E|0,at=at+this.F|0,ct=ct+this.G|0,lt=lt+this.H|0,this.set(nt,rt,ot,it,st,at,ct,lt)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256$2=wrapConstructor(()=>new SHA256);function sha256$1(o,et){return sha256$2(isHex(o,{strict:!1})?toBytes$3(o):o)}function commitmentToVersionedHash(o){const{commitment:et,version:tt=1}=o,nt=o.to??(typeof et=="string"?"hex":"bytes"),rt=sha256$1(et);return rt.set([tt],0),nt==="bytes"?rt:bytesToHex$4(rt)}function commitmentsToVersionedHashes(o){const{commitments:et,version:tt}=o,nt=o.to??(typeof et[0]=="string"?"hex":"bytes"),rt=[];for(const ot of et)rt.push(commitmentToVersionedHash({commitment:ot,to:nt,version:tt}));return rt}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError$3{constructor({maxSize:et,size:tt}){super("Blob size is too large.",{metaMessages:[`Max: ${et} bytes`,`Given: ${tt} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError$3{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError$3{constructor({hash:et,size:tt}){super(`Versioned hash "${et}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${tt}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError$3{constructor({hash:et,version:tt}){super(`Versioned hash "${et}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${tt}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(o){const et=o.to??(typeof o.data=="string"?"hex":"bytes"),tt=typeof o.data=="string"?hexToBytes$3(o.data):o.data,nt=size$2(tt);if(!nt)throw new EmptyBlobError;if(nt>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:nt});const rt=[];let ot=!0,it=0;for(;ot;){const st=createCursor(new Uint8Array(bytesPerBlob));let at=0;for(;atst.bytes):rt.map(st=>bytesToHex$4(st.bytes))}function toBlobSidecars(o){const{data:et,kzg:tt,to:nt}=o,rt=o.blobs??toBlobs({data:et,to:nt}),ot=o.commitments??blobsToCommitments({blobs:rt,kzg:tt,to:nt}),it=o.proofs??blobsToProofs({blobs:rt,commitments:ot,kzg:tt,to:nt}),st=[];for(let at=0;at1||tt[0]>1)throw new InvalidBytesBooleanError(tt);return!!tt[0]}function bytesToNumber$1(o,et={}){typeof et.size<"u"&&assertSize(o,{size:et.size});const tt=bytesToHex$4(o,et);return hexToNumber$2(tt,et)}function bytesToString(o,et={}){let tt=o;return typeof et.size<"u"&&(assertSize(tt,{size:et.size}),tt=trim$1(tt,{dir:"right"})),new TextDecoder().decode(tt)}function decodeAbiParameters(o,et){const tt=typeof et=="string"?hexToBytes$3(et):et,nt=createCursor(tt);if(size$2(tt)===0&&o.length>0)throw new AbiDecodingZeroDataError;if(size$2(et)&&size$2(et)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof et=="string"?et:bytesToHex$4(et),params:o,size:size$2(et)});let rt=0;const ot=[];for(let it=0;it48?bytesToBigInt(rt,{signed:tt}):bytesToNumber$1(rt,{signed:tt}),32]}function decodeTuple(o,et,{staticPosition:tt}){const nt=et.components.length===0||et.components.some(({name:it})=>!it),rt=nt?[]:{};let ot=0;if(hasDynamicChild(et)){const it=bytesToNumber$1(o.readBytes(sizeOfOffset)),st=tt+it;for(let at=0;atkeccak256$1(toBytes$3(o));function hashSignature(o){return hash(o)}const version$7="1.0.6";let BaseError$2=class As extends Error{constructor(et,tt={}){var it;const nt=tt.cause instanceof As?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,rt=tt.cause instanceof As&&tt.cause.docsPath||tt.docsPath,ot=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: https://abitype.dev${rt}`]:[],...nt?[`Details: ${nt}`]:[],`Version: abitype@${version$7}`].join(` `);super(ot),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}};function execTyped(o,et){const tt=o.exec(et);return tt==null?void 0:tt.groups}const bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(o){let et=o.type;if(tupleRegex.test(o.type)&&"components"in o){et="(";const tt=o.components.length;for(let rt=0;rt[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(o){return errorSignatureRegex.test(o)}function execErrorSignature(o){return execTyped(errorSignatureRegex,o)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(o){return eventSignatureRegex.test(o)}function execEventSignature(o){return execTyped(eventSignatureRegex,o)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(o){return functionSignatureRegex.test(o)}function execFunctionSignature(o){return execTyped(functionSignatureRegex,o)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(o){return structSignatureRegex.test(o)}function execStructSignature(o){return execTyped(structSignatureRegex,o)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(o){return constructorSignatureRegex.test(o)}function execConstructorSignature(o){return execTyped(constructorSignatureRegex,o)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(o){return fallbackSignatureRegex.test(o)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(o){return receiveSignatureRegex.test(o)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class UnknownSolidityTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidParameterError extends BaseError$2{constructor({param:et}){super("Invalid ABI parameter.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$2{constructor({param:et,name:tt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`"${tt}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class InvalidModifierError extends BaseError$2{constructor({param:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$2{constructor({param:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${nt}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$2{constructor({abiParameter:et}){super("Invalid ABI parameter.",{details:JSON.stringify(et,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}let InvalidSignatureError$1=class extends BaseError$2{constructor({signature:et,type:tt}){super(`Invalid ${tt} signature.`,{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class UnknownSignatureError extends BaseError$2{constructor({signature:et}){super("Unknown signature.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$2{constructor({signature:et}){super("Invalid struct signature.",{details:et,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$2{constructor({type:et}){super("Circular reference detected.",{metaMessages:[`Struct "${et}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$2{constructor({current:et,depth:tt}){super("Unbalanced parentheses.",{metaMessages:[`"${et.trim()}" has too many ${tt>0?"opening":"closing"} parentheses.`],details:`Depth "${tt}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(o,et){return et?`${et}:${o}`:o}const parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function parseSignature(o,et={}){if(isFunctionSignature(o)){const tt=execFunctionSignature(o);if(!tt)throw new InvalidSignatureError$1({signature:o,type:"function"});const nt=splitParameters(tt.parameters),rt=[],ot=nt.length;for(let st=0;st[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter(o,et){var dt,ht;const tt=getParameterCacheKey(o,et==null?void 0:et.type);if(parameterCache.has(tt))return parameterCache.get(tt);const nt=isTupleRegex.test(o),rt=execTyped(nt?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,o);if(!rt)throw new InvalidParameterError({param:o});if(rt.name&&isSolidityKeyword(rt.name))throw new SolidityProtectedKeywordError({param:o,name:rt.name});const ot=rt.name?{name:rt.name}:{},it=rt.modifier==="indexed"?{indexed:!0}:{},st=(et==null?void 0:et.structs)??{};let at,ct={};if(nt){at="tuple";const ft=splitParameters(rt.type),mt=[],pt=ft.length;for(let yt=0;yt[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(o,et,tt=new Set){const nt=[],rt=o.length;for(let ot=0;ot{const et=typeof o=="string"?o:formatAbiItem(o);return normalizeSignature$1(et)};function toSignatureHash(o){return hashSignature(toSignature(o))}const toEventSelector=toSignatureHash,toFunctionSelector=o=>slice(toSignatureHash(o),0,4);function getAbiItem(o){const{abi:et,args:tt=[],name:nt}=o,rt=isHex(nt,{strict:!1}),ot=et.filter(st=>rt?st.type==="function"?toFunctionSelector(st)===nt:st.type==="event"?toEventSelector(st)===nt:!1:"name"in st&&st.name===nt);if(ot.length===0)return;if(ot.length===1)return ot[0];let it;for(const st of ot){if(!("inputs"in st))continue;if(!tt||tt.length===0){if(!st.inputs||st.inputs.length===0)return st;continue}if(!st.inputs||st.inputs.length===0||st.inputs.length!==tt.length)continue;if(tt.every((ct,lt)=>{const dt="inputs"in st&&st.inputs[lt];return dt?isArgOfType(ct,dt):!1})){if(it&&"inputs"in it&&it.inputs){const ct=getAmbiguousTypes(st.inputs,it.inputs,tt);if(ct)throw new AbiItemAmbiguityError({abiItem:st,type:ct[0]},{abiItem:it,type:ct[1]})}it=st}}return it||ot[0]}function isArgOfType(o,et){const tt=typeof o,nt=et.type;switch(nt){case"address":return isAddress(o,{strict:!1});case"bool":return tt==="boolean";case"function":return tt==="string";case"string":return tt==="string";default:return nt==="tuple"&&"components"in et?Object.values(et.components).every((rt,ot)=>isArgOfType(Object.values(o)[ot],rt)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(nt)?tt==="number"||tt==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(nt)?tt==="string"||o instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(nt)?Array.isArray(o)&&o.every(rt=>isArgOfType(rt,{...et,type:nt.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(o,et,tt){for(const nt in o){const rt=o[nt],ot=et[nt];if(rt.type==="tuple"&&ot.type==="tuple"&&"components"in rt&&"components"in ot)return getAmbiguousTypes(rt.components,ot.components,tt[nt]);const it=[rt.type,ot.type];if(it.includes("address")&&it.includes("bytes20")?!0:it.includes("address")&&it.includes("string")?isAddress(tt[nt],{strict:!1}):it.includes("address")&&it.includes("bytes")?isAddress(tt[nt],{strict:!1}):!1)return it}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(o){const{abi:et,args:tt,functionName:nt,data:rt}=o;let ot=et[0];if(nt){const st=getAbiItem({abi:et,args:tt,name:nt});if(!st)throw new AbiFunctionNotFoundError(nt,{docsPath:docsPath$1});ot=st}if(ot.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!ot.outputs)throw new AbiFunctionOutputsNotFoundError(ot.name,{docsPath:docsPath$1});const it=decodeAbiParameters(ot.outputs,rt);if(it&&it.length>1)return it;if(it&&it.length===1)return it[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(o){const{abi:et,args:tt,functionName:nt}=o;let rt=et[0];if(nt){const ot=getAbiItem({abi:et,args:tt,name:nt});if(!ot)throw new AbiFunctionNotFoundError(nt,{docsPath});rt=ot}if(rt.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[rt],functionName:toFunctionSelector(formatAbiItem$1(rt))}}function encodeFunctionData(o){const{args:et}=o,{abi:tt,functionName:nt}=(()=>{var st;return o.abi.length===1&&((st=o.functionName)!=null&&st.startsWith("0x"))?o:prepareEncodeFunctionData(o)})(),rt=tt[0],ot=nt,it="inputs"in rt&&rt.inputs?encodeAbiParameters(rt.inputs,et??[]):void 0;return concatHex([ot,it??"0x"])}function getChainContractAddress({blockNumber:o,chain:et,contract:tt}){var rt;const nt=(rt=et==null?void 0:et.contracts)==null?void 0:rt[tt];if(!nt)throw new ChainDoesNotSupportContract({chain:et,contract:{name:tt}});if(o&&nt.blockCreated&&nt.blockCreated>o)throw new ChainDoesNotSupportContract({blockNumber:o,chain:et,contract:{name:tt,blockCreated:nt.blockCreated}});return nt.address}const panicReasons={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function decodeErrorResult(o){const{abi:et,data:tt}=o,nt=slice(tt,0,4);if(nt==="0x")throw new AbiDecodingZeroDataError;const ot=[...et||[],solidityError,solidityPanic].find(it=>it.type==="error"&&nt===toFunctionSelector(formatAbiItem$1(it)));if(!ot)throw new AbiErrorSignatureNotFoundError(nt,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:ot,args:"inputs"in ot&&ot.inputs&&ot.inputs.length>0?decodeAbiParameters(ot.inputs,slice(tt,4)):void 0,errorName:ot.name}}function formatAbiItemWithArgs({abiItem:o,args:et,includeFunctionName:tt=!0,includeName:nt=!1}){if("name"in o&&"inputs"in o&&o.inputs)return`${tt?o.name:""}(${o.inputs.map((rt,ot)=>`${nt&&rt.name?`${rt.name}: `:""}${typeof et[ot]=="object"?stringify$2(et[ot]):et[ot]}`).join(", ")})`}class CallExecutionError extends BaseError$3{constructor(et,{account:tt,docsPath:nt,chain:rt,data:ot,gas:it,gasPrice:st,maxFeePerGas:at,maxPriorityFeePerGas:ct,nonce:lt,to:dt,value:ht,stateOverride:ft}){var yt;const mt=tt?parseAccount(tt):void 0;let pt=prettyPrint({from:mt==null?void 0:mt.address,to:dt,value:typeof ht<"u"&&`${formatEther(ht)} ${((yt=rt==null?void 0:rt.nativeCurrency)==null?void 0:yt.symbol)||"ETH"}`,data:ot,gas:it,gasPrice:typeof st<"u"&&`${formatGwei(st)} gwei`,maxFeePerGas:typeof at<"u"&&`${formatGwei(at)} gwei`,maxPriorityFeePerGas:typeof ct<"u"&&`${formatGwei(ct)} gwei`,nonce:lt});ft&&(pt+=` ${prettyStateOverride(ft)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],"Raw Call Arguments:",pt].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=et}}class ContractFunctionExecutionError extends BaseError$3{constructor(et,{abi:tt,args:nt,contractAddress:rt,docsPath:ot,functionName:it,sender:st}){const at=getAbiItem({abi:tt,args:nt,name:it}),ct=at?formatAbiItemWithArgs({abiItem:at,args:nt,includeFunctionName:!1,includeName:!1}):void 0,lt=at?formatAbiItem$1(at,{includeName:!0}):void 0,dt=prettyPrint({address:rt&&getContractAddress(rt),function:lt,args:ct&&ct!=="()"&&`${[...Array((it==null?void 0:it.length)??0).keys()].map(()=>" ").join("")}${ct}`,sender:st});super(et.shortMessage||`An unknown error occurred while executing the contract function "${it}".`,{cause:et,docsPath:ot,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],dt&&"Contract Call:",dt].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=tt,this.args=nt,this.cause=et,this.contractAddress=rt,this.functionName=it,this.sender=st}}class ContractFunctionRevertedError extends BaseError$3{constructor({abi:et,data:tt,functionName:nt,message:rt}){let ot,it,st,at;if(tt&&tt!=="0x")try{it=decodeErrorResult({abi:et,data:tt});const{abiItem:lt,errorName:dt,args:ht}=it;if(dt==="Error")at=ht[0];else if(dt==="Panic"){const[ft]=ht;at=panicReasons[ft]}else{const ft=lt?formatAbiItem$1(lt,{includeName:!0}):void 0,mt=lt&&ht?formatAbiItemWithArgs({abiItem:lt,args:ht,includeFunctionName:!1,includeName:!1}):void 0;st=[ft?`Error: ${ft}`:"",mt&&mt!=="()"?` ${[...Array((dt==null?void 0:dt.length)??0).keys()].map(()=>" ").join("")}${mt}`:""]}}catch(lt){ot=lt}else rt&&(at=rt);let ct;ot instanceof AbiErrorSignatureNotFoundError&&(ct=ot.signature,st=[`Unable to decode signature "${ct}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${ct}.`]),super(at&&at!=="execution reverted"||ct?[`The contract function "${nt}" reverted with the following ${ct?"signature":"reason"}:`,at||ct].join(` -`):`The contract function "${nt}" reverted.`,{cause:ot,metaMessages:st,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class RawContractError extends BaseError$3{constructor({data:et,message:tt}){super(tt||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let ft=0;ft{for(let ft=0;ftschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:ft}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:ft}),dt):(ct({args:lt,resolve:ht,reject:ft}),setTimeout(ot,nt),dt)}}}async function call(o,et){var Nt,Mt,Bt,zt;const{account:tt=o.account,batch:nt=!!((Nt=o.batch)!=null&&Nt.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,It=lt&&dt&&xt&&ct,Rt=kt||It,$t=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):It?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Mt=o.chain)==null?void 0:Mt.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Pt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:$t,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Pt})&&!Ht)try{return await scheduleMulticall(o,{...Pt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Pt,Yt,Ht]:[Pt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Pt}=await import("./ccip-Uzdhqpi0.js");return{offchainLookup:qt,offchainLookupSignature:Pt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var pt;const{batchSize:tt=1024,wait:nt=0}=typeof((pt=o.batch)==null?void 0:pt.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:ft,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:ft});return ft==="0x"?{data:void 0}:{data:ft}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const ft=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return ft==="0x"||trim$1(ft)==="0x00"?null:ft}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(o);if(o.startsWith("http")&&!lt&&!dt){let ft=o;return et!=null&&et.arweave&&(ft=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:ft,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!rt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,ft=0;for(let gt=0;gt0&&ft>ct&&dt[ht].length>0&&(ht++,ft=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var ft,mt;const ht=rt();if(ht.length!==0)for(const pt of ht)(mt=(ft=pt.fns)[lt])==null||mt.call(ft,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var ft;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let pt=at+1n;ptat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(ft=ht.onError)==null||ft.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let ft=!0,mt=()=>ft=!1;return(async()=>{try{const pt=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await pt.subscribe({params:["newHeads"],onData(gt){var vt;if(!ft)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,ft||mt()}catch(pt){rt==null||rt(pt)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const pt={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,pt),gt=await(rt==null?void 0:rt(yt,pt))??{...pt,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let ft;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))ft=await ht.json();else{ft=await ht.text();try{ft=JSON.parse(ft||"{}")}catch(mt){if(ht.ok)throw mt;ft={error:ft}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(ft.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return ft}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof ft>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof ft>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});ft=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),pt=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(ft)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const ft=27n+(et.v===27n?0n:1n);if(et.v!==ft)throw new InvalidLegacyVError({v:et.v});return ft})(),dt=trim$1(et.r),ht=trim$1(et.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let ft;for(;!(ft=ht(ct()));)at();return it(),ft}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=ft,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=pt%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,ft=o.ZERO;ht>0;ht--)ft=ft.add(st[ht]),dt=dt.add(ft);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=et.subarray(nt,nt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((pt,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(pt=>{const yt=pt.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(pt){const{a:yt,b:gt}=et,xt=tt.sqr(pt),vt=tt.mul(xt,pt);return tt.add(tt.add(vt,tt.mul(pt,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(pt){return inRange(pt,_1n$5,et.n)}function at(pt){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;if(yt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!yt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(gt*2,"0")}let bt;try{bt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,gt))}catch{throw new Error(`private key must be ${gt} bytes, hex or bigint, not ${typeof pt}`)}return xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(pt){if(!(pt instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((pt,yt)=>{const{px:gt,py:xt,pz:vt}=pt;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=pt.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(pt=>{if(pt.is0()){if(et.allowInfinityPoint&&!tt.is0(pt.py))return;throw new Error("bad point: ZERO")}const{x:yt,y:gt}=pt.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))throw new Error("bad point: equation left != right");if(!pt.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(yt,gt,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,nt,yt,gt)}_setWindowSize(yt){mt.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),It=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&It}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,It=tt.ZERO,Rt=tt.mul(vt,vt),$t=tt.mul(bt,bt),Nt=tt.mul(Et,Et),Mt=tt.mul(vt,bt);return Mt=tt.add(Mt,Mt),It=tt.mul(vt,Et),It=tt.add(It,It),wt=tt.mul(yt,It),kt=tt.mul(xt,Nt),kt=tt.add(wt,kt),wt=tt.sub($t,kt),kt=tt.add($t,kt),kt=tt.mul(wt,kt),wt=tt.mul(Mt,wt),It=tt.mul(xt,It),Nt=tt.mul(yt,Nt),Mt=tt.sub(Rt,Nt),Mt=tt.mul(yt,Mt),Mt=tt.add(Mt,It),It=tt.add(Rt,Rt),Rt=tt.add(It,Rt),Rt=tt.add(Rt,Nt),Rt=tt.mul(Rt,Mt),kt=tt.add(kt,Rt),Nt=tt.mul(bt,Et),Nt=tt.add(Nt,Nt),Rt=tt.mul(Nt,Mt),wt=tt.sub(wt,Rt),It=tt.mul(Nt,$t),It=tt.add(It,It),It=tt.add(It,It),new ht(wt,kt,It)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,It=tt.ZERO,Rt=tt.ZERO;const $t=et.a,Nt=tt.mul(et.b,_3n$2);let Mt=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Mt,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Mt,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul($t,Yt),kt=tt.mul(Nt,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),It=tt.mul(kt,Rt),Bt=tt.add(Mt,Mt),Bt=tt.add(Bt,Mt),zt=tt.mul($t,zt),Yt=tt.mul(Nt,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Mt,zt),zt=tt.mul($t,zt),Yt=tt.add(Yt,zt),Mt=tt.mul(Bt,Yt),It=tt.add(It,Mt),Mt=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Mt),Mt=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Mt),new ht(kt,It,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,It=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(It=It.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(It=It.negate()),It=new ht(tt.mul(It.px,xt.beta),It.py,It.pz),kt.add(It)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:It}=gt.splitScalar(yt);let{p:Rt,f:$t}=this.wNAF(wt),{p:Nt,f:Mt}=this.wNAF(It);Rt=mt.constTimeNegate(Et,Rt),Nt=mt.constTimeNegate(kt,Nt),Nt=new ht(tt.mul(Nt.px,gt.beta),Nt.py,Nt.pz),vt=Rt.add(Nt),bt=$t.add(Mt)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const ft=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(ft/2):ft);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Pt;try{Pt=tt.sqrt(qt)}catch(Lt){const Gt=Lt instanceof Error?": "+Lt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Pt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Pt=tt.neg(Pt)),{x:Ut,y:Pt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function ft(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return ft(zt)?it(-zt):zt}const pt=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(pt(Ft,0,Yt),pt(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Pt=Ut===2||Ut===3?Yt+et.n:Yt;if(Pt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Pt)),Lt=st(Pt),Gt=it(-qt*Lt),nn=it(Ht*Lt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return ft(this.s)}normalizeS(){return this.hasHighS()?new yt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function It(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=$t){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Pt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Pt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Lt=ct(Ft),Gt=[It(Lt),It(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),Tt=at.BASE.multiply(Jt).toAffine(),Dt=it(Tt.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Lt));if(Vt===_0n$3)return;let en=(Tt.x===Dt?0:2)|Number(Tt.y&_1n$5),an=Vt;return qt&&ft(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const $t={lowS:et.lowS,prehash:!1},Nt={lowS:et.lowS,prehash:!1};function Mt(zt,Ft,Yt=$t){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=Nt){var Tt;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Pt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Pt&&(Ft=et.hash(Ft));const{r:Lt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Lt*Wt),Jt=(Tt=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:Tt.toAffine();return Jt?it(Jt.x)===Lt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Mt,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,ft=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(ft,rt,et)*ft%et,pt=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(pt,st,et)*pt%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*pt%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.5",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class Rs extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,tt={}){var ot;super(),_BaseError_instances.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const nt=tt.cause instanceof Rs?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof Rs&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` +`):`The contract function "${nt}" reverted.`,{cause:ot,metaMessages:st,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class RawContractError extends BaseError$3{constructor({data:et,message:tt}){super(tt||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let ft=0;ft{for(let ft=0;ftschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:ft}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:ft}),dt):(ct({args:lt,resolve:ht,reject:ft}),setTimeout(ot,nt),dt)}}}async function call(o,et){var Nt,Mt,Bt,zt;const{account:tt=o.account,batch:nt=!!((Nt=o.batch)!=null&&Nt.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,It=lt&&dt&&xt&&ct,Rt=kt||It,$t=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):It?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Mt=o.chain)==null?void 0:Mt.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Pt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:$t,gas:ht,gasPrice:ft,maxFeePerBlobGas:mt,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Pt})&&!Ht)try{return await scheduleMulticall(o,{...Pt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Pt,Yt,Ht]:[Pt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Pt}=await import("./ccip-C6hySDZB.js");return{offchainLookup:qt,offchainLookupSignature:Pt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var pt;const{batchSize:tt=1024,wait:nt=0}=typeof((pt=o.batch)==null?void 0:pt.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:ft,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:ft});return ft==="0x"?{data:void 0}:{data:ft}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const ft=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return ft==="0x"||trim$1(ft)==="0x00"?null:ft}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(o);if(o.startsWith("http")&&!lt&&!dt){let ft=o;return et!=null&&et.arweave&&(ft=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:ft,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!rt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,ft=0;for(let gt=0;gt0&&ft>ct&&dt[ht].length>0&&(ht++,ft=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var ft,mt;const ht=rt();if(ht.length!==0)for(const pt of ht)(mt=(ft=pt.fns)[lt])==null||mt.call(ft,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var ft;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let pt=at+1n;ptat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(ft=ht.onError)==null||ft.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let ft=!0,mt=()=>ft=!1;return(async()=>{try{const pt=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await pt.subscribe({params:["newHeads"],onData(gt){var vt;if(!ft)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,ft||mt()}catch(pt){rt==null||rt(pt)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const pt={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,pt),gt=await(rt==null?void 0:rt(yt,pt))??{...pt,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let ft;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))ft=await ht.json();else{ft=await ht.text();try{ft=JSON.parse(ft||"{}")}catch(mt){if(ht.ok)throw mt;ft={error:ft}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(ft.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return ft}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof ft>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof ft>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});ft=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),pt=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(ft)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const ft=27n+(et.v===27n?0n:1n);if(et.v!==ft)throw new InvalidLegacyVError({v:et.v});return ft})(),dt=trim$1(et.r),ht=trim$1(et.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let ft;for(;!(ft=ht(ct()));)at();return it(),ft}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=ft,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=pt%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,ft=o.ZERO;ht>0;ht--)ft=ft.add(st[ht]),dt=dt.add(ft);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=et.subarray(nt,nt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((pt,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(pt=>{const yt=pt.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(pt){const{a:yt,b:gt}=et,xt=tt.sqr(pt),vt=tt.mul(xt,pt);return tt.add(tt.add(vt,tt.mul(pt,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(pt){return inRange(pt,_1n$5,et.n)}function at(pt){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;if(yt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!yt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(gt*2,"0")}let bt;try{bt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,gt))}catch{throw new Error(`private key must be ${gt} bytes, hex or bigint, not ${typeof pt}`)}return xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(pt){if(!(pt instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((pt,yt)=>{const{px:gt,py:xt,pz:vt}=pt;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=pt.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(pt=>{if(pt.is0()){if(et.allowInfinityPoint&&!tt.is0(pt.py))return;throw new Error("bad point: ZERO")}const{x:yt,y:gt}=pt.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))throw new Error("bad point: equation left != right");if(!pt.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(yt,gt,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,nt,yt,gt)}_setWindowSize(yt){mt.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),It=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&It}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,It=tt.ZERO,Rt=tt.mul(vt,vt),$t=tt.mul(bt,bt),Nt=tt.mul(Et,Et),Mt=tt.mul(vt,bt);return Mt=tt.add(Mt,Mt),It=tt.mul(vt,Et),It=tt.add(It,It),wt=tt.mul(yt,It),kt=tt.mul(xt,Nt),kt=tt.add(wt,kt),wt=tt.sub($t,kt),kt=tt.add($t,kt),kt=tt.mul(wt,kt),wt=tt.mul(Mt,wt),It=tt.mul(xt,It),Nt=tt.mul(yt,Nt),Mt=tt.sub(Rt,Nt),Mt=tt.mul(yt,Mt),Mt=tt.add(Mt,It),It=tt.add(Rt,Rt),Rt=tt.add(It,Rt),Rt=tt.add(Rt,Nt),Rt=tt.mul(Rt,Mt),kt=tt.add(kt,Rt),Nt=tt.mul(bt,Et),Nt=tt.add(Nt,Nt),Rt=tt.mul(Nt,Mt),wt=tt.sub(wt,Rt),It=tt.mul(Nt,$t),It=tt.add(It,It),It=tt.add(It,It),new ht(wt,kt,It)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,It=tt.ZERO,Rt=tt.ZERO;const $t=et.a,Nt=tt.mul(et.b,_3n$2);let Mt=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Mt,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Mt,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul($t,Yt),kt=tt.mul(Nt,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),It=tt.mul(kt,Rt),Bt=tt.add(Mt,Mt),Bt=tt.add(Bt,Mt),zt=tt.mul($t,zt),Yt=tt.mul(Nt,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Mt,zt),zt=tt.mul($t,zt),Yt=tt.add(Yt,zt),Mt=tt.mul(Bt,Yt),It=tt.add(It,Mt),Mt=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Mt),Mt=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Mt),new ht(kt,It,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,It=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(It=It.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(It=It.negate()),It=new ht(tt.mul(It.px,xt.beta),It.py,It.pz),kt.add(It)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:It}=gt.splitScalar(yt);let{p:Rt,f:$t}=this.wNAF(wt),{p:Nt,f:Mt}=this.wNAF(It);Rt=mt.constTimeNegate(Et,Rt),Nt=mt.constTimeNegate(kt,Nt),Nt=new ht(tt.mul(Nt.px,gt.beta),Nt.py,Nt.pz),vt=Rt.add(Nt),bt=$t.add(Mt)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const ft=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(ft/2):ft);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Pt;try{Pt=tt.sqrt(qt)}catch(Lt){const Gt=Lt instanceof Error?": "+Lt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Pt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Pt=tt.neg(Pt)),{x:Ut,y:Pt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function ft(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return ft(zt)?it(-zt):zt}const pt=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(pt(Ft,0,Yt),pt(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Pt=Ut===2||Ut===3?Yt+et.n:Yt;if(Pt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Pt)),Lt=st(Pt),Gt=it(-qt*Lt),nn=it(Ht*Lt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return ft(this.s)}normalizeS(){return this.hasHighS()?new yt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function It(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=$t){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Pt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Pt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Lt=ct(Ft),Gt=[It(Lt),It(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),Tt=at.BASE.multiply(Jt).toAffine(),Dt=it(Tt.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Lt));if(Vt===_0n$3)return;let en=(Tt.x===Dt?0:2)|Number(Tt.y&_1n$5),an=Vt;return qt&&ft(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const $t={lowS:et.lowS,prehash:!1},Nt={lowS:et.lowS,prehash:!1};function Mt(zt,Ft,Yt=$t){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=Nt){var Tt;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Pt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Pt&&(Ft=et.hash(Ft));const{r:Lt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Lt*Wt),Jt=(Tt=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:Tt.toAffine();return Jt?it(Jt.x)===Lt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Mt,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,ft=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(ft,rt,et)*ft%et,pt=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(pt,st,et)*pt%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*pt%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.5",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class Rs extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,tt={}){var ot;super(),_BaseError_instances.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const nt=tt.cause instanceof Rs?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof Rs&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` `),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}walk(et){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,et)}};_BaseError_instances=new WeakSet,_BaseError_walk=function o(et,tt){return tt!=null&&tt(et)?et:et.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",o).call(this,et.cause,tt):et};class ChainNotConfiguredError extends BaseError$1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$1{constructor({address:et,connector:tt}){super(`Account "${et}" not found for connector "${tt.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$1{constructor({connectionChainId:et,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${et}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${et}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:et}){super(`Connector "${et.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function connect$1(o,et){var nt;let tt;if(typeof et.connector=="function"?tt=o._internal.connectors.setup(et.connector):tt=et.connector,tt.uid===o.state.current)throw new ConnectorAlreadyConnectedError;try{o.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const rt=await tt.connect({chainId:et.chainId}),ot=rt.accounts;return tt.emitter.off("connect",o._internal.events.connect),tt.emitter.on("change",o._internal.events.change),tt.emitter.on("disconnect",o._internal.events.disconnect),await((nt=o.storage)==null?void 0:nt.setItem("recentConnectorId",tt.id)),o.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:rt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:rt.chainId}}catch(rt){throw o.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),rt}}const size$1=256;let index$3=size$1,buffer$1;function uid$1(o=11){if(!buffer$1||index$3+o>size$1*2){buffer$1="",index$3=0;for(let et=0;et{const xt=gt(yt);for(const bt in mt)delete xt[bt];const vt={...yt,...xt};return Object.assign(vt,{extend:pt(vt)})}}return Object.assign(mt,{extend:pt(mt)})}function createTransport({key:o,name:et,request:tt,retryCount:nt=3,retryDelay:rt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:o,name:et,request:tt,retryCount:nt,retryDelay:rt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:nt,retryDelay:rt,uid:at}),value:st}}function custom(o,et={}){const{key:tt="custom",name:nt="Custom Provider",retryDelay:rt}=et;return({retryCount:ot})=>createTransport({key:tt,name:nt,request:o.request.bind(o),retryCount:et.retryCount??ot,retryDelay:rt,type:"custom"})}class UrlRequiredError extends BaseError$3{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function http(o,et={}){const{batch:tt,fetchOptions:nt,key:rt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=et;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:ft=0}=typeof tt=="object"?tt:{},mt=et.retryCount??lt,pt=dt??et.timeout??1e4,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{fetchOptions:nt,onRequest:it,onResponse:st,timeout:pt});return createTransport({key:rt,name:ot,async request({method:xt,params:vt}){const bt={method:xt,params:vt},{schedule:Et}=createBatchScheduler({id:yt,wait:ft,shouldSplitBatch(Rt){return Rt.length>ht},fn:Rt=>gt.request({body:Rt}),sort:(Rt,$t)=>Rt.id-$t.id}),wt=async Rt=>tt?Et(Rt):[await gt.request({body:Rt})],[{error:kt,result:It}]=await wt(bt);if(kt)throw new RpcRequestError({body:bt,error:kt,url:yt});return It},retryCount:mt,retryDelay:at,timeout:pt,type:"http"},{fetchOptions:nt,url:yt})}}async function getConnectorClient(o,et={}){let tt;if(et.connector){const{connector:ct}=et;if(o.state.status==="reconnecting"&&!ct.getAccounts&&!ct.getChainId)throw new ConnectorUnavailableReconnectingError({connector:ct});const[lt,dt]=await Promise.all([ct.getAccounts(),ct.getChainId()]);tt={accounts:lt,chainId:dt,connector:ct}}else tt=o.state.connections.get(o.state.current);if(!tt)throw new ConnectorNotConnectedError;const nt=et.chainId??tt.chainId,rt=await tt.connector.getChainId();if(rt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:rt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:nt});const it=parseAccount(et.account??tt.accounts[0]);if(it.address=getAddress(it.address),et.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=o.chains.find(ct=>ct.id===nt),at=await tt.connector.getProvider({chainId:nt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom(at)({...ct,retryCount:0})})}async function disconnect(o,et={}){var rt,ot;let tt;if(et.connector)tt=et.connector;else{const{connections:it,current:st}=o.state,at=it.get(st);tt=at==null?void 0:at.connector}const nt=o.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",o._internal.events.change),tt.emitter.off("disconnect",o._internal.events.disconnect),tt.emitter.on("connect",o._internal.events.connect),nt.delete(tt.uid)),o.setState(it=>{if(nt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=nt.values().next().value;return{...it,connections:new Map(nt),current:st.connector.uid}});{const it=o.state.current;if(!it)return;const st=(rt=o.state.connections.get(it))==null?void 0:rt.connector;if(!st)return;await((ot=o.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(o){return typeof o=="number"?o:o==="wei"?0:Math.abs(weiUnits[o])}function getAccount(o){const et=o.state.current,tt=o.state.connections.get(et),nt=tt==null?void 0:tt.accounts,rt=nt==null?void 0:nt[0],ot=o.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=o.state.status;switch(it){case"connected":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:it};case"reconnecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!rt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:it};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:it}}}async function multicall(o,et){const{allowFailure:tt=!0,chainId:nt,contracts:rt,...ot}=et,it=o.getClient({chainId:nt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:rt,...ot})}function readContract(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,readContract$1,"readContract")(nt)}async function readContracts(o,et){var st;const{allowFailure:tt=!0,blockNumber:nt,blockTag:rt,...ot}=et,it=et.contracts;try{const at={};for(const[ht,ft]of it.entries()){const mt=ft.chainId??o.state.chainId;at[mt]||(at[mt]=[]),(st=at[mt])==null||st.push({contract:ft,index:ht})}const ct=()=>Object.entries(at).map(([ht,ft])=>multicall(o,{...ot,allowFailure:tt,blockNumber:nt,blockTag:rt,chainId:Number.parseInt(ht),contracts:ft.map(({contract:mt})=>mt)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:ft})=>ft));return lt.reduce((ht,ft,mt)=>(ht&&(ht[dt[mt]]=ft),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(o,{...lt,blockNumber:nt,blockTag:rt}));return tt?(await Promise.allSettled(ct())).map(lt=>lt.status==="fulfilled"?{result:lt.value,status:"success"}:{error:lt.reason,result:void 0,status:"failure"}):await Promise.all(ct())}}async function getBalance(o,et){const{address:tt,blockNumber:nt,blockTag:rt,chainId:ot,token:it,unit:st="ether"}=et;if(it)try{return await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht.name==="ContractFunctionExecutionError"){const ft=await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),mt=hexToString(trim$1(ft.symbol,{dir:"right"}));return{...ft,symbol:mt}}throw ht}const at=o.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(nt?{address:tt,blockNumber:nt}:{address:tt,blockTag:rt}),dt=o.chains.find(ht=>ht.id===ot)??at.chain;return{decimals:dt.nativeCurrency.decimals,formatted:formatUnits(lt,getUnit(st)),symbol:dt.nativeCurrency.symbol,value:lt}}async function getTokenBalance(o,et){const{balanceAddress:tt,chainId:nt,symbolType:rt,tokenAddress:ot,unit:it}=et,st={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:rt}]}],address:ot},[at,ct,lt]=await readContracts(o,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:nt},{...st,functionName:"decimals",chainId:nt},{...st,functionName:"symbol",chainId:nt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(o,et={}){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getBlockNumber$1,"getBlockNumber")(nt)}function getChainId(o){return o.state.chainId}function deepEqual(o,et){if(o===et)return!0;if(o&&et&&typeof o=="object"&&typeof et=="object"){if(o.constructor!==et.constructor)return!1;let tt,nt;if(Array.isArray(o)&&Array.isArray(et)){if(tt=o.length,tt!==et.length)return!1;for(nt=tt;nt--!==0;)if(!deepEqual(o[nt],et[nt]))return!1;return!0}if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===et.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===et.toString();const rt=Object.keys(o);if(tt=rt.length,tt!==Object.keys(et).length)return!1;for(nt=tt;nt--!==0;)if(!Object.prototype.hasOwnProperty.call(et,rt[nt]))return!1;for(nt=tt;nt--!==0;){const ot=rt[nt];if(ot&&!deepEqual(o[ot],et[ot]))return!1}return!0}return o!==o&&et!==et}let previousChains=[];function getChains(o){const et=o.chains;return deepEqual(previousChains,et)?previousChains:(previousChains=et,et)}let previousConnections=[];function getConnections(o){const et=[...o.state.connections.values()];return o.state.status==="reconnecting"||deepEqual(previousConnections,et)?previousConnections:(previousConnections=et,et)}let previousConnectors=[];function getConnectors(o){const et=o.connectors;return deepEqual(previousConnectors,et)?previousConnectors:(previousConnectors=et,et)}function getEnsAddress(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAddress$1,"getEnsAddress")(nt)}function getEnsAvatar(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAvatar$1,"getEnsAvatar")(nt)}function getEnsName(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsName$1,"getEnsName")(nt)}let isReconnecting=!1;async function reconnect(o,et={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,o.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=et.connectors)!=null&&ct.length)for(const dt of et.connectors){let ht;typeof dt=="function"?ht=o._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...o.connectors);let nt;try{nt=await((lt=o.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const rt={};for(const[,dt]of o.state.connections)rt[dt.connector.id]=1;nt&&(rt[nt]=0);const ot=Object.keys(rt).length>0?[...tt].sort((dt,ht)=>(rt[dt.id]??10)-(rt[ht.id]??10)):tt;let it=!1;const st=[],at=[];for(const dt of ot){const ht=await dt.getProvider().catch(()=>{});if(!ht||at.some(pt=>pt===ht)||!await dt.isAuthorized())continue;const mt=await dt.connect({isReconnecting:!0}).catch(()=>null);mt&&(dt.emitter.off("connect",o._internal.events.connect),dt.emitter.on("change",o._internal.events.change),dt.emitter.on("disconnect",o._internal.events.disconnect),o.setState(pt=>{const yt=new Map(it?pt.connections:new Map).set(dt.uid,{accounts:mt.accounts,chainId:mt.chainId,connector:dt});return{...pt,current:it?pt.current:dt.uid,connections:yt}}),st.push({accounts:mt.accounts,chainId:mt.chainId,connector:dt}),at.push(ht),it=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(it?o.setState(dt=>({...dt,status:"connected"})):o.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(o,et){const{account:tt,connector:nt,...rt}=et;let ot;return typeof tt=="object"&&tt.type==="local"?ot=o.getClient():ot=await getConnectorClient(o,{account:tt,connector:nt}),getAction(ot,signMessage$1,"signMessage")({...rt,...tt?{account:tt}:{}})}class ProviderNotFoundError extends BaseError$1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$1{constructor({connector:et}){super(`"${et.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(o,et){var it;const{addEthereumChainParameter:tt,chainId:nt}=et,rt=o.state.connections.get(((it=et.connector)==null?void 0:it.uid)??o.state.current);if(rt){const st=rt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:nt})}const ot=o.chains.find(st=>st.id===nt);if(!ot)throw new ChainNotConfiguredError;return o.setState(st=>({...st,chainId:nt})),ot}function watchAccount(o,et){const{onChange:tt}=et;return o.subscribe(()=>getAccount(o),tt,{equalityFn(nt,rt){const{connector:ot,...it}=nt,{connector:st,...at}=rt;return deepEqual(it,at)&&(ot==null?void 0:ot.id)===(st==null?void 0:st.id)&&(ot==null?void 0:ot.uid)===(st==null?void 0:st.uid)}})}function watchBlockNumber(o,et){const{syncConnectedChain:tt=o._internal.syncConnectedChain,...nt}=et;let rt;const ot=at=>{rt&&rt();const ct=o.getClient({chainId:at});return rt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(nt),rt},it=ot(et.chainId);let st;return tt&&!et.chainId&&(st=o.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(o,et){const{onChange:tt}=et;return o.subscribe(nt=>nt.chainId,tt)}function watchConnections(o,et){const{onChange:tt}=et;return o.subscribe(()=>getConnections(o),tt,{equalityFn:deepEqual})}function watchConnectors(o,et){const{onChange:tt}=et;return o._internal.connectors.subscribe((nt,rt)=>{tt(Object.values(nt),rt)})}function createConnector(o){return o}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(o={}){const{shimDisconnect:et=!0,unstable_shimAsyncInject:tt}=o;function nt(){const at=o.target;if(typeof at=="function"){const ct=at();if(ct)return ct}return typeof at=="object"?at:typeof at=="string"?{...targetMap[at]??{id:at,name:`${at[0].toUpperCase()}${at.slice(1)}`,provider:`is${at[0].toUpperCase()}${at.slice(1)}`}}:{id:"injected",name:"Injected",provider(ct){return ct==null?void 0:ct.ethereum}}}let rt,ot,it,st;return at=>({get icon(){return nt().icon},get id(){return nt().id},get name(){return nt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&o.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)))},async connect({chainId:ct,isReconnecting:lt}={}){var ft,mt,pt,yt,gt,xt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(et)try{ht=(yt=(pt=(mt=(ft=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:ft.caveats)==null?void 0:mt[0])==null?void 0:pt.value)==null?void 0:yt.map(bt=>getAddress(bt)),ht.length>0&&(ht=await this.getAccounts())}catch(vt){const bt=vt;if(bt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(bt);if(bt.code===ResourceUnavailableRpcError.code)throw bt}try{!(ht!=null&&ht.length)&&!lt&&(ht=(await dt.request({method:"eth_requestAccounts"})).map(Et=>getAddress(Et))),it&&(dt.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let vt=await this.getChainId();if(ct&&vt!==ct){const bt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:vt}});vt=(bt==null?void 0:bt.id)??vt}return et&&await((gt=at.storage)==null?void 0:gt.removeItem(`${this.id}.disconnected`)),o.target||await((xt=at.storage)==null?void 0:xt.setItem("injected.connected",!0)),{accounts:ht,chainId:vt}}catch(vt){const bt=vt;throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):bt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(bt):bt}},async disconnect(){var lt,dt;const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;ot&&(ct.removeListener("chainChanged",ot),ot=void 0),st&&(ct.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),ct.on("connect",it));try{await withTimeout(()=>ct.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}et&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),o.target||await((dt=at.storage)==null?void 0:dt.removeItem("injected.connected"))},async getAccounts(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;return(await ct.request({method:"eth_accounts"})).map(dt=>getAddress(dt))},async getChainId(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;const lt=await ct.request({method:"eth_chainId"});return Number(lt)},async getProvider(){if(typeof window>"u")return;let ct;const lt=nt();return typeof lt.provider=="function"?ct=lt.provider(window):typeof lt.provider=="string"?ct=findProvider(window,lt.provider):ct=lt.provider,ct&&!ct.removeListener&&("off"in ct&&typeof ct.off=="function"?ct.removeListener=ct.off:ct.removeListener=()=>{}),ct},async isAuthorized(){var ct,lt;try{if(et&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!o.target&&!await((lt=at.storage)==null?void 0:lt.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(tt!==void 0&&tt!==!1){const mt=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",mt),!!await this.getProvider()),pt=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(gt=>window.addEventListener("ethereum#initialized",()=>gt(mt()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(mt()),pt))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,pt,yt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(xt=>xt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);const ft=new Promise(xt=>{const vt=bt=>{"chainId"in bt&&bt.chainId===lt&&(at.emitter.off("change",vt),xt())};at.emitter.on("change",vt)});try{return await Promise.all([dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt)}]}).then(async()=>{await this.getChainId()===lt&&at.emitter.emit("change",{chainId:lt})}),ft]),ht}catch(xt){const vt=xt;if(vt.code===4902||((pt=(mt=vt==null?void 0:vt.data)==null?void 0:mt.originalError)==null?void 0:pt.code)===4902)try{const{default:bt,...Et}=ht.blockExplorers??{};let wt;ct!=null&&ct.blockExplorerUrls?wt=ct.blockExplorerUrls:bt&&(wt=[bt.url,...Object.values(Et).map(Rt=>Rt.url)]);let kt;(yt=ct==null?void 0:ct.rpcUrls)!=null&&yt.length?kt=ct.rpcUrls:kt=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const It={blockExplorerUrls:wt,chainId:numberToHex(lt),chainName:(ct==null?void 0:ct.chainName)??ht.name,iconUrls:ct==null?void 0:ct.iconUrls,nativeCurrency:(ct==null?void 0:ct.nativeCurrency)??ht.nativeCurrency,rpcUrls:kt};return await Promise.all([dt.request({method:"wallet_addEthereumChain",params:[It]}).then(async()=>{if(await this.getChainId()===lt)at.emitter.emit("change",{chainId:lt});else throw new UserRejectedRequestError(new Error("User rejected switch after adding network."))}),ft]),ht}catch(bt){throw new UserRejectedRequestError(bt)}throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):new SwitchChainError(vt)}},async onAccountsChanged(ct){var lt;if(ct.length===0)this.onDisconnect();else if(at.emitter.listenerCount("connect")){const dt=(await this.getChainId()).toString();this.onConnect({chainId:dt}),et&&await((lt=at.storage)==null?void 0:lt.removeItem(`${this.id}.disconnected`))}else at.emitter.emit("change",{accounts:ct.map(dt=>getAddress(dt))})},onChainChanged(ct){const lt=Number(ct);at.emitter.emit("change",{chainId:lt})},async onConnect(ct){const lt=await this.getAccounts();if(lt.length===0)return;const dt=Number(ct.chainId);at.emitter.emit("connect",{accounts:lt,chainId:dt});const ht=await this.getProvider();ht&&(it&&(ht.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ht.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),ht.on("disconnect",st)))},async onDisconnect(ct){const lt=await this.getProvider();ct&&ct.code===1013&<&&(await this.getAccounts()).length||(at.emitter.emit("disconnect"),lt&&(ot&&(lt.removeListener("chainChanged",ot),ot=void 0),st&&(lt.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),lt.on("connect",it))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o!=null&&o.coinbaseWalletExtension?o.coinbaseWalletExtension:findProvider(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return findProvider(o,et=>{if(!et.isMetaMask||et.isBraveWallet&&!et._events&&!et._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const nt of tt)if(et[nt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){var et,tt;return(et=o==null?void 0:o.phantom)!=null&&et.ethereum?(tt=o.phantom)==null?void 0:tt.ethereum:findProvider(o,"isPhantom")}}};function findProvider(o,et){function tt(rt){return typeof et=="function"?et(rt):typeof et=="string"?rt[et]:!0}const nt=o.ethereum;if(nt!=null&&nt.providers)return nt.providers.find(rt=>tt(rt));if(nt&&tt(nt))return nt}function requestProviders(o){if(typeof window>"u")return;const et=tt=>o(tt.detail);return window.addEventListener("eip6963:announceProvider",et),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",et)}function createStore$1(){const o=new Set;let et=[];const tt=()=>requestProviders(rt=>{et.some(({info:ot})=>ot.uuid===rt.info.uuid)||(et=[...et,rt],o.forEach(ot=>ot(et,{added:[rt]})))});let nt=tt();return{_listeners(){return o},clear(){o.forEach(rt=>rt([],{removed:[...et]})),et=[]},destroy(){this.clear(),o.clear(),nt==null||nt()},findProvider({rdns:rt}){return et.find(ot=>ot.info.rdns===rt)},getProviders(){return et},reset(){this.clear(),nt==null||nt(),nt=tt()},subscribe(rt,{emitImmediately:ot}={}){return o.add(rt),ot&&rt(et,{added:et}),()=>o.delete(rt)}}}const subscribeWithSelectorImpl=o=>(et,tt,nt)=>{const rt=nt.subscribe;return nt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(nt.getState());ct=ht=>{const ft=it(ht);if(!lt(dt,ft)){const mt=dt;st(dt=ft,mt)}},at!=null&&at.fireImmediately&&st(dt,dt)}return rt(ct)},o(et,tt,nt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(o,et){let tt;try{tt=o()}catch{return}return{getItem:rt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(rt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(rt,ot)=>tt.setItem(rt,JSON.stringify(ot,void 0)),removeItem:rt=>tt.removeItem(rt)}}const toThenable=o=>et=>{try{const tt=o(et);return tt instanceof Promise?tt:{then(nt){return toThenable(nt)(tt)},catch(nt){return this}}}catch(tt){return{then(nt){return this},catch(nt){return toThenable(nt)(tt)}}}},persistImpl=(o,et)=>(tt,nt,rt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:pt=>pt,version:0,merge:(pt,yt)=>({...yt,...pt}),...et},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return o((...pt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...pt)},nt,rt);const lt=()=>{const pt=ot.partialize({...nt()});return ct.setItem(ot.name,{state:pt,version:ot.version})},dt=rt.setState;rt.setState=(pt,yt)=>{dt(pt,yt),lt()};const ht=o((...pt)=>{tt(...pt),lt()},nt,rt);rt.getInitialState=()=>ht;let ft;const mt=()=>{var pt,yt;if(!ct)return;it=!1,st.forEach(xt=>{var vt;return xt((vt=nt())!=null?vt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.call(ot,(pt=nt())!=null?pt:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(xt=>{if(xt)if(typeof xt.version=="number"&&xt.version!==ot.version){if(ot.migrate)return[!0,ot.migrate(xt.state,xt.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,xt.state];return[!1,void 0]}).then(xt=>{var vt;const[bt,Et]=xt;if(ft=ot.merge(Et,(vt=nt())!=null?vt:ht),tt(ft,!0),bt)return lt()}).then(()=>{gt==null||gt(ft,void 0),ft=nt(),it=!0,at.forEach(xt=>xt(ft))}).catch(xt=>{gt==null||gt(void 0,xt)})};return rt.persist={setOptions:pt=>{ot={...ot,...pt},pt.storage&&(ct=pt.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>mt(),hasHydrated:()=>it,onHydrate:pt=>(st.add(pt),()=>{st.delete(pt)}),onFinishHydration:pt=>(at.add(pt),()=>{at.delete(pt)})},ot.skipHydration||mt(),ft||ht},persist=persistImpl,createStoreImpl=o=>{let et;const tt=new Set,nt=(ct,lt)=>{const dt=typeof ct=="function"?ct(et):ct;if(!Object.is(dt,et)){const ht=et;et=lt??(typeof dt!="object"||dt===null)?dt:Object.assign({},et,dt),tt.forEach(ft=>ft(et,ht))}},rt=()=>et,st={setState:nt,getState:rt,getInitialState:()=>at,subscribe:ct=>(tt.add(ct),()=>tt.delete(ct))},at=et=o(nt,rt,st);return st},createStore=o=>o?createStoreImpl(o):createStoreImpl;var eventemitter3={exports:{}};(function(o){var et=Object.prototype.hasOwnProperty,tt="~";function nt(){}Object.create&&(nt.prototype=Object.create(null),new nt().__proto__||(tt=!1));function rt(at,ct,lt){this.fn=at,this.context=ct,this.once=lt||!1}function ot(at,ct,lt,dt,ht){if(typeof lt!="function")throw new TypeError("The listener must be a function");var ft=new rt(lt,dt||at,ht),mt=tt?tt+ct:ct;return at._events[mt]?at._events[mt].fn?at._events[mt]=[at._events[mt],ft]:at._events[mt].push(ft):(at._events[mt]=ft,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new nt:delete at._events[ct]}function st(){this._events=new nt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)et.call(lt,dt)&&ct.push(tt?dt.slice(1):dt);return Object.getOwnPropertySymbols?ct.concat(Object.getOwnPropertySymbols(lt)):ct},st.prototype.listeners=function(ct){var lt=tt?tt+ct:ct,dt=this._events[lt];if(!dt)return[];if(dt.fn)return[dt.fn];for(var ht=0,ft=dt.length,mt=new Array(ft);ht{let rt=nt;return(rt==null?void 0:rt.__type)==="bigint"&&(rt=BigInt(rt.value)),(rt==null?void 0:rt.__type)==="Map"&&(rt=new Map(rt.value)),(et==null?void 0:et(tt,rt))??rt})}function getReferenceKey(o,et){return o.slice(0,et).join(".")||"."}function getCutoff(o,et){const{length:tt}=o;for(let nt=0;nt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(et==null?void 0:et(rt,it))??it},nt),tt??void 0)}function createStorage(o){const{deserialize:et=deserialize$1,key:tt="wagmi",serialize:nt=serialize$1,storage:rt=noopStorage}=o;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...rt,key:tt,async getItem(it,st){const at=rt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?et(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(rt.removeItem(at)):await ot(rt.setItem(at,nt(st)))},async removeItem(it){await ot(rt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer;function uid(o=11){if(!buffer||index$2+o>size*2){buffer="",index$2=0;for(let et=0;etot.chains),at=createStore(()=>{const Et=[],wt=new Set;for(const kt of ot.connectors??[]){const It=ct(kt);Et.push(It),!rt&&It.rdns&&wt.add(It.rdns)}if(!rt&&it){const kt=it.getProviders();for(const It of kt)wt.has(It.info.rdns)||Et.push(ct(lt(It)))}return Et});function ct(Et){var It;const wt=createEmitter(uid()),kt={...Et({emitter:wt,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:wt,uid:wt.uid};return wt.on("connect",vt),(It=kt.setup)==null||It.call(kt),kt}function lt(Et){const{info:wt}=Et,kt=Et.provider;return injected({target:{...wt,id:wt.rdns,provider:kt}})}const dt=new Map;function ht(Et={}){const wt=Et.chainId??yt.getState().chainId,kt=st.getState().find(Rt=>Rt.id===wt);if(Et.chainId&&!kt)throw new ChainNotConfiguredError;{const Rt=dt.get(yt.getState().chainId);if(Rt&&!kt)return Rt;if(!kt)throw new ChainNotConfiguredError}{const Rt=dt.get(wt);if(Rt)return Rt}let It;if(ot.client)It=ot.client({chain:kt});else{const Rt=kt.id,$t=st.getState().map(Bt=>Bt.id),Nt={},Mt=Object.entries(ot);for(const[Bt,zt]of Mt)if(!(Bt==="chains"||Bt==="client"||Bt==="connectors"||Bt==="transports"))if(typeof zt=="object")if(Rt in zt)Nt[Bt]=zt[Rt];else{if($t.some(Yt=>Yt in zt))continue;Nt[Bt]=zt}else Nt[Bt]=zt;It=createClient({...Nt,chain:kt,batch:Nt.batch??{multicall:!0},transport:Bt=>ot.transports[Rt]({...Bt,connectors:at})})}return dt.set(wt,It),It}function ft(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let mt;const pt="0.0.0-canary-";version$6.startsWith(pt)?mt=Number.parseInt(version$6.replace(pt,"")):mt=Number.parseInt(version$6.split(".")[0]??"0");const yt=createStore(subscribeWithSelector(tt?persist(ft,{migrate(Et,wt){if(wt===mt)return Et;const kt=ft(),It=gt(Et,kt.chainId);return{...kt,chainId:It}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([wt,kt])=>{const{id:It,name:Rt,type:$t,uid:Nt}=kt.connector;return[wt,{...kt,connector:{id:It,name:Rt,type:$t,uid:Nt}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,wt){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const kt=gt(Et,wt.chainId);return{...wt,...Et,chainId:kt}},skipHydration:rt,storage:tt,version:mt}):ft));yt.setState(ft());function gt(Et,wt){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(kt=>kt.id===Et.chainId)?Et.chainId:wt}nt&&yt.subscribe(({connections:Et,current:wt})=>{var kt;return wt?(kt=Et.get(wt))==null?void 0:kt.chainId:void 0},Et=>{if(st.getState().some(kt=>kt.id===Et))return yt.setState(kt=>({...kt,chainId:Et??kt.chainId}))}),it==null||it.subscribe(Et=>{const wt=new Set,kt=new Set;for(const Rt of at.getState())wt.add(Rt.id),Rt.rdns&&kt.add(Rt.rdns);const It=[];for(const Rt of Et){if(kt.has(Rt.info.rdns))continue;const $t=ct(lt(Rt));wt.has($t.id)||It.push($t)}tt&&!yt.persist.hasHydrated()||at.setState(Rt=>[...Rt,...It],!0)});function xt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);return kt?{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts??kt.accounts,chainId:Et.chainId??kt.chainId,connector:kt.connector})}:wt})}function vt(Et){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.setState(wt=>{const kt=at.getState().find(It=>It.uid===Et.uid);return kt?(kt.emitter.listenerCount("connect")&&kt.emitter.off("connect",xt),kt.emitter.listenerCount("change")||kt.emitter.on("change",xt),kt.emitter.listenerCount("disconnect")||kt.emitter.on("disconnect",bt),{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:kt}),current:Et.uid,status:"connected"}):wt})}function bt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);if(kt){const Rt=kt.connector;Rt.emitter.listenerCount("change")&&kt.connector.emitter.off("change",xt),Rt.emitter.listenerCount("disconnect")&&kt.connector.emitter.off("disconnect",bt),Rt.emitter.listenerCount("connect")||kt.connector.emitter.on("connect",vt)}if(wt.connections.delete(Et.uid),wt.connections.size===0)return{...wt,connections:new Map,current:null,status:"disconnected"};const It=wt.connections.values().next().value;return{...wt,connections:new Map(wt.connections),current:It.connector.uid}})}return{get chains(){return st.getState()},get connectors(){return at.getState()},storage:tt,getClient:ht,get state(){return yt.getState()},setState(Et){let wt;typeof Et=="function"?wt=Et(yt.getState()):wt=Et;const kt=ft();typeof wt!="object"&&(wt=kt),Object.keys(kt).some(Rt=>!(Rt in wt))&&(wt=kt),yt.setState(wt,!0)},subscribe(Et,wt,kt){return yt.subscribe(Et,wt,kt?{...kt,fireImmediately:kt.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,ssr:!!rt,syncConnectedChain:nt,transports:ot.transports,chains:{setState(Et){const wt=typeof Et=="function"?Et(st.getState()):Et;if(wt.length!==0)return st.setState(wt,!0)},subscribe(Et){return st.subscribe(Et)}},connectors:{providerDetailToConnector:lt,setup:ct,setState(Et){return at.setState(typeof Et=="function"?Et(at.getState()):Et,!0)},subscribe(Et){return at.subscribe(Et)}},events:{change:xt,connect:vt,disconnect:bt}}}}function hydrate(o,et){const{initialState:tt,reconnectOnMount:nt}=et;return tt&&!o._internal.store.persist.hasHydrated()&&o.setState({...tt,chainId:o.chains.some(rt=>rt.id===tt.chainId)?tt.chainId:o.chains[0].id,connections:nt?tt.connections:new Map,status:nt?"reconnecting":"disconnected"}),{async onMount(){o._internal.ssr&&(await o._internal.store.persist.rehydrate(),o._internal.mipd&&o._internal.connectors.setState(rt=>{var at;const ot=new Set;for(const ct of rt??[])ct.rdns&&ot.add(ct.rdns);const it=[],st=((at=o._internal.mipd)==null?void 0:at.getProviders())??[];for(const ct of st){if(ot.has(ct.info.rdns))continue;const lt=o._internal.connectors.providerDetailToConnector(ct),dt=o._internal.connectors.setup(lt);it.push(dt)}return[...rt,...it]})),nt?reconnect(o):o.storage&&o.setState(rt=>({...rt,connections:new Map}))}}}function extractRpcUrls(o){var ot,it,st;const{chain:et}=o,tt=et.rpcUrls.default.http[0];if(!o.transports)return[tt];const nt=(it=(ot=o.transports)==null?void 0:ot[et.id])==null?void 0:it.call(ot,{chain:et});return(((st=nt==null?void 0:nt.value)==null?void 0:st.transports)||[nt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(o){const{children:et,config:tt,initialState:nt,reconnectOnMount:rt=!0}=o,{onMount:ot}=hydrate(tt,{initialState:nt,reconnectOnMount:rt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),et}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(o){const{children:et,config:tt}=o,nt={value:tt};return reactExports.createElement(Hydrate,o,reactExports.createElement(WagmiContext.Provider,nt,et))}const version$5="2.12.31",getVersion=()=>`wagmi@${version$5}`;class BaseError extends BaseError$1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return getVersion()}}class WagmiProviderNotFoundError extends BaseError{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function useConfig(o={}){const et=o.config??reactExports.useContext(WagmiContext);if(!et)throw new WagmiProviderNotFoundError;return et}function watchChains(o,et){const{onChange:tt}=et;return o._internal.chains.subscribe((nt,rt)=>{tt(nt,rt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** * @license React * use-sync-external-store-shim.production.min.js @@ -92,7 +92,7 @@ ${prettyStateOverride(ft)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMes * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var h$3=reactExports,n$2=shimExports;function p$2(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(o,et,tt,nt,rt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(ft){if(!ct){if(ct=!0,lt=ft,ft=nt(ft),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,ft))return dt=mt}return dt=ft}if(mt=dt,q$3(lt,ft))return mt;var pt=nt(ft);return rt!==void 0&&rt(mt,pt)?mt:(lt=ft,dt=pt)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,Or,zs,FocusManager=(zs=class extends Subscribable{constructor(){super();pn(this,Sr);pn(this,lr);pn(this,Or);un(this,Or,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){jt(this,lr)||this.setEventListener(jt(this,Or))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,Or,et),(tt=jt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){jt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof jt(this,Sr)=="boolean"?jt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,Or=new WeakMap,zs),focusManager=new FocusManager,Mr,ur,jr,Vs,OnlineManager=(Vs=class extends Subscribable{constructor(){super();pn(this,Mr,!0);pn(this,ur);pn(this,jr);un(this,jr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){jt(this,ur)||this.setEventListener(jt(this,jr))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,jr,et),(tt=jt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){jt(this,Mr)!==et&&(un(this,Mr,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return jt(this,Mr)}},Mr=new WeakMap,ur=new WeakMap,jr=new WeakMap,Vs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=pt=>{var yt;nt||(ht(new CancelledError(pt)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=pt=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,pt),rt==null||rt(),ot.resolve(pt))},ht=pt=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,pt),rt==null||rt(),ot.reject(pt))},ft=()=>new Promise(pt=>{var yt;rt=gt=>{(nt||ct())&&pt(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var pt;rt=void 0,nt||(pt=o.onContinue)==null||pt.call(o)}),mt=()=>{if(nt)return;let pt;const yt=tt===0?o.initialPromise:void 0;try{pt=yt??o.fn()}catch(gt){pt=Promise.reject(gt)}Promise.resolve(pt).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:ft()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():ft().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Hs,Removable=(Hs=class{constructor(){pn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){jt(this,kr)&&(clearTimeout(jt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Hs),Br,Dr,Un,Nn,no,Ar,Hn,tr,Ws,Query=(Ws=class extends Removable{constructor(et){super();pn(this,Hn);pn(this,Br);pn(this,Dr);pn(this,Un);pn(this,Nn);pn(this,no);pn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??jt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=jt(this,Nn))==null?void 0:et.promise}setOptions(et){this.options={...jt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&jt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=jt(this,Nn))==null?void 0:nt.promise;return(rt=jt(this,Nn))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(jt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),jt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(jt(this,Nn)&&(jt(this,Ar)?jt(this,Nn).cancel({revert:!0}):jt(this,Nn).cancelRetry()),this.scheduleGc()),jt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(jt(this,Nn))return jt(this,Nn).continueRetry(),jt(this,Nn).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,ft,mt,pt;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((ft=(ht=jt(this,Un).config).onError)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,Nn,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,ft,mt,pt;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(ft=(ht=jt(this,Un).config).onSuccess)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),jt(this,Nn).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,Nn=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&jt(this,Dr)?{...jt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),jt(this,Un).notify({query:this,type:"updated",action:et})})},Ws);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Gs,QueryCache=(Gs=class extends Subscribable{constructor(et={}){super();pn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){jt(this,Wn).has(et.queryHash)||(jt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=jt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&jt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return jt(this,Wn).get(et)}getAll(){return[...jt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Gs),Gn,On,Rr,qn,ar,qs,Mutation=(qs=class extends Removable{constructor(et){super();pn(this,qn);pn(this,Gn);pn(this,On);pn(this,Rr);this.mutationId=et.mutationId,un(this,On,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){jt(this,Gn).includes(et)||(jt(this,Gn).push(et),this.clearGcTimeout(),jt(this,On).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,jt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),jt(this,On).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){jt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():jt(this,On).remove(this))}continue(){var et;return((et=jt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(It,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:It,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>jt(this,On).canRun(this)}));const tt=this.state.status==="pending",nt=!jt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=jt(this,On).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const It=await jt(this,Rr).start();return await((ct=(at=jt(this,On).config).onSuccess)==null?void 0:ct.call(at,It,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,It,et,this.state.context)),await((ft=(ht=jt(this,On).config).onSettled)==null?void 0:ft.call(ht,It,null,this.state.variables,this.state.context,this)),await((pt=(mt=this.options).onSettled)==null?void 0:pt.call(mt,It,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:It}),It}catch(It){try{throw await((gt=(yt=jt(this,On).config).onError)==null?void 0:gt.call(yt,It,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,It,et,this.state.context)),await((Et=(bt=jt(this,On).config).onSettled)==null?void 0:Et.call(bt,void 0,It,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,It,et,this.state.context)),It}finally{gn(this,qn,ar).call(this,{type:"error",error:It})}}finally{jt(this,On).runNext(this)}}},Gn=new WeakMap,On=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{jt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),jt(this,On).notify({mutation:this,type:"updated",action:et})})},qs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fn,ro,Ks,MutationCache=(Ks=class extends Subscribable{constructor(et={}){super();pn(this,Fn);pn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=jt(this,Fn).get(tt)??[];nt.push(et),jt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(jt(this,Fn).has(tt)){const rt=(nt=jt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?jt(this,Fn).delete(tt):jt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...jt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ks);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,ft,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((ft=et.state.data)==null?void 0:ft.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let pt=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?pt=!0:et.signal.addEventListener("abort",()=>{pt=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(pt)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:It}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,It),pageParams:Rt(vt.pageParams,bt,It)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var pt,yt;return(yt=(pt=et.options).persister)==null?void 0:yt.call(pt,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Ln,dr,hr,Fr,Ur,fr,zr,Vr,Qs,QueryClient=(Qs=class{constructor(o={}){pn(this,Ln);pn(this,dr);pn(this,hr);pn(this,Fr);pn(this,Ur);pn(this,fr);pn(this,zr);pn(this,Vr);un(this,Ln,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,fr,0)}mount(){br(this,fr)._++,jt(this,fr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onOnline())})))}unmount(){var o,et;br(this,fr)._--,jt(this,fr)===0&&((o=jt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=jt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return jt(this,Ln).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return jt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=jt(this,Ln).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return jt(this,Ln).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=jt(this,Ln).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return jt(this,Ln).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>jt(this,Ln).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=jt(this,Ln);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=jt(this,Ln),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(jt(this,Ln).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=jt(this,Ln).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?jt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return jt(this,Ln)}getMutationCache(){return jt(this,dr)}getDefaultOptions(){return jt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){jt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...jt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){jt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...jt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...jt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...jt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){jt(this,Ln).clear(),jt(this,dr).clear()}},Ln=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,fr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Qs),jn,Sn,oo,Mn,Tr,Hr,pr,Kn,io,Wr,Gr,Ir,_r,mr,qr,In,to,Ts,Is,_s,$s,Ps,Ls,Ns,Xl,Ys,QueryObserver=(Ys=class extends Subscribable{constructor(et,tt){super();pn(this,In);pn(this,jn);pn(this,Sn);pn(this,oo);pn(this,Mn);pn(this,Tr);pn(this,Hr);pn(this,pr);pn(this,Kn);pn(this,io);pn(this,Wr);pn(this,Gr);pn(this,Ir);pn(this,_r);pn(this,mr);pn(this,qr,new Set);this.options=tt,un(this,jn,et),un(this,Kn,null),un(this,pr,pendingThenable()),this.options.experimental_prefetchInRender||jt(this,pr).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(jt(this,Sn).addObserver(this),shouldFetchOnMount(jt(this,Sn),this.options)?gn(this,In,to).call(this):this.updateResult(),gn(this,In,$s).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,In,Ps).call(this),gn(this,In,Ls).call(this),jt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=jt(this,Sn);if(this.options=jt(this,jn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,jt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,In,Ns).call(this),jt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&jt(this,jn).getQueryCache().notify({type:"observerOptionsUpdated",query:jt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(jt(this,Sn),rt,this.options,nt)&&gn(this,In,to).call(this),this.updateResult(tt),ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||resolveStaleTime(this.options.staleTime,jt(this,Sn))!==resolveStaleTime(nt.staleTime,jt(this,Sn)))&&gn(this,In,Ts).call(this);const it=gn(this,In,Is).call(this);ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||it!==jt(this,mr))&&gn(this,In,_s).call(this,it)}getOptimisticResult(et){const tt=jt(this,jn).getQueryCache().build(jt(this,jn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,Mn,nt),un(this,Hr,this.options),un(this,Tr,jt(this,Sn).state)),nt}getCurrentResult(){return jt(this,Mn)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){jt(this,qr).add(et)}getCurrentQuery(){return jt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=jt(this,jn).defaultQueryOptions(et),nt=jt(this,jn).getQueryCache().build(jt(this,jn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,In,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),jt(this,Mn)))}createResult(et,tt){var It;const nt=jt(this,Sn),rt=this.options,ot=jt(this,Mn),it=jt(this,Tr),st=jt(this,Hr),ct=et!==nt?et.state:jt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,ft;if(tt._optimisticResults){const Rt=this.hasListeners(),$t=!Rt&&shouldFetchOnMount(et,tt),Nt=Rt&&shouldFetchOptionally(et,nt,tt,rt);($t||Nt)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:pt,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===jt(this,io))ft=jt(this,Wr);else try{un(this,io,tt.select),ft=tt.select(dt.data),ft=replaceData(ot==null?void 0:ot.data,ft,tt),un(this,Wr,ft),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else ft=dt.data;if(tt.placeholderData!==void 0&&ft===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((It=jt(this,Gr))==null?void 0:It.state.data,jt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch($t){un(this,Kn,$t)}Rt!==void 0&&(yt="success",ft=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}jt(this,Kn)&&(mt=jt(this,Kn),ft=jt(this,Wr),pt=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=ft!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:ft,dataUpdatedAt:dt.dataUpdatedAt,error:mt,errorUpdatedAt:pt,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:gt,isRefetching:gt&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:jt(this,pr)};if(this.options.experimental_prefetchInRender){const Rt=Mt=>{kt.status==="error"?Mt.reject(kt.error):kt.data!==void 0&&Mt.resolve(kt.data)},$t=()=>{const Mt=un(this,pr,kt.promise=pendingThenable());Rt(Mt)},Nt=jt(this,pr);switch(Nt.status){case"pending":et.queryHash===nt.queryHash&&Rt(Nt);break;case"fulfilled":(kt.status==="error"||kt.data!==Nt.value)&&$t();break;case"rejected":(kt.status!=="error"||kt.error!==Nt.reason)&&$t();break}}return kt}updateResult(et){const tt=jt(this,Mn),nt=this.createResult(jt(this,Sn),this.options);if(un(this,Tr,jt(this,Sn).state),un(this,Hr,this.options),jt(this,Tr).data!==void 0&&un(this,Gr,jt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,Mn,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!jt(this,qr).size)return!0;const at=new Set(st??jt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(jt(this,Mn)).some(ct=>{const lt=ct;return jt(this,Mn)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,In,Xl).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,In,$s).call(this)}},jn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,Mn=new WeakMap,Tr=new WeakMap,Hr=new WeakMap,pr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ir=new WeakMap,_r=new WeakMap,mr=new WeakMap,qr=new WeakMap,In=new WeakSet,to=function(et){gn(this,In,Ns).call(this);let tt=jt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Ts=function(){gn(this,In,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,jt(this,Sn));if(isServer||jt(this,Mn).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(jt(this,Mn).dataUpdatedAt,et)+1;un(this,Ir,setTimeout(()=>{jt(this,Mn).isStale||this.updateResult()},nt))},Is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(jt(this,Sn)):this.options.refetchInterval)??!1},_s=function(et){gn(this,In,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,jt(this,Sn))===!1||!isValidTimeout(jt(this,mr))||jt(this,mr)===0)&&un(this,_r,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,In,to).call(this)},jt(this,mr)))},$s=function(){gn(this,In,Ts).call(this),gn(this,In,_s).call(this,gn(this,In,Is).call(this))},Ps=function(){jt(this,Ir)&&(clearTimeout(jt(this,Ir)),un(this,Ir,void 0))},Ls=function(){jt(this,_r)&&(clearInterval(jt(this,_r)),un(this,_r,void 0))},Ns=function(){const et=jt(this,jn).getQueryCache().build(jt(this,jn),this.options);if(et===jt(this,Sn))return;const tt=jt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Xl=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(jt(this,Mn))}),jt(this,jn).getQueryCache().notify({query:jt(this,Sn),type:"observerResultsUpdated"})})},Ys);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,Os,Zs,MutationObserver$1=(Zs=class extends Subscribable{constructor(tt,nt){super();pn(this,sr);pn(this,gr);pn(this,yr);pn(this,Bn);pn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=jt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||jt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:jt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=jt(this,Bn))==null?void 0:rt.state.status)==="pending"&&jt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=jt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this,tt)}getCurrentResult(){return jt(this,yr)}reset(){var tt;(tt=jt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=jt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,jt(this,gr).getMutationCache().build(jt(this,gr),this.options)),jt(this,Bn).addObserver(this),jt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=jt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(tt){notifyManager.batch(()=>{var nt,rt,ot,it,st,at,ct,lt;if(jt(this,rr)&&this.hasListeners()){const dt=jt(this,yr).variables,ht=jt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=jt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=jt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=jt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=jt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(jt(this,yr))})})},Zs);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:ft,retryDelay:mt,structuralSharing:pt,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:It,refetchOnMount:Rt,refetchOnReconnect:$t,refetchOnWindowFocus:Nt,retryOnMount:Mt,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Pt}=o;return Pt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,ft,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(pt=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),yt},[at,rt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((ft=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||ft.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const pt=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;pt==null||pt.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),sourceId=1,optimism=defineChain({...chainConfig,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const at=await __vitePreload(()=>import("./index-9j2nEnjI.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,ft,mt;const ct=it.chains.find(pt=>pt.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(pt){if(pt.code===4902)try{let yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(ft=st==null?void 0:st.rpcUrls)!=null&&ft.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:gt};return await lt.request({method:"wallet_addEthereumChain",params:[xt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(pt)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(ft=>{if(ft.code===UserRejectedRequestError.code)throw ft;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:pt}=await import("./index-D6MJTicx.js").then(yt=>yt.i);return{default:pt}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),ft=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(ft,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,ft,mt,pt;const lt=st.chains.find(yt=>yt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(ft=lt.blockExplorers)==null?void 0:ft.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((pt=lt.rpcUrls.default)==null?void 0:pt.http[0])??""];const vt={blockExplorerUrls:gt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),lt}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-BnSaZ_jt.js").then(dt=>dt.e);return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-BeN-aFbA.js").then(dt=>dt.i),__vite__mapDeps([5,6,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...ft}={}){var mt,pt;try{const yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.id===Et.chainId)?gt=Et.chainId:gt=(pt=dt.chains[0])==null?void 0:pt.id}if(!gt)throw new Error("No chains found on connector.");const xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in ft?{pairingTopic:ft.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:vt,chainId:bt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(ft){if(!/No matching key/i.test(ft.message))throw ft}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(ft=>getAddress(ft))},async getProvider({chainId:ht}={}){var mt;async function ft(){const pt=dt.chains.map(gt=>gt.id);if(!pt.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-CRyabuk4.js");return{EthereumProvider:gt}},__vite__mapDeps([7,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:pt,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=ft()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,ft]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&ft.session?(await ft.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:ft}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const pt=dt.chains.find(vt=>vt.id===ft);if(!pt)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===ft&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ft)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,ft]),pt}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(yt=pt.blockExplorers)!=null&&yt.default.url?[(gt=pt.blockExplorers)==null?void 0:gt.default.url]:[];let wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...pt.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(ft),chainName:(ht==null?void 0:ht.chainName)??pt.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??pt.nativeCurrency,rpcUrls:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const It=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...It,ft]),pt}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(ft=>getAddress(ft))})},onChainChanged(ht){const ft=Number(ht);dt.emitter.emit("change",{chainId:ft})},async onConnect(ht){const ft=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:ft})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const ft=await this.getProvider();ot&&(ft.removeListener("accountsChanged",ot),ot=void 0),it&&(ft.removeListener("chainChanged",it),it=void 0),lt&&(ft.removeListener("disconnect",lt),lt=void 0),ct&&(ft.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),ft.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var ft,mt,pt;return tt?((pt=(mt=(ft=tt.session)==null?void 0:ft.namespaces[rt])==null?void 0:mt.accounts)==null?void 0:pt.map(yt=>Number.parseInt(yt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!et)return!1;const ht=dt.chains.map(pt=>pt.id),ft=this.getNamespaceChainsIds();if(ft.length&&!ft.some(pt=>ht.includes(pt)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(pt=>mt.includes(pt))},async setRequestedChainsIds(ht){var ft;await((ft=dt.storage)==null?void 0:ft.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,ft=tt.length-1;ft>=0;ft--){var mt={};for(var pt in nt)mt[pt]=pt==="access"?{}:nt[pt];for(var pt in nt.access)mt.access[pt]=nt.access[pt];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[ft])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(ft,pt)})},mt&&(rt[ft]=mt(rt[ft])))}function at(ft,mt){try{ct(nt[ft](mt))}catch(pt){ht(ot[0][3],pt)}}function ct(ft){ft.value instanceof __await?Promise.resolve(ft.value.v).then(lt,dt):ht(ot[0][2],ft)}function lt(ft){at("next",ft)}function dt(ft){at("throw",ft)}function ht(ft,mt){ft(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,ft=0;fttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var ft in et){var mt=et[ft];if(isCSSVariable$1(ft)){it[ft]=mt;continue}var pt=numberValueTypes[ft],yt=getValueAsType(mt,pt);if(isTransformProp(ft)){if(lt=!0,st[ft]=yt,at.push(ft),!ht)continue;mt!==((rt=pt.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(ft)?(ct[ft]=yt,dt=!0):ot[ft]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,ft=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,ft,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,pt=o.style,yt=o.dimensions;mt.transform&&(yt&&(pt.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||pt.transform)&&(pt.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,ft=ht?ct:at;if(ft&&typeof ft!="boolean"&&!isAnimationControls(ft)){var mt=Array.isArray(ft)?ft:[ft];mt.forEach(function(pt){var yt=resolveVariantFromProps(o,pt);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,ft=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/ft*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,ft=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),pt=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-ft)*mt)/pt}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),ft=zero$1,mt=zero$1;function pt(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);ft=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)ft=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);ft=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return pt(),{next:yt=>{const gt=ft(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],pt()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:ft,onUpdate:mt}=o,pt=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=pt,gt,xt=0,vt=pt.duration,bt,Et=!1,wt=!0,kt;const It=detectAnimationFromOptions(pt);!((tt=(et=It).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=It(Object.assign(Object.assign({},pt),{from:nt,to:yt}));function $t(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,ft&&ft()}function Nt(){gt.stop(),ht&&ht()}function Mt(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:ft}){let mt;function pt(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:ft}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(pt(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const It=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};function lt(){var pt;(pt=at.current)===null||pt===void 0||pt.call(at),at.current=null}function dt(){var pt;return lt(),st.current=!1,(pt=ot.animationState)===null||pt===void 0||pt.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(pt,yt){dt()&&(isNodeOrChild(ot.getInstance(),pt.target)?et==null||et(pt,yt):nt==null||nt(pt,yt))}function ft(pt,yt){dt()&&(nt==null||nt(pt,yt))}function mt(pt,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",ft,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(pt,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,ft=dt.isIntersecting;if(et.isInView!==ft&&(et.isInView=ft,!(at&&!ft&&et.hasEnteredView))){ft&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,ft);var mt=tt.getProps(),pt=ft?mt.onViewportEnter:mt.onViewportLeave;pt==null||pt(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&Nt,Yt=Array.isArray($t)?$t:[$t],Ht=Yt.reduce(ot,{});Mt===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Pt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Pt){var Lt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Lt!==Gt?isKeyframesTarget(Lt)&&isKeyframesTarget(Gt)?!shallowCompare(Lt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Lt!==void 0?Zt(Qt):yt.add(Qt):Lt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=$t,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&pt.push.apply(pt,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:It},lt)}})),!1))},bt=0;bt=3;if(!(!ft&&!mt)){var pt=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},pt),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;ft||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,ft){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(ft,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,ft);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,ft){rt.end();var mt=rt.handlers,pt=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(ft,rt.transformPagePoint),rt.history);rt.startEvent&&pt&&pt(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],ft=dt[1];o.getValue(ht).set(ft)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(pt){return it.push(pt),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var ft=at(st);if(ot){var mt=0;ft=ft.replace(varToken,function(){var pt=it[mt];return mt++,pt})}return ft}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var ft=__values(st.values()),mt=ft.next();!mt.done;mt=ft.next()){var pt=mt.value;if(!pt)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=ft.return)&&ht.call(ft)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),ft=onlyElements(et),mt=ft,pt=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(ft,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),pt.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(It){return reactExports.createElement(PresenceChild,{key:getChildKey(It),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},It)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=ft.map(getChildKey),Et=vt.length,wt=0;wt1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,pt.size?mt:mt.map(function(It){return reactExports.cloneElement(It)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** + */var h$3=reactExports,n$2=shimExports;function p$2(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(o,et,tt,nt,rt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(ft){if(!ct){if(ct=!0,lt=ft,ft=nt(ft),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,ft))return dt=mt}return dt=ft}if(mt=dt,q$3(lt,ft))return mt;var pt=nt(ft);return rt!==void 0&&rt(mt,pt)?mt:(lt=ft,dt=pt)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,Or,zs,FocusManager=(zs=class extends Subscribable{constructor(){super();pn(this,Sr);pn(this,lr);pn(this,Or);un(this,Or,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){jt(this,lr)||this.setEventListener(jt(this,Or))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,Or,et),(tt=jt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){jt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof jt(this,Sr)=="boolean"?jt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,Or=new WeakMap,zs),focusManager=new FocusManager,Mr,ur,jr,Vs,OnlineManager=(Vs=class extends Subscribable{constructor(){super();pn(this,Mr,!0);pn(this,ur);pn(this,jr);un(this,jr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){jt(this,ur)||this.setEventListener(jt(this,jr))}onUnsubscribe(){var et;this.hasListeners()||((et=jt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,jr,et),(tt=jt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){jt(this,Mr)!==et&&(un(this,Mr,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return jt(this,Mr)}},Mr=new WeakMap,ur=new WeakMap,jr=new WeakMap,Vs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=pt=>{var yt;nt||(ht(new CancelledError(pt)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=pt=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,pt),rt==null||rt(),ot.resolve(pt))},ht=pt=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,pt),rt==null||rt(),ot.reject(pt))},ft=()=>new Promise(pt=>{var yt;rt=gt=>{(nt||ct())&&pt(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var pt;rt=void 0,nt||(pt=o.onContinue)==null||pt.call(o)}),mt=()=>{if(nt)return;let pt;const yt=tt===0?o.initialPromise:void 0;try{pt=yt??o.fn()}catch(gt){pt=Promise.reject(gt)}Promise.resolve(pt).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:ft()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():ft().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Hs,Removable=(Hs=class{constructor(){pn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){jt(this,kr)&&(clearTimeout(jt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Hs),Br,Dr,Un,Nn,no,Ar,Hn,tr,Ws,Query=(Ws=class extends Removable{constructor(et){super();pn(this,Hn);pn(this,Br);pn(this,Dr);pn(this,Un);pn(this,Nn);pn(this,no);pn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??jt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=jt(this,Nn))==null?void 0:et.promise}setOptions(et){this.options={...jt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&jt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=jt(this,Nn))==null?void 0:nt.promise;return(rt=jt(this,Nn))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(jt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=jt(this,Nn))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),jt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(jt(this,Nn)&&(jt(this,Ar)?jt(this,Nn).cancel({revert:!0}):jt(this,Nn).cancelRetry()),this.scheduleGc()),jt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(jt(this,Nn))return jt(this,Nn).continueRetry(),jt(this,Nn).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,ft,mt,pt;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((ft=(ht=jt(this,Un).config).onError)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,Nn,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,ft,mt,pt;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(ft=(ht=jt(this,Un).config).onSuccess)==null||ft.call(ht,dt,this),(pt=(mt=jt(this,Un).config).onSettled)==null||pt.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),jt(this,Nn).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,Nn=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&jt(this,Dr)?{...jt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),jt(this,Un).notify({query:this,type:"updated",action:et})})},Ws);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Gs,QueryCache=(Gs=class extends Subscribable{constructor(et={}){super();pn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){jt(this,Wn).has(et.queryHash)||(jt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=jt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&jt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return jt(this,Wn).get(et)}getAll(){return[...jt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Gs),Gn,On,Rr,qn,ar,qs,Mutation=(qs=class extends Removable{constructor(et){super();pn(this,qn);pn(this,Gn);pn(this,On);pn(this,Rr);this.mutationId=et.mutationId,un(this,On,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){jt(this,Gn).includes(et)||(jt(this,Gn).push(et),this.clearGcTimeout(),jt(this,On).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,jt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),jt(this,On).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){jt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():jt(this,On).remove(this))}continue(){var et;return((et=jt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,ft,mt,pt,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(It,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:It,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>jt(this,On).canRun(this)}));const tt=this.state.status==="pending",nt=!jt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=jt(this,On).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const It=await jt(this,Rr).start();return await((ct=(at=jt(this,On).config).onSuccess)==null?void 0:ct.call(at,It,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,It,et,this.state.context)),await((ft=(ht=jt(this,On).config).onSettled)==null?void 0:ft.call(ht,It,null,this.state.variables,this.state.context,this)),await((pt=(mt=this.options).onSettled)==null?void 0:pt.call(mt,It,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:It}),It}catch(It){try{throw await((gt=(yt=jt(this,On).config).onError)==null?void 0:gt.call(yt,It,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,It,et,this.state.context)),await((Et=(bt=jt(this,On).config).onSettled)==null?void 0:Et.call(bt,void 0,It,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,It,et,this.state.context)),It}finally{gn(this,qn,ar).call(this,{type:"error",error:It})}}finally{jt(this,On).runNext(this)}}},Gn=new WeakMap,On=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{jt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),jt(this,On).notify({mutation:this,type:"updated",action:et})})},qs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fn,ro,Ks,MutationCache=(Ks=class extends Subscribable{constructor(et={}){super();pn(this,Fn);pn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=jt(this,Fn).get(tt)??[];nt.push(et),jt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(jt(this,Fn).has(tt)){const rt=(nt=jt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?jt(this,Fn).delete(tt):jt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=jt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...jt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ks);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,ft,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((ft=et.state.data)==null?void 0:ft.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let pt=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?pt=!0:et.signal.addEventListener("abort",()=>{pt=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(pt)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:It}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,It),pageParams:Rt(vt.pageParams,bt,It)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var pt,yt;return(yt=(pt=et.options).persister)==null?void 0:yt.call(pt,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Ln,dr,hr,Fr,Ur,fr,zr,Vr,Qs,QueryClient=(Qs=class{constructor(o={}){pn(this,Ln);pn(this,dr);pn(this,hr);pn(this,Fr);pn(this,Ur);pn(this,fr);pn(this,zr);pn(this,Vr);un(this,Ln,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,fr,0)}mount(){br(this,fr)._++,jt(this,fr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),jt(this,Ln).onOnline())})))}unmount(){var o,et;br(this,fr)._--,jt(this,fr)===0&&((o=jt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=jt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return jt(this,Ln).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return jt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=jt(this,Ln).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return jt(this,Ln).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=jt(this,Ln).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return jt(this,Ln).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>jt(this,Ln).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=jt(this,Ln).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=jt(this,Ln);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=jt(this,Ln),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(jt(this,Ln).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>jt(this,Ln).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=jt(this,Ln).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?jt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return jt(this,Ln)}getMutationCache(){return jt(this,dr)}getDefaultOptions(){return jt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){jt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...jt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){jt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...jt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...jt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...jt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){jt(this,Ln).clear(),jt(this,dr).clear()}},Ln=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,fr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Qs),jn,Sn,oo,Mn,Tr,Hr,pr,Kn,io,Wr,Gr,Ir,_r,mr,qr,In,to,Ts,Is,_s,$s,Ps,Ls,Ns,Xl,Ys,QueryObserver=(Ys=class extends Subscribable{constructor(et,tt){super();pn(this,In);pn(this,jn);pn(this,Sn);pn(this,oo);pn(this,Mn);pn(this,Tr);pn(this,Hr);pn(this,pr);pn(this,Kn);pn(this,io);pn(this,Wr);pn(this,Gr);pn(this,Ir);pn(this,_r);pn(this,mr);pn(this,qr,new Set);this.options=tt,un(this,jn,et),un(this,Kn,null),un(this,pr,pendingThenable()),this.options.experimental_prefetchInRender||jt(this,pr).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(jt(this,Sn).addObserver(this),shouldFetchOnMount(jt(this,Sn),this.options)?gn(this,In,to).call(this):this.updateResult(),gn(this,In,$s).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(jt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,In,Ps).call(this),gn(this,In,Ls).call(this),jt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=jt(this,Sn);if(this.options=jt(this,jn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,jt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,In,Ns).call(this),jt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&jt(this,jn).getQueryCache().notify({type:"observerOptionsUpdated",query:jt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(jt(this,Sn),rt,this.options,nt)&&gn(this,In,to).call(this),this.updateResult(tt),ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||resolveStaleTime(this.options.staleTime,jt(this,Sn))!==resolveStaleTime(nt.staleTime,jt(this,Sn)))&&gn(this,In,Ts).call(this);const it=gn(this,In,Is).call(this);ot&&(jt(this,Sn)!==rt||resolveEnabled(this.options.enabled,jt(this,Sn))!==resolveEnabled(nt.enabled,jt(this,Sn))||it!==jt(this,mr))&&gn(this,In,_s).call(this,it)}getOptimisticResult(et){const tt=jt(this,jn).getQueryCache().build(jt(this,jn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,Mn,nt),un(this,Hr,this.options),un(this,Tr,jt(this,Sn).state)),nt}getCurrentResult(){return jt(this,Mn)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){jt(this,qr).add(et)}getCurrentQuery(){return jt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=jt(this,jn).defaultQueryOptions(et),nt=jt(this,jn).getQueryCache().build(jt(this,jn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,In,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),jt(this,Mn)))}createResult(et,tt){var It;const nt=jt(this,Sn),rt=this.options,ot=jt(this,Mn),it=jt(this,Tr),st=jt(this,Hr),ct=et!==nt?et.state:jt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,ft;if(tt._optimisticResults){const Rt=this.hasListeners(),$t=!Rt&&shouldFetchOnMount(et,tt),Nt=Rt&&shouldFetchOptionally(et,nt,tt,rt);($t||Nt)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:pt,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===jt(this,io))ft=jt(this,Wr);else try{un(this,io,tt.select),ft=tt.select(dt.data),ft=replaceData(ot==null?void 0:ot.data,ft,tt),un(this,Wr,ft),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else ft=dt.data;if(tt.placeholderData!==void 0&&ft===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((It=jt(this,Gr))==null?void 0:It.state.data,jt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch($t){un(this,Kn,$t)}Rt!==void 0&&(yt="success",ft=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}jt(this,Kn)&&(mt=jt(this,Kn),ft=jt(this,Wr),pt=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=ft!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:ft,dataUpdatedAt:dt.dataUpdatedAt,error:mt,errorUpdatedAt:pt,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:gt,isRefetching:gt&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:jt(this,pr)};if(this.options.experimental_prefetchInRender){const Rt=Mt=>{kt.status==="error"?Mt.reject(kt.error):kt.data!==void 0&&Mt.resolve(kt.data)},$t=()=>{const Mt=un(this,pr,kt.promise=pendingThenable());Rt(Mt)},Nt=jt(this,pr);switch(Nt.status){case"pending":et.queryHash===nt.queryHash&&Rt(Nt);break;case"fulfilled":(kt.status==="error"||kt.data!==Nt.value)&&$t();break;case"rejected":(kt.status!=="error"||kt.error!==Nt.reason)&&$t();break}}return kt}updateResult(et){const tt=jt(this,Mn),nt=this.createResult(jt(this,Sn),this.options);if(un(this,Tr,jt(this,Sn).state),un(this,Hr,this.options),jt(this,Tr).data!==void 0&&un(this,Gr,jt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,Mn,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!jt(this,qr).size)return!0;const at=new Set(st??jt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(jt(this,Mn)).some(ct=>{const lt=ct;return jt(this,Mn)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,In,Xl).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,In,$s).call(this)}},jn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,Mn=new WeakMap,Tr=new WeakMap,Hr=new WeakMap,pr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ir=new WeakMap,_r=new WeakMap,mr=new WeakMap,qr=new WeakMap,In=new WeakSet,to=function(et){gn(this,In,Ns).call(this);let tt=jt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Ts=function(){gn(this,In,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,jt(this,Sn));if(isServer||jt(this,Mn).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(jt(this,Mn).dataUpdatedAt,et)+1;un(this,Ir,setTimeout(()=>{jt(this,Mn).isStale||this.updateResult()},nt))},Is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(jt(this,Sn)):this.options.refetchInterval)??!1},_s=function(et){gn(this,In,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,jt(this,Sn))===!1||!isValidTimeout(jt(this,mr))||jt(this,mr)===0)&&un(this,_r,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,In,to).call(this)},jt(this,mr)))},$s=function(){gn(this,In,Ts).call(this),gn(this,In,_s).call(this,gn(this,In,Is).call(this))},Ps=function(){jt(this,Ir)&&(clearTimeout(jt(this,Ir)),un(this,Ir,void 0))},Ls=function(){jt(this,_r)&&(clearInterval(jt(this,_r)),un(this,_r,void 0))},Ns=function(){const et=jt(this,jn).getQueryCache().build(jt(this,jn),this.options);if(et===jt(this,Sn))return;const tt=jt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Xl=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(jt(this,Mn))}),jt(this,jn).getQueryCache().notify({query:jt(this,Sn),type:"observerResultsUpdated"})})},Ys);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,Os,Zs,MutationObserver$1=(Zs=class extends Subscribable{constructor(tt,nt){super();pn(this,sr);pn(this,gr);pn(this,yr);pn(this,Bn);pn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=jt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||jt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:jt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=jt(this,Bn))==null?void 0:rt.state.status)==="pending"&&jt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=jt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this,tt)}getCurrentResult(){return jt(this,yr)}reset(){var tt;(tt=jt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,Os).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=jt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,jt(this,gr).getMutationCache().build(jt(this,gr),this.options)),jt(this,Bn).addObserver(this),jt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=jt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(tt){notifyManager.batch(()=>{var nt,rt,ot,it,st,at,ct,lt;if(jt(this,rr)&&this.hasListeners()){const dt=jt(this,yr).variables,ht=jt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=jt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=jt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=jt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=jt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(jt(this,yr))})})},Zs);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:ft,retryDelay:mt,structuralSharing:pt,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:It,refetchOnMount:Rt,refetchOnReconnect:$t,refetchOnWindowFocus:Nt,retryOnMount:Mt,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Pt}=o;return Pt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,ft,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(pt=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),yt},[at,rt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((ft=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||ft.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const pt=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;pt==null||pt.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),sourceId=1,optimism=defineChain({...chainConfig,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const at=await __vitePreload(()=>import("./index-DyOq0GRj.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,ft,mt;const ct=it.chains.find(pt=>pt.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(pt){if(pt.code===4902)try{let yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(ft=st==null?void 0:st.rpcUrls)!=null&&ft.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:gt};return await lt.request({method:"wallet_addEthereumChain",params:[xt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(pt)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(ft=>{if(ft.code===UserRejectedRequestError.code)throw ft;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:pt}=await import("./index-DQD5FJy6.js").then(yt=>yt.i);return{default:pt}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),ft=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(ft,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,ft,mt,pt;const lt=st.chains.find(yt=>yt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(ft=lt.blockExplorers)==null?void 0:ft.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((pt=lt.rpcUrls.default)==null?void 0:pt.http[0])??""];const vt={blockExplorerUrls:gt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),lt}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-DTOI1f4O.js").then(dt=>dt.e);return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-IqLj3ThH.js").then(dt=>dt.i),__vite__mapDeps([5,6,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...ft}={}){var mt,pt;try{const yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.id===Et.chainId)?gt=Et.chainId:gt=(pt=dt.chains[0])==null?void 0:pt.id}if(!gt)throw new Error("No chains found on connector.");const xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in ft?{pairingTopic:ft.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:vt,chainId:bt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(ft){if(!/No matching key/i.test(ft.message))throw ft}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(ft=>getAddress(ft))},async getProvider({chainId:ht}={}){var mt;async function ft(){const pt=dt.chains.map(gt=>gt.id);if(!pt.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-1pglYqns.js");return{EthereumProvider:gt}},__vite__mapDeps([7,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:pt,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=ft()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,ft]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&ft.session?(await ft.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:ft}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const pt=dt.chains.find(vt=>vt.id===ft);if(!pt)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===ft&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ft)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,ft]),pt}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(yt=pt.blockExplorers)!=null&&yt.default.url?[(gt=pt.blockExplorers)==null?void 0:gt.default.url]:[];let wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...pt.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(ft),chainName:(ht==null?void 0:ht.chainName)??pt.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??pt.nativeCurrency,rpcUrls:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const It=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...It,ft]),pt}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(ft=>getAddress(ft))})},onChainChanged(ht){const ft=Number(ht);dt.emitter.emit("change",{chainId:ft})},async onConnect(ht){const ft=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:ft})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const ft=await this.getProvider();ot&&(ft.removeListener("accountsChanged",ot),ot=void 0),it&&(ft.removeListener("chainChanged",it),it=void 0),lt&&(ft.removeListener("disconnect",lt),lt=void 0),ct&&(ft.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),ft.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var ft,mt,pt;return tt?((pt=(mt=(ft=tt.session)==null?void 0:ft.namespaces[rt])==null?void 0:mt.accounts)==null?void 0:pt.map(yt=>Number.parseInt(yt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!et)return!1;const ht=dt.chains.map(pt=>pt.id),ft=this.getNamespaceChainsIds();if(ft.length&&!ft.some(pt=>ht.includes(pt)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(pt=>mt.includes(pt))},async setRequestedChainsIds(ht){var ft;await((ft=dt.storage)==null?void 0:ft.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,ft=tt.length-1;ft>=0;ft--){var mt={};for(var pt in nt)mt[pt]=pt==="access"?{}:nt[pt];for(var pt in nt.access)mt.access[pt]=nt.access[pt];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[ft])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(ft,pt)})},mt&&(rt[ft]=mt(rt[ft])))}function at(ft,mt){try{ct(nt[ft](mt))}catch(pt){ht(ot[0][3],pt)}}function ct(ft){ft.value instanceof __await?Promise.resolve(ft.value.v).then(lt,dt):ht(ot[0][2],ft)}function lt(ft){at("next",ft)}function dt(ft){at("throw",ft)}function ht(ft,mt){ft(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,ft=0;fttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var ft in et){var mt=et[ft];if(isCSSVariable$1(ft)){it[ft]=mt;continue}var pt=numberValueTypes[ft],yt=getValueAsType(mt,pt);if(isTransformProp(ft)){if(lt=!0,st[ft]=yt,at.push(ft),!ht)continue;mt!==((rt=pt.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(ft)?(ct[ft]=yt,dt=!0):ot[ft]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,ft=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,ft,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,pt=o.style,yt=o.dimensions;mt.transform&&(yt&&(pt.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||pt.transform)&&(pt.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,ft=ht?ct:at;if(ft&&typeof ft!="boolean"&&!isAnimationControls(ft)){var mt=Array.isArray(ft)?ft:[ft];mt.forEach(function(pt){var yt=resolveVariantFromProps(o,pt);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,ft=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/ft*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,ft=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),pt=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-ft)*mt)/pt}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),ft=zero$1,mt=zero$1;function pt(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);ft=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)ft=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);ft=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return pt(),{next:yt=>{const gt=ft(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],pt()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:ft,onUpdate:mt}=o,pt=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=pt,gt,xt=0,vt=pt.duration,bt,Et=!1,wt=!0,kt;const It=detectAnimationFromOptions(pt);!((tt=(et=It).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=It(Object.assign(Object.assign({},pt),{from:nt,to:yt}));function $t(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,ft&&ft()}function Nt(){gt.stop(),ht&&ht()}function Mt(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:ft}){let mt;function pt(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:ft}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(pt(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const It=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};function lt(){var pt;(pt=at.current)===null||pt===void 0||pt.call(at),at.current=null}function dt(){var pt;return lt(),st.current=!1,(pt=ot.animationState)===null||pt===void 0||pt.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(pt,yt){dt()&&(isNodeOrChild(ot.getInstance(),pt.target)?et==null||et(pt,yt):nt==null||nt(pt,yt))}function ft(pt,yt){dt()&&(nt==null||nt(pt,yt))}function mt(pt,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",ft,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(pt,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,ft=dt.isIntersecting;if(et.isInView!==ft&&(et.isInView=ft,!(at&&!ft&&et.hasEnteredView))){ft&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,ft);var mt=tt.getProps(),pt=ft?mt.onViewportEnter:mt.onViewportLeave;pt==null||pt(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&Nt,Yt=Array.isArray($t)?$t:[$t],Ht=Yt.reduce(ot,{});Mt===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Pt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Pt){var Lt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Lt!==Gt?isKeyframesTarget(Lt)&&isKeyframesTarget(Gt)?!shallowCompare(Lt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Lt!==void 0?Zt(Qt):yt.add(Qt):Lt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=$t,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&pt.push.apply(pt,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:It},lt)}})),!1))},bt=0;bt=3;if(!(!ft&&!mt)){var pt=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},pt),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;ft||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,ft){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(ft,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,ft);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,ft){rt.end();var mt=rt.handlers,pt=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(ft,rt.transformPagePoint),rt.history);rt.startEvent&&pt&&pt(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],ft=dt[1];o.getValue(ht).set(ft)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(pt){return it.push(pt),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var ft=at(st);if(ot){var mt=0;ft=ft.replace(varToken,function(){var pt=it[mt];return mt++,pt})}return ft}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var ft=__values(st.values()),mt=ft.next();!mt.done;mt=ft.next()){var pt=mt.value;if(!pt)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=ft.return)&&ht.call(ft)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),ft=onlyElements(et),mt=ft,pt=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(ft,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),pt.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(It){return reactExports.createElement(PresenceChild,{key:getChildKey(It),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},It)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=ft.map(getChildKey),Et=vt.length,wt=0;wt1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,pt.size?mt:mt.map(function(It){return reactExports.cloneElement(It)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** * @license React * react-is.production.min.js * @@ -4154,7 +4154,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${et.d `;)Et++;return Et}function pt(){if(st.length>0)return st.shift();if(at)return lt();var bt,Et,wt,kt,It,Rt=tt===0;do{if(tt===nt)return null;for(bt=!1;whitespaceRe.test(wt=dt(tt));)if(wt===` `&&(Rt=!0,++rt),++tt===nt)return null;if(dt(tt)==="/"){if(++tt===nt)throw ct("comment");if(dt(tt)==="/")if(et){if(kt=tt,It=!1,ft(tt-1)){It=!0;do if(tt=mt(tt),tt===nt||(tt++,!Rt))break;while(ft(tt))}else tt=Math.min(nt,mt(tt)+1);It&&(ht(kt,tt,Rt),Rt=!0),rt++,bt=!0}else{for(It=dt(kt=tt+1)==="/";dt(++tt)!==` `;)if(tt===nt)return null;++tt,It&&(ht(kt,tt-1,Rt),Rt=!0),++rt,bt=!0}else if((wt=dt(tt))==="*"){kt=tt+1,It=et||dt(kt)==="*";do{if(wt===` -`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,It&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var $t=tt;delimRe.lastIndex=0;var Nt=delimRe.test(dt($t++));if(!Nt)for(;$t");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,Tt);Mt(Vt,function(an){if(an==="option")Pt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new OneOf(gt(tn));Mt(Tt,function(Vt){Vt==="option"?(Pt(Tt,Vt),at(";")):(it(Vt),zt(Tt,"optional"))}),Jt.add(Tt)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new Enum(tn);Mt(Tt,function(Vt){switch(Vt){case"option":Pt(Tt,Vt),at(";");break;case"reserved":Et(Tt.reserved||(Tt.reserved=[]),!0);break;default:qt(Tt,Vt)}}),Jt.add(Tt)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var Tt=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Mt(Dt,function(en){if(en==="option")Pt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,Tt,Dt.comment,Dt.options)}function Pt(Jt,tn){var Tt=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;Tt&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Lt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var Tt={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=Tt[Vt];an&&(Dt=[].concat(an).concat(Dt)),Tt[Vt]=Dt,at(",",!0),at(";",!0)}return Tt}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,Tt){Jt.setOption&&Jt.setOption(tn,Tt)}function Lt(Jt,tn,Tt,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,Tt,Dt)}function Gt(Jt){if(at("[",!0)){do Pt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var Tt=new Service(tn);Mt(Tt,function(Vt){if(!Nt(Tt,Vt))if(Vt==="rpc")Wt(Tt,Vt);else throw xt(Vt)}),Jt.add(Tt)}function Wt(Jt,tn){var Tt=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var fn=new Method(Vt,Dt,en,dn,an,ln);fn.comment=Tt,Mt(fn,function(mn){if(mn==="option")Pt(fn,mn),at(";");else throw xt(mn)}),Jt.add(fn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var Tt=tn;Mt(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,Tt);break;case"optional":pt?zt(Jt,"proto3_optional",Tt):zt(Jt,"optional",Tt);break;default:if(!pt||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",Tt);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);It();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);$t();break;case"option":Pt(yt,Xt),at(";");break;default:if(Nt(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:ft,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function o(et){return common[et]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs);var TelemetryType=(o=>(o.LIGHT_PUSH_FILTER="LightPushFilter",o))(TelemetryType||{});class TelemetryClient{constructor(et,tt=5e3){Ct(this,"queue",[]);Ct(this,"intervalId",null);Ct(this,"requestId",0);this.url=et,this.intervalPeriod=tt,this.start()}push(et){this.queue.push(...et)}async start(){this.intervalId||(this.intervalId=setInterval(async()=>{this.queue.length>0&&await this.send(this.queue)&&(console.log("Sent ",this.queue.length," telemetry logs"),this.queue=[])},this.intervalPeriod))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}async send(et){const tt=localStorage.getItem("telemetryOptIn");if(!tt||tt==="false"||tt!=="true"||!window.location.hostname.includes("buddybook.fun"))return;const nt=et.map(rt=>({id:++this.requestId,telemetryType:rt.type.toString(),telemetryData:rt}));try{const rt=await fetch(this.url,{method:"POST",body:JSON.stringify(nt)});return rt.status!==201?(console.log("DEBUG: Error sending messages to telemetry service: ",rt.status,rt.statusText,rt.json),!1):!0}catch(rt){return console.log("DEBUG: Error sending messages to telemetry service",rt),!1}}}const Telemetry=new TelemetryClient("https://telemetry.status.im/waku-metrics",5e3),buildExtraData=({wallet:o,bookId:et,timeTaken:tt})=>JSON.stringify({sdk:"@waku/react:0.0.7-9a7287d",wallet:o,bookId:et,timeTaken:tt}),fromLightPush=o=>{var tt,nt,rt,ot;const et=[];return(nt=(tt=o.result)==null?void 0:tt.successes)==null||nt.forEach(it=>{et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:it.toString(),contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({bookId:o.bookId,wallet:o.wallet})})}),(ot=(rt=o.result)==null?void 0:rt.failures)==null||ot.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"missing",contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:o.encoder.ephemeral,messageHash:v4(),errorMessage:it.error.toString(),extraData:buildExtraData({wallet:o.wallet,bookId:o.bookId})})}),et},fromFilter=o=>{var rt,ot;const et=[],{error:tt,results:nt}=o.result;return tt&&et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:tt,extraData:buildExtraData({})}),(rt=nt==null?void 0:nt.failures)==null||rt.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"",contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:(it==null?void 0:it.error)||"Unknown error",extraData:buildExtraData({})})}),(ot=nt==null?void 0:nt.successes)==null||ot.forEach(it=>{et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:it.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({})})}),et},fromStore=o=>[{type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({timeTaken:o.timeTaken})}];function toInt$1(o){return parseInt(o)}const WAKU_NODE_OPTIONS={defaultBootstrap:!0,nodeToUse:{store:"/dns4/node-01.ac-cn-hongkong-c.waku.test.status.im/tcp/8000/wss/p2p/16Uiu2HAkzHaTP5JsUwfR9NR8Rj9HC24puS6ocaU8wze4QrXr9iXp"}},contentTopic="/buddybook-devcon/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){const et=Math.ceil(Date.now()/1e3);try{for await(const rt of o.store.queryGenerator([decoder])){const ot=await Promise.all(rt);for(const it of ot){if(console.log(it),!(it!=null&&it.payload))continue;const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),yield st}}const nt=Math.ceil(Date.now()/1e3)-et;console.log("getMessagesFromStore",nt),Telemetry.push(fromStore({node:o,decoder,timestamp:et,timeTaken:nt}))}catch(tt){const rt=Math.ceil(Date.now()/1e3)-et;throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:et,createdAt:et,seenTimestamp:et,peerId:o.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(tt==null?void 0:tt.message)??"Error during Store",extraData:buildExtraData({timeTaken:rt})}]),tt}}async function subscribeToFilter(o,et){const tt=await o.filter.subscribe([decoder],it=>{if(console.log("message received from filter",it),it.payload){const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),et(st)}},{forceUseAllPeers:!1});Telemetry.push(fromFilter({result:tt,node:o,decoder,timestamp:Math.ceil(Date.now()/1e3)}));const{error:nt,subscription:rt,results:ot}=tt;if(console.log("results",ot),nt&&console.log("Error subscribing to filter",nt),!rt||nt||ot.successes.length===0||ot.failures.length>0)throw new Error("Failed to subscribe to filter")}function calculateTotalSignatures(o,et){const tt=et.filter(nt=>nt.parentBlockUUID===o.blockUUID);return o.signatures.length+tt.reduce((nt,rt)=>nt+calculateTotalSignatures(rt,et),0)}function sortBlocksBySignatures(o,et){return[...o].sort((tt,nt)=>{const rt=calculateTotalSignatures(tt,et);return calculateTotalSignatures(nt,et)-rt})}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];if(rt)return/iPad|iPhone|iPod/.test(navigator.userAgent)&&(window.location.href="metamask:///",await new Promise(it=>setTimeout(it,1e3))),await et({connector:rt}),await new Promise(it=>setTimeout(it,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),typeof window.ethereum>"u"&&window.open("https://metamask.io/download/","_blank"),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,ft]=reactExports.useState(null),[mt,pt]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;ft(Rt);const $t=v4();pt($t);const Nt=Date.now(),Mt=createMessage({chainUUID:o.uuid,blockUUID:$t,title:o.title,description:o.description,signedMessage:Rt,timestamp:Nt,signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});try{const Bt=await(yt==null?void 0:yt.lightPush.send(encoder,Mt));Telemetry.push(fromLightPush({result:Bt,wallet:gt,bookId:o.uuid,node:yt,encoder,timestamp:Nt}))}catch(Bt){throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:toInt$1(Nt),createdAt:toInt$1(Nt),seenTimestamp:toInt$1(Nt),peerId:yt.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(Bt==null?void 0:Bt.message)??"Error during LightPush",extraData:buildExtraData({wallet:gt,bookId:o.uuid})}]),Bt}ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:$t,value:Nt}=Rt.target;et(Mt=>({...Mt,[$t]:Nt})),tt[$t]&&nt(Mt=>({...Mt,[$t]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Book: +`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,It&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var $t=tt;delimRe.lastIndex=0;var Nt=delimRe.test(dt($t++));if(!Nt)for(;$t");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,Tt);Mt(Vt,function(an){if(an==="option")Pt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new OneOf(gt(tn));Mt(Tt,function(Vt){Vt==="option"?(Pt(Tt,Vt),at(";")):(it(Vt),zt(Tt,"optional"))}),Jt.add(Tt)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Tt=new Enum(tn);Mt(Tt,function(Vt){switch(Vt){case"option":Pt(Tt,Vt),at(";");break;case"reserved":Et(Tt.reserved||(Tt.reserved=[]),!0);break;default:qt(Tt,Vt)}}),Jt.add(Tt)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var Tt=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Mt(Dt,function(en){if(en==="option")Pt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,Tt,Dt.comment,Dt.options)}function Pt(Jt,tn){var Tt=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;Tt&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Lt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var Tt={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=Tt[Vt];an&&(Dt=[].concat(an).concat(Dt)),Tt[Vt]=Dt,at(",",!0),at(";",!0)}return Tt}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,Tt){Jt.setOption&&Jt.setOption(tn,Tt)}function Lt(Jt,tn,Tt,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,Tt,Dt)}function Gt(Jt){if(at("[",!0)){do Pt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var Tt=new Service(tn);Mt(Tt,function(Vt){if(!Nt(Tt,Vt))if(Vt==="rpc")Wt(Tt,Vt);else throw xt(Vt)}),Jt.add(Tt)}function Wt(Jt,tn){var Tt=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var fn=new Method(Vt,Dt,en,dn,an,ln);fn.comment=Tt,Mt(fn,function(mn){if(mn==="option")Pt(fn,mn),at(";");else throw xt(mn)}),Jt.add(fn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var Tt=tn;Mt(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,Tt);break;case"optional":pt?zt(Jt,"proto3_optional",Tt):zt(Jt,"optional",Tt);break;default:if(!pt||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",Tt);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);It();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);$t();break;case"option":Pt(yt,Xt),at(";");break;default:if(Nt(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:ft,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function o(et){return common[et]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs);var TelemetryType=(o=>(o.LIGHT_PUSH_FILTER="LightPushFilter",o))(TelemetryType||{});class TelemetryClient{constructor(et,tt=5e3){Ct(this,"queue",[]);Ct(this,"intervalId",null);Ct(this,"requestId",0);this.url=et,this.intervalPeriod=tt,this.start()}push(et){this.queue.push(...et)}async start(){this.intervalId||(this.intervalId=setInterval(async()=>{this.queue.length>0&&await this.send(this.queue)&&(console.log("Sent ",this.queue.length," telemetry logs"),this.queue=[])},this.intervalPeriod))}stop(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}async send(et){const tt=localStorage.getItem("telemetryOptIn");if(!tt||tt==="false"||tt!=="true"||!window.location.hostname.includes("buddybook.fun"))return;const nt=et.map(rt=>({id:++this.requestId,telemetryType:rt.type.toString(),telemetryData:rt}));try{const rt=await fetch(this.url,{method:"POST",body:JSON.stringify(nt)});return rt.status!==201?(console.log("DEBUG: Error sending messages to telemetry service: ",rt.status,rt.statusText,rt.json),!1):!0}catch(rt){return console.log("DEBUG: Error sending messages to telemetry service",rt),!1}}}const Telemetry=new TelemetryClient("https://telemetry.status.im/waku-metrics",5e3),buildExtraData=({wallet:o,bookId:et,timeTaken:tt})=>JSON.stringify({sdk:"@waku/react:0.0.7-9a7287d",wallet:o,bookId:et,timeTaken:tt}),fromLightPush=o=>{var tt,nt,rt,ot;const et=[];return(nt=(tt=o.result)==null?void 0:tt.successes)==null||nt.forEach(it=>{et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:it.toString(),contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({bookId:o.bookId,wallet:o.wallet})})}),(ot=(rt=o.result)==null?void 0:rt.failures)==null||ot.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"lightPush",timestamp:o.timestamp,createdAt:o.timestamp,seenTimestamp:o.timestamp,peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"missing",contentTopic:o.encoder.contentTopic,pubsubTopic:o.encoder.pubsubTopic,ephemeral:o.encoder.ephemeral,messageHash:v4(),errorMessage:it.error.toString(),extraData:buildExtraData({wallet:o.wallet,bookId:o.bookId})})}),et},fromFilter=o=>{var rt,ot;const et=[],{error:tt,results:nt}=o.result;return tt&&et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:tt,extraData:buildExtraData({})}),(rt=nt==null?void 0:nt.failures)==null||rt.forEach(it=>{var st;et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:((st=it==null?void 0:it.peerId)==null?void 0:st.toString())||"",contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:(it==null?void 0:it.error)||"Unknown error",extraData:buildExtraData({})})}),(ot=nt==null?void 0:nt.successes)==null||ot.forEach(it=>{et.push({type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:it.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({})})}),et},fromStore=o=>[{type:"LightPushFilter",protocol:"filter",timestamp:toInt$1(o.timestamp),createdAt:toInt$1(o.timestamp),seenTimestamp:toInt$1(o.timestamp),peerId:o.node.peerId.toString(),contentTopic:o.decoder.contentTopic,pubsubTopic:o.decoder.pubsubTopic,ephemeral:!1,messageHash:v4(),errorMessage:"",extraData:buildExtraData({timeTaken:o.timeTaken})}];function toInt$1(o){return parseInt(o)}const WAKU_NODE_OPTIONS={defaultBootstrap:!0,nodeToUse:{store:"/dns4/node-01.ac-cn-hongkong-c.waku.test.status.im/tcp/8000/wss/p2p/16Uiu2HAkzHaTP5JsUwfR9NR8Rj9HC24puS6ocaU8wze4QrXr9iXp"}},contentTopic="/buddybook-devcon/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){const et=Math.floor(Date.now()/1e3);try{for await(const rt of o.store.queryGenerator([decoder])){const ot=await Promise.all(rt);for(const it of ot){if(console.log(it),!(it!=null&&it.payload))continue;const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),yield st}}const nt=Math.floor(Date.now()/1e3)-et;console.log("getMessagesFromStore",nt),Telemetry.push(fromStore({node:o,decoder,timestamp:et,timeTaken:nt}))}catch(tt){const rt=Math.floor(Date.now()/1e3)-et;throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:et,createdAt:et,seenTimestamp:et,peerId:o.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(tt==null?void 0:tt.message)??"Error during Store",extraData:buildExtraData({timeTaken:rt})}]),tt}}async function subscribeToFilter(o,et){const tt=await o.filter.subscribe([decoder],it=>{if(console.log("message received from filter",it),it.payload){const st=block.decode(it.payload);st.signatures=st.signatures.map(at=>JSON.parse(at)),et(st)}},{forceUseAllPeers:!1});Telemetry.push(fromFilter({result:tt,node:o,decoder,timestamp:Math.floor(Date.now()/1e3)}));const{error:nt,subscription:rt,results:ot}=tt;if(console.log("results",ot),nt&&console.log("Error subscribing to filter",nt),!rt||nt||ot.successes.length===0||ot.failures.length>0)throw new Error("Failed to subscribe to filter")}function calculateTotalSignatures(o,et){const tt=et.filter(nt=>nt.parentBlockUUID===o.blockUUID);return o.signatures.length+tt.reduce((nt,rt)=>nt+calculateTotalSignatures(rt,et),0)}function sortBlocksBySignatures(o,et){return[...o].sort((tt,nt)=>{const rt=calculateTotalSignatures(tt,et);return calculateTotalSignatures(nt,et)-rt})}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];if(rt)return/iPad|iPhone|iPod/.test(navigator.userAgent)&&(window.location.href="metamask:///",await new Promise(it=>setTimeout(it,1e3))),await et({connector:rt}),await new Promise(it=>setTimeout(it,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),typeof window.ethereum>"u"&&window.open("https://metamask.io/download/","_blank"),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,ft]=reactExports.useState(null),[mt,pt]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;ft(Rt);const $t=v4();pt($t);const Nt=Date.now(),Mt=createMessage({chainUUID:o.uuid,blockUUID:$t,title:o.title,description:o.description,signedMessage:Rt,timestamp:Nt,signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});try{const Bt=await(yt==null?void 0:yt.lightPush.send(encoder,Mt));Telemetry.push(fromLightPush({result:Bt,wallet:gt,bookId:o.uuid,node:yt,encoder,timestamp:Nt}))}catch(Bt){throw Telemetry.push([{type:TelemetryType.LIGHT_PUSH_FILTER,protocol:"lightPush",timestamp:toInt$1(Nt),createdAt:toInt$1(Nt),seenTimestamp:toInt$1(Nt),peerId:yt.peerId.toString(),contentTopic:encoder.contentTopic,pubsubTopic:encoder.pubsubTopic,ephemeral:encoder.ephemeral,messageHash:v4(),errorMessage:(Bt==null?void 0:Bt.message)??"Error during LightPush",extraData:buildExtraData({wallet:gt,bookId:o.uuid})}]),Bt}ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:$t,value:Nt}=Rt.target;et(Mt=>({...Mt,[$t]:Nt})),tt[$t]&&nt(Mt=>({...Mt,[$t]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Book: Book UUID: ${o.uuid} Title: ${o.title} Description: ${o.description} diff --git a/buddybook/assets/index-D6MJTicx.js b/buddybook/assets/index-DQD5FJy6.js similarity index 99% rename from buddybook/assets/index-D6MJTicx.js rename to buddybook/assets/index-DQD5FJy6.js index 2f09d41..69ce9a9 100644 --- a/buddybook/assets/index-D6MJTicx.js +++ b/buddybook/assets/index-DQD5FJy6.js @@ -1,4 +1,4 @@ -import{E as xo,j as Q,g as Zr,q as ii,r as su,u as ou,a as au}from"./index-CBcRH9LY.js";import{r as Ws,i as vt}from"./inherits_browser-BKdA78FI.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-DT22ZwC4.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,u)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new X(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.standardErrorCodes={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}};Nt.errorValues={"-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."}};var li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default='@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}';var Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r +import{E as xo,j as Q,g as Zr,q as ii,r as su,u as ou,a as au}from"./index-D-Yr2Iya.js";import{r as Ws,i as vt}from"./inherits_browser-CgLO5vwk.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-2fANA2U5.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,u)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new X(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.standardErrorCodes={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}};Nt.errorValues={"-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."}};var li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default='@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}';var Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r `:"",a=t.width,l=t.height,d=r.length,h=a/(d+2*t.padding),m=l/(d+2*t.padding),R=typeof t.join<"u"?!!t.join:!1,y=typeof t.swap<"u"?!!t.swap:!1,C=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,x=typeof t.predefined<"u"?!!t.predefined:!1,B=x?i+''+s:"",O=i+''+s,M="",T="",N=0;N'+s:M+=i+''+s}}R&&(M=i+'');let X="";if(this.options.image!==void 0&&this.options.image.svg){const S=a*this.options.image.width/100,o=l*this.options.image.height/100,u=a/2-S/2,f=l/2-o/2;X+=``,X+=this.options.image.svg+s,X+=""}var ne="";switch(e.container){case"svg":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"svg-viewbox":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"g":ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;default:ne+=(B+O+M+X).replace(/^\s+/,"");break}return ne};var Zh=Tc,Kh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ki,"__esModule",{value:!0});ki.QRCode=void 0;const Qh=tt,qo=Ei,Yh=Kh(Zh),Xh=e=>{const[t,r]=(0,qo.useState)("");return(0,qo.useEffect)(()=>{var n,i;const s=new Yh.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(n=e.width)!==null&&n!==void 0?n:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),a=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${a}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Qh.h)("img",{src:t,alt:"QR Code"}):null};ki.QRCode=Xh;var Ci={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var ed=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.Spinner=void 0;const Wn=tt,td=ed(Gs),rd=e=>{var t;const r=(t=e.size)!==null&&t!==void 0?t:64,n=e.color||"#000";return(0,Wn.h)("div",{class:"-cbwsdk-spinner"},(0,Wn.h)("style",null,td.default),(0,Wn.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Wn.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};Ci.Spinner=rd;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Nc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.CoinbaseWalletSteps=Vr.ConnectContent=void 0;const hr=Nc(Cn),oe=tt,nd=q,id=Qr,sd=Si,od=Ri,ad=Mi,cd=ki,ld=Ci,ud=Nc(Zs),cs={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Lc},hd=e=>e==="light"?"#FFFFFF":"#0A0B0D";function dd(e){const{theme:t}=e,r=(0,nd.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=cs.steps;return(0,oe.h)("div",{"data-testid":"connect-content",className:(0,hr.default)("-cbwsdk-connect-content",t)},(0,oe.h)("style",null,ud.default),(0,oe.h)("div",{className:"-cbwsdk-connect-content-header"},(0,oe.h)("h2",{className:(0,hr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,oe.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,oe.h)(sd.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,oe.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,oe.h)(fd,{title:cs.title,description:cs.description,theme:t})),(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,oe.h)(cd.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,oe.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:id.LIB_VERSION}),(0,oe.h)("input",{type:"hidden",value:r})),(0,oe.h)(n,{theme:t}),!e.isConnected&&(0,oe.h)("div",{"data-testid":"connecting-spinner",className:(0,hr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,oe.h)(ld.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,oe.h)("p",null,"Connecting...")))))}Vr.ConnectContent=dd;function fd({title:e,description:t,theme:r}){return(0,oe.h)("div",{className:(0,hr.default)("-cbwsdk-connect-item",r)},(0,oe.h)("div",null,(0,oe.h)(od.CoinbaseWalletRound,null)),(0,oe.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,oe.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,oe.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function Lc({theme:e}){return(0,oe.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,oe.h)("span",null,"Tap ",(0,oe.h)("strong",null,"Scan")," "),(0,oe.h)("span",{className:(0,hr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,oe.h)(ad.QRCodeIcon,{fill:hd(e)})))))}Vr.CoinbaseWalletSteps=Lc;var Ii={},xi={};Object.defineProperty(xi,"__esModule",{value:!0});xi.ArrowLeftIcon=void 0;const Jo=tt;function pd(e){return(0,Jo.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,Jo.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}xi.ArrowLeftIcon=pd;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.LaptopIcon=void 0;const ls=tt;function gd(e){return(0,ls.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,ls.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,ls.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Ai.LaptopIcon=gd;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SafeIcon=void 0;const Go=tt;function md(e){return(0,Go.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Go.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Ti.SafeIcon=md;var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var Oc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.TryExtensionContent=void 0;const rr=Oc(Cn),We=tt,us=Ei,vd=xi,bd=Ai,wd=Ti,_d=Oc(Ks);function yd({theme:e}){const[t,r]=(0,us.useState)(!1),n=(0,us.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,us.useCallback)(()=>{t?window.location.reload():(n(),r(!0))},[n,t]);return(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension",e)},(0,We.h)("style",null,_d.default),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("h3",{class:(0,rr.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,We.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,We.h)("button",{class:(0,rr.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,We.h)("div",null,!t&&(0,We.h)(vd.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(bd.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(wd.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Ii.TryExtensionContent=yd;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Pc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yi,"__esModule",{value:!0});yi.ConnectDialog=void 0;const hs=Pc(Cn),nr=tt,ds=Ei,Ed=Vr,Sd=Ii,Rd=Pc(Qs),Md=e=>{const{isOpen:t,darkMode:r}=e,[n,i]=(0,ds.useState)(!t),[s,a]=(0,ds.useState)(!t);(0,ds.useEffect)(()=>{const d=[window.setTimeout(()=>{a(!t)},10)];return t?i(!1):d.push(window.setTimeout(()=>{i(!0)},360)),()=>{d.forEach(window.clearTimeout)}},[t]);const l=r?"dark":"light";return(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,nr.h)("style",null,Rd.default),(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-backdrop",l,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,nr.h)("div",{class:"-cbwsdk-connect-dialog"},(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,nr.h)(Ed.ConnectContent,{theme:l,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,nr.h)(Sd.TryExtensionContent,{theme:l}))))};yi.ConnectDialog=Md;Object.defineProperty(_i,"__esModule",{value:!0});_i.LinkFlow=void 0;const fs=tt,kd=yi;class Cd{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,fs.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,fs.render)((0,fs.h)(kd.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}_i.LinkFlow=Cd;var Ys={},Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.default=".-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}.-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}";(function(e){var t=Q&&Q.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const r=t(Cn),n=tt,i=Ei,s=t(Xs),a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",l="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{constructor(y){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=y.darkMode}attach(y){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",y.appendChild(this.root),this.render()}presentItem(y){const C=this.nextItemKey++;return this.items.set(C,y),this.render(),()=>{this.items.delete(C),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([y,C])=>(0,n.h)(e.SnackbarInstance,Object.assign({},C,{key:y}))))),this.root)}}e.Snackbar=d;const h=R=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,s.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},R.children));e.SnackbarContainer=h;const m=({autoExpand:R,message:y,menuItems:C})=>{const[x,B]=(0,i.useState)(!0),[O,M]=(0,i.useState)(R??!1);(0,i.useEffect)(()=>{const N=[window.setTimeout(()=>{B(!1)},1),window.setTimeout(()=>{M(!0)},1e4)];return()=>{N.forEach(window.clearTimeout)}});const T=()=>{M(!O)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",x&&"-cbwsdk-snackbar-instance-hidden",O&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:T},(0,n.h)("img",{src:a,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},y),(0,n.h)("div",{class:"-gear-container"},!O&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:l,class:"-gear-icon",title:"Expand"}))),C&&C.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},C.map((N,D)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:N.onClick,key:D},(0,n.h)("svg",{width:N.svgWidth,height:N.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":N.defaultFillRule,"clip-rule":N.defaultClipRule,d:N.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},N.info)))))};e.SnackbarInstance=m})(Ys);Object.defineProperty(Mn,"__esModule",{value:!0});Mn.WalletLinkRelayUI=void 0;const Id=kn,xd=_i,Ad=Ys;class Td{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new Ad.Snackbar({darkMode:t.darkMode}),this.linkFlow=new xd.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",t.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,Id.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let r;return t.isUnlinkedErrorState?r={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:t.onResetConnection}]}:r={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:t.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:t.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}Mn.WalletLinkRelayUI=Td;Object.defineProperty(_n,"__esModule",{value:!0});_n.WalletLinkRelay=void 0;const Lr=gn,Nd=Ve,Fe=q,ir=Yr,Zo=ht,Pt=Xr,Ld=vi,sr=Kr,Od=Mn;class Tt extends Zo.RelayAbstract{constructor(t){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{var l;this.isLinked=a;const d=this.storage.getItem(Zo.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this.session.linked=a),this.isUnlinkedErrorState=!1,d){const h=d.split(" "),m=this.storage.getItem("IsStandaloneSigning")==="true";if(h[0]!==""&&!a&&this.session.linked&&!m){this.isUnlinkedErrorState=!0;const R=this.getSessionIdHash();(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:R})}}},this.metadataUpdated=(a,l)=>{this.storage.setItem(a,l)},this.chainUpdated=(a,l)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===l||(this.chainCallbackParams={chainId:a,jsonRpcUrl:l},this.chainCallback&&this.chainCallback(a,l))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),Tt.accountRequestCallbackIds.size>0&&(Array.from(Tt.accountRequestCallbackIds.values()).forEach(l=>{const d={type:"WEB3_RESPONSE",id:l,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},d),{id:l}))}),Tt.accountRequestCallbackIds.clear())},this.connectedUpdated=a=>{this.ui.setConnected(a)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(r=t.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const t=Pt.Session.load(this.storage)||new Pt.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new Ld.WalletLinkConnection({session:t,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:a}=this.options,l=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:a,session:t});return i.connect(),{session:t,ui:l,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,r;const n=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log(ir.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=Pt.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Pt.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:a,connection:l}=this.subscribe();this._session=s,this.connection=l,this.ui=a,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,r){this.appName=t,this.appLogoUrl=r}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,r){this.storage.setItem(t,r)}signEthereumMessage(t,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),signature:(0,Fe.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Fe.hexStringFromBuffer)(t,!0),chainId:r}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,Fe.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,r){return this.sendRequest({method:"generic",params:{action:r,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let r=null;const n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,a),r==null||r()};return{promise:new Promise((a,l)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,d=>{if(r==null||r(),(0,sr.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)}),this.ui.isStandalone()?this.sendRequestStandalone(n,t):this.publishWeb3RequestEvent(n,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof Od.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,r){var n;const i={type:"WEB3_REQUEST",id:t,request:r},s=Pt.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ir.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(a=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:a.message}})})}publishWeb3RequestCanceledEvent(t){const r={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(t,r,n){return this.connection.publishEvent(t,r,n)}handleWeb3ResponseMessage(t){var r;const{response:n}=t;if((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Tt.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),Tt.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,r,n,i){var s;const a=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,Lr.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:r,errorMessage:a,errorCode:i}})}invokeCallback(t){const r=this.relayEventManager.callbacks.get(t.id);r&&(r(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,Fe.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s)};return{promise:new Promise((s,a)=>{if(this.relayEventManager.callbacks.set(r,l=>{if(this.ui.hideRequestEthereumAccounts(),(0,sr.isErrorResponse)(l))return a(new Error(l.errorMessage));s(l)}),this.ui.inlineAccountsResponse()){const l=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:d}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:l})}else{const l=Lr.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(l)})}Tt.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,t)}),cancel:n}}selectProvider(t){const r={method:"selectProvider",params:{providerOptions:t}},n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,a)},s=new Promise((a,l)=>{this.relayEventManager.callbacks.set(n,m=>{if((0,sr.isErrorResponse)(m))return l(new Error(m.errorMessage));a(m)});const d=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:Nd.ProviderType.Unselected}})},h=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:m}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:h,onCancel:d,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,r,n,i,s,a){const l={method:"watchAsset",params:{type:t,options:{address:r,symbol:n,decimals:i,image:s},chainId:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};this.ui.inlineWatchAsset()||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload}));const R=new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!1}})},B=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:B,onCancel:x,type:t,address:r,symbol:n,decimals:i,image:s,chainId:a}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)});return{cancel:m,promise:R}}addEthereumChain(t,r,n,i,s,a){const l={method:"addEthereumChain",params:{chainId:t,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};return this.ui.inlineAddEthereumChain(t)||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload})),{promise:new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},B=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:O}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:x,onApprove:B,chainId:l.params.chainId,rpcUrls:l.params.rpcUrls,blockExplorerUrls:l.params.blockExplorerUrls,chainName:l.params.chainName,iconUrls:l.params.iconUrls,nativeCurrency:l.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)}),cancel:m}}switchEthereumChain(t,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:r})},i=(0,Fe.randomBytesHex)(8),s=l=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,l)};return{promise:new Promise((l,d)=>{this.relayEventManager.callbacks.set(i,R=>{if((0,sr.isErrorResponse)(R)&&R.errorCode)return d(Lr.standardErrors.provider.custom({code:R.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,sr.isErrorResponse)(R))return d(new Error(R.errorMessage));l(R)});const h=R=>{var y;if(R){const C=(y=(0,Lr.getErrorCode)(R))!==null&&y!==void 0?y:Lr.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",R instanceof Error?R:Lr.standardErrors.provider.unsupportedChain(t),C)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},m=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:R}}})};this.ui.switchEthereumChain({onCancel:h,onApprove:m,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return Pt.Session.hash(this._session.id)}sendRequestStandalone(t,r){const n=s=>{this.handleErrorResponse(t,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}_n.WalletLinkRelay=Tt;Tt.accountRequestCallbackIds=new Set;var In={},Ni={},$c={};(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ys,e)})($c);var eo={};Object.defineProperty(eo,"__esModule",{value:!0});eo.default=".-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}.-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}";var Bc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.RedirectDialog=void 0;const Pd=Bc(Cn),Rt=tt,$d=kn,Bd=$c,Dd=Bc(eo);class Fd{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,$d.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,Rt.render)(null,this.root),t&&(0,Rt.render)((0,Rt.h)(jd,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}Ni.RedirectDialog=Fd;const jd=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,Rt.h)(Bd.SnackbarContainer,{darkMode:r},(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Rt.h)("style",null,Dd.default),(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,Rt.h)("div",{class:(0,Pd.default)("-cbwsdk-redirect-dialog-box",s)},(0,Rt.h)("p",null,e),(0,Rt.h)("button",{onClick:n},t))))};Object.defineProperty(In,"__esModule",{value:!0});In.MobileRelayUI=void 0;const Hd=Ni;class Ud{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Hd.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),t&&r.searchParams.append("wl_url",t);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}In.MobileRelayUI=Ud;Object.defineProperty(wn,"__esModule",{value:!0});wn.MobileRelay=void 0;const Wd=q,Vd=_n,zd=In;class qd extends Vd.WalletLinkRelay{constructor(t){var r;super(t),this._enableMobileWalletLink=(r=t.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,Wd.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,r){if(super.publishWeb3RequestEvent(t,r),!(this._enableMobileWalletLink&&this.ui instanceof zd.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}wn.MobileRelay=qd;var $s={exports:{}},Dc=si.EventEmitter,ps,Ko;function Jd(){if(Ko)return ps;Ko=1;function e(x,B){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(x);B&&(M=M.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),O.push.apply(O,M)}return O}function t(x){for(var B=1;B0?this.tail.next=M:this.head=M,this.tail=M,++this.length}},{key:"unshift",value:function(O){var M={data:O,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}},{key:"shift",value:function(){if(this.length!==0){var O=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,O}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(O){if(this.length===0)return"";for(var M=this.head,T=""+M.data;M=M.next;)T+=O+M.data;return T}},{key:"concat",value:function(O){if(this.length===0)return h.alloc(0);for(var M=h.allocUnsafe(O>>>0),T=this.head,N=0;T;)C(T.data,M,N),N+=T.data.length,T=T.next;return M}},{key:"consume",value:function(O,M){var T;return OD.length?D.length:O;if(L===D.length?N+=D:N+=D.slice(0,O),O-=L,O===0){L===D.length?(++T,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=D.slice(L));break}++T}return this.length-=T,N}},{key:"_getBuffer",value:function(O){var M=h.allocUnsafe(O),T=this.head,N=1;for(T.data.copy(M),O-=T.data.length;T=T.next;){var D=T.data,L=O>D.length?D.length:O;if(D.copy(M,M.length-O,0,L),O-=L,O===0){L===D.length?(++N,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice(L));break}++N}return this.length-=N,M}},{key:y,value:function(O,M){return R(this,t(t({},M),{},{depth:0,customInspect:!1}))}}]),x}(),ps}var or={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function Gd(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,or.nextTick(Bs,this,e)):or.nextTick(Bs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?or.nextTick(Xn,r):(r._writableState.errorEmitted=!0,or.nextTick(Qo,r,s)):or.nextTick(Qo,r,s):t?(or.nextTick(Xn,r),t(s)):or.nextTick(Xn,r)}),this)}function Qo(e,t){Bs(e,t),Xn(e)}function Xn(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zd(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Bs(e,t){e.emit("error",t)}function Kd(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var Fc={destroy:Gd,undestroy:Zd,errorOrDestroy:Kd},mr={};function Qd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var jc={};function pt(e,t,r){r||(r=Error);function n(s,a,l){return typeof t=="string"?t:t(s,a,l)}var i=function(s){Qd(a,s);function a(l,d,h){return s.call(this,n(l,d,h))||this}return a}(r);i.prototype.name=r.name,i.prototype.code=e,jc[e]=i}function Yo(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Yd(e,t,r){return e.substr(0,t.length)===t}function Xd(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ef(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}pt("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);pt("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Yd(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xd(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Yo(t,"type"));else{var s=ef(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Yo(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);pt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");pt("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});pt("ERR_STREAM_PREMATURE_CLOSE","Premature close");pt("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});pt("ERR_MULTIPLE_CALLBACK","Callback called multiple times");pt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");pt("ERR_STREAM_WRITE_AFTER_END","write after end");pt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);pt("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);pt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");mr.codes=jc;var tf=mr.codes.ERR_INVALID_OPT_VALUE;function rf(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function nf(e,t,r,n){var i=rf(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new tf(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var Hc={getHighWaterMark:nf},sf=of;function of(e,t){if(gs("noDeprecation"))return e;var r=!1;function n(){if(!r){if(gs("throwDeprecation"))throw new Error(t);gs("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function gs(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var ms,Xo;function Uc(){if(Xo)return ms;Xo=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};ms=Z;function t(A){var I=this;this.next=null,this.entry=null,this.finish=function(){V(I,A)}}var r;Z.WritableState=W;var n={deprecate:sf},i=Dc,s=ii.Buffer,a=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(A){return s.from(A)}function d(A){return s.isBuffer(A)||A instanceof a}var h=Fc,m=Hc,R=m.getHighWaterMark,y=mr.codes,C=y.ERR_INVALID_ARG_TYPE,x=y.ERR_METHOD_NOT_IMPLEMENTED,B=y.ERR_MULTIPLE_CALLBACK,O=y.ERR_STREAM_CANNOT_PIPE,M=y.ERR_STREAM_DESTROYED,T=y.ERR_STREAM_NULL_VALUES,N=y.ERR_STREAM_WRITE_AFTER_END,D=y.ERR_UNKNOWN_ENCODING,L=h.errorOrDestroy;vt(Z,i);function F(){}function W(A,I,$){r=r||zr(),A=A||{},typeof $!="boolean"&&($=I instanceof r),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=R(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var K=A.decodeStrings===!1;this.decodeStrings=!K,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){p(I,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}W.prototype.getBuffer=function(){for(var I=this.bufferedRequest,$=[];I;)$.push(I),I=I.next;return $},function(){try{Object.defineProperty(W.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var te;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(te=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(I){return te.call(this,I)?!0:this!==Z?!1:I&&I._writableState instanceof W}})):te=function(I){return I instanceof this};function Z(A){r=r||zr();var I=this instanceof r;if(!I&&!te.call(Z,this))return new Z(A);this._writableState=new W(A,this,I),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),i.call(this)}Z.prototype.pipe=function(){L(this,new O)};function z(A,I){var $=new N;L(A,$),e.nextTick(I,$)}function X(A,I,$,K){var G;return $===null?G=new T:typeof $!="string"&&!I.objectMode&&(G=new C("chunk",["string","Buffer"],$)),G?(L(A,G),e.nextTick(K,G),!1):!0}Z.prototype.write=function(A,I,$){var K=this._writableState,G=!1,b=!K.objectMode&&d(A);return b&&!s.isBuffer(A)&&(A=l(A)),typeof I=="function"&&($=I,I=null),b?I="buffer":I||(I=K.defaultEncoding),typeof $!="function"&&($=F),K.ending?z(this,$):(b||X(this,K,A,$))&&(K.pendingcb++,G=S(this,K,b,A,I,$)),G},Z.prototype.cork=function(){this._writableState.corked++},Z.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&k(this,A))},Z.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new D(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(Z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ne(A,I,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof I=="string"&&(I=s.from(I,$)),I}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function S(A,I,$,K,G,b){if(!$){var _=ne(I,K,G);K!==_&&($=!0,G="buffer",K=_)}var P=I.objectMode?1:K.length;I.length+=P;var j=I.length>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function a(M,T,N){var D=T.length-1;if(D=0?(L>0&&(M.lastNeed=L-1),L):--D=0?(L>0&&(M.lastNeed=L-2),L):--D=0?(L>0&&(L===2?L=0:M.lastNeed=L-3),L):0))}function l(M,T,N){if((T[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return M.lastNeed=2,"�"}}function d(M){var T=this.lastTotal-this.lastNeed,N=l(this,M);if(N!==void 0)return N;if(this.lastNeed<=M.length)return M.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,T,0,M.length),this.lastNeed-=M.length}function h(M,T){var N=a(this,M,T);if(!this.lastNeed)return M.toString("utf8",T);this.lastTotal=N;var D=M.length-(N-this.lastNeed);return M.copy(this.lastChar,0,D),M.toString("utf8",T,D)}function m(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+"�":T}function R(M,T){if((M.length-T)%2===0){var N=M.toString("utf16le",T);if(N){var D=N.charCodeAt(N.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",T,M.length-1)}function y(M){var T=M&&M.length?this.write(M):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,N)}return T}function C(M,T){var N=(M.length-T)%3;return N===0?M.toString("base64",T):(this.lastNeed=3-N,this.lastTotal=3,N===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",T,M.length-N))}function x(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function B(M){return M.toString(this.encoding)}function O(M){return M&&M.length?this.write(M):""}return bs}var na=mr.codes.ERR_STREAM_PREMATURE_CLOSE;function af(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof _!="string"&&!J.objectMode&&Object.getPrototypeOf(_)!==i.prototype&&(_=a(_)),j)J.endEmitted?F(b,new T):ne(b,J,_,!0);else if(J.ended)F(b,new O);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!P?(_=J.decoder.write(_),J.objectMode||_.length!==0?ne(b,J,_,!1):k(b,J)):ne(b,J,_,!1)}else j||(J.reading=!1,k(b,J))}return!J.ended&&(J.length=o?b=o:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function f(b,_){return b<=0||_.length===0&&_.ended?0:_.objectMode?1:b!==b?_.flowing&&_.length?_.buffer.head.data.length:_.length:(b>_.highWaterMark&&(_.highWaterMark=u(b)),b<=_.length?b:_.ended?_.length:(_.needReadable=!0,0))}z.prototype.read=function(b){h("read",b),b=parseInt(b,10);var _=this._readableState,P=b;if(b!==0&&(_.emittedReadable=!1),b===0&&_.needReadable&&((_.highWaterMark!==0?_.length>=_.highWaterMark:_.length>0)||_.ended))return h("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?$(this):v(this),null;if(b=f(b,_),b===0&&_.ended)return _.length===0&&$(this),null;var j=_.needReadable;h("need readable",j),(_.length===0||_.length-b<_.highWaterMark)&&(j=!0,h("length less than watermark",j)),_.ended||_.reading?(j=!1,h("reading or ended",j)):j&&(h("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,_.reading||(b=f(P,_)));var ue;return b>0?ue=I(b,_):ue=null,ue===null?(_.needReadable=_.length<=_.highWaterMark,b=0):(_.length-=b,_.awaitDrain=0),_.length===0&&(_.ended||(_.needReadable=!0),P!==b&&_.ended&&$(this)),ue!==null&&this.emit("data",ue),ue};function p(b,_){if(h("onEofChunk"),!_.ended){if(_.decoder){var P=_.decoder.end();P&&P.length&&(_.buffer.push(P),_.length+=_.objectMode?1:P.length)}_.ended=!0,_.sync?v(b):(_.needReadable=!1,_.emittedReadable||(_.emittedReadable=!0,E(b)))}}function v(b){var _=b._readableState;h("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(h("emitReadable",_.flowing),_.emittedReadable=!0,e.nextTick(E,b))}function E(b){var _=b._readableState;h("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(b.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,A(b)}function k(b,_){_.readingMore||(_.readingMore=!0,e.nextTick(g,b,_))}function g(b,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var P=_.length;if(h("maybeReadMore read 0"),b.read(0),P===_.length)break}_.readingMore=!1}z.prototype._read=function(b){F(this,new M("_read()"))},z.prototype.pipe=function(b,_){var P=this,j=this._readableState;switch(j.pipesCount){case 0:j.pipes=b;break;case 1:j.pipes=[j.pipes,b];break;default:j.pipes.push(b);break}j.pipesCount+=1,h("pipe count=%d opts=%j",j.pipesCount,_);var ue=(!_||_.end!==!1)&&b!==e.stdout&&b!==e.stderr,J=ue?at:le;j.endEmitted?e.nextTick(J):P.once("end",J),b.on("unpipe",Y);function Y(nt,ce){h("onunpipe"),nt===P&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,Ht())}function at(){h("onend"),b.end()}var he=c(P);b.on("drain",he);var pe=!1;function Ht(){h("cleanup"),b.removeListener("close",xt),b.removeListener("finish",fe),b.removeListener("drain",he),b.removeListener("error",de),b.removeListener("unpipe",Y),P.removeListener("end",at),P.removeListener("end",le),P.removeListener("data",ge),pe=!0,j.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&he()}P.on("data",ge);function ge(nt){h("ondata");var ce=b.write(nt);h("dest.write",ce),ce===!1&&((j.pipesCount===1&&j.pipes===b||j.pipesCount>1&&G(j.pipes,b)!==-1)&&!pe&&(h("false write response, pause",j.awaitDrain),j.awaitDrain++),P.pause())}function de(nt){h("onerror",nt),le(),b.removeListener("error",de),r(b,"error")===0&&F(b,nt)}te(b,"error",de);function xt(){b.removeListener("finish",fe),le()}b.once("close",xt);function fe(){h("onfinish"),b.removeListener("close",xt),le()}b.once("finish",fe);function le(){h("unpipe"),P.unpipe(b)}return b.emit("pipe",P),j.flowing||(h("pipe resume"),P.resume()),b};function c(b){return function(){var P=b._readableState;h("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&r(b,"data")&&(P.flowing=!0,A(b))}}z.prototype.unpipe=function(b){var _=this._readableState,P={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return b&&b!==_.pipes?this:(b||(b=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,b&&b.emit("unpipe",this,P),this);if(!b){var j=_.pipes,ue=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J0,j.flowing!==!1&&this.resume()):b==="readable"&&!j.endEmitted&&!j.readableListening&&(j.readableListening=j.needReadable=!0,j.flowing=!1,j.emittedReadable=!1,h("on readable",j.length,j.reading),j.length?v(this):j.reading||e.nextTick(U,this)),P},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(b,_){var P=n.prototype.removeListener.call(this,b,_);return b==="readable"&&e.nextTick(w,this),P},z.prototype.removeAllListeners=function(b){var _=n.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&e.nextTick(w,this),_};function w(b){var _=b._readableState;_.readableListening=b.listenerCount("readable")>0,_.resumeScheduled&&!_.paused?_.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){h("readable nexttick read 0"),b.read(0)}z.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,H(this,b)),b.paused=!1,this};function H(b,_){_.resumeScheduled||(_.resumeScheduled=!0,e.nextTick(V,b,_))}function V(b,_){h("resume",_.reading),_.reading||b.read(0),_.resumeScheduled=!1,b.emit("resume"),A(b),_.flowing&&!_.reading&&b.read(0)}z.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var _=b._readableState;for(h("flow",_.flowing);_.flowing&&b.read()!==null;);}z.prototype.wrap=function(b){var _=this,P=this._readableState,j=!1;b.on("end",function(){if(h("wrapped end"),P.decoder&&!P.ended){var Y=P.decoder.end();Y&&Y.length&&_.push(Y)}_.push(null)}),b.on("data",function(Y){if(h("wrapped data"),P.decoder&&(Y=P.decoder.write(Y)),!(P.objectMode&&Y==null)&&!(!P.objectMode&&(!Y||!Y.length))){var at=_.push(Y);at||(j=!0,b.pause())}});for(var ue in b)this[ue]===void 0&&typeof b[ue]=="function"&&(this[ue]=function(at){return function(){return b[at].apply(b,arguments)}}(ue));for(var J=0;J=_.length?(_.decoder?P=_.buffer.join(""):_.buffer.length===1?P=_.buffer.first():P=_.buffer.concat(_.length),_.buffer.clear()):P=_.buffer.consume(b,_.decoder),P}function $(b){var _=b._readableState;h("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,e.nextTick(K,_,b))}function K(b,_){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,_.readable=!1,_.emit("end"),b.autoDestroy)){var P=_._writableState;(!P||P.autoDestroy&&P.finished)&&_.destroy()}}typeof Symbol=="function"&&(z.from=function(b,_){return L===void 0&&(L=hf()),L(z,b,_)});function G(b,_){for(var P=0,j=b.length;P0;return Sf(a,d,h,function(m){i||(i=m),m&&s.forEach(la),!d&&(s.forEach(la),n(i))})});return t.reduce(Rf)}var Cf=kf;(function(e,t){t=e.exports=Vc(),t.Stream=t,t.Readable=t,t.Writable=Uc(),t.Duplex=zr(),t.Transform=zc,t.PassThrough=bf,t.finished=to,t.pipeline=Cf})($s,$s.exports);var Gc=$s.exports;const{Transform:If}=Gc;var xf=e=>class Zc extends If{constructor(r,n,i,s,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Zc(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Af}=Gc;var Tf=e=>class Kc extends Af{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Kc(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const Nf=xf,Lf=Tf;var Of=function(e){const t=Nf(e),r=Lf(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},Qc={};const ua=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Qc.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],m=e[8]^e[18]^e[28]^e[38]^e[48],R=e[9]^e[19]^e[29]^e[39]^e[49];let y=m^(i<<1|s>>>31),C=R^(s<<1|i>>>31);const x=e[0]^y,B=e[1]^C,O=e[10]^y,M=e[11]^C,T=e[20]^y,N=e[21]^C,D=e[30]^y,L=e[31]^C,F=e[40]^y,W=e[41]^C;y=r^(a<<1|l>>>31),C=n^(l<<1|a>>>31);const te=e[2]^y,Z=e[3]^C,z=e[12]^y,X=e[13]^C,ne=e[22]^y,S=e[23]^C,o=e[32]^y,u=e[33]^C,f=e[42]^y,p=e[43]^C;y=i^(d<<1|h>>>31),C=s^(h<<1|d>>>31);const v=e[4]^y,E=e[5]^C,k=e[14]^y,g=e[15]^C,c=e[24]^y,w=e[25]^C,U=e[34]^y,H=e[35]^C,V=e[44]^y,A=e[45]^C;y=a^(m<<1|R>>>31),C=l^(R<<1|m>>>31);const I=e[6]^y,$=e[7]^C,K=e[16]^y,G=e[17]^C,b=e[26]^y,_=e[27]^C,P=e[36]^y,j=e[37]^C,ue=e[46]^y,J=e[47]^C;y=d^(r<<1|n>>>31),C=h^(n<<1|r>>>31);const Y=e[8]^y,at=e[9]^C,he=e[18]^y,pe=e[19]^C,Ht=e[28]^y,ge=e[29]^C,de=e[38]^y,xt=e[39]^C,fe=e[48]^y,le=e[49]^C,nt=x,ce=B,me=M<<4|O>>>28,wr=O<<4|M>>>28,ve=T<<3|N>>>29,be=N<<3|T>>>29,_r=L<<9|D>>>23,we=D<<9|L>>>23,_e=F<<18|W>>>14,yr=W<<18|F>>>14,ye=te<<1|Z>>>31,Ee=Z<<1|te>>>31,Er=X<<12|z>>>20,Se=z<<12|X>>>20,Re=ne<<10|S>>>22,Sr=S<<10|ne>>>22,Me=u<<13|o>>>19,ke=o<<13|u>>>19,Rr=f<<2|p>>>30,Ce=p<<2|f>>>30,Ie=E<<30|v>>>2,Mr=v<<30|E>>>2,xe=k<<6|g>>>26,Ae=g<<6|k>>>26,kr=w<<11|c>>>21,Te=c<<11|w>>>21,Ne=U<<15|H>>>17,Cr=H<<15|U>>>17,Le=A<<29|V>>>3,Oe=V<<29|A>>>3,Ir=I<<28|$>>>4,Pe=$<<28|I>>>4,$e=G<<23|K>>>9,xr=K<<23|G>>>9,Be=b<<25|_>>>7,De=_<<25|b>>>7,Ut=P<<21|j>>>11,Wt=j<<21|P>>>11,Vt=J<<24|ue>>>8,zt=ue<<24|J>>>8,qt=Y<<27|at>>>5,Jt=at<<27|Y>>>5,Gt=he<<20|pe>>>12,Zt=pe<<20|he>>>12,Kt=ge<<7|Ht>>>25,Qt=Ht<<7|ge>>>25,Yt=de<<8|xt>>>24,Xt=xt<<8|de>>>24,er=fe<<14|le>>>18,tr=le<<14|fe>>>18;e[0]=nt^~Er&kr,e[1]=ce^~Se&Te,e[10]=Ir^~Gt&ve,e[11]=Pe^~Zt&be,e[20]=ye^~xe&Be,e[21]=Ee^~Ae&De,e[30]=qt^~me&Re,e[31]=Jt^~wr&Sr,e[40]=Ie^~$e&Kt,e[41]=Mr^~xr&Qt,e[2]=Er^~kr&Ut,e[3]=Se^~Te&Wt,e[12]=Gt^~ve&Me,e[13]=Zt^~be&ke,e[22]=xe^~Be&Yt,e[23]=Ae^~De&Xt,e[32]=me^~Re&Ne,e[33]=wr^~Sr&Cr,e[42]=$e^~Kt&_r,e[43]=xr^~Qt&we,e[4]=kr^~Ut&er,e[5]=Te^~Wt&tr,e[14]=ve^~Me&Le,e[15]=be^~ke&Oe,e[24]=Be^~Yt&_e,e[25]=De^~Xt&yr,e[34]=Re^~Ne&Vt,e[35]=Sr^~Cr&zt,e[44]=Kt^~_r&Rr,e[45]=Qt^~we&Ce,e[6]=Ut^~er&nt,e[7]=Wt^~tr&ce,e[16]=Me^~Le&Ir,e[17]=ke^~Oe&Pe,e[26]=Yt^~_e&ye,e[27]=Xt^~yr&Ee,e[36]=Ne^~Vt&qt,e[37]=Cr^~zt&Jt,e[46]=_r^~Rr&Ie,e[47]=we^~Ce&Mr,e[8]=er^~nt&Er,e[9]=tr^~ce&Se,e[18]=Le^~Ir&Gt,e[19]=Oe^~Pe&Zt,e[28]=_e^~ye&xe,e[29]=yr^~Ee&Ae,e[38]=Vt^~qt&me,e[39]=zt^~Jt&wr,e[48]=Rr^~Ie&$e,e[49]=Ce^~Mr&xr,e[0]^=ua[t*2],e[1]^=ua[t*2+1]}};const ti=Qc;function tn(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}tn.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};tn.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(ti.p1600(this.state),this.count=0);return t};tn.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Pf=tn,$f=Of(Pf);const Bf=$f,Df=ci;function Yc(e){return Buffer.allocUnsafe(e).fill(0)}function Xc(e,t,r){const n=Yc(t);return e=Pi(e),r?e.length"u")throw new Error("Not an array?");if(r=il(e),r!=="dynamic"&&r!==0&&t.length>r)throw new Error("Elements exceed array size: "+r);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(St(e,t[s]));if(r==="dynamic"){var a=St("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([St("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,dr.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(r=Fr(e),r<1||r>32)throw new Error("Invalid bytes width: "+r);return dr.setLengthRight(t,32)}else if(e.startsWith("uint")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(r=ha(e),n=ar(t),n<0)throw new Error("Supplied ufixed is negative");return St("uint256",n.mul(new lr(2).pow(new lr(r[1]))))}else if(e.startsWith("fixed"))return r=ha(e),St("int256",ar(t).mul(new lr(2).pow(new lr(r[1]))))}throw new Error("Unsupported or invalid type: "+e)}function Wf(e){return e==="string"||e==="bytes"||il(e)==="dynamic"}function Vf(e){return e.lastIndexOf("]")===e.length-1}function zf(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var a=nl(e[s]),l=t[s],d=St(a,l);Wf(a)?(r.push(St("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function sl(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(dr.setLengthRight(l,r))}else if(a.startsWith("uint")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(a.startsWith("int")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function qf(e,t){return dr.keccak(sl(e,t))}var Jf={rawEncode:zf,solidityPack:sl,soliditySHA3:qf};const mt=rl,un=Jf,ol={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"]},Ss={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const a=(l,d,h)=>{if(r[d]!==void 0)return["bytes32",h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":mt.keccak(this.encodeData(d,h,r,n))];if(h===void 0)throw new Error(`missing value for field ${l} of type ${d}`);if(d==="bytes")return["bytes32",mt.keccak(h)];if(d==="string")return typeof h=="string"&&(h=Buffer.from(h,"utf8")),["bytes32",mt.keccak(h)];if(d.lastIndexOf("]")===d.length-1){const m=d.slice(0,d.lastIndexOf("[")),R=h.map(y=>a(l,m,y));return["bytes32",mt.keccak(un.rawEncode(R.map(([y])=>y),R.map(([,y])=>y)))]}return[d,h]};for(const l of r[e]){const[d,h]=a(l.name,l.type,t[l.name]);i.push(d),s.push(h)}}else for(const a of r[e]){let l=t[a.name];if(l!==void 0)if(a.type==="bytes")i.push("bytes32"),l=mt.keccak(l),s.push(l);else if(a.type==="string")i.push("bytes32"),typeof l=="string"&&(l=Buffer.from(l,"utf8")),l=mt.keccak(l),s.push(l);else if(r[a.type]!==void 0)i.push("bytes32"),l=mt.keccak(this.encodeData(a.type,l,r,n)),s.push(l);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(l)}}return un.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(i=>i!==e);n=[e].concat(n.sort());for(const i of n){if(!t[i])throw new Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:a,type:l})=>l+" "+a).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||t[e]===void 0)return r;r.push(e);for(const n of t[e])for(const i of this.findTypeDependencies(n.type,t,r))!r.includes(i)&&r.push(i);return r},hashStruct(e,t,r,n=!0){return mt.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return mt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in ol.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),mt.keccak(Buffer.concat(n))}};var Gf={TYPED_MESSAGE_SCHEMA:ol,TypedDataUtils:Ss,hashForSignTypedDataLegacy:function(e){return Zf(e.data)},hashForSignTypedData_v3:function(e){return Ss.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Ss.hash(e.data)}};function Zf(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const r=e.map(function(s){return s.type==="bytes"?mt.toBuffer(s.value):s.value}),n=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return un.soliditySHA3(["bytes32","bytes32"],[un.soliditySHA3(new Array(e.length).fill("string"),i),un.soliditySHA3(n,r)])}var qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.filterFromParam=qr.FilterPolyfill=void 0;const $r=Ve,Ye=q,Kf=5*60*1e3,cr={jsonrpc:"2.0",id:0};class Qf{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,$r.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const r=al(t),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Ye.hexStringFromIntNumber)(n)}async newBlockFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.blockFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}uninstallFilter(t){const r=(0,Ye.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(t){const r=(0,Ye.intNumberFromHexString)(t);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Vn())}async getFilterLogs(t){const r=(0,Ye.intNumberFromHexString)(t),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(n)]})):Vn()}makeFilterId(){return(0,$r.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((r,n)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const r=this.logFilters.get(t),n=this.cursors.get(t);if(!n||!r)return Vn();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return zn();console.info(`Fetching logs from ${n} to ${s} for filter ${t}`);const a=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(a.result)){const l=a.result.map(h=>(0,Ye.intNumberFromHexString)(h.blockNumber||"0x0")),d=Math.max(...l);if(d&&d>n){const h=(0,$r.IntNumber)(d+1);console.info(`Moving cursor position for filter (${t}) from ${n} to ${h}`),this.cursors.set(t,h)}}return a}async getBlockFilterChanges(t){const r=this.cursors.get(t);if(!r)return Vn();const n=await this.getCurrentBlockHeight();if(r>n)return zn();console.info(`Fetching blocks from ${r} to ${n} for filter (${t})`);const i=(await Promise.all((0,Ye.range)(r,n+1).map(a=>this.getBlockHashByNumber((0,$r.IntNumber)(a))))).filter(a=>!!a),s=(0,$r.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${t}) from ${r} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},cr),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(zn())}async setInitialCursorPosition(t,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(t,i),i}setFilterTimeout(t){const r=this.timeouts.get(t);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},Kf);this.timeouts.set(t,n)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_blockNumber",params:[]}));return(0,Ye.intNumberFromHexString)((0,Ye.ensureHexString)(t))}async getBlockHashByNumber(t){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getBlockByNumber",params:[(0,Ye.hexStringFromIntNumber)(t),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Ye.ensureHexString)(r.result.hash):null}}qr.FilterPolyfill=Qf;function al(e){return{fromBlock:fa(e.fromBlock),toBlock:fa(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}qr.filterFromParam=al;function da(e){const t={fromBlock:pa(e.fromBlock),toBlock:pa(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function fa(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,$r.IntNumber)(0);if((0,Ye.isHexString)(e))return(0,Ye.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function pa(e){return e==="latest"?e:(0,Ye.hexStringFromIntNumber)(e)}function Vn(){return Object.assign(Object.assign({},cr),{error:{code:-32e3,message:"filter not found"}})}function zn(){return Object.assign(Object.assign({},cr),{result:[]})}var $i={},cl={},Bi={},ro=Yf;function Yf(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const ga=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let i=0;i{t.errorFirst?n.push(function(a,l){if(t.multiArgs){const d=new Array(arguments.length-1);for(let h=1;h{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=i=>{const s=a=>typeof a=="string"?i===a:a.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let n;typeof e=="function"?n=function(){return t.excludeMain?e.apply(this,arguments):ga(e,t).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]=typeof s=="function"&&r(i)?ga(s,t):s}return n},xn={},An={};Object.defineProperty(An,"__esModule",{value:!0});const e0=si;function ma(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function t0(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")ma(s,this,r);else{const a=s.length,l=t0(s);for(let d=0;de+t,va=["sync","latest"];class a0 extends i0.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*s0,this._usePastBlocks=t.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(t){return t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t){va.includes(t)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return va.map(t=>this.listenerCount(t)).reduce(o0)}_shouldUseNewBlock(t){const r=this._currentBlock;if(!r)return!0;const n=ba(t),i=ba(r);return this._usePastBlocks&&ni}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const r=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:r,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}xn.BaseBlockTracker=a0;function ba(e){return Number.parseInt(e,16)}var ll={},ul={},Ke={};class hl extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...a}=t,{path:l}=t,d=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(s??d),s!=null&&(this.cause=d),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function c0(e){return ft(e)&&typeof e[Symbol.iterator]=="function"}function ft(e){return typeof e=="object"&&e!=null}function wa(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ze(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function l0(e){const{done:t,value:r}=e.next();return t?void 0:r}function u0(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:a}=r,{refinement:l,message:d=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${ze(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:s,...e,message:d}}function*Ds(e,t,r,n){c0(e)||(e=[e]);for(const i of e){const s=u0(i,t,r,n);s&&(yield s)}}function*no(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:a=!1}=r,l={path:n,branch:i};if(s&&(e=t.coercer(e,l),a&&t.type!=="type"&&ft(t.schema)&&ft(e)&&!Array.isArray(e)))for(const h in e)t.schema[h]===void 0&&delete e[h];let d="valid";for(const h of t.validator(e,l))h.explanation=r.message,d="not_valid",yield[h,void 0];for(let[h,m,R]of t.entries(e,l)){const y=no(m,R,{path:h===void 0?n:[...n,h],branch:h===void 0?i:[...i,m],coerce:s,mask:a,message:r.message});for(const C of y)C[0]?(d=C[0].refinement!=null?"not_refined":"not_valid",yield[C[0],void 0]):s&&(m=C[1],h===void 0?e=m:e instanceof Map?e.set(h,m):e instanceof Set?e.add(m):ft(e)&&(m!==void 0||h in e)&&(e[h]=m))}if(d!=="not_valid")for(const h of t.refiner(e,l))h.explanation=r.message,d="not_refined",yield[h,void 0];d==="valid"&&(yield[void 0,e])}class Ue{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:a=d=>d,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(d,h)=>{const m=i(d,h);return Ds(m,h,this,d)}:this.validator=()=>[],s?this.refiner=(d,h)=>{const m=s(d,h);return Ds(m,h,this,d)}:this.refiner=()=>[]}assert(t,r){return dl(t,this,r)}create(t,r){return fl(t,this,r)}is(t){return io(t,this)}mask(t,r){return pl(t,this,r)}validate(t,r={}){return rn(t,this,r)}}function dl(e,t,r){const n=rn(e,t,{message:r});if(n[0])throw n[0]}function fl(e,t,r){const n=rn(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function pl(e,t,r){const n=rn(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function io(e,t){return!rn(e,t)[0]}function rn(e,t,r={}){const n=no(e,t,r),i=l0(n);return i[0]?[new hl(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function h0(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Nn(n):Tn(n)}function rt(e,t){return new Ue({type:e,schema:null,validator:t})}function d0(e,t){return new Ue({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function f0(e){return new Ue({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function p0(e){let t;return new Ue({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function g0(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function m0(e){const t=e instanceof Ue,r=t?{...e.schema}:{...e};for(const n in r)r[n]=gl(r[n]);return t&&e.type==="type"?Nn(r):Tn(r)}function v0(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function b0(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),rt(e,t)}function w0(){return rt("any",()=>!0)}function _0(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${ze(t)}`}})}function y0(){return rt("bigint",e=>typeof e=="bigint")}function E0(){return rt("boolean",e=>typeof e=="boolean")}function S0(){return rt("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ze(e)}`)}function R0(e){const t={},r=e.map(n=>ze(n)).join();for(const n of e)t[n]=n;return new Ue({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${ze(n)}`}})}function M0(){return rt("func",e=>typeof e=="function"||`Expected a function, but received: ${ze(e)}`)}function k0(e){return rt("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ze(t)}`)}function C0(){return rt("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ze(e)}`)}function I0(e){return new Ue({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function x0(e){const t=ze(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${ze(n)}`}})}function A0(e,t){return new Ue({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${ze(r)}`}})}function so(){return rt("never",()=>!1)}function T0(e){return new Ue({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function N0(){return rt("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${ze(e)}`)}function Tn(e){const t=e?Object.keys(e):[],r=so();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&ft(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ft(n)||`Expected an object, but received: ${ze(n)}`},coercer(n){return ft(n)?{...n}:n}})}function gl(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function L0(e,t){return new Ue({type:"record",schema:null,*entries(r){if(ft(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ft(r)||`Expected an object, but received: ${ze(r)}`}})}function O0(){return rt("regexp",e=>e instanceof RegExp)}function P0(e){return new Ue({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${ze(t)}`}})}function ml(){return rt("string",e=>typeof e=="string"||`Expected a string, but received: ${ze(e)}`)}function $0(e){const t=so();return new Ue({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...a]=no(r,s,n),[l]=a;if(l[0])for(const[d]of a)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ze(r)}`,...i]}})}function vl(){return rt("unknown",()=>!0)}function oo(e,t,r){return new Ue({...e,coercer:(n,i)=>io(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function D0(e,t,r={}){return oo(e,vl(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&wa(n)&&wa(i)){const s={...n};let a=!1;for(const l in i)s[l]===void 0&&(s[l]=i[l],a=!0);if(a)return s}return n})}function F0(e){return oo(e,ml(),t=>t.trim())}function j0(e){return vr(e,"empty",t=>{const r=bl(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function bl(e){return e instanceof Map||e instanceof Set?e.size:e.length}function H0(e,t,r={}){const{exclusive:n}=r;return vr(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function W0(e){return vr(e,"nonempty",t=>bl(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function V0(e,t){return vr(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function z0(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return vr(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:a}=s;return t<=a&&a<=r||`${n} with a size ${i} but received one with a size of \`${a}\``}else{const{length:a}=s;return t<=a&&a<=r||`${n} with a length ${i} but received one with a length of \`${a}\``}})}function vr(e,t,r){return new Ue({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),a=Ds(s,i,e,n);for(const l of a)yield{...l,refinement:t}}})}const q0=Object.freeze(Object.defineProperty({__proto__:null,Struct:Ue,StructError:hl,any:w0,array:_0,assert:dl,assign:h0,bigint:y0,boolean:E0,coerce:oo,create:fl,date:S0,defaulted:D0,define:rt,deprecated:d0,dynamic:f0,empty:j0,enums:R0,func:M0,instance:k0,integer:C0,intersection:I0,is:io,lazy:p0,literal:x0,map:A0,mask:pl,max:H0,min:U0,never:so,nonempty:W0,nullable:T0,number:N0,object:Tn,omit:g0,optional:gl,partial:m0,pattern:V0,pick:v0,record:L0,refine:vr,regexp:O0,set:P0,size:z0,string:ml,struct:b0,trimmed:F0,tuple:$0,type:Nn,union:B0,unknown:vl,validate:rn},Symbol.toStringTag,{value:"Module"})),br=Zr(q0);Object.defineProperty(Ke,"__esModule",{value:!0});Ke.assertExhaustive=Ke.assertStruct=Ke.assert=Ke.AssertionError=void 0;const J0=br;function G0(e){return typeof e=="object"&&e!==null&&"message"in e}function Z0(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function K0(e){const t=G0(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function wl(e,t){return Z0(e)?new e({message:t}):e({message:t})}class ao extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}Ke.AssertionError=ao;function Q0(e,t="Assertion failed.",r=ao){if(!e)throw t instanceof Error?t:wl(r,t)}Ke.assert=Q0;function Y0(e,t,r="Assertion failed",n=ao){try{(0,J0.assert)(e,t)}catch(i){throw wl(n,`${r}: ${K0(i)}.`)}}Ke.assertStruct=Y0;function X0(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Ke.assertExhaustive=X0;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.base64=void 0;const e1=br,t1=Ke,r1=(e,t={})=>{var r,n;const i=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=t.characterSet)!==null&&n!==void 0?n:"base64";let a;s==="base64"?a=String.raw`[A-Za-z0-9+\/]`:((0,t1.assert)(s==="base64url"),a=String.raw`[-_A-Za-z0-9]`);let l;return i?l=new RegExp(`^(?:${a}{4})*(?:${a}{3}=|${a}{2}==)?$`,"u"):l=new RegExp(`^(?:${a}{4})*(?:${a}{2,3}|${a}{3}=|${a}{2}==)?$`,"u"),(0,e1.pattern)(e,l)};Ln.base64=r1;var ae={},On={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=br,r=Ke;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function n(h){return(0,t.is)(h,e.HexStruct)}e.isHexString=n;function i(h){return(0,t.is)(h,e.StrictHexStruct)}e.isStrictHexString=i;function s(h){(0,r.assert)(n(h),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function a(h){(0,r.assert)(i(h),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=a;function l(h){return h.startsWith("0x")?h:h.startsWith("0X")?`0x${h.substring(2)}`:`0x${h}`}e.add0x=l;function d(h){return h.startsWith("0x")||h.startsWith("0X")?h.substring(2):h}e.remove0x=d})(On);Object.defineProperty(ae,"__esModule",{value:!0});ae.createDataView=ae.concatBytes=ae.valueToBytes=ae.stringToBytes=ae.numberToBytes=ae.signedBigIntToBytes=ae.bigIntToBytes=ae.hexToBytes=ae.bytesToString=ae.bytesToNumber=ae.bytesToSignedBigInt=ae.bytesToBigInt=ae.bytesToHex=ae.assertIsBytes=ae.isBytes=void 0;const ot=Ke,Fs=On,_a=48,ya=58,Ea=87;function n1(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const i1=n1();function co(e){return e instanceof Uint8Array}ae.isBytes=co;function nn(e){(0,ot.assert)(co(e),"Value must be a Uint8Array.")}ae.assertIsBytes=nn;function _l(e){if(nn(e),e.length===0)return"0x";const t=i1(),r=new Array(e.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return Di(t)}ae.bigIntToBytes=El;function c1(e,t){(0,ot.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function l1(e,t){(0,ot.assert)(typeof e=="bigint","Value must be a bigint."),(0,ot.assert)(typeof t=="number","Byte length must be a number."),(0,ot.assert)(t>0,"Byte length must be greater than 0."),(0,ot.assert)(c1(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i>=BigInt(8);return n.reverse()}ae.signedBigIntToBytes=l1;function Sl(e){(0,ot.assert)(typeof e=="number","Value must be a number."),(0,ot.assert)(e>=0,"Value must be a non-negative number."),(0,ot.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return Di(t)}ae.numberToBytes=Sl;function Rl(e){return(0,ot.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}ae.stringToBytes=Rl;function Ml(e){if(typeof e=="bigint")return El(e);if(typeof e=="number")return Sl(e);if(typeof e=="string")return e.startsWith("0x")?Di(e):Rl(e);if(co(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}ae.valueToBytes=Ml;function u1(e){const t=new Array(e.length);let r=0;for(let i=0;it.call(r,n,i,this))}get(t){return Xe(this,gt,"f").get(t)}has(t){return Xe(this,gt,"f").has(t)}keys(){return Xe(this,gt,"f").keys()}values(){return Xe(this,gt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}Jr.FrozenMap=lo;class uo{constructor(t){yt.set(this,void 0),Il(this,yt,new Set(t),"f"),Object.freeze(this)}get size(){return Xe(this,yt,"f").size}[(yt=new WeakMap,Symbol.iterator)](){return Xe(this,yt,"f")[Symbol.iterator]()}entries(){return Xe(this,yt,"f").entries()}forEach(t,r){return Xe(this,yt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}has(t){return Xe(this,yt,"f").has(t)}keys(){return Xe(this,yt,"f").keys()}values(){return Xe(this,yt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}Jr.FrozenSet=uo;Object.freeze(lo);Object.freeze(lo.prototype);Object.freeze(uo);Object.freeze(uo.prototype);var xl={};Object.defineProperty(xl,"__esModule",{value:!0});var Al={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=br,r=Ke,n=()=>(0,t.define)("finite number",L=>(0,t.is)(L,(0,t.number)())&&Number.isFinite(L));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),n(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(L,F)=>{function W(te,Z){const X=[...Z.validator(te,F)];return X.length>0?X:!0}try{const te=W(L,e.UnsafeJsonStruct);return te!==!0?te:W(JSON.parse(JSON.stringify(L)),e.UnsafeJsonStruct)}catch(te){return te instanceof RangeError?"Circular reference detected":!1}});function i(L){return(0,t.is)(L,e.JsonStruct)}e.isValidJson=i;function s(L){(0,r.assertStruct)(L,e.JsonStruct,"Invalid JSON value");const F=JSON.stringify(L);return new TextEncoder().encode(F).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function a(L){return(0,t.is)(L,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=a;function l(L,F){(0,r.assertStruct)(L,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",F)}e.assertIsJsonRpcNotification=l;function d(L){return(0,t.is)(L,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=d;function h(L,F){(0,r.assertStruct)(L,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",F)}e.assertIsJsonRpcRequest=h,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function m(L){return(0,t.is)(L,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=m;function R(L,F){(0,r.assertStruct)(L,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",F)}e.assertIsPendingJsonRpcResponse=R;function y(L){return(0,t.is)(L,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=y;function C(L,F){(0,r.assertStruct)(L,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",F)}e.assertIsJsonRpcResponse=C;function x(L){return(0,t.is)(L,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=x;function B(L,F){(0,r.assertStruct)(L,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",F)}e.assertIsJsonRpcSuccess=B;function O(L){return(0,t.is)(L,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=O;function M(L,F){(0,r.assertStruct)(L,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",F)}e.assertIsJsonRpcFailure=M;function T(L){return(0,t.is)(L,e.JsonRpcErrorStruct)}e.isJsonRpcError=T;function N(L,F){(0,r.assertStruct)(L,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",F)}e.assertIsJsonRpcError=N;function D(L){const{permitEmptyString:F,permitFractions:W,permitNull:te}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},L);return z=>!!(typeof z=="number"&&(W||Number.isInteger(z))||typeof z=="string"&&(F||z.length>0)||te&&z===null)}e.getJsonRpcIdValidator=D})(Al);var Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});var Gr={},E1=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createModuleLogger=Gr.createProjectLogger=void 0;const S1=E1(su),R1=(0,S1.default)("metamask");function M1(e){return R1.extend(e)}Gr.createProjectLogger=M1;function k1(e,t){return e.extend(t)}Gr.createModuleLogger=k1;var Nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(h){return Array.isArray(h)&&h.length>0}e.isNonEmptyArray=t;function r(h){return h==null}e.isNullOrUndefined=r;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}e.isObject=n;const i=(h,m)=>Object.hasOwnProperty.call(h,m);e.hasProperty=i,function(h){h[h.Null=4]="Null",h[h.Comma=1]="Comma",h[h.Wrapper=1]="Wrapper",h[h.True=4]="True",h[h.False=5]="False",h[h.Quote=1]="Quote",h[h.Colon=1]="Colon",h[h.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(h){if(typeof h!="object"||h===null)return!1;try{let m=h;for(;Object.getPrototypeOf(m)!==null;)m=Object.getPrototypeOf(m);return Object.getPrototypeOf(h)===m}catch{return!1}}e.isPlainObject=s;function a(h){return h.charCodeAt(0)<=127}e.isASCII=a;function l(h){var m;return h.split("").reduce((y,C)=>a(C)?y+1:y+2,0)+((m=h.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&m!==void 0?m:[]).length}e.calculateStringSize=l;function d(h){return h.toString().length}e.calculateNumberSize=d})(Nl);var It={};Object.defineProperty(It,"__esModule",{value:!0});It.hexToBigInt=It.hexToNumber=It.bigIntToHex=It.numberToHex=void 0;const jr=Ke,fn=On,C1=e=>((0,jr.assert)(typeof e=="number","Value must be a number."),(0,jr.assert)(e>=0,"Value must be a non-negative number."),(0,jr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,fn.add0x)(e.toString(16)));It.numberToHex=C1;const I1=e=>((0,jr.assert)(typeof e=="bigint","Value must be a bigint."),(0,jr.assert)(e>=0,"Value must be a non-negative bigint."),(0,fn.add0x)(e.toString(16)));It.bigIntToHex=I1;const x1=e=>{(0,fn.assertIsHexString)(e);const t=parseInt(e,16);return(0,jr.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};It.hexToNumber=x1;const A1=e=>((0,fn.assertIsHexString)(e),BigInt((0,fn.add0x)(e)));It.hexToBigInt=A1;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var Ol={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,a)=>{if(!t(s))throw new Error(`"${a}" must be a non-negative integer. Received: "${s}".`)};function n(s,a){return r(s,"count"),s*a}e.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=i})(Ol);var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});var $l={},js={exports:{}};const T1="2.0.0",Bl=256,N1=Number.MAX_SAFE_INTEGER||9007199254740991,L1=16,O1=Bl-6,P1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Hi={MAX_LENGTH:Bl,MAX_SAFE_COMPONENT_LENGTH:L1,MAX_SAFE_BUILD_LENGTH:O1,MAX_SAFE_INTEGER:N1,RELEASE_TYPES:P1,SEMVER_SPEC_VERSION:T1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$1={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},Rs={};const B1=typeof $1=="object"&&Rs&&Rs.NODE_DEBUG&&/\bsemver\b/i.test(Rs.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ui=B1;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hi,s=Ui;t=e.exports={};const a=t.re=[],l=t.safeRe=[],d=t.src=[],h=t.t={};let m=0;const R="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",i],[R,n]],C=B=>{for(const[O,M]of y)B=B.split(`${O}*`).join(`${O}{0,${M}}`).split(`${O}+`).join(`${O}{1,${M}}`);return B},x=(B,O,M)=>{const T=C(O),N=m++;s(B,N,O),h[B]=N,d[N]=O,a[N]=new RegExp(O,M?"g":void 0),l[N]=new RegExp(T,M?"g":void 0)};x("NUMERICIDENTIFIER","0|[1-9]\\d*"),x("NUMERICIDENTIFIERLOOSE","\\d+"),x("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${R}*`),x("MAINVERSION",`(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})`),x("MAINVERSIONLOOSE",`(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})`),x("PRERELEASEIDENTIFIER",`(?:${d[h.NUMERICIDENTIFIER]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASEIDENTIFIERLOOSE",`(?:${d[h.NUMERICIDENTIFIERLOOSE]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASE",`(?:-(${d[h.PRERELEASEIDENTIFIER]}(?:\\.${d[h.PRERELEASEIDENTIFIER]})*))`),x("PRERELEASELOOSE",`(?:-?(${d[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[h.PRERELEASEIDENTIFIERLOOSE]})*))`),x("BUILDIDENTIFIER",`${R}+`),x("BUILD",`(?:\\+(${d[h.BUILDIDENTIFIER]}(?:\\.${d[h.BUILDIDENTIFIER]})*))`),x("FULLPLAIN",`v?${d[h.MAINVERSION]}${d[h.PRERELEASE]}?${d[h.BUILD]}?`),x("FULL",`^${d[h.FULLPLAIN]}$`),x("LOOSEPLAIN",`[v=\\s]*${d[h.MAINVERSIONLOOSE]}${d[h.PRERELEASELOOSE]}?${d[h.BUILD]}?`),x("LOOSE",`^${d[h.LOOSEPLAIN]}$`),x("GTLT","((?:<|>)?=?)"),x("XRANGEIDENTIFIERLOOSE",`${d[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),x("XRANGEIDENTIFIER",`${d[h.NUMERICIDENTIFIER]}|x|X|\\*`),x("XRANGEPLAIN",`[v=\\s]*(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:${d[h.PRERELEASE]})?${d[h.BUILD]}?)?)?`),x("XRANGEPLAINLOOSE",`[v=\\s]*(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:${d[h.PRERELEASELOOSE]})?${d[h.BUILD]}?)?)?`),x("XRANGE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAIN]}$`),x("XRANGELOOSE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAINLOOSE]}$`),x("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),x("COERCE",`${d[h.COERCEPLAIN]}(?:$|[^\\d])`),x("COERCEFULL",d[h.COERCEPLAIN]+`(?:${d[h.PRERELEASE]})?(?:${d[h.BUILD]})?(?:$|[^\\d])`),x("COERCERTL",d[h.COERCE],!0),x("COERCERTLFULL",d[h.COERCEFULL],!0),x("LONETILDE","(?:~>?)"),x("TILDETRIM",`(\\s*)${d[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",x("TILDE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAIN]}$`),x("TILDELOOSE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAINLOOSE]}$`),x("LONECARET","(?:\\^)"),x("CARETTRIM",`(\\s*)${d[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",x("CARET",`^${d[h.LONECARET]}${d[h.XRANGEPLAIN]}$`),x("CARETLOOSE",`^${d[h.LONECARET]}${d[h.XRANGEPLAINLOOSE]}$`),x("COMPARATORLOOSE",`^${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]})$|^$`),x("COMPARATOR",`^${d[h.GTLT]}\\s*(${d[h.FULLPLAIN]})$|^$`),x("COMPARATORTRIM",`(\\s*)${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]}|${d[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",x("HYPHENRANGE",`^\\s*(${d[h.XRANGEPLAIN]})\\s+-\\s+(${d[h.XRANGEPLAIN]})\\s*$`),x("HYPHENRANGELOOSE",`^\\s*(${d[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[h.XRANGEPLAINLOOSE]})\\s*$`),x("STAR","(<|>)?=?\\s*\\*"),x("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),x("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(js,js.exports);var Pn=js.exports;const D1=Object.freeze({loose:!0}),F1=Object.freeze({}),j1=e=>e?typeof e!="object"?D1:e:F1;var ho=j1;const Ra=/^[0-9]+$/,Dl=(e,t)=>{const r=Ra.test(e),n=Ra.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eDl(t,e);var Fl={compareIdentifiers:Dl,rcompareIdentifiers:H1};const qn=Ui,{MAX_LENGTH:Ma,MAX_SAFE_INTEGER:Jn}=Hi,{safeRe:ka,t:Ca}=Pn,U1=ho,{compareIdentifiers:Or}=Fl;let W1=class Et{constructor(t,r){if(r=U1(r),t instanceof Et){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ma)throw new TypeError(`version is longer than ${Ma} characters`);qn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ka[Ca.LOOSE]:ka[Ca.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Jn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Jn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Jn||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Or(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var et=W1;const Ia=et,V1=(e,t,r=!1)=>{if(e instanceof Ia)return e;try{return new Ia(e,t)}catch(n){if(!r)return null;throw n}};var sn=V1;const z1=sn,q1=(e,t)=>{const r=z1(e,t);return r?r.version:null};var J1=q1;const G1=sn,Z1=(e,t)=>{const r=G1(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var K1=Z1;const xa=et,Q1=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new xa(e instanceof xa?e.version:e,r).inc(t,n,i).version}catch{return null}};var Y1=Q1;const Aa=sn,X1=(e,t)=>{const r=Aa(e,null,!0),n=Aa(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,a=s?r:n,l=s?n:r,d=!!a.prerelease.length;if(!!l.prerelease.length&&!d)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const m=d?"pre":"";return r.major!==n.major?m+"major":r.minor!==n.minor?m+"minor":r.patch!==n.patch?m+"patch":"prerelease"};var ep=X1;const tp=et,rp=(e,t)=>new tp(e,t).major;var np=rp;const ip=et,sp=(e,t)=>new ip(e,t).minor;var op=sp;const ap=et,cp=(e,t)=>new ap(e,t).patch;var lp=cp;const up=sn,hp=(e,t)=>{const r=up(e,t);return r&&r.prerelease.length?r.prerelease:null};var dp=hp;const Ta=et,fp=(e,t,r)=>new Ta(e,r).compare(new Ta(t,r));var bt=fp;const pp=bt,gp=(e,t,r)=>pp(t,e,r);var mp=gp;const vp=bt,bp=(e,t)=>vp(e,t,!0);var wp=bp;const Na=et,_p=(e,t,r)=>{const n=new Na(e,r),i=new Na(t,r);return n.compare(i)||n.compareBuild(i)};var fo=_p;const yp=fo,Ep=(e,t)=>e.sort((r,n)=>yp(r,n,t));var Sp=Ep;const Rp=fo,Mp=(e,t)=>e.sort((r,n)=>Rp(n,r,t));var kp=Mp;const Cp=bt,Ip=(e,t,r)=>Cp(e,t,r)>0;var Wi=Ip;const xp=bt,Ap=(e,t,r)=>xp(e,t,r)<0;var po=Ap;const Tp=bt,Np=(e,t,r)=>Tp(e,t,r)===0;var jl=Np;const Lp=bt,Op=(e,t,r)=>Lp(e,t,r)!==0;var Hl=Op;const Pp=bt,$p=(e,t,r)=>Pp(e,t,r)>=0;var go=$p;const Bp=bt,Dp=(e,t,r)=>Bp(e,t,r)<=0;var mo=Dp;const Fp=jl,jp=Hl,Hp=Wi,Up=go,Wp=po,Vp=mo,zp=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Fp(e,r,n);case"!=":return jp(e,r,n);case">":return Hp(e,r,n);case">=":return Up(e,r,n);case"<":return Wp(e,r,n);case"<=":return Vp(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Ul=zp;const qp=et,Jp=sn,{safeRe:Gn,t:Zn}=Pn,Gp=(e,t)=>{if(e instanceof qp)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Gn[Zn.COERCEFULL]:Gn[Zn.COERCE]);else{const d=t.includePrerelease?Gn[Zn.COERCERTLFULL]:Gn[Zn.COERCERTL];let h;for(;(h=d.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),d.lastIndex=h.index+h[1].length+h[2].length;d.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",l=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jp(`${n}.${i}.${s}${a}${l}`,t)};var Zp=Gp;class Kp{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var Qp=Kp,Ms,La;function wt(){if(La)return Ms;La=1;const e=/\s+/g;class t{constructor(u,f){if(f=i(f),u instanceof t)return u.loose===!!f.loose&&u.includePrerelease===!!f.includePrerelease?u:new t(u.raw,f);if(u instanceof s)return this.raw=u.value,this.set=[[u]],this.formatted=void 0,this;if(this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease,this.raw=u.trim().replace(e," "),this.set=this.raw.split("||").map(p=>this.parseRange(p.trim())).filter(p=>p.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const p=this.set[0];if(this.set=this.set.filter(v=>!B(v[0])),this.set.length===0)this.set=[p];else if(this.set.length>1){for(const v of this.set)if(v.length===1&&O(v[0])){this.set=[v];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let u=0;u0&&(this.formatted+="||");const f=this.set[u];for(let p=0;p0&&(this.formatted+=" "),this.formatted+=f[p].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(u){const p=((this.options.includePrerelease&&C)|(this.options.loose&&x))+":"+u,v=n.get(p);if(v)return v;const E=this.options.loose,k=E?d[h.HYPHENRANGELOOSE]:d[h.HYPHENRANGE];u=u.replace(k,ne(this.options.includePrerelease)),a("hyphen replace",u),u=u.replace(d[h.COMPARATORTRIM],m),a("comparator trim",u),u=u.replace(d[h.TILDETRIM],R),a("tilde trim",u),u=u.replace(d[h.CARETTRIM],y),a("caret trim",u);let g=u.split(" ").map(H=>T(H,this.options)).join(" ").split(/\s+/).map(H=>X(H,this.options));E&&(g=g.filter(H=>(a("loose invalid filter",H,this.options),!!H.match(d[h.COMPARATORLOOSE])))),a("range list",g);const c=new Map,w=g.map(H=>new s(H,this.options));for(const H of w){if(B(H))return[H];c.set(H.value,H)}c.size>1&&c.has("")&&c.delete("");const U=[...c.values()];return n.set(p,U),U}intersects(u,f){if(!(u instanceof t))throw new TypeError("a Range is required");return this.set.some(p=>M(p,f)&&u.set.some(v=>M(v,f)&&p.every(E=>v.every(k=>E.intersects(k,f)))))}test(u){if(!u)return!1;if(typeof u=="string")try{u=new l(u,this.options)}catch{return!1}for(let f=0;fo.value==="<0.0.0-0",O=o=>o.value==="",M=(o,u)=>{let f=!0;const p=o.slice();let v=p.pop();for(;f&&p.length;)f=p.every(E=>v.intersects(E,u)),v=p.pop();return f},T=(o,u)=>(a("comp",o,u),o=F(o,u),a("caret",o),o=D(o,u),a("tildes",o),o=te(o,u),a("xrange",o),o=z(o,u),a("stars",o),o),N=o=>!o||o.toLowerCase()==="x"||o==="*",D=(o,u)=>o.trim().split(/\s+/).map(f=>L(f,u)).join(" "),L=(o,u)=>{const f=u.loose?d[h.TILDELOOSE]:d[h.TILDE];return o.replace(f,(p,v,E,k,g)=>{a("tilde",o,p,v,E,k,g);let c;return N(v)?c="":N(E)?c=`>=${v}.0.0 <${+v+1}.0.0-0`:N(k)?c=`>=${v}.${E}.0 <${v}.${+E+1}.0-0`:g?(a("replaceTilde pr",g),c=`>=${v}.${E}.${k}-${g} <${v}.${+E+1}.0-0`):c=`>=${v}.${E}.${k} <${v}.${+E+1}.0-0`,a("tilde return",c),c})},F=(o,u)=>o.trim().split(/\s+/).map(f=>W(f,u)).join(" "),W=(o,u)=>{a("caret",o,u);const f=u.loose?d[h.CARETLOOSE]:d[h.CARET],p=u.includePrerelease?"-0":"";return o.replace(f,(v,E,k,g,c)=>{a("caret",o,v,E,k,g,c);let w;return N(E)?w="":N(k)?w=`>=${E}.0.0${p} <${+E+1}.0.0-0`:N(g)?E==="0"?w=`>=${E}.${k}.0${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.0${p} <${+E+1}.0.0-0`:c?(a("replaceCaret pr",c),E==="0"?k==="0"?w=`>=${E}.${k}.${g}-${c} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}-${c} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g}-${c} <${+E+1}.0.0-0`):(a("no pr"),E==="0"?k==="0"?w=`>=${E}.${k}.${g}${p} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g} <${+E+1}.0.0-0`),a("caret return",w),w})},te=(o,u)=>(a("replaceXRanges",o,u),o.split(/\s+/).map(f=>Z(f,u)).join(" ")),Z=(o,u)=>{o=o.trim();const f=u.loose?d[h.XRANGELOOSE]:d[h.XRANGE];return o.replace(f,(p,v,E,k,g,c)=>{a("xRange",o,p,v,E,k,g,c);const w=N(E),U=w||N(k),H=U||N(g),V=H;return v==="="&&V&&(v=""),c=u.includePrerelease?"-0":"",w?v===">"||v==="<"?p="<0.0.0-0":p="*":v&&V?(U&&(k=0),g=0,v===">"?(v=">=",U?(E=+E+1,k=0,g=0):(k=+k+1,g=0)):v==="<="&&(v="<",U?E=+E+1:k=+k+1),v==="<"&&(c="-0"),p=`${v+E}.${k}.${g}${c}`):U?p=`>=${E}.0.0${c} <${+E+1}.0.0-0`:H&&(p=`>=${E}.${k}.0${c} <${E}.${+k+1}.0-0`),a("xRange return",p),p})},z=(o,u)=>(a("replaceStars",o,u),o.trim().replace(d[h.STAR],"")),X=(o,u)=>(a("replaceGTE0",o,u),o.trim().replace(d[u.includePrerelease?h.GTE0PRE:h.GTE0],"")),ne=o=>(u,f,p,v,E,k,g,c,w,U,H,V)=>(N(p)?f="":N(v)?f=`>=${p}.0.0${o?"-0":""}`:N(E)?f=`>=${p}.${v}.0${o?"-0":""}`:k?f=`>=${f}`:f=`>=${f}${o?"-0":""}`,N(w)?c="":N(U)?c=`<${+w+1}.0.0-0`:N(H)?c=`<${w}.${+U+1}.0-0`:V?c=`<=${w}.${U}.${H}-${V}`:o?c=`<${w}.${U}.${+H+1}-0`:c=`<=${c}`,`${f} ${c}`.trim()),S=(o,u,f)=>{for(let p=0;p0){const v=o[p].semver;if(v.major===u.major&&v.minor===u.minor&&v.patch===u.patch)return!0}return!1}return!0};return Ms}var ks,Oa;function Vi(){if(Oa)return ks;Oa=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(m,R){if(R=r(R),m instanceof t){if(m.loose===!!R.loose)return m;m=m.value}m=m.trim().split(/\s+/).join(" "),a("comparator",m,R),this.options=R,this.loose=!!R.loose,this.parse(m),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(m){const R=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],y=m.match(R);if(!y)throw new TypeError(`Invalid comparator: ${m}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new l(y[2],this.options.loose):this.semver=e}toString(){return this.value}test(m){if(a("Comparator.test",m,this.options.loose),this.semver===e||m===e)return!0;if(typeof m=="string")try{m=new l(m,this.options)}catch{return!1}return s(m,this.operator,this.semver,this.options)}intersects(m,R){if(!(m instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(m.value,R).test(this.value):m.operator===""?m.value===""?!0:new d(this.value,R).test(m.semver):(R=r(R),R.includePrerelease&&(this.value==="<0.0.0-0"||m.value==="<0.0.0-0")||!R.includePrerelease&&(this.value.startsWith("<0.0.0")||m.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&m.operator.startsWith(">")||this.operator.startsWith("<")&&m.operator.startsWith("<")||this.semver.version===m.semver.version&&this.operator.includes("=")&&m.operator.includes("=")||s(this.semver,"<",m.semver,R)&&this.operator.startsWith(">")&&m.operator.startsWith("<")||s(this.semver,">",m.semver,R)&&this.operator.startsWith("<")&&m.operator.startsWith(">")))}}ks=t;const r=ho,{safeRe:n,t:i}=Pn,s=Ul,a=Ui,l=et,d=wt();return ks}const Yp=wt(),Xp=(e,t,r)=>{try{t=new Yp(t,r)}catch{return!1}return t.test(e)};var zi=Xp;const eg=wt(),tg=(e,t)=>new eg(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var rg=tg;const ng=et,ig=wt(),sg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new ig(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===-1)&&(n=a,i=new ng(n,r))}),n};var og=sg;const ag=et,cg=wt(),lg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new cg(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===1)&&(n=a,i=new ag(n,r))}),n};var ug=lg;const Cs=et,hg=wt(),Pa=Wi,dg=(e,t)=>{e=new hg(e,t);let r=new Cs("0.0.0");if(e.test(r)||(r=new Cs("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const l=new Cs(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Pa(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Pa(r,s))&&(r=s)}return r&&e.test(r)?r:null};var fg=dg;const pg=wt(),gg=(e,t)=>{try{return new pg(e,t).range||"*"}catch{return null}};var mg=gg;const vg=et,Wl=Vi(),{ANY:bg}=Wl,wg=wt(),_g=zi,$a=Wi,Ba=po,yg=mo,Eg=go,Sg=(e,t,r,n)=>{e=new vg(e,n),t=new wg(t,n);let i,s,a,l,d;switch(r){case">":i=$a,s=yg,a=Ba,l=">",d=">=";break;case"<":i=Ba,s=Eg,a=$a,l="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(_g(e,t,n))return!1;for(let h=0;h{C.semver===bg&&(C=new Wl(">=0.0.0")),R=R||C,y=y||C,i(C.semver,R.semver,n)?R=C:a(C.semver,y.semver,n)&&(y=C)}),R.operator===l||R.operator===d||(!y.operator||y.operator===l)&&s(e,y.semver))return!1;if(y.operator===d&&a(e,y.semver))return!1}return!0};var vo=Sg;const Rg=vo,Mg=(e,t,r)=>Rg(e,t,">",r);var kg=Mg;const Cg=vo,Ig=(e,t,r)=>Cg(e,t,"<",r);var xg=Ig;const Da=wt(),Ag=(e,t,r)=>(e=new Da(e,r),t=new Da(t,r),e.intersects(t,r));var Tg=Ag;const Ng=zi,Lg=bt;var Og=(e,t,r)=>{const n=[];let i=null,s=null;const a=e.sort((m,R)=>Lg(m,R,r));for(const m of a)Ng(m,t,r)?(s=m,i||(i=m)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const l=[];for(const[m,R]of n)m===R?l.push(m):!R&&m===a[0]?l.push("*"):R?m===a[0]?l.push(`<=${R}`):l.push(`${m} - ${R}`):l.push(`>=${m}`);const d=l.join(" || "),h=typeof t.raw=="string"?t.raw:String(t);return d.length{if(e===t)return!0;e=new Fa(e,r),t=new Fa(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const a=Bg(i,s,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},$g=[new bo(">=0.0.0-0")],ja=[new bo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Is){if(t.length===1&&t[0].semver===Is)return!0;r.includePrerelease?e=$g:e=ja}if(t.length===1&&t[0].semver===Is){if(r.includePrerelease)return!0;t=ja}const n=new Set;let i,s;for(const C of e)C.operator===">"||C.operator===">="?i=Ha(i,C,r):C.operator==="<"||C.operator==="<="?s=Ua(s,C,r):n.add(C.semver);if(n.size>1)return null;let a;if(i&&s){if(a=wo(i.semver,s.semver,r),a>0)return null;if(a===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const C of n){if(i&&!an(C,String(i),r)||s&&!an(C,String(s),r))return null;for(const x of t)if(!an(C,String(x),r))return!1;return!0}let l,d,h,m,R=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;R&&R.prerelease.length===1&&s.operator==="<"&&R.prerelease[0]===0&&(R=!1);for(const C of t){if(m=m||C.operator===">"||C.operator===">=",h=h||C.operator==="<"||C.operator==="<=",i){if(y&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===y.major&&C.semver.minor===y.minor&&C.semver.patch===y.patch&&(y=!1),C.operator===">"||C.operator===">="){if(l=Ha(i,C,r),l===C&&l!==i)return!1}else if(i.operator===">="&&!an(i.semver,String(C),r))return!1}if(s){if(R&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===R.major&&C.semver.minor===R.minor&&C.semver.patch===R.patch&&(R=!1),C.operator==="<"||C.operator==="<="){if(d=Ua(s,C,r),d===C&&d!==s)return!1}else if(s.operator==="<="&&!an(s.semver,String(C),r))return!1}if(!C.operator&&(s||i)&&a!==0)return!1}return!(i&&h&&!s&&a!==0||s&&m&&!i&&a!==0||y||R)},Ha=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Ua=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var Dg=Pg;const xs=Pn,Wa=Hi,Fg=et,Va=Fl,jg=sn,Hg=J1,Ug=K1,Wg=Y1,Vg=ep,zg=np,qg=op,Jg=lp,Gg=dp,Zg=bt,Kg=mp,Qg=wp,Yg=fo,Xg=Sp,em=kp,tm=Wi,rm=po,nm=jl,im=Hl,sm=go,om=mo,am=Ul,cm=Zp,lm=Vi(),um=wt(),hm=zi,dm=rg,fm=og,pm=ug,gm=fg,mm=mg,vm=vo,bm=kg,wm=xg,_m=Tg,ym=Og,Em=Dg;var Sm={parse:jg,valid:Hg,clean:Ug,inc:Wg,diff:Vg,major:zg,minor:qg,patch:Jg,prerelease:Gg,compare:Zg,rcompare:Kg,compareLoose:Qg,compareBuild:Yg,sort:Xg,rsort:em,gt:tm,lt:rm,eq:nm,neq:im,gte:sm,lte:om,cmp:am,coerce:cm,Comparator:lm,Range:um,satisfies:hm,toComparators:dm,maxSatisfying:fm,minSatisfying:pm,minVersion:gm,validRange:mm,outside:vm,gtr:bm,ltr:wm,intersects:_m,simplifyRange:ym,subset:Em,SemVer:Fg,re:xs.re,src:xs.src,tokens:xs.t,SEMVER_SPEC_VERSION:Wa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=Sm,r=br,n=Ke;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",R=>(0,t.valid)(R)===null?`Expected SemVer version, got "${R}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",R=>(0,t.validRange)(R)===null?`Expected SemVer range, got "${R}"`:!0);function i(R){return(0,r.is)(R,e.VersionStruct)}e.isValidSemVerVersion=i;function s(R){return(0,r.is)(R,e.VersionRangeStruct)}e.isValidSemVerRange=s;function a(R){(0,n.assertStruct)(R,e.VersionStruct)}e.assertIsSemVerVersion=a;function l(R){(0,n.assertStruct)(R,e.VersionRangeStruct)}e.assertIsSemVerRange=l;function d(R,y){return(0,t.gt)(R,y)}e.gtVersion=d;function h(R,y){return(0,t.gtr)(R,y)}e.gtRange=h;function m(R,y){return(0,t.satisfies)(R,y,{includePrerelease:!0})}e.satisfiesVersionRange=m})($l);(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ke,e),r(Ln,e),r(ae,e),r(Fi,e),r(Ct,e),r(Jr,e),r(xl,e),r(On,e),r(Al,e),r(Tl,e),r(Gr,e),r(Nl,e),r(It,e),r(Ll,e),r(Ol,e),r(Pl,e),r($l,e)})(ul);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ul;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")})(ll);var Vl=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.PollingBlockTracker=void 0;const Rm=Vl(ro),Mm=Vl(Xf),km=xn,za=ll,qa=(0,za.createModuleLogger)(za.projectLogger,"polling-block-tracker"),Cm=(0,Rm.default)(),Im=1e3;class xm extends km.BaseBlockTracker{constructor(t={}){var r;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(r=t.blockResetDuration)!==null&&r!==void 0?r:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*Im,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const r=Ja(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: ${(t=r.stack)!==null&&t!==void 0?t:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Ja(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:Cm(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),qa("Making request",t);const r=await(0,Mm.default)(n=>this._provider.sendAsync(t,n))();if(qa("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: ${r.error.message}`);return r.result}}Bi.PollingBlockTracker=xm;function Ja(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}var qi={},Am=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});qi.SubscribeBlockTracker=void 0;const Tm=Am(ro),Nm=xn,Lm=(0,Tm.default)();class Om extends Nm.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:Lm(),method:t,params:r,jsonrpc:"2.0"},(s,a)=>{s?i(s):n(a.result)})})}_handleSubData(t,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}qi.SubscribeBlockTracker=Om;(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Bi,e),r(qi,e)})(cl);var _o={},Ji={},$n={};Object.defineProperty($n,"__esModule",{value:!0});$n.getUniqueId=void 0;const zl=4294967295;let As=Math.floor(Math.random()*zl);function Pm(){return As=(As+1)%zl,As}$n.getUniqueId=Pm;Object.defineProperty(Ji,"__esModule",{value:!0});Ji.createIdRemapMiddleware=void 0;const $m=$n;function Bm(){return(e,t,r,n)=>{const i=e.id,s=$m.getUniqueId();e.id=s,t.id=s,r(a=>{e.id=i,t.id=i,a()})}}Ji.createIdRemapMiddleware=Bm;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.createAsyncMiddleware=void 0;function Dm(e){return async(t,r,n,i)=>{let s;const a=new Promise(m=>{s=m});let l=null,d=!1;const h=async()=>{d=!0,n(m=>{l=m,s()}),await a};try{await e(t,r,h),d?(await a,l(null)):i(null)}catch(m){l?l(m):i(m)}}}Gi.createAsyncMiddleware=Dm;var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.createScaffoldMiddleware=void 0;function Fm(e){return(t,r,n,i)=>{const s=e[t.method];return s===void 0?n():typeof s=="function"?s(t,r,n,i):(r.result=s,i())}}Zi.createScaffoldMiddleware=Fm;var Bn={},yo={};Object.defineProperty(yo,"__esModule",{value:!0});const jm=si;function Ga(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function Hm(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Ga(s,this,r);else{const a=s.length,l=Hm(s);for(let d=0;d"u"&&(n=Gl()),Hs(e,"",0,[],void 0,0,n);var i;try{ur.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var s=fr.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hr(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),fr.push([n,r,t,i])):ur.push([t,r,e]):(n[r]=e,fr.push([n,r,t]))}function Hs(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;lt?1:0}function Zl(e,t,r,n){typeof n>"u"&&(n=Gl());var i=Us(e,"",0,[],void 0,0,n)||e,s;try{ur.length===0?s=JSON.stringify(i,t,r):s=JSON.stringify(i,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var a=fr.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function Us(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;l0)for(var n=0;n=1e3&&e<=4999}function Gm(e,t){if(t!=="[Circular]")return t}var Eo={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.errorValues=Ft.errorCodes=void 0;Ft.errorCodes={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}};Ft.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Ft,r=Dt,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:a(n)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function a(y,C=i){if(Number.isInteger(y)){const x=y.toString();if(R(t.errorValues,x))return t.errorValues[x].message;if(h(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=a;function l(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||h(y))}e.isValidCode=l;function d(y,{fallbackError:C=s,shouldIncludeStack:x=!1}={}){var B,O;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const M={};if(y&&typeof y=="object"&&!Array.isArray(y)&&R(y,"code")&&l(y.code)){const N=y;M.code=N.code,N.message&&typeof N.message=="string"?(M.message=N.message,R(N,"data")&&(M.data=N.data)):(M.message=a(M.code),M.data={originalError:m(y)})}else{M.code=C.code;const N=(B=y)===null||B===void 0?void 0:B.message;M.message=N&&typeof N=="string"?N:C.message,M.data={originalError:m(y)}}const T=(O=y)===null||O===void 0?void 0:O.stack;return x&&y&&T&&typeof T=="string"&&(M.stack=T),M}e.serializeError=d;function h(y){return y>=-32099&&y<=-32e3}function m(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function R(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(Eo);var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ethErrors=void 0;const So=Dt,Yl=Eo,Qe=Ft;Ki.ethErrors={rpc:{parse:e=>lt(Qe.errorCodes.rpc.parse,e),invalidRequest:e=>lt(Qe.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lt(Qe.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lt(Qe.errorCodes.rpc.methodNotFound,e),internal:e=>lt(Qe.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return lt(t,e)},invalidInput:e=>lt(Qe.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lt(Qe.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lt(Qe.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lt(Qe.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lt(Qe.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lt(Qe.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cn(Qe.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cn(Qe.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cn(Qe.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cn(Qe.errorCodes.provider.disconnected,e),chainDisconnected:e=>cn(Qe.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new So.EthereumProviderError(t,r,n)}}};function lt(e,t){const[r,n]=Xl(t);return new So.EthereumRpcError(e,r||Yl.getMessageFromCode(e),n)}function cn(e,t){const[r,n]=Xl(t);return new So.EthereumProviderError(e,r||Yl.getMessageFromCode(e),n)}function Xl(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dt;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Eo;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ki;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Ft;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(ql);var Zm=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.JsonRpcEngine=void 0;const Km=Zm(yo),ut=ql;class At extends Km.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,n,i)=>{try{const[s,a,l]=await At._runAllMiddleware(t,r,this._middleware);return a?(await At._runReturnHandlers(l),i(s)):n(async d=>{try{await At._runReturnHandlers(l)}catch(h){return d(h)}return d()})}catch(s){return i(s)}}}async _handleBatch(t,r){try{const n=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(n,i)=>{r(i)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return r(a,{id:void 0,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return r(a,{id:t.id,jsonrpc:"2.0",error:a})}const n=Object.assign({},t),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(a){s=a}return s&&(delete i.result,i.error||(i.error=ut.serializeError(s))),r(s,i)}async _processRequest(t,r){const[n,i,s]=await At._runAllMiddleware(t,r,this._middleware);if(At._checkForCompletion(t,r,i),await At._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(t,r,n){const i=[];let s=null,a=!1;for(const l of n)if([s,a]=await At._runMiddleware(t,r,l,i),a)break;return[s,a,i.reverse()]}static _runMiddleware(t,r,n,i){return new Promise(s=>{const a=d=>{const h=d||r.error;h&&(r.error=ut.serializeError(h)),s([h,!0])},l=d=>{r.error?a(r.error):(d&&(typeof d!="function"&&a(new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof d}" for request: diff --git a/buddybook/assets/index-BnSaZ_jt.js b/buddybook/assets/index-DTOI1f4O.js similarity index 99% rename from buddybook/assets/index-BnSaZ_jt.js rename to buddybook/assets/index-DTOI1f4O.js index fe7f01e..16ee8b9 100644 --- a/buddybook/assets/index-BnSaZ_jt.js +++ b/buddybook/assets/index-DTOI1f4O.js @@ -1,2 +1,2 @@ -import{B as G,s as xe,k as A,c as $,e as K,t as X,n as et,i as tt,I as nt,b as j,d as st,f as V,h as it,j as p,l as q}from"./index-CBcRH9LY.js";const at=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class ct extends G{constructor({domain:t}){super(`Invalid domain "${xe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class ot extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class ut extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function dt(e){const{domain:t={},message:n,primaryType:s}=e,c={EIP712Domain:Et({domain:t}),...e.types};ht({domain:t,message:n,primaryType:s,types:c});const i=["0x1901"];return t&&i.push(lt({domain:t,types:c})),s!=="EIP712Domain"&&i.push(Q({data:n,primaryType:s,types:c})),A($(i))}function lt({domain:e,types:t}){return Q({data:e,primaryType:"EIP712Domain",types:t})}function Q({data:e,primaryType:t,types:n}){const s=z({data:e,primaryType:t,types:n});return A(s)}function z({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],c=[ft({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=Y({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),c.push(l)}return K(s,c)}function ft({primaryType:e,types:t}){const n=X(gt({primaryType:e,types:t}));return A(n)}function gt({primaryType:e,types:t}){let n="";const s=J({primaryType:e,types:t});s.delete(e);const c=[e,...Array.from(s).sort()];for(const i of c)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function J({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),c=s==null?void 0:s[0];if(n.has(c)||t[c]===void 0)return n;n.add(c);for(const i of t[c])J({primaryType:i.type,types:t},n);return n}function Y({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},A(z({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},A(s)];if(n==="string")return[{type:"bytes32"},A(X(s))];if(n.lastIndexOf("]")===n.length-1){const c=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>Y({name:t,type:c,types:e,value:u}));return[{type:"bytes32"},A(K(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function ht(e){const{domain:t,message:n,primaryType:s,types:c}=e,i=(u,l)=>{for(const h of u){const{name:v,type:f}=h,E=l[v],D=f.match(rt);if(D&&(typeof E=="number"||typeof E=="bigint")){const[B,S,H]=D;et(E,{signed:S==="int",size:Number.parseInt(H)/8})}if(f==="address"&&typeof E=="string"&&!tt(E))throw new nt({address:E});const w=f.match(at);if(w){const[B,S]=w;if(S&&j(E)!==Number.parseInt(S))throw new st({expectedSize:Number.parseInt(S),givenSize:j(E)})}const P=c[f];P&&(yt(f),i(P,E))}};if(c.EIP712Domain&&t){if(typeof t!="object")throw new ct({domain:t});i(c.EIP712Domain,t)}if(s!=="EIP712Domain")if(c[s])i(c[s],n);else throw new ot({primaryType:s,types:c})}function Et({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function yt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new ut({type:e})}const _t=`Ethereum Signed Message: +import{B as G,s as xe,k as A,c as $,e as K,t as X,n as et,i as tt,I as nt,b as j,d as st,f as V,h as it,j as p,l as q}from"./index-D-Yr2Iya.js";const at=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,rt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;class ct extends G{constructor({domain:t}){super(`Invalid domain "${xe(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class ot extends G{constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class ut extends G{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function dt(e){const{domain:t={},message:n,primaryType:s}=e,c={EIP712Domain:Et({domain:t}),...e.types};ht({domain:t,message:n,primaryType:s,types:c});const i=["0x1901"];return t&&i.push(lt({domain:t,types:c})),s!=="EIP712Domain"&&i.push(Q({data:n,primaryType:s,types:c})),A($(i))}function lt({domain:e,types:t}){return Q({data:e,primaryType:"EIP712Domain",types:t})}function Q({data:e,primaryType:t,types:n}){const s=z({data:e,primaryType:t,types:n});return A(s)}function z({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],c=[ft({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=Y({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),c.push(l)}return K(s,c)}function ft({primaryType:e,types:t}){const n=X(gt({primaryType:e,types:t}));return A(n)}function gt({primaryType:e,types:t}){let n="";const s=J({primaryType:e,types:t});s.delete(e);const c=[e,...Array.from(s).sort()];for(const i of c)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function J({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),c=s==null?void 0:s[0];if(n.has(c)||t[c]===void 0)return n;n.add(c);for(const i of t[c])J({primaryType:i.type,types:t},n);return n}function Y({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},A(z({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},A(s)];if(n==="string")return[{type:"bytes32"},A(X(s))];if(n.lastIndexOf("]")===n.length-1){const c=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>Y({name:t,type:c,types:e,value:u}));return[{type:"bytes32"},A(K(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function ht(e){const{domain:t,message:n,primaryType:s,types:c}=e,i=(u,l)=>{for(const h of u){const{name:v,type:f}=h,E=l[v],D=f.match(rt);if(D&&(typeof E=="number"||typeof E=="bigint")){const[B,S,H]=D;et(E,{signed:S==="int",size:Number.parseInt(H)/8})}if(f==="address"&&typeof E=="string"&&!tt(E))throw new nt({address:E});const w=f.match(at);if(w){const[B,S]=w;if(S&&j(E)!==Number.parseInt(S))throw new st({expectedSize:Number.parseInt(S),givenSize:j(E)})}const P=c[f];P&&(yt(f),i(P,E))}};if(c.EIP712Domain&&t){if(typeof t!="object")throw new ct({domain:t});i(c.EIP712Domain,t)}if(s!=="EIP712Domain")if(c[s])i(c[s],n);else throw new ot({primaryType:s,types:c})}function Et({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function yt(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new ut({type:e})}const _t=`Ethereum Signed Message: `;function Tt(e){const t=typeof e=="string"?V(e):typeof e.raw=="string"?e.raw:it(e.raw),n=V(`${_t}${j(t)}`);return $([n,t])}function vt(e,t){return A(Tt(e),t)}const Z=()=>"9.1.0",It=e=>e.toString(16).padStart(2,"0"),mt=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,It).join("")},At=()=>typeof window<"u"?mt(10):new Date().getTime().toString(36);class C{}C.makeRequest=(e,t)=>({id:At(),method:e,params:t,env:{sdkVersion:Z()}});C.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t});C.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var g;(function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"})(g||(g={}));var R;(function(e){e.requestAddressBook="requestAddressBook"})(R||(R={}));class St{constructor(t=null,n=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:c,source:i})=>{const u=!c,l=!this.isServer&&i===window.parent,h=typeof c.version<"u"&&parseInt(c.version.split(".")[0]),v=typeof h=="number"&&h>=1;let f=!0;return Array.isArray(this.allowedOrigins)&&(f=this.allowedOrigins.find(E=>E.test(s))!==void 0),!u&&l&&v&&f},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:c}=s,i=this.callbacks.get(c);i&&(i(s),this.callbacks.delete(c))},this.send=(s,c)=>{const i=C.makeRequest(s,c);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((u,l)=>{this.callbacks.set(i.id,h=>{if(!h.success){l(new Error(h.error));return}u(h)})})},this.allowedOrigins=t,this.debugMode=n,this.isServer||window.addEventListener("message",this.onParentMessage)}}const W=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var b={},_={},T={},k=p&&p.__awaiter||function(e,t,n,s){function c(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function l(f){try{v(s.next(f))}catch(E){u(E)}}function h(f){try{v(s.throw(f))}catch(E){u(E)}}function v(f){f.done?i(f.value):c(f.value).then(l,h)}v((s=s.apply(e,t||[])).next())})};Object.defineProperty(T,"__esModule",{value:!0});T.getData=T.fetchData=T.stringifyQuery=T.insertParams=void 0;const Ot=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function pt(e,t,n){return e.replace(new RegExp(`\\{${t}\\}`,"g"),n)}function bt(e,t){return t?Object.keys(t).reduce((n,s)=>pt(n,s,String(t[s])),e):e}T.insertParams=bt;function Nt(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach(s=>{e[s]!=null&&t.append(s,String(e[s]))});const n=t.toString();return n?`?${n}`:""}T.stringifyQuery=Nt;function x(e){return k(this,void 0,void 0,function*(){let t;try{t=yield e.json()}catch{t={}}if(!e.ok){const n=Ot(t)?`CGW error - ${t.code}: ${t.message}`:`CGW error - status ${e.statusText}`;throw new Error(n)}return t})}function Ct(e,t,n,s,c){return k(this,void 0,void 0,function*(){const i=Object.assign({"Content-Type":"application/json"},s),u={method:t??"POST",headers:i};c&&(u.credentials=c),n!=null&&(u.body=typeof n=="string"?n:JSON.stringify(n));const l=yield fetch(e,u);return x(l)})}T.fetchData=Ct;function Dt(e,t,n){return k(this,void 0,void 0,function*(){const s={method:"GET"};t&&(s.headers=Object.assign(Object.assign({},t),{"Content-Type":"application/json"})),n&&(s.credentials=n);const c=yield fetch(e,s);return x(c)})}T.getData=Dt;Object.defineProperty(_,"__esModule",{value:!0});_.getEndpoint=_.deleteEndpoint=_.putEndpoint=_.postEndpoint=void 0;const O=T;function M(e,t,n,s){const c=(0,O.insertParams)(t,n),i=(0,O.stringifyQuery)(s);return`${e}${c}${i}`}function wt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"POST",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.postEndpoint=wt;function Pt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"PUT",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.putEndpoint=Pt;function Rt(e,t,n){const s=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"DELETE",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.deleteEndpoint=Rt;function Mt(e,t,n,s){if(s)return(0,O.getData)(s,void 0,n==null?void 0:n.credentials);const c=M(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.getData)(c,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.getEndpoint=Mt;var L={};Object.defineProperty(L,"__esModule",{value:!0});L.DEFAULT_BASE_URL=void 0;L.DEFAULT_BASE_URL="https://safe-client.safe.global";var ee={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(t){t.UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(ee);var te={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(t){t.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(t){t.TWITTER="TWITTER",t.GITHUB="GITHUB",t.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(te);var ne={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.StartTimeValue=e.DurationType=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(t){t.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",t.ADD_OWNER="ADD_OWNER",t.REMOVE_OWNER="REMOVE_OWNER",t.SWAP_OWNER="SWAP_OWNER",t.CHANGE_THRESHOLD="CHANGE_THRESHOLD",t.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",t.ENABLE_MODULE="ENABLE_MODULE",t.DISABLE_MODULE="DISABLE_MODULE",t.SET_GUARD="SET_GUARD",t.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(t){t.TRANSFER="Transfer",t.SETTINGS_CHANGE="SettingsChange",t.CUSTOM="Custom",t.CREATION="Creation",t.SWAP_ORDER="SwapOrder",t.TWAP_ORDER="TwapOrder",t.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(t){t.NONE="None",t.HAS_NEXT="HasNext",t.END="End"}(e.ConflictType||(e.ConflictType={})),function(t){t.TRANSACTION="TRANSACTION",t.LABEL="LABEL",t.CONFLICT_HEADER="CONFLICT_HEADER",t.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(t){t.MULTISIG="MULTISIG",t.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(t){t.AUTO="AUTO",t.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(t){t.AT_MINING_TIME="AT_MINING_TIME",t.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(t){t.Queued="Queued",t.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(ne);var se={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.FIXED_1559="FIXED1559",t.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",t.TX_SIMULATION="TX_SIMULATION",t.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(se);var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ie);var ae={};Object.defineProperty(ae,"__esModule",{value:!0});var re={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(t){t.COW_SWAP_ORDER="COW_SWAP_ORDER",t.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(re);var ce={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(t){t.DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(t){t.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",t.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(ce);var oe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(t){t.ANDROID="ANDROID",t.IOS="IOS",t.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(oe);var ue={};Object.defineProperty(ue,"__esModule",{value:!0});(function(e){var t=p&&p.__createBinding||(Object.create?function(a,r,o,d){d===void 0&&(d=o);var m=Object.getOwnPropertyDescriptor(r,o);(!m||("get"in m?!r.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return r[o]}}),Object.defineProperty(a,d,m)}:function(a,r,o,d){d===void 0&&(d=o),a[d]=r[o]}),n=p&&p.__exportStar||function(a,r){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(r,o)&&t(r,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.deleteAccount=e.getAccount=e.createAccount=e.verifyAuth=e.getAuthNonce=e.getContract=e.getSafeOverviews=e.unsubscribeAll=e.unsubscribeSingle=e.registerRecoveryModule=e.deleteRegisteredEmail=e.getRegisteredEmail=e.verifyEmail=e.resendEmailVerificationCode=e.changeEmail=e.registerEmail=e.unregisterDevice=e.unregisterSafe=e.registerDevice=e.getDelegates=e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.getConfirmationView=e.proposeTransaction=e.getNonces=e.postSafeGasEstimation=e.deleteTransaction=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getAllOwnedSafes=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.getRelayCount=e.relayTransaction=e.setBaseUrl=void 0,e.putAccountDataSettings=e.getAccountDataSettings=e.getAccountDataTypes=void 0;const s=_,c=L;n(ee,e),n(te,e),n(ne,e),n(se,e),n(ie,e),n(ae,e),n(re,e),n(ce,e),n(oe,e),n(ue,e);let i=c.DEFAULT_BASE_URL;const u=a=>{i=a};e.setBaseUrl=u;function l(a,r){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:r})}e.relayTransaction=l;function h(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:r}})}e.getRelayCount=h;function v(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:r}})}e.getSafeInfo=v;function f(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:r},query:o},d)}e.getIncomingTransfers=f;function E(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:r},query:o},d)}e.getModuleTransactions=E;function D(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:r},query:o},d)}e.getMultisigTransactions=D;function w(a,r,o="usd",d={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:r,currency:o},query:d})}e.getBalances=w;function P(){return(0,s.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=P;function B(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:r}})}e.getOwnedSafes=B;function S(a){return(0,s.getEndpoint)(i,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=S;function H(a,r,o={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:r},query:o})}e.getCollectibles=H;function fe(a,r,o={},d){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:r},query:o},d)}e.getCollectiblesPage=fe;function ge(a,r,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:r},query:o},d)}e.getTransactionHistory=ge;function he(a,r,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:r},query:o},d)}e.getTransactionQueue=he;function Ee(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:r}})}e.getTransactionDetails=Ee;function ye(a,r,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:r},body:{signature:o}})}e.deleteTransaction=ye;function _e(a,r,o){return(0,s.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:r},body:o})}e.postSafeGasEstimation=_e;function Te(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:r}})}e.getNonces=Te;function ve(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:r},body:o})}e.proposeTransaction=ve;function Ie(a,r,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:r},body:{data:o,to:d}})}e.getConfirmationView=Ie;function me(a){return(0,s.getEndpoint)(i,"/v1/chains",{query:a})}e.getChainsConfig=me;function Ae(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=Ae;function Se(a,r={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:r})}e.getSafeApps=Se;function Oe(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=Oe;function pe(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:r,to:o}})}e.getDecodedData=pe;function be(a,r,o){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:r},query:{}},o)}e.getSafeMessages=be;function Ne(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:r}})}e.getSafeMessage=Ne;function Ce(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:r},body:o})}e.proposeSafeMessage=Ce;function De(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:r},body:o})}e.confirmSafeMessage=De;function we(a,r={}){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:r})}e.getDelegates=we;function Pe(a){return(0,s.postEndpoint)(i,"/v1/register/notifications",{body:a})}e.registerDevice=Pe;function Re(a,r,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:r,uuid:o}})}e.unregisterSafe=Re;function Me(a,r){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:r}})}e.unregisterDevice=Me;function Le(a,r,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:r},body:o,headers:d})}e.registerEmail=Le;function Be(a,r,o,d,m){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},body:d,headers:m})}e.changeEmail=Be;function He(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:r,signer:o},body:""})}e.resendEmailVerificationCode=He;function je(a,r,o,d){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:r,signer:o},body:d})}e.verifyEmail=je;function Ue(a,r,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},headers:d})}e.getRegisteredEmail=Ue;function Ge(a,r,o,d){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:r,signer:o},headers:d})}e.deleteRegisteredEmail=Ge;function We(a,r,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:r},body:o})}e.registerRecoveryModule=We;function ke(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=ke;function Ve(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=Ve;function qe(a,r){return(0,s.getEndpoint)(i,"/v1/safes",{query:Object.assign(Object.assign({},r),{safes:a.join(",")})})}e.getSafeOverviews=qe;function Fe(a,r){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:r}})}e.getContract=Fe;function $e(){return(0,s.getEndpoint)(i,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=$e;function Ke(a){return(0,s.postEndpoint)(i,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Ke;function Xe(a){return(0,s.postEndpoint)(i,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=Xe;function Qe(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Qe;function ze(a){return(0,s.deleteEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=ze;function Je(){return(0,s.getEndpoint)(i,"/v1/accounts/data-types")}e.getAccountDataTypes=Je;function Ye(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=Ye;function Ze(a,r){return(0,s.putEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},body:r,credentials:"include"})}e.putAccountDataSettings=Ze})(b);class Lt{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(g.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const n={message:t};return(await this.communicator.send(g.signMessage,n)).data}async signTypedMessage(t){if(!W(t))throw new Error("Invalid typed data");return(await this.communicator.send(g.signTypedMessage,{typedData:t})).data}async send({txs:t,params:n}){if(!t||!t.length)throw new Error("No transactions were passed");const s={txs:t,params:n};return(await this.communicator.send(g.sendTransactions,s)).data}}const y={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},I={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class Bt{constructor(t){this.communicator=t,this.call=this.buildRequest({call:y.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:y.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:y.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:y.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:y.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:y.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:y.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:y.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:y.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:y.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:y.eth_gasPrice}),this.getEstimateGas=n=>this.buildRequest({call:y.eth_estimateGas})([n]),this.setSafeSettings=this.buildRequest({call:y.safe_setSettings})}buildRequest(t){const{call:n,formatters:s}=t;return async c=>{s&&Array.isArray(c)&&s.forEach((l,h)=>{l&&(c[h]=l(c[h]))});const i={call:n,params:c||[]};return(await this.communicator.send(g.rpcCall,i)).data}}}const Ht="0x1626ba7e",jt="0x20c13b0b",U=4001;class N extends Error{constructor(t,n,s){super(t),this.code=n,this.data=s,Object.setPrototypeOf(this,N.prototype)}}class de{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(g.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new N("Permissions request is invalid",U);try{return(await this.communicator.send(g.wallet_requestPermissions,t)).data}catch{throw new N("Permissions rejected",U)}}isPermissionRequestValid(t){return t.every(n=>typeof n=="object"?Object.keys(n).every(s=>!!Object.values(R).includes(s)):!1)}}const F=(e,t)=>t.some(n=>n.parentCapability===e),Ut=()=>(e,t,n)=>{const s=n.value;return n.value=async function(){const c=new de(this.communicator);let i=await c.getPermissions();if(F(t,i)||(i=await c.requestPermissions([{[t]:{}}])),!F(t,i))throw new N("Permissions rejected",U);return s.apply(this)},n};var Gt=function(e,t,n,s){var c=arguments.length,i=c<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(i=(c<3?u(i):c>3?u(t,n,i):u(t,n))||i);return c>3&&i&&Object.defineProperty(t,n,i),i};class le{constructor(t){this.communicator=t}async getChainInfo(){return(await this.communicator.send(g.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(g.getSafeInfo,void 0)).data}async experimental_getBalances({currency:t="usd"}={}){return(await this.communicator.send(g.getSafeBalances,{currency:t})).data}async check1271Signature(t,n="0x"){const s=await this.getInfo(),c=q({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()===Ht}catch{return!1}}async check1271SignatureBytes(t,n="0x"){const s=await this.getInfo(),c=q({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:c},"latest"]};try{return(await this.communicator.send(g.rpcCall,i)).data.slice(0,10).toLowerCase()===jt}catch{return!1}}calculateMessageHash(t){return vt(t)}calculateTypedMessageHash(t){const n=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let s=t.primaryType;if(!s){const c=Object.values(t.types),i=Object.keys(t.types).filter(u=>c.every(l=>l.every(({type:h})=>h.replace("[","").replace("]","")!==u)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");s=i[0]}return dt({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:s})}async getOffChainSignature(t){return(await this.communicator.send(g.getOffChainSignature,t)).data}async isMessageSigned(t,n="0x"){let s;if(typeof t=="string"&&(s=async()=>{const c=this.calculateMessageHash(t);return await this.isMessageHashSigned(c,n)}),W(t)&&(s=async()=>{const c=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(c,n)}),s)return await s();throw new Error("Invalid message type")}async isMessageHashSigned(t,n="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const c of s)if(await c(t,n))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(g.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(g.requestAddressBook,void 0)).data}}Gt([Ut()],le.prototype,"requestAddressBook",null);class Wt{constructor(t={}){const{allowedDomains:n=null,debug:s=!1}=t;this.communicator=new St(n,s),this.eth=new Bt(this.communicator),this.txs=new Lt(this.communicator),this.safe=new le(this.communicator),this.wallet=new de(this.communicator)}}const Vt=Object.freeze(Object.defineProperty({__proto__:null,MessageFormatter:C,get Methods(){return g},Operation:b.Operation,RPC_CALLS:y,get RestrictedMethods(){return R},TokenType:b.TokenType,TransactionStatus:b.TransactionStatus,TransferDirection:b.TransferDirection,default:Wt,getSDKVersion:Z,isObjectEIP712TypedData:W},Symbol.toStringTag,{value:"Module"}));export{Vt as e}; diff --git a/buddybook/assets/index-BLeCt1zy.js b/buddybook/assets/index-DwTiVe8d.js similarity index 99% rename from buddybook/assets/index-BLeCt1zy.js rename to buddybook/assets/index-DwTiVe8d.js index 42e474c..850aafe 100644 --- a/buddybook/assets/index-BLeCt1zy.js +++ b/buddybook/assets/index-DwTiVe8d.js @@ -1,4 +1,4 @@ -import{T as $t,M as re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-3RtEhhzm.js";import{C as Wo}from"./index-CBcRH9LY.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** +import{T as $t,M as re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-BhMsHqT3.js";import{C as Wo}from"./index-D-Yr2Iya.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/buddybook/assets/index-9j2nEnjI.js b/buddybook/assets/index-DyOq0GRj.js similarity index 99% rename from buddybook/assets/index-9j2nEnjI.js rename to buddybook/assets/index-DyOq0GRj.js index c676061..98db010 100644 --- a/buddybook/assets/index-9j2nEnjI.js +++ b/buddybook/assets/index-DyOq0GRj.js @@ -1,3 +1,3 @@ -import{g as rt,m as at,a as ot,o as ct,p as dt,E as lt}from"./index-CBcRH9LY.js";import{B as Y,_ as h,h as ae,y as ht}from"./hooks.module-D0gf0yJl.js";const ut=(t,e)=>{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",pt="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return pt}return e}function ft(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function gt(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&ft(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.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 <= -32005');return b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.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:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!mt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function mt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),wt=se(),bt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return bt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function yt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=yt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return wt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||kt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function vt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function kt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function Et(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Ct(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function It(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function St(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function Mt(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function xt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return St(e,s)}async function At(t,e){return JSON.parse(await Mt(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class _t{constructor(){this.storage=new v("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($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Ct();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await It(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.3",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function Lt(){return globalThis.coinbaseWalletExtension}function Pt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=Lt();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Pt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.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 l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Nt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new _t,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(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 A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_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 l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await xt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await At(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Tt=rt(at),{keccak_256:Dt}=Tt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Ot(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function Ht(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Kt(t){return t.lastIndexOf("]")===t.length-1}function Vt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);Ht(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function zt(t,e){return w.keccak(Fe(t,e))}var Zt={rawEncode:Vt,solidityPack:Fe,soliditySHA3:zt};const y=Ve,U=Zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var Ft={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return $t(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function $t(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const q=ot(Ft),Gt="walletUsername",ee="Addresses",Yt="AppVersion";function m(t){return t.errorMessage!==void 0}class Jt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Qt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Xt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,es=6e4;class ts{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Gt,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated(Yt,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Jt(e.secret),this.listener=n;const i=new Xt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Qt(s,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:I(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 s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}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()).forEach(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:es}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class ss{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ct(dt(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ns(){try{return window.frameElement!==null}catch{return!1}}function is(){try{return ns()&&window.top?window.top.location:window.location}catch{return window.location}}function rs(){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 Ge(){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 as='@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 Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(as)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(hs,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,os),h("div",{class:"-cbwsdk-snackbar"},t.children)),hs=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);ht(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:cs,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:ds,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class us{constructor(){this.attached=!1,this.snackbar=new ls}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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}]}:s={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(s)}}const ps=".-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}.-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 fs{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(gs,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const gs=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,ps),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},ms="https://keys.coinbase.com/connect",be="https://www.walletlink.org",ws="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new fs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(ws);s.searchParams.append("redirect_url",is().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.href,n.rel="noreferrer noopener",n.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 S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=rs(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.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:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new ss,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new ts({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new us;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)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 s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=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 A(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(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);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(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:vt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function bs(){return tt.getItem(et)}function ys(t){tt.setItem(et,t)}async function vs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;Es(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ks(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Nt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function Es(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const Cs=`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. +import{g as rt,m as at,a as ot,o as ct,p as dt,E as lt}from"./index-D-Yr2Iya.js";import{B as Y,_ as h,h as ae,y as ht}from"./hooks.module-D0gf0yJl.js";const ut=(t,e)=>{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",pt="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return pt}return e}function ft(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function gt(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&ft(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.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 <= -32005');return b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.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:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!mt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function mt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),wt=se(),bt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return bt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function yt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=yt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return wt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||kt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function vt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function kt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function Et(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Ct(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function It(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function St(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function Mt(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function xt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return St(e,s)}async function At(t,e){return JSON.parse(await Mt(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class _t{constructor(){this.storage=new v("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($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Ct();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await It(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.3",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function Lt(){return globalThis.coinbaseWalletExtension}function Pt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=Lt();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Pt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.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 l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Nt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new _t,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(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 A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_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 l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await xt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await At(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Tt=rt(at),{keccak_256:Dt}=Tt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Ot(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function Ht(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Kt(t){return t.lastIndexOf("]")===t.length-1}function Vt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);Ht(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function zt(t,e){return w.keccak(Fe(t,e))}var Zt={rawEncode:Vt,solidityPack:Fe,soliditySHA3:zt};const y=Ve,U=Zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var Ft={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return $t(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function $t(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const q=ot(Ft),Gt="walletUsername",ee="Addresses",Yt="AppVersion";function m(t){return t.errorMessage!==void 0}class Jt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Qt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Xt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,es=6e4;class ts{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Gt,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated(Yt,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Jt(e.secret),this.listener=n;const i=new Xt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Qt(s,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:I(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 s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}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()).forEach(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:es}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class ss{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ct(dt(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ns(){try{return window.frameElement!==null}catch{return!1}}function is(){try{return ns()&&window.top?window.top.location:window.location}catch{return window.location}}function rs(){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 Ge(){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 as='@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 Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(as)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(hs,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,os),h("div",{class:"-cbwsdk-snackbar"},t.children)),hs=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);ht(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:cs,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:ds,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class us{constructor(){this.attached=!1,this.snackbar=new ls}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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}]}:s={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(s)}}const ps=".-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}.-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 fs{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(gs,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const gs=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,ps),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},ms="https://keys.coinbase.com/connect",be="https://www.walletlink.org",ws="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new fs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(ws);s.searchParams.append("redirect_url",is().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.href,n.rel="noreferrer noopener",n.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 S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=rs(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.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:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new ss,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new ts({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new us;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)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 s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=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 A(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(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);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(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:vt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function bs(){return tt.getItem(et)}function ys(t){tt.setItem(et,t)}async function vs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;Es(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ks(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Nt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function Es(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const Cs=`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. Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Is=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,s=await fetch(e,{method:"HEAD"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=s.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(Cs)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:st,getCrossOriginOpenerPolicy:Ss}=Is(),Ee=420,Ce=540;function Ms(t){const e=(window.innerWidth-Ee)/2+window.screenX,s=(window.innerHeight-Ce)/2+window.screenY;As(t);const n=window.open(t,"Smart Wallet",`width=${Ee}, height=${Ce}, left=${e}, top=${s}`);if(n==null||n.focus(),!n)throw l.rpc.internal("Pop up window failed to open");return n}function xs(t){t&&!t.closed&&t.close()}function As(t){const e={sdkName:Oe,sdkVersion:T,origin:window.location.origin,coop:Ss()};for(const[s,n]of Object.entries(e))t.searchParams.append(s,n.toString())}class _s{constructor({url:e=ms,metadata:s,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const r=this.onMessage(({requestId:a})=>a===i.id);return this.postMessage(i),await r},this.onMessage=async i=>new Promise((r,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const d=c.data;i(d)&&(r(d),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{xs(this.popup),this.popup=null,this.listeners.forEach(({reject:i},r)=>{i(l.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=Ms(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:T,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw l.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=s,this.preference=n}}function Ls(t){const e=gt(Ps(t),{shouldIncludeStack:!0}),s=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return s.searchParams.set("version",T),s.searchParams.set("code",e.code.toString()),s.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:s.href})}function Ps(t){var e;if(typeof t=="string")return{message:t,code:u.rpc.internal};if(m(t)){const s=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:s.match(/(denied|rejected)/i)?u.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:s,code:n,data:{method:t.method}})}return t}class Rs extends lt{}var Ns=function(t,e){var s={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i(i||(i=Ts(n)),i)}}export{Us as CoinbaseWalletSDK,Ws as createCoinbaseWalletSDK,Us as default}; diff --git a/buddybook/assets/index-BeN-aFbA.js b/buddybook/assets/index-IqLj3ThH.js similarity index 97% rename from buddybook/assets/index-BeN-aFbA.js rename to buddybook/assets/index-IqLj3ThH.js index 355471f..242f8ef 100644 --- a/buddybook/assets/index-BeN-aFbA.js +++ b/buddybook/assets/index-IqLj3ThH.js @@ -1 +1 @@ -import{g as v,a as S}from"./index-CBcRH9LY.js";import{e as C}from"./index-BnSaZ_jt.js";import{e as H}from"./events-DT22ZwC4.js";function y(r,n){for(var i=0;ie[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var x={},p={};const I=v(C);var f={};Object.defineProperty(f,"__esModule",{value:!0});f.numberToHex=f.getLowerCase=void 0;function E(r){return r&&r.toLowerCase()}f.getLowerCase=E;function A(r){return`0x${r.toString(16)}`}f.numberToHex=A;Object.defineProperty(p,"__esModule",{value:!0});p.SafeAppProvider=void 0;const l=I,N=H,o=f;class P extends N.EventEmitter{constructor(n,i){super(),this.submittedTxs=new Map,this.safe=n,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(n){var d,u,w,T;const{method:i,params:e=[]}=n;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return(0,o.numberToHex)(this.chainId);case"personal_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(s);return("signature"in a?a.signature:void 0)||"0x"}case"eth_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(t);return("signature"in a?a.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[s,t]=e,a=typeof t=="string"?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase())throw new Error("The address is invalid");const h=await this.sdk.txs.signTypedMessage(a);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sendTransaction":const c={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof c.gas=="string"&&c.gas.startsWith("0x")&&(c.gas=parseInt(c.gas,16));const m=await this.sdk.txs.send({txs:[c],params:{safeTxGas:c.gas}});return this.submittedTxs.set(m.safeTxHash,{from:this.safe.safeAddress,hash:m.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:c.data,value:c.value,to:c.to,blockHash:null,blockNumber:null,transactionIndex:null}),m.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,o.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let g=e[0];try{g=(await this.sdk.txs.getBySafeTxHash(g)).txHash||g}catch{}return this.submittedTxs.has(g)?this.submittedTxs.get(g):this.sdk.eth.getTransactionByHash([g]).then(s=>(s&&(s.hash=e[0]),s));case"eth_getTransactionReceipt":{let s=e[0];try{s=(await this.sdk.txs.getBySafeTxHash(s)).txHash||s}catch{}return this.sdk.eth.getTransactionReceipt([s]).then(t=>(t&&(t.transactionHash=e[0]),t))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);case"wallet_sendCalls":{if(e[0].from!==this.safe.safeAddress)throw Error("Invalid from address");const s=e[0].calls.map((a,h)=>{if(a.chainId!==(0,o.numberToHex)(this.chainId))throw new Error(`Invalid call #${h}: Safe is not on chain ${a.chainId}`);if(!a.to)throw new Error(`Invalid call #${h}: missing "to" field`);return{to:a.to,data:a.data??"0x",value:a.value??(0,o.numberToHex)(0)}}),{safeTxHash:t}=await this.sdk.txs.send({txs:s});return t}case"wallet_getCallsStatus":{const s={[l.TransactionStatus.AWAITING_CONFIRMATIONS]:"PENDING",[l.TransactionStatus.AWAITING_EXECUTION]:"PENDING",[l.TransactionStatus.CANCELLED]:"CONFIRMED",[l.TransactionStatus.FAILED]:"CONFIRMED",[l.TransactionStatus.SUCCESS]:"CONFIRMED"},t=await this.sdk.txs.getBySafeTxHash(e[0]).catch(()=>null);if(!(t!=null&&t.txHash))throw new Error("Transaction not found");const a=await this.sdk.eth.getTransactionReceipt([t.txHash]).catch(()=>null);if(!a)throw new Error("Transaction receipt not found");const h=((u=(d=t.txData)==null?void 0:d.dataDecoded)==null?void 0:u.method)!=="multiSend"?1:((T=(w=t.txData.dataDecoded.parameters)==null?void 0:w[0].valueDecoded)==null?void 0:T.length)??1,_=Number(a.blockNumber),b=Number(a.gasUsed),k=Array(h).fill({success:(0,o.numberToHex)(t.txStatus===l.TransactionStatus.SUCCESS?1:0),blockHash:a.blockHash,blockNumber:(0,o.numberToHex)(_),blockTimestamp:(0,o.numberToHex)(t.executedAt??0),gasUsed:(0,o.numberToHex)(b),transactionHash:t.txHash,logs:a.logs});return{status:s[t.txStatus],receipts:k}}case"wallet_showCallsStatus":throw new Error(`"${n.method}" not supported`);case"wallet_getCapabilities":return{[(0,o.numberToHex)(this.chainId)]:{atomicBatch:{supported:!0}}};default:throw Error(`"${n.method}" not implemented`)}}send(n,i){n||i("Undefined request"),this.request(n).then(e=>i(null,{jsonrpc:"2.0",id:n.id,result:e})).catch(e=>i(e,null))}}p.SafeAppProvider=P;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.SafeAppProvider=void 0;var n=p;Object.defineProperty(r,"SafeAppProvider",{enumerable:!0,get:function(){return n.SafeAppProvider}})})(x);const L=S(x),j=y({__proto__:null,default:L},[x]);export{j as i}; +import{g as v,a as S}from"./index-D-Yr2Iya.js";import{e as C}from"./index-DTOI1f4O.js";import{e as H}from"./events-2fANA2U5.js";function y(r,n){for(var i=0;ie[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var x={},p={};const I=v(C);var f={};Object.defineProperty(f,"__esModule",{value:!0});f.numberToHex=f.getLowerCase=void 0;function E(r){return r&&r.toLowerCase()}f.getLowerCase=E;function A(r){return`0x${r.toString(16)}`}f.numberToHex=A;Object.defineProperty(p,"__esModule",{value:!0});p.SafeAppProvider=void 0;const l=I,N=H,o=f;class P extends N.EventEmitter{constructor(n,i){super(),this.submittedTxs=new Map,this.safe=n,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(n){var d,u,w,T;const{method:i,params:e=[]}=n;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return(0,o.numberToHex)(this.chainId);case"personal_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(s);return("signature"in a?a.signature:void 0)||"0x"}case"eth_sign":{const[s,t]=e;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase()||!t.startsWith("0x"))throw new Error("The address or message hash is invalid");const a=await this.sdk.txs.signMessage(t);return("signature"in a?a.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[s,t]=e,a=typeof t=="string"?JSON.parse(t):t;if(this.safe.safeAddress.toLowerCase()!==s.toLowerCase())throw new Error("The address is invalid");const h=await this.sdk.txs.signTypedMessage(a);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sendTransaction":const c={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof c.gas=="string"&&c.gas.startsWith("0x")&&(c.gas=parseInt(c.gas,16));const m=await this.sdk.txs.send({txs:[c],params:{safeTxGas:c.gas}});return this.submittedTxs.set(m.safeTxHash,{from:this.safe.safeAddress,hash:m.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:c.data,value:c.value,to:c.to,blockHash:null,blockNumber:null,transactionIndex:null}),m.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,o.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,o.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let g=e[0];try{g=(await this.sdk.txs.getBySafeTxHash(g)).txHash||g}catch{}return this.submittedTxs.has(g)?this.submittedTxs.get(g):this.sdk.eth.getTransactionByHash([g]).then(s=>(s&&(s.hash=e[0]),s));case"eth_getTransactionReceipt":{let s=e[0];try{s=(await this.sdk.txs.getBySafeTxHash(s)).txHash||s}catch{}return this.sdk.eth.getTransactionReceipt([s]).then(t=>(t&&(t.transactionHash=e[0]),t))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);case"wallet_sendCalls":{if(e[0].from!==this.safe.safeAddress)throw Error("Invalid from address");const s=e[0].calls.map((a,h)=>{if(a.chainId!==(0,o.numberToHex)(this.chainId))throw new Error(`Invalid call #${h}: Safe is not on chain ${a.chainId}`);if(!a.to)throw new Error(`Invalid call #${h}: missing "to" field`);return{to:a.to,data:a.data??"0x",value:a.value??(0,o.numberToHex)(0)}}),{safeTxHash:t}=await this.sdk.txs.send({txs:s});return t}case"wallet_getCallsStatus":{const s={[l.TransactionStatus.AWAITING_CONFIRMATIONS]:"PENDING",[l.TransactionStatus.AWAITING_EXECUTION]:"PENDING",[l.TransactionStatus.CANCELLED]:"CONFIRMED",[l.TransactionStatus.FAILED]:"CONFIRMED",[l.TransactionStatus.SUCCESS]:"CONFIRMED"},t=await this.sdk.txs.getBySafeTxHash(e[0]).catch(()=>null);if(!(t!=null&&t.txHash))throw new Error("Transaction not found");const a=await this.sdk.eth.getTransactionReceipt([t.txHash]).catch(()=>null);if(!a)throw new Error("Transaction receipt not found");const h=((u=(d=t.txData)==null?void 0:d.dataDecoded)==null?void 0:u.method)!=="multiSend"?1:((T=(w=t.txData.dataDecoded.parameters)==null?void 0:w[0].valueDecoded)==null?void 0:T.length)??1,_=Number(a.blockNumber),b=Number(a.gasUsed),k=Array(h).fill({success:(0,o.numberToHex)(t.txStatus===l.TransactionStatus.SUCCESS?1:0),blockHash:a.blockHash,blockNumber:(0,o.numberToHex)(_),blockTimestamp:(0,o.numberToHex)(t.executedAt??0),gasUsed:(0,o.numberToHex)(b),transactionHash:t.txHash,logs:a.logs});return{status:s[t.txStatus],receipts:k}}case"wallet_showCallsStatus":throw new Error(`"${n.method}" not supported`);case"wallet_getCapabilities":return{[(0,o.numberToHex)(this.chainId)]:{atomicBatch:{supported:!0}}};default:throw Error(`"${n.method}" not implemented`)}}send(n,i){n||i("Undefined request"),this.request(n).then(e=>i(null,{jsonrpc:"2.0",id:n.id,result:e})).catch(e=>i(e,null))}}p.SafeAppProvider=P;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.SafeAppProvider=void 0;var n=p;Object.defineProperty(r,"SafeAppProvider",{enumerable:!0,get:function(){return n.SafeAppProvider}})})(x);const L=S(x),j=y({__proto__:null,default:L},[x]);export{j as i}; diff --git a/buddybook/assets/index.es-CRyabuk4.js b/buddybook/assets/index.es-1pglYqns.js similarity index 99% rename from buddybook/assets/index.es-CRyabuk4.js rename to buddybook/assets/index.es-1pglYqns.js index f766f39..5519fd4 100644 --- a/buddybook/assets/index.es-CRyabuk4.js +++ b/buddybook/assets/index.es-1pglYqns.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-3RtEhhzm.js","assets/index-CBcRH9LY.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); -import{g as tv,j as rv,v as w4,a as Fd,_ as _4}from"./index-CBcRH9LY.js";import{e as Vi,J as zd}from"./events-DT22ZwC4.js";import{r as jd,i as Of}from"./inherits_browser-BKdA78FI.js";var Ae={};/*! ***************************************************************************** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BhMsHqT3.js","assets/index-D-Yr2Iya.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{g as tv,j as rv,v as w4,a as Fd,_ as _4}from"./index-D-Yr2Iya.js";import{e as Vi,J as zd}from"./events-2fANA2U5.js";import{r as jd,i as Of}from"./inherits_browser-CgLO5vwk.js";var Ae={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -67,4 +67,4 @@ __p += '`),Tt&&(ge+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ge+`return __p -}`;var wt=m1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,sl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return M0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=I0(A,T),Q=C0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,O0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=C0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if($a(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-Ua(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),al(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=Dh(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=Ha(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),ul=yp("toUpperCase");function v1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var m1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return sl(l)?l:new dt(l)}}),B5=rs(function(s,o){return Pi(o,function(l){l=An(l),es(s,l,il(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=yh(A,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(b)},Dn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:$u,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=cu[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),Dn(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(za,A)||(za[A]=[]),za[A].push({name:o,func:l})}}),za[Cu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,No&&($.prototype[No]=p8),$},qa=lm();sr?((sr.exports=qa)._=qa,kt._=qa):Ot._=qa}).call(oc)})(Ud,Ud.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,kb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,Hb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&Hb(r,t,e[t]);if(kb)for(var t of kb(e))PB.call(e,t)&&Hb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function vn(r,e,t){var i;const n=hc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Pa(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function rd(r={},e={}){const t=Kb(r),i=Kb(e);return Ud.exports.merge(t,i)}function Kb(r){var e,t,i,n;const a={};if(!Dc(r))return a;for(const[c,f]of Object.entries(r)){const g=h0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=fc(c);a[O]=OB(ef(ef({},a[O]),f),{chains:nf(g,(e=a[O])==null?void 0:e.chains),methods:nf(d,(t=a[O])==null?void 0:t.methods),events:nf(m,(i=a[O])==null?void 0:i.events),rpcMap:ef(ef({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Vb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=h0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function id(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const j2={},Ut=r=>j2[r],nd=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Gb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Jb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Jb(r,t,e[t]);if(Gb)for(var t of Gb(e))LB.call(e,t)&&Jb(r,t,e[t]);return r},Yb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||vn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Pa(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Yb(Wb({},c.sessionProperties||{}),{capabilities:Yb(Wb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||vn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Pa(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||vn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=eo,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=hc(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Qb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Xb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tf=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Xb(r,t,e[t]);if(Qb)for(var t of Qb(e))ZB.call(e,t)&&Xb(r,t,e[t]);return r},sd=(r,e)=>YB(r,QB(e));class w0{constructor(e){this.events=new zd,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qc(eh({level:(e==null?void 0:e.logger)||zb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new w0(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:tf({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(c=>t(null,rh(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Lt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const c=Vb(this.session.namespaces);this.namespaces=rd(this.namespaces,c),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const c=Vb(a.namespaces);this.namespaces=rd(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===eo?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Kn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await y0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||zb,relayUrl:this.providerOpts.relayUrl||DB,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>fc(t)))];nd("client",this.client),nd("events",this.events),nd("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=rd(this.namespaces,this.optionalNamespaces),c=sd(tf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[eo]?this.rpcProviders[eo].updateNamespace(c):this.rpcProviders[eo]=new JB({namespace:c})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Kn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=fc(n),f=id(n)!==id(a)?`${c}:${id(a)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=sd(tf({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sd(tf({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(yn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[eo]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(c=>fc(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=fc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${jb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${jb}/${e}`)}}const e$=w0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",qd=["eth_sendTransaction","personal_sign"],s$=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Ld=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Zb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,ev=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,to=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&ev(r,t,e[t]);if(Zb)for(var t of Zb(e))h$.call(e,t)&&ev(r,t,e[t]);return r},ad=(r,e)=>c$(r,u$(e));function Pf(r){return Number(r[0].split(":")[1])}function rf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Kn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||qd,events:a||Ld,rpcMap:to({},e.length?{[Pf(e)]:f[Pf(e)]}:{})},d=a==null?void 0:a.filter(I=>!Ld.includes(I)),m=i==null?void 0:i.filter(I=>!qd.includes(I));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class _0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new _0;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(ad(to({namespaces:to({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(ad(to({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",rf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",ad(to({},Lt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",rf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||qd:[],g=n.length?(e==null?void 0:e.events)||Ld:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Pf(this.rpc.chains):Pf(this.rpc.optionalChains),this.signer=await e$.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await _4(()=>import("./index-3RtEhhzm.js").then(n=>n.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(to({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Kn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&Kn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${n$}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const V$=_0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,Ld as REQUIRED_EVENTS,qd as REQUIRED_METHODS,_0 as default}; +}`;var wt=m1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,sl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return M0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=I0(A,T),Q=C0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,O0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=C0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if($a(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-Ua(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),al(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=Dh(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=Ha(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),ul=yp("toUpperCase");function v1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var m1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return sl(l)?l:new dt(l)}}),B5=rs(function(s,o){return Pi(o,function(l){l=An(l),es(s,l,il(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=yh(A,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(b)},Dn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:$u,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=cu[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),Dn(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(za,A)||(za[A]=[]),za[A].push({name:o,func:l})}}),za[Cu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,No&&($.prototype[No]=p8),$},qa=lm();sr?((sr.exports=qa)._=qa,kt._=qa):Ot._=qa}).call(oc)})(Ud,Ud.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,kb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,Hb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&Hb(r,t,e[t]);if(kb)for(var t of kb(e))PB.call(e,t)&&Hb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function vn(r,e,t){var i;const n=hc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Pa(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function rd(r={},e={}){const t=Kb(r),i=Kb(e);return Ud.exports.merge(t,i)}function Kb(r){var e,t,i,n;const a={};if(!Dc(r))return a;for(const[c,f]of Object.entries(r)){const g=h0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=fc(c);a[O]=OB(ef(ef({},a[O]),f),{chains:nf(g,(e=a[O])==null?void 0:e.chains),methods:nf(d,(t=a[O])==null?void 0:t.methods),events:nf(m,(i=a[O])==null?void 0:i.events),rpcMap:ef(ef({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Vb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=h0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function id(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const j2={},Ut=r=>j2[r],nd=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Gb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Jb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Jb(r,t,e[t]);if(Gb)for(var t of Gb(e))LB.call(e,t)&&Jb(r,t,e[t]);return r},Yb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||vn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Pa(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Yb(Wb({},c.sessionProperties||{}),{capabilities:Yb(Wb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||vn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Pa(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Pa(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||vn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace);return typeof i>"u"?void 0:new mn(new Yn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=eo,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=hc(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||vn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new mn(new Yn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Qb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Xb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,tf=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Xb(r,t,e[t]);if(Qb)for(var t of Qb(e))ZB.call(e,t)&&Xb(r,t,e[t]);return r},sd=(r,e)=>YB(r,QB(e));class w0{constructor(e){this.events=new zd,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:qc(eh({level:(e==null?void 0:e.logger)||zb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new w0(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:tf({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(c=>t(null,rh(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Lt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const c=Vb(this.session.namespaces);this.namespaces=rd(this.namespaces,c),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const c=Vb(a.namespaces);this.namespaces=rd(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===eo?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Kn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await y0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||zb,relayUrl:this.providerOpts.relayUrl||DB,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>fc(t)))];nd("client",this.client),nd("events",this.events),nd("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=rd(this.namespaces,this.optionalNamespaces),c=sd(tf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[eo]?this.rpcProviders[eo].updateNamespace(c):this.rpcProviders[eo]=new JB({namespace:c})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Kn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=fc(n),f=id(n)!==id(a)?`${c}:${id(a)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=sd(tf({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sd(tf({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(yn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[eo]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(c=>fc(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=fc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${jb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${jb}/${e}`)}}const e$=w0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",qd=["eth_sendTransaction","personal_sign"],s$=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Ld=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Zb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,ev=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,to=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&ev(r,t,e[t]);if(Zb)for(var t of Zb(e))h$.call(e,t)&&ev(r,t,e[t]);return r},ad=(r,e)=>c$(r,u$(e));function Pf(r){return Number(r[0].split(":")[1])}function rf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Kn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||qd,events:a||Ld,rpcMap:to({},e.length?{[Pf(e)]:f[Pf(e)]}:{})},d=a==null?void 0:a.filter(I=>!Ld.includes(I)),m=i==null?void 0:i.filter(I=>!qd.includes(I));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class _0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new _0;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(ad(to({namespaces:to({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(ad(to({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=Z1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:rf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",rf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",ad(to({},Lt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",rf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||qd:[],g=n.length?(e==null?void 0:e.events)||Ld:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Pf(this.rpc.chains):Pf(this.rpc.optionalChains),this.signer=await e$.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await _4(()=>import("./index-BhMsHqT3.js").then(n=>n.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(to({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Kn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&Kn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${n$}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const V$=_0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,Ld as REQUIRED_EVENTS,qd as REQUIRED_METHODS,_0 as default}; diff --git a/buddybook/assets/inherits_browser-BKdA78FI.js b/buddybook/assets/inherits_browser-CgLO5vwk.js similarity index 85% rename from buddybook/assets/inherits_browser-BKdA78FI.js rename to buddybook/assets/inherits_browser-CgLO5vwk.js index 6c408c1..e020f87 100644 --- a/buddybook/assets/inherits_browser-BKdA78FI.js +++ b/buddybook/assets/inherits_browser-CgLO5vwk.js @@ -1 +1 @@ -import{g as n,w as s}from"./index-CBcRH9LY.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var f=r.exports;export{f as i,a as r}; +import{g as n,w as s}from"./index-D-Yr2Iya.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var f=r.exports;export{f as i,a as r}; diff --git a/buddybook/index.html b/buddybook/index.html index da43ce9..f9859ac 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -23,7 +23,7 @@ browser: true }; - + diff --git a/flush-notes/404.html b/flush-notes/404.html index b6f95e1..3ce1a77 100644 --- a/flush-notes/404.html +++ b/flush-notes/404.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/_next/static/sSSStgTszOxV6NKQOFQIT/_buildManifest.js b/flush-notes/_next/static/rmOC9oKL0ERMEwFO86Gas/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/sSSStgTszOxV6NKQOFQIT/_buildManifest.js rename to flush-notes/_next/static/rmOC9oKL0ERMEwFO86Gas/_buildManifest.js diff --git a/flush-notes/_next/static/sSSStgTszOxV6NKQOFQIT/_ssgManifest.js b/flush-notes/_next/static/rmOC9oKL0ERMEwFO86Gas/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/sSSStgTszOxV6NKQOFQIT/_ssgManifest.js rename to flush-notes/_next/static/rmOC9oKL0ERMEwFO86Gas/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index a60be5c..6b3e7e2 100644 --- a/flush-notes/index.html +++ b/flush-notes/index.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/index.txt b/flush-notes/index.txt index 53efe85..0faaa5d 100644 --- a/flush-notes/index.txt +++ b/flush-notes/index.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["sSSStgTszOxV6NKQOFQIT",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["rmOC9oKL0ERMEwFO86Gas",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""] diff --git a/flush-notes/view.html b/flush-notes/view.html index ba20ba9..4e056b8 100644 --- a/flush-notes/view.html +++ b/flush-notes/view.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/view.txt b/flush-notes/view.txt index 4122698..abea105 100644 --- a/flush-notes/view.txt +++ b/flush-notes/view.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["sSSStgTszOxV6NKQOFQIT",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["rmOC9oKL0ERMEwFO86Gas",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""]