@latticexyz/explorer 2.2.17-73859484bb53c1a4066de028a3ad7d3a4284e4da → 2.2.17-7c3df691b30f031202ab184345cbb76bb113c2cd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/packages/explorer/.next/BUILD_ID +1 -1
- package/.next/standalone/packages/explorer/.next/app-build-manifest.json +29 -29
- package/.next/standalone/packages/explorer/.next/app-path-routes-manifest.json +1 -1
- package/.next/standalone/packages/explorer/.next/build-manifest.json +2 -2
- package/.next/standalone/packages/explorer/.next/prerender-manifest.json +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/page.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/explore/page.js +5 -5
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/explore/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/interact/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/page.js +2 -2
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/[worldAddress]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/page.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/[chainName]/worlds/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/api/world-abi/route.js +3 -3
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/page.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/(explorer)/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/internal/observer-relay/page_client-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/internal/observer-relay.html +1 -1
- package/.next/standalone/packages/explorer/.next/server/app/internal/observer-relay.rsc +1 -1
- package/.next/standalone/packages/explorer/.next/server/app-paths-manifest.json +4 -4
- package/.next/standalone/packages/explorer/.next/server/chunks/6561.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/middleware-build-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/pages/404.html +1 -1
- package/.next/standalone/packages/explorer/.next/server/pages/500.html +1 -1
- package/.next/standalone/packages/explorer/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/packages/explorer/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/packages/explorer/.next/static/chunks/{9154-0a5af17bac14be88.js → 9154-f4682040f04bc0eb.js} +2 -2
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/layout-5231ad058b0ee141.js +1 -0
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/worlds/[worldAddress]/explore/{page-9ff4337c9343da7f.js → page-b7494f5b36ab5348.js} +1 -1
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/worlds/[worldAddress]/interact/page-f8fd5231d2bc42f3.js +1 -0
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/worlds/[worldAddress]/{layout-63f28150e24ab732.js → layout-f1e4b28982b703bc.js} +1 -1
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/worlds/[worldAddress]/observe/{page-e716403d962a4a59.js → page-35ac1690de80f649.js} +1 -1
- package/package.json +10 -10
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/layout-4b139f041b8b121d.js +0 -1
- package/.next/standalone/packages/explorer/.next/static/chunks/app/(explorer)/[chainName]/worlds/[worldAddress]/interact/page-3c2790901334458e.js +0 -1
- /package/.next/standalone/packages/explorer/.next/static/{hw1ae3nvKjK8T8XTC3K_D → F0AIc2MLnr_ZGumwf3iCC}/_buildManifest.js +0 -0
- /package/.next/standalone/packages/explorer/.next/static/{hw1ae3nvKjK8T8XTC3K_D → F0AIc2MLnr_ZGumwf3iCC}/_ssgManifest.js +0 -0
package/.next/standalone/packages/explorer/.next/server/app/(explorer)/api/world-abi/route.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var e={};e.id=9373,e.ids=[9373],e.modules={20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},22037:e=>{"use strict";e.exports=require("os")},76224:e=>{"use strict";e.exports=require("tty")},73837:e=>{"use strict";e.exports=require("util")},33800:(e,t,n)=>{"use strict";let r,a;n.r(t),n.d(t,{originalPathname:()=>oz,patchFetch:()=>oU,requestAsyncStorage:()=>oD,routeModule:()=>oL,serverHooks:()=>oB,staticGenerationAsyncStorage:()=>oZ});var s,i,o,u,l,c,d,p,y,m,f,h,b,g,v,w,_,x,T,k,I,O,C,E,S,R,j,A={};n.r(A),n.d(A,{GET:()=>oM,dynamic:()=>oN});var N=n(50705),$=n(20022),F=n(55669);let P=256;function M(e=11){if(!r||P+e>512){r="",P=0;for(let e=0;e<256;e++)r+=(256+256*Math.random()|0).toString(16).substring(1)}return r.substring(P,P+++e)}function L(e){var t;let{batch:n,cacheTime:r=e.pollingInterval??4e3,ccipRead:a,key:s="base",name:i="Base Client",pollingInterval:o=4e3,type:u="base"}=e,l=e.chain,c=e.account?"string"==typeof(t=e.account)?{address:t,type:"json-rpc"}:t:void 0,{config:d,request:p,value:y}=e.transport({chain:l,pollingInterval:o}),m={account:c,batch:n,cacheTime:r,ccipRead:a,chain:l,key:s,name:i,pollingInterval:o,request:p,transport:{...d,...y},type:u,uid:M()};return Object.assign(m,{extend:function e(t){return n=>{let r=n(t);for(let e in m)delete r[e];let a={...t,...r};return Object.assign(a,{extend:e(a)})}}(m)})}let D=(e,t,n)=>JSON.stringify(e,(e,n)=>{let r="bigint"==typeof n?n.toString():n;return"function"==typeof t?t(e,r):r},n);var Z=n(44357);let B=e=>e;class z extends Z.G{constructor({body:e,cause:t,details:n,headers:r,status:a,url:s}){super("HTTP request failed.",{cause:t,details:n,metaMessages:[a&&`Status: ${a}`,`URL: ${B(s)}`,e&&`Request body: ${D(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=a,this.url=s}}class U extends Z.G{constructor({body:e,error:t,url:n}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${B(n)}`,`Request body: ${D(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class q extends Z.G{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${B(t)}`,`Request body: ${D(e)}`],name:"TimeoutError"})}}class V extends Z.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}let W=new Map,G={current:0,take(){return this.current++},reset(){this.current=0}};function H(e,t={}){return{async request(n){let{body:r,onRequest:a=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,o={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:l,signal:c}=o;try{let t;let n=await function(e,{errorInstance:t=Error("timed out"),timeout:n,signal:r}){return new Promise((a,s)=>{(async()=>{let i;try{let o=new AbortController;n>0&&(i=setTimeout(()=>{r?o.abort():s(t)},n)),a(await e({signal:o?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(i)}})()})}(async({signal:t})=>{let n={...o,body:Array.isArray(r)?D(r.map(e=>({jsonrpc:"2.0",id:e.id??G.take(),...e}))):D({jsonrpc:"2.0",id:r.id??G.take(),...r}),headers:{"Content-Type":"application/json",...u},method:l||"POST",signal:c||(i>0?t:null)},s=new Request(e,n);return a&&await a(s),await fetch(e,n)},{errorInstance:new q({body:r,url:e}),timeout:i,signal:!0});if(s&&await s(n),n.headers.get("Content-Type")?.startsWith("application/json"))t=await n.json();else{t=await n.text();try{t=JSON.parse(t||"{}")}catch(e){if(n.ok)throw e;t={error:t}}}if(!n.ok)throw new z({body:r,details:D(t.error)||n.statusText,headers:n.headers,status:n.status,url:e});return t}catch(t){if(t instanceof z||t instanceof q)throw t;throw new z({body:r,cause:t,url:e})}}}}class J extends Z.G{constructor(e,{code:t,docsPath:n,metaMessages:r,name:a,shortMessage:s}){super(s,{cause:e,docsPath:n,metaMessages:r||e?.metaMessages,name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof U?e.code:t??-1}}class K extends J{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class Y extends J{constructor(e){super(e,{code:Y.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Q extends J{constructor(e){super(e,{code:Q.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Q,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class X extends J{constructor(e,{method:t}={}){super(e,{code:X.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(X,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ee extends J{constructor(e){super(e,{code:ee.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(ee,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class et extends J{constructor(e){super(e,{code:et.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class en extends J{constructor(e){super(e,{code:en.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class er extends J{constructor(e){super(e,{code:er.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(er,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ea extends J{constructor(e){super(e,{code:ea.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ea,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class es extends J{constructor(e){super(e,{code:es.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(es,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class ei extends J{constructor(e,{method:t}={}){super(e,{code:ei.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not implemented.`})}}Object.defineProperty(ei,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class eo extends J{constructor(e){super(e,{code:eo.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class eu extends J{constructor(e){super(e,{code:eu.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class el extends K{constructor(e){super(e,{code:el.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(el,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class ec extends K{constructor(e){super(e,{code:ec.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(ec,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ed extends K{constructor(e,{method:t}={}){super(e,{code:ed.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(ed,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ep extends K{constructor(e){super(e,{code:ep.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ep,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ey extends K{constructor(e){super(e,{code:ey.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ey,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class em extends K{constructor(e){super(e,{code:em.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(em,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ef extends J{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}var eh=n(88090),eb=n(50916);let eg=new(n(5898)).k(8192);async function ev(e){return new Promise(t=>setTimeout(t,e))}function ew(e,t={}){let{batch:n,fetchOptions:r,key:a="http",name:s="HTTP JSON-RPC",onFetchRequest:i,onFetchResponse:o,retryDelay:u}=t;return({chain:l,retryCount:c,timeout:d})=>{let{batchSize:p=1e3,wait:y=0}="object"==typeof n?n:{},m=t.retryCount??c,f=d??t.timeout??1e4,h=e||l?.rpcUrls.default.http[0];if(!h)throw new V;let b=H(h,{fetchOptions:r,onRequest:i,onResponse:o,timeout:f});return function({key:e,name:t,request:n,retryCount:r=3,retryDelay:a=150,timeout:s,type:i},o){return{config:{key:e,name:t,request:n,retryCount:r,retryDelay:a,timeout:s,type:i},request:function(e,t={}){return async(n,r={})=>{let{dedupe:a=!1,retryDelay:s=150,retryCount:i=3,uid:o}={...t,...r},u=a?(0,eb.w)((0,eh.$G)(`${o}.${D(n)}`)):void 0;return function(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(eg.get(n))return eg.get(n);let r=e().finally(()=>eg.delete(n));return eg.set(n,r),r}(()=>(function(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((a,s)=>{let i=async({count:o=0}={})=>{let u=async({error:e})=>{let n="function"==typeof t?t({count:o,error:e}):t;n&&await ev(n),i({count:o+1})};try{let t=await e();a(t)}catch(e){if(o<n&&await r({count:o,error:e}))return u({error:e});s(e)}};i()})})(async()=>{try{return await e(n)}catch(e){switch(e.code){case Y.code:throw new Y(e);case Q.code:throw new Q(e);case X.code:throw new X(e,{method:n.method});case ee.code:throw new ee(e);case et.code:throw new et(e);case en.code:throw new en(e);case er.code:throw new er(e);case ea.code:throw new ea(e);case es.code:throw new es(e);case ei.code:throw new ei(e,{method:n.method});case eo.code:throw new eo(e);case eu.code:throw new eu(e);case el.code:throw new el(e);case ec.code:throw new ec(e);case ed.code:throw new ed(e);case ep.code:throw new ep(e);case ey.code:throw new ey(e);case em.code:throw new em(e);case 5e3:throw new el(e);default:if(e instanceof Z.G)throw e;throw new ef(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof z){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<<e)*s},retryCount:i,shouldRetry:({error:e})=>"code"in e&&"number"==typeof e.code?-1===e.code||e.code===eo.code||e.code===et.code:!(e instanceof z)||!e.status||403===e.status||408===e.status||413===e.status||429===e.status||500===e.status||502===e.status||503===e.status||504===e.status}),{enabled:a,id:u})}}(n,{retryCount:r,retryDelay:a,uid:M()}),value:o}}({key:a,name:s,async request({method:e,params:t}){let r={method:e,params:t},{schedule:a}=function({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:a}){let s=async()=>{let t=u();i();let n=t.map(({args:e})=>e);0!==n.length&&e(n).then(e=>{a&&Array.isArray(e)&&e.sort(a);for(let n=0;n<t.length;n++){let{pendingPromise:r}=t[n];r.resolve?.([e[n],e])}}).catch(e=>{for(let n=0;n<t.length;n++){let{pendingPromise:r}=t[n];r.reject?.(e)}})},i=()=>W.delete(t),o=()=>u().map(({args:e})=>e),u=()=>W.get(t)||[],l=e=>W.set(t,[...u(),e]);return{flush:i,async schedule(e){let t={},a=new Promise((e,n)=>{t.resolve=e,t.reject=n});return(n?.([...o(),e])&&s(),u().length>0)?l({args:e,pendingPromise:t}):(l({args:e,pendingPromise:t}),setTimeout(s,r)),a}}}({id:h,wait:y,shouldSplitBatch:e=>e.length>p,fn:e=>b.request({body:e}),sort:(e,t)=>e.id-t.id}),s=async e=>n?a(e):[await b.request({body:e})],[{error:i,result:o}]=await s(r);if(i)throw new U({body:r,error:i,url:h});return o},retryCount:m,retryDelay:u,timeout:f,type:"http"},{fetchOptions:r,url:h})}}function e_(e,t){let n=e.exec(t);return n?.groups}let ex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eT=/^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)?$/,ek=/^\(.+?\).*?$/,eI=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/,eO=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/,eC=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/,eE=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function eS(e){return eE.test(e)}let eR=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/,ej=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/,eA=/^receive\(\) external payable$/,eN=new Set(["memory","indexed","storage","calldata"]),e$=new Set(["indexed"]),eF=new Set(["calldata","memory","storage"]);class eP extends Error{constructor(e,t={}){let n=t.cause instanceof eP?t.cause.details:t.cause?.message?t.cause.message:t.details,r=t.cause instanceof eP&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@1.0.6"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=r,this.metaMessages=t.metaMessages,this.shortMessage=e}}class eM extends eP{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class eL extends eP{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class eD extends eP{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class eZ extends eP{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class eB extends eP{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class ez extends eP{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class eU extends eP{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class eq extends eP{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class eV extends eP{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class eW extends eP{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class eG extends eP{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class eH extends eP{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class eJ extends eP{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class eK extends eP{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}let eY=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function eQ(e,t={}){if(eC.test(e)){let n=e_(eC,e);if(!n)throw new eW({signature:e,type:"function"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{modifiers:eF,structs:t,type:"function"}));let i=[];if(n.returns){let e=e3(n.returns),r=e.length;for(let n=0;n<r;n++)i.push(e1(e[n],{modifiers:eF,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}if(eO.test(e)){let n=e_(eO,e);if(!n)throw new eW({signature:e,type:"event"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{modifiers:e$,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}if(eI.test(e)){let n=e_(eI,e);if(!n)throw new eW({signature:e,type:"error"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}if(eR.test(e)){let n=e_(eR,e);if(!n)throw new eW({signature:e,type:"constructor"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}if(ej.test(e))return{type:"fallback"};if(eA.test(e))return{type:"receive",stateMutability:"payable"};throw new eG({signature:e})}let eX=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,e0=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,e2=/^u?int$/;function e1(e,t){var n,r,a;let s;let i=(n=t?.type)?`${n}:${e}`:e;if(eY.has(i))return eY.get(i);let o=ek.test(e),u=e_(o?e0:eX,e);if(!u)throw new eB({param:e});if(u.name&&("address"===(r=u.name)||"bool"===r||"function"===r||"string"===r||"tuple"===r||ex.test(r)||eT.test(r)||e4.test(r)))throw new ez({param:e,name:u.name});let l=u.name?{name:u.name}:{},c="indexed"===u.modifier?{indexed:!0}:{},d=t?.structs??{},p={};if(o){s="tuple";let e=e3(u.type),t=[],n=e.length;for(let r=0;r<n;r++)t.push(e1(e[r],{structs:d}));p={components:t}}else if(u.type in d)s="tuple",p={components:d[u.type]};else if(e2.test(u.type))s=`${u.type}256`;else if(s=u.type,t?.type!=="struct"&&!e6(s))throw new eD({type:s});if(u.modifier){if(!t?.modifiers?.has?.(u.modifier))throw new eU({param:e,type:t?.type,modifier:u.modifier});if(eF.has(u.modifier)&&(a=s,!u.array&&"bytes"!==a&&"string"!==a&&"tuple"!==a))throw new eq({param:e,type:t?.type,modifier:u.modifier})}let y={type:`${s}${u.array??""}`,...l,...c,...p};return eY.set(i,y),y}function e3(e,t=[],n="",r=0){let a=e.trim().length;for(let s=0;s<a;s++){let a=e[s],i=e.slice(s+1);switch(a){case",":return 0===r?e3(i,[...t,n.trim()]):e3(i,t,`${n}${a}`,r);case"(":return e3(i,t,`${n}${a}`,r+1);case")":return e3(i,t,`${n}${a}`,r-1);default:return e3(i,t,`${n}${a}`,r)}}if(""===n)return t;if(0!==r)throw new eK({current:n,depth:r});return t.push(n.trim()),t}function e6(e){return"address"===e||"bool"===e||"function"===e||"string"===e||ex.test(e)||eT.test(e)}let e4=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function e8(e){let t={},n=e.length;for(let r=0;r<n;r++){let n=e[r];if(!eS(n))continue;let a=e_(eE,n);if(!a)throw new eW({signature:n,type:"struct"});let s=a.properties.split(";"),i=[],o=s.length;for(let e=0;e<o;e++){let t=s[e].trim();if(!t)continue;let n=e1(t,{type:"struct"});i.push(n)}if(!i.length)throw new eH({signature:n});t[a.name]=i}let r={},a=Object.entries(t),s=a.length;for(let e=0;e<s;e++){let[n,s]=a[e];r[n]=function e(t,n,r=new Set){let a=[],s=t.length;for(let i=0;i<s;i++){let s=t[i];if(ek.test(s.type))a.push(s);else{let t=e_(e9,s.type);if(!t?.type)throw new eV({abiParameter:s});let{array:i,type:o}=t;if(o in n){if(r.has(o))throw new eJ({type:o});a.push({...s,type:`tuple${i??""}`,components:e(n[o]??[],n,new Set([...r,o]))})}else if(e6(o))a.push(s);else throw new eL({type:o})}}return a}(s,t)}return r}let e9=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function e5(e){let t=e8(e),n=[],r=e.length;for(let a=0;a<r;a++){let r=e[a];eS(r)||n.push(eQ(r,t))}return n}var e7=n(41399);let te=new Map,tt=new Map;async function tn(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){let r=function(e){let t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:n=>t.set(e,n)}),n=t(e,te),r=t(e,tt);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}(t),a=r.response.get();if(a&&n>0&&new Date().getTime()-a.created.getTime()<n)return a.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{let e=await s;return r.response.set({created:new Date,data:e}),e}finally{r.promise.clear()}}let tr=e=>`blockNumber.${e}`;async function ta(e,{cacheTime:t=e.cacheTime}={}){return BigInt(await tn(()=>e.request({method:"eth_blockNumber"}),{cacheKey:tr(e.uid),cacheTime:t}))}async function ts(e,{address:t,blockNumber:n,blockTag:r="latest"}){let a=void 0!==n?(0,eh.eC)(n):void 0,s=await e.request({method:"eth_getCode",params:[t,a||r]},{dedupe:!!a});if("0x"!==s)return s}function ti(e,t,n){let r=e[t.name];if("function"==typeof r)return r;let a=e[n];return"function"==typeof a?a:n=>t(e,n)}var to=n(35217);let tu=e=>(0,eb.w)((0,to.O0)(e)),tl=/^tuple(?<array>(\[(\d*)\])*)$/;function tc(e){let t="",n=e.length;for(let r=0;r<n;r++)t+=function e(t){let n=t.type;if(tl.test(t.type)&&"components"in t){n="(";let r=t.components.length;for(let a=0;a<r;a++)n+=e(t.components[a]),a<r-1&&(n+=", ");let a=e_(tl,t.type);return n+=`)${a?.array??""}`,e({...t,type:n})}return("indexed"in t&&t.indexed&&(n=`${n} indexed`),t.name)?`${n} ${t.name}`:n}(e[r]),r!==n-1&&(t+=", ");return t}let td=e=>(function(e){let t=!0,n="",r=0,a="",s=!1;for(let i=0;i<e.length;i++){let o=e[i];if(["(",")",","].includes(o)&&(t=!0),"("===o&&r++,")"===o&&r--,t){if(0===r){if(" "===o&&["event","function",""].includes(a))a="";else if(a+=o,")"===o){s=!0;break}continue}if(" "===o){","!==e[i-1]&&","!==n&&",("!==n&&(n="",t=!1);continue}a+=o,n+=o}}if(!s)throw new Z.G("Unable to normalize signature.");return a})("string"==typeof e?e:function(e){return"function"===e.type?`function ${e.name}(${tc(e.inputs)})${e.stateMutability&&"nonpayable"!==e.stateMutability?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${tc(e.outputs)})`:""}`:"event"===e.type?`event ${e.name}(${tc(e.inputs)})`:"error"===e.type?`error ${e.name}(${tc(e.inputs)})`:"constructor"===e.type?`constructor(${tc(e.inputs)})${"payable"===e.stateMutability?" payable":""}`:"fallback"===e.type?"fallback()":"receive() external payable"}(e));function tp(e){return tu(td(e))}function ty(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new tE(e.type);return`${e.name}(${tm(e.inputs,{includeName:t})})`}function tm(e,{includeName:t=!1}={}){return e?e.map(e=>(function(e,{includeName:t}){return e.type.startsWith("tuple")?`(${tm(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")})(e,{includeName:t})).join(t?", ":","):""}class tf extends Z.G{constructor({data:e,params:t,size:n}){super(`Data size of ${n} bytes is too small for given parameters.`,{metaMessages:[`Params: (${tm(t,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=n}}class th extends Z.G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class tb extends Z.G{constructor({expectedLength:e,givenLength:t,type:n}){super(`ABI encoding array length mismatch for type ${n}.
|
|
1
|
+
(()=>{var e={};e.id=9373,e.ids=[9373],e.modules={20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},22037:e=>{"use strict";e.exports=require("os")},76224:e=>{"use strict";e.exports=require("tty")},73837:e=>{"use strict";e.exports=require("util")},33800:(e,t,n)=>{"use strict";let r,a;n.r(t),n.d(t,{originalPathname:()=>oz,patchFetch:()=>oU,requestAsyncStorage:()=>oD,routeModule:()=>oL,serverHooks:()=>oB,staticGenerationAsyncStorage:()=>oZ});var s,i,o,u,l,c,d,p,y,m,f,h,b,g,v,w,_,x,T,k,I,O,C,E,S,R,j,A={};n.r(A),n.d(A,{GET:()=>oM,dynamic:()=>oN});var N=n(50705),$=n(20022),P=n(55669);let F=256;function M(e=11){if(!r||F+e>512){r="",F=0;for(let e=0;e<256;e++)r+=(256+256*Math.random()|0).toString(16).substring(1)}return r.substring(F,F+++e)}function L(e){var t;let{batch:n,cacheTime:r=e.pollingInterval??4e3,ccipRead:a,key:s="base",name:i="Base Client",pollingInterval:o=4e3,type:u="base"}=e,l=e.chain,c=e.account?"string"==typeof(t=e.account)?{address:t,type:"json-rpc"}:t:void 0,{config:d,request:p,value:y}=e.transport({chain:l,pollingInterval:o}),m={account:c,batch:n,cacheTime:r,ccipRead:a,chain:l,key:s,name:i,pollingInterval:o,request:p,transport:{...d,...y},type:u,uid:M()};return Object.assign(m,{extend:function e(t){return n=>{let r=n(t);for(let e in m)delete r[e];let a={...t,...r};return Object.assign(a,{extend:e(a)})}}(m)})}let D=(e,t,n)=>JSON.stringify(e,(e,n)=>{let r="bigint"==typeof n?n.toString():n;return"function"==typeof t?t(e,r):r},n);var Z=n(44357);let B=e=>e;class z extends Z.G{constructor({body:e,cause:t,details:n,headers:r,status:a,url:s}){super("HTTP request failed.",{cause:t,details:n,metaMessages:[a&&`Status: ${a}`,`URL: ${B(s)}`,e&&`Request body: ${D(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=a,this.url=s}}class U extends Z.G{constructor({body:e,error:t,url:n}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${B(n)}`,`Request body: ${D(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class q extends Z.G{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${B(t)}`,`Request body: ${D(e)}`],name:"TimeoutError"})}}class V extends Z.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}let W=new Map,G={current:0,take(){return this.current++},reset(){this.current=0}};function H(e,t={}){return{async request(n){let{body:r,onRequest:a=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,o={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:l,signal:c}=o;try{let t;let n=await function(e,{errorInstance:t=Error("timed out"),timeout:n,signal:r}){return new Promise((a,s)=>{(async()=>{let i;try{let o=new AbortController;n>0&&(i=setTimeout(()=>{r?o.abort():s(t)},n)),a(await e({signal:o?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(i)}})()})}(async({signal:t})=>{let n={...o,body:Array.isArray(r)?D(r.map(e=>({jsonrpc:"2.0",id:e.id??G.take(),...e}))):D({jsonrpc:"2.0",id:r.id??G.take(),...r}),headers:{"Content-Type":"application/json",...u},method:l||"POST",signal:c||(i>0?t:null)},s=new Request(e,n);return a&&await a(s),await fetch(e,n)},{errorInstance:new q({body:r,url:e}),timeout:i,signal:!0});if(s&&await s(n),n.headers.get("Content-Type")?.startsWith("application/json"))t=await n.json();else{t=await n.text();try{t=JSON.parse(t||"{}")}catch(e){if(n.ok)throw e;t={error:t}}}if(!n.ok)throw new z({body:r,details:D(t.error)||n.statusText,headers:n.headers,status:n.status,url:e});return t}catch(t){if(t instanceof z||t instanceof q)throw t;throw new z({body:r,cause:t,url:e})}}}}class J extends Z.G{constructor(e,{code:t,docsPath:n,metaMessages:r,name:a,shortMessage:s}){super(s,{cause:e,docsPath:n,metaMessages:r||e?.metaMessages,name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof U?e.code:t??-1}}class K extends J{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class Y extends J{constructor(e){super(e,{code:Y.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(Y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Q extends J{constructor(e){super(e,{code:Q.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Q,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class X extends J{constructor(e,{method:t}={}){super(e,{code:X.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(X,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ee extends J{constructor(e){super(e,{code:ee.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(ee,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class et extends J{constructor(e){super(e,{code:et.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class en extends J{constructor(e){super(e,{code:en.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class er extends J{constructor(e){super(e,{code:er.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(er,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ea extends J{constructor(e){super(e,{code:ea.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ea,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class es extends J{constructor(e){super(e,{code:es.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(es,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class ei extends J{constructor(e,{method:t}={}){super(e,{code:ei.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not implemented.`})}}Object.defineProperty(ei,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class eo extends J{constructor(e){super(e,{code:eo.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class eu extends J{constructor(e){super(e,{code:eu.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(eu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class el extends K{constructor(e){super(e,{code:el.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(el,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class ec extends K{constructor(e){super(e,{code:ec.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(ec,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ed extends K{constructor(e,{method:t}={}){super(e,{code:ed.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(ed,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ep extends K{constructor(e){super(e,{code:ep.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ep,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ey extends K{constructor(e){super(e,{code:ey.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ey,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class em extends K{constructor(e){super(e,{code:em.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(em,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ef extends J{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}var eh=n(88090),eb=n(50916);let eg=new(n(5898)).k(8192);async function ev(e){return new Promise(t=>setTimeout(t,e))}function ew(e,t={}){let{batch:n,fetchOptions:r,key:a="http",name:s="HTTP JSON-RPC",onFetchRequest:i,onFetchResponse:o,retryDelay:u}=t;return({chain:l,retryCount:c,timeout:d})=>{let{batchSize:p=1e3,wait:y=0}="object"==typeof n?n:{},m=t.retryCount??c,f=d??t.timeout??1e4,h=e||l?.rpcUrls.default.http[0];if(!h)throw new V;let b=H(h,{fetchOptions:r,onRequest:i,onResponse:o,timeout:f});return function({key:e,name:t,request:n,retryCount:r=3,retryDelay:a=150,timeout:s,type:i},o){return{config:{key:e,name:t,request:n,retryCount:r,retryDelay:a,timeout:s,type:i},request:function(e,t={}){return async(n,r={})=>{let{dedupe:a=!1,retryDelay:s=150,retryCount:i=3,uid:o}={...t,...r},u=a?(0,eb.w)((0,eh.$G)(`${o}.${D(n)}`)):void 0;return function(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(eg.get(n))return eg.get(n);let r=e().finally(()=>eg.delete(n));return eg.set(n,r),r}(()=>(function(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((a,s)=>{let i=async({count:o=0}={})=>{let u=async({error:e})=>{let n="function"==typeof t?t({count:o,error:e}):t;n&&await ev(n),i({count:o+1})};try{let t=await e();a(t)}catch(e){if(o<n&&await r({count:o,error:e}))return u({error:e});s(e)}};i()})})(async()=>{try{return await e(n)}catch(e){switch(e.code){case Y.code:throw new Y(e);case Q.code:throw new Q(e);case X.code:throw new X(e,{method:n.method});case ee.code:throw new ee(e);case et.code:throw new et(e);case en.code:throw new en(e);case er.code:throw new er(e);case ea.code:throw new ea(e);case es.code:throw new es(e);case ei.code:throw new ei(e,{method:n.method});case eo.code:throw new eo(e);case eu.code:throw new eu(e);case el.code:throw new el(e);case ec.code:throw new ec(e);case ed.code:throw new ed(e);case ep.code:throw new ep(e);case ey.code:throw new ey(e);case em.code:throw new em(e);case 5e3:throw new el(e);default:if(e instanceof Z.G)throw e;throw new ef(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof z){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<<e)*s},retryCount:i,shouldRetry:({error:e})=>"code"in e&&"number"==typeof e.code?-1===e.code||e.code===eo.code||e.code===et.code:!(e instanceof z)||!e.status||403===e.status||408===e.status||413===e.status||429===e.status||500===e.status||502===e.status||503===e.status||504===e.status}),{enabled:a,id:u})}}(n,{retryCount:r,retryDelay:a,uid:M()}),value:o}}({key:a,name:s,async request({method:e,params:t}){let r={method:e,params:t},{schedule:a}=function({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:a}){let s=async()=>{let t=u();i();let n=t.map(({args:e})=>e);0!==n.length&&e(n).then(e=>{a&&Array.isArray(e)&&e.sort(a);for(let n=0;n<t.length;n++){let{pendingPromise:r}=t[n];r.resolve?.([e[n],e])}}).catch(e=>{for(let n=0;n<t.length;n++){let{pendingPromise:r}=t[n];r.reject?.(e)}})},i=()=>W.delete(t),o=()=>u().map(({args:e})=>e),u=()=>W.get(t)||[],l=e=>W.set(t,[...u(),e]);return{flush:i,async schedule(e){let t={},a=new Promise((e,n)=>{t.resolve=e,t.reject=n});return(n?.([...o(),e])&&s(),u().length>0)?l({args:e,pendingPromise:t}):(l({args:e,pendingPromise:t}),setTimeout(s,r)),a}}}({id:h,wait:y,shouldSplitBatch:e=>e.length>p,fn:e=>b.request({body:e}),sort:(e,t)=>e.id-t.id}),s=async e=>n?a(e):[await b.request({body:e})],[{error:i,result:o}]=await s(r);if(i)throw new U({body:r,error:i,url:h});return o},retryCount:m,retryDelay:u,timeout:f,type:"http"},{fetchOptions:r,url:h})}}function e_(e,t){let n=e.exec(t);return n?.groups}let ex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,eT=/^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)?$/,ek=/^\(.+?\).*?$/,eI=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/,eO=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/,eC=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/,eE=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function eS(e){return eE.test(e)}let eR=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/,ej=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/,eA=/^receive\(\) external payable$/,eN=new Set(["memory","indexed","storage","calldata"]),e$=new Set(["indexed"]),eP=new Set(["calldata","memory","storage"]);class eF extends Error{constructor(e,t={}){let n=t.cause instanceof eF?t.cause.details:t.cause?.message?t.cause.message:t.details,r=t.cause instanceof eF&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...r?[`Docs: https://abitype.dev${r}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@1.0.6"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=r,this.metaMessages=t.metaMessages,this.shortMessage=e}}class eM extends eF{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class eL extends eF{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class eD extends eF{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class eZ extends eF{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class eB extends eF{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class ez extends eF{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class eU extends eF{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class eq extends eF{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class eV extends eF{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class eW extends eF{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class eG extends eF{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class eH extends eF{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class eJ extends eF{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class eK extends eF{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}let eY=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function eQ(e,t={}){if(eC.test(e)){let n=e_(eC,e);if(!n)throw new eW({signature:e,type:"function"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{modifiers:eP,structs:t,type:"function"}));let i=[];if(n.returns){let e=e3(n.returns),r=e.length;for(let n=0;n<r;n++)i.push(e1(e[n],{modifiers:eP,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}if(eO.test(e)){let n=e_(eO,e);if(!n)throw new eW({signature:e,type:"event"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{modifiers:e$,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}if(eI.test(e)){let n=e_(eI,e);if(!n)throw new eW({signature:e,type:"error"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}if(eR.test(e)){let n=e_(eR,e);if(!n)throw new eW({signature:e,type:"constructor"});let r=e3(n.parameters),a=[],s=r.length;for(let e=0;e<s;e++)a.push(e1(r[e],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}if(ej.test(e))return{type:"fallback"};if(eA.test(e))return{type:"receive",stateMutability:"payable"};throw new eG({signature:e})}let eX=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,e0=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,e2=/^u?int$/;function e1(e,t){var n,r,a;let s;let i=(n=t?.type)?`${n}:${e}`:e;if(eY.has(i))return eY.get(i);let o=ek.test(e),u=e_(o?e0:eX,e);if(!u)throw new eB({param:e});if(u.name&&("address"===(r=u.name)||"bool"===r||"function"===r||"string"===r||"tuple"===r||ex.test(r)||eT.test(r)||e4.test(r)))throw new ez({param:e,name:u.name});let l=u.name?{name:u.name}:{},c="indexed"===u.modifier?{indexed:!0}:{},d=t?.structs??{},p={};if(o){s="tuple";let e=e3(u.type),t=[],n=e.length;for(let r=0;r<n;r++)t.push(e1(e[r],{structs:d}));p={components:t}}else if(u.type in d)s="tuple",p={components:d[u.type]};else if(e2.test(u.type))s=`${u.type}256`;else if(s=u.type,t?.type!=="struct"&&!e6(s))throw new eD({type:s});if(u.modifier){if(!t?.modifiers?.has?.(u.modifier))throw new eU({param:e,type:t?.type,modifier:u.modifier});if(eP.has(u.modifier)&&(a=s,!u.array&&"bytes"!==a&&"string"!==a&&"tuple"!==a))throw new eq({param:e,type:t?.type,modifier:u.modifier})}let y={type:`${s}${u.array??""}`,...l,...c,...p};return eY.set(i,y),y}function e3(e,t=[],n="",r=0){let a=e.trim().length;for(let s=0;s<a;s++){let a=e[s],i=e.slice(s+1);switch(a){case",":return 0===r?e3(i,[...t,n.trim()]):e3(i,t,`${n}${a}`,r);case"(":return e3(i,t,`${n}${a}`,r+1);case")":return e3(i,t,`${n}${a}`,r-1);default:return e3(i,t,`${n}${a}`,r)}}if(""===n)return t;if(0!==r)throw new eK({current:n,depth:r});return t.push(n.trim()),t}function e6(e){return"address"===e||"bool"===e||"function"===e||"string"===e||ex.test(e)||eT.test(e)}let e4=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function e8(e){let t={},n=e.length;for(let r=0;r<n;r++){let n=e[r];if(!eS(n))continue;let a=e_(eE,n);if(!a)throw new eW({signature:n,type:"struct"});let s=a.properties.split(";"),i=[],o=s.length;for(let e=0;e<o;e++){let t=s[e].trim();if(!t)continue;let n=e1(t,{type:"struct"});i.push(n)}if(!i.length)throw new eH({signature:n});t[a.name]=i}let r={},a=Object.entries(t),s=a.length;for(let e=0;e<s;e++){let[n,s]=a[e];r[n]=function e(t,n,r=new Set){let a=[],s=t.length;for(let i=0;i<s;i++){let s=t[i];if(ek.test(s.type))a.push(s);else{let t=e_(e9,s.type);if(!t?.type)throw new eV({abiParameter:s});let{array:i,type:o}=t;if(o in n){if(r.has(o))throw new eJ({type:o});a.push({...s,type:`tuple${i??""}`,components:e(n[o]??[],n,new Set([...r,o]))})}else if(e6(o))a.push(s);else throw new eL({type:o})}}return a}(s,t)}return r}let e9=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function e5(e){let t=e8(e),n=[],r=e.length;for(let a=0;a<r;a++){let r=e[a];eS(r)||n.push(eQ(r,t))}return n}var e7=n(41399);let te=new Map,tt=new Map;async function tn(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){let r=function(e){let t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:n=>t.set(e,n)}),n=t(e,te),r=t(e,tt);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}(t),a=r.response.get();if(a&&n>0&&new Date().getTime()-a.created.getTime()<n)return a.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{let e=await s;return r.response.set({created:new Date,data:e}),e}finally{r.promise.clear()}}let tr=e=>`blockNumber.${e}`;async function ta(e,{cacheTime:t=e.cacheTime}={}){return BigInt(await tn(()=>e.request({method:"eth_blockNumber"}),{cacheKey:tr(e.uid),cacheTime:t}))}async function ts(e,{address:t,blockNumber:n,blockTag:r="latest"}){let a=void 0!==n?(0,eh.eC)(n):void 0,s=await e.request({method:"eth_getCode",params:[t,a||r]},{dedupe:!!a});if("0x"!==s)return s}function ti(e,t,n){let r=e[t.name];if("function"==typeof r)return r;let a=e[n];return"function"==typeof a?a:n=>t(e,n)}var to=n(35217);let tu=e=>(0,eb.w)((0,to.O0)(e)),tl=/^tuple(?<array>(\[(\d*)\])*)$/;function tc(e){let t="",n=e.length;for(let r=0;r<n;r++)t+=function e(t){let n=t.type;if(tl.test(t.type)&&"components"in t){n="(";let r=t.components.length;for(let a=0;a<r;a++)n+=e(t.components[a]),a<r-1&&(n+=", ");let a=e_(tl,t.type);return n+=`)${a?.array??""}`,e({...t,type:n})}return("indexed"in t&&t.indexed&&(n=`${n} indexed`),t.name)?`${n} ${t.name}`:n}(e[r]),r!==n-1&&(t+=", ");return t}let td=e=>(function(e){let t=!0,n="",r=0,a="",s=!1;for(let i=0;i<e.length;i++){let o=e[i];if(["(",")",","].includes(o)&&(t=!0),"("===o&&r++,")"===o&&r--,t){if(0===r){if(" "===o&&["event","function",""].includes(a))a="";else if(a+=o,")"===o){s=!0;break}continue}if(" "===o){","!==e[i-1]&&","!==n&&",("!==n&&(n="",t=!1);continue}a+=o,n+=o}}if(!s)throw new Z.G("Unable to normalize signature.");return a})("string"==typeof e?e:function(e){return"function"===e.type?`function ${e.name}(${tc(e.inputs)})${e.stateMutability&&"nonpayable"!==e.stateMutability?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${tc(e.outputs)})`:""}`:"event"===e.type?`event ${e.name}(${tc(e.inputs)})`:"error"===e.type?`error ${e.name}(${tc(e.inputs)})`:"constructor"===e.type?`constructor(${tc(e.inputs)})${"payable"===e.stateMutability?" payable":""}`:"fallback"===e.type?"fallback()":"receive() external payable"}(e));function tp(e){return tu(td(e))}function ty(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new tE(e.type);return`${e.name}(${tm(e.inputs,{includeName:t})})`}function tm(e,{includeName:t=!1}={}){return e?e.map(e=>(function(e,{includeName:t}){return e.type.startsWith("tuple")?`(${tm(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")})(e,{includeName:t})).join(t?", ":","):""}class tf extends Z.G{constructor({data:e,params:t,size:n}){super(`Data size of ${n} bytes is too small for given parameters.`,{metaMessages:[`Params: (${tm(t,{includeName:!0})})`,`Data: ${e} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=n}}class th extends Z.G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class tb extends Z.G{constructor({expectedLength:e,givenLength:t,type:n}){super(`ABI encoding array length mismatch for type ${n}.
|
|
2
2
|
Expected length: ${e}
|
|
3
3
|
Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class tg extends Z.G{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${(0,e7.d)(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class tv extends Z.G{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch.
|
|
4
4
|
Expected length (params): ${e}
|
|
@@ -7,7 +7,7 @@ Make sure you are using the correct ABI and that the event exists on it.
|
|
|
7
7
|
You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`,{docsPath:t,name:"AbiEventSignatureNotFoundError"})}}class tx extends Z.G{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}}class tT extends Z.G{constructor({abiItem:e,data:t,params:n,size:r}){super(`Data size of ${r} bytes is too small for non-indexed event parameters.`,{metaMessages:[`Params: (${tm(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"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=t,this.params=n,this.size=r}}class tk extends Z.G{constructor({abiItem:e,param:t}){super(`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${ty(e,{includeName:!0})}".`,{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class tI extends Z.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type.
|
|
8
8
|
Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class tO extends Z.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid decoding type.
|
|
9
9
|
Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiDecodingType"})}}class tC extends Z.G{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class tE extends Z.G{constructor(e){super(`"${e}" is not a valid definition type.
|
|
10
|
-
Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}class tS extends Z.G{constructor(e){super(`Type "${e}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}var tR=n(35130),tj=n(99487),tA=n(69535),tN=n(76670),t$=n(16272),tF=n(19611),tP=n(65484),tM=n(12322),tL=n(1504);function tD(e,t={}){void 0!==t.size&&(0,tL.Yf)(e,{size:t.size});let n=(0,eh.ci)(e,t);return(0,tL.ly)(n,t)}var tZ=n(68095),tB=n(77157);function tz(e,t){if(e.length!==t.length)throw new tv({expectedLength:e.length,givenLength:t.length});let n=tU(function({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(function e({param:t,value:n}){let r=tq(t.type);if(r){let[a,s]=r;return function(t,{length:n,param:r}){let a=null===n;if(!Array.isArray(t))throw new tC(t);if(!a&&t.length!==n)throw new tb({expectedLength:n,givenLength:t.length,type:`${r.type}[${n}]`});let s=!1,i=[];for(let n=0;n<t.length;n++){let a=e({param:r,value:t[n]});a.dynamic&&(s=!0),i.push(a)}if(a||s){let e=tU(i);if(a){let t=(0,eh.eC)(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?(0,tZ.zo)([t,e]):t}}if(s)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:(0,tZ.zo)(i.map(({encoded:e})=>e))}}(n,{length:a,param:{...t,type:s}})}if("tuple"===t.type)return function(t,{param:n}){let r=!1,a=[];for(let s=0;s<n.components.length;s++){let i=n.components[s],o=Array.isArray(t)?s:i.name,u=e({param:i,value:t[o]});a.push(u),u.dynamic&&(r=!0)}return{dynamic:r,encoded:r?tU(a):(0,tZ.zo)(a.map(({encoded:e})=>e))}}(n,{param:t});if("address"===t.type)return function(e){if(!(0,tj.U)(e))throw new tR.b({address:e});return{dynamic:!1,encoded:(0,tB.gc)(e.toLowerCase())}}(n);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new Z.G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,tB.gc)((0,eh.C4)(e))}}(n);if(t.type.startsWith("uint")||t.type.startsWith("int"))return function(e,{signed:t}){return{dynamic:!1,encoded:(0,eh.eC)(e,{size:32,signed:t})}}(n,{signed:t.type.startsWith("int")});if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,n]=t.type.split("bytes"),r=(0,e7.d)(e);if(!n){let t=e;return r%32!=0&&(t=(0,tB.gc)(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:(0,tZ.zo)([(0,tB.gc)((0,eh.eC)(r,{size:32})),t])}}if(r!==Number.parseInt(n))throw new tg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:(0,tB.gc)(e,{dir:"right"})}}(n,{param:t});if("string"===t.type)return function(e){let t=(0,eh.$G)(e),n=Math.ceil((0,e7.d)(t)/32),r=[];for(let e=0;e<n;e++)r.push((0,tB.gc)((0,tF.tP)(t,32*e,(e+1)*32),{dir:"right"}));return{dynamic:!0,encoded:(0,tZ.zo)([(0,tB.gc)((0,eh.eC)((0,e7.d)(t),{size:32})),...r])}}(n);throw new tI(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[r],value:t[r]}));return n}({params:e,values:t}));return 0===n.length?"0x":n}function tU(e){let t=0;for(let n=0;n<e.length;n++){let{dynamic:r,encoded:a}=e[n];r?t+=32:t+=(0,e7.d)(a)}let n=[],r=[],a=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:o}=e[s];i?(n.push((0,eh.eC)(t+a,{size:32})),r.push(o),a+=(0,e7.d)(o)):n.push(o)}return(0,tZ.zo)([...n,...r])}function tq(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function tV(e,t){let n="string"==typeof t?(0,to.nr)(t):t,r=(0,t$.q)(n);if(0===(0,e7.d)(n)&&e.length>0)throw new th;if((0,e7.d)(t)&&32>(0,e7.d)(t))throw new tf({data:"string"==typeof t?t:(0,eh.ci)(t),params:e,size:(0,e7.d)(t)});let a=0,s=[];for(let t=0;t<e.length;++t){let n=e[t];r.setPosition(a);let[i,o]=function e(t,n,{staticPosition:r}){let a=tq(n.type);if(a){let[s,i]=a;return function(t,n,{length:r,staticPosition:a}){if(!r){let r=a+tD(t.readBytes(32)),s=r+32;t.setPosition(r);let i=tD(t.readBytes(32)),o=tW(n),u=0,l=[];for(let r=0;r<i;++r){t.setPosition(s+(o?32*r:u));let[a,i]=e(t,n,{staticPosition:s});u+=i,l.push(a)}return t.setPosition(a+32),[l,32]}if(tW(n)){let s=a+tD(t.readBytes(32)),i=[];for(let a=0;a<r;++a){t.setPosition(s+32*a);let[r]=e(t,n,{staticPosition:s});i.push(r)}return t.setPosition(a+32),[i,32]}let s=0,i=[];for(let o=0;o<r;++o){let[r,o]=e(t,n,{staticPosition:a+s});s+=o,i.push(r)}return[i,s]}(t,{...n,type:i},{length:s,staticPosition:r})}if("tuple"===n.type)return function(t,n,{staticPosition:r}){let a=0===n.components.length||n.components.some(({name:e})=>!e),s=a?[]:{},i=0;if(tW(n)){let o=r+tD(t.readBytes(32));for(let r=0;r<n.components.length;++r){let u=n.components[r];t.setPosition(o+i);let[l,c]=e(t,u,{staticPosition:o});i+=c,s[a?r:u?.name]=l}return t.setPosition(r+32),[s,32]}for(let o=0;o<n.components.length;++o){let u=n.components[o],[l,c]=e(t,u,{staticPosition:r});s[a?o:u?.name]=l,i+=c}return[s,i]}(t,n,{staticPosition:r});if("address"===n.type)return function(e){let t=e.readBytes(32);return[(0,tN.x)((0,eh.ci)((0,tF.T4)(t,-20))),32]}(t);if("bool"===n.type)return[function(e,t={}){let n=e;if(void 0!==t.size&&((0,tL.Yf)(n,{size:t.size}),n=(0,tP.f)(n)),n.length>1||n[0]>1)throw new tM.yr(n);return!!n[0]}(t.readBytes(32),{size:32}),32];if(n.type.startsWith("bytes"))return function(e,t,{staticPosition:n}){let[r,a]=t.type.split("bytes");if(!a){let t=tD(e.readBytes(32));e.setPosition(n+t);let r=tD(e.readBytes(32));if(0===r)return e.setPosition(n+32),["0x",32];let a=e.readBytes(r);return e.setPosition(n+32),[(0,eh.ci)(a),32]}return[(0,eh.ci)(e.readBytes(Number.parseInt(a),32)),32]}(t,n,{staticPosition:r});if(n.type.startsWith("uint")||n.type.startsWith("int"))return function(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),a=e.readBytes(32);return[r>48?function(e,t={}){void 0!==t.size&&(0,tL.Yf)(e,{size:t.size});let n=(0,eh.ci)(e,t);return(0,tL.y_)(n,t)}(a,{signed:n}):tD(a,{signed:n}),32]}(t,n);if("string"===n.type)return function(e,{staticPosition:t}){let n=tD(e.readBytes(32));e.setPosition(t+n);let r=tD(e.readBytes(32));if(0===r)return e.setPosition(t+32),["",32];let a=e.readBytes(r,32),s=function(e,t={}){let n=e;return void 0!==t.size&&((0,tL.Yf)(n,{size:t.size}),n=(0,tP.f)(n,{dir:"right"})),new TextDecoder().decode(n)}((0,tP.f)(a));return e.setPosition(t+32),[s,32]}(t,{staticPosition:r});throw new tO(n.type,{docsPath:"/docs/contract/decodeAbiParameters"})}(r,n,{staticPosition:0});a+=o,s.push(i)}return s}function tW(e){let{type:t}=e;if("string"===t||"bytes"===t||t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(tW);let n=tq(e.type);return!!(n&&tW({...e,type:n[1]}))}let tG="/docs/contract/decodeEventLog";function tH(e){let{abi:t,args:n,logs:r,strict:a=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(e=>{try{let r=t.find(t=>"event"===t.type&&e.topics[0]===tp(t));if(!r)return null;let i=function(e){let{abi:t,data:n,strict:r,topics:a}=e,s=r??!0,[i,...o]=a;if(!i)throw new tw({docsPath:tG});let u=1===t.length?t[0]:t.find(e=>"event"===e.type&&i===tp(ty(e)));if(!(u&&"name"in u)||"event"!==u.type)throw new t_(i,{docsPath:tG});let{name:l,inputs:c}=u,d=c?.some(e=>!("name"in e&&e.name)),p=d?[]:{},y=c.filter(e=>"indexed"in e&&e.indexed);for(let e=0;e<y.length;e++){let t=y[e],n=o[e];if(!n)throw new tk({abiItem:u,param:t});p[d?e:t.name||e]=function({param:e,value:t}){return"string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(tV([e],t)||[])[0]}({param:t,value:n})}let m=c.filter(e=>!("indexed"in e&&e.indexed));if(m.length>0){if(n&&"0x"!==n)try{let e=tV(m,n);if(e){if(d)p=[...p,...e];else for(let t=0;t<m.length;t++)p[m[t].name]=e[t]}}catch(e){if(s){if(e instanceof tf||e instanceof tA.lQ)throw new tT({abiItem:u,data:n,params:m,size:(0,e7.d)(n)});throw e}}else if(s)throw new tT({abiItem:u,data:"0x",params:m,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}({...e,abi:[r],strict:a});if(s&&!s.includes(i.eventName)||!function(e){let{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function a(e,t,n){try{if("address"===e.type)return function(e,t){if(!(0,tj.U)(e,{strict:!1}))throw new tR.b({address:e});if(!(0,tj.U)(t,{strict:!1}))throw new tR.b({address:t});return e.toLowerCase()===t.toLowerCase()}(t,n);if("string"===e.type||"bytes"===e.type)return(0,eb.w)((0,to.O0)(t))===n;return t===n}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((e,r)=>{if(null==e)return!0;let s=n[r];return!!s&&(Array.isArray(e)?e:[e]).some(e=>a(s,e,t[r]))}):!("object"!=typeof t||Array.isArray(t)||"object"!=typeof r||Array.isArray(r))&&Object.entries(r).every(([e,r])=>{if(null==r)return!0;let s=n.find(t=>t.name===e);return!!s&&(Array.isArray(r)?r:[r]).some(n=>a(s,n,t[e]))})}({args:i.args,inputs:r.inputs,matchArgs:n}))return null;return{...i,...e}}catch(r){let t,n;if(r instanceof t_)return null;if(r instanceof tT||r instanceof tk){if(a)return null;t=r.abiItem.name,n=r.abiItem.inputs?.some(e=>!("name"in e&&e.name))}return{...e,args:n?[]:{},eventName:t}}}).filter(Boolean)}class tJ extends Z.G{constructor({blockHash:e,blockNumber:t}){let n="Block";e&&(n=`Block at hash "${e}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}function tK(e,t){throw Error(t??`Unexpected value: ${e}`)}function tY(...e){return e.reduce((e,t)=>t<e?t:e)}function tQ(e,t){return e<t?-1:e>t?1:0}function tX(e,t){let n=new Map;for(let r of e){let e=t(r);n.has(e)||n.set(e,[]),n.get(e).push(r)}return n}function t0(e){return void 0!==e}async function t2(e){let t=[];for await(let n of e)t.push(n);return t}function t1(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function t3(e){return new Promise(t=>setTimeout(()=>t(),e))}var t6=n(3741),t4=n(8297),t8=t6("mud:common"),t9=t6("mud:common");t8.log=console.debug.bind(console),t9.log=console.error.bind(console),n(94335);class t5 extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}new WeakMap;var t7=function(e,t,n,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n},ne=function(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};i=new WeakMap,o=new WeakMap,u=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,p=new WeakMap,y=new WeakMap,m=new WeakMap,new WeakMap,f=new WeakMap,h=new WeakMap,b=new WeakMap,new WeakMap,s=new WeakSet,g=function(){return ne(this,o,"f")||ne(this,u,"f")<ne(this,l,"f")},v=function(){return ne(this,f,"f")<ne(this,h,"f")},w=function(){ne(this,s,"m",k).call(this),ne(this,s,"m",T).call(this),t7(this,y,void 0,"f")},_=function(){let e=Date.now();if(void 0===ne(this,p,"f")){let t=ne(this,d,"f")-e;if(!(t<0))return void 0===ne(this,y,"f")&&t7(this,y,setTimeout(()=>{ne(this,s,"m",w).call(this)},t),"f"),!0;t7(this,u,ne(this,i,"f")?ne(this,f,"f"):0,"f")}return!1},x=function(){if(0===ne(this,m,"f").size)return ne(this,p,"f")&&clearInterval(ne(this,p,"f")),t7(this,p,void 0,"f"),this.emit("empty"),0===ne(this,f,"f")&&this.emit("idle"),!1;if(!ne(this,b,"f")){let e=!ne(this,s,"a",_);if(ne(this,s,"a",g)&&ne(this,s,"a",v)){let t=ne(this,m,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&ne(this,s,"m",T).call(this),!0)}}return!1},T=function(){ne(this,o,"f")||void 0!==ne(this,p,"f")||(t7(this,p,setInterval(()=>{ne(this,s,"m",k).call(this)},ne(this,c,"f")),"f"),t7(this,d,Date.now()+ne(this,c,"f"),"f"))},k=function(){0===ne(this,u,"f")&&0===ne(this,f,"f")&&ne(this,p,"f")&&(clearInterval(ne(this,p,"f")),t7(this,p,void 0,"f")),t7(this,u,ne(this,i,"f")?ne(this,f,"f"):0,"f"),ne(this,s,"m",I).call(this)},I=function(){for(;ne(this,s,"m",x).call(this););},n(27147);t8.extend("createNonceManager");t8.extend("sendTransaction"),t8.extend("writeContract");var nt=["table","offchainTable","namespace","system"],nn={table:"tb",offchainTable:"ot",namespace:"ns",system:"sy"};function nr(e){let t=nn[e.type];if(e.namespace.length>14)throw Error(`Namespaces must fit into \`bytes14\`, but "${e.namespace}" is too long.`);return(0,tZ.SM)([(0,eh.$G)(t,{size:2}),(0,eh.$G)(e.namespace,{size:14}),(0,eh.$G)(e.name.slice(0,16),{size:16})])}function na({namespace:e,name:t}){return""===e?t:`${e}__${t}`}var ns=Object.fromEntries(Object.entries(nn).map(([e,t])=>[t,e]));function ni(e){let t=(0,tL.rR)((0,tF.p5)(e,0,2)).replace(/\0+$/,""),n=function(e){let t=ns[e];if(nt.includes(t))return t}(t),r=(0,tL.rR)((0,tF.p5)(e,2,16)).replace(/\0+$/,""),a=(0,tL.rR)((0,tF.p5)(e,16,32)).replace(/\0+$/,"");if(!n)throw Error(`Unknown type (${t}) for resource (${na({namespace:r,name:a})})`);return{resourceId:e,type:n,namespace:r,name:a}}function no(e,t){return e.blockNumber===t.blockNumber?e.logIndex===t.logIndex?0:null==e.logIndex?1:null==t.logIndex?-1:e.logIndex-t.logIndex:null==e.blockNumber?1:null==t.blockNumber?-1:e.blockNumber>t.blockNumber?1:e.blockNumber<t.blockNumber?-1:0}function nu(e,t,n){return`0x${e.replace(/^0x/,"").slice(2*t,null!=n?2*n:void 0).padEnd(((n??t)-t)*2,"0")}`}function nl(e,t,n=0,r="0x"){return(0,tZ.SM)([nu(e,0,t),r,nu(e,t+n)])}t6("mud:benchmark").log=console.info.bind(console),t8.extend("transportObserver");var nc=t6("mud:block-events-stream"),nd=t6("mud:block-events-stream");async function np(e){let t={method:"eth_getLogs",params:[{address:e.address,topics:e.topics,fromBlock:(0,eh.eC)(e.fromBlock),toBlock:(0,eh.eC)(e.toBlock)}]};if(!e.internal_validateBlockRange)return(await (e.publicClient??L({chain:e.internal_chain,transport:ew()})).request(t)).map(e=>(0,t4.U)(e));let[n]=e.internal_chain.rpcUrls.default.http,r=H(n),a={method:"eth_getBlockByNumber",params:[(0,eh.eC)(e.toBlock),!1]},[{error:s,result:i},{error:o,result:u}]=await r.request({body:[a,t]});if(s)throw new U({body:a,error:s,url:n});if(o)throw new U({body:t,error:o,url:n});if(!i)throw new tJ({blockNumber:e.toBlock});return u.map(e=>(0,t4.U)(e))}nc.log=console.debug.bind(console),nd.log=console.error.bind(console);var ny=["rate limit exceeded","over rate limit","sender is over rate limit"],nm=["block range exceeded","block range is too large","block range greater than","query exceeds max block range","exceed maximum block range"],nf=["block is out of range","backend response too large","query exceeds max results"],nh=["block not found","unknown block","Unknown block"];async function*nb({maxBlockRange:e=1000n,maxRetryCount:t=3,fromBlock:n,toBlock:r,...a}){let s=a.getLogs??(async e=>{let t=a.events?[a.events.map(e=>tp(e))]:void 0,n=await np({...a,...e,topics:t});return a.events?tH({logs:n,abi:a.events}):n}),i=n,o=tY(e,r-i),u=0;for(;i<=r;){let n=i+function(...e){return e.reduce((e,t)=>t>e?t:e)}(0n,o-1n);nc(`getting logs for blocks ${i}-${n} (${o} blocks, ${e} max)`);try{let t=await s({fromBlock:i,toBlock:n});yield{fromBlock:i,toBlock:n,logs:t},i=n+1n,o=tY(e,r-i),u=0}catch(s){if(!(s instanceof Error))throw s;if(u<t&&ny.some(e=>s.message.includes(e))){let e=2*u;nc(`too many requests, retrying in ${e}s`),await t3(1e3*e),u+=1;continue}let r=nm.some(e=>s.message.includes(e)),a=nf.some(e=>s.message.includes(e));if(r||a){if((o/=2n)<=0n)throw Error("can't reduce block range any further");r&&(e=o),nc(`got block range error, retrying with ${o} blocks, ${e} max`);continue}if(u<t&&(nh.some(e=>s.message.includes(e))||s.message===new tJ({blockNumber:n}).message)){let e=2*u;nc(`missing block, retrying in ${e}s`),await t3(1e3*e),u+=1;continue}throw s}}}async function ng(e){var t;let n,r;return(n=Array.from(new Set((t=(await t2(nb(e))).flatMap(({logs:e})=>e)).map(e=>e.blockNumber)))).sort(tQ),r=Array.from(tX(t.slice().sort(no),e=>e.blockNumber).entries()).map(([e,t])=>({blockNumber:e,logs:t})).filter(e=>e.logs.length>0),n.at(-1),r}var nv=e5(["event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)","event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data)","event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint48 start, uint40 deleteCount, bytes32 encodedLengths, bytes data)","event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple)"]),nw=["uint8","uint16","uint24","uint32","uint40","uint48","uint56","uint64","uint72","uint80","uint88","uint96","uint104","uint112","uint120","uint128","uint136","uint144","uint152","uint160","uint168","uint176","uint184","uint192","uint200","uint208","uint216","uint224","uint232","uint240","uint248","uint256","int8","int16","int24","int32","int40","int48","int56","int64","int72","int80","int88","int96","int104","int112","int120","int128","int136","int144","int152","int160","int168","int176","int184","int192","int200","int208","int216","int224","int232","int240","int248","int256","bytes1","bytes2","bytes3","bytes4","bytes5","bytes6","bytes7","bytes8","bytes9","bytes10","bytes11","bytes12","bytes13","bytes14","bytes15","bytes16","bytes17","bytes18","bytes19","bytes20","bytes21","bytes22","bytes23","bytes24","bytes25","bytes26","bytes27","bytes28","bytes29","bytes30","bytes31","bytes32","bool","address","uint8[]","uint16[]","uint24[]","uint32[]","uint40[]","uint48[]","uint56[]","uint64[]","uint72[]","uint80[]","uint88[]","uint96[]","uint104[]","uint112[]","uint120[]","uint128[]","uint136[]","uint144[]","uint152[]","uint160[]","uint168[]","uint176[]","uint184[]","uint192[]","uint200[]","uint208[]","uint216[]","uint224[]","uint232[]","uint240[]","uint248[]","uint256[]","int8[]","int16[]","int24[]","int32[]","int40[]","int48[]","int56[]","int64[]","int72[]","int80[]","int88[]","int96[]","int104[]","int112[]","int120[]","int128[]","int136[]","int144[]","int152[]","int160[]","int168[]","int176[]","int184[]","int192[]","int200[]","int208[]","int216[]","int224[]","int232[]","int240[]","int248[]","int256[]","bytes1[]","bytes2[]","bytes3[]","bytes4[]","bytes5[]","bytes6[]","bytes7[]","bytes8[]","bytes9[]","bytes10[]","bytes11[]","bytes12[]","bytes13[]","bytes14[]","bytes15[]","bytes16[]","bytes17[]","bytes18[]","bytes19[]","bytes20[]","bytes21[]","bytes22[]","bytes23[]","bytes24[]","bytes25[]","bytes26[]","bytes27[]","bytes28[]","bytes29[]","bytes30[]","bytes31[]","bytes32[]","bool[]","address[]","bytes","string"],n_=nw.slice(0,98),nx=nw.slice(98),nT={uint8:0,uint16:0,uint24:0,uint32:0,uint40:0,uint48:0,uint56:0n,uint64:0n,uint72:0n,uint80:0n,uint88:0n,uint96:0n,uint104:0n,uint112:0n,uint120:0n,uint128:0n,uint136:0n,uint144:0n,uint152:0n,uint160:0n,uint168:0n,uint176:0n,uint184:0n,uint192:0n,uint200:0n,uint208:0n,uint216:0n,uint224:0n,uint232:0n,uint240:0n,uint248:0n,uint256:0n,int8:0,int16:0,int24:0,int32:0,int40:0,int48:0,int56:0n,int64:0n,int72:0n,int80:0n,int88:0n,int96:0n,int104:0n,int112:0n,int120:0n,int128:0n,int136:0n,int144:0n,int152:0n,int160:0n,int168:0n,int176:0n,int184:0n,int192:0n,int200:0n,int208:0n,int216:0n,int224:0n,int232:0n,int240:0n,int248:0n,int256:0n,bytes1:"0x00",bytes2:"0x0000",bytes3:"0x000000",bytes4:"0x00000000",bytes5:"0x0000000000",bytes6:"0x000000000000",bytes7:"0x00000000000000",bytes8:"0x0000000000000000",bytes9:"0x000000000000000000",bytes10:"0x00000000000000000000",bytes11:"0x0000000000000000000000",bytes12:"0x000000000000000000000000",bytes13:"0x00000000000000000000000000",bytes14:"0x0000000000000000000000000000",bytes15:"0x000000000000000000000000000000",bytes16:"0x00000000000000000000000000000000",bytes17:"0x0000000000000000000000000000000000",bytes18:"0x000000000000000000000000000000000000",bytes19:"0x00000000000000000000000000000000000000",bytes20:"0x0000000000000000000000000000000000000000",bytes21:"0x000000000000000000000000000000000000000000",bytes22:"0x00000000000000000000000000000000000000000000",bytes23:"0x0000000000000000000000000000000000000000000000",bytes24:"0x000000000000000000000000000000000000000000000000",bytes25:"0x00000000000000000000000000000000000000000000000000",bytes26:"0x0000000000000000000000000000000000000000000000000000",bytes27:"0x000000000000000000000000000000000000000000000000000000",bytes28:"0x00000000000000000000000000000000000000000000000000000000",bytes29:"0x0000000000000000000000000000000000000000000000000000000000",bytes30:"0x000000000000000000000000000000000000000000000000000000000000",bytes31:"0x00000000000000000000000000000000000000000000000000000000000000",bytes32:"0x0000000000000000000000000000000000000000000000000000000000000000",bool:!1,address:"0x0000000000000000000000000000000000000000"},nk={uint8:1,uint16:2,uint24:3,uint32:4,uint40:5,uint48:6,uint56:7,uint64:8,uint72:9,uint80:10,uint88:11,uint96:12,uint104:13,uint112:14,uint120:15,uint128:16,uint136:17,uint144:18,uint152:19,uint160:20,uint168:21,uint176:22,uint184:23,uint192:24,uint200:25,uint208:26,uint216:27,uint224:28,uint232:29,uint240:30,uint248:31,uint256:32,int8:1,int16:2,int24:3,int32:4,int40:5,int48:6,int56:7,int64:8,int72:9,int80:10,int88:11,int96:12,int104:13,int112:14,int120:15,int128:16,int136:17,int144:18,int152:19,int160:20,int168:21,int176:22,int184:23,int192:24,int200:25,int208:26,int216:27,int224:28,int232:29,int240:30,int248:31,int256:32,bytes1:1,bytes2:2,bytes3:3,bytes4:4,bytes5:5,bytes6:6,bytes7:7,bytes8:8,bytes9:9,bytes10:10,bytes11:11,bytes12:12,bytes13:13,bytes14:14,bytes15:15,bytes16:16,bytes17:17,bytes18:18,bytes19:19,bytes20:20,bytes21:21,bytes22:22,bytes23:23,bytes24:24,bytes25:25,bytes26:26,bytes27:27,bytes28:28,bytes29:29,bytes30:30,bytes31:31,bytes32:32,bool:1,address:20};function nI(e){return n_.includes(e)}var nO=/\[\]$/,nC=/\[\d+\]$/;function nE(e){return"string"==typeof e&&nC.test(e)&&nI(e.replace(nC,""))}function nS(e){return e.replace(nO,"")}var nR={"uint8[]":[],"uint16[]":[],"uint24[]":[],"uint32[]":[],"uint40[]":[],"uint48[]":[],"uint56[]":[],"uint64[]":[],"uint72[]":[],"uint80[]":[],"uint88[]":[],"uint96[]":[],"uint104[]":[],"uint112[]":[],"uint120[]":[],"uint128[]":[],"uint136[]":[],"uint144[]":[],"uint152[]":[],"uint160[]":[],"uint168[]":[],"uint176[]":[],"uint184[]":[],"uint192[]":[],"uint200[]":[],"uint208[]":[],"uint216[]":[],"uint224[]":[],"uint232[]":[],"uint240[]":[],"uint248[]":[],"uint256[]":[],"int8[]":[],"int16[]":[],"int24[]":[],"int32[]":[],"int40[]":[],"int48[]":[],"int56[]":[],"int64[]":[],"int72[]":[],"int80[]":[],"int88[]":[],"int96[]":[],"int104[]":[],"int112[]":[],"int120[]":[],"int128[]":[],"int136[]":[],"int144[]":[],"int152[]":[],"int160[]":[],"int168[]":[],"int176[]":[],"int184[]":[],"int192[]":[],"int200[]":[],"int208[]":[],"int216[]":[],"int224[]":[],"int232[]":[],"int240[]":[],"int248[]":[],"int256[]":[],"bytes1[]":[],"bytes2[]":[],"bytes3[]":[],"bytes4[]":[],"bytes5[]":[],"bytes6[]":[],"bytes7[]":[],"bytes8[]":[],"bytes9[]":[],"bytes10[]":[],"bytes11[]":[],"bytes12[]":[],"bytes13[]":[],"bytes14[]":[],"bytes15[]":[],"bytes16[]":[],"bytes17[]":[],"bytes18[]":[],"bytes19[]":[],"bytes20[]":[],"bytes21[]":[],"bytes22[]":[],"bytes23[]":[],"bytes24[]":[],"bytes25[]":[],"bytes26[]":[],"bytes27[]":[],"bytes28[]":[],"bytes29[]":[],"bytes30[]":[],"bytes31[]":[],"bytes32[]":[],"bool[]":[],"address[]":[],bytes:"0x",string:""};function nj(e){return nx.includes(e)}let nA=e=>{let t=typeof e;return"object"===t?null===e?"null":"object":"function"===t?"object":t},nN=(e,t)=>{let n=Array.isArray(e),r=Object.entries(e).flatMap((e,r)=>{let a=n?t(r,e[1]):t(...e,r);return Array.isArray(a[0])||0===a.length?a:[a]}),a=Object.fromEntries(r);return"number"==typeof r[0]?.[0]?Object.values(a):a};class n$ extends Error{}let nF=e=>nP(e,n$),nP=(e,t=Error)=>{throw new t(e)},nM=(e,t)=>e in t,nL=Symbol("represents an uninitialized value");(e=>{let t=nL;return()=>t===nL?t=e():t})(()=>{try{return Function("return false")()}catch{return!0}});let nD=/^(?!^-0$)-?(?:0|[1-9]\d*)(?:\.\d*[1-9])?$/;nD.test.bind(nD);let nZ=/^(?:0|(?:-?[1-9]\d*))$/;nZ.test.bind(nZ);let nB=/^-?\d+$/;nB.test.bind(nB);let nz={Array,Date,Error,Function,Map,RegExp,Set,String,Number,Boolean,WeakMap,WeakSet,Promise},nU=e=>{let t=Object.getPrototypeOf(e);for(;t?.constructor&&(!nM(t.constructor.name,nz)||!(e instanceof nz[t.constructor.name]));)t=Object.getPrototypeOf(t);let n=t?.constructor?.name;if(void 0!==n&&"Object"!==n)return n},nq=e=>{let t=[],n=e;for(;n!==Object.prototype&&null!=n;){for(let e of Object.getOwnPropertyNames(n))"constructor"===e||t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e);n=Object.getPrototypeOf(n)}return t};nq(0n),nq(!1),nq(0),nq(""),nq(Symbol());let nV={version:"0.2.2",filename:void 0},nW=new WeakMap,nG={},nH=e=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(e),nJ=e=>{switch(typeof e){case"object":{if(null===e)break;let t=nU(e)??"object";return t[0].toLowerCase()+t.slice(1)}case"function":return nH(e.name)?e.name:"fn";case"symbol":return e.description&&nH(e.description)?e.description:"symbol"}return nF(`Unexpected attempt to register serializable value of type ${nA(e)}`)};function nK(e,t){return"object"==typeof e&&null!=e&&nY(e,t)?e[t]:void 0}function nY(e,t){return"object"==typeof e&&null!==e&&e.hasOwnProperty(t)}function nQ(e){return null!=e&&"object"==typeof e}function nX(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].map(n=>[n,typeof e[n]>"u"?t[n]:e[n]]))}Symbol("implementedTraits"),Symbol.hasInstance;var n0={storeImportPath:"@latticexyz/store/src",userTypesFilename:"common.sol",outputDirectory:"codegen",indexFilename:"index.sol"},n2={outputDirectory:"tables",tableIdArgument:!1,storeArgument:!1},n1={disabled:!1},n3={namespaceLabel:"",type:"table"},n6={sourceDirectory:"src",namespace:""},n4={types:Object.fromEntries(nw.map(e=>[e,e]))};function n8(e,t){return{types:{...e.types,...t}}}function n9(e,t=n4){return"object"==typeof e&&null!=e&&Object.values(e).every(e=>nE(e)||nY(t.types,e))}function n5(e,t){return"string"==typeof e?{schema:{id:"bytes32",value:e},key:["id"]}:n9(e,t)?{schema:e,key:["id"]}:e}function n7(e,t){if(nQ(e)){for(let n of Object.values(e))"string"==typeof n||nQ(n)&&Object.values(n).every(e=>"string"==typeof e)?function(e,t=n4){if("string"==typeof e){if(nE(e)||nY(t.types,e))return;throw Error(`Invalid ABI type. \`${e}\` not found in scope.`)}if("object"==typeof e&&null!==e){if(n9(e,t)){if(nY(e,"id")&&nI(t.types[e.id]))return;throw Error("Invalid schema. Expected an `id` field with a static ABI type or an explicit `key` option.")}throw Error("Invalid schema. Are you using invalid types or missing types in your scope?")}throw Error("Invalid table shorthand.")}(n,t):function(e,t=n4,n={inStoreContext:!1}){if("object"!=typeof e||null==e)throw Error(`Expected full table config, got \`${JSON.stringify(e)}\``);if(!nY(e,"schema"))throw Error("Missing schema input");if(function(e,t=n4){if(!nQ(e))throw Error(`Expected schema, received ${JSON.stringify(e)}`);for(let n of Object.values(e))if(!nE(n)&&!nY(t.types,n))throw Error(`"${String(n)}" is not a valid type in this scope.`)}(e.schema,t),!nY(e,"key")||!function(e,t,n=n4){return Array.isArray(e)&&e.every(e=>nY(t,e)&&nY(n.types,t[e])&&nI(n.types[t[e]]))}(e.key,e.schema,t))throw Error(`Invalid key. Expected \`(${(function(e,t=n4){return Object.entries(e).filter(([,e])=>nY(t.types,e)&&nI(t.types[e])).map(([e])=>e)})(e.schema,t).map(e=>`"${String(e)}"`).join(" | ")})[]\`, received \`${nY(e,"key")&&Array.isArray(e.key)?`[${e.key.map(e=>`"${e}"`).join(", ")}]`:String(nK(e,"key"))}\``);if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`Table \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(nY(e,"namespaceLabel")&&"string"==typeof e.namespaceLabel&&(!nY(e,"namespace")||"string"!=typeof e.namespace)&&e.namespaceLabel.length>14)throw Error(`Table \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${e.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`);if(nY(e,"name")&&"string"==typeof e.name&&e.name.length>16)throw Error(`Table \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`);if(n.inStoreContext&&(nY(e,"label")||nY(e,"namespaceLabel")||nY(e,"namespace")))throw Error("Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for tables in this context.")}(n,t,{inStoreContext:!0});return}throw Error(`Expected tables config, received ${JSON.stringify(e)}`)}function re(e,t){if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);nY(e,"tables")&&n7(e.tables,t)}function rt(e,t=n4){let n=e.label,r=e.namespace??n.slice(0,14);return{label:n,namespace:r,tables:Object.fromEntries(Object.entries(nN(e.tables??{},(e,a)=>[e,nX(n5(a,t),{namespace:r,namespaceLabel:n})])).map(([e,n])=>[e,function(e,t=n4){let n,r=e.namespaceLabel??n3.namespaceLabel,a=e.namespace??r,s=e.label,i=e.name??s.slice(0,16),o=e.type??n3.type,u=nr({type:o,namespace:a,name:i});return{label:s,type:o,namespace:a,namespaceLabel:r,name:i,tableId:u,schema:function(e,t=n4){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{type:nE(n)?n.replace(nC,"[]"):t.types[n],internalType:n}]))}(e.schema,t),key:e.key,codegen:{outputDirectory:nK(n=e.codegen,"outputDirectory")??n2.outputDirectory,tableIdArgument:nK(n,"tableIdArgument")??n2.tableIdArgument,storeArgument:nK(n,"storeArgument")??n2.storeArgument,dataStruct:nK(n,"dataStruct")??Object.keys(e.schema).length-e.key.length>1},deploy:nX(e.deploy??{},n1)}}(nX(n5(n,t),{label:e}),t)]))}}function rn(e,t){if(!nQ(e))throw Error(`Expected namespaces config, received ${JSON.stringify(e)}`);let n=nN(e,(e,n)=>[e,rt(nX(n,{label:e}),t)]),r=Array.from(tX(Object.values(n),e=>e.namespace).entries()).filter(([,e])=>e.length>1).map(([e])=>e);if(r.length>0)throw Error(`Found namespaces defined more than once in config: ${r.join(", ")}`);return n}function rr(e){return Object.fromEntries(Object.entries(e.namespaces).flatMap(([e,t])=>Object.entries(t.tables).map(([t,n])=>[""===e?t:`${e}__${t}`,n])))}function ra(e){return function(e,t=n4){return"object"==typeof e&&null!=e&&Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>"string"==typeof e))?n8(t,Object.fromEntries(Object.keys(e).map(e=>[e,"uint8"]))):t}(nK(e,"enums"),function(e,t=n4){return nQ(e)&&Object.values(e).every(e=>{var t;return t=e.type,nw.includes(t)})?n8(t,t1(e,e=>e.type)):t}(nK(e,"userTypes")))}function rs(e){let t=ra(e);if(nY(e,"namespaces")){if(nY(e,"namespace")||nY(e,"tables"))throw Error("Cannot use `namespaces` with `namespace` or `tables` keys.");(function(e,t){if(!nQ(e))throw Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let n of Object.values(e))re(n,t)})(e.namespaces,t)}if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);nY(e,"tables")&&n7(e.tables,t),nY(e,"userTypes")&&function(e){if(!nQ(e))throw Error(`Expected userTypes, received ${JSON.stringify(e)}`);for(let{type:t}of Object.values(e))if(!nY(n4.types,t))throw Error(`"${String(t)}" is not a valid ABI type.`)}(e.userTypes)}function ri(e){var t;let n=ra(e),r=e.namespace??n6.namespace,a=e.namespaces?{multipleNamespaces:!0,namespace:null,namespaces:rn(e.namespaces,n)}:{multipleNamespaces:!1,namespace:r,namespaces:rn({[r]:e},n)},s=rr(a);return{...a,tables:s,sourceDirectory:e.sourceDirectory??n6.sourceDirectory,userTypes:e.userTypes??{},enums:e.enums??{},enumValues:nN(e.enums??{},(e,t)=>[e,nN(t,(e,t)=>[t,e])]),codegen:nQ(t=e.codegen)?nX(t,n0):n0}}var ro=n(56928);(function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t})(O||(O={})),(C||(C={})).mergeShapes=(e,t)=>({...e,...t});let ru=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rl=e=>{switch(typeof e){case"undefined":return ru.undefined;case"string":return ru.string;case"number":return isNaN(e)?ru.nan:ru.number;case"boolean":return ru.boolean;case"function":return ru.function;case"bigint":return ru.bigint;case"symbol":return ru.symbol;case"object":if(Array.isArray(e))return ru.array;if(null===e)return ru.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return ru.promise;if("undefined"!=typeof Map&&e instanceof Map)return ru.map;if("undefined"!=typeof Set&&e instanceof Set)return ru.set;if("undefined"!=typeof Date&&e instanceof Date)return ru.date;return ru.object;default:return ru.unknown}},rc=O.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class rd extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){let n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof rd))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}rd.create=e=>new rd(e);let rp=(e,t)=>{let n;switch(e.code){case rc.invalid_type:n=e.received===ru.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case rc.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,O.jsonStringifyReplacer)}`;break;case rc.unrecognized_keys:n=`Unrecognized key(s) in object: ${O.joinValues(e.keys,", ")}`;break;case rc.invalid_union:n="Invalid input";break;case rc.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${O.joinValues(e.options)}`;break;case rc.invalid_enum_value:n=`Invalid enum value. Expected ${O.joinValues(e.options)}, received '${e.received}'`;break;case rc.invalid_arguments:n="Invalid function arguments";break;case rc.invalid_return_type:n="Invalid function return type";break;case rc.invalid_date:n="Invalid date";break;case rc.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:O.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case rc.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case rc.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case rc.custom:n="Invalid input";break;case rc.invalid_intersection_types:n="Intersection results could not be merged";break;case rc.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case rc.not_finite:n="Number must be finite";break;default:n=t.defaultError,O.assertNever(e)}return{message:n}},ry=rp;function rm(){return ry}let rf=e=>{let{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";for(let e of r.filter(e=>!!e).slice().reverse())o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function rh(e,t){let n=rm(),r=rf({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===rp?void 0:rp].filter(e=>!!e)});e.common.issues.push(r)}class rb{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if("aborted"===r.status)return rg;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let e of t){let t=await e.key,r=await e.value;n.push({key:t,value:r})}return rb.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:a}=r;if("aborted"===t.status||"aborted"===a.status)return rg;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==a.value||r.alwaysSet)&&(n[t.value]=a.value)}return{status:e.value,value:n}}}let rg=Object.freeze({status:"aborted"}),rv=e=>({status:"dirty",value:e}),rw=e=>({status:"valid",value:e}),r_=e=>"aborted"===e.status,rx=e=>"dirty"===e.status,rT=e=>"valid"===e.status,rk=e=>"undefined"!=typeof Promise&&e instanceof Promise;function rI(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function rO(e,t,n,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(E||(E={}));class rC{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let rE=(e,t)=>{if(rT(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new rd(e.common.issues);return this._error=t,this._error}}};function rS(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var s,i;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class rR{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rl(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rb,ctx:{common:e.parent.common,data:e.data,parsedType:rl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rk(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rl(e)},a=this._parseSync({data:e,path:r.path,parent:r});return rE(r,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rl(e)},r=this._parse({data:e,path:n.path,parent:n});return rE(n,await (rk(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{let a=e(t),s=()=>r.addIssue({code:rc.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new ac({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ad.create(this,this._def)}nullable(){return ap.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return r3.create(this,this._def)}promise(){return al.create(this,this._def)}or(e){return r4.create([this,e],this._def)}and(e){return r5.create(this,e,this._def)}transform(e){return new ac({...rS(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ay({...rS(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:j.ZodDefault})}brand(){return new ab({typeName:j.ZodBranded,type:this,...rS(this._def)})}catch(e){return new am({...rS(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:j.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ag.create(this,e)}readonly(){return av.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let rj=/^c[^\s-]{8,}$/i,rA=/^[0-9a-z]+$/,rN=/^[0-9A-HJKMNP-TV-Z]{26}$/,r$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rF=/^[a-z0-9_-]{21}$/i,rP=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rD=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,rZ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rB="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rz=RegExp(`^${rB}$`);function rU(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function rq(e){let t=`${rB}T${rU(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,RegExp(`^${t}$`)}class rV extends rR{_parse(e){var t,n;let r;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ru.string){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.string,received:t.parsedType}),rg}let s=new rb;for(let i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(rh(r=this._getOrReturnCtx(e,r),{code:rc.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if("max"===i.kind)e.data.length>i.value&&(rh(r=this._getOrReturnCtx(e,r),{code:rc.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if("length"===i.kind){let t=e.data.length>i.value,n=e.data.length<i.value;(t||n)&&(r=this._getOrReturnCtx(e,r),t?rh(r,{code:rc.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):n&&rh(r,{code:rc.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if("email"===i.kind)rM.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"email",code:rc.invalid_string,message:i.message}),s.dirty());else if("emoji"===i.kind)a||(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"emoji",code:rc.invalid_string,message:i.message}),s.dirty());else if("uuid"===i.kind)r$.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"uuid",code:rc.invalid_string,message:i.message}),s.dirty());else if("nanoid"===i.kind)rF.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"nanoid",code:rc.invalid_string,message:i.message}),s.dirty());else if("cuid"===i.kind)rj.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"cuid",code:rc.invalid_string,message:i.message}),s.dirty());else if("cuid2"===i.kind)rA.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"cuid2",code:rc.invalid_string,message:i.message}),s.dirty());else if("ulid"===i.kind)rN.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"ulid",code:rc.invalid_string,message:i.message}),s.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(t){rh(r=this._getOrReturnCtx(e,r),{validation:"url",code:rc.invalid_string,message:i.message}),s.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"regex",code:rc.invalid_string,message:i.message}),s.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):"datetime"===i.kind?rq(i).test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"datetime",message:i.message}),s.dirty()):"date"===i.kind?rz.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"date",message:i.message}),s.dirty()):"time"===i.kind?RegExp(`^${rU(i)}$`).test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"time",message:i.message}),s.dirty()):"duration"===i.kind?rP.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"duration",code:rc.invalid_string,message:i.message}),s.dirty()):"ip"===i.kind?(t=e.data,("v4"===(n=i.version)||!n)&&rL.test(t)||("v6"===n||!n)&&rD.test(t)||(rh(r=this._getOrReturnCtx(e,r),{validation:"ip",code:rc.invalid_string,message:i.message}),s.dirty())):"base64"===i.kind?rZ.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"base64",code:rc.invalid_string,message:i.message}),s.dirty()):O.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:rc.invalid_string,...E.errToObj(n)})}_addCheck(e){return new rV({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...E.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...E.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new rV({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rV({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rV({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rV.create=e=>{var t;return new rV({checks:[],typeName:j.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...rS(e)})};class rW extends rR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ru.number){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.number,received:t.parsedType}),rg}let n=new rb;for(let r of this._def.checks)"int"===r.kind?O.isInteger(e.data)||(rh(t=this._getOrReturnCtx(e,t),{code:rc.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==function(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}(e.data,r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_finite,message:r.message}),n.dirty()):O.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,r){return new rW({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(r)}]})}_addCheck(e){return new rW({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&O.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}rW.create=e=>new rW({checks:[],typeName:j.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...rS(e)});class rG extends rR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ru.bigint){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.bigint,received:t.parsedType}),rg}let n=new rb;for(let r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):O.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,r){return new rG({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(r)}]})}_addCheck(e){return new rG({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rG.create=e=>{var t;return new rG({checks:[],typeName:j.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...rS(e)})};class rH extends rR{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ru.boolean){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.boolean,received:t.parsedType}),rg}return rw(e.data)}}rH.create=e=>new rH({typeName:j.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...rS(e)});class rJ extends rR{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ru.date){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.date,received:t.parsedType}),rg}if(isNaN(e.data.getTime()))return rh(this._getOrReturnCtx(e),{code:rc.invalid_date}),rg;let n=new rb;for(let r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):O.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rJ({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}rJ.create=e=>new rJ({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:j.ZodDate,...rS(e)});class rK extends rR{_parse(e){if(this._getType(e)!==ru.symbol){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.symbol,received:t.parsedType}),rg}return rw(e.data)}}rK.create=e=>new rK({typeName:j.ZodSymbol,...rS(e)});class rY extends rR{_parse(e){if(this._getType(e)!==ru.undefined){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.undefined,received:t.parsedType}),rg}return rw(e.data)}}rY.create=e=>new rY({typeName:j.ZodUndefined,...rS(e)});class rQ extends rR{_parse(e){if(this._getType(e)!==ru.null){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.null,received:t.parsedType}),rg}return rw(e.data)}}rQ.create=e=>new rQ({typeName:j.ZodNull,...rS(e)});class rX extends rR{constructor(){super(...arguments),this._any=!0}_parse(e){return rw(e.data)}}rX.create=e=>new rX({typeName:j.ZodAny,...rS(e)});class r0 extends rR{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rw(e.data)}}r0.create=e=>new r0({typeName:j.ZodUnknown,...rS(e)});class r2 extends rR{_parse(e){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.never,received:t.parsedType}),rg}}r2.create=e=>new r2({typeName:j.ZodNever,...rS(e)});class r1 extends rR{_parse(e){if(this._getType(e)!==ru.undefined){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.void,received:t.parsedType}),rg}return rw(e.data)}}r1.create=e=>new r1({typeName:j.ZodVoid,...rS(e)});class r3 extends rR{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==ru.array)return rh(t,{code:rc.invalid_type,expected:ru.array,received:t.parsedType}),rg;if(null!==r.exactLength){let e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(rh(t,{code:e?rc.too_big:rc.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(rh(t,{code:rc.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(rh(t,{code:rc.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new rC(t,e,t.path,n)))).then(e=>rb.mergeArray(n,e));let a=[...t.data].map((e,n)=>r.type._parseSync(new rC(t,e,t.path,n)));return rb.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r3({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new r3({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new r3({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}r3.create=(e,t)=>new r3({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...rS(t)});class r6 extends rR{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=O.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ru.object){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.object,received:t.parsedType}),rg}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof r2&&"strip"===this._def.unknownKeys))for(let e in n.data)a.includes(e)||s.push(e);let i=[];for(let e of a){let t=r[e],a=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new rC(n,a,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof r2){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(rh(n,{code:rc.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new rC(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of i){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>rb.mergeObjectSync(t,e)):rb.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new r6({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;let o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=E.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new r6({...this._def,unknownKeys:"strip"})}passthrough(){return new r6({...this._def,unknownKeys:"passthrough"})}extend(e){return new r6({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r6({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r6({...this._def,catchall:e})}pick(e){let t={};return O.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r6({...this._def,shape:()=>t})}omit(e){let t={};return O.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r6({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof r6){let n={};for(let r in t.shape){let a=t.shape[r];n[r]=ad.create(e(a))}return new r6({...t._def,shape:()=>n})}return t instanceof r3?new r3({...t._def,type:e(t.element)}):t instanceof ad?ad.create(e(t.unwrap())):t instanceof ap?ap.create(e(t.unwrap())):t instanceof r7?r7.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return O.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new r6({...this._def,shape:()=>t})}required(e){let t={};return O.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ad;)e=e._def.innerType;t[n]=e}}),new r6({...this._def,shape:()=>t})}keyof(){return ai(O.objectKeys(this.shape))}}r6.create=(e,t)=>new r6({shape:()=>e,unknownKeys:"strip",catchall:r2.create(),typeName:j.ZodObject,...rS(t)}),r6.strictCreate=(e,t)=>new r6({shape:()=>e,unknownKeys:"strict",catchall:r2.create(),typeName:j.ZodObject,...rS(t)}),r6.lazycreate=(e,t)=>new r6({shape:e,unknownKeys:"strip",catchall:r2.create(),typeName:j.ZodObject,...rS(t)});class r4 extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new rd(e.ctx.common.issues));return rh(t,{code:rc.invalid_union,unionErrors:n}),rg});{let e;let r=[];for(let a of n){let n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let a=r.map(e=>new rd(e));return rh(t,{code:rc.invalid_union,unionErrors:a}),rg}}get options(){return this._def.options}}r4.create=(e,t)=>new r4({options:e,typeName:j.ZodUnion,...rS(t)});let r8=e=>{if(e instanceof aa)return r8(e.schema);if(e instanceof ac)return r8(e.innerType());if(e instanceof as)return[e.value];if(e instanceof ao)return e.options;if(e instanceof au)return O.objectValues(e.enum);if(e instanceof ay)return r8(e._def.innerType);if(e instanceof rY)return[void 0];else if(e instanceof rQ)return[null];else if(e instanceof ad)return[void 0,...r8(e.unwrap())];else if(e instanceof ap)return[null,...r8(e.unwrap())];else if(e instanceof ab)return r8(e.unwrap());else if(e instanceof av)return r8(e.unwrap());else if(e instanceof am)return r8(e._def.innerType);else return[]};class r9 extends rR{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ru.object)return rh(t,{code:rc.invalid_type,expected:ru.object,received:t.parsedType}),rg;let n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(rh(t,{code:rc.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),rg)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let n of t){let t=r8(n.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of t){if(r.has(a))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,n)}}return new r9({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...rS(n)})}}class r5 extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(r_(e)||r_(r))return rg;let a=function e(t,n){let r=rl(t),a=rl(n);if(t===n)return{valid:!0,data:t};if(r===ru.object&&a===ru.object){let r=O.objectKeys(n),a=O.objectKeys(t).filter(e=>-1!==r.indexOf(e)),s={...t,...n};for(let r of a){let a=e(t[r],n[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}if(r===ru.array&&a===ru.array){if(t.length!==n.length)return{valid:!1};let r=[];for(let a=0;a<t.length;a++){let s=e(t[a],n[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===ru.date&&a===ru.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}(e.value,r.value);return a.valid?((rx(e)||rx(r))&&t.dirty(),{status:t.value,value:a.data}):(rh(n,{code:rc.invalid_intersection_types}),rg)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}r5.create=(e,t,n)=>new r5({left:e,right:t,typeName:j.ZodIntersection,...rS(n)});class r7 extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.array)return rh(n,{code:rc.invalid_type,expected:ru.array,received:n.parsedType}),rg;if(n.data.length<this._def.items.length)return rh(n,{code:rc.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),rg;!this._def.rest&&n.data.length>this._def.items.length&&(rh(n,{code:rc.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new rC(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>rb.mergeArray(t,e)):rb.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new r7({...this._def,rest:e})}}r7.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new r7({items:e,typeName:j.ZodTuple,rest:null,...rS(t)})};class ae extends rR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.object)return rh(n,{code:rc.invalid_type,expected:ru.object,received:n.parsedType}),rg;let r=[],a=this._def.keyType,s=this._def.valueType;for(let e in n.data)r.push({key:a._parse(new rC(n,e,n.path,e)),value:s._parse(new rC(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?rb.mergeObjectAsync(t,r):rb.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new ae(t instanceof rR?{keyType:e,valueType:t,typeName:j.ZodRecord,...rS(n)}:{keyType:rV.create(),valueType:e,typeName:j.ZodRecord,...rS(t)})}}class at extends rR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.map)return rh(n,{code:rc.invalid_type,expected:ru.map,received:n.parsedType}),rg;let r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new rC(n,e,n.path,[s,"key"])),value:a._parse(new rC(n,t,n.path,[s,"value"]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return rg;("dirty"===r.status||"dirty"===a.status)&&t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of s){let r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return rg;("dirty"===r.status||"dirty"===a.status)&&t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}at.create=(e,t,n)=>new at({valueType:t,keyType:e,typeName:j.ZodMap,...rS(n)});class an extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.set)return rh(n,{code:rc.invalid_type,expected:ru.set,received:n.parsedType}),rg;let r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(rh(n,{code:rc.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(rh(n,{code:rc.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let a=this._def.valueType;function s(e){let n=new Set;for(let r of e){if("aborted"===r.status)return rg;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let i=[...n.data.values()].map((e,t)=>a._parse(new rC(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new an({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new an({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}an.create=(e,t)=>new an({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...rS(t)});class ar extends rR{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ru.function)return rh(t,{code:rc.invalid_type,expected:ru.function,received:t.parsedType}),rg;function n(e,n){return rf({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rm(),rp].filter(e=>!!e),issueData:{code:rc.invalid_arguments,argumentsError:n}})}function r(e,n){return rf({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rm(),rp].filter(e=>!!e),issueData:{code:rc.invalid_return_type,returnTypeError:n}})}let a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof al){let e=this;return rw(async function(...t){let i=new rd([]),o=await e._def.args.parseAsync(t,a).catch(e=>{throw i.addIssue(n(t,e)),i}),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,a).catch(e=>{throw i.addIssue(r(u,e)),i})})}{let e=this;return rw(function(...t){let i=e._def.args.safeParse(t,a);if(!i.success)throw new rd([n(t,i.error)]);let o=Reflect.apply(s,this,i.data),u=e._def.returns.safeParse(o,a);if(!u.success)throw new rd([r(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ar({...this._def,args:r7.create(e).rest(r0.create())})}returns(e){return new ar({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ar({args:e||r7.create([]).rest(r0.create()),returns:t||r0.create(),typeName:j.ZodFunction,...rS(n)})}}class aa extends rR{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}aa.create=(e,t)=>new aa({getter:e,typeName:j.ZodLazy,...rS(t)});class as extends rR{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return rh(t,{received:t.data,code:rc.invalid_literal,expected:this._def.value}),rg}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ai(e,t){return new ao({values:e,typeName:j.ZodEnum,...rS(t)})}as.create=(e,t)=>new as({value:e,typeName:j.ZodLiteral,...rS(t)});class ao extends rR{constructor(){super(...arguments),S.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),n=this._def.values;return rh(t,{expected:O.joinValues(n),received:t.parsedType,code:rc.invalid_type}),rg}if(rI(this,S,"f")||rO(this,S,new Set(this._def.values),"f"),!rI(this,S,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return rh(t,{received:t.data,code:rc.invalid_enum_value,options:n}),rg}return rw(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ao.create(e,{...this._def,...t})}exclude(e,t=this._def){return ao.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}S=new WeakMap,ao.create=ai;class au extends rR{constructor(){super(...arguments),R.set(this,void 0)}_parse(e){let t=O.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ru.string&&n.parsedType!==ru.number){let e=O.objectValues(t);return rh(n,{expected:O.joinValues(e),received:n.parsedType,code:rc.invalid_type}),rg}if(rI(this,R,"f")||rO(this,R,new Set(O.getValidEnumValues(this._def.values)),"f"),!rI(this,R,"f").has(e.data)){let e=O.objectValues(t);return rh(n,{received:n.data,code:rc.invalid_enum_value,options:e}),rg}return rw(e.data)}get enum(){return this._def.values}}R=new WeakMap,au.create=(e,t)=>new au({values:e,typeName:j.ZodNativeEnum,...rS(t)});class al extends rR{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ru.promise&&!1===t.common.async?(rh(t,{code:rc.invalid_type,expected:ru.promise,received:t.parsedType}),rg):rw((t.parsedType===ru.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}al.create=(e,t)=>new al({type:e,typeName:j.ZodPromise,...rS(t)});class ac extends rR{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{rh(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){let e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return rg;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?rg:"dirty"===r.status||"dirty"===t.value?rv(r.value):r});{if("aborted"===t.value)return rg;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?rg:"dirty"===r.status||"dirty"===t.value?rv(r.value):r}}if("refinement"===r.type){let e=e=>{let t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?rg:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))));{let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?rg:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}}if("transform"===r.type){if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>rT(e)?Promise.resolve(r.transform(e.value,a)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!rT(e))return e;let s=r.transform(e.value,a);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}O.assertNever(r)}}ac.create=(e,t,n)=>new ac({schema:e,typeName:j.ZodEffects,effect:t,...rS(n)}),ac.createWithPreprocess=(e,t,n)=>new ac({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...rS(n)});class ad extends rR{_parse(e){return this._getType(e)===ru.undefined?rw(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ad.create=(e,t)=>new ad({innerType:e,typeName:j.ZodOptional,...rS(t)});class ap extends rR{_parse(e){return this._getType(e)===ru.null?rw(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ap.create=(e,t)=>new ap({innerType:e,typeName:j.ZodNullable,...rS(t)});class ay extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===ru.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ay.create=(e,t)=>new ay({innerType:e,typeName:j.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...rS(t)});class am extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rk(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new rd(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new rd(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}am.create=(e,t)=>new am({innerType:e,typeName:j.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...rS(t)});class af extends rR{_parse(e){if(this._getType(e)!==ru.nan){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.nan,received:t.parsedType}),rg}return{status:"valid",value:e.data}}}af.create=e=>new af({typeName:j.ZodNaN,...rS(e)});let ah=Symbol("zod_brand");class ab extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ag extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?rg:"dirty"===e.status?(t.dirty(),rv(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?rg:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ag({in:e,out:t,typeName:j.ZodPipeline})}}class av extends rR{_parse(e){let t=this._def.innerType._parse(e),n=e=>(rT(e)&&(e.value=Object.freeze(e.value)),e);return rk(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function aw(e,t={},n){return e?rX.create().superRefine((r,a)=>{var s,i;if(!e(r)){let e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):rX.create()}av.create=(e,t)=>new av({innerType:e,typeName:j.ZodReadonly,...rS(t)});let a_={object:r6.lazycreate};!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(j||(j={}));let ax=rV.create,aT=rW.create,ak=af.create,aI=rG.create,aO=rH.create,aC=rJ.create,aE=rK.create,aS=rY.create,aR=rQ.create,aj=rX.create,aA=r0.create,aN=r2.create,a$=r1.create,aF=r3.create,aP=r6.create,aM=r6.strictCreate,aL=r4.create,aD=r9.create,aZ=r5.create,aB=r7.create,az=ae.create,aU=at.create,aq=an.create,aV=ar.create,aW=aa.create,aG=as.create,aH=ao.create,aJ=au.create,aK=al.create,aY=ac.create,aQ=ad.create,aX=ap.create,a0=ac.createWithPreprocess,a2=ag.create;var a1=Object.freeze({__proto__:null,defaultErrorMap:rp,setErrorMap:function(e){ry=e},getErrorMap:rm,makeIssue:rf,EMPTY_PATH:[],addIssueToContext:rh,ParseStatus:rb,INVALID:rg,DIRTY:rv,OK:rw,isAborted:r_,isDirty:rx,isValid:rT,isAsync:rk,get util(){return O},get objectUtil(){return C},ZodParsedType:ru,getParsedType:rl,ZodType:rR,datetimeRegex:rq,ZodString:rV,ZodNumber:rW,ZodBigInt:rG,ZodBoolean:rH,ZodDate:rJ,ZodSymbol:rK,ZodUndefined:rY,ZodNull:rQ,ZodAny:rX,ZodUnknown:r0,ZodNever:r2,ZodVoid:r1,ZodArray:r3,ZodObject:r6,ZodUnion:r4,ZodDiscriminatedUnion:r9,ZodIntersection:r5,ZodTuple:r7,ZodRecord:ae,ZodMap:at,ZodSet:an,ZodFunction:ar,ZodLazy:aa,ZodLiteral:as,ZodEnum:ao,ZodNativeEnum:au,ZodPromise:al,ZodEffects:ac,ZodTransformer:ac,ZodOptional:ad,ZodNullable:ap,ZodDefault:ay,ZodCatch:am,ZodNaN:af,BRAND:ah,ZodBranded:ab,ZodPipeline:ag,ZodReadonly:av,custom:aw,Schema:rR,ZodSchema:rR,late:a_,get ZodFirstPartyTypeKind(){return j},coerce:{string:e=>rV.create({...e,coerce:!0}),number:e=>rW.create({...e,coerce:!0}),boolean:e=>rH.create({...e,coerce:!0}),bigint:e=>rG.create({...e,coerce:!0}),date:e=>rJ.create({...e,coerce:!0})},any:aj,array:aF,bigint:aI,boolean:aO,date:aC,discriminatedUnion:aD,effect:aY,enum:aH,function:aV,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>aw(t=>t instanceof e,t),intersection:aZ,lazy:aW,literal:aG,map:aU,nan:ak,nativeEnum:aJ,never:aN,null:aR,nullable:aX,number:aT,object:aP,oboolean:()=>aO().optional(),onumber:()=>aT().optional(),optional:aQ,ostring:()=>ax().optional(),pipeline:a2,preprocess:a0,promise:aK,record:az,set:aq,strictObject:aM,string:ax,symbol:aE,transformer:aY,tuple:aB,undefined:aS,union:aL,unknown:aA,void:a$,NEVER:rg,ZodIssueCode:rc,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:rd});a1.object({chainId:a1.number(),address:a1.string().refine(ro.v).optional(),filters:a1.array(a1.object({tableId:a1.string().refine(ro.v),key0:a1.string().refine(ro.v).optional(),key1:a1.string().refine(ro.v).optional()})).default([])});class a3 extends Error{}class a6 extends Error{constructor(e){let t=function(e){if(e instanceof Error)return e;let t=typeof e;if("undefined"!==t&&"function"!==t&&null!==e){if("object"!==t)return Error(String(e));if(e&&!Array.isArray(e)&&"object"==typeof e){let t=new a3;for(let n in e)t[n]=e[n];return t}}}(e.cause);super(e.message??t?.message??e.code,{cause:t}),this.code=e.code,this.name=this.constructor.name}}function a4(e){let t=Object.create(null);for(let n in e)t[e[n]]=n;return t}let a8={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};a4(a8),a4(a8);let a9={PARSE_ERROR:400,BAD_REQUEST:400,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500,UNAUTHORIZED:401,FORBIDDEN:403,TIMEOUT:408,CONFLICT:409,CLIENT_CLOSED_REQUEST:499,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,METHOD_NOT_SUPPORTED:405,UNPROCESSABLE_CONTENT:422,TOO_MANY_REQUESTS:429},a5=()=>{},a7=e=>(function e(t,n){return new Proxy(a5,{get(r,a){if("string"==typeof a&&"then"!==a)return e(t,[...n,a])},apply(e,r,a){let s="apply"===n[n.length-1];return t({args:s?a.length>=2?a[1]:[]:a,path:s?n.slice(0,-1):n})}})})(e,[]),se=e=>new Proxy(a5,{get(t,n){if("string"==typeof n&&"then"!==n)return e(n)}}),st={_default:!0,input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}},sn=({shape:e})=>e,sr=["query","mutation","subscription"],sa={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:sn,transformer:st},ss=["then"];function si(e){return function(t){var n;let r=new Set(Object.keys(t).filter(e=>ss.includes(e)));if(r.size>0)throw Error("Reserved words used in `router({})` call: "+Array.from(r).join(", "));let a=(n={},Object.assign(Object.create(null),n));!function e(t,n=""){for(let[r,s]of Object.entries(t??{})){let t=`${n}${r}`;if("router"in s._def){e(s._def.procedures,`${t}.`);continue}if(a[t])throw Error(`Duplicate key: ${t}`);a[t]=s}}(t);let s={_config:e,router:!0,procedures:a,...sa,record:t,queries:Object.entries(a).filter(e=>e[1]._def.query).reduce((e,[t,n])=>({...e,[t]:n}),{}),mutations:Object.entries(a).filter(e=>e[1]._def.mutation).reduce((e,[t,n])=>({...e,[t]:n}),{}),subscriptions:Object.entries(a).filter(e=>e[1]._def.subscription).reduce((e,[t,n])=>({...e,[t]:n}),{})};return{...t,_def:s,createCaller:e=>a7(({path:t,args:n})=>{if(1===t.length&&sr.includes(t[0]))return function(e){let{type:t,path:n}=e;if(!(n in e.procedures)||!e.procedures[n]?._def[t])throw new a6({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});return(0,e.procedures[n])(e)}({procedures:s.procedures,path:n[0],rawInput:n[1],ctx:e,type:t[0]});let r=t.join("."),a=s.procedures[r],i="query";return a._def.mutation?i="mutation":a._def.subscription&&(i="subscription"),a({path:r,rawInput:n[0],ctx:e,type:i})}),getErrorShape(t){let{path:n,error:r}=t,{code:a}=t.error,s={message:r.message,code:a8[a],data:{code:a,httpStatus:function(e){let{code:t}=e;return a9[t]??500}(r)}};return e.isDev&&"string"==typeof t.error.stack&&(s.data.stack=t.error.stack),"string"==typeof n&&(s.data.path=n),this._def._config.errorFormatter({...t,shape:s})}}}}let so="undefined"==typeof window||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID,su="middlewareMarker";function sl(e){if("function"==typeof e)return e;if("function"==typeof e.parseAsync)return e.parseAsync.bind(e);if("function"==typeof e.parse)return e.parse.bind(e);if("function"==typeof e.validateSync)return e.validateSync.bind(e);if("function"==typeof e.create)return e.create.bind(e);throw Error("Could not find a validator fn")}class sc{_def(){return{middlewares:this.middlewares,resolver:this.resolver,inputParser:this.inputParser,outputParser:this.outputParser,meta:this.meta}}async parseInput(e){try{return await this.parseInputFn(e)}catch(e){throw new TRPCError({code:"BAD_REQUEST",cause:e})}}async parseOutput(e){try{return await this.parseOutputFn(e)}catch(e){throw new TRPCError({code:"INTERNAL_SERVER_ERROR",cause:e,message:"Output validation failed"})}}async call(e){let t=this.middlewares.concat([async({ctx:t})=>{let n=await this.parseInput(e.rawInput),r=await this.resolver({...e,ctx:t,input:n});return{marker:su,ok:!0,data:await this.parseOutput(r),ctx:t}}]),n=async(r={index:0,ctx:e.ctx})=>{try{return await t[r.index]({ctx:r.ctx,type:e.type,path:e.path,rawInput:e.rawInput,meta:this.meta,next:async e=>await n({index:r.index+1,ctx:e?e.ctx:r.ctx})})}catch(e){return{ctx:r.ctx,ok:!1,error:getTRPCErrorFromUnknown(e),marker:su}}},r=await n();if(!r)throw new TRPCError({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!r.ok)throw r.error;return r.data}inheritMiddlewares(e){return new this.constructor({middlewares:[...e,...this.middlewares],resolver:this.resolver,inputParser:this.inputParser,outputParser:this.outputParser,meta:this.meta})}constructor(e){this.middlewares=e.middlewares,this.resolver=e.resolver,this.inputParser=e.inputParser,this.parseInputFn=sl(this.inputParser),this.outputParser=e.outputParser,this.parseOutputFn=sl(this.outputParser),this.meta=e.meta}}function sd(e){let t="input"in e?e.input:e=>{if(null!=e)throw new TRPCError({code:"BAD_REQUEST",message:"No input expected"})},n="output"in e&&e.output?e.output:e=>e;return new sc({inputParser:t,resolver:e.resolve,middlewares:[],outputParser:n,meta:e.meta})}function sp(e){if("function"==typeof e)return e;if("function"==typeof e.parseAsync)return e.parseAsync.bind(e);if("function"==typeof e.parse)return e.parse.bind(e);if("function"==typeof e.validateSync)return e.validateSync.bind(e);if("function"==typeof e.create)return e.create.bind(e);if("function"==typeof e.assert)return t=>(e.assert(t),t);throw Error("Could not find a validator fn")}function sy(e,...t){let n=Object.assign(Object.create(null),e);for(let e of t)for(let t in e){if(t in n&&n[t]!==e[t])throw Error(`Duplicate key ${t}`);n[t]=e[t]}return n}function sm(e){return e&&"object"==typeof e&&!Array.isArray(e)}function sf(e){let t=async({next:t,rawInput:n,input:r})=>{let a;try{a=await e(n)}catch(e){throw new a6({code:"BAD_REQUEST",cause:e})}return t({input:sm(r)&&sm(a)?{...r,...a}:a})};return t._type="input",t}function sh(e){let t=async({next:t})=>{let n=await t();if(!n.ok)return n;try{let t=await e(n.data);return{...n,data:t}}catch(e){throw new a6({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:e})}};return t._type="output",t}let sb="middlewareMarker";function sg(e,t){let{middlewares:n=[],inputs:r,meta:a,...s}=t;return sv({...sy(e,s),inputs:[...e.inputs,...r??[]],middlewares:[...e.middlewares,...n],meta:e.meta&&a?{...e.meta,...a}:a??e.meta})}function sv(e={}){let t={inputs:[],middlewares:[],...e};return{_def:t,input(e){let n=sp(e);return sg(t,{inputs:[e],middlewares:[sf(n)]})},output(e){let n=sp(e);return sg(t,{output:e,middlewares:[sh(n)]})},meta:e=>sg(t,{meta:e}),unstable_concat:e=>sg(t,e._def),use:e=>sg(t,{middlewares:"_middlewares"in e?e._middlewares:[e]}),query:e=>sw({...t,query:!0},e),mutation:e=>sw({...t,mutation:!0},e),subscription:e=>sw({...t,subscription:!0},e)}}function sw(e,t){return function(e){let t=async function(t){if(!t||!("rawInput"in t))throw Error(s_);let n=async(r={index:0,ctx:t.ctx})=>{try{let a=e.middlewares[r.index];return await a({ctx:r.ctx,type:t.type,path:t.path,rawInput:r.rawInput??t.rawInput,meta:e.meta,input:r.input,next:e=>n({index:r.index+1,ctx:e&&"ctx"in e?{...r.ctx,...e.ctx}:r.ctx,input:e&&"input"in e?e.input:r.input,rawInput:e&&"rawInput"in e?e.rawInput:r.rawInput})})}catch(e){return{ok:!1,error:function(e){if(e instanceof a6)return e;let t=new a6({code:"INTERNAL_SERVER_ERROR",cause:e});return e instanceof Error&&e.stack&&(t.stack=e.stack),t}(e),marker:sb}}},r=await n();if(!r)throw new a6({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!r.ok)throw r.error;return r.data};return t._def=e,t.meta=e.meta,t}(sg(e,{resolver:t,middlewares:[async function(e){return{marker:sb,ok:!0,data:await t(e),ctx:e.ctx}}]})._def)}let s_=`
|
|
10
|
+
Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}class tS extends Z.G{constructor(e){super(`Type "${e}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}var tR=n(35130),tj=n(99487),tA=n(69535),tN=n(76670),t$=n(16272),tP=n(19611),tF=n(65484),tM=n(12322),tL=n(1504);function tD(e,t={}){void 0!==t.size&&(0,tL.Yf)(e,{size:t.size});let n=(0,eh.ci)(e,t);return(0,tL.ly)(n,t)}var tZ=n(68095),tB=n(77157);function tz(e,t){if(e.length!==t.length)throw new tv({expectedLength:e.length,givenLength:t.length});let n=tU(function({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(function e({param:t,value:n}){let r=tq(t.type);if(r){let[a,s]=r;return function(t,{length:n,param:r}){let a=null===n;if(!Array.isArray(t))throw new tC(t);if(!a&&t.length!==n)throw new tb({expectedLength:n,givenLength:t.length,type:`${r.type}[${n}]`});let s=!1,i=[];for(let n=0;n<t.length;n++){let a=e({param:r,value:t[n]});a.dynamic&&(s=!0),i.push(a)}if(a||s){let e=tU(i);if(a){let t=(0,eh.eC)(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?(0,tZ.zo)([t,e]):t}}if(s)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:(0,tZ.zo)(i.map(({encoded:e})=>e))}}(n,{length:a,param:{...t,type:s}})}if("tuple"===t.type)return function(t,{param:n}){let r=!1,a=[];for(let s=0;s<n.components.length;s++){let i=n.components[s],o=Array.isArray(t)?s:i.name,u=e({param:i,value:t[o]});a.push(u),u.dynamic&&(r=!0)}return{dynamic:r,encoded:r?tU(a):(0,tZ.zo)(a.map(({encoded:e})=>e))}}(n,{param:t});if("address"===t.type)return function(e){if(!(0,tj.U)(e))throw new tR.b({address:e});return{dynamic:!1,encoded:(0,tB.gc)(e.toLowerCase())}}(n);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new Z.G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,tB.gc)((0,eh.C4)(e))}}(n);if(t.type.startsWith("uint")||t.type.startsWith("int"))return function(e,{signed:t}){return{dynamic:!1,encoded:(0,eh.eC)(e,{size:32,signed:t})}}(n,{signed:t.type.startsWith("int")});if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,n]=t.type.split("bytes"),r=(0,e7.d)(e);if(!n){let t=e;return r%32!=0&&(t=(0,tB.gc)(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:(0,tZ.zo)([(0,tB.gc)((0,eh.eC)(r,{size:32})),t])}}if(r!==Number.parseInt(n))throw new tg({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:(0,tB.gc)(e,{dir:"right"})}}(n,{param:t});if("string"===t.type)return function(e){let t=(0,eh.$G)(e),n=Math.ceil((0,e7.d)(t)/32),r=[];for(let e=0;e<n;e++)r.push((0,tB.gc)((0,tP.tP)(t,32*e,(e+1)*32),{dir:"right"}));return{dynamic:!0,encoded:(0,tZ.zo)([(0,tB.gc)((0,eh.eC)((0,e7.d)(t),{size:32})),...r])}}(n);throw new tI(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[r],value:t[r]}));return n}({params:e,values:t}));return 0===n.length?"0x":n}function tU(e){let t=0;for(let n=0;n<e.length;n++){let{dynamic:r,encoded:a}=e[n];r?t+=32:t+=(0,e7.d)(a)}let n=[],r=[],a=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:o}=e[s];i?(n.push((0,eh.eC)(t+a,{size:32})),r.push(o),a+=(0,e7.d)(o)):n.push(o)}return(0,tZ.zo)([...n,...r])}function tq(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function tV(e,t){let n="string"==typeof t?(0,to.nr)(t):t,r=(0,t$.q)(n);if(0===(0,e7.d)(n)&&e.length>0)throw new th;if((0,e7.d)(t)&&32>(0,e7.d)(t))throw new tf({data:"string"==typeof t?t:(0,eh.ci)(t),params:e,size:(0,e7.d)(t)});let a=0,s=[];for(let t=0;t<e.length;++t){let n=e[t];r.setPosition(a);let[i,o]=function e(t,n,{staticPosition:r}){let a=tq(n.type);if(a){let[s,i]=a;return function(t,n,{length:r,staticPosition:a}){if(!r){let r=a+tD(t.readBytes(32)),s=r+32;t.setPosition(r);let i=tD(t.readBytes(32)),o=tW(n),u=0,l=[];for(let r=0;r<i;++r){t.setPosition(s+(o?32*r:u));let[a,i]=e(t,n,{staticPosition:s});u+=i,l.push(a)}return t.setPosition(a+32),[l,32]}if(tW(n)){let s=a+tD(t.readBytes(32)),i=[];for(let a=0;a<r;++a){t.setPosition(s+32*a);let[r]=e(t,n,{staticPosition:s});i.push(r)}return t.setPosition(a+32),[i,32]}let s=0,i=[];for(let o=0;o<r;++o){let[r,o]=e(t,n,{staticPosition:a+s});s+=o,i.push(r)}return[i,s]}(t,{...n,type:i},{length:s,staticPosition:r})}if("tuple"===n.type)return function(t,n,{staticPosition:r}){let a=0===n.components.length||n.components.some(({name:e})=>!e),s=a?[]:{},i=0;if(tW(n)){let o=r+tD(t.readBytes(32));for(let r=0;r<n.components.length;++r){let u=n.components[r];t.setPosition(o+i);let[l,c]=e(t,u,{staticPosition:o});i+=c,s[a?r:u?.name]=l}return t.setPosition(r+32),[s,32]}for(let o=0;o<n.components.length;++o){let u=n.components[o],[l,c]=e(t,u,{staticPosition:r});s[a?o:u?.name]=l,i+=c}return[s,i]}(t,n,{staticPosition:r});if("address"===n.type)return function(e){let t=e.readBytes(32);return[(0,tN.x)((0,eh.ci)((0,tP.T4)(t,-20))),32]}(t);if("bool"===n.type)return[function(e,t={}){let n=e;if(void 0!==t.size&&((0,tL.Yf)(n,{size:t.size}),n=(0,tF.f)(n)),n.length>1||n[0]>1)throw new tM.yr(n);return!!n[0]}(t.readBytes(32),{size:32}),32];if(n.type.startsWith("bytes"))return function(e,t,{staticPosition:n}){let[r,a]=t.type.split("bytes");if(!a){let t=tD(e.readBytes(32));e.setPosition(n+t);let r=tD(e.readBytes(32));if(0===r)return e.setPosition(n+32),["0x",32];let a=e.readBytes(r);return e.setPosition(n+32),[(0,eh.ci)(a),32]}return[(0,eh.ci)(e.readBytes(Number.parseInt(a),32)),32]}(t,n,{staticPosition:r});if(n.type.startsWith("uint")||n.type.startsWith("int"))return function(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),a=e.readBytes(32);return[r>48?function(e,t={}){void 0!==t.size&&(0,tL.Yf)(e,{size:t.size});let n=(0,eh.ci)(e,t);return(0,tL.y_)(n,t)}(a,{signed:n}):tD(a,{signed:n}),32]}(t,n);if("string"===n.type)return function(e,{staticPosition:t}){let n=tD(e.readBytes(32));e.setPosition(t+n);let r=tD(e.readBytes(32));if(0===r)return e.setPosition(t+32),["",32];let a=e.readBytes(r,32),s=function(e,t={}){let n=e;return void 0!==t.size&&((0,tL.Yf)(n,{size:t.size}),n=(0,tF.f)(n,{dir:"right"})),new TextDecoder().decode(n)}((0,tF.f)(a));return e.setPosition(t+32),[s,32]}(t,{staticPosition:r});throw new tO(n.type,{docsPath:"/docs/contract/decodeAbiParameters"})}(r,n,{staticPosition:0});a+=o,s.push(i)}return s}function tW(e){let{type:t}=e;if("string"===t||"bytes"===t||t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(tW);let n=tq(e.type);return!!(n&&tW({...e,type:n[1]}))}let tG="/docs/contract/decodeEventLog";function tH(e){let{abi:t,args:n,logs:r,strict:a=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(e=>{try{let r=t.find(t=>"event"===t.type&&e.topics[0]===tp(t));if(!r)return null;let i=function(e){let{abi:t,data:n,strict:r,topics:a}=e,s=r??!0,[i,...o]=a;if(!i)throw new tw({docsPath:tG});let u=1===t.length?t[0]:t.find(e=>"event"===e.type&&i===tp(ty(e)));if(!(u&&"name"in u)||"event"!==u.type)throw new t_(i,{docsPath:tG});let{name:l,inputs:c}=u,d=c?.some(e=>!("name"in e&&e.name)),p=d?[]:{},y=c.filter(e=>"indexed"in e&&e.indexed);for(let e=0;e<y.length;e++){let t=y[e],n=o[e];if(!n)throw new tk({abiItem:u,param:t});p[d?e:t.name||e]=function({param:e,value:t}){return"string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(tV([e],t)||[])[0]}({param:t,value:n})}let m=c.filter(e=>!("indexed"in e&&e.indexed));if(m.length>0){if(n&&"0x"!==n)try{let e=tV(m,n);if(e){if(d)p=[...p,...e];else for(let t=0;t<m.length;t++)p[m[t].name]=e[t]}}catch(e){if(s){if(e instanceof tf||e instanceof tA.lQ)throw new tT({abiItem:u,data:n,params:m,size:(0,e7.d)(n)});throw e}}else if(s)throw new tT({abiItem:u,data:"0x",params:m,size:0})}return{eventName:l,args:Object.values(p).length>0?p:void 0}}({...e,abi:[r],strict:a});if(s&&!s.includes(i.eventName)||!function(e){let{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function a(e,t,n){try{if("address"===e.type)return function(e,t){if(!(0,tj.U)(e,{strict:!1}))throw new tR.b({address:e});if(!(0,tj.U)(t,{strict:!1}))throw new tR.b({address:t});return e.toLowerCase()===t.toLowerCase()}(t,n);if("string"===e.type||"bytes"===e.type)return(0,eb.w)((0,to.O0)(t))===n;return t===n}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((e,r)=>{if(null==e)return!0;let s=n[r];return!!s&&(Array.isArray(e)?e:[e]).some(e=>a(s,e,t[r]))}):!("object"!=typeof t||Array.isArray(t)||"object"!=typeof r||Array.isArray(r))&&Object.entries(r).every(([e,r])=>{if(null==r)return!0;let s=n.find(t=>t.name===e);return!!s&&(Array.isArray(r)?r:[r]).some(n=>a(s,n,t[e]))})}({args:i.args,inputs:r.inputs,matchArgs:n}))return null;return{...i,...e}}catch(r){let t,n;if(r instanceof t_)return null;if(r instanceof tT||r instanceof tk){if(a)return null;t=r.abiItem.name,n=r.abiItem.inputs?.some(e=>!("name"in e&&e.name))}return{...e,args:n?[]:{},eventName:t}}}).filter(Boolean)}class tJ extends Z.G{constructor({blockHash:e,blockNumber:t}){let n="Block";e&&(n=`Block at hash "${e}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}function tK(e,t){throw Error(t??`Unexpected value: ${e}`)}function tY(...e){return e.reduce((e,t)=>t<e?t:e)}function tQ(e,t){return e<t?-1:e>t?1:0}function tX(e,t){let n=new Map;for(let r of e){let e=t(r);n.has(e)||n.set(e,[]),n.get(e).push(r)}return n}function t0(e){return void 0!==e}async function t2(e){let t=[];for await(let n of e)t.push(n);return t}function t1(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n,e)]))}function t3(e){return new Promise(t=>setTimeout(()=>t(),e))}var t6=n(3741),t4=n(8297),t8=t6("mud:common"),t9=t6("mud:common");t8.log=console.debug.bind(console),t9.log=console.error.bind(console),n(94335);class t5 extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}new WeakMap;var t7=function(e,t,n,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n},ne=function(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};i=new WeakMap,o=new WeakMap,u=new WeakMap,l=new WeakMap,c=new WeakMap,d=new WeakMap,p=new WeakMap,y=new WeakMap,m=new WeakMap,new WeakMap,f=new WeakMap,h=new WeakMap,b=new WeakMap,new WeakMap,s=new WeakSet,g=function(){return ne(this,o,"f")||ne(this,u,"f")<ne(this,l,"f")},v=function(){return ne(this,f,"f")<ne(this,h,"f")},w=function(){ne(this,s,"m",k).call(this),ne(this,s,"m",T).call(this),t7(this,y,void 0,"f")},_=function(){let e=Date.now();if(void 0===ne(this,p,"f")){let t=ne(this,d,"f")-e;if(!(t<0))return void 0===ne(this,y,"f")&&t7(this,y,setTimeout(()=>{ne(this,s,"m",w).call(this)},t),"f"),!0;t7(this,u,ne(this,i,"f")?ne(this,f,"f"):0,"f")}return!1},x=function(){if(0===ne(this,m,"f").size)return ne(this,p,"f")&&clearInterval(ne(this,p,"f")),t7(this,p,void 0,"f"),this.emit("empty"),0===ne(this,f,"f")&&this.emit("idle"),!1;if(!ne(this,b,"f")){let e=!ne(this,s,"a",_);if(ne(this,s,"a",g)&&ne(this,s,"a",v)){let t=ne(this,m,"f").dequeue();return!!t&&(this.emit("active"),t(),e&&ne(this,s,"m",T).call(this),!0)}}return!1},T=function(){ne(this,o,"f")||void 0!==ne(this,p,"f")||(t7(this,p,setInterval(()=>{ne(this,s,"m",k).call(this)},ne(this,c,"f")),"f"),t7(this,d,Date.now()+ne(this,c,"f"),"f"))},k=function(){0===ne(this,u,"f")&&0===ne(this,f,"f")&&ne(this,p,"f")&&(clearInterval(ne(this,p,"f")),t7(this,p,void 0,"f")),t7(this,u,ne(this,i,"f")?ne(this,f,"f"):0,"f"),ne(this,s,"m",I).call(this)},I=function(){for(;ne(this,s,"m",x).call(this););},n(27147);t8.extend("createNonceManager");t8.extend("sendTransaction"),t8.extend("writeContract");var nt=["table","offchainTable","namespace","system"],nn={table:"tb",offchainTable:"ot",namespace:"ns",system:"sy"};function nr(e){let t=nn[e.type];if(e.namespace.length>14)throw Error(`Namespaces must fit into \`bytes14\`, but "${e.namespace}" is too long.`);return(0,tZ.SM)([(0,eh.$G)(t,{size:2}),(0,eh.$G)(e.namespace,{size:14}),(0,eh.$G)(e.name.slice(0,16),{size:16})])}function na({namespace:e,name:t}){return""===e?t:`${e}__${t}`}var ns=Object.fromEntries(Object.entries(nn).map(([e,t])=>[t,e]));function ni(e){let t=(0,tL.rR)((0,tP.p5)(e,0,2)).replace(/\0+$/,""),n=function(e){let t=ns[e];if(nt.includes(t))return t}(t),r=(0,tL.rR)((0,tP.p5)(e,2,16)).replace(/\0+$/,""),a=(0,tL.rR)((0,tP.p5)(e,16,32)).replace(/\0+$/,"");if(!n)throw Error(`Unknown type (${t}) for resource (${na({namespace:r,name:a})})`);return{resourceId:e,type:n,namespace:r,name:a}}function no(e,t){return e.blockNumber===t.blockNumber?e.logIndex===t.logIndex?0:null==e.logIndex?1:null==t.logIndex?-1:e.logIndex-t.logIndex:null==e.blockNumber?1:null==t.blockNumber?-1:e.blockNumber>t.blockNumber?1:e.blockNumber<t.blockNumber?-1:0}function nu(e,t,n){return`0x${e.replace(/^0x/,"").slice(2*t,null!=n?2*n:void 0).padEnd(((n??t)-t)*2,"0")}`}function nl(e,t,n=0,r="0x"){return(0,tZ.SM)([nu(e,0,t),r,nu(e,t+n)])}t6("mud:benchmark").log=console.info.bind(console),t8.extend("transportObserver");var nc=t6("mud:block-events-stream"),nd=t6("mud:block-events-stream");async function np(e){let t={method:"eth_getLogs",params:[{address:e.address,topics:e.topics,fromBlock:(0,eh.eC)(e.fromBlock),toBlock:(0,eh.eC)(e.toBlock)}]};if(!e.internal_validateBlockRange)return(await (e.publicClient??L({chain:e.internal_chain,transport:ew()})).request(t)).map(e=>(0,t4.U)(e));let[n]=e.internal_chain.rpcUrls.default.http,r=H(n),a={method:"eth_getBlockByNumber",params:[(0,eh.eC)(e.toBlock),!1]},[{error:s,result:i},{error:o,result:u}]=await r.request({body:[a,t]});if(s)throw new U({body:a,error:s,url:n});if(o)throw new U({body:t,error:o,url:n});if(!i)throw new tJ({blockNumber:e.toBlock});return u.map(e=>(0,t4.U)(e))}nc.log=console.debug.bind(console),nd.log=console.error.bind(console);var ny=["rate limit exceeded","over rate limit","sender is over rate limit"],nm=["block range exceeded","block range is too large","block range greater than","query exceeds max block range","exceed maximum block range"],nf=["block is out of range","backend response too large","query exceeds max results"],nh=["block not found","unknown block","Unknown block"];async function*nb({maxBlockRange:e=1000n,maxRetryCount:t=3,fromBlock:n,toBlock:r,...a}){let s=a.getLogs??(async e=>{let t=a.events?[a.events.map(e=>tp(e))]:void 0,n=await np({...a,...e,topics:t});return a.events?tH({logs:n,abi:a.events}):n}),i=n,o=tY(e,r-i),u=0;for(;i<=r;){let n=i+function(...e){return e.reduce((e,t)=>t>e?t:e)}(0n,o-1n);nc(`getting logs for blocks ${i}-${n} (${o} blocks, ${e} max)`);try{let t=await s({fromBlock:i,toBlock:n});yield{fromBlock:i,toBlock:n,logs:t},i=n+1n,o=tY(e,r-i),u=0}catch(s){if(!(s instanceof Error))throw s;if(u<t&&ny.some(e=>s.message.includes(e))){let e=2*u;nc(`too many requests, retrying in ${e}s`),await t3(1e3*e),u+=1;continue}let r=nm.some(e=>s.message.includes(e)),a=nf.some(e=>s.message.includes(e));if(r||a){if((o/=2n)<=0n)throw Error("can't reduce block range any further");r&&(e=o),nc(`got block range error, retrying with ${o} blocks, ${e} max`);continue}if(u<t&&(nh.some(e=>s.message.includes(e))||s.message===new tJ({blockNumber:n}).message)){let e=2*u;nc(`missing block, retrying in ${e}s`),await t3(1e3*e),u+=1;continue}throw s}}}async function ng(e){var t;let n,r;return(n=Array.from(new Set((t=(await t2(nb(e))).flatMap(({logs:e})=>e)).map(e=>e.blockNumber)))).sort(tQ),r=Array.from(tX(t.slice().sort(no),e=>e.blockNumber).entries()).map(([e,t])=>({blockNumber:e,logs:t})).filter(e=>e.logs.length>0),n.at(-1),r}var nv=e5(["event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)","event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data)","event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint8 dynamicFieldIndex, uint48 start, uint40 deleteCount, bytes32 encodedLengths, bytes data)","event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple)"]),nw=["uint8","uint16","uint24","uint32","uint40","uint48","uint56","uint64","uint72","uint80","uint88","uint96","uint104","uint112","uint120","uint128","uint136","uint144","uint152","uint160","uint168","uint176","uint184","uint192","uint200","uint208","uint216","uint224","uint232","uint240","uint248","uint256","int8","int16","int24","int32","int40","int48","int56","int64","int72","int80","int88","int96","int104","int112","int120","int128","int136","int144","int152","int160","int168","int176","int184","int192","int200","int208","int216","int224","int232","int240","int248","int256","bytes1","bytes2","bytes3","bytes4","bytes5","bytes6","bytes7","bytes8","bytes9","bytes10","bytes11","bytes12","bytes13","bytes14","bytes15","bytes16","bytes17","bytes18","bytes19","bytes20","bytes21","bytes22","bytes23","bytes24","bytes25","bytes26","bytes27","bytes28","bytes29","bytes30","bytes31","bytes32","bool","address","uint8[]","uint16[]","uint24[]","uint32[]","uint40[]","uint48[]","uint56[]","uint64[]","uint72[]","uint80[]","uint88[]","uint96[]","uint104[]","uint112[]","uint120[]","uint128[]","uint136[]","uint144[]","uint152[]","uint160[]","uint168[]","uint176[]","uint184[]","uint192[]","uint200[]","uint208[]","uint216[]","uint224[]","uint232[]","uint240[]","uint248[]","uint256[]","int8[]","int16[]","int24[]","int32[]","int40[]","int48[]","int56[]","int64[]","int72[]","int80[]","int88[]","int96[]","int104[]","int112[]","int120[]","int128[]","int136[]","int144[]","int152[]","int160[]","int168[]","int176[]","int184[]","int192[]","int200[]","int208[]","int216[]","int224[]","int232[]","int240[]","int248[]","int256[]","bytes1[]","bytes2[]","bytes3[]","bytes4[]","bytes5[]","bytes6[]","bytes7[]","bytes8[]","bytes9[]","bytes10[]","bytes11[]","bytes12[]","bytes13[]","bytes14[]","bytes15[]","bytes16[]","bytes17[]","bytes18[]","bytes19[]","bytes20[]","bytes21[]","bytes22[]","bytes23[]","bytes24[]","bytes25[]","bytes26[]","bytes27[]","bytes28[]","bytes29[]","bytes30[]","bytes31[]","bytes32[]","bool[]","address[]","bytes","string"],n_=nw.slice(0,98),nx=nw.slice(98),nT={uint8:0,uint16:0,uint24:0,uint32:0,uint40:0,uint48:0,uint56:0n,uint64:0n,uint72:0n,uint80:0n,uint88:0n,uint96:0n,uint104:0n,uint112:0n,uint120:0n,uint128:0n,uint136:0n,uint144:0n,uint152:0n,uint160:0n,uint168:0n,uint176:0n,uint184:0n,uint192:0n,uint200:0n,uint208:0n,uint216:0n,uint224:0n,uint232:0n,uint240:0n,uint248:0n,uint256:0n,int8:0,int16:0,int24:0,int32:0,int40:0,int48:0,int56:0n,int64:0n,int72:0n,int80:0n,int88:0n,int96:0n,int104:0n,int112:0n,int120:0n,int128:0n,int136:0n,int144:0n,int152:0n,int160:0n,int168:0n,int176:0n,int184:0n,int192:0n,int200:0n,int208:0n,int216:0n,int224:0n,int232:0n,int240:0n,int248:0n,int256:0n,bytes1:"0x00",bytes2:"0x0000",bytes3:"0x000000",bytes4:"0x00000000",bytes5:"0x0000000000",bytes6:"0x000000000000",bytes7:"0x00000000000000",bytes8:"0x0000000000000000",bytes9:"0x000000000000000000",bytes10:"0x00000000000000000000",bytes11:"0x0000000000000000000000",bytes12:"0x000000000000000000000000",bytes13:"0x00000000000000000000000000",bytes14:"0x0000000000000000000000000000",bytes15:"0x000000000000000000000000000000",bytes16:"0x00000000000000000000000000000000",bytes17:"0x0000000000000000000000000000000000",bytes18:"0x000000000000000000000000000000000000",bytes19:"0x00000000000000000000000000000000000000",bytes20:"0x0000000000000000000000000000000000000000",bytes21:"0x000000000000000000000000000000000000000000",bytes22:"0x00000000000000000000000000000000000000000000",bytes23:"0x0000000000000000000000000000000000000000000000",bytes24:"0x000000000000000000000000000000000000000000000000",bytes25:"0x00000000000000000000000000000000000000000000000000",bytes26:"0x0000000000000000000000000000000000000000000000000000",bytes27:"0x000000000000000000000000000000000000000000000000000000",bytes28:"0x00000000000000000000000000000000000000000000000000000000",bytes29:"0x0000000000000000000000000000000000000000000000000000000000",bytes30:"0x000000000000000000000000000000000000000000000000000000000000",bytes31:"0x00000000000000000000000000000000000000000000000000000000000000",bytes32:"0x0000000000000000000000000000000000000000000000000000000000000000",bool:!1,address:"0x0000000000000000000000000000000000000000"},nk={uint8:1,uint16:2,uint24:3,uint32:4,uint40:5,uint48:6,uint56:7,uint64:8,uint72:9,uint80:10,uint88:11,uint96:12,uint104:13,uint112:14,uint120:15,uint128:16,uint136:17,uint144:18,uint152:19,uint160:20,uint168:21,uint176:22,uint184:23,uint192:24,uint200:25,uint208:26,uint216:27,uint224:28,uint232:29,uint240:30,uint248:31,uint256:32,int8:1,int16:2,int24:3,int32:4,int40:5,int48:6,int56:7,int64:8,int72:9,int80:10,int88:11,int96:12,int104:13,int112:14,int120:15,int128:16,int136:17,int144:18,int152:19,int160:20,int168:21,int176:22,int184:23,int192:24,int200:25,int208:26,int216:27,int224:28,int232:29,int240:30,int248:31,int256:32,bytes1:1,bytes2:2,bytes3:3,bytes4:4,bytes5:5,bytes6:6,bytes7:7,bytes8:8,bytes9:9,bytes10:10,bytes11:11,bytes12:12,bytes13:13,bytes14:14,bytes15:15,bytes16:16,bytes17:17,bytes18:18,bytes19:19,bytes20:20,bytes21:21,bytes22:22,bytes23:23,bytes24:24,bytes25:25,bytes26:26,bytes27:27,bytes28:28,bytes29:29,bytes30:30,bytes31:31,bytes32:32,bool:1,address:20};function nI(e){return n_.includes(e)}var nO=/\[\]$/,nC=/\[\d+\]$/;function nE(e){return"string"==typeof e&&nC.test(e)&&nI(e.replace(nC,""))}function nS(e){return e.replace(nO,"")}var nR={"uint8[]":[],"uint16[]":[],"uint24[]":[],"uint32[]":[],"uint40[]":[],"uint48[]":[],"uint56[]":[],"uint64[]":[],"uint72[]":[],"uint80[]":[],"uint88[]":[],"uint96[]":[],"uint104[]":[],"uint112[]":[],"uint120[]":[],"uint128[]":[],"uint136[]":[],"uint144[]":[],"uint152[]":[],"uint160[]":[],"uint168[]":[],"uint176[]":[],"uint184[]":[],"uint192[]":[],"uint200[]":[],"uint208[]":[],"uint216[]":[],"uint224[]":[],"uint232[]":[],"uint240[]":[],"uint248[]":[],"uint256[]":[],"int8[]":[],"int16[]":[],"int24[]":[],"int32[]":[],"int40[]":[],"int48[]":[],"int56[]":[],"int64[]":[],"int72[]":[],"int80[]":[],"int88[]":[],"int96[]":[],"int104[]":[],"int112[]":[],"int120[]":[],"int128[]":[],"int136[]":[],"int144[]":[],"int152[]":[],"int160[]":[],"int168[]":[],"int176[]":[],"int184[]":[],"int192[]":[],"int200[]":[],"int208[]":[],"int216[]":[],"int224[]":[],"int232[]":[],"int240[]":[],"int248[]":[],"int256[]":[],"bytes1[]":[],"bytes2[]":[],"bytes3[]":[],"bytes4[]":[],"bytes5[]":[],"bytes6[]":[],"bytes7[]":[],"bytes8[]":[],"bytes9[]":[],"bytes10[]":[],"bytes11[]":[],"bytes12[]":[],"bytes13[]":[],"bytes14[]":[],"bytes15[]":[],"bytes16[]":[],"bytes17[]":[],"bytes18[]":[],"bytes19[]":[],"bytes20[]":[],"bytes21[]":[],"bytes22[]":[],"bytes23[]":[],"bytes24[]":[],"bytes25[]":[],"bytes26[]":[],"bytes27[]":[],"bytes28[]":[],"bytes29[]":[],"bytes30[]":[],"bytes31[]":[],"bytes32[]":[],"bool[]":[],"address[]":[],bytes:"0x",string:""};function nj(e){return nx.includes(e)}let nA=e=>{let t=typeof e;return"object"===t?null===e?"null":"object":"function"===t?"object":t},nN=(e,t)=>{let n=Array.isArray(e),r=Object.entries(e).flatMap((e,r)=>{let a=n?t(r,e[1]):t(...e,r);return Array.isArray(a[0])||0===a.length?a:[a]}),a=Object.fromEntries(r);return"number"==typeof r[0]?.[0]?Object.values(a):a};class n$ extends Error{}let nP=e=>nF(e,n$),nF=(e,t=Error)=>{throw new t(e)},nM=(e,t)=>e in t,nL=Symbol("represents an uninitialized value");(e=>{let t=nL;return()=>t===nL?t=e():t})(()=>{try{return Function("return false")()}catch{return!0}});let nD=/^(?!^-0$)-?(?:0|[1-9]\d*)(?:\.\d*[1-9])?$/;nD.test.bind(nD);let nZ=/^(?:0|(?:-?[1-9]\d*))$/;nZ.test.bind(nZ);let nB=/^-?\d+$/;nB.test.bind(nB);let nz={Array,Date,Error,Function,Map,RegExp,Set,String,Number,Boolean,WeakMap,WeakSet,Promise},nU=e=>{let t=Object.getPrototypeOf(e);for(;t?.constructor&&(!nM(t.constructor.name,nz)||!(e instanceof nz[t.constructor.name]));)t=Object.getPrototypeOf(t);let n=t?.constructor?.name;if(void 0!==n&&"Object"!==n)return n},nq=e=>{let t=[],n=e;for(;n!==Object.prototype&&null!=n;){for(let e of Object.getOwnPropertyNames(n))"constructor"===e||t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e);n=Object.getPrototypeOf(n)}return t};nq(0n),nq(!1),nq(0),nq(""),nq(Symbol());let nV={version:"0.2.2",filename:void 0},nW=new WeakMap,nG={},nH=e=>/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(e),nJ=e=>{switch(typeof e){case"object":{if(null===e)break;let t=nU(e)??"object";return t[0].toLowerCase()+t.slice(1)}case"function":return nH(e.name)?e.name:"fn";case"symbol":return e.description&&nH(e.description)?e.description:"symbol"}return nP(`Unexpected attempt to register serializable value of type ${nA(e)}`)};function nK(e,t){return"object"==typeof e&&null!=e&&nY(e,t)?e[t]:void 0}function nY(e,t){return"object"==typeof e&&null!==e&&e.hasOwnProperty(t)}function nQ(e){return null!=e&&"object"==typeof e}function nX(e,t){return Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].map(n=>[n,typeof e[n]>"u"?t[n]:e[n]]))}Symbol("implementedTraits"),Symbol.hasInstance;var n0={storeImportPath:"@latticexyz/store/src",userTypesFilename:"common.sol",outputDirectory:"codegen",indexFilename:"index.sol"},n2={outputDirectory:"tables",tableIdArgument:!1,storeArgument:!1},n1={disabled:!1},n3={namespaceLabel:"",type:"table"},n6={sourceDirectory:"src",namespace:""},n4={types:Object.fromEntries(nw.map(e=>[e,e]))};function n8(e,t){return{types:{...e.types,...t}}}function n9(e,t=n4){return"object"==typeof e&&null!=e&&Object.values(e).every(e=>nE(e)||nY(t.types,e))}function n5(e,t){return"string"==typeof e?{schema:{id:"bytes32",value:e},key:["id"]}:n9(e,t)?{schema:e,key:["id"]}:e}function n7(e,t){if(nQ(e)){for(let n of Object.values(e))"string"==typeof n||nQ(n)&&Object.values(n).every(e=>"string"==typeof e)?function(e,t=n4){if("string"==typeof e){if(nE(e)||nY(t.types,e))return;throw Error(`Invalid ABI type. \`${e}\` not found in scope.`)}if("object"==typeof e&&null!==e){if(n9(e,t)){if(nY(e,"id")&&nI(t.types[e.id]))return;throw Error("Invalid schema. Expected an `id` field with a static ABI type or an explicit `key` option.")}throw Error("Invalid schema. Are you using invalid types or missing types in your scope?")}throw Error("Invalid table shorthand.")}(n,t):function(e,t=n4,n={inStoreContext:!1}){if("object"!=typeof e||null==e)throw Error(`Expected full table config, got \`${JSON.stringify(e)}\``);if(!nY(e,"schema"))throw Error("Missing schema input");if(function(e,t=n4){if(!nQ(e))throw Error(`Expected schema, received ${JSON.stringify(e)}`);for(let n of Object.values(e))if(!nE(n)&&!nY(t.types,n))throw Error(`"${String(n)}" is not a valid type in this scope.`)}(e.schema,t),!nY(e,"key")||!function(e,t,n=n4){return Array.isArray(e)&&e.every(e=>nY(t,e)&&nY(n.types,t[e])&&nI(n.types[t[e]]))}(e.key,e.schema,t))throw Error(`Invalid key. Expected \`(${(function(e,t=n4){return Object.entries(e).filter(([,e])=>nY(t.types,e)&&nI(t.types[e])).map(([e])=>e)})(e.schema,t).map(e=>`"${String(e)}"`).join(" | ")})[]\`, received \`${nY(e,"key")&&Array.isArray(e.key)?`[${e.key.map(e=>`"${e}"`).join(", ")}]`:String(nK(e,"key"))}\``);if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`Table \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(nY(e,"namespaceLabel")&&"string"==typeof e.namespaceLabel&&(!nY(e,"namespace")||"string"!=typeof e.namespace)&&e.namespaceLabel.length>14)throw Error(`Table \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${e.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`);if(nY(e,"name")&&"string"==typeof e.name&&e.name.length>16)throw Error(`Table \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`);if(n.inStoreContext&&(nY(e,"label")||nY(e,"namespaceLabel")||nY(e,"namespace")))throw Error("Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for tables in this context.")}(n,t,{inStoreContext:!0});return}throw Error(`Expected tables config, received ${JSON.stringify(e)}`)}function re(e,t){if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);nY(e,"tables")&&n7(e.tables,t)}function rt(e,t=n4){let n=e.label,r=e.namespace??n.slice(0,14);return{label:n,namespace:r,tables:Object.fromEntries(Object.entries(nN(e.tables??{},(e,a)=>[e,nX(n5(a,t),{namespace:r,namespaceLabel:n})])).map(([e,n])=>[e,function(e,t=n4){let n,r=e.namespaceLabel??n3.namespaceLabel,a=e.namespace??r,s=e.label,i=e.name??s.slice(0,16),o=e.type??n3.type,u=nr({type:o,namespace:a,name:i});return{label:s,type:o,namespace:a,namespaceLabel:r,name:i,tableId:u,schema:function(e,t=n4){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,{type:nE(n)?n.replace(nC,"[]"):t.types[n],internalType:n}]))}(e.schema,t),key:e.key,codegen:{outputDirectory:nK(n=e.codegen,"outputDirectory")??n2.outputDirectory,tableIdArgument:nK(n,"tableIdArgument")??n2.tableIdArgument,storeArgument:nK(n,"storeArgument")??n2.storeArgument,dataStruct:nK(n,"dataStruct")??Object.keys(e.schema).length-e.key.length>1},deploy:nX(e.deploy??{},n1)}}(nX(n5(n,t),{label:e}),t)]))}}function rn(e,t){if(!nQ(e))throw Error(`Expected namespaces config, received ${JSON.stringify(e)}`);let n=nN(e,(e,n)=>[e,rt(nX(n,{label:e}),t)]),r=Array.from(tX(Object.values(n),e=>e.namespace).entries()).filter(([,e])=>e.length>1).map(([e])=>e);if(r.length>0)throw Error(`Found namespaces defined more than once in config: ${r.join(", ")}`);return n}function rr(e){return Object.fromEntries(Object.entries(e.namespaces).flatMap(([e,t])=>Object.entries(t.tables).map(([t,n])=>[""===e?t:`${e}__${t}`,n])))}function ra(e){return function(e,t=n4){return"object"==typeof e&&null!=e&&Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>"string"==typeof e))?n8(t,Object.fromEntries(Object.keys(e).map(e=>[e,"uint8"]))):t}(nK(e,"enums"),function(e,t=n4){return nQ(e)&&Object.values(e).every(e=>{var t;return t=e.type,nw.includes(t)})?n8(t,t1(e,e=>e.type)):t}(nK(e,"userTypes")))}function rs(e){let t=ra(e);if(nY(e,"namespaces")){if(nY(e,"namespace")||nY(e,"tables"))throw Error("Cannot use `namespaces` with `namespace` or `tables` keys.");(function(e,t){if(!nQ(e))throw Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let n of Object.values(e))re(n,t)})(e.namespaces,t)}if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`\`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);nY(e,"tables")&&n7(e.tables,t),nY(e,"userTypes")&&function(e){if(!nQ(e))throw Error(`Expected userTypes, received ${JSON.stringify(e)}`);for(let{type:t}of Object.values(e))if(!nY(n4.types,t))throw Error(`"${String(t)}" is not a valid ABI type.`)}(e.userTypes)}function ri(e){var t;let n=ra(e),r=e.namespace??n6.namespace,a=e.namespaces?{multipleNamespaces:!0,namespace:null,namespaces:rn(e.namespaces,n)}:{multipleNamespaces:!1,namespace:r,namespaces:rn({[r]:e},n)},s=rr(a);return{...a,tables:s,sourceDirectory:e.sourceDirectory??n6.sourceDirectory,userTypes:e.userTypes??{},enums:e.enums??{},enumValues:nN(e.enums??{},(e,t)=>[e,nN(t,(e,t)=>[t,e])]),codegen:nQ(t=e.codegen)?nX(t,n0):n0}}var ro=n(56928);(function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw Error()},e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t})(O||(O={})),(C||(C={})).mergeShapes=(e,t)=>({...e,...t});let ru=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),rl=e=>{switch(typeof e){case"undefined":return ru.undefined;case"string":return ru.string;case"number":return isNaN(e)?ru.nan:ru.number;case"boolean":return ru.boolean;case"function":return ru.function;case"bigint":return ru.bigint;case"symbol":return ru.symbol;case"object":if(Array.isArray(e))return ru.array;if(null===e)return ru.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return ru.promise;if("undefined"!=typeof Map&&e instanceof Map)return ru.map;if("undefined"!=typeof Set&&e instanceof Set)return ru.set;if("undefined"!=typeof Date&&e instanceof Date)return ru.date;return ru.object;default:return ru.unknown}},rc=O.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class rd extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){let n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof rd))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}rd.create=e=>new rd(e);let rp=(e,t)=>{let n;switch(e.code){case rc.invalid_type:n=e.received===ru.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case rc.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,O.jsonStringifyReplacer)}`;break;case rc.unrecognized_keys:n=`Unrecognized key(s) in object: ${O.joinValues(e.keys,", ")}`;break;case rc.invalid_union:n="Invalid input";break;case rc.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${O.joinValues(e.options)}`;break;case rc.invalid_enum_value:n=`Invalid enum value. Expected ${O.joinValues(e.options)}, received '${e.received}'`;break;case rc.invalid_arguments:n="Invalid function arguments";break;case rc.invalid_return_type:n="Invalid function return type";break;case rc.invalid_date:n="Invalid date";break;case rc.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:O.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case rc.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case rc.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case rc.custom:n="Invalid input";break;case rc.invalid_intersection_types:n="Intersection results could not be merged";break;case rc.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case rc.not_finite:n="Number must be finite";break;default:n=t.defaultError,O.assertNever(e)}return{message:n}},ry=rp;function rm(){return ry}let rf=e=>{let{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";for(let e of r.filter(e=>!!e).slice().reverse())o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function rh(e,t){let n=rm(),r=rf({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===rp?void 0:rp].filter(e=>!!e)});e.common.issues.push(r)}class rb{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let r of t){if("aborted"===r.status)return rg;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let e of t){let t=await e.key,r=await e.value;n.push({key:t,value:r})}return rb.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:a}=r;if("aborted"===t.status||"aborted"===a.status)return rg;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==a.value||r.alwaysSet)&&(n[t.value]=a.value)}return{status:e.value,value:n}}}let rg=Object.freeze({status:"aborted"}),rv=e=>({status:"dirty",value:e}),rw=e=>({status:"valid",value:e}),r_=e=>"aborted"===e.status,rx=e=>"dirty"===e.status,rT=e=>"valid"===e.status,rk=e=>"undefined"!=typeof Promise&&e instanceof Promise;function rI(e,t,n,r){if("a"===n&&!r)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function rO(e,t,n,r,a){if("m"===r)throw TypeError("Private method is not writable");if("a"===r&&!a)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?a.call(e,n):a?a.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(E||(E={}));class rC{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let rE=(e,t)=>{if(rT(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new rd(e.common.issues);return this._error=t,this._error}}};function rS(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:a}:{errorMap:(t,a)=>{var s,i;let{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class rR{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return rl(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:rl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new rb,ctx:{common:e.parent.common,data:e.data,parsedType:rl(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(rk(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rl(e)},a=this._parseSync({data:e,path:r.path,parent:r});return rE(r,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:rl(e)},r=this._parse({data:e,path:n.path,parent:n});return rE(n,await (rk(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{let a=e(t),s=()=>r.addIssue({code:rc.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new ac({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ad.create(this,this._def)}nullable(){return ap.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return r3.create(this,this._def)}promise(){return al.create(this,this._def)}or(e){return r4.create([this,e],this._def)}and(e){return r5.create(this,e,this._def)}transform(e){return new ac({...rS(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new ay({...rS(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:j.ZodDefault})}brand(){return new ab({typeName:j.ZodBranded,type:this,...rS(this._def)})}catch(e){return new am({...rS(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:j.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return ag.create(this,e)}readonly(){return av.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let rj=/^c[^\s-]{8,}$/i,rA=/^[0-9a-z]+$/,rN=/^[0-9A-HJKMNP-TV-Z]{26}$/,r$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,rP=/^[a-z0-9_-]{21}$/i,rF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,rL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rD=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,rZ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rB="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rz=RegExp(`^${rB}$`);function rU(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function rq(e){let t=`${rB}T${rU(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,RegExp(`^${t}$`)}class rV extends rR{_parse(e){var t,n;let r;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ru.string){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.string,received:t.parsedType}),rg}let s=new rb;for(let i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(rh(r=this._getOrReturnCtx(e,r),{code:rc.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if("max"===i.kind)e.data.length>i.value&&(rh(r=this._getOrReturnCtx(e,r),{code:rc.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),s.dirty());else if("length"===i.kind){let t=e.data.length>i.value,n=e.data.length<i.value;(t||n)&&(r=this._getOrReturnCtx(e,r),t?rh(r,{code:rc.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):n&&rh(r,{code:rc.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),s.dirty())}else if("email"===i.kind)rM.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"email",code:rc.invalid_string,message:i.message}),s.dirty());else if("emoji"===i.kind)a||(a=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),a.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"emoji",code:rc.invalid_string,message:i.message}),s.dirty());else if("uuid"===i.kind)r$.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"uuid",code:rc.invalid_string,message:i.message}),s.dirty());else if("nanoid"===i.kind)rP.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"nanoid",code:rc.invalid_string,message:i.message}),s.dirty());else if("cuid"===i.kind)rj.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"cuid",code:rc.invalid_string,message:i.message}),s.dirty());else if("cuid2"===i.kind)rA.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"cuid2",code:rc.invalid_string,message:i.message}),s.dirty());else if("ulid"===i.kind)rN.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"ulid",code:rc.invalid_string,message:i.message}),s.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(t){rh(r=this._getOrReturnCtx(e,r),{validation:"url",code:rc.invalid_string,message:i.message}),s.dirty()}else"regex"===i.kind?(i.regex.lastIndex=0,i.regex.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"regex",code:rc.invalid_string,message:i.message}),s.dirty())):"trim"===i.kind?e.data=e.data.trim():"includes"===i.kind?e.data.includes(i.value,i.position)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),s.dirty()):"toLowerCase"===i.kind?e.data=e.data.toLowerCase():"toUpperCase"===i.kind?e.data=e.data.toUpperCase():"startsWith"===i.kind?e.data.startsWith(i.value)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{startsWith:i.value},message:i.message}),s.dirty()):"endsWith"===i.kind?e.data.endsWith(i.value)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:{endsWith:i.value},message:i.message}),s.dirty()):"datetime"===i.kind?rq(i).test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"datetime",message:i.message}),s.dirty()):"date"===i.kind?rz.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"date",message:i.message}),s.dirty()):"time"===i.kind?RegExp(`^${rU(i)}$`).test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{code:rc.invalid_string,validation:"time",message:i.message}),s.dirty()):"duration"===i.kind?rF.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"duration",code:rc.invalid_string,message:i.message}),s.dirty()):"ip"===i.kind?(t=e.data,("v4"===(n=i.version)||!n)&&rL.test(t)||("v6"===n||!n)&&rD.test(t)||(rh(r=this._getOrReturnCtx(e,r),{validation:"ip",code:rc.invalid_string,message:i.message}),s.dirty())):"base64"===i.kind?rZ.test(e.data)||(rh(r=this._getOrReturnCtx(e,r),{validation:"base64",code:rc.invalid_string,message:i.message}),s.dirty()):O.assertNever(i);return{status:s.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:rc.invalid_string,...E.errToObj(n)})}_addCheck(e){return new rV({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...E.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...E.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new rV({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rV({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rV({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rV.create=e=>{var t;return new rV({checks:[],typeName:j.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...rS(e)})};class rW extends rR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ru.number){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.number,received:t.parsedType}),rg}let n=new rb;for(let r of this._def.checks)"int"===r.kind?O.isInteger(e.data)||(rh(t=this._getOrReturnCtx(e,t),{code:rc.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):"multipleOf"===r.kind?0!==function(e,t){let n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}(e.data,r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_finite,message:r.message}),n.dirty()):O.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,r){return new rW({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(r)}]})}_addCheck(e){return new rW({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&O.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}rW.create=e=>new rW({checks:[],typeName:j.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...rS(e)});class rG extends rR{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==ru.bigint){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.bigint,received:t.parsedType}),rg}let n=new rb;for(let r of this._def.checks)"min"===r.kind?(r.inclusive?e.data<r.value:e.data<=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"max"===r.kind?(r.inclusive?e.data>r.value:e.data>=r.value)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):O.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,r){return new rG({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(r)}]})}_addCheck(e){return new rG({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}rG.create=e=>{var t;return new rG({checks:[],typeName:j.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...rS(e)})};class rH extends rR{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ru.boolean){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.boolean,received:t.parsedType}),rg}return rw(e.data)}}rH.create=e=>new rH({typeName:j.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...rS(e)});class rJ extends rR{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ru.date){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.date,received:t.parsedType}),rg}if(isNaN(e.data.getTime()))return rh(this._getOrReturnCtx(e),{code:rc.invalid_date}),rg;let n=new rb;for(let r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(rh(t=this._getOrReturnCtx(e,t),{code:rc.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):O.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new rJ({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}rJ.create=e=>new rJ({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:j.ZodDate,...rS(e)});class rK extends rR{_parse(e){if(this._getType(e)!==ru.symbol){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.symbol,received:t.parsedType}),rg}return rw(e.data)}}rK.create=e=>new rK({typeName:j.ZodSymbol,...rS(e)});class rY extends rR{_parse(e){if(this._getType(e)!==ru.undefined){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.undefined,received:t.parsedType}),rg}return rw(e.data)}}rY.create=e=>new rY({typeName:j.ZodUndefined,...rS(e)});class rQ extends rR{_parse(e){if(this._getType(e)!==ru.null){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.null,received:t.parsedType}),rg}return rw(e.data)}}rQ.create=e=>new rQ({typeName:j.ZodNull,...rS(e)});class rX extends rR{constructor(){super(...arguments),this._any=!0}_parse(e){return rw(e.data)}}rX.create=e=>new rX({typeName:j.ZodAny,...rS(e)});class r0 extends rR{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rw(e.data)}}r0.create=e=>new r0({typeName:j.ZodUnknown,...rS(e)});class r2 extends rR{_parse(e){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.never,received:t.parsedType}),rg}}r2.create=e=>new r2({typeName:j.ZodNever,...rS(e)});class r1 extends rR{_parse(e){if(this._getType(e)!==ru.undefined){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.void,received:t.parsedType}),rg}return rw(e.data)}}r1.create=e=>new r1({typeName:j.ZodVoid,...rS(e)});class r3 extends rR{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==ru.array)return rh(t,{code:rc.invalid_type,expected:ru.array,received:t.parsedType}),rg;if(null!==r.exactLength){let e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(rh(t,{code:e?rc.too_big:rc.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(rh(t,{code:rc.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(rh(t,{code:rc.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new rC(t,e,t.path,n)))).then(e=>rb.mergeArray(n,e));let a=[...t.data].map((e,n)=>r.type._parseSync(new rC(t,e,t.path,n)));return rb.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r3({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new r3({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new r3({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}r3.create=(e,t)=>new r3({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...rS(t)});class r6 extends rR{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=O.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==ru.object){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.object,received:t.parsedType}),rg}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof r2&&"strip"===this._def.unknownKeys))for(let e in n.data)a.includes(e)||s.push(e);let i=[];for(let e of a){let t=r[e],a=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new rC(n,a,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof r2){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(rh(n,{code:rc.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new rC(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of i){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>rb.mergeObjectSync(t,e)):rb.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new r6({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;let o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=E.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new r6({...this._def,unknownKeys:"strip"})}passthrough(){return new r6({...this._def,unknownKeys:"passthrough"})}extend(e){return new r6({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r6({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r6({...this._def,catchall:e})}pick(e){let t={};return O.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r6({...this._def,shape:()=>t})}omit(e){let t={};return O.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r6({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof r6){let n={};for(let r in t.shape){let a=t.shape[r];n[r]=ad.create(e(a))}return new r6({...t._def,shape:()=>n})}return t instanceof r3?new r3({...t._def,type:e(t.element)}):t instanceof ad?ad.create(e(t.unwrap())):t instanceof ap?ap.create(e(t.unwrap())):t instanceof r7?r7.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return O.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new r6({...this._def,shape:()=>t})}required(e){let t={};return O.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ad;)e=e._def.innerType;t[n]=e}}),new r6({...this._def,shape:()=>t})}keyof(){return ai(O.objectKeys(this.shape))}}r6.create=(e,t)=>new r6({shape:()=>e,unknownKeys:"strip",catchall:r2.create(),typeName:j.ZodObject,...rS(t)}),r6.strictCreate=(e,t)=>new r6({shape:()=>e,unknownKeys:"strict",catchall:r2.create(),typeName:j.ZodObject,...rS(t)}),r6.lazycreate=(e,t)=>new r6({shape:e,unknownKeys:"strip",catchall:r2.create(),typeName:j.ZodObject,...rS(t)});class r4 extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new rd(e.ctx.common.issues));return rh(t,{code:rc.invalid_union,unionErrors:n}),rg});{let e;let r=[];for(let a of n){let n={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let a=r.map(e=>new rd(e));return rh(t,{code:rc.invalid_union,unionErrors:a}),rg}}get options(){return this._def.options}}r4.create=(e,t)=>new r4({options:e,typeName:j.ZodUnion,...rS(t)});let r8=e=>{if(e instanceof aa)return r8(e.schema);if(e instanceof ac)return r8(e.innerType());if(e instanceof as)return[e.value];if(e instanceof ao)return e.options;if(e instanceof au)return O.objectValues(e.enum);if(e instanceof ay)return r8(e._def.innerType);if(e instanceof rY)return[void 0];else if(e instanceof rQ)return[null];else if(e instanceof ad)return[void 0,...r8(e.unwrap())];else if(e instanceof ap)return[null,...r8(e.unwrap())];else if(e instanceof ab)return r8(e.unwrap());else if(e instanceof av)return r8(e.unwrap());else if(e instanceof am)return r8(e._def.innerType);else return[]};class r9 extends rR{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ru.object)return rh(t,{code:rc.invalid_type,expected:ru.object,received:t.parsedType}),rg;let n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(rh(t,{code:rc.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),rg)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let n of t){let t=r8(n.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of t){if(r.has(a))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,n)}}return new r9({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...rS(n)})}}class r5 extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(r_(e)||r_(r))return rg;let a=function e(t,n){let r=rl(t),a=rl(n);if(t===n)return{valid:!0,data:t};if(r===ru.object&&a===ru.object){let r=O.objectKeys(n),a=O.objectKeys(t).filter(e=>-1!==r.indexOf(e)),s={...t,...n};for(let r of a){let a=e(t[r],n[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}if(r===ru.array&&a===ru.array){if(t.length!==n.length)return{valid:!1};let r=[];for(let a=0;a<t.length;a++){let s=e(t[a],n[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===ru.date&&a===ru.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}(e.value,r.value);return a.valid?((rx(e)||rx(r))&&t.dirty(),{status:t.value,value:a.data}):(rh(n,{code:rc.invalid_intersection_types}),rg)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}r5.create=(e,t,n)=>new r5({left:e,right:t,typeName:j.ZodIntersection,...rS(n)});class r7 extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.array)return rh(n,{code:rc.invalid_type,expected:ru.array,received:n.parsedType}),rg;if(n.data.length<this._def.items.length)return rh(n,{code:rc.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),rg;!this._def.rest&&n.data.length>this._def.items.length&&(rh(n,{code:rc.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new rC(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>rb.mergeArray(t,e)):rb.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new r7({...this._def,rest:e})}}r7.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new r7({items:e,typeName:j.ZodTuple,rest:null,...rS(t)})};class ae extends rR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.object)return rh(n,{code:rc.invalid_type,expected:ru.object,received:n.parsedType}),rg;let r=[],a=this._def.keyType,s=this._def.valueType;for(let e in n.data)r.push({key:a._parse(new rC(n,e,n.path,e)),value:s._parse(new rC(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?rb.mergeObjectAsync(t,r):rb.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new ae(t instanceof rR?{keyType:e,valueType:t,typeName:j.ZodRecord,...rS(n)}:{keyType:rV.create(),valueType:e,typeName:j.ZodRecord,...rS(t)})}}class at extends rR{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.map)return rh(n,{code:rc.invalid_type,expected:ru.map,received:n.parsedType}),rg;let r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new rC(n,e,n.path,[s,"key"])),value:a._parse(new rC(n,t,n.path,[s,"value"]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return rg;("dirty"===r.status||"dirty"===a.status)&&t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{let e=new Map;for(let n of s){let r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return rg;("dirty"===r.status||"dirty"===a.status)&&t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}at.create=(e,t,n)=>new at({valueType:t,keyType:e,typeName:j.ZodMap,...rS(n)});class an extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ru.set)return rh(n,{code:rc.invalid_type,expected:ru.set,received:n.parsedType}),rg;let r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(rh(n,{code:rc.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(rh(n,{code:rc.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let a=this._def.valueType;function s(e){let n=new Set;for(let r of e){if("aborted"===r.status)return rg;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let i=[...n.data.values()].map((e,t)=>a._parse(new rC(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new an({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new an({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}an.create=(e,t)=>new an({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...rS(t)});class ar extends rR{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==ru.function)return rh(t,{code:rc.invalid_type,expected:ru.function,received:t.parsedType}),rg;function n(e,n){return rf({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rm(),rp].filter(e=>!!e),issueData:{code:rc.invalid_arguments,argumentsError:n}})}function r(e,n){return rf({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,rm(),rp].filter(e=>!!e),issueData:{code:rc.invalid_return_type,returnTypeError:n}})}let a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof al){let e=this;return rw(async function(...t){let i=new rd([]),o=await e._def.args.parseAsync(t,a).catch(e=>{throw i.addIssue(n(t,e)),i}),u=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(u,a).catch(e=>{throw i.addIssue(r(u,e)),i})})}{let e=this;return rw(function(...t){let i=e._def.args.safeParse(t,a);if(!i.success)throw new rd([n(t,i.error)]);let o=Reflect.apply(s,this,i.data),u=e._def.returns.safeParse(o,a);if(!u.success)throw new rd([r(o,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ar({...this._def,args:r7.create(e).rest(r0.create())})}returns(e){return new ar({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ar({args:e||r7.create([]).rest(r0.create()),returns:t||r0.create(),typeName:j.ZodFunction,...rS(n)})}}class aa extends rR{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}aa.create=(e,t)=>new aa({getter:e,typeName:j.ZodLazy,...rS(t)});class as extends rR{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return rh(t,{received:t.data,code:rc.invalid_literal,expected:this._def.value}),rg}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ai(e,t){return new ao({values:e,typeName:j.ZodEnum,...rS(t)})}as.create=(e,t)=>new as({value:e,typeName:j.ZodLiteral,...rS(t)});class ao extends rR{constructor(){super(...arguments),S.set(this,void 0)}_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),n=this._def.values;return rh(t,{expected:O.joinValues(n),received:t.parsedType,code:rc.invalid_type}),rg}if(rI(this,S,"f")||rO(this,S,new Set(this._def.values),"f"),!rI(this,S,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return rh(t,{received:t.data,code:rc.invalid_enum_value,options:n}),rg}return rw(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ao.create(e,{...this._def,...t})}exclude(e,t=this._def){return ao.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}S=new WeakMap,ao.create=ai;class au extends rR{constructor(){super(...arguments),R.set(this,void 0)}_parse(e){let t=O.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ru.string&&n.parsedType!==ru.number){let e=O.objectValues(t);return rh(n,{expected:O.joinValues(e),received:n.parsedType,code:rc.invalid_type}),rg}if(rI(this,R,"f")||rO(this,R,new Set(O.getValidEnumValues(this._def.values)),"f"),!rI(this,R,"f").has(e.data)){let e=O.objectValues(t);return rh(n,{received:n.data,code:rc.invalid_enum_value,options:e}),rg}return rw(e.data)}get enum(){return this._def.values}}R=new WeakMap,au.create=(e,t)=>new au({values:e,typeName:j.ZodNativeEnum,...rS(t)});class al extends rR{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==ru.promise&&!1===t.common.async?(rh(t,{code:rc.invalid_type,expected:ru.promise,received:t.parsedType}),rg):rw((t.parsedType===ru.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}al.create=(e,t)=>new al({type:e,typeName:j.ZodPromise,...rS(t)});class ac extends rR{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{rh(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){let e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return rg;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?rg:"dirty"===r.status||"dirty"===t.value?rv(r.value):r});{if("aborted"===t.value)return rg;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?rg:"dirty"===r.status||"dirty"===t.value?rv(r.value):r}}if("refinement"===r.type){let e=e=>{let t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?rg:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))));{let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?rg:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}}if("transform"===r.type){if(!1!==n.common.async)return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>rT(e)?Promise.resolve(r.transform(e.value,a)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!rT(e))return e;let s=r.transform(e.value,a);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}O.assertNever(r)}}ac.create=(e,t,n)=>new ac({schema:e,typeName:j.ZodEffects,effect:t,...rS(n)}),ac.createWithPreprocess=(e,t,n)=>new ac({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...rS(n)});class ad extends rR{_parse(e){return this._getType(e)===ru.undefined?rw(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ad.create=(e,t)=>new ad({innerType:e,typeName:j.ZodOptional,...rS(t)});class ap extends rR{_parse(e){return this._getType(e)===ru.null?rw(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ap.create=(e,t)=>new ap({innerType:e,typeName:j.ZodNullable,...rS(t)});class ay extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===ru.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ay.create=(e,t)=>new ay({innerType:e,typeName:j.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...rS(t)});class am extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return rk(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new rd(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new rd(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}am.create=(e,t)=>new am({innerType:e,typeName:j.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...rS(t)});class af extends rR{_parse(e){if(this._getType(e)!==ru.nan){let t=this._getOrReturnCtx(e);return rh(t,{code:rc.invalid_type,expected:ru.nan,received:t.parsedType}),rg}return{status:"valid",value:e.data}}}af.create=e=>new af({typeName:j.ZodNaN,...rS(e)});let ah=Symbol("zod_brand");class ab extends rR{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ag extends rR{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?rg:"dirty"===e.status?(t.dirty(),rv(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?rg:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ag({in:e,out:t,typeName:j.ZodPipeline})}}class av extends rR{_parse(e){let t=this._def.innerType._parse(e),n=e=>(rT(e)&&(e.value=Object.freeze(e.value)),e);return rk(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function aw(e,t={},n){return e?rX.create().superRefine((r,a)=>{var s,i;if(!e(r)){let e="function"==typeof t?t(r):"string"==typeof t?{message:t}:t,o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:o})}}):rX.create()}av.create=(e,t)=>new av({innerType:e,typeName:j.ZodReadonly,...rS(t)});let a_={object:r6.lazycreate};!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(j||(j={}));let ax=rV.create,aT=rW.create,ak=af.create,aI=rG.create,aO=rH.create,aC=rJ.create,aE=rK.create,aS=rY.create,aR=rQ.create,aj=rX.create,aA=r0.create,aN=r2.create,a$=r1.create,aP=r3.create,aF=r6.create,aM=r6.strictCreate,aL=r4.create,aD=r9.create,aZ=r5.create,aB=r7.create,az=ae.create,aU=at.create,aq=an.create,aV=ar.create,aW=aa.create,aG=as.create,aH=ao.create,aJ=au.create,aK=al.create,aY=ac.create,aQ=ad.create,aX=ap.create,a0=ac.createWithPreprocess,a2=ag.create;var a1=Object.freeze({__proto__:null,defaultErrorMap:rp,setErrorMap:function(e){ry=e},getErrorMap:rm,makeIssue:rf,EMPTY_PATH:[],addIssueToContext:rh,ParseStatus:rb,INVALID:rg,DIRTY:rv,OK:rw,isAborted:r_,isDirty:rx,isValid:rT,isAsync:rk,get util(){return O},get objectUtil(){return C},ZodParsedType:ru,getParsedType:rl,ZodType:rR,datetimeRegex:rq,ZodString:rV,ZodNumber:rW,ZodBigInt:rG,ZodBoolean:rH,ZodDate:rJ,ZodSymbol:rK,ZodUndefined:rY,ZodNull:rQ,ZodAny:rX,ZodUnknown:r0,ZodNever:r2,ZodVoid:r1,ZodArray:r3,ZodObject:r6,ZodUnion:r4,ZodDiscriminatedUnion:r9,ZodIntersection:r5,ZodTuple:r7,ZodRecord:ae,ZodMap:at,ZodSet:an,ZodFunction:ar,ZodLazy:aa,ZodLiteral:as,ZodEnum:ao,ZodNativeEnum:au,ZodPromise:al,ZodEffects:ac,ZodTransformer:ac,ZodOptional:ad,ZodNullable:ap,ZodDefault:ay,ZodCatch:am,ZodNaN:af,BRAND:ah,ZodBranded:ab,ZodPipeline:ag,ZodReadonly:av,custom:aw,Schema:rR,ZodSchema:rR,late:a_,get ZodFirstPartyTypeKind(){return j},coerce:{string:e=>rV.create({...e,coerce:!0}),number:e=>rW.create({...e,coerce:!0}),boolean:e=>rH.create({...e,coerce:!0}),bigint:e=>rG.create({...e,coerce:!0}),date:e=>rJ.create({...e,coerce:!0})},any:aj,array:aP,bigint:aI,boolean:aO,date:aC,discriminatedUnion:aD,effect:aY,enum:aH,function:aV,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>aw(t=>t instanceof e,t),intersection:aZ,lazy:aW,literal:aG,map:aU,nan:ak,nativeEnum:aJ,never:aN,null:aR,nullable:aX,number:aT,object:aF,oboolean:()=>aO().optional(),onumber:()=>aT().optional(),optional:aQ,ostring:()=>ax().optional(),pipeline:a2,preprocess:a0,promise:aK,record:az,set:aq,strictObject:aM,string:ax,symbol:aE,transformer:aY,tuple:aB,undefined:aS,union:aL,unknown:aA,void:a$,NEVER:rg,ZodIssueCode:rc,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:rd});a1.object({chainId:a1.number(),address:a1.string().refine(ro.v).optional(),filters:a1.array(a1.object({tableId:a1.string().refine(ro.v),key0:a1.string().refine(ro.v).optional(),key1:a1.string().refine(ro.v).optional()})).default([])});class a3 extends Error{}class a6 extends Error{constructor(e){let t=function(e){if(e instanceof Error)return e;let t=typeof e;if("undefined"!==t&&"function"!==t&&null!==e){if("object"!==t)return Error(String(e));if(e&&!Array.isArray(e)&&"object"==typeof e){let t=new a3;for(let n in e)t[n]=e[n];return t}}}(e.cause);super(e.message??t?.message??e.code,{cause:t}),this.code=e.code,this.name=this.constructor.name}}function a4(e){let t=Object.create(null);for(let n in e)t[e[n]]=n;return t}let a8={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};a4(a8),a4(a8);let a9={PARSE_ERROR:400,BAD_REQUEST:400,NOT_FOUND:404,INTERNAL_SERVER_ERROR:500,UNAUTHORIZED:401,FORBIDDEN:403,TIMEOUT:408,CONFLICT:409,CLIENT_CLOSED_REQUEST:499,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,METHOD_NOT_SUPPORTED:405,UNPROCESSABLE_CONTENT:422,TOO_MANY_REQUESTS:429},a5=()=>{},a7=e=>(function e(t,n){return new Proxy(a5,{get(r,a){if("string"==typeof a&&"then"!==a)return e(t,[...n,a])},apply(e,r,a){let s="apply"===n[n.length-1];return t({args:s?a.length>=2?a[1]:[]:a,path:s?n.slice(0,-1):n})}})})(e,[]),se=e=>new Proxy(a5,{get(t,n){if("string"==typeof n&&"then"!==n)return e(n)}}),st={_default:!0,input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}},sn=({shape:e})=>e,sr=["query","mutation","subscription"],sa={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:sn,transformer:st},ss=["then"];function si(e){return function(t){var n;let r=new Set(Object.keys(t).filter(e=>ss.includes(e)));if(r.size>0)throw Error("Reserved words used in `router({})` call: "+Array.from(r).join(", "));let a=(n={},Object.assign(Object.create(null),n));!function e(t,n=""){for(let[r,s]of Object.entries(t??{})){let t=`${n}${r}`;if("router"in s._def){e(s._def.procedures,`${t}.`);continue}if(a[t])throw Error(`Duplicate key: ${t}`);a[t]=s}}(t);let s={_config:e,router:!0,procedures:a,...sa,record:t,queries:Object.entries(a).filter(e=>e[1]._def.query).reduce((e,[t,n])=>({...e,[t]:n}),{}),mutations:Object.entries(a).filter(e=>e[1]._def.mutation).reduce((e,[t,n])=>({...e,[t]:n}),{}),subscriptions:Object.entries(a).filter(e=>e[1]._def.subscription).reduce((e,[t,n])=>({...e,[t]:n}),{})};return{...t,_def:s,createCaller:e=>a7(({path:t,args:n})=>{if(1===t.length&&sr.includes(t[0]))return function(e){let{type:t,path:n}=e;if(!(n in e.procedures)||!e.procedures[n]?._def[t])throw new a6({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});return(0,e.procedures[n])(e)}({procedures:s.procedures,path:n[0],rawInput:n[1],ctx:e,type:t[0]});let r=t.join("."),a=s.procedures[r],i="query";return a._def.mutation?i="mutation":a._def.subscription&&(i="subscription"),a({path:r,rawInput:n[0],ctx:e,type:i})}),getErrorShape(t){let{path:n,error:r}=t,{code:a}=t.error,s={message:r.message,code:a8[a],data:{code:a,httpStatus:function(e){let{code:t}=e;return a9[t]??500}(r)}};return e.isDev&&"string"==typeof t.error.stack&&(s.data.stack=t.error.stack),"string"==typeof n&&(s.data.path=n),this._def._config.errorFormatter({...t,shape:s})}}}}let so="undefined"==typeof window||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID,su="middlewareMarker";function sl(e){if("function"==typeof e)return e;if("function"==typeof e.parseAsync)return e.parseAsync.bind(e);if("function"==typeof e.parse)return e.parse.bind(e);if("function"==typeof e.validateSync)return e.validateSync.bind(e);if("function"==typeof e.create)return e.create.bind(e);throw Error("Could not find a validator fn")}class sc{_def(){return{middlewares:this.middlewares,resolver:this.resolver,inputParser:this.inputParser,outputParser:this.outputParser,meta:this.meta}}async parseInput(e){try{return await this.parseInputFn(e)}catch(e){throw new TRPCError({code:"BAD_REQUEST",cause:e})}}async parseOutput(e){try{return await this.parseOutputFn(e)}catch(e){throw new TRPCError({code:"INTERNAL_SERVER_ERROR",cause:e,message:"Output validation failed"})}}async call(e){let t=this.middlewares.concat([async({ctx:t})=>{let n=await this.parseInput(e.rawInput),r=await this.resolver({...e,ctx:t,input:n});return{marker:su,ok:!0,data:await this.parseOutput(r),ctx:t}}]),n=async(r={index:0,ctx:e.ctx})=>{try{return await t[r.index]({ctx:r.ctx,type:e.type,path:e.path,rawInput:e.rawInput,meta:this.meta,next:async e=>await n({index:r.index+1,ctx:e?e.ctx:r.ctx})})}catch(e){return{ctx:r.ctx,ok:!1,error:getTRPCErrorFromUnknown(e),marker:su}}},r=await n();if(!r)throw new TRPCError({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!r.ok)throw r.error;return r.data}inheritMiddlewares(e){return new this.constructor({middlewares:[...e,...this.middlewares],resolver:this.resolver,inputParser:this.inputParser,outputParser:this.outputParser,meta:this.meta})}constructor(e){this.middlewares=e.middlewares,this.resolver=e.resolver,this.inputParser=e.inputParser,this.parseInputFn=sl(this.inputParser),this.outputParser=e.outputParser,this.parseOutputFn=sl(this.outputParser),this.meta=e.meta}}function sd(e){let t="input"in e?e.input:e=>{if(null!=e)throw new TRPCError({code:"BAD_REQUEST",message:"No input expected"})},n="output"in e&&e.output?e.output:e=>e;return new sc({inputParser:t,resolver:e.resolve,middlewares:[],outputParser:n,meta:e.meta})}function sp(e){if("function"==typeof e)return e;if("function"==typeof e.parseAsync)return e.parseAsync.bind(e);if("function"==typeof e.parse)return e.parse.bind(e);if("function"==typeof e.validateSync)return e.validateSync.bind(e);if("function"==typeof e.create)return e.create.bind(e);if("function"==typeof e.assert)return t=>(e.assert(t),t);throw Error("Could not find a validator fn")}function sy(e,...t){let n=Object.assign(Object.create(null),e);for(let e of t)for(let t in e){if(t in n&&n[t]!==e[t])throw Error(`Duplicate key ${t}`);n[t]=e[t]}return n}function sm(e){return e&&"object"==typeof e&&!Array.isArray(e)}function sf(e){let t=async({next:t,rawInput:n,input:r})=>{let a;try{a=await e(n)}catch(e){throw new a6({code:"BAD_REQUEST",cause:e})}return t({input:sm(r)&&sm(a)?{...r,...a}:a})};return t._type="input",t}function sh(e){let t=async({next:t})=>{let n=await t();if(!n.ok)return n;try{let t=await e(n.data);return{...n,data:t}}catch(e){throw new a6({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:e})}};return t._type="output",t}let sb="middlewareMarker";function sg(e,t){let{middlewares:n=[],inputs:r,meta:a,...s}=t;return sv({...sy(e,s),inputs:[...e.inputs,...r??[]],middlewares:[...e.middlewares,...n],meta:e.meta&&a?{...e.meta,...a}:a??e.meta})}function sv(e={}){let t={inputs:[],middlewares:[],...e};return{_def:t,input(e){let n=sp(e);return sg(t,{inputs:[e],middlewares:[sf(n)]})},output(e){let n=sp(e);return sg(t,{output:e,middlewares:[sh(n)]})},meta:e=>sg(t,{meta:e}),unstable_concat:e=>sg(t,e._def),use:e=>sg(t,{middlewares:"_middlewares"in e?e._middlewares:[e]}),query:e=>sw({...t,query:!0},e),mutation:e=>sw({...t,mutation:!0},e),subscription:e=>sw({...t,subscription:!0},e)}}function sw(e,t){return function(e){let t=async function(t){if(!t||!("rawInput"in t))throw Error(s_);let n=async(r={index:0,ctx:t.ctx})=>{try{let a=e.middlewares[r.index];return await a({ctx:r.ctx,type:t.type,path:t.path,rawInput:r.rawInput??t.rawInput,meta:e.meta,input:r.input,next:e=>n({index:r.index+1,ctx:e&&"ctx"in e?{...r.ctx,...e.ctx}:r.ctx,input:e&&"input"in e?e.input:r.input,rawInput:e&&"rawInput"in e?e.rawInput:r.rawInput})})}catch(e){return{ok:!1,error:function(e){if(e instanceof a6)return e;let t=new a6({code:"INTERNAL_SERVER_ERROR",cause:e});return e instanceof Error&&e.stack&&(t.stack=e.stack),t}(e),marker:sb}}},r=await n();if(!r)throw new a6({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!r.ok)throw r.error;return r.data};return t._def=e,t.meta=e.meta,t}(sg(e,{resolver:t,middlewares:[async function(e){return{marker:sb,ok:!0,data:await t(e),ctx:e.ctx}}]})._def)}let s_=`
|
|
11
11
|
If you want to call this function on the server, you do the following:
|
|
12
12
|
This is a client-only function.
|
|
13
13
|
|
|
@@ -16,4 +16,4 @@ const caller = appRouter.createCaller({
|
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
const result = await caller.call('myProcedure', input);
|
|
19
|
-
`.trim();function sx(e,t){var n,r;let a=e._def(),s=(n=a.inputParser)?sp(n):e=>e,i=(r=a.outputParser)?sp(r):e=>e,o=sf(s);return sv({inputs:[a.inputParser],middlewares:[...a.middlewares,o,sh(i)],meta:a.meta,output:a.outputParser,mutation:"mutation"===t,query:"query"===t,subscription:"subscription"===t})[t](e=>a.resolver(e))}let sT={query:"queries",mutation:"mutations",subscription:"subscriptions"};function sk(...e){return Object.assign(Object.create(null),...e)}class sI{static prefixProcedures(e,t){let n=sk();for(let[r,a]of Object.entries(e))n[t+r]=a;return n}query(e,t){let n=new sI({queries:sk({[e]:sd(t)})});return this.merge(n)}mutation(e,t){let n=new sI({mutations:sk({[e]:sd(t)})});return this.merge(n)}subscription(e,t){let n=new sI({subscriptions:sk({[e]:sd(t)})});return this.merge(n)}merge(e,t){let n,r="";if("string"==typeof e&&t instanceof sI)r=e,n=t;else if(e instanceof sI)n=e;else throw Error("Invalid args");let a=[...Object.keys(n._def.queries).filter(e=>!!this._def.queries[r+e]),...Object.keys(n._def.mutations).filter(e=>!!this._def.mutations[r+e]),...Object.keys(n._def.subscriptions).filter(e=>!!this._def.subscriptions[r+e])];if(a.length)throw Error(`Duplicate endpoint(s): ${a.join(", ")}`);let s=e=>{let t=sk();for(let[n,r]of Object.entries(e)){let e=r.inheritMiddlewares(this._def.middlewares);t[n]=e}return sI.prefixProcedures(t,r)};return new sI({...this._def,queries:sk(this._def.queries,s(n._def.queries)),mutations:sk(this._def.mutations,s(n._def.mutations)),subscriptions:sk(this._def.subscriptions,s(n._def.subscriptions))})}async call(e){let{type:t,path:n}=e,r=sT[t],a=this._def[r][n];if(!a)throw new TRPCError({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});return a.call(e)}createCaller(e){return{query:(t,...n)=>this.call({type:"query",ctx:e,path:t,rawInput:n[0]}),mutation:(t,...n)=>this.call({type:"mutation",ctx:e,path:t,rawInput:n[0]}),subscription:(t,...n)=>this.call({type:"subscription",ctx:e,path:t,rawInput:n[0]})}}middleware(e){return new sI({...this._def,middlewares:[...this._def.middlewares,e]})}formatError(e){if(this._def.errorFormatter!==defaultFormatter)throw Error("You seem to have double `formatError()`-calls in your router tree");return new sI({...this._def,errorFormatter:e})}getErrorShape(e){let{path:t,error:n}=e,{code:r}=e.error,a={message:n.message,code:TRPC_ERROR_CODES_BY_KEY[r],data:{code:r,httpStatus:getHTTPStatusCodeFromError(n)}};return globalThis.process?.env?.NODE_ENV!=="production"&&"string"==typeof e.error.stack&&(a.data.stack=e.error.stack),"string"==typeof t&&(a.data.path=t),this._def.errorFormatter({...e,shape:a})}transformer(e){if(this._def.transformer!==defaultTransformer)throw Error("You seem to have double `transformer()`-calls in your router tree");return new sI({...this._def,transformer:"input"in e?e:{input:e,output:e}})}flat(){return this}interop(){return function(e){let t=e._def.errorFormatter,n=e._def.transformer,r={},a={},s={};for(let[t,n]of Object.entries(e._def.queries))r[t]=sx(n,"query");for(let[t,n]of Object.entries(e._def.mutations))a[t]=sx(n,"mutation");for(let[t,n]of Object.entries(e._def.subscriptions))s[t]=sx(n,"subscription");let i=sy(r,a,s);return createRouterFactory({transformer:n,errorFormatter:t,isDev:!1})(i)}(this)}constructor(e){this._def={queries:e?.queries??sk(),mutations:e?.mutations??sk(),subscriptions:e?.subscriptions??sk(),middlewares:e?.middlewares??[],errorFormatter:e?.errorFormatter??defaultFormatter,transformer:e?.transformer??defaultTransformer}}}function sO(...e){let t=sy({},...e.map(e=>e._def.record));return si({errorFormatter:e.reduce((e,t)=>{if(t._def._config.errorFormatter&&t._def._config.errorFormatter!==sn){if(e!==sn&&e!==t._def._config.errorFormatter)throw Error("You seem to have several error formatters");return t._def._config.errorFormatter}return e},sn),transformer:e.reduce((e,t)=>{if(t._def._config.transformer&&t._def._config.transformer!==st){if(e!==st&&e!==t._def._config.transformer)throw Error("You seem to have several transformers");return t._def._config.transformer}return e},st),isDev:e.some(e=>e._def._config.isDev),allowOutsideOfServer:e.some(e=>e._def._config.allowOutsideOfServer),isServer:e.some(e=>e._def._config.isServer),$types:e[0]?._def._config.$types})(t)}class sC{context(){return new sC}meta(){return new sC}create(e){return function(e){var t;let n=e?.errorFormatter??sn,r={transformer:"input"in(t=e?.transformer??st)?t:{input:t,output:t},isDev:e?.isDev??globalThis.process?.env?.NODE_ENV!=="production",allowOutsideOfServer:e?.allowOutsideOfServer??!1,errorFormatter:n,isServer:e?.isServer??so,$types:se(e=>{throw Error(`Tried to access "$types.${e}" which is not available at runtime`)})};if(!(e?.isServer??so)&&e?.allowOutsideOfServer!==!0)throw Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:r,procedure:sv({meta:e?.defaultMeta}),middleware:function(e){return function e(t){return{_middlewares:t,unstable_pipe:n=>e([...t,..."_middlewares"in n?n._middlewares:[n]])}}([e])},router:si(r),mergeRouters:sO}}(e)}}new sC;var sE=function(){function e(){this.keyToValue=new Map,this.valueToKey=new Map}return e.prototype.set=function(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)},e.prototype.getByKey=function(e){return this.keyToValue.get(e)},e.prototype.getByValue=function(e){return this.valueToKey.get(e)},e.prototype.clear=function(){this.keyToValue.clear(),this.valueToKey.clear()},e}(),sS=function(){function e(e){this.generateIdentifier=e,this.kv=new sE}return e.prototype.register=function(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))},e.prototype.clear=function(){this.kv.clear()},e.prototype.getIdentifier=function(e){return this.kv.getByValue(e)},e.prototype.getValue=function(e){return this.kv.getByKey(e)},e}(),sR=function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),sj=function(e){function t(){var t=e.call(this,function(e){return e.name})||this;return t.classToAllowedProps=new Map,t}return sR(t,e),t.prototype.register=function(t,n){"object"==typeof n?(n.allowProps&&this.classToAllowedProps.set(t,n.allowProps),e.prototype.register.call(this,t,n.identifier)):e.prototype.register.call(this,t,n)},t.prototype.getAllowedProps=function(e){return this.classToAllowedProps.get(e)},t}(sS),sA=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i};function sN(e,t){Object.entries(e).forEach(function(e){var n=sA(e,2),r=n[0];return t(n[1],r)})}function s$(e,t){return -1!==e.indexOf(t)}function sF(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t(r))return r}}var sP=function(){function e(){this.transfomers={}}return e.prototype.register=function(e){this.transfomers[e.name]=e},e.prototype.findApplicable=function(e){return function(e,t){var n=function(e){if("values"in Object)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}(e);if("find"in n)return n.find(t);for(var r=0;r<n.length;r++){var a=n[r];if(t(a))return a}}(this.transfomers,function(t){return t.isApplicable(e)})},e.prototype.findByName=function(e){return this.transfomers[e]},e}(),sM=function(e){return void 0===e},sL=function(e){return"object"==typeof e&&null!==e&&e!==Object.prototype&&(null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===Object.prototype)},sD=function(e){return sL(e)&&0===Object.keys(e).length},sZ=function(e){return Array.isArray(e)},sB=function(e){return e instanceof Map},sz=function(e){return e instanceof Set},sU=function(e){return"Symbol"===Object.prototype.toString.call(e).slice(8,-1)},sq=function(e){return"number"==typeof e&&isNaN(e)},sV=function(e){return"boolean"==typeof e||null===e||sM(e)||"number"==typeof e&&!isNaN(e)||"string"==typeof e||sU(e)},sW=function(e){return e.replace(/\./g,"\\.")},sG=function(e){return e.map(String).map(sW).join(".")},sH=function(e){for(var t=[],n="",r=0;r<e.length;r++){var a=e.charAt(r);if("\\"===a&&"."===e.charAt(r+1)){n+=".",r++;continue}if("."===a){t.push(n),n="";continue}n+=a}var s=n;return t.push(s),t},sJ=function(){return(sJ=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},sK=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},sY=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e};function sQ(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var sX=[sQ(sM,"undefined",function(){return null},function(){}),sQ(function(e){return"bigint"==typeof e},"bigint",function(e){return e.toString()},function(e){return"undefined"!=typeof BigInt?BigInt(e):(console.error("Please add a BigInt polyfill."),e)}),sQ(function(e){return e instanceof Date&&!isNaN(e.valueOf())},"Date",function(e){return e.toISOString()},function(e){return new Date(e)}),sQ(function(e){return e instanceof Error},"Error",function(e,t){var n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(function(t){n[t]=e[t]}),n},function(e,t){var n=Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(function(t){n[t]=e[t]}),n}),sQ(function(e){return e instanceof RegExp},"regexp",function(e){return""+e},function(e){return new RegExp(e.slice(1,e.lastIndexOf("/")),e.slice(e.lastIndexOf("/")+1))}),sQ(sz,"set",function(e){return sY([],sK(e.values()))},function(e){return new Set(e)}),sQ(sB,"map",function(e){return sY([],sK(e.entries()))},function(e){return new Map(e)}),sQ(function(e){var t;return sq(e)||(t=e)===1/0||t===-1/0},"number",function(e){return sq(e)?"NaN":e>0?"Infinity":"-Infinity"},Number),sQ(function(e){return 0===e&&1/e==-1/0},"number",function(){return"-0"},Number),sQ(function(e){return e instanceof URL},"URL",function(e){return e.toString()},function(e){return new URL(e)})];function s0(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var s2=s0(function(e,t){return!!sU(e)&&!!t.symbolRegistry.getIdentifier(e)},function(e,t){return["symbol",t.symbolRegistry.getIdentifier(e)]},function(e){return e.description},function(e,t,n){var r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown symbol");return r}),s1=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce(function(e,t){return e[t.name]=t,e},{}),s3=s0(function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},function(e){return["typed-array",e.constructor.name]},function(e){return sY([],sK(e))},function(e,t){var n=s1[t[1]];if(!n)throw Error("Trying to deserialize unknown typed array");return new n(e)});function s6(e,t){return null!=e&&!!e.constructor&&!!t.classRegistry.getIdentifier(e.constructor)}var s4=s0(s6,function(e,t){return["class",t.classRegistry.getIdentifier(e.constructor)]},function(e,t){var n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return sJ({},e);var r={};return n.forEach(function(t){r[t]=e[t]}),r},function(e,t,n){var r=n.classRegistry.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),s8=s0(function(e,t){return!!t.customTransformerRegistry.findApplicable(e)},function(e,t){return["custom",t.customTransformerRegistry.findApplicable(e).name]},function(e,t){return t.customTransformerRegistry.findApplicable(e).serialize(e)},function(e,t,n){var r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),s9=[s4,s2,s8,s3],s5=function(e,t){var n=sF(s9,function(n){return n.isApplicable(e,t)});if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};var r=sF(sX,function(n){return n.isApplicable(e,t)});if(r)return{value:r.transform(e,t),type:r.annotation}},s7={};sX.forEach(function(e){s7[e.annotation]=e});var ie=function(e,t,n){if(sZ(t))switch(t[0]){case"symbol":return s2.untransform(e,t,n);case"class":return s4.untransform(e,t,n);case"custom":return s8.untransform(e,t,n);case"typed-array":return s3.untransform(e,t,n);default:throw Error("Unknown transformation: "+t)}else{var r=s7[t];if(!r)throw Error("Unknown transformation: "+t);return r.untransform(e,n)}},it=function(e,t){for(var n=e.keys();t>0;)n.next(),t--;return n.next().value};function ir(e){if(s$(e,"__proto__"))throw Error("__proto__ is not allowed as a property");if(s$(e,"prototype"))throw Error("prototype is not allowed as a property");if(s$(e,"constructor"))throw Error("constructor is not allowed as a property")}var ia=function(e,t){ir(t);for(var n=0;n<t.length;n++){var r=t[n];if(sz(e))e=it(e,+r);else if(sB(e)){var a=+r,s=0==+t[++n]?"key":"value",i=it(e,a);switch(s){case"key":e=i;break;case"value":e=e.get(i)}}else e=e[r]}return e},is=function(e,t,n){if(ir(t),0===t.length)return n(e);for(var r=e,a=0;a<t.length-1;a++){var s=t[a];if(sZ(r))r=r[+s];else if(sL(r))r=r[s];else if(sz(r)){var i=+s;r=it(r,i)}else if(sB(r)){if(a===t.length-2)break;var i=+s,o=0==+t[++a]?"key":"value",u=it(r,i);switch(o){case"key":r=u;break;case"value":r=r.get(u)}}}var l=t[t.length-1];if(sZ(r)?r[+l]=n(r[+l]):sL(r)&&(r[l]=n(r[l])),sz(r)){var c=it(r,+l),d=n(c);c!==d&&(r.delete(c),r.add(d))}if(sB(r)){var i=+t[t.length-2],p=it(r,i),o=0==+l?"key":"value";switch(o){case"key":var y=n(p);r.set(y,r.get(p)),y!==p&&r.delete(p);break;case"value":r.set(p,n(r.get(p)))}}return e},ii=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},io=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e},iu=function(e,t,n,r,a){if(void 0===r&&(r=[]),void 0===a&&(a=[]),sV(e)||(s=r,(i=t.get(e))?i.push(s):t.set(e,[s])),!(sL(e)||sZ(e)||sB(e)||sz(e)||s6(e,n))){var s,i,o,u=s5(e,n);return u?{transformedValue:u.value,annotations:[u.type]}:{transformedValue:e}}if(s$(a,e))return{transformedValue:null};var l=s5(e,n),c=null!==(o=null==l?void 0:l.value)&&void 0!==o?o:e;sV(e)||(a=io(io([],ii(a)),[e]));var d=sZ(c)?[]:{},p={};return(sN(c,function(e,s){var i=iu(e,t,n,io(io([],ii(r)),[s]),a);d[s]=i.transformedValue,sZ(i.annotations)?p[s]=i.annotations:sL(i.annotations)&&sN(i.annotations,function(e,t){p[sW(s)+"."+t]=e})}),sD(p))?{transformedValue:d,annotations:l?[l.type]:void 0}:{transformedValue:d,annotations:l?[l.type,p]:p}};function il(e){return Object.prototype.toString.call(e).slice(8,-1)}function ic(e){return"Array"===il(e)}var id=function(){return(id=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},ip=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},iy=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e},im=function(){function e(){this.classRegistry=new sj,this.symbolRegistry=new sS(function(e){var t;return null!==(t=e.description)&&void 0!==t?t:""}),this.customTransformerRegistry=new sP,this.allowedErrorProps=[]}return e.prototype.serialize=function(e){var t,n,r=new Map,a=iu(e,r,this),s={json:a.transformedValue};a.annotations&&(s.meta=id(id({},s.meta),{values:a.annotations}));var i=(t={},n=void 0,(r.forEach(function(e){if(!(e.length<=1)){var r=ii(e.map(function(e){return e.map(String)}).sort(function(e,t){return e.length-t.length})),a=r[0],s=r.slice(1);0===a.length?n=s.map(sG):t[sG(a)]=s.map(sG)}}),n)?sD(t)?[n]:[n,t]:sD(t)?void 0:t);return i&&(s.meta=id(id({},s.meta),{referentialEqualities:i})),s},e.prototype.deserialize=function(e){var t,n,r,a=e.json,s=e.meta,i=function e(t,n={}){return ic(t)?t.map(t=>e(t,n)):!function(e){if("Object"!==il(e))return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}(t)?t:[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].reduce((r,a)=>{if(ic(n.props)&&!n.props.includes(a))return r;let s=e(t[a],n);return function(e,t,n,r,a){let s=({}).propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";"enumerable"===s&&(e[t]=n),a&&"nonenumerable"===s&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}(r,a,s,t,n.nonenumerable),r},{})}(a);return(null==s?void 0:s.values)&&(t=i,n=s.values,r=this,function e(t,n,r){if(void 0===r&&(r=[]),t){if(!sZ(t)){sN(t,function(t,a){return e(t,n,io(io([],ii(r)),ii(sH(a))))});return}var a=ii(t,2),s=a[0],i=a[1];i&&sN(i,function(t,a){e(t,n,io(io([],ii(r)),ii(sH(a))))}),n(s,r)}}(n,function(e,n){t=is(t,n,function(t){return ie(t,e,r)})}),i=t),(null==s?void 0:s.referentialEqualities)&&(i=function(e,t){function n(t,n){var r=ia(e,sH(n));t.map(sH).forEach(function(t){e=is(e,t,function(){return r})})}if(sZ(t)){var r=ii(t,2),a=r[0],s=r[1];a.forEach(function(t){e=is(e,sH(t),function(){return e})}),s&&sN(s,n)}else sN(t,n);return e}(i,s.referentialEqualities)),i},e.prototype.stringify=function(e){return JSON.stringify(this.serialize(e))},e.prototype.parse=function(e){return this.deserialize(JSON.parse(e))},e.prototype.registerClass=function(e,t){this.classRegistry.register(e,t)},e.prototype.registerSymbol=function(e,t){this.symbolRegistry.register(e,t)},e.prototype.registerCustom=function(e,t){this.customTransformerRegistry.register(id({name:t},e))},e.prototype.allowErrorProps=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.allowedErrorProps).push.apply(e,iy([],ip(t)))},e.defaultInstance=new e,e.serialize=e.defaultInstance.serialize.bind(e.defaultInstance),e.deserialize=e.defaultInstance.deserialize.bind(e.defaultInstance),e.stringify=e.defaultInstance.stringify.bind(e.defaultInstance),e.parse=e.defaultInstance.parse.bind(e.defaultInstance),e.registerClass=e.defaultInstance.registerClass.bind(e.defaultInstance),e.registerSymbol=e.defaultInstance.registerSymbol.bind(e.defaultInstance),e.registerCustom=e.defaultInstance.registerCustom.bind(e.defaultInstance),e.allowErrorProps=e.defaultInstance.allowErrorProps.bind(e.defaultInstance),e}();function ih(e){let t={subscribe(t){let n=null,r=!1,a=!1,s=!1;function i(){if(null===n){s=!0;return}!a&&(a=!0,"function"==typeof n?n():n&&n.unsubscribe())}return n=e({next(e){r||t.next?.(e)},error(e){r||(r=!0,t.error?.(e),i())},complete(){r||(r=!0,t.complete?.(),i())}}),s&&i(),{unsubscribe:i}},pipe:(...e)=>(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce((e,t)=>t(e),t)})(t)};return t}im.serialize,im.deserialize,im.stringify,im.parse,im.registerClass,im.registerCustom,im.registerSymbol,im.allowErrorProps;class ib extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,ib.prototype)}}class ig extends Error{static from(e,t={}){return e instanceof Error?e instanceof ig||"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):new ig(e.message,{...t,cause:e,result:null}):new ig(e.error.message??"",{...t,cause:void 0,result:e})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ig.prototype)}}let iv=e=>"function"==typeof e;function iw(e){var t;return{url:e.url,fetch:e.fetch,AbortController:(t=e.AbortController)?t:"undefined"!=typeof window&&window.AbortController?window.AbortController:"undefined"!=typeof globalThis&&globalThis.AbortController?globalThis.AbortController:null}}let i_={query:"GET",mutation:"POST"};function ix(e){return"input"in e?e.runtime.transformer.serialize(e.input):function(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];t[n]=r}return t}(e.inputs.map(t=>e.runtime.transformer.serialize(t)))}let iT=e=>{let t=e.url+"/"+e.path,n=[];if("inputs"in e&&n.push("batch=1"),"query"===e.type){let t=ix(e);void 0!==t&&n.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return n.length&&(t+="?"+n.join("&")),t},ik=e=>{if("query"===e.type)return;let t=ix(e);return void 0!==t?JSON.stringify(t):void 0},iI=e=>iC({...e,contentTypeHeader:"application/json",getUrl:iT,getBody:ik});async function iO(e,t){let n=e.getUrl(e),r=e.getBody(e),{type:a}=e,s=await e.headers();/* istanbul ignore if -- @preserve */if("subscription"===a)throw Error("Subscriptions should use wsLink");let i={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.batchModeHeader?{"trpc-batch-mode":e.batchModeHeader}:{},...s};return(function(e){if(e)return e;if("undefined"!=typeof window&&iv(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&iv(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")})(e.fetch)(n,{method:i_[a],signal:t?.signal,body:r,headers:i})}function iC(e){let t=e.AbortController?new e.AbortController:null,n={};return{promise:new Promise((r,a)=>{iO(e,t).then(e=>(n.response=e,e.json())).then(e=>{n.responseJSON=e,r({json:e,meta:n})}).catch(e=>{a(ig.from(e,{meta:n}))})}),cancel:()=>{t?.abort()}}}function iE(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}class iS extends Error{constructor(){super("Unable to transform response from server")}}function iR(e,t){let n;try{n=function(e,t){if("error"in e){let n=t.transformer.deserialize(e.error);return{ok:!1,error:{...e,error:n}}}return{ok:!0,result:{...e.result,...(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.transformer.deserialize(e.result.data)}}}}(e,t)}catch(e){throw new iS}if(!n.ok&&(!iE(n.error.error)||"number"!=typeof n.error.error.code)||n.ok&&!iE(n.result))throw new iS;return n}let ij=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function iA(e){let t=null,n=null,r=()=>{clearTimeout(n),n=null,t=null};function a(){let n=function(t){let n=[[]],r=0;for(;;){let a=t[r];if(!a)break;let s=n[n.length-1];if(a.aborted){a.reject?.(Error("Aborted")),r++;continue}if(e.validate(s.concat(a).map(e=>e.key))){s.push(a),r++;continue}if(0===s.length){a.reject?.(Error("Input is too big for a single dispatch")),r++;continue}n.push([])}return n}(t);for(let t of(r(),n)){if(!t.length)continue;let n={items:t,cancel:ij};for(let e of t)e.batch=n;let r=(e,t)=>{let r=n.items[e];r.resolve?.(t),r.batch=null,r.reject=null,r.resolve=null},{promise:a,cancel:s}=e.fetch(n.items.map(e=>e.key),r);n.cancel=s,a.then(e=>{for(let t=0;t<e.length;t++){let n=e[t];r(t,n)}for(let e of n.items)e.reject?.(Error("Missing result")),e.batch=null}).catch(e=>{for(let t of n.items)t.reject?.(e),t.batch=null})}}return{load:function(e){let r={aborted:!1,key:e,batch:null,resolve:ij,reject:ij},s=new Promise((e,n)=>{r.reject=n,r.resolve=e,t||(t=[]),t.push(r)});return n||(n=setTimeout(a)),{promise:s,cancel:()=>{r.aborted=!0,r.batch?.items.every(e=>e.aborted)&&(r.batch.cancel(),r.batch=null)}}}}}function iN(e){return function(t){let n=iw(t),r=t.maxURLLength??1/0;return a=>{let s=s=>({validate:e=>{if(r===1/0)return!0;let t=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return iT({...n,runtime:a,type:s,path:t,inputs:i}).length<=r},fetch:e({...n,runtime:a,type:s,opts:t})}),i=iA(s("query")),o=iA(s("mutation")),u={query:i,subscription:iA(s("subscription")),mutation:o};return({op:e})=>ih(t=>{let n;let{promise:r,cancel:s}=u[e.type].load(e);return r.then(e=>{n=e;let r=iR(e.json,a);if(!r.ok){t.error(ig.from(r.error,{meta:e.meta}));return}t.next({context:e.meta,result:r.result}),t.complete()}).catch(e=>{t.error(ig.from(e,{meta:n?.meta}))}),()=>{s()}})}}}let i$=iN(e=>t=>{let n=t.map(e=>e.path).join(","),r=t.map(e=>e.input),{promise:a,cancel:s}=iI({...e,path:n,inputs:r,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:t}):e.opts.headers:{}});return{promise:a.then(e=>(Array.isArray(e.json)?e.json:t.map(()=>e.json)).map(t=>({meta:e.meta,json:t}))),cancel:s}});function iF(e){return t=>{let n=iw(t);return r=>({op:a})=>ih(s=>{let i;let{path:o,input:u,type:l}=a,{promise:c,cancel:d}=e.requester({...n,runtime:r,type:l,path:o,input:u,headers:()=>t.headers?"function"==typeof t.headers?t.headers({op:a}):t.headers:{}});return c.then(e=>{i=e.meta;let t=iR(e.json,r);if(!t.ok){s.error(ig.from(t.error,{meta:i}));return}s.next({context:e.meta,result:t.result}),s.complete()}).catch(e=>{s.error(ig.from(e,{meta:i}))}),()=>{d()}})}}iF({requester:iI});class iP extends Error{constructor(e){super(e),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,iP.prototype)}}class iM{$request({type:e,input:t,path:n,context:r={}}){var a;return(a={links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:r}},ih(e=>(function e(t=0,n=a.op){let r=a.links[t];if(!r)throw Error("No more links to execute - did you forget to add an ending link?");return r({op:n,next:n=>e(t+1,n)})})().subscribe(e))).pipe(e=>{let t=0,n=null,r=[];return{subscribe:a=>(t++,r.push(a),n||(n=e.subscribe({next(e){for(let t of r)t.next?.(e)},error(e){for(let t of r)t.error?.(e)},complete(){for(let e of r)e.complete?.()}})),{unsubscribe(){t--,function(){if(0===t&&n){let e=n;n=null,e.unsubscribe()}}();let e=r.findIndex(e=>e===a);e>-1&&r.splice(e,1)}})}})}requestAsPromise(e){var t;let n;let{promise:r,abort:a}=(t=this.$request(e),{promise:new Promise((e,r)=>{let a=!1;function s(){a||(a=!0,r(new ib("This operation was aborted.")),i.unsubscribe())}let i=t.subscribe({next(t){a=!0,e(t),s()},error(e){a=!0,r(e),s()},complete(){a=!0,s()}});n=s}),abort:n});return new Promise((t,n)=>{e.signal?.addEventListener("abort",a),r.then(e=>{t(e.result.data)}).catch(e=>{n(ig.from(e))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n?.context}).subscribe({next(e){"started"===e.result.type?n.onStarted?.():"stopped"===e.result.type?n.onStopped?.():n.onData?.(e.result.data)},error(e){n.onError?.(e)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let t=(()=>{let t=e.transformer;return t?"input"in t?e.transformer:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}})();this.runtime={transformer:{serialize:e=>t.input.serialize(e),deserialize:e=>t.output.deserialize(e)},combinedTransformer:t},this.links=e.links.map(e=>e(this.runtime))}}let iL={query:"query",mutate:"mutation",subscribe:"subscription"},iD=e=>iL[e];async function iZ(e){let t=e.parse??JSON.parse;await iB(e.readableStream,n=>{if(e.signal?.aborted||!n||"}"===n)return;let r=n.indexOf(":"),a=n.substring(2,r-1),s=n.substring(r+1);e.onSingle(Number(a),t(s))},e.textDecoder)}async function iB(e,t,n){let r="",a=e=>{let a=n.decode(e).split("\n");if(1===a.length)r+=a[0];else if(a.length>1){t(r+a[0]);for(let e=1;e<a.length-1;e++)t(a[e]);r=a[a.length-1]}};"getReader"in e?await iz(e,a):await new Promise(t=>{e.on("data",a),e.on("end",t)}),t(r)}async function iz(e,t){let n=e.getReader(),r=await n.read();for(;!r.done;)t(r.value),r=await n.read()}let iU=(e,t)=>{let n=e.AbortController?new e.AbortController:null;return{cancel:()=>n?.abort(),promise:iO({...e,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:iT,getBody:ik},n).then(async r=>{if(!r.body)throw Error("Received response without body");let a={response:r};return iZ({readableStream:r.body,onSingle:t,parse:e=>({json:JSON.parse(e),meta:a}),signal:n?.signal,textDecoder:e.textDecoder})})}};iN(e=>{let t=function(e){if(e)return e;if("undefined"!=typeof window&&window.TextDecoder)return new window.TextDecoder;if("undefined"!=typeof globalThis&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw Error("No TextDecoder implementation found")}(e.opts.textDecoder);return(n,r)=>{let a=n.map(e=>e.path).join(","),s=n.map(e=>e.input),{cancel:i,promise:o}=iU({...e,textDecoder:t,path:a,inputs:s,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:n}):e.opts.headers:{}},(e,t)=>{r(e,t)});return{promise:o.then(()=>[]),cancel:i}}});let iq=e=>{if("input"in e){if(!(e.input instanceof FormData))throw Error("Input is not FormData");return e.input}};iF({requester:e=>{if("mutation"!==e.type)throw Error("We only handle mutations with formdata");return iC({...e,getUrl:()=>`${e.url}/${e.path}`,getBody:iq})}});var iV=class extends Error{constructor(){super(...arguments),this.name="MUDError"}};let iW=/^(.*)\[([0-9]*)\]$/,iG=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,iH=/^(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 iJ(e,t){if(e.length!==t.length)throw new tv({expectedLength:e.length,givenLength:t.length});let n=[];for(let r=0;r<e.length;r++){let a=e[r],s=t[r];n.push(function e(t,n,r=!1){if("address"===t){if(!(0,tj.U)(n))throw new tR.b({address:n});return(0,tB.vk)(n.toLowerCase(),{size:r?32:null})}if("string"===t)return(0,eh.$G)(n);if("bytes"===t)return n;if("bool"===t)return(0,tB.vk)((0,eh.C4)(n),{size:r?32:1});let a=t.match(iH);if(a){let[e,t,s="256"]=a,i=Number.parseInt(s)/8;return(0,eh.eC)(n,{size:r?32:i,signed:"int"===t})}let s=t.match(iG);if(s){let[e,t]=s;if(Number.parseInt(t)!==(n.length-2)/2)throw new tx({expectedSize:Number.parseInt(t),givenSize:(n.length-2)/2});return(0,tB.vk)(n,{dir:"right",size:r?32:null})}let i=t.match(iW);if(i&&Array.isArray(n)){let[t,r]=i,a=[];for(let t=0;t<n.length;t++)a.push(e(r,n[t],!0));return 0===a.length?"0x":(0,tZ.SM)(a)}throw new tS(t)}(a,s))}return(0,tZ.SM)(n)}var iK=class extends iV{constructor(e){super(`Hex value "${e}" is an odd length (${e.length-2}). It must be an even length.`),this.name="InvalidHexValueError"}},iY=class extends iV{constructor(e){super(`Hex value "${e}" has length of ${e.length-2}, but expected length of 64 for encoded lengths.`),this.name="InvalidHexLengthForEncodedLengthsError"}},iQ=class extends iV{constructor(e,t){super(`Hex value "${t}" has length of ${t.length-2}, but expected length of ${2*nk[e]} for ${e} type.`),this.name="InvalidHexLengthForStaticFieldError"}},iX=class extends iV{constructor(e,t){super(`Hex value "${t}" has length of ${t.length-2}, but expected a multiple of ${2*nk[e]} for ${e}[] type.`),this.name="InvalidHexLengthForArrayFieldError"}},i0=class extends iV{constructor(e,t,n){super(`EncodedLengths "${e}" total bytes length (${t}) did not match the summed length of all field byte lengths (${n}).`),this.name="EncodedLengthsLengthMismatchError"}};function i2(e,t){if(t.length>3&&t.length%2!=0)throw new iK(t);if((t.length-2)/2!==nk[e])throw new iQ(e,t);switch(e){case"uint8":case"uint16":case"uint24":case"uint32":case"uint40":case"uint48":case"uint56":case"uint64":case"uint72":case"uint80":case"uint88":case"uint96":case"uint104":case"uint112":case"uint120":case"uint128":case"uint136":case"uint144":case"uint152":case"uint160":case"uint168":case"uint176":case"uint184":case"uint192":case"uint200":case"uint208":case"uint216":case"uint224":case"uint232":case"uint240":case"uint248":case"uint256":case"int8":case"int16":case"int24":case"int32":case"int40":case"int48":case"int56":case"int64":case"int72":case"int80":case"int88":case"int96":case"int104":case"int112":case"int120":case"int128":case"int136":case"int144":case"int152":case"int160":case"int168":case"int176":case"int184":case"int192":case"int200":case"int208":case"int216":case"int224":case"int232":case"int240":case"int248":case"int256":{let n=(0,tL.y_)(t,{signed:e.startsWith("int")}),r=typeof nT[e];if("number"===r)return Number(n);if("bigint"===r)return n;throw Error(`Unexpected default value type (${r}) for ABI type (${e})`)}case"bytes1":case"bytes2":case"bytes3":case"bytes4":case"bytes5":case"bytes6":case"bytes7":case"bytes8":case"bytes9":case"bytes10":case"bytes11":case"bytes12":case"bytes13":case"bytes14":case"bytes15":case"bytes16":case"bytes17":case"bytes18":case"bytes19":case"bytes20":case"bytes21":case"bytes22":case"bytes23":case"bytes24":case"bytes25":case"bytes26":case"bytes27":case"bytes28":case"bytes29":case"bytes30":case"bytes31":case"bytes32":return t;case"bool":return(0,tL.XA)(t);case"address":return(0,tN.K)(t)}return tK(e,`Unsupported static ABI type: ${e}`)}function i1(e,t){if("bytes"===e)return t;if("string"===e)return(0,tL.rR)(t);if(t.length>3&&t.length%2!=0)throw new iK(t);let n=(t.length-2)/2;switch(e){case"uint8[]":case"uint16[]":case"uint24[]":case"uint32[]":case"uint40[]":case"uint48[]":case"uint56[]":case"uint64[]":case"uint72[]":case"uint80[]":case"uint88[]":case"uint96[]":case"uint104[]":case"uint112[]":case"uint120[]":case"uint128[]":case"uint136[]":case"uint144[]":case"uint152[]":case"uint160[]":case"uint168[]":case"uint176[]":case"uint184[]":case"uint192[]":case"uint200[]":case"uint208[]":case"uint216[]":case"uint224[]":case"uint232[]":case"uint240[]":case"uint248[]":case"uint256[]":case"int8[]":case"int16[]":case"int24[]":case"int32[]":case"int40[]":case"int48[]":case"int56[]":case"int64[]":case"int72[]":case"int80[]":case"int88[]":case"int96[]":case"int104[]":case"int112[]":case"int120[]":case"int128[]":case"int136[]":case"int144[]":case"int152[]":case"int160[]":case"int168[]":case"int176[]":case"int184[]":case"int192[]":case"int200[]":case"int208[]":case"int216[]":case"int224[]":case"int232[]":case"int240[]":case"int248[]":case"int256[]":case"bytes1[]":case"bytes2[]":case"bytes3[]":case"bytes4[]":case"bytes5[]":case"bytes6[]":case"bytes7[]":case"bytes8[]":case"bytes9[]":case"bytes10[]":case"bytes11[]":case"bytes12[]":case"bytes13[]":case"bytes14[]":case"bytes15[]":case"bytes16[]":case"bytes17[]":case"bytes18[]":case"bytes19[]":case"bytes20[]":case"bytes21[]":case"bytes22[]":case"bytes23[]":case"bytes24[]":case"bytes25[]":case"bytes26[]":case"bytes27[]":case"bytes28[]":case"bytes29[]":case"bytes30[]":case"bytes31[]":case"bytes32[]":case"bool[]":case"address[]":{let r=nS(e),a=nk[r];if(n%a!=0)throw new iX(r,t);return Array(n/a).fill(void 0).map((e,n)=>i2(r,(0,tF.p5)(t,n*a,(n+1)*a)))}}return tK(e,`Unsupported dynamic ABI type: ${e}`)}function i3(e){return e.reduce((e,t)=>e+nk[t],0)}function i6(e,t){if("string"==typeof e&&nO.test(e)&&nI(e.replace(nO,""))&&Array.isArray(t)){let n=nS(e);return 0===t.length?"0x":iJ(t.map(()=>n),t)}return iJ([e],[t])}function i4(e,t){var n;return n={staticFields:Object.values(e).filter(nI),dynamicFields:[]},Object.values(t).map((e,t)=>tz([{type:n.staticFields[t]}],[e]))}function i8(e,t){let n,r;let a=Object.entries(e),s=a.filter(([,e])=>nI(e)),i=a.filter(([,e])=>nj(e)),o=s.map(([e,n])=>i6(n,t[e])),u=i.map(([e,n])=>i6(n,t[e])),l=(r=(n=u.map(e7.d).reverse()).reduce((e,t)=>e+BigInt(t),0n),(0,tB.gc)((0,tZ.SM)([...n.map(e=>i6("uint40",e)),i6("uint56",r)]),{size:32,dir:"left"}));return{staticData:(0,tZ.SM)(o),encodedLengths:l,dynamicData:(0,tZ.SM)(u)}}function i9(e){let t=e.staticFields.map(e=>nw.indexOf(e)),n=e.dynamicFields.map(e=>nw.indexOf(e));return`0x${[i3(e.staticFields).toString(16).padStart(4,"0"),e.staticFields.length.toString(16).padStart(2,"0"),e.dynamicFields.length.toString(16).padStart(2,"0"),...t.map(e=>e.toString(16).padStart(2,"0")),...n.map(e=>e.toString(16).padStart(2,"0"))].join("").padEnd(64,"0")}`}function i5(e){return Object.fromEntries(e.key.map(t=>[t,e.schema[t]]))}function i7(e){return Object.fromEntries(Object.entries(e.schema).filter(([t])=>!e.key.includes(t)))}function oe(e){return t1(e,e=>e.type)}var ot=function(e){return rs(e),ri(e)}({namespace:"store",codegen:{storeImportPath:"./src"},userTypes:{ResourceId:{filePath:"./src/ResourceId.sol",type:"bytes32"},FieldLayout:{filePath:"./src/FieldLayout.sol",type:"bytes32"},Schema:{filePath:"./src/Schema.sol",type:"bytes32"}},tables:{StoreHooks:{schema:{tableId:"ResourceId",hooks:"bytes21[]"},key:["tableId"]},Tables:{schema:{tableId:"ResourceId",fieldLayout:"FieldLayout",keySchema:"Schema",valueSchema:"Schema",abiEncodedKeyNames:"bytes",abiEncodedFieldNames:"bytes"},key:["tableId"]},ResourceIds:{schema:{resourceId:"ResourceId",exists:"bool"},key:["resourceId"]},Hooks:{schema:{resourceId:"ResourceId",hooks:"bytes21[]"},key:["resourceId"],codegen:{tableIdArgument:!0},deploy:{disabled:!0}}}}),on=n(41772),or={staticData:"0x",encodedLengths:"0x",dynamicData:"0x"},oa=on("mud:store");async function os(e,{address:t,tableId:n,fromBlock:r,toBlock:a}={}){let s=[nv.map(tp),n??null],i=n?Array.isArray(n)?n:[n]:[],o=t?Array.isArray(t)?t:[t]:[];return oa(`getting store logs for ${i.length?i.map(ni).map(na).join(", "):"all tables"} at ${o.length?o.join(", "):"any address"}`),tH({abi:nv,args:{tableId:n},logs:(await e.request({method:"eth_getLogs",params:[{address:t,topics:s,fromBlock:"bigint"==typeof r?(0,eh.eC)(r):r,toBlock:"bigint"==typeof a?(0,eh.eC)(a):a}]})).map(e=>(0,t4.U)(e)),strict:!0})}oa.log=console.debug.bind(console),on("mud:store").log=console.error.bind(console),(0,tL.y_)((0,eb.w)((0,to.O0)("mud.store")));var oi={disabled:!1,registerWorldFunctions:!0},oo={namespaceLabel:"",openAccess:!0,accessList:[]},ou={root:!1,args:[],artifactPath:void 0},ol={worldInterfaceName:"IWorld",worldgenDirectory:"world",systemLibrariesDirectory:"systems",generateSystemLibraries:!1,worldImportPath:"@latticexyz/world/src"},oc={postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},od={systems:{},tables:{},excludeSystems:[],modules:[],codegen:ol,deploy:oc};function op(e){if(nQ(e)){for(let t of Object.values(e))(function(e,t={}){if("object"!=typeof e||null==e)throw Error(`Expected full system config, got \`${JSON.stringify(e)}\``);if(t.inNamespace&&(nY(e,"label")||nY(e,"namespaceLabel")||nY(e,"namespace")))throw Error("Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.");if(nY(e,"namespaceLabel")&&"string"==typeof e.namespaceLabel&&(!nY(e,"namespace")||"string"!=typeof e.namespace)&&e.namespaceLabel.length>14)throw Error(`System \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${e.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`);if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`System \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(nY(e,"name")&&"string"==typeof e.name&&e.name.length>16)throw Error(`System \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`)})(t,{inNamespace:!0});return}throw Error(`Expected system config, received ${JSON.stringify(e)}`)}function oy(e,t,n){return Object.fromEntries(Object.entries(e).map(([e,r])=>{var a;let s,i,o,u,l;return[e,(s=(a={...r,label:e,namespaceLabel:t,namespace:n}).namespaceLabel??oo.namespaceLabel,i=a.namespace??s,o=a.label,l=nr({type:"system",namespace:i,name:u=a.name??o.slice(0,16)}),nX({...a,label:o,namespaceLabel:s,namespace:i,name:u,systemId:l,deploy:nX(a.deploy??{},oi)},oo))]}))}function om(e,t){if(!nQ(e))throw Error(`Expected namespaces config, received ${JSON.stringify(e)}`);let n=nN(e,(e,n)=>[e,function(e,t=n4){let n=rt(e,t),r=oy(e.systems??{},n.label,n.namespace);return{...n,systems:r}}(nX(n,{label:e}),t)]),r=Array.from(tX(Object.values(n),e=>e.namespace).entries()).filter(([,e])=>e.length>1).map(([e])=>e);if(r.length>0)throw Error(`Found namespaces defined more than once in config: ${r.join(", ")}`);return n}var of=function(e){var t,n;let r,a,s,i,o;return function(e){let t=ra(e);if(nY(e,"namespaces")){if(nY(e,"namespace")||nY(e,"tables")||nY(e,"systems"))throw Error("Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.");(function(e,t){if(!nQ(e))throw Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let n of Object.values(e))nY(n,"systems")&&op(n.systems),re(n,t)})(e.namespaces,t)}nY(e,"systems")&&op(e.systems),rs(e)}(e),r=ra(e),a=ri(e),i=rr({namespaces:s=e.namespaces?om(e.namespaces,r):om({[a.namespace]:e},r)}),o=(e.modules??od.modules).map(e=>nX(e,ou)),nX({...a,namespaces:s,tables:i,systems:!a.multipleNamespaces&&e.systems?oy(e.systems,a.namespace,a.namespace):od.systems,excludeSystems:nK(e,"excludeSystems"),codegen:nX(a.codegen,nQ(t=e.codegen)?nX(t,ol):ol),deploy:nQ(n=e.deploy)?nX(n,oc):oc,modules:o},od)}({namespace:"world",codegen:{worldImportPath:"./src",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});function oh(e){let t=[];if("string"==typeof e){let n=e3(e),r=n.length;for(let e=0;e<r;e++)t.push(e1(n[e],{modifiers:eN}))}else{let n=e8(e),r=e.length;for(let a=0;a<r;a++){let r=e[a];if(eS(r))continue;let s=e3(r),i=s.length;for(let e=0;e<i;e++)t.push(e1(s[e],{modifiers:eN,structs:n}))}}if(0===t.length)throw new eZ({params:e});return t}function ob(e){return Object.fromEntries(Object.values(e.namespaces).flatMap(e=>Object.values(e.tables)).map(e=>[e.label,e]))}Object.create,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;var og={...ob(ot),...ob(of)},ov=(Object.values(og).map(e=>e.tableId),{...og.Tables,keySchema:oe(i5(og.Tables)),valueSchema:oe(i7(og.Tables))});function ow(e){var t,n;let r,a,s;return{eventName:"Store_SetRecord",address:e.address,args:{tableId:ov.tableId,keyTuple:i4(ov.keySchema,{tableId:e.tableId}),...i8(ov.valueSchema,{fieldLayout:(r=Object.values(t=e.valueSchema).filter(nI),a=Object.values(t).filter(nj),s=r.map(e=>nk[e]),`0x${[s.reduce((e,t)=>e+t,0).toString(16).padStart(4,"0"),r.length.toString(16).padStart(2,"0"),a.length.toString(16).padStart(2,"0"),...s.map(e=>e.toString(16).padStart(2,"0"))].join("").padEnd(64,"0")}`),keySchema:i9({staticFields:Object.values(e.keySchema).filter(nI),dynamicFields:[]}),valueSchema:i9({staticFields:Object.values(n=e.valueSchema).filter(nI),dynamicFields:Object.values(n).filter(nj)}),abiEncodedKeyNames:tz(oh("string[]"),[Object.keys(e.keySchema)]),abiEncodedFieldNames:tz(oh("string[]"),[Object.keys(e.valueSchema)])})}}}function o_(e){return[...e.map(ow),...e.flatMap(e=>e.records.map(t=>({eventName:"Store_SetRecord",address:e.address,args:{tableId:e.tableId,keyTuple:i4(oe(i5(e)),t.key),...i8(oe(i7(e)),t.value)}})))]}var ox=t6("mud:store-sync"),oT=t6("mud:store-sync");ox.log=console.debug.bind(console),oT.log=console.error.bind(console);var ok=ox.extend("getSnapshot");async function oI({chainId:e,address:t,filters:n,initialState:r,initialBlockLogs:a,indexerUrl:s}){if(a&&r)throw Error("Only one of initialBlockLogs or initialState should be provided.");if(a)return a;if(r)return{blockNumber:r.blockNumber,logs:o_(r.tables)};if(!s)return;let i=new URL(s).origin,o=function({url:e}){return{getLogs:async t=>{try{let n=encodeURIComponent(JSON.stringify(t)),r=new URL(e).origin,a=await (await fetch(`${r}/api/logs?input=${n}`,{method:"GET"})).json();return a&&"string"==typeof a.blockNumber&&Array.isArray(a.logs)?{ok:{...a,blockNumber:BigInt(a.blockNumber)}}:{error:a}}catch(e){return{error:e}}}}}({url:i}),u=function({url:e}){var t;return t=new iM({transformer:im,links:[i$({url:e})]}),se(e=>t.hasOwnProperty(e)?t[e]:"__untypedClient"===e?t:a7(({path:n,args:r})=>{let a=[e,...n],s=iD(a.pop()),i=a.join(".");return t[s](i,...r)}))}({url:`${i}/trpc`});ok("fetching logs from indexer via get",s);let l=await o.getLogs({chainId:e,address:t,filters:n});if("ok"in l)return l.ok;console.warn(l.error);try{return ok("fetching logs from indexer via trpc",s),await u.getLogs.query({chainId:e,address:t,filters:n})}catch(r){if(r instanceof ig){ok("failed to fetch logs, fetching table records instead",s);let r=await u.findAll.query({chainId:e,address:t,filters:n});return console.warn(`The indexer at ${s} appears to be outdated. Consider upgrading to a recent version for better performance.`),null==r.blockNumber?void 0:{blockNumber:r.blockNumber,logs:o_(r.tables)}}throw r}}async function oO(e){async function t(){if(e.indexerUrl&&e.chainId)return ox("fetching records for",e.table.label,"via indexer from",e.indexerUrl),(await oI({chainId:e.chainId,address:e.worldAddress,indexerUrl:e.indexerUrl,filters:[{tableId:e.table.tableId}]}))?.logs.filter(t=>t.args.tableId===e.table.tableId)??[];{let t=e.client??L({transport:ew(e.rpcUrl)});return ox("fetching records for",e.table.label,"via RPC from",t.transport.url),function(e){let t=e.slice().sort(no),n=new Map;for(let e of t){let t=[e.address,e.args.tableId,e.args.keyTuple.join(",")].join(":");if("Store_SetRecord"===e.eventName)n.delete(t),n.set(t,e);else if("Store_SpliceStaticData"===e.eventName){let r=n.get(t),{staticData:a,encodedLengths:s,dynamicData:i}=r?.args??or,o={...e,eventName:"Store_SetRecord",args:{tableId:e.args.tableId,keyTuple:e.args.keyTuple,staticData:nl(a,e.args.start,(0,e7.d)(e.args.data),e.args.data),encodedLengths:s,dynamicData:i}};n.delete(t),n.set(t,o)}else if("Store_SpliceDynamicData"===e.eventName){let r=n.get(t),{staticData:a,dynamicData:s}=r?.args??or,i={...e,eventName:"Store_SetRecord",args:{tableId:e.args.tableId,keyTuple:e.args.keyTuple,staticData:a,encodedLengths:e.args.encodedLengths,dynamicData:nl(s,e.args.start,e.args.deleteCount,e.args.data)}};n.delete(t),n.set(t,i)}else"Store_DeleteRecord"===e.eventName&&n.delete(t)}return Array.from(n.values())}((await ng({fromBlock:e.fromBlock??0n,toBlock:e.toBlock??await ti(t,ta,"getBlockNumber")({}),maxBlockRange:100000n,getLogs:async({fromBlock:n,toBlock:r})=>os(t,{address:e.worldAddress,fromBlock:n,toBlock:r,tableId:e.table.tableId})})).flatMap(e=>e.logs))}}let n=await t(),r=n.map(t=>(function({table:e,log:t}){var n;let r;let a=oe(i5(e)),s=oe(i7(e)),i=(n=t.args.keyTuple,r=function(e,t){if(e.staticFields.length!==t.length)throw Error(`key tuple length ${t.length} does not match key schema length ${e.staticFields.length}`);return t.map((t,n)=>tV([{type:e.staticFields[n]}],t)[0])}({staticFields:Object.values(a),dynamicFields:[]},n),Object.fromEntries(Object.keys(a).map((e,t)=>[e,r[t]]))),o=function(e,{staticData:t,encodedLengths:n,dynamicData:r}){var a;let s;return a=(0,tZ.SM)([nu(t,0,i3(Object.values(e).filter(nI))),(0,tB.gc)(n,{size:32}),r]),s=function(e,t){let n=[],r=0;e.staticFields.forEach(e=>{let a=nk[e],s=i2(e,nu(t,r,r+a));r+=a,n.push(s)});let a=i3(e.staticFields),s=r;if(s!==a&&console.warn("Decoded static data length does not match value schema's expected static data length. Data may get corrupted. Is `getStaticByteLength` outdated?",{expectedLength:a,actualLength:s,bytesOffset:r}),e.dynamicFields.length>0){let a=function(e){if(66!==e.length)throw new iY(e);let t=i2("uint56",nu(e,25,32)),n=Object.freeze([...i1("uint40[]",nu(e,0,25))].reverse()),r=BigInt(n.reduce((e,t)=>e+t,0));if(r!==t)throw new i0(e,t,r);return{totalByteLength:t,fieldByteLengths:n}}(nu(t,r,r+32));r+=32,e.dynamicFields.forEach((e,s)=>{let i=a.fieldByteLengths[s];if(i>0){let a=i1(e,nu(t,r,r+i));r+=i,n.push(a)}else n.push(nR[e])});let i=r-32-s;BigInt(i)!==a.totalByteLength&&console.warn("Decoded dynamic data length does not match data layout's expected data length. Data may get corrupted. Did the data layout change?",{expectedLength:a.totalByteLength,actualLength:i,bytesOffset:r})}return n}({staticFields:Object.values(e).filter(nI),dynamicFields:Object.values(e).filter(nj)},a),Object.fromEntries(Object.keys(e).map((e,t)=>[e,s[t]]))}(s,t.args);return{...i,...o}})({log:t,table:e.table})),a=n.length>0?n[n.length-1].blockNumber??0n:0n;return ox("found",r.length,"records for table",e.table.label,"at block",a),{records:r,blockNumber:a}}let oC=e=>(0,tF.tP)(tp(e),0,4),oE=JSON.parse('[{"type":"function","name":"batchCall","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallData[]","components":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"batchCallFrom","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallFromData[]","components":[{"name":"from","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"call","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"callFrom","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"creator","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"deleteRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldSlice","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getFieldLayout","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getKeySchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"keySchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"getValueSchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"valueSchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"grantAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initialize","inputs":[{"name":"initModule","type":"address","internalType":"contract IModule"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installRootModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"popFromDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"byteLengthToPop","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"pushToDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"dataToPush","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespace","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerRootFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"worldFunctionSignature","type":"string","internalType":"string"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystem","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"system","type":"address","internalType":"contract System"},{"name":"publicAccess","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerTable","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"},{"name":"keySchema","type":"bytes32","internalType":"Schema"},{"name":"valueSchema","type":"bytes32","internalType":"Schema"},{"name":"keyNames","type":"string[]","internalType":"string[]"},{"name":"fieldNames","type":"string[]","internalType":"string[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceStaticData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"start","type":"uint48","internalType":"uint48"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"storeVersion","inputs":[],"outputs":[{"name":"version","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"transferBalanceToAddress","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toAddress","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferBalanceToNamespace","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"worldVersion","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"event","name":"HelloStore","inputs":[{"name":"storeVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"HelloWorld","inputs":[{"name":"worldVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Store_DeleteRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"}],"anonymous":false},{"type":"event","name":"Store_SetRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"staticData","type":"bytes","indexed":false,"internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"deleteCount","type":"uint40","indexed":false,"internalType":"uint40"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceStaticData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"error","name":"EncodedLengths_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_Empty","inputs":[]},{"type":"error","name":"FieldLayout_InvalidStaticDataLength","inputs":[{"name":"staticDataLength","type":"uint256","internalType":"uint256"},{"name":"computedStaticDataLength","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsNotZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyDynamicFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Module_AlreadyInstalled","inputs":[]},{"type":"error","name":"Module_MissingDependency","inputs":[{"name":"dependency","type":"address","internalType":"address"}]},{"type":"error","name":"Module_NonRootInstallNotSupported","inputs":[]},{"type":"error","name":"Module_RootInstallNotSupported","inputs":[]},{"type":"error","name":"Schema_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Schema_StaticTypeAfterDynamicType","inputs":[]},{"type":"error","name":"Slice_OutOfBounds","inputs":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_IndexOutOfBounds","inputs":[{"name":"length","type":"uint256","internalType":"uint256"},{"name":"accessedIndex","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidBounds","inputs":[{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidFieldNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidKeyNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_InvalidSplice","inputs":[{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"fieldLength","type":"uint40","internalType":"uint40"}]},{"type":"error","name":"Store_InvalidStaticDataLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaDynamicLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaStaticLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_TableAlreadyExists","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_TableNotFound","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_AccessDenied","inputs":[{"name":"resource","type":"string","internalType":"string"},{"name":"caller","type":"address","internalType":"address"}]},{"type":"error","name":"World_AlreadyInitialized","inputs":[]},{"type":"error","name":"World_CallbackNotAllowed","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_DelegationNotFound","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"delegatee","type":"address","internalType":"address"}]},{"type":"error","name":"World_FunctionSelectorAlreadyExists","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_FunctionSelectorNotFound","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InsufficientBalance","inputs":[{"name":"balance","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"World_InterfaceNotSupported","inputs":[{"name":"contractAddress","type":"address","internalType":"address"},{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InvalidNamespace","inputs":[{"name":"namespace","type":"bytes14","internalType":"bytes14"}]},{"type":"error","name":"World_InvalidResourceId","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceAlreadyExists","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceNotFound","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_SystemAlreadyExists","inputs":[{"name":"system","type":"address","internalType":"address"}]},{"type":"error","name":"World_UnlimitedDelegationNotAllowed","inputs":[]}]');async function oS({client:e,worldAddress:t,fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}){ox("looking up function selectors for",t);let{records:i}=await oO({indexerUrl:a,chainId:s,client:e,table:of.namespaces.world.tables.FunctionSelectors,worldAddress:t,fromBlock:n,toBlock:r});ox("found",i.length,"function selectors for",t),ox("looking up function signatures for",t);let{records:o}=await oO({indexerUrl:a,chainId:s,client:e,table:of.namespaces.world.tables.FunctionSignatures,worldAddress:t,fromBlock:n,toBlock:r}),u=Object.fromEntries(o.map(e=>[e.functionSelector,e.functionSignature]));return ox("found",o.length,"function signatures for",t),i.map(({worldFunctionSelector:e,systemFunctionSelector:t,systemId:n})=>({selector:e,signature:u[e],systemFunctionSelector:t,systemFunctionSignature:u[t],systemId:n}))}function oR(e){return"function"===e.type}async function oj({client:e,worldAddress:t,fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}){let i=await oS({client:e,worldAddress:(0,tN.K)(t),fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}),o=oE.filter(oR).map(oC);return[...oE,...i.map(e=>{try{return function(e){let t=function(e){let t;if("string"==typeof e)t=eQ(e);else{let n=e8(e),r=e.length;for(let a=0;a<r;a++){let r=e[a];if(!eS(r)){t=eQ(r,n);break}}}if(!t)throw new eM({signature:e});return t}(`function ${e}`);if("function"!==t.type)throw Error(`Expected function signature, got ${t.type}`);return t}(e.signature)}catch(e){console.error(e)}}).filter(t0).filter(e=>!o.includes(oC(e)))]}var oA=n(20119);let oN="force-dynamic";async function o$(e){return L({chain:oA.df[oA.is[e]],transport:ew()})}function oF(e){let t=oA.df[oA.is[e]];return"indexerUrl"in t?t.indexerUrl:void 0}async function oP(e,t){let n=await o$(e),r=await ti(n,ta,"getBlockNumber")({}),a=await ng({fromBlock:0n,toBlock:r,maxBlockRange:100000n,publicClient:n,address:t,events:e5(["event HelloStore(bytes32 indexed storeVersion)","event HelloWorld(bytes32 indexed worldVersion)"])});return{fromBlock:a[0]?.blockNumber??0n,toBlock:r,isWorldDeployed:a[0]?.logs.length===2}}async function oM(e){let{searchParams:t}=new URL(e.url),n=Number(t.get("chainId")),r=t.get("worldAddress");if(!n||!r)return Response.json({error:"Missing chainId or worldAddress"},{status:400});(0,oA.wG)(n);try{let e=await o$(n),t=oF(n);if(t){let[a,s]=await Promise.all([ts(e,{address:r}),oj({client:e,worldAddress:r,indexerUrl:t,chainId:n})]);return Response.json({abi:s,isWorldDeployed:a&&(0,e7.d)(a)>0})}let{fromBlock:a,toBlock:s,isWorldDeployed:i}=await oP(n,r),o=await oj({client:e,worldAddress:r,fromBlock:a,toBlock:s,indexerUrl:oF(n),chainId:n});return Response.json({abi:o,isWorldDeployed:i})}catch(t){let e=t instanceof Error?t.message:"An unknown error occurred";return Response.json({error:e},{status:400})}}let oL=new N.AppRouteRouteModule({definition:{kind:$.x.APP_ROUTE,page:"/(explorer)/api/world-abi/route",pathname:"/api/world-abi",filename:"route",bundlePath:"app/(explorer)/api/world-abi/route"},resolvedPagePath:"/home/runner/work/mud/mud/packages/explorer/src/app/(explorer)/api/world-abi/route.ts",nextConfigOutput:"standalone",userland:A}),{requestAsyncStorage:oD,staticGenerationAsyncStorage:oZ,serverHooks:oB}=oL,oz="/(explorer)/api/world-abi/route";function oU(){return(0,F.patchFetch)({serverHooks:oB,staticGenerationAsyncStorage:oZ})}},49308:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(48229)(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},48229:(e,t,n)=>{e.exports=function(e){function t(e){let n,a,s;let i=null;function o(...e){if(!o.enabled)return;let r=Number(new Date),a=r-(n||r);o.diff=a,o.prev=n,o.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";s++;let a=t.formatters[r];if("function"==typeof a){let t=e[s];n=a.call(o,t),e.splice(s,1),s--}return n}),t.formatArgs.call(o,e),(o.log||t.log).apply(o,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(a!==t.namespaces&&(a=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(a),...t.skips.map(a).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){let n,r;if("*"===e[e.length-1])return!0;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(26469),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},3741:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||process.__nwjs?e.exports=n(49308):e.exports=n(61341)},61341:(e,t,n)=>{let r=n(76224),a=n(73837);t.init=function(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(a.format(...e)+"\n")},t.formatArgs=function(n){let{namespace:r,useColors:a}=this;if(a){let t=this.color,a="\x1b[3"+(t<8?t:"8;5;"+t),s=` ${a};1m${r} \u001B[0m`;n[0]=s+n[0].split("\n").join("\n"+s),n.push(a+"m+"+e.exports.humanize(this.diff)+"\x1b[0m")}else n[0]=(t.inspectOpts.hideDate?"":new Date().toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)},t.destroy=a.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=n(86046);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e},{}),e.exports=n(48229)(t);let{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}},22569:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){let e;return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(69550)(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},69550:(e,t,n)=>{e.exports=function(e){function t(e){let n,a,s;let i=null;function o(...e){if(!o.enabled)return;let r=Number(new Date),a=r-(n||r);o.diff=a,o.prev=n,o.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";s++;let a=t.formatters[r];if("function"==typeof a){let t=e[s];n=a.call(o,t),e.splice(s,1),s--}return n}),t.formatArgs.call(o,e),(o.log||t.log).apply(o,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(a!==t.namespaces&&(a=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(a),...t.skips.map(a).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){let n,r;if("*"===e[e.length-1])return!0;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(22677),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},41772:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||process.__nwjs?e.exports=n(22569):e.exports=n(89294)},89294:(e,t,n)=>{let r=n(76224),a=n(73837);t.init=function(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(a.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(n){let{namespace:r,useColors:a}=this;if(a){let t=this.color,a="\x1b[3"+(t<8?t:"8;5;"+t),s=` ${a};1m${r} \u001B[0m`;n[0]=s+n[0].split("\n").join("\n"+s),n.push(a+"m+"+e.exports.humanize(this.diff)+"\x1b[0m")}else n[0]=(t.inspectOpts.hideDate?"":new Date().toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)},t.destroy=a.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=n(86046);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e},{}),e.exports=n(69550)(t);let{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}},94335:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,i){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new a(r,s||e,i),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],o]:e._events[u].push(o):(e._events[u]=o,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1)),o.prototype.eventNames=function(){var e,r,a=[];if(0===this._eventsCount)return a;for(r in e=this._events)t.call(e,r)&&a.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},o.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,i=Array(s);a<s;a++)i[a]=r[a].fn;return i},o.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,a,s,i){var o=n?n+e:e;if(!this._events[o])return!1;var u,l,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,a),!0;case 5:return c.fn.call(c.context,t,r,a,s),!0;case 6:return c.fn.call(c.context,t,r,a,s,i),!0}for(l=1,u=Array(d-1);l<d;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var p,y=c.length;for(l=0;l<y;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),d){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,r);break;case 4:c[l].fn.call(c[l].context,t,r,a);break;default:if(!u)for(p=1,u=Array(d-1);p<d;p++)u[p-1]=arguments[p];c[l].fn.apply(c[l].context,u)}}return!0},o.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},o.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},o.prototype.removeListener=function(e,t,r,a){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return i(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||a&&!o.once||r&&o.context!==r||i(this,s);else{for(var u=0,l=[],c=o.length;u<c;u++)(o[u].fn!==t||a&&!o[u].once||r&&o[u].context!==r)&&l.push(o[u]);l.length?this._events[s]=1===l.length?l[0]:l:i(this,s)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&i(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,e.exports=o},7226:e=>{"use strict";e.exports=(e,t=process.argv)=>{let n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),a=t.indexOf("--");return -1!==r&&(-1===a||r<a)}},26469:e=>{function t(e,t,n,r){return Math.round(e/n)+" "+r+(t>=1.5*n?"s":"")}e.exports=function(e,n){n=n||{};var r,a,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===s&&isFinite(e))return n.long?(r=Math.abs(e))>=864e5?t(e,r,864e5,"day"):r>=36e5?t(e,r,36e5,"hour"):r>=6e4?t(e,r,6e4,"minute"):r>=1e3?t(e,r,1e3,"second"):e+" ms":(a=Math.abs(e))>=864e5?Math.round(e/864e5)+"d":a>=36e5?Math.round(e/36e5)+"h":a>=6e4?Math.round(e/6e4)+"m":a>=1e3?Math.round(e/1e3)+"s":e+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},22677:e=>{function t(e,t,n,r){return Math.round(e/n)+" "+r+(t>=1.5*n?"s":"")}e.exports=function(e,n){n=n||{};var r,a,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===s&&isFinite(e))return n.long?(r=Math.abs(e))>=864e5?t(e,r,864e5,"day"):r>=36e5?t(e,r,36e5,"hour"):r>=6e4?t(e,r,6e4,"minute"):r>=1e3?t(e,r,1e3,"second"):e+" ms":(a=Math.abs(e))>=864e5?Math.round(e/864e5)+"d":a>=36e5?Math.round(e/36e5)+"h":a>=6e4?Math.round(e/6e4)+"m":a>=1e3?Math.round(e/1e3)+"s":e+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},50705:(e,t,n)=>{"use strict";e.exports=n(30517)},27147:(e,t,n)=>{n(26711)},26711:(e,t,n)=>{var r=n(84932);t.operation=function(e){return new r(t.timeouts(e),{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(e,t){return e-t}),r},t.createTimeout=function(e,t){return Math.min(Math.round((t.randomize?Math.random()+1:1)*Math.max(t.minTimeout,1)*Math.pow(t.factor,e)),t.maxTimeout)},t.wrap=function(e,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var a in r=[],e)"function"==typeof e[a]&&r.push(a);for(var s=0;s<r.length;s++){var i=r[s],o=e[i];e[i]=(function(r){var a=t.operation(n),s=Array.prototype.slice.call(arguments,1),i=s.pop();s.push(function(e){a.retry(e)||(e&&(arguments[0]=a.mainError()),i.apply(this,arguments))}),a.attempt(function(){r.apply(e,s)})}).bind(e,o),e[i].options=n}}},84932:e=>{function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],s=a.message,i=(e[s]||0)+1;e[s]=i,i>=n&&(t=a,n=i)}return t}},86046:(e,t,n)=>{"use strict";let r;let a=n(22037),s=n(76224),i=n(7226),{env:o}=process;function u(e,t={}){var n;return 0!==(n=function(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let s=function(){if("FORCE_COLOR"in o)return"true"===o.FORCE_COLOR?1:"false"===o.FORCE_COLOR?0:0===o.FORCE_COLOR.length?1:Math.min(Number.parseInt(o.FORCE_COLOR,10),3)}();void 0!==s&&(r=s);let u=n?r:s;if(0===u)return 0;if(n){if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2}if(e&&!t&&void 0===u)return 0;let l=u||0;if("dumb"===o.TERM)return l;if("win32"===process.platform){let e=a.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in o)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(e=>e in o)||"codeship"===o.CI_NAME?1:l;if("TEAMCITY_VERSION"in o)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0;if("truecolor"===o.COLORTERM)return 3;if("TERM_PROGRAM"in o){let e=Number.parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||"COLORTERM"in o?1:l}(e,{streamIsTTY:e&&e.isTTY,...t}))&&{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}i("no-color")||i("no-colors")||i("color=false")||i("color=never")?r=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(r=1),e.exports={supportsColor:u,stdout:u({isTTY:s.isatty(1)}),stderr:u({isTTY:s.isatty(2)})}},20119:(e,t,n)=>{"use strict";n.d(t,{is:()=>y,df:()=>p,wG:()=>m});var r=n(89272),a=n(7769),s=n(27094),i=n(18061),o=n(21322);a.t;var u={...s.g,iconUrls:["https://redstone.xyz/chain-icons/redstone.png"],indexerUrl:"https://indexer.mud.redstonechain.com"},l={...i.T,iconUrls:["https://redstone.xyz/chain-icons/garnet.png"],indexerUrl:"https://indexer.mud.garnetchain.com"},c={http:["https://rpc.rhodolitechain.com"],webSocket:["wss://rpc.rhodolitechain.com"]},d={...o.i,name:"Rhodolite Devnet",testnet:!0,id:17420,sourceId:17e3,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:c,bundler:c,quarryPassIssuer:c,wiresaw:c},contracts:{...o.i.contracts,l1StandardBridge:{17e3:{address:"0x6487446e0B9FAEa90F6a9772A6448cFa780E30F9"}},quarryPaymaster:{address:"0x7ca1b85aca23fccf2fbac14c02b5e8a6432639b9"}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.rhodolitechain.com"},worldsExplorer:{name:"MUD Worlds Explorer",url:"https://explorer.mud.dev/rhodolite/worlds"}},iconUrls:["https://redstone.xyz/chain-icons/rhodolite.png"],indexerUrl:"https://indexer.mud.rhodolitechain.com"};let p={anvil:r.O,rhodolite:d,garnet:l,redstone:u},y=Object.fromEntries(Object.entries(p).map(([e,t])=>[t.id,e]));function m(e){if(!("number"==typeof e&&e in y))throw Error(`Invalid chain ID. Supported chains are: ${Object.keys(y).join(", ")}.`)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),r=t.X(0,[2031,965],()=>n(33800));module.exports=r})();
|
|
19
|
+
`.trim();function sx(e,t){var n,r;let a=e._def(),s=(n=a.inputParser)?sp(n):e=>e,i=(r=a.outputParser)?sp(r):e=>e,o=sf(s);return sv({inputs:[a.inputParser],middlewares:[...a.middlewares,o,sh(i)],meta:a.meta,output:a.outputParser,mutation:"mutation"===t,query:"query"===t,subscription:"subscription"===t})[t](e=>a.resolver(e))}let sT={query:"queries",mutation:"mutations",subscription:"subscriptions"};function sk(...e){return Object.assign(Object.create(null),...e)}class sI{static prefixProcedures(e,t){let n=sk();for(let[r,a]of Object.entries(e))n[t+r]=a;return n}query(e,t){let n=new sI({queries:sk({[e]:sd(t)})});return this.merge(n)}mutation(e,t){let n=new sI({mutations:sk({[e]:sd(t)})});return this.merge(n)}subscription(e,t){let n=new sI({subscriptions:sk({[e]:sd(t)})});return this.merge(n)}merge(e,t){let n,r="";if("string"==typeof e&&t instanceof sI)r=e,n=t;else if(e instanceof sI)n=e;else throw Error("Invalid args");let a=[...Object.keys(n._def.queries).filter(e=>!!this._def.queries[r+e]),...Object.keys(n._def.mutations).filter(e=>!!this._def.mutations[r+e]),...Object.keys(n._def.subscriptions).filter(e=>!!this._def.subscriptions[r+e])];if(a.length)throw Error(`Duplicate endpoint(s): ${a.join(", ")}`);let s=e=>{let t=sk();for(let[n,r]of Object.entries(e)){let e=r.inheritMiddlewares(this._def.middlewares);t[n]=e}return sI.prefixProcedures(t,r)};return new sI({...this._def,queries:sk(this._def.queries,s(n._def.queries)),mutations:sk(this._def.mutations,s(n._def.mutations)),subscriptions:sk(this._def.subscriptions,s(n._def.subscriptions))})}async call(e){let{type:t,path:n}=e,r=sT[t],a=this._def[r][n];if(!a)throw new TRPCError({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});return a.call(e)}createCaller(e){return{query:(t,...n)=>this.call({type:"query",ctx:e,path:t,rawInput:n[0]}),mutation:(t,...n)=>this.call({type:"mutation",ctx:e,path:t,rawInput:n[0]}),subscription:(t,...n)=>this.call({type:"subscription",ctx:e,path:t,rawInput:n[0]})}}middleware(e){return new sI({...this._def,middlewares:[...this._def.middlewares,e]})}formatError(e){if(this._def.errorFormatter!==defaultFormatter)throw Error("You seem to have double `formatError()`-calls in your router tree");return new sI({...this._def,errorFormatter:e})}getErrorShape(e){let{path:t,error:n}=e,{code:r}=e.error,a={message:n.message,code:TRPC_ERROR_CODES_BY_KEY[r],data:{code:r,httpStatus:getHTTPStatusCodeFromError(n)}};return globalThis.process?.env?.NODE_ENV!=="production"&&"string"==typeof e.error.stack&&(a.data.stack=e.error.stack),"string"==typeof t&&(a.data.path=t),this._def.errorFormatter({...e,shape:a})}transformer(e){if(this._def.transformer!==defaultTransformer)throw Error("You seem to have double `transformer()`-calls in your router tree");return new sI({...this._def,transformer:"input"in e?e:{input:e,output:e}})}flat(){return this}interop(){return function(e){let t=e._def.errorFormatter,n=e._def.transformer,r={},a={},s={};for(let[t,n]of Object.entries(e._def.queries))r[t]=sx(n,"query");for(let[t,n]of Object.entries(e._def.mutations))a[t]=sx(n,"mutation");for(let[t,n]of Object.entries(e._def.subscriptions))s[t]=sx(n,"subscription");let i=sy(r,a,s);return createRouterFactory({transformer:n,errorFormatter:t,isDev:!1})(i)}(this)}constructor(e){this._def={queries:e?.queries??sk(),mutations:e?.mutations??sk(),subscriptions:e?.subscriptions??sk(),middlewares:e?.middlewares??[],errorFormatter:e?.errorFormatter??defaultFormatter,transformer:e?.transformer??defaultTransformer}}}function sO(...e){let t=sy({},...e.map(e=>e._def.record));return si({errorFormatter:e.reduce((e,t)=>{if(t._def._config.errorFormatter&&t._def._config.errorFormatter!==sn){if(e!==sn&&e!==t._def._config.errorFormatter)throw Error("You seem to have several error formatters");return t._def._config.errorFormatter}return e},sn),transformer:e.reduce((e,t)=>{if(t._def._config.transformer&&t._def._config.transformer!==st){if(e!==st&&e!==t._def._config.transformer)throw Error("You seem to have several transformers");return t._def._config.transformer}return e},st),isDev:e.some(e=>e._def._config.isDev),allowOutsideOfServer:e.some(e=>e._def._config.allowOutsideOfServer),isServer:e.some(e=>e._def._config.isServer),$types:e[0]?._def._config.$types})(t)}class sC{context(){return new sC}meta(){return new sC}create(e){return function(e){var t;let n=e?.errorFormatter??sn,r={transformer:"input"in(t=e?.transformer??st)?t:{input:t,output:t},isDev:e?.isDev??globalThis.process?.env?.NODE_ENV!=="production",allowOutsideOfServer:e?.allowOutsideOfServer??!1,errorFormatter:n,isServer:e?.isServer??so,$types:se(e=>{throw Error(`Tried to access "$types.${e}" which is not available at runtime`)})};if(!(e?.isServer??so)&&e?.allowOutsideOfServer!==!0)throw Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.");return{_config:r,procedure:sv({meta:e?.defaultMeta}),middleware:function(e){return function e(t){return{_middlewares:t,unstable_pipe:n=>e([...t,..."_middlewares"in n?n._middlewares:[n]])}}([e])},router:si(r),mergeRouters:sO}}(e)}}new sC;var sE=function(){function e(){this.keyToValue=new Map,this.valueToKey=new Map}return e.prototype.set=function(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)},e.prototype.getByKey=function(e){return this.keyToValue.get(e)},e.prototype.getByValue=function(e){return this.valueToKey.get(e)},e.prototype.clear=function(){this.keyToValue.clear(),this.valueToKey.clear()},e}(),sS=function(){function e(e){this.generateIdentifier=e,this.kv=new sE}return e.prototype.register=function(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))},e.prototype.clear=function(){this.kv.clear()},e.prototype.getIdentifier=function(e){return this.kv.getByValue(e)},e.prototype.getValue=function(e){return this.kv.getByKey(e)},e}(),sR=function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),sj=function(e){function t(){var t=e.call(this,function(e){return e.name})||this;return t.classToAllowedProps=new Map,t}return sR(t,e),t.prototype.register=function(t,n){"object"==typeof n?(n.allowProps&&this.classToAllowedProps.set(t,n.allowProps),e.prototype.register.call(this,t,n.identifier)):e.prototype.register.call(this,t,n)},t.prototype.getAllowedProps=function(e){return this.classToAllowedProps.get(e)},t}(sS),sA=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i};function sN(e,t){Object.entries(e).forEach(function(e){var n=sA(e,2),r=n[0];return t(n[1],r)})}function s$(e,t){return -1!==e.indexOf(t)}function sP(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(t(r))return r}}var sF=function(){function e(){this.transfomers={}}return e.prototype.register=function(e){this.transfomers[e.name]=e},e.prototype.findApplicable=function(e){return function(e,t){var n=function(e){if("values"in Object)return Object.values(e);var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}(e);if("find"in n)return n.find(t);for(var r=0;r<n.length;r++){var a=n[r];if(t(a))return a}}(this.transfomers,function(t){return t.isApplicable(e)})},e.prototype.findByName=function(e){return this.transfomers[e]},e}(),sM=function(e){return void 0===e},sL=function(e){return"object"==typeof e&&null!==e&&e!==Object.prototype&&(null===Object.getPrototypeOf(e)||Object.getPrototypeOf(e)===Object.prototype)},sD=function(e){return sL(e)&&0===Object.keys(e).length},sZ=function(e){return Array.isArray(e)},sB=function(e){return e instanceof Map},sz=function(e){return e instanceof Set},sU=function(e){return"Symbol"===Object.prototype.toString.call(e).slice(8,-1)},sq=function(e){return"number"==typeof e&&isNaN(e)},sV=function(e){return"boolean"==typeof e||null===e||sM(e)||"number"==typeof e&&!isNaN(e)||"string"==typeof e||sU(e)},sW=function(e){return e.replace(/\./g,"\\.")},sG=function(e){return e.map(String).map(sW).join(".")},sH=function(e){for(var t=[],n="",r=0;r<e.length;r++){var a=e.charAt(r);if("\\"===a&&"."===e.charAt(r+1)){n+=".",r++;continue}if("."===a){t.push(n),n="";continue}n+=a}var s=n;return t.push(s),t},sJ=function(){return(sJ=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},sK=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},sY=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e};function sQ(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var sX=[sQ(sM,"undefined",function(){return null},function(){}),sQ(function(e){return"bigint"==typeof e},"bigint",function(e){return e.toString()},function(e){return"undefined"!=typeof BigInt?BigInt(e):(console.error("Please add a BigInt polyfill."),e)}),sQ(function(e){return e instanceof Date&&!isNaN(e.valueOf())},"Date",function(e){return e.toISOString()},function(e){return new Date(e)}),sQ(function(e){return e instanceof Error},"Error",function(e,t){var n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(function(t){n[t]=e[t]}),n},function(e,t){var n=Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(function(t){n[t]=e[t]}),n}),sQ(function(e){return e instanceof RegExp},"regexp",function(e){return""+e},function(e){return new RegExp(e.slice(1,e.lastIndexOf("/")),e.slice(e.lastIndexOf("/")+1))}),sQ(sz,"set",function(e){return sY([],sK(e.values()))},function(e){return new Set(e)}),sQ(sB,"map",function(e){return sY([],sK(e.entries()))},function(e){return new Map(e)}),sQ(function(e){var t;return sq(e)||(t=e)===1/0||t===-1/0},"number",function(e){return sq(e)?"NaN":e>0?"Infinity":"-Infinity"},Number),sQ(function(e){return 0===e&&1/e==-1/0},"number",function(){return"-0"},Number),sQ(function(e){return e instanceof URL},"URL",function(e){return e.toString()},function(e){return new URL(e)})];function s0(e,t,n,r){return{isApplicable:e,annotation:t,transform:n,untransform:r}}var s2=s0(function(e,t){return!!sU(e)&&!!t.symbolRegistry.getIdentifier(e)},function(e,t){return["symbol",t.symbolRegistry.getIdentifier(e)]},function(e){return e.description},function(e,t,n){var r=n.symbolRegistry.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown symbol");return r}),s1=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce(function(e,t){return e[t.name]=t,e},{}),s3=s0(function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},function(e){return["typed-array",e.constructor.name]},function(e){return sY([],sK(e))},function(e,t){var n=s1[t[1]];if(!n)throw Error("Trying to deserialize unknown typed array");return new n(e)});function s6(e,t){return null!=e&&!!e.constructor&&!!t.classRegistry.getIdentifier(e.constructor)}var s4=s0(s6,function(e,t){return["class",t.classRegistry.getIdentifier(e.constructor)]},function(e,t){var n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return sJ({},e);var r={};return n.forEach(function(t){r[t]=e[t]}),r},function(e,t,n){var r=n.classRegistry.getValue(t[1]);if(!r)throw Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(r.prototype),e)}),s8=s0(function(e,t){return!!t.customTransformerRegistry.findApplicable(e)},function(e,t){return["custom",t.customTransformerRegistry.findApplicable(e).name]},function(e,t){return t.customTransformerRegistry.findApplicable(e).serialize(e)},function(e,t,n){var r=n.customTransformerRegistry.findByName(t[1]);if(!r)throw Error("Trying to deserialize unknown custom value");return r.deserialize(e)}),s9=[s4,s2,s8,s3],s5=function(e,t){var n=sP(s9,function(n){return n.isApplicable(e,t)});if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};var r=sP(sX,function(n){return n.isApplicable(e,t)});if(r)return{value:r.transform(e,t),type:r.annotation}},s7={};sX.forEach(function(e){s7[e.annotation]=e});var ie=function(e,t,n){if(sZ(t))switch(t[0]){case"symbol":return s2.untransform(e,t,n);case"class":return s4.untransform(e,t,n);case"custom":return s8.untransform(e,t,n);case"typed-array":return s3.untransform(e,t,n);default:throw Error("Unknown transformation: "+t)}else{var r=s7[t];if(!r)throw Error("Unknown transformation: "+t);return r.untransform(e,n)}},it=function(e,t){for(var n=e.keys();t>0;)n.next(),t--;return n.next().value};function ir(e){if(s$(e,"__proto__"))throw Error("__proto__ is not allowed as a property");if(s$(e,"prototype"))throw Error("prototype is not allowed as a property");if(s$(e,"constructor"))throw Error("constructor is not allowed as a property")}var ia=function(e,t){ir(t);for(var n=0;n<t.length;n++){var r=t[n];if(sz(e))e=it(e,+r);else if(sB(e)){var a=+r,s=0==+t[++n]?"key":"value",i=it(e,a);switch(s){case"key":e=i;break;case"value":e=e.get(i)}}else e=e[r]}return e},is=function(e,t,n){if(ir(t),0===t.length)return n(e);for(var r=e,a=0;a<t.length-1;a++){var s=t[a];if(sZ(r))r=r[+s];else if(sL(r))r=r[s];else if(sz(r)){var i=+s;r=it(r,i)}else if(sB(r)){if(a===t.length-2)break;var i=+s,o=0==+t[++a]?"key":"value",u=it(r,i);switch(o){case"key":r=u;break;case"value":r=r.get(u)}}}var l=t[t.length-1];if(sZ(r)?r[+l]=n(r[+l]):sL(r)&&(r[l]=n(r[l])),sz(r)){var c=it(r,+l),d=n(c);c!==d&&(r.delete(c),r.add(d))}if(sB(r)){var i=+t[t.length-2],p=it(r,i),o=0==+l?"key":"value";switch(o){case"key":var y=n(p);r.set(y,r.get(p)),y!==p&&r.delete(p);break;case"value":r.set(p,n(r.get(p)))}}return e},ii=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},io=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e},iu=function(e,t,n,r,a){if(void 0===r&&(r=[]),void 0===a&&(a=[]),sV(e)||(s=r,(i=t.get(e))?i.push(s):t.set(e,[s])),!(sL(e)||sZ(e)||sB(e)||sz(e)||s6(e,n))){var s,i,o,u=s5(e,n);return u?{transformedValue:u.value,annotations:[u.type]}:{transformedValue:e}}if(s$(a,e))return{transformedValue:null};var l=s5(e,n),c=null!==(o=null==l?void 0:l.value)&&void 0!==o?o:e;sV(e)||(a=io(io([],ii(a)),[e]));var d=sZ(c)?[]:{},p={};return(sN(c,function(e,s){var i=iu(e,t,n,io(io([],ii(r)),[s]),a);d[s]=i.transformedValue,sZ(i.annotations)?p[s]=i.annotations:sL(i.annotations)&&sN(i.annotations,function(e,t){p[sW(s)+"."+t]=e})}),sD(p))?{transformedValue:d,annotations:l?[l.type]:void 0}:{transformedValue:d,annotations:l?[l.type,p]:p}};function il(e){return Object.prototype.toString.call(e).slice(8,-1)}function ic(e){return"Array"===il(e)}var id=function(){return(id=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},ip=function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,s=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(e){a={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return i},iy=function(e,t){for(var n=0,r=t.length,a=e.length;n<r;n++,a++)e[a]=t[n];return e},im=function(){function e(){this.classRegistry=new sj,this.symbolRegistry=new sS(function(e){var t;return null!==(t=e.description)&&void 0!==t?t:""}),this.customTransformerRegistry=new sF,this.allowedErrorProps=[]}return e.prototype.serialize=function(e){var t,n,r=new Map,a=iu(e,r,this),s={json:a.transformedValue};a.annotations&&(s.meta=id(id({},s.meta),{values:a.annotations}));var i=(t={},n=void 0,(r.forEach(function(e){if(!(e.length<=1)){var r=ii(e.map(function(e){return e.map(String)}).sort(function(e,t){return e.length-t.length})),a=r[0],s=r.slice(1);0===a.length?n=s.map(sG):t[sG(a)]=s.map(sG)}}),n)?sD(t)?[n]:[n,t]:sD(t)?void 0:t);return i&&(s.meta=id(id({},s.meta),{referentialEqualities:i})),s},e.prototype.deserialize=function(e){var t,n,r,a=e.json,s=e.meta,i=function e(t,n={}){return ic(t)?t.map(t=>e(t,n)):!function(e){if("Object"!==il(e))return!1;let t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}(t)?t:[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)].reduce((r,a)=>{if(ic(n.props)&&!n.props.includes(a))return r;let s=e(t[a],n);return function(e,t,n,r,a){let s=({}).propertyIsEnumerable.call(r,t)?"enumerable":"nonenumerable";"enumerable"===s&&(e[t]=n),a&&"nonenumerable"===s&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}(r,a,s,t,n.nonenumerable),r},{})}(a);return(null==s?void 0:s.values)&&(t=i,n=s.values,r=this,function e(t,n,r){if(void 0===r&&(r=[]),t){if(!sZ(t)){sN(t,function(t,a){return e(t,n,io(io([],ii(r)),ii(sH(a))))});return}var a=ii(t,2),s=a[0],i=a[1];i&&sN(i,function(t,a){e(t,n,io(io([],ii(r)),ii(sH(a))))}),n(s,r)}}(n,function(e,n){t=is(t,n,function(t){return ie(t,e,r)})}),i=t),(null==s?void 0:s.referentialEqualities)&&(i=function(e,t){function n(t,n){var r=ia(e,sH(n));t.map(sH).forEach(function(t){e=is(e,t,function(){return r})})}if(sZ(t)){var r=ii(t,2),a=r[0],s=r[1];a.forEach(function(t){e=is(e,sH(t),function(){return e})}),s&&sN(s,n)}else sN(t,n);return e}(i,s.referentialEqualities)),i},e.prototype.stringify=function(e){return JSON.stringify(this.serialize(e))},e.prototype.parse=function(e){return this.deserialize(JSON.parse(e))},e.prototype.registerClass=function(e,t){this.classRegistry.register(e,t)},e.prototype.registerSymbol=function(e,t){this.symbolRegistry.register(e,t)},e.prototype.registerCustom=function(e,t){this.customTransformerRegistry.register(id({name:t},e))},e.prototype.allowErrorProps=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.allowedErrorProps).push.apply(e,iy([],ip(t)))},e.defaultInstance=new e,e.serialize=e.defaultInstance.serialize.bind(e.defaultInstance),e.deserialize=e.defaultInstance.deserialize.bind(e.defaultInstance),e.stringify=e.defaultInstance.stringify.bind(e.defaultInstance),e.parse=e.defaultInstance.parse.bind(e.defaultInstance),e.registerClass=e.defaultInstance.registerClass.bind(e.defaultInstance),e.registerSymbol=e.defaultInstance.registerSymbol.bind(e.defaultInstance),e.registerCustom=e.defaultInstance.registerCustom.bind(e.defaultInstance),e.allowErrorProps=e.defaultInstance.allowErrorProps.bind(e.defaultInstance),e}();function ih(e){let t={subscribe(t){let n=null,r=!1,a=!1,s=!1;function i(){if(null===n){s=!0;return}!a&&(a=!0,"function"==typeof n?n():n&&n.unsubscribe())}return n=e({next(e){r||t.next?.(e)},error(e){r||(r=!0,t.error?.(e),i())},complete(){r||(r=!0,t.complete?.(),i())}}),s&&i(),{unsubscribe:i}},pipe:(...e)=>(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce((e,t)=>t(e),t)})(t)};return t}im.serialize,im.deserialize,im.stringify,im.parse,im.registerClass,im.registerCustom,im.registerSymbol,im.allowErrorProps;class ib extends Error{constructor(e){super(e),this.name="ObservableAbortError",Object.setPrototypeOf(this,ib.prototype)}}class ig extends Error{static from(e,t={}){return e instanceof Error?e instanceof ig||"TRPCClientError"===e.name?(t.meta&&(e.meta={...e.meta,...t.meta}),e):new ig(e.message,{...t,cause:e,result:null}):new ig(e.error.message??"",{...t,cause:void 0,result:e})}constructor(e,t){let n=t?.cause;super(e,{cause:n}),this.meta=t?.meta,this.cause=n,this.shape=t?.result?.error,this.data=t?.result?.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ig.prototype)}}let iv=e=>"function"==typeof e;function iw(e){var t;return{url:e.url,fetch:e.fetch,AbortController:(t=e.AbortController)?t:"undefined"!=typeof window&&window.AbortController?window.AbortController:"undefined"!=typeof globalThis&&globalThis.AbortController?globalThis.AbortController:null}}let i_={query:"GET",mutation:"POST"};function ix(e){return"input"in e?e.runtime.transformer.serialize(e.input):function(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];t[n]=r}return t}(e.inputs.map(t=>e.runtime.transformer.serialize(t)))}let iT=e=>{let t=e.url+"/"+e.path,n=[];if("inputs"in e&&n.push("batch=1"),"query"===e.type){let t=ix(e);void 0!==t&&n.push(`input=${encodeURIComponent(JSON.stringify(t))}`)}return n.length&&(t+="?"+n.join("&")),t},ik=e=>{if("query"===e.type)return;let t=ix(e);return void 0!==t?JSON.stringify(t):void 0},iI=e=>iC({...e,contentTypeHeader:"application/json",getUrl:iT,getBody:ik});async function iO(e,t){let n=e.getUrl(e),r=e.getBody(e),{type:a}=e,s=await e.headers();/* istanbul ignore if -- @preserve */if("subscription"===a)throw Error("Subscriptions should use wsLink");let i={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.batchModeHeader?{"trpc-batch-mode":e.batchModeHeader}:{},...s};return(function(e){if(e)return e;if("undefined"!=typeof window&&iv(window.fetch))return window.fetch;if("undefined"!=typeof globalThis&&iv(globalThis.fetch))return globalThis.fetch;throw Error("No fetch implementation found")})(e.fetch)(n,{method:i_[a],signal:t?.signal,body:r,headers:i})}function iC(e){let t=e.AbortController?new e.AbortController:null,n={};return{promise:new Promise((r,a)=>{iO(e,t).then(e=>(n.response=e,e.json())).then(e=>{n.responseJSON=e,r({json:e,meta:n})}).catch(e=>{a(ig.from(e,{meta:n}))})}),cancel:()=>{t?.abort()}}}function iE(e){return!!e&&!Array.isArray(e)&&"object"==typeof e}class iS extends Error{constructor(){super("Unable to transform response from server")}}function iR(e,t){let n;try{n=function(e,t){if("error"in e){let n=t.transformer.deserialize(e.error);return{ok:!1,error:{...e,error:n}}}return{ok:!0,result:{...e.result,...(!e.result.type||"data"===e.result.type)&&{type:"data",data:t.transformer.deserialize(e.result.data)}}}}(e,t)}catch(e){throw new iS}if(!n.ok&&(!iE(n.error.error)||"number"!=typeof n.error.error.code)||n.ok&&!iE(n.result))throw new iS;return n}let ij=()=>{throw Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function iA(e){let t=null,n=null,r=()=>{clearTimeout(n),n=null,t=null};function a(){let n=function(t){let n=[[]],r=0;for(;;){let a=t[r];if(!a)break;let s=n[n.length-1];if(a.aborted){a.reject?.(Error("Aborted")),r++;continue}if(e.validate(s.concat(a).map(e=>e.key))){s.push(a),r++;continue}if(0===s.length){a.reject?.(Error("Input is too big for a single dispatch")),r++;continue}n.push([])}return n}(t);for(let t of(r(),n)){if(!t.length)continue;let n={items:t,cancel:ij};for(let e of t)e.batch=n;let r=(e,t)=>{let r=n.items[e];r.resolve?.(t),r.batch=null,r.reject=null,r.resolve=null},{promise:a,cancel:s}=e.fetch(n.items.map(e=>e.key),r);n.cancel=s,a.then(e=>{for(let t=0;t<e.length;t++){let n=e[t];r(t,n)}for(let e of n.items)e.reject?.(Error("Missing result")),e.batch=null}).catch(e=>{for(let t of n.items)t.reject?.(e),t.batch=null})}}return{load:function(e){let r={aborted:!1,key:e,batch:null,resolve:ij,reject:ij},s=new Promise((e,n)=>{r.reject=n,r.resolve=e,t||(t=[]),t.push(r)});return n||(n=setTimeout(a)),{promise:s,cancel:()=>{r.aborted=!0,r.batch?.items.every(e=>e.aborted)&&(r.batch.cancel(),r.batch=null)}}}}}function iN(e){return function(t){let n=iw(t),r=t.maxURLLength??1/0;return a=>{let s=s=>({validate:e=>{if(r===1/0)return!0;let t=e.map(e=>e.path).join(","),i=e.map(e=>e.input);return iT({...n,runtime:a,type:s,path:t,inputs:i}).length<=r},fetch:e({...n,runtime:a,type:s,opts:t})}),i=iA(s("query")),o=iA(s("mutation")),u={query:i,subscription:iA(s("subscription")),mutation:o};return({op:e})=>ih(t=>{let n;let{promise:r,cancel:s}=u[e.type].load(e);return r.then(e=>{n=e;let r=iR(e.json,a);if(!r.ok){t.error(ig.from(r.error,{meta:e.meta}));return}t.next({context:e.meta,result:r.result}),t.complete()}).catch(e=>{t.error(ig.from(e,{meta:n?.meta}))}),()=>{s()}})}}}let i$=iN(e=>t=>{let n=t.map(e=>e.path).join(","),r=t.map(e=>e.input),{promise:a,cancel:s}=iI({...e,path:n,inputs:r,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:t}):e.opts.headers:{}});return{promise:a.then(e=>(Array.isArray(e.json)?e.json:t.map(()=>e.json)).map(t=>({meta:e.meta,json:t}))),cancel:s}});function iP(e){return t=>{let n=iw(t);return r=>({op:a})=>ih(s=>{let i;let{path:o,input:u,type:l}=a,{promise:c,cancel:d}=e.requester({...n,runtime:r,type:l,path:o,input:u,headers:()=>t.headers?"function"==typeof t.headers?t.headers({op:a}):t.headers:{}});return c.then(e=>{i=e.meta;let t=iR(e.json,r);if(!t.ok){s.error(ig.from(t.error,{meta:i}));return}s.next({context:e.meta,result:t.result}),s.complete()}).catch(e=>{s.error(ig.from(e,{meta:i}))}),()=>{d()}})}}iP({requester:iI});class iF extends Error{constructor(e){super(e),this.name="TRPCWebSocketClosedError",Object.setPrototypeOf(this,iF.prototype)}}class iM{$request({type:e,input:t,path:n,context:r={}}){var a;return(a={links:this.links,op:{id:++this.requestId,type:e,path:n,input:t,context:r}},ih(e=>(function e(t=0,n=a.op){let r=a.links[t];if(!r)throw Error("No more links to execute - did you forget to add an ending link?");return r({op:n,next:n=>e(t+1,n)})})().subscribe(e))).pipe(e=>{let t=0,n=null,r=[];return{subscribe:a=>(t++,r.push(a),n||(n=e.subscribe({next(e){for(let t of r)t.next?.(e)},error(e){for(let t of r)t.error?.(e)},complete(){for(let e of r)e.complete?.()}})),{unsubscribe(){t--,function(){if(0===t&&n){let e=n;n=null,e.unsubscribe()}}();let e=r.findIndex(e=>e===a);e>-1&&r.splice(e,1)}})}})}requestAsPromise(e){var t;let n;let{promise:r,abort:a}=(t=this.$request(e),{promise:new Promise((e,r)=>{let a=!1;function s(){a||(a=!0,r(new ib("This operation was aborted.")),i.unsubscribe())}let i=t.subscribe({next(t){a=!0,e(t),s()},error(e){a=!0,r(e),s()},complete(){a=!0,s()}});n=s}),abort:n});return new Promise((t,n)=>{e.signal?.addEventListener("abort",a),r.then(e=>{t(e.result.data)}).catch(e=>{n(ig.from(e))})})}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n?.context}).subscribe({next(e){"started"===e.result.type?n.onStarted?.():"stopped"===e.result.type?n.onStopped?.():n.onData?.(e.result.data)},error(e){n.onError?.(e)},complete(){n.onComplete?.()}})}constructor(e){this.requestId=0;let t=(()=>{let t=e.transformer;return t?"input"in t?e.transformer:{input:t,output:t}:{input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}}})();this.runtime={transformer:{serialize:e=>t.input.serialize(e),deserialize:e=>t.output.deserialize(e)},combinedTransformer:t},this.links=e.links.map(e=>e(this.runtime))}}let iL={query:"query",mutate:"mutation",subscribe:"subscription"},iD=e=>iL[e];async function iZ(e){let t=e.parse??JSON.parse;await iB(e.readableStream,n=>{if(e.signal?.aborted||!n||"}"===n)return;let r=n.indexOf(":"),a=n.substring(2,r-1),s=n.substring(r+1);e.onSingle(Number(a),t(s))},e.textDecoder)}async function iB(e,t,n){let r="",a=e=>{let a=n.decode(e).split("\n");if(1===a.length)r+=a[0];else if(a.length>1){t(r+a[0]);for(let e=1;e<a.length-1;e++)t(a[e]);r=a[a.length-1]}};"getReader"in e?await iz(e,a):await new Promise(t=>{e.on("data",a),e.on("end",t)}),t(r)}async function iz(e,t){let n=e.getReader(),r=await n.read();for(;!r.done;)t(r.value),r=await n.read()}let iU=(e,t)=>{let n=e.AbortController?new e.AbortController:null;return{cancel:()=>n?.abort(),promise:iO({...e,contentTypeHeader:"application/json",batchModeHeader:"stream",getUrl:iT,getBody:ik},n).then(async r=>{if(!r.body)throw Error("Received response without body");let a={response:r};return iZ({readableStream:r.body,onSingle:t,parse:e=>({json:JSON.parse(e),meta:a}),signal:n?.signal,textDecoder:e.textDecoder})})}};iN(e=>{let t=function(e){if(e)return e;if("undefined"!=typeof window&&window.TextDecoder)return new window.TextDecoder;if("undefined"!=typeof globalThis&&globalThis.TextDecoder)return new globalThis.TextDecoder;throw Error("No TextDecoder implementation found")}(e.opts.textDecoder);return(n,r)=>{let a=n.map(e=>e.path).join(","),s=n.map(e=>e.input),{cancel:i,promise:o}=iU({...e,textDecoder:t,path:a,inputs:s,headers:()=>e.opts.headers?"function"==typeof e.opts.headers?e.opts.headers({opList:n}):e.opts.headers:{}},(e,t)=>{r(e,t)});return{promise:o.then(()=>[]),cancel:i}}});let iq=e=>{if("input"in e){if(!(e.input instanceof FormData))throw Error("Input is not FormData");return e.input}};iP({requester:e=>{if("mutation"!==e.type)throw Error("We only handle mutations with formdata");return iC({...e,getUrl:()=>`${e.url}/${e.path}`,getBody:iq})}});var iV=class extends Error{constructor(){super(...arguments),this.name="MUDError"}};let iW=/^(.*)\[([0-9]*)\]$/,iG=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,iH=/^(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 iJ(e,t){if(e.length!==t.length)throw new tv({expectedLength:e.length,givenLength:t.length});let n=[];for(let r=0;r<e.length;r++){let a=e[r],s=t[r];n.push(function e(t,n,r=!1){if("address"===t){if(!(0,tj.U)(n))throw new tR.b({address:n});return(0,tB.vk)(n.toLowerCase(),{size:r?32:null})}if("string"===t)return(0,eh.$G)(n);if("bytes"===t)return n;if("bool"===t)return(0,tB.vk)((0,eh.C4)(n),{size:r?32:1});let a=t.match(iH);if(a){let[e,t,s="256"]=a,i=Number.parseInt(s)/8;return(0,eh.eC)(n,{size:r?32:i,signed:"int"===t})}let s=t.match(iG);if(s){let[e,t]=s;if(Number.parseInt(t)!==(n.length-2)/2)throw new tx({expectedSize:Number.parseInt(t),givenSize:(n.length-2)/2});return(0,tB.vk)(n,{dir:"right",size:r?32:null})}let i=t.match(iW);if(i&&Array.isArray(n)){let[t,r]=i,a=[];for(let t=0;t<n.length;t++)a.push(e(r,n[t],!0));return 0===a.length?"0x":(0,tZ.SM)(a)}throw new tS(t)}(a,s))}return(0,tZ.SM)(n)}var iK=class extends iV{constructor(e){super(`Hex value "${e}" is an odd length (${e.length-2}). It must be an even length.`),this.name="InvalidHexValueError"}},iY=class extends iV{constructor(e){super(`Hex value "${e}" has length of ${e.length-2}, but expected length of 64 for encoded lengths.`),this.name="InvalidHexLengthForEncodedLengthsError"}},iQ=class extends iV{constructor(e,t){super(`Hex value "${t}" has length of ${t.length-2}, but expected length of ${2*nk[e]} for ${e} type.`),this.name="InvalidHexLengthForStaticFieldError"}},iX=class extends iV{constructor(e,t){super(`Hex value "${t}" has length of ${t.length-2}, but expected a multiple of ${2*nk[e]} for ${e}[] type.`),this.name="InvalidHexLengthForArrayFieldError"}},i0=class extends iV{constructor(e,t,n){super(`EncodedLengths "${e}" total bytes length (${t}) did not match the summed length of all field byte lengths (${n}).`),this.name="EncodedLengthsLengthMismatchError"}};function i2(e,t){if(t.length>3&&t.length%2!=0)throw new iK(t);if((t.length-2)/2!==nk[e])throw new iQ(e,t);switch(e){case"uint8":case"uint16":case"uint24":case"uint32":case"uint40":case"uint48":case"uint56":case"uint64":case"uint72":case"uint80":case"uint88":case"uint96":case"uint104":case"uint112":case"uint120":case"uint128":case"uint136":case"uint144":case"uint152":case"uint160":case"uint168":case"uint176":case"uint184":case"uint192":case"uint200":case"uint208":case"uint216":case"uint224":case"uint232":case"uint240":case"uint248":case"uint256":case"int8":case"int16":case"int24":case"int32":case"int40":case"int48":case"int56":case"int64":case"int72":case"int80":case"int88":case"int96":case"int104":case"int112":case"int120":case"int128":case"int136":case"int144":case"int152":case"int160":case"int168":case"int176":case"int184":case"int192":case"int200":case"int208":case"int216":case"int224":case"int232":case"int240":case"int248":case"int256":{let n=(0,tL.y_)(t,{signed:e.startsWith("int")}),r=typeof nT[e];if("number"===r)return Number(n);if("bigint"===r)return n;throw Error(`Unexpected default value type (${r}) for ABI type (${e})`)}case"bytes1":case"bytes2":case"bytes3":case"bytes4":case"bytes5":case"bytes6":case"bytes7":case"bytes8":case"bytes9":case"bytes10":case"bytes11":case"bytes12":case"bytes13":case"bytes14":case"bytes15":case"bytes16":case"bytes17":case"bytes18":case"bytes19":case"bytes20":case"bytes21":case"bytes22":case"bytes23":case"bytes24":case"bytes25":case"bytes26":case"bytes27":case"bytes28":case"bytes29":case"bytes30":case"bytes31":case"bytes32":return t;case"bool":return(0,tL.XA)(t);case"address":return(0,tN.K)(t)}return tK(e,`Unsupported static ABI type: ${e}`)}function i1(e,t){if("bytes"===e)return t;if("string"===e)return(0,tL.rR)(t);if(t.length>3&&t.length%2!=0)throw new iK(t);let n=(t.length-2)/2;switch(e){case"uint8[]":case"uint16[]":case"uint24[]":case"uint32[]":case"uint40[]":case"uint48[]":case"uint56[]":case"uint64[]":case"uint72[]":case"uint80[]":case"uint88[]":case"uint96[]":case"uint104[]":case"uint112[]":case"uint120[]":case"uint128[]":case"uint136[]":case"uint144[]":case"uint152[]":case"uint160[]":case"uint168[]":case"uint176[]":case"uint184[]":case"uint192[]":case"uint200[]":case"uint208[]":case"uint216[]":case"uint224[]":case"uint232[]":case"uint240[]":case"uint248[]":case"uint256[]":case"int8[]":case"int16[]":case"int24[]":case"int32[]":case"int40[]":case"int48[]":case"int56[]":case"int64[]":case"int72[]":case"int80[]":case"int88[]":case"int96[]":case"int104[]":case"int112[]":case"int120[]":case"int128[]":case"int136[]":case"int144[]":case"int152[]":case"int160[]":case"int168[]":case"int176[]":case"int184[]":case"int192[]":case"int200[]":case"int208[]":case"int216[]":case"int224[]":case"int232[]":case"int240[]":case"int248[]":case"int256[]":case"bytes1[]":case"bytes2[]":case"bytes3[]":case"bytes4[]":case"bytes5[]":case"bytes6[]":case"bytes7[]":case"bytes8[]":case"bytes9[]":case"bytes10[]":case"bytes11[]":case"bytes12[]":case"bytes13[]":case"bytes14[]":case"bytes15[]":case"bytes16[]":case"bytes17[]":case"bytes18[]":case"bytes19[]":case"bytes20[]":case"bytes21[]":case"bytes22[]":case"bytes23[]":case"bytes24[]":case"bytes25[]":case"bytes26[]":case"bytes27[]":case"bytes28[]":case"bytes29[]":case"bytes30[]":case"bytes31[]":case"bytes32[]":case"bool[]":case"address[]":{let r=nS(e),a=nk[r];if(n%a!=0)throw new iX(r,t);return Array(n/a).fill(void 0).map((e,n)=>i2(r,(0,tP.p5)(t,n*a,(n+1)*a)))}}return tK(e,`Unsupported dynamic ABI type: ${e}`)}function i3(e){return e.reduce((e,t)=>e+nk[t],0)}function i6(e,t){if("string"==typeof e&&nO.test(e)&&nI(e.replace(nO,""))&&Array.isArray(t)){let n=nS(e);return 0===t.length?"0x":iJ(t.map(()=>n),t)}return iJ([e],[t])}function i4(e,t){var n;return n={staticFields:Object.values(e).filter(nI),dynamicFields:[]},Object.values(t).map((e,t)=>tz([{type:n.staticFields[t]}],[e]))}function i8(e,t){let n,r;let a=Object.entries(e),s=a.filter(([,e])=>nI(e)),i=a.filter(([,e])=>nj(e)),o=s.map(([e,n])=>i6(n,t[e])),u=i.map(([e,n])=>i6(n,t[e])),l=(r=(n=u.map(e7.d).reverse()).reduce((e,t)=>e+BigInt(t),0n),(0,tB.gc)((0,tZ.SM)([...n.map(e=>i6("uint40",e)),i6("uint56",r)]),{size:32,dir:"left"}));return{staticData:(0,tZ.SM)(o),encodedLengths:l,dynamicData:(0,tZ.SM)(u)}}function i9(e){let t=e.staticFields.map(e=>nw.indexOf(e)),n=e.dynamicFields.map(e=>nw.indexOf(e));return`0x${[i3(e.staticFields).toString(16).padStart(4,"0"),e.staticFields.length.toString(16).padStart(2,"0"),e.dynamicFields.length.toString(16).padStart(2,"0"),...t.map(e=>e.toString(16).padStart(2,"0")),...n.map(e=>e.toString(16).padStart(2,"0"))].join("").padEnd(64,"0")}`}function i5(e){return Object.fromEntries(e.key.map(t=>[t,e.schema[t]]))}function i7(e){return Object.fromEntries(Object.entries(e.schema).filter(([t])=>!e.key.includes(t)))}function oe(e){return t1(e,e=>e.type)}var ot=function(e){return rs(e),ri(e)}({namespace:"store",codegen:{storeImportPath:"./src"},userTypes:{ResourceId:{filePath:"./src/ResourceId.sol",type:"bytes32"},FieldLayout:{filePath:"./src/FieldLayout.sol",type:"bytes32"},Schema:{filePath:"./src/Schema.sol",type:"bytes32"}},tables:{StoreHooks:{schema:{tableId:"ResourceId",hooks:"bytes21[]"},key:["tableId"]},Tables:{schema:{tableId:"ResourceId",fieldLayout:"FieldLayout",keySchema:"Schema",valueSchema:"Schema",abiEncodedKeyNames:"bytes",abiEncodedFieldNames:"bytes"},key:["tableId"]},ResourceIds:{schema:{resourceId:"ResourceId",exists:"bool"},key:["resourceId"]},Hooks:{schema:{resourceId:"ResourceId",hooks:"bytes21[]"},key:["resourceId"],codegen:{tableIdArgument:!0},deploy:{disabled:!0}}}}),on=n(41772),or={staticData:"0x",encodedLengths:"0x",dynamicData:"0x"},oa=on("mud:store");async function os(e,{address:t,tableId:n,fromBlock:r,toBlock:a}={}){let s=[nv.map(tp),n??null],i=n?Array.isArray(n)?n:[n]:[],o=t?Array.isArray(t)?t:[t]:[];return oa(`getting store logs for ${i.length?i.map(ni).map(na).join(", "):"all tables"} at ${o.length?o.join(", "):"any address"}`),tH({abi:nv,args:{tableId:n},logs:(await e.request({method:"eth_getLogs",params:[{address:t,topics:s,fromBlock:"bigint"==typeof r?(0,eh.eC)(r):r,toBlock:"bigint"==typeof a?(0,eh.eC)(a):a}]})).map(e=>(0,t4.U)(e)),strict:!0})}oa.log=console.debug.bind(console),on("mud:store").log=console.error.bind(console),(0,tL.y_)((0,eb.w)((0,to.O0)("mud.store")));var oi={disabled:!1,registerWorldFunctions:!0},oo={namespaceLabel:"",openAccess:!0,accessList:[]},ou={root:!1,args:[],artifactPath:void 0},ol={worldInterfaceName:"IWorld",worldgenDirectory:"world",systemLibrariesDirectory:"systems",generateSystemLibraries:!1,worldImportPath:"@latticexyz/world/src"},oc={postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},od={systems:{},tables:{},excludeSystems:[],modules:[],codegen:ol,deploy:oc};function op(e){if(nQ(e)){for(let t of Object.values(e))(function(e,t={}){if("object"!=typeof e||null==e)throw Error(`Expected full system config, got \`${JSON.stringify(e)}\``);if(t.inNamespace&&(nY(e,"label")||nY(e,"namespaceLabel")||nY(e,"namespace")))throw Error("Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.");if(nY(e,"namespaceLabel")&&"string"==typeof e.namespaceLabel&&(!nY(e,"namespace")||"string"!=typeof e.namespace)&&e.namespaceLabel.length>14)throw Error(`System \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${e.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`);if(nY(e,"namespace")&&"string"==typeof e.namespace&&e.namespace.length>14)throw Error(`System \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(nY(e,"name")&&"string"==typeof e.name&&e.name.length>16)throw Error(`System \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`)})(t,{inNamespace:!0});return}throw Error(`Expected system config, received ${JSON.stringify(e)}`)}function oy(e,t,n){return Object.fromEntries(Object.entries(e).map(([e,r])=>{var a;let s,i,o,u,l;return[e,(s=(a={...r,label:e,namespaceLabel:t,namespace:n}).namespaceLabel??oo.namespaceLabel,i=a.namespace??s,o=a.label,l=nr({type:"system",namespace:i,name:u=a.name??o.slice(0,16)}),nX({...a,label:o,namespaceLabel:s,namespace:i,name:u,systemId:l,deploy:nX(a.deploy??{},oi)},oo))]}))}function om(e,t){if(!nQ(e))throw Error(`Expected namespaces config, received ${JSON.stringify(e)}`);let n=nN(e,(e,n)=>[e,function(e,t=n4){let n=rt(e,t),r=oy(e.systems??{},n.label,n.namespace);return{...n,systems:r}}(nX(n,{label:e}),t)]),r=Array.from(tX(Object.values(n),e=>e.namespace).entries()).filter(([,e])=>e.length>1).map(([e])=>e);if(r.length>0)throw Error(`Found namespaces defined more than once in config: ${r.join(", ")}`);return n}var of=function(e){var t,n;let r,a,s,i,o;return function(e){let t=ra(e);if(nY(e,"namespaces")){if(nY(e,"namespace")||nY(e,"tables")||nY(e,"systems"))throw Error("Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.");(function(e,t){if(!nQ(e))throw Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let n of Object.values(e))nY(n,"systems")&&op(n.systems),re(n,t)})(e.namespaces,t)}nY(e,"systems")&&op(e.systems),rs(e)}(e),r=ra(e),a=ri(e),i=rr({namespaces:s=e.namespaces?om(e.namespaces,r):om({[a.namespace]:e},r)}),o=(e.modules??od.modules).map(e=>nX(e,ou)),nX({...a,namespaces:s,tables:i,systems:!a.multipleNamespaces&&e.systems?oy(e.systems,a.namespace,a.namespace):od.systems,excludeSystems:nK(e,"excludeSystems"),codegen:nX(a.codegen,nQ(t=e.codegen)?nX(t,ol):ol),deploy:nQ(n=e.deploy)?nX(n,oc):oc,modules:o},od)}({namespace:"world",codegen:{worldImportPath:"./src",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});function oh(e){let t=[];if("string"==typeof e){let n=e3(e),r=n.length;for(let e=0;e<r;e++)t.push(e1(n[e],{modifiers:eN}))}else{let n=e8(e),r=e.length;for(let a=0;a<r;a++){let r=e[a];if(eS(r))continue;let s=e3(r),i=s.length;for(let e=0;e<i;e++)t.push(e1(s[e],{modifiers:eN,structs:n}))}}if(0===t.length)throw new eZ({params:e});return t}function ob(e){return Object.fromEntries(Object.values(e.namespaces).flatMap(e=>Object.values(e.tables)).map(e=>[e.label,e]))}Object.create,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.prototype.hasOwnProperty;var og={...ob(ot),...ob(of)},ov=(Object.values(og).map(e=>e.tableId),{...og.Tables,keySchema:oe(i5(og.Tables)),valueSchema:oe(i7(og.Tables))});function ow(e){var t,n;let r,a,s;return{eventName:"Store_SetRecord",address:e.address,args:{tableId:ov.tableId,keyTuple:i4(ov.keySchema,{tableId:e.tableId}),...i8(ov.valueSchema,{fieldLayout:(r=Object.values(t=e.valueSchema).filter(nI),a=Object.values(t).filter(nj),s=r.map(e=>nk[e]),`0x${[s.reduce((e,t)=>e+t,0).toString(16).padStart(4,"0"),r.length.toString(16).padStart(2,"0"),a.length.toString(16).padStart(2,"0"),...s.map(e=>e.toString(16).padStart(2,"0"))].join("").padEnd(64,"0")}`),keySchema:i9({staticFields:Object.values(e.keySchema).filter(nI),dynamicFields:[]}),valueSchema:i9({staticFields:Object.values(n=e.valueSchema).filter(nI),dynamicFields:Object.values(n).filter(nj)}),abiEncodedKeyNames:tz(oh("string[]"),[Object.keys(e.keySchema)]),abiEncodedFieldNames:tz(oh("string[]"),[Object.keys(e.valueSchema)])})}}}function o_(e){return[...e.map(ow),...e.flatMap(e=>e.records.map(t=>({eventName:"Store_SetRecord",address:e.address,args:{tableId:e.tableId,keyTuple:i4(oe(i5(e)),t.key),...i8(oe(i7(e)),t.value)}})))]}var ox=t6("mud:store-sync"),oT=t6("mud:store-sync");ox.log=console.debug.bind(console),oT.log=console.error.bind(console);var ok=ox.extend("getSnapshot");async function oI({chainId:e,address:t,filters:n,initialState:r,initialBlockLogs:a,indexerUrl:s}){if(a&&r)throw Error("Only one of initialBlockLogs or initialState should be provided.");if(a)return a;if(r)return{blockNumber:r.blockNumber,logs:o_(r.tables)};if(!s)return;let i=new URL(s).origin,o=function({url:e}){return{getLogs:async t=>{try{let n=encodeURIComponent(JSON.stringify(t)),r=new URL(e).origin,a=await (await fetch(`${r}/api/logs?input=${n}`,{method:"GET"})).json();return a&&"string"==typeof a.blockNumber&&Array.isArray(a.logs)?{ok:{...a,blockNumber:BigInt(a.blockNumber)}}:{error:a}}catch(e){return{error:e}}}}}({url:i}),u=function({url:e}){var t;return t=new iM({transformer:im,links:[i$({url:e})]}),se(e=>t.hasOwnProperty(e)?t[e]:"__untypedClient"===e?t:a7(({path:n,args:r})=>{let a=[e,...n],s=iD(a.pop()),i=a.join(".");return t[s](i,...r)}))}({url:`${i}/trpc`});ok("fetching logs from indexer via get",s);let l=await o.getLogs({chainId:e,address:t,filters:n});if("ok"in l)return l.ok;console.warn(l.error);try{return ok("fetching logs from indexer via trpc",s),await u.getLogs.query({chainId:e,address:t,filters:n})}catch(r){if(r instanceof ig){ok("failed to fetch logs, fetching table records instead",s);let r=await u.findAll.query({chainId:e,address:t,filters:n});return console.warn(`The indexer at ${s} appears to be outdated. Consider upgrading to a recent version for better performance.`),null==r.blockNumber?void 0:{blockNumber:r.blockNumber,logs:o_(r.tables)}}throw r}}async function oO(e){async function t(){if(e.indexerUrl&&e.chainId)return ox("fetching records for",e.table.label,"via indexer from",e.indexerUrl),(await oI({chainId:e.chainId,address:e.worldAddress,indexerUrl:e.indexerUrl,filters:[{tableId:e.table.tableId}]}))?.logs.filter(t=>t.args.tableId===e.table.tableId)??[];{let t=e.client??L({transport:ew(e.rpcUrl)});return ox("fetching records for",e.table.label,"via RPC from",t.transport.url),function(e){let t=e.slice().sort(no),n=new Map;for(let e of t){let t=[e.address,e.args.tableId,e.args.keyTuple.join(",")].join(":");if("Store_SetRecord"===e.eventName)n.delete(t),n.set(t,e);else if("Store_SpliceStaticData"===e.eventName){let r=n.get(t),{staticData:a,encodedLengths:s,dynamicData:i}=r?.args??or,o={...e,eventName:"Store_SetRecord",args:{tableId:e.args.tableId,keyTuple:e.args.keyTuple,staticData:nl(a,e.args.start,(0,e7.d)(e.args.data),e.args.data),encodedLengths:s,dynamicData:i}};n.delete(t),n.set(t,o)}else if("Store_SpliceDynamicData"===e.eventName){let r=n.get(t),{staticData:a,dynamicData:s}=r?.args??or,i={...e,eventName:"Store_SetRecord",args:{tableId:e.args.tableId,keyTuple:e.args.keyTuple,staticData:a,encodedLengths:e.args.encodedLengths,dynamicData:nl(s,e.args.start,e.args.deleteCount,e.args.data)}};n.delete(t),n.set(t,i)}else"Store_DeleteRecord"===e.eventName&&n.delete(t)}return Array.from(n.values())}((await ng({fromBlock:e.fromBlock??0n,toBlock:e.toBlock??await ti(t,ta,"getBlockNumber")({}),maxBlockRange:100000n,getLogs:async({fromBlock:n,toBlock:r})=>os(t,{address:e.worldAddress,fromBlock:n,toBlock:r,tableId:e.table.tableId})})).flatMap(e=>e.logs))}}let n=await t(),r=n.map(t=>(function({table:e,log:t}){var n;let r;let a=oe(i5(e)),s=oe(i7(e)),i=(n=t.args.keyTuple,r=function(e,t){if(e.staticFields.length!==t.length)throw Error(`key tuple length ${t.length} does not match key schema length ${e.staticFields.length}`);return t.map((t,n)=>tV([{type:e.staticFields[n]}],t)[0])}({staticFields:Object.values(a),dynamicFields:[]},n),Object.fromEntries(Object.keys(a).map((e,t)=>[e,r[t]]))),o=function(e,{staticData:t,encodedLengths:n,dynamicData:r}){var a;let s;return a=(0,tZ.SM)([nu(t,0,i3(Object.values(e).filter(nI))),(0,tB.gc)(n,{size:32}),r]),s=function(e,t){let n=[],r=0;e.staticFields.forEach(e=>{let a=nk[e],s=i2(e,nu(t,r,r+a));r+=a,n.push(s)});let a=i3(e.staticFields),s=r;if(s!==a&&console.warn("Decoded static data length does not match value schema's expected static data length. Data may get corrupted. Is `getStaticByteLength` outdated?",{expectedLength:a,actualLength:s,bytesOffset:r}),e.dynamicFields.length>0){let a=function(e){if(66!==e.length)throw new iY(e);let t=i2("uint56",nu(e,25,32)),n=Object.freeze([...i1("uint40[]",nu(e,0,25))].reverse()),r=BigInt(n.reduce((e,t)=>e+t,0));if(r!==t)throw new i0(e,t,r);return{totalByteLength:t,fieldByteLengths:n}}(nu(t,r,r+32));r+=32,e.dynamicFields.forEach((e,s)=>{let i=a.fieldByteLengths[s];if(i>0){let a=i1(e,nu(t,r,r+i));r+=i,n.push(a)}else n.push(nR[e])});let i=r-32-s;BigInt(i)!==a.totalByteLength&&console.warn("Decoded dynamic data length does not match data layout's expected data length. Data may get corrupted. Did the data layout change?",{expectedLength:a.totalByteLength,actualLength:i,bytesOffset:r})}return n}({staticFields:Object.values(e).filter(nI),dynamicFields:Object.values(e).filter(nj)},a),Object.fromEntries(Object.keys(e).map((e,t)=>[e,s[t]]))}(s,t.args);return{...i,...o}})({log:t,table:e.table})),a=n.length>0?n[n.length-1].blockNumber??0n:0n;return ox("found",r.length,"records for table",e.table.label,"at block",a),{records:r,blockNumber:a}}let oC=e=>(0,tP.tP)(tp(e),0,4),oE=JSON.parse('[{"type":"function","name":"batchCall","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallData[]","components":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"batchCallFrom","inputs":[{"name":"systemCalls","type":"tuple[]","internalType":"struct SystemCallFromData[]","components":[{"name":"from","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}]}],"outputs":[{"name":"returnDatas","type":"bytes[]","internalType":"bytes[]"}],"stateMutability":"nonpayable"},{"type":"function","name":"call","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"callFrom","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"callData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"payable"},{"type":"function","name":"creator","inputs":[],"outputs":[{"name":"","type":"address","internalType":"address"}],"stateMutability":"view"},{"type":"function","name":"deleteRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"getDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getDynamicFieldSlice","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"data","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getFieldLayout","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getFieldLength","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"","type":"uint256","internalType":"uint256"}],"stateMutability":"view"},{"type":"function","name":"getKeySchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"keySchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"}],"outputs":[{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"stateMutability":"view"},{"type":"function","name":"getStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"getValueSchema","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"}],"outputs":[{"name":"valueSchema","type":"bytes32","internalType":"Schema"}],"stateMutability":"view"},{"type":"function","name":"grantAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"initialize","inputs":[{"name":"initModule","type":"address","internalType":"contract IModule"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"installRootModule","inputs":[{"name":"module","type":"address","internalType":"contract IModule"},{"name":"encodedArgs","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"popFromDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"byteLengthToPop","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"pushToDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"dataToPush","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespace","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"delegationControlId","type":"bytes32","internalType":"ResourceId"},{"name":"initCallData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerRootFunctionSelector","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"worldFunctionSignature","type":"string","internalType":"string"},{"name":"systemFunctionSignature","type":"string","internalType":"string"}],"outputs":[{"name":"worldFunctionSelector","type":"bytes4","internalType":"bytes4"}],"stateMutability":"nonpayable"},{"type":"function","name":"registerStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystem","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"system","type":"address","internalType":"contract System"},{"name":"publicAccess","type":"bool","internalType":"bool"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"},{"name":"enabledHooksBitmap","type":"uint8","internalType":"uint8"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"registerTable","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"},{"name":"keySchema","type":"bytes32","internalType":"Schema"},{"name":"valueSchema","type":"bytes32","internalType":"Schema"},{"name":"keyNames","type":"string[]","internalType":"string[]"},{"name":"fieldNames","type":"string[]","internalType":"string[]"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"renounceOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"revokeAccess","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"grantee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setDynamicField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setRecord","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"staticData","type":"bytes","internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"setStaticField","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"fieldIndex","type":"uint8","internalType":"uint8"},{"name":"data","type":"bytes","internalType":"bytes"},{"name":"fieldLayout","type":"bytes32","internalType":"FieldLayout"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","internalType":"uint8"},{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"spliceStaticData","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","internalType":"bytes32[]"},{"name":"start","type":"uint48","internalType":"uint48"},{"name":"data","type":"bytes","internalType":"bytes"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"storeVersion","inputs":[],"outputs":[{"name":"version","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"function","name":"transferBalanceToAddress","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toAddress","type":"address","internalType":"address"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferBalanceToNamespace","inputs":[{"name":"fromNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"toNamespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"amount","type":"uint256","internalType":"uint256"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"transferOwnership","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"},{"name":"newOwner","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterDelegation","inputs":[{"name":"delegatee","type":"address","internalType":"address"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterNamespaceDelegation","inputs":[{"name":"namespaceId","type":"bytes32","internalType":"ResourceId"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterStoreHook","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract IStoreHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"unregisterSystemHook","inputs":[{"name":"systemId","type":"bytes32","internalType":"ResourceId"},{"name":"hookAddress","type":"address","internalType":"contract ISystemHook"}],"outputs":[],"stateMutability":"nonpayable"},{"type":"function","name":"worldVersion","inputs":[],"outputs":[{"name":"","type":"bytes32","internalType":"bytes32"}],"stateMutability":"view"},{"type":"event","name":"HelloStore","inputs":[{"name":"storeVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"HelloWorld","inputs":[{"name":"worldVersion","type":"bytes32","indexed":true,"internalType":"bytes32"}],"anonymous":false},{"type":"event","name":"Store_DeleteRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"}],"anonymous":false},{"type":"event","name":"Store_SetRecord","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"staticData","type":"bytes","indexed":false,"internalType":"bytes"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"dynamicData","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceDynamicData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"dynamicFieldIndex","type":"uint8","indexed":false,"internalType":"uint8"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"deleteCount","type":"uint40","indexed":false,"internalType":"uint40"},{"name":"encodedLengths","type":"bytes32","indexed":false,"internalType":"EncodedLengths"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"event","name":"Store_SpliceStaticData","inputs":[{"name":"tableId","type":"bytes32","indexed":true,"internalType":"ResourceId"},{"name":"keyTuple","type":"bytes32[]","indexed":false,"internalType":"bytes32[]"},{"name":"start","type":"uint48","indexed":false,"internalType":"uint48"},{"name":"data","type":"bytes","indexed":false,"internalType":"bytes"}],"anonymous":false},{"type":"error","name":"EncodedLengths_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_Empty","inputs":[]},{"type":"error","name":"FieldLayout_InvalidStaticDataLength","inputs":[{"name":"staticDataLength","type":"uint256","internalType":"uint256"},{"name":"computedStaticDataLength","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthDoesNotFitInAWord","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsNotZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_StaticLengthIsZero","inputs":[{"name":"index","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyDynamicFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"FieldLayout_TooManyFields","inputs":[{"name":"numFields","type":"uint256","internalType":"uint256"},{"name":"maxFields","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Module_AlreadyInstalled","inputs":[]},{"type":"error","name":"Module_MissingDependency","inputs":[{"name":"dependency","type":"address","internalType":"address"}]},{"type":"error","name":"Module_NonRootInstallNotSupported","inputs":[]},{"type":"error","name":"Module_RootInstallNotSupported","inputs":[]},{"type":"error","name":"Schema_InvalidLength","inputs":[{"name":"length","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Schema_StaticTypeAfterDynamicType","inputs":[]},{"type":"error","name":"Slice_OutOfBounds","inputs":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_IndexOutOfBounds","inputs":[{"name":"length","type":"uint256","internalType":"uint256"},{"name":"accessedIndex","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidBounds","inputs":[{"name":"start","type":"uint256","internalType":"uint256"},{"name":"end","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidFieldNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidKeyNamesLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_InvalidSplice","inputs":[{"name":"startWithinField","type":"uint40","internalType":"uint40"},{"name":"deleteCount","type":"uint40","internalType":"uint40"},{"name":"fieldLength","type":"uint40","internalType":"uint40"}]},{"type":"error","name":"Store_InvalidStaticDataLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaDynamicLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_InvalidValueSchemaStaticLength","inputs":[{"name":"expected","type":"uint256","internalType":"uint256"},{"name":"received","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"Store_TableAlreadyExists","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"Store_TableNotFound","inputs":[{"name":"tableId","type":"bytes32","internalType":"ResourceId"},{"name":"tableIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_AccessDenied","inputs":[{"name":"resource","type":"string","internalType":"string"},{"name":"caller","type":"address","internalType":"address"}]},{"type":"error","name":"World_AlreadyInitialized","inputs":[]},{"type":"error","name":"World_CallbackNotAllowed","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_DelegationNotFound","inputs":[{"name":"delegator","type":"address","internalType":"address"},{"name":"delegatee","type":"address","internalType":"address"}]},{"type":"error","name":"World_FunctionSelectorAlreadyExists","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_FunctionSelectorNotFound","inputs":[{"name":"functionSelector","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InsufficientBalance","inputs":[{"name":"balance","type":"uint256","internalType":"uint256"},{"name":"amount","type":"uint256","internalType":"uint256"}]},{"type":"error","name":"World_InterfaceNotSupported","inputs":[{"name":"contractAddress","type":"address","internalType":"address"},{"name":"interfaceId","type":"bytes4","internalType":"bytes4"}]},{"type":"error","name":"World_InvalidNamespace","inputs":[{"name":"namespace","type":"bytes14","internalType":"bytes14"}]},{"type":"error","name":"World_InvalidResourceId","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_InvalidResourceType","inputs":[{"name":"expected","type":"bytes2","internalType":"bytes2"},{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceAlreadyExists","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_ResourceNotFound","inputs":[{"name":"resourceId","type":"bytes32","internalType":"ResourceId"},{"name":"resourceIdString","type":"string","internalType":"string"}]},{"type":"error","name":"World_SystemAlreadyExists","inputs":[{"name":"system","type":"address","internalType":"address"}]},{"type":"error","name":"World_UnlimitedDelegationNotAllowed","inputs":[]}]');async function oS({client:e,worldAddress:t,fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}){ox("looking up function selectors for",t);let{records:i}=await oO({indexerUrl:a,chainId:s,client:e,table:of.namespaces.world.tables.FunctionSelectors,worldAddress:t,fromBlock:n,toBlock:r});ox("found",i.length,"function selectors for",t),ox("looking up function signatures for",t);let{records:o}=await oO({indexerUrl:a,chainId:s,client:e,table:of.namespaces.world.tables.FunctionSignatures,worldAddress:t,fromBlock:n,toBlock:r}),u=Object.fromEntries(o.map(e=>[e.functionSelector,e.functionSignature]));return ox("found",o.length,"function signatures for",t),i.map(({worldFunctionSelector:e,systemFunctionSelector:t,systemId:n})=>({selector:e,signature:u[e],systemFunctionSelector:t,systemFunctionSignature:u[t],systemId:n}))}function oR(e){return"function"===e.type}async function oj({client:e,worldAddress:t,fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}){let i=await oS({client:e,worldAddress:(0,tN.K)(t),fromBlock:n,toBlock:r,indexerUrl:a,chainId:s}),o=oE.filter(oR).map(oC);return[...oE,...i.map(e=>{try{return function(e){let t=function(e){let t;if("string"==typeof e)t=eQ(e);else{let n=e8(e),r=e.length;for(let a=0;a<r;a++){let r=e[a];if(!eS(r)){t=eQ(r,n);break}}}if(!t)throw new eM({signature:e});return t}(`function ${e}`);if("function"!==t.type)throw Error(`Expected function signature, got ${t.type}`);return t}(e.signature)}catch(e){console.error(e)}}).filter(t0).filter(e=>!o.includes(oC(e)))]}var oA=n(20119);let oN="force-dynamic";async function o$(e){return L({chain:oA.df[oA.is[e]],transport:ew()})}function oP(e){let t=oA.df[oA.is[e]];return"indexerUrl"in t?t.indexerUrl:void 0}async function oF(e,t){let n=await o$(e),r=await ti(n,ta,"getBlockNumber")({}),a=await ng({fromBlock:0n,toBlock:r,maxBlockRange:100000n,publicClient:n,address:t,events:e5(["event HelloStore(bytes32 indexed storeVersion)","event HelloWorld(bytes32 indexed worldVersion)"])});return{fromBlock:a[0]?.blockNumber??0n,toBlock:r,isWorldDeployed:a[0]?.logs.length===2}}async function oM(e){let{searchParams:t}=new URL(e.url),n=Number(t.get("chainId")),r=t.get("worldAddress");if(!n||!r)return Response.json({error:"Missing chainId or worldAddress"},{status:400});(0,oA.wG)(n);try{let e=await o$(n),t=oP(n);if(t){let[a,s]=await Promise.all([ts(e,{address:r}),oj({client:e,worldAddress:r,indexerUrl:t,chainId:n})]);return Response.json({abi:s,isWorldDeployed:a&&(0,e7.d)(a)>0})}let{fromBlock:a,toBlock:s,isWorldDeployed:i}=await oF(n,r),o=await oj({client:e,worldAddress:r,fromBlock:a,toBlock:s,indexerUrl:oP(n),chainId:n});return Response.json({abi:o,isWorldDeployed:i})}catch(t){let e=t instanceof Error?t.message:"An unknown error occurred";return Response.json({error:e},{status:400})}}let oL=new N.AppRouteRouteModule({definition:{kind:$.x.APP_ROUTE,page:"/(explorer)/api/world-abi/route",pathname:"/api/world-abi",filename:"route",bundlePath:"app/(explorer)/api/world-abi/route"},resolvedPagePath:"/home/runner/work/mud/mud/packages/explorer/src/app/(explorer)/api/world-abi/route.ts",nextConfigOutput:"standalone",userland:A}),{requestAsyncStorage:oD,staticGenerationAsyncStorage:oZ,serverHooks:oB}=oL,oz="/(explorer)/api/world-abi/route";function oU(){return(0,P.patchFetch)({serverHooks:oB,staticGenerationAsyncStorage:oZ})}},49308:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(48229)(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},48229:(e,t,n)=>{e.exports=function(e){function t(e){let n,a,s;let i=null;function o(...e){if(!o.enabled)return;let r=Number(new Date),a=r-(n||r);o.diff=a,o.prev=n,o.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";s++;let a=t.formatters[r];if("function"==typeof a){let t=e[s];n=a.call(o,t),e.splice(s,1),s--}return n}),t.formatArgs.call(o,e),(o.log||t.log).apply(o,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(a!==t.namespaces&&(a=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(a),...t.skips.map(a).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){let n,r;if("*"===e[e.length-1])return!0;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(26469),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},3741:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||process.__nwjs?e.exports=n(49308):e.exports=n(61341)},61341:(e,t,n)=>{let r=n(76224),a=n(73837);t.init=function(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(a.format(...e)+"\n")},t.formatArgs=function(n){let{namespace:r,useColors:a}=this;if(a){let t=this.color,a="\x1b[3"+(t<8?t:"8;5;"+t),s=` ${a};1m${r} \u001B[0m`;n[0]=s+n[0].split("\n").join("\n"+s),n.push(a+"m+"+e.exports.humanize(this.diff)+"\x1b[0m")}else n[0]=(t.inspectOpts.hideDate?"":new Date().toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)},t.destroy=a.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=n(86046);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e},{}),e.exports=n(48229)(t);let{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}},22569:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r))}),t.splice(a,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){let e;return"undefined"!=typeof window&&!!window.process&&("renderer"===window.process.type||!!window.process.__nwjs)||!("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(69550)(t);let{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},69550:(e,t,n)=>{e.exports=function(e){function t(e){let n,a,s;let i=null;function o(...e){if(!o.enabled)return;let r=Number(new Date),a=r-(n||r);o.diff=a,o.prev=n,o.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,r)=>{if("%%"===n)return"%";s++;let a=t.formatters[r];if("function"==typeof a){let t=e[s];n=a.call(o,t),e.splice(s,1),s--}return n}),t.formatArgs.call(o,e),(o.log||t.log).apply(o,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(a!==t.namespaces&&(a=t.namespaces,s=t.enabled(e)),s),set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){let r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function a(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){let e=[...t.names.map(a),...t.skips.map(a).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];let r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n<a;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(RegExp("^"+e.slice(1)+"$")):t.names.push(RegExp("^"+e+"$")))},t.enabled=function(e){let n,r;if("*"===e[e.length-1])return!0;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(22677),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},41772:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||process.__nwjs?e.exports=n(22569):e.exports=n(89294)},89294:(e,t,n)=>{let r=n(76224),a=n(73837);t.init=function(e){e.inspectOpts={};let n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(a.formatWithOptions(t.inspectOpts,...e)+"\n")},t.formatArgs=function(n){let{namespace:r,useColors:a}=this;if(a){let t=this.color,a="\x1b[3"+(t<8?t:"8;5;"+t),s=` ${a};1m${r} \u001B[0m`;n[0]=s+n[0].split("\n").join("\n"+s),n.push(a+"m+"+e.exports.humanize(this.diff)+"\x1b[0m")}else n[0]=(t.inspectOpts.hideDate?"":new Date().toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?!!t.inspectOpts.colors:r.isatty(process.stderr.fd)},t.destroy=a.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let e=n(86046);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e},{}),e.exports=n(69550)(t);let{formatters:s}=e.exports;s.o=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},s.O=function(e){return this.inspectOpts.colors=this.useColors,a.inspect(e,this.inspectOpts)}},94335:e=>{"use strict";var t=Object.prototype.hasOwnProperty,n="~";function r(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,i){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new a(r,s||e,i),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],o]:e._events[u].push(o):(e._events[u]=o,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1)),o.prototype.eventNames=function(){var e,r,a=[];if(0===this._eventsCount)return a;for(r in e=this._events)t.call(e,r)&&a.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(e)):a},o.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var a=0,s=r.length,i=Array(s);a<s;a++)i[a]=r[a].fn;return i},o.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,a,s,i){var o=n?n+e:e;if(!this._events[o])return!1;var u,l,c=this._events[o],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,r),!0;case 4:return c.fn.call(c.context,t,r,a),!0;case 5:return c.fn.call(c.context,t,r,a,s),!0;case 6:return c.fn.call(c.context,t,r,a,s,i),!0}for(l=1,u=Array(d-1);l<d;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var p,y=c.length;for(l=0;l<y;l++)switch(c[l].once&&this.removeListener(e,c[l].fn,void 0,!0),d){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,t);break;case 3:c[l].fn.call(c[l].context,t,r);break;case 4:c[l].fn.call(c[l].context,t,r,a);break;default:if(!u)for(p=1,u=Array(d-1);p<d;p++)u[p-1]=arguments[p];c[l].fn.apply(c[l].context,u)}}return!0},o.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},o.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},o.prototype.removeListener=function(e,t,r,a){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return i(this,s),this;var o=this._events[s];if(o.fn)o.fn!==t||a&&!o.once||r&&o.context!==r||i(this,s);else{for(var u=0,l=[],c=o.length;u<c;u++)(o[u].fn!==t||a&&!o[u].once||r&&o[u].context!==r)&&l.push(o[u]);l.length?this._events[s]=1===l.length?l[0]:l:i(this,s)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&i(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=n,o.EventEmitter=o,e.exports=o},7226:e=>{"use strict";e.exports=(e,t=process.argv)=>{let n=e.startsWith("-")?"":1===e.length?"-":"--",r=t.indexOf(n+e),a=t.indexOf("--");return -1!==r&&(-1===a||r<a)}},26469:e=>{function t(e,t,n,r){return Math.round(e/n)+" "+r+(t>=1.5*n?"s":"")}e.exports=function(e,n){n=n||{};var r,a,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===s&&isFinite(e))return n.long?(r=Math.abs(e))>=864e5?t(e,r,864e5,"day"):r>=36e5?t(e,r,36e5,"hour"):r>=6e4?t(e,r,6e4,"minute"):r>=1e3?t(e,r,1e3,"second"):e+" ms":(a=Math.abs(e))>=864e5?Math.round(e/864e5)+"d":a>=36e5?Math.round(e/36e5)+"h":a>=6e4?Math.round(e/6e4)+"m":a>=1e3?Math.round(e/1e3)+"s":e+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},22677:e=>{function t(e,t,n,r){return Math.round(e/n)+" "+r+(t>=1.5*n?"s":"")}e.exports=function(e,n){n=n||{};var r,a,s=typeof e;if("string"===s&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return 864e5*n;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*n;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*n;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(e);if("number"===s&&isFinite(e))return n.long?(r=Math.abs(e))>=864e5?t(e,r,864e5,"day"):r>=36e5?t(e,r,36e5,"hour"):r>=6e4?t(e,r,6e4,"minute"):r>=1e3?t(e,r,1e3,"second"):e+" ms":(a=Math.abs(e))>=864e5?Math.round(e/864e5)+"d":a>=36e5?Math.round(e/36e5)+"h":a>=6e4?Math.round(e/6e4)+"m":a>=1e3?Math.round(e/1e3)+"s":e+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},50705:(e,t,n)=>{"use strict";e.exports=n(30517)},27147:(e,t,n)=>{n(26711)},26711:(e,t,n)=>{var r=n(84932);t.operation=function(e){return new r(t.timeouts(e),{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(e,t){return e-t}),r},t.createTimeout=function(e,t){return Math.min(Math.round((t.randomize?Math.random()+1:1)*Math.max(t.minTimeout,1)*Math.pow(t.factor,e)),t.maxTimeout)},t.wrap=function(e,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var a in r=[],e)"function"==typeof e[a]&&r.push(a);for(var s=0;s<r.length;s++){var i=r[s],o=e[i];e[i]=(function(r){var a=t.operation(n),s=Array.prototype.slice.call(arguments,1),i=s.pop();s.push(function(e){a.retry(e)||(e&&(arguments[0]=a.mainError()),i.apply(this,arguments))}),a.attempt(function(){r.apply(e,s)})}).bind(e,o),e[i].options=n}}},84932:e=>{function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(void 0===n){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1)}var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],s=a.message,i=(e[s]||0)+1;e[s]=i,i>=n&&(t=a,n=i)}return t}},86046:(e,t,n)=>{"use strict";let r;let a=n(22037),s=n(76224),i=n(7226),{env:o}=process;function u(e,t={}){var n;return 0!==(n=function(e,{streamIsTTY:t,sniffFlags:n=!0}={}){let s=function(){if("FORCE_COLOR"in o)return"true"===o.FORCE_COLOR?1:"false"===o.FORCE_COLOR?0:0===o.FORCE_COLOR.length?1:Math.min(Number.parseInt(o.FORCE_COLOR,10),3)}();void 0!==s&&(r=s);let u=n?r:s;if(0===u)return 0;if(n){if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2}if(e&&!t&&void 0===u)return 0;let l=u||0;if("dumb"===o.TERM)return l;if("win32"===process.platform){let e=a.release().split(".");return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if("CI"in o)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(e=>e in o)||"codeship"===o.CI_NAME?1:l;if("TEAMCITY_VERSION"in o)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0;if("truecolor"===o.COLORTERM)return 3;if("TERM_PROGRAM"in o){let e=Number.parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return e>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||"COLORTERM"in o?1:l}(e,{streamIsTTY:e&&e.isTTY,...t}))&&{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}i("no-color")||i("no-colors")||i("color=false")||i("color=never")?r=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(r=1),e.exports={supportsColor:u,stdout:u({isTTY:s.isatty(1)}),stderr:u({isTTY:s.isatty(2)})}},20119:(e,t,n)=>{"use strict";n.d(t,{is:()=>y,df:()=>p,wG:()=>m});var r=n(89272),a=n(7769),s=n(27094),i=n(18061),o=n(21322);a.t;var u={...s.g,iconUrls:["https://redstone.xyz/chain-icons/redstone.png"],indexerUrl:"https://indexer.mud.redstonechain.com"},l={...i.T,iconUrls:["https://redstone.xyz/chain-icons/garnet.png"],indexerUrl:"https://indexer.mud.garnetchain.com"},c={http:["https://rpc.rhodolitechain.com"],webSocket:["wss://rpc.rhodolitechain.com"]},d={...o.i,name:"Rhodolite Devnet",testnet:!0,id:17420,sourceId:17001,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:c,bundler:c,quarryPassIssuer:c,wiresaw:c},contracts:{...o.i.contracts,quarryPaymaster:{address:"0x61f22c3827d90c390e0e2aaf220971524ac0a68d",blockCreated:11262}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.rhodolitechain.com"},worldsExplorer:{name:"MUD Worlds Explorer",url:"https://explorer.mud.dev/rhodolite/worlds"}},iconUrls:["https://redstone.xyz/chain-icons/rhodolite.png"],indexerUrl:"https://indexer.mud.rhodolitechain.com"};let p={anvil:r.O,rhodolite:d,garnet:l,redstone:u},y=Object.fromEntries(Object.entries(p).map(([e,t])=>[t.id,e]));function m(e){if(!("number"==typeof e&&e in y))throw Error(`Invalid chain ID. Supported chains are: ${Object.keys(y).join(", ")}.`)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var n=e=>t(t.s=e),r=t.X(0,[2031,965],()=>n(33800));module.exports=r})();
|