const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-tY4qhF3l.js","assets/index-CXyQ5sGC.js","assets/lodash-CQGrF3PQ.js","assets/index-D5c7CNr0.css","assets/index-CKrDYfdW.js"])))=>i.map(i=>d[i]); import{r as T,_ as qn}from"./index-CXyQ5sGC.js";import{g as qi}from"./lodash-CQGrF3PQ.js";function Ni({storage:t,key:e="REACT_QUERY_OFFLINE_CACHE",throttleTime:n=1e3,serialize:r=JSON.stringify,deserialize:s=JSON.parse,retry:i}){if(t){const a=o=>{try{t.setItem(e,r(o));return}catch(u){return u}};return{persistClient:_i(o=>{let u=o,l=a(u),c=0;for(;l&&u;)c++,u=i==null?void 0:i({persistedClient:u,error:l,errorCount:c}),u&&(l=a(u))},n),restoreClient:()=>{const o=t.getItem(e);if(o)return s(o)},removeClient:()=>{t.removeItem(e)}}}return{persistClient:Er,restoreClient:()=>{},removeClient:Er}}function _i(t,e=100){let n=null,r;return function(...s){r=s,n===null&&(n=setTimeout(()=>{t(...r),n=null},e))}}function Er(){}class Ee{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){const n={listener:e};return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const qe=typeof window>"u"||"Deno"in window;function L(){}function Bi(t,e){return typeof t=="function"?t(e):t}function un(t){return typeof t=="number"&&t>=0&&t!==1/0}function cs(t,e){return Math.max(t+(e||0)-Date.now(),0)}function ft(t,e,n){return tt(t)?typeof e=="function"?{...n,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function ls(t,e,n){return tt(t)?typeof e=="function"?{...n,mutationKey:t,mutationFn:e}:{...e,mutationKey:t}:typeof t=="function"?{...e,mutationFn:t}:{...t}}function ee(t,e,n){return tt(t)?[{...e,queryKey:t},n]:[t||{},e]}function xr(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:a,stale:o}=t;if(tt(a)){if(r){if(e.queryHash!==Nn(a,e.options))return!1}else if(!vt(e.queryKey,a))return!1}if(n!=="all"){const u=e.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof s<"u"&&s!==e.state.fetchStatus||i&&!i(e))}function Sr(t,e){const{exact:n,fetching:r,predicate:s,mutationKey:i}=t;if(tt(i)){if(!e.options.mutationKey)return!1;if(n){if(ce(e.options.mutationKey)!==ce(i))return!1}else if(!vt(e.options.mutationKey,i))return!1}return!(typeof r=="boolean"&&e.state.status==="loading"!==r||s&&!s(e))}function Nn(t,e){return((e==null?void 0:e.queryKeyHashFn)||ce)(t)}function ce(t){return JSON.stringify(t,(e,n)=>cn(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function vt(t,e){return ds(t,e)}function ds(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!ds(t[n],e[n])):!1}function fs(t,e){if(t===e)return t;const n=Or(t)&&Or(e);if(n||cn(t)&&cn(e)){const r=n?t.length:Object.keys(t).length,s=n?e:Object.keys(e),i=s.length,a=n?[]:{};let o=0;for(let u=0;u"u")return!0;const n=e.prototype;return!(!Ar(n)||!n.hasOwnProperty("isPrototypeOf"))}function Ar(t){return Object.prototype.toString.call(t)==="[object Object]"}function tt(t){return Array.isArray(t)}function hs(t){return new Promise(e=>{setTimeout(e,t)})}function Tr(t){hs(0).then(t)}function Di(){if(typeof AbortController=="function")return new AbortController}function ln(t,e,n){return n.isDataEqual!=null&&n.isDataEqual(t,e)?t:typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?fs(t,e):e}class Ui extends Ee{constructor(){super(),this.setup=e=>{if(!qe&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),window.addEventListener("focus",n,!1),()=>{window.removeEventListener("visibilitychange",n),window.removeEventListener("focus",n)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var n;this.setup=e,(n=this.cleanup)==null||n.call(this),this.cleanup=e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(e){this.focused!==e&&(this.focused=e,this.onFocus())}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const Ct=new Ui,kr=["online","offline"];class Li extends Ee{constructor(){super(),this.setup=e=>{if(!qe&&window.addEventListener){const n=()=>e();return kr.forEach(r=>{window.addEventListener(r,n,!1)}),()=>{kr.forEach(r=>{window.removeEventListener(r,n)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var n;this.setup=e,(n=this.cleanup)==null||n.call(this),this.cleanup=e(r=>{typeof r=="boolean"?this.setOnline(r):this.onOnline()})}setOnline(e){this.online!==e&&(this.online=e,this.onOnline())}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const Et=new Li;function zi(t){return Math.min(1e3*2**t,3e4)}function Ft(t){return(t??"online")==="online"?Et.isOnline():!0}class ps{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}}function mt(t){return t instanceof ps}function ys(t){let e=!1,n=0,r=!1,s,i,a;const o=new Promise((y,m)=>{i=y,a=m}),u=y=>{r||(p(new ps(y)),t.abort==null||t.abort())},l=()=>{e=!0},c=()=>{e=!1},d=()=>!Ct.isFocused()||t.networkMode!=="always"&&!Et.isOnline(),h=y=>{r||(r=!0,t.onSuccess==null||t.onSuccess(y),s==null||s(),i(y))},p=y=>{r||(r=!0,t.onError==null||t.onError(y),s==null||s(),a(y))},f=()=>new Promise(y=>{s=m=>{const g=r||!d();return g&&y(m),g},t.onPause==null||t.onPause()}).then(()=>{s=void 0,r||t.onContinue==null||t.onContinue()}),b=()=>{if(r)return;let y;try{y=t.fn()}catch(m){y=Promise.reject(m)}Promise.resolve(y).then(h).catch(m=>{var g,w;if(r)return;const E=(g=t.retry)!=null?g:3,C=(w=t.retryDelay)!=null?w:zi,v=typeof C=="function"?C(n,m):C,P=E===!0||typeof E=="number"&&n{if(d())return f()}).then(()=>{e?p(m):b()})})};return Ft(t.networkMode)?b():f().then(b),{promise:o,cancel:u,continue:()=>(s==null?void 0:s())?o:Promise.resolve(),cancelRetry:l,continueRetry:c}}const _n=console;function Gi(){let t=[],e=0,n=c=>{c()},r=c=>{c()};const s=c=>{let d;e++;try{d=c()}finally{e--,e||o()}return d},i=c=>{e?t.push(c):Tr(()=>{n(c)})},a=c=>(...d)=>{i(()=>{c(...d)})},o=()=>{const c=t;t=[],c.length&&Tr(()=>{r(()=>{c.forEach(d=>{n(d)})})})};return{batch:s,batchCalls:a,schedule:i,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c}}}const R=Gi();class bs{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),un(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,e??(qe?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class Wi extends bs{constructor(e){super(),this.abortSignalConsumed=!1,this.defaultOptions=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.cache=e.cache,this.logger=e.logger||_n,this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.initialState=e.state||Qi(this.options),this.state=this.initialState,this.scheduleGc()}get meta(){return this.options.meta}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.cache.remove(this)}setData(e,n){const r=ln(this.state.data,e,this.options);return this.dispatch({data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){this.dispatch({type:"setState",state:e,setStateOptions:n})}cancel(e){var n;const r=this.promise;return(n=this.retryer)==null||n.cancel(e),r?r.then(L).catch(L):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.initialState)}isActive(){return this.observers.some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||this.observers.some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!cs(this.state.dataUpdatedAt,e)}onFocus(){var e;const n=this.observers.find(r=>r.shouldFetchOnWindowFocus());n&&n.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}onOnline(){var e;const n=this.observers.find(r=>r.shouldFetchOnReconnect());n&&n.refetch({cancelRefetch:!1}),(e=this.retryer)==null||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.cache.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(this.retryer&&(this.abortSignalConsumed?this.retryer.cancel({revert:!0}):this.retryer.cancelRetry()),this.scheduleGc()),this.cache.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.dispatch({type:"invalidate"})}fetch(e,n){var r,s;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&n!=null&&n.cancelRefetch)this.cancel({silent:!0});else if(this.promise){var i;return(i=this.retryer)==null||i.continueRetry(),this.promise}}if(e&&this.setOptions(e),!this.options.queryFn){const p=this.observers.find(f=>f.options.queryFn);p&&this.setOptions(p.options)}const a=Di(),o={queryKey:this.queryKey,pageParam:void 0,meta:this.meta},u=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>{if(a)return this.abortSignalConsumed=!0,a.signal}})};u(o);const l=()=>this.options.queryFn?(this.abortSignalConsumed=!1,this.options.queryFn(o)):Promise.reject("Missing queryFn for queryKey '"+this.options.queryHash+"'"),c={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:l};if(u(c),(r=this.options.behavior)==null||r.onFetch(c),this.revertState=this.state,this.state.fetchStatus==="idle"||this.state.fetchMeta!==((s=c.fetchOptions)==null?void 0:s.meta)){var d;this.dispatch({type:"fetch",meta:(d=c.fetchOptions)==null?void 0:d.meta})}const h=p=>{if(mt(p)&&p.silent||this.dispatch({type:"error",error:p}),!mt(p)){var f,b,y,m;(f=(b=this.cache.config).onError)==null||f.call(b,p,this),(y=(m=this.cache.config).onSettled)==null||y.call(m,this.state.data,p,this)}this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return this.retryer=ys({fn:c.fetchFn,abort:a==null?void 0:a.abort.bind(a),onSuccess:p=>{var f,b,y,m;if(typeof p>"u"){h(new Error(this.queryHash+" data is undefined"));return}this.setData(p),(f=(b=this.cache.config).onSuccess)==null||f.call(b,p,this),(y=(m=this.cache.config).onSettled)==null||y.call(m,p,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:h,onFail:(p,f)=>{this.dispatch({type:"failed",failureCount:p,error:f})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode}),this.promise=this.retryer.promise,this.promise}dispatch(e){const n=r=>{var s,i;switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:(s=e.meta)!=null?s:null,fetchStatus:Ft(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"loading"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:(i=e.dataUpdatedAt)!=null?i:Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=e.error;return mt(a)&&a.revert&&this.revertState?{...this.revertState,fetchStatus:"idle"}:{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),R.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate(e)}),this.cache.notify({query:this,type:"updated",action:e})})}}function Qi(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=typeof e<"u",r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"loading",fetchStatus:"idle"}}class Hi extends Ee{constructor(e){super(),this.config=e||{},this.queries=[],this.queriesMap={}}build(e,n,r){var s;const i=n.queryKey,a=(s=n.queryHash)!=null?s:Nn(i,n);let o=this.get(a);return o||(o=new Wi({cache:this,logger:e.getLogger(),queryKey:i,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.queriesMap[e.queryHash]||(this.queriesMap[e.queryHash]=e,this.queries.push(e),this.notify({type:"added",query:e}))}remove(e){const n=this.queriesMap[e.queryHash];n&&(e.destroy(),this.queries=this.queries.filter(r=>r!==e),n===e&&delete this.queriesMap[e.queryHash],this.notify({type:"removed",query:e}))}clear(){R.batch(()=>{this.queries.forEach(e=>{this.remove(e)})})}get(e){return this.queriesMap[e]}getAll(){return this.queries}find(e,n){const[r]=ee(e,n);return typeof r.exact>"u"&&(r.exact=!0),this.queries.find(s=>xr(r,s))}findAll(e,n){const[r]=ee(e,n);return Object.keys(r).length>0?this.queries.filter(s=>xr(r,s)):this.queries}notify(e){R.batch(()=>{this.listeners.forEach(({listener:n})=>{n(e)})})}onFocus(){R.batch(()=>{this.queries.forEach(e=>{e.onFocus()})})}onOnline(){R.batch(()=>{this.queries.forEach(e=>{e.onOnline()})})}}class Ki extends bs{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||_n,this.observers=[],this.state=e.state||ms(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(n=>n!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,n;return(e=(n=this.retryer)==null?void 0:n.continue())!=null?e:this.execute()}async execute(){const e=()=>{var P;return this.retryer=ys({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(S,A)=>{this.dispatch({type:"failed",failureCount:S,error:A})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(P=this.options.retry)!=null?P:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},n=this.state.status==="loading";try{var r,s,i,a,o,u,l,c;if(!n){var d,h,p,f;this.dispatch({type:"loading",variables:this.options.variables}),await((d=(h=this.mutationCache.config).onMutate)==null?void 0:d.call(h,this.state.variables,this));const S=await((p=(f=this.options).onMutate)==null?void 0:p.call(f,this.state.variables));S!==this.state.context&&this.dispatch({type:"loading",context:S,variables:this.state.variables})}const P=await e();return await((r=(s=this.mutationCache.config).onSuccess)==null?void 0:r.call(s,P,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,P,this.state.variables,this.state.context)),await((o=(u=this.mutationCache.config).onSettled)==null?void 0:o.call(u,P,null,this.state.variables,this.state.context,this)),await((l=(c=this.options).onSettled)==null?void 0:l.call(c,P,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:P}),P}catch(P){try{var b,y,m,g,w,E,C,v;throw await((b=(y=this.mutationCache.config).onError)==null?void 0:b.call(y,P,this.state.variables,this.state.context,this)),await((m=(g=this.options).onError)==null?void 0:m.call(g,P,this.state.variables,this.state.context)),await((w=(E=this.mutationCache.config).onSettled)==null?void 0:w.call(E,void 0,P,this.state.variables,this.state.context,this)),await((C=(v=this.options).onSettled)==null?void 0:C.call(v,void 0,P,this.state.variables,this.state.context)),P}finally{this.dispatch({type:"error",error:P})}}}dispatch(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"loading":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!Ft(this.options.networkMode),status:"loading",variables:e.variables};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"};case"setState":return{...r,...e.state}}};this.state=n(this.state),R.batch(()=>{this.observers.forEach(r=>{r.onMutationUpdate(e)}),this.mutationCache.notify({mutation:this,type:"updated",action:e})})}}function ms(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class Vi extends Ee{constructor(e){super(),this.config=e||{},this.mutations=[],this.mutationId=0}build(e,n,r){const s=new Ki({mutationCache:this,logger:e.getLogger(),mutationId:++this.mutationId,options:e.defaultMutationOptions(n),state:r,defaultOptions:n.mutationKey?e.getMutationDefaults(n.mutationKey):void 0});return this.add(s),s}add(e){this.mutations.push(e),this.notify({type:"added",mutation:e})}remove(e){this.mutations=this.mutations.filter(n=>n!==e),this.notify({type:"removed",mutation:e})}clear(){R.batch(()=>{this.mutations.forEach(e=>{this.remove(e)})})}getAll(){return this.mutations}find(e){return typeof e.exact>"u"&&(e.exact=!0),this.mutations.find(n=>Sr(e,n))}findAll(e){return this.mutations.filter(n=>Sr(e,n))}notify(e){R.batch(()=>{this.listeners.forEach(({listener:n})=>{n(e)})})}resumePausedMutations(){var e;return this.resuming=((e=this.resuming)!=null?e:Promise.resolve()).then(()=>{const n=this.mutations.filter(r=>r.state.isPaused);return R.batch(()=>n.reduce((r,s)=>r.then(()=>s.continue().catch(L)),Promise.resolve()))}).then(()=>{this.resuming=void 0}),this.resuming}}function Ji(){return{onFetch:t=>{t.fetchFn=()=>{var e,n,r,s,i,a;const o=(e=t.fetchOptions)==null||(n=e.meta)==null?void 0:n.refetchPage,u=(r=t.fetchOptions)==null||(s=r.meta)==null?void 0:s.fetchMore,l=u==null?void 0:u.pageParam,c=(u==null?void 0:u.direction)==="forward",d=(u==null?void 0:u.direction)==="backward",h=((i=t.state.data)==null?void 0:i.pages)||[],p=((a=t.state.data)==null?void 0:a.pageParams)||[];let f=p,b=!1;const y=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>{var P;if((P=t.signal)!=null&&P.aborted)b=!0;else{var S;(S=t.signal)==null||S.addEventListener("abort",()=>{b=!0})}return t.signal}})},m=t.options.queryFn||(()=>Promise.reject("Missing queryFn for queryKey '"+t.options.queryHash+"'")),g=(v,P,S,A)=>(f=A?[P,...f]:[...f,P],A?[S,...v]:[...v,S]),w=(v,P,S,A)=>{if(b)return Promise.reject("Cancelled");if(typeof S>"u"&&!P&&v.length)return Promise.resolve(v);const I={queryKey:t.queryKey,pageParam:S,meta:t.options.meta};y(I);const F=m(I);return Promise.resolve(F).then(ue=>g(v,S,ue,A))};let E;if(!h.length)E=w([]);else if(c){const v=typeof l<"u",P=v?l:Fr(t.options,h);E=w(h,v,P)}else if(d){const v=typeof l<"u",P=v?l:Zi(t.options,h);E=w(h,v,P,!0)}else{f=[];const v=typeof t.options.getNextPageParam>"u";E=(o&&h[0]?o(h[0],0,h):!0)?w([],v,p[0]):Promise.resolve(g([],p[0],h[0]));for(let S=1;S{if(o&&h[S]?o(h[S],S,h):!0){const F=v?p[S]:Fr(t.options,A);return w(A,v,F)}return Promise.resolve(g(A,p[S],h[S]))})}return E.then(v=>({pages:v,pageParams:f}))}}}}function Fr(t,e){return t.getNextPageParam==null?void 0:t.getNextPageParam(e[e.length-1],e)}function Zi(t,e){return t.getPreviousPageParam==null?void 0:t.getPreviousPageParam(e[0],e)}class Xi{constructor(e={}){this.queryCache=e.queryCache||new Hi,this.mutationCache=e.mutationCache||new Vi,this.logger=e.logger||_n,this.defaultOptions=e.defaultOptions||{},this.queryDefaults=[],this.mutationDefaults=[],this.mountCount=0}mount(){this.mountCount++,this.mountCount===1&&(this.unsubscribeFocus=Ct.subscribe(()=>{Ct.isFocused()&&(this.resumePausedMutations(),this.queryCache.onFocus())}),this.unsubscribeOnline=Et.subscribe(()=>{Et.isOnline()&&(this.resumePausedMutations(),this.queryCache.onOnline())}))}unmount(){var e,n;this.mountCount--,this.mountCount===0&&((e=this.unsubscribeFocus)==null||e.call(this),this.unsubscribeFocus=void 0,(n=this.unsubscribeOnline)==null||n.call(this),this.unsubscribeOnline=void 0)}isFetching(e,n){const[r]=ee(e,n);return r.fetchStatus="fetching",this.queryCache.findAll(r).length}isMutating(e){return this.mutationCache.findAll({...e,fetching:!0}).length}getQueryData(e,n){var r;return(r=this.queryCache.find(e,n))==null?void 0:r.state.data}ensureQueryData(e,n,r){const s=ft(e,n,r),i=this.getQueryData(s.queryKey);return i?Promise.resolve(i):this.fetchQuery(s)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:n,state:r})=>{const s=r.data;return[n,s]})}setQueryData(e,n,r){const s=this.queryCache.find(e),i=s==null?void 0:s.state.data,a=Bi(n,i);if(typeof a>"u")return;const o=ft(e),u=this.defaultQueryOptions(o);return this.queryCache.build(this,u).setData(a,{...r,manual:!0})}setQueriesData(e,n,r){return R.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,n,r)]))}getQueryState(e,n){var r;return(r=this.queryCache.find(e,n))==null?void 0:r.state}removeQueries(e,n){const[r]=ee(e,n),s=this.queryCache;R.batch(()=>{s.findAll(r).forEach(i=>{s.remove(i)})})}resetQueries(e,n,r){const[s,i]=ee(e,n,r),a=this.queryCache,o={type:"active",...s};return R.batch(()=>(a.findAll(s).forEach(u=>{u.reset()}),this.refetchQueries(o,i)))}cancelQueries(e,n,r){const[s,i={}]=ee(e,n,r);typeof i.revert>"u"&&(i.revert=!0);const a=R.batch(()=>this.queryCache.findAll(s).map(o=>o.cancel(i)));return Promise.all(a).then(L).catch(L)}invalidateQueries(e,n,r){const[s,i]=ee(e,n,r);return R.batch(()=>{var a,o;if(this.queryCache.findAll(s).forEach(l=>{l.invalidate()}),s.refetchType==="none")return Promise.resolve();const u={...s,type:(a=(o=s.refetchType)!=null?o:s.type)!=null?a:"active"};return this.refetchQueries(u,i)})}refetchQueries(e,n,r){const[s,i]=ee(e,n,r),a=R.batch(()=>this.queryCache.findAll(s).filter(u=>!u.isDisabled()).map(u=>{var l;return u.fetch(void 0,{...i,cancelRefetch:(l=i==null?void 0:i.cancelRefetch)!=null?l:!0,meta:{refetchPage:s.refetchPage}})}));let o=Promise.all(a).then(L);return i!=null&&i.throwOnError||(o=o.catch(L)),o}fetchQuery(e,n,r){const s=ft(e,n,r),i=this.defaultQueryOptions(s);typeof i.retry>"u"&&(i.retry=!1);const a=this.queryCache.build(this,i);return a.isStaleByTime(i.staleTime)?a.fetch(i):Promise.resolve(a.state.data)}prefetchQuery(e,n,r){return this.fetchQuery(e,n,r).then(L).catch(L)}fetchInfiniteQuery(e,n,r){const s=ft(e,n,r);return s.behavior=Ji(),this.fetchQuery(s)}prefetchInfiniteQuery(e,n,r){return this.fetchInfiniteQuery(e,n,r).then(L).catch(L)}resumePausedMutations(){return this.mutationCache.resumePausedMutations()}getQueryCache(){return this.queryCache}getMutationCache(){return this.mutationCache}getLogger(){return this.logger}getDefaultOptions(){return this.defaultOptions}setDefaultOptions(e){this.defaultOptions=e}setQueryDefaults(e,n){const r=this.queryDefaults.find(s=>ce(e)===ce(s.queryKey));r?r.defaultOptions=n:this.queryDefaults.push({queryKey:e,defaultOptions:n})}getQueryDefaults(e){if(!e)return;const n=this.queryDefaults.find(r=>vt(e,r.queryKey));return n==null?void 0:n.defaultOptions}setMutationDefaults(e,n){const r=this.mutationDefaults.find(s=>ce(e)===ce(s.mutationKey));r?r.defaultOptions=n:this.mutationDefaults.push({mutationKey:e,defaultOptions:n})}getMutationDefaults(e){if(!e)return;const n=this.mutationDefaults.find(r=>vt(e,r.mutationKey));return n==null?void 0:n.defaultOptions}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const n={...this.defaultOptions.queries,...this.getQueryDefaults(e==null?void 0:e.queryKey),...e,_defaulted:!0};return!n.queryHash&&n.queryKey&&(n.queryHash=Nn(n.queryKey,n)),typeof n.refetchOnReconnect>"u"&&(n.refetchOnReconnect=n.networkMode!=="always"),typeof n.useErrorBoundary>"u"&&(n.useErrorBoundary=!!n.suspense),n}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...this.defaultOptions.mutations,...this.getMutationDefaults(e==null?void 0:e.mutationKey),...e,_defaulted:!0}}clear(){this.queryCache.clear(),this.mutationCache.clear()}}class Yi extends Ee{constructor(e,n){super(),this.client=e,this.options=n,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(n)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),Ir(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return dn(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return dn(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,n){const r=this.options,s=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),Pt(r,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),this.updateQuery();const i=this.hasListeners();i&&Rr(this.currentQuery,s,this.options,r)&&this.executeFetch(),this.updateResult(n),i&&(this.currentQuery!==s||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&this.updateStaleTimeout();const a=this.computeRefetchInterval();i&&(this.currentQuery!==s||this.options.enabled!==r.enabled||a!==this.currentRefetchInterval)&&this.updateRefetchInterval(a)}getOptimisticResult(e){const n=this.client.getQueryCache().build(this.client,e),r=this.createResult(n,e);return ta(this,r,e)&&(this.currentResult=r,this.currentResultOptions=this.options,this.currentResultState=this.currentQuery.state),r}getCurrentResult(){return this.currentResult}trackResult(e){const n={};return Object.keys(e).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(r),e[r])})}),n}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...n}={}){return this.fetch({...n,meta:{refetchPage:e}})}fetchOptimistic(e){const n=this.client.defaultQueryOptions(e),r=this.client.getQueryCache().build(this.client,n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(e){var n;return this.executeFetch({...e,cancelRefetch:(n=e.cancelRefetch)!=null?n:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let n=this.currentQuery.fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(L)),n}updateStaleTimeout(){if(this.clearStaleTimeout(),qe||this.currentResult.isStale||!un(this.options.staleTime))return;const n=cs(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},n)}computeRefetchInterval(){var e;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(e=this.options.refetchInterval)!=null?e:!1}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!(qe||this.options.enabled===!1||!un(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||Ct.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,n){const r=this.currentQuery,s=this.options,i=this.currentResult,a=this.currentResultState,o=this.currentResultOptions,u=e!==r,l=u?e.state:this.currentQueryInitialState,c=u?this.currentResult:this.previousQueryResult,{state:d}=e;let{dataUpdatedAt:h,error:p,errorUpdatedAt:f,fetchStatus:b,status:y}=d,m=!1,g=!1,w;if(n._optimisticResults){const S=this.hasListeners(),A=!S&&Ir(e,n),I=S&&Rr(e,r,n,s);(A||I)&&(b=Ft(e.options.networkMode)?"fetching":"paused",h||(y="loading")),n._optimisticResults==="isRestoring"&&(b="idle")}if(n.keepPreviousData&&!d.dataUpdatedAt&&c!=null&&c.isSuccess&&y!=="error")w=c.data,h=c.dataUpdatedAt,y=c.status,m=!0;else if(n.select&&typeof d.data<"u")if(i&&d.data===(a==null?void 0:a.data)&&n.select===this.selectFn)w=this.selectResult;else try{this.selectFn=n.select,w=n.select(d.data),w=ln(i==null?void 0:i.data,w,n),this.selectResult=w,this.selectError=null}catch(S){this.selectError=S}else w=d.data;if(typeof n.placeholderData<"u"&&typeof w>"u"&&y==="loading"){let S;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData))S=i.data;else if(S=typeof n.placeholderData=="function"?n.placeholderData():n.placeholderData,n.select&&typeof S<"u")try{S=n.select(S),this.selectError=null}catch(A){this.selectError=A}typeof S<"u"&&(y="success",w=ln(i==null?void 0:i.data,S,n),g=!0)}this.selectError&&(p=this.selectError,w=this.selectResult,f=Date.now(),y="error");const E=b==="fetching",C=y==="loading",v=y==="error";return{status:y,fetchStatus:b,isLoading:C,isSuccess:y==="success",isError:v,isInitialLoading:C&&E,data:w,dataUpdatedAt:h,error:p,errorUpdatedAt:f,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:E,isRefetching:E&&!C,isLoadingError:v&&d.dataUpdatedAt===0,isPaused:b==="paused",isPlaceholderData:g,isPreviousData:m,isRefetchError:v&&d.dataUpdatedAt!==0,isStale:Bn(e,n),refetch:this.refetch,remove:this.remove}}updateResult(e){const n=this.currentResult,r=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,Pt(r,n))return;this.currentResult=r;const s={cache:!0},i=()=>{if(!n)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!this.trackedProps.size)return!0;const u=new Set(o??this.trackedProps);return this.options.useErrorBoundary&&u.add("error"),Object.keys(this.currentResult).some(l=>{const c=l;return this.currentResult[c]!==n[c]&&u.has(c)})};(e==null?void 0:e.listeners)!==!1&&i()&&(s.listeners=!0),this.notify({...s,...e})}updateQuery(){const e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;const n=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){const n={};e.type==="success"?n.onSuccess=!e.manual:e.type==="error"&&!mt(e.error)&&(n.onError=!0),this.updateResult(n),this.hasListeners()&&this.updateTimers()}notify(e){R.batch(()=>{if(e.onSuccess){var n,r,s,i;(n=(r=this.options).onSuccess)==null||n.call(r,this.currentResult.data),(s=(i=this.options).onSettled)==null||s.call(i,this.currentResult.data,null)}else if(e.onError){var a,o,u,l;(a=(o=this.options).onError)==null||a.call(o,this.currentResult.error),(u=(l=this.options).onSettled)==null||u.call(l,void 0,this.currentResult.error)}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function ea(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Ir(t,e){return ea(t,e)||t.state.dataUpdatedAt>0&&dn(t,e,e.refetchOnMount)}function dn(t,e,n){if(e.enabled!==!1){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Bn(t,e)}return!1}function Rr(t,e,n,r){return n.enabled!==!1&&(t!==e||r.enabled===!1)&&(!n.suspense||t.state.status!=="error")&&Bn(t,n)}function Bn(t,e){return t.isStaleByTime(e.staleTime)}function ta(t,e,n){return n.keepPreviousData?!1:n.placeholderData!==void 0?e.isPlaceholderData:!Pt(t.getCurrentResult(),e)}class na extends Ee{constructor(e,n){super(),this.client=e,this.setOptions(n),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var n;const r=this.options;this.options=this.client.defaultMutationOptions(e),Pt(r,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(n=this.currentMutation)==null||n.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.currentMutation)==null||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();const n={listeners:!0};e.type==="success"?n.onSuccess=!0:e.type==="error"&&(n.onError=!0),this.notify(n)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,n){return this.mutateOptions=n,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof e<"u"?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const e=this.currentMutation?this.currentMutation.state:ms(),n={...e,isLoading:e.status==="loading",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=n}notify(e){R.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(e.onSuccess){var n,r,s,i;(n=(r=this.mutateOptions).onSuccess)==null||n.call(r,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(s=(i=this.mutateOptions).onSettled)==null||s.call(i,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(e.onError){var a,o,u,l;(a=(o=this.mutateOptions).onError)==null||a.call(o,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(u=(l=this.mutateOptions).onSettled)==null||u.call(l,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)})})}}function ra(t){return{mutationKey:t.options.mutationKey,state:t.state}}function sa(t){return{state:t.state,queryKey:t.queryKey,queryHash:t.queryHash}}function ia(t){return t.state.isPaused}function aa(t){return t.state.status==="success"}function oa(t,e={}){const n=[],r=[];if(e.dehydrateMutations!==!1){const s=e.shouldDehydrateMutation||ia;t.getMutationCache().getAll().forEach(i=>{s(i)&&n.push(ra(i))})}if(e.dehydrateQueries!==!1){const s=e.shouldDehydrateQuery||aa;t.getQueryCache().getAll().forEach(i=>{s(i)&&r.push(sa(i))})}return{mutations:n,queries:r}}function ua(t,e,n){if(typeof e!="object"||e===null)return;const r=t.getMutationCache(),s=t.getQueryCache(),i=e.mutations||[],a=e.queries||[];i.forEach(o=>{var u;r.build(t,{...n==null||(u=n.defaultOptions)==null?void 0:u.mutations,mutationKey:o.mutationKey},o.state)}),a.forEach(({queryKey:o,state:u,queryHash:l})=>{var c;const d=s.get(l);if(d){if(d.state.dataUpdatedAt"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ba:ya;ws.useSyncExternalStore=we.useSyncExternalStore!==void 0?we.useSyncExternalStore:ma;gs.exports=ws;var Dn=gs.exports;const ga=Dn.useSyncExternalStore,Mr=T.createContext(void 0),vs=T.createContext(!1);function Ps(t,e){return t||(e&&typeof window<"u"?(window.ReactQueryClientContext||(window.ReactQueryClientContext=Mr),window.ReactQueryClientContext):Mr)}const Un=({context:t}={})=>{const e=T.useContext(Ps(t,T.useContext(vs)));if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},wa=({client:t,children:e,context:n,contextSharing:r=!1})=>{T.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]);const s=Ps(n,r);return T.createElement(vs.Provider,{value:!n&&r},T.createElement(s.Provider,{value:t},e))},Cs=T.createContext(!1),va=()=>T.useContext(Cs);Cs.Provider;function Pa(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}const Ca=T.createContext(Pa()),Ea=()=>T.useContext(Ca);function xa(t,e){return typeof t=="function"?t(...e):!!t}function Sa(t,e,n){const r=ls(t,e,n),s=Un({context:r.context}),[i]=T.useState(()=>new na(s,r));T.useEffect(()=>{i.setOptions(r)},[i,r]);const a=ga(T.useCallback(u=>i.subscribe(R.batchCalls(u)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=T.useCallback((u,l)=>{i.mutate(u,l).catch(Oa)},[i]);if(a.error&&xa(i.options.useErrorBoundary,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function Oa(){}const Aa=["added","removed","updated"];function $r(t){return Aa.includes(t)}async function Ta({queryClient:t,persister:e,maxAge:n=1e3*60*60*24,buster:r="",hydrateOptions:s}){try{const i=await e.restoreClient();if(i)if(i.timestamp){const a=Date.now()-i.timestamp>n,o=i.buster!==r;a||o?e.removeClient():ua(t,i.clientState,s)}else e.removeClient()}catch{e.removeClient()}}async function jr({queryClient:t,persister:e,buster:n="",dehydrateOptions:r}){const s={buster:n,timestamp:Date.now(),clientState:oa(t,r)};await e.persistClient(s)}function ka(t){const e=t.queryClient.getQueryCache().subscribe(r=>{$r(r.type)&&jr(t)}),n=t.queryClient.getMutationCache().subscribe(r=>{$r(r.type)&&jr(t)});return()=>{e(),n()}}function Fa(t){let e=!1,n;const r=()=>{e=!0,n==null||n()},s=Ta(t).then(()=>{e||(n=ka(t))});return[r,s]}function Es(t,e={}){const{fees:n=t.fees,formatters:r=t.formatters,serializers:s=t.serializers}=e;return{...t,fees:n,formatters:r,serializers:s}}const Ia="1.21.3",Ra=t=>t,It=t=>t,Ma=()=>`viem@${Ia}`;class x extends Error{constructor(e,n={}){var i;super(),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:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:Ma()});const r=n.cause instanceof x?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,s=n.cause instanceof x&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://viem.sh${s}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(` `),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return xs(this,e)}}function xs(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t?xs(t.cause,e):e?null:t}class $a extends x{constructor({max:e,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class ja extends x{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"})}}class qa extends x{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}function H(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function $(t){return H(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function le(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;sn*2)throw new Os({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function Na(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new Os({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;se.toString(16).padStart(2,"0"));function Y(t,e={}){return typeof t=="number"||typeof t=="bigint"?k(t,e):typeof t=="string"?Ln(t,e):typeof t=="boolean"?As(t,e):Ne(t,e)}function As(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(ie(n,{size:e.size}),xe(n,{size:e.size})):n}function Ne(t,e={}){let n="";for(let s=0;si||s=V.zero&&t<=V.nine)return t-V.zero;if(t>=V.A&&t<=V.F)return t-(V.A-10);if(t>=V.a&&t<=V.f)return t-(V.a-10)}function zn(t,e={}){let n=t;e.size&&(ie(n,{size:e.size}),n=xe(n,{dir:"right",size:e.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let a=0,o=0;ae)throw new qa({givenSize:$(t),maxSize:e})}function Rt(t,e={}){const{signed:n}=e;e.size&&ie(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,i=(1n<{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e}function Is(t){var n;const e=(n=t.transactions)==null?void 0:n.map(r=>typeof r=="string"?r:Fs(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,difficulty:t.difficulty?BigInt(t.difficulty):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}function W(t,{args:e,eventName:n}={}){return{...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,logIndex:t.logIndex?Number(t.logIndex):null,transactionHash:t.transactionHash?t.transactionHash:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,...n?{args:e,eventName:n}:{}}}const Ga={"0x0":"reverted","0x1":"success"};function Wa(t){return{...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs?t.logs.map(e=>W(e)):null,to:t.to?t.to:null,transactionIndex:t.transactionIndex?j(t.transactionIndex):null,status:t.status?Ga[t.status]:null,type:t.type?ks[t.type]||t.type:null}}const Qa={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function Mt(t){return{...t,gas:typeof t.gas<"u"?k(t.gas):void 0,gasPrice:typeof t.gasPrice<"u"?k(t.gasPrice):void 0,maxFeePerGas:typeof t.maxFeePerGas<"u"?k(t.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof t.maxPriorityFeePerGas<"u"?k(t.maxPriorityFeePerGas):void 0,nonce:typeof t.nonce<"u"?k(t.nonce):void 0,type:typeof t.type<"u"?Qa[t.type]:void 0,value:typeof t.value<"u"?k(t.value):void 0}}class _e extends x{constructor({address:e}){super(`Address "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class fn extends x{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}let Ha=class extends x{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}};class Ka extends x{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(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}class Rs extends x{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}const Va={gwei:9,wei:18},Ja={ether:-9,wei:9},Za={ether:-18,gwei:-9};function xt(t,e){let n=t.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,i]=[n.slice(0,n.length-e),n.slice(n.length-e)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${i?`.${i}`:""}`}function B(t,e="wei"){return xt(t,Ja[e])}class ye extends x{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(ye,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class St extends x{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${B(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}Object.defineProperty(St,"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 hn extends x{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${B(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}Object.defineProperty(hn,"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 pn extends x{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(pn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class yn extends x{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(yn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class bn extends x{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(bn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class mn extends x{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:e,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."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}Object.defineProperty(mn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class gn extends x{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}Object.defineProperty(gn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class wn extends x{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(wn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class vn extends x{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}Object.defineProperty(vn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Ot extends x{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${B(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${B(r)} gwei`:""}).`].join(` `),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(Ot,"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 $t extends x{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}const Xa=/^0x[a-fA-F0-9]{40}$/;function K(t){return Xa.test(t)}function Z(t){return typeof t[0]=="string"?Gn(t):Ya(t)}function Ya(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function Gn(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}function eo(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const Nr=/^tuple(?(\[(\d*)\])*)$/;function Pn(t){let e=t.type;if(Nr.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s{var s;return((s=t[e.name||n])==null?void 0:s.call(t,r))??e(t,r)}}function X(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new bo(t.type);return`${t.name}(${jt(t.inputs,{includeName:e})})`}function jt(t,{includeName:e=!1}={}){return t?t.map(n=>no(n,{includeName:e})).join(e?", ":","):""}function no(t,{includeName:e}){return t.type.startsWith("tuple")?`(${jt(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class ro extends x{constructor({docsPath:e}){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:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class _r extends x{constructor({docsPath:e}){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:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Wn extends x{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(` `),{metaMessages:[`Params: (${jt(n,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"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=e,this.params=n,this.size=r}}class qt extends x{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class so extends x{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class io extends x{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${$(n)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class ao extends x{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class Ms extends x{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" 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=${e}.`].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class oo extends x{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}}class uo extends x{constructor(e,{docsPath:n}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class Br extends x{constructor(e,{docsPath:n}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class At extends x{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class co extends x{constructor(e,{docsPath:n}){super([`Function "${e}" 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:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class lo extends x{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${X(e.abiItem)}\`, and`,`\`${n.type}\` in \`${X(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class fo extends x{constructor({expectedSize:e,givenSize:n}){super(`Expected bytes${e}, got bytes${n}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class de extends x{constructor({abiItem:e,data:n,params:r,size:s}){super([`Data size of ${s} bytes is too small for non-indexed event parameters.`].join(` `),{metaMessages:[`Params: (${jt(r,{includeName:!0})})`,`Data: ${n} (${s} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),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.abiItem=e,this.data=n,this.params=r,this.size=s}}class Se extends x{constructor({abiItem:e,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${X(e,{includeName:!0})}".`].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class ho extends x{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class po extends x{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(` `),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class yo extends x{constructor(e){super([`Value "${e}" is not a valid array.`].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class bo extends x{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class mo extends x{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}function go(t){let e=!0,n="",r=0,s="",i=!1;for(let a=0;a{const e=typeof t=="string"?t:to(t);return go(e)},wo=t=>$s(t);function Dr(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function js(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Ur(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function vo(t,e){js(t);const n=e.outputLen;if(t.length>Lr&ht)}:{h:Number(t>>Lr&ht)|0,l:Number(t&ht)|0}}function Co(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let s=0;st<>>32-n,xo=(t,e,n)=>e<>>32-n,So=(t,e,n)=>e<>>64-n,Oo=(t,e,n)=>t<>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ao=t=>t instanceof Uint8Array,To=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),ko=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!ko)throw new Error("Non little-endian hardware is not supported");function Fo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function qs(t){if(typeof t=="string"&&(t=Fo(t)),!Ao(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}class Io{clone(){return this._cloneInto()}}function Ro(t){const e=r=>t().update(qs(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}const[Ns,_s,Bs]=[[],[],[]],Mo=BigInt(0),Re=BigInt(1),$o=BigInt(2),jo=BigInt(7),qo=BigInt(256),No=BigInt(113);for(let t=0,e=Re,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],Ns.push(2*(5*r+n)),_s.push((t+1)*(t+2)/2%64);let s=Mo;for(let i=0;i<7;i++)e=(e<>jo)*No)%qo,e&$o&&(s^=Re<<(Re<n>32?So(t,e,n):Eo(t,e,n),Gr=(t,e,n)=>n>32?Oo(t,e,n):xo(t,e,n);function Do(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let a=0;a<10;a++)n[a]=t[a]^t[a+10]^t[a+20]^t[a+30]^t[a+40];for(let a=0;a<10;a+=2){const o=(a+8)%10,u=(a+2)%10,l=n[u],c=n[u+1],d=zr(l,c,1)^n[o],h=Gr(l,c,1)^n[o+1];for(let p=0;p<50;p+=10)t[a+p]^=d,t[a+p+1]^=h}let s=t[2],i=t[3];for(let a=0;a<24;a++){const o=_s[a],u=zr(s,i,o),l=Gr(s,i,o),c=Ns[a];s=t[c],i=t[c+1],t[c]=u,t[c+1]=l}for(let a=0;a<50;a+=10){for(let o=0;o<10;o++)n[o]=t[a+o];for(let o=0;o<10;o++)t[a+o]^=~n[(o+2)%10]&n[(o+4)%10]}t[0]^=_o[r],t[1]^=Bo[r]}n.fill(0)}class Qn extends Io{constructor(e,n,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Dr(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=To(this.state)}keccak(){Do(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Ur(this);const{blockLen:n,state:r}=this;e=qs(e);const s=e.length;for(let i=0;i=r&&this.keccak();const a=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+a),s),this.posOut+=a,s+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Dr(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(vo(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:a}=this;return e||(e=new Qn(n,r,s,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=a,e.destroyed=this.destroyed,e}}const Uo=(t,e,n)=>Ro(()=>new Qn(e,t,n)),Lo=Uo(1,136,256/8);function q(t,e){const n=e||"hex",r=Lo(H(t,{strict:!1})?ne(t):t);return n==="bytes"?r:Y(r)}const zo=t=>q(ne(t)),Hn=t=>zo(wo(t));function M(t,e,n,{strict:r}={}){return H(t,{strict:!1})?Wo(t,e,n,{strict:r}):Go(t,e,n,{strict:r})}function Ds(t,e){if(typeof e=="number"&&e>0&&e>$(t)-1)throw new Ss({offset:e,position:"start",size:$(t)})}function Us(t,e,n){if(typeof e=="number"&&typeof n=="number"&&$(t)!==n-e)throw new Ss({offset:n,position:"end",size:$(t)})}function Go(t,e,n,{strict:r}={}){Ds(t,e);const s=t.slice(e,n);return r&&Us(s,e,n),s}function Wo(t,e,n,{strict:r}={}){Ds(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&Us(s,e,n),s}function nt(t,e){if(t.length!==e.length)throw new ao({expectedLength:t.length,givenLength:e.length});const n=Qo({params:t,values:e}),r=Vn(n);return r.length===0?"0x":r}function Qo({params:t,values:e}){const n=[];for(let r=0;r0?Z([o,a]):o}}if(s)return{dynamic:!0,encoded:a}}return{dynamic:!1,encoded:Z(i.map(({encoded:a})=>a))}}function Vo(t,{param:e}){const[,n]=e.type.split("bytes"),r=$(t);if(!n){let s=t;return r%32!==0&&(s=te(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:Z([te(k(r,{size:32})),s])}}if(r!==parseInt(n))throw new io({expectedSize:parseInt(n),value:t});return{dynamic:!1,encoded:te(t,{dir:"right"})}}function Jo(t){return{dynamic:!1,encoded:te(As(t))}}function Zo(t,{signed:e}){return{dynamic:!1,encoded:k(t,{size:32,signed:e})}}function Xo(t){const e=Ln(t),n=Math.ceil($(e)/32),r=[];for(let s=0;ss))}}function Nt(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const eu=t=>q(ne(t)),Jn=t=>M(eu($s(t)),0,4);function rt({abi:t,args:e=[],name:n}){const r=H(n,{strict:!1}),s=t.filter(a=>r?a.type==="function"?Jn(a)===n:a.type==="event"?Hn(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const a of s){if(!("inputs"in a))continue;if(!e||e.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==e.length)continue;if(e.every((u,l)=>{const c="inputs"in a&&a.inputs[l];return c?Cn(u,c):!1})){if(i&&"inputs"in i&&i.inputs){const u=Ls(a.inputs,i.inputs,e);if(u)throw new lo({abiItem:a,type:u[0]},{abiItem:i,type:u[1]})}i=a}}return i||s[0]}function Cn(t,e){const n=typeof t,r=e.type;switch(r){case"address":return K(t);case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,i)=>Cn(Object.values(t)[i],s)):/^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(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>Cn(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ls(t,e,n){for(const r in t){const s=t[r],i=e[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return Ls(s.components,i.components,n[r]);const a=[s.type,i.type];if(a.includes("address")&&a.includes("bytes20")?!0:a.includes("address")&&a.includes("string")||a.includes("address")&&a.includes("bytes")?K(n[r]):!1)return a}}function st({abi:t,eventName:e,args:n}){var o;let r=t[0];if(e&&(r=rt({abi:t,args:n,name:e}),!r))throw new Br(e,{docsPath:"/docs/contract/encodeEventTopics"});if(r.type!=="event")throw new Br(void 0,{docsPath:"/docs/contract/encodeEventTopics"});const s=X(r),i=Hn(s);let a=[];if(n&&"inputs"in r){const u=(o=r.inputs)==null?void 0:o.filter(c=>"indexed"in c&&c.indexed),l=Array.isArray(n)?n:Object.values(n).length>0?(u==null?void 0:u.map(c=>n[c.name]))??[]:[];l.length>0&&(a=(u==null?void 0:u.map((c,d)=>Array.isArray(l[d])?l[d].map((h,p)=>Wr({param:c,value:l[d][p]})):l[d]?Wr({param:c,value:l[d]}):null))??[])}return[i,...a]}function Wr({param:t,value:e}){if(t.type==="string"||t.type==="bytes")return q(ne(e));if(t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/))throw new mo(t.type);return nt([t],[e])}function _t(t,{method:e}){var r,s;const n={};return t.transport.type==="fallback"&&((s=(r=t.transport).onResponse)==null||s.call(r,({method:i,response:a,status:o,transport:u})=>{o==="success"&&e===i&&(n[a]=u.request)})),i=>n[i]||t.request}async function zs(t,{address:e,abi:n,args:r,eventName:s,fromBlock:i,strict:a,toBlock:o}){const u=_t(t,{method:"eth_newFilter"}),l=s?st({abi:n,args:r,eventName:s}):void 0,c=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof i=="bigint"?k(i):i,toBlock:typeof o=="bigint"?k(o):o,topics:l}]});return{abi:n,args:r,eventName:s,id:c,request:u(c),strict:a,type:"event"}}function G(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}function ae({abi:t,args:e,functionName:n}){let r=t[0];if(n&&(r=rt({abi:t,args:e,name:n}),!r))throw new At(n,{docsPath:"/docs/contract/encodeFunctionData"});if(r.type!=="function")throw new At(void 0,{docsPath:"/docs/contract/encodeFunctionData"});const s=X(r),i=Jn(s),a="inputs"in r&&r.inputs?nt(r.inputs,e??[]):void 0;return Gn([i,a??"0x"])}const Gs={1:"An `assert` condition failed.",17:"Arithmic 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."},tu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},nu={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Zn(t,e){const n=t.substring(2).toLowerCase(),r=q(J(n),"bytes"),s=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&s[i]&&(s[i]=s[i].toUpperCase()),(r[i>>1]&15)>=8&&s[i+1]&&(s[i+1]=s[i+1].toUpperCase());return`0x${s.join("")}`}function be(t,e){if(!K(t))throw new _e({address:t});return Zn(t)}function Bt(t,e){if(e==="0x"&&t.length>0)throw new qt;if($(e)&&$(e)<32)throw new Wn({data:e,params:t,size:$(e)});return ru({data:e,params:t})}function ru({data:t,params:e}){const n=[];let r=0;for(let s=0;s=$(t))throw new Wn({data:t,params:e,size:$(t)});const i=e[s],{consumed:a,value:o}=me({data:t,param:i,position:r});n.push(o),r+=a}return n}function me({data:t,param:e,position:n}){const r=Nt(e.type);if(r){const[i,a]=r;return iu(t,{length:i,param:{...e,type:a},position:n})}if(e.type==="tuple")return lu(t,{param:e,position:n});if(e.type==="string")return cu(t,{position:n});if(e.type.startsWith("bytes"))return ou(t,{param:e,position:n});const s=M(t,n,n+32,{strict:!0});if(e.type.startsWith("uint")||e.type.startsWith("int"))return uu(s,{param:e});if(e.type==="address")return su(s);if(e.type==="bool")return au(s);throw new po(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function su(t){return{consumed:32,value:Zn(M(t,-20))}}function iu(t,{param:e,length:n,position:r}){if(!n){const a=j(M(t,r,r+32,{strict:!0})),o=j(M(t,a,a+32,{strict:!0}));let u=0;const l=[];for(let c=0;c48?Rt(t,{signed:n}):j(t,{signed:n})}}function cu(t,{position:e}){const n=j(M(t,e,e+32,{strict:!0})),r=j(M(t,n,n+32,{strict:!0}));return r===0?{consumed:32,value:""}:{consumed:32,value:Ts(le(M(t,n+32,n+32+r,{strict:!0})))}}function lu(t,{param:e,position:n}){const r=e.components.length===0||e.components.some(({name:a})=>!a),s=r?[]:{};let i=0;if(Tt(e)){const a=j(M(t,n,n+32,{strict:!0}));for(let o=0;oi.type==="error"&&n===Jn(X(i)));if(!s)throw new Ms(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?Bt(s.inputs,M(e,4)):void 0,errorName:s.name}}const N=(t,e,n)=>JSON.stringify(t,(r,s)=>{const i=typeof s=="bigint"?s.toString():s;return typeof e=="function"?e(r,i):i},n);function Ws({abiItem:t,args:e,includeFunctionName:n=!0,includeName:r=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,i)=>`${r&&s.name?`${s.name}: `:""}${typeof e[i]=="object"?N(e[i]):e[i]}`).join(", ")})`}function Xn(t,e="wei"){return xt(t,Va[e])}function it(t){const e=Object.entries(t).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=e.reduce((r,[s])=>Math.max(r,s.length),0);return e.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(` `)}class fu extends x{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(` `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class hu extends x{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",it(e),"}","","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","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class pu extends x{constructor(e,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h}){var f;const p=it({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${Xn(h)} ${((f=s==null?void 0:s.nativeCurrency)==null?void 0:f.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${B(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${B(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${B(l)} gwei`,nonce:c});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=e}}class Qs extends x{constructor({blockHash:e,blockNumber:n,blockTag:r,hash:s,index:i}){let a="Transaction";r&&i!==void 0&&(a=`Transaction at block time "${r}" at index "${i}"`),e&&i!==void 0&&(a=`Transaction at block hash "${e}" at index "${i}"`),n&&i!==void 0&&(a=`Transaction at block number "${n}" at index "${i}"`),s&&(a=`Transaction with hash "${s}"`),super(`${a} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class Hs extends x{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}}class yu extends x{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}}class Ks extends x{constructor(e,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h}){var b;const p=n?G(n):void 0,f=it({from:p==null?void 0:p.address,to:d,value:typeof h<"u"&&`${Xn(h)} ${((b=s==null?void 0:s.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${B(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${B(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${B(l)} gwei`,nonce:c});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",f].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}}class Yn extends x{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:i,functionName:a,sender:o}){const u=rt({abi:n,args:r,name:a}),l=u?Ws({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,c=u?X(u,{includeName:!0}):void 0,d=it({address:s&&Ra(s),function:c,args:l&&l!=="()"&&`${[...Array((a==null?void 0:a.length)??0).keys()].map(()=>" ").join("")}${l}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",d].filter(Boolean)}),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}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=n,this.args=r,this.cause=e,this.contractAddress=s,this.functionName=a,this.sender=o}}class En extends x{constructor({abi:e,data:n,functionName:r,message:s}){let i,a,o,u;if(n&&n!=="0x")try{a=du({abi:e,data:n});const{abiItem:c,errorName:d,args:h}=a;if(d==="Error")u=h[0];else if(d==="Panic"){const[p]=h;u=Gs[p]}else{const p=c?X(c,{includeName:!0}):void 0,f=c&&h?Ws({abiItem:c,args:h,includeFunctionName:!1,includeName:!1}):void 0;o=[p?`Error: ${p}`:"",f&&f!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${f}`:""]}}catch(c){i=c}else s&&(u=s);let l;i instanceof Ms&&(l=i.signature,o=[`Unable to decode signature "${l}" 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=${l}.`]),super(u&&u!=="execution reverted"||l?[`The contract function "${r}" reverted with the following ${l?"signature":"reason"}:`,u||l].join(` `):`The contract function "${r}" reverted.`,{cause:i,metaMessages:o}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"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=a,this.reason=u,this.signature=l}}class bu extends x{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}}class er extends x{constructor({data:e,message:n}){super(n||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class je extends x{constructor({body:e,details:n,headers:r,status:s,url:i}){super("HTTP request failed.",{details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${It(i)}`,e&&`Request body: ${N(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"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=e,this.headers=r,this.status=s,this.url=i}}class mu extends x{constructor({body:e,details:n,url:r}){super("WebSocket request failed.",{details:n,metaMessages:[`URL: ${It(r)}`,`Request body: ${N(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"})}}class tr extends x{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${It(r)}`,`Request body: ${N(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code}}class xn extends x{constructor({body:e,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${It(n)}`,`Request body: ${N(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}const gu=-1;class D extends x{constructor(e,{code:n,docsPath:r,metaMessages:s,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof tr?e.code:n??gu}}class Oe extends D{constructor(e,n){super(e,n),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class Be extends D{constructor(e){super(e,{code:Be.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class De extends D{constructor(e){super(e,{code:De.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(De,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Ue extends D{constructor(e){super(e,{code:Ue.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(Ue,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Le extends D{constructor(e){super(e,{code:Le.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(` `)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(Le,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ve extends D{constructor(e){super(e,{code:ve.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(ve,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class fe extends D{constructor(e){super(e,{code:fe.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(` `)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(fe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ze extends D{constructor(e){super(e,{code:ze.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Pe extends D{constructor(e){super(e,{code:Pe.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(Pe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Ge extends D{constructor(e){super(e,{code:Ge.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class We extends D{constructor(e){super(e,{code:We.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(We,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Qe extends D{constructor(e){super(e,{code:Qe.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(Qe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class He extends D{constructor(e){super(e,{code:He.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(He,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Q extends Oe{constructor(e){super(e,{code:Q.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(Q,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Ke extends Oe{constructor(e){super(e,{code:Ke.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(Ke,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Ve extends Oe{constructor(e){super(e,{code:Ve.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(Ve,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Je extends Oe{constructor(e){super(e,{code:Je.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(Je,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Ze extends Oe{constructor(e){super(e,{code:Ze.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(Ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Ce extends Oe{constructor(e){super(e,{code:Ce.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(Ce,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class wu extends D{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}const vu=3;function Xe(t,{abi:e,address:n,args:r,docsPath:s,functionName:i,sender:a}){const{code:o,data:u,message:l,shortMessage:c}=t instanceof er?t:t instanceof x?t.walk(h=>"data"in h)||t.walk():{},d=t instanceof qt?new bu({functionName:i}):[vu,ve.code].includes(o)&&(u||l||c)?new En({abi:e,data:typeof u=="object"?u.data:u,functionName:i,message:c??l}):t;return new Yn(d,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:i,sender:a})}class Ae extends x{constructor({docsPath:e}={}){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 WalletClient."].join(` `),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class Pu extends x{constructor(e,{account:n,docsPath:r,chain:s,data:i,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h}){var f;const p=it({from:n==null?void 0:n.address,to:d,value:typeof h<"u"&&`${Xn(h)} ${((f=s==null?void 0:s.nativeCurrency)==null?void 0:f.symbol)||"ETH"}`,data:i,gas:a,gasPrice:typeof o<"u"&&`${B(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${B(u)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${B(l)} gwei`,nonce:c});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}function nr(t,e){const n=(t.details||"").toLowerCase(),r=t.walk(s=>s.code===ye.code);return r instanceof x?new ye({cause:t,message:r.details}):ye.nodeMessage.test(n)?new ye({cause:t,message:t.details}):St.nodeMessage.test(n)?new St({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):hn.nodeMessage.test(n)?new hn({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):pn.nodeMessage.test(n)?new pn({cause:t,nonce:e==null?void 0:e.nonce}):yn.nodeMessage.test(n)?new yn({cause:t,nonce:e==null?void 0:e.nonce}):bn.nodeMessage.test(n)?new bn({cause:t,nonce:e==null?void 0:e.nonce}):mn.nodeMessage.test(n)?new mn({cause:t}):gn.nodeMessage.test(n)?new gn({cause:t,gas:e==null?void 0:e.gas}):wn.nodeMessage.test(n)?new wn({cause:t,gas:e==null?void 0:e.gas}):vn.nodeMessage.test(n)?new vn({cause:t}):Ot.nodeMessage.test(n)?new Ot({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new $t({cause:t})}function Cu(t,{docsPath:e,...n}){const r=(()=>{const s=nr(t,n);return s instanceof $t?t:s})();return new Pu(r,{docsPath:e,...n})}function rr(t,{format:e}){if(!e)return{};const n={};function r(i){const a=Object.keys(i);for(const o of a)o in t&&(n[o]=t[o]),i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])&&r(i[o])}const s=e(t||{});return r(s),n}function at(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:i}=t,a=e?G(e):void 0;if(a&&!K(a.address))throw new _e({address:a.address});if(i&&!K(i))throw new _e({address:i});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new fu;if(r&&r>2n**256n-1n)throw new St({maxFeePerGas:r});if(s&&r&&s>r)throw new Ot({maxFeePerGas:r,maxPriorityFeePerGas:s})}class Eu extends x{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class sr extends x{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class xu extends x{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${B(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Vs extends x{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function re(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var c,d,h;const i=r??"latest",a=s??!1,o=n!==void 0?k(n):void 0;let u=null;if(e?u=await t.request({method:"eth_getBlockByHash",params:[e,a]}):u=await t.request({method:"eth_getBlockByNumber",params:[o||i,a]}),!u)throw new Vs({blockHash:e,blockNumber:n});return(((h=(d=(c=t.chain)==null?void 0:c.formatters)==null?void 0:d.block)==null?void 0:h.format)||Is)(u)}async function ir(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Su(t,e){return Js(t,e)}async function Js(t,e){var i,a,o;const{block:n,chain:r=t.chain,request:s}=e||{};if(typeof((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee)=="function"){const u=n||await O(t,re,"getBlock")({});return r.fees.defaultPriorityFee({block:u,client:t,request:s})}if(typeof((a=r==null?void 0:r.fees)==null?void 0:a.defaultPriorityFee)<"u")return(o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee;try{const u=await t.request({method:"eth_maxPriorityFeePerGas"});return Rt(u)}catch{const[u,l]=await Promise.all([n?Promise.resolve(n):O(t,re,"getBlock")({}),O(t,ir,"getGasPrice")({})]);if(typeof u.baseFeePerGas!="bigint")throw new sr;const c=l-u.baseFeePerGas;return c<0n?0n:c}}async function Ou(t,e){return Sn(t,e)}async function Sn(t,e){var h,p;const{block:n,chain:r=t.chain,request:s,type:i="eip1559"}=e||{},a=await(async()=>{var f,b;return typeof((f=r==null?void 0:r.fees)==null?void 0:f.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:t,request:s}):((b=r==null?void 0:r.fees)==null?void 0:b.baseFeeMultiplier)??1.2})();if(a<1)throw new Eu;const u=10**(((h=a.toString().split(".")[1])==null?void 0:h.length)??0),l=f=>f*BigInt(Math.ceil(a*u))/BigInt(u),c=n||await O(t,re,"getBlock")({});if(typeof((p=r==null?void 0:r.fees)==null?void 0:p.estimateFeesPerGas)=="function")return r.fees.estimateFeesPerGas({block:n,client:t,multiply:l,request:s,type:i});if(i==="eip1559"){if(typeof c.baseFeePerGas!="bigint")throw new sr;const f=s!=null&&s.maxPriorityFeePerGas?s.maxPriorityFeePerGas:await Js(t,{block:c,chain:r,request:s}),b=l(c.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??b+f,maxPriorityFeePerGas:f}}return{gasPrice:(s==null?void 0:s.gasPrice)??l(await O(t,ir,"getGasPrice")({}))}}async function Zs(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?k(r):n]});return j(s)}function Au(t){if(t.type)return t.type;if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new hu({transaction:t})}async function Dt(t,e){const{account:n=t.account,chain:r,gas:s,nonce:i,type:a}=e;if(!n)throw new Ae;const o=G(n),u=await O(t,re,"getBlock")({blockTag:"latest"}),l={...e,from:o.address};if(typeof i>"u"&&(l.nonce=await O(t,Zs,"getTransactionCount")({address:o.address,blockTag:"pending"})),typeof a>"u")try{l.type=Au(l)}catch{l.type=typeof u.baseFeePerGas=="bigint"?"eip1559":"legacy"}if(l.type==="eip1559"){const{maxFeePerGas:c,maxPriorityFeePerGas:d}=await Sn(t,{block:u,chain:r,request:l});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas"u"&&(l.gas=await O(t,ar,"estimateGas")({...l,account:{address:o.address,type:"json-rpc"}})),at(l),l}async function ar(t,e){var s,i,a;const n=e.account??t.account;if(!n)throw new Ae({docsPath:"/docs/actions/public/estimateGas"});const r=G(n);try{const{accessList:o,blockNumber:u,blockTag:l,data:c,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,to:y,value:m,...g}=r.type==="local"?await Dt(t,e):e,E=(u?k(u):void 0)||l;at(e);const C=(a=(i=(s=t.chain)==null?void 0:s.formatters)==null?void 0:i.transactionRequest)==null?void 0:a.format,P=(C||Mt)({...rr(g,{format:C}),from:r.address,accessList:o,data:c,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,to:y,value:m}),S=await t.request({method:"eth_estimateGas",params:E?[P,E]:[P]});return BigInt(S)}catch(o){throw Cu(o,{...e,account:r,chain:t.chain})}}async function Tu(t,{abi:e,address:n,args:r,functionName:s,...i}){const a=ae({abi:e,args:r,functionName:s});try{return await O(t,ar,"estimateGas")({data:a,to:n,...i})}catch(o){const u=i.account?G(i.account):void 0;throw Xe(o,{abi:e,address:n,args:r,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:u==null?void 0:u.address})}}const Qr="/docs/contract/decodeEventLog";function ot({abi:t,data:e,strict:n,topics:r}){const s=n??!0,[i,...a]=r;if(!i)throw new oo({docsPath:Qr});const o=t.find(f=>f.type==="event"&&i===Hn(X(f)));if(!(o&&"name"in o)||o.type!=="event")throw new uo(i,{docsPath:Qr});const{name:u,inputs:l}=o,c=l==null?void 0:l.some(f=>!("name"in f&&f.name));let d=c?[]:{};const h=l.filter(f=>"indexed"in f&&f.indexed);for(let f=0;f!("indexed"in f&&f.indexed));if(p.length>0){if(e&&e!=="0x")try{const f=Bt(p,e);if(f)if(c)d=[...d,...f];else for(let b=0;b0?d:void 0}}function ku({param:t,value:e}){return t.type==="string"||t.type==="bytes"||t.type==="tuple"||t.type.match(/^(.*)\[(\d+)?\]$/)?e:(Bt([t],e)||[])[0]}async function or(t,{address:e,blockHash:n,fromBlock:r,toBlock:s,event:i,events:a,args:o,strict:u}={}){const l=u??!1,c=a??(i?[i]:void 0);let d=[];c&&(d=[c.flatMap(p=>st({abi:[p],eventName:p.name,args:o}))],i&&(d=d[0]));let h;return n?h=await t.request({method:"eth_getLogs",params:[{address:e,topics:d,blockHash:n}]}):h=await t.request({method:"eth_getLogs",params:[{address:e,topics:d,fromBlock:typeof r=="bigint"?k(r):r,toBlock:typeof s=="bigint"?k(s):s}]}),h.map(p=>{var f;try{const{eventName:b,args:y}=c?ot({abi:c,data:p.data,topics:p.topics,strict:l}):{eventName:void 0,args:void 0};return W(p,{args:y,eventName:b})}catch(b){let y,m;if(b instanceof de||b instanceof Se){if(l)return;y=b.abiItem.name,m=(f=b.abiItem.inputs)==null?void 0:f.some(g=>!("name"in g&&g.name))}return W(p,{args:m?[]:{},eventName:y})}}).filter(Boolean)}async function Xs(t,{abi:e,address:n,args:r,blockHash:s,eventName:i,fromBlock:a,toBlock:o,strict:u}){const l=i?rt({abi:e,name:i}):void 0,c=l?void 0:e.filter(d=>d.type==="event");return O(t,or,"getLogs")({address:n,args:r,blockHash:s,event:l,events:c,fromBlock:a,toBlock:o,strict:u})}const Zt="/docs/contract/decodeFunctionResult";function Te({abi:t,args:e,functionName:n,data:r}){let s=t[0];if(n&&(s=rt({abi:t,args:e,name:n}),!s))throw new At(n,{docsPath:Zt});if(s.type!=="function")throw new At(void 0,{docsPath:Zt});if(!s.outputs)throw new co(s.name,{docsPath:Zt});const i=Bt(s.outputs,r);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const On=[{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"}],Ys=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],ei=[...Ys,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Fu=[...Ys,{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"}]}],Hr=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Kr=[{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"}]}],Iu=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],Ru="0x82ad56cb";function ke({blockNumber:t,chain:e,contract:n}){var s;const r=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!r)throw new fn({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new fn({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function Mu(t,{docsPath:e,...n}){const r=(()=>{const s=nr(t,n);return s instanceof $t?t:s})();return new Ks(r,{docsPath:e,...n})}const Xt=new Map;function ur({fn:t,id:e,shouldSplitBatch:n,wait:r=0,sort:s}){const i=async()=>{const c=u();a();const d=c.map(({args:h})=>h);d.length!==0&&t(d).then(h=>{var p;s&&Array.isArray(h)&&h.sort(s);for(let f=0;f{var p;for(let f=0;fXt.delete(e),o=()=>u().map(({args:c})=>c),u=()=>Xt.get(e)||[],l=c=>Xt.set(e,[...u(),c]);return{flush:a,async schedule(c){const d={},h=new Promise((b,y)=>{d.resolve=b,d.reject=y});return(n==null?void 0:n([...o(),c]))&&i(),u().length>0?(l({args:c,pendingPromise:d}),h):(l({args:c,pendingPromise:d}),setTimeout(i,r),h)}}}async function Ut(t,e){var m,g,w,E;const{account:n=t.account,batch:r=!!((m=t.batch)!=null&&m.multicall),blockNumber:s,blockTag:i="latest",accessList:a,data:o,gas:u,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:h,to:p,value:f,...b}=e,y=n?G(n):void 0;try{at(e);const v=(s?k(s):void 0)||i,P=(E=(w=(g=t.chain)==null?void 0:g.formatters)==null?void 0:w.transactionRequest)==null?void 0:E.format,A=(P||Mt)({...rr(b,{format:P}),from:y==null?void 0:y.address,accessList:a,data:o,gas:u,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:h,to:p,value:f});if(r&&$u({request:A}))try{return await ju(t,{...A,blockNumber:s,blockTag:i})}catch(F){if(!(F instanceof Rs)&&!(F instanceof fn))throw F}const I=await t.request({method:"eth_call",params:v?[A,v]:[A]});return I==="0x"?{data:void 0}:{data:I}}catch(C){const v=qu(C),{offchainLookup:P,offchainLookupSignature:S}=await qn(async()=>{const{offchainLookup:A,offchainLookupSignature:I}=await import("./ccip-tY4qhF3l.js");return{offchainLookup:A,offchainLookupSignature:I}},__vite__mapDeps([0,1,2,3]));if((v==null?void 0:v.slice(0,10))===S&&p)return{data:await P(t,{data:v,to:p})};throw Mu(C,{...e,account:y,chain:t.chain})}}function $u({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(Ru)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function ju(t,e){var b;const{batchSize:n=1024,wait:r=0}=typeof((b=t.batch)==null?void 0:b.multicall)=="object"?t.batch.multicall:{},{blockNumber:s,blockTag:i="latest",data:a,multicallAddress:o,to:u}=e;let l=o;if(!l){if(!t.chain)throw new Rs;l=ke({blockNumber:s,chain:t.chain,contract:"multicall3"})}const d=(s?k(s):void 0)||i,{schedule:h}=ur({id:`${t.uid}.${d}`,wait:r,shouldSplitBatch(y){return y.reduce((g,{data:w})=>g+(w.length-2),0)>n*2},fn:async y=>{const m=y.map(E=>({allowFailure:!0,callData:E.data,target:E.to})),g=ae({abi:On,args:[m],functionName:"aggregate3"}),w=await t.request({method:"eth_call",params:[{data:g,to:l},d]});return Te({abi:On,args:[m],functionName:"aggregate3",data:w||"0x"})}}),[{returnData:p,success:f}]=await h({data:a,to:u});if(!f)throw new er({data:p});return p==="0x"?{data:void 0}:{data:p}}function qu(t){if(!(t instanceof x))return;const e=t.walk();return typeof e.data=="object"?e.data.data:e.data}async function se(t,{abi:e,address:n,args:r,functionName:s,...i}){const a=ae({abi:e,args:r,functionName:s});try{const{data:o}=await O(t,Ut,"call")({data:a,to:n,...i});return Te({abi:e,args:r,functionName:s,data:o||"0x"})}catch(o){throw Xe(o,{abi:e,address:n,args:r,docsPath:"/docs/contract/readContract",functionName:s})}}async function Nu(t,{abi:e,address:n,args:r,dataSuffix:s,functionName:i,...a}){const o=a.account?G(a.account):void 0,u=ae({abi:e,args:r,functionName:i});try{const{data:l}=await O(t,Ut,"call")({batch:!1,data:`${u}${s?s.replace("0x",""):""}`,to:n,...a});return{result:Te({abi:e,args:r,functionName:i,data:l||"0x"}),request:{abi:e,address:n,args:r,dataSuffix:s,functionName:i,...a}}}catch(l){throw Xe(l,{abi:e,address:n,args:r,docsPath:"/docs/contract/simulateContract",functionName:i,sender:o==null?void 0:o.address})}}const Yt=new Map,Vr=new Map;let _u=0;function Fe(t,e,n){const r=++_u,s=()=>Yt.get(t)||[],i=()=>{const c=s();Yt.set(t,c.filter(d=>d.id!==r))},a=()=>{const c=Vr.get(t);s().length===1&&c&&c(),i()},o=s();if(Yt.set(t,[...o,{id:r,fns:e}]),o&&o.length>0)return a;const u={};for(const c in e)u[c]=(...d)=>{var p,f;const h=s();if(h.length!==0)for(const b of h)(f=(p=b.fns)[c])==null||f.call(p,...d)};const l=n(u);return typeof l=="function"&&Vr.set(t,l),a}async function kt(t){return new Promise(e=>setTimeout(e,t))}function ut(t,{emitOnBegin:e,initialWaitTime:n,interval:r}){let s=!0;const i=()=>s=!1;return(async()=>{let o;e&&(o=await t({unpoll:i}));const u=await(n==null?void 0:n(o))??r;await kt(u);const l=async()=>{s&&(await t({unpoll:i}),await kt(r),l())};l()})(),i}const Bu=new Map,Du=new Map;function Uu(t){const e=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:a=>i.set(s,a)}),n=e(t,Bu),r=e(t,Du);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function Lu(t,{cacheKey:e,cacheTime:n=1/0}){const r=Uu(e),s=r.response.get();if(s&&n>0&&new Date().getTime()-s.created.getTime()`blockNumber.${t}`;async function ct(t,{cacheTime:e=t.cacheTime,maxAge:n}={}){const r=await Lu(()=>t.request({method:"eth_blockNumber"}),{cacheKey:zu(t.uid),cacheTime:n??e});return BigInt(r)}async function Lt(t,{filter:e}){const n="strict"in e&&e.strict;return(await e.request({method:"eth_getFilterChanges",params:[e.id]})).map(s=>{var i;if(typeof s=="string")return s;try{const{eventName:a,args:o}="abi"in e&&e.abi?ot({abi:e.abi,data:s.data,topics:s.topics,strict:n}):{eventName:void 0,args:void 0};return W(s,{args:o,eventName:a})}catch(a){let o,u;if(a instanceof de||a instanceof Se){if("strict"in e&&e.strict)return;o=a.abiItem.name,u=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return W(s,{args:u?[]:{},eventName:o})}}).filter(Boolean)}async function zt(t,{filter:e}){return e.request({method:"eth_uninstallFilter",params:[e.id]})}function Gu(t,{abi:e,address:n,args:r,batch:s=!0,eventName:i,onError:a,onLogs:o,poll:u,pollingInterval:l=t.pollingInterval,strict:c}){return(typeof u<"u"?u:t.transport.type!=="webSocket")?(()=>{const f=N(["watchContractEvent",n,r,s,t.uid,i,l]),b=c??!1;return Fe(f,{onLogs:o,onError:a},y=>{let m,g,w=!1;const E=ut(async()=>{var C;if(!w){try{g=await O(t,zs,"createContractEventFilter")({abi:e,address:n,args:r,eventName:i,strict:b})}catch{}w=!0;return}try{let v;if(g)v=await O(t,Lt,"getFilterChanges")({filter:g});else{const P=await O(t,ct,"getBlockNumber")({});m&&m!==P?v=await O(t,Xs,"getContractEvents")({abi:e,address:n,args:r,eventName:i,fromBlock:m+1n,toBlock:P,strict:b}):v=[],m=P}if(v.length===0)return;if(s)y.onLogs(v);else for(const P of v)y.onLogs([P])}catch(v){g&&v instanceof fe&&(w=!1),(C=y.onError)==null||C.call(y,v)}},{emitOnBegin:!0,interval:l});return async()=>{g&&await O(t,zt,"uninstallFilter")({filter:g}),E()}})})():(()=>{let f=!0,b=()=>f=!1;return(async()=>{try{const y=i?st({abi:e,eventName:i,args:r}):[],{unsubscribe:m}=await t.transport.subscribe({params:["logs",{address:n,topics:y}],onData(g){var E;if(!f)return;const w=g.result;try{const{eventName:C,args:v}=ot({abi:e,data:w.data,topics:w.topics,strict:c}),P=W(w,{args:v,eventName:C});o([P])}catch(C){let v,P;if(C instanceof de||C instanceof Se){if(c)return;v=C.abiItem.name,P=(E=C.abiItem.inputs)==null?void 0:E.some(A=>!("name"in A&&A.name))}const S=W(w,{args:P?[]:{},eventName:v});o([S])}},onError(g){a==null||a(g)}});b=m,f||b()}catch(y){a==null||a(y)}})(),b})()}function ti({chain:t,currentChainId:e}){if(!t)throw new Ka;if(e!==t.id)throw new Ha({chain:t,currentChainId:e})}function Wu(t,{docsPath:e,...n}){const r=(()=>{const s=nr(t,n);return s instanceof $t?t:s})();return new pu(r,{docsPath:e,...n})}async function Ye(t){const e=await t.request({method:"eth_chainId"});return j(e)}async function cr(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]})}async function lr(t,e){var b,y,m,g;const{account:n=t.account,chain:r=t.chain,accessList:s,data:i,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h,...p}=e;if(!n)throw new Ae({docsPath:"/docs/actions/wallet/sendTransaction"});const f=G(n);try{at(e);let w;if(r!==null&&(w=await O(t,Ye,"getChainId")({}),ti({currentChainId:w,chain:r})),f.type==="local"){const P=await O(t,Dt,"prepareTransactionRequest")({account:f,accessList:s,chain:r,data:i,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h,...p});w||(w=await O(t,Ye,"getChainId")({}));const S=(b=r==null?void 0:r.serializers)==null?void 0:b.transaction,A=await f.signTransaction({...P,chainId:w},{serializer:S});return await O(t,cr,"sendRawTransaction")({serializedTransaction:A})}const E=(g=(m=(y=t.chain)==null?void 0:y.formatters)==null?void 0:m.transactionRequest)==null?void 0:g.format,v=(E||Mt)({...rr(p,{format:E}),accessList:s,data:i,from:f.address,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,to:d,value:h});return await t.request({method:"eth_sendTransaction",params:[v]})}catch(w){throw Wu(w,{...e,account:f,chain:e.chain||void 0})}}async function Qu(t,{abi:e,address:n,args:r,dataSuffix:s,functionName:i,...a}){const o=ae({abi:e,args:r,functionName:i});return await O(t,lr,"sendTransaction")({data:`${o}${s?s.replace("0x",""):""}`,to:n,...a})}async function Hu(t,{chain:e}){const{id:n,name:r,nativeCurrency:s,rpcUrls:i,blockExplorers:a}=e;await t.request({method:"wallet_addEthereumChain",params:[{chainId:k(n),chainName:r,nativeCurrency:s,rpcUrls:i.default.http,blockExplorerUrls:a?Object.values(a).map(({url:o})=>o):void 0}]})}const An=256;let pt=An,yt;function Ku(t=11){if(!yt||pt+t>An*2){yt="",pt=0;for(let e=0;e{const m=y(b);for(const w in p)delete m[w];const g={...b,...m};return Object.assign(g,{extend:f(g)})}}return Object.assign(p,{extend:f(p)})}function Tn(t,{delay:e=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,i)=>{const a=async({count:o=0}={})=>{const u=async({error:l})=>{const c=typeof e=="function"?e({count:o,error:l}):e;c&&await kt(c),a({count:o+1})};try{const l=await t();s(l)}catch(l){if(o"code"in t?t.code!==-1&&t.code!==-32004&&t.code!==-32005&&t.code!==-32042&&t.code!==-32603:t instanceof je&&t.status?t.status!==403&&t.status!==408&&t.status!==413&&t.status!==429&&t.status!==500&&t.status!==502&&t.status!==503&&t.status!==504:!1;function Vu(t,{retryDelay:e=150,retryCount:n=3}={}){return async r=>Tn(async()=>{try{return await t(r)}catch(s){const i=s;switch(i.code){case Be.code:throw new Be(i);case De.code:throw new De(i);case Ue.code:throw new Ue(i);case Le.code:throw new Le(i);case ve.code:throw new ve(i);case fe.code:throw new fe(i);case ze.code:throw new ze(i);case Pe.code:throw new Pe(i);case Ge.code:throw new Ge(i);case We.code:throw new We(i);case Qe.code:throw new Qe(i);case He.code:throw new He(i);case Q.code:throw new Q(i);case Ke.code:throw new Ke(i);case Ve.code:throw new Ve(i);case Je.code:throw new Je(i);case Ze.code:throw new Ze(i);case Ce.code:throw new Ce(i);case 5e3:throw new Q(i);default:throw s instanceof x?s:new wu(i)}}},{delay:({count:s,error:i})=>{var a;if(i&&i instanceof je){const o=(a=i==null?void 0:i.headers)==null?void 0:a.get("Retry-After");if(o!=null&&o.match(/\d/))return parseInt(o)*1e3}return~~(1<!ri(s)})}function Gt({key:t,name:e,request:n,retryCount:r=3,retryDelay:s=150,timeout:i,type:a},o){return{config:{key:t,name:e,request:n,retryCount:r,retryDelay:s,timeout:i,type:a},request:Vu(n,{retryCount:r,retryDelay:s}),value:o}}function Ju(t,e={}){const{key:n="custom",name:r="Custom Provider",retryDelay:s}=e;return({retryCount:i})=>Gt({key:n,name:r,request:t.request.bind(t),retryCount:e.retryCount??i,retryDelay:s,type:"custom"})}function Jr(t,e={}){const{key:n="fallback",name:r="Fallback",rank:s=!1,retryCount:i,retryDelay:a}=e;return({chain:o,pollingInterval:u=4e3,timeout:l})=>{let c=t,d=()=>{};const h=Gt({key:n,name:r,async request({method:p,params:f}){const b=async(y=0)=>{const m=c[y]({chain:o,retryCount:0,timeout:l});try{const g=await m.request({method:p,params:f});return d({method:p,params:f,response:g,transport:m,status:"success"}),g}catch(g){if(d({error:g,method:p,params:f,transport:m,status:"error"}),ri(g)||y===c.length-1)throw g;return b(y+1)}};return b()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:p=>d=p,transports:c.map(p=>p({chain:o,retryCount:0}))});if(s){const p=typeof s=="object"?s:{};Zu({chain:o,interval:p.interval??u,onTransports:f=>c=f,sampleCount:p.sampleCount,timeout:p.timeout,transports:c,weights:p.weights})}return h}}function Zu({chain:t,interval:e=4e3,onTransports:n,sampleCount:r=10,timeout:s=1e3,transports:i,weights:a={}}){const{stability:o=.7,latency:u=.3}=a,l=[],c=async()=>{const d=await Promise.all(i.map(async f=>{const b=f({chain:t,retryCount:0,timeout:s}),y=Date.now();let m,g;try{await b.request({method:"net_listening"}),g=1}catch{g=0}finally{m=Date.now()}return{latency:m-y,success:g}}));l.push(d),l.length>r&&l.shift();const h=Math.max(...l.map(f=>Math.max(...f.map(({latency:b})=>b)))),p=i.map((f,b)=>{const y=l.map(C=>C[b].latency),g=1-y.reduce((C,v)=>C+v,0)/y.length/h,w=l.map(C=>C[b].success),E=w.reduce((C,v)=>C+v,0)/w.length;return E===0?[0,b]:[u*g+o*E,b]}).sort((f,b)=>b[0]-f[0]);n(p.map(([,f])=>i[f])),await kt(e),c()};c()}class si extends x{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Xu(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const Zr=Xu();function ii(t,{errorInstance:e=new Error("timed out"),timeout:n,signal:r}){return new Promise((s,i)=>{(async()=>{let a;try{const o=new AbortController;n>0&&(a=setTimeout(()=>{r?o.abort():i(e)},n)),s(await t({signal:o==null?void 0:o.signal}))}catch(o){o.name==="AbortError"&&i(e),i(o)}finally{clearTimeout(a)}})()})}let kn=0;async function Yu(t,{body:e,fetchOptions:n={},timeout:r=1e4}){var o;const{headers:s,method:i,signal:a}=n;try{const u=await ii(async({signal:c})=>await fetch(t,{...n,body:Array.isArray(e)?N(e.map(h=>({jsonrpc:"2.0",id:h.id??kn++,...h}))):N({jsonrpc:"2.0",id:e.id??kn++,...e}),headers:{...s,"Content-Type":"application/json"},method:i||"POST",signal:a||(r>0?c:void 0)}),{errorInstance:new xn({body:e,url:t}),timeout:r,signal:!0});let l;if((o=u.headers.get("Content-Type"))!=null&&o.startsWith("application/json")?l=await u.json():l=await u.text(),!u.ok)throw new je({body:e,details:N(l.error)||u.statusText,headers:u.headers,status:u.status,url:t});return l}catch(u){throw u instanceof je||u instanceof xn?u:new je({body:e,details:u.message,url:t})}}const en=new Map;async function tn(t){let e=en.get(t);if(e)return e;const{schedule:n}=ur({id:t,fn:async()=>{const i=new Zr(t),a=new Map,o=new Map,u=({data:c})=>{const d=JSON.parse(c),h=d.method==="eth_subscription",p=h?d.params.subscription:d.id,f=h?o:a,b=f.get(p);b&&b({data:c}),h||f.delete(p)},l=()=>{en.delete(t),i.removeEventListener("close",l),i.removeEventListener("message",u)};return i.addEventListener("close",l),i.addEventListener("message",u),i.readyState===Zr.CONNECTING&&await new Promise((c,d)=>{i&&(i.onopen=c,i.onerror=d)}),e=Object.assign(i,{requests:a,subscriptions:o}),en.set(t,e),[e]}}),[r,[s]]=await n();return s}function ec(t,{body:e,onResponse:n}){if(t.readyState===t.CLOSED||t.readyState===t.CLOSING)throw new mu({body:e,url:t.url,details:"Socket is closed."});const r=kn++,s=({data:i})=>{var o;const a=JSON.parse(i);typeof a.id=="number"&&r!==a.id||(n==null||n(a),e.method==="eth_subscribe"&&typeof a.result=="string"&&t.subscriptions.set(a.result,s),e.method==="eth_unsubscribe"&&t.subscriptions.delete((o=e.params)==null?void 0:o[0]))};return t.requests.set(r,s),t.send(JSON.stringify({jsonrpc:"2.0",...e,id:r})),t}async function tc(t,{body:e,timeout:n=1e4}){return ii(()=>new Promise(r=>ge.webSocket(t,{body:e,onResponse:r})),{errorInstance:new xn({body:e,url:t.url}),timeout:n})}const ge={http:Yu,webSocket:ec,webSocketAsync:tc};function nc(t,e={}){const{batch:n,fetchOptions:r,key:s="http",name:i="HTTP JSON-RPC",retryDelay:a}=e;return({chain:o,retryCount:u,timeout:l})=>{const{batchSize:c=1e3,wait:d=0}=typeof n=="object"?n:{},h=e.retryCount??u,p=l??e.timeout??1e4,f=t||(o==null?void 0:o.rpcUrls.default.http[0]);if(!f)throw new si;return Gt({key:s,name:i,async request({method:b,params:y}){const m={method:b,params:y},{schedule:g}=ur({id:`${t}`,wait:d,shouldSplitBatch(v){return v.length>c},fn:v=>ge.http(f,{body:v,fetchOptions:r,timeout:p}),sort:(v,P)=>v.id-P.id}),w=async v=>n?g(v):[await ge.http(f,{body:v,fetchOptions:r,timeout:p})],[{error:E,result:C}]=await w(m);if(E)throw new tr({body:m,error:E,url:f});return C},retryCount:h,retryDelay:a,timeout:p,type:"http"},{fetchOptions:r,url:t})}}function dr(t,e){var r,s,i;if(!(t instanceof x))return!1;const n=t.walk(a=>a instanceof En);return n instanceof En?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((s=n.data)==null?void 0:s.errorName)==="ResolverWildcardNotSupported"||(i=n.reason)!=null&&i.includes("Wildcard on non-extended resolvers is not supported")||e==="reverse"&&n.reason===Gs[50]):!1}function ai(t){if(t.length!==66||t.indexOf("[")!==0||t.indexOf("]")!==65)return null;const e=`0x${t.slice(1,65)}`;return H(e)?e:null}function gt(t){let e=new Uint8Array(32).fill(0);if(!t)return Ne(e);const n=t.split(".");for(let r=n.length-1;r>=0;r-=1){const s=ai(n[r]),i=s?ne(s):q(J(n[r]),"bytes");e=q(Z([e,i]),"bytes")}return Ne(e)}function rc(t){return`[${t.slice(2)}]`}function sc(t){const e=new Uint8Array(32).fill(0);return t?ai(t)||q(J(t)):Ne(e)}function Wt(t){const e=t.replace(/^\.|\.$/gm,"");if(e.length===0)return new Uint8Array(1);const n=new Uint8Array(J(e).byteLength+2);let r=0;const s=e.split(".");for(let i=0;i255&&(a=J(rc(sc(s[i])))),n[r]=a.length,n.set(a,r+1),r+=a.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function ic(t,{blockNumber:e,blockTag:n,coinType:r,name:s,universalResolverAddress:i}){let a=i;if(!a){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=ke({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const o=ae({abi:Kr,functionName:"addr",...r!=null?{args:[gt(s),BigInt(r)]}:{args:[gt(s)]}}),u=await O(t,se,"readContract")({address:a,abi:ei,functionName:"resolve",args:[Y(Wt(s)),o],blockNumber:e,blockTag:n});if(u[0]==="0x")return null;const l=Te({abi:Kr,args:r!=null?[gt(s),BigInt(r)]:void 0,functionName:"addr",data:u[0]});return l==="0x"||le(l)==="0x00"?null:l}catch(o){if(dr(o,"resolve"))return null;throw o}}class ac extends x{constructor({data:e}){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(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class Me extends x{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class fr extends x{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class oc extends x{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const uc=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,cc=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,lc=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dc=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function fc(t){try{const e=await fetch(t,{method:"HEAD"});if(e.status===200){const n=e.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(e){return typeof e=="object"&&typeof e.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=t})}}function Xr(t,e){return t?t.endsWith("/")?t.slice(0,-1):t:e}function oi({uri:t,gatewayUrls:e}){const n=lc.test(t);if(n)return{uri:t,isOnChain:!0,isEncoded:n};const r=Xr(e==null?void 0:e.ipfs,"https://ipfs.io"),s=Xr(e==null?void 0:e.arweave,"https://arweave.net"),i=t.match(uc),{protocol:a,subpath:o,target:u,subtarget:l=""}=(i==null?void 0:i.groups)||{},c=a==="ipns:/"||o==="ipns/",d=a==="ipfs:/"||o==="ipfs/"||cc.test(t);if(t.startsWith("http")&&!c&&!d){let p=t;return e!=null&&e.arweave&&(p=t.replace(/https:\/\/arweave.net/g,e==null?void 0:e.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((c||d)&&u)return{uri:`${r}/${c?"ipns":"ipfs"}/${u}${l}`,isOnChain:!1,isEncoded:!1};if(a==="ar:/"&&u)return{uri:`${s}/${u}${l||""}`,isOnChain:!1,isEncoded:!1};let h=t.replace(dc,"");if(h.startsWith("s.json());return await hr({gatewayUrls:t,uri:ui(n)})}catch{throw new fr({uri:e})}}async function hr({gatewayUrls:t,uri:e}){const{uri:n,isOnChain:r}=oi({uri:e,gatewayUrls:t});if(r||await fc(n))return n;throw new fr({uri:e})}function pc(t){let e=t;e.startsWith("did:nft:")&&(e=e.replace("did:nft:","").replace(/_/g,"/"));const[n,r,s]=e.split("/"),[i,a]=n.split(":"),[o,u]=r.split(":");if(!i||i.toLowerCase()!=="eip155")throw new Me({reason:"Only EIP-155 supported"});if(!a)throw new Me({reason:"Chain ID not found"});if(!u)throw new Me({reason:"Contract address not found"});if(!s)throw new Me({reason:"Token ID not found"});if(!o)throw new Me({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:o.toLowerCase(),contractAddress:u,tokenID:s}}async function yc(t,{nft:e}){if(e.namespace==="erc721")return se(t,{address:e.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(e.tokenID)]});if(e.namespace==="erc1155")return se(t,{address:e.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(e.tokenID)]});throw new oc({namespace:e.namespace})}async function bc(t,{gatewayUrls:e,record:n}){return/eip155:/i.test(n)?mc(t,{gatewayUrls:e,record:n}):hr({uri:n,gatewayUrls:e})}async function mc(t,{gatewayUrls:e,record:n}){const r=pc(n),s=await yc(t,{nft:r}),{uri:i,isOnChain:a,isEncoded:o}=oi({uri:s,gatewayUrls:e});if(a&&(i.includes("data:application/json;base64,")||i.startsWith("{"))){const l=o?atob(i.replace("data:application/json;base64,","")):i,c=JSON.parse(l);return hr({uri:ui(c),gatewayUrls:e})}let u=r.tokenID;return r.namespace==="erc1155"&&(u=u.replace("0x","").padStart(64,"0")),hc({gatewayUrls:e,uri:i.replace(/(?:0x)?{id}/,u)})}async function ci(t,{blockNumber:e,blockTag:n,name:r,key:s,universalResolverAddress:i}){let a=i;if(!a){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=ke({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}try{const o=await O(t,se,"readContract")({address:a,abi:ei,functionName:"resolve",args:[Y(Wt(r)),ae({abi:Hr,functionName:"text",args:[gt(r),s]})],blockNumber:e,blockTag:n});if(o[0]==="0x")return null;const u=Te({abi:Hr,functionName:"text",data:o[0]});return u===""?null:u}catch(o){if(dr(o,"resolve"))return null;throw o}}async function gc(t,{blockNumber:e,blockTag:n,gatewayUrls:r,name:s,universalResolverAddress:i}){const a=await O(t,ci,"getEnsText")({blockNumber:e,blockTag:n,key:"avatar",name:s,universalResolverAddress:i});if(!a)return null;try{return await bc(t,{record:a,gatewayUrls:r})}catch{return null}}async function wc(t,{address:e,blockNumber:n,blockTag:r,universalResolverAddress:s}){let i=s;if(!i){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=ke({blockNumber:n,chain:t.chain,contract:"ensUniversalResolver"})}const a=`${e.toLowerCase().substring(2)}.addr.reverse`;try{const[o,u]=await O(t,se,"readContract")({address:i,abi:Fu,functionName:"reverse",args:[Y(Wt(a))],blockNumber:n,blockTag:r});return e.toLowerCase()!==u.toLowerCase()?null:o}catch(o){if(dr(o,"reverse"))return null;throw o}}async function vc(t,{blockNumber:e,blockTag:n,name:r,universalResolverAddress:s}){let i=s;if(!i){if(!t.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=ke({blockNumber:e,chain:t.chain,contract:"ensUniversalResolver"})}const[a]=await O(t,se,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Y(Wt(r))],blockNumber:e,blockTag:n});return a}async function Pc(t){const e=_t(t,{method:"eth_newBlockFilter"}),n=await t.request({method:"eth_newBlockFilter"});return{id:n,request:e(n),type:"block"}}async function li(t,{address:e,args:n,event:r,events:s,fromBlock:i,strict:a,toBlock:o}={}){const u=s??(r?[r]:void 0),l=_t(t,{method:"eth_newFilter"});let c=[];u&&(c=[u.flatMap(h=>st({abi:[h],eventName:h.name,args:n}))],r&&(c=c[0]));const d=await t.request({method:"eth_newFilter",params:[{address:e,fromBlock:typeof i=="bigint"?k(i):i,toBlock:typeof o=="bigint"?k(o):o,...c.length?{topics:c}:{}}]});return{abi:u,args:n,eventName:r?r.name:void 0,fromBlock:i,id:d,request:l(d),strict:a,toBlock:o,type:"event"}}async function di(t){const e=_t(t,{method:"eth_newPendingTransactionFilter"}),n=await t.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:e(n),type:"transaction"}}async function Cc(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?k(n):void 0,i=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(i)}async function Ec(t,{blockHash:e,blockNumber:n,blockTag:r="latest"}={}){const s=n!==void 0?k(n):void 0;let i;return e?i=await t.request({method:"eth_getBlockTransactionCountByHash",params:[e]}):i=await t.request({method:"eth_getBlockTransactionCountByNumber",params:[s||r]}),j(i)}async function xc(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n!==void 0?k(n):void 0,i=await t.request({method:"eth_getCode",params:[e,s||r]});if(i!=="0x")return i}function Sc(t){var e;return{baseFeePerGas:t.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:t.gasUsedRatio,oldestBlock:BigInt(t.oldestBlock),reward:(e=t.reward)==null?void 0:e.map(n=>n.map(r=>BigInt(r)))}}async function Oc(t,{blockCount:e,blockNumber:n,blockTag:r="latest",rewardPercentiles:s}){const i=n?k(n):void 0,a=await t.request({method:"eth_feeHistory",params:[k(e),i||r,s]});return Sc(a)}async function Ac(t,{filter:e}){const n=e.strict??!1;return(await e.request({method:"eth_getFilterLogs",params:[e.id]})).map(s=>{var i;try{const{eventName:a,args:o}="abi"in e&&e.abi?ot({abi:e.abi,data:s.data,topics:s.topics,strict:n}):{eventName:void 0,args:void 0};return W(s,{args:o,eventName:a})}catch(a){let o,u;if(a instanceof de||a instanceof Se){if("strict"in e&&e.strict)return;o=a.abiItem.name,u=(i=a.abiItem.inputs)==null?void 0:i.some(l=>!("name"in l&&l.name))}return W(s,{args:u?[]:{},eventName:o})}}).filter(Boolean)}const Tc=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,kc=/^(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)?$/;function Fc({domain:t,message:e,primaryType:n,types:r}){const s=typeof t>"u"?{}:t,i={EIP712Domain:mi({domain:s}),...r};bi({domain:s,message:e,primaryType:n,types:i});const a=["0x1901"];return s&&a.push(Ic({domain:s,types:i})),n!=="EIP712Domain"&&a.push(fi({data:e,primaryType:n,types:i})),q(Z(a))}function Ic({domain:t,types:e}){return fi({data:t,primaryType:"EIP712Domain",types:e})}function fi({data:t,primaryType:e,types:n}){const r=hi({data:t,primaryType:e,types:n});return q(r)}function hi({data:t,primaryType:e,types:n}){const r=[{type:"bytes32"}],s=[Rc({primaryType:e,types:n})];for(const i of n[e]){const[a,o]=yi({types:n,name:i.name,type:i.type,value:t[i.name]});r.push(a),s.push(o)}return nt(r,s)}function Rc({primaryType:t,types:e}){const n=Y(Mc({primaryType:t,types:e}));return q(n)}function Mc({primaryType:t,types:e}){let n="";const r=pi({primaryType:t,types:e});r.delete(t);const s=[t,...Array.from(r).sort()];for(const i of s)n+=`${i}(${e[i].map(({name:a,type:o})=>`${o} ${a}`).join(",")})`;return n}function pi({primaryType:t,types:e},n=new Set){const r=t.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||e[s]===void 0)return n;n.add(s);for(const i of e[s])pi({primaryType:i.type,types:e},n);return n}function yi({types:t,name:e,type:n,value:r}){if(t[n]!==void 0)return[{type:"bytes32"},q(hi({data:r,primaryType:n,types:t}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},q(r)];if(n==="string")return[{type:"bytes32"},q(Y(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(a=>yi({name:e,type:s,types:t,value:a}));return[{type:"bytes32"},q(nt(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:n},r]}function bi({domain:t,message:e,primaryType:n,types:r}){const s=r,i=(a,o)=>{for(const u of a){const{name:l,type:c}=u,d=c,h=o[l],p=d.match(kc);if(p&&(typeof h=="number"||typeof h=="bigint")){const[y,m,g]=p;k(h,{signed:m==="int",size:parseInt(g)/8})}if(d==="address"&&typeof h=="string"&&!K(h))throw new _e({address:h});const f=d.match(Tc);if(f){const[y,m]=f;if(m&&$(h)!==parseInt(m))throw new fo({expectedSize:parseInt(m),givenSize:$(h)})}const b=s[d];b&&i(b,h)}};if(s.EIP712Domain&&t&&i(s.EIP712Domain,t),n!=="EIP712Domain"){const a=s[n];i(a,e)}}function mi({domain:t}){return[typeof(t==null?void 0:t.name)=="string"&&{name:"name",type:"string"},(t==null?void 0:t.version)&&{name:"version",type:"string"},typeof(t==null?void 0:t.chainId)=="number"&&{name:"chainId",type:"uint256"},(t==null?void 0:t.verifyingContract)&&{name:"verifyingContract",type:"address"},(t==null?void 0:t.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const nn="/docs/contract/encodeDeployData";function gi({abi:t,args:e,bytecode:n}){if(!e||e.length===0)return n;const r=t.find(i=>"type"in i&&i.type==="constructor");if(!r)throw new ro({docsPath:nn});if(!("inputs"in r))throw new _r({docsPath:nn});if(!r.inputs||r.inputs.length===0)throw new _r({docsPath:nn});const s=nt(r.inputs,e);return Gn([n,s])}const $c=`Ethereum Signed Message: `;function jc(t,e){const n=typeof t=="string"?J(t):t.raw instanceof Uint8Array?t.raw:ne(t.raw),r=J(`${$c}${n.length}`);return q(Z([r,n]),e)}function qc(t){return t.map(e=>({...e,value:BigInt(e.value)}))}function Nc(t){return{...t,balance:t.balance?BigInt(t.balance):void 0,nonce:t.nonce?j(t.nonce):void 0,storageProof:t.storageProof?qc(t.storageProof):void 0}}async function _c(t,{address:e,blockNumber:n,blockTag:r,storageKeys:s}){const i=r??"latest",a=n!==void 0?k(n):void 0,o=await t.request({method:"eth_getProof",params:[e,s,a||i]});return Nc(o)}async function Bc(t,{address:e,blockNumber:n,blockTag:r="latest",slot:s}){const i=n!==void 0?k(n):void 0;return await t.request({method:"eth_getStorageAt",params:[e,s,i||r]})}async function pr(t,{blockHash:e,blockNumber:n,blockTag:r,hash:s,index:i}){var c,d,h;const a=r||"latest",o=n!==void 0?k(n):void 0;let u=null;if(s?u=await t.request({method:"eth_getTransactionByHash",params:[s]}):e?u=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[e,k(i)]}):(o||a)&&(u=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||a,k(i)]})),!u)throw new Qs({blockHash:e,blockNumber:n,blockTag:a,hash:s,index:i});return(((h=(d=(c=t.chain)==null?void 0:c.formatters)==null?void 0:d.transaction)==null?void 0:h.format)||Fs)(u)}async function Dc(t,{hash:e,transactionReceipt:n}){const[r,s]=await Promise.all([O(t,ct,"getBlockNumber")({}),e?O(t,pr,"getBlockNumber")({hash:e}):void 0]),i=(n==null?void 0:n.blockNumber)||(s==null?void 0:s.blockNumber);return i?r-i+1n:0n}async function Fn(t,{hash:e}){var s,i,a;const n=await t.request({method:"eth_getTransactionReceipt",params:[e]});if(!n)throw new Hs({hash:e});return(((a=(i=(s=t.chain)==null?void 0:s.formatters)==null?void 0:i.transactionReceipt)==null?void 0:a.format)||Wa)(n)}async function Uc(t,e){var b;const{allowFailure:n=!0,batchSize:r,blockNumber:s,blockTag:i,contracts:a,multicallAddress:o}=e,u=r??(typeof((b=t.batch)==null?void 0:b.multicall)=="object"&&t.batch.multicall.batchSize||1024);let l=o;if(!l){if(!t.chain)throw new Error("client chain not configured. multicallAddress is required.");l=ke({blockNumber:s,chain:t.chain,contract:"multicall3"})}const c=[[]];let d=0,h=0;for(let y=0;y0&&h>u&&c[d].length>0&&(d++,h=(C.length-2)/2,c[d]=[]),c[d]=[...c[d],{allowFailure:!0,callData:C,target:g}]}catch(C){const v=Xe(C,{abi:m,address:g,args:w,docsPath:"/docs/contract/multicall",functionName:E});if(!n)throw v;c[d]=[...c[d],{allowFailure:!0,callData:"0x",target:g}]}}const p=await Promise.allSettled(c.map(y=>O(t,se,"readContract")({abi:On,address:l,args:[y],blockNumber:s,blockTag:i,functionName:"aggregate3"}))),f=[];for(let y=0;y{const d=N(["watchBlockNumber",t.uid,e,n,a]);return Fe(d,{onBlockNumber:r,onError:s},h=>ut(async()=>{var p;try{const f=await O(t,ct,"getBlockNumber")({cacheTime:0});if(u){if(f===u)return;if(f-u>1&&n)for(let b=u+1n;bu)&&(h.onBlockNumber(f,u),u=f)}catch(f){(p=h.onError)==null||p.call(h,f)}},{emitOnBegin:e,interval:a}))})():(()=>{let d=!0,h=()=>d=!1;return(async()=>{try{const{unsubscribe:p}=await t.transport.subscribe({params:["newHeads"],onData(f){var y;if(!d)return;const b=Rt((y=f.result)==null?void 0:y.number);r(b,u),u=b},onError(f){s==null||s(f)}});h=p,d||h()}catch(p){s==null||s(p)}})(),h})()}async function Hc(t,{confirmations:e=1,hash:n,onReplaced:r,pollingInterval:s=t.pollingInterval,timeout:i}){const a=N(["waitForTransactionReceipt",t.uid,n]);let o,u,l,c=!1;return new Promise((d,h)=>{i&&setTimeout(()=>h(new yu({hash:n})),i);const p=Fe(a,{onReplaced:r,resolve:d,reject:h},f=>{const b=O(t,vi,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:s,async onBlockNumber(y){if(c)return;let m=y;const g=w=>{b(),w(),p()};try{if(l){if(e>1&&(!l.blockNumber||m-l.blockNumber+1nf.resolve(l));return}if(o||(c=!0,await Tn(async()=>{o=await O(t,pr,"getTransaction")({hash:n}),o.blockNumber&&(m=o.blockNumber)},{delay:({count:w})=>~~(1<1&&(!l.blockNumber||m-l.blockNumber+1nf.resolve(l))}catch(w){if(o&&(w instanceof Qs||w instanceof Hs))try{u=o,c=!0;const E=await Tn(()=>O(t,re,"getBlock")({blockNumber:m,includeTransactions:!0}),{delay:({count:P})=>~~(1<P instanceof Vs});c=!1;const C=E.transactions.find(({from:P,nonce:S})=>P===u.from&&S===u.nonce);if(!C||(l=await O(t,Fn,"getTransactionReceipt")({hash:C.hash}),e>1&&(!l.blockNumber||m-l.blockNumber+1n{var P;(P=f.onReplaced)==null||P.call(f,{reason:v,replacedTransaction:u,transaction:C,transactionReceipt:l}),f.resolve(l)})}catch(E){g(()=>f.reject(E))}else g(()=>f.reject(w))}}})})})}function Kc(t,{blockTag:e="latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:s,onError:i,includeTransactions:a,poll:o,pollingInterval:u=t.pollingInterval}){const l=typeof o<"u"?o:t.transport.type!=="webSocket",c=a??!1;let d;return l?(()=>{const f=N(["watchBlocks",t.uid,n,r,c,u]);return Fe(f,{onBlock:s,onError:i},b=>ut(async()=>{var y;try{const m=await O(t,re,"getBlock")({blockTag:e,includeTransactions:c});if(m.number&&(d!=null&&d.number)){if(m.number===d.number)return;if(m.number-d.number>1&&n)for(let g=(d==null?void 0:d.number)+1n;gd.number)&&(b.onBlock(m,d),d=m)}catch(m){(y=b.onError)==null||y.call(b,m)}},{emitOnBegin:r,interval:u}))})():(()=>{let f=!0,b=()=>f=!1;return(async()=>{try{const{unsubscribe:y}=await t.transport.subscribe({params:["newHeads"],onData(m){var E,C,v;if(!f)return;const w=(((v=(C=(E=t.chain)==null?void 0:E.formatters)==null?void 0:C.block)==null?void 0:v.format)||Is)(m.result);s(w,d),d=w},onError(m){i==null||i(m)}});b=y,f||b()}catch(y){i==null||i(y)}})(),b})()}function Vc(t,{address:e,args:n,batch:r=!0,event:s,events:i,onError:a,onLogs:o,poll:u,pollingInterval:l=t.pollingInterval,strict:c}){const d=typeof u<"u"?u:t.transport.type!=="webSocket",h=c??!1;return d?(()=>{const b=N(["watchEvent",e,n,r,t.uid,s,l]);return Fe(b,{onLogs:o,onError:a},y=>{let m,g,w=!1;const E=ut(async()=>{var C;if(!w){try{g=await O(t,li,"createEventFilter")({address:e,args:n,event:s,events:i,strict:h})}catch{}w=!0;return}try{let v;if(g)v=await O(t,Lt,"getFilterChanges")({filter:g});else{const P=await O(t,ct,"getBlockNumber")({});m&&m!==P?v=await O(t,or,"getLogs")({address:e,args:n,event:s,events:i,fromBlock:m+1n,toBlock:P}):v=[],m=P}if(v.length===0)return;if(r)y.onLogs(v);else for(const P of v)y.onLogs([P])}catch(v){g&&v instanceof fe&&(w=!1),(C=y.onError)==null||C.call(y,v)}},{emitOnBegin:!0,interval:l});return async()=>{g&&await O(t,zt,"uninstallFilter")({filter:g}),E()}})})():(()=>{let b=!0,y=()=>b=!1;return(async()=>{try{const m=i??(s?[s]:void 0);let g=[];m&&(g=[m.flatMap(E=>st({abi:[E],eventName:E.name,args:n}))],s&&(g=g[0]));const{unsubscribe:w}=await t.transport.subscribe({params:["logs",{address:e,topics:g}],onData(E){var v;if(!b)return;const C=E.result;try{const{eventName:P,args:S}=ot({abi:m,data:C.data,topics:C.topics,strict:h}),A=W(C,{args:S,eventName:P});o([A])}catch(P){let S,A;if(P instanceof de||P instanceof Se){if(c)return;S=P.abiItem.name,A=(v=P.abiItem.inputs)==null?void 0:v.some(F=>!("name"in F&&F.name))}const I=W(C,{args:A?[]:{},eventName:S});o([I])}},onError(E){a==null||a(E)}});y=w,b||y()}catch(m){a==null||a(m)}})(),y})()}function Jc(t,{batch:e=!0,onError:n,onTransactions:r,poll:s,pollingInterval:i=t.pollingInterval}){return(typeof s<"u"?s:t.transport.type!=="webSocket")?(()=>{const l=N(["watchPendingTransactions",t.uid,e,i]);return Fe(l,{onTransactions:r,onError:n},c=>{let d;const h=ut(async()=>{var p;try{if(!d)try{d=await O(t,di,"createPendingTransactionFilter")({});return}catch(b){throw h(),b}const f=await O(t,Lt,"getFilterChanges")({filter:d});if(f.length===0)return;if(e)c.onTransactions(f);else for(const b of f)c.onTransactions([b])}catch(f){(p=c.onError)==null||p.call(c,f)}},{emitOnBegin:!0,interval:i});return async()=>{d&&await O(t,zt,"uninstallFilter")({filter:d}),h()}})})():(()=>{let l=!0,c=()=>l=!1;return(async()=>{try{const{unsubscribe:d}=await t.transport.subscribe({params:["newPendingTransactions"],onData(h){if(!l)return;const p=h.result;r([p])},onError(h){n==null||n(h)}});c=d,l||c()}catch(d){n==null||n(d)}})(),c})()}function Zc(t){return{call:e=>Ut(t,e),createBlockFilter:()=>Pc(t),createContractEventFilter:e=>zs(t,e),createEventFilter:e=>li(t,e),createPendingTransactionFilter:()=>di(t),estimateContractGas:e=>Tu(t,e),estimateGas:e=>ar(t,e),getBalance:e=>Cc(t,e),getBlock:e=>re(t,e),getBlockNumber:e=>ct(t,e),getBlockTransactionCount:e=>Ec(t,e),getBytecode:e=>xc(t,e),getChainId:()=>Ye(t),getContractEvents:e=>Xs(t,e),getEnsAddress:e=>ic(t,e),getEnsAvatar:e=>gc(t,e),getEnsName:e=>wc(t,e),getEnsResolver:e=>vc(t,e),getEnsText:e=>ci(t,e),getFeeHistory:e=>Oc(t,e),estimateFeesPerGas:e=>Ou(t,e),getFilterChanges:e=>Lt(t,e),getFilterLogs:e=>Ac(t,e),getGasPrice:()=>ir(t),getLogs:e=>or(t,e),getProof:e=>_c(t,e),estimateMaxPriorityFeePerGas:e=>Su(t,e),getStorageAt:e=>Bc(t,e),getTransaction:e=>pr(t,e),getTransactionConfirmations:e=>Dc(t,e),getTransactionCount:e=>Zs(t,e),getTransactionReceipt:e=>Fn(t,e),multicall:e=>Uc(t,e),prepareTransactionRequest:e=>Dt(t,e),readContract:e=>se(t,e),sendRawTransaction:e=>cr(t,e),simulateContract:e=>Nu(t,e),verifyMessage:e=>Wc(t,e),verifyTypedData:e=>Qc(t,e),uninstallFilter:e=>zt(t,e),waitForTransactionReceipt:e=>Hc(t,e),watchBlocks:e=>Kc(t,e),watchBlockNumber:e=>vi(t,e),watchContractEvent:e=>Gu(t,e),watchEvent:e=>Vc(t,e),watchPendingTransactions:e=>Jc(t,e)}}function Yr(t){const{key:e="public",name:n="Public Client"}=t;return ni({...t,key:e,name:n,type:"publicClient"}).extend(Zc)}function Xc(t,{abi:e,args:n,bytecode:r,...s}){const i=gi({abi:e,args:n,bytecode:r});return lr(t,{...s,data:i})}async function Yc(t){var n;return((n=t.account)==null?void 0:n.type)==="local"?[t.account.address]:(await t.request({method:"eth_accounts"})).map(r=>Zn(r))}async function el(t){return await t.request({method:"wallet_getPermissions"})}async function tl(t){return(await t.request({method:"eth_requestAccounts"})).map(n=>be(n))}async function nl(t,e){return t.request({method:"wallet_requestPermissions",params:[e]})}async function rl(t,{account:e=t.account,message:n}){if(!e)throw new Ae({docsPath:"/docs/actions/wallet/signMessage"});const r=G(e);if(r.type==="local")return r.signMessage({message:n});const s=typeof n=="string"?Ln(n):n.raw instanceof Uint8Array?Y(n.raw):n.raw;return t.request({method:"personal_sign",params:[s,r.address]})}async function sl(t,e){var l,c,d,h;const{account:n=t.account,chain:r=t.chain,...s}=e;if(!n)throw new Ae({docsPath:"/docs/actions/wallet/signTransaction"});const i=G(n);at({account:i,...e});const a=await O(t,Ye,"getChainId")({});r!==null&&ti({currentChainId:a,chain:r});const o=(r==null?void 0:r.formatters)||((l=t.chain)==null?void 0:l.formatters),u=((c=o==null?void 0:o.transactionRequest)==null?void 0:c.format)||Mt;return i.type==="local"?i.signTransaction({...s,chainId:a},{serializer:(h=(d=t.chain)==null?void 0:d.serializers)==null?void 0:h.transaction}):await t.request({method:"eth_signTransaction",params:[{...u(s),chainId:k(a),from:i.address}]})}async function il(t,{account:e=t.account,domain:n,message:r,primaryType:s,types:i}){if(!e)throw new Ae({docsPath:"/docs/actions/wallet/signTypedData"});const a=G(e),o={EIP712Domain:mi({domain:n}),...i};if(bi({domain:n,message:r,primaryType:s,types:o}),a.type==="local")return a.signTypedData({domain:n,primaryType:s,types:o,message:r});const u=N({domain:n??{},primaryType:s,types:o,message:r},(l,c)=>H(c)?c.toLowerCase():c);return t.request({method:"eth_signTypedData_v4",params:[a.address,u]})}async function al(t,{id:e}){await t.request({method:"wallet_switchEthereumChain",params:[{chainId:k(e)}]})}async function ol(t,e){return await t.request({method:"wallet_watchAsset",params:e})}function ul(t){return{addChain:e=>Hu(t,e),deployContract:e=>Xc(t,e),getAddresses:()=>Yc(t),getChainId:()=>Ye(t),getPermissions:()=>el(t),prepareTransactionRequest:e=>Dt(t,e),requestAddresses:()=>tl(t),requestPermissions:e=>nl(t,e),sendRawTransaction:e=>cr(t,e),sendTransaction:e=>lr(t,e),signMessage:e=>rl(t,e),signTransaction:e=>sl(t,e),signTypedData:e=>il(t,e),switchChain:e=>al(t,e),watchAsset:e=>ol(t,e),writeContract:e=>Qu(t,e)}}function cl(t){const{key:e="wallet",name:n="Wallet Client",transport:r}=t;return ni({...t,key:e,name:n,transport:i=>r({...i,retryCount:0}),type:"walletClient"}).extend(ul)}function ll(t,e={}){const{key:n="webSocket",name:r="WebSocket JSON-RPC",retryDelay:s}=e;return({chain:i,retryCount:a,timeout:o})=>{var d;const u=e.retryCount??a,l=o??e.timeout??1e4,c=t||((d=i==null?void 0:i.rpcUrls.default.webSocket)==null?void 0:d[0]);if(!c)throw new si;return Gt({key:n,name:r,async request({method:h,params:p}){const f={method:h,params:p},b=await tn(c),{error:y,result:m}=await ge.webSocketAsync(b,{body:f,timeout:l});if(y)throw new tr({body:f,error:y,url:c});return m},retryCount:u,retryDelay:s,timeout:l,type:"webSocket"},{getSocket(){return tn(c)},async subscribe({params:h,onData:p,onError:f}){const b=await tn(c),{result:y}=await new Promise((m,g)=>ge.webSocket(b,{body:{method:"eth_subscribe",params:h},onResponse(w){if(w.error){g(w.error),f==null||f(w.error);return}if(typeof w.id=="number"){m(w);return}w.method==="eth_subscription"&&p(w.params)}}));return{subscriptionId:y,async unsubscribe(){return new Promise(m=>ge.webSocket(b,{body:{method:"eth_unsubscribe",params:[y]},onResponse:m}))}}}})}}const dl=Es({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),fl=Es({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var hl=class extends Error{constructor({chainId:t,connectorId:e}){super(`Chain "${t}" not configured for connector "${e}".`),this.name="ChainNotConfiguredForConnectorError"}},z=class extends Error{constructor(){super(...arguments),this.name="ConnectorNotFoundError",this.message="Connector not found"}};function es(t){return typeof t=="string"?Number.parseInt(t,t.trim().substring(0,2)==="0x"?16:10):typeof t=="bigint"?Number(t):t}var Pi={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(u,l,c){this.fn=u,this.context=l,this.once=c||!1}function i(u,l,c,d,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var p=new s(c,d||u,h),f=n?n+l:l;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],p]:u._events[f].push(p):(u._events[f]=p,u._eventsCount++),u}function a(u,l){--u._eventsCount===0?u._events=new r:delete u._events[l]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],c,d;if(this._eventsCount===0)return l;for(d in c=this._events)e.call(c,d)&&l.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},o.prototype.listeners=function(l){var c=n?n+l:l,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,p=d.length,f=new Array(p);h{if(!e.has(t))throw TypeError("Cannot "+n)},bl=(t,e,n)=>(yr(t,e,"read from private field"),n?n.call(t):e.get(t)),ml=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},gl=(t,e,n,r)=>(yr(t,e,"write to private field"),e.set(t,n),n),Vd=(t,e,n)=>(yr(t,e,"access private method"),n),wl=class extends yl{constructor({chains:t=[fl,dl],options:e}){super(),this.chains=t,this.options=e}getBlockExplorerUrls(t){const{default:e,...n}=t.blockExplorers??{};if(e)return[e.url,...Object.values(n).map(r=>r.url)]}isChainUnsupported(t){return!this.chains.some(e=>e.id===t)}setStorage(t){this.storage=t}};function vl(t){var n;if(!t)return"Injected";const e=r=>{if(r.isApexWallet)return"Apex Wallet";if(r.isAvalanche)return"Core Wallet";if(r.isBackpack)return"Backpack";if(r.isBifrost)return"Bifrost Wallet";if(r.isBitKeep)return"BitKeep";if(r.isBitski)return"Bitski";if(r.isBlockWallet)return"BlockWallet";if(r.isBraveWallet)return"Brave Wallet";if(r.isCoin98)return"Coin98 Wallet";if(r.isCoinbaseWallet)return"Coinbase Wallet";if(r.isDawn)return"Dawn Wallet";if(r.isDefiant)return"Defiant";if(r.isDesig)return"Desig Wallet";if(r.isEnkrypt)return"Enkrypt";if(r.isExodus)return"Exodus";if(r.isFordefi)return"Fordefi";if(r.isFrame)return"Frame";if(r.isFrontier)return"Frontier Wallet";if(r.isGamestop)return"GameStop Wallet";if(r.isHaqqWallet)return"HAQQ Wallet";if(r.isHyperPay)return"HyperPay Wallet";if(r.isImToken)return"ImToken";if(r.isHaloWallet)return"Halo Wallet";if(r.isKuCoinWallet)return"KuCoin Wallet";if(r.isMathWallet)return"MathWallet";if(r.isNovaWallet)return"Nova Wallet";if(r.isOkxWallet||r.isOKExWallet)return"OKX Wallet";if(r.isOktoWallet)return"Okto Wallet";if(r.isOneInchIOSWallet||r.isOneInchAndroidWallet)return"1inch Wallet";if(r.isOneKey)return"OneKey Wallet";if(r.isOpera)return"Opera";if(r.isPhantom)return"Phantom";if(r.isPortal)return"Ripio Portal";if(r.isRabby)return"Rabby Wallet";if(r.isRainbow)return"Rainbow";if(r.isSafePal)return"SafePal Wallet";if(r.isStatus)return"Status";if(r.isSubWallet)return"SubWallet";if(r.isTalisman)return"Talisman";if(r.isTally)return"Taho";if(r.isTokenPocket)return"TokenPocket";if(r.isTokenary)return"Tokenary";if(r.isTrust||r.isTrustWallet)return"Trust Wallet";if(r.isTTWallet)return"TTWallet";if(r.isXDEFI)return"XDEFI Wallet";if(r.isZeal)return"Zeal";if(r.isZerion)return"Zerion";if(r.isMetaMask)return"MetaMask"};if((n=t.providers)!=null&&n.length){const r=new Set;let s=1;for(const a of t.providers){let o=e(a);o||(o=`Unknown Wallet #${s}`,s+=1),r.add(o)}const i=[...r];return i.length?i:i[0]??"Injected"}return e(t)??"Injected"}var wt,Pl=class extends wl{constructor({chains:t,options:e}={}){const n={shimDisconnect:!0,getProvider(){if(typeof window>"u")return;const s=window.ethereum;return s!=null&&s.providers&&s.providers.length>0?s.providers[0]:s},...e};super({chains:t,options:n}),this.id="injected",ml(this,wt,void 0),this.shimDisconnectKey=`${this.id}.shimDisconnect`,this.onAccountsChanged=s=>{s.length===0?this.emit("disconnect"):this.emit("change",{account:be(s[0])})},this.onChainChanged=s=>{const i=es(s),a=this.isChainUnsupported(i);this.emit("change",{chain:{id:i,unsupported:a}})},this.onDisconnect=async s=>{var i;s.code===1013&&await this.getProvider()&&await this.getAccount()||(this.emit("disconnect"),this.options.shimDisconnect&&((i=this.storage)==null||i.removeItem(this.shimDisconnectKey)))};const r=n.getProvider();if(typeof n.name=="string")this.name=n.name;else if(r){const s=vl(r);n.name?this.name=n.name(s):typeof s=="string"?this.name=s:this.name=s[0]}else this.name="Injected";this.ready=!!r}async connect({chainId:t}={}){var e;try{const n=await this.getProvider();if(!n)throw new z;n.on&&(n.on("accountsChanged",this.onAccountsChanged),n.on("chainChanged",this.onChainChanged),n.on("disconnect",this.onDisconnect)),this.emit("message",{type:"connecting"});const r=await n.request({method:"eth_requestAccounts"}),s=be(r[0]);let i=await this.getChainId(),a=this.isChainUnsupported(i);return t&&i!==t&&(i=(await this.switchChain(t)).id,a=this.isChainUnsupported(i)),this.options.shimDisconnect&&((e=this.storage)==null||e.setItem(this.shimDisconnectKey,!0)),{account:s,chain:{id:i,unsupported:a}}}catch(n){throw this.isUserRejectedRequestError(n)?new Q(n):n.code===-32002?new Pe(n):n}}async disconnect(){var e;const t=await this.getProvider();t!=null&&t.removeListener&&(t.removeListener("accountsChanged",this.onAccountsChanged),t.removeListener("chainChanged",this.onChainChanged),t.removeListener("disconnect",this.onDisconnect),this.options.shimDisconnect&&((e=this.storage)==null||e.removeItem(this.shimDisconnectKey)))}async getAccount(){const t=await this.getProvider();if(!t)throw new z;const e=await t.request({method:"eth_accounts"});return be(e[0])}async getChainId(){const t=await this.getProvider();if(!t)throw new z;return t.request({method:"eth_chainId"}).then(es)}async getProvider(){const t=this.options.getProvider();return t&&gl(this,wt,t),bl(this,wt)}async getWalletClient({chainId:t}={}){const[e,n]=await Promise.all([this.getProvider(),this.getAccount()]),r=this.chains.find(s=>s.id===t);if(!e)throw new Error("provider is required.");return cl({account:n,chain:r,transport:Ju(e)})}async isAuthorized(){var t;try{if(this.options.shimDisconnect&&!((t=this.storage)!=null&&t.getItem(this.shimDisconnectKey)))return!1;if(!await this.getProvider())throw new z;return!!await this.getAccount()}catch{return!1}}async switchChain(t){var r,s,i;const e=await this.getProvider();if(!e)throw new z;const n=k(t);try{return await Promise.all([e.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]}),new Promise(a=>this.on("change",({chain:o})=>{(o==null?void 0:o.id)===t&&a()}))]),this.chains.find(a=>a.id===t)??{id:t,name:`Chain ${n}`,network:`${n}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}}}catch(a){const o=this.chains.find(u=>u.id===t);if(!o)throw new hl({chainId:t,connectorId:this.id});if(a.code===4902||((s=(r=a==null?void 0:a.data)==null?void 0:r.originalError)==null?void 0:s.code)===4902)try{if(await e.request({method:"wallet_addEthereumChain",params:[{chainId:n,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:[((i=o.rpcUrls.public)==null?void 0:i.http[0])??""],blockExplorerUrls:this.getBlockExplorerUrls(o)}]}),await this.getChainId()!==t)throw new Q(new Error("User rejected switch after adding network."));return o}catch(u){throw new Q(u)}throw this.isUserRejectedRequestError(a)?new Q(a):new Ce(a)}}async watchAsset({address:t,decimals:e=18,image:n,symbol:r}){const s=await this.getProvider();if(!s)throw new z;return s.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:t,decimals:e,image:n,symbol:r}}})}isUserRejectedRequestError(t){return t.code===4001}};wt=new WeakMap;var br=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},rn=(t,e,n)=>(br(t,e,"read from private field"),e.get(t)),sn=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},bt=(t,e,n,r)=>(br(t,e,"write to private field"),e.set(t,n),n),Cl=(t,e,n)=>(br(t,e,"access private method"),n);const El={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REACT_APP_BUILD_DATE:"02/28/2025-13:04",VITE_REACT_APP_PLATFORM_NAME:"web",VITE_REACT_APP_STORAGE_AVAILABLE:"true",VITE_REACT_APP_STORAGE_PREFIX:"18759314-web"},xl=t=>(e,n,r)=>{const s=r.subscribe;return r.subscribe=(a,o,u)=>{let l=a;if(o){const c=(u==null?void 0:u.equalityFn)||Object.is;let d=a(r.getState());l=h=>{const p=a(h);if(!c(d,p)){const f=d;o(d=p,f)}},u!=null&&u.fireImmediately&&o(d,d)}return s(l)},t(e,n,r)},Sl=xl;function Ol(t,e){let n;try{n=t()}catch{return}return{getItem:s=>{var i;const a=u=>u===null?null:JSON.parse(u,void 0),o=(i=n.getItem(s))!=null?i:null;return o instanceof Promise?o.then(a):a(o)},setItem:(s,i)=>n.setItem(s,JSON.stringify(i,void 0)),removeItem:s=>n.removeItem(s)}}const et=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(r){return et(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return et(r)(n)}}}},Al=(t,e)=>(n,r,s)=>{let i={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:y=>y,version:0,merge:(y,m)=>({...m,...y}),...e},a=!1;const o=new Set,u=new Set;let l;try{l=i.getStorage()}catch{}if(!l)return t((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...y)},r,s);const c=et(i.serialize),d=()=>{const y=i.partialize({...r()});let m;const g=c({state:y,version:i.version}).then(w=>l.setItem(i.name,w)).catch(w=>{m=w});if(m)throw m;return g},h=s.setState;s.setState=(y,m)=>{h(y,m),d()};const p=t((...y)=>{n(...y),d()},r,s);let f;const b=()=>{var y;if(!l)return;a=!1,o.forEach(g=>g(r()));const m=((y=i.onRehydrateStorage)==null?void 0:y.call(i,r()))||void 0;return et(l.getItem.bind(l))(i.name).then(g=>{if(g)return i.deserialize(g)}).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==i.version){if(i.migrate)return i.migrate(g.state,g.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return g.state}).then(g=>{var w;return f=i.merge(g,(w=r())!=null?w:p),n(f,!0),d()}).then(()=>{m==null||m(f,void 0),a=!0,u.forEach(g=>g(f))}).catch(g=>{m==null||m(void 0,g)})};return s.persist={setOptions:y=>{i={...i,...y},y.getStorage&&(l=y.getStorage())},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>b(),hasHydrated:()=>a,onHydrate:y=>(o.add(y),()=>{o.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},b(),f||p},Tl=(t,e)=>(n,r,s)=>{let i={storage:Ol(()=>localStorage),partialize:b=>b,version:0,merge:(b,y)=>({...y,...b}),...e},a=!1;const o=new Set,u=new Set;let l=i.storage;if(!l)return t((...b)=>{console.warn(`[zustand persist middleware] Unable to update item '${i.name}', the given storage is currently unavailable.`),n(...b)},r,s);const c=()=>{const b=i.partialize({...r()});return l.setItem(i.name,{state:b,version:i.version})},d=s.setState;s.setState=(b,y)=>{d(b,y),c()};const h=t((...b)=>{n(...b),c()},r,s);s.getInitialState=()=>h;let p;const f=()=>{var b,y;if(!l)return;a=!1,o.forEach(g=>{var w;return g((w=r())!=null?w:h)});const m=((y=i.onRehydrateStorage)==null?void 0:y.call(i,(b=r())!=null?b:h))||void 0;return et(l.getItem.bind(l))(i.name).then(g=>{if(g)if(typeof g.version=="number"&&g.version!==i.version){if(i.migrate)return[!0,i.migrate(g.state,g.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,g.state];return[!1,void 0]}).then(g=>{var w;const[E,C]=g;if(p=i.merge(C,(w=r())!=null?w:h),n(p,!0),E)return c()}).then(()=>{m==null||m(p,void 0),p=r(),a=!0,u.forEach(g=>g(p))}).catch(g=>{m==null||m(void 0,g)})};return s.persist={setOptions:b=>{i={...i,...b},b.storage&&(l=b.storage)},clearStorage:()=>{l==null||l.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>f(),hasHydrated:()=>a,onHydrate:b=>(o.add(b),()=>{o.delete(b)}),onFinishHydration:b=>(u.add(b),()=>{u.delete(b)})},i.skipHydration||f(),p||h},kl=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((El?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Al(t,e)):Tl(t,e),Fl=kl,Il={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_REACT_APP_BUILD_DATE:"02/28/2025-13:04",VITE_REACT_APP_PLATFORM_NAME:"web",VITE_REACT_APP_STORAGE_AVAILABLE:"true",VITE_REACT_APP_STORAGE_PREFIX:"18759314-web"},ts=t=>{let e;const n=new Set,r=(c,d)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const p=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(f=>f(e,p))}},s=()=>e,u={setState:r,getState:s,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c)),destroy:()=>{(Il?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=e=t(r,s,u);return u},Rl=t=>t?ts(t):ts;function mr(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}function Jd(t,e,{batch:n={multicall:{wait:32}},pollingInterval:r=4e3,rank:s,retryCount:i,retryDelay:a,stallTimeout:o}={}){if(!t.length)throw new Error("must have at least one chain");let u=[];const l={},c={};for(const d of t){let h=!1;for(const p of e){const f=p(d);f&&(h=!0,u.some(({id:b})=>b===d.id)||(u=[...u,f.chain]),l[d.id]=[...l[d.id]||[],...f.rpcUrls.http],f.rpcUrls.webSocket&&(c[d.id]=[...c[d.id]||[],...f.rpcUrls.webSocket]))}if(!h)throw new Error([`Could not find valid provider configuration for chain "${d.name}". `,"You may need to add `jsonRpcProvider` to `configureChains` with the chain's RPC URLs.","Read more: https://wagmi.sh/core/providers/jsonRpc"].join(` `))}return{chains:u,publicClient:({chainId:d})=>{const h=u.find(b=>b.id===d)??t[0],p=l[h.id];if(!p||!p[0])throw new Error(`No providers configured for chain "${h.id}"`);const f=Yr({batch:n,chain:h,transport:Jr(p.map(b=>nc(b,{timeout:o})),{rank:s,retryCount:i,retryDelay:a}),pollingInterval:r});return Object.assign(f,{chains:u})},webSocketPublicClient:({chainId:d})=>{const h=u.find(b=>b.id===d)??t[0],p=c[h.id];if(!p||!p[0])return;const f=Yr({batch:n,chain:h,transport:Jr(p.map(b=>ll(b,{timeout:o})),{rank:s,retryCount:i,retryDelay:a}),pollingInterval:r});return Object.assign(f,{chains:u})}}}var Ml=class extends Error{constructor({activeChain:t,targetChain:e}){super(`Chain mismatch: Expected "${e}", received "${t}".`),this.name="ChainMismatchError"}},$l=class extends Error{constructor({chainId:t,connectorId:e}){super(`Chain "${t}" not configured${e?` for connector "${e}"`:""}.`),this.name="ChainNotConfigured"}},jl=class extends Error{constructor(){super(...arguments),this.name="ConnectorAlreadyConnectedError",this.message="Connector already connected"}},ql=class extends Error{constructor(){super(...arguments),this.name="ConfigChainsNotFound",this.message="No chains were found on the wagmi config. Some functions that require a chain may not work."}},Nl=class extends Error{constructor({connector:t}){super(`"${t.name}" does not support programmatic chain switching.`),this.name="SwitchChainNotSupportedError"}};function In(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!In(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(i&&!In(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}var Rn=(t,{find:e,replace:n})=>t&&e(t)?n(t):typeof t!="object"?t:Array.isArray(t)?t.map(r=>Rn(r,{find:e,replace:n})):t instanceof Object?Object.entries(t).reduce((r,[s,i])=>({...r,[s]:Rn(i,{find:e,replace:n})}),{}):t;function _l(t){const e=JSON.parse(t);return Rn(e,{find:r=>typeof r=="string"&&r.startsWith("#bigint."),replace:r=>BigInt(r.replace("#bigint.",""))})}function Ci(t){return{accessList:t.accessList,account:t.account,blockNumber:t.blockNumber,blockTag:t.blockTag,data:t.data,gas:t.gas,gasPrice:t.gasPrice,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,nonce:t.nonce,to:t.to,value:t.value}}function Bl(t){return{accessList:t.accessList,account:t.account,data:t.data,gas:t.gas,gasPrice:t.gasPrice,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,nonce:t.nonce,to:t.to,value:t.value}}function ns(t){return typeof t=="number"?t:t==="wei"?0:Math.abs(Za[t])}function rs(t,e){return t.slice(0,e).join(".")||"."}function ss(t,e){const{length:n}=t;for(let r=0;r{const a=typeof i=="bigint"?`#bigint.${i.toString()}`:i;return(e==null?void 0:e(s,a))||a},r),n??void 0)}var Ei={getItem:t=>"",setItem:(t,e)=>null,removeItem:t=>null};function xi({deserialize:t=_l,key:e="wagmi",serialize:n=Ul,storage:r}){return{...r,getItem:(s,i=null)=>{const a=r.getItem(`${e}.${s}`);try{return a?t(a):i}catch(o){return console.warn(o),i}},setItem:(s,i)=>{if(i===null)r.removeItem(`${e}.${s}`);else try{r.setItem(`${e}.${s}`,n(i))}catch(a){console.error(a)}},removeItem:s=>r.removeItem(`${e}.${s}`)}}var is="store",pe,$e,Mn,Si,Ll=class{constructor({autoConnect:t=!1,connectors:e=[new Pl],publicClient:n,storage:r=xi({storage:typeof window<"u"?window.localStorage:Ei}),logger:s={warn:console.warn},webSocketPublicClient:i}){var l,c;sn(this,Mn),this.publicClients=new Map,this.webSocketPublicClients=new Map,sn(this,pe,void 0),sn(this,$e,void 0),this.args={autoConnect:t,connectors:e,logger:s,publicClient:n,storage:r,webSocketPublicClient:i};let a="disconnected",o;if(t)try{const d=r.getItem(is),h=(l=d==null?void 0:d.state)==null?void 0:l.data;a=h!=null&&h.account?"reconnecting":"connecting",o=(c=h==null?void 0:h.chain)==null?void 0:c.id}catch{}const u=typeof e=="function"?e():e;u.forEach(d=>d.setStorage(r)),this.store=Rl(Sl(Fl(()=>({connectors:u,publicClient:this.getPublicClient({chainId:o}),status:a,webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}),{name:is,storage:r,partialize:d=>{var h,p;return{...t&&{data:{account:(h=d==null?void 0:d.data)==null?void 0:h.account,chain:(p=d==null?void 0:d.data)==null?void 0:p.chain}},chains:d==null?void 0:d.chains}},version:2}))),this.storage=r,bt(this,$e,r==null?void 0:r.getItem("wallet")),Cl(this,Mn,Si).call(this),t&&typeof window<"u"&&setTimeout(async()=>await this.autoConnect(),0)}get chains(){return this.store.getState().chains}get connectors(){return this.store.getState().connectors}get connector(){return this.store.getState().connector}get data(){return this.store.getState().data}get error(){return this.store.getState().error}get lastUsedChainId(){var t,e;return(e=(t=this.data)==null?void 0:t.chain)==null?void 0:e.id}get publicClient(){return this.store.getState().publicClient}get status(){return this.store.getState().status}get subscribe(){return this.store.subscribe}get webSocketPublicClient(){return this.store.getState().webSocketPublicClient}setState(t){const e=typeof t=="function"?t(this.store.getState()):t;this.store.setState(e,!0)}clearState(){this.setState(t=>({...t,chains:void 0,connector:void 0,data:void 0,error:void 0,status:"disconnected"}))}async destroy(){var t,e;this.connector&&await((e=(t=this.connector).disconnect)==null?void 0:e.call(t)),bt(this,pe,!1),this.clearState(),this.store.destroy()}async autoConnect(){if(rn(this,pe))return;bt(this,pe,!0),this.setState(n=>{var r;return{...n,status:(r=n.data)!=null&&r.account?"reconnecting":"connecting"}});const t=rn(this,$e)?[...this.connectors].sort(n=>n.id===rn(this,$e)?-1:1):this.connectors;let e=!1;for(const n of t){if(!n.ready||!n.isAuthorized||!await n.isAuthorized())continue;const s=await n.connect();this.setState(i=>({...i,connector:n,chains:n==null?void 0:n.chains,data:s,status:"connected"})),e=!0;break}return e||this.setState(n=>({...n,data:void 0,status:"disconnected"})),bt(this,pe,!1),this.data}setConnectors(t){this.args={...this.args,connectors:t};const e=typeof t=="function"?t():t;e.forEach(n=>n.setStorage(this.args.storage)),this.setState(n=>({...n,connectors:e}))}getPublicClient({chainId:t}={}){let e=this.publicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===t||(e=this.publicClients.get(t??-1),e))return e;const{publicClient:n}=this.args;return e=typeof n=="function"?n({chainId:t}):n,this.publicClients.set(t??-1,e),e}setPublicClient(t){var n,r;const e=(r=(n=this.data)==null?void 0:n.chain)==null?void 0:r.id;this.args={...this.args,publicClient:t},this.publicClients.clear(),this.setState(s=>({...s,publicClient:this.getPublicClient({chainId:e})}))}getWebSocketPublicClient({chainId:t}={}){let e=this.webSocketPublicClients.get(-1);if(e&&(e==null?void 0:e.chain.id)===t||(e=this.webSocketPublicClients.get(t??-1),e))return e;const{webSocketPublicClient:n}=this.args;return e=typeof n=="function"?n({chainId:t}):n,e&&this.webSocketPublicClients.set(t??-1,e),e}setWebSocketPublicClient(t){var n,r;const e=(r=(n=this.data)==null?void 0:n.chain)==null?void 0:r.id;this.args={...this.args,webSocketPublicClient:t},this.webSocketPublicClients.clear(),this.setState(s=>({...s,webSocketPublicClient:this.getWebSocketPublicClient({chainId:e})}))}setLastUsedConnector(t=null){var e;(e=this.storage)==null||e.setItem("wallet",t)}};pe=new WeakMap;$e=new WeakMap;Mn=new WeakSet;Si=function(){const t=o=>{this.setState(u=>({...u,data:{...u.data,...o}}))},e=()=>{this.clearState()},n=o=>{this.setState(u=>({...u,error:o}))};this.store.subscribe(({connector:o})=>o,(o,u)=>{var l,c,d,h,p,f;(l=u==null?void 0:u.off)==null||l.call(u,"change",t),(c=u==null?void 0:u.off)==null||c.call(u,"disconnect",e),(d=u==null?void 0:u.off)==null||d.call(u,"error",n),o&&((h=o.on)==null||h.call(o,"change",t),(p=o.on)==null||p.call(o,"disconnect",e),(f=o.on)==null||f.call(o,"error",n))});const{publicClient:r,webSocketPublicClient:s}=this.args;(typeof r=="function"||typeof s=="function")&&this.store.subscribe(({data:o})=>{var u;return(u=o==null?void 0:o.chain)==null?void 0:u.id},o=>{this.setState(u=>({...u,publicClient:this.getPublicClient({chainId:o}),webSocketPublicClient:this.getWebSocketPublicClient({chainId:o})}))})};var $n;function zl(t){const e=new Ll(t);return $n=e,e}function _(){if(!$n)throw new Error("No wagmi config found. Ensure you have set up a config: https://wagmi.sh/react/config");return $n}async function Zd({chainId:t,connector:e}){const n=_(),r=n.connector;if(r&&e.id===r.id)throw new jl;try{n.setState(i=>({...i,status:"connecting"}));const s=await e.connect({chainId:t});return n.setLastUsedConnector(e.id),n.setState(i=>({...i,connector:e,chains:e==null?void 0:e.chains,data:s,status:"connected"})),n.storage.setItem("connected",!0),{...s,connector:e}}catch(s){throw n.setState(i=>({...i,status:i.connector?"connected":"disconnected"})),s}}async function Gl(){const t=_();t.connector&&await t.connector.disconnect(),t.clearState(),t.storage.removeItem("connected")}var Wl=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],Ql=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];function U({chainId:t}={}){const e=_();return t&&e.getPublicClient({chainId:t})||e.publicClient}async function he({chainId:t}={}){var r,s;return await((s=(r=_().connector)==null?void 0:r.getWalletClient)==null?void 0:s.call(r,{chainId:t}))||null}function jn({chainId:t}={}){const e=_();return t&&e.getWebSocketPublicClient({chainId:t})||e.webSocketPublicClient}function Hl(t,e){const n=_(),r=async()=>e(U(t));return n.subscribe(({publicClient:i})=>i,r)}function Kl({chainId:t},e){const n=_(),r=async({chainId:i})=>{if(t&&i&&t!==i)return;const a=await he({chainId:t});return _().connector?e(a):e(null)};return n.subscribe(({data:i,connector:a})=>{var o;return{account:i==null?void 0:i.account,chainId:(o=i==null?void 0:i.chain)==null?void 0:o.id,connector:a}},r,{equalityFn:mr})}function Vl(t,e){const n=_(),r=async()=>e(jn(t));return n.subscribe(({webSocketPublicClient:i})=>i,r)}async function Oi({abi:t,address:e,args:n,chainId:r,dataSuffix:s,functionName:i,walletClient:a,...o}){const u=U({chainId:r}),l=a??await he({chainId:r});if(!l)throw new z;r&&Qt({chainId:r});const{account:c,accessList:d,blockNumber:h,blockTag:p,gas:f,gasPrice:b,maxFeePerGas:y,maxPriorityFeePerGas:m,nonce:g,value:w}=Ci(o),{result:E,request:C}=await u.simulateContract({abi:t,address:e,functionName:i,args:n,account:c||l.account,accessList:d,blockNumber:h,blockTag:p,dataSuffix:s,gas:f,gasPrice:b,maxFeePerGas:y,maxPriorityFeePerGas:m,nonce:g,value:w}),v=t.filter(P=>"name"in P&&P.name===i);return{mode:"prepared",request:{...C,abi:v,chainId:r},result:E}}async function Jl({chainId:t,contracts:e,blockNumber:n,blockTag:r,...s}){const i=U({chainId:t});if(!i.chains)throw new ql;if(t&&i.chain.id!==t)throw new $l({chainId:t});return i.multicall({allowFailure:s.allowFailure??!0,blockNumber:n,blockTag:r,contracts:e})}async function Zl({address:t,account:e,chainId:n,abi:r,args:s,functionName:i,blockNumber:a,blockTag:o}){return U({chainId:n}).readContract({abi:r,address:t,account:e,functionName:i,args:s,blockNumber:a,blockTag:o})}async function Xl({contracts:t,blockNumber:e,blockTag:n,...r}){const{allowFailure:s=!0}=r;try{const i=U(),a=t.reduce((c,d,h)=>{const p=d.chainId??i.chain.id;return{...c,[p]:[...c[p]||[],{contract:d,index:h}]}},{}),o=()=>Object.entries(a).map(([c,d])=>Jl({allowFailure:s,chainId:parseInt(c),contracts:d.map(({contract:h})=>h),blockNumber:e,blockTag:n})),u=(await Promise.all(o())).flat(),l=Object.values(a).flatMap(c=>c.map(({index:d})=>d));return u.reduce((c,d,h)=>(c&&(c[l[h]]=d),c),[])}catch(i){if(i instanceof Yn)throw i;const a=()=>t.map(o=>Zl({...o,blockNumber:e,blockTag:n}));return s?(await Promise.allSettled(a())).map(o=>o.status==="fulfilled"?{result:o.value,status:"success"}:{error:o.reason,result:void 0,status:"failure"}):await Promise.all(a())}}async function as(t){const e=await he({chainId:t.chainId});if(!e)throw new z;t.chainId&&Qt({chainId:t.chainId});let n;if(t.mode==="prepared")n=t.request;else{const{chainId:s,mode:i,...a}=t;n=(await Oi(a)).request}return{hash:await e.writeContract({...n,chain:t.chainId?{id:t.chainId}:null})}}async function Yl({address:t,chainId:e,formatUnits:n,token:r}){const s=_(),i=U({chainId:e});if(r){const l=async({abi:c})=>{const d={abi:c,address:r,chainId:e},[h,p,f]=await Xl({allowFailure:!1,contracts:[{...d,functionName:"balanceOf",args:[t]},{...d,functionName:"decimals"},{...d,functionName:"symbol"}]});return{decimals:p,formatted:xt(h??"0",ns(n??p)),symbol:f,value:h}};try{return await l({abi:Wl})}catch(c){if(c instanceof Yn){const{symbol:d,...h}=await l({abi:Ql});return{symbol:Ts(le(d,{dir:"right"})),...h}}throw c}}const a=[...s.publicClient.chains||[],...s.chains??[]],o=await i.getBalance({address:t}),u=a.find(l=>l.id===i.chain.id);return{decimals:(u==null?void 0:u.nativeCurrency.decimals)??18,formatted:xt(o??"0",ns(n??18)),symbol:(u==null?void 0:u.nativeCurrency.symbol)??"ETH",value:o}}function Ai(){const{data:t,connector:e,status:n}=_();switch(n){case"connected":return{address:t==null?void 0:t.account,connector:e,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:n};case"reconnecting":return{address:t==null?void 0:t.account,connector:e,isConnected:!!(t!=null&&t.account),isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:n};case"connecting":return{address:t==null?void 0:t.account,connector:e,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:n};case"disconnected":return{address:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:n}}}function gr(){var s,i,a,o;const t=_(),e=(i=(s=t.data)==null?void 0:s.chain)==null?void 0:i.id,n=t.chains??[],r=[...((a=t.publicClient)==null?void 0:a.chains)||[],...n].find(u=>u.id===e)??{id:e,name:`Chain ${e}`,network:`${e}`,nativeCurrency:{name:"Ether",decimals:18,symbol:"ETH"},rpcUrls:{default:{http:[""]},public:{http:[""]}}};return{chain:e?{...r,...(o=t.data)==null?void 0:o.chain,id:e}:void 0,chains:n}}async function ed(t){const e=await he();if(!e)throw new z;return await e.signMessage({message:t.message})}async function td({chainId:t}){const{connector:e}=_();if(!e)throw new z;if(!e.switchChain)throw new Nl({connector:e});return e.switchChain(t)}function nd(t,{selector:e=n=>n}={}){const n=_(),r=()=>t(Ai());return n.subscribe(({data:i,connector:a,status:o})=>e({address:i==null?void 0:i.account,connector:a,status:o}),r,{equalityFn:mr})}function rd(t,{selector:e=n=>n}={}){const n=_(),r=()=>t(gr());return n.subscribe(({data:i,chains:a})=>{var o;return e({chainId:(o=i==null?void 0:i.chain)==null?void 0:o.id,chains:a})},r,{equalityFn:mr})}async function sd({chainId:t,name:e}){const{normalize:n}=await qn(async()=>{const{normalize:i}=await import("./index-CKrDYfdW.js");return{normalize:i}},__vite__mapDeps([4,1,2,3])),s=await U({chainId:t}).getEnsAddress({name:n(e)});try{return s==="0x0000000000000000000000000000000000000000"?null:s?be(s):null}catch{return null}}async function Xd({name:t,chainId:e}){const{normalize:n}=await qn(async()=>{const{normalize:i}=await import("./index-CKrDYfdW.js");return{normalize:i}},__vite__mapDeps([4,1,2,3]));return await U({chainId:e}).getEnsAvatar({name:n(t)})}async function Yd({address:t,chainId:e}){return U({chainId:e}).getEnsName({address:be(t)})}async function id({chainId:t}={}){return await U({chainId:t}).getBlockNumber()}async function Ti({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,nonce:u,to:l,value:c,walletClient:d}){const h=U({chainId:n}),p=d??await he({chainId:n});if(!p)throw new z;n&&Qt({chainId:n});const f=(l&&!K(l)?await sd({name:l}):l)||void 0;if(f&&!K(f))throw new Error("Invalid address");const b=typeof s>"u"?await h.estimateGas({accessList:t,account:p.account,data:r,gas:s??void 0,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,nonce:u,to:f,value:c}):s||void 0;return{accessList:t,account:e,data:r,gas:b,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:"prepared",nonce:u,to:f,value:c,...n?{chainId:n}:{}}}async function ad({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,to:c,value:d}){const h=await he({chainId:n});if(!h)throw new z;n&&Qt({chainId:n});let p;return u==="prepared"?p={account:e,accessList:t,chain:null,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,nonce:l,to:c,value:d}:p=await Ti({accessList:t,account:e,chainId:n,data:r,gas:s||null,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,nonce:l,to:c,value:d}),{hash:await h.sendTransaction({...p,chain:n?{id:n}:null})}}function Qt({chainId:t}){var s,i;const{chain:e,chains:n}=gr(),r=e==null?void 0:e.id;if(r&&t!==r)throw new Ml({activeChain:((s=n.find(a=>a.id===r))==null?void 0:s.name)??`Chain ${r}`,targetChain:((i=n.find(a=>a.id===t))==null?void 0:i.name)??`Chain ${t}`})}var ki={exports:{}},Fi={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ht=T,od=Dn;function ud(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var cd=typeof Object.is=="function"?Object.is:ud,ld=od.useSyncExternalStore,dd=Ht.useRef,fd=Ht.useEffect,hd=Ht.useMemo,pd=Ht.useDebugValue;Fi.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=dd(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=hd(function(){function u(p){if(!l){if(l=!0,c=p,p=r(p),s!==void 0&&a.hasValue){var f=a.value;if(s(f,p))return d=f}return d=p}if(f=d,cd(c,p))return f;var b=r(p);return s!==void 0&&s(f,b)?f:(c=p,d=b)}var l=!1,c,d,h=n===void 0?null:n;return[function(){return u(e())},h===null?void 0:function(){return u(h())}]},[e,n,r,s]);var o=ld(t,i[0],i[1]);return fd(function(){a.hasValue=!0,a.value=o},[o]),pd(o),o};ki.exports=Fi;var wr=ki.exports;function ef({queryClient:t=new Xi({defaultOptions:{queries:{cacheTime:1e3*60*60*24,networkMode:"offlineFirst",refetchOnWindowFocus:!1,retry:0},mutations:{networkMode:"offlineFirst"}}}),storage:e=xi({storage:typeof window<"u"&&window.localStorage?window.localStorage:Ei}),persister:n=typeof window<"u"?Ni({key:"cache",storage:e,serialize:s=>s,deserialize:s=>s}):void 0,...r}){const s=zl({...r,storage:e});return n&&Fa({queryClient:t,persister:n,dehydrateOptions:{shouldDehydrateQuery:i=>i.cacheTime!==0&&i.queryKey[0].persist!==!1}}),Object.assign(s,{queryClient:t})}var Ii=T.createContext(void 0),Kt=T.createContext(void 0);function tf({children:t,config:e}){return T.createElement(Ii.Provider,{children:T.createElement(wa,{children:t,client:e.queryClient,context:Kt}),value:e})}function vr(){const t=T.useContext(Ii);if(!t)throw new Error(["`useConfig` must be used within `WagmiConfig`.\n","Read more: https://wagmi.sh/react/WagmiConfig"].join(` `));return t}var yd=Dn.useSyncExternalStore;function bd(t){return Array.isArray(t)}function md(t){if(!os(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const n=e.prototype;return!(!os(n)||!n.hasOwnProperty("isPrototypeOf"))}function os(t){return Object.prototype.toString.call(t)==="[object Object]"}function gd(t,e,n){return bd(t)?typeof e=="function"?{...n,queryKey:t,queryFn:e}:{...e,queryKey:t}:t}function wd(t){return JSON.stringify(t,(e,n)=>md(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):typeof n=="bigint"?n.toString():n)}function vd(t,e){return typeof t=="function"?t(...e):!!t}function Pd(t,e){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(e.trackedProps.add(r),t[r])})}),n}function Cd(t,e){const n=Un({context:t.context}),r=va(),s=Ea(),i=n.defaultQueryOptions({...t,queryKeyHashFn:wd});i._optimisticResults=r?"isRestoring":"optimistic",i.onError&&(i.onError=R.batchCalls(i.onError)),i.onSuccess&&(i.onSuccess=R.batchCalls(i.onSuccess)),i.onSettled&&(i.onSettled=R.batchCalls(i.onSettled)),i.suspense&&typeof i.staleTime!="number"&&(i.staleTime=1e3),(i.suspense||i.useErrorBoundary)&&(s.isReset()||(i.retryOnMount=!1));const[a]=T.useState(()=>new e(n,i)),o=a.getOptimisticResult(i);if(yd(T.useCallback(d=>r?()=>{}:a.subscribe(R.batchCalls(d)),[a,r]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),T.useEffect(()=>{s.clearReset()},[s]),T.useEffect(()=>{a.setOptions(i,{listeners:!1})},[i,a]),i.suspense&&o.isLoading&&o.isFetching&&!r)throw a.fetchOptimistic(i).then(({data:d})=>{var h,p;(h=i.onSuccess)==null||h.call(i,d),(p=i.onSettled)==null||p.call(i,d,null)}).catch(d=>{var h,p;s.clearReset(),(h=i.onError)==null||h.call(i,d),(p=i.onSettled)==null||p.call(i,void 0,d)});if(o.isError&&!s.isReset()&&!o.isFetching&&vd(i.useErrorBoundary,[o.error,a.getCurrentQuery()]))throw o.error;const u=o.status==="loading"&&o.fetchStatus==="idle"?"idle":o.status,l=u==="idle",c=u==="loading"&&o.fetchStatus==="fetching";return{...o,defaultedOptions:i,isIdle:l,isLoading:c,observer:a,status:u}}function lt(t,e,n){const r=ls(t,e,n);return Sa({context:Kt,...r})}function dt(t,e,n){const r=gd(t,e,n),s=Cd({context:Kt,...r},Yi),i={data:s.data,error:s.error,fetchStatus:s.fetchStatus,isError:s.isError,isFetched:s.isFetched,isFetchedAfterMount:s.isFetchedAfterMount,isFetching:s.isFetching,isIdle:s.isIdle,isLoading:s.isLoading,isRefetching:s.isRefetching,isSuccess:s.isSuccess,refetch:s.refetch,status:s.status,internal:{dataUpdatedAt:s.dataUpdatedAt,errorUpdatedAt:s.errorUpdatedAt,failureCount:s.failureCount,isFetchedAfterMount:s.isFetchedAfterMount,isLoadingError:s.isLoadingError,isPaused:s.isPaused,isPlaceholderData:s.isPlaceholderData,isPreviousData:s.isPreviousData,isRefetchError:s.isRefetchError,isStale:s.isStale,remove:s.remove}};return s.defaultedOptions.notifyOnChangeProps?i:Pd(i,s.observer)}var Pr=()=>Un({context:Kt});function Ri({chainId:t}={}){return wr.useSyncExternalStoreWithSelector(e=>Hl({chainId:t},e),()=>U({chainId:t}),()=>U({chainId:t}),e=>e,(e,n)=>e.uid===n.uid)}function an({chainId:t}){return[{entity:"walletClient",chainId:t,persist:!1}]}function Ed({queryKey:[{chainId:t}]}){return he({chainId:t})}function Mi({chainId:t,suspense:e,onError:n,onSettled:r,onSuccess:s}={}){const{connector:i}=kd(),a=Cr({chainId:t}),o=dt(an({chainId:a}),Ed,{cacheTime:0,enabled:!!i,staleTime:1/0,suspense:e,onError:n,onSettled:r,onSuccess:s}),u=Pr();return T.useEffect(()=>Kl({chainId:a},c=>{c?u.invalidateQueries(an({chainId:a})):u.removeQueries(an({chainId:a}))}),[u,a]),o}function xd({chainId:t}={}){return wr.useSyncExternalStoreWithSelector(e=>Vl({chainId:t},e),()=>jn({chainId:t}),()=>jn({chainId:t}),e=>e,(e,n)=>(e==null?void 0:e.uid)===(n==null?void 0:n.uid))}function Cr({chainId:t}={}){return Ri({chainId:t}).chain.id}function Sd(){const[,t]=T.useReducer(e=>e+1,0);return t}function us({chainId:t,scopeKey:e}){return[{entity:"blockNumber",chainId:t,scopeKey:e}]}function Od({queryKey:[{chainId:t}]}){return id({chainId:t})}function Ad({cacheTime:t=0,chainId:e,enabled:n=!0,scopeKey:r,staleTime:s,suspense:i,watch:a=!1,onBlock:o,onError:u,onSettled:l,onSuccess:c}={}){const d=Cr({chainId:e}),h=Ri({chainId:d}),p=xd({chainId:d}),f=Pr();return T.useEffect(()=>!n||!a&&!o?void 0:(p??h).watchBlockNumber({onBlockNumber:m=>{a&&f.setQueryData(us({chainId:d,scopeKey:r}),m),o&&o(m)},emitOnBegin:!0}),[d,r,o,h,f,a,p,n]),dt(us({scopeKey:r,chainId:d}),Od,{cacheTime:t,enabled:n,staleTime:s,suspense:i,onError:u,onSettled:l,onSuccess:c})}function Td({chainId:t,enabled:e,queryKey:n}){const r=Pr(),s=T.useCallback(()=>r.invalidateQueries({queryKey:n},{cancelRefetch:!1}),[r,n]);Ad({chainId:t,enabled:e,onBlock:e?s:void 0,scopeKey:e?void 0:"idle"})}var on=t=>typeof t=="object"&&!Array.isArray(t);function $i(t,e,n=e,r=In){const s=T.useRef([]),i=wr.useSyncExternalStoreWithSelector(t,e,n,a=>a,(a,o)=>{if(on(a)&&on(o)&&s.current.length){for(const u of s.current)if(!r(a[u],o[u]))return!1;return!0}return r(a,o)});if(on(i)){const a={...i};return Object.defineProperties(a,Object.entries(a).reduce((o,[u,l])=>({...o,[u]:{configurable:!1,enumerable:!0,get:()=>(s.current.includes(u)||s.current.push(u),l)}}),{})),a}return i}function kd({onConnect:t,onDisconnect:e}={}){const n=vr(),r=T.useCallback(o=>nd(o),[n]),s=$i(r,Ai),i=T.useRef(),a=i.current;return T.useEffect(()=>{(a==null?void 0:a.status)!=="connected"&&s.status==="connected"&&(t==null||t({address:s.address,connector:s.connector,isReconnected:(a==null?void 0:a.status)==="reconnecting"||(a==null?void 0:a.status)===void 0})),(a==null?void 0:a.status)==="connected"&&s.status==="disconnected"&&(e==null||e()),i.current=s},[t,e,a,s]),s}function Fd({address:t,chainId:e,formatUnits:n,scopeKey:r,token:s}){return[{entity:"balance",address:t,chainId:e,formatUnits:n,scopeKey:r,token:s}]}function Id({queryKey:[{address:t,chainId:e,formatUnits:n,token:r}]}){if(!t)throw new Error("address is required");return Yl({address:t,chainId:e,formatUnits:n,token:r})}function nf({address:t,cacheTime:e,chainId:n,enabled:r=!0,formatUnits:s,scopeKey:i,staleTime:a,suspense:o,token:u,watch:l,onError:c,onSettled:d,onSuccess:h}={}){const p=Cr({chainId:n}),f=T.useMemo(()=>Fd({address:t,chainId:p,formatUnits:s,scopeKey:i,token:u}),[t,p,s,i,u]),b=dt(f,Id,{cacheTime:e,enabled:!!(r&&t),staleTime:a,suspense:o,onError:c,onSettled:d,onSuccess:h});return Td({chainId:p,enabled:!!(r&&l&&t),queryKey:f}),b}var Rd=[{entity:"disconnect"}],Md=()=>Gl();function rf({onError:t,onMutate:e,onSettled:n,onSuccess:r}={}){const{error:s,isError:i,isIdle:a,isLoading:o,isSuccess:u,mutate:l,mutateAsync:c,reset:d,status:h}=lt(Rd,Md,{...t?{onError(p,f,b){t(p,b)}}:{},onMutate:e,...n?{onSettled(p,f,b,y){n(f,y)}}:{},...r?{onSuccess(p,f,b){r(b)}}:{}});return{disconnect:l,disconnectAsync:c,error:s,isError:i,isIdle:a,isLoading:o,isSuccess:u,reset:d,status:h}}function ji(){const t=vr(),e=T.useCallback(n=>rd(n),[t]);return $i(e,gr)}var $d=t=>[{entity:"signMessage",...t}],jd=t=>{const{message:e}=t;if(!e)throw new Error("message is required");return ed({message:e})};function sf({message:t,onError:e,onMutate:n,onSettled:r,onSuccess:s}={}){const{data:i,error:a,isError:o,isIdle:u,isLoading:l,isSuccess:c,mutate:d,mutateAsync:h,reset:p,status:f,variables:b}=lt($d({message:t}),jd,{onError:e,onMutate:n,onSettled:r,onSuccess:s}),y=T.useCallback(g=>d(g||{message:t}),[t,d]),m=T.useCallback(g=>h(g||{message:t}),[t,h]);return{data:i,error:a,isError:o,isIdle:u,isLoading:l,isSuccess:c,reset:p,signMessage:y,signMessageAsync:m,status:f,variables:b}}var qd=t=>[{entity:"switchNetwork",...t}],Nd=t=>{const{chainId:e}=t;if(!e)throw new Error("chainId is required");return td({chainId:e})};function af({chainId:t,throwForSwitchChainNotSupported:e,onError:n,onMutate:r,onSettled:s,onSuccess:i}={}){var S;const a=vr(),o=Sd(),{data:u,error:l,isError:c,isIdle:d,isLoading:h,isSuccess:p,mutate:f,mutateAsync:b,reset:y,status:m,variables:g}=lt(qd({chainId:t}),Nd,{onError:n,onMutate:r,onSettled:s,onSuccess:i}),w=T.useCallback(A=>f({chainId:A??t}),[t,f]),E=T.useCallback(A=>b({chainId:A??t}),[t,b]);T.useEffect(()=>a.subscribe(({chains:I,connector:F})=>({chains:I,connector:F}),o),[a,o]);let C,v;const P=!!((S=a.connector)!=null&&S.switchChain);return(e||P)&&(C=w,v=E),{chains:a.chains??[],data:u,error:l,isError:c,isIdle:d,isLoading:h,isSuccess:p,pendingChainId:g==null?void 0:g.chainId,reset:y,status:m,switchNetwork:C,switchNetworkAsync:v,variables:g}}function _d({address:t,abi:e,functionName:n,...r}){const{args:s,accessList:i,account:a,dataSuffix:o,gas:u,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:h,request:p,value:f}=r;return[{entity:"writeContract",address:t,args:s,abi:e,accessList:i,account:a,dataSuffix:o,functionName:n,gas:u,gasPrice:l,maxFeePerGas:c,maxPriorityFeePerGas:d,nonce:h,request:p,value:f}]}function Bd(t){if(t.mode==="prepared"){if(!t.request)throw new Error("request is required");return as({mode:"prepared",request:t.request})}if(!t.address)throw new Error("address is required");if(!t.abi)throw new Error("abi is required");if(!t.functionName)throw new Error("functionName is required");return as({address:t.address,args:t.args,chainId:t.chainId,abi:t.abi,functionName:t.functionName,accessList:t.accessList,account:t.account,dataSuffix:t.dataSuffix,gas:t.gas,gasPrice:t.gasPrice,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas,nonce:t.nonce,value:t.value})}function of(t){const{address:e,abi:n,args:r,chainId:s,functionName:i,mode:a,request:o,dataSuffix:u}=t,{accessList:l,account:c,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,value:y}=Bl(t),{data:m,error:g,isError:w,isIdle:E,isLoading:C,isSuccess:v,mutate:P,mutateAsync:S,reset:A,status:I,variables:F}=lt(_d({address:e,abi:n,functionName:i,chainId:s,mode:a,args:r,accessList:l,account:c,dataSuffix:u,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,request:o,value:y}),Bd,{onError:t.onError,onMutate:t.onMutate,onSettled:t.onSettled,onSuccess:t.onSuccess}),oe=T.useMemo(()=>t.mode==="prepared"?o?()=>P({mode:"prepared",request:t.request,chainId:t.chainId}):void 0:Vt=>P({address:e,args:r,abi:n,functionName:i,chainId:s,accessList:l,account:c,dataSuffix:u,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,value:y,...Vt}),[l,c,n,e,r,s,t.chainId,t.mode,t.request,u,i,d,h,p,f,P,b,o,y]),ue=T.useMemo(()=>t.mode==="prepared"?o?()=>S({mode:"prepared",request:t.request}):void 0:Vt=>S({address:e,args:r,abi:n,chainId:s,functionName:i,accessList:l,account:c,dataSuffix:u,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,value:y,...Vt}),[l,c,n,e,r,s,t.mode,t.request,u,i,d,h,p,f,S,b,o,y]);return{data:m,error:g,isError:w,isIdle:E,isLoading:C,isSuccess:v,reset:A,status:I,variables:F,write:oe,writeAsync:ue}}function Dd({accessList:t,account:e,activeChainId:n,args:r,address:s,blockNumber:i,blockTag:a,chainId:o,dataSuffix:u,functionName:l,gas:c,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:f,scopeKey:b,walletClientAddress:y,value:m}){return[{entity:"prepareContractTransaction",accessList:t,account:e,activeChainId:n,address:s,args:r,blockNumber:i,blockTag:a,chainId:o,dataSuffix:u,functionName:l,gas:c,gasPrice:d,maxFeePerGas:h,maxPriorityFeePerGas:p,nonce:f,scopeKey:b,walletClientAddress:y,value:m}]}function Ud({abi:t,walletClient:e}){return({queryKey:[{accessList:n,account:r,args:s,address:i,blockNumber:a,blockTag:o,chainId:u,dataSuffix:l,functionName:c,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,value:y}]})=>{if(!t)throw new Error("abi is required");if(!i)throw new Error("address is required");if(!c)throw new Error("functionName is required");return Oi({abi:t,accessList:n,account:r,args:s,address:i,blockNumber:a,blockTag:o,chainId:u,dataSuffix:l,functionName:c,gas:d,gasPrice:h,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:b,walletClient:e,value:y})}}function uf({address:t,abi:e,functionName:n,chainId:r,args:s,cacheTime:i,dataSuffix:a,enabled:o=!0,scopeKey:u,staleTime:l,suspense:c,onError:d,onSettled:h,onSuccess:p,...f}={}){const{chain:b}=ji(),{data:y}=Mi({chainId:r}),{accessList:m,account:g,blockNumber:w,blockTag:E,gas:C,gasPrice:v,maxFeePerGas:P,maxPriorityFeePerGas:S,nonce:A,value:I}=Ci(f),F=dt(Dd({accessList:m,account:g,activeChainId:b==null?void 0:b.id,address:t,args:s,blockNumber:w,blockTag:E,chainId:r,dataSuffix:a,functionName:n,gas:C,gasPrice:v,maxFeePerGas:P,maxPriorityFeePerGas:S,nonce:A,scopeKey:u,walletClientAddress:y==null?void 0:y.account.address,value:I}),Ud({abi:e,walletClient:y}),{cacheTime:i,enabled:!!(o&&e&&t&&n&&y),staleTime:l,suspense:c,onError:d,onSettled:h,onSuccess:p});return Object.assign(F,{config:{chainId:r,mode:"prepared",request:void 0,...F.data}})}function Ld({accessList:t,account:e,activeChainId:n,chainId:r,data:s,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:u,nonce:l,to:c,value:d,scopeKey:h,walletClientAddress:p}){return[{entity:"prepareSendTransaction",activeChainId:n,accessList:t,account:e,chainId:r,data:s,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:u,nonce:l,to:c,value:d,scopeKey:h,walletClientAddress:p}]}function zd({walletClient:t}){return({queryKey:[{accessList:e,account:n,chainId:r,data:s,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:u,nonce:l,to:c,value:d}]})=>{if(!c)throw new Error("to is required");return Ti({accessList:e,account:n,chainId:r,data:s,gas:i,gasPrice:a,maxFeePerGas:o,maxPriorityFeePerGas:u,nonce:l,to:c,value:d,walletClient:t})}}function cf({accessList:t,account:e,chainId:n,cacheTime:r,data:s,enabled:i=!0,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,scopeKey:d,staleTime:h,suspense:p,to:f,value:b,onError:y,onSettled:m,onSuccess:g}={}){const{chain:w}=ji(),{data:E}=Mi({chainId:n}),C=dt(Ld({accessList:t,activeChainId:w==null?void 0:w.id,account:e,chainId:n,data:s,gas:a,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:l,nonce:c,scopeKey:d,to:f,value:b,walletClientAddress:E==null?void 0:E.account.address}),zd({walletClient:E}),{cacheTime:r,enabled:!!(i&&E&&f),staleTime:h,suspense:p,onError:y,onSettled:m,onSuccess:g});return Object.assign(C,{config:{mode:"prepared",...C.isSuccess?C.data:void 0}})}var Gd=t=>[{entity:"sendTransaction",...t}],Wd=({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,to:c,value:d})=>{if(!c)throw new Error("to is required.");return ad({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,to:c,value:d})};function lf({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,to:c,value:d,onError:h,onMutate:p,onSettled:f,onSuccess:b}={}){const{data:y,error:m,isError:g,isIdle:w,isLoading:E,isSuccess:C,mutate:v,mutateAsync:P,reset:S,status:A,variables:I}=lt(Gd({accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,to:c,value:d}),Wd,{onError:h,onMutate:p,onSettled:f,onSuccess:b}),F=T.useCallback(ue=>v({chainId:n,mode:u,...ue||{accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,value:d,to:c}}),[t,e,n,r,s,i,a,o,u,v,l,c,d]),oe=T.useCallback(ue=>P({chainId:n,mode:u,...ue||{accessList:t,account:e,chainId:n,data:r,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:o,mode:u,nonce:l,value:d,to:c}}),[t,e,n,r,s,i,a,o,u,P,l,c,d]);return{data:y,error:m,isError:g,isIdle:w,isLoading:E,isSuccess:C,reset:S,sendTransaction:u==="prepared"&&!c?void 0:F,sendTransactionAsync:u==="prepared"&&!c?void 0:oe,status:A,variables:I}}export{H as $,lf as A,of as B,wl as C,Wl as D,nf as E,ic as F,gc as G,wc as H,Pl as I,vc as J,ci as K,sc as L,gt as M,x as N,It as O,N as P,K as Q,_e as R,Ce as S,du as T,Q as U,Ut as V,tf as W,Z as X,nt as Y,je as Z,ml as _,Vd as a,rf as a0,bl as b,cl as c,Ju as d,gl as e,Gl as f,be as g,Ai as h,Yl as i,gr as j,rd as k,Yd as l,Xd as m,k as n,Zd as o,Jd as p,ef as q,fl as r,td as s,kd as t,ji as u,sf as v,nd as w,af as x,cf as y,uf as z};