Reading from NEAR testnet…
Reading from NEAR testnet…
GA2tgZcSPuQJjNBCrzAHyTMVkUzTeoRQ8vDSWGSWUvST
web4.nearbuilders.testnet to web4.nearbuilders.testnet · failed
fs_store()
import{T as pe,M as ke,R as A,E as D,C as h,a as F,b as Ho,O as H,c as re}from"./index-CoYyUc-x.js";import{ao as W,c2 as ko}from"./index-DhqGQKi4.js";/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Be=window,Nt=Be.ShadowRoot&&(Be.ShadyCSS===void 0||Be.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,jt=Symbol(),Ft=new WeakMap;let fo=class{constructor(e,o,i){if(this._$cssResult$=!0,i!==jt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=o}get styleSheet(){let e=this.o;const o=this.t;if(Nt&&e===void 0){const i=o!==void 0&&o.length===1;i&&(e=Ft.get(o)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ft.set(o,e))}return e}toString(){return this.cssText}};const Bo=t=>new fo(typeof t=="string"?t:t+"",void 0,jt),_=(t,...e)=>{const o=t.length===1?t[0]:e.reduce((i,r,s)=>i+(l=>{if(l._$cssResult$===!0)return l.cssText;if(typeof l=="number")return l;throw Error("Value passed to 'css' function must be a 'css' function result: "+l+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[s+1],t[0]);return new fo(o,t,jt)},Zo=(t,e)=>{Nt?t.adoptedStyleSheets=e.map(o=>o instanceof CSSStyleSheet?o:o.styleSheet):e.forEach(o=>{const i=document.createElement("style"),r=Be.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=o.cssText,t.appendChild(i)})},qt=Nt?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let o="";for(const i of e.cssRules)o+=i.cssText;return Bo(o)})(t):t;/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var rt;const ze=window,Kt=ze.trustedTypes,zo=Kt?Kt.emptyScript:"",Qt=ze.reactiveElementPolyfillSupport,wt={toAttribute(t,e){switch(e){case Boolean:t=t?zo:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let o=t;switch(e){case Boolean:o=t!==null;break;case Number:o=t===null?null:Number(t);break;case Object:case Array:try{o=JSON.parse(t)}catch{o=null}}return o}},wo=(t,e)=>e!==t&&(e==e||t==t),it={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:wo},vt="finalized";let ce=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var o;this.finalize(),((o=this.h)!==null&&o!==void 0?o:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach((o,i)=>{const r=this._$Ep(i,o);r!==void 0&&(this._$Ev.set(r,i),e.push(r))}),e}static createProperty(e,o=it){if(o.state&&(o.attribute=!1),this.finalize(),this.elementProperties.set(e,o),!o.noAccessor&&!this.prototype.hasOwnProperty(e)){const i=typeof e=="symbol"?Symbol():"__"+e,r=this.getPropertyDescriptor(e,i,o);r!==void 0&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,o,i){return{get(){return this[o]},set(r){const s=this[e];this[o]=r,this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||it}static finalize(){if(this.hasOwnProperty(vt))return!1;this[vt]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const o=this.properties,i=[...Object.getOwnPropertyNames(o),...Object.getOwnPropertySymbols(o)];for(const r of i)this.createProperty(r,o[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const o=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const r of i)o.unshift(qt(r))}else e!==void 0&&o.push(qt(e));return o}static _$Ep(e,o){const i=o.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(o=>this.enableUpdating=o),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(o=>o(this))}addController(e){var o,i;((o=this._$ES)!==null&&o!==void 0?o:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var o;(o=this._$ES)===null||o===void 0||o.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,o)=>{this.hasOwnProperty(o)&&(this._$Ei.set(o,this[o]),delete this[o])})}createRenderRoot(){var e;const o=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Zo(o,this.constructor.elementStyles),o}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(o=>{var i;return(i=o.hostConnected)===null||i===void 0?void 0:i.call(o)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(o=>{var i;return(i=o.hostDisconnected)===null||i===void 0?void 0:i.call(o)})}attributeChangedCallback(e,o,i){this._$AK(e,i)}_$EO(e,o,i=it){var r;const s=this.constructor._$Ep(e,i);if(s!==void 0&&i.reflect===!0){const l=(((r=i.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?i.converter:wt).toAttribute(o,i.type);this._$El=e,l==null?this.removeAttribute(s):this.setAttribute(s,l),this._$El=null}}_$AK(e,o){var i;const r=this.constructor,s=r._$Ev.get(e);if(s!==void 0&&this._$El!==s){const l=r.getPropertyOptions(s),n=typeof l.converter=="function"?{fromAttribute:l.converter}:((i=l.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?l.converter:wt;this._$El=s,this[s]=n.fromAttribute(o,l.type),this._$El=null}}requestUpdate(e,o,i){let r=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||wo)(this[e],o)?(this._$AL.has(e)||this._$AL.set(e,o),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(o){Promise.reject(o)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,s)=>this[s]=r),this._$Ei=void 0);let o=!1;const i=this._$AL;try{o=this.shouldUpdate(i),o?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var s;return(s=r.hostUpdate)===null||s===void 0?void 0:s.call(r)}),this.update(i)):this._$Ek()}catch(r){throw o=!1,this._$Ek(),r}o&&this._$AE(i)}willUpdate(e){}_$AE(e){var o;(o=this._$ES)===null||o===void 0||o.forEach(i=>{var r;return(r=i.hostUpdated)===null||r===void 0?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((o,i)=>this._$EO(i,this[i],o)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};ce[vt]=!0,ce.elementProperties=new Map,ce.elementStyles=[],ce.shadowRootOptions={mode:"open"},Qt==null||Qt({ReactiveElement:ce}),((rt=ze.reactiveElementVersions)!==null&&rt!==void 0?rt:ze.reactiveElementVersions=[]).push("1.6.3");/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var st;const Ve=window,ue=Ve.trustedTypes,Gt=ue?ue.createPolicy("lit-html",{createHTML:t=>t}):void 0,gt="$lit$",V=`lit$${(Math.random()+"").slice(9)}$`,vo="?"+V,Vo=`<${vo}>`,ie=document,Ae=()=>ie.createComment(""),Ee=t=>t===null||typeof t!="object"&&typeof t!="function",go=Array.isArray,Fo=t=>go(t)||typeof(t==null?void 0:t[Symbol.iterator])=="function",lt=`[
\f\r]`,_e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yt=/-->/g,Xt=/>/g,ee=RegExp(`>|${lt}(?:([^\\s"'>=/]+)(${lt}*=${lt}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),Jt=/'/g,eo=/"/g,bo=/^(?:script|style|textarea|title)$/i,yo=t=>(e,...o)=>({_$litType$:t,strings:e,values:o}),c=yo(1),Ze=yo(2),se=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),to=new WeakMap,te=ie.createTreeWalker(ie,129,null,!1);function xo(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gt!==void 0?Gt.createHTML(e):e}const qo=(t,e)=>{const o=t.length-1,i=[];let r,s=e===2?"<svg>":"",l=_e;for(let n=0;n<o;n++){const a=t[n];let d,x,$=-1,p=0;for(;p<a.length&&(l.lastIndex=p,x=l.exec(a),x!==null);)p=l.lastIndex,l===_e?x[1]==="!--"?l=Yt:x[1]!==void 0?l=Xt:x[2]!==void 0?(bo.test(x[2])&&(r=RegExp("</"+x[2],"g")),l=ee):x[3]!==void 0&&(l=ee):l===ee?x[0]===">"?(l=r??_e,$=-1):x[1]===void 0?$=-2:($=l.lastIndex-x[2].length,d=x[1],l=x[3]===void 0?ee:x[3]==='"'?eo:Jt):l===eo||l===Jt?l=ee:l===Yt||l===Xt?l=_e:(l=ee,r=void 0);const O=l===ee&&t[n+1].startsWith("/>")?" ":"";s+=l===_e?a+Vo:$>=0?(i.push(d),a.slice(0,$)+gt+a.slice($)+V+O):a+V+($===-2?(i.push(void 0),n):O)}return[xo(t,s+(t[o]||"<?>")+(e===2?"</svg>":"")),i]};class Pe{constructor({strings:e,_$litType$:o},i){let r;this.parts=[];let s=0,l=0;const n=e.length-1,a=this.parts,[d,x]=qo(e,o);if(this.el=Pe.createElement(d,i),te.currentNode=this.el.content,o===2){const $=this.el.content,p=$.firstChild;p.remove(),$.append(...p.childNodes)}for(;(r=te.nextNode())!==null&&a.length<n;){if(r.nodeType===1){if(r.hasAttributes()){const $=[];for(const p of r.getAttributeNames())if(p.endsWith(gt)||p.startsWith(V)){const O=x[l++];if($.push(p),O!==void 0){const g=r.getAttribute(O.toLowerCase()+gt).split(V),f=/([.?@])?(.*)/.exec(O);a.push({type:1,index:s,name:f[2],strings:g,ctor:f[1]==="."?Qo:f[1]==="?"?Yo:f[1]==="@"?Xo:et})}else a.push({type:6,index:s})}for(const p of $)r.removeAttribute(p)}if(bo.test(r.tagName)){const $=r.textContent.split(V),p=$.length-1;if(p>0){r.textContent=ue?ue.emptyScript:"";for(let O=0;O<p;O++)r.append($[O],Ae()),te.nextNode(),a.push({type:2,index:++s});r.append($[p],Ae())}}}else if(r.nodeType===8)if(r.data===vo)a.push({type:2,index:s});else{let $=-1;for(;($=r.data.indexOf(V,$+1))!==-1;)a.push({type:7,index:s}),$+=V.length-1}s++}}static createElement(e,o){const i=ie.createElement("template");return i.innerHTML=e,i}}function fe(t,e,o=t,i){var r,s,l,n;if(e===se)return e;let a=i!==void 0?(r=o._$Co)===null||r===void 0?void 0:r[i]:o._$Cl;const d=Ee(e)?void 0:e._$litDirective$;return(a==null?void 0:a.constructor)!==d&&((s=a==null?void 0:a._$AO)===null||s===void 0||s.call(a,!1),d===void 0?a=void 0:(a=new d(t),a._$AT(t,o,i)),i!==void 0?((l=(n=o)._$Co)!==null&&l!==void 0?l:n._$Co=[])[i]=a:o._$Cl=a),a!==void 0&&(e=fe(t,a._$AS(t,e.values),a,i)),e}class Ko{constructor(e,o){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=o}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var o;const{el:{content:i},parts:r}=this._$AD,s=((o=e==null?void 0:e.creationScope)!==null&&o!==void 0?o:ie).importNode(i,!0);te.currentNode=s;let l=te.nextNode(),n=0,a=0,d=r[0];for(;d!==void 0;){if(n===d.index){let x;d.type===2?x=new Se(l,l.nextSibling,this,e):d.type===1?x=new d.ctor(l,d.name,d.strings,this,e):d.type===6&&(x=new Jo(l,this,e)),this._$AV.push(x),d=r[++a]}n!==(d==null?void 0:d.index)&&(l=te.nextNode(),n++)}return te.currentNode=ie,s}v(e){let o=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,o),o+=i.strings.length-2):i._$AI(e[o])),o++}}class Se{constructor(e,o,i,r){var s;this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=e,this._$AB=o,this._$AM=i,this.options=r,this._$Cp=(s=r==null?void 0:r.isConnected)===null||s===void 0||s}get _$AU(){var e,o;return(o=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&o!==void 0?o:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const o=this._$AM;return o!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=o.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,o=this){e=fe(this,e,o),Ee(e)?e===T||e==null||e===""?(this._$AH!==T&&this._$AR(),this._$AH=T):e!==this._$AH&&e!==se&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Fo(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==T&&Ee(this._$AH)?this._$AA.nextSibling.data=e:this.$(ie.createTextNode(e)),this._$AH=e}g(e){var o;const{values:i,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=Pe.createElement(xo(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)===null||o===void 0?void 0:o._$AD)===s)this._$AH.v(i);else{const l=new Ko(s,this),n=l.u(this.options);l.v(i),this.$(n),this._$AH=l}}_$AC(e){let o=to.get(e.strings);return o===void 0&&to.set(e.strings,o=new Pe(e)),o}T(e){go(this._$AH)||(this._$AH=[],this._$AR());const o=this._$AH;let i,r=0;for(const s of e)r===o.length?o.push(i=new Se(this.k(Ae()),this.k(Ae()),this,this.options)):i=o[r],i._$AI(s),r++;r<o.length&&(this._$AR(i&&i._$AB.nextSibling,r),o.length=r)}_$AR(e=this._$AA.nextSibling,o){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,o);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){var o;this._$AM===void 0&&(this._$Cp=e,(o=this._$AP)===null||o===void 0||o.call(this,e))}}class et{constructor(e,o,i,r,s){this.type=1,this._$AH=T,this._$AN=void 0,this.element=e,this.name=o,this._$AM=r,this.options=s,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=T}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,o=this,i,r){const s=this.strings;let l=!1;if(s===void 0)e=fe(this,e,o,0),l=!Ee(e)||e!==this._$AH&&e!==se,l&&(this._$AH=e);else{const n=e;let a,d;for(e=s[0],a=0;a<s.length-1;a++)d=fe(this,n[i+a],o,a),d===se&&(d=this._$AH[a]),l||(l=!Ee(d)||d!==this._$AH[a]),d===T?e=T:e!==T&&(e+=(d??"")+s[a+1]),this._$AH[a]=d}l&&!r&&this.j(e)}j(e){e===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Qo extends et{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===T?void 0:e}}const Go=ue?ue.emptyScript:"";class Yo extends et{constructor(){super(...arguments),this.type=4}j(e){e&&e!==T?this.element.setAttribute(this.name,Go):this.element.removeAttribute(this.name)}}class Xo extends et{constructor(e,o,i,r,s){super(e,o,i,r,s),this.type=5}_$AI(e,o=this){var i;if((e=(i=fe(this,e,o,0))!==null&&i!==void 0?i:T)===se)return;const r=this._$AH,s=e===T&&r!==T||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,l=e!==T&&(r===T||s);s&&this.element.removeEventListener(this.name,this,r),l&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var o,i;typeof this._$AH=="function"?this._$AH.call((i=(o=this.options)===null||o===void 0?void 0:o.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}}class Jo{constructor(e,o,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=o,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){fe(this,e)}}const oo=Ve.litHtmlPolyfillSupport;oo==null||oo(Pe,Se),((st=Ve.litHtmlVersions)!==null&&st!==void 0?st:Ve.litHtmlVersions=[]).push("2.8.0");const er=(t,e,o)=>{var i,r;const s=(i=o==null?void 0:o.renderBefore)!==null&&i!==void 0?i:e;let l=s._$litPart$;if(l===void 0){const n=(r=o==null?void 0:o.renderBefore)!==null&&r!==void 0?r:null;s._$litPart$=l=new Se(e.insertBefore(Ae(),n),n,void 0,o??{})}return l._$AI(t),l};/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var nt,at;class w extends ce{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,o;const i=super.createRenderRoot();return(e=(o=this.renderOptions).renderBefore)!==null&&e!==void 0||(o.renderBefore=i.firstChild),i}update(e){const o=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=er(o,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return se}}w.finalized=!0,w._$litElement$=!0,(nt=globalThis.litElementHydrateSupport)===null||nt===void 0||nt.call(globalThis,{LitElement:w});const ro=globalThis.litElementPolyfillSupport;ro==null||ro({LitElement:w});((at=globalThis.litElementVersions)!==null&&at!==void 0?at:globalThis.litElementVersions=[]).push("3.3.3");/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const y=t=>e=>typeof e=="function"?((o,i)=>(customElements.define(o,i),i))(t,e):((o,i)=>{const{kind:r,elements:s}=i;return{kind:r,elements:s,finisher(l){customElements.define(o,l)}}})(t,e);/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const tr=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(o){o.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(o){o.createProperty(e.key,t)}},or=(t,e,o)=>{e.constructor.createProperty(o,t)};function u(t){return(e,o)=>o!==void 0?or(t,e,o):tr(t,e)}/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/function L(t){return u({...t,state:!0})}/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var ct;((ct=window.HTMLSlotElement)===null||ct===void 0?void 0:ct.prototype.assignedElements)!=null;/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const rr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ir=t=>(...e)=>({_$litDirective$:t,values:e});class sr{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,o,i){this._$Ct=e,this._$AM=o,this._$Ci=i}_$AS(e,o){return this.update(e,o)}update(e,o){return this.render(...o)}}/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Z=ir(class extends sr{constructor(t){var e;if(super(t),t.type!==rr.ATTRIBUTE||t.name!=="class"||((e=t.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter(e=>t[e]).join(" ")+" "}update(t,[e]){var o,i;if(this.it===void 0){this.it=new Set,t.strings!==void 0&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter(s=>s!=="")));for(const s in e)e[s]&&!(!((o=this.nt)===null||o===void 0)&&o.has(s))&&this.it.add(s);return this.render(e)}const r=t.element.classList;this.it.forEach(s=>{s in e||(r.remove(s),this.it.delete(s))});for(const s in e){const l=!!e[s];l===this.it.has(s)||!((i=this.nt)===null||i===void 0)&&i.has(s)||(l?(r.add(s),this.it.add(s)):(r.remove(s),this.it.delete(s)))}return se}});function lr(t,e){t.indexOf(e)===-1&&t.push(e)}const $o=(t,e,o)=>Math.min(Math.max(o,t),e),j={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},Fe=t=>typeof t=="number",he=t=>Array.isArray(t)&&!Fe(t[0]),nr=(t,e,o)=>{const i=e-t;return((o-t)%i+i)%i+t};function ar(t,e){return he(t)?t[nr(0,t.length,e)]:t}const _o=(t,e,o)=>-o*t+o*e+t,Co=()=>{},q=t=>t,Ut=(t,e,o)=>e-t===0?1:(o-t)/(e-t);function Oo(t,e){const o=t[t.length-1];for(let i=1;i<=e;i++){const r=Ut(0,e,i);t.push(_o(o,1,r))}}function cr(t){const e=[0];return Oo(e,t-1),e}function dr(t,e=cr(t.length),o=q){const i=t.length,r=i-e.length;return r>0&&Oo(e,r),s=>{let l=0;for(;l<i-2&&!(s<e[l+1]);l++);let n=$o(0,1,Ut(e[l],e[l+1],s));return n=ar(o,l)(n),_o(t[l],t[l+1],n)}}const Ao=t=>Array.isArray(t)&&Fe(t[0]),bt=t=>typeof t=="object"&&!!t.createAnimation,we=t=>typeof t=="function",hr=t=>typeof t=="string",Oe={ms:t=>t*1e3,s:t=>t/1e3},Eo=(t,e,o)=>(((1-3*o+3*e)*t+(3*o-6*e))*t+3*e)*t,mr=1e-7,pr=12;function ur(t,e,o,i,r){let s,l,n=0;do l=e+(o-e)/2,s=Eo(l,i,r)-t,s>0?o=l:e=l;while(Math.abs(s)>mr&&++n<pr);return l}function Ce(t,e,o,i){if(t===e&&o===i)return q;const r=s=>ur(s,0,1,t,o);return s=>s===0||s===1?s:Eo(r(s),e,i)}const fr=(t,e="end")=>o=>{o=e==="end"?Math.min(o,.999):Math.max(o,.001);const i=o*t,r=e==="end"?Math.floor(i):Math.ceil(i);return $o(0,1,r/t)},wr={ease:Ce(.25,.1,.25,1),"ease-in":Ce(.42,0,1,1),"ease-in-out":Ce(.42,0,.58,1),"ease-out":Ce(0,0,.58,1)},vr=/\((.*?)\)/;function io(t){if(we(t))return t;if(Ao(t))return Ce(...t);const e=wr[t];if(e)return e;if(t.startsWith("steps")){const o=vr.exec(t);if(o){const i=o[1].split(",");return fr(parseFloat(i[0]),i[1].trim())}}return q}class Po{constructor(e,o=[0,1],{easing:i,duration:r=j.duration,delay:s=j.delay,endDelay:l=j.endDelay,repeat:n=j.repeat,offset:a,direction:d="normal",autoplay:x=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=q,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((p,O)=>{this.resolve=p,this.reject=O}),i=i||j.easing,bt(i)){const p=i.createAnimation(o);i=p.easing,o=p.keyframes||o,r=p.duration||r}this.repeat=n,this.easing=he(i)?q:io(i),this.updateDuration(r);const $=dr(o,a,he(i)?i.map(io):q);this.tick=p=>{var O;s=s;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(p-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-s,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let P=Math.floor(f),b=f%1;!b&&f>=1&&(b=1),b===1&&P--;const M=P%2;(d==="reverse"||d==="alternate"&&M||d==="alternate-reverse"&&!M)&&(b=1-b);const R=g>=this.totalDuration?1:Math.min(b,1),N=$(this.easing(R));e(N),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+l)?(this.playState="finished",(O=this.resolve)===null||O===void 0||O.call(this,N)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},x&&this.play()}play(){const e=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=e-this.pauseTime:this.startTime||(this.startTime=e),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 e;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(e=this.reject)===null||e===void 0||e.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(e){this.duration=e,this.totalDuration=e*(this.repeat+1)}get currentTime(){return this.t}set currentTime(e){this.pauseTime!==void 0||this.rate===0?this.pauseTime=e:this.startTime=performance.now()-e/this.rate}get playbackRate(){return this.rate}set playbackRate(e){this.rate=e}}class gr{setAnimation(e){this.animation=e,e==null||e.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const dt=new WeakMap;function Io(t){return dt.has(t)||dt.set(t,{transforms:[],values:new Map}),dt.get(t)}function br(t,e){return t.has(e)||t.set(e,new gr),t.get(e)}const yr=["","X","Y","Z"],xr=["translate","scale","rotate","skew"],qe={x:"translateX",y:"translateY",z:"translateZ"},so={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},$r={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:so,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:q},skew:so},Ie=new Map,Ht=t=>`--motion-${t}`,Ke=["x","y","z"];xr.forEach(t=>{yr.forEach(e=>{Ke.push(t+e),Ie.set(Ht(t+e),$r[t])})});const _r=(t,e)=>Ke.indexOf(t)-Ke.indexOf(e),Cr=new Set(Ke),To=t=>Cr.has(t),Or=(t,e)=>{qe[e]&&(e=qe[e]);const{transforms:o}=Io(t);lr(o,e),t.style.transform=Ar(o)},Ar=t=>t.sort(_r).reduce(Er,"").trim(),Er=(t,e)=>`${t} ${e}(var(${Ht(e)}))`,yt=t=>t.startsWith("--"),lo=new Set;function Pr(t){if(!lo.has(t)){lo.add(t);try{const{syntax:e,initialValue:o}=Ie.has(t)?Ie.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:o})}catch{}}}const ht=(t,e)=>document.createElement("div").animate(t,e),no={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{ht({opacity:[1]})}catch{return!1}return!0},finished:()=>!!ht({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{ht({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},mt={},de={};for(const t in no)de[t]=()=>(mt[t]===void 0&&(mt[t]=no[t]()),mt[t]);const Ir=.015,Tr=(t,e)=>{let o="";const i=Math.round(e/Ir);for(let r=0;r<i;r++)o+=t(Ut(0,i-1,r))+", ";return o.substring(0,o.length-2)},ao=(t,e)=>we(t)?de.linearEasing()?`linear(${Tr(t,e)})`:j.easing:Ao(t)?Mr(t):t,Mr=([t,e,o,i])=>`cubic-bezier(${t}, ${e}, ${o}, ${i})`;function Wr(t,e){for(let o=0;o<t.length;o++)t[o]===null&&(t[o]=o?t[o-1]:e());return t}const Rr=t=>Array.isArray(t)?t:[t];function xt(t){return qe[t]&&(t=qe[t]),To(t)?Ht(t):t}const He={get:(t,e)=>{e=xt(e);let o=yt(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!o&&o!==0){const i=Ie.get(e);i&&(o=i.initialValue)}return o},set:(t,e,o)=>{e=xt(e),yt(e)?t.style.setProperty(e,o):t.style[e]=o}};function Mo(t,e=!0){if(!(!t||t.playState==="finished"))try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch{}}function Sr(t,e){var o;let i=(e==null?void 0:e.toDefaultUnit)||q;const r=t[t.length-1];if(hr(r)){const s=((o=r.match(/(-?[\d.]+)([a-z%]*)/))===null||o===void 0?void 0:o[2])||"";s&&(i=l=>l+s)}return i}function Dr(){return window.__MOTION_DEV_TOOLS_RECORD}function Lr(t,e,o,i={},r){const s=Dr(),l=i.record!==!1&&s;let n,{duration:a=j.duration,delay:d=j.delay,endDelay:x=j.endDelay,repeat:$=j.repeat,easing:p=j.easing,persist:O=!1,direction:g,offset:f,allowWebkitAcceleration:P=!1,autoplay:b=!0}=i;const M=Io(t),R=To(e);let N=de.waapi();R&&Or(t,e);const U=xt(e),je=br(M.values,U),z=Ie.get(U);return Mo(je.animation,!(bt(p)&&je.generator)&&i.record!==!1),()=>{const Ue=()=>{var E,$e;return($e=(E=He.get(t,U))!==null&&E!==void 0?E:z==null?void 0:z.initialValue)!==null&&$e!==void 0?$e:0};let I=Wr(Rr(o),Ue);const Vt=Sr(I,z);if(bt(p)){const E=p.createAnimation(I,e!=="opacity",Ue,U,je);p=E.easing,I=E.keyframes||I,a=E.duration||a}if(yt(U)&&(de.cssRegisterProperty()?Pr(U):N=!1),R&&!de.linearEasing()&&(we(p)||he(p)&&p.some(we))&&(N=!1),N){z&&(I=I.map(J=>Fe(J)?z.toDefaultUnit(J):J)),I.length===1&&(!de.partialKeyframes()||l)&&I.unshift(Ue());const E={delay:Oe.ms(d),duration:Oe.ms(a),endDelay:Oe.ms(x),easing:he(p)?void 0:ao(p,a),direction:g,iterations:$+1,fill:"both"};n=t.animate({[U]:I,offset:f,easing:he(p)?p.map(J=>ao(J,a)):void 0},E),n.finished||(n.finished=new Promise((J,Uo)=>{n.onfinish=J,n.oncancel=Uo}));const $e=I[I.length-1];n.finished.then(()=>{O||(He.set(t,U,$e),n.cancel())}).catch(Co),P||(n.playbackRate=1.000001)}else if(r&&R)I=I.map(E=>typeof E=="string"?parseFloat(E):E),I.length===1&&I.unshift(parseFloat(Ue())),n=new r(E=>{He.set(t,U,Vt?Vt(E):E)},I,Object.assign(Object.assign({},i),{duration:a,easing:p}));else{const E=I[I.length-1];He.set(t,U,z&&Fe(E)?z.toDefaultUnit(E):E)}return l&&s(t,e,I,{duration:a,delay:d,easing:p,repeat:$,offset:f},"motion-one"),je.setAnimation(n),n&&!b&&n.pause(),n}}const Nr=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function jr(t,e){return typeof t=="string"?t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t||[])}const Ur=t=>t(),Wo=(t,e,o=j.duration)=>new Proxy({animations:t.map(Ur).filter(Boolean),duration:o,options:e},kr),Hr=t=>t.animations[0],kr={get:(t,e)=>{const o=Hr(t);switch(e){case"duration":return t.duration;case"currentTime":return Oe.s((o==null?void 0:o[e])||0);case"playbackRate":case"playState":return o==null?void 0:o[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(Br)).catch(Co)),t.finished;case"stop":return()=>{t.animations.forEach(i=>Mo(i))};case"forEachNative":return i=>{t.animations.forEach(r=>i(r,t))};default:return typeof(o==null?void 0:o[e])>"u"?void 0:()=>t.animations.forEach(i=>i[e]())}},set:(t,e,o)=>{switch(e){case"currentTime":o=Oe.ms(o);case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=o;return!0}return!1}},Br=t=>t.finished;function Zr(t,e,o){return we(t)?t(e,o):t}function zr(t){return function(o,i,r={}){o=jr(o);const s=o.length,l=[];for(let n=0;n<s;n++){const a=o[n];for(const d in i){const x=Nr(r,d);x.delay=Zr(x.delay,n,s);const $=Lr(a,d,i[d],x,t);l.push($)}}return Wo(l,r,r.duration)}}const Vr=zr(Po);function Fr(t,e={}){return Wo([()=>{const o=new Po(t,[0,1],e);return o.finished.catch(()=>{}),o}],e,e.duration)}function oe(t,e,o){return(we(t)?Fr:Vr)(t,e,o)}/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const S=t=>t??T;var qr=Object.defineProperty,co=Object.getOwnPropertySymbols,Kr=Object.prototype.hasOwnProperty,Qr=Object.prototype.propertyIsEnumerable,ho=(t,e,o)=>e in t?qr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,pt=(t,e)=>{for(var o in e||(e={}))Kr.call(e,o)&&ho(t,o,e[o]);if(co)for(var o of co(e))Qr.call(e,o)&&ho(t,o,e[o]);return t};function Gr(){var t;const e=(t=pe.state.themeMode)!=null?t:"dark",i={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[e];return{"--wcm-color-fg-1":i.foreground[1],"--wcm-color-fg-2":i.foreground[2],"--wcm-color-fg-3":i.foreground[3],"--wcm-color-bg-1":i.background[1],"--wcm-color-bg-2":i.background[2],"--wcm-color-bg-3":i.background[3],"--wcm-color-overlay":i.overlay}}function mo(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const v={getPreset(t){return mo()[t]},setTheme(){const t=document.querySelector(":root"),{themeVariables:e}=pe.state;if(t){const o=pt(pt(pt({},Gr()),mo()),e);Object.entries(o).forEach(([i,r])=>t.style.setProperty(i,r))}},globalCss:_`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},Yr=_`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var Xr=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,be=(t,e,o,i)=>{for(var r=i>1?void 0:i?Jr(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Xr(e,o,r),r};let Q=class extends w{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const t={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let e="inverse";return this.variant==="ghost"&&(e="secondary"),this.variant==="outline"&&(e="accent"),c`<button class="${Z(t)}" ?disabled="${this.disabled}" @click="${this.onClick}">${this.iconLeft}<wcm-text variant="small-regular" color="${e}"><slot></slot></wcm-text>${this.iconRight}</button>`}};Q.styles=[v.globalCss,Yr];be([u({type:Boolean})],Q.prototype,"disabled",2);be([u()],Q.prototype,"iconLeft",2);be([u()],Q.prototype,"iconRight",2);be([u()],Q.prototype,"onClick",2);be([u()],Q.prototype,"variant",2);Q=be([y("wcm-button")],Q);const ei=_`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var ti=Object.defineProperty,oi=Object.getOwnPropertyDescriptor,kt=(t,e,o,i)=>{for(var r=i>1?void 0:i?oi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ti(e,o,r),r};let Te=class extends w{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const t={"wcm-secondary":this.variant==="secondary"};return c`<button ?disabled="${this.disabled}" class="${Z(t)}"><slot></slot></button>`}};Te.styles=[v.globalCss,ei];kt([u({type:Boolean})],Te.prototype,"disabled",2);kt([u()],Te.prototype,"variant",2);Te=kt([y("wcm-button-big")],Te);const ri=_`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var ii=Object.defineProperty,si=Object.getOwnPropertyDescriptor,li=(t,e,o,i)=>{for(var r=i>1?void 0:i?si(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ii(e,o,r),r};let $t=class extends w{render(){return c`<div><slot></slot></div>`}};$t.styles=[v.globalCss,ri];$t=li([y("wcm-info-footer")],$t);const C={CROSS_ICON:W`<svg width="12" height="12" viewBox="0 0 12 12"><path d="M9.94 11A.75.75 0 1 0 11 9.94L7.414 6.353a.5.5 0 0 1 0-.708L11 2.061A.75.75 0 1 0 9.94 1L6.353 4.586a.5.5 0 0 1-.708 0L2.061 1A.75.75 0 0 0 1 2.06l3.586 3.586a.5.5 0 0 1 0 .708L1 9.939A.75.75 0 1 0 2.06 11l3.586-3.586a.5.5 0 0 1 .708 0L9.939 11Z" fill="#fff"/></svg>`,WALLET_CONNECT_LOGO:W`<svg width="178" height="29" viewBox="0 0 178 29" id="wcm-wc-logo"><path d="M10.683 7.926c5.284-5.17 13.85-5.17 19.134 0l.636.623a.652.652 0 0 1 0 .936l-2.176 2.129a.343.343 0 0 1-.478 0l-.875-.857c-3.686-3.607-9.662-3.607-13.348 0l-.937.918a.343.343 0 0 1-.479 0l-2.175-2.13a.652.652 0 0 1 0-.936l.698-.683Zm23.633 4.403 1.935 1.895a.652.652 0 0 1 0 .936l-8.73 8.543a.687.687 0 0 1-.956 0L20.37 17.64a.172.172 0 0 0-.239 0l-6.195 6.063a.687.687 0 0 1-.957 0l-8.73-8.543a.652.652 0 0 1 0-.936l1.936-1.895a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .239 0l6.195-6.064a.687.687 0 0 1 .957 0l6.196 6.064a.172.172 0 0 0 .24 0l6.195-6.064a.687.687 0 0 1 .956 0ZM48.093 20.948l2.338-9.355c.139-.515.258-1.07.416-1.942.12.872.258 1.427.357 1.942l2.022 9.355h4.181l3.528-13.874h-3.21l-1.943 8.523a24.825 24.825 0 0 0-.456 2.457c-.158-.931-.317-1.625-.495-2.438l-1.883-8.542h-4.201l-2.042 8.542a41.204 41.204 0 0 0-.475 2.438 41.208 41.208 0 0 0-.476-2.438l-1.903-8.542h-3.349l3.508 13.874h4.083ZM63.33 21.304c1.585 0 2.596-.654 3.11-1.605-.059.297-.078.595-.078.892v.357h2.655V15.22c0-2.735-1.248-4.32-4.3-4.32-2.636 0-4.36 1.466-4.52 3.487h2.914c.1-.891.734-1.426 1.705-1.426.911 0 1.407.515 1.407 1.11 0 .435-.258.693-1.03.792l-1.388.159c-2.061.257-3.825 1.01-3.825 3.19 0 1.982 1.645 3.092 3.35 3.092Zm.891-2.041c-.773 0-1.348-.436-1.348-1.19 0-.733.655-1.09 1.645-1.268l.674-.119c.575-.118.892-.218 1.09-.396v.912c0 1.228-.892 2.06-2.06 2.06ZM70.398 7.074v13.874h2.874V7.074h-2.874ZM74.934 7.074v13.874h2.874V7.074h-2.874ZM84.08 21.304c2.735 0 4.5-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922H81.92ZM94.92 21.146c.633 0 1.248-.1 1.525-.179v-2.18c-.218.04-.475.06-.693.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.338v-2.24h-2.338V7.788H91.47v3.448H89.37v2.24h2.1v4.201c0 2.3 1.15 3.469 3.45 3.469ZM104.62 21.304c3.924 0 6.302-2.299 6.599-5.608h-3.111c-.238 1.803-1.506 3.032-3.369 3.032-2.2 0-3.746-1.784-3.746-4.796 0-2.953 1.605-4.638 3.805-4.638 1.883 0 2.953 1.15 3.171 2.834h3.191c-.317-3.448-2.854-5.41-6.342-5.41-3.984 0-7.036 2.695-7.036 7.214 0 4.677 2.676 7.372 6.838 7.372ZM117.449 21.304c2.993 0 5.114-1.882 5.114-5.172 0-3.23-2.121-5.233-5.114-5.233-2.972 0-5.093 2.002-5.093 5.233 0 3.29 2.101 5.172 5.093 5.172Zm0-2.22c-1.327 0-2.18-1.09-2.18-2.952 0-1.903.892-2.973 2.18-2.973 1.308 0 2.2 1.07 2.2 2.973 0 1.862-.872 2.953-2.2 2.953ZM126.569 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.229-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM137.464 20.948v-5.689c0-1.208.753-2.1 1.823-2.1 1.011 0 1.606.773 1.606 2.06v5.729h2.873v-6.144c0-2.339-1.228-3.905-3.428-3.905-1.526 0-2.458.734-2.953 1.606a5.31 5.31 0 0 0 .079-.892v-.377h-2.874v9.712h2.874ZM149.949 21.304c2.735 0 4.499-1.546 4.697-3.567h-2.893c-.139.892-.892 1.387-1.804 1.387-1.228 0-2.12-.99-2.14-2.358h6.897v-.555c0-3.21-1.764-5.312-4.816-5.312-2.933 0-4.994 2.062-4.994 5.173 0 3.37 2.12 5.232 5.053 5.232Zm-2.16-6.421c.119-1.11.932-1.922 2.081-1.922 1.11 0 1.883.772 1.903 1.922h-3.984ZM160.876 21.304c3.013 0 4.658-1.645 4.975-4.201h-2.874c-.099 1.07-.713 1.982-2.001 1.982-1.309 0-2.2-1.21-2.2-2.993 0-1.942 1.03-2.933 2.259-2.933 1.209 0 1.803.872 1.883 1.882h2.873c-.218-2.358-1.823-4.142-4.776-4.142-2.874 0-5.153 1.903-5.153 5.193 0 3.25 1.923 5.212 5.014 5.212ZM172.067 21.146c.634 0 1.248-.1 1.526-.179v-2.18c-.218.04-.476.06-.694.06-1.05 0-1.427-.595-1.427-1.566v-3.805h2.339v-2.24h-2.339V7.788h-2.854v3.448h-2.1v2.24h2.1v4.201c0 2.3 1.15 3.469 3.449 3.469Z" fill="#fff"/></svg>`,WALLET_CONNECT_ICON:W`<svg width="28" height="20" viewBox="0 0 28 20"><g clip-path="url(#a)"><path d="M7.386 6.482c3.653-3.576 9.575-3.576 13.228 0l.44.43a.451.451 0 0 1 0 .648L19.55 9.033a.237.237 0 0 1-.33 0l-.606-.592c-2.548-2.496-6.68-2.496-9.228 0l-.648.634a.237.237 0 0 1-.33 0L6.902 7.602a.451.451 0 0 1 0-.647l.483-.473Zm16.338 3.046 1.339 1.31a.451.451 0 0 1 0 .648l-6.035 5.909a.475.475 0 0 1-.662 0L14.083 13.2a.119.119 0 0 0-.166 0l-4.283 4.194a.475.475 0 0 1-.662 0l-6.035-5.91a.451.451 0 0 1 0-.647l1.338-1.31a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0l4.283 4.194c.046.044.12.044.166 0l4.283-4.194a.475.475 0 0 1 .662 0Z" fill="#000000"/></g><defs><clipPath id="a"><path fill="#ffffff" d="M0 0h28v20H0z"/></clipPath></defs></svg>`,WALLET_CONNECT_ICON_COLORED:W`<svg width="96" height="96" fill="none"><path fill="#fff" d="M25.322 33.597c12.525-12.263 32.83-12.263 45.355 0l1.507 1.476a1.547 1.547 0 0 1 0 2.22l-5.156 5.048a.814.814 0 0 1-1.134 0l-2.074-2.03c-8.737-8.555-22.903-8.555-31.64 0l-2.222 2.175a.814.814 0 0 1-1.134 0l-5.156-5.049a1.547 1.547 0 0 1 0-2.22l1.654-1.62Zm56.019 10.44 4.589 4.494a1.547 1.547 0 0 1 0 2.22l-20.693 20.26a1.628 1.628 0 0 1-2.267 0L48.283 56.632a.407.407 0 0 0-.567 0L33.03 71.012a1.628 1.628 0 0 1-2.268 0L10.07 50.75a1.547 1.547 0 0 1 0-2.22l4.59-4.494a1.628 1.628 0 0 1 2.267 0l14.687 14.38c.156.153.41.153.567 0l14.685-14.38a1.628 1.628 0 0 1 2.268 0l14.687 14.38c.156.153.41.153.567 0l14.686-14.38a1.628 1.628 0 0 1 2.268 0Z"/><path stroke="#000" d="M25.672 33.954c12.33-12.072 32.325-12.072 44.655 0l1.508 1.476a1.047 1.047 0 0 1 0 1.506l-5.157 5.048a.314.314 0 0 1-.434 0l-2.074-2.03c-8.932-8.746-23.409-8.746-32.34 0l-2.222 2.174a.314.314 0 0 1-.434 0l-5.157-5.048a1.047 1.047 0 0 1 0-1.506l1.655-1.62Zm55.319 10.44 4.59 4.494a1.047 1.047 0 0 1 0 1.506l-20.694 20.26a1.128 1.128 0 0 1-1.568 0l-14.686-14.38a.907.907 0 0 0-1.267 0L32.68 70.655a1.128 1.128 0 0 1-1.568 0L10.42 50.394a1.047 1.047 0 0 1 0-1.506l4.59-4.493a1.128 1.128 0 0 1 1.567 0l14.687 14.379a.907.907 0 0 0 1.266 0l-.35-.357.35.357 14.686-14.38a1.128 1.128 0 0 1 1.568 0l14.687 14.38a.907.907 0 0 0 1.267 0l14.686-14.38a1.128 1.128 0 0 1 1.568 0Z"/></svg>`,BACK_ICON:W`<svg width="10" height="18" viewBox="0 0 10 18"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.735.179a.75.75 0 0 1 .087 1.057L2.92 8.192a1.25 1.25 0 0 0 0 1.617l5.902 6.956a.75.75 0 1 1-1.144.97L1.776 10.78a2.75 2.75 0 0 1 0-3.559L7.678.265A.75.75 0 0 1 8.735.18Z" fill="#fff"/></svg>`,COPY_ICON:W`<svg width="24" height="24" fill="none"><path fill="#fff" fill-rule="evenodd" d="M7.01 7.01c.03-1.545.138-2.5.535-3.28A5 5 0 0 1 9.73 1.545C10.8 1 12.2 1 15 1c2.8 0 4.2 0 5.27.545a5 5 0 0 1 2.185 2.185C23 4.8 23 6.2 23 9c0 2.8 0 4.2-.545 5.27a5 5 0 0 1-2.185 2.185c-.78.397-1.735.505-3.28.534l-.001.01c-.03 1.54-.138 2.493-.534 3.27a5 5 0 0 1-2.185 2.186C13.2 23 11.8 23 9 23c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C1 19.2 1 17.8 1 15c0-2.8 0-4.2.545-5.27A5 5 0 0 1 3.73 7.545C4.508 7.149 5.46 7.04 7 7.01h.01ZM15 15.5c-1.425 0-2.403-.001-3.162-.063-.74-.06-1.139-.172-1.427-.319a3.5 3.5 0 0 1-1.53-1.529c-.146-.288-.257-.686-.318-1.427C8.501 11.403 8.5 10.425 8.5 9c0-1.425.001-2.403.063-3.162.06-.74.172-1.139.318-1.427a3.5 3.5 0 0 1 1.53-1.53c.288-.146.686-.257 1.427-.318.759-.062 1.737-.063 3.162-.063 1.425 0 2.403.001 3.162.063.74.06 1.139.172 1.427.318a3.5 3.5 0 0 1 1.53 1.53c.146.288.257.686.318 1.427.062.759.063 1.737.063 3.162 0 1.425-.001 2.403-.063 3.162-.06.74-.172 1.139-.319 1.427a3.5 3.5 0 0 1-1.529 1.53c-.288.146-.686.257-1.427.318-.759.062-1.737.063-3.162.063ZM7 8.511c-.444.009-.825.025-1.162.052-.74.06-1.139.172-1.427.318a3.5 3.5 0 0 0-1.53 1.53c-.146.288-.257.686-.318 1.427-.062.759-.063 1.737-.063 3.162 0 1.425.001 2.403.063 3.162.06.74.172 1.139.318 1.427a3.5 3.5 0 0 0 1.53 1.53c.288.146.686.257 1.427.318.759.062 1.737.063 3.162.063 1.425 0 2.403-.001 3.162-.063.74-.06 1.139-.172 1.427-.319a3.5 3.5 0 0 0 1.53-1.53c.146-.287.257-.685.318-1.426.027-.337.043-.718.052-1.162H15c-2.8 0-4.2 0-5.27-.545a5 5 0 0 1-2.185-2.185C7 13.2 7 11.8 7 9v-.489Z" clip-rule="evenodd"/></svg>`,RETRY_ICON:W`<svg width="15" height="16" viewBox="0 0 15 16"><path d="M6.464 2.03A.75.75 0 0 0 5.403.97L2.08 4.293a1 1 0 0 0 0 1.414L5.403 9.03a.75.75 0 0 0 1.06-1.06L4.672 6.177a.25.25 0 0 1 .177-.427h2.085a4 4 0 1 1-3.93 4.746c-.077-.407-.405-.746-.82-.746-.414 0-.755.338-.7.748a5.501 5.501 0 1 0 5.45-6.248H4.848a.25.25 0 0 1-.177-.427L6.464 2.03Z" fill="#fff"/></svg>`,DESKTOP_ICON:W`<svg width="16" height="16" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 5.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C2.204 1 3.13 1 4.98 1h6.04c1.85 0 2.775 0 3.466.394a3 3 0 0 1 1.12 1.12C16 3.204 16 4.13 16 5.98v1.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C13.796 12 12.87 12 11.02 12H4.98c-1.85 0-2.775 0-3.466-.394a3 3 0 0 1-1.12-1.12C0 9.796 0 8.87 0 7.02V5.98ZM4.98 2.5h6.04c.953 0 1.568.001 2.034.043.446.04.608.108.69.154a1.5 1.5 0 0 1 .559.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033v1.04c0 .952-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.046-.243.114-.69.154-.466.042-1.08.043-2.033.043H4.98c-.952 0-1.568-.001-2.034-.043-.446-.04-.608-.108-.69-.154a1.5 1.5 0 0 1-.559-.56c-.046-.08-.114-.243-.154-.69-.042-.465-.043-1.08-.043-2.033V5.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.046.243-.114.69-.154.465-.042 1.08-.043 2.033-.043Z" fill="#fff"/><path d="M4 14.25a.75.75 0 0 1 .75-.75h6.5a.75.75 0 0 1 0 1.5h-6.5a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,MOBILE_ICON:W`<svg width="16" height="16" viewBox="0 0 16 16"><path d="M6.75 5a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M3 4.98c0-1.85 0-2.775.394-3.466a3 3 0 0 1 1.12-1.12C5.204 0 6.136 0 8 0s2.795 0 3.486.394a3 3 0 0 1 1.12 1.12C13 2.204 13 3.13 13 4.98v6.04c0 1.85 0 2.775-.394 3.466a3 3 0 0 1-1.12 1.12C10.796 16 9.864 16 8 16s-2.795 0-3.486-.394a3 3 0 0 1-1.12-1.12C3 13.796 3 12.87 3 11.02V4.98Zm8.5 0v6.04c0 .953-.001 1.568-.043 2.034-.04.446-.108.608-.154.69a1.499 1.499 0 0 1-.56.559c-.08.045-.242.113-.693.154-.47.042-1.091.043-2.05.043-.959 0-1.58-.001-2.05-.043-.45-.04-.613-.109-.693-.154a1.5 1.5 0 0 1-.56-.56c-.046-.08-.114-.243-.154-.69-.042-.466-.043-1.08-.043-2.033V4.98c0-.952.001-1.568.043-2.034.04-.446.108-.608.154-.69a1.5 1.5 0 0 1 .56-.559c.08-.045.243-.113.693-.154C6.42 1.501 7.041 1.5 8 1.5c.959 0 1.58.001 2.05.043.45.04.613.109.693.154a1.5 1.5 0 0 1 .56.56c.046.08.114.243.154.69.042.465.043 1.08.043 2.033Z" fill="#fff"/></svg>`,ARROW_DOWN_ICON:W`<svg width="14" height="14" viewBox="0 0 14 14"><path d="M2.28 7.47a.75.75 0 0 0-1.06 1.06l5.25 5.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0-1.06-1.06l-3.544 3.543a.25.25 0 0 1-.426-.177V.75a.75.75 0 0 0-1.5 0v10.086a.25.25 0 0 1-.427.176L2.28 7.47Z" fill="#fff"/></svg>`,ARROW_UP_RIGHT_ICON:W`<svg width="15" height="14" fill="none"><path d="M4.5 1.75A.75.75 0 0 1 5.25 1H12a1.5 1.5 0 0 1 1.5 1.5v6.75a.75.75 0 0 1-1.5 0V4.164a.25.25 0 0 0-.427-.176L4.061 11.5A.75.75 0 0 1 3 10.44l7.513-7.513a.25.25 0 0 0-.177-.427H5.25a.75.75 0 0 1-.75-.75Z" fill="#fff"/></svg>`,ARROW_RIGHT_ICON:W`<svg width="6" height="14" viewBox="0 0 6 14"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.181 1.099a.75.75 0 0 1 1.024.279l2.433 4.258a2.75 2.75 0 0 1 0 2.729l-2.433 4.257a.75.75 0 1 1-1.303-.744L4.335 7.62a1.25 1.25 0 0 0 0-1.24L1.902 2.122a.75.75 0 0 1 .28-1.023Z" fill="#fff"/></svg>`,QRCODE_ICON:W`<svg width="25" height="24" viewBox="0 0 25 24"><path d="M23.748 9a.748.748 0 0 0 .748-.752c-.018-2.596-.128-4.07-.784-5.22a6 6 0 0 0-2.24-2.24c-1.15-.656-2.624-.766-5.22-.784a.748.748 0 0 0-.752.748c0 .414.335.749.748.752 1.015.007 1.82.028 2.494.088.995.09 1.561.256 1.988.5.7.398 1.28.978 1.679 1.678.243.427.41.993.498 1.988.061.675.082 1.479.09 2.493a.753.753 0 0 0 .75.749ZM3.527.788C4.677.132 6.152.022 8.747.004A.748.748 0 0 1 9.5.752a.753.753 0 0 1-.749.752c-1.014.007-1.818.028-2.493.088-.995.09-1.561.256-1.988.5-.7.398-1.28.978-1.679 1.678-.243.427-.41.993-.499 1.988-.06.675-.081 1.479-.088 2.493A.753.753 0 0 1 1.252 9a.748.748 0 0 1-.748-.752c.018-2.596.128-4.07.784-5.22a6 6 0 0 1 2.24-2.24ZM1.252 15a.748.748 0 0 0-.748.752c.018 2.596.128 4.07.784 5.22a6 6 0 0 0 2.24 2.24c1.15.656 2.624.766 5.22.784a.748.748 0 0 0 .752-.748.753.753 0 0 0-.749-.752c-1.014-.007-1.818-.028-2.493-.089-.995-.089-1.561-.255-1.988-.498a4.5 4.5 0 0 1-1.679-1.68c-.243-.426-.41-.992-.499-1.987-.06-.675-.081-1.479-.088-2.493A.753.753 0 0 0 1.252 15ZM22.996 15.749a.753.753 0 0 1 .752-.749c.415 0 .751.338.748.752-.018 2.596-.128 4.07-.784 5.22a6 6 0 0 1-2.24 2.24c-1.15.656-2.624.766-5.22.784a.748.748 0 0 1-.752-.748c0-.414.335-.749.748-.752 1.015-.007 1.82-.028 2.494-.089.995-.089 1.561-.255 1.988-.498a4.5 4.5 0 0 0 1.679-1.68c.243-.426.41-.992.498-1.987.061-.675.082-1.479.09-2.493Z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 4a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 11h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 4H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1ZM13.5 6.5A2.5 2.5 0 0 1 16 4h2a2.5 2.5 0 0 1 2.5 2.5v2A2.5 2.5 0 0 1 18 11h-2a2.5 2.5 0 0 1-2.5-2.5v-2Zm2.5-1h2a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1v-2a1 1 0 0 1 1-1ZM7 13a2.5 2.5 0 0 0-2.5 2.5v2A2.5 2.5 0 0 0 7 20h2a2.5 2.5 0 0 0 2.5-2.5v-2A2.5 2.5 0 0 0 9 13H7Zm2 1.5H7a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1Z" fill="#fff"/><path d="M13.5 15.5c0-.465 0-.697.038-.89a2 2 0 0 1 1.572-1.572C15.303 13 15.535 13 16 13v2.5h-2.5ZM18 13c.465 0 .697 0 .89.038a2 2 0 0 1 1.572 1.572c.038.193.038.425.038.89H18V13ZM18 17.5h2.5c0 .465 0 .697-.038.89a2 2 0 0 1-1.572 1.572C18.697 20 18.465 20 18 20v-2.5ZM13.5 17.5H16V20c-.465 0-.697 0-.89-.038a2 2 0 0 1-1.572-1.572c-.038-.193-.038-.425-.038-.89Z" fill="#fff"/></svg>`,SCAN_ICON:W`<svg width="16" height="16" fill="none"><path fill="#fff" d="M10 15.216c0 .422.347.763.768.74 1.202-.064 2.025-.222 2.71-.613a5.001 5.001 0 0 0 1.865-1.866c.39-.684.549-1.507.613-2.709a.735.735 0 0 0-.74-.768.768.768 0 0 0-.76.732c-.009.157-.02.306-.032.447-.073.812-.206 1.244-.384 1.555-.31.545-.761.996-1.306 1.306-.311.178-.743.311-1.555.384-.141.013-.29.023-.447.032a.768.768 0 0 0-.732.76ZM10 .784c0 .407.325.737.732.76.157.009.306.02.447.032.812.073 1.244.206 1.555.384a3.5 3.5 0 0 1 1.306 1.306c.178.311.311.743.384 1.555.013.142.023.29.032.447a.768.768 0 0 0 .76.732.734.734 0 0 0 .74-.768c-.064-1.202-.222-2.025-.613-2.71A5 5 0 0 0 13.477.658c-.684-.39-1.507-.549-2.709-.613a.735.735 0 0 0-.768.74ZM5.232.044A.735.735 0 0 1 6 .784a.768.768 0 0 1-.732.76c-.157.009-.305.02-.447.032-.812.073-1.244.206-1.555.384A3.5 3.5 0 0 0 1.96 3.266c-.178.311-.311.743-.384 1.555-.013.142-.023.29-.032.447A.768.768 0 0 1 .784 6a.735.735 0 0 1-.74-.768c.064-1.202.222-2.025.613-2.71A5 5 0 0 1 2.523.658C3.207.267 4.03.108 5.233.044ZM5.268 14.456a.768.768 0 0 1 .732.76.734.734 0 0 1-.768.74c-1.202-.064-2.025-.222-2.71-.613a5 5 0 0 1-1.865-1.866c-.39-.684-.549-1.507-.613-2.709A.735.735 0 0 1 .784 10c.407 0 .737.325.76.732.009.157.02.306.032.447.073.812.206 1.244.384 1.555a3.5 3.5 0 0 0 1.306 1.306c.311.178.743.311 1.555.384.142.013.29.023.447.032Z"/></svg>`,CHECKMARK_ICON:W`<svg width="13" height="12" viewBox="0 0 13 12"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.155.132a.75.75 0 0 1 .232 1.035L5.821 11.535a1 1 0 0 1-1.626.09L.665 7.21a.75.75 0 1 1 1.17-.937L4.71 9.867a.25.25 0 0 0 .406-.023L11.12.364a.75.75 0 0 1 1.035-.232Z" fill="#fff"/></svg>`,SEARCH_ICON:W`<svg width="20" height="21"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.432 13.992c-.354-.353-.91-.382-1.35-.146a5.5 5.5 0 1 1 2.265-2.265c-.237.441-.208.997.145 1.35l3.296 3.296a.75.75 0 1 1-1.06 1.061l-3.296-3.296Zm.06-5a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z" fill="#949E9E"/></svg>`,WALLET_PLACEHOLDER:W`<svg width="60" height="60" fill="none" viewBox="0 0 60 60"><g clip-path="url(#q)"><path id="wallet-placeholder-fill" fill="#fff" d="M0 24.9c0-9.251 0-13.877 1.97-17.332a15 15 0 0 1 5.598-5.597C11.023 0 15.648 0 24.9 0h10.2c9.252 0 13.877 0 17.332 1.97a15 15 0 0 1 5.597 5.598C60 11.023 60 15.648 60 24.9v10.2c0 9.252 0 13.877-1.97 17.332a15.001 15.001 0 0 1-5.598 5.597C48.977 60 44.352 60 35.1 60H24.9c-9.251 0-13.877 0-17.332-1.97a15 15 0 0 1-5.597-5.598C0 48.977 0 44.352 0 35.1V24.9Z"/><path id="wallet-placeholder-dash" stroke="#000" stroke-dasharray="4 4" stroke-width="1.5" d="M.04 41.708a231.598 231.598 0 0 1-.039-4.403l.75-.001L.75 35.1v-2.55H0v-5.1h.75V24.9l.001-2.204h-.75c.003-1.617.011-3.077.039-4.404l.75.016c.034-1.65.099-3.08.218-4.343l-.746-.07c.158-1.678.412-3.083.82-4.316l.713.236c.224-.679.497-1.296.827-1.875a14.25 14.25 0 0 1 1.05-1.585L3.076 5.9A15 15 0 0 1 5.9 3.076l.455.596a14.25 14.25 0 0 1 1.585-1.05c.579-.33 1.196-.603 1.875-.827l-.236-.712C10.812.674 12.217.42 13.895.262l.07.746C15.23.89 16.66.824 18.308.79l-.016-.75C19.62.012 21.08.004 22.695.001l.001.75L24.9.75h2.55V0h5.1v.75h2.55l2.204.001v-.75c1.617.003 3.077.011 4.404.039l-.016.75c1.65.034 3.08.099 4.343.218l.07-.746c1.678.158 3.083.412 4.316.82l-.236.713c.679.224 1.296.497 1.875.827a14.24 14.24 0 0 1 1.585 1.05l.455-.596A14.999 14.999 0 0 1 56.924 5.9l-.596.455c.384.502.735 1.032 1.05 1.585.33.579.602 1.196.827 1.875l.712-.236c.409 1.233.663 2.638.822 4.316l-.747.07c.119 1.264.184 2.694.218 4.343l.75-.016c.028 1.327.036 2.787.039 4.403l-.75.001.001 2.204v2.55H60v5.1h-.75v2.55l-.001 2.204h.75a231.431 231.431 0 0 1-.039 4.404l-.75-.016c-.034 1.65-.099 3.08-.218 4.343l.747.07c-.159 1.678-.413 3.083-.822 4.316l-.712-.236a10.255 10.255 0 0 1-.827 1.875 14.242 14.242 0 0 1-1.05 1.585l.596.455a14.997 14.997 0 0 1-2.824 2.824l-.455-.596c-.502.384-1.032.735-1.585 1.05-.579.33-1.196.602-1.875.827l.236.712c-1.233.409-2.638.663-4.316.822l-.07-.747c-1.264.119-2.694.184-4.343.218l.016.75c-1.327.028-2.787.036-4.403.039l-.001-.75-2.204.001h-2.55V60h-5.1v-.75H24.9l-2.204-.001v.75a231.431 231.431 0 0 1-4.404-.039l.016-.75c-1.65-.034-3.08-.099-4.343-.218l-.07.747c-1.678-.159-3.083-.413-4.316-.822l.236-.712a10.258 10.258 0 0 1-1.875-.827 14.252 14.252 0 0 1-1.585-1.05l-.455.596A14.999 14.999 0 0 1 3.076 54.1l.596-.455a14.24 14.24 0 0 1-1.05-1.585 10.259 10.259 0 0 1-.827-1.875l-.712.236C.674 49.188.42 47.783.262 46.105l.746-.07C.89 44.77.824 43.34.79 41.692l-.75.016Z"/><path fill="#fff" fill-rule="evenodd" d="M35.643 32.145c-.297-.743-.445-1.114-.401-1.275a.42.42 0 0 1 .182-.27c.134-.1.463-.1 1.123-.1.742 0 1.499.046 2.236-.05a6 6 0 0 0 5.166-5.166c.051-.39.051-.855.051-1.784 0-.928 0-1.393-.051-1.783a6 6 0 0 0-5.166-5.165c-.39-.052-.854-.052-1.783-.052h-7.72c-4.934 0-7.401 0-9.244 1.051a8 8 0 0 0-2.985 2.986C16.057 22.28 16.003 24.58 16 29 15.998 31.075 16 33.15 16 35.224A7.778 7.778 0 0 0 23.778 43H28.5c1.394 0 2.09 0 2.67-.116a6 6 0 0 0 4.715-4.714c.115-.58.115-1.301.115-2.744 0-1.31 0-1.964-.114-2.49a4.998 4.998 0 0 0-.243-.792Z" clip-rule="evenodd"/><path fill="#9EA9A9" fill-rule="evenodd" d="M37 18h-7.72c-2.494 0-4.266.002-5.647.126-1.361.122-2.197.354-2.854.728a6.5 6.5 0 0 0-2.425 2.426c-.375.657-.607 1.492-.729 2.853-.11 1.233-.123 2.777-.125 4.867 0 .7 0 1.05.097 1.181.096.13.182.181.343.2.163.02.518-.18 1.229-.581a6.195 6.195 0 0 1 3.053-.8H37c.977 0 1.32-.003 1.587-.038a4.5 4.5 0 0 0 3.874-3.874c.036-.268.039-.611.039-1.588 0-.976-.003-1.319-.038-1.587a4.5 4.5 0 0 0-3.875-3.874C38.32 18.004 37.977 18 37 18Zm-7.364 12.5h-7.414a4.722 4.722 0 0 0-4.722 4.723 6.278 6.278 0 0 0 6.278 6.278H28.5c1.466 0 1.98-.008 2.378-.087a4.5 4.5 0 0 0 3.535-3.536c.08-.397.087-.933.087-2.451 0-1.391-.009-1.843-.08-2.17a3.5 3.5 0 0 0-2.676-2.676c-.328-.072-.762-.08-2.108-.08Z" clip-rule="evenodd"/></g><defs><clipPath id="q"><path fill="#fff" d="M0 0h60v60H0z"/></clipPath></defs></svg>`,GLOBE_ICON:W`<svg width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#fff" fill-rule="evenodd" d="M15.5 8a7.5 7.5 0 1 1-15 0 7.5 7.5 0 0 1 15 0Zm-2.113.75c.301 0 .535.264.47.558a6.01 6.01 0 0 1-2.867 3.896c-.203.116-.42-.103-.334-.32.409-1.018.691-2.274.797-3.657a.512.512 0 0 1 .507-.477h1.427Zm.47-2.058c.065.294-.169.558-.47.558H11.96a.512.512 0 0 1-.507-.477c-.106-1.383-.389-2.638-.797-3.656-.087-.217.13-.437.333-.32a6.01 6.01 0 0 1 2.868 3.895Zm-4.402.558c.286 0 .515-.24.49-.525-.121-1.361-.429-2.534-.83-3.393-.279-.6-.549-.93-.753-1.112a.535.535 0 0 0-.724 0c-.204.182-.474.513-.754 1.112-.4.859-.708 2.032-.828 3.393a.486.486 0 0 0 .49.525h2.909Zm-5.415 0c.267 0 .486-.21.507-.477.106-1.383.389-2.638.797-3.656.087-.217-.13-.437-.333-.32a6.01 6.01 0 0 0-2.868 3.895c-.065.294.169.558.47.558H4.04ZM2.143 9.308c-.065-.294.169-.558.47-.558H4.04c.267 0 .486.21.507.477.106 1.383.389 2.639.797 3.657.087.217-.13.436-.333.32a6.01 6.01 0 0 1-2.868-3.896Zm3.913-.033a.486.486 0 0 1 .49-.525h2.909c.286 0 .515.24.49.525-.121 1.361-.428 2.535-.83 3.394-.279.6-.549.93-.753 1.112a.535.535 0 0 1-.724 0c-.204-.182-.474-.513-.754-1.112-.4-.859-.708-2.033-.828-3.394Z" clip-rule="evenodd"/></svg>`},ni=_`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var ai=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,di=(t,e,o,i)=>{for(var r=i>1?void 0:i?ci(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ai(e,o,r),r};let _t=class extends w{render(){return c`<div class="wcm-toolbar-placeholder"></div><div class="wcm-toolbar">${C.WALLET_CONNECT_LOGO} <button @click="${ke.close}">${C.CROSS_ICON}</button></div>`}};_t.styles=[v.globalCss,ni];_t=di([y("wcm-modal-backcard")],_t);const hi=_`main{padding:20px;padding-top:0;width:100%}`;var mi=Object.defineProperty,pi=Object.getOwnPropertyDescriptor,ui=(t,e,o,i)=>{for(var r=i>1?void 0:i?pi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&mi(e,o,r),r};let Ct=class extends w{render(){return c`<main><slot></slot></main>`}};Ct.styles=[v.globalCss,hi];Ct=ui([y("wcm-modal-content")],Ct);const fi=_`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var wi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,gi=(t,e,o,i)=>{for(var r=i>1?void 0:i?vi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&wi(e,o,r),r};let Ot=class extends w{render(){return c`<footer><slot></slot></footer>`}};Ot.styles=[v.globalCss,fi];Ot=gi([y("wcm-modal-footer")],Ot);const bi=_`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var yi=Object.defineProperty,xi=Object.getOwnPropertyDescriptor,De=(t,e,o,i)=>{for(var r=i>1?void 0:i?xi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&yi(e,o,r),r};let le=class extends w{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return c`<button class="wcm-back-btn" @click="${A.goBack}">${C.BACK_ICON}</button>`}actionBtnTemplate(){return c`<button class="wcm-action-btn" @click="${this.onAction}">${this.actionIcon}</button>`}render(){const t={"wcm-border":this.border},e=A.state.history.length>1,o=this.title?c`<wcm-text variant="big-bold">${this.title}</wcm-text>`:c`<slot></slot>`;return c`<header class="${Z(t)}">${e?this.backBtnTemplate():null} ${o} ${this.onAction?this.actionBtnTemplate():null}</header>`}};le.styles=[v.globalCss,bi];De([u()],le.prototype,"title",2);De([u()],le.prototype,"onAction",2);De([u()],le.prototype,"actionIcon",2);De([u({type:Boolean})],le.prototype,"border",2);le=De([y("wcm-modal-header")],le);const m={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(t,e){const o=t.renderRoot.querySelector(e);if(!o)throw new Error(`${e} not found`);return o},getWalletIcon({id:t,image_id:e}){const{walletImages:o}=re.state;return o!=null&&o[t]?o[t]:e?D.getWalletImageUrl(e):""},getWalletName(t,e=!1){return e&&t.length>8?`${t.substring(0,8)}..`:t},isMobileAnimation(){return window.innerWidth<=m.MOBILE_BREAKPOINT},async preloadImage(t){const e=new Promise((o,i)=>{const r=new Image;r.onload=o,r.onerror=i,r.crossOrigin="anonymous",r.src=t});return Promise.race([e,h.wait(3e3)])},getErrorMessage(t){return t instanceof Error?t.message:"Unknown Error"},debounce(t,e=500){let o;return(...i)=>{function r(){t(...i)}o&&clearTimeout(o),o=setTimeout(r,e)}},handleMobileLinking(t,e="_self"){const{walletConnectUri:o}=H.state,{mobile:i,name:r}=t,s=i==null?void 0:i.native,l=i==null?void 0:i.universal;m.setRecentWallet(t);function n(a){if(s){const d=h.formatNativeUrl(s,a,r);h.openHref(d,e)}else if(l){const d=h.formatUniversalUrl(l,a,r);h.openHref(d,e)}}o&&n(o)},handleAndroidLinking(){const{walletConnectUri:t}=H.state;t&&(h.setWalletConnectAndroidDeepLink(t),h.openHref(t,h.isTelegram()?"_blank":"_self"))},async handleUriCopy(){const{walletConnectUri:t}=H.state;if(t)try{await navigator.clipboard.writeText(t),F.openToast("Link copied","success")}catch{F.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:t}=re.state,e=Object.values(t??{});return Object.values(e)},truncate(t,e=8){return t.length<=e?t:`${t.substring(0,4)}...${t.substring(t.length-4)}`},setRecentWallet(t){try{localStorage.setItem(m.WCM_RECENT_WALLET_DATA,JSON.stringify(t))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const t=localStorage.getItem(m.WCM_RECENT_WALLET_DATA);return t?JSON.parse(t):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(t,e){return t.toUpperCase().includes(e.toUpperCase())},openWalletExplorerUrl(){h.openHref(m.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:t,mobile:e}=h.getWalletRouterData(),o=!!(t!=null&&t.native),i=!!(t!=null&&t.universal),r=!!(e!=null&&e.native)||!!(e!=null&&e.universal);return{isDesktop:o,isMobile:r,isWeb:i}},goToConnectingView(t){A.setData({Wallet:t});const e=h.isMobile(),{isDesktop:o,isWeb:i,isMobile:r}=m.getCachedRouterWalletPlatforms();e?r?(A.push("MobileConnecting"),!h.isAndroid()&&h.isTelegram()&&this.handleMobileLinking(t,"_blank")):i?A.push("WebConnecting"):A.push("InstallWallet"):o?A.push("DesktopConnecting"):i?A.push("WebConnecting"):r?A.push("MobileQrcodeConnecting"):A.push("InstallWallet")}},$i=_`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var _i=Object.defineProperty,Ci=Object.getOwnPropertyDescriptor,Bt=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ci(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&_i(e,o,r),r};let Me=class extends w{constructor(){super(),this.view=A.state.view,this.prevView=A.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=A.subscribe(t=>{this.view!==t.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([t])=>{const e=`${t.contentRect.height}px`;this.oldHeight!=="0px"&&oe(this.routerEl,{height:[this.oldHeight,e]},{duration:.2}),this.oldHeight=e}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var t,e;(t=this.unsubscribe)==null||t.call(this),(e=this.resizeObserver)==null||e.disconnect()}get routerEl(){return m.getShadowRootElement(this,".wcm-router")}get contentEl(){return m.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return c`<wcm-connect-wallet-view></wcm-connect-wallet-view>`;case"DesktopConnecting":return c`<wcm-desktop-connecting-view></wcm-desktop-connecting-view>`;case"MobileConnecting":return c`<wcm-mobile-connecting-view></wcm-mobile-connecting-view>`;case"WebConnecting":return c`<wcm-web-connecting-view></wcm-web-connecting-view>`;case"MobileQrcodeConnecting":return c`<wcm-mobile-qr-connecting-view></wcm-mobile-qr-connecting-view>`;case"WalletExplorer":return c`<wcm-wallet-explorer-view></wcm-wallet-explorer-view>`;case"Qrcode":return c`<wcm-qrcode-view></wcm-qrcode-view>`;case"InstallWallet":return c`<wcm-install-wallet-view></wcm-install-wallet-view>`;default:return c`<div>Not Found</div>`}}async onChangeRoute(){await oe(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=A.state.view,oe(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return c`<div class="wcm-router"><div class="wcm-content">${this.viewTemplate()}</div></div>`}};Me.styles=[v.globalCss,$i];Bt([L()],Me.prototype,"view",2);Bt([L()],Me.prototype,"prevView",2);Me=Bt([y("wcm-modal-router")],Me);const Oi=_`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var Ai=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,Ro=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ei(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Ai(e,o,r),r};let Qe=class extends w{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=F.subscribe(t=>{t.open?(this.open=!0,this.timeout=setTimeout(()=>F.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var t;(t=this.unsubscribe)==null||t.call(this),clearTimeout(this.timeout),F.closeToast()}render(){const{message:t,variant:e}=F.state,o={"wcm-success":e==="success","wcm-error":e==="error"};return this.open?c`<div class="${Z(o)}">${e==="success"?C.CHECKMARK_ICON:null} ${e==="error"?C.CROSS_ICON:null}<wcm-text variant="small-regular">${t}</wcm-text></div>`:null}};Qe.styles=[v.globalCss,Oi];Ro([L()],Qe.prototype,"open",2);Qe=Ro([y("wcm-modal-toast")],Qe);const Pi=.1,po=2.5,B=7;function ut(t,e,o){return t===e?!1:(t-e<0?e-t:t-e)<=o+Pi}function Ii(t,e){const o=Array.prototype.slice.call(ko.create(t,{errorCorrectionLevel:e}).modules.data,0),i=Math.sqrt(o.length);return o.reduce((r,s,l)=>(l%i===0?r.push([s]):r[r.length-1].push(s))&&r,[])}const Ti={generate(t,e,o){const i="#141414",r="#ffffff",s=[],l=Ii(t,"Q"),n=e/l.length,a=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];a.forEach(({x:g,y:f})=>{const P=(l.length-B)*n*g,b=(l.length-B)*n*f,M=.45;for(let R=0;R<a.length;R+=1){const N=n*(B-R*2);s.push(Ze`<rect fill="${R%2===0?i:r}" height="${N}" rx="${N*M}" ry="${N*M}" width="${N}" x="${P+n*R}" y="${b+n*R}">`)}});const d=Math.floor((o+25)/n),x=l.length/2-d/2,$=l.length/2+d/2-1,p=[];l.forEach((g,f)=>{g.forEach((P,b)=>{if(l[f][b]&&!(f<B&&b<B||f>l.length-(B+1)&&b<B||f<B&&b>l.length-(B+1))&&!(f>x&&f<$&&b>x&&b<$)){const M=f*n+n/2,R=b*n+n/2;p.push([M,R])}})});const O={};return p.forEach(([g,f])=>{O[g]?O[g].push(f):O[g]=[f]}),Object.entries(O).map(([g,f])=>{const P=f.filter(b=>f.every(M=>!ut(b,M,n)));return[Number(g),P]}).forEach(([g,f])=>{f.forEach(P=>{s.push(Ze`<circle cx="${g}" cy="${P}" fill="${i}" r="${n/po}">`)})}),Object.entries(O).filter(([g,f])=>f.length>1).map(([g,f])=>{const P=f.filter(b=>f.some(M=>ut(b,M,n)));return[Number(g),P]}).map(([g,f])=>{f.sort((b,M)=>b<M?-1:1);const P=[];for(const b of f){const M=P.find(R=>R.some(N=>ut(b,N,n)));M?M.push(b):P.push([b])}return[g,P.map(b=>[b[0],b[b.length-1]])]}).forEach(([g,f])=>{f.forEach(([P,b])=>{s.push(Ze`<line x1="${g}" x2="${g}" y1="${P}" y2="${b}" stroke="${i}" stroke-width="${n/(po/2)}" stroke-linecap="round">`)})}),s}},Mi=_`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var Wi=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,ye=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ri(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Wi(e,o,r),r};let G=class extends w{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=pe.state.themeMode==="light"?this.size:this.size-18*2;return Ze`<svg height="${e}" width="${e}">${Ti.generate(this.uri,e,e/4)}</svg>`}render(){const t={"wcm-dark":pe.state.themeMode==="dark"};return c`<div style="${`width: ${this.size}px`}" class="${Z(t)}">${this.walletId||this.imageUrl?c`<wcm-wallet-image walletId="${S(this.walletId)}" imageId="${S(this.imageId)}" imageUrl="${S(this.imageUrl)}"></wcm-wallet-image>`:C.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}</div>`}};G.styles=[v.globalCss,Mi];ye([u()],G.prototype,"uri",2);ye([u({type:Number})],G.prototype,"size",2);ye([u()],G.prototype,"imageId",2);ye([u()],G.prototype,"walletId",2);ye([u()],G.prototype,"imageUrl",2);G=ye([y("wcm-qrcode")],G);const Si=_`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var Di=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,So=(t,e,o,i)=>{for(var r=i>1?void 0:i?Li(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Di(e,o,r),r};let Ge=class extends w{constructor(){super(...arguments),this.onChange=()=>null}render(){return c`<input type="text" @input="${this.onChange}" placeholder="Search wallets"> ${C.SEARCH_ICON}`}};Ge.styles=[v.globalCss,Si];So([u()],Ge.prototype,"onChange",2);Ge=So([y("wcm-search-input")],Ge);const Ni=_`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var ji=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,Hi=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ui(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ji(e,o,r),r};let At=class extends w{render(){return c`<svg viewBox="0 0 50 50" width="24" height="24"><circle cx="25" cy="25" r="20" fill="none" stroke-width="4" stroke="#fff"/></svg>`}};At.styles=[v.globalCss,Ni];At=Hi([y("wcm-spinner")],At);const ki=_`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var Bi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Zt=(t,e,o,i)=>{for(var r=i>1?void 0:i?Zi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Bi(e,o,r),r};let We=class extends w{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const t={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return c`<span><slot class="${Z(t)}"></slot></span>`}};We.styles=[v.globalCss,ki];Zt([u()],We.prototype,"variant",2);Zt([u()],We.prototype,"color",2);We=Zt([y("wcm-text")],We);const zi=_`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var Vi=Object.defineProperty,Fi=Object.getOwnPropertyDescriptor,X=(t,e,o,i)=>{for(var r=i>1?void 0:i?Fi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Vi(e,o,r),r};let k=class extends w{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?c`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">RECENT</wcm-text>`:this.installed?c`<wcm-text class="wcm-sublabel" variant="xsmall-bold" color="tertiary">INSTALLED</wcm-text>`:null}handleClick(){Ho.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var t;return c`<button @click="${this.handleClick.bind(this)}"><div><wcm-wallet-image walletId="${this.walletId}" imageId="${S(this.imageId)}"></wcm-wallet-image><wcm-text variant="xsmall-regular">${(t=this.label)!=null?t:m.getWalletName(this.name,!0)}</wcm-text>${this.sublabelTemplate()}</div></button>`}};k.styles=[v.globalCss,zi];X([u()],k.prototype,"onClick",2);X([u()],k.prototype,"name",2);X([u()],k.prototype,"walletId",2);X([u()],k.prototype,"label",2);X([u()],k.prototype,"imageId",2);X([u({type:Boolean})],k.prototype,"installed",2);X([u({type:Boolean})],k.prototype,"recent",2);k=X([y("wcm-wallet-button")],k);const qi=_`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var Ki=Object.defineProperty,Qi=Object.getOwnPropertyDescriptor,tt=(t,e,o,i)=>{for(var r=i>1?void 0:i?Qi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Ki(e,o,r),r};let ve=class extends w{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var t;const e=(t=this.imageUrl)!=null&&t.length?this.imageUrl:m.getWalletIcon({id:this.walletId,image_id:this.imageId});return c`${e.length?c`<div><img crossorigin="anonymous" src="${e}" alt="${this.id}"></div>`:C.WALLET_PLACEHOLDER}`}};ve.styles=[v.globalCss,qi];tt([u()],ve.prototype,"walletId",2);tt([u()],ve.prototype,"imageId",2);tt([u()],ve.prototype,"imageUrl",2);ve=tt([y("wcm-wallet-image")],ve);var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,Do=(t,e,o,i)=>{for(var r=i>1?void 0:i?Yi(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Gi(e,o,r),r};let Et=class extends w{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(t){try{t!=null&&t.length&&await Promise.all(t.map(async e=>m.preloadImage(e)))}catch{console.info("Unsuccessful attempt at preloading some images",t)}}async preloadListings(){if(re.state.enableExplorer){await D.getRecomendedWallets(),H.setIsDataLoaded(!0);const{recomendedWallets:t}=D.state,e=t.map(o=>m.getWalletIcon(o));await this.loadImages(e)}else H.setIsDataLoaded(!0)}async preloadCustomImages(){const t=m.getCustomImageUrls();await this.loadImages(t)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(t){console.error(t),F.openToast("Failed preloading","error")}}};Do([L()],Et.prototype,"preload",2);Et=Do([y("wcm-explorer-context")],Et);var Xi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,es=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ji(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Xi(e,o,r),r};let uo=class extends w{constructor(){super(),this.unsubscribeTheme=void 0,v.setTheme(),this.unsubscribeTheme=pe.subscribe(v.setTheme)}disconnectedCallback(){var t;(t=this.unsubscribeTheme)==null||t.call(this)}};uo=es([y("wcm-theme-context")],uo);const ts=_`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var os=Object.defineProperty,rs=Object.getOwnPropertyDescriptor,is=(t,e,o,i)=>{for(var r=i>1?void 0:i?rs(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&os(e,o,r),r};let Pt=class extends w{onGoToQrcode(){A.push("Qrcode")}render(){const{recomendedWallets:t}=D.state,e=[...t,...t],o=h.RECOMMENDED_WALLET_AMOUNT*2;return c`<wcm-modal-header title="Connect your wallet" .onAction="${this.onGoToQrcode}" .actionIcon="${C.QRCODE_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-title">${C.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">WalletConnect</wcm-text></div><div class="wcm-slider"><div class="wcm-track">${[...Array(o)].map((i,r)=>{const s=e[r%e.length];return s?c`<wcm-wallet-image walletId="${s.id}" imageId="${s.image_id}"></wcm-wallet-image>`:C.WALLET_PLACEHOLDER})}</div><wcm-button-big @click="${m.handleAndroidLinking}"><wcm-text variant="medium-regular" color="inverse">Select Wallet</wcm-text></wcm-button-big></div></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">Choose WalletConnect to see supported apps on your device</wcm-text></wcm-info-footer>`}};Pt.styles=[v.globalCss,ts];Pt=is([y("wcm-android-wallet-selection")],Pt);const ss=_`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var ls=Object.defineProperty,ns=Object.getOwnPropertyDescriptor,xe=(t,e,o,i)=>{for(var r=i>1?void 0:i?ns(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ls(e,o,r),r};let Y=class extends w{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var t,e;const s=(e=(t=pe.state.themeVariables)==null?void 0:t["--wcm-wallet-icon-large-border-radius"])!=null?e:v.getPreset("--wcm-wallet-icon-large-border-radius");let l=0;s.includes("%")?l=88/100*parseInt(s,10):l=parseInt(s,10),l*=1.17;const n=317-l*1.57,a=425-l*1.8;return c`<svg viewBox="0 0 110 110" width="110" height="110"><rect id="wcm-loader" x="2" y="2" width="106" height="106" rx="${l}"/><use xlink:href="#wcm-loader" stroke-dasharray="106 ${n}" stroke-dashoffset="${a}"></use></svg>`}render(){const t={"wcm-error":this.isError,"wcm-stale":this.isStale};return c`<div class="${Z(t)}">${this.svgLoaderTemplate()}<wcm-wallet-image walletId="${S(this.walletId)}" imageId="${S(this.imageId)}"></wcm-wallet-image></div><wcm-text variant="medium-regular" color="${this.isError?"error":"primary"}">${this.isError?"Connection declined":this.label}</wcm-text>`}};Y.styles=[v.globalCss,ss];xe([u()],Y.prototype,"walletId",2);xe([u()],Y.prototype,"imageId",2);xe([u({type:Boolean})],Y.prototype,"isError",2);xe([u({type:Boolean})],Y.prototype,"isStale",2);xe([u()],Y.prototype,"label",2);Y=xe([y("wcm-connector-waiting")],Y);const me={manualWallets(){var t,e;const{mobileWallets:o,desktopWallets:i}=re.state,r=(t=me.recentWallet())==null?void 0:t.id,s=h.isMobile()?o:i,l=s==null?void 0:s.filter(n=>r!==n.id);return(e=h.isMobile()?l==null?void 0:l.map(({id:n,name:a,links:d})=>({id:n,name:a,mobile:d,links:d})):l==null?void 0:l.map(({id:n,name:a,links:d})=>({id:n,name:a,desktop:d,links:d})))!=null?e:[]},recentWallet(){return m.getRecentWallet()},recomendedWallets(t=!1){var e;const o=t||(e=me.recentWallet())==null?void 0:e.id,{recomendedWallets:i}=D.state;return i.filter(s=>o!==s.id)}},K={onConnecting(t){m.goToConnectingView(t)},manualWalletsTemplate(){return me.manualWallets().map(e=>c`<wcm-wallet-button walletId="${e.id}" name="${e.name}" .onClick="${()=>this.onConnecting(e)}"></wcm-wallet-button>`)},recomendedWalletsTemplate(t=!1){return me.recomendedWallets(t).map(o=>c`<wcm-wallet-button name="${o.name}" walletId="${o.id}" imageId="${o.image_id}" .onClick="${()=>this.onConnecting(o)}"></wcm-wallet-button>`)},recentWalletTemplate(){const t=me.recentWallet();if(t)return c`<wcm-wallet-button name="${t.name}" walletId="${t.id}" imageId="${S(t.image_id)}" .recent="${!0}" .onClick="${()=>this.onConnecting(t)}"></wcm-wallet-button>`}},as=_`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var cs=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,hs=(t,e,o,i)=>{for(var r=i>1?void 0:i?ds(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&cs(e,o,r),r};let It=class extends w{render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=re.state,o=t!=="ALL"&&e,i=K.manualWalletsTemplate(),r=K.recomendedWalletsTemplate();let l=[K.recentWalletTemplate(),...i,...r];l=l.filter(Boolean);const n=l.length>4||o;let a=[];n?a=l.slice(0,3):a=l;const d=!!a.length;return c`<wcm-modal-header .border="${!0}" title="Connect your wallet" .onAction="${m.handleUriCopy}" .actionIcon="${C.COPY_ICON}"></wcm-modal-header><wcm-modal-content><div class="wcm-mobile-title"><div class="wcm-subtitle">${C.MOBILE_ICON}<wcm-text variant="small-regular" color="accent">Mobile</wcm-text></div><div class="wcm-subtitle">${C.SCAN_ICON}<wcm-text variant="small-regular" color="secondary">Scan with your wallet</wcm-text></div></div><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>${d?c`<wcm-modal-footer><div class="wcm-desktop-title">${C.DESKTOP_ICON}<wcm-text variant="small-regular" color="accent">Desktop</wcm-text></div><div class="wcm-grid">${a} ${n?c`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-footer>`:null}`}};It.styles=[v.globalCss,as];It=hs([y("wcm-desktop-wallet-selection")],It);const ms=_`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var ps=Object.defineProperty,us=Object.getOwnPropertyDescriptor,fs=(t,e,o,i)=>{for(var r=i>1?void 0:i?us(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&ps(e,o,r),r};let Tt=class extends w{render(){const{termsOfServiceUrl:t,privacyPolicyUrl:e}=re.state;return t??e?c`<div><wcm-text variant="small-regular" color="secondary">By connecting your wallet to this app, you agree to the app's ${t?c`<a href="${t}" target="_blank" rel="noopener noreferrer">Terms of Service</a>`:null} ${t&&e?"and":null} ${e?c`<a href="${e}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:null}</wcm-text></div>`:null}};Tt.styles=[v.globalCss,ms];Tt=fs([y("wcm-legal-notice")],Tt);const ws=_`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var vs=Object.defineProperty,gs=Object.getOwnPropertyDescriptor,bs=(t,e,o,i)=>{for(var r=i>1?void 0:i?gs(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&vs(e,o,r),r};let Mt=class extends w{onQrcode(){A.push("Qrcode")}render(){const{explorerExcludedWalletIds:t,enableExplorer:e}=re.state,o=t!=="ALL"&&e,i=K.manualWalletsTemplate(),r=K.recomendedWalletsTemplate();let l=[K.recentWalletTemplate(),...i,...r];l=l.filter(Boolean);const n=l.length>8||o;let a=[];n?a=l.slice(0,7):a=l;const d=!!a.length;return c`<wcm-modal-header title="Connect your wallet" .onAction="${this.onQrcode}" .actionIcon="${C.QRCODE_ICON}"></wcm-modal-header>${d?c`<wcm-modal-content><div>${a} ${n?c`<wcm-view-all-wallets-button></wcm-view-all-wallets-button>`:null}</div></wcm-modal-content>`:null}`}};Mt.styles=[v.globalCss,ws];Mt=bs([y("wcm-mobile-wallet-selection")],Mt);const ys=_`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var xs=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,zt=(t,e,o,i)=>{for(var r=i>1?void 0:i?$s(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&xs(e,o,r),r};let Re=class extends w{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=ke.subscribe(t=>{t.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var t;(t=this.unsubscribeModal)==null||t.call(this)}get overlayEl(){return m.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return m.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(t){if(document.querySelector("body"))if(t){const o=document.getElementById("wcm-styles");o==null||o.remove()}else document.head.insertAdjacentHTML("beforeend",'<style id="wcm-styles">html,body{touch-action:none;overflow:hidden;overscroll-behavior:contain;}</style>')}onCloseModal(t){t.target===t.currentTarget&&ke.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const t=m.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},e=.1,o=.2;await Promise.all([oe(this.overlayEl,{opacity:[0,1]},{delay:e,duration:o}).finished,oe(this.containerEl,t,{delay:e,duration:o}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const t=m.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},e=.2;await Promise.all([oe(this.overlayEl,{opacity:[1,0]},{duration:e}).finished,oe(this.containerEl,t,{duration:e}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",t=>{var e;t.key==="Escape"?ke.close():t.key==="Tab"&&((e=t.target)!=null&&e.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var t;(t=this.abortController)==null||t.abort(),this.abortController=void 0}render(){const t={"wcm-overlay":!0,"wcm-active":this.active};return c`<wcm-explorer-context></wcm-explorer-context><wcm-theme-context></wcm-theme-context><div id="wcm-modal" class="${Z(t)}" @click="${this.onCloseModal}" role="alertdialog" aria-modal="true"><div class="wcm-container" tabindex="0">${this.open?c`<wcm-modal-backcard></wcm-modal-backcard><div class="wcm-card"><wcm-modal-router></wcm-modal-router><wcm-modal-toast></wcm-modal-toast></div>`:null}</div></div>`}};Re.styles=[v.globalCss,ys];zt([L()],Re.prototype,"open",2);zt([L()],Re.prototype,"active",2);Re=zt([y("wcm-modal")],Re);const _s=_`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var Cs=Object.defineProperty,Os=Object.getOwnPropertyDescriptor,Le=(t,e,o,i)=>{for(var r=i>1?void 0:i?Os(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Cs(e,o,r),r};let ne=class extends w{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){h.isMobile()?A.replace("MobileConnecting"):A.replace("MobileQrcodeConnecting")}onDesktop(){A.replace("DesktopConnecting")}onWeb(){A.replace("WebConnecting")}render(){return c`<div>${this.isRetry?c`<slot></slot>`:null} ${this.isMobile?c`<wcm-button .onClick="${this.onMobile}" .iconLeft="${C.MOBILE_ICON}" variant="outline">Mobile</wcm-button>`:null} ${this.isDesktop?c`<wcm-button .onClick="${this.onDesktop}" .iconLeft="${C.DESKTOP_ICON}" variant="outline">Desktop</wcm-button>`:null} ${this.isWeb?c`<wcm-button .onClick="${this.onWeb}" .iconLeft="${C.GLOBE_ICON}" variant="outline">Web</wcm-button>`:null}</div>`}};ne.styles=[v.globalCss,_s];Le([u({type:Boolean})],ne.prototype,"isMobile",2);Le([u({type:Boolean})],ne.prototype,"isDesktop",2);Le([u({type:Boolean})],ne.prototype,"isWeb",2);Le([u({type:Boolean})],ne.prototype,"isRetry",2);ne=Le([y("wcm-platform-selection")],ne);const As=_`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var Es=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,Is=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ps(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Es(e,o,r),r};let Wt=class extends w{onClick(){A.push("WalletExplorer")}render(){const{recomendedWallets:t}=D.state,e=me.manualWallets(),o=[...t,...e].reverse().slice(0,4);return c`<button @click="${this.onClick}"><div class="wcm-icons">${o.map(i=>{const r=m.getWalletIcon(i);if(r)return c`<img crossorigin="anonymous" src="${r}">`;const s=m.getWalletIcon({id:i.id});return s?c`<img crossorigin="anonymous" src="${s}">`:C.WALLET_PLACEHOLDER})} ${[...Array(4-o.length)].map(()=>C.WALLET_PLACEHOLDER)}</div><wcm-text variant="xsmall-regular">View All</wcm-text></button>`}};Wt.styles=[v.globalCss,As];Wt=Is([y("wcm-view-all-wallets-button")],Wt);const Ts=_`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var Ms=Object.defineProperty,Ws=Object.getOwnPropertyDescriptor,ot=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ws(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Ms(e,o,r),r};let ge=class extends w{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:t}=H.state;this.uri=t},0)}get overlayEl(){return m.getShadowRootElement(this,".wcm-qr-container")}render(){return c`<div class="wcm-qr-container">${this.uri?c`<wcm-qrcode size="${this.overlayEl.offsetWidth}" uri="${this.uri}" walletId="${S(this.walletId)}" imageId="${S(this.imageId)}"></wcm-qrcode>`:c`<wcm-spinner></wcm-spinner>`}</div>`}};ge.styles=[v.globalCss,Ts];ot([u()],ge.prototype,"walletId",2);ot([u()],ge.prototype,"imageId",2);ot([L()],ge.prototype,"uri",2);ge=ot([y("wcm-walletconnect-qr")],ge);var Rs=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,Ds=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ss(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Rs(e,o,r),r};let Rt=class extends w{viewTemplate(){return h.isAndroid()&&!h.isTelegram()?c`<wcm-android-wallet-selection></wcm-android-wallet-selection>`:h.isMobile()?c`<wcm-mobile-wallet-selection></wcm-mobile-wallet-selection>`:c`<wcm-desktop-wallet-selection></wcm-desktop-wallet-selection>`}render(){return c`${this.viewTemplate()}<wcm-legal-notice></wcm-legal-notice>`}};Rt.styles=[v.globalCss];Rt=Ds([y("wcm-connect-wallet-view")],Rt);const Ls=_`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Ns=Object.defineProperty,js=Object.getOwnPropertyDescriptor,Lo=(t,e,o,i)=>{for(var r=i>1?void 0:i?js(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Ns(e,o,r),r};let Ye=class extends w{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(t){const{desktop:e,name:o}=h.getWalletRouterData(),i=e==null?void 0:e.native,r=e==null?void 0:e.universal;if(i){const s=h.formatNativeUrl(i,t,o);h.openHref(s,"_self")}else if(r){const s=h.formatUniversalUrl(r,t,o);h.openHref(s,"_blank")}}openDesktopApp(){const{walletConnectUri:t}=H.state,e=h.getWalletRouterData();m.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:o}=h.getWalletRouterData(),{isMobile:i,isWeb:r}=m.getCachedRouterWalletPlatforms();return c`<wcm-modal-header title="${t}" .onAction="${m.handleUriCopy}" .actionIcon="${C.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${S(o)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Connection can continue loading if ${t} is not installed on your device`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isWeb="${r}" .isRetry="${!0}"><wcm-button .onClick="${this.openDesktopApp.bind(this)}" .iconRight="${C.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Ye.styles=[v.globalCss,Ls];Lo([L()],Ye.prototype,"isError",2);Ye=Lo([y("wcm-desktop-connecting-view")],Ye);const Us=_`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var Hs=Object.defineProperty,ks=Object.getOwnPropertyDescriptor,Bs=(t,e,o,i)=>{for(var r=i>1?void 0:i?ks(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Hs(e,o,r),r};let St=class extends w{onInstall(t){t&&h.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:o,homepage:i}=h.getWalletRouterData();return c`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${S(o)}" label="Not Detected" .isStale="${!0}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Download ${t} to continue. If multiple browser extensions are installed, disable non ${t} ones and try again`}</wcm-text><wcm-button .onClick="${()=>this.onInstall(i)}" .iconLeft="${C.ARROW_DOWN_ICON}">Download</wcm-button></wcm-info-footer>`}};St.styles=[v.globalCss,Us];St=Bs([y("wcm-install-wallet-view")],St);const Zs=_`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var zs=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,No=(t,e,o,i)=>{for(var r=i>1?void 0:i?Vs(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&zs(e,o,r),r};let Xe=class extends w{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(t,e=!1){const{mobile:o,name:i}=h.getWalletRouterData(),r=o==null?void 0:o.native,s=o==null?void 0:o.universal,l=h.isTelegram()?"_blank":"_self";if(t=h.isTelegram()&&h.isAndroid()?encodeURIComponent(t):t,r&&!e){const n=h.formatNativeUrl(r,t,i);h.openHref(n,l)}else if(s){const n=h.formatUniversalUrl(s,t,i);h.openHref(n,l)}}openMobileApp(t=!1){const{walletConnectUri:e}=H.state,o=h.getWalletRouterData();e&&this.onFormatAndRedirect(e,t),m.setRecentWallet(o)}onGoToAppStore(t){t&&h.openHref(t,"_blank")}render(){const{name:t,id:e,image_id:o,app:i,mobile:r}=h.getWalletRouterData(),{isWeb:s}=m.getCachedRouterWalletPlatforms(),l=i==null?void 0:i.ios,n=r==null?void 0:r.universal;return c`<wcm-modal-header title="${t}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${S(o)}" label="Tap 'Open' to continue…" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer class="wcm-note"><wcm-platform-selection .isWeb="${s}" .isRetry="${!0}"><wcm-button .onClick="${()=>this.openMobileApp(!1)}" .iconRight="${C.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection>${n?c`<wcm-text color="secondary" variant="small-thin">Still doesn't work? <span tabindex="0" @click="${()=>this.openMobileApp(!0)}">Try this alternate link</span></wcm-text>`:null}</wcm-info-footer><wcm-info-footer class="wcm-app-store"><div><wcm-wallet-image walletId="${e}" imageId="${S(o)}"></wcm-wallet-image><wcm-text>${`Get ${t}`}</wcm-text></div><wcm-button .iconRight="${C.ARROW_RIGHT_ICON}" .onClick="${()=>this.onGoToAppStore(l)}" variant="ghost">App Store</wcm-button></wcm-info-footer>`}};Xe.styles=[v.globalCss,Zs];No([L()],Xe.prototype,"isError",2);Xe=No([y("wcm-mobile-connecting-view")],Xe);const Fs=_`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var qs=Object.defineProperty,Ks=Object.getOwnPropertyDescriptor,Qs=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ks(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&qs(e,o,r),r};let Dt=class extends w{render(){const{name:t,id:e,image_id:o}=h.getWalletRouterData(),{isDesktop:i,isWeb:r}=m.getCachedRouterWalletPlatforms();return c`<wcm-modal-header title="${t}" .onAction="${m.handleUriCopy}" .actionIcon="${C.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr walletId="${e}" imageId="${S(o)}"></wcm-walletconnect-qr></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`Scan this QR Code with your phone's camera or inside ${t} app`}</wcm-text><wcm-platform-selection .isDesktop="${i}" .isWeb="${r}"></wcm-platform-selection></wcm-info-footer>`}};Dt.styles=[v.globalCss,Fs];Dt=Qs([y("wcm-mobile-qr-connecting-view")],Dt);var Gs=Object.defineProperty,Ys=Object.getOwnPropertyDescriptor,Xs=(t,e,o,i)=>{for(var r=i>1?void 0:i?Ys(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&Gs(e,o,r),r};let Lt=class extends w{render(){return c`<wcm-modal-header title="Scan the code" .onAction="${m.handleUriCopy}" .actionIcon="${C.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-walletconnect-qr></wcm-walletconnect-qr></wcm-modal-content>`}};Lt.styles=[v.globalCss];Lt=Xs([y("wcm-qrcode-view")],Lt);const Js=_`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var el=Object.defineProperty,tl=Object.getOwnPropertyDescriptor,Ne=(t,e,o,i)=>{for(var r=i>1?void 0:i?tl(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&el(e,o,r),r};const ft=40;let ae=class extends w{constructor(){super(...arguments),this.loading=!D.state.wallets.listings.length,this.firstFetch=!D.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=m.debounce(t=>{t.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=t,D.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),D.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var t;(t=this.intersectionObserver)==null||t.disconnect()}get placeholderEl(){return m.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([t])=>{t.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:t,search:e}=D.state,{listings:o,total:i}=this.search?e:t;return i<=ft||o.length>=i}async fetchWallets(){var t;const{wallets:e,search:o}=D.state,{listings:i,total:r,page:s}=this.search?o:e;if(!this.endReached&&(this.firstFetch||r>ft&&i.length<r))try{this.loading=!0;const l=(t=H.state.chains)==null?void 0:t.join(","),{listings:n}=await D.getWallets({page:this.firstFetch?1:s+1,entries:ft,search:this.search,version:2,chains:l}),a=n.map(d=>m.getWalletIcon(d));await Promise.all([...a.map(async d=>m.preloadImage(d)),h.wait(300)]),this.endReached=this.isLastPage()}catch(l){console.error(l),F.openToast(m.getErrorMessage(l),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(t){h.isAndroid()?m.handleMobileLinking(t):m.goToConnectingView(t)}onSearchChange(t){const{value:e}=t.target;this.searchDebounce(e)}render(){const{wallets:t,search:e}=D.state,{listings:o}=this.search?e:t,i=this.loading&&!o.length,r=this.search.length>=3;let s=K.manualWalletsTemplate(),l=K.recomendedWalletsTemplate(!0);r&&(s=s.filter(({values:d})=>m.caseSafeIncludes(d[0],this.search)),l=l.filter(({values:d})=>m.caseSafeIncludes(d[0],this.search)));const n=!this.loading&&!o.length&&!l.length,a={"wcm-loading":i,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":n};return c`<wcm-modal-header><wcm-search-input .onChange="${this.onSearchChange.bind(this)}"></wcm-search-input></wcm-modal-header><wcm-modal-content class="${Z(a)}"><div class="wcm-grid">${i?null:s} ${i?null:l} ${i?null:o.map(d=>c`${d?c`<wcm-wallet-button imageId="${d.image_id}" name="${d.name}" walletId="${d.id}" .onClick="${()=>this.onConnect(d)}"></wcm-wallet-button>`:null}`)}</div><div class="wcm-placeholder-block">${n?c`<wcm-text variant="big-bold" color="secondary">No results found</wcm-text>`:null} ${!n&&this.loading?c`<wcm-spinner></wcm-spinner>`:null}</div></wcm-modal-content>`}};ae.styles=[v.globalCss,Js];Ne([L()],ae.prototype,"loading",2);Ne([L()],ae.prototype,"firstFetch",2);Ne([L()],ae.prototype,"search",2);Ne([L()],ae.prototype,"endReached",2);ae=Ne([y("wcm-wallet-explorer-view")],ae);const ol=_`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var rl=Object.defineProperty,il=Object.getOwnPropertyDescriptor,jo=(t,e,o,i)=>{for(var r=i>1?void 0:i?il(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(i?l(e,o,r):l(r))||r);return i&&r&&rl(e,o,r),r};let Je=class extends w{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(t){const{desktop:e,name:o}=h.getWalletRouterData(),i=e==null?void 0:e.universal;if(i){const r=h.formatUniversalUrl(i,t,o);h.openHref(r,"_blank")}}openWebWallet(){const{walletConnectUri:t}=H.state,e=h.getWalletRouterData();m.setRecentWallet(e),t&&this.onFormatAndRedirect(t)}render(){const{name:t,id:e,image_id:o}=h.getWalletRouterData(),{isMobile:i,isDesktop:r}=m.getCachedRouterWalletPlatforms(),s=h.isMobile();return c`<wcm-modal-header title="${t}" .onAction="${m.handleUriCopy}" .actionIcon="${C.COPY_ICON}"></wcm-modal-header><wcm-modal-content><wcm-connector-waiting walletId="${e}" imageId="${S(o)}" label="${`Continue in ${t}...`}" .isError="${this.isError}"></wcm-connector-waiting></wcm-modal-content><wcm-info-footer><wcm-text color="secondary" variant="small-thin">${`${t} web app has opened in a new tab. Go there, accept the connection, and come back`}</wcm-text><wcm-platform-selection .isMobile="${i}" .isDesktop="${s?!1:r}" .isRetry="${!0}"><wcm-button .onClick="${this.openWebWallet.bind(this)}" .iconRight="${C.RETRY_ICON}">Retry</wcm-button></wcm-platform-selection></wcm-info-footer>`}};Je.styles=[v.globalCss,ol];jo([L()],Je.prototype,"isError",2);Je=jo([y("wcm-web-connecting-view")],Je);export{Re as WcmModal,G as WcmQrCode};
fs_store()
on(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in g$5,arrayBuffer:"ArrayBuffer"in g$5};function isDataView(Mn){return Mn&&DataView.prototype.isPrototypeOf(Mn)}if(support.arrayBuffer)var viewClasses=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isArrayBufferView=ArrayBuffer.isView||function(Mn){return Mn&&viewClasses.indexOf(Object.prototype.toString.call(Mn))>-1};function normalizeName(Mn){if(typeof Mn!="string"&&(Mn=String(Mn)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(Mn)||Mn==="")throw new TypeError('Invalid character in header field name: "'+Mn+'"');return Mn.toLowerCase()}function normalizeValue(Mn){return typeof Mn!="string"&&(Mn=String(Mn)),Mn}function iteratorFor(Mn){var Fn={next:function(){var io=Mn.shift();return{done:io===void 0,value:io}}};return support.iterable&&(Fn[Symbol.iterator]=function(){return Fn}),Fn}function Headers$1(Mn){this.map={},Mn instanceof Headers$1?Mn.forEach(function(Fn,io){this.append(io,Fn)},this):Array.isArray(Mn)?Mn.forEach(function(Fn){if(Fn.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+Fn.length);this.append(Fn[0],Fn[1])},this):Mn&&Object.getOwnPropertyNames(Mn).forEach(function(Fn){this.append(Fn,Mn[Fn])},this)}Headers$1.prototype.append=function(Mn,Fn){Mn=normalizeName(Mn),Fn=normalizeValue(Fn);var io=this.map[Mn];this.map[Mn]=io?io+", "+Fn:Fn};Headers$1.prototype.delete=function(Mn){delete this.map[normalizeName(Mn)]};Headers$1.prototype.get=function(Mn){return Mn=normalizeName(Mn),this.has(Mn)?this.map[Mn]:null};Headers$1.prototype.has=function(Mn){return this.map.hasOwnProperty(normalizeName(Mn))};Headers$1.prototype.set=function(Mn,Fn){this.map[normalizeName(Mn)]=normalizeValue(Fn)};Headers$1.prototype.forEach=function(Mn,Fn){for(var io in this.map)this.map.hasOwnProperty(io)&&Mn.call(Fn,this.map[io],io,this)};Headers$1.prototype.keys=function(){var Mn=[];return this.forEach(function(Fn,io){Mn.push(io)}),iteratorFor(Mn)};Headers$1.prototype.values=function(){var Mn=[];return this.forEach(function(Fn){Mn.push(Fn)}),iteratorFor(Mn)};Headers$1.prototype.entries=function(){var Mn=[];return this.forEach(function(Fn,io){Mn.push([io,Fn])}),iteratorFor(Mn)};support.iterable&&(Headers$1.prototype[Symbol.iterator]=Headers$1.prototype.entries);function consumed(Mn){if(!Mn._noBody){if(Mn.bodyUsed)return Promise.reject(new TypeError("Already read"));Mn.bodyUsed=!0}}function fileReaderReady(Mn){return new Promise(function(Fn,io){Mn.onload=function(){Fn(Mn.result)},Mn.onerror=function(){io(Mn.error)}})}function readBlobAsArrayBuffer(Mn){var Fn=new FileReader,io=fileReaderReady(Fn);return Fn.readAsArrayBuffer(Mn),io}function readBlobAsText(Mn){var Fn=new FileReader,io=fileReaderReady(Fn),fo=/charset=([A-Za-z0-9_-]+)/.exec(Mn.type),$o=fo?fo[1]:"utf-8";return Fn.readAsText(Mn,$o),io}function readArrayBufferAsText(Mn){for(var Fn=new Uint8Array(Mn),io=new Array(Fn.length),fo=0;fo<Fn.length;fo++)io[fo]=String.fromCharCode(Fn[fo]);return io.join("")}function bufferClone(Mn){if(Mn.slice)return Mn.slice(0);var Fn=new Uint8Array(Mn.byteLength);return Fn.set(new Uint8Array(Mn)),Fn.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(Mn){this.bodyUsed=this.bodyUsed,this._bodyInit=Mn,Mn?typeof Mn=="string"?this._bodyText=Mn:support.blob&&Blob.prototype.isPrototypeOf(Mn)?this._bodyBlob=Mn:support.formData&&FormData.prototype.isPrototypeOf(Mn)?this._bodyFormData=Mn:support.searchParams&&URLSearchParams.prototype.isPrototypeOf(Mn)?this._bodyText=Mn.toString():support.arrayBuffer&&support.blob&&isDataView(Mn)?(this._bodyArrayBuffer=bufferClone(Mn.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):support.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(Mn)||isArrayBufferView(Mn))?this._bodyArrayBuffer=bufferClone(Mn):this._bodyText=Mn=Object.prototype.toString.call(Mn):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof Mn=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):support.searchParams&&URLSearchParams.prototype.isPrototypeOf(Mn)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},support.blob&&(this.blob=function(){var Mn=consumed(this);if(Mn)return Mn;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var Mn=consumed(this);return Mn||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(support.blob)return this.blob().then(readBlobAsArrayBuffer);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var Mn=consumed(this);if(Mn)return Mn;if(this._bodyBlob)return readBlobAsText(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},support.formData&&(this.formData=function(){return this.text().then(decode$4)}),this.json=function(){return this.text().then(JSON.parse)},this}var methods=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function normalizeMethod(Mn){var Fn=Mn.toUpperCase();return methods.indexOf(Fn)>-1?Fn:Mn}function Request$1(Mn,Fn){if(!(this instanceof Request$1))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');Fn=Fn||{};var io=Fn.body;if(Mn instanceof Request$1){if(Mn.bodyUsed)throw new TypeError("Already read");this.url=Mn.url,this.credentials=Mn.credentials,Fn.headers||(this.headers=new Headers$1(Mn.headers)),this.method=Mn.method,this.mode=Mn.mode,this.signal=Mn.signal,!io&&Mn._bodyInit!=null&&(io=Mn._bodyInit,Mn.bodyUsed=!0)}else this.url=String(Mn);if(this.credentials=Fn.credentials||this.credentials||"same-origin",(Fn.headers||!this.headers)&&(this.headers=new Headers$1(Fn.headers)),this.method=normalizeMethod(Fn.method||this.method||"GET"),this.mode=Fn.mode||this.mode||null,this.signal=Fn.signal||this.signal||function(){if("AbortController"in g$5){var mo=new AbortController;return mo.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&io)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(io),(this.method==="GET"||this.method==="HEAD")&&(Fn.cache==="no-store"||Fn.cache==="no-cache")){var fo=/([?&])_=[^&]*/;if(fo.test(this.url))this.url=this.url.replace(fo,"$1_="+new Date().getTime());else{var $o=/\?/;this.url+=($o.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Request$1.prototype.clone=function(){return new Request$1(this,{body:this._bodyInit})};function decode$4(Mn){var Fn=new FormData;return Mn.trim().split("&").forEach(function(io){if(io){var fo=io.split("="),$o=fo.shift().replace(/\+/g," "),mo=fo.join("=").replace(/\+/g," ");Fn.append(decodeURIComponent($o),decodeURIComponent(mo))}}),Fn}function parseHeaders(Mn){var Fn=new Headers$1,io=Mn.replace(/\r?\n[\t ]+/g," ");return io.split("\r").map(function(fo){return fo.indexOf(`
`)===0?fo.substr(1,fo.length):fo}).forEach(function(fo){var $o=fo.split(":"),mo=$o.shift().trim();if(mo){var Ao=$o.join(":").trim();try{Fn.append(mo,Ao)}catch(jo){console.warn("Response "+jo.message)}}}),Fn}Body.call(Request$1.prototype);function Response(Mn,Fn){if(!(this instanceof Response))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(Fn||(Fn={}),this.type="default",this.status=Fn.status===void 0?200:Fn.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=Fn.statusText===void 0?"":""+Fn.statusText,this.headers=new Headers$1(Fn.headers),this.url=Fn.url||"",this._initBody(Mn)}Body.call(Response.prototype);Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers$1(this.headers),url:this.url})};Response.error=function(){var Mn=new Response(null,{status:200,statusText:""});return Mn.ok=!1,Mn.status=0,Mn.type="error",Mn};var redirectStatuses=[301,302,303,307,308];Response.redirect=function(Mn,Fn){if(redirectStatuses.indexOf(Fn)===-1)throw new RangeError("Invalid status code");return new Response(null,{status:Fn,headers:{location:Mn}})};var DOMException=g$5.DOMException;try{new DOMException}catch(Mn){DOMException=function(Fn,io){this.message=Fn,this.name=io;var fo=Error(Fn);this.stack=fo.stack},DOMException.prototype=Object.create(Error.prototype),DOMException.prototype.constructor=DOMException}function fetch$3(Mn,Fn){return new Promise(function(io,fo){var $o=new Request$1(Mn,Fn);if($o.signal&&$o.signal.aborted)return fo(new DOMException("Aborted","AbortError"));var mo=new XMLHttpRequest;function Ao(){mo.abort()}mo.onload=function(){var Ho={statusText:mo.statusText,headers:parseHeaders(mo.getAllResponseHeaders()||"")};$o.url.indexOf("file://")===0&&(mo.status<200||mo.status>599)?Ho.status=200:Ho.status=mo.status,Ho.url="responseURL"in mo?mo.responseURL:Ho.headers.get("X-Request-URL");var zo="response"in mo?mo.response:mo.responseText;setTimeout(function(){io(new Response(zo,Ho))},0)},mo.onerror=function(){setTimeout(function(){fo(new TypeError("Network request failed"))},0)},mo.ontimeout=function(){setTimeout(function(){fo(new TypeError("Network request timed out"))},0)},mo.onabort=function(){setTimeout(function(){fo(new DOMException("Aborted","AbortError"))},0)};function jo(Ho){try{return Ho===""&&g$5.location.href?g$5.location.href:Ho}catch{return Ho}}if(mo.open($o.method,jo($o.url),!0),$o.credentials==="include"?mo.withCredentials=!0:$o.credentials==="omit"&&(mo.withCredentials=!1),"responseType"in mo&&(support.blob?mo.responseType="blob":support.arrayBuffer&&(mo.responseType="arraybuffer")),Fn&&typeof Fn.headers=="object"&&!(Fn.headers instanceof Headers$1||g$5.Headers&&Fn.headers instanceof g$5.Headers)){var Lo=[];Object.getOwnPropertyNames(Fn.headers).forEach(function(Ho){Lo.push(normalizeName(Ho)),mo.setRequestHeader(Ho,normalizeValue(Fn.headers[Ho]))}),$o.headers.forEach(function(Ho,zo){Lo.indexOf(zo)===-1&&mo.setRequestHeader(zo,Ho)})}else $o.headers.forEach(function(Ho,zo){mo.setRequestHeader(zo,Ho)});$o.signal&&($o.signal.addEventListener("abort",Ao),mo.onreadystatechange=function(){mo.readyState===4&&$o.signal.removeEventListener("abort",Ao)}),mo.send(typeof $o._bodyInit>"u"?null:$o._bodyInit)})}fetch$3.polyfill=!0;g$5.fetch||(g$5.fetch=fetch$3,g$5.Headers=Headers$1,g$5.Request=Request$1,g$5.Response=Response);self.fetch.bind(self);async function exponentialBackoff$6(Mn,Fn,io,fo){let $o=Mn;for(let mo=0;mo<Fn;mo++){const Ao=await fo();if(Ao)return Ao;await sleep$3($o),$o*=io}return null}function sleep$3(Mn){return new Promise(Fn=>setTimeout(Fn,Mn))}let FunctionCallPermission$3=class{constructor({allowance:Fn,receiverId:io,methodNames:fo}){ap(this,"allowance");ap(this,"receiverId");ap(this,"methodNames");this.allowance=Fn,this.receiverId=io,this.methodNames=fo}},FullAccessPermission$3=class{},AccessKeyPermission$3=class extends Enum$5{constructor(io){super(io);ap(this,"enum");ap(this,"functionCall");ap(this,"fullAccess");for(const[fo,$o]of Object.entries(io||{}))this[fo]=$o,this.enum=fo}},AccessKey$3=class{constructor({nonce:Fn,permission:io}){ap(this,"nonce");ap(this,"permission");this.nonce=Fn,this.permission=io}},CreateAccount$3=class{},DeployContract$3=class{constructor({code:Fn}){ap(this,"code");this.code=Fn}},FunctionCall$3=class{constructor({methodName:Fn,args:io,gas:fo,deposit:$o}){ap(this,"methodName");ap(this,"args");ap(this,"gas");ap(this,"deposit");this.methodName=Fn,this.args=io,this.gas=fo,this.deposit=$o}},Transfer$3=class{constructor({deposit:Fn}){ap(this,"deposit");this.deposit=Fn}},Stake$3=class{constructor({stake:Fn,publicKey:io}){ap(this,"stake");ap(this,"publicKey");this.stake=Fn,this.publicKey=io}},AddKey$3=class{constructor({publicKey:Fn,accessKey:io}){ap(this,"publicKey");ap(this,"accessKey");this.publicKey=Fn,this.accessKey=io}},DeleteKey$3=class{constructor({publicKey:Fn}){ap(this,"publicKey");this.publicKey=Fn}},DeleteAccount$3=class{constructor({beneficiaryId:Fn}){ap(this,"beneficiaryId");this.beneficiaryId=Fn}},SignedDelegate$3=class{constructor({delegateAction:Fn,signature:io}){ap(this,"delegateAction");ap(this,"signature");this.delegateAction=Fn,this.signature=io}},Action$3=class extends Enum$5{constructor(io){super(io);ap(this,"enum");ap(this,"createAccount");ap(this,"deployContract");ap(this,"functionCall");ap(this,"transfer");ap(this,"stake");ap(this,"addKey");ap(this,"deleteKey");ap(this,"deleteAccount");ap(this,"signedDelegate");for(const[fo,$o]of Object.entries(io||{}))this[fo]=$o,this.enum=fo}};function fullAccessKey$9(){return new AccessKey$3({nonce:0n,permission:new AccessKeyPermission$3({fullAccess:new FullAccessPermission$3})})}function functionCallAccessKey$9(Mn,Fn,io){return new AccessKey$3({nonce:0n,permission:new AccessKeyPermission$3({functionCall:new FunctionCallPermission$3({receiverId:Mn,allowance:io,methodNames:Fn})})})}function createAccount$a(){return new Action$3({createAccount:new CreateAccount$3})}function deployContract$g(Mn){return new Action$3({deployContract:new DeployContract$3({code:Mn})})}function stringifyJsonOrBytes$3(Mn){return Mn.byteLength!==void 0&&Mn.byteLength===Mn.length?Mn:Buffer$D.from(JSON.stringify(Mn))}function functionCall$g(Mn,Fn,io=0n,fo=0n,$o=stringifyJsonOrBytes$3,mo=!1){return mo?new Action$3({functionCall:new FunctionCall$3({methodName:Mn,args:Fn,gas:io,deposit:fo})}):new Action$3({functionCall:new FunctionCall$3({methodName:Mn,args:$o(Fn),gas:io,deposit:fo})})}function transfer$a(Mn=0n){return new Action$3({transfer:new Transfer$3({deposit:Mn})})}function stake$a(Mn=0n,Fn){return new Action$3({stake:new Stake$3({stake:Mn,publicKey:Fn})})}function addKey$d(Mn,Fn){return new Action$3({addKey:new AddKey$3({publicKey:Mn,accessKey:Fn})})}function deleteKey$d(Mn){return new Action$3({deleteKey:new DeleteKey$3({publicKey:Mn})})}function deleteAccount$a(Mn){return new Action$3({deleteAccount:new DeleteAccount$3({beneficiaryId:Mn})})}function signedDelegate$3({delegateAction:Mn,signature:Fn}){return new Action$3({signedDelegate:new SignedDelegate$3({delegateAction:Mn,signature:Fn})})}const actionCreators={addKey:addKey$d,createAccount:createAccount$a,deleteAccount:deleteAccount$a,deleteKey:deleteKey$d,deployContract:deployContract$g,fullAccessKey:fullAccessKey$9,functionCall:functionCall$g,functionCallAccessKey:functionCallAccessKey$9,signedDelegate:signedDelegate$3,stake:stake$a,transfer:transfer$a};var integers=["u8","u16","u32","u64","u128","i8","i16","i32","i64","i128","f32","f64"],EncodeBuffer$1=function(){function Mn(){this.offset=0,this.buffer_size=256,this.buffer=new ArrayBuffer(this.buffer_size),this.view=new DataView(this.buffer)}return Mn.prototype.resize_if_necessary=function(Fn){if(this.buffer_size-this.offset<Fn){this.buffer_size=Math.max(this.buffer_size*2,this.buffer_size+Fn);var io=new ArrayBuffer(this.buffer_size);new Uint8Array(io).set(new Uint8Array(this.buffer)),this.buffer=io,this.view=new DataView(io)}},Mn.prototype.get_used_buffer=function(){return new Uint8Array(this.buffer).slice(0,this.offset)},Mn.prototype.store_value=function(Fn,io){var fo=io.substring(1),$o=parseInt(fo)/8;this.resize_if_necessary($o);var mo=io[0]==="f"?"setFloat".concat(fo):io[0]==="i"?"setInt".concat(fo):"setUint".concat(fo);this.view[mo](this.offset,Fn,!0),this.offset+=$o},Mn.prototype.store_bytes=function(Fn){this.resize_if_necessary(Fn.length),new Uint8Array(this.buffer).set(new Uint8Array(Fn),this.offset),this.offset+=Fn.length},Mn}(),DecodeBuffer$1=function(){function Mn(Fn){this.offset=0,this.buffer_size=Fn.length,this.buffer=new ArrayBuffer(Fn.length),new Uint8Array(this.buffer).set(Fn),this.view=new DataView(this.buffer)}return Mn.prototype.assert_enough_buffer=function(Fn){if(this.offset+Fn>this.buffer.byteLength)throw new Error("Error in schema, the buffer is smaller than expected")},Mn.prototype.consume_value=function(Fn){var io=Fn.substring(1),fo=parseInt(io)/8;this.assert_enough_buffer(fo);var $o=Fn[0]==="f"?"getFloat".concat(io):Fn[0]==="i"?"getInt".concat(io):"getUint".concat(io),mo=this.view[$o](this.offset,!0);return this.offset+=fo,mo},Mn.prototype.consume_bytes=function(Fn){this.assert_enough_buffer(Fn);var io=this.buffer.slice(this.offset,this.offset+Fn);return this.offset+=Fn,io},Mn}(),__extends$4=function(){var Mn=function(Fn,io){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(fo,$o){fo.__proto__=$o}||function(fo,$o){for(var mo in $o)Object.prototype.hasOwnProperty.call($o,mo)&&(fo[mo]=$o[mo])},Mn(Fn,io)};return function(Fn,io){if(typeof io!="function"&&io!==null)throw new TypeError("Class extends value "+String(io)+" is not a constructor or null");Mn(Fn,io);function fo(){this.constructor=Fn}Fn.prototype=io===null?Object.create(io):(fo.prototype=io.prototype,new fo)}}();function isArrayLike$1(Mn){return Array.isArray(Mn)||!!Mn&&typeof Mn=="object"&&"length"in Mn&&typeof Mn.length=="number"&&(Mn.length===0||Mn.length>0&&Mn.length-1 in Mn)}function expect_type$1(Mn,Fn,io){if(typeof Mn!==Fn)throw new Error("Expected ".concat(Fn," not ").concat(typeof Mn,"(").concat(Mn,") at ").concat(io.join(".")))}function expect_bigint$1(Mn,Fn){var io=["number","string","bigint","boolean"].includes(typeof Mn),fo=typeof Mn=="object"&&Mn!==null&&"toString"in Mn;if(!io&&!fo)throw new Error("Expected bigint, number, boolean or string not ".concat(typeof Mn,"(").concat(Mn,") at ").concat(Fn.join(".")))}function expect_same_size$1(Mn,Fn,io){if(Mn!==Fn)throw new Error("Array length ".concat(Mn," does not match schema length ").concat(Fn," at ").concat(io.join(".")))}function expect_enum$1(Mn,Fn){if(typeof Mn!="object"||Mn===null)throw new Error("Expected object not ".concat(typeof Mn,"(").concat(Mn,") at ").concat(Fn.join(".")))}var VALID_STRING_TYPES$1=integers.concat(["bool","string"]),VALID_OBJECT_KEYS$1=["option","enum","array","set","map","struct"],ErrorSchema$1=function(Mn){__extends$4(Fn,Mn);function Fn(io,fo){var $o="Invalid schema: ".concat(JSON.stringify(io)," expected ").concat(fo);return Mn.call(this,$o)||this}return Fn}(Error);function validate_schema$1(Mn){if(!(typeof Mn=="string"&&VALID_STRING_TYPES$1.includes(Mn))){if(Mn&&typeof Mn=="object"){var Fn=Object.keys(Mn);if(Fn.length===1&&VALID_OBJECT_KEYS$1.includes(Fn[0])){var io=Fn[0];if(io==="option")return validate_schema$1(Mn[io]);if(io==="enum")return validate_enum_schema$1(Mn[io]);if(io==="array")return validate_array_schema$1(Mn[io]);if(io==="set")return validate_schema$1(Mn[io]);if(io==="map")return validate_map_schema$1(Mn[io]);if(io==="struct")return validate_struct_schema$1(Mn[io])}}throw new ErrorSchema$1(Mn,VALID_OBJECT_KEYS$1.join(", ")+" or "+VALID_STRING_TYPES$1.join(", "))}}function validate_enum_schema$1(Mn){if(!Array.isArray(Mn))throw new ErrorSchema$1(Mn,"Array");for(var Fn=0,io=Mn;Fn<io.length;Fn++){var fo=io[Fn];if(typeof fo!="object"||!("struct"in fo))throw new Error('Missing "struct" key in enum schema');if(typeof fo.struct!="object"||Object.keys(fo.struct).length!==1)throw new Error('The "struct" in each enum must have a single key');validate_schema$1({struct:fo.struct})}}function validate_array_schema$1(Mn){if(typeof Mn!="object")throw new ErrorSchema$1(Mn,"{ type, len? }");if(Mn.len&&typeof Mn.len!="number")throw new Error("Invalid schema: ".concat(Mn));if("type"in Mn)return validate_schema$1(Mn.type);throw new ErrorSchema$1(Mn,"{ type, len? }")}function validate_map_schema$1(Mn){if(typeof Mn=="object"&&"key"in Mn&&"value"in Mn)validate_schema$1(Mn.key),validate_schema$1(Mn.value);else throw new ErrorSchema$1(Mn,"{ key, value }")}function validate_struct_schema$1(Mn){if(typeof Mn!="object")throw new ErrorSchema$1(Mn,"object");for(var Fn in Mn)validate_schema$1(Mn[Fn])}var BorshSerializer$1=function(){function Mn(Fn){this.encoded=new EncodeBuffer$1,this.fieldPath=["value"],this.checkTypes=Fn}return Mn.prototype.encode=function(Fn,io){return this.encode_value(Fn,io),this.encoded.get_used_buffer()},Mn.prototype.encode_value=function(Fn,io){if(typeof io=="string"){if(integers.includes(io))return this.encode_integer(Fn,io);if(io==="string")return this.encode_string(Fn);if(io==="bool")return this.encode_boolean(Fn)}if(typeof io=="object"){if("option"in io)return this.encode_option(Fn,io);if("enum"in io)return this.encode_enum(Fn,io);if("array"in io)return this.encode_array(Fn,io);if("set"in io)return this.encode_set(Fn,io);if("map"in io)return this.encode_map(Fn,io);if("struct"in io)return this.encode_struct(Fn,io)}},Mn.prototype.encode_integer=function(Fn,io){var fo=parseInt(io.substring(1));fo<=32||io=="f64"?(this.checkTypes&&expect_type$1(Fn,"number",this.fieldPath),this.encoded.store_value(Fn,io)):(this.checkTypes&&expect_bigint$1(Fn,this.fieldPath),this.encode_bigint(BigInt(Fn),fo))},Mn.prototype.encode_bigint=function(Fn,io){for(var fo=io/8,$o=new Uint8Array(fo),mo=0;mo<fo;mo++)$o[mo]=Number(Fn&BigInt(255)),Fn=Fn>>BigInt(8);this.encoded.store_bytes(new Uint8Array($o))},Mn.prototype.encode_string=function(Fn){this.checkTypes&&expect_type$1(Fn,"string",this.fieldPath);var io=Fn;this.encoded.store_value(io.length,"u32");for(var fo=0;fo<io.length;fo++)this.encoded.store_value(io.charCodeAt(fo),"u8")},Mn.prototype.encode_boolean=function(Fn){this.checkTypes&&expect_type$1(Fn,"boolean",this.fieldPath),this.encoded.store_value(Fn?1:0,"u8")},Mn.prototype.encode_option=function(Fn,io){Fn==null?this.encoded.store_value(0,"u8"):(this.encoded.store_value(1,"u8"),this.encode_value(Fn,io.option))},Mn.prototype.encode_enum=function(Fn,io){this.checkTypes&&expect_enum$1(Fn,this.fieldPath);for(var fo=Object.keys(Fn)[0],$o=0;$o<io.enum.length;$o++){var mo=io.enum[$o];if(fo===Object.keys(mo.struct)[0])return this.encoded.store_value($o,"u8"),this.encode_struct(Fn,mo)}throw new Error("Enum key (".concat(fo,") not found in enum schema: ").concat(JSON.stringify(io)," at ").concat(this.fieldPath.join(".")))},Mn.prototype.encode_array=function(Fn,io){if(isArrayLike$1(Fn))return this.encode_arraylike(Fn,io);if(Fn instanceof ArrayBuffer)return this.encode_buffer(Fn,io);throw new Error("Expected Array-like not ".concat(typeof Fn,"(").concat(Fn,") at ").concat(this.fieldPath.join(".")))},Mn.prototype.encode_arraylike=function(Fn,io){io.array.len?expect_same_size$1(Fn.length,io.array.len,this.fieldPath):this.encoded.store_value(Fn.length,"u32");for(var fo=0;fo<Fn.length;fo++)this.encode_value(Fn[fo],io.array.type)},Mn.prototype.encode_buffer=function(Fn,io){io.array.len?expect_same_size$1(Fn.byteLength,io.array.len,this.fieldPath):this.encoded.store_value(Fn.byteLength,"u32"),this.encoded.store_bytes(new Uint8Array(Fn))},Mn.prototype.encode_set=function(Fn,io){this.checkTypes&&expect_type$1(Fn,"object",this.fieldPath);var fo=Fn instanceof Set,$o=fo?Array.from(Fn.values()):Object.values(Fn);this.encoded.store_value($o.length,"u32");for(var mo=0,Ao=$o;mo<Ao.length;mo++){var jo=Ao[mo];this.encode_value(jo,io.set)}},Mn.prototype.encode_map=function(Fn,io){this.checkTypes&&expect_type$1(Fn,"object",this.fieldPath);var fo=Fn instanceof Map,$o=fo?Array.from(Fn.keys()):Object.keys(Fn);this.encoded.store_value($o.length,"u32");for(var mo=0,Ao=$o;mo<Ao.length;mo++){var jo=Ao[mo];this.encode_value(jo,io.map.key),this.encode_value(fo?Fn.get(jo):Fn[jo],io.map.value)}},Mn.prototype.encode_struct=function(Fn,io){this.checkTypes&&expect_type$1(Fn,"object",this.fieldPath);for(var fo=0,$o=Object.keys(io.struct);fo<$o.length;fo++){var mo=$o[fo];this.fieldPath.push(mo),this.encode_value(Fn[mo],io.struct[mo]),this.fieldPath.pop()}},Mn}(),BorshDeserializer$1=function(){function Mn(Fn){this.buffer=new DecodeBuffer$1(Fn)}return Mn.prototype.decode=function(Fn){return this.decode_value(Fn)},Mn.prototype.decode_value=function(Fn){if(typeof Fn=="string"){if(integers.includes(Fn))return this.decode_integer(Fn);if(Fn==="string")return this.decode_string();if(Fn==="bool")return this.decode_boolean()}if(typeof Fn=="object"){if("option"in Fn)return this.decode_option(Fn);if("enum"in Fn)return this.decode_enum(Fn);if("array"in Fn)return this.decode_array(Fn);if("set"in Fn)return this.decode_set(Fn);if("map"in Fn)return this.decode_map(Fn);if("struct"in Fn)return this.decode_struct(Fn)}throw new Error("Unsupported type: ".concat(Fn))},Mn.prototype.decode_integer=function(Fn){var io=parseInt(Fn.substring(1));return io<=32||Fn=="f64"?this.buffer.consume_value(Fn):this.decode_bigint(io,Fn.startsWith("i"))},Mn.prototype.decode_bigint=function(Fn,io){io===void 0&&(io=!1);var fo=Fn/8,$o=new Uint8Array(this.buffer.consume_bytes(fo)),mo=$o.reduceRight(function(Ao,jo){return Ao+jo.toString(16).padStart(2,"0")},"");return io&&$o[fo-1]?BigInt.asIntN(Fn,BigInt("0x".concat(mo))):BigInt("0x".concat(mo))},Mn.prototype.decode_string=function(){var Fn=this.decode_integer("u32"),io=new Uint8Array(this.buffer.consume_bytes(Fn));return String.fromCharCode.apply(null,io)},Mn.prototype.decode_boolean=function(){return this.buffer.consume_value("u8")>0},Mn.prototype.decode_option=function(Fn){var io=this.buffer.consume_value("u8");if(io===1)return this.decode_value(Fn.option);if(io!==0)throw new Error("Invalid option ".concat(io));return null},Mn.prototype.decode_enum=function(Fn){var io,fo=this.buffer.consume_value("u8");if(fo>Fn.enum.length)throw new Error("Enum option ".concat(fo," is not available"));var $o=Fn.enum[fo].struct,mo=Object.keys($o)[0];return io={},io[mo]=this.decode_value($o[mo]),io},Mn.prototype.decode_array=function(Fn){for(var io=[],fo=Fn.array.len?Fn.array.len:this.decode_integer("u32"),$o=0;$o<fo;++$o)io.push(this.decode_value(Fn.array.type));return io},Mn.prototype.decode_set=function(Fn){for(var io=this.decode_integer("u32"),fo=new Set,$o=0;$o<io;++$o)fo.add(this.decode_value(Fn.set));return fo},Mn.prototype.decode_map=function(Fn){for(var io=this.decode_integer("u32"),fo=new Map,$o=0;$o<io;++$o){var mo=this.decode_value(Fn.map.key),Ao=this.decode_value(Fn.map.value);fo.set(mo,Ao)}return fo},Mn.prototype.decode_struct=function(Fn){var io={};for(var fo in Fn.struct)io[fo]=this.decode_value(Fn.struct[fo]);return io},Mn}();function serialize$8(Mn,Fn,io){io===void 0&&(io=!0),io&&validate_schema$1(Mn);var fo=new BorshSerializer$1(io);return fo.encode(Fn,Mn)}function deserialize$5(Mn,Fn,io){io===void 0&&(io=!0),io&&validate_schema$1(Mn);var fo=new BorshDeserializer$1(Fn);return fo.decode(Mn)}const esm$3=Object.freeze(Object.defineProperty({__proto__:null,deserialize:deserialize$5,serialize:serialize$8},Symbol.toStringTag,{value:"Module"})),ACTIONABLE_MESSAGE_BASE$3=Math.pow(2,30),NEP$3={MetaTransactions:366};let NEPPrefix$3=class{constructor({prefix:Fn}){ap(this,"prefix");this.prefix=Fn}},ActionableMessagePrefix$3=class extends NEPPrefix$3{constructor(Fn){super({prefix:ACTIONABLE_MESSAGE_BASE$3+Fn})}},DelegateActionPrefix$3=class extends ActionableMessagePrefix$3{constructor(){super(NEP$3.MetaTransactions)}};function encodeDelegateAction(Mn){return new Uint8Array([...serialize$8(SCHEMA.DelegateActionPrefix,new DelegateActionPrefix$3),...serialize$8(SCHEMA.DelegateAction,Mn)])}function encodeSignedDelegate(Mn){return serialize$8(SCHEMA.SignedDelegate,Mn)}function encodeTransaction(Mn){const Fn=Mn instanceof SignedTransaction?SCHEMA.SignedTransaction:SCHEMA.Transaction;return serialize$8(Fn,Mn)}function decodeTransaction(Mn){return new Transaction(deserialize$5(SCHEMA.Transaction,Mn))}function decodeSignedTransaction(Mn){return new SignedTransaction(deserialize$5(SCHEMA.SignedTransaction,Mn))}class Transaction{constructor({signerId:Fn,publicKey:io,nonce:fo,receiverId:$o,actions:mo,blockHash:Ao}){ap(this,"signerId");ap(this,"publicKey");ap(this,"nonce");ap(this,"receiverId");ap(this,"actions");ap(this,"blockHash");this.signerId=Fn,this.publicKey=io,this.nonce=fo,this.receiverId=$o,this.actions=mo,this.blockHash=Ao}encode(){return encodeTransaction(this)}static decode(Fn){return decodeTransaction(Fn)}}class SignedTransaction{constructor({transaction:Fn,signature:io}){ap(this,"transaction");ap(this,"signature");this.transaction=Fn,this.signature=io}encode(){return encodeTransaction(this)}static decode(Fn){return decodeSignedTransaction(Fn)}}const SCHEMA=new class{constructor(){ap(this,"Ed25519Signature",{struct:{data:{array:{type:"u8",len:64}}}});ap(this,"Secp256k1Signature",{struct:{data:{array:{type:"u8",len:65}}}});ap(this,"Signature",{enum:[{struct:{ed25519Signature:this.Ed25519Signature}},{struct:{secp256k1Signature:this.Secp256k1Signature}}]});ap(this,"Ed25519Data",{struct:{data:{array:{type:"u8",len:32}}}});ap(this,"Secp256k1Data",{struct:{data:{array:{type:"u8",len:64}}}});ap(this,"PublicKey",{enum:[{struct:{ed25519Key:this.Ed25519Data}},{struct:{secp256k1Key:this.Secp256k1Data}}]});ap(this,"FunctionCallPermission",{struct:{allowance:{option:"u128"},receiverId:"string",methodNames:{array:{type:"string"}}}});ap(this,"FullAccessPermission",{struct:{}});ap(this,"AccessKeyPermission",{enum:[{struct:{functionCall:this.FunctionCallPermission}},{struct:{fullAccess:this.FullAccessPermission}}]});ap(this,"AccessKey",{struct:{nonce:"u64",permission:this.AccessKeyPermission}});ap(this,"CreateAccount",{struct:{}});ap(this,"DeployContract",{struct:{code:{array:{type:"u8"}}}});ap(this,"FunctionCall",{struct:{methodName:"string",args:{array:{type:"u8"}},gas:"u64",deposit:"u128"}});ap(this,"Transfer",{struct:{deposit:"u128"}});ap(this,"Stake",{struct:{stake:"u128",publicKey:this.PublicKey}});ap(this,"AddKey",{struct:{publicKey:this.PublicKey,accessKey:this.AccessKey}});ap(this,"DeleteKey",{struct:{publicKey:this.PublicKey}});ap(this,"DeleteAccount",{struct:{beneficiaryId:"string"}});ap(this,"DelegateActionPrefix",{struct:{prefix:"u32"}});ap(this,"ClassicActions",{enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}}]});ap(this,"DelegateAction",{struct:{senderId:"string",receiverId:"string",actions:{array:{type:this.ClassicActions}},nonce:"u64",maxBlockHeight:"u64",publicKey:this.PublicKey}});ap(this,"SignedDelegate",{struct:{delegateAction:this.DelegateAction,signature:this.Signature}});ap(this,"Action",{enum:[{struct:{createAccount:this.CreateAccount}},{struct:{deployContract:this.DeployContract}},{struct:{functionCall:this.FunctionCall}},{struct:{transfer:this.Transfer}},{struct:{stake:this.Stake}},{struct:{addKey:this.AddKey}},{struct:{deleteKey:this.DeleteKey}},{struct:{deleteAccount:this.DeleteAccount}},{struct:{signedDelegate:this.SignedDelegate}}]});ap(this,"Transaction",{struct:{signerId:"string",publicKey:this.PublicKey,nonce:"u64",receiverId:"string",blockHash:{array:{type:"u8",len:32}},actions:{array:{type:this.Action}}}});ap(this,"SignedTransaction",{struct:{transaction:this.Transaction,signature:this.Signature}})}};function createTransaction$3(Mn,Fn,io,fo,$o,mo){const Ao=typeof fo=="bigint"?fo:BigInt(fo);return new Transaction({signerId:Mn,publicKey:Fn,nonce:Ao,receiverId:io,actions:$o,blockHash:mo})}const{addKey:addKey$c,createAccount:createAccount$9,deleteAccount:deleteAccount$9,deleteKey:deleteKey$c,deployContract:deployContract$f,functionCall:functionCall$f,stake:stake$9,transfer:transfer$9}=actionCreators;let DelegateAction$3=class{constructor({senderId:Fn,receiverId:io,actions:fo,nonce:$o,maxBlockHeight:mo,publicKey:Ao}){ap(this,"senderId");ap(this,"receiverId");ap(this,"actions");ap(this,"nonce");ap(this,"maxBlockHeight");ap(this,"publicKey");this.senderId=Fn,this.receiverId=io,this.actions=fo,this.nonce=$o,this.maxBlockHeight=mo,this.publicKey=Ao}};function buildDelegateAction$3({actions:Mn,maxBlockHeight:Fn,nonce:io,publicKey:fo,receiverId:$o,senderId:mo}){return new DelegateAction$3({senderId:mo,receiverId:$o,actions:Mn.map(Ao=>{if(!Ao.type&&!Ao.params)return Ao;switch(Ao.type){case"AddKey":{const{publicKey:jo,accessKey:Lo}=Ao.params;return addKey$c(jo,Lo)}case"CreateAccount":return createAccount$9(Ao.params.createAccount);case"DeleteAccount":return deleteAccount$9(Ao.params.deleteAccount);case"DeleteKey":return deleteKey$c(Ao.params.publicKey);case"DeployContract":return deployContract$f(Ao.params.code);case"FunctionCall":{const{methodName:jo,args:Lo,gas:Ho,deposit:zo}=Ao.params;return functionCall$f(jo,Lo,Ho,zo)}case"Stake":return stake$9(Ao.params.stake,Ao.params.publicKey);case"Transfer":{const{deposit:jo}=Ao.params;return transfer$9(jo)}}throw new Error("Unrecognized action")}),nonce:io,maxBlockHeight:Fn,publicKey:fo})}function isBytes$4(Mn){return Mn instanceof Uint8Array||Mn!=null&&typeof Mn=="object"&&Mn.constructor.name==="Uint8Array"}function bytes$2(Mn,...Fn){if(!isBytes$4(Mn))throw new Error("Expected Uint8Array");if(Fn.length>0&&!Fn.includes(Mn.length))throw new Error(`Expected Uint8Array of length ${Fn}, not of length=${Mn.length}`)}function exists$2(Mn,Fn=!0){if(Mn.destroyed)throw new Error("Hash instance has been destroyed");if(Fn&&Mn.finished)throw new Error("Hash#digest() has already been called")}function output$2(Mn,Fn){bytes$2(Mn);const io=Fn.outputLen;if(Mn.length<io)throw new Error(`digestInto() expects output buffer of length at least ${io}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$3(Mn){return Mn instanceof Uint8Array||Mn!=null&&typeof Mn=="object"&&Mn.constructor.name==="Uint8Array"}const createView$1=Mn=>new DataView(Mn.buffer,Mn.byteOffset,Mn.byteLength),rotr$1=(Mn,Fn)=>Mn<<32-Fn|Mn>>>Fn,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE$1)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$2(Mn){if(typeof Mn!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Mn}`);return new Uint8Array(new TextEncoder().encode(Mn))}function toBytes$3(Mn){if(typeof Mn=="string"&&(Mn=utf8ToBytes$2(Mn)),!isBytes$3(Mn))throw new Error(`expected Uint8Array, got ${typeof Mn}`);return Mn}let Hash$1=class{clone(){return this._cloneInto()}};function wrapConstructor$1(Mn){const Fn=fo=>Mn().update(toBytes$3(fo)).digest(),io=Mn();return Fn.outputLen=io.outputLen,Fn.blockLen=io.blockLen,Fn.create=()=>Mn(),Fn}function setBigUint64$2(Mn,Fn,io,fo){if(typeof Mn.setBigUint64=="function")return Mn.setBigUint64(Fn,io,fo);const $o=BigInt(32),mo=BigInt(4294967295),Ao=Number(io>>$o&mo),jo=Number(io&mo),Lo=fo?4:0,Ho=fo?0:4;Mn.setUint32(Fn+Lo,Ao,fo),Mn.setUint32(Fn+Ho,jo,fo)}let SHA2$1=class extends Hash$1{constructor(Fn,io,fo,$o){super(),this.blockLen=Fn,this.outputLen=io,this.padOffset=fo,this.isLE=$o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(Fn),this.view=createView$1(this.buffer)}update(Fn){exists$2(this);const{view:io,buffer:fo,blockLen:$o}=this;Fn=toBytes$3(Fn);const mo=Fn.length;for(let Ao=0;Ao<mo;){const jo=Math.min($o-this.pos,mo-Ao);if(jo===$o){const Lo=createView$1(Fn);for(;$o<=mo-Ao;Ao+=$o)this.process(Lo,Ao);continue}fo.set(Fn.subarray(Ao,Ao+jo),this.pos),this.pos+=jo,Ao+=jo,this.pos===$o&&(this.process(io,0),this.pos=0)}return this.length+=Fn.length,this.roundClean(),this}digestInto(Fn){exists$2(this),output$2(Fn,this),this.finished=!0;const{buffer:io,view:fo,blockLen:$o,isLE:mo}=this;let{pos:Ao}=this;io[Ao++]=128,this.buffer.subarray(Ao).fill(0),this.padOffset>$o-Ao&&(this.process(fo,0),Ao=0);for(let Go=Ao;Go<$o;Go++)io[Go]=0;setBigUint64$2(fo,$o-8,BigInt(this.length*8),mo),this.process(fo,0);const jo=createView$1(Fn),Lo=this.outputLen;if(Lo%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const Ho=Lo/4,zo=this.get();if(Ho>zo.length)throw new Error("_sha2: outputLen bigger than state");for(let Go=0;Go<Ho;Go++)jo.setUint32(4*Go,zo[Go],mo)}digest(){const{buffer:Fn,outputLen:io}=this;this.digestInto(Fn);const fo=Fn.slice(0,io);return this.destroy(),fo}_cloneInto(Fn){Fn||(Fn=new this.constructor),Fn.set(...this.get());const{blockLen:io,buffer:fo,length:$o,finished:mo,destroyed:Ao,pos:jo}=this;return Fn.length=$o,Fn.pos=jo,Fn.finished=mo,Fn.destroyed=Ao,$o%io&&Fn.buffer.set(fo),Fn}};const Chi$2=(Mn,Fn,io)=>Mn&Fn^~Mn&io,Maj$2=(Mn,Fn,io)=>Mn&Fn^Mn&io^Fn&io,SHA256_K$2=new Uint32Array([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]),IV$1=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$2=new Uint32Array(64);let SHA256$2=class extends SHA2$1{constructor(){super(64,32,8,!1),this.A=IV$1[0]|0,this.B=IV$1[1]|0,this.C=IV$1[2]|0,this.D=IV$1[3]|0,this.E=IV$1[4]|0,this.F=IV$1[5]|0,this.G=IV$1[6]|0,this.H=IV$1[7]|0}get(){const{A:Fn,B:io,C:fo,D:$o,E:mo,F:Ao,G:jo,H:Lo}=this;return[Fn,io,fo,$o,mo,Ao,jo,Lo]}set(Fn,io,fo,$o,mo,Ao,jo,Lo){this.A=Fn|0,this.B=io|0,this.C=fo|0,this.D=$o|0,this.E=mo|0,this.F=Ao|0,this.G=jo|0,this.H=Lo|0}process(Fn,io){for(let Go=0;Go<16;Go++,io+=4)SHA256_W$2[Go]=Fn.getUint32(io,!1);for(let Go=16;Go<64;Go++){const Vo=SHA256_W$2[Go-15],Yo=SHA256_W$2[Go-2],Xo=rotr$1(Vo,7)^rotr$1(Vo,18)^Vo>>>3,is=rotr$1(Yo,17)^rotr$1(Yo,19)^Yo>>>10;SHA256_W$2[Go]=is+SHA256_W$2[Go-7]+Xo+SHA256_W$2[Go-16]|0}let{A:fo,B:$o,C:mo,D:Ao,E:jo,F:Lo,G:Ho,H:zo}=this;for(let Go=0;Go<64;Go++){const Vo=rotr$1(jo,6)^rotr$1(jo,11)^rotr$1(jo,25),Yo=zo+Vo+Chi$2(jo,Lo,Ho)+SHA256_K$2[Go]+SHA256_W$2[Go]|0,is=(rotr$1(fo,2)^rotr$1(fo,13)^rotr$1(fo,22))+Maj$2(fo,$o,mo)|0;zo=Ho,Ho=Lo,Lo=jo,jo=Ao+Yo|0,Ao=mo,mo=$o,$o=fo,fo=Yo+is|0}fo=fo+this.A|0,$o=$o+this.B|0,mo=mo+this.C|0,Ao=Ao+this.D|0,jo=jo+this.E|0,Lo=Lo+this.F|0,Ho=Ho+this.G|0,zo=zo+this.H|0,this.set(fo,$o,mo,Ao,jo,Lo,Ho,zo)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},SHA224$1=class extends SHA256$2{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};const sha256$6=wrapConstructor$1(()=>new SHA256$2),sha224=wrapConstructor$1(()=>new SHA224$1),sha256$7=Object.freeze(Object.defineProperty({__proto__:null,sha224,sha256:sha256$6},Symbol.toStringTag,{value:"Module"}));function resolveEnumKeyName$2(Mn){switch(Mn){case KeyType$1.ED25519:return"ed25519Signature";case KeyType$1.SECP256K1:return"secp256k1Signature";default:throw Error(`unknown type ${Mn}`)}}let Signature$3=class extends Enum$5{constructor(io){const fo=resolveEnumKeyName$2(io.keyType);super({[fo]:io});ap(this,"enum");ap(this,"ed25519Signature");ap(this,"secp256k1Signature");this[fo]=io,this.enum=fo}get signature(){return this.ed25519Signature||this.secp256k1Signature}get signatureType(){return this.signature.keyType}get data(){return this.signature.data}};async function signTransactionObject$3(Mn,Fn,io,fo){const $o=encodeTransaction(Mn),mo=new Uint8Array(sha256$6($o)),Ao=await Fn.signMessage($o,io,fo),jo=Mn.publicKey.ed25519Key?KeyType$1.ED25519:KeyType$1.SECP256K1,Lo=new SignedTransaction({transaction:Mn,signature:new Signature$3({keyType:jo,data:Ao.signature})});return[mo,Lo]}async function signTransaction$3(...Mn){if(Mn[0].constructor===Transaction){const[Fn,io,fo,$o]=Mn;return signTransactionObject$3(Fn,io,fo,$o)}else{const[Fn,io,fo,$o,mo,Ao,jo]=Mn,Lo=await mo.getPublicKey(Ao,jo),Ho=createTransaction$3(Ao,Lo,Fn,io,fo,$o);return signTransactionObject$3(Ho,mo,Ao,jo)}}async function signDelegateAction$3({delegateAction:Mn,signer:Fn}){const io=encodeDelegateAction(Mn),fo=await Fn.sign(io),$o=Mn.publicKey.ed25519Key?KeyType$1.ED25519:KeyType$1.SECP256K1,mo=new SignedDelegate$3({delegateAction:Mn,signature:new Signature$3({keyType:$o,data:fo})});return{hash:new Uint8Array(sha256$6(io)),signedDelegateAction:mo}}const esm$2=Object.freeze(Object.defineProperty({__proto__:null,AccessKey:AccessKey$3,AccessKeyPermission:AccessKeyPermission$3,Action:Action$3,AddKey:AddKey$3,CreateAccount:CreateAccount$3,DelegateAction:DelegateAction$3,DeleteAccount:DeleteAccount$3,DeleteKey:DeleteKey$3,DeployContract:DeployContract$3,FullAccessPermission:FullAccessPermission$3,FunctionCall:FunctionCall$3,FunctionCallPermission:FunctionCallPermission$3,SCHEMA,Signature:Signature$3,SignedDelegate:SignedDelegate$3,SignedTransaction,Stake:Stake$3,Transaction,Transfer:Transfer$3,actionCreators,buildDelegateAction:buildDelegateAction$3,createTransaction:createTransaction$3,decodeSignedTransaction,decodeTransaction,encodeDelegateAction,encodeSignedDelegate,encodeTransaction,signDelegateAction:signDelegateAction$3,signTransaction:signTransaction$3,stringifyJsonOrBytes:stringifyJsonOrBytes$3},Symbol.toStringTag,{value:"Module"}));let Provider$4=class{};var backoff={},options={},__assign$1=commonjsGlobal$c&&commonjsGlobal$c.__assign||function(){return __assign$1=Object.assign||function(Mn){for(var Fn,io=1,fo=arguments.length;io<fo;io++){Fn=arguments[io];for(var $o in Fn)Object.prototype.hasOwnProperty.call(Fn,$o)&&(Mn[$o]=Fn[$o])}return Mn},__assign$1.apply(this,arguments)};Object.defineProperty(options,"__esModule",{value:!0});var defaultOptions={delayFirstAttempt:!1,jitter:"none",maxDelay:1/0,numOfAttempts:10,retry:function(){return!0},startingDelay:100,timeMultiple:2};function getSanitizedOptions(Mn){var Fn=__assign$1(__assign$1({},defaultOptions),Mn);return Fn.numOfAttempts<1&&(Fn.numOfAttempts=1),Fn}options.getSanitizedOptions=getSanitizedOptions;var delay_factory={},skipFirst_delay={},delay_base={},jitter_factory={},full_jitter={};Object.defineProperty(full_jitter,"__esModule",{value:!0});function fullJitter(Mn){var Fn=Math.random()*Mn;return Math.round(Fn)}full_jitter.fullJitter=fullJitter;var no_jitter={};Object.defineProperty(no_jitter,"__esModule",{value:!0});function noJitter(Mn){return Mn}no_jitter.noJitter=noJitter;Object.defineProperty(jitter_factory,"__esModule",{value:!0});var full_jitter_1=full_jitter,no_jitter_1=no_jitter;function JitterFactory(Mn){switch(Mn.jitter){case"full":return full_jitter_1.fullJitter;case"none":default:return no_jitter_1.noJitter}}jitter_factory.JitterFactory=JitterFactory;Object.defineProperty(delay_base,"__esModule",{value:!0});var jitter_factory_1=jitter_factory,Delay=function(){function Mn(Fn){this.options=Fn,this.attempt=0}return Mn.prototype.apply=function(){var Fn=this;return new Promise(function(io){return setTimeout(io,Fn.jitteredDelay)})},Mn.prototype.setAttemptNumber=function(Fn){this.attempt=Fn},Object.defineProperty(Mn.prototype,"jitteredDelay",{get:function(){var Fn=jitter_factory_1.JitterFactory(this.options);return Fn(this.delay)},enumerable:!0,configurable:!0}),Object.defineProperty(Mn.prototype,"delay",{get:function(){var Fn=this.options.startingDelay,io=this.options.timeMultiple,fo=this.numOfDelayedAttempts,$o=Fn*Math.pow(io,fo);return Math.min($o,this.options.maxDelay)},enumerable:!0,configurable:!0}),Object.defineProperty(Mn.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt},enumerable:!0,configurable:!0}),Mn}();delay_base.Delay=Delay;var __extends$3=commonjsGlobal$c&&commonjsGlobal$c.__extends||function(){var Mn=function(Fn,io){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(fo,$o){fo.__proto__=$o}||function(fo,$o){for(var mo in $o)$o.hasOwnProperty(mo)&&(fo[mo]=$o[mo])},Mn(Fn,io)};return function(Fn,io){Mn(Fn,io);function fo(){this.constructor=Fn}Fn.prototype=io===null?Object.create(io):(fo.prototype=io.prototype,new fo)}}(),__awaiter$13=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})},__generator$2=commonjsGlobal$c&&commonjsGlobal$c.__generator||function(Mn,Fn){var io={label:0,sent:function(){if(mo[0]&1)throw mo[1];return mo[1]},trys:[],ops:[]},fo,$o,mo,Ao;return Ao={next:jo(0),throw:jo(1),return:jo(2)},typeof Symbol=="function"&&(Ao[Symbol.iterator]=function(){return this}),Ao;function jo(Ho){return function(zo){return Lo([Ho,zo])}}function Lo(Ho){if(fo)throw new TypeError("Generator is already executing.");for(;io;)try{if(fo=1,$o&&(mo=Ho[0]&2?$o.return:Ho[0]?$o.throw||((mo=$o.return)&&mo.call($o),0):$o.next)&&!(mo=mo.call($o,Ho[1])).done)return mo;switch($o=0,mo&&(Ho=[Ho[0]&2,mo.value]),Ho[0]){case 0:case 1:mo=Ho;break;case 4:return io.label++,{value:Ho[1],done:!1};case 5:io.label++,$o=Ho[1],Ho=[0];continue;case 7:Ho=io.ops.pop(),io.trys.pop();continue;default:if(mo=io.trys,!(mo=mo.length>0&&mo[mo.length-1])&&(Ho[0]===6||Ho[0]===2)){io=0;continue}if(Ho[0]===3&&(!mo||Ho[1]>mo[0]&&Ho[1]<mo[3])){io.label=Ho[1];break}if(Ho[0]===6&&io.label<mo[1]){io.label=mo[1],mo=Ho;break}if(mo&&io.label<mo[2]){io.label=mo[2],io.ops.push(Ho);break}mo[2]&&io.ops.pop(),io.trys.pop();continue}Ho=Fn.call(Mn,io)}catch(zo){Ho=[6,zo],$o=0}finally{fo=mo=0}if(Ho[0]&5)throw Ho[1];return{value:Ho[0]?Ho[1]:void 0,done:!0}}};Object.defineProperty(skipFirst_delay,"__esModule",{value:!0});var delay_base_1$1=delay_base,SkipFirstDelay=function(Mn){__extends$3(Fn,Mn);function Fn(){return Mn!==null&&Mn.apply(this,arguments)||this}return Fn.prototype.apply=function(){return __awaiter$13(this,void 0,void 0,function(){return __generator$2(this,function(io){return[2,this.isFirstAttempt?!0:Mn.prototype.apply.call(this)]})})},Object.defineProperty(Fn.prototype,"isFirstAttempt",{get:function(){return this.attempt===0},enumerable:!0,configurable:!0}),Object.defineProperty(Fn.prototype,"numOfDelayedAttempts",{get:function(){return this.attempt-1},enumerable:!0,configurable:!0}),Fn}(delay_base_1$1.Delay);skipFirst_delay.SkipFirstDelay=SkipFirstDelay;var always_delay={},__extends$2=commonjsGlobal$c&&commonjsGlobal$c.__extends||function(){var Mn=function(Fn,io){return Mn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(fo,$o){fo.__proto__=$o}||function(fo,$o){for(var mo in $o)$o.hasOwnProperty(mo)&&(fo[mo]=$o[mo])},Mn(Fn,io)};return function(Fn,io){Mn(Fn,io);function fo(){this.constructor=Fn}Fn.prototype=io===null?Object.create(io):(fo.prototype=io.prototype,new fo)}}();Object.defineProperty(always_delay,"__esModule",{value:!0});var delay_base_1=delay_base,AlwaysDelay=function(Mn){__extends$2(Fn,Mn);function Fn(){return Mn!==null&&Mn.apply(this,arguments)||this}return Fn}(delay_base_1.Delay);always_delay.AlwaysDelay=AlwaysDelay;Object.defineProperty(delay_factory,"__esModule",{value:!0});var skip_first_delay_1=skipFirst_delay,always_delay_1=always_delay;function DelayFactory(Mn,Fn){var io=initDelayClass(Mn);return io.setAttemptNumber(Fn),io}delay_factory.DelayFactory=DelayFactory;function initDelayClass(Mn){return Mn.delayFirstAttempt?new always_delay_1.AlwaysDelay(Mn):new skip_first_delay_1.SkipFirstDelay(Mn)}var __awaiter$12=commonjsGlobal$c&&commonjsGlobal$c.__awaiter||function(Mn,Fn,io,fo){function $o(mo){return mo instanceof io?mo:new io(function(Ao){Ao(mo)})}return new(io||(io=Promise))(function(mo,Ao){function jo(zo){try{Ho(fo.next(zo))}catch(Go){Ao(Go)}}function Lo(zo){try{Ho(fo.throw(zo))}catch(Go){Ao(Go)}}function Ho(zo){zo.done?mo(zo.value):$o(zo.value).then(jo,Lo)}Ho((fo=fo.apply(Mn,Fn||[])).next())})},__generator$1=commonjsGlobal$c&&commonjsGlobal$c.__generator||function(Mn,Fn){var io={label:0,sent:function(){if(mo[0]&1)throw mo[1];return mo[1]},trys:[],ops:[]},fo,$o,mo,Ao;return Ao={next:jo(0),throw:jo(1),return:jo(2)},typeof Symbol=="function"&&(Ao[Symbol.iterator]=function(){return this}),Ao;function jo(Ho){return function(zo){return Lo([Ho,zo])}}function Lo(Ho){if(fo)throw new TypeError("Generator is already executing.");for(;io;)try{if(fo=1,$o&&(mo=Ho[0]&2?$o.return:Ho[0]?$o.throw||((mo=$o.return)&&mo.call($o),0):$o.next)&&!(mo=mo.call($o,Ho[1])).done)return mo;switch($o=0,mo&&(Ho=[Ho[0]&2,mo.value]),Ho[0]){case 0:case 1:mo=Ho;break;case 4:return io.label++,{value:Ho[1],done:!1};case 5:io.label++,$o=Ho[1],Ho=[0];continue;case 7:Ho=io.ops.pop(),io.trys.pop();continue;default:if(mo=io.trys,!(mo=mo.length>0&&mo[mo.length-1])&&(Ho[0]===6||Ho[0]===2)){io=0;continue}if(Ho[0]===3&&(!mo||Ho[1]>mo[0]&&Ho[1]<mo[3])){io.label=Ho[1];break}if(Ho[0]===6&&io.label<mo[1]){io.label=mo[1],mo=Ho;break}if(mo&&io.label<mo[2]){io.label=mo[2],io.ops.push(Ho);break}mo[2]&&io.ops.pop(),io.trys.pop();continue}Ho=Fn.call(Mn,io)}catch(zo){Ho=[6,zo],$o=0}finally{fo=mo=0}if(Ho[0]&5)throw Ho[1];return{value:Ho[0]?Ho[1]:void 0,done:!0}}};Object.defineProperty(backoff,"__esModule",{value:!0});var options_1=options,delay_factory_1=delay_factory;function backOff(Mn,Fn){return Fn===void 0&&(Fn={}),__awaiter$12(this,void 0,void 0,function(){var io,fo;return __generator$1(this,function($o){switch($o.label){case 0:return io=options_1.getSanitizedOptions(Fn),fo=new BackOff(Mn,io),[4,fo.execute()];case 1:return[2,$o.sent()]}})})}var backOff_1=backoff.backOff=backOff,BackOff=function(){function Mn(Fn,io){this.request=Fn,this.options=io,this.attemptNumber=0}return Mn.prototype.execute=function(){return __awaiter$12(this,void 0,void 0,function(){var Fn,io;return __generator$1(this,function(fo){switch(fo.label){case 0:if(this.attemptLimitReached)return[3,7];fo.label=1;case 1:return fo.trys.push([1,4,,6]),[4,this.applyDelay()];case 2:return fo.sent(),[4,this.request()];case 3:return[2,fo.sent()];case 4:return Fn=fo.sent(),this.attemptNumber++,[4,this.options.retry(Fn,this.attemptNumber)];case 5:if(io=fo.sent(),!io||this.attemptLimitReached)throw Fn;return[3,6];case 6:return[3,0];case 7:throw new Error("Something went wrong.")}})})},Object.defineProperty(Mn.prototype,"attemptLimitReached",{get:function(){return this.attemptNumber>=this.options.numOfAttempts},enumerable:!0,configurable:!0}),Mn.prototype.applyDelay=function(){return __awaiter$12(this,void 0,void 0,function(){var Fn;return __generator$1(this,function(io){switch(io.label){case 0:return Fn=delay_factory_1.DelayFactory(this.options,this.attemptNumber),[4,Fn.apply()];case 1:return io.sent(),[2]}})})},Mn}();function unfetch_module(Mn,Fn){return Fn=Fn||{},new Promise(function(io,fo){var $o=new XMLHttpRequest,mo=[],Ao=[],jo={},Lo=function(){return{ok:($o.status/100|0)==2,statusText:$o.statusText,status:$o.status,url:$o.responseURL,text:function(){return Promise.resolve($o.responseText)},json:function(){return Promise.resolve($o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([$o.response]))},clone:Lo,headers:{keys:function(){return mo},entries:function(){return Ao},get:function(zo){return jo[zo.toLowerCase()]},has:function(zo){return zo.toLowerCase()in jo}}}};for(var Ho in $o.open(Fn.method||"get",Mn,!0),$o.onload=function(){$o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(zo,Go,Vo){mo.push(Go=Go.toLowerCase()),Ao.push([Go,Vo]),jo[Go]=jo[Go]?jo[Go]+","+Vo:Vo}),io(Lo())},$o.onerror=fo,$o.withCredentials=Fn.credentials=="include",Fn.headers)$o.setRequestHeader(Ho,Fn.headers[Ho]);$o.send(Fn.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$b=getAugmentedNamespace(unfetch_module$1);var browser$8=self.fetch||(self.fetch=require$$0$b.default||require$$0$b);const unfetch=getDefaultExportFromCjs$1(browser$8),BACKOFF_MULTIPLIER$3=1.5,RETRY_NUMBER$3=10,retryConfig$1={numOfAttempts:RETRY_NUMBER$3,timeMultiple:BACKOFF_MULTIPLIER$3,retry:Mn=>!!([503,408].includes(Mn.cause)||Mn.toString().includes("FetchError")||Mn.toString().includes("Failed to fetch"))};let ProviderError$1=class extends Error{constructor(io,fo){super(io,fo);ap(this,"cause")}};async function fetchJsonRpc$1(Mn,Fn,io){const fo=await backOff_1(async()=>{const $o=await unfetch(Mn,{method:"POST",body:JSON.stringify(Fn),headers:{...io,"Content-Type":"application/json"}}),{ok:mo,status:Ao}=$o;if(!mo)throw new ProviderError$1(await $o.text(),{cause:Ao});if(Ao===503)throw new ProviderError$1(`${Mn} unavailable`,{cause:Ao});if(Ao===408)throw new ProviderError$1("Unused connection",{cause:Ao});return $o},retryConfig$1);if(!fo)throw new TypedError$2(`Exceeded ${RETRY_NUMBER$3} attempts for ${Mn}.`,"RetriesExceeded");return await fo.json()}const REQUEST_RETRY_NUMBER$3=12,REQUEST_RETRY_WAIT$3=500,REQUEST_RETRY_WAIT_BACKOFF$3=1.5;let _nextId$3=123,JsonRpcProvider$3=class extends Provider$4{constructor(io,fo){super();ap(this,"connection");ap(this,"options");this.connection=io||{url:""};const $o={retries:REQUEST_RETRY_NUMBER$3,wait:REQUEST_RETRY_WAIT$3,backoff:REQUEST_RETRY_WAIT_BACKOFF$3};this.options=Object.assign({},$o,fo)}async status(){return this.sendJsonRpc("status",[])}async sendTransactionUntil(io,fo){const $o=encodeTransaction(io);return this.sendJsonRpc("send_tx",{signed_tx_base64:Buffer$D.from($o).toString("base64"),wait_until:fo})}async sendTransaction(io){return this.sendTransactionUntil(io,"EXECUTED_OPTIMISTIC")}async sendTransactionAsync(io){return this.sendTransactionUntil(io,"NONE")}async txStatus(io,fo,$o="EXECUTED_OPTIMISTIC"){return typeof io=="string"?this.txStatusString(io,fo,$o):this.txStatusUint8Array(io,fo,$o)}async txStatusUint8Array(io,fo,$o){return this.sendJsonRpc("tx",{tx_hash:baseEncode$1(io),sender_account_id:fo,wait_until:$o})}async txStatusString(io,fo,$o){return this.sendJsonRpc("tx",{tx_hash:io,sender_account_id:fo,wait_until:$o})}async txStatusReceipts(io,fo,$o="EXECUTED_OPTIMISTIC"){return typeof io=="string"?this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:io,sender_account_id:fo,wait_until:$o}):this.sendJsonRpc("EXPERIMENTAL_tx_status",{tx_hash:baseEncode$1(io),sender_account_id:fo,wait_until:$o})}async query(...io){let fo;if(io.length===1){const{block_id:$o,blockId:mo,...Ao}=io[0];fo=await this.sendJsonRpc("query",{...Ao,block_id:$o||mo})}else{const[$o,mo]=io;fo=await this.sendJsonRpc("query",[$o,mo])}if(fo&&fo.error)throw new TypedError$2(`Querying failed: ${fo.error}.
${JSON.stringify(fo,null,2)}`,getErrorTypeFromErrorMessage$3(fo.error,fo.error.name));return fo}async block(io){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("block",{block_id:$o,finality:fo})}async blockChanges(io){const{finality:fo}=io,{blockId:$o}=io;return this.sendJsonRpc("EXPERIMENTAL_changes_in_block",{block_id:$o,finality:fo})}async chunk(io){return this.sendJsonRpc("chunk",[io])}async validators(io){return this.sendJsonRpc("validators",[io])}async experimental_protocolConfig(io){const{blockId:fo,...$o}=io;return await this.sendJsonRpc("EXPERIMENTAL_protocol_config",{...$o,block_id:fo})}async lightClientProof(io){return await this.sendJsonRpc("EXPERIMENTAL_light_client_proof",io)}async nextLightClientBlock(io){return await this.sendJsonRpc("next_light_client_block",io)}async accessKeyChanges(io,fo){const{finality:$o}=fo,{blockId:mo}=fo;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"all_access_key_changes",account_ids:io,block_id:mo,finality:$o})}async singleAccessKeyChanges(io,fo){const{finality:$o}=fo,{blockId:mo}=fo;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"single_access_key_changes",keys:io,block_id:mo,finality:$o})}async accountChanges(io,fo){const{finality:$o}=fo,{blockId:mo}=fo;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"account_changes",account_ids:io,block_id:mo,finality:$o})}async contractStateChanges(io,fo,$o=""){const{finality:mo}=fo,{blockId:Ao}=fo;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"data_changes",account_ids:io,key_prefix_base64:$o,block_id:Ao,finality:mo})}async contractCodeChanges(io,fo){const{finality:$o}=fo,{blockId:mo}=fo;return this.sendJsonRpc("EXPERIMENTAL_changes",{changes_type:"contract_code_changes",account_ids:io,block_id:mo,finality:$o})}async gasPrice(io){return await this.sendJsonRpc("gas_price",[io])}async sendJsonRpc(io,fo){const $o=await exponentialBackoff$6(this.options.wait,this.options.retries,this.options.backoff,async()=>{var Ao;try{const jo={method:io,params:fo,id:_nextId$3++,jsonrpc:"2.0"},Lo=await fetchJsonRpc$1(this.connection.url,jo,this.connection.headers);if(Lo.error){if(typeof Lo.error.data=="object")throw typeof Lo.error.data.error_message=="string"&&typeof Lo.error.data.error_type=="string"?new TypedError$2(Lo.error.data.error_message,Lo.error.data.error_type):parseRpcError$3(Lo.error.data);{const Ho=`[${Lo.error.code}] ${Lo.error.message}: ${Lo.error.data}`;if(Lo.error.data==="Timeout"||Ho.includes("Timeout error")||Ho.includes("query has timed out"))throw new TypedError$2(Ho,"TimeoutError");const zo=getErrorTypeFromErrorMessage$3(Lo.error.data,"");throw zo?new TypedError$2(formatError$3(zo,fo),zo):new TypedError$2(Ho,Lo.error.name)}}else if(typeof((Ao=Lo.result)==null?void 0:Ao.error)=="string"){const Ho=getErrorTypeFromErrorMessage$3(Lo.result.error,"");if(Ho)throw new ServerError$3(formatError$3(Ho,fo),Ho)}return Lo}catch(jo){if(jo.type==="TimeoutError")return Logger$4.warn(`Retrying request to ${io} as it has timed out`,fo),null;throw jo}}),{result:mo}=$o;if(typeof mo>"u")throw new TypedError$2(`Exceeded ${this.options.retries} attempts for request to ${io}.`,"RetriesExceeded");return mo}},FailoverRpcProvider$3=class extends Provider$4{constructor(io){super();ap(this,"providers");ap(this,"currentProviderIndex");if(io.length===0)throw new Error("At least one provider must be specified");this.providers=io,this.currentProviderIndex=0}switchToNextProvider(){this.providers.length!==1&&(this.providers.length-1<=this.currentProviderIndex?this.currentProviderIndex=0:this.currentProviderIndex+=1,Logger$4.debug(`Switched to provider at the index ${this.currentProviderIndex}`))}get currentProvider(){const io=this.providers[this.currentProviderIndex];if(!io)throw new Error(`Provider wasn't found at index ${this.currentProviderIndex}`);return io}async withBackoff(io){for(let fo=0;fo<this.providers.length;fo++)try{const $o=await io(this.currentProvider);if($o)return $o}catch($o){console.error($o),this.switchToNextProvider()}throw new TypedError$2(`Exceeded ${this.providers.length} providers to execute request`,"RetriesExceeded")}async status(){return this.withBackoff(io=>io.status())}async sendTransactionUntil(io,fo){return this.withBackoff($o=>$o.sendTransactionUntil(io,fo))}async sendTransaction(io){return this.withBackoff(fo=>fo.sendTransaction(io))}async sendTransactionAsync(io){return this.withBackoff(fo=>fo.sendTransactionAsync(io))}async txStatus(io,fo,$o){return this.withBackoff(mo=>mo.txStatus(io,fo,$o))}async txStatusReceipts(io,fo,$o){return this.withBackoff(mo=>mo.txStatusReceipts(io,fo,$o))}async query(io,fo){return fo?this.withBackoff($o=>$o.query(io,fo)):this.withBackoff($o=>$o.query(io))}async block(io){return this.withBackoff(fo=>fo.block(io))}async blockChanges(io){return this.withBackoff(fo=>fo.blockChanges(io))}async chunk(io){return this.withBackoff(fo=>fo.chunk(io))}async validators(io){return this.withBackoff(fo=>fo.validators(io))}async experimental_protocolConfig(io){return this.withBackoff(fo=>fo.experimental_protocolConfig(io))}async lightClientProof(io){return this.withBackoff(fo=>fo.lightClientProof(io))}async nextLightClientBlock(io){return this.withBackoff(fo=>fo.nextLightClientBlock(io))}async accessKeyChanges(io,fo){return this.withBackoff($o=>$o.accessKeyChanges(io,fo))}async singleAccessKeyChanges(io,fo){return this.withBackoff($o=>$o.singleAccessKeyChanges(io,fo))}async accountChanges(io,fo){return this.withBackoff($o=>$o.accountChanges(io,fo))}async contractStateChanges(io,fo,$o=""){return this.withBackoff(mo=>mo.contractStateChanges(io,fo,$o))}async contractCodeChanges(io,fo){return this.withBackoff($o=>$o.contractCodeChanges(io,fo))}async gasPrice(io){return this.withBackoff(fo=>fo.gasPrice(io))}};const esm$1=Object.freeze(Object.defineProperty({__proto__:null,FailoverRpcProvider:FailoverRpcProvider$3,JsonRpcProvider:JsonRpcProvider$3,Provider:Provider$4,exponentialBackoff:exponentialBackoff$6},Symbol.toStringTag,{value:"Module"}));var commonjs$9={},constants$b={};Object.defineProperty(constants$b,"__esModule",{value:!0});constants$b.KeySize=constants$b.KeyType=void 0;var KeyType;(function(Mn){Mn[Mn.ED25519=0]="ED25519",Mn[Mn.SECP256K1=1]="SECP256K1"})(KeyType||(constants$b.KeyType=KeyType={}));constants$b.KeySize={SECRET_KEY:32,ED25519_PUBLIC_KEY:32,SECP256k1_PUBLIC_KEY:64};var key_pair$5={},key_pair_base$2={};Object.defineProperty(key_pair_base$2,"__esModule",{value:!0});key_pair_base$2.KeyPairBase=void 0;let KeyPairBase$2=class{};key_pair_base$2.KeyPairBase=KeyPairBase$2;var key_pair_ed25519$2={};const require$$0$a=getAugmentedNamespace(esm$5),require$$1$5=getAugmentedNamespace(ed25519$3);var public_key$2={},__importDefault$r=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(public_key$2,"__esModule",{value:!0});public_key$2.PublicKey=void 0;const utils_1$K=require$$0$a,ed25519_1$5=require$$1$5,secp256k1_1$3=__importDefault$r(elliptic),constants_1$d=constants$b;function key_type_to_str$2(Mn){switch(Mn){case constants_1$d.KeyType.ED25519:return"ed25519";case constants_1$d.KeyType.SECP256K1:return"secp256k1";default:throw new Error(`Unknown key type ${Mn}`)}}function str_to_key_type$2(Mn){switch(Mn.toLowerCase()){case"ed25519":return constants_1$d.KeyType.ED25519;case"secp256k1":return constants_1$d.KeyType.SECP256K1;default:throw new Error(`Unknown key type ${Mn}`)}}function resolveEnumKeyName$1(Mn){switch(Mn){case constants_1$d.KeyType.ED25519:return"ed25519Key";case constants_1$d.KeyType.SECP256K1:return"secp256k1Key";default:throw Error(`unknown type ${Mn}`)}}let Enum$3=class{constructor(Fn){if(Object.keys(Fn).length!==1)throw new Error("Enum can only take single value");Object.keys(Fn).map(io=>{this[io]=Fn[io]})}},PublicKey$2=class B2 extends Enum$3{constructor(io){const fo=resolveEnumKeyName$1(io.keyType);super({[fo]:io});ap(this,"enum");ap(this,"ed25519Key");ap(this,"secp256k1Key");this[fo]=io,this.enum=fo}static from(io){return typeof io=="string"?B2.fromString(io):io}static fromString(io){const fo=io.split(":");let $o,mo;if(fo.length===1)$o=fo[0];else if(fo.length===2)$o=fo[1],mo=str_to_key_type$2(fo[0]);else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>");const Ao=(0,utils_1$K.baseDecode)($o);mo||(mo=Ao.length===constants_1$d.KeySize.SECP256k1_PUBLIC_KEY?constants_1$d.KeyType.SECP256K1:constants_1$d.KeyType.ED25519);const jo=mo===constants_1$d.KeyType.ED25519?constants_1$d.KeySize.ED25519_PUBLIC_KEY:constants_1$d.KeySize.SECP256k1_PUBLIC_KEY;if(Ao.length!==jo)throw new Error(`Invalid public key size (${Ao.length}), must be ${jo}`);return new B2({keyType:mo,data:Ao})}toString(){const io=(0,utils_1$K.baseEncode)(this.data);return`${key_type_to_str$2(this.keyType)}:${io}`}verify(io,fo){const $o=this.keyType,mo=this.data;switch($o){case constants_1$d.KeyType.ED25519:return ed25519_1$5.ed25519.verify(fo,io,mo);case constants_1$d.KeyType.SECP256K1:return secp256k1_1$3.default.ecdsaVerify(fo.subarray(0,64),io,new Uint8Array([4,...mo]));default:throw new Error(`Unknown key type: ${$o}`)}}get keyPair(){return this.ed25519Key||this.secp256k1Key}get keyType(){return this.keyPair.keyType}get data(){return this.keyPair.data}};public_key$2.PublicKey=PublicKey$2;var __importDefault$q=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(key_pair_ed25519$2,"__esModule",{value:!0});key_pair_ed25519$2.KeyPairEd25519=void 0;const utils_1$J=require$$0$a,ed25519_1$4=require$$1$5,randombytes_1$4=__importDefault$q(browserExports),constants_1$c=constants$b,key_pair_base_1$7=key_pair_base$2,public_key_1$4=public_key$2;let KeyPairEd25519$2=class i_ extends key_pair_base_1$7.KeyPairBase{constructor(io){super();ap(this,"publicKey");ap(this,"secretKey");ap(this,"extendedSecretKey");const fo=(0,utils_1$J.baseDecode)(io),$o=new Uint8Array(fo.slice(0,constants_1$c.KeySize.SECRET_KEY)),mo=ed25519_1$4.ed25519.getPublicKey(new Uint8Array($o));this.publicKey=new public_key_1$4.PublicKey({keyType:constants_1$c.KeyType.ED25519,data:mo}),this.secretKey=(0,utils_1$J.baseEncode)($o),this.extendedSecretKey=io}static fromRandom(){const io=(0,randombytes_1$4.default)(constants_1$c.KeySize.SECRET_KEY),fo=ed25519_1$4.ed25519.getPublicKey(new Uint8Array(io)),$o=new Uint8Array([...io,...fo]);return new i_((0,utils_1$J.baseEncode)($o))}sign(io){return{signature:ed25519_1$4.ed25519.sign(io,(0,utils_1$J.baseDecode)(this.secretKey)),publicKey:this.publicKey}}verify(io,fo){return this.publicKey.verify(io,fo)}toString(){return`ed25519:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}};key_pair_ed25519$2.KeyPairEd25519=KeyPairEd25519$2;var key_pair_secp256k1$1={},__importDefault$p=commonjsGlobal$c&&commonjsGlobal$c.__importDefault||function(Mn){return Mn&&Mn.__esModule?Mn:{default:Mn}};Object.defineProperty(key_pair_secp256k1$1,"__esModule",{value:!0});key_pair_secp256k1$1.KeyPairSecp256k1=void 0;const utils_1$I=require$$0$a,randombytes_1$3=__importDefault$p(browserExports),secp256k1_1$2=__importDefault$p(elliptic),constants_1$b=constants$b,key_pair_base_1$6=key_pair_base$2,public_key_1$3=public_key$2;let KeyPairSecp256k1$1=class a_ extends key_pair_base_1$6.KeyPairBase{constructor(io){super();ap(this,"publicKey");ap(this,"secretKey");ap(this,"extendedSecretKey");const fo=(0,utils_1$I.baseDecode)(io),$o=new Uint8Array(fo.slice(0,constants_1$b.KeySize.SECRET_KEY)),mo=secp256k1_1$2.default.publicKeyCreate(new Uint8Array($o),!1),Ao=mo.subarray(1,mo.length);this.publicKey=new public_key_1$3.PublicKey({keyType:constants_1$b.KeyType.SECP256K1,data:Ao}),this.secretKey=(0,utils_1$I.baseEncode)($o),this.extendedSecretKey=io}static fromRandom(){const io=(0,randombytes_1$3.default)(constants_1$b.KeySize.SECRET_KEY),fo=secp256k1_1$2.default.publicKeyCreate(new Uint8Array(io),!1),$o=fo.subarray(1,fo.length),mo=new Uint8Array([...io,...$o]);return new a_((0,utils_1$I.baseEncode)(mo))}sign(io){const{signature:fo,recid:$o}=secp256k1_1$2.default.ecdsaSign(io,(0,utils_1$I.baseDecode)(this.secretKey));return{signature:new Uint8Array([...fo,$o]),publicKey:this.publicKey}}verify(io,fo){return this.publicKey.verify(io,fo)}toString(){return`secp256k1:${this.extendedSecretKey}`}getPublicKey(){return this.publicKey}};key_pair_secp256k1$1.KeyPairSecp256k1=KeyPairSecp256k1$1;Object.defineProperty(key_pair$5,"__esModule",{value:!0});key_pair$5.KeyPair=void 0;const key_pair_base_1$5=key_pair_base$2,key_pair_ed25519_1$2=key_pair_ed25519$2,key_pair_secp256k1_1$1=key_pair_secp256k1$1;let KeyPair$2=class extends key_pair_base_1$5.KeyPairBase{static fromRandom(Fn){switch(Fn.toUpperCase()){case"ED25519":return key_pair_ed25519_1$2.KeyPairEd25519.fromRandom();case"SECP256K1":return key_pair_secp256k1_1$1.KeyPairSecp256k1.fromRandom();default:throw new Error(`Unknown curve ${Fn}`)}}static fromString(Fn){const io=Fn.split(":");if(io.length===2)switch(io[0].toUpperCase()){case"ED25519":return new key_pair_ed25519_1$2.KeyPairEd25519(io[1]);case"SECP256K1":return new key_pair_secp256k1_1$1.KeyPairSecp256k1(io[1]);default:throw new Error(`Unknown curve: ${io[0]}`)}else throw new Error("Invalid encoded key format, must be <curve>:<encoded key>")}};key_pair$5.KeyPair=KeyPair$2;(function(Mn){Object.defineProperty(Mn,"__esModule",{value:!0}),Mn.PublicKey=Mn.KeyPairSecp256k1=Mn.KeyPairEd25519=Mn.KeyPair=Mn.KeyType=void 0;var Fn=constants$b;Object.defineProperty(Mn,"KeyType",{enumerable:!0,get:function(){return Fn.KeyType}});var io=key_pair$5;Object.defineProperty(Mn,"KeyPair",{enumerable:!0,get:function(){return io.KeyPair}});var fo=key_pair_ed25519$2;Object.defineProperty(Mn,"KeyPairEd25519",{enumerable:!0,get:function(){return fo.KeyPairEd25519}});var $o=key_pair_secp256k1$1;Object.defineProperty(Mn,"KeyPairSecp256k1",{enumerable:!0,get:function(){return $o.KeyPairSecp256k1}});var mo=public_key$2;Object.defineProperty(Mn,"PublicKey",{enumerable:!0,get:function(){return mo.PublicKey}})})(commonjs$9);let KeyStore$3=class{},InMemoryKeyStore$3=class extends KeyStore$3{constructor(){super();ap(this,"keys");this.keys={}}async setKey(io,fo,$o){this.keys[`${fo}:${io}`]=$o.toString()}async getKey(io,fo){const $o=this.keys[`${fo}:${io}`];return $o?commonjs$9.KeyPair.fromString($o):null}async removeKey(io,fo){delete this.keys[`${fo}:${io}`]}async clear(){this.keys={}}async getNetworks(){const io=new Set;return Object.keys(this.keys).forEach(fo=>{const $o=fo.split(":");io.add($o[1])}),Array.from(io.values())}async getAccounts(io){const fo=new Array;return Object.keys(this.keys).forEach($o=>{const mo=$o.split(":");mo[mo.length-1]===io&&fo.push(mo.slice(0,mo.length-1).join(":"))}),fo}toString(){return"InMemoryKeyStore"}},MergeKeyStore$3=class extends KeyStore$3{constructor(io,fo={writeKeyStoreIndex:0}){super();ap(this,"options");ap(this,"keyStores");this.options=fo,this.keyStores=io}async setKey(io,fo,$o){await this.keyStores[this.options.writeKeyStoreIndex].setKey(io,fo,$o)}async getKey(io,fo){for(const $o of this.keyStores){const mo=await $o.getKey(io,fo);if(mo)return mo}return null}async removeKey(io,fo){for(const $o of this.keyStores)await $o.removeKey(io,fo)}async clear(){for(const io of this.keyStores)await io.clear()}async getNetworks(){const io=new Set;for(const fo of this.keyStores)for(const $o of await fo.getNetworks())io.add($o);return Array.from(io)}async getAccounts(io){const fo=new Set;for(const $o of this.keyStores)for(const mo of await $o.getAccounts(io))fo.add(mo);return Array.from(fo)}toString(){return`MergeKeyStore(${this.keyStores.join(", ")})`}},MultiContractKeyStore$2=class{};const esm=Object.freeze(Object.defineProperty({__proto__:null,InMemoryKeyStore:InMemoryKeyStore$3,KeyStore:KeyStore$3,MergeKeyStore:MergeKeyStore$3,MultiContractKeyStore:MultiContractKeyStore$2},Symbol.toStringTag,{value:"Module"}));var RequestType;(function(Mn){Mn.CallFunction="call_function",Mn.ViewAccessKey="view_access_key",Mn.ViewAccessKeyList="view_access_key_list",Mn.ViewAccount="view_account",Mn.ViewCode="view_code",Mn.ViewState="view_state"})(RequestType||(RequestType={}));const NETWORK_ID="testnet",version$d="2.21.34";let errorConfig={getDocsUrl:({docsBaseUrl:Mn,docsPath:Fn="",docsSlug:io})=>Fn?`${Mn??"https://viem.sh"}${Fn}${io?`#${io}`:""}`:void 0,version:`viem@${version$d}`},BaseError$4=class L2 extends Error{constructor(Fn,io={}){var jo;const fo=(()=>{var Lo;return io.cause instanceof L2?io.cause.details:(Lo=io.cause)!=null&&Lo.message?io.cause.message:io.details})(),$o=io.cause instanceof L2&&io.cause.docsPath||io.docsPath,mo=(jo=errorConfig.getDocsUrl)==null?void 0:jo.call(errorConfig,{...io,docsPath:$o}),Ao=[Fn||"An error occurred.","",...io.metaMessages?[...io.metaMessages,""]:[],...mo?[`Docs: ${mo}`]:[],...fo?[`Details: ${fo}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(`
`);super(Ao,io.cause?{cause:io.cause}:void 0),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,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=fo,this.docsPath=$o,this.metaMessages=io.metaMessages,this.name=io.name??this.name,this.shortMessage=Fn,this.version=version$d}walk(Fn){return walk$1(this,Fn)}};function walk$1(Mn,Fn){return Fn!=null&&Fn(Mn)?Mn:Mn&&typeof Mn=="object"&&"cause"in Mn?walk$1(Mn.cause,Fn):Fn?null:Mn}let IntegerOutOfRangeError$1=class extends BaseError$4{constructor({max:Fn,min:io,signed:fo,size:$o,value:mo}){super(`Number "${mo}" is not in safe ${$o?`${$o*8}-bit ${fo?"signed":"unsigned"} `:""}integer range ${Fn?`(${io} to ${Fn})`:`(above ${io})`}`,{name:"IntegerOutOfRangeError"})}},InvalidBytesBooleanError$1=class extends BaseError$4{constructor(Fn){super(`Bytes value "${Fn}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},SizeOverflowError$1=class extends BaseError$4{constructor({givenSize:Fn,maxSize:io}){super(`Size cannot exceed ${io} bytes. Given size: ${Fn} bytes.`,{name:"SizeOverflowError"})}},SliceOffsetOutOfBoundsError$1=class extends BaseError$4{constructor({offset:Fn,position:io,size:fo}){super(`Slice ${io==="start"?"starting":"ending"} at offset "${Fn}" is out-of-bounds (size: ${fo}).`,{name:"SliceOffsetOutOfBoundsError"})}},SizeExceedsPaddingSizeError$1=class extends BaseError$4{constructor({size:Fn,targetSize:io,type:fo}){super(`${fo.charAt(0).toUpperCase()}${fo.slice(1).toLowerCase()} size (${Fn}) exceeds padding size (${io}).`,{name:"SizeExceedsPaddingSizeError"})}},InvalidBytesLengthError$1=class extends BaseError$4{constructor({size:Fn,targetSize:io,type:fo}){super(`${fo.charAt(0).toUpperCase()}${fo.slice(1).toLowerCase()} is expected to be ${io} ${fo} long, but is ${Fn} ${fo} long.`,{name:"InvalidBytesLengthError"})}};function pad$1(Mn,{dir:Fn,size:io=32}={}){return typeof Mn=="string"?padHex$1(Mn,{dir:Fn,size:io}):padBytes$1(Mn,{dir:Fn,size:io})}function padHex$1(Mn,{dir:Fn,size:io=32}={}){if(io===null)return Mn;const fo=Mn.replace("0x","");if(fo.length>io*2)throw new SizeExceedsPaddingSizeError$1({size:Math.ceil(fo.length/2),targetSize:io,type:"hex"});return`0x${fo[Fn==="right"?"padEnd":"padStart"](io*2,"0")}`}function padBytes$1(Mn,{dir:Fn,size:io=32}={}){if(io===null)return Mn;if(Mn.length>io)throw new SizeExceedsPaddingSizeError$1({size:Mn.length,targetSize:io,type:"bytes"});const fo=new Uint8Array(io);for(let $o=0;$o<io;$o++){const mo=Fn==="right";fo[mo?$o:io-$o-1]=Mn[mo?$o:Mn.length-$o-1]}return fo}function isHex$1(Mn,{strict:Fn=!0}={}){return!Mn||typeof Mn!="string"?!1:Fn?/^0x[0-9a-fA-F]*$/.test(Mn):Mn.startsWith("0x")}function size$3(Mn){return isHex$1(Mn,{strict:!1})?Math.ceil((Mn.length-2)/2):Mn.length}function trim$2(Mn,{dir:Fn="left"}={}){let io=typeof Mn=="string"?Mn.replace("0x",""):Mn,fo=0;for(let $o=0;$o<io.length-1&&io[Fn==="left"?$o:io.length-$o-1].toString()==="0";$o++)fo++;return io=Fn==="left"?io.slice(fo):io.slice(0,io.length-fo),typeof Mn=="string"?(io.length===1&&Fn==="right"&&(io=`${io}0`),`0x${io.length%2===1?`0${io}`:io}`):io}const encoder$3=new TextEncoder;function toBytes$2(Mn,Fn={}){return typeof Mn=="number"||typeof Mn=="bigint"?numberToBytes$1(Mn,Fn):typeof Mn=="boolean"?boolToBytes$1(Mn,Fn):isHex$1(Mn)?hexToBytes$2(Mn,Fn):stringToBytes$1(Mn,Fn)}function boolToBytes$1(Mn,Fn={}){const io=new Uint8Array(1);return io[0]=Number(Mn),typeof Fn.size=="number"?(assertSize$1(io,{size:Fn.size}),pad$1(io,{size:Fn.size})):io}const charCodeMap$1={zero:48,nine:57,A:65,F:70,a:97,f:102};function charCodeToBase16$1(Mn){if(Mn>=charCodeMap$1.zero&&Mn<=charCodeMap$1.nine)return Mn-charCodeMap$1.zero;if(Mn>=charCodeMap$1.A&&Mn<=charCodeMap$1.F)return Mn-(charCodeMap$1.A-10);if(Mn>=charCodeMap$1.a&&Mn<=charCodeMap$1.f)return Mn-(charCodeMap$1.a-10)}function hexToBytes$2(Mn,Fn={}){let io=Mn;Fn.size&&(assertSize$1(io,{size:Fn.size}),io=pad$1(io,{dir:"right",size:Fn.size}));let fo=io.slice(2);fo.length%2&&(fo=`0${fo}`);const $o=fo.length/2,mo=new Uint8Array($o);for(let Ao=0,jo=0;Ao<$o;Ao++){const Lo=charCodeToBase16$1(fo.charCodeAt(jo++)),Ho=charCodeToBase16$1(fo.charCodeAt(jo++));if(Lo===void 0||Ho===void 0)throw new BaseError$4(`Invalid byte sequence ("${fo[jo-2]}${fo[jo-1]}" in "${fo}").`);mo[Ao]=Lo*16+Ho}return mo}function numberToBytes$1(Mn,Fn){const io=numberToHex$1(Mn,Fn);return hexToBytes$2(io)}function stringToBytes$1(Mn,Fn={}){const io=encoder$3.encode(Mn);return typeof Fn.size=="number"?(assertSize$1(io,{size:Fn.size}),pad$1(io,{dir:"right",size:Fn.size})):io}function assertSize$1(Mn,{size:Fn}){if(size$3(Mn)>Fn)throw new SizeOverflowError$1({givenSize:size$3(Mn),maxSize:Fn})}function hexToBigInt$1(Mn,Fn={}){const{signed:io}=Fn;Fn.size&&assertSize$1(Mn,{size:Fn.size});const fo=BigInt(Mn);if(!io)return fo;const $o=(Mn.length-2)/2,mo=(1n<<BigInt($o)*8n-1n)-1n;return fo<=mo?fo:fo-BigInt(`0x${"f".padStart($o*2,"f")}`)-1n}function hexToNumber$2(Mn,Fn={}){return Number(hexToBigInt$1(Mn,Fn))}function hexToString$1(Mn,Fn={}){let io=hexToBytes$2(Mn);return Fn.size&&(assertSize$1(io,{size:Fn.size}),io=trim$2(io,{dir:"right"})),new TextDecoder().decode(io)}const hexes$2=Array.from({length:256},(Mn,Fn)=>Fn.toString(16).padStart(2,"0"));function toHex$1(Mn,Fn={}){return typeof Mn=="number"||typeof Mn=="bigint"?numberToHex$1(Mn,Fn):typeof Mn=="string"?stringToHex$1(Mn,Fn):typeof Mn=="boolean"?boolToHex$1(Mn,Fn):bytesToHex$2(Mn,Fn)}function boolToHex$1(Mn,Fn={}){const io=`0x${Number(Mn)}`;return typeof Fn.size=="number"?(assertSize$1(io,{size:Fn.size}),pad$1(io,{size:Fn.size})):io}function bytesToHex$2(Mn,Fn={}){let io="";for(let $o=0;$o<Mn.length;$o++)io+=hexes$2[Mn[$o]];const fo=`0x${io}`;return typeof Fn.size=="number"?(assertSize$1(fo,{size:Fn.size}),pad$1(fo,{dir:"right",size:Fn.size})):fo}function numberToHex$1(Mn,Fn={}){const{signed:io,size:fo}=Fn,$o=BigInt(Mn);let mo;fo?io?mo=(1n<<BigInt(fo)*8n-1n)-1n:mo=2n**(BigInt(fo)*8n)-1n:typeof Mn=="number"&&(mo=BigInt(Number.MAX_SAFE_INTEGER));const Ao=typeof mo=="bigint"&&io?-mo-1n:0;if(mo&&$o>mo||$o<Ao){const Lo=typeof Mn=="bigint"?"n":"";throw new IntegerOutOfRangeError$1({max:mo?`${mo}${Lo}`:void 0,min:`${Ao}${Lo}`,signed:io,size:fo,value:`${Mn}${Lo}`})}const jo=`0x${(io&&$o<0?(1n<<BigInt(fo*8))+BigInt($o):$o).toString(16)}`;return fo?pad$1(jo,{size:fo}):jo}const encoder$2=new TextEncoder;function stringToHex$1(Mn,Fn={}){const io=encoder$2.encode(Mn);return bytesToHex$2(io,Fn)}function formatAbiItem$1(Mn,{includeName:Fn=!1}={}){if(Mn.type!=="function"&&Mn.type!=="event"&&Mn.type!=="error")throw new InvalidDefinitionTypeError(Mn.type);return`${Mn.name}(${formatAbiParams(Mn.inputs,{includeName:Fn})})`}function formatAbiParams(Mn,{includeName:Fn=!1}={}){return Mn?Mn.map(io=>formatAbiParam(io,{includeName:Fn})).join(Fn?", ":","):""}function formatAbiParam(Mn,{includeName:Fn}){return Mn.type.startsWith("tuple")?`(${formatAbiParams(Mn.components,{includeName:Fn})})${Mn.type.slice(5)}`:Mn.type+(Fn&&Mn.name?` ${Mn.name}`:"")}class AbiConstructorNotFoundError extends BaseError$4{constructor({docsPath:Fn}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
`),{docsPath:Fn,name:"AbiConstructorNotFoundError"})}}class AbiConstructorParamsNotFoundError extends BaseError$4{constructor({docsPath:Fn}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
`),{docsPath:Fn,name:"AbiConstructorParamsNotFoundError"})}}class AbiDecodingDataSizeTooSmallError extends BaseError$4{constructor({data:Fn,params:io,size:fo}){super([`Data size of ${fo} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${formatAbiParams(io,{includeName:!0})})`,`Data: ${Fn} (${fo} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=Fn,this.params=io,this.size=fo}}class AbiDecodingZeroDataError extends BaseError$4{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class AbiEncodingArrayLengthMismatchError extends BaseError$4{constructor({expectedLength:Fn,givenLength:io,type:fo}){super([`ABI encoding array length mismatch for type ${fo}.`,`Expected length: ${Fn}`,`Given length: ${io}`].join(`
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class AbiEncodingBytesSizeMismatchError extends BaseError$4{constructor({expectedSize:Fn,value:io}){super(`Size of bytes "${io}" (bytes${size$3(io)}) does not match expected size (bytes${Fn}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class AbiEncodingLengthMismatchError extends BaseError$4{constructor({expectedLength:Fn,givenLength:io}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${Fn}`,`Given length (values): ${io}`].join(`
`),{name:"AbiEncodingLengthMismatchError"})}}class AbiErrorSignatureNotFoundError extends BaseError$4{constructor(Fn,{docsPath:io}){super([`Encoded error signature "${Fn}" not found on 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=${Fn}.`].join(`
`),{docsPath:io,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=Fn}}class AbiFunctionNotFoundError extends BaseError$4{constructor(Fn,{docsPath:io}={}){super([`Function ${Fn?`"${Fn}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:io,name:"AbiFunctionNotFoundError"})}}class AbiFunctionOutputsNotFoundError extends BaseError$4{constructor(Fn,{docsPath:io}){super([`Function "${Fn}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:io,name:"AbiFunctionOutputsNotFoundError"})}}class AbiItemAmbiguityError extends BaseError$4{constructor(Fn,io){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${Fn.type}\` in \`${formatAbiItem$1(Fn.abiItem)}\`, and`,`\`${io.type}\` in \`${formatAbiItem$1(io.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class InvalidAbiEncodingTypeError extends BaseError$4{constructor(Fn,{docsPath:io}){super([`Type "${Fn}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:io,name:"InvalidAbiEncodingType"})}}class InvalidAbiDecodingTypeError extends BaseError$4{constructor(Fn,{docsPath:io}){super([`Type "${Fn}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:io,name:"InvalidAbiDecodingType"})}}class InvalidArrayError extends BaseError$4{constructor(Fn){super([`Value "${Fn}" is not a valid array.`].join(`
`),{name:"InvalidArrayError"})}}class InvalidDefinitionTypeError extends BaseError$4{constructor(Fn){super([`"${Fn}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`),{name:"InvalidDefinitionTypeError"})}}function concat$1(Mn){return typeof Mn[0]=="string"?concatHex(Mn):concatBytes$2(Mn)}function concatBytes$2(Mn){let Fn=0;for(const $o of Mn)Fn+=$o.length;const io=new Uint8Array(Fn);let fo=0;for(const $o of Mn)io.set($o,fo),fo+=$o.length;return io}function concatHex(Mn){return`0x${Mn.reduce((Fn,io)=>Fn+io.replace("0x",""),"")}`}class InvalidAddressError extends BaseError$4{constructor({address:Fn}){super(`Address "${Fn}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(Fn){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=Fn}get(Fn){const io=super.get(Fn);return super.has(Fn)&&io!==void 0&&(this.delete(Fn),super.set(Fn,io)),io}set(Fn,io){if(super.set(Fn,io),this.maxSize&&this.size>this.maxSize){const fo=this.keys().next().value;fo&&this.delete(fo)}return this}}function number$2(Mn){if(!Number.isSafeInteger(Mn)||Mn<0)throw new Error(`positive integer expected, not ${Mn}`)}function isBytes$2(Mn){return Mn instanceof Uint8Array||Mn!=null&&typeof Mn=="object"&&Mn.constructor.name==="Uint8Array"}function bytes$1(Mn,...Fn){if(!isBytes$2(Mn))throw new Error("Uint8Array expected");if(Fn.length>0&&!Fn.includes(Mn.length))throw new Error(`Uint8Array expected of length ${Fn}, not of length=${Mn.length}`)}function hash$3(Mn){if(typeof Mn!="function"||typeof Mn.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$2(Mn.outputLen),number$2(Mn.blockLen)}function exists$1(Mn,Fn=!0){if(Mn.destroyed)throw new Error("Hash instance has been destroyed");if(Fn&&Mn.finished)throw new Error("Hash#digest() has already been called")}function output$1(Mn,Fn){bytes$1(Mn);const io=Fn.outputLen;if(Mn.length<io)throw new Error(`digestInto() expects output buffer of length at least ${io}`)}const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(Mn,Fn=!1){return Fn?{h:Number(Mn&U32_MASK64),l:Number(Mn>>_32n&U32_MASK64)}:{h:Number(Mn>>_32n&U32_MASK64)|0,l:Number(Mn&U32_MASK64)|0}}function split$c(Mn,Fn=!1){let io=new Uint32Array(Mn.length),fo=new Uint32Array(Mn.length);for(let $o=0;$o<Mn.length;$o++){const{h:mo,l:Ao}=fromBig(Mn[$o],Fn);[io[$o],fo[$o]]=[mo,Ao]}return[io,fo]}const rotlSH=(Mn,Fn,io)=>Mn<<io|Fn>>>32-io,rotlSL=(Mn,Fn,io)=>Fn<<io|Mn>>>32-io,rotlBH=(Mn,Fn,io)=>Fn<<io-32|Mn>>>64-io,rotlBL=(Mn,Fn,io)=>Mn<<io-32|Fn>>>64-io,crypto$3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32=Mn=>new Uint32Array(Mn.buffer,Mn.byteOffset,Math.floor(Mn.byteLength/4)),createView=Mn=>new DataView(Mn.buffer,Mn.byteOffset,Mn.byteLength),rotr=(Mn,Fn)=>Mn<<32-Fn|Mn>>>Fn,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=Mn=>Mn<<24&4278190080|Mn<<8&16711680|Mn>>>8&65280|Mn>>>24&255;function byteSwap32(Mn){for(let Fn=0;Fn<Mn.length;Fn++)Mn[Fn]=byteSwap(Mn[Fn])}function utf8ToBytes$1(Mn){if(typeof Mn!="string")throw new Error(`utf8ToBytes expected string, got ${typeof Mn}`);return new Uint8Array(new TextEncoder().encode(Mn))}function toBytes$1(Mn){return typeof Mn=="string"&&(Mn=utf8ToBytes$1(Mn)),bytes$1(Mn),Mn}function concatBytes$1(...Mn){let Fn=0;for(let fo=0;fo<Mn.length;fo++){const $o=Mn[fo];bytes$1($o),Fn+=$o.length}const io=new Uint8Array(Fn);for(let fo=0,$o=0;fo<Mn.length;fo++){const mo=Mn[fo];io.set(mo,$o),$o+=mo.length}return io}class Hash{clone(){return this._cloneInto()}}function wrapConstructor(Mn){const Fn=fo=>Mn().update(toBytes$1(fo)).digest(),io=Mn();return Fn.outputLen=io.outputLen,Fn.blockLen=io.blockLen,Fn.create=()=>Mn(),Fn}function randomBytes(Mn=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(Mn));if(crypto$3&&typeof crypto$3.randomBytes=="function")return crypto$3.randomBytes(Mn);throw new Error("crypto.getRandomValues must be defined")}const SHA3_PI$1=[],SHA3_ROTL$1=[],_SHA3_IOTA$1=[],_0n$6=BigInt(0),_1n$6=BigInt(1),_2n$4=BigInt(2),_7n$1=BigInt(7),_256n$1=BigInt(256),_0x71n$1=BigInt(113);for(let Mn=0,Fn=_1n$6,io=1,fo=0;Mn<24;Mn++){[io,fo]=[fo,(2*io+3*fo)%5],SHA3_PI$1.push(2*(5*fo+io)),SHA3_ROTL$1.push((Mn+1)*(Mn+2)/2%64);let $o=_0n$6;for(let mo=0;mo<7;mo++)Fn=(Fn<<_1n$6^(Fn>>_7n$1)*_0x71n$1)%_256n$1,Fn&_2n$4&&($o^=_1n$6<<(_1n$6<<BigInt(mo))-_1n$6);_SHA3_IOTA$1.push($o)}const[SHA3_IOTA_H$1,SHA3_IOTA_L$1]=split$c(_SHA3_IOTA$1,!0),rotlH$1=(Mn,Fn,io)=>io>32?rotlBH(Mn,Fn,io):rotlSH(Mn,Fn,io),rotlL$1=(Mn,Fn,io)=>io>32?rotlBL(Mn,Fn,io):rotlSL(Mn,Fn,io);function keccakP$1(Mn,Fn=24){const io=new Uint32Array(10);for(let fo=24-Fn;fo<24;fo++){for(let Ao=0;Ao<10;Ao++)io[Ao]=Mn[Ao]^Mn[Ao+10]^Mn[Ao+20]^Mn[Ao+30]^Mn[Ao+40];for(let Ao=0;Ao<10;Ao+=2){const jo=(Ao+8)%10,Lo=(Ao+2)%10,Ho=io[Lo],zo=io[Lo+1],Go=rotlH$1(Ho,zo,1)^io[jo],Vo=rotlL$1(Ho,zo,1)^io[jo+1];for(let Yo=0;Yo<50;Yo+=10)Mn[Ao+Yo]^=Go,Mn[Ao+Yo+1]^=Vo}let $o=Mn[2],mo=Mn[3];for(let Ao=0;Ao<24;Ao++){const jo=SHA3_ROTL$1[Ao],Lo=rotlH$1($o,mo,jo),Ho=rotlL$1($o,mo,jo),zo=SHA3_PI$1[Ao];$o=Mn[zo],mo=Mn[zo+1],Mn[zo]=Lo,Mn[zo+1]=Ho}for(let Ao=0;Ao<50;Ao+=10){for(let jo=0;jo<10;jo++)io[jo]=Mn[Ao+jo];for(let jo=0;jo<10;jo++)Mn[Ao+jo]^=~io[(jo+2)%10]&io[(jo+4)%10]}Mn[0]^=SHA3_IOTA_H$1[fo],Mn[1]^=SHA3_IOTA_L$1[fo]}io.fill(0)}let Keccak$1=class s_ extends Hash{constructor(Fn,io,fo,$o=!1,mo=24){if(super(),this.blockLen=Fn,this.suffix=io,this.outputLen=fo,this.enableXOF=$o,this.rounds=mo,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$2(fo),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){isLE||byteSwap32(this.state32),keccakP$1(this.state32,this.rounds),isLE||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(Fn){exists$1(this);const{blockLen:io,state:fo}=this;Fn=toBytes$1(Fn);const $o=Fn.length;for(let mo=0;mo<$o;){const Ao=Math.min(io-this.pos,$o-mo);for(let jo=0;jo<Ao;jo++)fo[this.pos++]^=Fn[mo++];this.pos===io&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:Fn,suffix:io,pos:fo,blockLen:$o}=this;Fn[fo]^=io,io&128&&fo===$o-1&&this.keccak(),Fn[$o-1]^=128,this.keccak()}writeInto(Fn){exists$1(this,!1),bytes$1(Fn),this.finish();const io=this.state,{blockLen:fo}=this;for(let $o=0,mo=Fn.length;$o<mo;){this.posOut>=fo&&this.keccak();const Ao=Math.min(fo-this.posOut,mo-$o);Fn.set(io.subarray(this.posOut,this.posOut+Ao),$o),this.posOut+=Ao,$o+=Ao}return Fn}xofInto(Fn){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(Fn)}xof(Fn){return number$2(Fn),this.xofInto(new Uint8Array(Fn))}digestInto(Fn){if(output$1(Fn,this),this.finished)throw new Error("digest() was already called");return this.writeInto(Fn),this.destroy(),Fn}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(Fn){const{blockLen:io,suffix:fo,outputLen:$o,rounds:mo,enableXOF:Ao}=this;return Fn||(Fn=new s_(io,fo,$o,Ao,mo)),Fn.state32.set(this.state32),Fn.pos=this.pos,Fn.posOut=this.posOut,Fn.finished=this.finished,Fn.rounds=mo,Fn.suffix=fo,Fn.outputLen=$o,Fn.enableXOF=Ao,Fn.destroyed=this.destroyed,Fn}};const gen$2=(Mn,Fn,io)=>wrapConstructor(()=>new Keccak$1(Fn,Mn,io)),keccak_256$1=gen$2(1,136,256/8);function keccak256$1(Mn,Fn){const io=Fn||"hex",fo=keccak_256$1(isHex$1(Mn,{strict:!1})?toBytes$2(Mn):Mn);return io==="bytes"?fo:toHex$1(fo)}const checksumAddressCache=new LruMap(8192);function checksumAddress(Mn,Fn){if(checksumAddressCache.has(`${Mn}.${Fn}`))return checksumAddressCache.get(`${Mn}.${Fn}`);const io=Mn.substring(2).toLowerCase(),fo=keccak256$1(stringToBytes$1(io),"bytes"),$o=io.split("");for(let Ao=0;Ao<40;Ao+=2)fo[Ao>>1]>>4>=8&&$o[Ao]&&($o[Ao]=$o[Ao].toUpperCase()),(fo[Ao>>1]&15)>=8&&$o[Ao+1]&&($o[Ao+1]=$o[Ao+1].toUpperCase());const mo=`0x${$o.join("")}`;return checksumAddressCache.set(`${Mn}.${Fn}`,mo),mo}function getAddress(Mn,Fn){if(!isAddress(Mn,{strict:!1}))throw new InvalidAddressError({address:Mn});return checksumAddress(Mn,Fn)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(Mn,Fn){const{strict:io=!0}=Fn??{},fo=`${Mn}.${io}`;if(isAddressCache.has(fo))return isAddressCache.get(fo);const $o=addressRegex.test(Mn)?Mn.toLowerCase()===Mn?!0:io?checksumAddress(Mn)===Mn:!0:!1;return isAddressCache.set(fo,$o),$o}function slice(Mn,Fn,io,{strict:fo}={}){return isHex$1(Mn,{strict:!1})?sliceHex(Mn,Fn,io,{strict:fo}):sliceBytes(Mn,Fn,io,{strict:fo})}function assertStartOffset(Mn,Fn){if(typeof Fn=="number"&&Fn>0&&Fn>size$3(Mn)-1)throw new SliceOffsetOutOfBoundsError$1({offset:Fn,position:"start",size:size$3(Mn)})}function assertEndOffset(Mn,Fn,io){if(typeof Fn=="number"&&typeof io=="number"&&size$3(Mn)!==io-Fn)throw new SliceOffsetOutOfBoundsError$1({offset:io,position:"end",size:size$3(Mn)})}function sliceBytes(Mn,Fn,io,{strict:fo}={}){assertStartOffset(Mn,Fn);const $o=Mn.slice(Fn,io);return fo&&assertEndOffset($o,Fn,io),$o}function sliceHex(Mn,Fn,io,{strict:fo}={}){assertStartOffset(Mn,Fn);const $o=`0x${Mn.replace("0x","").slice((Fn??0)*2,(io??Mn.length)*2)}`;return fo&&assertEndOffset($o,Fn,io),$o}function encodeAbiParameters(Mn,Fn){if(Mn.length!==Fn.length)throw new AbiEncodingLengthMismatchError({expectedLength:Mn.length,givenLength:Fn.length});const io=prepareParams({params:Mn,values:Fn}),fo=encodeParams(io);return fo.length===0?"0x":fo}function prepareParams({params:Mn,values:Fn}){const io=[];for(let fo=0;fo<Mn.length;fo++)io.push(prepareParam({param:Mn[fo],value:Fn[fo]}));return io}function prepareParam({param:Mn,value:Fn}){const io=getArrayComponents(Mn.type);if(io){const[fo,$o]=io;return encodeArray(Fn,{length:fo,param:{...Mn,type:$o}})}if(Mn.type==="tuple")return encodeTuple(Fn,{param:Mn});if(Mn.type==="address")return encodeAddress(Fn);if(Mn.type==="bool")return encodeBool(Fn);if(Mn.type.startsWith("uint")||Mn.type.startsWith("int")){const fo=Mn.type.startsWith("int");return encodeNumber(Fn,{signed:fo})}if(Mn.type.startsWith("bytes"))return encodeBytes(Fn,{param:Mn});if(Mn.type==="string")return encodeString(Fn);throw new InvalidAbiEncodingTypeError(Mn.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function encodeParams(Mn){let Fn=0;for(let mo=0;mo<Mn.length;mo++){const{dynamic:Ao,encoded:jo}=Mn[mo];Ao?Fn+=32:Fn+=size$3(jo)}const io=[],fo=[];let $o=0;for(let mo=0;mo<Mn.length;mo++){const{dynamic:Ao,encoded:jo}=Mn[mo];Ao?(io.push(numberToHex$1(Fn+$o,{size:32})),fo.push(jo),$o+=size$3(jo)):io.push(jo)}return concat$1([...io,...fo])}function encodeAddress(Mn){if(!isAddress(Mn))throw new InvalidAddressError({address:Mn});return{dynamic:!1,encoded:padHex$1(Mn.toLowerCase())}}function encodeArray(Mn,{length:Fn,param:io}){const fo=Fn===null;if(!Array.isArray(Mn))throw new InvalidArrayError(Mn);if(!fo&&Mn.length!==Fn)throw new AbiEncodingArrayLengthMismatchError({expectedLength:Fn,givenLength:Mn.length,type:`${io.type}[${Fn}]`});let $o=!1;const mo=[];for(let Ao=0;Ao<Mn.length;Ao++){const jo=prepareParam({param:io,value:Mn[Ao]});jo.dynamic&&($o=!0),mo.push(jo)}if(fo||$o){const Ao=encodeParams(mo);if(fo){const jo=numberToHex$1(mo.length,{size:32});return{dynamic:!0,encoded:mo.length>0?concat$1([jo,Ao]):jo}}if($o)return{dynamic:!0,encoded:Ao}}return{dynamic:!1,encoded:concat$1(mo.map(({encoded:Ao})=>Ao))}}function encodeBytes(Mn,{param:Fn}){const[,io]=Fn.type.split("bytes"),fo=size$3(Mn);if(!io){let $o=Mn;return fo%32!==0&&($o=padHex$1($o,{dir:"right",size:Math.ceil((Mn.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$1([padHex$1(numberToHex$1(fo,{size:32})),$o])}}if(fo!==Number.parseInt(io))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(io),value:Mn});return{dynamic:!1,encoded:padHex$1(Mn,{dir:"right"})}}function encodeBool(Mn){if(typeof Mn!="boolean")throw new BaseError$4(`Invalid boolean value: "${Mn}" (type: ${typeof Mn}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex$1(boolToHex$1(Mn))}}function encodeNumber(Mn,{signed:Fn}){return{dynamic:!1,encoded:numberToHex$1(Mn,{size:32,signed:Fn})}}function encodeString(Mn){const Fn=stringToHex$1(Mn),io=Math.ceil(size$3(Fn)/32),fo=[];for(let $o=0;$o<io;$o++)fo.push(padHex$1(slice(Fn,$o*32,($o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:concat$1([padHex$1(numberToHex$1(size$3(Fn),{size:32})),...fo])}}function encodeTuple(Mn,{param:Fn}){let io=!1;const fo=[];for(let $o=0;$o<Fn.components.length;$o++){const mo=Fn.components[$o],Ao=Array.isArray(Mn)?$o:mo.name,jo=prepareParam({param:mo,value:Mn[Ao]});fo.push(jo),jo.dynamic&&(io=!0)}return{dynamic:io,encoded:io?encodeParams(fo):concat$1(fo.map(({encoded:$o})=>$o))}}function getArrayComponents(Mn){const Fn=Mn.match(/^(.*)\[(\d+)?\]$/);return Fn?[Fn[2]?Number(Fn[2]):null,Fn[1]]:void 0}const docsPath$2="/docs/contract/encodeDeployData";function encodeDeployData(Mn){const{abi:Fn,args:io,bytecode:fo}=Mn;if(!io||io.length===0)return fo;const $o=Fn.find(Ao=>"type"in Ao&&Ao.type==="constructor");if(!$o)throw new AbiConstructorNotFoundError({docsPath:docsPath$2});if(!("inputs"in $o))throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});if(!$o.inputs||$o.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});const mo=encodeAbiParameters($o.inputs,io);return concatHex([fo,mo])}function parseAccount(Mn){return typeof Mn=="string"?{address:Mn,type:"json-rpc"}:Mn}class AccountNotFoundError extends BaseError$4{constructor({docsPath:Fn}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
`),{docsPath:Fn,docsSlug:"account",name:"AccountNotFoundError"})}}class AccountTypeNotSupportedError extends BaseError$4{constructor({docsPath:Fn,metaMessages:io,type:fo}){super(`Account type "${fo}" is not supported.`,{docsPath:Fn,metaMessages:io,name:"AccountTypeNotSupportedError"})}}function publicKeyToAddress(Mn){const Fn=keccak256$1(`0x${Mn.substring(4)}`).substring(26);return checksumAddress(`0x${Fn}`)}async function recoverPublicKey({hash:Mn,signature:Fn}){const io=isHex$1(Mn)?Mn:toHex$1(Mn),{secp256k1:fo}=await __vitePreload(async()=>{const{secp256k1:Ao}=await import("./secp256k1-CAji6-V8.js");return{secp256k1:Ao}},[]);return`0x${(()=>{if(typeof Fn=="object"&&"r"in Fn&&"s"in Fn){const{r:Ho,s:zo,v:Go,yParity:Vo}=Fn,Yo=Number(Vo??Go),Xo=toRecoveryBit(Yo);return new fo.Signature(hexToBigInt$1(Ho),hexToBigInt$1(zo)).addRecoveryBit(Xo)}const Ao=isHex$1(Fn)?Fn:toHex$1(Fn),jo=hexToNumber$2(`0x${Ao.slice(130)}`),Lo=toRecoveryBit(jo);return fo.Signature.fromCompact(Ao.substring(2,130)).addRecoveryBit(Lo)})().recoverPublicKey(io.substring(2)).toHex(!1)}`}function toRecoveryBit(Mn){if(Mn===0||Mn===1)return Mn;if(Mn===27)return 0;if(Mn===28)return 1;throw new Error("Invalid yParityOrV value")}async function recoverAddress({hash:Mn,signature:Fn}){return publicKeyToAddress(await recoverPublicKey({hash:Mn,signature:Fn}))}class NegativeOffsetError extends BaseError$4{constructor({offset:Fn}){super(`Offset \`${Fn}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError$4{constructor({length:Fn,position:io}){super(`Position \`${io}\` is out of bounds (\`0 < position < ${Fn}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError$4{constructor({count:Fn,limit:io}){super(`Recursive read limit of \`${io}\` exceeded (recursive read count: \`${Fn}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(Mn){if(Mn<0||Mn>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:Mn})},decrementPosition(Mn){if(Mn<0)throw new NegativeOffsetError({offset:Mn});const Fn=this.position-Mn;this.assertPosition(Fn),this.position=Fn},getReadCount(Mn){return this.positionReadCount.get(Mn||this.position)||0},incrementPosition(Mn){if(Mn<0)throw new NegativeOffsetError({offset:Mn});const Fn=this.position+Mn;this.assertPosition(Fn),this.position=Fn},inspectByte(Mn){const Fn=Mn??this.position;return this.assertPosition(Fn),this.bytes[Fn]},inspectBytes(Mn,Fn){const io=Fn??this.position;return this.assertPosition(io+Mn-1),this.bytes.subarray(io,io+Mn)},inspectUint8(Mn){const Fn=Mn??this.position;return this.assertPosition(Fn),this.bytes[Fn]},inspectUint16(Mn){const Fn=Mn??this.position;return this.assertPosition(Fn+1),this.dataView.getUint16(Fn)},inspectUint24(Mn){const Fn=Mn??this.position;return this.assertPosition(Fn+2),(this.dataView.getUint16(Fn)<<8)+this.dataView.getUint8(Fn+2)},inspectUint32(Mn){const Fn=Mn??this.position;return this.assertPosition(Fn+3),this.dataView.getUint32(Fn)},pushByte(Mn){this.assertPosition(this.position),this.bytes[this.position]=Mn,this.position++},pushBytes(Mn){this.assertPosition(this.position+Mn.length-1),this.bytes.set(Mn,this.position),this.position+=Mn.length},pushUint8(Mn){this.assertPosition(this.position),this.bytes[this.position]=Mn,this.position++},pushUint16(Mn){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,Mn),this.position+=2},pushUint24(Mn){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,Mn>>8),this.dataView.setUint8(this.position+2,Mn&255),this.position+=3},pushUint32(Mn){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,Mn),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const Mn=this.inspectByte();return this.position++,Mn},readBytes(Mn,Fn){this.assertReadLimit(),this._touch();const io=this.inspectBytes(Mn);return this.position+=Fn??Mn,io},readUint8(){this.assertReadLimit(),this._touch();const Mn=this.inspectUint8();return this.position+=1,Mn},readUint16(){this.assertReadLimit(),this._touch();const Mn=this.inspectUint16();return this.position+=2,Mn},readUint24(){this.assertReadLimit(),this._touch();const Mn=this.inspectUint24();return this.position+=3,Mn},readUint32(){this.assertReadLimit(),this._touch();const Mn=this.inspectUint32();return this.position+=4,Mn},get remaining(){return this.bytes.length-this.position},setPosition(Mn){const Fn=this.position;return this.assertPosition(Mn),this.position=Mn,()=>this.position=Fn},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const Mn=this.getReadCount();this.positionReadCount.set(this.position,Mn+1),Mn>0&&this.recursiveReadCount++}};function createCursor(Mn,{recursiveReadLimit:Fn=8192}={}){const io=Object.create(staticCursor);return io.bytes=Mn,io.dataView=new DataView(Mn.buffer,Mn.byteOffset,Mn.byteLength),io.positionReadCount=new Map,io.recursiveReadLimit=Fn,io}function toRlp(Mn,Fn="hex"){const io=getEncodable(Mn),fo=createCursor(new Uint8Array(io.length));return io.encode(fo),Fn==="hex"?bytesToHex$2(fo.bytes):fo.bytes}function getEncodable(Mn){return Array.isArray(Mn)?getEncodableList(Mn.map(Fn=>getEncodable(Fn))):getEncodableBytes(Mn)}function getEncodableList(Mn){const Fn=Mn.reduce(($o,mo)=>$o+mo.length,0),io=getSizeOfLength(Fn);return{length:Fn<=55?1+Fn:1+io+Fn,encode($o){Fn<=55?$o.pushByte(192+Fn):($o.pushByte(247+io),io===1?$o.pushUint8(Fn):io===2?$o.pushUint16(Fn):io===3?$o.pushUint24(Fn):$o.pushUint32(Fn));for(const{encode:mo}of Mn)mo($o)}}}function getEncodableBytes(Mn){const Fn=typeof Mn=="string"?hexToBytes$2(Mn):Mn,io=getSizeOfLength(Fn.length);return{length:Fn.length===1&&Fn[0]<128?1:Fn.length<=55?1+Fn.length:1+io+Fn.length,encode($o){Fn.length===1&&Fn[0]<128?$o.pushBytes(Fn):Fn.length<=55?($o.pushByte(128+Fn.length),$o.pushBytes(Fn)):($o.pushByte(183+io),io===1?$o.pushUint8(Fn.length):io===2?$o.pushUint16(Fn.length):io===3?$o.pushUint24(Fn.length):$o.pushUint32(Fn.length),$o.pushBytes(Fn))}}}function getSizeOfLength(Mn){if(Mn<2**8)return 1;if(Mn<2**16)return 2;if(Mn<2**24)return 3;if(Mn<2**32)return 4;throw new BaseError$4("Length is too large.")}function hashAuthorization(Mn){const{chainId:Fn,contractAddress:io,nonce:fo,to:$o}=Mn,mo=keccak256$1(concatHex(["0x05",toRlp([Fn?numberToHex$1(Fn):"0x",io,fo?numberToHex$1(fo):"0x"])]));return $o==="bytes"?hexToBytes$2(mo):mo}async function recoverAuthorizationAddress(Mn){const{authorization:Fn,signature:io}=Mn;return recoverAddress({hash:hashAuthorization(Fn),signature:io??Fn})}class ChainDoesNotSupportContract extends BaseError$4{constructor({blockNumber:Fn,chain:io,contract:fo}){super(`Chain "${io.name}" does not support contract "${fo.name}".`,{metaMessages:["This could be due to any of the following:",...Fn&&fo.blockCreated&&fo.blockCreated>Fn?[`- The contract "${fo.name}" was not deployed until block ${fo.blockCreated} (current block ${Fn}).`]:[`- The chain does not have the contract "${fo.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ChainMismatchError extends BaseError$4{constructor({chain:Fn,currentChainId:io}){super(`The current chain of the wallet (id: ${io}) does not match the target chain for the transaction (id: ${Fn.id} – ${Fn.name}).`,{metaMessages:[`Current Chain ID: ${io}`,`Expected Chain ID: ${Fn.id} – ${Fn.name}`],name:"ChainMismatchError"})}}class ChainNotFoundError extends BaseError$4{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
`),{name:"ChainNotFoundError"})}}class ClientChainNotConfiguredError extends BaseError$4{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function assertCurrentChain({chain:Mn,currentChainId:Fn}){if(!Mn)throw new ChainNotFoundError;if(Fn!==Mn.id)throw new ChainMismatchError({chain:Mn,currentChainId:Fn})}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9},weiUnits={ether:-18,gwei:-9};function formatUnits$1(Mn,Fn){let io=Mn.toString();const fo=io.startsWith("-");fo&&(io=io.slice(1)),io=io.padStart(Fn,"0");let[$o,mo]=[io.slice(0,io.length-Fn),io.slice(io.length-Fn)];return mo=mo.replace(/(0+)$/,""),`${fo?"-":""}${$o||"0"}${mo?`.${mo}`:""}`}function formatGwei(Mn,Fn="wei"){return formatUnits$1(Mn,gweiUnits[Fn])}class ExecutionRevertedError extends BaseError$4{constructor({cause:Fn,message:io}={}){var $o;const fo=($o=io==null?void 0:io.replace("execution reverted: ",""))==null?void 0:$o.replace("execution reverted","");super(`Execution reverted ${fo?`with reason: ${fo}`:"for an unknown reason"}.`,{cause:Fn,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError$4{constructor({cause:Fn,maxFeePerGas:io}={}){super(`The fee cap (\`maxFeePerGas\`${io?` = ${formatGwei(io)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:Fn,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class FeeCapTooLowError extends BaseError$4{constructor({cause:Fn,maxFeePerGas:io}={}){super(`The fee cap (\`maxFeePerGas\`${io?` = ${formatGwei(io)}`:""} gwei) cannot be lower than the block base fee.`,{cause:Fn,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class NonceTooHighError extends BaseError$4{constructor({cause:Fn,nonce:io}={}){super(`Nonce provided for the transaction ${io?`(${io}) `:""}is higher than the next one expected.`,{cause:Fn,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError$4{constructor({cause:Fn,nonce:io}={}){super([`Nonce provided for the transaction ${io?`(${io}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
`),{cause:Fn,name:"NonceTooLowError"})}}Object.defineProperty(NonceTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class NonceMaxValueError extends BaseError$4{constructor({cause:Fn,nonce:io}={}){super(`Nonce provided for the transaction ${io?`(${io}) `:""}exceeds the maximum allowed nonce.`,{cause:Fn,name:"NonceMaxValueError"})}}Object.defineProperty(NonceMaxValueError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class InsufficientFundsError extends BaseError$4{constructor({cause:Fn}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
`),{cause:Fn,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(InsufficientFundsError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class IntrinsicGasTooHighError extends BaseError$4{constructor({cause:Fn,gas:io}={}){super(`The amount of gas ${io?`(${io}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:Fn,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(IntrinsicGasTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class IntrinsicGasTooLowError extends BaseError$4{constructor({cause:Fn,gas:io}={}){super(`The amount of gas ${io?`(${io}) `:""}provided for the transaction is too low.`,{cause:Fn,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(IntrinsicGasTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class TransactionTypeNotSupportedError extends BaseError$4{constructor({cause:Fn}){super("The transaction type is not supported for this chain.",{cause:Fn,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(TransactionTypeNotSupportedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class TipAboveFeeCapError extends BaseError$4{constructor({cause:Fn,maxPriorityFeePerGas:io,maxFeePerGas:fo}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${io?` = ${formatGwei(io)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${fo?` = ${formatGwei(fo)} gwei`:""}).`].join(`
`),{cause:Fn,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class UnknownNodeError extends BaseError$4{constructor({cause:Fn}){super(`An error occurred while executing: ${Fn==null?void 0:Fn.shortMessage}`,{cause:Fn,name:"UnknownNodeError"})}}function formatEther(Mn,Fn="wei"){return formatUnits$1(Mn,etherUnits[Fn])}function prettyPrint(Mn){const Fn=Object.entries(Mn).map(([fo,$o])=>$o===void 0||$o===!1?null:[fo,$o]).filter(Boolean),io=Fn.reduce((fo,[$o])=>Math.max(fo,$o.length),0);return Fn.map(([fo,$o])=>` ${`${fo}:`.padEnd(io+1)} ${$o}`).join(`
`)}class FeeConflictError extends BaseError$4{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
`),{name:"FeeConflictError"})}}class InvalidSerializableTransactionError extends BaseError$4{constructor({transaction:Fn}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",prettyPrint(Fn),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class TransactionExecutionError extends BaseError$4{constructor(Fn,{account:io,docsPath:fo,chain:$o,data:mo,gas:Ao,gasPrice:jo,maxFeePerGas:Lo,maxPriorityFeePerGas:Ho,nonce:zo,to:Go,value:Vo}){var Xo;const Yo=prettyPrint({chain:$o&&`${$o==null?void 0:$o.name} (id: ${$o==null?void 0:$o.id})`,from:io==null?void 0:io.address,to:Go,value:typeof Vo<"u"&&`${formatEther(Vo)} ${((Xo=$o==null?void 0:$o.nativeCurrency)==null?void 0:Xo.symbol)||"ETH"}`,data:mo,gas:Ao,gasPrice:typeof jo<"u"&&`${formatGwei(jo)} gwei`,maxFeePerGas:typeof Lo<"u"&&`${formatGwei(Lo)} gwei`,maxPriorityFeePerGas:typeof Ho<"u"&&`${formatGwei(Ho)} gwei`,nonce:zo});super(Fn.shortMessage,{cause:Fn,docsPath:fo,metaMessages:[...Fn.metaMessages?[...Fn.metaMessages," "]:[],"Request Arguments:",Yo].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=Fn}}class TransactionNotFoundError extends BaseError$4{constructor({blockHash:Fn,blockNumber:io,blockTag:fo,hash:$o,index:mo}){let Ao="Transaction";fo&&mo!==void 0&&(Ao=`Transaction at block time "${fo}" at index "${mo}"`),Fn&&mo!==void 0&&(Ao=`Transaction at block hash "${Fn}" at index "${mo}"`),io&&mo!==void 0&&(Ao=`Transaction at block number "${io}" at index "${mo}"`),$o&&(Ao=`Transaction with hash "${$o}"`),super(`${Ao} could not be found.`,{name:"TransactionNotFoundError"})}}class TransactionReceiptNotFoundError extends BaseError$4{constructor({hash:Fn}){super(`Transaction receipt with hash "${Fn}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class WaitForTransactionReceiptTimeoutError extends BaseError$4{constructor({hash:Fn}){super(`Timed out while waiting for transaction with hash "${Fn}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}const stringify$3=(Mn,Fn,io)=>JSON.stringify(Mn,(fo,$o)=>typeof $o=="bigint"?$o.toString():$o,io),getContractAddress$1=Mn=>Mn,getUrl$1=Mn=>Mn;class HttpRequestError extends BaseError$4{constructor({body:Fn,cause:io,details:fo,headers:$o,status:mo,url:Ao}){super("HTTP request failed.",{cause:io,details:fo,metaMessages:[mo&&`Status: ${mo}`,`URL: ${getUrl$1(Ao)}`,Fn&&`Request body: ${stringify$3(Fn)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=Fn,this.headers=$o,this.status=mo,this.url=Ao}}class RpcRequestError extends BaseError$4{constructor({body:Fn,error:io,url:fo}){super("RPC Request failed.",{cause:io,details:io.message,metaMessages:[`URL: ${getUrl$1(fo)}`,`Request body: ${stringify$3(Fn)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=io.code}}class TimeoutError extends BaseError$4{constructor({body:Fn,url:io}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${getUrl$1(io)}`,`Request body: ${stringify$3(Fn)}`],name:"TimeoutError"})}}const unknownErrorCode=-1;class RpcError extends BaseError$4{constructor(Fn,{code:io,docsPath:fo,metaMessages:$o,name:mo,shortMessage:Ao}){super(Ao,{cause:Fn,docsPath:fo,metaMessages:$o||(Fn==null?void 0:Fn.metaMessages),name:mo||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=mo||Fn.name,this.code=Fn instanceof RpcRequestError?Fn.code:io??unknownErrorCode}}class ProviderRpcError extends RpcError{constructor(Fn,io){super(Fn,io),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=io.data}}class ParseRpcError extends RpcError{constructor(Fn){super(Fn,{code:ParseRpcError.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ParseRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class InvalidRequestRpcError extends RpcError{constructor(Fn){super(Fn,{code:InvalidRequestRpcError.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(InvalidRequestRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class MethodNotFoundRpcError extends RpcError{constructor(Fn,{method:io}={}){super(Fn,{code:MethodNotFoundRpcError.code,name:"MethodNotFoundRpcError",shortMessage:`The method${io?` "${io}"`:""} does not exist / is not available.`})}}Object.defineProperty(MethodNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class InvalidParamsRpcError extends RpcError{constructor(Fn){super(Fn,{code:InvalidParamsRpcError.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(InvalidParamsRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class InternalRpcError extends RpcError{constructor(Fn){super(Fn,{code:InternalRpcError.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(InternalRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class InvalidInputRpcError extends RpcError{constructor(Fn){super(Fn,{code:InvalidInputRpcError.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(InvalidInputRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ResourceNotFoundRpcError extends RpcError{constructor(Fn){super(Fn,{code:ResourceNotFoundRpcError.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ResourceNotFoundRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ResourceUnavailableRpcError extends RpcError{constructor(Fn){super(Fn,{code:ResourceUnavailableRpcError.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ResourceUnavailableRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class TransactionRejectedRpcError extends RpcError{constructor(Fn){super(Fn,{code:TransactionRejectedRpcError.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(TransactionRejectedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class MethodNotSupportedRpcError extends RpcError{constructor(Fn,{method:io}={}){super(Fn,{code:MethodNotSupportedRpcError.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${io?` "${io}"`:""} is not implemented.`})}}Object.defineProperty(MethodNotSupportedRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class LimitExceededRpcError extends RpcError{constructor(Fn){super(Fn,{code:LimitExceededRpcError.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(LimitExceededRpcError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class JsonRpcVersionUnsupportedError extends RpcError{constructor(Fn){super(Fn,{code:JsonRpcVersionUnsupportedError.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(JsonRpcVersionUnsupportedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class UserRejectedRequestError extends ProviderRpcError{constructor(Fn){super(Fn,{code:UserRejectedRequestError.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(UserRejectedRequestError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class UnauthorizedProviderError extends ProviderRpcError{constructor(Fn){super(Fn,{code:UnauthorizedProviderError.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(UnauthorizedProviderError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class UnsupportedProviderMethodError extends ProviderRpcError{constructor(Fn,{method:io}={}){super(Fn,{code:UnsupportedProviderMethodError.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${io?` " ${io}"`:""}.`})}}Object.defineProperty(UnsupportedProviderMethodError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ProviderDisconnectedError extends ProviderRpcError{constructor(Fn){super(Fn,{code:ProviderDisconnectedError.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ProviderDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ChainDisconnectedError extends ProviderRpcError{constructor(Fn){super(Fn,{code:ChainDisconnectedError.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ChainDisconnectedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class SwitchChainError extends ProviderRpcError{constructor(Fn){super(Fn,{code:SwitchChainError.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(SwitchChainError,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class UnknownRpcError extends RpcError{constructor(Fn){super(Fn,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function getNodeError(Mn,Fn){const io=(Mn.details||"").toLowerCase(),fo=Mn instanceof BaseError$4?Mn.walk($o=>($o==null?void 0:$o.code)===ExecutionRevertedError.code):Mn;return fo instanceof BaseError$4?new ExecutionRevertedError({cause:Mn,message:fo.details}):ExecutionRevertedError.nodeMessage.test(io)?new ExecutionRevertedError({cause:Mn,message:Mn.details}):FeeCapTooHighError.nodeMessage.test(io)?new FeeCapTooHighError({cause:Mn,maxFeePerGas:Fn==null?void 0:Fn.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(io)?new FeeCapTooLowError({cause:Mn,maxFeePerGas:Fn==null?void 0:Fn.maxFeePerGas}):NonceTooHighError.nodeMessage.test(io)?new NonceTooHighError({cause:Mn,nonce:Fn==null?void 0:Fn.nonce}):NonceTooLowError.nodeMessage.test(io)?new NonceTooLowError({cause:Mn,nonce:Fn==null?void 0:Fn.nonce}):NonceMaxValueError.nodeMessage.test(io)?new NonceMaxValueError({cause:Mn,nonce:Fn==null?void 0:Fn.nonce}):InsufficientFundsError.nodeMessage.test(io)?new InsufficientFundsError({cause:Mn}):IntrinsicGasTooHighError.nodeMessage.test(io)?new IntrinsicGasTooHighError({cause:Mn,gas:Fn==null?void 0:Fn.gas}):IntrinsicGasTooLowError.nodeMessage.test(io)?new IntrinsicGasTooLowError({cause:Mn,gas:Fn==null?void 0:Fn.gas}):TransactionTypeNotSupportedError.nodeMessage.test(io)?new TransactionTypeNotSupportedError({cause:Mn}):TipAboveFeeCapError.nodeMessage.test(io)?new TipAboveFeeCapError({cause:Mn,maxFeePerGas:Fn==null?void 0:Fn.maxFeePerGas,maxPriorityFeePerGas:Fn==null?void 0:Fn.maxPriorityFeePerGas}):new UnknownNodeError({cause:Mn})}function getTransactionError(Mn,{docsPath:Fn,...io}){const fo=(()=>{const $o=getNodeError(Mn,io);return $o instanceof UnknownNodeError?Mn:$o})();return new TransactionExecutionError(fo,{docsPath:Fn,...io})}function extract(Mn,{format:Fn}){if(!Fn)return{};const io={};function fo(mo){const Ao=Object.keys(mo);for(const jo of Ao)jo in Mn&&(io[jo]=Mn[jo]),mo[jo]&&typeof mo[jo]=="object"&&!Array.isArray(mo[jo])&&fo(mo[jo])}const $o=Fn(Mn||{});return fo($o),io}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(Mn){const Fn={};return typeof Mn.authorizationList<"u"&&(Fn.authorizationList=formatAuthorizationList$1(Mn.authorizationList)),typeof Mn.accessList<"u"&&(Fn.accessList=Mn.accessList),typeof Mn.blobVersionedHashes<"u"&&(Fn.blobVersionedHashes=Mn.blobVersionedHashes),typeof Mn.blobs<"u"&&(typeof Mn.blobs[0]!="string"?Fn.blobs=Mn.blobs.map(io=>bytesToHex$2(io)):Fn.blobs=Mn.blobs),typeof Mn.data<"u"&&(Fn.data=Mn.data),typeof Mn.from<"u"&&(Fn.from=Mn.from),typeof Mn.gas<"u"&&(Fn.gas=numberToHex$1(Mn.gas)),typeof Mn.gasPrice<"u"&&(Fn.gasPrice=numberToHex$1(Mn.gasPrice)),typeof Mn.maxFeePerBlobGas<"u"&&(Fn.maxFeePerBlobGas=numberToHex$1(Mn.maxFeePerBlobGas)),typeof Mn.maxFeePerGas<"u"&&(Fn.maxFeePerGas=numberToHex$1(Mn.maxFeePerGas)),typeof Mn.maxPriorityFeePerGas<"u"&&(Fn.maxPriorityFeePerGas=numberToHex$1(Mn.maxPriorityFeePerGas)),typeof Mn.nonce<"u"&&(Fn.nonce=numberToHex$1(Mn.nonce)),typeof Mn.to<"u"&&(Fn.to=Mn.to),typeof Mn.type<"u"&&(Fn.type=rpcTransactionType[Mn.type]),typeof Mn.value<"u"&&(Fn.value=numberToHex$1(Mn.value)),Fn}function formatAuthorizationList$1(Mn){return Mn.map(Fn=>({address:Fn.contractAddress,r:Fn.r,s:Fn.s,chainId:numberToHex$1(Fn.chainId),nonce:numberToHex$1(Fn.nonce),...typeof Fn.yParity<"u"?{yParity:numberToHex$1(Fn.yParity)}:{},...typeof Fn.v<"u"&&typeof Fn.yParity>"u"?{v:numberToHex$1(Fn.v)}:{}}))}function getAction$1(Mn,Fn,io){const fo=Mn[Fn.name];if(typeof fo=="function")return fo;const $o=Mn[io];return typeof $o=="function"?$o:mo=>Fn(Mn,mo)}const maxUint256=2n**256n-1n;function assertRequest(Mn){const{account:Fn,gasPrice:io,maxFeePerGas:fo,maxPriorityFeePerGas:$o,to:mo}=Mn,Ao=Fn?parseAccount(Fn):void 0;if(Ao&&!isAddress(Ao.address))throw new InvalidAddressError({address:Ao.address});if(mo&&!isAddress(mo))throw new InvalidAddressError({address:mo});if(typeof io<"u"&&(typeof fo<"u"||typeof $o<"u"))throw new FeeConflictError;if(fo&&fo>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:fo});if($o&&fo&&$o>fo)throw new TipAboveFeeCapError({maxFeePerGas:fo,maxPriorityFeePerGas:$o})}async function getChainId(Mn){const Fn=await Mn.request({method:"eth_chainId"},{dedupe:!0});return hexToNumber$2(Fn)}class BaseFeeScalarError extends BaseError$4{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Eip1559FeesNotSupportedError extends BaseError$4{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class MaxFeePerGasTooLowError extends BaseError$4{constructor({maxPriorityFeePerGas:Fn}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei(Fn)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class BlockNotFoundError extends BaseError$4{constructor({blockHash:Fn,blockNumber:io}){let fo="Block";Fn&&(fo=`Block at hash "${Fn}"`),io&&(fo=`Block at number "${io}"`),super(`${fo} could not be found.`,{name:"BlockNotFoundError"})}}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(Mn){const Fn={...Mn,blockHash:Mn.blockHash?Mn.blockHash:null,blockNumber:Mn.blockNumber?BigInt(Mn.blockNumber):null,chainId:Mn.chainId?hexToNumber$2(Mn.chainId):void 0,gas:Mn.gas?BigInt(Mn.gas):void 0,gasPrice:Mn.gasPrice?BigInt(Mn.gasPrice):void 0,maxFeePerBlobGas:Mn.maxFeePerBlobGas?BigInt(Mn.maxFeePerBlobGas):void 0,maxFeePerGas:Mn.maxFeePerGas?BigInt(Mn.maxFeePerGas):void 0,maxPriorityFeePerGas:Mn.maxPriorityFeePerGas?BigInt(Mn.maxPriorityFeePerGas):void 0,nonce:Mn.nonce?hexToNumber$2(Mn.nonce):void 0,to:Mn.to?Mn.to:null,transactionIndex:Mn.transactionIndex?Number(Mn.transactionIndex):null,type:Mn.type?transactionType[Mn.type]:void 0,typeHex:Mn.type?Mn.type:void 0,value:Mn.value?BigInt(Mn.value):void 0,v:Mn.v?BigInt(Mn.v):void 0};return Mn.authorizationList&&(Fn.authorizationList=formatAuthorizationList(Mn.authorizationList)),Fn.yParity=(()=>{if(Mn.yParity)return Number(Mn.yParity);if(typeof Fn.v=="bigint"){if(Fn.v===0n||Fn.v===27n)return 0;if(Fn.v===1n||Fn.v===28n)return 1;if(Fn.v>=35n)return Fn.v%2n===0n?1:0}})(),Fn.type==="legacy"&&(delete Fn.accessList,delete Fn.maxFeePerBlobGas,delete Fn.maxFeePerGas,delete Fn.maxPriorityFeePerGas,delete Fn.yParity),Fn.type==="eip2930"&&(delete Fn.maxFeePerBlobGas,delete Fn.maxFeePerGas,delete Fn.maxPriorityFeePerGas),Fn.type==="eip1559"&&delete Fn.maxFeePerBlobGas,Fn}function formatAuthorizationList(Mn){return Mn.map(Fn=>({contractAddress:Fn.address,chainId:Number(Fn.chainId),nonce:Number(Fn.nonce),r:Fn.r,s:Fn.s,yParity:Number(Fn.yParity)}))}function formatBlock(Mn){var io;const Fn=(io=Mn.transactions)==null?void 0:io.map(fo=>typeof fo=="string"?fo:formatTransaction(fo));return{...Mn,baseFeePerGas:Mn.baseFeePerGas?BigInt(Mn.baseFeePerGas):null,blobGasUsed:Mn.blobGasUsed?BigInt(Mn.blobGasUsed):void 0,difficulty:Mn.difficulty?BigInt(Mn.difficulty):void 0,excessBlobGas:Mn.excessBlobGas?BigInt(Mn.excessBlobGas):void 0,gasLimit:Mn.gasLimit?BigInt(Mn.gasLimit):void 0,gasUsed:Mn.gasUsed?BigInt(Mn.gasUsed):void 0,hash:Mn.hash?Mn.hash:null,logsBloom:Mn.logsBloom?Mn.logsBloom:null,nonce:Mn.nonce?Mn.nonce:null,number:Mn.number?BigInt(Mn.number):null,size:Mn.size?BigInt(Mn.size):void 0,timestamp:Mn.timestamp?BigInt(Mn.timestamp):void 0,transactions:Fn,totalDifficulty:Mn.totalDifficulty?BigInt(Mn.totalDifficulty):null}}async function getBlock(Mn,{blockHash:Fn,blockNumber:io,blockTag:fo,includeTransactions:$o}={}){var zo,Go,Vo;const mo=fo??"latest",Ao=$o??!1,jo=io!==void 0?numberToHex$1(io):void 0;let Lo=null;if(Fn?Lo=await Mn.request({method:"eth_getBlockByHash",params:[Fn,Ao]},{dedupe:!0}):Lo=await Mn.request({method:"eth_getBlockByNumber",params:[jo||mo,Ao]},{dedupe:!!jo}),!Lo)throw new BlockNotFoundError({blockHash:Fn,blockNumber:io});return(((Vo=(Go=(zo=Mn.chain)==null?void 0:zo.formatters)==null?void 0:Go.block)==null?void 0:Vo.format)||formatBlock)(Lo)}async function getGasPrice(Mn){const Fn=await Mn.request({method:"eth_gasPrice"});return BigInt(Fn)}async function internal_estimateMaxPriorityFeePerGas(Mn,Fn){var mo,Ao;const{block:io,chain:fo=Mn.chain,request:$o}=Fn||{};try{const jo=((mo=fo==null?void 0:fo.fees)==null?void 0:mo.maxPriorityFeePerGas)??((Ao=fo==null?void 0:fo.fees)==null?void 0:Ao.defaultPriorityFee);if(typeof jo=="function"){const Ho=io||await getAction$1(Mn,getBlock,"getBlock")({}),zo=await jo({block:Ho,client:Mn,request:$o});if(zo===null)throw new Error;return zo}if(typeof jo<"u")return jo;const Lo=await Mn.request({method:"eth_maxPriorityFeePerGas"});return hexToBigInt$1(Lo)}catch{const[jo,Lo]=await Promise.all([io?Promise.resolve(io):getAction$1(Mn,getBlock,"getBlock")({}),getAction$1(Mn,getGasPrice,"getGasPrice")({})]);if(typeof jo.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const Ho=Lo-jo.baseFeePerGas;return Ho<0n?0n:Ho}}async function internal_estimateFeesPerGas(Mn,Fn){var Vo,Yo;const{block:io,chain:fo=Mn.chain,request:$o,type:mo="eip1559"}=Fn||{},Ao=await(async()=>{var Xo,is;return typeof((Xo=fo==null?void 0:fo.fees)==null?void 0:Xo.baseFeeMultiplier)=="function"?fo.fees.baseFeeMultiplier({block:io,client:Mn,request:$o}):((is=fo==null?void 0:fo.fees)==null?void 0:is.baseFeeMultiplier)??1.2})();if(Ao<1)throw new BaseFeeScalarError;const Lo=10**(((Vo=Ao.toString().split(".")[1])==null?void 0:Vo.length)??0),Ho=Xo=>Xo*BigInt(Math.ceil(Ao*Lo))/BigInt(Lo),zo=io||await getAction$1(Mn,getBlock,"getBlock")({});if(typeof((Yo=fo==null?void 0:fo.fees)==null?void 0:Yo.estimateFeesPerGas)=="function"){const Xo=await fo.fees.estimateFeesPerGas({block:io,client:Mn,multiply:Ho,request:$o,type:mo});if(Xo!==null)return Xo}if(mo==="eip1559"){if(typeof zo.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const Xo=typeof($o==null?void 0:$o.maxPriorityFeePerGas)=="bigint"?$o.maxPriorityFeePerGas:await internal_estimateMaxPriorityFeePerGas(Mn,{block:zo,chain:fo,request:$o}),is=Ho(zo.baseFeePerGas);return{maxFeePerGas:($o==null?void 0:$o.maxFeePerGas)??is+Xo,maxPriorityFeePerGas:Xo}}return{gasPrice:($o==null?void 0:$o.gasPrice)??Ho(await getAction$1(Mn,getGasPrice,"getGasPrice")({}))}}class EstimateGasExecutionError extends BaseError$4{constructor(Fn,{account:io,docsPath:fo,chain:$o,data:mo,gas:Ao,gasPrice:jo,maxFeePerGas:Lo,maxPriorityFeePerGas:Ho,nonce:zo,to:Go,value:Vo}){var Xo;const Yo=prettyPrint({from:io==null?void 0:io.address,to:Go,value:typeof Vo<"u"&&`${formatEther(Vo)} ${((Xo=$o==null?void 0:$o.nativeCurrency)==null?void 0:Xo.symbol)||"ETH"}`,data:mo,gas:Ao,gasPrice:typeof jo<"u"&&`${formatGwei(jo)} gwei`,maxFeePerGas:typeof Lo<"u"&&`${formatGwei(Lo)} gwei`,maxPriorityFeePerGas:typeof Ho<"u"&&`${formatGwei(Ho)} gwei`,nonce:zo});super(Fn.shortMessage,{cause:Fn,docsPath:fo,metaMessages:[...Fn.metaMessages?[...Fn.metaMessages," "]:[],"Estimate Gas Arguments:",Yo].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=Fn}}function getEstimateGasError(Mn,{docsPath:Fn,...io}){const fo=(()=>{const $o=getNodeError(Mn,io);return $o instanceof UnknownNodeError?Mn:$o})();return new EstimateGasExecutionError(fo,{docsPath:Fn,...io})}class AccountStateConflictError extends BaseError$4{constructor({address:Fn}){super(`State for account "${Fn}" is set multiple times.`,{name:"AccountStateConflictError"})}}class StateAssignmentConflictError extends BaseError$4{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function prettyStateMapping(Mn){return Mn.reduce((Fn,{slot:io,value:fo})=>`${Fn} ${io}: ${fo}
`,"")}function prettyStateOverride(Mn){return Mn.reduce((Fn,{address:io,...fo})=>{let $o=`${Fn} ${io}:
`;return fo.nonce&&($o+=` nonce: ${fo.nonce}
`),fo.balance&&($o+=` balance: ${fo.balance}
`),fo.code&&($o+=` code: ${fo.code}
`),fo.state&&($o+=` state:
`,$o+=prettyStateMapping(fo.state)),fo.stateDiff&&($o+=` stateDiff:
`,$o+=prettyStateMapping(fo.stateDiff)),$o},` State Override:
`).slice(0,-1)}function serializeStateMapping(Mn){if(!(!Mn||Mn.length===0))return Mn.reduce((Fn,{slot:io,value:fo})=>{if(io.length!==66)throw new InvalidBytesLengthError$1({size:io.length,targetSize:66,type:"hex"});if(fo.length!==66)throw new InvalidBytesLengthError$1({size:fo.length,targetSize:66,type:"hex"});return Fn[io]=fo,Fn},{})}function serializeAccountStateOverride(Mn){const{balance:Fn,nonce:io,state:fo,stateDiff:$o,code:mo}=Mn,Ao={};if(mo!==void 0&&(Ao.code=mo),Fn!==void 0&&(Ao.balance=numberToHex$1(Fn)),io!==void 0&&(Ao.nonce=numberToHex$1(io)),fo!==void 0&&(Ao.state=serializeStateMapping(fo)),$o!==void 0){if(Ao.state)throw new StateAssignmentConflictError;Ao.stateDiff=serializeStateMapping($o)}return Ao}function serializeStateOverride(Mn){if(!Mn)return;const Fn={};for(const{address:io,...fo}of Mn){if(!isAddress(io,{strict:!1}))throw new InvalidAddressError({address:io});if(Fn[io])throw new AccountStateConflictError({address:io});Fn[io]=serializeAccountStateOverride(fo)}return Fn}async function getBalance$1(Mn,{address:Fn,blockNumber:io,blockTag:fo="latest"}){const $o=io?numberToHex$1(io):void 0,mo=await Mn.request({method:"eth_getBalance",params:[Fn,$o||fo]});return BigInt(mo)}async function estimateGas$1(Mn,Fn){var $o,mo,Ao;const{account:io=Mn.account}=Fn,fo=io?parseAccount(io):void 0;try{let Jo=function(ps){const{block:_c,request:$l,rpcStateOverride:El}=ps;return Mn.request({method:"eth_estimateGas",params:El?[$l,_c??"latest",El]:_c?[$l,_c]:[$l]})};const{accessList:jo,authorizationList:Lo,blobs:Ho,blobVersionedHashes:zo,blockNumber:Go,blockTag:Vo,data:Yo,gas:Xo,gasPrice:is,maxFeePerBlobGas:yl,maxFeePerGas:us,maxPriorityFeePerGas:hs,nonce:_l,value:xl,stateOverride:Il,...Ol}=await prepareTransactionRequest$1(Mn,{...Fn,parameters:(fo==null?void 0:fo.type)==="local"?void 0:["blobVersionedHashes"]}),Cl=(Go?numberToHex$1(Go):void 0)||Vo,Nl=serializeStateOverride(Il),Wl=await(async()=>{if(Ol.to)return Ol.to;if(Lo&&Lo.length>0)return await recoverAuthorizationAddress({authorization:Lo[0]}).catch(()=>{throw new BaseError$4("`to` is required. Could not infer from `authorizationList`")})})();assertRequest(Fn);const Dl=(Ao=(mo=($o=Mn.chain)==null?void 0:$o.formatters)==null?void 0:mo.transactionRequest)==null?void 0:Ao.format,Qo=(Dl||formatTransactionRequest)({...extract(Ol,{format:Dl}),from:fo==null?void 0:fo.address,accessList:jo,authorizationList:Lo,blobs:Ho,blobVersionedHashes:zo,data:Yo,gas:Xo,gasPrice:is,maxFeePerBlobGas:yl,maxFeePerGas:us,maxPriorityFeePerGas:hs,nonce:_l,to:Wl,value:xl});let rs=BigInt(await Jo({block:Cl,request:Qo,rpcStateOverride:Nl}));if(Lo){const ps=await getBalance$1(Mn,{address:Qo.from}),_c=await Promise.all(Lo.map(async $l=>{const{contractAddress:El}=$l,ds=await Jo({block:Cl,request:{authorizationList:void 0,data:Yo,from:fo==null?void 0:fo.address,to:El,value:numberToHex$1(ps)},rpcStateOverride:Nl}).catch(()=>100000n);return 2n*BigInt(ds)}));rs+=_c.reduce(($l,El)=>$l+El,0n)}return rs}catch(jo){throw getEstimateGasError(jo,{...Fn,account:fo,chain:Mn.chain})}}async function getTransactionCount(Mn,{address:Fn,blockTag:io="latest",blockNumber:fo}){const $o=await Mn.request({method:"eth_getTransactionCount",params:[Fn,fo?numberToHex$1(fo):io]},{dedupe:!!fo});return hexToNumber$2($o)}function blobsToCommitments(Mn){const{kzg:Fn}=Mn,io=Mn.to??(typeof Mn.blobs[0]=="string"?"hex":"bytes"),fo=typeof Mn.blobs[0]=="string"?Mn.blobs.map(mo=>hexToBytes$2(mo)):Mn.blobs,$o=[];for(const mo of fo)$o.push(Uint8Array.from(Fn.blobToKzgCommitment(mo)));return io==="bytes"?$o:$o.map(mo=>bytesToHex$2(mo))}function blobsToProofs(Mn){const{kzg:Fn}=Mn,io=Mn.to??(typeof Mn.blobs[0]=="string"?"hex":"bytes"),fo=typeof Mn.blobs[0]=="string"?Mn.blobs.map(Ao=>hexToBytes$2(Ao)):Mn.blobs,$o=typeof Mn.commitments[0]=="string"?Mn.commitments.map(Ao=>hexToBytes$2(Ao)):Mn.commitments,mo=[];for(let Ao=0;Ao<fo.length;Ao++){const jo=fo[Ao],Lo=$o[Ao];mo.push(Uint8Array.from(Fn.computeBlobKzgProof(jo,Lo)))}return io==="bytes"?mo:mo.map(Ao=>bytesToHex$2(Ao))}function setBigUint64$1(Mn,Fn,io,fo){if(typeof Mn.setBigUint64=="function")return Mn.setBigUint64(Fn,io,fo);const $o=BigInt(32),mo=BigInt(4294967295),Ao=Number(io>>$o&mo),jo=Number(io&mo),Lo=fo?4:0,Ho=fo?0:4;Mn.setUint32(Fn+Lo,Ao,fo),Mn.setUint32(Fn+Ho,jo,fo)}const Chi$1=(Mn,Fn,io)=>Mn&Fn^~Mn&io,Maj$1=(Mn,Fn,io)=>Mn&Fn^Mn&io^Fn&io;class HashMD extends Hash{constructor(Fn,io,fo,$o){super(),this.blockLen=Fn,this.outputLen=io,this.padOffset=fo,this.isLE=$o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(Fn),this.view=createView(this.buffer)}update(Fn){exists$1(this);const{view:io,buffer:fo,blockLen:$o}=this;Fn=toBytes$1(Fn);const mo=Fn.length;for(let Ao=0;Ao<mo;){const jo=Math.min($o-this.pos,mo-Ao);if(jo===$o){const Lo=createView(Fn);for(;$o<=mo-Ao;Ao+=$o)this.process(Lo,Ao);continue}fo.set(Fn.subarray(Ao,Ao+jo),this.pos),this.pos+=jo,Ao+=jo,this.pos===$o&&(this.process(io,0),this.pos=0)}return this.length+=Fn.length,this.roundClean(),this}digestInto(Fn){exists$1(this),output$1(Fn,this),this.finished=!0;const{buffer:io,view:fo,blockLen:$o,isLE:mo}=this;let{pos:Ao}=this;io[Ao++]=128,this.buffer.subarray(Ao).fill(0),this.padOffset>$o-Ao&&(this.process(fo,0),Ao=0);for(let Go=Ao;Go<$o;Go++)io[Go]=0;setBigUint64$1(fo,$o-8,BigInt(this.length*8),mo),this.process(fo,0);const jo=createView(Fn),Lo=this.outputLen;if(Lo%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const Ho=Lo/4,zo=this.get();if(Ho>zo.length)throw new Error("_sha2: outputLen bigger than state");for(let Go=0;Go<Ho;Go++)jo.setUint32(4*Go,zo[Go],mo)}digest(){const{buffer:Fn,outputLen:io}=this;this.digestInto(Fn);const fo=Fn.slice(0,io);return this.destroy(),fo}_cloneInto(Fn){Fn||(Fn=new this.constructor),Fn.set(...this.get());const{blockLen:io,buffer:fo,length:$o,finished:mo,destroyed:Ao,pos:jo}=this;return Fn.length=$o,Fn.pos=jo,Fn.finished=mo,Fn.destroyed=Ao,$o%io&&Fn.buffer.set(fo),Fn}}const SHA256_K$1=new Uint32Array([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]),SHA256_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$1=class extends HashMD{constructor(){super(64,32,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:Fn,B:io,C:fo,D:$o,E:mo,F:Ao,G:jo,H:Lo}=this;return[Fn,io,fo,$o,mo,Ao,jo,Lo]}set(Fn,io,fo,$o,mo,Ao,jo,Lo){this.A=Fn|0,this.B=io|0,this.C=fo|0,this.D=$o|0,this.E=mo|0,this.F=Ao|0,this.G=jo|0,this.H=Lo|0}process(Fn,io){for(let Go=0;Go<16;Go++,io+=4)SHA256_W$1[Go]=Fn.getUint32(io,!1);for(let Go=16;Go<64;Go++){const Vo=SHA256_W$1[Go-15],Yo=SHA256_W$1[Go-2],Xo=rotr(Vo,7)^rotr(Vo,18)^Vo>>>3,is=rotr(Yo,17)^rotr(Yo,19)^Yo>>>10;SHA256_W$1[Go]=is+SHA256_W$1[Go-7]+Xo+SHA256_W$1[Go-16]|0}let{A:fo,B:$o,C:mo,D:Ao,E:jo,F:Lo,G:Ho,H:zo}=this;for(let Go=0;Go<64;Go++){const Vo=rotr(jo,6)^rotr(jo,11)^rotr(jo,25),Yo=zo+Vo+Chi$1(jo,Lo,Ho)+SHA256_K$1[Go]+SHA256_W$1[Go]|0,is=(rotr(fo,2)^rotr(fo,13)^rotr(fo,22))+Maj$1(fo,$o,mo)|0;zo=Ho,Ho=Lo,Lo=jo,jo=Ao+Yo|0,Ao=mo,mo=$o,$o=fo,fo=Yo+is|0}fo=fo+this.A|0,$o=$o+this.B|0,mo=mo+this.C|0,Ao=Ao+this.D|0,jo=jo+this.E|0,Lo=Lo+this.F|0,Ho=Ho+this.G|0,zo=zo+this.H|0,this.set(fo,$o,mo,Ao,jo,Lo,Ho,zo)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$5=wrapConstructor(()=>new SHA256$1);function sha256$4(Mn,Fn){return sha256$5(isHex$1(Mn,{strict:!1})?toBytes$2(Mn):Mn)}function commitmentToVersionedHash(Mn){const{commitment:Fn,version:io=1}=Mn,fo=Mn.to??(typeof Fn=="string"?"hex":"bytes"),$o=sha256$4(Fn);return $o.set([io],0),fo==="bytes"?$o:bytesToHex$2($o)}function commitmentsToVersionedHashes(Mn){const{commitments:Fn,version:io}=Mn,fo=Mn.to??(typeof Fn[0]=="string"?"hex":"bytes"),$o=[];for(const mo of Fn)$o.push(commitmentToVersionedHash({commitment:mo,to:fo,version:io}));return $o}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction;class BlobSizeTooLargeError extends BaseError$4{constructor({maxSize:Fn,size:io}){super("Blob size is too large.",{metaMessages:[`Max: ${Fn} bytes`,`Given: ${io} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError$4{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function toBlobs(Mn){const Fn=Mn.to??(typeof Mn.data=="string"?"hex":"bytes"),io=typeof Mn.data=="string"?hexToBytes$2(Mn.data):Mn.data,fo=size$3(io);if(!fo)throw new EmptyBlobError;if(fo>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:fo});const $o=[];let mo=!0,Ao=0;for(;mo;){const jo=createCursor(new Uint8Array(bytesPerBlob));let Lo=0;for(;Lo<fieldElementsPerBlob;){const Ho=io.slice(Ao,Ao+(bytesPerFieldElement-1));if(jo.pushByte(0),jo.pushBytes(Ho),Ho.length<31){jo.pushByte(128),mo=!1;break}Lo++,Ao+=31}$o.push(jo)}return Fn==="bytes"?$o.map(jo=>jo.bytes):$o.map(jo=>bytesToHex$2(jo.bytes))}function toBlobSidecars(Mn){const{data:Fn,kzg:io,to:fo}=Mn,$o=Mn.blobs??toBlobs({data:Fn,to:fo}),mo=Mn.commitments??blobsToCommitments({blobs:$o,kzg:io,to:fo}),Ao=Mn.proofs??blobsToProofs({blobs:$o,commitments:mo,kzg:io,to:fo}),jo=[];for(let Lo=0;Lo<$o.length;Lo++)jo.push({blob:$o[Lo],commitment:mo[Lo],proof:Ao[Lo]});return jo}function getTransactionType(Mn){if(Mn.type)return Mn.type;if(typeof Mn.authorizationList<"u")return"eip7702";if(typeof Mn.blobs<"u"||typeof Mn.blobVersionedHashes<"u"||typeof Mn.maxFeePerBlobGas<"u"||typeof Mn.sidecars<"u")return"eip4844";if(typeof Mn.maxFeePerGas<"u"||typeof Mn.maxPriorityFeePerGas<"u")return"eip1559";if(typeof Mn.gasPrice<"u")return typeof Mn.accessList<"u"?"eip2930":"legacy";throw new InvalidSerializableTransactionError({transaction:Mn})}const defaultParameters=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function prepareTransactionRequest$1(Mn,Fn){const{account:io=Mn.account,blobs:fo,chain:$o,gas:mo,kzg:Ao,nonce:jo,nonceManager:Lo,parameters:Ho=defaultParameters,type:zo}=Fn,Go=io&&parseAccount(io),Vo={...Fn,...Go?{from:Go==null?void 0:Go.address}:{}};let Yo;async function Xo(){return Yo||(Yo=await getAction$1(Mn,getBlock,"getBlock")({blockTag:"latest"}),Yo)}let is;async function yl(){return is||($o?$o.id:typeof Fn.chainId<"u"?Fn.chainId:(is=await getAction$1(Mn,getChainId,"getChainId")({}),is))}if((Ho.includes("blobVersionedHashes")||Ho.includes("sidecars"))&&fo&&Ao){const us=blobsToCommitments({blobs:fo,kzg:Ao});if(Ho.includes("blobVersionedHashes")){const hs=commitmentsToVersionedHashes({commitments:us,to:"hex"});Vo.blobVersionedHashes=hs}if(Ho.includes("sidecars")){const hs=blobsToProofs({blobs:fo,commitments:us,kzg:Ao}),_l=toBlobSidecars({blobs:fo,commitments:us,proofs:hs,to:"hex"});Vo.sidecars=_l}}if(Ho.includes("chainId")&&(Vo.chainId=await yl()),Ho.includes("nonce")&&typeof jo>"u"&&Go)if(Lo){const us=await yl();Vo.nonce=await Lo.consume({address:Go.address,chainId:us,client:Mn})}else Vo.nonce=await getAction$1(Mn,getTransactionCount,"getTransactionCount")({address:Go.address,blockTag:"pending"});if((Ho.includes("fees")||Ho.includes("type"))&&typeof zo>"u")try{Vo.type=getTransactionType(Vo)}catch{const us=await Xo();Vo.type=typeof(us==null?void 0:us.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(Ho.includes("fees"))if(Vo.type!=="legacy"&&Vo.type!=="eip2930"){if(typeof Vo.maxFeePerGas>"u"||typeof Vo.maxPriorityFeePerGas>"u"){const us=await Xo(),{maxFeePerGas:hs,maxPriorityFeePerGas:_l}=await internal_estimateFeesPerGas(Mn,{block:us,chain:$o,request:Vo});if(typeof Fn.maxPriorityFeePerGas>"u"&&Fn.maxFeePerGas&&Fn.maxFeePerGas<_l)throw new MaxFeePerGasTooLowError({maxPriorityFeePerGas:_l});Vo.maxPriorityFeePerGas=_l,Vo.maxFeePerGas=hs}}else{if(typeof Fn.maxFeePerGas<"u"||typeof Fn.maxPriorityFeePerGas<"u")throw new Eip1559FeesNotSupportedError;const us=await Xo(),{gasPrice:hs}=await internal_estimateFeesPerGas(Mn,{block:us,chain:$o,request:Vo,type:"legacy"});Vo.gasPrice=hs}return Ho.includes("gas")&&typeof mo>"u"&&(Vo.gas=await getAction$1(Mn,estimateGas$1,"estimateGas")({...Vo,account:Go&&{address:Go.address,type:"json-rpc"}})),assertRequest(Vo),delete Vo.parameters,Vo}async function sendRawTransaction(Mn,{serializedTransaction:Fn}){return Mn.request({method:"eth_sendRawTransaction",params:[Fn]},{retryCount:0})}const supportsWalletNamespace=new LruMap(128);async function sendTransaction$1(Mn,Fn){var us,hs,_l,xl;const{account:io=Mn.account,chain:fo=Mn.chain,accessList:$o,authorizationList:mo,blobs:Ao,data:jo,gas:Lo,gasPrice:Ho,maxFeePerBlobGas:zo,maxFeePerGas:Go,maxPriorityFeePerGas:Vo,nonce:Yo,value:Xo,...is}=Fn;if(typeof io>"u")throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const yl=io?parseAccount(io):null;try{assertRequest(Fn);const Il=await(async()=>{if(Fn.to)return Fn.to;if(mo&&mo.length>0)return await recoverAuthorizationAddress({authorization:mo[0]}).catch(()=>{throw new BaseError$4("`to` is required. Could not infer from `authorizationList`.")})})();if((yl==null?void 0:yl.type)==="json-rpc"||yl===null){let Ol;fo!==null&&(Ol=await getAction$1(Mn,getChainId,"getChainId")({}),assertCurrentChain({currentChainId:Ol,chain:fo}));const Tl=(_l=(hs=(us=Mn.chain)==null?void 0:us.formatters)==null?void 0:hs.transactionRequest)==null?void 0:_l.format,Nl=(Tl||formatTransactionRequest)({...extract(is,{format:Tl}),accessList:$o,authorizationList:mo,blobs:Ao,chainId:Ol,data:jo,from:yl==null?void 0:yl.address,gas:Lo,gasPrice:Ho,maxFeePerBlobGas:zo,maxFeePerGas:Go,maxPriorityFeePerGas:Vo,nonce:Yo,to:Il,value:Xo}),Wl=supportsWalletNamespace.get(Mn.uid)?"wallet_sendTransaction":"eth_sendTransaction";try{return await Mn.request({method:Wl,params:[Nl]},{retryCount:0})}catch(Dl){const Rl=Dl;if(Rl.name==="InvalidInputRpcError"||Rl.name==="InvalidParamsRpcError"||Rl.name==="MethodNotFoundRpcError"||Rl.name==="MethodNotSupportedRpcError")return await Mn.request({method:"wallet_sendTransaction",params:[Nl]},{retryCount:0}).then(Qo=>(supportsWalletNamespace.set(Mn.uid,!0),Qo));throw Rl}}if((yl==null?void 0:yl.type)==="local"){const Ol=await getAction$1(Mn,prepareTransactionRequest$1,"prepareTransactionRequest")({account:yl,accessList:$o,authorizationList:mo,blobs:Ao,chain:fo,data:jo,gas:Lo,gasPrice:Ho,maxFeePerBlobGas:zo,maxFeePerGas:Go,maxPriorityFeePerGas:Vo,nonce:Yo,nonceManager:yl.nonceManager,parameters:[...defaultParameters,"sidecars"],value:Xo,...is,to:Il}),Tl=(xl=fo==null?void 0:fo.serializers)==null?void 0:xl.transaction,Cl=await yl.signTransaction(Ol,{serializer:Tl});return await getAction$1(Mn,sendRawTransaction,"sendRawTransaction")({serializedTransaction:Cl})}throw(yl==null?void 0:yl.type)==="smart"?new AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:yl==null?void 0:yl.type})}catch(Il){throw Il instanceof AccountTypeNotSupportedError?Il:getTransactionError(Il,{...Fn,account:yl,chain:Fn.chain||void 0})}}const multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],universalResolverErrors=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],universalResolverResolveAbi=[...universalResolverErrors,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],universalResolverReverseAbi=[...universalResolverErrors,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}];function bytesToBigInt(Mn,Fn={}){typeof Fn.size<"u"&&assertSize$1(Mn,{size:Fn.size});const io=bytesToHex$2(Mn,Fn);return hexToBigInt$1(io,Fn)}function bytesToBool(Mn,Fn={}){let io=Mn;if(typeof Fn.size<"u"&&(assertSize$1(io,{size:Fn.size}),io=trim$2(io)),io.length>1||io[0]>1)throw new InvalidBytesBooleanError$1(io);return!!io[0]}function bytesToNumber(Mn,Fn={}){typeof Fn.size<"u"&&assertSize$1(Mn,{size:Fn.size});const io=bytesToHex$2(Mn,Fn);return hexToNumber$2(io,Fn)}function bytesToString(Mn,Fn={}){let io=Mn;return typeof Fn.size<"u"&&(assertSize$1(io,{size:Fn.size}),io=trim$2(io,{dir:"right"})),new TextDecoder().decode(io)}function decodeAbiParameters(Mn,Fn){const io=typeof Fn=="string"?hexToBytes$2(Fn):Fn,fo=createCursor(io);if(size$3(io)===0&&Mn.length>0)throw new AbiDecodingZeroDataError;if(size$3(Fn)&&size$3(Fn)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof Fn=="string"?Fn:bytesToHex$2(Fn),params:Mn,size:size$3(Fn)});let $o=0;const mo=[];for(let Ao=0;Ao<Mn.length;++Ao){const jo=Mn[Ao];fo.setPosition($o);const[Lo,Ho]=decodeParameter(fo,jo,{staticPosition:0});$o+=Ho,mo.push(Lo)}return mo}function decodeParameter(Mn,Fn,{staticPosition:io}){const fo=getArrayComponents(Fn.type);if(fo){const[$o,mo]=fo;return decodeArray(Mn,{...Fn,type:mo},{length:$o,staticPosition:io})}if(Fn.type==="tuple")return decodeTuple(Mn,Fn,{staticPosition:io});if(Fn.type==="address")return decodeAddress(Mn);if(Fn.type==="bool")return decodeBool(Mn);if(Fn.type.startsWith("bytes"))return decodeBytes(Mn,Fn,{staticPosition:io});if(Fn.type.startsWith("uint")||Fn.type.startsWith("int"))return decodeNumber(Mn,Fn);if(Fn.type==="string")return decodeString(Mn,{staticPosition:io});throw new InvalidAbiDecodingTypeError(Fn.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const sizeOfLength=32,sizeOfOffset=32;function decodeAddress(Mn){const Fn=Mn.readBytes(32);return[checksumAddress(bytesToHex$2(sliceBytes(Fn,-20))),32]}function decodeArray(Mn,Fn,{length:io,staticPosition:fo}){if(!io){const Ao=bytesToNumber(Mn.readBytes(sizeOfOffset)),jo=fo+Ao,Lo=jo+sizeOfLength;Mn.setPosition(jo);const Ho=bytesToNumber(Mn.readBytes(sizeOfLength)),zo=hasDynamicChild(Fn);let Go=0;const Vo=[];for(let Yo=0;Yo<Ho;++Yo){Mn.setPosition(Lo+(zo?Yo*32:Go));const[Xo,is]=decodeParameter(Mn,Fn,{staticPosition:Lo});Go+=is,Vo.push(Xo)}return Mn.setPosition(fo+32),[Vo,32]}if(hasDynamicChild(Fn)){const Ao=bytesToNumber(Mn.readBytes(sizeOfOffset)),jo=fo+Ao,Lo=[];for(let Ho=0;Ho<io;++Ho){Mn.setPosition(jo+Ho*32);const[zo]=decodeParameter(Mn,Fn,{staticPosition:jo});Lo.push(zo)}return Mn.setPosition(fo+32),[Lo,32]}let $o=0;const mo=[];for(let Ao=0;Ao<io;++Ao){const[jo,Lo]=decodeParameter(Mn,Fn,{staticPosition:fo+$o});$o+=Lo,mo.push(jo)}return[mo,$o]}function decodeBool(Mn){return[bytesToBool(Mn.readBytes(32),{size:32}),32]}function decodeBytes(Mn,Fn,{staticPosition:io}){const[fo,$o]=Fn.type.split("bytes");if(!$o){const Ao=bytesToNumber(Mn.readBytes(32));Mn.setPosition(io+Ao);const jo=bytesToNumber(Mn.readBytes(32));if(jo===0)return Mn.setPosition(io+32),["0x",32];const Lo=Mn.readBytes(jo);return Mn.setPosition(io+32),[bytesToHex$2(Lo),32]}return[bytesToHex$2(Mn.readBytes(Number.parseInt($o),32)),32]}function decodeNumber(Mn,Fn){const io=Fn.type.startsWith("int"),fo=Number.parseInt(Fn.type.split("int")[1]||"256"),$o=Mn.readBytes(32);return[fo>48?bytesToBigInt($o,{signed:io}):bytesToNumber($o,{signed:io}),32]}function decodeTuple(Mn,Fn,{staticPosition:io}){const fo=Fn.components.length===0||Fn.components.some(({name:Ao})=>!Ao),$o=fo?[]:{};let mo=0;if(hasDynamicChild(Fn)){const Ao=bytesToNumber(Mn.readBytes(sizeOfOffset)),jo=io+Ao;for(let Lo=0;Lo<Fn.components.length;++Lo){const Ho=Fn.components[Lo];Mn.setPosition(jo+mo);const[zo,Go]=decodeParameter(Mn,Ho,{staticPosition:jo});mo+=Go,$o[fo?Lo:Ho==null?void 0:Ho.name]=zo}return Mn.setPosition(io+32),[$o,32]}for(let Ao=0;Ao<Fn.components.length;++Ao){const jo=Fn.components[Ao],[Lo,Ho]=decodeParameter(Mn,jo,{staticPosition:io});$o[fo?Ao:jo==null?void 0:jo.name]=Lo,mo+=Ho}return[$o,mo]}function decodeString(Mn,{staticPosition:Fn}){const io=bytesToNumber(Mn.readBytes(32)),fo=Fn+io;Mn.setPosition(fo);const $o=bytesToNumber(Mn.readBytes(32));if($o===0)return Mn.setPosition(Fn+32),["",32];const mo=Mn.readBytes($o,32),Ao=bytesToString(trim$2(mo));return Mn.setPosition(Fn+32),[Ao,32]}function hasDynamicChild(Mn){var fo;const{type:Fn}=Mn;if(Fn==="string"||Fn==="bytes"||Fn.endsWith("[]"))return!0;if(Fn==="tuple")return(fo=Mn.components)==null?void 0:fo.some(hasDynamicChild);const io=getArrayComponents(Mn.type);return!!(io&&hasDynamicChild({...Mn,type:io[1]}))}const hash$2=Mn=>keccak256$1(toBytes$2(Mn));function hashSignature(Mn){return hash$2(Mn)}const version$c="1.0.6";let BaseError$3=class U2 extends Error{constructor(Fn,io={}){var Ao;const fo=io.cause instanceof U2?io.cause.details:(Ao=io.cause)!=null&&Ao.message?io.cause.message:io.details,$o=io.cause instanceof U2&&io.cause.docsPath||io.docsPath,mo=[Fn||"An error occurred.","",...io.metaMessages?[...io.metaMessages,""]:[],...$o?[`Docs: https://abitype.dev${$o}`]:[],...fo?[`Details: ${fo}`]:[],`Version: abitype@${version$c}`].join(`
`);super(mo),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"}),io.cause&&(this.cause=io.cause),this.details=fo,this.docsPath=$o,this.metaMessages=io.metaMessages,this.shortMessage=Fn}};function execTyped$1(Mn,Fn){const io=Mn.exec(Fn);return io==null?void 0:io.groups}const bytesRegex$1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex$1=/^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$1=/^\(.+?\).*?$/,tupleRegex=/^tuple(?<array>(\[(\d*)\])*)$/;function formatAbiParameter(Mn){let Fn=Mn.type;if(tupleRegex.test(Mn.type)&&"components"in Mn){Fn="(";const io=Mn.components.length;for(let $o=0;$o<io;$o++){const mo=Mn.components[$o];Fn+=formatAbiParameter(mo),$o<io-1&&(Fn+=", ")}const fo=execTyped$1(tupleRegex,Mn.type);return Fn+=`)${(fo==null?void 0:fo.array)??""}`,formatAbiParameter({...Mn,type:Fn})}return"indexed"in Mn&&Mn.indexed&&(Fn=`${Fn} indexed`),Mn.name?`${Fn} ${Mn.name}`:Fn}function formatAbiParameters(Mn){let Fn="";const io=Mn.length;for(let fo=0;fo<io;fo++){const $o=Mn[fo];Fn+=formatAbiParameter($o),fo!==io-1&&(Fn+=", ")}return Fn}function formatAbiItem(Mn){return Mn.type==="function"?`function ${Mn.name}(${formatAbiParameters(Mn.inputs)})${Mn.stateMutability&&Mn.stateMutability!=="nonpayable"?` ${Mn.stateMutability}`:""}${Mn.outputs.length?` returns (${formatAbiParameters(Mn.outputs)})`:""}`:Mn.type==="event"?`event ${Mn.name}(${formatAbiParameters(Mn.inputs)})`:Mn.type==="error"?`error ${Mn.name}(${formatAbiParameters(Mn.inputs)})`:Mn.type==="constructor"?`constructor(${formatAbiParameters(Mn.inputs)})${Mn.stateMutability==="payable"?" payable":""}`:Mn.type==="fallback"?"fallback()":"receive() external payable"}const errorSignatureRegex$1=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function isErrorSignature$1(Mn){return errorSignatureRegex$1.test(Mn)}function execErrorSignature$1(Mn){return execTyped$1(errorSignatureRegex$1,Mn)}const eventSignatureRegex$1=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function isEventSignature$1(Mn){return eventSignatureRegex$1.test(Mn)}function execEventSignature$1(Mn){return execTyped$1(eventSignatureRegex$1,Mn)}const functionSignatureRegex$1=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function isFunctionSignature$1(Mn){return functionSignatureRegex$1.test(Mn)}function execFunctionSignature$1(Mn){return execTyped$1(functionSignatureRegex$1,Mn)}const structSignatureRegex$1=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function isStructSignature$1(Mn){return structSignatureRegex$1.test(Mn)}function execStructSignature$1(Mn){return execTyped$1(structSignatureRegex$1,Mn)}const constructorSignatureRegex$1=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function isConstructorSignature$1(Mn){return constructorSignatureRegex$1.test(Mn)}function execConstructorSignature$1(Mn){return execTyped$1(constructorSignatureRegex$1,Mn)}const fallbackSignatureRegex$1=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function isFallbackSignature$1(Mn){return fallbackSignatureRegex$1.test(Mn)}const receiveSignatureRegex$1=/^receive\(\) external payable$/;function isReceiveSignature$1(Mn){return receiveSignatureRegex$1.test(Mn)}const eventModifiers$1=new Set(["indexed"]),functionModifiers$1=new Set(["calldata","memory","storage"]);let UnknownTypeError$1=class extends BaseError$3{constructor({type:Fn}){super("Unknown type.",{metaMessages:[`Type "${Fn}" 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"})}},UnknownSolidityTypeError$1=class extends BaseError$3{constructor({type:Fn}){super("Unknown type.",{metaMessages:[`Type "${Fn}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}},InvalidParameterError$1=class extends BaseError$3{constructor({param:Fn}){super("Invalid ABI parameter.",{details:Fn}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},SolidityProtectedKeywordError$1=class extends BaseError$3{constructor({param:Fn,name:io}){super("Invalid ABI parameter.",{details:Fn,metaMessages:[`"${io}" 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"})}},InvalidModifierError$1=class extends BaseError$3{constructor({param:Fn,type:io,modifier:fo}){super("Invalid ABI parameter.",{details:Fn,metaMessages:[`Modifier "${fo}" not allowed${io?` in "${io}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},InvalidFunctionModifierError$1=class extends BaseError$3{constructor({param:Fn,type:io,modifier:fo}){super("Invalid ABI parameter.",{details:Fn,metaMessages:[`Modifier "${fo}" not allowed${io?` in "${io}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${fo}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},InvalidAbiTypeParameterError$1=class extends BaseError$3{constructor({abiParameter:Fn}){super("Invalid ABI parameter.",{details:JSON.stringify(Fn,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},InvalidSignatureError$1=class extends BaseError$3{constructor({signature:Fn,type:io}){super(`Invalid ${io} signature.`,{details:Fn}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},UnknownSignatureError$1=class extends BaseError$3{constructor({signature:Fn}){super("Unknown signature.",{details:Fn}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},InvalidStructSignatureError$1=class extends BaseError$3{constructor({signature:Fn}){super("Invalid struct signature.",{details:Fn,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},CircularReferenceError$1=class extends BaseError$3{constructor({type:Fn}){super("Circular reference detected.",{metaMessages:[`Struct "${Fn}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},InvalidParenthesisError$1=class extends BaseError$3{constructor({current:Fn,depth:io}){super("Unbalanced parentheses.",{metaMessages:[`"${Fn.trim()}" has too many ${io>0?"opening":"closing"} parentheses.`],details:`Depth "${io}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};function getParameterCacheKey$1(Mn,Fn){return Fn?`${Fn}:${Mn}`:Mn}const parameterCache$1=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$1(Mn,Fn={}){if(isFunctionSignature$1(Mn)){const io=execFunctionSignature$1(Mn);if(!io)throw new InvalidSignatureError$1({signature:Mn,type:"function"});const fo=splitParameters$1(io.parameters),$o=[],mo=fo.length;for(let jo=0;jo<mo;jo++)$o.push(parseAbiParameter$1(fo[jo],{modifiers:functionModifiers$1,structs:Fn,type:"function"}));const Ao=[];if(io.returns){const jo=splitParameters$1(io.returns),Lo=jo.length;for(let Ho=0;Ho<Lo;Ho++)Ao.push(parseAbiParameter$1(jo[Ho],{modifiers:functionModifiers$1,structs:Fn,type:"function"}))}return{name:io.name,type:"function",stateMutability:io.stateMutability??"nonpayable",inputs:$o,outputs:Ao}}if(isEventSignature$1(Mn)){const io=execEventSignature$1(Mn);if(!io)throw new InvalidSignatureError$1({signature:Mn,type:"event"});const fo=splitParameters$1(io.parameters),$o=[],mo=fo.length;for(let Ao=0;Ao<mo;Ao++)$o.push(parseAbiParameter$1(fo[Ao],{modifiers:eventModifiers$1,structs:Fn,type:"event"}));return{name:io.name,type:"event",inputs:$o}}if(isErrorSignature$1(Mn)){const io=execErrorSignature$1(Mn);if(!io)throw new InvalidSignatureError$1({signature:Mn,type:"error"});const fo=splitParameters$1(io.parameters),$o=[],mo=fo.length;for(let Ao=0;Ao<mo;Ao++)$o.push(parseAbiParameter$1(fo[Ao],{structs:Fn,type:"error"}));return{name:io.name,type:"error",inputs:$o}}if(isConstructorSignature$1(Mn)){const io=execConstructorSignature$1(Mn);if(!io)throw new InvalidSignatureError$1({signature:Mn,type:"constructor"});const fo=splitParameters$1(io.parameters),$o=[],mo=fo.length;for(let Ao=0;Ao<mo;Ao++)$o.push(parseAbiParameter$1(fo[Ao],{structs:Fn,type:"constructor"}));return{type:"constructor",stateMutability:io.stateMutability??"nonpayable",inputs:$o}}if(isFallbackSignature$1(Mn))return{type:"fallback"};if(isReceiveSignature$1(Mn))return{type:"receive",stateMutability:"payable"};throw new UnknownSignatureError$1({signature:Mn})}const abiParameterWithoutTupleRegex$1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex$1=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex$1=/^u?int$/;function parseAbiParameter$1(Mn,Fn){var Go,Vo;const io=getParameterCacheKey$1(Mn,Fn==null?void 0:Fn.type);if(parameterCache$1.has(io))return parameterCache$1.get(io);const fo=isTupleRegex$1.test(Mn),$o=execTyped$1(fo?abiParameterWithTupleRegex$1:abiParameterWithoutTupleRegex$1,Mn);if(!$o)throw new InvalidParameterError$1({param:Mn});if($o.name&&isSolidityKeyword$1($o.name))throw new SolidityProtectedKeywordError$1({param:Mn,name:$o.name});const mo=$o.name?{name:$o.name}:{},Ao=$o.modifier==="indexed"?{indexed:!0}:{},jo=(Fn==null?void 0:Fn.structs)??{};let Lo,Ho={};if(fo){Lo="tuple";const Yo=splitParameters$1($o.type),Xo=[],is=Yo.length;for(let yl=0;yl<is;yl++)Xo.push(parseAbiParameter$1(Yo[yl],{structs:jo}));Ho={components:Xo}}else if($o.type in jo)Lo="tuple",Ho={components:jo[$o.type]};else if(dynamicIntegerRegex$1.test($o.type))Lo=`${$o.type}256`;else if(Lo=$o.type,(Fn==null?void 0:Fn.type)!=="struct"&&!isSolidityType$1(Lo))throw new UnknownSolidityTypeError$1({type:Lo});if($o.modifier){if(!((Vo=(Go=Fn==null?void 0:Fn.modifiers)==null?void 0:Go.has)!=null&&Vo.call(Go,$o.modifier)))throw new InvalidModifierError$1({param:Mn,type:Fn==null?void 0:Fn.type,modifier:$o.modifier});if(functionModifiers$1.has($o.modifier)&&!isValidDataLocation$1(Lo,!!$o.array))throw new InvalidFunctionModifierError$1({param:Mn,type:Fn==null?void 0:Fn.type,modifier:$o.modifier})}const zo={type:`${Lo}${$o.array??""}`,...mo,...Ao,...Ho};return parameterCache$1.set(io,zo),zo}function splitParameters$1(Mn,Fn=[],io="",fo=0){const $o=Mn.trim().length;for(let mo=0;mo<$o;mo++){const Ao=Mn[mo],jo=Mn.slice(mo+1);switch(Ao){case",":return fo===0?splitParameters$1(jo,[...Fn,io.trim()]):splitParameters$1(jo,Fn,`${io}${Ao}`,fo);case"(":return splitParameters$1(jo,Fn,`${io}${Ao}`,fo+1);case")":return splitParameters$1(jo,Fn,`${io}${Ao}`,fo-1);default:return splitParameters$1(jo,Fn,`${io}${Ao}`,fo)}}if(io==="")return Fn;if(fo!==0)throw new InvalidParenthesisError$1({current:io,depth:fo});return Fn.push(io.trim()),Fn}function isSolidityType$1(Mn){return Mn==="address"||Mn==="bool"||Mn==="function"||Mn==="string"||bytesRegex$1.test(Mn)||integerRegex$1.test(Mn)}const protectedKeywordsRegex$1=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function isSolidityKeyword$1(Mn){return Mn==="address"||Mn==="bool"||Mn==="function"||Mn==="string"||Mn==="tuple"||bytesRegex$1.test(Mn)||integerRegex$1.test(Mn)||protectedKeywordsRegex$1.test(Mn)}function isValidDataLocation$1(Mn,Fn){return Fn||Mn==="bytes"||Mn==="string"||Mn==="tuple"}function parseStructs$1(Mn){const Fn={},io=Mn.length;for(let Ao=0;Ao<io;Ao++){const jo=Mn[Ao];if(!isStructSignature$1(jo))continue;const Lo=execStructSignature$1(jo);if(!Lo)throw new InvalidSignatureError$1({signature:jo,type:"struct"});const Ho=Lo.properties.split(";"),zo=[],Go=Ho.length;for(let Vo=0;Vo<Go;Vo++){const Xo=Ho[Vo].trim();if(!Xo)continue;const is=parseAbiParameter$1(Xo,{type:"struct"});zo.push(is)}if(!zo.length)throw new InvalidStructSignatureError$1({signature:jo});Fn[Lo.name]=zo}const fo={},$o=Object.entries(Fn),mo=$o.length;for(let Ao=0;Ao<mo;Ao++){const[jo,Lo]=$o[Ao];fo[jo]=resolveStructs$1(Lo,Fn)}return fo}const typeWithoutTupleRegex$1=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function resolveStructs$1(Mn,Fn,io=new Set){const fo=[],$o=Mn.length;for(let mo=0;mo<$o;mo++){const Ao=Mn[mo];if(isTupleRegex$1.test(Ao.type))fo.push(Ao);else{const Lo=execTyped$1(typeWithoutTupleRegex$1,Ao.type);if(!(Lo!=null&&Lo.type))throw new InvalidAbiTypeParameterError$1({abiParameter:Ao});const{array:Ho,type:zo}=Lo;if(zo in Fn){if(io.has(zo))throw new CircularReferenceError$1({type:zo});fo.push({...Ao,type:`tuple${Ho??""}`,components:resolveStructs$1(Fn[zo]??[],Fn,new Set([...io,zo]))})}else if(isSolidityType$1(zo))fo.push(Ao);else throw new UnknownTypeError$1({type:zo})}}return fo}function parseAbi$1(Mn){const Fn=parseStructs$1(Mn),io=[],fo=Mn.length;for(let $o=0;$o<fo;$o++){const mo=Mn[$o];isStructSignature$1(mo)||io.push(parseSignature$1(mo,Fn))}return io}function normalizeSignature(Mn){let Fn=!0,io="",fo=0,$o="",mo=!1;for(let Ao=0;Ao<Mn.length;Ao++){const jo=Mn[Ao];if(["(",")",","].includes(jo)&&(Fn=!0),jo==="("&&fo++,jo===")"&&fo--,!!Fn){if(fo===0){if(jo===" "&&["event","function",""].includes($o))$o="";else if($o+=jo,jo===")"){mo=!0;break}continue}if(jo===" "){Mn[Ao-1]!==","&&io!==","&&io!==",("&&(io="",Fn=!1);continue}$o+=jo,io+=jo}}if(!mo)throw new BaseError$4("Unable to normalize signature.");return $o}const toSignature=Mn=>{const Fn=typeof Mn=="string"?Mn:formatAbiItem(Mn);return normalizeSignature(Fn)};function toSignatureHash(Mn){return hashSignature(toSignature(Mn))}const toEventSelector=toSignatureHash,toFunctionSelector=Mn=>slice(toSignatureHash(Mn),0,4);function getAbiItem(Mn){const{abi:Fn,args:io=[],name:fo}=Mn,$o=isHex$1(fo,{strict:!1}),mo=Fn.filter(jo=>$o?jo.type==="function"?toFunctionSelector(jo)===fo:jo.type==="event"?toEventSelector(jo)===fo:!1:"name"in jo&&jo.name===fo);if(mo.length===0)return;if(mo.length===1)return mo[0];let Ao;for(const jo of mo){if(!("inputs"in jo))continue;if(!io||io.length===0){if(!jo.inputs||jo.inputs.length===0)return jo;continue}if(!jo.inputs||jo.inputs.length===0||jo.inputs.length!==io.length)continue;if(io.every((Ho,zo)=>{const Go="inputs"in jo&&jo.inputs[zo];return Go?isArgOfType(Ho,Go):!1})){if(Ao&&"inputs"in Ao&&Ao.inputs){const Ho=getAmbiguousTypes(jo.inputs,Ao.inputs,io);if(Ho)throw new AbiItemAmbiguityError({abiItem:jo,type:Ho[0]},{abiItem:Ao,type:Ho[1]})}Ao=jo}}return Ao||mo[0]}function isArgOfType(Mn,Fn){const io=typeof Mn,fo=Fn.type;switch(fo){case"address":return isAddress(Mn,{strict:!1});case"bool":return io==="boolean";case"function":return io==="string";case"string":return io==="string";default:return fo==="tuple"&&"components"in Fn?Object.values(Fn.components).every(($o,mo)=>isArgOfType(Object.values(Mn)[mo],$o)):/^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(fo)?io==="number"||io==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(fo)?io==="string"||Mn instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(fo)?Array.isArray(Mn)&&Mn.every($o=>isArgOfType($o,{...Fn,type:fo.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(Mn,Fn,io){for(const fo in Mn){const $o=Mn[fo],mo=Fn[fo];if($o.type==="tuple"&&mo.type==="tuple"&&"components"in $o&&"components"in mo)return getAmbiguousTypes($o.components,mo.components,io[fo]);const Ao=[$o.type,mo.type];if(Ao.includes("address")&&Ao.includes("bytes20")?!0:Ao.includes("address")&&Ao.includes("string")?isAddress(io[fo],{strict:!1}):Ao.includes("address")&&Ao.includes("bytes")?isAddress(io[fo],{strict:!1}):!1)return Ao}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(Mn){const{abi:Fn,args:io,functionName:fo,data:$o}=Mn;let mo=Fn[0];if(fo){const jo=getAbiItem({abi:Fn,args:io,name:fo});if(!jo)throw new AbiFunctionNotFoundError(fo,{docsPath:docsPath$1});mo=jo}if(mo.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!mo.outputs)throw new AbiFunctionOutputsNotFoundError(mo.name,{docsPath:docsPath$1});const Ao=decodeAbiParameters(mo.outputs,$o);if(Ao&&Ao.length>1)return Ao;if(Ao&&Ao.length===1)return Ao[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(Mn){const{abi:Fn,args:io,functionName:fo}=Mn;let $o=Fn[0];if(fo){const mo=getAbiItem({abi:Fn,args:io,name:fo});if(!mo)throw new AbiFunctionNotFoundError(fo,{docsPath});$o=mo}if($o.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[$o],functionName:toFunctionSelector(formatAbiItem$1($o))}}function encodeFunctionData(Mn){const{args:Fn}=Mn,{abi:io,functionName:fo}=(()=>{var jo;return Mn.abi.length===1&&((jo=Mn.functionName)!=null&&jo.startsWith("0x"))?Mn:prepareEncodeFunctionData(Mn)})(),$o=io[0],mo=fo,Ao="inputs"in $o&&$o.inputs?encodeAbiParameters($o.inputs,Fn??[]):void 0;return concatHex([mo,Ao??"0x"])}function getChainContractAddress({blockNumber:Mn,chain:Fn,contract:io}){var $o;const fo=($o=Fn==null?void 0:Fn.contracts)==null?void 0:$o[io];if(!fo)throw new ChainDoesNotSupportContract({chain:Fn,contract:{name:io}});if(Mn&&fo.blockCreated&&fo.blockCreated>Mn)throw new ChainDoesNotSupportContract({blockNumber:Mn,chain:Fn,contract:{name:io,blockCreated:fo.blockCreated}});return fo.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(Mn){const{abi:Fn,data:io}=Mn,fo=slice(io,0,4);if(fo==="0x")throw new AbiDecodingZeroDataError;const mo=[...Fn||[],solidityError,solidityPanic].find(Ao=>Ao.type==="error"&&fo===toFunctionSelector(formatAbiItem$1(Ao)));if(!mo)throw new AbiErrorSignatureNotFoundError(fo,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:mo,args:"inputs"in mo&&mo.inputs&&mo.inputs.length>0?decodeAbiParameters(mo.inputs,slice(io,4)):void 0,errorName:mo.name}}function formatAbiItemWithArgs({abiItem:Mn,args:Fn,includeFunctionName:io=!0,includeName:fo=!1}){if("name"in Mn&&"inputs"in Mn&&Mn.inputs)return`${io?Mn.name:""}(${Mn.inputs.map(($o,mo)=>`${fo&&$o.name?`${$o.name}: `:""}${typeof Fn[mo]=="object"?stringify$3(Fn[mo]):Fn[mo]}`).join(", ")})`}class CallExecutionError extends BaseError$4{constructor(Fn,{account:io,docsPath:fo,chain:$o,data:mo,gas:Ao,gasPrice:jo,maxFeePerGas:Lo,maxPriorityFeePerGas:Ho,nonce:zo,to:Go,value:Vo,stateOverride:Yo}){var yl;const Xo=io?parseAccount(io):void 0;let is=prettyPrint({from:Xo==null?void 0:Xo.address,to:Go,value:typeof Vo<"u"&&`${formatEther(Vo)} ${((yl=$o==null?void 0:$o.nativeCurrency)==null?void 0:yl.symbol)||"ETH"}`,data:mo,gas:Ao,gasPrice:typeof jo<"u"&&`${formatGwei(jo)} gwei`,maxFeePerGas:typeof Lo<"u"&&`${formatGwei(Lo)} gwei`,maxPriorityFeePerGas:typeof Ho<"u"&&`${formatGwei(Ho)} gwei`,nonce:zo});Yo&&(is+=`
${prettyStateOverride(Yo)}`),super(Fn.shortMessage,{cause:Fn,docsPath:fo,metaMessages:[...Fn.metaMessages?[...Fn.metaMessages," "]:[],"Raw Call Arguments:",is].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=Fn}}class ContractFunctionExecutionError extends BaseError$4{constructor(Fn,{abi:io,args:fo,contractAddress:$o,docsPath:mo,functionName:Ao,sender:jo}){const Lo=getAbiItem({abi:io,args:fo,name:Ao}),Ho=Lo?formatAbiItemWithArgs({abiItem:Lo,args:fo,includeFunctionName:!1,includeName:!1}):void 0,zo=Lo?formatAbiItem$1(Lo,{includeName:!0}):void 0,Go=prettyPrint({address:$o&&getContractAddress$1($o),function:zo,args:Ho&&Ho!=="()"&&`${[...Array((Ao==null?void 0:Ao.length)??0).keys()].map(()=>" ").join("")}${Ho}`,sender:jo});super(Fn.shortMessage||`An unknown error occurred while executing the contract function "${Ao}".`,{cause:Fn,docsPath:mo,metaMessages:[...Fn.metaMessages?[...Fn.metaMessages," "]:[],Go&&"Contract Call:",Go].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=io,this.args=fo,this.cause=Fn,this.contractAddress=$o,this.functionName=Ao,this.sender=jo}}class ContractFunctionRevertedError extends BaseError$4{constructor({abi:Fn,data:io,functionName:fo,message:$o}){let mo,Ao,jo,Lo;if(io&&io!=="0x")try{Ao=decodeErrorResult({abi:Fn,data:io});const{abiItem:zo,errorName:Go,args:Vo}=Ao;if(Go==="Error")Lo=Vo[0];else if(Go==="Panic"){const[Yo]=Vo;Lo=panicReasons[Yo]}else{const Yo=zo?formatAbiItem$1(zo,{includeName:!0}):void 0,Xo=zo&&Vo?formatAbiItemWithArgs({abiItem:zo,args:Vo,includeFunctionName:!1,includeName:!1}):void 0;jo=[Yo?`Error: ${Yo}`:"",Xo&&Xo!=="()"?` ${[...Array((Go==null?void 0:Go.length)??0).keys()].map(()=>" ").join("")}${Xo}`:""]}}catch(zo){mo=zo}else $o&&(Lo=$o);let Ho;mo instanceof AbiErrorSignatureNotFoundError&&(Ho=mo.signature,jo=[`Unable to decode signature "${Ho}" 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=${Ho}.`]),super(Lo&&Lo!=="execution reverted"||Ho?[`The contract function "${fo}" reverted with the following ${Ho?"signature":"reason"}:`,Lo||Ho].join(`
`):`The contract function "${fo}" reverted.`,{cause:mo,metaMessages:jo,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=Ao,this.reason=Lo,this.signature=Ho}}class ContractFunctionZeroDataError extends BaseError$4{constructor({functionName:Fn}){super(`The contract function "${Fn}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${Fn}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$4{constructor({factory:Fn}){super(`Deployment for counterfactual contract call failed${Fn?` for factory "${Fn}".`:""}`,{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$4{constructor({data:Fn,message:io}){super(io||"",{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=Fn}}function isNullUniversalResolverError(Mn,Fn){var fo,$o,mo,Ao,jo,Lo;if(!(Mn instanceof BaseError$4))return!1;const io=Mn.walk(Ho=>Ho instanceof ContractFunctionRevertedError);return io instanceof ContractFunctionRevertedError?!!(((fo=io.data)==null?void 0:fo.errorName)==="ResolverNotFound"||(($o=io.data)==null?void 0:$o.errorName)==="ResolverWildcardNotSupported"||((mo=io.data)==null?void 0:mo.errorName)==="ResolverNotContract"||((Ao=io.data)==null?void 0:Ao.errorName)==="ResolverError"||((jo=io.data)==null?void 0:jo.errorName)==="HttpError"||(Lo=io.reason)!=null&&Lo.includes("Wildcard on non-extended resolvers is not supported")||Fn==="reverse"&&io.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(Mn){if(Mn.length!==66||Mn.indexOf("[")!==0||Mn.indexOf("]")!==65)return null;const Fn=`0x${Mn.slice(1,65)}`;return isHex$1(Fn)?Fn:null}function namehash(Mn){let Fn=new Uint8Array(32).fill(0);if(!Mn)return bytesToHex$2(Fn);const io=Mn.split(".");for(let fo=io.length-1;fo>=0;fo-=1){const $o=encodedLabelToLabelhash(io[fo]),mo=$o?toBytes$2($o):keccak256$1(stringToBytes$1(io[fo]),"bytes");Fn=keccak256$1(concat$1([Fn,mo]),"bytes")}return bytesToHex$2(Fn)}function encodeLabelhash(Mn){return`[${Mn.slice(2)}]`}function labelhash(Mn){const Fn=new Uint8Array(32).fill(0);return Mn?encodedLabelToLabelhash(Mn)||keccak256$1(stringToBytes$1(Mn)):bytesToHex$2(Fn)}function packetToBytes(Mn){const Fn=Mn.replace(/^\.|\.$/gm,"");if(Fn.length===0)return new Uint8Array(1);const io=new Uint8Array(stringToBytes$1(Fn).byteLength+2);let fo=0;const $o=Fn.split(".");for(let mo=0;mo<$o.length;mo++){let Ao=stringToBytes$1($o[mo]);Ao.byteLength>255&&(Ao=stringToBytes$1(encodeLabelhash(labelhash($o[mo])))),io[fo]=Ao.length,io.set(Ao,fo+1),fo+=Ao.length+1}return io.byteLength!==fo+1?io.slice(0,fo+1):io}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(Mn,{abi:Fn,address:io,args:fo,docsPath:$o,functionName:mo,sender:Ao}){const{code:jo,data:Lo,message:Ho,shortMessage:zo}=Mn instanceof RawContractError?Mn:Mn instanceof BaseError$4?Mn.walk(Vo=>"data"in Vo)||Mn.walk():{},Go=Mn instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:mo}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(jo)&&(Lo||Ho||zo)?new ContractFunctionRevertedError({abi:Fn,data:typeof Lo=="object"?Lo.data:Lo,functionName:mo,message:zo??Ho}):Mn;return new ContractFunctionExecutionError(Go,{abi:Fn,args:fo,contractAddress:io,docsPath:$o,functionName:mo,sender:Ao})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(Mn,{docsPath:Fn,...io}){const fo=(()=>{const $o=getNodeError(Mn,io);return $o instanceof UnknownNodeError?Mn:$o})();return new CallExecutionError(fo,{docsPath:Fn,...io})}function withResolvers(){let Mn=()=>{},Fn=()=>{};return{promise:new Promise((fo,$o)=>{Mn=fo,Fn=$o}),resolve:Mn,reject:Fn}}const schedulerCache=new Map;function createBatchScheduler({fn:Mn,id:Fn,shouldSplitBatch:io,wait:fo=0,sort:$o}){const mo=async()=>{const zo=Lo();Ao();const Go=zo.map(({args:Vo})=>Vo);Go.length!==0&&Mn(Go).then(Vo=>{$o&&Array.isArray(Vo)&&Vo.sort($o);for(let Yo=0;Yo<zo.length;Yo++){const{resolve:Xo}=zo[Yo];Xo==null||Xo([Vo[Yo],Vo])}}).catch(Vo=>{for(let Yo=0;Yo<zo.length;Yo++){const{reject:Xo}=zo[Yo];Xo==null||Xo(Vo)}})},Ao=()=>schedulerCache.delete(Fn),jo=()=>Lo().map(({args:zo})=>zo),Lo=()=>schedulerCache.get(Fn)||[],Ho=zo=>schedulerCache.set(Fn,[...Lo(),zo]);return{flush:Ao,async schedule(zo){const{promise:Go,resolve:Vo,reject:Yo}=withResolvers();return(io==null?void 0:io([...jo(),zo]))&&mo(),Lo().length>0?(Ho({args:zo,resolve:Vo,reject:Yo}),Go):(Ho({args:zo,resolve:Vo,reject:Yo}),setTimeout(mo,fo),Go)}}}async function call(Mn,Fn){var Dl,Rl,Qo,Jo;const{account:io=Mn.account,batch:fo=!!((Dl=Mn.batch)!=null&&Dl.multicall),blockNumber:$o,blockTag:mo="latest",accessList:Ao,blobs:jo,code:Lo,data:Ho,factory:zo,factoryData:Go,gas:Vo,gasPrice:Yo,maxFeePerBlobGas:Xo,maxFeePerGas:is,maxPriorityFeePerGas:yl,nonce:us,to:hs,value:_l,stateOverride:xl,...Il}=Fn,Ol=io?parseAccount(io):void 0;if(Lo&&(zo||Go))throw new BaseError$4("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(Lo&&hs)throw new BaseError$4("Cannot provide both `code` & `to` as parameters.");const Tl=Lo&&Ho,Cl=zo&&Go&&hs&&Ho,Nl=Tl||Cl,Wl=Tl?toDeploylessCallViaBytecodeData({code:Lo,data:Ho}):Cl?toDeploylessCallViaFactoryData({data:Ho,factory:zo,factoryData:Go,to:hs}):Ho;try{assertRequest(Fn);const ps=($o?numberToHex$1($o):void 0)||mo,_c=serializeStateOverride(xl),$l=(Jo=(Qo=(Rl=Mn.chain)==null?void 0:Rl.formatters)==null?void 0:Qo.transactionRequest)==null?void 0:Jo.format,ds=($l||formatTransactionRequest)({...extract(Il,{format:$l}),from:Ol==null?void 0:Ol.address,accessList:Ao,blobs:jo,data:Wl,gas:Vo,gasPrice:Yo,maxFeePerBlobGas:Xo,maxFeePerGas:is,maxPriorityFeePerGas:yl,nonce:us,to:Nl?void 0:hs,value:_l});if(fo&&shouldPerformMulticall({request:ds})&&!_c)try{return await scheduleMulticall(Mn,{...ds,blockNumber:$o,blockTag:mo})}catch(Al){if(!(Al instanceof ClientChainNotConfiguredError)&&!(Al instanceof ChainDoesNotSupportContract))throw Al}const os=await Mn.request({method:"eth_call",params:_c?[ds,ps,_c]:[ds,ps]});return os==="0x"?{data:void 0}:{data:os}}catch(rs){const ps=getRevertErrorData(rs),{offchainLookup:_c,offchainLookupSignature:$l}=await __vitePreload(async()=>{const{offchainLookup:El,offchainLookupSignature:ds}=await import("./ccip-B8fqnaFr.js");return{offchainLookup:El,offchainLookupSignature:ds}},[]);if(Mn.ccipRead!==!1&&(ps==null?void 0:ps.slice(0,10))===$l&&hs)return{data:await _c(Mn,{data:ps,to:hs})};throw Nl&&(ps==null?void 0:ps.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:zo}):getCallError(rs,{...Fn,account:Ol,chain:Mn.chain})}}function shouldPerformMulticall({request:Mn}){const{data:Fn,to:io,...fo}=Mn;return!(!Fn||Fn.startsWith(aggregate3Signature)||!io||Object.values(fo).filter($o=>typeof $o<"u").length>0)}async function scheduleMulticall(Mn,Fn){var is;const{batchSize:io=1024,wait:fo=0}=typeof((is=Mn.batch)==null?void 0:is.multicall)=="object"?Mn.batch.multicall:{},{blockNumber:$o,blockTag:mo="latest",data:Ao,multicallAddress:jo,to:Lo}=Fn;let Ho=jo;if(!Ho){if(!Mn.chain)throw new ClientChainNotConfiguredError;Ho=getChainContractAddress({blockNumber:$o,chain:Mn.chain,contract:"multicall3"})}const Go=($o?numberToHex$1($o):void 0)||mo,{schedule:Vo}=createBatchScheduler({id:`${Mn.uid}.${Go}`,wait:fo,shouldSplitBatch(yl){return yl.reduce((hs,{data:_l})=>hs+(_l.length-2),0)>io*2},fn:async yl=>{const us=yl.map(xl=>({allowFailure:!0,callData:xl.data,target:xl.to})),hs=encodeFunctionData({abi:multicall3Abi,args:[us],functionName:"aggregate3"}),_l=await Mn.request({method:"eth_call",params:[{data:hs,to:Ho},Go]});return decodeFunctionResult({abi:multicall3Abi,args:[us],functionName:"aggregate3",data:_l||"0x"})}}),[{returnData:Yo,success:Xo}]=await Vo({data:Ao,to:Lo});if(!Xo)throw new RawContractError({data:Yo});return Yo==="0x"?{data:void 0}:{data:Yo}}function toDeploylessCallViaBytecodeData(Mn){const{code:Fn,data:io}=Mn;return encodeDeployData({abi:parseAbi$1(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[Fn,io]})}function toDeploylessCallViaFactoryData(Mn){const{data:Fn,factory:io,factoryData:fo,to:$o}=Mn;return encodeDeployData({abi:parseAbi$1(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[$o,Fn,io,fo]})}function getRevertErrorData(Mn){var io;if(!(Mn instanceof BaseError$4))return;const Fn=Mn.walk();return typeof(Fn==null?void 0:Fn.data)=="object"?(io=Fn.data)==null?void 0:io.data:Fn.data}async function readContract$1(Mn,Fn){const{abi:io,address:fo,args:$o,functionName:mo,...Ao}=Fn,jo=encodeFunctionData({abi:io,args:$o,functionName:mo});try{const{data:Lo}=await getAction$1(Mn,call,"call")({...Ao,data:jo,to:fo});return decodeFunctionResult({abi:io,args:$o,functionName:mo,data:Lo||"0x"})}catch(Lo){throw getContractError(Lo,{abi:io,address:fo,args:$o,docsPath:"/docs/contract/readContract",functionName:mo})}}async function getEnsAddress$1(Mn,{blockNumber:Fn,blockTag:io,coinType:fo,name:$o,gatewayUrls:mo,strict:Ao,universalResolverAddress:jo}){let Lo=jo;if(!Lo){if(!Mn.chain)throw new Error("client chain not configured. universalResolverAddress is required.");Lo=getChainContractAddress({blockNumber:Fn,chain:Mn.chain,contract:"ensUniversalResolver"})}try{const Ho=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...fo!=null?{args:[namehash($o),BigInt(fo)]}:{args:[namehash($o)]}}),zo={address:Lo,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes($o)),Ho],blockNumber:Fn,blockTag:io},Go=getAction$1(Mn,readContract$1,"readContract"),Vo=mo?await Go({...zo,args:[...zo.args,mo]}):await Go(zo);if(Vo[0]==="0x")return null;const Yo=decodeFunctionResult({abi:addressResolverAbi,args:fo!=null?[namehash($o),BigInt(fo)]:void 0,functionName:"addr",data:Vo[0]});return Yo==="0x"||trim$2(Yo)==="0x00"?null:Yo}catch(Ho){if(Ao)throw Ho;if(isNullUniversalResolverError(Ho,"resolve"))return null;throw Ho}}class EnsAvatarInvalidMetadataError extends BaseError$4{constructor({data:Fn}){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(Fn)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$4{constructor({reason:Fn}){super(`ENS NFT avatar URI is invalid. ${Fn}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$4{constructor({uri:Fn}){super(`Unable to resolve ENS avatar URI "${Fn}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$4{constructor({namespace:Fn}){super(`ENS NFT avatar namespace "${Fn}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,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,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(Mn){try{const Fn=await fetch(Mn,{method:"HEAD"});if(Fn.status===200){const io=Fn.headers.get("content-type");return io==null?void 0:io.startsWith("image/")}return!1}catch(Fn){return typeof Fn=="object"&&typeof Fn.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(io=>{const fo=new Image;fo.onload=()=>{io(!0)},fo.onerror=()=>{io(!1)},fo.src=Mn})}}function getGateway(Mn,Fn){return Mn?Mn.endsWith("/")?Mn.slice(0,-1):Mn:Fn}function resolveAvatarUri({uri:Mn,gatewayUrls:Fn}){const io=base64Regex.test(Mn);if(io)return{uri:Mn,isOnChain:!0,isEncoded:io};const fo=getGateway(Fn==null?void 0:Fn.ipfs,"https://ipfs.io"),$o=getGateway(Fn==null?void 0:Fn.arweave,"https://arweave.net"),mo=Mn.match(networkRegex),{protocol:Ao,subpath:jo,target:Lo,subtarget:Ho=""}=(mo==null?void 0:mo.groups)||{},zo=Ao==="ipns:/"||jo==="ipns/",Go=Ao==="ipfs:/"||jo==="ipfs/"||ipfsHashRegex.test(Mn);if(Mn.startsWith("http")&&!zo&&!Go){let Yo=Mn;return Fn!=null&&Fn.arweave&&(Yo=Mn.replace(/https:\/\/arweave.net/g,Fn==null?void 0:Fn.arweave)),{uri:Yo,isOnChain:!1,isEncoded:!1}}if((zo||Go)&&Lo)return{uri:`${fo}/${zo?"ipns":"ipfs"}/${Lo}${Ho}`,isOnChain:!1,isEncoded:!1};if(Ao==="ar:/"&&Lo)return{uri:`${$o}/${Lo}${Ho||""}`,isOnChain:!1,isEncoded:!1};let Vo=Mn.replace(dataURIRegex,"");if(Vo.startsWith("<svg")&&(Vo=`data:image/svg+xml;base64,${btoa(Vo)}`),Vo.startsWith("data:")||Vo.startsWith("{"))return{uri:Vo,isOnChain:!0,isEncoded:!1};throw new EnsAvatarUriResolutionError({uri:Mn})}function getJsonImage(Mn){if(typeof Mn!="object"||!("image"in Mn)&&!("image_url"in Mn)&&!("image_data"in Mn))throw new EnsAvatarInvalidMetadataError({data:Mn});return Mn.image||Mn.image_url||Mn.image_data}async function getMetadataAvatarUri({gatewayUrls:Mn,uri:Fn}){try{const io=await fetch(Fn).then($o=>$o.json());return await parseAvatarUri({gatewayUrls:Mn,uri:getJsonImage(io)})}catch{throw new EnsAvatarUriResolutionError({uri:Fn})}}async function parseAvatarUri({gatewayUrls:Mn,uri:Fn}){const{uri:io,isOnChain:fo}=resolveAvatarUri({uri:Fn,gatewayUrls:Mn});if(fo||await isImageUri(io))return io;throw new EnsAvatarUriResolutionError({uri:Fn})}function parseNftUri(Mn){let Fn=Mn;Fn.startsWith("did:nft:")&&(Fn=Fn.replace("did:nft:","").replace(/_/g,"/"));const[io,fo,$o]=Fn.split("/"),[mo,Ao]=io.split(":"),[jo,Lo]=fo.split(":");if(!mo||mo.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!Ao)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!Lo)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!$o)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!jo)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(Ao),namespace:jo.toLowerCase(),contractAddress:Lo,tokenID:$o}}async function getNftTokenUri(Mn,{nft:Fn}){if(Fn.namespace==="erc721")return readContract$1(Mn,{address:Fn.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(Fn.tokenID)]});if(Fn.namespace==="erc1155")return readContract$1(Mn,{address:Fn.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(Fn.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:Fn.namespace})}async function parseAvatarRecord(Mn,{gatewayUrls:Fn,record:io}){return/eip155:/i.test(io)?parseNftAvatarUri(Mn,{gatewayUrls:Fn,record:io}):parseAvatarUri({uri:io,gatewayUrls:Fn})}async function parseNftAvatarUri(Mn,{gatewayUrls:Fn,record:io}){const fo=parseNftUri(io),$o=await getNftTokenUri(Mn,{nft:fo}),{uri:mo,isOnChain:Ao,isEncoded:jo}=resolveAvatarUri({uri:$o,gatewayUrls:Fn});if(Ao&&(mo.includes("data:application/json;base64,")||mo.startsWith("{"))){const Ho=jo?atob(mo.replace("data:application/json;base64,","")):mo,zo=JSON.parse(Ho);return parseAvatarUri({uri:getJsonImage(zo),gatewayUrls:Fn})}let Lo=fo.tokenID;return fo.namespace==="erc1155"&&(Lo=Lo.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:Fn,uri:mo.replace(/(?:0x)?{id}/,Lo)})}async function getEnsText(Mn,{blockNumber:Fn,blockTag:io,name:fo,key:$o,gatewayUrls:mo,strict:Ao,universalResolverAddress:jo}){let Lo=jo;if(!Lo){if(!Mn.chain)throw new Error("client chain not configured. universalResolverAddress is required.");Lo=getChainContractAddress({blockNumber:Fn,chain:Mn.chain,contract:"ensUniversalResolver"})}try{const Ho={address:Lo,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex$1(packetToBytes(fo)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(fo),$o]})],blockNumber:Fn,blockTag:io},zo=getAction$1(Mn,readContract$1,"readContract"),Go=mo?await zo({...Ho,args:[...Ho.args,mo]}):await zo(Ho);if(Go[0]==="0x")return null;const Vo=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:Go[0]});return Vo===""?null:Vo}catch(Ho){if(Ao)throw Ho;if(isNullUniversalResolverError(Ho,"resolve"))return null;throw Ho}}async function getEnsAvatar$1(Mn,{blockNumber:Fn,blockTag:io,assetGatewayUrls:fo,name:$o,gatewayUrls:mo,strict:Ao,universalResolverAddress:jo}){const Lo=await getAction$1(Mn,getEnsText,"getEnsText")({blockNumber:Fn,blockTag:io,key:"avatar",name:$o,universalResolverAddress:jo,gatewayUrls:mo,strict:Ao});if(!Lo)return null;try{return await parseAvatarRecord(Mn,{record:Lo,gatewayUrls:fo})}catch{return null}}async function getEnsName$1(Mn,{address:Fn,blockNumber:io,blockTag:fo,gatewayUrls:$o,strict:mo,universalResolverAddress:Ao}){let jo=Ao;if(!jo){if(!Mn.chain)throw new Error("client chain not configured. universalResolverAddress is required.");jo=getChainContractAddress({blockNumber:io,chain:Mn.chain,contract:"ensUniversalResolver"})}const Lo=`${Fn.toLowerCase().substring(2)}.addr.reverse`;try{const Ho={address:jo,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex$1(packetToBytes(Lo))],blockNumber:io,blockTag:fo},zo=getAction$1(Mn,readContract$1,"readContract"),[Go,Vo]=$o?await zo({...Ho,args:[...Ho.args,$o]}):await zo(Ho);return Fn.toLowerCase()!==Vo.toLowerCase()?null:Go}catch(Ho){if(mo)throw Ho;if(isNullUniversalResolverError(Ho,"reverse"))return null;throw Ho}}const promiseCache$1=new Map,responseCache=new Map;function getCache(Mn){const Fn=($o,mo)=>({clear:()=>mo.delete($o),get:()=>mo.get($o),set:Ao=>mo.set($o,Ao)}),io=Fn(Mn,promiseCache$1),fo=Fn(Mn,responseCache);return{clear:()=>{io.clear(),fo.clear()},promise:io,response:fo}}async function withCache(Mn,{cacheKey:Fn,cacheTime:io=Number.POSITIVE_INFINITY}){const fo=getCache(Fn),$o=fo.response.get();if($o&&io>0&&new Date().getTime()-$o.created.getTime()<io)return $o.data;let mo=fo.promise.get();mo||(mo=Mn(),fo.promise.set(mo));try{const Ao=await mo;return fo.response.set({created:new Date,data:Ao}),Ao}finally{fo.promise.clear()}}const cacheKey=Mn=>`blockNumber.${Mn}`;async function getBlockNumber(Mn,{cacheTime:Fn=Mn.cacheTime}={}){const io=await withCache(()=>Mn.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(Mn.uid),cacheTime:Fn});return BigInt(io)}function formatLog(Mn,{args:Fn,eventName:io}={}){return{...Mn,blockHash:Mn.blockHash?Mn.blockHash:null,blockNumber:Mn.blockNumber?BigInt(Mn.blockNumber):null,logIndex:Mn.logIndex?Number(Mn.logIndex):null,transactionHash:Mn.transactionHash?Mn.transactionHash:null,transactionIndex:Mn.transactionIndex?Number(Mn.transactionIndex):null,...io?{args:Fn,eventName:io}:{}}}async function getTransaction(Mn,{blockHash:Fn,blockNumber:io,blockTag:fo,hash:$o,index:mo}){var zo,Go,Vo;const Ao=fo||"latest",jo=io!==void 0?numberToHex$1(io):void 0;let Lo=null;if($o?Lo=await Mn.request({method:"eth_getTransactionByHash",params:[$o]},{dedupe:!0}):Fn?Lo=await Mn.request({method:"eth_getTransactionByBlockHashAndIndex",params:[Fn,numberToHex$1(mo)]},{dedupe:!0}):(jo||Ao)&&(Lo=await Mn.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[jo||Ao,numberToHex$1(mo)]},{dedupe:!!jo})),!Lo)throw new TransactionNotFoundError({blockHash:Fn,blockNumber:io,blockTag:Ao,hash:$o,index:mo});return(((Vo=(Go=(zo=Mn.chain)==null?void 0:zo.formatters)==null?void 0:Go.transaction)==null?void 0:Vo.format)||formatTransaction)(Lo)}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(Mn){const Fn={...Mn,blockNumber:Mn.blockNumber?BigInt(Mn.blockNumber):null,contractAddress:Mn.contractAddress?Mn.contractAddress:null,cumulativeGasUsed:Mn.cumulativeGasUsed?BigInt(Mn.cumulativeGasUsed):null,effectiveGasPrice:Mn.effectiveGasPrice?BigInt(Mn.effectiveGasPrice):null,gasUsed:Mn.gasUsed?BigInt(Mn.gasUsed):null,logs:Mn.logs?Mn.logs.map(io=>formatLog(io)):null,to:Mn.to?Mn.to:null,transactionIndex:Mn.transactionIndex?hexToNumber$2(Mn.transactionIndex):null,status:Mn.status?receiptStatuses[Mn.status]:null,type:Mn.type?transactionType[Mn.type]||Mn.type:null};return Mn.blobGasPrice&&(Fn.blobGasPrice=BigInt(Mn.blobGasPrice)),Mn.blobGasUsed&&(Fn.blobGasUsed=BigInt(Mn.blobGasUsed)),Fn}async function getTransactionReceipt(Mn,{hash:Fn}){var $o,mo,Ao;const io=await Mn.request({method:"eth_getTransactionReceipt",params:[Fn]},{dedupe:!0});if(!io)throw new TransactionReceiptNotFoundError({hash:Fn});return(((Ao=(mo=($o=Mn.chain)==null?void 0:$o.formatters)==null?void 0:mo.transactionReceipt)==null?void 0:Ao.format)||formatTransactionReceipt)(io)}async function multicall$1(Mn,Fn){var yl;const{allowFailure:io=!0,batchSize:fo,blockNumber:$o,blockTag:mo,multicallAddress:Ao,stateOverride:jo}=Fn,Lo=Fn.contracts,Ho=fo??(typeof((yl=Mn.batch)==null?void 0:yl.multicall)=="object"&&Mn.batch.multicall.batchSize||1024);let zo=Ao;if(!zo){if(!Mn.chain)throw new Error("client chain not configured. multicallAddress is required.");zo=getChainContractAddress({blockNumber:$o,chain:Mn.chain,contract:"multicall3"})}const Go=[[]];let Vo=0,Yo=0;for(let us=0;us<Lo.length;us++){const{abi:hs,address:_l,args:xl,functionName:Il}=Lo[us];try{const Ol=encodeFunctionData({abi:hs,args:xl,functionName:Il});Yo+=(Ol.length-2)/2,Ho>0&&Yo>Ho&&Go[Vo].length>0&&(Vo++,Yo=(Ol.length-2)/2,Go[Vo]=[]),Go[Vo]=[...Go[Vo],{allowFailure:!0,callData:Ol,target:_l}]}catch(Ol){const Tl=getContractError(Ol,{abi:hs,address:_l,args:xl,docsPath:"/docs/contract/multicall",functionName:Il});if(!io)throw Tl;Go[Vo]=[...Go[Vo],{allowFailure:!0,callData:"0x",target:_l}]}}const Xo=await Promise.allSettled(Go.map(us=>getAction$1(Mn,readContract$1,"readContract")({abi:multicall3Abi,address:zo,args:[us],blockNumber:$o,blockTag:mo,functionName:"aggregate3",stateOverride:jo}))),is=[];for(let us=0;us<Xo.length;us++){const hs=Xo[us];if(hs.status==="rejected"){if(!io)throw hs.reason;for(let xl=0;xl<Go[us].length;xl++)is.push({status:"failure",error:hs.reason,result:void 0});continue}const _l=hs.value;for(let xl=0;xl<_l.length;xl++){const{returnData:Il,success:Ol}=_l[xl],{callData:Tl}=Go[us][xl],{abi:Cl,address:Nl,functionName:Wl,args:Dl}=Lo[is.length];try{if(Tl==="0x")throw new AbiDecodingZeroDataError;if(!Ol)throw new RawContractError({data:Il});const Rl=decodeFunctionResult({abi:Cl,args:Dl,data:Il,functionName:Wl});is.push(io?{result:Rl,status:"success"}:Rl)}catch(Rl){const Qo=getContractError(Rl,{abi:Cl,address:Nl,args:Dl,docsPath:"/docs/contract/multicall",functionName:Wl});if(!io)throw Qo;is.push({error:Qo,result:void 0,status:"failure"})}}}if(is.length!==Lo.length)throw new BaseError$4("multicall results mismatch");return is}const listenersCache=new Map,cleanupCache=new Map;let callbackCount=0;function observe(Mn,Fn,io){const fo=++callbackCount,$o=()=>listenersCache.get(Mn)||[],mo=()=>{const zo=$o();listenersCache.set(Mn,zo.filter(Go=>Go.id!==fo))},Ao=()=>{const zo=cleanupCache.get(Mn);$o().length===1&&zo&&zo(),mo()},jo=$o();if(listenersCache.set(Mn,[...jo,{id:fo,fns:Fn}]),jo&&jo.length>0)return Ao;const Lo={};for(const zo in Fn)Lo[zo]=(...Go)=>{var Yo,Xo;const Vo=$o();if(Vo.length!==0)for(const is of Vo)(Xo=(Yo=is.fns)[zo])==null||Xo.call(Yo,...Go)};const Ho=io(Lo);return typeof Ho=="function"&&cleanupCache.set(Mn,Ho),Ao}async function wait$1(Mn){return new Promise(Fn=>setTimeout(Fn,Mn))}function poll$1(Mn,{emitOnBegin:Fn,initialWaitTime:io,interval:fo}){let $o=!0;const mo=()=>$o=!1;return(async()=>{let jo;Fn&&(jo=await Mn({unpoll:mo}));const Lo=await(io==null?void 0:io(jo))??fo;await wait$1(Lo);const Ho=async()=>{$o&&(await Mn({unpoll:mo}),await wait$1(fo),Ho())};Ho()})(),mo}function watchBlockNumber(Mn,{emitOnBegin:Fn=!1,emitMissed:io=!1,onBlockNumber:fo,onError:$o,poll:mo,pollingInterval:Ao=Mn.pollingInterval}){const jo=typeof mo<"u"?mo:!(Mn.transport.type==="webSocket"||Mn.transport.type==="fallback"&&Mn.transport.transports[0].config.type==="webSocket");let Lo;return jo?(()=>{const Go=stringify$3(["watchBlockNumber",Mn.uid,Fn,io,Ao]);return observe(Go,{onBlockNumber:fo,onError:$o},Vo=>poll$1(async()=>{var Yo;try{const Xo=await getAction$1(Mn,getBlockNumber,"getBlockNumber")({cacheTime:0});if(Lo){if(Xo===Lo)return;if(Xo-Lo>1&&io)for(let is=Lo+1n;is<Xo;is++)Vo.onBlockNumber(is,Lo),Lo=is}(!Lo||Xo>Lo)&&(Vo.onBlockNumber(Xo,Lo),Lo=Xo)}catch(Xo){(Yo=Vo.onError)==null||Yo.call(Vo,Xo)}},{emitOnBegin:Fn,interval:Ao}))})():(()=>{const Go=stringify$3(["watchBlockNumber",Mn.uid,Fn,io]);return observe(Go,{onBlockNumber:fo,onError:$o},Vo=>{let Yo=!0,Xo=()=>Yo=!1;return(async()=>{try{const is=(()=>{if(Mn.transport.type==="fallback"){const us=Mn.transport.transports.find(hs=>hs.config.type==="webSocket");return us?us.value:Mn.transport}return Mn.transport})(),{unsubscribe:yl}=await is.subscribe({params:["newHeads"],onData(us){var _l;if(!Yo)return;const hs=hexToBigInt$1((_l=us.result)==null?void 0:_l.number);Vo.onBlockNumber(hs,Lo),Lo=hs},onError(us){var hs;(hs=Vo.onError)==null||hs.call(Vo,us)}});Xo=yl,Yo||Xo()}catch(is){$o==null||$o(is)}})(),()=>Xo()})})()}const promiseCache=new LruMap(8192);function withDedupe(Mn,{enabled:Fn=!0,id:io}){if(!Fn||!io)return Mn();if(promiseCache.get(io))return promiseCache.get(io);const fo=Mn().finally(()=>promiseCache.delete(io));return promiseCache.set(io,fo),fo}function withRetry(Mn,{delay:Fn=100,retryCount:io=2,shouldRetry:fo=()=>!0}={}){return new Promise(($o,mo)=>{const Ao=async({count:jo=0}={})=>{const Lo=async({error:Ho})=>{const zo=typeof Fn=="function"?Fn({count:jo,error:Ho}):Fn;zo&&await wait$1(zo),Ao({count:jo+1})};try{const Ho=await Mn();$o(Ho)}catch(Ho){if(jo<io&&await fo({count:jo,error:Ho}))return Lo({error:Ho});mo(Ho)}};Ao()})}function buildRequest(Mn,Fn={}){return async(io,fo={})=>{const{dedupe:$o=!1,retryDelay:mo=150,retryCount:Ao=3,uid:jo}={...Fn,...fo},Lo=$o?keccak256$1(stringToHex$1(`${jo}.${stringify$3(io)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await Mn(io)}catch(Ho){const zo=Ho;switch(zo.code){case ParseRpcError.code:throw new ParseRpcError(zo);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(zo);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(zo,{method:io.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(zo);case InternalRpcError.code:throw new InternalRpcError(zo);case InvalidInputRpcError.code:throw new InvalidInputRpcError(zo);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(zo);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(zo);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(zo);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(zo,{method:io.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(zo);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(zo);case UserRejectedRequestError.code:throw new UserRejectedRequestError(zo);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(zo);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(zo);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(zo);case ChainDisconnectedError.code:throw new ChainDisconnectedError(zo);case SwitchChainError.code:throw new SwitchChainError(zo);case 5e3:throw new UserRejectedRequestError(zo);default:throw Ho instanceof BaseError$4?Ho:new UnknownRpcError(zo)}}},{delay:({count:Ho,error:zo})=>{var Go;if(zo&&zo instanceof HttpRequestError){const Vo=(Go=zo==null?void 0:zo.headers)==null?void 0:Go.get("Retry-After");if(Vo!=null&&Vo.match(/\d/))return Number.parseInt(Vo)*1e3}return~~(1<<Ho)*mo},retryCount:Ao,shouldRetry:({error:Ho})=>shouldRetry(Ho)}),{enabled:$o,id:Lo})}}function shouldRetry(Mn){return"code"in Mn&&typeof Mn.code=="number"?Mn.code===-1||Mn.code===LimitExceededRpcError.code||Mn.code===InternalRpcError.code:Mn instanceof HttpRequestError&&Mn.status?Mn.status===403||Mn.status===408||Mn.status===413||Mn.status===429||Mn.status===500||Mn.status===502||Mn.status===503||Mn.status===504:!0}function defineChain(Mn){return{formatters:void 0,fees:void 0,serializers:void 0,...Mn}}function withTimeout(Mn,{errorInstance:Fn=new Error("timed out"),timeout:io,signal:fo}){return new Promise(($o,mo)=>{(async()=>{let Ao;try{const jo=new AbortController;io>0&&(Ao=setTimeout(()=>{fo?jo.abort():mo(Fn)},io)),$o(await Mn({signal:(jo==null?void 0:jo.signal)||null}))}catch(jo){(jo==null?void 0:jo.name)==="AbortError"&&mo(Fn),mo(jo)}finally{clearTimeout(Ao)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(Mn,Fn={}){return{async request(io){var Go;const{body:fo,onRequest:$o=Fn.onRequest,onResponse:mo=Fn.onResponse,timeout:Ao=Fn.timeout??1e4}=io,jo={...Fn.fetchOptions??{},...io.fetchOptions??{}},{headers:Lo,method:Ho,signal:zo}=jo;try{const Vo=await withTimeout(async({signal:Xo})=>{const is={...jo,body:Array.isArray(fo)?stringify$3(fo.map(_l=>({jsonrpc:"2.0",id:_l.id??idCache.take(),..._l}))):stringify$3({jsonrpc:"2.0",id:fo.id??idCache.take(),...fo}),headers:{"Content-Type":"application/json",...Lo},method:Ho||"POST",signal:zo||(Ao>0?Xo:null)},yl=new Request(Mn,is),us=await($o==null?void 0:$o(yl,is))??{...is,url:Mn};return await fetch(us.url??Mn,us)},{errorInstance:new TimeoutError({body:fo,url:Mn}),timeout:Ao,signal:!0});mo&&await mo(Vo);let Yo;if((Go=Vo.headers.get("Content-Type"))!=null&&Go.startsWith("application/json"))Yo=await Vo.json();else{Yo=await Vo.text();try{Yo=JSON.parse(Yo||"{}")}catch(Xo){if(Vo.ok)throw Xo;Yo={error:Yo}}}if(!Vo.ok)throw new HttpRequestError({body:fo,details:stringify$3(Yo.error)||Vo.statusText,headers:Vo.headers,status:Vo.status,url:Mn});return Yo}catch(Vo){throw Vo instanceof HttpRequestError||Vo instanceof TimeoutError?Vo:new HttpRequestError({body:fo,cause:Vo,url:Mn})}}}}class InvalidDecimalNumberError extends BaseError$4{constructor({value:Fn}){super(`Number \`${Fn}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function parseUnits(Mn,Fn){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(Mn))throw new InvalidDecimalNumberError({value:Mn});let[io,fo="0"]=Mn.split(".");const $o=io.startsWith("-");if($o&&(io=io.slice(1)),fo=fo.replace(/(0+)$/,""),Fn===0)Math.round(+`.${fo}`)===1&&(io=`${BigInt(io)+1n}`),fo="";else if(fo.length>Fn){const[mo,Ao,jo]=[fo.slice(0,Fn-1),fo.slice(Fn-1,Fn),fo.slice(Fn)],Lo=Math.round(+`${Ao}.${jo}`);Lo>9?fo=`${BigInt(mo)+BigInt(1)}0`.padStart(mo.length+1,"0"):fo=`${mo}${Lo}`,fo.length>Fn&&(fo=fo.slice(1),io=`${BigInt(io)+1n}`),fo=fo.slice(0,Fn)}else fo=fo.padEnd(Fn,"0");return BigInt(`${$o?"-":""}${io}${fo}`)}async function waitForTransactionReceipt$1(Mn,{confirmations:Fn=1,hash:io,onReplaced:fo,pollingInterval:$o=Mn.pollingInterval,retryCount:mo=6,retryDelay:Ao=({count:Lo})=>~~(1<<Lo)*200,timeout:jo=18e4}){const Lo=stringify$3(["waitForTransactionReceipt",Mn.uid,io]);let Ho,zo,Go,Vo=!1;const{promise:Yo,resolve:Xo,reject:is}=withResolvers(),yl=jo?setTimeout(()=>is(new WaitForTransactionReceiptTimeoutError({hash:io})),jo):void 0,us=observe(Lo,{onReplaced:fo,resolve:Xo,reject:is},hs=>{const _l=getAction$1(Mn,watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:$o,async onBlockNumber(xl){const Il=Tl=>{clearTimeout(yl),_l(),Tl(),us()};let Ol=xl;if(!Vo)try{if(Go){if(Fn>1&&(!Go.blockNumber||Ol-Go.blockNumber+1n<Fn))return;Il(()=>hs.resolve(Go));return}if(Ho||(Vo=!0,await withRetry(async()=>{Ho=await getAction$1(Mn,getTransaction,"getTransaction")({hash:io}),Ho.blockNumber&&(Ol=Ho.blockNumber)},{delay:Ao,retryCount:mo}),Vo=!1),Go=await getAction$1(Mn,getTransactionReceipt,"getTransactionReceipt")({hash:io}),Fn>1&&(!Go.blockNumber||Ol-Go.blockNumber+1n<Fn))return;Il(()=>hs.resolve(Go))}catch(Tl){if(Tl instanceof TransactionNotFoundError||Tl instanceof TransactionReceiptNotFoundError){if(!Ho){Vo=!1;return}try{zo=Ho,Vo=!0;const Cl=await withRetry(()=>getAction$1(Mn,getBlock,"getBlock")({blockNumber:Ol,includeTransactions:!0}),{delay:Ao,retryCount:mo,shouldRetry:({error:Dl})=>Dl instanceof BlockNotFoundError});Vo=!1;const Nl=Cl.transactions.find(({from:Dl,nonce:Rl})=>Dl===zo.from&&Rl===zo.nonce);if(!Nl||(Go=await getAction$1(Mn,getTransactionReceipt,"getTransactionReceipt")({hash:Nl.hash}),Fn>1&&(!Go.blockNumber||Ol-Go.blockNumber+1n<Fn)))return;let Wl="replaced";Nl.to===zo.to&&Nl.value===zo.value?Wl="repriced":Nl.from===Nl.to&&Nl.value===0n&&(Wl="cancelled"),Il(()=>{var Dl;(Dl=hs.onReplaced)==null||Dl.call(hs,{reason:Wl,replacedTransaction:zo,transaction:Nl,transactionReceipt:Go}),hs.resolve(Go)})}catch(Cl){Il(()=>hs.reject(Cl))}}else Il(()=>hs.reject(Tl))}}})});return Yo}async function signMessage$1(Mn,{account:Fn=Mn.account,message:io}){if(!Fn)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const fo=parseAccount(Fn);if(fo.signMessage)return fo.signMessage({message:io});const $o=typeof io=="string"?stringToHex$1(io):io.raw instanceof Uint8Array?toHex$1(io.raw):io.raw;return Mn.request({method:"personal_sign",params:[$o,fo.address]},{retryCount:0})}async function simulateContract$1(Mn,Fn){const{abi:io,address:fo,args:$o,dataSuffix:mo,functionName:Ao,...jo}=Fn,Lo=jo.account?parseAccount(jo.account):Mn.account,Ho=encodeFunctionData({abi:io,args:$o,functionName:Ao});try{const{data:zo}=await getAction$1(Mn,call,"call")({batch:!1,data:`${Ho}${mo?mo.replace("0x",""):""}`,to:fo,...jo,account:Lo}),Go=decodeFunctionResult({abi:io,args:$o,functionName:Ao,data:zo||"0x"}),Vo=io.filter(Yo=>"name"in Yo&&Yo.name===Fn.functionName);return{result:Go,request:{abi:Vo,address:fo,args:$o,dataSuffix:mo,functionName:Ao,...jo,account:Lo}}}catch(zo){throw getContractError(zo,{abi:io,address:fo,args:$o,docsPath:"/docs/contract/simulateContract",functionName:Ao,sender:Lo==null?void 0:Lo.address})}}async function writeContract$1(Mn,Fn){const{abi:io,account:fo=Mn.account,address:$o,args:mo,dataSuffix:Ao,functionName:jo,...Lo}=Fn;if(typeof fo>"u")throw new AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const Ho=fo?parseAccount(fo):null,zo=encodeFunctionData({abi:io,args:mo,functionName:jo});try{return await getAction$1(Mn,sendTransaction$1,"sendTransaction")({data:`${zo}${Ao?Ao.replace("0x",""):""}`,to:$o,account:Ho,...Lo})}catch(Go){throw getContractError(Go,{abi:io,address:$o,args:mo,docsPath:"/docs/contract/writeContract",functionName:jo,sender:Ho==null?void 0:Ho.address})}}function getAction(Mn,Fn,io){const fo=Mn[Fn.name];if(typeof fo=="function")return fo;const $o=Mn[io];return typeof $o=="function"?$o:mo=>Fn(Mn,mo)}const version$b="2.14.1",getVersion$1=()=>`@wagmi/core@${version$b}`;var __classPrivateFieldGet$1=function(Mn,Fn,io,fo){if(io==="a"&&!fo)throw new TypeError("Private accessor was defined without a getter");if(typeof Fn=="function"?Mn!==Fn||!fo:!Fn.has(Mn))throw new TypeError("Cannot read private member from an object whose class did not declare it");return io==="m"?fo:io==="a"?fo.call(Mn):fo?fo.value:Fn.get(Mn)},_BaseError_instances,_BaseError_walk;let BaseError$2=class F2 extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(Fn,io={}){var mo;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 fo=io.cause instanceof F2?io.cause.details:(mo=io.cause)!=null&&mo.message?io.cause.message:io.details,$o=io.cause instanceof F2&&io.cause.docsPath||io.docsPath;this.message=[Fn||"An error occurred.","",...io.metaMessages?[...io.metaMessages,""]:[],...$o?[`Docs: ${this.docsBaseUrl}${$o}.html${io.docsSlug?`#${io.docsSlug}`:""}`]:[],...fo?[`Details: ${fo}`]:[],`Version: ${this.version}`].join(`
`),io.cause&&(this.cause=io.cause),this.details=fo,this.docsPath=$o,this.metaMessages=io.metaMessages,this.shortMessage=Fn}walk(Fn){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,Fn)}};_BaseError_instances=new WeakSet,_BaseError_walk=function Mn(Fn,io){return io!=null&&io(Fn)?Fn:Fn.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",Mn).call(this,Fn.cause,io):Fn};class ChainNotConfiguredError extends BaseError$2{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$2{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$2{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$2{constructor({address:Fn,connector:io}){super(`Account "${Fn}" not found for connector "${io.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$2{constructor({connectionChainId:Fn,connectorChainId:io}){super(`The current chain of the connector (id: ${io}) does not match the connection's chain (id: ${Fn}).`,{metaMessages:[`Current Chain ID: ${io}`,`Expected Chain ID: ${Fn}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$2{constructor({connector:Fn}){super(`Connector "${Fn.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$3(Mn,Fn){var fo;let io;if(typeof Fn.connector=="function"?io=Mn._internal.connectors.setup(Fn.connector):io=Fn.connector,io.uid===Mn.state.current)throw new ConnectorAlreadyConnectedError;try{Mn.setState(Ao=>({...Ao,status:"connecting"})),io.emitter.emit("message",{type:"connecting"});const $o=await io.connect({chainId:Fn.chainId}),mo=$o.accounts;return io.emitter.off("connect",Mn._internal.events.connect),io.emitter.on("change",Mn._internal.events.change),io.emitter.on("disconnect",Mn._internal.events.disconnect),await((fo=Mn.storage)==null?void 0:fo.setItem("recentConnectorId",io.id)),Mn.setState(Ao=>({...Ao,connections:new Map(Ao.connections).set(io.uid,{accounts:mo,chainId:$o.chainId,connector:io}),current:io.uid,status:"connected"})),{accounts:mo,chainId:$o.chainId}}catch($o){throw Mn.setState(mo=>({...mo,status:mo.current?"connected":"disconnected"})),$o}}const size$2=256;let index$1=size$2,buffer$2;function uid$g(Mn=11){if(!buffer$2||index$1+Mn>size$2*2){buffer$2="",index$1=0;for(let Fn=0;Fn<size$2;Fn++)buffer$2+=(256+Math.random()*256|0).toString(16).substring(1)}return buffer$2.substring(index$1,index$1+++Mn)}function createClient(Mn){const{batch:Fn,cacheTime:io=Mn.pollingInterval??4e3,ccipRead:fo,key:$o="base",name:mo="Base Client",pollingInterval:Ao=4e3,type:jo="base"}=Mn,Lo=Mn.chain,Ho=Mn.account?parseAccount(Mn.account):void 0,{config:zo,request:Go,value:Vo}=Mn.transport({chain:Lo,pollingInterval:Ao}),Yo={...zo,...Vo},Xo={account:Ho,batch:Fn,cacheTime:io,ccipRead:fo,chain:Lo,key:$o,name:mo,pollingInterval:Ao,request:Go,transport:Yo,type:jo,uid:uid$g()};function is(yl){return us=>{const hs=us(yl);for(const xl in Xo)delete hs[xl];const _l={...yl,...hs};return Object.assign(_l,{extend:is(_l)})}}return Object.assign(Xo,{extend:is(Xo)})}function createTransport({key:Mn,name:Fn,request:io,retryCount:fo=3,retryDelay:$o=150,timeout:mo,type:Ao},jo){const Lo=uid$g();return{config:{key:Mn,name:Fn,request:io,retryCount:fo,retryDelay:$o,timeout:mo,type:Ao},request:buildRequest(io,{retryCount:fo,retryDelay:$o,uid:Lo}),value:jo}}function custom$1(Mn,Fn={}){const{key:io="custom",name:fo="Custom Provider",retryDelay:$o}=Fn;return({retryCount:mo})=>createTransport({key:io,name:fo,request:Mn.request.bind(Mn),retryCount:Fn.retryCount??mo,retryDelay:$o,type:"custom"})}class UrlRequiredError extends BaseError$4{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(Mn,Fn={}){const{batch:io,fetchOptions:fo,key:$o="http",name:mo="HTTP JSON-RPC",onFetchRequest:Ao,onFetchResponse:jo,retryDelay:Lo}=Fn;return({chain:Ho,retryCount:zo,timeout:Go})=>{const{batchSize:Vo=1e3,wait:Yo=0}=typeof io=="object"?io:{},Xo=Fn.retryCount??zo,is=Go??Fn.timeout??1e4,yl=Ho==null?void 0:Ho.rpcUrls.default.http[0];if(!yl)throw new UrlRequiredError;const us=getHttpRpcClient(yl,{fetchOptions:fo,onRequest:Ao,onResponse:jo,timeout:is});return createTransport({key:$o,name:mo,async request({method:hs,params:_l}){const xl={method:hs,params:_l},{schedule:Il}=createBatchScheduler({id:yl,wait:Yo,shouldSplitBatch(Nl){return Nl.length>Vo},fn:Nl=>us.request({body:Nl}),sort:(Nl,Wl)=>Nl.id-Wl.id}),Ol=async Nl=>io?Il(Nl):[await us.request({body:Nl})],[{error:Tl,result:Cl}]=await Ol(xl);if(Tl)throw new RpcRequestError({body:xl,error:Tl,url:yl});return Cl},retryCount:Xo,retryDelay:Lo,timeout:is,type:"http"},{fetchOptions:fo,url:yl})}}async function getConnectorClient(Mn,Fn={}){let io;if(Fn.connector){const{connector:Ho}=Fn;if(Mn.state.status==="reconnecting"&&!Ho.getAccounts&&!Ho.getChainId)throw new ConnectorUnavailableReconnectingError({connector:Ho});const[zo,Go]=await Promise.all([Ho.getAccounts(),Ho.getChainId()]);io={accounts:zo,chainId:Go,connector:Ho}}else io=Mn.state.connections.get(Mn.state.current);if(!io)throw new ConnectorNotConnectedError;const fo=Fn.chainId??io.chainId,$o=await io.connector.getChainId();if($o!==io.chainId)throw new ConnectorChainMismatchError({connectionChainId:io.chainId,connectorChainId:$o});const mo=io.connector;if(mo.getClient)return mo.getClient({chainId:fo});const Ao=parseAccount(Fn.account??io.accounts[0]);if(Ao.address=getAddress(Ao.address),Fn.account&&!io.accounts.some(Ho=>Ho.toLowerCase()===Ao.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:Ao.address,connector:mo});const jo=Mn.chains.find(Ho=>Ho.id===fo),Lo=await io.connector.getProvider({chainId:fo});return createClient({account:Ao,chain:jo,name:"Connector Client",transport:Ho=>custom$1(Lo)({...Ho,retryCount:0})})}async function disconnect(Mn,Fn={}){var $o,mo;let io;if(Fn.connector)io=Fn.connector;else{const{connections:Ao,current:jo}=Mn.state,Lo=Ao.get(jo);io=Lo==null?void 0:Lo.connector}const fo=Mn.state.connections;io&&(await io.disconnect(),io.emitter.off("change",Mn._internal.events.change),io.emitter.off("disconnect",Mn._internal.events.disconnect),io.emitter.on("connect",Mn._internal.events.connect),fo.delete(io.uid)),Mn.setState(Ao=>{if(fo.size===0)return{...Ao,connections:new Map,current:null,status:"disconnected"};const jo=fo.values().next().value;return{...Ao,connections:new Map(fo),current:jo.connector.uid}});{const Ao=Mn.state.current;if(!Ao)return;const jo=($o=Mn.state.connections.get(Ao))==null?void 0:$o.connector;if(!jo)return;await((mo=Mn.storage)==null?void 0:mo.setItem("recentConnectorId",jo.id))}}async function estimateGas(Mn,Fn){const{chainId:io,connector:fo,...$o}=Fn;let mo;Fn.account?mo=Fn.account:mo=(await getConnectorClient(Mn,{account:Fn.account,chainId:io,connector:fo})).account;const Ao=Mn.getClient({chainId:io});return getAction(Ao,estimateGas$1,"estimateGas")({...$o,account:mo})}function getUnit(Mn){return typeof Mn=="number"?Mn:Mn==="wei"?0:Math.abs(weiUnits[Mn])}function getAccount(Mn){const Fn=Mn.state.current,io=Mn.state.connections.get(Fn),fo=io==null?void 0:io.accounts,$o=fo==null?void 0:fo[0],mo=Mn.chains.find(jo=>jo.id===(io==null?void 0:io.chainId)),Ao=Mn.state.status;switch(Ao){case"connected":return{address:$o,addresses:fo,chain:mo,chainId:io==null?void 0:io.chainId,connector:io==null?void 0:io.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:Ao};case"reconnecting":return{address:$o,addresses:fo,chain:mo,chainId:io==null?void 0:io.chainId,connector:io==null?void 0:io.connector,isConnected:!!$o,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:Ao};case"connecting":return{address:$o,addresses:fo,chain:mo,chainId:io==null?void 0:io.chainId,connector:io==null?void 0:io.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:Ao};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:Ao}}}async function multicall(Mn,Fn){const{allowFailure:io=!0,chainId:fo,contracts:$o,...mo}=Fn,Ao=Mn.getClient({chainId:fo});return getAction(Ao,multicall$1,"multicall")({allowFailure:io,contracts:$o,...mo})}function readContract(Mn,Fn){const{chainId:io,...fo}=Fn,$o=Mn.getClient({chainId:io});return getAction($o,readContract$1,"readContract")(fo)}async function readContracts(Mn,Fn){var jo;const{allowFailure:io=!0,blockNumber:fo,blockTag:$o,...mo}=Fn,Ao=Fn.contracts;try{const Lo={};for(const[Vo,Yo]of Ao.entries()){const Xo=Yo.chainId??Mn.state.chainId;Lo[Xo]||(Lo[Xo]=[]),(jo=Lo[Xo])==null||jo.push({contract:Yo,index:Vo})}const Ho=()=>Object.entries(Lo).map(([Vo,Yo])=>multicall(Mn,{...mo,allowFailure:io,blockNumber:fo,blockTag:$o,chainId:Number.parseInt(Vo),contracts:Yo.map(({contract:Xo})=>Xo)})),zo=(await Promise.all(Ho())).flat(),Go=Object.values(Lo).flatMap(Vo=>Vo.map(({index:Yo})=>Yo));return zo.reduce((Vo,Yo,Xo)=>(Vo&&(Vo[Go[Xo]]=Yo),Vo),[])}catch(Lo){if(Lo instanceof ContractFunctionExecutionError)throw Lo;const Ho=()=>Ao.map(zo=>readContract(Mn,{...zo,blockNumber:fo,blockTag:$o}));return io?(await Promise.allSettled(Ho())).map(zo=>zo.status==="fulfilled"?{result:zo.value,status:"success"}:{error:zo.reason,result:void 0,status:"failure"}):await Promise.all(Ho())}}async function getBalance(Mn,Fn){const{address:io,blockNumber:fo,blockTag:$o,chainId:mo,token:Ao,unit:jo="ether"}=Fn;if(Ao)try{return getTokenBalance(Mn,{balanceAddress:io,chainId:mo,symbolType:"string",tokenAddress:Ao})}catch(Vo){if(Vo instanceof ContractFunctionExecutionError){const Yo=await getTokenBalance(Mn,{balanceAddress:io,chainId:mo,symbolType:"bytes32",tokenAddress:Ao}),Xo=hexToString$1(trim$2(Yo.symbol,{dir:"right"}));return{...Yo,symbol:Xo}}throw Vo}const Lo=Mn.getClient({chainId:mo}),zo=await getAction(Lo,getBalance$1,"getBalance")(fo?{address:io,blockNumber:fo}:{address:io,blockTag:$o}),Go=Mn.chains.find(Vo=>Vo.id===mo)??Lo.chain;return{decimals:Go.nativeCurrency.decimals,formatted:formatUnits$1(zo,getUnit(jo)),symbol:Go.nativeCurrency.symbol,value:zo}}async function getTokenBalance(Mn,Fn){const{balanceAddress:io,chainId:fo,symbolType:$o,tokenAddress:mo,unit:Ao}=Fn,jo={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:$o}]}],address:mo},[Lo,Ho,zo]=await readContracts(Mn,{allowFailure:!1,contracts:[{...jo,functionName:"balanceOf",args:[io],chainId:fo},{...jo,functionName:"decimals",chainId:fo},{...jo,functionName:"symbol",chainId:fo}]}),Go=formatUnits$1(Lo??"0",getUnit(Ao??Ho));return{decimals:Ho,formatted:Go,symbol:zo,value:Lo}}function deepEqual(Mn,Fn){if(Mn===Fn)return!0;if(Mn&&Fn&&typeof Mn=="object"&&typeof Fn=="object"){if(Mn.constructor!==Fn.constructor)return!1;let io,fo;if(Array.isArray(Mn)&&Array.isArray(Fn)){if(io=Mn.length,io!==Fn.length)return!1;for(fo=io;fo--!==0;)if(!deepEqual(Mn[fo],Fn[fo]))return!1;return!0}if(Mn.valueOf!==Object.prototype.valueOf)return Mn.valueOf()===Fn.valueOf();if(Mn.toString!==Object.prototype.toString)return Mn.toString()===Fn.toString();const $o=Object.keys(Mn);if(io=$o.length,io!==Object.keys(Fn).length)return!1;for(fo=io;fo--!==0;)if(!Object.prototype.hasOwnProperty.call(Fn,$o[fo]))return!1;for(fo=io;fo--!==0;){const mo=$o[fo];if(mo&&!deepEqual(Mn[mo],Fn[mo]))return!1}return!0}return Mn!==Mn&&Fn!==Fn}let previousConnections=[];function getConnections(Mn){const Fn=[...Mn.state.connections.values()];return Mn.state.status==="reconnecting"||deepEqual(previousConnections,Fn)?previousConnections:(previousConnections=Fn,Fn)}function getEnsAddress(Mn,Fn){const{chainId:io,...fo}=Fn,$o=Mn.getClient({chainId:io});return getAction($o,getEnsAddress$1,"getEnsAddress")(fo)}function getEnsAvatar(Mn,Fn){const{chainId:io,...fo}=Fn,$o=Mn.getClient({chainId:io});return getAction($o,getEnsAvatar$1,"getEnsAvatar")(fo)}function getEnsName(Mn,Fn){const{chainId:io,...fo}=Fn,$o=Mn.getClient({chainId:io});return getAction($o,getEnsName$1,"getEnsName")(fo)}async function prepareTransactionRequest(Mn,Fn){const{account:io,chainId:fo,...$o}=Fn,mo=io??getAccount(Mn).address,Ao=Mn.getClient({chainId:fo});return getAction(Ao,prepareTransactionRequest$1,"prepareTransactionRequest")({...$o,...mo?{account:mo}:{}})}let isReconnecting=!1;async function reconnect(Mn,Fn={}){var Ho,zo;if(isReconnecting)return[];isReconnecting=!0,Mn.setState(Go=>({...Go,status:Go.current?"reconnecting":"connecting"}));const io=[];if((Ho=Fn.connectors)!=null&&Ho.length)for(const Go of Fn.connectors){let Vo;typeof Go=="function"?Vo=Mn._internal.connectors.setup(Go):Vo=Go,io.push(Vo)}else io.push(...Mn.connectors);let fo;try{fo=await((zo=Mn.storage)==null?void 0:zo.getItem("recentConnectorId"))}catch{}const $o={};for(const[,Go]of Mn.state.connections)$o[Go.connector.id]=1;fo&&($o[fo]=0);const mo=Object.keys($o).length>0?[...io].sort((Go,Vo)=>($o[Go.id]??10)-($o[Vo.id]??10)):io;let Ao=!1;const jo=[],Lo=[];for(const Go of mo){const Vo=await Go.getProvider().catch(()=>{});if(!Vo||Lo.some(is=>is===Vo)||!await Go.isAuthorized())continue;const Xo=await Go.connect({isReconnecting:!0}).catch(()=>null);Xo&&(Go.emitter.off("connect",Mn._internal.events.connect),Go.emitter.on("change",Mn._internal.events.change),Go.emitter.on("disconnect",Mn._internal.events.disconnect),Mn.setState(is=>{const yl=new Map(Ao?is.connections:new Map).set(Go.uid,{accounts:Xo.accounts,chainId:Xo.chainId,connector:Go});return{...is,current:Ao?is.current:Go.uid,connections:yl}}),jo.push({accounts:Xo.accounts,chainId:Xo.chainId,connector:Go}),Lo.push(Vo),Ao=!0)}return(Mn.state.status==="reconnecting"||Mn.state.status==="connecting")&&(Ao?Mn.setState(Go=>({...Go,status:"connected"})):Mn.setState(Go=>({...Go,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,jo}async function sendTransaction(Mn,Fn){const{account:io,chainId:fo,connector:$o,gas:mo,...Ao}=Fn;let jo;typeof io=="object"&&(io==null?void 0:io.type)==="local"?jo=Mn.getClient({chainId:fo}):jo=await getConnectorClient(Mn,{account:io??void 0,chainId:fo,connector:$o});const{connector:Lo}=getAccount(Mn),Ho=await(async()=>{var Vo;if(!(!("data"in Fn)||!Fn.data)&&!((Vo=$o??Lo)!=null&&Vo.supportsSimulation)&&mo!==null)return mo===void 0?getAction(jo,estimateGas$1,"estimateGas")({...Ao,account:io,chain:fo?{id:fo}:null}):mo})();return await getAction(jo,sendTransaction$1,"sendTransaction")({...Ao,...io?{account:io}:{},gas:Ho,chain:fo?{id:fo}:null})}async function signMessage(Mn,Fn){const{account:io,connector:fo,...$o}=Fn;let mo;return typeof io=="object"&&io.type==="local"?mo=Mn.getClient():mo=await getConnectorClient(Mn,{account:io,connector:fo}),getAction(mo,signMessage$1,"signMessage")({...$o,...io?{account:io}:{}})}async function simulateContract(Mn,Fn){const{abi:io,chainId:fo,connector:$o,...mo}=Fn;let Ao;Fn.account?Ao=Fn.account:Ao=(await getConnectorClient(Mn,{chainId:fo,connector:$o})).account;const jo=Mn.getClient({chainId:fo}),Lo=getAction(jo,simulateContract$1,"simulateContract"),{result:Ho,request:zo}=await Lo({...mo,abi:io,account:Ao});return{chainId:jo.chain.id,result:Ho,request:{__mode:"prepared",...zo,chainId:fo}}}async function switchAccount(Mn,Fn){var $o;const{connector:io}=Fn,fo=Mn.state.connections.get(io.uid);if(!fo)throw new ConnectorNotConnectedError;return await(($o=Mn.storage)==null?void 0:$o.setItem("recentConnectorId",io.id)),Mn.setState(mo=>({...mo,current:io.uid})),{accounts:fo.accounts,chainId:fo.chainId}}class ProviderNotFoundError extends BaseError$2{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$2{constructor({connector:Fn}){super(`"${Fn.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(Mn,Fn){var Ao;const{addEthereumChainParameter:io,chainId:fo}=Fn,$o=Mn.state.connections.get(((Ao=Fn.connector)==null?void 0:Ao.uid)??Mn.state.current);if($o){const jo=$o.connector;if(!jo.switchChain)throw new SwitchChainNotSupportedError({connector:jo});return await jo.switchChain({addEthereumChainParameter:io,chainId:fo})}const mo=Mn.chains.find(jo=>jo.id===fo);if(!mo)throw new ChainNotConfiguredError;return Mn.setState(jo=>({...jo,chainId:fo})),mo}function watchAccount(Mn,Fn){const{onChange:io}=Fn;return Mn.subscribe(()=>getAccount(Mn),io,{equalityFn(fo,$o){const{connector:mo,...Ao}=fo,{connector:jo,...Lo}=$o;return deepEqual(Ao,Lo)&&(mo==null?void 0:mo.id)===(jo==null?void 0:jo.id)&&(mo==null?void 0:mo.uid)===(jo==null?void 0:jo.uid)}})}function watchConnectors(Mn,Fn){const{onChange:io}=Fn;return Mn._internal.connectors.subscribe((fo,$o)=>{io(Object.values(fo),$o)})}async function waitForTransactionReceipt(Mn,Fn){const{chainId:io,timeout:fo=0,...$o}=Fn,mo=Mn.getClient({chainId:io}),jo=await getAction(mo,waitForTransactionReceipt$1,"waitForTransactionReceipt")({...$o,timeout:fo});if(jo.status==="reverted"){const Ho=await getAction(mo,getTransaction,"getTransaction")({hash:jo.transactionHash}),Go=await getAction(mo,call,"call")({...Ho,gasPrice:Ho.type!=="eip1559"?Ho.gasPrice:void 0,maxFeePerGas:Ho.type==="eip1559"?Ho.maxFeePerGas:void 0,maxPriorityFeePerGas:Ho.type==="eip1559"?Ho.maxPriorityFeePerGas:void 0}),Vo=Go!=null&&Go.data?hexToString$1(`0x${Go.data.substring(138)}`):"unknown reason";throw new Error(Vo)}return{...jo,chainId:mo.chain.id}}async function writeContract(Mn,Fn){const{account:io,chainId:fo,connector:$o,__mode:mo,...Ao}=Fn;let jo;typeof io=="object"&&(io==null?void 0:io.type)==="local"?jo=Mn.getClient({chainId:fo}):jo=await getConnectorClient(Mn,{account:io??void 0,chainId:fo,connector:$o});const{connector:Lo}=getAccount(Mn);let Ho;if(mo==="prepared"||Lo!=null&&Lo.supportsSimulation)Ho=Ao;else{const{request:Vo}=await simulateContract(Mn,{...Ao,account:io,chainId:fo});Ho=Vo}return await getAction(jo,writeContract$1,"writeContract")({...Ho,...io?{account:io}:{},chain:fo?{id:fo}:null})}function createConnector(Mn){return Mn}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(Mn={}){const{shimDisconnect:Fn=!0,unstable_shimAsyncInject:io}=Mn;function fo(){const Lo=Mn.target;if(typeof Lo=="function"){const Ho=Lo();if(Ho)return Ho}return typeof Lo=="object"?Lo:typeof Lo=="string"?{...targetMap[Lo]??{id:Lo,name:`${Lo[0].toUpperCase()}${Lo.slice(1)}`,provider:`is${Lo[0].toUpperCase()}${Lo.slice(1)}`}}:{id:"injected",name:"Injected",provider(Ho){return Ho==null?void 0:Ho.ethereum}}}let $o,mo,Ao,jo;return Lo=>({get icon(){return fo().icon},get id(){return fo().id},get name(){return fo().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const Ho=await this.getProvider();Ho!=null&&Ho.on&&Mn.target&&(Ao||(Ao=this.onConnect.bind(this),Ho.on("connect",Ao)),$o||($o=this.onAccountsChanged.bind(this),Ho.on("accountsChanged",$o)))},async connect({chainId:Ho,isReconnecting:zo}={}){var Yo,Xo,is,yl,us,hs;const Go=await this.getProvider();if(!Go)throw new ProviderNotFoundError;let Vo=[];if(zo)Vo=await this.getAccounts().catch(()=>[]);else if(Fn)try{Vo=(yl=(is=(Xo=(Yo=(await Go.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:Yo.caveats)==null?void 0:Xo[0])==null?void 0:is.value)==null?void 0:yl.map(xl=>getAddress(xl)),Vo.length>0&&(Vo=await this.getAccounts())}catch(_l){const xl=_l;if(xl.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(xl);if(xl.code===ResourceUnavailableRpcError.code)throw xl}try{!(Vo!=null&&Vo.length)&&!zo&&(Vo=(await Go.request({method:"eth_requestAccounts"})).map(Il=>getAddress(Il))),Ao&&(Go.removeListener("connect",Ao),Ao=void 0),$o||($o=this.onAccountsChanged.bind(this),Go.on("accountsChanged",$o)),mo||(mo=this.onChainChanged.bind(this),Go.on("chainChanged",mo)),jo||(jo=this.onDisconnect.bind(this),Go.on("disconnect",jo));let _l=await this.getChainId();if(Ho&&_l!==Ho){const xl=await this.switchChain({chainId:Ho}).catch(Il=>{if(Il.code===UserRejectedRequestError.code)throw Il;return{id:_l}});_l=(xl==null?void 0:xl.id)??_l}return Fn&&await((us=Lo.storage)==null?void 0:us.removeItem(`${this.id}.disconnected`)),Mn.target||await((hs=Lo.storage)==null?void 0:hs.setItem("injected.connected",!0)),{accounts:Vo,chainId:_l}}catch(_l){const xl=_l;throw xl.code===UserRejectedRequestError.code?new UserRejectedRequestError(xl):xl.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(xl):xl}},async disconnect(){var zo,Go;const Ho=await this.getProvider();if(!Ho)throw new ProviderNotFoundError;mo&&(Ho.removeListener("chainChanged",mo),mo=void 0),jo&&(Ho.removeListener("disconnect",jo),jo=void 0),Ao||(Ao=this.onConnect.bind(this),Ho.on("connect",Ao));try{await withTimeout(()=>Ho.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}Fn&&await((zo=Lo.storage)==null?void 0:zo.setItem(`${this.id}.disconnected`,!0)),Mn.target||await((Go=Lo.storage)==null?void 0:Go.removeItem("injected.connected"))},async getAccounts(){const Ho=await this.getProvider();if(!Ho)throw new ProviderNotFoundError;return(await Ho.request({method:"eth_accounts"})).map(Go=>getAddress(Go))},async getChainId(){const Ho=await this.getProvider();if(!Ho)throw new ProviderNotFoundError;const zo=await Ho.request({method:"eth_chainId"});return Number(zo)},async getProvider(){if(typeof window>"u")return;let Ho;const zo=fo();return typeof zo.provider=="function"?Ho=zo.provider(window):typeof zo.provider=="string"?Ho=findProvider(window,zo.provider):Ho=zo.provider,Ho&&!Ho.removeListener&&("off"in Ho&&typeof Ho.off=="function"?Ho.removeListener=Ho.off:Ho.removeListener=()=>{}),Ho},async isAuthorized(){var Ho,zo;try{if(Fn&&await((Ho=Lo.storage)==null?void 0:Ho.getItem(`${this.id}.disconnected`))||!Mn.target&&!await((zo=Lo.storage)==null?void 0:zo.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(io!==void 0&&io!==!1){const Xo=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",Xo),!!await this.getProvider()),is=typeof io=="number"?io:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(us=>window.addEventListener("ethereum#initialized",()=>us(Xo()),{once:!0}))]:[],new Promise(us=>setTimeout(()=>us(Xo()),is))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:Ho,chainId:zo}){var Yo,Xo,is,yl;const Go=await this.getProvider();if(!Go)throw new ProviderNotFoundError;const Vo=Lo.chains.find(us=>us.id===zo);if(!Vo)throw new SwitchChainError(new ChainNotConfiguredError);try{return await Promise.all([Go.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex$1(zo)}]}).then(async()=>{await this.getChainId()===zo&&Lo.emitter.emit("change",{chainId:zo})}),new Promise(us=>{const hs=_l=>{"chainId"in _l&&_l.chainId===zo&&(Lo.emitter.off("change",hs),us())};Lo.emitter.on("change",hs)})]),Vo}catch(us){const hs=us;if(hs.code===4902||((Xo=(Yo=hs==null?void 0:hs.data)==null?void 0:Yo.originalError)==null?void 0:Xo.code)===4902)try{const{default:_l,...xl}=Vo.blockExplorers??{};let Il;Ho!=null&&Ho.blockExplorerUrls?Il=Ho.blockExplorerUrls:_l&&(Il=[_l.url,...Object.values(xl).map(Nl=>Nl.url)]);let Ol;(is=Ho==null?void 0:Ho.rpcUrls)!=null&&is.length?Ol=Ho.rpcUrls:Ol=[((yl=Vo.rpcUrls.default)==null?void 0:yl.http[0])??""];const Tl={blockExplorerUrls:Il,chainId:numberToHex$1(zo),chainName:(Ho==null?void 0:Ho.chainName)??Vo.name,iconUrls:Ho==null?void 0:Ho.iconUrls,nativeCurrency:(Ho==null?void 0:Ho.nativeCurrency)??Vo.nativeCurrency,rpcUrls:Ol};if(await Go.request({method:"wallet_addEthereumChain",params:[Tl]}),await this.getChainId()!==zo)throw new UserRejectedRequestError(new Error("User rejected switch after adding network."));return Vo}catch(_l){throw new UserRejectedRequestError(_l)}throw hs.code===UserRejectedRequestError.code?new UserRejectedRequestError(hs):new SwitchChainError(hs)}},async onAccountsChanged(Ho){var zo;if(Ho.length===0)this.onDisconnect();else if(Lo.emitter.listenerCount("connect")){const Go=(await this.getChainId()).toString();this.onConnect({chainId:Go}),Fn&&await((zo=Lo.storage)==null?void 0:zo.removeItem(`${this.id}.disconnected`))}else Lo.emitter.emit("change",{accounts:Ho.map(Go=>getAddress(Go))})},onChainChanged(Ho){const zo=Number(Ho);Lo.emitter.emit("change",{chainId:zo})},async onConnect(Ho){const zo=await this.getAccounts();if(zo.length===0)return;const Go=Number(Ho.chainId);Lo.emitter.emit("connect",{accounts:zo,chainId:Go});const Vo=await this.getProvider();Vo&&(Ao&&(Vo.removeListener("connect",Ao),Ao=void 0),$o||($o=this.onAccountsChanged.bind(this),Vo.on("accountsChanged",$o)),mo||(mo=this.onChainChanged.bind(this),Vo.on("chainChanged",mo)),jo||(jo=this.onDisconnect.bind(this),Vo.on("disconnect",jo)))},async onDisconnect(Ho){const zo=await this.getProvider();Ho&&Ho.code===1013&&zo&&(await this.getAccounts()).length||(Lo.emitter.emit("disconnect"),zo&&(mo&&(zo.removeListener("chainChanged",mo),mo=void 0),jo&&(zo.removeListener("disconnect",jo),jo=void 0),Ao||(Ao=this.onConnect.bind(this),zo.on("connect",Ao))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(Mn){return Mn!=null&&Mn.coinbaseWalletExtension?Mn.coinbaseWalletExtension:findProvider(Mn,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(Mn){return findProvider(Mn,Fn=>{if(!Fn.isMetaMask||Fn.isBraveWallet&&!Fn._events&&!Fn._state)return!1;const io=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const fo of io)if(Fn[fo])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(Mn){var Fn,io;return(Fn=Mn==null?void 0:Mn.phantom)!=null&&Fn.ethereum?(io=Mn.phantom)==null?void 0:io.ethereum:findProvider(Mn,"isPhantom")}}};function findProvider(Mn,Fn){function io($o){return typeof Fn=="function"?Fn($o):typeof Fn=="string"?$o[Fn]:!0}const fo=Mn.ethereum;if(fo!=null&&fo.providers)return fo.providers.find($o=>io($o));if(fo&&io(fo))return fo}function requestProviders(Mn){if(typeof window>"u")return;const Fn=io=>Mn(io.detail);return window.addEventListener("eip6963:announceProvider",Fn),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",Fn)}function createStore$3(){const Mn=new Set;let Fn=[];const io=()=>requestProviders($o=>{Fn.some(({info:mo})=>mo.uuid===$o.info.uuid)||(Fn=[...Fn,$o],Mn.forEach(mo=>mo(Fn,{added:[$o]})))});let fo=io();return{_listeners(){return Mn},clear(){Mn.forEach($o=>$o([],{removed:[...Fn]})),Fn=[]},destroy(){this.clear(),Mn.clear(),fo==null||fo()},findProvider({rdns:$o}){return Fn.find(mo=>mo.info.rdns===$o)},getProviders(){return Fn},reset(){this.clear(),fo==null||fo(),fo=io()},subscribe($o,{emitImmediately:mo}={}){return Mn.add($o),mo&&$o(Fn,{added:Fn}),()=>Mn.delete($o)}}}const subscribeWithSelectorImpl=Mn=>(Fn,io,fo)=>{const $o=fo.subscribe;return fo.subscribe=(Ao,jo,Lo)=>{let Ho=Ao;if(jo){const zo=(Lo==null?void 0:Lo.equalityFn)||Object.is;let Go=Ao(fo.getState());Ho=Vo=>{const Yo=Ao(Vo);if(!zo(Go,Yo)){const Xo=Go;jo(Go=Yo,Xo)}},Lo!=null&&Lo.fireImmediately&&jo(Go,Go)}return $o(Ho)},Mn(Fn,io,fo)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(Mn,Fn){let io;try{io=Mn()}catch{return}return{getItem:$o=>{var mo;const Ao=Lo=>Lo===null?null:JSON.parse(Lo,void 0),jo=(mo=io.getItem($o))!=null?mo:null;return jo instanceof Promise?jo.then(Ao):Ao(jo)},setItem:($o,mo)=>io.setItem($o,JSON.stringify(mo,void 0)),removeItem:$o=>io.removeItem($o)}}const toThenable=Mn=>Fn=>{try{const io=Mn(Fn);return io instanceof Promise?io:{then(fo){return toThenable(fo)(io)},catch(fo){return this}}}catch(io){return{then(fo){return this},catch(fo){return toThenable(fo)(io)}}}},persistImpl=(Mn,Fn)=>(io,fo,$o)=>{let mo={storage:createJSONStorage(()=>localStorage),partialize:is=>is,version:0,merge:(is,yl)=>({...yl,...is}),...Fn},Ao=!1;const jo=new Set,Lo=new Set;let Ho=mo.storage;if(!Ho)return Mn((...is)=>{console.warn(`[zustand persist middleware] Unable to update item '${mo.name}', the given storage is currently unavailable.`),io(...is)},fo,$o);const zo=()=>{const is=mo.partialize({...fo()});return Ho.setItem(mo.name,{state:is,version:mo.version})},Go=$o.setState;$o.setState=(is,yl)=>{Go(is,yl),zo()};const Vo=Mn((...is)=>{io(...is),zo()},fo,$o);$o.getInitialState=()=>Vo;let Yo;const Xo=()=>{var is,yl;if(!Ho)return;Ao=!1,jo.forEach(hs=>{var _l;return hs((_l=fo())!=null?_l:Vo)});const us=((yl=mo.onRehydrateStorage)==null?void 0:yl.call(mo,(is=fo())!=null?is:Vo))||void 0;return toThenable(Ho.getItem.bind(Ho))(mo.name).then(hs=>{if(hs)if(typeof hs.version=="number"&&hs.version!==mo.version){if(mo.migrate)return[!0,mo.migrate(hs.state,hs.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,hs.state];return[!1,void 0]}).then(hs=>{var _l;const[xl,Il]=hs;if(Yo=mo.merge(Il,(_l=fo())!=null?_l:Vo),io(Yo,!0),xl)return zo()}).then(()=>{us==null||us(Yo,void 0),Yo=fo(),Ao=!0,Lo.forEach(hs=>hs(Yo))}).catch(hs=>{us==null||us(void 0,hs)})};return $o.persist={setOptions:is=>{mo={...mo,...is},is.storage&&(Ho=is.storage)},clearStorage:()=>{Ho==null||Ho.removeItem(mo.name)},getOptions:()=>mo,rehydrate:()=>Xo(),hasHydrated:()=>Ao,onHydrate:is=>(jo.add(is),()=>{jo.delete(is)}),onFinishHydration:is=>(Lo.add(is),()=>{Lo.delete(is)})},mo.skipHydration||Xo(),Yo||Vo},persist=persistImpl,createStoreImpl=Mn=>{let Fn;const io=new Set,fo=(Ho,zo)=>{const Go=typeof Ho=="function"?Ho(Fn):Ho;if(!Object.is(Go,Fn)){const Vo=Fn;Fn=zo??(typeof Go!="object"||Go===null)?Go:Object.assign({},Fn,Go),io.forEach(Yo=>Yo(Fn,Vo))}},$o=()=>Fn,jo={setState:fo,getState:$o,getInitialState:()=>Lo,subscribe:Ho=>(io.add(Ho),()=>io.delete(Ho))},Lo=Fn=Mn(fo,$o,jo);return jo},createStore$2=Mn=>Mn?createStoreImpl(Mn):createStoreImpl;var eventemitter3={exports:{}};(function(Mn){var Fn=Object.prototype.hasOwnProperty,io="~";function fo(){}Object.create&&(fo.prototype=Object.create(null),new fo().__proto__||(io=!1));function $o(Lo,Ho,zo){this.fn=Lo,this.context=Ho,this.once=zo||!1}function mo(Lo,Ho,zo,Go,Vo){if(typeof zo!="function")throw new TypeError("The listener must be a function");var Yo=new $o(zo,Go||Lo,Vo),Xo=io?io+Ho:Ho;return Lo._events[Xo]?Lo._events[Xo].fn?Lo._events[Xo]=[Lo._events[Xo],Yo]:Lo._events[Xo].push(Yo):(Lo._events[Xo]=Yo,Lo._eventsCount++),Lo}function Ao(Lo,Ho){--Lo._eventsCount===0?Lo._events=new fo:delete Lo._events[Ho]}function jo(){this._events=new fo,this._eventsCount=0}jo.prototype.eventNames=function(){var Ho=[],zo,Go;if(this._eventsCount===0)return Ho;for(Go in zo=this._events)Fn.call(zo,Go)&&Ho.push(io?Go.slice(1):Go);return Object.getOwnPropertySymbols?Ho.concat(Object.getOwnPropertySymbols(zo)):Ho},jo.prototype.listeners=function(Ho){var zo=io?io+Ho:Ho,Go=this._events[zo];if(!Go)return[];if(Go.fn)return[Go.fn];for(var Vo=0,Yo=Go.length,Xo=new Array(Yo);Vo<Yo;Vo++)Xo[Vo]=Go[Vo].fn;return Xo},jo.prototype.listenerCount=function(Ho){var zo=io?io+Ho:Ho,Go=this._events[zo];return Go?Go.fn?1:Go.length:0},jo.prototype.emit=function(Ho,zo,Go,Vo,Yo,Xo){var is=io?io+Ho:Ho;if(!this._events[is])return!1;var yl=this._events[is],us=arguments.length,hs,_l;if(yl.fn){switch(yl.once&&this.removeListener(Ho,yl.fn,void 0,!0),us){case 1:return yl.fn.call(yl.context),!0;case 2:return yl.fn.call(yl.context,zo),!0;case 3:return yl.fn.call(yl.context,zo,Go),!0;case 4:return yl.fn.call(yl.context,zo,Go,Vo),!0;case 5:return yl.fn.call(yl.context,zo,Go,Vo,Yo),!0;case 6:return yl.fn.call(yl.context,zo,Go,Vo,Yo,Xo),!0}for(_l=1,hs=new Array(us-1);_l<us;_l++)hs[_l-1]=arguments[_l];yl.fn.apply(yl.context,hs)}else{var xl=yl.length,Il;for(_l=0;_l<xl;_l++)switch(yl[_l].once&&this.removeListener(Ho,yl[_l].fn,void 0,!0),us){case 1:yl[_l].fn.call(yl[_l].context);break;case 2:yl[_l].fn.call(yl[_l].context,zo);break;case 3:yl[_l].fn.call(yl[_l].context,zo,Go);break;case 4:yl[_l].fn.call(yl[_l].context,zo,Go,Vo);break;default:if(!hs)for(Il=1,hs=new Array(us-1);Il<us;Il++)hs[Il-1]=arguments[Il];yl[_l].fn.apply(yl[_l].context,hs)}}return!0},jo.prototype.on=function(Ho,zo,Go){return mo(this,Ho,zo,Go,!1)},jo.prototype.once=function(Ho,zo,Go){return mo(this,Ho,zo,Go,!0)},jo.prototype.removeListener=function(Ho,zo,Go,Vo){var Yo=io?io+Ho:Ho;if(!this._events[Yo])return this;if(!zo)return Ao(this,Yo),this;var Xo=this._events[Yo];if(Xo.fn)Xo.fn===zo&&(!Vo||Xo.once)&&(!Go||Xo.context===Go)&&Ao(this,Yo);else{for(var is=0,yl=[],us=Xo.length;is<us;is++)(Xo[is].fn!==zo||Vo&&!Xo[is].once||Go&&Xo[is].context!==Go)&&yl.push(Xo[is]);yl.length?this._events[Yo]=yl.length===1?yl[0]:yl:Ao(this,Yo)}return this},jo.prototype.removeAllListeners=function(Ho){var zo;return Ho?(zo=io?io+Ho:Ho,this._events[zo]&&Ao(this,zo)):(this._events=new fo,this._eventsCount=0),this},jo.prototype.off=jo.prototype.removeListener,jo.prototype.addListener=jo.prototype.on,jo.prefixed=io,jo.EventEmitter=jo,Mn.exports=jo})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter$1=getDefaultExportFromCjs$1(eventemitter3Exports);class Emitter{constructor(Fn){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:Fn}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new EventEmitter$1})}on(Fn,io){this._emitter.on(Fn,io)}once(Fn,io){this._emitter.once(Fn,io)}off(Fn,io){this._emitter.off(Fn,io)}emit(Fn,...io){const fo=io[0];this._emitter.emit(Fn,{uid:this.uid,...fo})}listenerCount(Fn){return this._emitter.listenerCount(Fn)}}function createEmitter(Mn){return new Emitter(Mn)}function deserialize$4(Mn,Fn){return JSON.parse(Mn,(io,fo)=>{let $o=fo;return($o==null?void 0:$o.__type)==="bigint"&&($o=BigInt($o.value)),($o==null?void 0:$o.__type)==="Map"&&($o=new Map($o.value)),(Fn==null?void 0:Fn(io,$o))??$o})}function getReferenceKey(Mn,Fn){return Mn.slice(0,Fn).join(".")||"."}function getCutoff(Mn,Fn){const{length:io}=Mn;for(let fo=0;fo<io;++fo)if(Mn[fo]===Fn)return fo+1;return 0}function createReplacer(Mn,Fn){const io=typeof Mn=="function",fo=typeof Fn=="function",$o=[],mo=[];return function(jo,Lo){if(typeof Lo=="object")if($o.length){const Ho=getCutoff($o,this);Ho===0?$o[$o.length]=this:($o.splice(Ho),mo.splice(Ho)),mo[mo.length]=jo;const zo=getCutoff($o,Lo);if(zo!==0)return fo?Fn.call(this,jo,Lo,getReferenceKey(mo,zo)):`[ref=${getReferenceKey(mo,zo)}]`}else $o[0]=Lo,mo[0]=jo;return io?Mn.call(this,jo,Lo):Lo}}function serialize$7(Mn,Fn,io,fo){return JSON.stringify(Mn,createReplacer(($o,mo)=>{let Ao=mo;return typeof Ao=="bigint"&&(Ao={__type:"bigint",value:mo.toString()}),Ao instanceof Map&&(Ao={__type:"Map",value:Array.from(mo.entries())}),(Fn==null?void 0:Fn($o,Ao))??Ao},fo),io??void 0)}function createStorage$1(Mn){const{deserialize:Fn=deserialize$4,key:io="wagmi",serialize:fo=serialize$7,storage:$o=noopStorage}=Mn;function mo(Ao){return Ao instanceof Promise?Ao.then(jo=>jo).catch(()=>null):Ao}return{...$o,key:io,async getItem(Ao,jo){const Lo=$o.getItem(`${io}.${Ao}`),Ho=await mo(Lo);return Ho?Fn(Ho)??null:jo??null},async setItem(Ao,jo){const Lo=`${io}.${Ao}`;jo===null?await mo($o.removeItem(Lo)):await mo($o.setItem(Lo,fo(jo)))},async removeItem(Ao){await mo($o.removeItem(`${io}.${Ao}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size$1=256;let index=size$1,buffer$1;function uid$f(Mn=11){if(!buffer$1||index+Mn>size$1*2){buffer$1="",index=0;for(let Fn=0;Fn<size$1;Fn++)buffer$1+=(256+Math.random()*256|0).toString(16).substring(1)}return buffer$1.substring(index,index+++Mn)}function createConfig(Mn){const{multiInjectedProviderDiscovery:Fn=!0,storage:io=createStorage$1({storage:typeof window<"u"&&window.localStorage?window.localStorage:noopStorage}),syncConnectedChain:fo=!0,ssr:$o=!1,...mo}=Mn,Ao=typeof window<"u"&&Fn?createStore$3():void 0,jo=createStore$2(()=>mo.chains),Lo=createStore$2(()=>{const Il=[],Ol=new Set;for(const Tl of mo.connectors??[]){const Cl=Ho(Tl);Il.push(Cl),!$o&&Cl.rdns&&Ol.add(Cl.rdns)}if(!$o&&Ao){const Tl=Ao.getProviders();for(const Cl of Tl)Ol.has(Cl.info.rdns)||Il.push(Ho(zo(Cl)))}return Il});function Ho(Il){var Cl;const Ol=createEmitter(uid$f()),Tl={...Il({emitter:Ol,chains:jo.getState(),storage:io,transports:mo.transports}),emitter:Ol,uid:Ol.uid};return Ol.on("connect",_l),(Cl=Tl.setup)==null||Cl.call(Tl),Tl}function zo(Il){const{info:Ol}=Il,Tl=Il.provider;return injected({target:{...Ol,id:Ol.rdns,provider:Tl}})}const Go=new Map;function Vo(Il={}){const Ol=Il{"ActionError":{"index":0,"kind":{"FunctionCallError":{"CompilationError":{"CodeDoesNotExist":{"account_id":"web4.nearbuilders.testnet"}}}}}}
1 automatic refund step from the network not shown.
This page reads FastNEAR's public transaction index and stores nothing. This command asks a NEAR archival node for the same transaction and needs no keys.
curl -s https://archival-rpc.testnet.fastnear.com -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"tx","params":{"tx_hash":"GA2tgZcSPuQJjNBCrzAHyTMVkUzTeoRQ8vDSWGSWUvST","sender_account_id":"web4.nearbuilders.testnet","wait_until":"FINAL"}}'Vouch has its own page because testnet.nearblocks.io stopped indexing on 27 Sep 2026, so it can't show newer transactions.