@nibgate/sdk 0.2.19 → 0.2.20

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.
@@ -1,116 +1,116 @@
1
- var Nibgate=(()=>{var Pp=Object.defineProperty;var vE=Object.getOwnPropertyDescriptor;var EE=Object.getOwnPropertyNames;var AE=Object.prototype.hasOwnProperty;var TE=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t)=>()=>(e&&(t=e(e=0)),t);var sn=(e,t)=>{for(var r in t)Pp(e,r,{get:t[r],enumerable:!0})},PE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of EE(t))!AE.call(e,o)&&o!==r&&Pp(e,o,{get:()=>t[o],enumerable:!(n=vE(t,o))||n.enumerable});return e};var SE=e=>PE(Pp({},"__esModule",{value:!0}),e);function Hi(e,t="gateway"){let r=String(e||"").trim().toLowerCase().replace(/[-\s]+/g,"_");return r==="circle_gateway"||r==="x402"?"gateway":r==="direct_transfer"||r==="wallet_transfer"?"transfer":Qc.includes(r)?r:t}var Qc,Ff=p(()=>{Qc=["gateway","transfer"]});function Ps(e){let t=String(e||"").trim().toLowerCase();return Mi.includes(t)?t:IE[t]||"article"}function Sp(e,t="paid"){let r=String(e||"").trim().toLowerCase();return zi.includes(r)?r:t}function Ss(e={}){if(typeof e=="string"){let t=Sp(e);return{humans:t,agents:t}}return{humans:Sp(e.humans||e.human||e.default,"paid"),agents:Sp(e.agents||e.agent||e.default,"paid")}}function _i(e={}){let t=typeof e=="string"?{mode:e}:e||{},r=String(t.mode||t.type||"one_time").trim().toLowerCase().replace(/[-\s]+/g,"_");return{...t,mode:eu.includes(r)?r:"one_time"}}function Bp(){return typeof window<"u"?window:null}function Ts(e){let t=Bp();if(!t)return"";let r=`meta[name="${e}"], meta[property="${e}"]`,n=t.document.querySelector(r);return n&&n.getAttribute("content")||""}function BE(e){let t=Bp();if(!(!t||!e))return`${t.location.origin}${e.startsWith("/")?e:"/"+e}`}function kE(){return Ts("og:image")||void 0}function CE(){return Ts("og:description")||Ts("description")||void 0}function RE(){let e=Bp();return Ts("og:title")||Ts("twitter:title")||(e?e.document.title:"")||void 0}function $E(){let e=Ts("og:type").toLowerCase();return e.includes("music")||e.includes("audio")||e.includes("song")?"music":e.includes("video")||e.includes("movie")?"video":e.includes("image")||e.includes("photo")?"image":"article"}function NE(){let e=Ts("keywords");if(e)return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).slice(0,8)}function HE(e,t){return t&&typeof t=="object"&&Object.keys(t).length>0?Ss(t):e!=null&&e!==""&&Number.parseFloat(e)>0?{humans:"paid",agents:"paid"}:{humans:"free",agents:"free"}}function we(e={}){let t=typeof e=="string"?{id:e}:e||{},{publisher:r,publisherId:n,publisherWallet:o,publisherHandle:s,publisherName:i,publisherProfileUrl:a,publisherOrigin:c,publisherVerification:u,authorHandle:f,...d}=t,l=t.path||t.route||void 0,m=t.url||BE(l)||void 0,h=t.access,y=t.price??t.amount??"";return{...d,id:String(t.id||t.contentId||t.slug||"").trim(),title:String(t.title||t.name||RE()||"Untitled").trim(),type:Ps(t.type||t.contentType||$E()),price:y,currency:t.currency||"USDC",paymentRail:Hi(t.paymentRail||t.paymentMode||t.rail),recipient:t.recipient||t.receiver||t.receiverAddress||t.payTo||t.creatorWallet||void 0,payTo:t.payTo||t.recipient||t.receiver||t.receiverAddress||t.creatorWallet||void 0,path:l,url:m,imageUrl:t.imageUrl||t.image||kE()||void 0,description:t.description||t.summary||CE()||void 0,tags:t.tags||NE()||void 0,access:HE(y,h),unlock:_i(t.unlock),ratingsEnabled:t.ratingsEnabled??t.enableRatings??t.reputation?.ratingsEnabled??!0,reputation:{...typeof t.reputation=="object"&&t.reputation?t.reputation:{},ratingsEnabled:t.ratingsEnabled??t.enableRatings??t.reputation?.ratingsEnabled??!0}}}function Ip(e){return Array.isArray(e)?e.length>0:e!=null&&String(e).trim()!==""}function ME(e={}){let t=Ss(e.access);return t.humans==="paid"||t.agents==="paid"||Number.parseFloat(e.price||e.amount||"0")>0}function Lf(e={},t={}){let r=we(e),n=[],o=[],s=t.required||["id","type"],i=t.recommended||["title","url","description","imageUrl","tags"];for(let c of s)Ip(r[c])||o.push(`Missing required content metadata: ${c}`);for(let c of i)Ip(r[c])||n.push(`Missing recommended discovery metadata: ${c}`);Mi.includes(r.type)||o.push("Content type must be one of music, video, article, or image."),r.url&&!/^https?:\/\//i.test(String(r.url))&&n.push("Use an absolute canonical url for stronger discovery identity."),r.imageUrl&&!/^https?:\/\//i.test(String(r.imageUrl))&&n.push("Use an absolute imageUrl for thumbnails in Explore and agent discovery."),ME(r)&&(Ip(r.price)||o.push("Paid content requires price."));let a=Math.max(0,100-o.length*20-n.length*8);return{ok:o.length===0,score:a,errors:o,warnings:n,resource:r}}var Mi,IE,zi,eu,_t=p(()=>{Ff();Mi=["music","video","article","image"],IE={audio:"music",song:"music",track:"music",album:"music",playlist:"music",photo:"image",picture:"image",illustration:"image",art:"image",movie:"video",clip:"video"},zi=["free","paid","blocked"],eu=["one_time","metered_stream","metered_read","time_pass","agent_quota"]});function fe(){return typeof window>"u"?null:window}var Is=p(()=>{});function zE(e,t){let r=fe();return r?(r.__nibgateClientQueue=r.__nibgateClientQueue||[],r.__nibgateClientQueue.push({eventName:e,payload:t}),!0):!1}function Of(){let e=fe();if(!e?.nibgateHub?.track||!Array.isArray(e.__nibgateClientQueue))return!1;let t=e.__nibgateClientQueue.splice(0);return t.forEach(r=>{e.nibgateHub.track(r.eventName,r.payload)}),t.length>0}function _E(){let e=fe();if(!e||e.__nibgateClientFlushStarted)return;e.__nibgateClientFlushStarted=!0;let t=0,r=e.setInterval(()=>{t+=1,Of(),(e.nibgateHub?.track||t>=80)&&(e.clearInterval(r),e.__nibgateClientFlushStarted=!1)},250)}function er(e,t={}){let r=fe();return r?r.nibgateHub?.track?(r.nibgateHub.track(e,t),Of(),!0):(zE(e,t),_E(),!1):!1}function hr(e,t={}){return{...t,resource:we(e)}}var Ui=p(()=>{Is();_t()});function kp(e){return`nibgate:unlock:${e.id||e.path||e.url||"content"}`}function Cp(e){return`nibgate:payment-proof:${e.id||e.path||e.url||"content"}`}function Df(e,t={}){let r=fe();if(!r)return!1;try{return r.localStorage.setItem(kp(e),JSON.stringify({unlockedAt:new Date().toISOString(),payment:t})),!0}catch{return!1}}function Rp(e,t){let r=fe();if(!r||!t)return!1;try{let n=typeof t=="string"?t:JSON.stringify(t);return r.localStorage.setItem(Cp(e),n),!0}catch{return!1}}function $p(e){let t=fe();if(!t)return"";try{return t.localStorage.getItem(Cp(e))||""}catch{return""}}function Rb(e){let t=we(e),r=fe();if(!r)return!1;try{return r.localStorage.removeItem(Cp(t)),r.localStorage.removeItem(kp(t)),!0}catch{return!1}}function $b(e){let t=fe();if(!t)return!1;try{return!!t.localStorage.getItem(kp(e))}catch{return!1}}var qf=p(()=>{Is();_t()});function Hb(e){Nb=e}function ct(e,t={}){let r=we(e),n=t.client||Nb;return{resource:r,content(o={}){return n.content(r,o)},view(o={}){return n.view(r,o)},track(o,s={}){return n.track(o,hr(r,s))},unlockStarted(o={}){return n.unlockStarted(r,o)},unlockCompleted(o={}){return Df(r,o),n.unlockCompleted(r,o)},paymentCompleted(o={}){return n.paymentCompleted(r,o)},isUnlocked(){return $b(r)},markUnlocked(o={}){return Df(r,o),n.unlockCompleted(r,o),n.paymentCompleted(r,o),!0},async unlock(o={}){n.unlockStarted(r);let s=typeof o=="function"?await o(r):o;return Df(r,s||{}),n.unlockCompleted(r,s||{}),n.paymentCompleted(r,s||{}),{unlocked:!0,resource:r,payment:s||{}}},rate(o={},s={}){return n.rateResource(r,o,s)}}}var Nb,qn=p(()=>{_t();Ui();qf();Nb=null});function UE(e,t){return typeof t=="bigint"?t.toString():t}function jf(e){return JSON.stringify(e,UE)}var Np=p(()=>{});function nu(e={}){let t=typeof e=="number"?e:e.rating??e.stars??e.ratingValue??e.score,r=Number.parseFloat(t),n=Number.isFinite(r)?Math.max(1,Math.min(50,r<=5?Math.round(r*10):Math.round(r))):null;return{...e,rating:n?n/10:void 0,ratingValue:n||void 0}}function Wf(e,t={},r={}){let n=we(e),s=nu(t).ratingValue||0;return["Nibgate content rating",`site:${r.siteDomain||r.domain||n.siteDomain||n.domain||""}`,`content:${n.externalId||n.id}`,`url:${n.url||r.url||""}`,`rating:${s}`,"I confirm this rating is tied to my unlock/payment proof."].join(`
2
- `)}var Kf=p(()=>{_t()});var _b={};sn(_b,{createCircleGatewayBrowserAdapter:()=>DE});function LE(e){let t=typeof e=="string"?e:jf(e);return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(unescape(encodeURIComponent(t)))}function OE(e){return typeof Buffer<"u"?Buffer.from(e,"base64").toString("utf8"):decodeURIComponent(escape(atob(e)))}async function DE(e={}){let t=e.signer||await e.getSigner?.();if(!t?.address||typeof t.signTypedData!="function")throw new Error("Circle Gateway browser adapter requires an EVM signer with address and signTypedData.");let r=new zb.BatchEvmScheme(t),n=e.network||e.chainId&&`eip155:${e.chainId}`||"eip155:5042002";function o(i){if(i&&typeof i=="object")return i;if(!i||typeof i!="string")throw new Error("Missing PAYMENT-REQUIRED header.");return JSON.parse(OE(i))}function s(i){let a=Array.isArray(i?.accepts)?i.accepts:[],c=a.find(u=>{let f=u.extra||{};return u.network===n&&f.name==="GatewayWalletBatched"&&f.version==="1"&&typeof f.verifyingContract=="string"})||a.find(u=>{let f=u.extra||{};return f.name==="GatewayWalletBatched"&&f.version==="1"&&typeof f.verifyingContract=="string"});if(!c){let u=a.map(d=>d.network).filter(Boolean).join(", ")||"none",f=a.some(d=>{let l=d.extra||{};return l.name==="GatewayWalletBatched"&&l.version==="1"&&typeof l.verifyingContract=="string"});throw new Error(f?`No Circle Gateway batching payment option found for ${n}. Server returned networks: ${u}.`:`The payment challenge is not a Circle Gateway batching challenge. Configure the creator access route with createCircleGatewayServer(...) or createNibgateServer({ paymentMode: 'circle-gateway', network: '${n}' }).`)}return c}return{signer:t,network:n,async pay({paymentRequiredHeader:i,challenge:a}){let c=o(i||a),u=s(c),f=c.x402Version??2,d=await r.createPaymentPayload(f,u),l=LE({...d,resource:c.resource,accepted:u});return{paymentSignature:l,signature:l,metadata:{paymentProvider:"circle-gateway",network:u.network,payer:t.address,recipient:u.payTo||u.recipient,amount:u.amount,currency:u.asset}}}}}var zb,Ub=p(()=>{zb=TE("@circle-fin/x402-batching/client");Np()});var Fb,Lb=p(()=>{Fb="1.2.3"});var Pe,Fi=p(()=>{Lb();Pe=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${Fb}`].join(`
3
- `);super(s),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"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t}}});function Ft(e,t){return e.exec(t)?.groups}var Hp,Mp,Zf,ou=p(()=>{Hp=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Mp=/^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)?$/,Zf=/^\(.+?\).*?$/});function Jf(e){let t=e.type;if(Ob.test(e.type)&&"components"in e){t="(";let r=e.components.length;for(let o=0;o<r;o++){let s=e.components[o];t+=Jf(s),o<r-1&&(t+=", ")}let n=Ft(Ob,e.type);return t+=`)${n?.array||""}`,Jf({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var Ob,Db=p(()=>{ou();Ob=/^tuple(?<array>(\[(\d*)\])*)$/});function Li(e){let t="",r=e.length;for(let n=0;n<r;n++){let o=e[n];t+=Jf(o),n!==r-1&&(t+=", ")}return t}var qb=p(()=>{Db()});function zp(e){return e.type==="function"?`function ${e.name}(${Li(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Li(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Li(e.inputs)})`:e.type==="error"?`error ${e.name}(${Li(e.inputs)})`:e.type==="constructor"?`constructor(${Li(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var jb=p(()=>{qb()});function Vb(e){return Gb.test(e)}function Wb(e){return Ft(Gb,e)}function Zb(e){return Kb.test(e)}function Jb(e){return Ft(Kb,e)}function Xb(e){return Yb.test(e)}function Qb(e){return Ft(Yb,e)}function $r(e){return e1.test(e)}function t1(e){return Ft(e1,e)}function n1(e){return r1.test(e)}function o1(e){return Ft(r1,e)}function i1(e){return s1.test(e)}function a1(e){return Ft(s1,e)}function c1(e){return qE.test(e)}var Gb,Kb,Yb,e1,r1,s1,qE,Oi,u1,Yf,ks=p(()=>{ou();Gb=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Kb=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Yb=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;e1=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;r1=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;s1=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;qE=/^receive\(\) external payable$/;Oi=new Set(["memory","indexed","storage","calldata"]),u1=new Set(["indexed"]),Yf=new Set(["calldata","memory","storage"])});var Cs,Rs,su,iu=p(()=>{Fi();Cs=class extends Pe{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}},Rs=class extends Pe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" 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"})}},su=class extends Pe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}});var $s,Ns,Hs,Ms,zs,_s,Us,Di=p(()=>{Fi();$s=class extends Pe{constructor({param:t}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}},Ns=class extends Pe{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},Hs=class extends Pe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},Ms=class extends Pe{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" 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"})}},zs=class extends Pe{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},_s=class extends Pe{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" 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"})}},Us=class extends Pe{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}});var Lt,Fs,Ls,Xf=p(()=>{Fi();Lt=class extends Pe{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Fs=class extends Pe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Ls=class extends Pe{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}});var Os,_p=p(()=>{Fi();Os=class extends Pe{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}});var Ds,Up=p(()=>{Fi();Ds=class extends Pe{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}});function f1(e,t,r){let n="";if(r)for(let o of Object.entries(r)){if(!o)continue;let s="";for(let i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;n+=`(${o[0]}{${s}})`}return t?`${t}:${e}${n}`:`${e}${n}`}var Qf,d1=p(()=>{Qf=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 au(e,t={}){if(Xb(e))return jE(e,t);if(Zb(e))return GE(e,t);if(Vb(e))return VE(e,t);if(n1(e))return WE(e,t);if(i1(e))return KE(e);if(c1(e))return{type:"receive",stateMutability:"payable"};throw new Fs({signature:e})}function jE(e,t={}){let r=Qb(e);if(!r)throw new Lt({signature:e,type:"function"});let n=Et(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(At(n[a],{modifiers:Yf,structs:t,type:"function"}));let i=[];if(r.returns){let a=Et(r.returns),c=a.length;for(let u=0;u<c;u++)i.push(At(a[u],{modifiers:Yf,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:i}}function GE(e,t={}){let r=Jb(e);if(!r)throw new Lt({signature:e,type:"event"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{modifiers:u1,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}function VE(e,t={}){let r=Wb(e);if(!r)throw new Lt({signature:e,type:"error"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}function WE(e,t={}){let r=o1(e);if(!r)throw new Lt({signature:e,type:"constructor"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}function KE(e){let t=a1(e);if(!t)throw new Lt({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function At(e,t){let r=f1(e,t?.type,t?.structs);if(Qf.has(r))return Qf.get(r);let n=Zf.test(e),o=Ft(n?JE:ZE,e);if(!o)throw new Hs({param:e});if(o.name&&QE(o.name))throw new Ms({param:e,name:o.name});let s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},c,u={};if(n){c="tuple";let d=Et(o.type),l=[],m=d.length;for(let h=0;h<m;h++)l.push(At(d[h],{structs:a}));u={components:l}}else if(o.type in a)c="tuple",u={components:a[o.type]};else if(YE.test(o.type))c=`${o.type}256`;else if(o.type==="address payable")c="address";else if(c=o.type,t?.type!=="struct"&&!Fp(c))throw new su({type:c});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new zs({param:e,type:t?.type,modifier:o.modifier});if(Yf.has(o.modifier)&&!eA(c,!!o.array))throw new _s({param:e,type:t?.type,modifier:o.modifier})}let f={type:`${c}${o.array??""}`,...s,...i,...u};return Qf.set(r,f),f}function Et(e,t=[],r="",n=0){let o=e.trim().length;for(let s=0;s<o;s++){let i=e[s],a=e.slice(s+1);switch(i){case",":return n===0?Et(a,[...t,r.trim()]):Et(a,t,`${r}${i}`,n);case"(":return Et(a,t,`${r}${i}`,n+1);case")":return Et(a,t,`${r}${i}`,n-1);default:return Et(a,t,`${r}${i}`,n)}}if(r==="")return t;if(n!==0)throw new Ds({current:r,depth:n});return t.push(r.trim()),t}function Fp(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Hp.test(e)||Mp.test(e)}function QE(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Hp.test(e)||Mp.test(e)||XE.test(e)}function eA(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var ZE,JE,YE,XE,qs=p(()=>{ou();iu();Di();Xf();Up();d1();ks();ZE=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,JE=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,YE=/^u?int$/;XE=/^(?: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 jn(e){let t={},r=e.length;for(let i=0;i<r;i++){let a=e[i];if(!$r(a))continue;let c=t1(a);if(!c)throw new Lt({signature:a,type:"struct"});let u=c.properties.split(";"),f=[],d=u.length;for(let l=0;l<d;l++){let h=u[l].trim();if(!h)continue;let y=At(h,{type:"struct"});f.push(y)}if(!f.length)throw new Ls({signature:a});t[c.name]=f}let n={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){let[a,c]=o[i];n[a]=m1(c,t)}return n}function m1(e=[],t={},r=new Set){let n=[],o=e.length;for(let s=0;s<o;s++){let i=e[s];if(Zf.test(i.type))n.push(i);else{let c=Ft(tA,i.type);if(!c?.type)throw new Us({abiParameter:i});let{array:u,type:f}=c;if(f in t){if(r.has(f))throw new Os({type:f});n.push({...i,type:`tuple${u??""}`,components:m1(t[f],t,new Set([...r,f]))})}else if(Fp(f))n.push(i);else throw new Rs({type:f})}}return n}var tA,cu=p(()=>{ou();iu();Di();Xf();_p();ks();qs();tA=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/});function qi(e){let t=jn(e),r=[],n=e.length;for(let o=0;o<n;o++){let s=e[o];$r(s)||r.push(au(s,t))}return r}var p1=p(()=>{ks();cu();qs()});function Lp(e){let t;if(typeof e=="string")t=au(e);else{let r=jn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!$r(s)){t=au(s,r);break}}}if(!t)throw new Cs({signature:e});return t}var l1=p(()=>{iu();ks();cu();qs()});function Op(e){let t;if(typeof e=="string")t=At(e,{modifiers:Oi});else{let r=jn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!$r(s)){t=At(s,{modifiers:Oi,structs:r});break}}}if(!t)throw new $s({param:e});return t}var h1=p(()=>{Di();ks();cu();qs()});function Dp(e){let t=[];if(typeof e=="string"){let r=Et(e),n=r.length;for(let o=0;o<n;o++)t.push(At(r[o],{modifiers:Oi}))}else{let r=jn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if($r(s))continue;let i=Et(s),a=i.length;for(let c=0;c<a;c++)t.push(At(i[c],{modifiers:Oi,structs:r}))}}if(t.length===0)throw new Ns({params:e});return t}var y1=p(()=>{Di();ks();cu();qs();qs()});var ed=p(()=>{jb();p1();l1();h1();y1();iu();Di();Xf();Up();_p()});function R(e,t,r){let n=e[t.name];if(typeof n=="function")return n;let o=e[r];return typeof o=="function"?o:s=>t(e,s)}var ee=p(()=>{});function Le(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new ji(e.type);return`${e.name}(${uu(e.inputs,{includeName:t})})`}function uu(e,{includeName:t=!1}={}){return e?e.map(r=>rA(r,{includeName:t})).join(t?", ":","):""}function rA(e,{includeName:t}){return e.type.startsWith("tuple")?`(${uu(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}var an=p(()=>{le()});function O(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var ut=p(()=>{});function J(e){return O(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var et=p(()=>{ut()});var qp,b1=p(()=>{qp="2.54.1"});function x1(e){td=e}function g1(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?g1(e.cause,t):t?null:e}var td,T,V=p(()=>{b1();td={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${qp}`};T=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=td.getDocsUrl?.({...r,docsPath:o}),i=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...td.version?[`Version: ${td.version}`]:[]].join(`
4
- `);super(i,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=qp}walk(t){return g1(this,t)}}});var Gn,Nr,rd,Vn,Tt,Gi,Vi,Wn,Wi,js,Kn,Ki,Zi,Gs,Ot,Zn,Ji,nd,Jn,yr,Hr,Yi,Xi,Yn,ji,Qi,le=p(()=>{an();et();V();Gn=class extends T{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
5
- `),{docsPath:t,name:"AbiConstructorNotFoundError"})}},Nr=class extends T{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
6
- `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}},rd=class extends T{constructor({data:t,size:r}){super([`Data size of ${r} bytes is invalid.`,"Size must be in increments of 32 bytes (size % 32 === 0)."].join(`
7
- `),{metaMessages:[`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeInvalidError"})}},Vn=class extends T{constructor({data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(`
8
- `),{metaMessages:[`Params: (${uu(r,{includeName:!0})})`,`Data: ${t} (${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=t,this.params=r,this.size=n}},Tt=class extends T{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}},Gi=class extends T{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
9
- `),{name:"AbiEncodingArrayLengthMismatchError"})}},Vi=class extends T{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${J(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Wn=class extends T{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
10
- `),{name:"AbiEncodingLengthMismatchError"})}},Wi=class extends T{constructor(t,{docsPath:r}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
11
- `),{docsPath:r,name:"AbiErrorInputsNotFoundError"})}},js=class extends T{constructor(t,{docsPath:r}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
12
- `),{docsPath:r,name:"AbiErrorNotFoundError"})}},Kn=class extends T{constructor(t,{docsPath:r,cause:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
13
- `),{docsPath:r,name:"AbiErrorSignatureNotFoundError",cause:n}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}},Ki=class extends T{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}},Zi=class extends T{constructor(t,{docsPath:r}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
14
- `),{docsPath:r,name:"AbiEventSignatureNotFoundError"})}},Gs=class extends T{constructor(t,{docsPath:r}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
1
+ var Nibgate=(()=>{var Bm=Object.defineProperty;var SE=Object.getOwnPropertyDescriptor;var IE=Object.getOwnPropertyNames;var BE=Object.prototype.hasOwnProperty;var kE=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var m=(e,t)=>()=>(e&&(t=e(e=0)),t);var Nr=(e,t)=>{for(var r in t)Bm(e,r,{get:t[r],enumerable:!0})},CE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of IE(t))!BE.call(e,o)&&o!==r&&Bm(e,o,{get:()=>t[o],enumerable:!(n=SE(t,o))||n.enumerable});return e};var RE=e=>CE(Bm({},"__esModule",{value:!0}),e);function Hi(e,t="gateway"){let r=String(e||"").trim().toLowerCase().replace(/[-\s]+/g,"_");return r==="circle_gateway"||r==="x402"?"gateway":r==="direct_transfer"||r==="wallet_transfer"?"transfer":eu.includes(r)?r:t}var eu,Ff=m(()=>{eu=["gateway","transfer"]});function Ss(e){let t=String(e||"").trim().toLowerCase();return Mi.includes(t)?t:$E[t]||"article"}function km(e,t="paid"){let r=String(e||"").trim().toLowerCase();return zi.includes(r)?r:t}function Is(e={}){if(typeof e=="string"){let t=km(e);return{humans:t,agents:t}}return{humans:km(e.humans||e.human||e.default,"paid"),agents:km(e.agents||e.agent||e.default,"paid")}}function _i(e={}){let t=typeof e=="string"?{mode:e}:e||{},r=String(t.mode||t.type||"one_time").trim().toLowerCase().replace(/[-\s]+/g,"_");return{...t,mode:tu.includes(r)?r:"one_time"}}function Rm(){return typeof window<"u"?window:null}function Ps(e){let t=Rm();if(!t)return"";let r=`meta[name="${e}"], meta[property="${e}"]`,n=t.document.querySelector(r);return n&&n.getAttribute("content")||""}function NE(e){let t=Rm();if(!(!t||!e))return`${t.location.origin}${e.startsWith("/")?e:"/"+e}`}function HE(){return Ps("og:image")||void 0}function ME(){return Ps("og:description")||Ps("description")||void 0}function zE(){let e=Rm();return Ps("og:title")||Ps("twitter:title")||(e?e.document.title:"")||void 0}function _E(){let e=Ps("og:type").toLowerCase();return e.includes("music")||e.includes("audio")||e.includes("song")?"music":e.includes("video")||e.includes("movie")?"video":e.includes("image")||e.includes("photo")?"image":"article"}function UE(){let e=Ps("keywords");if(e)return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).slice(0,8)}function LE(e,t){return t&&typeof t=="object"&&Object.keys(t).length>0?Is(t):e!=null&&e!==""&&Number.parseFloat(e)>0?{humans:"paid",agents:"paid"}:{humans:"free",agents:"free"}}function we(e={}){let t=typeof e=="string"?{id:e}:e||{},{publisher:r,publisherId:n,publisherWallet:o,publisherHandle:s,publisherName:i,publisherProfileUrl:a,publisherOrigin:c,publisherVerification:u,authorHandle:f,...d}=t,l=t.path||t.route||void 0,p=t.url||NE(l)||void 0,h=t.access,y=t.price??t.amount??"";return{...d,id:String(t.id||t.contentId||t.slug||"").trim(),title:String(t.title||t.name||zE()||"Untitled").trim(),type:Ss(t.type||t.contentType||_E()),price:y,currency:t.currency||"USDC",paymentRail:Hi(t.paymentRail||t.paymentMode||t.rail),recipient:t.recipient||t.receiver||t.receiverAddress||t.payTo||t.creatorWallet||void 0,payTo:t.payTo||t.recipient||t.receiver||t.receiverAddress||t.creatorWallet||void 0,path:l,url:p,imageUrl:t.imageUrl||t.image||HE()||void 0,description:t.description||t.summary||ME()||void 0,tags:t.tags||UE()||void 0,access:LE(y,h),unlock:_i(t.unlock),ratingsEnabled:t.ratingsEnabled??t.enableRatings??t.reputation?.ratingsEnabled??!0,reputation:{...typeof t.reputation=="object"&&t.reputation?t.reputation:{},ratingsEnabled:t.ratingsEnabled??t.enableRatings??t.reputation?.ratingsEnabled??!0}}}function Cm(e){return Array.isArray(e)?e.length>0:e!=null&&String(e).trim()!==""}function FE(e={}){let t=Is(e.access);return t.humans==="paid"||t.agents==="paid"||Number.parseFloat(e.price||e.amount||"0")>0}function Of(e={},t={}){let r=we(e),n=[],o=[],s=t.required||["id","type"],i=t.recommended||["title","url","description","imageUrl","tags"];for(let c of s)Cm(r[c])||o.push(`Missing required content metadata: ${c}`);for(let c of i)Cm(r[c])||n.push(`Missing recommended discovery metadata: ${c}`);Mi.includes(r.type)||o.push("Content type must be one of music, video, article, or image."),r.url&&!/^https?:\/\//i.test(String(r.url))&&n.push("Use an absolute canonical url for stronger discovery identity."),r.imageUrl&&!/^https?:\/\//i.test(String(r.imageUrl))&&n.push("Use an absolute imageUrl for thumbnails in Explore and agent discovery."),FE(r)&&(Cm(r.price)||o.push("Paid content requires price."));let a=Math.max(0,100-o.length*20-n.length*8);return{ok:o.length===0,score:a,errors:o,warnings:n,resource:r}}var Mi,$E,zi,tu,_t=m(()=>{Ff();Mi=["music","video","article","image"],$E={audio:"music",song:"music",track:"music",album:"music",playlist:"music",photo:"image",picture:"image",illustration:"image",art:"image",movie:"video",clip:"video"},zi=["free","paid","blocked"],tu=["one_time","metered_stream","metered_read","time_pass","agent_quota"]});function fe(){return typeof window>"u"?null:window}var Bs=m(()=>{});function OE(e,t){let r=fe();return r?(r.__nibgateClientQueue=r.__nibgateClientQueue||[],r.__nibgateClientQueue.push({eventName:e,payload:t}),!0):!1}function Df(){let e=fe();if(!e?.nibgateHub?.track||!Array.isArray(e.__nibgateClientQueue))return!1;let t=e.__nibgateClientQueue.splice(0);return t.forEach(r=>{e.nibgateHub.track(r.eventName,r.payload)}),t.length>0}function DE(){let e=fe();if(!e||e.__nibgateClientFlushStarted)return;e.__nibgateClientFlushStarted=!0;let t=0,r=e.setInterval(()=>{t+=1,Df(),(e.nibgateHub?.track||t>=80)&&(e.clearInterval(r),e.__nibgateClientFlushStarted=!1)},250)}function er(e,t={}){let r=fe();return r?r.nibgateHub?.track?(r.nibgateHub.track(e,t),Df(),!0):(OE(e,t),DE(),!1):!1}function hr(e,t={}){return{...t,resource:we(e)}}var Ui=m(()=>{Bs();_t()});function $m(e){return`nibgate:unlock:${e.id||e.path||e.url||"content"}`}function Nm(e){return`nibgate:payment-proof:${e.id||e.path||e.url||"content"}`}function qf(e,t={}){let r=fe();if(!r)return!1;try{return r.localStorage.setItem($m(e),JSON.stringify({unlockedAt:new Date().toISOString(),payment:t})),!0}catch{return!1}}function Hm(e,t){let r=fe();if(!r||!t)return!1;try{let n=typeof t=="string"?t:JSON.stringify(t);return r.localStorage.setItem(Nm(e),n),!0}catch{return!1}}function Mm(e){let t=fe();if(!t)return"";try{return t.localStorage.getItem(Nm(e))||""}catch{return""}}function Ub(e){let t=we(e),r=fe();if(!r)return!1;try{return r.localStorage.removeItem(Nm(t)),r.localStorage.removeItem($m(t)),!0}catch{return!1}}function Lb(e){let t=fe();if(!t)return!1;try{return!!t.localStorage.getItem($m(e))}catch{return!1}}var jf=m(()=>{Bs();_t()});function Ob(e){Fb=e}function ct(e,t={}){let r=we(e),n=t.client||Fb;return{resource:r,content(o={}){return n.content(r,o)},view(o={}){return n.view(r,o)},track(o,s={}){return n.track(o,hr(r,s))},unlockStarted(o={}){return n.unlockStarted(r,o)},unlockCompleted(o={}){return qf(r,o),n.unlockCompleted(r,o)},paymentCompleted(o={}){return n.paymentCompleted(r,o)},isUnlocked(){return Lb(r)},markUnlocked(o={}){return qf(r,o),n.unlockCompleted(r,o),n.paymentCompleted(r,o),!0},async unlock(o={}){n.unlockStarted(r);let s=typeof o=="function"?await o(r):o;return qf(r,s||{}),n.unlockCompleted(r,s||{}),n.paymentCompleted(r,s||{}),{unlocked:!0,resource:r,payment:s||{}}},rate(o={},s={}){return n.rateResource(r,o,s)}}}var Fb,jn=m(()=>{_t();Ui();jf();Fb=null});function qE(e,t){return typeof t=="bigint"?t.toString():t}function Gf(e){return JSON.stringify(e,qE)}var zm=m(()=>{});function ks(e,t={}){let r=ct(e,t.gateOptions||{}),n=Of(r.resource,t.validation||{});return(n.warnings.length||n.errors.length)&&t.warn!==!1&&fe()?.console?.warn&&fe().console.warn("Nibgate content metadata needs attention",n),r.content({source:t.source,metadataQuality:{score:n.score,warnings:n.warnings,errors:n.errors},...t.content||{}}),r.view({source:t.source,path:t.path||fe()?.location?.pathname||r.resource.path,referrer:t.referrer??fe()?.document?.referrer??"",...t.view||{}}),r}function Vf(e,t={}){let r=ks(e,t),n=fe();if(!n)return r;let o=typeof t.button=="string"?n.document.querySelector(t.button):t.button,s=typeof t.status=="string"?n.document.querySelector(t.status):t.status,i=t.onStatus||(a=>{s&&(s.textContent=a||"")});return o&&o.addEventListener("click",async()=>{o.disabled=!0;try{await Ut(e,{...t,onStatus:i})}finally{o.disabled=!1}}),r}var Wf=m(()=>{_t();Bs();jn();Li()});async function Ut(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.accessPath||r.resource.accessPath||"/api/nibgate/access",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.checkingMessage||"Checking access route..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"nibgate-access-route"});let s=await fetch(n,{method:t.method||"GET",headers:{accept:"application/json",...Mm(r.resource)?{"x-nibgate-payment-proof":Mm(r.resource)}:{},...t.headers||{}},body:t.body}),i=await s.json().catch(()=>({}));if(s.status===402){if(r.track("payment_challenge_returned",{source:t.source,challenge:i,resource:r.resource}),o(t.challengeMessage||"Payment challenge returned. Continue with checkout."),typeof t.createPaymentSignature=="function"||typeof t.checkout=="function")return ru(e,{...t,challenge:i,paymentRequiredHeader:s.headers.get("PAYMENT-REQUIRED")||s.headers.get("payment-required")||""});if(t.autoPay&&t.payPath){let c=await nu(e,t);return c.ok&&t.retryAfterPay!==!1?Ut(e,{...t,autoPay:!1}):c}return{ok:!1,status:s.status,challenge:i,resource:r.resource,response:s}}if(!s.ok)return o(i.error||t.errorMessage||"Access check failed"),{ok:!1,status:s.status,error:i.error||"Access check failed",payload:i,resource:r.resource,response:s};let a=t.payment||i.payment||null;return a&&(r.unlockCompleted(a),r.paymentCompleted(a)),o(t.successMessage||"Access allowed and Nibgate events emitted."),{ok:!0,status:s.status,payload:i,payment:a,resource:r.resource,response:s}}async function ru(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.accessPath||r.resource.accessPath||"/api/nibgate/access",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.paymentMessage||"Waiting for wallet payment approval..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"wallet-gateway"});let s=t.paymentSignature||"",i=t.memo||"",a=t.payment||{};if(!s){let l=t.paymentRequiredHeader||"",p=t.challenge||null,y=await(t.createPaymentSignature||t.checkout)({resource:r.resource,challenge:p,paymentRequiredHeader:l,accessPath:n});s=y?.paymentSignature||y?.signature||y?.payment||"",i=y?.memo||y?.paymentMemo||"",a=y?.metadata||y?.paymentMetadata||y||{}}if(!s){let l="Wallet did not return a payment signature.";return r.track("payment_failed",{source:t.source,error:l}),o(l),{ok:!1,status:400,error:l,resource:r.resource}}let c=await fetch(n,{method:t.method||"GET",headers:{accept:"application/json","payment-signature":s,...i?{"payment-memo":i}:{},...t.headers||{}}}),u=await c.text(),f={};try{f=u?JSON.parse(u):{}}catch{f={error:u||"Payment verification failed"}}if(!c.ok){let l=f.detail||f.reason||f.invalidReason||f.error||u||"Payment verification failed",p=typeof l=="string"?l:Gf(l);return r.track("payment_failed",{source:t.source,status:c.status,error:p,...a}),o(t.paymentErrorMessage||p),{ok:!1,status:c.status,error:p,payload:f,resource:r.resource,response:c}}let d=f.payment||{paymentProvider:t.paymentProvider||"wallet-gateway",paymentId:s,memo:i,amount:Number(r.resource.price||0),revenue:Number(r.resource.price||0),currency:r.resource.currency||"USDC",...a};return Hm(r.resource,f.unlockProof),r.markUnlocked(d),o(t.paymentSuccessMessage||"Payment verified. Content unlocked."),{ok:!0,status:c.status,payload:f,payment:d,resource:r.resource,response:c}}async function nu(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.payPath||r.resource.payPath||"/api/nibgate/pay",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.paymentMessage||"Starting payment..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"circle-gateway"});let s=await fetch(n,{method:t.payMethod||"POST",headers:{accept:"application/json","content-type":"application/json",...t.payHeaders||{}},body:JSON.stringify({resource:r.resource,...t.payPayload||{}})}),i=await s.json().catch(()=>({}));if(!s.ok||!i.ok)return r.track("payment_failed",{source:t.source,status:s.status,error:i.error||"Payment failed",detail:i.detail||""}),o(i.detail||i.error||t.paymentErrorMessage||"Payment failed."),{ok:!1,status:s.status,payload:i,resource:r.resource,response:s};let a=i.payment||{paymentProvider:t.paymentProvider||"circle-gateway",paymentId:i.paymentId||`nibgate_payment_${Date.now()}`,amount:Number(r.resource.price||0),revenue:Number(r.resource.price||0),currency:r.resource.currency||"USDC"};return Hm(r.resource,i.unlockProof),r.markUnlocked(a),o(t.paymentSuccessMessage||"Payment verified. Content unlocked."),{ok:!0,status:s.status,payload:i,payment:a,resource:r.resource,response:s}}var Li=m(()=>{Ui();jf();zm();jn()});function ou(e={}){let t=typeof e=="number"?e:e.rating??e.stars??e.ratingValue??e.score,r=Number.parseFloat(t),n=Number.isFinite(r)?Math.max(1,Math.min(50,r<=5?Math.round(r*10):Math.round(r))):null;return{...e,rating:n?n/10:void 0,ratingValue:n||void 0}}function Zf(e,t={},r={}){let n=we(e),s=ou(t).ratingValue||0;return["Nibgate content rating",`site:${r.siteDomain||r.domain||n.siteDomain||n.domain||""}`,`content:${n.externalId||n.id}`,`url:${n.url||r.url||""}`,`rating:${s}`,"I confirm this rating is tied to my unlock/payment proof."].join(`
2
+ `)}var Jf=m(()=>{_t()});var jb={};Nr(jb,{createCircleGatewayBrowserAdapter:()=>WE});function GE(e){let t=typeof e=="string"?e:Gf(e);return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(unescape(encodeURIComponent(t)))}function VE(e){return typeof Buffer<"u"?Buffer.from(e,"base64").toString("utf8"):decodeURIComponent(escape(atob(e)))}async function WE(e={}){let t=e.signer||await e.getSigner?.();if(!t?.address||typeof t.signTypedData!="function")throw new Error("Circle Gateway browser adapter requires an EVM signer with address and signTypedData.");let r=new qb.BatchEvmScheme(t),n=e.network||e.chainId&&`eip155:${e.chainId}`||"eip155:5042002";function o(i){if(i&&typeof i=="object")return i;if(!i||typeof i!="string")throw new Error("Missing PAYMENT-REQUIRED header.");return JSON.parse(VE(i))}function s(i){let a=Array.isArray(i?.accepts)?i.accepts:[],c=a.find(u=>{let f=u.extra||{};return u.network===n&&f.name==="GatewayWalletBatched"&&f.version==="1"&&typeof f.verifyingContract=="string"})||a.find(u=>{let f=u.extra||{};return f.name==="GatewayWalletBatched"&&f.version==="1"&&typeof f.verifyingContract=="string"});if(!c){let u=a.map(d=>d.network).filter(Boolean).join(", ")||"none",f=a.some(d=>{let l=d.extra||{};return l.name==="GatewayWalletBatched"&&l.version==="1"&&typeof l.verifyingContract=="string"});throw new Error(f?`No Circle Gateway batching payment option found for ${n}. Server returned networks: ${u}.`:`The payment challenge is not a Circle Gateway batching challenge. Configure the creator access route with createCircleGatewayServer(...) or createNibgateServer({ paymentMode: 'circle-gateway', network: '${n}' }).`)}return c}return{signer:t,network:n,async pay({paymentRequiredHeader:i,challenge:a}){let c=o(i||a),u=s(c),f=c.x402Version??2,d=await r.createPaymentPayload(f,u),l=GE({...d,resource:c.resource,accepted:u});return{paymentSignature:l,signature:l,metadata:{paymentProvider:"circle-gateway",network:u.network,payer:t.address,recipient:u.payTo||u.recipient,amount:u.amount,currency:u.asset}}}}}var qb,Gb=m(()=>{qb=kE("@circle-fin/x402-batching/client");zm()});var Vb,Wb=m(()=>{Vb="1.2.3"});var Pe,Fi=m(()=>{Wb();Pe=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${Vb}`].join(`
3
+ `);super(s),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"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t}}});function Lt(e,t){return e.exec(t)?.groups}var _m,Um,Yf,su=m(()=>{_m=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Um=/^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)?$/,Yf=/^\(.+?\).*?$/});function Xf(e){let t=e.type;if(Kb.test(e.type)&&"components"in e){t="(";let r=e.components.length;for(let o=0;o<r;o++){let s=e.components[o];t+=Xf(s),o<r-1&&(t+=", ")}let n=Lt(Kb,e.type);return t+=`)${n?.array||""}`,Xf({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var Kb,Zb=m(()=>{su();Kb=/^tuple(?<array>(\[(\d*)\])*)$/});function Oi(e){let t="",r=e.length;for(let n=0;n<r;n++){let o=e[n];t+=Xf(o),n!==r-1&&(t+=", ")}return t}var Jb=m(()=>{Zb()});function Lm(e){return e.type==="function"?`function ${e.name}(${Oi(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Oi(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Oi(e.inputs)})`:e.type==="error"?`error ${e.name}(${Oi(e.inputs)})`:e.type==="constructor"?`constructor(${Oi(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var Yb=m(()=>{Jb()});function Qb(e){return Xb.test(e)}function e1(e){return Lt(Xb,e)}function r1(e){return t1.test(e)}function n1(e){return Lt(t1,e)}function s1(e){return o1.test(e)}function i1(e){return Lt(o1,e)}function Hr(e){return a1.test(e)}function c1(e){return Lt(a1,e)}function f1(e){return u1.test(e)}function d1(e){return Lt(u1,e)}function m1(e){return p1.test(e)}function l1(e){return Lt(p1,e)}function h1(e){return KE.test(e)}var Xb,t1,o1,a1,u1,p1,KE,Di,y1,Qf,Cs=m(()=>{su();Xb=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;t1=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;o1=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;a1=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;u1=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;p1=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;KE=/^receive\(\) external payable$/;Di=new Set(["memory","indexed","storage","calldata"]),y1=new Set(["indexed"]),Qf=new Set(["calldata","memory","storage"])});var Rs,$s,iu,au=m(()=>{Fi();Rs=class extends Pe{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}},$s=class extends Pe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" 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"})}},iu=class extends Pe{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}});var Ns,Hs,Ms,zs,_s,Us,Ls,qi=m(()=>{Fi();Ns=class extends Pe{constructor({param:t}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}},Hs=class extends Pe{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},Ms=class extends Pe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},zs=class extends Pe{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" 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"})}},_s=class extends Pe{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},Us=class extends Pe{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" 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"})}},Ls=class extends Pe{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}});var Ft,Fs,Os,ed=m(()=>{Fi();Ft=class extends Pe{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Fs=class extends Pe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Os=class extends Pe{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}});var Ds,Fm=m(()=>{Fi();Ds=class extends Pe{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}});var qs,Om=m(()=>{Fi();qs=class extends Pe{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}});function b1(e,t,r){let n="";if(r)for(let o of Object.entries(r)){if(!o)continue;let s="";for(let i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;n+=`(${o[0]}{${s}})`}return t?`${t}:${e}${n}`:`${e}${n}`}var td,x1=m(()=>{td=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 cu(e,t={}){if(s1(e))return ZE(e,t);if(r1(e))return JE(e,t);if(Qb(e))return YE(e,t);if(f1(e))return XE(e,t);if(m1(e))return QE(e);if(h1(e))return{type:"receive",stateMutability:"payable"};throw new Fs({signature:e})}function ZE(e,t={}){let r=i1(e);if(!r)throw new Ft({signature:e,type:"function"});let n=Et(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(At(n[a],{modifiers:Qf,structs:t,type:"function"}));let i=[];if(r.returns){let a=Et(r.returns),c=a.length;for(let u=0;u<c;u++)i.push(At(a[u],{modifiers:Qf,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:i}}function JE(e,t={}){let r=n1(e);if(!r)throw new Ft({signature:e,type:"event"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{modifiers:y1,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}function YE(e,t={}){let r=e1(e);if(!r)throw new Ft({signature:e,type:"error"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}function XE(e,t={}){let r=d1(e);if(!r)throw new Ft({signature:e,type:"constructor"});let n=Et(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(At(n[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}function QE(e){let t=l1(e);if(!t)throw new Ft({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function At(e,t){let r=b1(e,t?.type,t?.structs);if(td.has(r))return td.get(r);let n=Yf.test(e),o=Lt(n?tA:eA,e);if(!o)throw new Ms({param:e});if(o.name&&oA(o.name))throw new zs({param:e,name:o.name});let s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},c,u={};if(n){c="tuple";let d=Et(o.type),l=[],p=d.length;for(let h=0;h<p;h++)l.push(At(d[h],{structs:a}));u={components:l}}else if(o.type in a)c="tuple",u={components:a[o.type]};else if(rA.test(o.type))c=`${o.type}256`;else if(o.type==="address payable")c="address";else if(c=o.type,t?.type!=="struct"&&!Dm(c))throw new iu({type:c});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new _s({param:e,type:t?.type,modifier:o.modifier});if(Qf.has(o.modifier)&&!sA(c,!!o.array))throw new Us({param:e,type:t?.type,modifier:o.modifier})}let f={type:`${c}${o.array??""}`,...s,...i,...u};return td.set(r,f),f}function Et(e,t=[],r="",n=0){let o=e.trim().length;for(let s=0;s<o;s++){let i=e[s],a=e.slice(s+1);switch(i){case",":return n===0?Et(a,[...t,r.trim()]):Et(a,t,`${r}${i}`,n);case"(":return Et(a,t,`${r}${i}`,n+1);case")":return Et(a,t,`${r}${i}`,n-1);default:return Et(a,t,`${r}${i}`,n)}}if(r==="")return t;if(n!==0)throw new qs({current:r,depth:n});return t.push(r.trim()),t}function Dm(e){return e==="address"||e==="bool"||e==="function"||e==="string"||_m.test(e)||Um.test(e)}function oA(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||_m.test(e)||Um.test(e)||nA.test(e)}function sA(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var eA,tA,rA,nA,js=m(()=>{su();au();qi();ed();Om();x1();Cs();eA=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,tA=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,rA=/^u?int$/;nA=/^(?: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 Gn(e){let t={},r=e.length;for(let i=0;i<r;i++){let a=e[i];if(!Hr(a))continue;let c=c1(a);if(!c)throw new Ft({signature:a,type:"struct"});let u=c.properties.split(";"),f=[],d=u.length;for(let l=0;l<d;l++){let h=u[l].trim();if(!h)continue;let y=At(h,{type:"struct"});f.push(y)}if(!f.length)throw new Os({signature:a});t[c.name]=f}let n={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){let[a,c]=o[i];n[a]=g1(c,t)}return n}function g1(e=[],t={},r=new Set){let n=[],o=e.length;for(let s=0;s<o;s++){let i=e[s];if(Yf.test(i.type))n.push(i);else{let c=Lt(iA,i.type);if(!c?.type)throw new Ls({abiParameter:i});let{array:u,type:f}=c;if(f in t){if(r.has(f))throw new Ds({type:f});n.push({...i,type:`tuple${u??""}`,components:g1(t[f],t,new Set([...r,f]))})}else if(Dm(f))n.push(i);else throw new $s({type:f})}}return n}var iA,uu=m(()=>{su();au();qi();ed();Fm();Cs();js();iA=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/});function ji(e){let t=Gn(e),r=[],n=e.length;for(let o=0;o<n;o++){let s=e[o];Hr(s)||r.push(cu(s,t))}return r}var w1=m(()=>{Cs();uu();js()});function qm(e){let t;if(typeof e=="string")t=cu(e);else{let r=Gn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!Hr(s)){t=cu(s,r);break}}}if(!t)throw new Rs({signature:e});return t}var v1=m(()=>{au();Cs();uu();js()});function jm(e){let t;if(typeof e=="string")t=At(e,{modifiers:Di});else{let r=Gn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!Hr(s)){t=At(s,{modifiers:Di,structs:r});break}}}if(!t)throw new Ns({param:e});return t}var E1=m(()=>{qi();Cs();uu();js()});function Gm(e){let t=[];if(typeof e=="string"){let r=Et(e),n=r.length;for(let o=0;o<n;o++)t.push(At(r[o],{modifiers:Di}))}else{let r=Gn(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(Hr(s))continue;let i=Et(s),a=i.length;for(let c=0;c<a;c++)t.push(At(i[c],{modifiers:Di,structs:r}))}}if(t.length===0)throw new Hs({params:e});return t}var A1=m(()=>{qi();Cs();uu();js();js()});var rd=m(()=>{Yb();w1();v1();E1();A1();au();qi();ed();Om();Fm()});function $(e,t,r){let n=e[t.name];if(typeof n=="function")return n;let o=e[r];return typeof o=="function"?o:s=>t(e,s)}var ee=m(()=>{});function Fe(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Gi(e.type);return`${e.name}(${fu(e.inputs,{includeName:t})})`}function fu(e,{includeName:t=!1}={}){return e?e.map(r=>aA(r,{includeName:t})).join(t?", ":","):""}function aA(e,{includeName:t}){return e.type.startsWith("tuple")?`(${fu(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}var cn=m(()=>{le()});function O(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var ut=m(()=>{});function J(e){return O(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var et=m(()=>{ut()});var Vm,T1=m(()=>{Vm="2.54.1"});function P1(e){nd=e}function S1(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?S1(e.cause,t):t?null:e}var nd,T,W=m(()=>{T1();nd={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${Vm}`};T=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=nd.getDocsUrl?.({...r,docsPath:o}),i=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...nd.version?[`Version: ${nd.version}`]:[]].join(`
4
+ `);super(i,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=Vm}walk(t){return S1(this,t)}}});var Vn,Mr,od,Wn,Tt,Vi,Wi,Kn,Ki,Gs,Zn,Zi,Ji,Vs,Ot,Jn,Yi,sd,Yn,yr,zr,Xi,Qi,Xn,Gi,ea,le=m(()=>{cn();et();W();Vn=class extends T{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
5
+ `),{docsPath:t,name:"AbiConstructorNotFoundError"})}},Mr=class extends T{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
6
+ `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}},od=class extends T{constructor({data:t,size:r}){super([`Data size of ${r} bytes is invalid.`,"Size must be in increments of 32 bytes (size % 32 === 0)."].join(`
7
+ `),{metaMessages:[`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeInvalidError"})}},Wn=class extends T{constructor({data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(`
8
+ `),{metaMessages:[`Params: (${fu(r,{includeName:!0})})`,`Data: ${t} (${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=t,this.params=r,this.size=n}},Tt=class extends T{constructor({cause:t}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:t})}},Vi=class extends T{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
9
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}},Wi=class extends T{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${J(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Kn=class extends T{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
10
+ `),{name:"AbiEncodingLengthMismatchError"})}},Ki=class extends T{constructor(t,{docsPath:r}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
11
+ `),{docsPath:r,name:"AbiErrorInputsNotFoundError"})}},Gs=class extends T{constructor(t,{docsPath:r}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
12
+ `),{docsPath:r,name:"AbiErrorNotFoundError"})}},Zn=class extends T{constructor(t,{docsPath:r,cause:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
13
+ `),{docsPath:r,name:"AbiErrorSignatureNotFoundError",cause:n}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}},Zi=class extends T{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}},Ji=class extends T{constructor(t,{docsPath:r}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
14
+ `),{docsPath:r,name:"AbiEventSignatureNotFoundError"})}},Vs=class extends T{constructor(t,{docsPath:r}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
15
15
  `),{docsPath:r,name:"AbiEventNotFoundError"})}},Ot=class extends T{constructor(t,{docsPath:r}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
16
- `),{docsPath:r,name:"AbiFunctionNotFoundError"})}},Zn=class extends T{constructor(t,{docsPath:r}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
17
- `),{docsPath:r,name:"AbiFunctionOutputsNotFoundError"})}},Ji=class extends T{constructor(t,{docsPath:r}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
18
- `),{docsPath:r,name:"AbiFunctionSignatureNotFoundError"})}},nd=class extends T{constructor(t,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Le(t.abiItem)}\`, and`,`\`${r.type}\` in \`${Le(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},Jn=class extends T{constructor({expectedSize:t,givenSize:r}){super(`Expected bytes${t}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}},yr=class extends T{constructor({abiItem:t,data:r,params:n,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
19
- `),{metaMessages:[`Params: (${uu(n,{includeName:!0})})`,`Data: ${r} (${o} 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=t,this.data=r,this.params=n,this.size=o}},Hr=class extends T{constructor({abiItem:t,param:r}){super([`Expected a topic for indexed event parameter${r.name?` "${r.name}"`:""} on event "${Le(t,{includeName:!0})}".`].join(`
20
- `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}},Yi=class extends T{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
21
- `),{docsPath:r,name:"InvalidAbiEncodingType"})}},Xi=class extends T{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
22
- `),{docsPath:r,name:"InvalidAbiDecodingType"})}},Yn=class extends T{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
23
- `),{name:"InvalidArrayError"})}},ji=class extends T{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
24
- `),{name:"InvalidDefinitionTypeError"})}},Qi=class extends T{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}});var ea,jp=p(()=>{V();ea=class extends T{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}});var Vs,Ws,fu,du=p(()=>{V();Vs=class extends T{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},Ws=class extends T{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}},fu=class extends T{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${t} ${n} long.`,{name:"InvalidBytesLengthError"})}}});function tt(e,{dir:t,size:r=32}={}){return typeof e=="string"?Pt(e,{dir:t,size:r}):Gp(e,{dir:t,size:r})}function Pt(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new Ws({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Gp(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new Ws({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let o=0;o<r;o++){let s=t==="right";n[s?o:r-o-1]=e[s?o:e.length-o-1]}return n}var Xn=p(()=>{du()});var Mr,ta,ra,na,oa,sa,Ks=p(()=>{V();Mr=class extends T{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},ta=class extends T{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},ra=class extends T{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},na=class extends T{constructor(t){super(`Hex value "${t}" is an odd length (${t.length}). It must be an even length.`,{name:"InvalidHexValueError"})}},oa=class extends T{constructor({limit:t}){super(`RLP depth limit of \`${t}\` exceeded.`,{name:"RlpDepthLimitExceededError"})}},sa=class extends T{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function he(e,{dir:t="left"}={}){let r=typeof e=="string"?e.replace("0x",""):e,n=0;for(let o=0;o<r.length-1&&r[t==="left"?o:r.length-o-1].toString()==="0";o++)n++;return r=t==="left"?r.slice(n):r.slice(0,r.length-n),typeof e=="string"?(r.length===1&&t==="right"&&(r=`${r}0`),`0x${r.length%2===1?`0${r}`:r}`):r}var cn=p(()=>{});function ft(e,{size:t}){if(J(e)>t)throw new sa({givenSize:J(e),maxSize:t})}function Vp(e,t){let r=typeof t=="string"?{to:t}:t,n=r.to;return n==="number"?Z(e,r):n==="bigint"?j(e,r):n==="string"?od(e,r):n==="boolean"?ia(e,r):re(e,r)}function j(e,t={}){let{signed:r}=t;t.size&&ft(e,{size:t.size});let n=BigInt(e);if(!r)return n;let o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function ia(e,t={}){let r=e;if(t.size&&(ft(r,{size:t.size}),r=he(r)),he(r)==="0x00")return!1;if(he(r)==="0x01")return!0;throw new ra(r)}function Z(e,t={}){let r=j(e,t),n=Number(r);if(!Number.isSafeInteger(n))throw new Mr({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${r}n`});return n}function od(e,t={}){let r=re(e);return t.size&&(ft(r,{size:t.size}),r=he(r,{dir:"right"})),new TextDecoder().decode(r)}var ve=p(()=>{Ks();et();cn();ue()});function pe(e,t={}){return typeof e=="number"||typeof e=="bigint"?I(e,t):typeof e=="string"?tr(e,t):typeof e=="boolean"?Zs(e,t):K(e,t)}function Zs(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{size:t.size})):r}function K(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=nA[e[o]];let n=`0x${r}`;return typeof t.size=="number"?(ft(n,{size:t.size}),tt(n,{dir:"right",size:t.size})):n}function I(e,t={}){let{signed:r,size:n}=t,o=BigInt(e),s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<i){let c=typeof e=="bigint"?"n":"";throw new Mr({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:r,size:n,value:`${e}${c}`})}let a=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?tt(a,{size:n}):a}function tr(e,t={}){let r=oA.encode(e);return K(r,t)}var nA,oA,L=p(()=>{Ks();Xn();ve();nA=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));oA=new TextEncoder});function Ee(e,t={}){return typeof e=="number"||typeof e=="bigint"?Kp(e,t):typeof e=="boolean"?Wp(e,t):O(e)?re(e,t):Dt(e,t)}function Wp(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{size:t.size})):r}function w1(e){if(e>=un.zero&&e<=un.nine)return e-un.zero;if(e>=un.A&&e<=un.F)return e-(un.A-10);if(e>=un.a&&e<=un.f)return e-(un.a-10)}function re(e,t={}){let r=e;t.size&&(ft(r,{size:t.size}),r=tt(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let o=n.length/2,s=new Uint8Array(o);for(let i=0,a=0;i<o;i++){let c=w1(n.charCodeAt(a++)),u=w1(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new T(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);s[i]=c*16+u}return s}function Kp(e,t){let r=I(e,t);return re(r)}function Dt(e,t={}){let r=sA.encode(e);return typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{dir:"right",size:t.size})):r}var sA,un,ue=p(()=>{V();ut();Xn();ve();L();sA=new TextEncoder;un={zero:48,nine:57,A:65,F:70,a:97,f:102}});function iA(e,t=!1){return t?{h:Number(e&sd),l:Number(e>>v1&sd)}:{h:Number(e>>v1&sd)|0,l:Number(e&sd)|0}}function E1(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let s=0;s<r;s++){let{h:i,l:a}=iA(e[s],t);[n[s],o[s]]=[i,a]}return[n,o]}var sd,v1,A1,T1,P1,S1,I1=p(()=>{sd=BigInt(4294967295),v1=BigInt(32);A1=(e,t,r)=>e<<r|t>>>32-r,T1=(e,t,r)=>t<<r|e>>>32-r,P1=(e,t,r)=>t<<r-32|e>>>64-r,S1=(e,t,r)=>e<<r-32|t>>>64-r});var Js,B1=p(()=>{Js=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function aA(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Ys(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function zr(e,...t){if(!aA(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function k1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Ys(e.outputLen),Ys(e.blockLen)}function fn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function id(e,t){zr(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function C1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function qt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ad(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function br(e,t){return e<<32-t|e>>>t}function mu(e,t){return e<<t|e>>>32-t>>>0}function uA(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function fA(e){for(let t=0;t<e.length;t++)e[t]=uA(e[t]);return e}function dA(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Xs(e){return typeof e=="string"&&(e=dA(e)),zr(e),e}function R1(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];zr(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function aa(e){let t=n=>e().update(Xs(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function cd(e=32){if(Js&&typeof Js.getRandomValues=="function")return Js.getRandomValues(new Uint8Array(e));if(Js&&typeof Js.randomBytes=="function")return Uint8Array.from(Js.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}var cA,Zp,Qn,dn=p(()=>{B1();cA=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;Zp=cA?e=>e:fA;Qn=class{}});function gA(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let i=0;i<10;i++)r[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let a=(i+8)%10,c=(i+2)%10,u=r[c],f=r[c+1],d=$1(u,f,1)^r[a],l=N1(u,f,1)^r[a+1];for(let m=0;m<50;m+=10)e[i+m]^=d,e[i+m+1]^=l}let o=e[2],s=e[3];for(let i=0;i<24;i++){let a=M1[i],c=$1(o,s,a),u=N1(o,s,a),f=H1[i];o=e[f],s=e[f+1],e[f]=c,e[f+1]=u}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)r[a]=e[i+a];for(let a=0;a<10;a++)e[i+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=bA[n],e[1]^=xA[n]}qt(r)}var mA,pu,pA,lA,hA,yA,H1,M1,z1,_1,bA,xA,$1,N1,Jp,wA,ud,Yp=p(()=>{I1();dn();mA=BigInt(0),pu=BigInt(1),pA=BigInt(2),lA=BigInt(7),hA=BigInt(256),yA=BigInt(113),H1=[],M1=[],z1=[];for(let e=0,t=pu,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],H1.push(2*(5*n+r)),M1.push((e+1)*(e+2)/2%64);let o=mA;for(let s=0;s<7;s++)t=(t<<pu^(t>>lA)*yA)%hA,t&pA&&(o^=pu<<(pu<<BigInt(s))-pu);z1.push(o)}_1=E1(z1,!0),bA=_1[0],xA=_1[1],$1=(e,t,r)=>r>32?P1(e,t,r):A1(e,t,r),N1=(e,t,r)=>r>32?S1(e,t,r):T1(e,t,r);Jp=class e extends Qn{constructor(t,r,n,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=s,Ys(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=C1(this.state)}clone(){return this._cloneInto()}keccak(){Zp(this.state32),gA(this.state32,this.rounds),Zp(this.state32),this.posOut=0,this.pos=0}update(t){fn(this),t=Xs(t),zr(t);let{blockLen:r,state:n}=this,o=t.length;for(let s=0;s<o;){let i=Math.min(r-this.pos,o-s);for(let a=0;a<i;a++)n[this.pos++]^=t[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){fn(this,!1),zr(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let i=Math.min(n-this.posOut,s-o);t.set(r.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Ys(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(id(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,qt(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new e(r,n,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},wA=(e,t,r)=>aa(()=>new Jp(t,e,r)),ud=wA(1,136,256/8)});function te(e,t){let r=t||"hex",n=ud(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:pe(n)}var St=p(()=>{Yp();ut();ue();L()});function U1(e){return vA(e)}var vA,F1=p(()=>{ue();St();vA=e=>te(Ee(e))});function L1(e){let t=!0,r="",n=0,o="",s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(["(",")",","].includes(a)&&(t=!0),a==="("&&n++,a===")"&&n--,!!t){if(n===0){if(a===" "&&["event","function",""].includes(o))o="";else if(o+=a,a===")"){s=!0;break}continue}if(a===" "){e[i-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=a,r+=a}}if(!s)throw new T("Unable to normalize signature.");return o}var O1=p(()=>{V()});var mn,fd=p(()=>{ed();O1();mn=e=>{let t=typeof e=="string"?e:zp(e);return L1(t)}});function pn(e){return U1(mn(e))}var lu=p(()=>{F1();fd()});var xr,ca=p(()=>{lu();xr=pn});var ae,rr=p(()=>{V();ae=class extends T{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var rt,eo=p(()=>{rt=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,r)),r}set(t,r){if(super.has(t)&&super.delete(t),super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=super.keys().next().value;n!==void 0&&super.delete(n)}return this}}});function gr(e,t){if(Xp.has(`${e}.${t}`))return Xp.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=te(Dt(r),"bytes"),o=(t?r.substring(`${t}0x`.length):r).split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(n[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());let s=`0x${o.join("")}`;return Xp.set(`${e}.${t}`,s),s}function ye(e,t){if(!Q(e,{strict:!1}))throw new ae({address:e});return gr(e,t)}var Xp,dt=p(()=>{rr();ue();St();eo();mt();Xp=new rt(8192)});function Q(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(Qp.has(n))return Qp.get(n);let o=EA.test(e)?e.toLowerCase()===e?!0:r?gr(e)===e:!0:!1;return Qp.set(n,o),o}var EA,Qp,mt=p(()=>{eo();dt();EA=/^0x[a-fA-F0-9]{40}$/,Qp=new rt(8192)});function ie(e){return typeof e[0]=="string"?Ae(e):el(e)}function el(e){let t=0;for(let o of e)t+=o.length;let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Ae(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Me=p(()=>{});function De(e,t,r,{strict:n}={}){return O(e,{strict:!1})?_r(e,t,r,{strict:n}):hu(e,t,r,{strict:n})}function D1(e,t){if(typeof t=="number"&&t>0&&t>J(e)-1)throw new Vs({offset:t,position:"start",size:J(e)})}function q1(e,t,r){if(typeof t=="number"&&typeof r=="number"&&J(e)!==r-t)throw new Vs({offset:r,position:"end",size:J(e)})}function hu(e,t,r,{strict:n}={}){D1(e,t);let o=e.slice(t,r);return n&&q1(o,t,r),o}function _r(e,t,r,{strict:n}={}){D1(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&q1(o,t,r),o}var jt=p(()=>{du();ut();et()});var j1,dd,ua,md=p(()=>{j1=/^(.*)\[([0-9]*)\]$/,dd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ua=/^(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 Oe(e,t){if(e.length!==t.length)throw new Wn({expectedLength:e.length,givenLength:t.length});let r=AA({params:e,values:t}),n=rl(r);return n.length===0?"0x":n}function AA({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(tl({param:e[n],value:t[n]}));return r}function tl({param:e,value:t}){let r=pd(e.type);if(r){let[n,o]=r;return PA(t,{length:n,param:{...e,type:o}})}if(e.type==="tuple")return CA(t,{param:e});if(e.type==="address")return TA(t);if(e.type==="bool")return IA(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,o="256"]=ua.exec(e.type)??[];return BA(t,{signed:n,size:Number(o)})}if(e.type.startsWith("bytes"))return SA(t,{param:e});if(e.type==="string")return kA(t);throw new Yi(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function rl(e){let t=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?t+=32:t+=J(a)}let r=[],n=[],o=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?(r.push(I(t+o,{size:32})),n.push(a),o+=J(a)):r.push(a)}return ie([...r,...n])}function TA(e){if(!Q(e))throw new ae({address:e});return{dynamic:!1,encoded:Pt(e.toLowerCase())}}function PA(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Yn(e);if(!n&&e.length!==t)throw new Gi({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let o=!1,s=[];for(let i=0;i<e.length;i++){let a=tl({param:r,value:e[i]});a.dynamic&&(o=!0),s.push(a)}if(n||o){let i=rl(s);if(n){let a=I(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?ie([a,i]):a}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:ie(s.map(({encoded:i})=>i))}}function SA(e,{param:t}){let[,r]=t.type.split("bytes"),n=J(e);if(!r){let o=e;return n%32!==0&&(o=Pt(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:ie([Pt(I(n,{size:32})),o])}}if(n!==Number.parseInt(r,10))throw new Vi({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:Pt(e,{dir:"right"})}}function IA(e){if(typeof e!="boolean")throw new T(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Pt(Zs(e))}}function BA(e,{signed:t,size:r=256}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,o=t?-n-1n:0n;if(e>n||e<o)throw new Mr({max:n.toString(),min:o.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:I(e,{size:32,signed:t})}}function kA(e){let t=tr(e),r=Math.ceil(J(t)/32),n=[];for(let o=0;o<r;o++)n.push(Pt(De(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ie([Pt(I(J(t),{size:32})),...n])}}function CA(e,{param:t}){let r=!1,n=[];for(let o=0;o<t.components.length;o++){let s=t.components[o],i=Array.isArray(e)?o:s.name,a=tl({param:s,value:e[i]});n.push(a),a.dynamic&&(r=!0)}return{dynamic:r,encoded:r?rl(n):ie(n.map(({encoded:o})=>o))}}function pd(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var wr=p(()=>{le();rr();V();Ks();mt();Me();Xn();et();jt();L();md()});var Gt,Qs=p(()=>{jt();lu();Gt=e=>De(pn(e),0,4)});function nt(e){let{abi:t,args:r=[],name:n}=e,o=O(n,{strict:!1}),s=t.filter(a=>o?a.type==="function"?Gt(a)===n:a.type==="event"?xr(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let i;for(let a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((u,f)=>{let d="inputs"in a&&a.inputs[f];return d?nl(u,d):!1})){if(i&&"inputs"in i&&i.inputs){let u=G1(a.inputs,i.inputs,r);if(u)throw new nd({abiItem:a,type:u[0]},{abiItem:i,type:u[1]})}i=a}}return i||s[0]}function nl(e,t){let r=typeof e,n=t.type;switch(n){case"address":return Q(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>r==="object"&&nl(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>nl(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function G1(e,t,r){for(let n in e){let o=e[n],s=t[n];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return G1(o.components,s.components,r[n]);let i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?Q(r[n],{strict:!1}):i.includes("address")&&i.includes("bytes")?Q(r[n],{strict:!1}):!1)return i}}var ln=p(()=>{le();ut();mt();ca();Qs()});function nr(e){let{abi:t,eventName:r,args:n}=e,o=t[0];if(r){let c=nt({abi:t,name:r});if(!c)throw new Gs(r,{docsPath:V1});o=c}if(o.type!=="event")throw new Gs(void 0,{docsPath:V1});let s=[];if(n&&"inputs"in o){let c=o.inputs?.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(n)?n:Object.values(n).length>0?c?.map(f=>n[f.name])??[]:[];u.length>0&&(s=c?.map((f,d)=>Array.isArray(u[d])?u[d].map((l,m)=>W1({param:f,value:u[d][m]})):typeof u[d]<"u"&&u[d]!==null?W1({param:f,value:u[d]}):null)??[])}if(o.anonymous)return s;let i=Le(o);return[xr(i),...s]}function W1({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return te(Ee(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new ea(e.type);return Oe([e],[t])}var V1,ei=p(()=>{le();jp();ue();St();ca();wr();an();ln();V1="/docs/contract/encodeEventTopics"});function to(e,{method:t}){let r={};return e.transport.type==="fallback"&&e.transport.onResponse?.(({method:n,response:o,status:s,transport:i})=>{s==="success"&&t===n&&(r[o]=i.request)}),(n=>r[n]||e.request)}var yu=p(()=>{});async function fa(e,t){let{address:r,abi:n,args:o,eventName:s,fromBlock:i,strict:a,toBlock:c}=t,u=to(e,{method:"eth_newFilter"}),f=s?nr({abi:n,args:o,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:typeof i=="bigint"?I(i):i,toBlock:typeof c=="bigint"?I(c):c,topics:f}]});return{abi:n,args:o,eventName:s,id:d,request:u(d),strict:!!a,type:"event"}}var ld=p(()=>{ei();L();yu()});function G(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var be=p(()=>{});function hd(e){let{abi:t,args:r,functionName:n}=e,o=t[0];if(n){let s=nt({abi:t,args:r,name:n});if(!s)throw new Ot(n,{docsPath:K1});o=s}if(o.type!=="function")throw new Ot(void 0,{docsPath:K1});return{abi:[o],functionName:Gt(Le(o))}}var K1,ol=p(()=>{le();Qs();an();ln();K1="/docs/contract/encodeFunctionData"});function ne(e){let{args:t}=e,{abi:r,functionName:n}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:hd(e),o=r[0],s=n,i="inputs"in o&&o.inputs?Oe(o.inputs,t??[]):void 0;return Ae([s,i??"0x"])}var Ze=p(()=>{Me();wr();ol()});var Z1,da,J1,bu=p(()=>{Z1={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},da={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},J1={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}});var xu,ma,yd,sl=p(()=>{V();xu=class extends T{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},ma=class extends T{constructor({length:t,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},yd=class extends T{constructor({count:t,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}});function vr(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(RA);return r.bytes=e,r.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}var RA,pa=p(()=>{sl();RA={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new yd({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ma({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new xu({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new xu({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}}});function Y1(e,t){let r=typeof t=="string"?{to:t}:t,n=r.to;return n==="number"?Vt(e,r):n==="bigint"?gu(e,r):n==="boolean"?wu(e,r):n==="string"?vu(e,r):K(e,r)}function gu(e,t={}){typeof t.size<"u"&&ft(e,{size:t.size});let r=K(e,t);return j(r,t)}function wu(e,t={}){let r=e;if(typeof t.size<"u"&&(ft(r,{size:t.size}),r=he(r)),r.length>1||r[0]>1)throw new ta(r);return!!r[0]}function Vt(e,t={}){typeof t.size<"u"&&ft(e,{size:t.size});let r=K(e,t);return Z(r,t)}function vu(e,t={}){let r=e;return typeof t.size<"u"&&(ft(r,{size:t.size}),r=he(r,{dir:"right"})),new TextDecoder().decode(r)}var il=p(()=>{Ks();cn();ve();L()});function pt(e,t){let r=typeof t=="string"?re(t):t,n=vr(r);if(J(r)===0&&e.length>0)throw new Tt;if(J(t)&&J(t)<32)throw new Vn({data:typeof t=="string"?t:K(t),params:e,size:J(t)});let o=0,s=[];for(let i=0;i<e.length;++i){let a=e[i];n.setPosition(o);let[c,u]=la(n,a,{staticPosition:0});o+=u,s.push(c)}return s}function la(e,t,{staticPosition:r}){let n=pd(t.type);if(n){let[o,s]=n;return NA(e,{...t,type:s},{length:o,staticPosition:r})}if(t.type==="tuple")return _A(e,t,{staticPosition:r});if(t.type==="address")return $A(e);if(t.type==="bool")return HA(e);if(t.type.startsWith("bytes"))return MA(e,t,{staticPosition:r});if(t.type.startsWith("uint")||t.type.startsWith("int"))return zA(e,t);if(t.type==="string")return UA(e,{staticPosition:r});throw new Xi(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function $A(e){let t=e.readBytes(32);return[gr(K(hu(t,-20))),32]}function NA(e,t,{length:r,staticPosition:n}){if(!r){let i=Vt(e.readBytes(al)),a=n+i,c=a+X1;e.setPosition(a);let u=Vt(e.readBytes(X1)),f=Eu(t),d=0,l=[];for(let m=0;m<u;++m){e.setPosition(c+(f?m*32:d));let[h,y]=la(e,t,{staticPosition:c});d+=y,l.push(h)}return e.setPosition(n+32),[l,32]}if(Eu(t)){let i=Vt(e.readBytes(al)),a=n+i,c=[];for(let u=0;u<r;++u){e.setPosition(a+u*32);let[f]=la(e,t,{staticPosition:a});c.push(f)}return e.setPosition(n+32),[c,32]}let o=0,s=[];for(let i=0;i<r;++i){let[a,c]=la(e,t,{staticPosition:n+o});o+=c,s.push(a)}return[s,o]}function HA(e){return[wu(e.readBytes(32),{size:32}),32]}function MA(e,t,{staticPosition:r}){let[n,o]=t.type.split("bytes");if(!o){let i=Vt(e.readBytes(32));e.setPosition(r+i);let a=Vt(e.readBytes(32));if(a===0)return e.setPosition(r+32),["0x",32];let c=e.readBytes(a);return e.setPosition(r+32),[K(c),32]}return[K(e.readBytes(Number.parseInt(o,10),32)),32]}function zA(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[n>48?gu(o,{signed:r}):Vt(o,{signed:r}),32]}function _A(e,t,{staticPosition:r}){let n=t.components.length===0||t.components.some(({name:i})=>!i),o=n?[]:{},s=0;if(Eu(t)){let i=Vt(e.readBytes(al)),a=r+i;for(let c=0;c<t.components.length;++c){let u=t.components[c];e.setPosition(a+s);let[f,d]=la(e,u,{staticPosition:a});s+=d,o[n?c:u?.name]=f}return e.setPosition(r+32),[o,32]}for(let i=0;i<t.components.length;++i){let a=t.components[i],[c,u]=la(e,a,{staticPosition:r});o[n?i:a?.name]=c,s+=u}return[o,s]}function UA(e,{staticPosition:t}){let r=Vt(e.readBytes(32)),n=t+r;e.setPosition(n);let o=Vt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let s=e.readBytes(o,32),i=vu(he(s));return e.setPosition(t+32),[i,32]}function Eu(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Eu);let r=pd(e.type);return!!(r&&Eu({...e,type:r[1]}))}var X1,al,ro=p(()=>{le();dt();pa();et();jt();cn();il();ue();L();wr();X1=32,al=32});function no(e){let{abi:t,data:r,cause:n}=e,o=De(r,0,4);if(o==="0x")throw new Tt({cause:n});let i=[...t||[],da,J1].find(a=>a.type==="error"&&o===Gt(Le(a)));if(!i)throw new Kn(o,{docsPath:"/docs/contract/decodeErrorResult",cause:n});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?pt(i.inputs,De(r,4)):void 0,errorName:i.name}}var Au=p(()=>{bu();le();jt();Qs();ro();an()});var Y,Je=p(()=>{Y=(e,t,r)=>JSON.stringify(e,(n,o)=>{let s=typeof o=="bigint"?o.toString():o;return typeof t=="function"?t(n,s):s},r)});function cl({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map((o,s)=>`${n&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Y(t[s]):t[s]}`).join(", ")})`}var Q1=p(()=>{Je()});var ha,ya,ex,ba=p(()=>{ha={gwei:9,wei:18},ya={ether:-9,wei:9},ex={ether:-18,gwei:-9}});function or(e,t){let r=e.toString(),n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[o,s]=[r.slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${o||"0"}${s?`.${s}`:""}`}var ti=p(()=>{});function oo(e,t="wei"){return or(e,ha[t])}var Tu=p(()=>{ba();ti()});function Se(e,t="wei"){return or(e,ya[t])}var ri=p(()=>{ba();ti()});function tx(e){return e.reduce((t,{slot:r,value:n})=>`${t} ${r}: ${n}
25
- `,"")}function rx(e){return e.reduce((t,{address:r,...n})=>{let o=`${t} ${r}:
16
+ `),{docsPath:r,name:"AbiFunctionNotFoundError"})}},Jn=class extends T{constructor(t,{docsPath:r}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
17
+ `),{docsPath:r,name:"AbiFunctionOutputsNotFoundError"})}},Yi=class extends T{constructor(t,{docsPath:r}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${t}.`].join(`
18
+ `),{docsPath:r,name:"AbiFunctionSignatureNotFoundError"})}},sd=class extends T{constructor(t,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Fe(t.abiItem)}\`, and`,`\`${r.type}\` in \`${Fe(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},Yn=class extends T{constructor({expectedSize:t,givenSize:r}){super(`Expected bytes${t}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}},yr=class extends T{constructor({abiItem:t,data:r,params:n,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
19
+ `),{metaMessages:[`Params: (${fu(n,{includeName:!0})})`,`Data: ${r} (${o} 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=t,this.data=r,this.params=n,this.size=o}},zr=class extends T{constructor({abiItem:t,param:r}){super([`Expected a topic for indexed event parameter${r.name?` "${r.name}"`:""} on event "${Fe(t,{includeName:!0})}".`].join(`
20
+ `),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}},Xi=class extends T{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
21
+ `),{docsPath:r,name:"InvalidAbiEncodingType"})}},Qi=class extends T{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
22
+ `),{docsPath:r,name:"InvalidAbiDecodingType"})}},Xn=class extends T{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
23
+ `),{name:"InvalidArrayError"})}},Gi=class extends T{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
24
+ `),{name:"InvalidDefinitionTypeError"})}},ea=class extends T{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}});var ta,Wm=m(()=>{W();ta=class extends T{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}});var Ws,Ks,du,pu=m(()=>{W();Ws=class extends T{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`,{name:"SliceOffsetOutOfBoundsError"})}},Ks=class extends T{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}},du=class extends T{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${r} ${n} long, but is ${t} ${n} long.`,{name:"InvalidBytesLengthError"})}}});function tt(e,{dir:t,size:r=32}={}){return typeof e=="string"?Pt(e,{dir:t,size:r}):Km(e,{dir:t,size:r})}function Pt(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new Ks({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function Km(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new Ks({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let o=0;o<r;o++){let s=t==="right";n[s?o:r-o-1]=e[s?o:e.length-o-1]}return n}var Qn=m(()=>{pu()});var _r,ra,na,oa,sa,ia,Zs=m(()=>{W();_r=class extends T{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number "${s}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}},ra=class extends T{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}},na=class extends T{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},oa=class extends T{constructor(t){super(`Hex value "${t}" is an odd length (${t.length}). It must be an even length.`,{name:"InvalidHexValueError"})}},sa=class extends T{constructor({limit:t}){super(`RLP depth limit of \`${t}\` exceeded.`,{name:"RlpDepthLimitExceededError"})}},ia=class extends T{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function he(e,{dir:t="left"}={}){let r=typeof e=="string"?e.replace("0x",""):e,n=0;for(let o=0;o<r.length-1&&r[t==="left"?o:r.length-o-1].toString()==="0";o++)n++;return r=t==="left"?r.slice(n):r.slice(0,r.length-n),typeof e=="string"?(r.length===1&&t==="right"&&(r=`${r}0`),`0x${r.length%2===1?`0${r}`:r}`):r}var un=m(()=>{});function ft(e,{size:t}){if(J(e)>t)throw new ia({givenSize:J(e),maxSize:t})}function Zm(e,t){let r=typeof t=="string"?{to:t}:t,n=r.to;return n==="number"?Z(e,r):n==="bigint"?j(e,r):n==="string"?id(e,r):n==="boolean"?aa(e,r):re(e,r)}function j(e,t={}){let{signed:r}=t;t.size&&ft(e,{size:t.size});let n=BigInt(e);if(!r)return n;let o=(e.length-2)/2,s=(1n<<BigInt(o)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function aa(e,t={}){let r=e;if(t.size&&(ft(r,{size:t.size}),r=he(r)),he(r)==="0x00")return!1;if(he(r)==="0x01")return!0;throw new na(r)}function Z(e,t={}){let r=j(e,t),n=Number(r);if(!Number.isSafeInteger(n))throw new _r({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${r}n`});return n}function id(e,t={}){let r=re(e);return t.size&&(ft(r,{size:t.size}),r=he(r,{dir:"right"})),new TextDecoder().decode(r)}var ve=m(()=>{Zs();et();un();ue()});function me(e,t={}){return typeof e=="number"||typeof e=="bigint"?I(e,t):typeof e=="string"?tr(e,t):typeof e=="boolean"?Js(e,t):K(e,t)}function Js(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{size:t.size})):r}function K(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=cA[e[o]];let n=`0x${r}`;return typeof t.size=="number"?(ft(n,{size:t.size}),tt(n,{dir:"right",size:t.size})):n}function I(e,t={}){let{signed:r,size:n}=t,o=BigInt(e),s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<i){let c=typeof e=="bigint"?"n":"";throw new _r({max:s?`${s}${c}`:void 0,min:`${i}${c}`,signed:r,size:n,value:`${e}${c}`})}let a=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?tt(a,{size:n}):a}function tr(e,t={}){let r=uA.encode(e);return K(r,t)}var cA,uA,F=m(()=>{Zs();Qn();ve();cA=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));uA=new TextEncoder});function Ee(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ym(e,t):typeof e=="boolean"?Jm(e,t):O(e)?re(e,t):Dt(e,t)}function Jm(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{size:t.size})):r}function I1(e){if(e>=fn.zero&&e<=fn.nine)return e-fn.zero;if(e>=fn.A&&e<=fn.F)return e-(fn.A-10);if(e>=fn.a&&e<=fn.f)return e-(fn.a-10)}function re(e,t={}){let r=e;t.size&&(ft(r,{size:t.size}),r=tt(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let o=n.length/2,s=new Uint8Array(o);for(let i=0,a=0;i<o;i++){let c=I1(n.charCodeAt(a++)),u=I1(n.charCodeAt(a++));if(c===void 0||u===void 0)throw new T(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);s[i]=c*16+u}return s}function Ym(e,t){let r=I(e,t);return re(r)}function Dt(e,t={}){let r=fA.encode(e);return typeof t.size=="number"?(ft(r,{size:t.size}),tt(r,{dir:"right",size:t.size})):r}var fA,fn,ue=m(()=>{W();ut();Qn();ve();F();fA=new TextEncoder;fn={zero:48,nine:57,A:65,F:70,a:97,f:102}});function dA(e,t=!1){return t?{h:Number(e&ad),l:Number(e>>B1&ad)}:{h:Number(e>>B1&ad)|0,l:Number(e&ad)|0}}function k1(e,t=!1){let r=e.length,n=new Uint32Array(r),o=new Uint32Array(r);for(let s=0;s<r;s++){let{h:i,l:a}=dA(e[s],t);[n[s],o[s]]=[i,a]}return[n,o]}var ad,B1,C1,R1,$1,N1,H1=m(()=>{ad=BigInt(4294967295),B1=BigInt(32);C1=(e,t,r)=>e<<r|t>>>32-r,R1=(e,t,r)=>t<<r|e>>>32-r,$1=(e,t,r)=>t<<r-32|e>>>64-r,N1=(e,t,r)=>e<<r-32|t>>>64-r});var Ys,M1=m(()=>{Ys=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function pA(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xs(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ur(e,...t){if(!pA(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function z1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Xs(e.outputLen),Xs(e.blockLen)}function dn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cd(e,t){Ur(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function _1(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function qt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ud(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function br(e,t){return e<<32-t|e>>>t}function mu(e,t){return e<<t|e>>>32-t>>>0}function lA(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function hA(e){for(let t=0;t<e.length;t++)e[t]=lA(e[t]);return e}function yA(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Qs(e){return typeof e=="string"&&(e=yA(e)),Ur(e),e}function U1(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];Ur(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function ca(e){let t=n=>e().update(Qs(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function fd(e=32){if(Ys&&typeof Ys.getRandomValues=="function")return Ys.getRandomValues(new Uint8Array(e));if(Ys&&typeof Ys.randomBytes=="function")return Uint8Array.from(Ys.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}var mA,Xm,eo,pn=m(()=>{M1();mA=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;Xm=mA?e=>e:hA;eo=class{}});function TA(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let i=0;i<10;i++)r[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let a=(i+8)%10,c=(i+2)%10,u=r[c],f=r[c+1],d=L1(u,f,1)^r[a],l=F1(u,f,1)^r[a+1];for(let p=0;p<50;p+=10)e[i+p]^=d,e[i+p+1]^=l}let o=e[2],s=e[3];for(let i=0;i<24;i++){let a=D1[i],c=L1(o,s,a),u=F1(o,s,a),f=O1[i];o=e[f],s=e[f+1],e[f]=c,e[f+1]=u}for(let i=0;i<50;i+=10){for(let a=0;a<10;a++)r[a]=e[i+a];for(let a=0;a<10;a++)e[i+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=EA[n],e[1]^=AA[n]}qt(r)}var bA,lu,xA,gA,wA,vA,O1,D1,q1,j1,EA,AA,L1,F1,Qm,PA,dd,el=m(()=>{H1();pn();bA=BigInt(0),lu=BigInt(1),xA=BigInt(2),gA=BigInt(7),wA=BigInt(256),vA=BigInt(113),O1=[],D1=[],q1=[];for(let e=0,t=lu,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],O1.push(2*(5*n+r)),D1.push((e+1)*(e+2)/2%64);let o=bA;for(let s=0;s<7;s++)t=(t<<lu^(t>>gA)*vA)%wA,t&xA&&(o^=lu<<(lu<<BigInt(s))-lu);q1.push(o)}j1=k1(q1,!0),EA=j1[0],AA=j1[1],L1=(e,t,r)=>r>32?$1(e,t,r):C1(e,t,r),F1=(e,t,r)=>r>32?N1(e,t,r):R1(e,t,r);Qm=class e extends eo{constructor(t,r,n,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=s,Xs(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=_1(this.state)}clone(){return this._cloneInto()}keccak(){Xm(this.state32),TA(this.state32,this.rounds),Xm(this.state32),this.posOut=0,this.pos=0}update(t){dn(this),t=Qs(t),Ur(t);let{blockLen:r,state:n}=this,o=t.length;for(let s=0;s<o;){let i=Math.min(r-this.pos,o-s);for(let a=0;a<i;a++)n[this.pos++]^=t[s++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,(r&128)!==0&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){dn(this,!1),Ur(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let i=Math.min(n-this.posOut,s-o);t.set(r.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Xs(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(cd(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,qt(this.state)}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new e(r,n,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}},PA=(e,t,r)=>ca(()=>new Qm(t,e,r)),dd=PA(1,136,256/8)});function te(e,t){let r=t||"hex",n=dd(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:me(n)}var St=m(()=>{el();ut();ue();F()});function G1(e){return SA(e)}var SA,V1=m(()=>{ue();St();SA=e=>te(Ee(e))});function W1(e){let t=!0,r="",n=0,o="",s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(["(",")",","].includes(a)&&(t=!0),a==="("&&n++,a===")"&&n--,!!t){if(n===0){if(a===" "&&["event","function",""].includes(o))o="";else if(o+=a,a===")"){s=!0;break}continue}if(a===" "){e[i-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=a,r+=a}}if(!s)throw new T("Unable to normalize signature.");return o}var K1=m(()=>{W()});var mn,pd=m(()=>{rd();K1();mn=e=>{let t=typeof e=="string"?e:Lm(e);return W1(t)}});function ln(e){return G1(mn(e))}var hu=m(()=>{V1();pd()});var xr,ua=m(()=>{hu();xr=ln});var ae,rr=m(()=>{W();ae=class extends T{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}});var rt,to=m(()=>{rt=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&(super.delete(t),super.set(t,r)),r}set(t,r){if(super.has(t)&&super.delete(t),super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=super.keys().next().value;n!==void 0&&super.delete(n)}return this}}});function gr(e,t){if(tl.has(`${e}.${t}`))return tl.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=te(Dt(r),"bytes"),o=(t?r.substring(`${t}0x`.length):r).split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(n[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());let s=`0x${o.join("")}`;return tl.set(`${e}.${t}`,s),s}function ye(e,t){if(!Q(e,{strict:!1}))throw new ae({address:e});return gr(e,t)}var tl,dt=m(()=>{rr();ue();St();to();pt();tl=new rt(8192)});function Q(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(rl.has(n))return rl.get(n);let o=IA.test(e)?e.toLowerCase()===e?!0:r?gr(e)===e:!0:!1;return rl.set(n,o),o}var IA,rl,pt=m(()=>{to();dt();IA=/^0x[a-fA-F0-9]{40}$/,rl=new rt(8192)});function ie(e){return typeof e[0]=="string"?Ae(e):nl(e)}function nl(e){let t=0;for(let o of e)t+=o.length;let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Ae(e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}var Me=m(()=>{});function De(e,t,r,{strict:n}={}){return O(e,{strict:!1})?Lr(e,t,r,{strict:n}):yu(e,t,r,{strict:n})}function Z1(e,t){if(typeof t=="number"&&t>0&&t>J(e)-1)throw new Ws({offset:t,position:"start",size:J(e)})}function J1(e,t,r){if(typeof t=="number"&&typeof r=="number"&&J(e)!==r-t)throw new Ws({offset:r,position:"end",size:J(e)})}function yu(e,t,r,{strict:n}={}){Z1(e,t);let o=e.slice(t,r);return n&&J1(o,t,r),o}function Lr(e,t,r,{strict:n}={}){Z1(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&J1(o,t,r),o}var jt=m(()=>{pu();ut();et()});var Y1,md,fa,ld=m(()=>{Y1=/^(.*)\[([0-9]*)\]$/,md=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,fa=/^(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 Oe(e,t){if(e.length!==t.length)throw new Kn({expectedLength:e.length,givenLength:t.length});let r=BA({params:e,values:t}),n=sl(r);return n.length===0?"0x":n}function BA({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(ol({param:e[n],value:t[n]}));return r}function ol({param:e,value:t}){let r=hd(e.type);if(r){let[n,o]=r;return CA(t,{length:n,param:{...e,type:o}})}if(e.type==="tuple")return MA(t,{param:e});if(e.type==="address")return kA(t);if(e.type==="bool")return $A(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int"),[,,o="256"]=fa.exec(e.type)??[];return NA(t,{signed:n,size:Number(o)})}if(e.type.startsWith("bytes"))return RA(t,{param:e});if(e.type==="string")return HA(t);throw new Xi(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function sl(e){let t=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?t+=32:t+=J(a)}let r=[],n=[],o=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?(r.push(I(t+o,{size:32})),n.push(a),o+=J(a)):r.push(a)}return ie([...r,...n])}function kA(e){if(!Q(e))throw new ae({address:e});return{dynamic:!1,encoded:Pt(e.toLowerCase())}}function CA(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Xn(e);if(!n&&e.length!==t)throw new Vi({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let o=!1,s=[];for(let i=0;i<e.length;i++){let a=ol({param:r,value:e[i]});a.dynamic&&(o=!0),s.push(a)}if(n||o){let i=sl(s);if(n){let a=I(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?ie([a,i]):a}}if(o)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:ie(s.map(({encoded:i})=>i))}}function RA(e,{param:t}){let[,r]=t.type.split("bytes"),n=J(e);if(!r){let o=e;return n%32!==0&&(o=Pt(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:ie([Pt(I(n,{size:32})),o])}}if(n!==Number.parseInt(r,10))throw new Wi({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:Pt(e,{dir:"right"})}}function $A(e){if(typeof e!="boolean")throw new T(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Pt(Js(e))}}function NA(e,{signed:t,size:r=256}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,o=t?-n-1n:0n;if(e>n||e<o)throw new _r({max:n.toString(),min:o.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:I(e,{size:32,signed:t})}}function HA(e){let t=tr(e),r=Math.ceil(J(t)/32),n=[];for(let o=0;o<r;o++)n.push(Pt(De(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ie([Pt(I(J(t),{size:32})),...n])}}function MA(e,{param:t}){let r=!1,n=[];for(let o=0;o<t.components.length;o++){let s=t.components[o],i=Array.isArray(e)?o:s.name,a=ol({param:s,value:e[i]});n.push(a),a.dynamic&&(r=!0)}return{dynamic:r,encoded:r?sl(n):ie(n.map(({encoded:o})=>o))}}function hd(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var wr=m(()=>{le();rr();W();Zs();pt();Me();Qn();et();jt();F();ld()});var Gt,ei=m(()=>{jt();hu();Gt=e=>De(ln(e),0,4)});function nt(e){let{abi:t,args:r=[],name:n}=e,o=O(n,{strict:!1}),s=t.filter(a=>o?a.type==="function"?Gt(a)===n:a.type==="event"?xr(a)===n:!1:"name"in a&&a.name===n);if(s.length===0)return;if(s.length===1)return s[0];let i;for(let a of s){if(!("inputs"in a))continue;if(!r||r.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==r.length)continue;if(r.every((u,f)=>{let d="inputs"in a&&a.inputs[f];return d?il(u,d):!1})){if(i&&"inputs"in i&&i.inputs){let u=X1(a.inputs,i.inputs,r);if(u)throw new sd({abiItem:a,type:u[0]},{abiItem:i,type:u[1]})}i=a}}return i||s[0]}function il(e,t){let r=typeof e,n=t.type;switch(n){case"address":return Q(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>r==="object"&&il(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>il(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function X1(e,t,r){for(let n in e){let o=e[n],s=t[n];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return X1(o.components,s.components,r[n]);let i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?Q(r[n],{strict:!1}):i.includes("address")&&i.includes("bytes")?Q(r[n],{strict:!1}):!1)return i}}var hn=m(()=>{le();ut();pt();ua();ei()});function nr(e){let{abi:t,eventName:r,args:n}=e,o=t[0];if(r){let c=nt({abi:t,name:r});if(!c)throw new Vs(r,{docsPath:Q1});o=c}if(o.type!=="event")throw new Vs(void 0,{docsPath:Q1});let s=[];if(n&&"inputs"in o){let c=o.inputs?.filter(f=>"indexed"in f&&f.indexed),u=Array.isArray(n)?n:Object.values(n).length>0?c?.map(f=>n[f.name])??[]:[];u.length>0&&(s=c?.map((f,d)=>Array.isArray(u[d])?u[d].map((l,p)=>ex({param:f,value:u[d][p]})):typeof u[d]<"u"&&u[d]!==null?ex({param:f,value:u[d]}):null)??[])}if(o.anonymous)return s;let i=Fe(o);return[xr(i),...s]}function ex({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return te(Ee(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new ta(e.type);return Oe([e],[t])}var Q1,ti=m(()=>{le();Wm();ue();St();ua();wr();cn();hn();Q1="/docs/contract/encodeEventTopics"});function ro(e,{method:t}){let r={};return e.transport.type==="fallback"&&e.transport.onResponse?.(({method:n,response:o,status:s,transport:i})=>{s==="success"&&t===n&&(r[o]=i.request)}),(n=>r[n]||e.request)}var bu=m(()=>{});async function da(e,t){let{address:r,abi:n,args:o,eventName:s,fromBlock:i,strict:a,toBlock:c}=t,u=ro(e,{method:"eth_newFilter"}),f=s?nr({abi:n,args:o,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:typeof i=="bigint"?I(i):i,toBlock:typeof c=="bigint"?I(c):c,topics:f}]});return{abi:n,args:o,eventName:s,id:d,request:u(d),strict:!!a,type:"event"}}var yd=m(()=>{ti();F();bu()});function G(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var be=m(()=>{});function bd(e){let{abi:t,args:r,functionName:n}=e,o=t[0];if(n){let s=nt({abi:t,args:r,name:n});if(!s)throw new Ot(n,{docsPath:tx});o=s}if(o.type!=="function")throw new Ot(void 0,{docsPath:tx});return{abi:[o],functionName:Gt(Fe(o))}}var tx,al=m(()=>{le();ei();cn();hn();tx="/docs/contract/encodeFunctionData"});function ne(e){let{args:t}=e,{abi:r,functionName:n}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:bd(e),o=r[0],s=n,i="inputs"in o&&o.inputs?Oe(o.inputs,t??[]):void 0;return Ae([s,i??"0x"])}var Ze=m(()=>{Me();wr();al()});var rx,pa,nx,xu=m(()=>{rx={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},pa={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},nx={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}});var gu,ma,xd,cl=m(()=>{W();gu=class extends T{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},ma=class extends T{constructor({length:t,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},xd=class extends T{constructor({count:t,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}});function vr(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(zA);return r.bytes=e,r.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}var zA,la=m(()=>{cl();zA={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new xd({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ma({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new gu({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new gu({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}}});function ox(e,t){let r=typeof t=="string"?{to:t}:t,n=r.to;return n==="number"?Vt(e,r):n==="bigint"?wu(e,r):n==="boolean"?vu(e,r):n==="string"?Eu(e,r):K(e,r)}function wu(e,t={}){typeof t.size<"u"&&ft(e,{size:t.size});let r=K(e,t);return j(r,t)}function vu(e,t={}){let r=e;if(typeof t.size<"u"&&(ft(r,{size:t.size}),r=he(r)),r.length>1||r[0]>1)throw new ra(r);return!!r[0]}function Vt(e,t={}){typeof t.size<"u"&&ft(e,{size:t.size});let r=K(e,t);return Z(r,t)}function Eu(e,t={}){let r=e;return typeof t.size<"u"&&(ft(r,{size:t.size}),r=he(r,{dir:"right"})),new TextDecoder().decode(r)}var ul=m(()=>{Zs();un();ve();F()});function mt(e,t){let r=typeof t=="string"?re(t):t,n=vr(r);if(J(r)===0&&e.length>0)throw new Tt;if(J(t)&&J(t)<32)throw new Wn({data:typeof t=="string"?t:K(t),params:e,size:J(t)});let o=0,s=[];for(let i=0;i<e.length;++i){let a=e[i];n.setPosition(o);let[c,u]=ha(n,a,{staticPosition:0});o+=u,s.push(c)}return s}function ha(e,t,{staticPosition:r}){let n=hd(t.type);if(n){let[o,s]=n;return UA(e,{...t,type:s},{length:o,staticPosition:r})}if(t.type==="tuple")return DA(e,t,{staticPosition:r});if(t.type==="address")return _A(e);if(t.type==="bool")return LA(e);if(t.type.startsWith("bytes"))return FA(e,t,{staticPosition:r});if(t.type.startsWith("uint")||t.type.startsWith("int"))return OA(e,t);if(t.type==="string")return qA(e,{staticPosition:r});throw new Qi(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function _A(e){let t=e.readBytes(32);return[gr(K(yu(t,-20))),32]}function UA(e,t,{length:r,staticPosition:n}){if(!r){let i=Vt(e.readBytes(fl)),a=n+i,c=a+sx;e.setPosition(a);let u=Vt(e.readBytes(sx)),f=Au(t),d=0,l=[];for(let p=0;p<u;++p){e.setPosition(c+(f?p*32:d));let[h,y]=ha(e,t,{staticPosition:c});d+=y,l.push(h)}return e.setPosition(n+32),[l,32]}if(Au(t)){let i=Vt(e.readBytes(fl)),a=n+i,c=[];for(let u=0;u<r;++u){e.setPosition(a+u*32);let[f]=ha(e,t,{staticPosition:a});c.push(f)}return e.setPosition(n+32),[c,32]}let o=0,s=[];for(let i=0;i<r;++i){let[a,c]=ha(e,t,{staticPosition:n+o});o+=c,s.push(a)}return[s,o]}function LA(e){return[vu(e.readBytes(32),{size:32}),32]}function FA(e,t,{staticPosition:r}){let[n,o]=t.type.split("bytes");if(!o){let i=Vt(e.readBytes(32));e.setPosition(r+i);let a=Vt(e.readBytes(32));if(a===0)return e.setPosition(r+32),["0x",32];let c=e.readBytes(a);return e.setPosition(r+32),[K(c),32]}return[K(e.readBytes(Number.parseInt(o,10),32)),32]}function OA(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[n>48?wu(o,{signed:r}):Vt(o,{signed:r}),32]}function DA(e,t,{staticPosition:r}){let n=t.components.length===0||t.components.some(({name:i})=>!i),o=n?[]:{},s=0;if(Au(t)){let i=Vt(e.readBytes(fl)),a=r+i;for(let c=0;c<t.components.length;++c){let u=t.components[c];e.setPosition(a+s);let[f,d]=ha(e,u,{staticPosition:a});s+=d,o[n?c:u?.name]=f}return e.setPosition(r+32),[o,32]}for(let i=0;i<t.components.length;++i){let a=t.components[i],[c,u]=ha(e,a,{staticPosition:r});o[n?i:a?.name]=c,s+=u}return[o,s]}function qA(e,{staticPosition:t}){let r=Vt(e.readBytes(32)),n=t+r;e.setPosition(n);let o=Vt(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let s=e.readBytes(o,32),i=Eu(he(s));return e.setPosition(t+32),[i,32]}function Au(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Au);let r=hd(e.type);return!!(r&&Au({...e,type:r[1]}))}var sx,fl,no=m(()=>{le();dt();la();et();jt();un();ul();ue();F();wr();sx=32,fl=32});function oo(e){let{abi:t,data:r,cause:n}=e,o=De(r,0,4);if(o==="0x")throw new Tt({cause:n});let i=[...t||[],pa,nx].find(a=>a.type==="error"&&o===Gt(Fe(a)));if(!i)throw new Zn(o,{docsPath:"/docs/contract/decodeErrorResult",cause:n});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?mt(i.inputs,De(r,4)):void 0,errorName:i.name}}var Tu=m(()=>{xu();le();jt();ei();no();cn()});var Y,Je=m(()=>{Y=(e,t,r)=>JSON.stringify(e,(n,o)=>{let s=typeof o=="bigint"?o.toString():o;return typeof t=="function"?t(n,s):s},r)});function dl({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map((o,s)=>`${n&&o.name?`${o.name}: `:""}${typeof t[s]=="object"?Y(t[s]):t[s]}`).join(", ")})`}var ix=m(()=>{Je()});var ya,ba,ax,xa=m(()=>{ya={gwei:9,wei:18},ba={ether:-9,wei:9},ax={ether:-18,gwei:-9}});function or(e,t){let r=e.toString(),n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[o,s]=[r.slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${o||"0"}${s?`.${s}`:""}`}var ri=m(()=>{});function so(e,t="wei"){return or(e,ya[t])}var Pu=m(()=>{xa();ri()});function Se(e,t="wei"){return or(e,ba[t])}var ni=m(()=>{xa();ri()});function cx(e){return e.reduce((t,{slot:r,value:n})=>`${t} ${r}: ${n}
25
+ `,"")}function ux(e){return e.reduce((t,{address:r,...n})=>{let o=`${t} ${r}:
26
26
  `;return n.nonce&&(o+=` nonce: ${n.nonce}
27
27
  `),n.balance&&(o+=` balance: ${n.balance}
28
28
  `),n.code&&(o+=` code: ${n.code}
29
29
  `),n.state&&(o+=` state:
30
- `,o+=tx(n.state)),n.stateDiff&&(o+=` stateDiff:
31
- `,o+=tx(n.stateDiff)),o},` State Override:
32
- `).slice(0,-1)}var xa,ga,bd=p(()=>{V();xa=class extends T{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},ga=class extends T{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}});function oi(e){let t=Object.entries(e).map(([n,o])=>o===void 0||o===!1?null:[n,o]).filter(Boolean),r=t.reduce((n,[o])=>Math.max(n,o.length),0);return t.map(([n,o])=>` ${`${n}:`.padEnd(r+1)} ${o}`).join(`
33
- `)}var xd,so,wa,va,Ea,Ur,Aa,Ta,io,ao,ni,Pa,lt=p(()=>{Tu();ri();V();xd=class extends T{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
34
- `),{name:"FeeConflictError"})}},so=class extends T{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}},wa=class extends T{constructor({yParity:t}){super(`Invalid \`yParity\` value "${t}". Expected 0 or 1.`,{name:"InvalidYParityError"})}},va=class extends T{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",oi(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}},Ea=class extends T{constructor({serializedType:t}){super(`Serialized transaction type "${t}" is invalid.`,{name:"InvalidSerializedTransactionType"}),Object.defineProperty(this,"serializedType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedType=t}},Ur=class extends T{constructor({attributes:t,serializedTransaction:r,type:n}){let o=Object.entries(t).map(([s,i])=>typeof i>"u"?s:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${n}" was provided.`,{metaMessages:[`Serialized Transaction: "${r}"`,o.length>0?`Missing Attributes: ${o.join(", ")}`:""].filter(Boolean),name:"InvalidSerializedTransactionError"}),Object.defineProperty(this,"serializedTransaction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedTransaction=r,this.type=n}},Aa=class extends T{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}},Ta=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l}){let m=oi({chain:o&&`${o?.name} (id: ${o?.id})`,from:r?.address,to:d,value:typeof l<"u"&&`${oo(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",m].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},io=class extends T{constructor({blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s}){let i="Transaction";n&&s!==void 0&&(i=`Transaction at block time "${n}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),r&&s!==void 0&&(i=`Transaction at block number "${r}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}},ao=class extends T{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}},ni=class extends T{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}},Pa=class extends T{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}});function Ye(e){if(e?.reason)return e.reason;if(typeof DOMException=="function")return new DOMException("This operation was aborted","AbortError");let t=new Error("This operation was aborted");return t.name="AbortError",t}function It(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var nx,hn,Er=p(()=>{nx=e=>e;hn=e=>{try{let t=new URL(e);return!t.username&&!t.password?e:(t.username="",t.password="",t.toString())}catch{return e}}});var co,uo,yn,Sa,Ia,sr,bn=p(()=>{be();bu();Au();an();Q1();ln();Tu();ri();le();V();bd();lt();Er();co=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l,stateOverride:m}){let h=r?G(r):void 0,y=oi({from:h?.address,to:d,value:typeof l<"u"&&`${oo(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});m&&(y+=`
35
- ${rx(m)}`),super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",y].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},uo=class extends T{constructor(t,{abi:r,args:n,contractAddress:o,docsPath:s,functionName:i,sender:a}){let c=nt({abi:r,args:n,name:i}),u=c?cl({abiItem:c,args:n,includeFunctionName:!1,includeName:!1}):void 0,f=c?Le(c,{includeName:!0}):void 0,d=oi({address:o&&nx(o),function:f,args:u&&u!=="()"&&`${[...Array(i?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=a}},yn=class extends T{constructor({abi:t,data:r,functionName:n,message:o,cause:s}){let i,a,c,u;if(r&&r!=="0x")try{a=no({abi:t,data:r,cause:s});let{abiItem:d,errorName:l,args:m}=a;if(l==="Error")u=m[0];else if(l==="Panic"){let[h]=m;u=Z1[h]}else{let h=d?Le(d,{includeName:!0}):void 0,y=d&&m?cl({abiItem:d,args:m,includeFunctionName:!1,includeName:!1}):void 0;c=[h?`Error: ${h}`:"",y&&y!=="()"?` ${[...Array(l?.length??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){i=d}else o&&(u=o);let f;i instanceof Kn&&(f=i.signature,c=[`Unable to decode signature "${f}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${f}.`]),super(u&&u!=="execution reverted"||f?[`The contract function "${n}" reverted with the following ${f?"signature":"reason"}:`,u||f].join(`
36
- `):`The contract function "${n}" reverted.`,{cause:i??s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=r,this.reason=u,this.signature=f}},Sa=class extends T{constructor({functionName:t,cause:r}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:r})}},Ia=class extends T{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},sr=class extends T{constructor({data:t,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}});var ot,xn,si,ir,Fr,gn,ar=p(()=>{Je();V();Er();ot=class extends T{constructor({body:t,cause:r,details:n,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${hn(i)}`,t&&`Request body: ${Y(t)}`].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=t,this.headers=o,this.status=s,this.url=i}},xn=class extends T{constructor({maxSize:t,size:r}){super("HTTP response body exceeded the size limit.",{metaMessages:[`Max: ${t} bytes`,`Received: ${r} bytes`],name:"ResponseBodyTooLargeError"}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t,this.size=r}},si=class extends T{constructor({body:t,cause:r,details:n,url:o}){super("WebSocket request failed.",{cause:r,details:n,metaMessages:[`URL: ${hn(o)}`,t&&`Request body: ${Y(t)}`].filter(Boolean),name:"WebSocketRequestError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=o}},ir=class extends T{constructor({body:t,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${hn(n)}`,`Request body: ${Y(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{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,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data,this.url=n}},Fr=class extends T{constructor({url:t}={}){super("The socket has been closed.",{metaMessages:[t&&`URL: ${hn(t)}`].filter(Boolean),name:"SocketClosedError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=t}},gn=class extends T{constructor({body:t,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${hn(r)}`,`Request body: ${Y(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=r}}});var FA,qe,je,fo,mo,po,lo,Ar,Bt,ho,yo,Lr,Or,wn,bo,Tr,xo,go,wo,vo,Eo,Dr,Ao,To,Po,So,Io,qr,Bo,Ba,ko=p(()=>{V();ar();FA=-1,qe=class extends T{constructor(t,{code:r,docsPath:n,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:n,metaMessages:o||t?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof ir?t.code:r??FA}},je=class extends qe{constructor(t,r){super(t,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}},fo=class e extends qe{constructor(t){super(t,{code:e.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(fo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});mo=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});po=class e extends qe{constructor(t,{method:r}={}){super(t,{code:e.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}};Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});lo=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
37
- `)})}};Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});Ar=class e extends qe{constructor(t){super(t,{code:e.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(Ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});Bt=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
38
- `)})}};Object.defineProperty(Bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});ho=class e extends qe{constructor(t){super(t,{code:e.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});yo=class e extends qe{constructor(t){super(t,{code:e.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});Lr=class e extends qe{constructor(t){super(t,{code:e.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(Lr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});Or=class e extends qe{constructor(t,{method:r}={}){super(t,{code:e.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}};Object.defineProperty(Or,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});wn=class e extends qe{constructor(t){super(t,{code:e.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(wn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});bo=class e extends qe{constructor(t){super(t,{code:e.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});Tr=class e extends je{constructor(t){super(t,{code:e.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});xo=class e extends je{constructor(t){super(t,{code:e.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});go=class e extends je{constructor(t,{method:r}={}){super(t,{code:e.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}};Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});wo=class e extends je{constructor(t){super(t,{code:e.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});vo=class e extends je{constructor(t){super(t,{code:e.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});Eo=class e extends je{constructor(t){super(t,{code:e.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});Dr=class e extends je{constructor(t){super(t,{code:e.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}};Object.defineProperty(Dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});Ao=class e extends je{constructor(t){super(t,{code:e.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}};Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});To=class e extends je{constructor(t){super(t,{code:e.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}};Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});Po=class e extends je{constructor(t){super(t,{code:e.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}};Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});So=class e extends je{constructor(t){super(t,{code:e.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}};Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});Io=class e extends je{constructor(t){super(t,{code:e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}};Object.defineProperty(Io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});qr=class e extends je{constructor(t){super(t,{code:e.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}};Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});Bo=class e extends je{constructor(t){super(t,{code:e.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}};Object.defineProperty(Bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});Ba=class extends qe{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}});function ht(e,{abi:t,address:r,args:n,docsPath:o,functionName:s,sender:i}){let a=e instanceof sr?e:e instanceof T?e.walk(h=>"data"in h)||e.walk():{},{code:c,data:u,details:f,message:d,shortMessage:l}=a,m=e instanceof Tt?new Sa({functionName:s,cause:e}):[LA,Ar.code].includes(c)&&(u||f||d||l)||c===Bt.code&&f==="execution reverted"&&u?new yn({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:a instanceof ir?f:l??d,cause:e}):e;return new uo(m,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:s,sender:i})}var LA,Co=p(()=>{le();V();bn();ar();ko();LA=3});function ox(e){let t=te(`0x${e.substring(4)}`).substring(26);return gr(`0x${t}`)}var sx=p(()=>{dt();St()});function OA(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(r>>o&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,i,n),e.setUint32(t+u,a,n)}function ul(e,t,r){return e&t^~e&r}function fl(e,t,r){return e&t^e&r^t&r}var ka,vn,dl=p(()=>{dn();ka=class extends Qn{constructor(t,r,n,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ad(this.buffer)}update(t){fn(this),t=Xs(t),zr(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=ad(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){fn(this),id(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,qt(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let d=i;d<o;d++)r[d]=0;OA(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=ad(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,f[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=a,o%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225])});var DA,Ro,gd,ii,ml=p(()=>{dl();dn();DA=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ro=new Uint32Array(64),gd=class extends ka{constructor(t=32){super(64,t,8,!1),this.A=vn[0]|0,this.B=vn[1]|0,this.C=vn[2]|0,this.D=vn[3]|0,this.E=vn[4]|0,this.F=vn[5]|0,this.G=vn[6]|0,this.H=vn[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,r){for(let d=0;d<16;d++,r+=4)Ro[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let l=Ro[d-15],m=Ro[d-2],h=br(l,7)^br(l,18)^l>>>3,y=br(m,17)^br(m,19)^m>>>10;Ro[d]=y+Ro[d-7]+h+Ro[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:f}=this;for(let d=0;d<64;d++){let l=br(a,6)^br(a,11)^br(a,25),m=f+l+ul(a,c,u)+DA[d]+Ro[d]|0,y=(br(n,2)^br(n,13)^br(n,22))+fl(n,o,s)|0;f=u,u=c,c=a,a=i+m|0,i=s,s=o,o=n,n=m+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,o,s,i,a,c,u,f)}roundClean(){qt(Ro)}destroy(){this.set(0,0,0,0,0,0,0,0),qt(this.buffer)}},ii=aa(()=>new gd)});var wd,pl,ix=p(()=>{dn();wd=class extends Qn{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,k1(t);let n=Xs(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),qt(s)}update(t){return fn(this),this.iHash.update(t),this}digestInto(t){fn(this),zr(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},pl=(e,t,r)=>new wd(e,t).update(r).digest();pl.create=(e,t)=>new wd(e,t)});function Ca(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function An(e){if(!Ca(e))throw new Error("Uint8Array expected")}function Ra(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Pu(e){let t=e.toString(16);return t.length&1?"0"+t:t}function ux(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?bl:BigInt("0x"+e)}function $a(e){if(An(e),fx)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=qA[e[r]];return t}function ax(e){if(e>=En._0&&e<=En._9)return e-En._0;if(e>=En.A&&e<=En.F)return e-(En.A-10);if(e>=En.a&&e<=En.f)return e-(En.a-10)}function Su(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(fx)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let i=ax(e.charCodeAt(s)),a=ax(e.charCodeAt(s+1));if(i===void 0||a===void 0){let c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function kt(e){return ux($a(e))}function xl(e){return An(e),ux($a(Uint8Array.from(e).reverse()))}function jr(e,t){return Su(e.toString(16).padStart(t*2,"0"))}function gl(e,t){return jr(e,t).reverse()}function ze(e,t,r){let n;if(typeof t=="string")try{n=Su(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ca(t))n=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(e+" of length "+r+" expected, got "+o);return n}function yt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];An(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function vd(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ai(e,t,r){return ll(e)&&ll(t)&&ll(r)&&t<=e&&e<r}function Tn(e,t,r,n){if(!ai(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function dx(e){let t;for(t=0;e>bl;e>>=yl,t+=1);return t}function mx(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=hl(e),o=hl(e),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...d)=>r(o,n,...d),c=(d=hl(0))=>{o=a(cx([0]),d),n=a(),d.length!==0&&(o=a(cx([1]),d),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0,l=[];for(;d<t;){n=a();let m=n.slice();l.push(m),d+=n.length}return yt(...l)};return(d,l)=>{i(),c(d);let m;for(;!(m=l(u()));)c();return i(),m}}function Pn(e,t,r={}){let n=(o,s,i)=>{let a=jA[s];if(typeof a!="function")throw new Error("invalid validator function");let c=e[o];if(!(i&&c===void 0)&&!a(c,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+c)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(r))n(o,s,!0);return e}function wl(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let s=e(r,...n);return t.set(r,s),s}}var bl,yl,fx,qA,En,ll,ci,hl,cx,jA,Na=p(()=>{bl=BigInt(0),yl=BigInt(1);fx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",qA=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));En={_0:48,_9:57,A:65,F:70,a:97,f:102};ll=e=>typeof e=="bigint"&&bl<=e;ci=e=>(yl<<BigInt(e))-yl,hl=e=>new Uint8Array(e),cx=e=>Uint8Array.from(e);jA={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ca(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)}});function Ie(e,t){let r=e%t;return r>=bt?r:t+r}function Wt(e,t,r){let n=e;for(;t-- >bt;)n*=n,n%=r;return n}function Ed(e,t){if(e===bt)throw new Error("invert: expected non-zero number");if(t<=bt)throw new Error("invert: expected positive modulus, got "+t);let r=Ie(e,t),n=t,o=bt,s=st,i=st,a=bt;for(;r!==bt;){let u=n/r,f=n%r,d=o-i*u,l=s-a*u;n=r,r=f,o=i,s=a,i=d,a=l}if(n!==st)throw new Error("invert: does not exist");return Ie(o,t)}function bx(e,t){let r=(e.ORDER+st)/lx,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw new Error("Cannot find square root");return n}function VA(e,t){let r=(e.ORDER-hx)/yx,n=e.mul(t,ui),o=e.pow(n,r),s=e.mul(t,o),i=e.mul(e.mul(s,ui),o),a=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function WA(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-st,r=0;for(;t%ui===bt;)t/=ui,r++;let n=ui,o=Iu(e);for(;px(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return bx;let s=o.pow(n,t),i=(t+st)/ui;return function(c,u){if(c.is0(u))return u;if(px(c,u)!==1)throw new Error("Cannot find square root");let f=r,d=c.mul(c.ONE,s),l=c.pow(u,t),m=c.pow(u,i);for(;!c.eql(l,c.ONE);){if(c.is0(l))return c.ZERO;let h=1,y=c.sqr(l);for(;!c.eql(y,c.ONE);)if(h++,y=c.sqr(y),h===f)throw new Error("Cannot find square root");let g=st<<BigInt(f-h-1),v=c.pow(d,g);f=h,d=c.sqr(v),l=c.mul(l,d),m=c.mul(m,v)}return m}}function KA(e){return e%lx===GA?bx:e%yx===hx?VA:WA(e)}function Ad(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=ZA.reduce((n,o)=>(n[o]="function",n),t);return Pn(e,r)}function JA(e,t,r){if(r<bt)throw new Error("invalid exponent, negatives unsupported");if(r===bt)return e.ONE;if(r===st)return t;let n=e.ONE,o=t;for(;r>bt;)r&st&&(n=e.mul(n,o)),o=e.sqr(o),r>>=st;return n}function Ha(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),o=t.reduce((i,a,c)=>e.is0(a)?i:(n[c]=i,e.mul(i,a)),e.ONE),s=e.inv(o);return t.reduceRight((i,a,c)=>e.is0(a)?i:(n[c]=e.mul(i,n[c]),e.mul(i,a)),s),n}function px(e,t){let r=(e.ORDER-st)/ui,n=e.pow(t,r),o=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),i=e.eql(n,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function vl(e,t){t!==void 0&&Ys(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Iu(e,t,r=!1,n={}){if(e<=bt)throw new Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:o,nByteLength:s}=vl(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,a=Object.freeze({ORDER:e,isLE:r,BITS:o,BYTES:s,MASK:ci(o),ZERO:bt,ONE:st,create:c=>Ie(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return bt<=c&&c<e},is0:c=>c===bt,isOdd:c=>(c&st)===st,neg:c=>Ie(-c,e),eql:(c,u)=>c===u,sqr:c=>Ie(c*c,e),add:(c,u)=>Ie(c+u,e),sub:(c,u)=>Ie(c-u,e),mul:(c,u)=>Ie(c*u,e),pow:(c,u)=>JA(a,c,u),div:(c,u)=>Ie(c*Ed(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Ed(c,e),sqrt:n.sqrt||(c=>(i||(i=KA(e)),i(a,c))),toBytes:c=>r?gl(c,s):jr(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?xl(c):kt(c)},invertBatch:c=>Ha(a,c),cmov:(c,u,f)=>f?u:c});return Object.freeze(a)}function xx(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function El(e){let t=xx(e);return t+Math.ceil(t/2)}function gx(e,t,r=!1){let n=e.length,o=xx(t),s=El(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=r?xl(e):kt(e),a=Ie(i,t-st)+st;return r?gl(a,o):jr(a,o)}var bt,st,ui,GA,lx,hx,yx,ZA,Bu=p(()=>{dn();Na();bt=BigInt(0),st=BigInt(1),ui=BigInt(2),GA=BigInt(3),lx=BigInt(4),hx=BigInt(5),yx=BigInt(8);ZA=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function Al(e,t){let r=t.negate();return e?r:t}function Ex(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Tl(e,t){Ex(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),o=2**e,s=ci(e),i=BigInt(e);return{windows:r,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function vx(e,t,r){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=r,a=Number(e&o),c=e>>i;a>n&&(a-=s,c+=Il);let u=t*n,f=u+Math.abs(a)-1,d=a===0,l=a<0,m=t%2!==0;return{nextN:c,offset:f,isZero:d,isNeg:l,isNegF:m,offsetF:u}}function YA(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,n)=>{if(!(r instanceof t))throw new Error("invalid point at index "+n)})}function XA(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,n)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+n)})}function Sl(e){return Ax.get(e)||1}function Tx(e,t){return{constTimeNegate:Al,hasPrecomputes(r){return Sl(r)!==1},unsafeLadder(r,n,o=e.ZERO){let s=r;for(;n>wx;)n&Il&&(o=o.add(s)),s=s.double(),n>>=Il;return o},precomputeWindow(r,n){let{windows:o,windowSize:s}=Tl(n,t),i=[],a=r,c=a;for(let u=0;u<o;u++){c=a,i.push(c);for(let f=1;f<s;f++)c=c.add(a),i.push(c);a=c.double()}return i},wNAF(r,n,o){let s=e.ZERO,i=e.BASE,a=Tl(r,t);for(let c=0;c<a.windows;c++){let{nextN:u,offset:f,isZero:d,isNeg:l,isNegF:m,offsetF:h}=vx(o,c,a);o=u,d?i=i.add(Al(m,n[h])):s=s.add(Al(l,n[f]))}return{p:s,f:i}},wNAFUnsafe(r,n,o,s=e.ZERO){let i=Tl(r,t);for(let a=0;a<i.windows&&o!==wx;a++){let{nextN:c,offset:u,isZero:f,isNeg:d}=vx(o,a,i);if(o=c,!f){let l=n[u];s=s.add(d?l.negate():l)}}return s},getPrecomputes(r,n,o){let s=Pl.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&Pl.set(n,o(s))),s},wNAFCached(r,n,o){let s=Sl(r);return this.wNAF(s,this.getPrecomputes(s,r,o),n)},wNAFCachedUnsafe(r,n,o,s){let i=Sl(r);return i===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,r,o),n,s)},setWindowSize(r,n){Ex(n,t),Ax.set(r,n),Pl.delete(r)}}}function Px(e,t,r,n){YA(r,e),XA(n,t);let o=r.length,s=n.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");let i=e.ZERO,a=dx(BigInt(o)),c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);let u=ci(c),f=new Array(Number(u)+1).fill(i),d=Math.floor((t.BITS-1)/c)*c,l=i;for(let m=d;m>=0;m-=c){f.fill(i);for(let y=0;y<s;y++){let g=n[y],v=Number(g>>BigInt(m)&u);f[v]=f[v].add(r[y])}let h=i;for(let y=f.length-1,g=i;y>0;y--)g=g.add(f[y]),h=h.add(g);if(l=l.add(h),m!==0)for(let y=0;y<c;y++)l=l.double()}return l}function Bl(e){return Ad(e.Fp),Pn(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vl(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var wx,Il,Pl,Ax,Sx=p(()=>{Bu();Na();wx=BigInt(0),Il=BigInt(1);Pl=new WeakMap,Ax=new WeakMap});function Ix(e){e.lowS!==void 0&&Ra("lowS",e.lowS),e.prehash!==void 0&&Ra("prehash",e.prehash)}function QA(e){let t=Bl(e);Pn(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}function kl(e,t){return $a(jr(e,t))}function e9(e){let t=QA(e),{Fp:r}=t,n=Iu(t.n,t.nBitLength),o=t.toBytes||((x,b,w)=>{let A=b.toAffine();return yt(Uint8Array.from([4]),r.toBytes(A.x),r.toBytes(A.y))}),s=t.fromBytes||(x=>{let b=x.subarray(1),w=r.fromBytes(b.subarray(0,r.BYTES)),A=r.fromBytes(b.subarray(r.BYTES,2*r.BYTES));return{x:w,y:A}});function i(x){let{a:b,b:w}=t,A=r.sqr(x),P=r.mul(A,x);return r.add(r.add(P,r.mul(x,b)),w)}function a(x,b){let w=r.sqr(b),A=i(x);return r.eql(w,A)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");let c=r.mul(r.pow(t.a,ku),Rl),u=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,u)))throw new Error("bad curve params: a or b");function f(x){return ai(x,ce,t.n)}function d(x){let{allowedPrivateKeyLengths:b,nByteLength:w,wrapPrivateKey:A,n:P}=t;if(b&&typeof x!="bigint"){if(Ca(x)&&(x=$a(x)),typeof x!="string"||!b.includes(x.length))throw new Error("invalid private key");x=x.padStart(w*2,"0")}let B;try{B=typeof x=="bigint"?x:kt(ze("private key",x,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof x)}return A&&(B=Ie(B,P)),Tn("private key",B,ce,P),B}function l(x){if(!(x instanceof y))throw new Error("ProjectivePoint expected")}let m=wl((x,b)=>{let{px:w,py:A,pz:P}=x;if(r.eql(P,r.ONE))return{x:w,y:A};let B=x.is0();b==null&&(b=B?r.ONE:r.inv(P));let k=r.mul(w,b),S=r.mul(A,b),N=r.mul(P,b);if(B)return{x:r.ZERO,y:r.ZERO};if(!r.eql(N,r.ONE))throw new Error("invZ was invalid");return{x:k,y:S}}),h=wl(x=>{if(x.is0()){if(t.allowInfinityPoint&&!r.is0(x.py))return;throw new Error("bad point: ZERO")}let{x:b,y:w}=x.toAffine();if(!r.isValid(b)||!r.isValid(w))throw new Error("bad point: x or y not FE");if(!a(b,w))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(b,w,A){if(b==null||!r.isValid(b))throw new Error("x required");if(w==null||!r.isValid(w)||r.is0(w))throw new Error("y required");if(A==null||!r.isValid(A))throw new Error("z required");this.px=b,this.py=w,this.pz=A,Object.freeze(this)}static fromAffine(b){let{x:w,y:A}=b||{};if(!b||!r.isValid(w)||!r.isValid(A))throw new Error("invalid affine point");if(b instanceof y)throw new Error("projective point not allowed");let P=B=>r.eql(B,r.ZERO);return P(w)&&P(A)?y.ZERO:new y(w,A,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){let w=Ha(r,b.map(A=>A.pz));return b.map((A,P)=>A.toAffine(w[P])).map(y.fromAffine)}static fromHex(b){let w=y.fromAffine(s(ze("pointHex",b)));return w.assertValidity(),w}static fromPrivateKey(b){return y.BASE.multiply(d(b))}static msm(b,w){return Px(y,n,b,w)}_setWindowSize(b){E.setWindowSize(this,b)}assertValidity(){h(this)}hasEvenY(){let{y:b}=this.toAffine();if(r.isOdd)return!r.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){l(b);let{px:w,py:A,pz:P}=this,{px:B,py:k,pz:S}=b,N=r.eql(r.mul(w,S),r.mul(B,P)),_=r.eql(r.mul(A,S),r.mul(k,P));return N&&_}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){let{a:b,b:w}=t,A=r.mul(w,ku),{px:P,py:B,pz:k}=this,S=r.ZERO,N=r.ZERO,_=r.ZERO,z=r.mul(P,P),$=r.mul(B,B),C=r.mul(k,k),H=r.mul(P,B);return H=r.add(H,H),_=r.mul(P,k),_=r.add(_,_),S=r.mul(b,_),N=r.mul(A,C),N=r.add(S,N),S=r.sub($,N),N=r.add($,N),N=r.mul(S,N),S=r.mul(H,S),_=r.mul(A,_),C=r.mul(b,C),H=r.sub(z,C),H=r.mul(b,H),H=r.add(H,_),_=r.add(z,z),z=r.add(_,z),z=r.add(z,C),z=r.mul(z,H),N=r.add(N,z),C=r.mul(B,k),C=r.add(C,C),z=r.mul(C,H),S=r.sub(S,z),_=r.mul(C,$),_=r.add(_,_),_=r.add(_,_),new y(S,N,_)}add(b){l(b);let{px:w,py:A,pz:P}=this,{px:B,py:k,pz:S}=b,N=r.ZERO,_=r.ZERO,z=r.ZERO,$=t.a,C=r.mul(t.b,ku),H=r.mul(w,B),U=r.mul(A,k),M=r.mul(P,S),F=r.add(w,A),q=r.add(B,k);F=r.mul(F,q),q=r.add(H,U),F=r.sub(F,q),q=r.add(w,P);let X=r.add(B,S);return q=r.mul(q,X),X=r.add(H,M),q=r.sub(q,X),X=r.add(A,P),N=r.add(k,S),X=r.mul(X,N),N=r.add(U,M),X=r.sub(X,N),z=r.mul($,q),N=r.mul(C,M),z=r.add(N,z),N=r.sub(U,z),z=r.add(U,z),_=r.mul(N,z),U=r.add(H,H),U=r.add(U,H),M=r.mul($,M),q=r.mul(C,q),U=r.add(U,M),M=r.sub(H,M),M=r.mul($,M),q=r.add(q,M),H=r.mul(U,q),_=r.add(_,H),H=r.mul(X,q),N=r.mul(F,N),N=r.sub(N,H),H=r.mul(F,U),z=r.mul(X,z),z=r.add(z,H),new y(N,_,z)}subtract(b){return this.add(b.negate())}is0(){return this.equals(y.ZERO)}wNAF(b){return E.wNAFCached(this,b,y.normalizeZ)}multiplyUnsafe(b){let{endo:w,n:A}=t;Tn("scalar",b,Pr,A);let P=y.ZERO;if(b===Pr)return P;if(this.is0()||b===ce)return this;if(!w||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,b,y.normalizeZ);let{k1neg:B,k1:k,k2neg:S,k2:N}=w.splitScalar(b),_=P,z=P,$=this;for(;k>Pr||N>Pr;)k&ce&&(_=_.add($)),N&ce&&(z=z.add($)),$=$.double(),k>>=ce,N>>=ce;return B&&(_=_.negate()),S&&(z=z.negate()),z=new y(r.mul(z.px,w.beta),z.py,z.pz),_.add(z)}multiply(b){let{endo:w,n:A}=t;Tn("scalar",b,ce,A);let P,B;if(w){let{k1neg:k,k1:S,k2neg:N,k2:_}=w.splitScalar(b),{p:z,f:$}=this.wNAF(S),{p:C,f:H}=this.wNAF(_);z=E.constTimeNegate(k,z),C=E.constTimeNegate(N,C),C=new y(r.mul(C.px,w.beta),C.py,C.pz),P=z.add(C),B=$.add(H)}else{let{p:k,f:S}=this.wNAF(b);P=k,B=S}return y.normalizeZ([P,B])[0]}multiplyAndAddUnsafe(b,w,A){let P=y.BASE,B=(S,N)=>N===Pr||N===ce||!S.equals(P)?S.multiplyUnsafe(N):S.multiply(N),k=B(this,w).add(B(b,A));return k.is0()?void 0:k}toAffine(b){return m(this,b)}isTorsionFree(){let{h:b,isTorsionFree:w}=t;if(b===ce)return!0;if(w)return w(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:b,clearCofactor:w}=t;return b===ce?this:w?w(y,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return Ra("isCompressed",b),this.assertValidity(),o(y,this,b)}toHex(b=!0){return Ra("isCompressed",b),$a(this.toRawBytes(b))}}y.BASE=new y(t.Gx,t.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);let{endo:g,nBitLength:v}=t,E=Tx(y,g?Math.ceil(v/2):v);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:f}}function t9(e){let t=Bl(e);return Pn(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Bx(e){let t=t9(e),{Fp:r,n,nByteLength:o,nBitLength:s}=t,i=r.BYTES+1,a=2*r.BYTES+1;function c(C){return Ie(C,n)}function u(C){return Ed(C,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:d,weierstrassEquation:l,isWithinCurveOrder:m}=e9({...t,toBytes(C,H,U){let M=H.toAffine(),F=r.toBytes(M.x),q=yt;return Ra("isCompressed",U),U?q(Uint8Array.from([H.hasEvenY()?2:3]),F):q(Uint8Array.from([4]),F,r.toBytes(M.y))},fromBytes(C){let H=C.length,U=C[0],M=C.subarray(1);if(H===i&&(U===2||U===3)){let F=kt(M);if(!ai(F,ce,r.ORDER))throw new Error("Point is not on curve");let q=l(F),X;try{X=r.sqrt(q)}catch(me){let He=me instanceof Error?": "+me.message:"";throw new Error("Point is not on curve"+He)}let Ne=(X&ce)===ce;return(U&1)===1!==Ne&&(X=r.neg(X)),{x:F,y:X}}else if(H===a&&U===4){let F=r.fromBytes(M.subarray(0,r.BYTES)),q=r.fromBytes(M.subarray(r.BYTES,2*r.BYTES));return{x:F,y:q}}else{let F=i,q=a;throw new Error("invalid Point, expected length of "+F+", or uncompressed "+q+", got "+H)}}});function h(C){let H=n>>ce;return C>H}function y(C){return h(C)?c(-C):C}let g=(C,H,U)=>kt(C.slice(H,U));class v{constructor(H,U,M){Tn("r",H,ce,n),Tn("s",U,ce,n),this.r=H,this.s=U,M!=null&&(this.recovery=M),Object.freeze(this)}static fromCompact(H){let U=o;return H=ze("compactSignature",H,U*2),new v(g(H,0,U),g(H,U,2*U))}static fromDER(H){let{r:U,s:M}=Sn.toSig(ze("DER",H));return new v(U,M)}assertValidity(){}addRecoveryBit(H){return new v(this.r,this.s,H)}recoverPublicKey(H){let{r:U,s:M,recovery:F}=this,q=P(ze("msgHash",H));if(F==null||![0,1,2,3].includes(F))throw new Error("recovery id invalid");let X=F===2||F===3?U+t.n:U;if(X>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let Ne=(F&1)===0?"02":"03",vt=f.fromHex(Ne+kl(X,r.BYTES)),me=u(X),He=c(-q*me),Ri=c(M*me),Dn=f.BASE.multiplyAndAddUnsafe(vt,He,Ri);if(!Dn)throw new Error("point at infinify");return Dn.assertValidity(),Dn}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Su(this.toDERHex())}toDERHex(){return Sn.hexFromSig(this)}toCompactRawBytes(){return Su(this.toCompactHex())}toCompactHex(){let H=o;return kl(this.r,H)+kl(this.s,H)}}let E={isValidPrivateKey(C){try{return d(C),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let C=El(t.n);return gx(t.randomBytes(C),t.n)},precompute(C=8,H=f.BASE){return H._setWindowSize(C),H.multiply(BigInt(3)),H}};function x(C,H=!0){return f.fromPrivateKey(C).toRawBytes(H)}function b(C){if(typeof C=="bigint")return!1;if(C instanceof f)return!0;let U=ze("key",C).length,M=r.BYTES,F=M+1,q=2*M+1;if(!(t.allowedPrivateKeyLengths||o===F))return U===F||U===q}function w(C,H,U=!0){if(b(C)===!0)throw new Error("first arg must be private key");if(b(H)===!1)throw new Error("second arg must be public key");return f.fromHex(H).multiply(d(C)).toRawBytes(U)}let A=t.bits2int||function(C){if(C.length>8192)throw new Error("input is too large");let H=kt(C),U=C.length*8-s;return U>0?H>>BigInt(U):H},P=t.bits2int_modN||function(C){return c(A(C))},B=ci(s);function k(C){return Tn("num < 2^"+s,C,Pr,B),jr(C,o)}function S(C,H,U=N){if(["recovered","canonical"].some(Es=>Es in U))throw new Error("sign() legacy options not supported");let{hash:M,randomBytes:F}=t,{lowS:q,prehash:X,extraEntropy:Ne}=U;q==null&&(q=!0),C=ze("msgHash",C),Ix(U),X&&(C=ze("prehashed msgHash",M(C)));let vt=P(C),me=d(H),He=[k(me),k(vt)];if(Ne!=null&&Ne!==!1){let Es=Ne===!0?F(r.BYTES):Ne;He.push(ze("extraEntropy",Es))}let Ri=yt(...He),Dn=vt;function Ap(Es){let $i=A(Es);if(!m($i))return;let Tp=u($i),Yc=f.BASE.multiply($i).toAffine(),As=c(Yc.x);if(As===Pr)return;let Xc=c(Tp*c(Dn+As*me));if(Xc===Pr)return;let Ni=(Yc.x===As?0:2)|Number(Yc.y&ce),Cb=Xc;return q&&h(Xc)&&(Cb=y(Xc),Ni^=1),new v(As,Cb,Ni)}return{seed:Ri,k2sig:Ap}}let N={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};function z(C,H,U=N){let{seed:M,k2sig:F}=S(C,H,U),q=t;return mx(q.hash.outputLen,q.nByteLength,q.hmac)(M,F)}f.BASE._setWindowSize(8);function $(C,H,U,M=_){let F=C;H=ze("msgHash",H),U=ze("publicKey",U);let{lowS:q,prehash:X,format:Ne}=M;if(Ix(M),"strict"in M)throw new Error("options.strict was renamed to lowS");if(Ne!==void 0&&Ne!=="compact"&&Ne!=="der")throw new Error("format must be compact or der");let vt=typeof F=="string"||Ca(F),me=!vt&&!Ne&&typeof F=="object"&&F!==null&&typeof F.r=="bigint"&&typeof F.s=="bigint";if(!vt&&!me)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let He,Ri;try{if(me&&(He=new v(F.r,F.s)),vt){try{Ne!=="compact"&&(He=v.fromDER(F))}catch(Ni){if(!(Ni instanceof Sn.Err))throw Ni}!He&&Ne!=="der"&&(He=v.fromCompact(F))}Ri=f.fromHex(U)}catch{return!1}if(!He||q&&He.hasHighS())return!1;X&&(H=t.hash(H));let{r:Dn,s:Ap}=He,Es=P(H),$i=u(Ap),Tp=c(Es*$i),Yc=c(Dn*$i),As=f.BASE.multiplyAndAddUnsafe(Ri,Tp,Yc)?.toAffine();return As?c(As.x)===Dn:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:w,sign:z,verify:$,ProjectivePoint:f,Signature:v,utils:E}}function r9(e,t){let r=e.ORDER,n=Pr;for(let h=r-ce;h%$o===Pr;h/=$o)n+=ce;let o=n,s=$o<<o-ce-ce,i=s*$o,a=(r-ce)/i,c=(a-ce)/$o,u=i-ce,f=s,d=e.pow(t,a),l=e.pow(t,(a+ce)/$o),m=(h,y)=>{let g=d,v=e.pow(y,u),E=e.sqr(v);E=e.mul(E,y);let x=e.mul(h,E);x=e.pow(x,c),x=e.mul(x,v),v=e.mul(x,y),E=e.mul(x,h);let b=e.mul(E,v);x=e.pow(b,f);let w=e.eql(x,e.ONE);v=e.mul(E,l),x=e.mul(b,g),E=e.cmov(v,E,w),b=e.cmov(x,b,w);for(let A=o;A>ce;A--){let P=A-$o;P=$o<<P-ce;let B=e.pow(b,P),k=e.eql(B,e.ONE);v=e.mul(E,g),g=e.mul(g,g),B=e.mul(b,g),E=e.cmov(v,E,k),b=e.cmov(B,b,k)}return{isValid:w,value:E}};if(e.ORDER%Rl===ku){let h=(e.ORDER-ku)/Rl,y=e.sqrt(e.neg(t));m=(g,v)=>{let E=e.sqr(v),x=e.mul(g,v);E=e.mul(E,x);let b=e.pow(E,h);b=e.mul(b,x);let w=e.mul(b,y),A=e.mul(e.sqr(b),v),P=e.eql(A,g),B=e.cmov(w,b,P);return{isValid:P,value:B}}}return m}function kx(e,t){if(Ad(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let r=r9(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let o,s,i,a,c,u,f,d;o=e.sqr(n),o=e.mul(o,t.Z),s=e.sqr(o),s=e.add(s,o),i=e.add(s,e.ONE),i=e.mul(i,t.B),a=e.cmov(t.Z,e.neg(s),!e.eql(s,e.ZERO)),a=e.mul(a,t.A),s=e.sqr(i),u=e.sqr(a),c=e.mul(u,t.A),s=e.add(s,c),s=e.mul(s,i),u=e.mul(u,a),c=e.mul(u,t.B),s=e.add(s,c),f=e.mul(o,i);let{isValid:l,value:m}=r(s,u);d=e.mul(o,n),d=e.mul(d,m),f=e.cmov(f,i,l),d=e.cmov(d,m,l);let h=e.isOdd(n)===e.isOdd(d);d=e.cmov(e.neg(d),d,h);let y=Ha(e,[a],!0)[0];return f=e.mul(f,y),{x:f,y:d}}}var Cl,Sn,Pr,ce,$o,ku,Rl,$l=p(()=>{Sx();Bu();Na();Cl=class extends Error{constructor(t=""){super(t)}},Sn={Err:Cl,_tlv:{encode:(e,t)=>{let{Err:r}=Sn;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=Pu(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?Pu(o.length/2|128):"";return Pu(e)+s+o+t},decode(e,t){let{Err:r}=Sn,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let c=o&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of u)i=i<<8|f;if(n+=c,i<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=Sn;if(e<Pr)throw new t("integer: negative integers are not allowed");let r=Pu(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=Sn;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return kt(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=Sn,o=ze("signature",e),{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,s),{v:u,l:f}=n.decode(2,c);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=Sn,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),s=n+o;return t.encode(48,s)}};Pr=BigInt(0),ce=BigInt(1),$o=BigInt(2),ku=BigInt(3),Rl=BigInt(4)});function n9(e){return{hash:e,hmac:(t,...r)=>pl(e,t,R1(...r)),randomBytes:cd}}function Cx(e,t){let r=n=>Bx({...e,...n9(n)});return{...r(t),create:r}}var Rx=p(()=>{ix();dn();$l();});function No(e,t){if(Cu(e),Cu(t),e<0||e>=1<<8*t)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function s9(e,t){let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function Cu(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function i9(e,t,r,n){An(e),An(t),Cu(r),t.length>255&&(t=n(yt(vd("H2C-OVERSIZE-DST-"),t)));let{outputLen:o,blockLen:s}=n,i=Math.ceil(r/o);if(r>65535||i>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=yt(t,No(t.length,1)),c=No(0,s),u=No(r,2),f=new Array(i),d=n(yt(c,e,u,No(0,1),a));f[0]=n(yt(d,No(1,1),a));for(let m=1;m<=i;m++){let h=[s9(d,f[m-1]),No(m+1,1),a];f[m]=n(yt(...h))}return yt(...f).slice(0,r)}function a9(e,t,r,n,o){if(An(e),An(t),Cu(r),t.length>255){let s=Math.ceil(2*n/8);t=o.create({dkLen:s}).update(vd("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:r}).update(e).update(No(r,2)).update(t).update(No(t.length,1)).digest()}function $x(e,t,r){Pn(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:o,m:s,hash:i,expand:a,DST:c}=r;An(e),Cu(t);let u=typeof c=="string"?vd(c):c,f=n.toString(2).length,d=Math.ceil((f+o)/8),l=t*s*d,m;if(a==="xmd")m=i9(e,u,l,i);else if(a==="xof")m=a9(e,u,l,o,i);else if(a==="_internal_pass")m=e;else throw new Error('expand must be "xmd" or "xof"');let h=new Array(t);for(let y=0;y<t;y++){let g=new Array(s);for(let v=0;v<s;v++){let E=d*(v+y*s),x=m.subarray(E,E+d);g[v]=Ie(o9(x),n)}h[y]=g}return h}function Nx(e,t){let r=t.map(n=>Array.from(n).reverse());return(n,o)=>{let[s,i,a,c]=r.map(d=>d.reduce((l,m)=>e.add(e.mul(l,n),m))),[u,f]=Ha(e,[i,c],!0);return n=e.mul(s,u),o=e.mul(o,e.mul(a,f)),{x:n,y:o}}}function Hx(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");function n(s){return e.fromAffine(t(s))}function o(s){let i=s.clearCofactor();return i.equals(e.ZERO)?e.ZERO:(i.assertValidity(),i)}return{defaults:r,hashToCurve(s,i){let a=$x(s,2,{...r,DST:r.DST,...i}),c=n(a[0]),u=n(a[1]);return o(c.add(u))},encodeToCurve(s,i){let a=$x(s,1,{...r,DST:r.encodeDST,...i});return o(n(a[0]))},mapToCurve(s){if(!Array.isArray(s))throw new Error("expected array of bigints");for(let i of s)if(typeof i!="bigint")throw new Error("expected array of bigints");return o(n(s))}}}var o9,Mx=p(()=>{Bu();Na();o9=kt});var Dx={};sn(Dx,{encodeToCurve:()=>h9,hashToCurve:()=>l9,schnorr:()=>d9,secp256k1:()=>xt,secp256k1_hasher:()=>Fl});function Ux(e){let t=Nu,r=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,f=u*u*e%t,d=Wt(f,r,t)*f%t,l=Wt(d,r,t)*f%t,m=Wt(l,Pd,t)*u%t,h=Wt(m,o,t)*m%t,y=Wt(h,s,t)*h%t,g=Wt(y,a,t)*y%t,v=Wt(g,c,t)*g%t,E=Wt(v,a,t)*y%t,x=Wt(E,r,t)*f%t,b=Wt(x,i,t)*h%t,w=Wt(b,n,t)*u%t,A=Wt(w,Pd,t);if(!Ho.eql(Ho.sqr(A),e))throw new Error("Cannot find square root");return A}function Sd(e,...t){let r=_x[e];if(r===void 0){let n=ii(Uint8Array.from(e,o=>o.charCodeAt(0)));r=yt(n,n),_x[e]=r}return ii(yt(r,...t))}function Ml(e){let t=xt.utils.normPrivateKeyToScalar(e),r=Ul.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:$u(-t),bytes:_l(r)}}function Fx(e){Tn("x",e,Ru,Nu);let t=Nl(e*e),r=Nl(t*e+BigInt(7)),n=Ux(r);n%Pd!==zl&&(n=Nl(-n));let o=new Ul(e,n,Ru);return o.assertValidity(),o}function Lx(...e){return $u(Ma(Sd("BIP0340/challenge",...e)))}function u9(e){return Ml(e).bytes}function f9(e,t,r=cd(32)){let n=ze("message",e),{bytes:o,scalar:s}=Ml(t),i=ze("auxRand",r,32),a=Hl(s^Ma(Sd("BIP0340/aux",i))),c=Sd("BIP0340/nonce",a,o,n),u=$u(Ma(c));if(u===zl)throw new Error("sign failed: k is zero");let{bytes:f,scalar:d}=Ml(u),l=Lx(f,o,n),m=new Uint8Array(64);if(m.set(f,0),m.set(Hl($u(d+l*s)),32),!Ox(m,n,o))throw new Error("sign: Invalid signature produced");return m}function Ox(e,t,r){let n=ze("signature",e,64),o=ze("message",t),s=ze("publicKey",r,32);try{let i=Fx(Ma(s)),a=Ma(n.subarray(0,32));if(!ai(a,Ru,Nu))return!1;let c=Ma(n.subarray(32,64));if(!ai(c,Ru,Td))return!1;let u=Lx(Hl(a),_l(i),o),f=c9(i,c,$u(-u));return!(!f||!f.hasEvenY()||f.toAffine().x!==a)}catch{return!1}}var Nu,Td,zl,Ru,Pd,zx,Ho,xt,_x,_l,Hl,Nl,$u,Ul,c9,Ma,d9,m9,p9,Fl,l9,h9,fi=p(()=>{ml();dn();Rx();Mx();Bu();Na();$l();Nu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Td=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zl=BigInt(0),Ru=BigInt(1),Pd=BigInt(2),zx=(e,t)=>(e+t/Pd)/t;Ho=Iu(Nu,void 0,void 0,{sqrt:Ux}),xt=Cx({a:zl,b:BigInt(7),Fp:Ho,n:Td,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=Td,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Ru*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,i=BigInt("0x100000000000000000000000000000000"),a=zx(s*e,t),c=zx(-n*e,t),u=Ie(e-a*r-c*o,t),f=Ie(-a*n-c*s,t),d=u>i,l=f>i;if(d&&(u=t-u),l&&(f=t-f),u>i||f>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:l,k2:f}}}},ii),_x={};_l=e=>e.toRawBytes(!0).slice(1),Hl=e=>jr(e,32),Nl=e=>Ie(e,Nu),$u=e=>Ie(e,Td),Ul=xt.ProjectivePoint,c9=(e,t,r)=>Ul.BASE.multiplyAndAddUnsafe(e,t,r);Ma=kt;d9={getPublicKey:u9,sign:f9,verify:Ox,utils:{randomPrivateKey:xt.utils.randomPrivateKey,lift_x:Fx,pointToBytes:_l,numberToBytesBE:jr,bytesToNumberBE:kt,taggedHash:Sd,mod:Ie}},m9=Nx(Ho,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(t=>BigInt(t)))),p9=kx(Ho,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Ho.create(BigInt("-11"))}),Fl=Hx(xt.ProjectivePoint,e=>{let{x:t,y:r}=p9(Ho.create(e[0]));return m9(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Ho.ORDER,m:1,k:128,expand:"xmd",hash:ii}),l9=Fl.hashToCurve,h9=Fl.encodeToCurve});async function Id({hash:e,signature:t}){let r=O(e)?e:pe(e),{secp256k1:n}=await Promise.resolve().then(()=>(fi(),Dx));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){let{r:u,s:f,v:d,yParity:l}=t,m=Number(l??d),h=qx(m);return new n.Signature(j(u),j(f)).addRecoveryBit(h)}let i=O(t)?t:pe(t);if(J(i)!==65)throw new Error("invalid signature length");let a=Z(`0x${i.slice(130)}`),c=qx(a);return n.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function qx(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}var Ll=p(()=>{ut();et();ve();L()});async function gt({hash:e,signature:t}){return ox(await Id({hash:e,signature:t}))}var Mo=p(()=>{sx();Ll()});function wt(e,t="hex"){let r=Vx(e),n=vr(new Uint8Array(r.length));return r.encode(n),t==="hex"?K(n.bytes):n.bytes}function jx(e,t="bytes"){return wt(e,t)}function Gx(e,t="hex"){return wt(e,t)}function Vx(e){return Array.isArray(e)?y9(e.map(t=>Vx(t))):b9(e)}function y9(e){let t=e.reduce((o,s)=>o+s.length,0),r=Wx(t);return{length:t<=55?1+t:1+r+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+r),r===1?o.pushUint8(t):r===2?o.pushUint16(t):r===3?o.pushUint24(t):o.pushUint32(t));for(let{encode:s}of e)s(o)}}}function b9(e){let t=typeof e=="string"?re(e):e,r=Wx(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+r),r===1?o.pushUint8(t.length):r===2?o.pushUint16(t.length):r===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function Wx(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new T("Length is too large.")}var Hu=p(()=>{V();pa();ue();L()});function Kx(e){let{chainId:t,nonce:r,to:n}=e,o=e.contractAddress??e.address,s=te(Ae(["0x05",wt([t?I(t):"0x",o,r?I(r):"0x"])]));return n==="bytes"?re(s):s}var Zx=p(()=>{Me();ue();L();Hu();St()});async function zo(e){let{authorization:t,signature:r}=e;return gt({hash:Kx(t),signature:r??t})}var Mu=p(()=>{Mo();Zx()});var za,Ol=p(()=>{Tu();ri();V();lt();za=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l}){let m=oi({from:r?.address,to:d,value:typeof l<"u"&&`${oo(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",m].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}});var Kt,Ct,_o,Uo,Fo,Lo,Oo,Do,qo,jo,cr,Rt,Gr=p(()=>{ri();V();Kt=class extends T{constructor({cause:t,message:r}={}){let n=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(Kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Kt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});Ct=class extends T{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Se(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(Ct,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});_o=class extends T{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Se(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(_o,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});Uo=class extends T{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};Object.defineProperty(Uo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Fo=class extends T{constructor({cause:t,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
39
- `),{cause:t,name:"NonceTooLowError"})}};Object.defineProperty(Fo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Lo=class extends T{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(Lo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Oo=class extends T{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
40
- `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(Oo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});Do=class extends T{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(Do,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});qo=class extends T{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(qo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});jo=class extends T{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(jo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});cr=class extends T{constructor({cause:t,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${Se(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${Se(n)} gwei`:""}).`].join(`
41
- `),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});Rt=class extends T{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}});function Go(e,t){let r=(e.details||"").toLowerCase(),n=e instanceof T?e.walk(o=>o?.code===Kt.code):e;return n instanceof T?new Kt({cause:e,message:n.details}):Kt.nodeMessage.test(r)?new Kt({cause:e,message:e.details}):Ct.nodeMessage.test(r)?new Ct({cause:e,maxFeePerGas:t?.maxFeePerGas}):_o.nodeMessage.test(r)?new _o({cause:e,maxFeePerGas:t?.maxFeePerGas}):Uo.nodeMessage.test(r)?new Uo({cause:e,nonce:t?.nonce}):Fo.nodeMessage.test(r)?new Fo({cause:e,nonce:t?.nonce}):Lo.nodeMessage.test(r)?new Lo({cause:e,nonce:t?.nonce}):Oo.nodeMessage.test(r)?new Oo({cause:e}):Do.nodeMessage.test(r)?new Do({cause:e,gas:t?.gas}):qo.nodeMessage.test(r)?new qo({cause:e,gas:t?.gas}):jo.nodeMessage.test(r)?new jo({cause:e}):cr.nodeMessage.test(r)?new cr({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Rt({cause:e})}var zu=p(()=>{V();Gr()});function Jx(e,{docsPath:t,...r}){let n=(()=>{let o=Go(e,r);return o instanceof Rt?e:o})();return new za(n,{docsPath:t,...r})}var Yx=p(()=>{Ol();Gr();zu()});function $t(e,{format:t}){if(!t)return{};let r={};function n(s){let i=Object.keys(s);for(let a of i)a in e&&(r[a]=e[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}let o=t(e||{});return n(o),r}var Vo=p(()=>{});function Wo(e,t){return({exclude:r,format:n})=>({exclude:r,format:(o,s)=>{let i=t(o,s);if(r)for(let a of r)delete i[a];return{...i,...n(o,s)}},type:e})}var _u=p(()=>{});function Be(e,t){let r={};return typeof e.authorizationList<"u"&&(r.authorizationList=x9(e.authorizationList)),typeof e.accessList<"u"&&(r.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(r.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?r.blobs=e.blobs.map(n=>K(n)):r.blobs=e.blobs),typeof e.data<"u"&&(r.data=e.data),e.account&&(r.from=e.account.address),typeof e.from<"u"&&(r.from=e.from),typeof e.gas<"u"&&(r.gas=I(e.gas)),typeof e.gasPrice<"u"&&(r.gasPrice=I(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(r.maxFeePerBlobGas=I(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(r.maxFeePerGas=I(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(r.maxPriorityFeePerGas=I(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(r.nonce=I(e.nonce)),typeof e.to<"u"&&(r.to=e.to),typeof e.type<"u"&&(r.type=Dl[e.type]),typeof e.value<"u"&&(r.value=I(e.value)),r}function x9(e){return e.map(t=>({address:t.address,r:t.r?I(BigInt(t.r)):t.r,s:t.s?I(BigInt(t.s)):t.s,chainId:I(t.chainId),nonce:I(t.nonce),...typeof t.yParity<"u"?{yParity:I(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:I(t.v)}:{}}))}var Dl,Xx,Sr=p(()=>{L();_u();Dl={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};Xx=Wo("transactionRequest",Be)});function Qx(e){if(!(!e||e.length===0))return e.reduce((t,{slot:r,value:n})=>{if(r.length!==66)throw new fu({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new fu({size:n.length,targetSize:66,type:"hex"});return t[r]=n,t},{})}function g9(e){let{balance:t,nonce:r,state:n,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=I(t)),r!==void 0&&(i.nonce=I(r)),n!==void 0&&(i.state=Qx(n)),o!==void 0){if(i.state)throw new ga;i.stateDiff=Qx(o)}return i}function _a(e){if(!e)return;let t={};for(let{address:r,...n}of e){if(!Q(r,{strict:!1}))throw new ae({address:r});if(t[r])throw new xa({address:r});t[r]=g9(n)}return t}var Bd=p(()=>{rr();du();bd();mt();L()});var eg,tg,rg,ng,og,sg,ig,ag,cg,ug,fg,dg,mg,pg,lg,hg,yg,bg,xg,gg,wg,vg,Eg,Ag,Tg,Pg,Sg,Ig,Bg,kg,Cg,Rg,$g,Ng,Hg,Mg,zg,_g,Ug,Fg,Lg,Og,Dg,qg,jg,Gg,Vg,Wg,Kg,Zg,Jg,Yg,Xg,Qg,e6,t6,r6,n6,o6,s6,i6,a6,c6,u6,f6,d6,m6,p6,l6,h6,y6,b6,x6,g6,w6,v6,E6,A6,T6,P6,S6,I6,B6,k6,C6,R6,$6,N6,H6,M6,z6,_6,U6,F6,L6,Ko,kd=p(()=>{eg=2n**(8n-1n)-1n,tg=2n**(16n-1n)-1n,rg=2n**(24n-1n)-1n,ng=2n**(32n-1n)-1n,og=2n**(40n-1n)-1n,sg=2n**(48n-1n)-1n,ig=2n**(56n-1n)-1n,ag=2n**(64n-1n)-1n,cg=2n**(72n-1n)-1n,ug=2n**(80n-1n)-1n,fg=2n**(88n-1n)-1n,dg=2n**(96n-1n)-1n,mg=2n**(104n-1n)-1n,pg=2n**(112n-1n)-1n,lg=2n**(120n-1n)-1n,hg=2n**(128n-1n)-1n,yg=2n**(136n-1n)-1n,bg=2n**(144n-1n)-1n,xg=2n**(152n-1n)-1n,gg=2n**(160n-1n)-1n,wg=2n**(168n-1n)-1n,vg=2n**(176n-1n)-1n,Eg=2n**(184n-1n)-1n,Ag=2n**(192n-1n)-1n,Tg=2n**(200n-1n)-1n,Pg=2n**(208n-1n)-1n,Sg=2n**(216n-1n)-1n,Ig=2n**(224n-1n)-1n,Bg=2n**(232n-1n)-1n,kg=2n**(240n-1n)-1n,Cg=2n**(248n-1n)-1n,Rg=2n**(256n-1n)-1n,$g=-(2n**(8n-1n)),Ng=-(2n**(16n-1n)),Hg=-(2n**(24n-1n)),Mg=-(2n**(32n-1n)),zg=-(2n**(40n-1n)),_g=-(2n**(48n-1n)),Ug=-(2n**(56n-1n)),Fg=-(2n**(64n-1n)),Lg=-(2n**(72n-1n)),Og=-(2n**(80n-1n)),Dg=-(2n**(88n-1n)),qg=-(2n**(96n-1n)),jg=-(2n**(104n-1n)),Gg=-(2n**(112n-1n)),Vg=-(2n**(120n-1n)),Wg=-(2n**(128n-1n)),Kg=-(2n**(136n-1n)),Zg=-(2n**(144n-1n)),Jg=-(2n**(152n-1n)),Yg=-(2n**(160n-1n)),Xg=-(2n**(168n-1n)),Qg=-(2n**(176n-1n)),e6=-(2n**(184n-1n)),t6=-(2n**(192n-1n)),r6=-(2n**(200n-1n)),n6=-(2n**(208n-1n)),o6=-(2n**(216n-1n)),s6=-(2n**(224n-1n)),i6=-(2n**(232n-1n)),a6=-(2n**(240n-1n)),c6=-(2n**(248n-1n)),u6=-(2n**(256n-1n)),f6=2n**8n-1n,d6=2n**16n-1n,m6=2n**24n-1n,p6=2n**32n-1n,l6=2n**40n-1n,h6=2n**48n-1n,y6=2n**56n-1n,b6=2n**64n-1n,x6=2n**72n-1n,g6=2n**80n-1n,w6=2n**88n-1n,v6=2n**96n-1n,E6=2n**104n-1n,A6=2n**112n-1n,T6=2n**120n-1n,P6=2n**128n-1n,S6=2n**136n-1n,I6=2n**144n-1n,B6=2n**152n-1n,k6=2n**160n-1n,C6=2n**168n-1n,R6=2n**176n-1n,$6=2n**184n-1n,N6=2n**192n-1n,H6=2n**200n-1n,M6=2n**208n-1n,z6=2n**216n-1n,_6=2n**224n-1n,U6=2n**232n-1n,F6=2n**240n-1n,L6=2n**248n-1n,Ko=2n**256n-1n});function _e(e){let{account:t,maxFeePerGas:r,maxPriorityFeePerGas:n,to:o}=e,s=t?G(t):void 0;if(s&&!Q(s.address))throw new ae({address:s.address});if(o&&!Q(o))throw new ae({address:o});if(r&&r>Ko)throw new Ct({maxFeePerGas:r});if(n&&r&&n>r)throw new cr({maxFeePerGas:r,maxPriorityFeePerGas:n})}var Ir=p(()=>{be();kd();rr();Gr();mt()});var Zo,Vr,Ua,Fa=p(()=>{ri();V();Zo=class extends T{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}},Vr=class extends T{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}},Ua=class extends T{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Se(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}});var Wr,Uu=p(()=>{V();Wr=class extends T{constructor({blockHash:t,blockNumber:r}){let n="Block";t&&(n=`Block at hash "${t}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}});function In(e,t){let r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,...e.blockTimestamp!=null&&{blockTimestamp:BigInt(e.blockTimestamp)},chainId:e.chainId?Z(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Z(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Fu[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=w9(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}function w9(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}var Fu,O6,La=p(()=>{ve();_u();Fu={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};O6=Wo("transaction",In)});function di(e,t){let r=(e.transactions??[]).map(n=>typeof n=="string"?n:In(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:r,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}var D6,Cd=p(()=>{_u();La();D6=Wo("block",di)});async function Ge(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",includeTransactions:o}={}){let s=o??!1,i=r!==void 0?I(r):void 0,a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[i||n,s]},{dedupe:!!i}),!a)throw new Wr({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||di)(a,"getBlock")}var Jo=p(()=>{Uu();L();Cd()});async function Oa(e){let t=await e.request({method:"eth_gasPrice"});return BigInt(t)}var Rd=p(()=>{});async function q6(e,t){return ql(e,t)}async function ql(e,t){let{block:r,chain:n=e.chain,request:o}=t||{};try{let s=n?.fees?.maxPriorityFeePerGas??n?.fees?.defaultPriorityFee;if(typeof s=="function"){let a=r||await R(e,Ge,"getBlock")({}),c=await s({block:a,client:e,request:o});if(c===null)throw new Error;return c}if(typeof s<"u")return s;let i=await e.request({method:"eth_maxPriorityFeePerGas"});return j(i)}catch{let[s,i]=await Promise.all([r?Promise.resolve(r):R(e,Ge,"getBlock")({}),R(e,Oa,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new Vr;let a=i-s.baseFeePerGas;return a<0n?0n:a}}var jl=p(()=>{Fa();ve();ee();Jo();Rd()});async function j6(e,t){return $d(e,t)}async function $d(e,t){let{block:r,chain:n=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>typeof n?.fees?.baseFeeMultiplier=="function"?n.fees.baseFeeMultiplier({block:r,client:e,request:o}):n?.fees?.baseFeeMultiplier??1.2)();if(i<1)throw new Zo;let c=10**(i.toString().split(".")[1]?.length??0),u=l=>l*BigInt(Math.ceil(i*c))/BigInt(c),f=r||await R(e,Ge,"getBlock")({});if(typeof n?.fees?.estimateFeesPerGas=="function"){let l=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:u,request:o,type:s});if(l!==null)return l}if(s==="eip1559"){if(typeof f.baseFeePerGas!="bigint")throw new Vr;let l=typeof o?.maxPriorityFeePerGas=="bigint"?o.maxPriorityFeePerGas:await ql(e,{block:f,chain:n,request:o}),m=u(f.baseFeePerGas);return{maxFeePerGas:o?.maxFeePerGas??m+l,maxPriorityFeePerGas:l}}return{gasPrice:o?.gasPrice??u(await R(e,Oa,"getGasPrice")({}))}}var Gl=p(()=>{Fa();ee();jl();Jo();Rd()});function Zt(e){let{blockHash:t,blockNumber:r,blockTag:n,requireCanonical:o}=e;if(o!==void 0&&!t)throw new T("`requireCanonical` can only be provided when `blockHash` is set.");return t?o?{blockHash:t,requireCanonical:o}:{blockHash:t}:typeof r=="bigint"?I(r):n??"latest"}var mi=p(()=>{V();L()});async function Yo(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),a=await e.request({method:"eth_getTransactionCount",params:[t,i]},{dedupe:typeof n=="bigint"||r!==void 0});return Z(a)}var Lu=p(()=>{mi();ve()});function Xo(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),n=typeof e.blobs[0]=="string"?e.blobs.map(s=>re(s)):e.blobs,o=[];for(let s of n)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return r==="bytes"?o:o.map(s=>K(s))}var Ou=p(()=>{ue();L()});function Qo(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),n=typeof e.blobs[0]=="string"?e.blobs.map(i=>re(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>re(i)):e.commitments,s=[];for(let i=0;i<n.length;i++){let a=n[i],c=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return r==="bytes"?s:s.map(i=>K(i))}var Du=p(()=>{ue();L()});var G6,V6=p(()=>{ml();G6=ii});function Nd(e,t){let r=t||"hex",n=G6(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:pe(n)}var Vl=p(()=>{V6();ut();ue();L()});function Da(e){let{commitment:t,version:r=1}=e,n=e.to??(typeof t=="string"?"hex":"bytes"),o=Nd(t,"bytes");return o.set([r],0),n==="bytes"?o:K(o)}var Hd=p(()=>{L();Vl()});function qa(e){let{commitments:t,version:r}=e,n=e.to??(typeof t[0]=="string"?"hex":"bytes"),o=[];for(let s of t)o.push(Da({commitment:s,to:n,version:r}));return o}var Md=p(()=>{Hd()});var zd,ja,_d,Ud,Wl=p(()=>{V();zd=class extends T{constructor({maxSize:t,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}},ja=class extends T{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}},_d=class extends T{constructor({hash:t,size:r}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${r}`],name:"InvalidVersionedHashSizeError"})}},Ud=class extends T{constructor({hash:t,version:r}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${1}`,`Received: ${r}`],name:"InvalidVersionedHashVersionError"})}}});function Fd(e){let t=e.to??(typeof e.data=="string"?"hex":"bytes"),r=typeof e.data=="string"?re(e.data):e.data,n=J(r);if(!n)throw new ja;if(n>761855)throw new zd({maxSize:761855,size:n});let o=[],s=!0,i=0;for(;s;){let a=vr(new Uint8Array(131072)),c=0;for(;c<4096;){let u=r.slice(i,i+31);if(a.pushByte(0),a.pushBytes(u),u.length<31){a.pushByte(128),s=!1;break}c++,i+=31}o.push(a)}return t==="bytes"?o.map(a=>a.bytes):o.map(a=>K(a.bytes))}var Kl=p(()=>{Wl();pa();et();ue();L()});function es(e){let{data:t,kzg:r,to:n}=e,o=e.blobs??Fd({data:t,to:n}),s=e.commitments??Xo({blobs:o,kzg:r,to:n}),i=e.proofs??Qo({blobs:o,commitments:s,kzg:r,to:n}),a=[];for(let c=0;c<o.length;c++)a.push({blob:o[c],commitment:s[c],proof:i[c]});return a}var qu=p(()=>{Ou();Du();Kl()});function Ga(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new va({transaction:e})}var Ld=p(()=>{lt()});function ts(e,{docsPath:t,...r}){let n=(()=>{let o=Go(e,r);return o instanceof Rt?e:o})();return new Ta(n,{docsPath:t,...r})}var ju=p(()=>{Gr();lt();zu()});async function Ve(e){let t=await e.request({method:"eth_chainId"},{dedupe:!0});return Z(t)}var Bn=p(()=>{ve()});async function Va(e,t){let{account:r=e.account,accessList:n,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:a,data:c,gas:u,gasPrice:f,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:h,nonceManager:y,to:g,type:v,value:E,...x}=t,b=await(async()=>{if(!r||!y||typeof h<"u")return h;let B=G(r),k=s?s.id:await R(e,Ve,"getChainId")({});return await y.consume({address:B.address,chainId:k,client:e})})();_e(t);let w=s?.formatters?.transactionRequest?.format,P=(w||Be)({...$t(x,{format:w}),account:r?G(r):void 0,accessList:n,authorizationList:o,blobs:a,blobVersionedHashes:i,data:c,gas:u,gasPrice:f,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:b,to:g,type:v,value:E},"fillTransaction");try{let B=await e.request({method:"eth_fillTransaction",params:[P]}),S=(s?.formatters?.transaction?.format||In)(B.tx);delete S.blockHash,delete S.blockNumber,delete S.r,delete S.s,delete S.transactionIndex,delete S.v,delete S.yParity,S.data=S.input,S.gas&&(S.gas=t.gas??S.gas),S.gasPrice&&(S.gasPrice=t.gasPrice??S.gasPrice),S.maxFeePerBlobGas&&(S.maxFeePerBlobGas=t.maxFeePerBlobGas??S.maxFeePerBlobGas),S.maxFeePerGas&&(S.maxFeePerGas=t.maxFeePerGas??S.maxFeePerGas),S.maxPriorityFeePerGas&&(S.maxPriorityFeePerGas=t.maxPriorityFeePerGas??S.maxPriorityFeePerGas),typeof S.nonce<"u"&&(S.nonce=t.nonce??S.nonce);let N=await(async()=>{if(typeof s?.fees?.baseFeeMultiplier=="function"){let C=await R(e,Ge,"getBlock")({});return s.fees.baseFeeMultiplier({block:C,client:e,request:t})}return s?.fees?.baseFeeMultiplier??1.2})();if(N<1)throw new Zo;let z=10**(N.toString().split(".")[1]?.length??0),$=C=>C*BigInt(Math.ceil(N*z))/BigInt(z);return S.feePayerSignature||(S.maxFeePerGas&&!t.maxFeePerGas&&(S.maxFeePerGas=$(S.maxFeePerGas)),S.gasPrice&&!t.gasPrice&&(S.gasPrice=$(S.gasPrice))),{raw:B.raw,transaction:{from:P.from,...S},...B.capabilities?{capabilities:B.capabilities}:{}}}catch(B){throw ts(B,{...t,chain:e.chain})}}var Od=p(()=>{be();Fa();ju();Vo();La();Sr();ee();Ir();Jo();Bn()});async function Kr(e,t){let r=t;r.account??(r.account=e.account),r.parameters??(r.parameters=Gu);let{account:n,chain:o=e.chain,nonceManager:s,parameters:i}=r,a=(()=>{if(typeof o?.prepareTransactionRequest=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o?.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})(),c;async function u(){return c||(typeof r.chainId<"u"?r.chainId:o?o.id:(c=await R(e,Ve,"getChainId")({}),c))}let f=n&&G(n),d=r.nonce;if(i.includes("nonce")&&typeof d>"u"&&f&&s){let b=await u();d=await s.consume({address:f.address,chainId:b,client:e})}a?.fn&&a.runAt?.includes("beforeFillTransaction")&&(r=await a.fn({...r,chain:o},{client:e,phase:"beforeFillTransaction"}),d??(d=r.nonce));let m=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&r.kzg&&r.blobs||Zl.get(e.uid)===!1||!["fees","gas"].some(w=>i.includes(w))?!1:!!(i.includes("chainId")&&typeof r.chainId!="number"||i.includes("nonce")&&typeof d!="number"||i.includes("fees")&&typeof r.gasPrice!="bigint"&&(typeof r.maxFeePerGas!="bigint"||typeof r.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof r.gas!="bigint"))?await R(e,Va,"fillTransaction")({...r,nonce:d}).then(b=>{let{chainId:w,from:A,gas:P,gasPrice:B,nonce:k,maxFeePerBlobGas:S,maxFeePerGas:N,maxPriorityFeePerGas:_,type:z,...$}=b.transaction;return Zl.set(e.uid,!0),{...r,...A?{from:A}:{},...z&&!r.type?{type:z}:{},...typeof w<"u"?{chainId:w}:{},...typeof P<"u"?{gas:P}:{},...typeof B<"u"?{gasPrice:B}:{},...typeof k<"u"?{nonce:k}:{},...typeof S<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerBlobGas:S}:{},...typeof N<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerGas:N}:{},...typeof _<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxPriorityFeePerGas:_}:{},..."nonceKey"in $&&typeof $.nonceKey<"u"?{nonceKey:$.nonceKey}:{},..."keyAuthorization"in $&&typeof $.keyAuthorization<"u"&&$.keyAuthorization!==null&&!("keyAuthorization"in r)?{keyAuthorization:$.keyAuthorization}:{},..."feePayerSignature"in $&&typeof $.feePayerSignature<"u"&&$.feePayerSignature!==null?{feePayerSignature:$.feePayerSignature}:{},..."feeToken"in $&&typeof $.feeToken<"u"&&$.feeToken!==null&&!("feeToken"in r)?{feeToken:$.feeToken}:{},...b.capabilities?{_capabilities:b.capabilities}:{}}}).catch(b=>{let w=b;if(w.name!=="TransactionExecutionError")return r;if(w.walk?.(B=>B.name==="ExecutionRevertedError"))throw b;return w.walk?.(B=>{let k=B;return k.name==="MethodNotFoundRpcError"||k.name==="MethodNotSupportedRpcError"||k.message?.includes("eth_fillTransaction is not available")})&&Zl.set(e.uid,!1),r}):r;d??(d=m.nonce),r={...m,...f?{from:f?.address}:{},...typeof d<"u"?{nonce:d}:{}};let{blobs:h,gas:y,kzg:g,type:v}=r;a?.fn&&a.runAt?.includes("beforeFillParameters")&&(r=await a.fn({...r,chain:o},{client:e,phase:"beforeFillParameters"}));let E;async function x(){return E||(E=await R(e,Ge,"getBlock")({blockTag:"latest"}),E)}if(i.includes("nonce")&&typeof d>"u"&&f&&!s&&(r.nonce=await R(e,Yo,"getTransactionCount")({address:f.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&g){let b=Xo({blobs:h,kzg:g});if(i.includes("blobVersionedHashes")){let w=qa({commitments:b,to:"hex"});r.blobVersionedHashes=w}if(i.includes("sidecars")){let w=Qo({blobs:h,commitments:b,kzg:g}),A=es({blobs:h,commitments:b,proofs:w,to:"hex"});r.sidecars=A}}if(i.includes("chainId")&&(r.chainId=await u()),(i.includes("fees")||i.includes("type"))&&typeof v>"u")try{r.type=Ga(r)}catch{let b=W6.get(e.uid);typeof b>"u"&&(b=typeof(await x())?.baseFeePerGas=="bigint",W6.set(e.uid,b)),r.type=b?"eip1559":"legacy"}if(i.includes("fees"))if(r.type!=="legacy"&&r.type!=="eip2930"){if(typeof r.maxFeePerGas>"u"||typeof r.maxPriorityFeePerGas>"u"){let b=await x(),{maxFeePerGas:w,maxPriorityFeePerGas:A}=await $d(e,{block:b,chain:o,request:r});if(typeof r.maxPriorityFeePerGas>"u"&&r.maxFeePerGas&&r.maxFeePerGas<A)throw new Ua({maxPriorityFeePerGas:A});r.maxPriorityFeePerGas=A,r.maxFeePerGas=w}}else{if(typeof r.maxFeePerGas<"u"||typeof r.maxPriorityFeePerGas<"u")throw new Vr;if(typeof r.gasPrice>"u"){let b=await x(),{gasPrice:w}=await $d(e,{block:b,chain:o,request:r,type:"legacy"});r.gasPrice=w}}return i.includes("gas")&&typeof y>"u"&&(r.gas=await R(e,Ka,"estimateGas")({...r,account:f,prepare:f?.type==="local"?[]:["blobVersionedHashes"]})),a?.fn&&a.runAt?.includes("afterFillParameters")&&(r=await a.fn({...r,chain:o},{client:e,phase:"afterFillParameters"})),_e(r),delete r.parameters,r}var Gu,W6,Zl,Wa=p(()=>{be();Gl();Dd();Jo();Lu();Fa();Ou();Du();Md();qu();ee();eo();Ir();Ld();Od();Bn();Gu=["blobVersionedHashes","chainId","fees","gas","nonce","type"],W6=new Map,Zl=new rt(128)});async function Ka(e,t){let{account:r=e.account,prepare:n=!0}=t,o=r?G(r):void 0,s=(()=>{if(Array.isArray(n))return n;if(o?.type!=="local")return["blobVersionedHashes"]})();try{let i=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await zo({authorization:t.authorizationList[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:f,blockNumber:d,blockTag:l,data:m,gas:h,gasPrice:y,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:x,value:b,stateOverride:w,...A}=n?await Kr(e,{...t,parameters:s,to:i}):t;if(h&&t.gas!==h)return h;let B=(typeof d=="bigint"?I(d):void 0)||l,k=_a(w);_e(t);let S=e.chain?.formatters?.transactionRequest?.format,_=(S||Be)({...$t(A,{format:S}),account:o,accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:f,data:m,gasPrice:y,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:x,to:i,value:b},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:k?[_,B??e.experimental_blockTag??"latest",k]:B?[_,B]:[_]}))}catch(i){throw Jx(i,{...t,account:o,chain:e.chain})}}var Dd=p(()=>{be();V();Mu();L();Yx();Vo();Sr();Bd();Ir();Wa()});async function rs(e,t){let{abi:r,address:n,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...a}=t,c=ne({abi:r,args:o,functionName:s});try{return await R(e,Ka,"estimateGas")({data:`${c}${i?i.replace("0x",""):""}`,to:n,...a})}catch(u){let f=a.account?G(a.account):void 0;throw ht(u,{abi:r,address:n,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f?.address})}}var Vu=p(()=>{be();Ze();Co();ee();Dd()});function de(e,t){if(!Q(e,{strict:!1}))throw new ae({address:e});if(!Q(t,{strict:!1}))throw new ae({address:t});return e.toLowerCase()===t.toLowerCase()}var Jt=p(()=>{rr();mt()});function Ue(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}var Zr=p(()=>{});function kn(e){let{abi:t,data:r,strict:n,topics:o}=e,s=n??!0,[i,...a]=o;if(!i)throw new Ki({docsPath:K6});let c=t.find(v=>v.type==="event"&&i===xr(Le(v)));if(!(c&&"name"in c)||c.type!=="event")throw new Zi(i,{docsPath:K6});let{name:u,inputs:f}=c,d=f?.some(v=>!("name"in v&&v.name)),l=d?[]:{},m=f.map((v,E)=>[v,E]).filter(([v])=>"indexed"in v&&v.indexed),h=[];for(let v=0;v<m.length;v++){let[E,x]=m[v],b=a[v];if(!b){if(s)throw new Hr({abiItem:c,param:E});h.push([E,x]);continue}l[d?x:E.name||x]=A9({param:E,value:b})}let y=f.filter(v=>!("indexed"in v&&v.indexed)),g=s?y:[...h.map(([v])=>v),...y];if(g.length>0){if(r&&r!=="0x")try{let v=pt(g,r);if(v){let E=0;if(!s)for(let[x,b]of h)l[d?b:x.name||b]=v[E++];if(d)for(let x=0;x<f.length;x++)l[x]===void 0&&E<v.length&&(l[x]=v[E++]);else for(let x=0;x<y.length;x++)l[y[x].name]=v[E++]}}catch(v){if(s)throw v instanceof Vn||v instanceof ma?new yr({abiItem:c,data:r,params:g,size:J(r)}):v}else if(s)throw new yr({abiItem:c,data:"0x",params:g,size:0})}return{eventName:u,args:Object.values(l).length>0?l:void 0}}function A9({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(pt([e],t)||[])[0]}var K6,Wu=p(()=>{le();sl();et();ca();ro();an();K6="/docs/contract/decodeEventLog"});function ur(e){let{abi:t,args:r,logs:n,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:xr(a)}));return n.map(a=>{let c=typeof a.blockNumber=="string"?Ue(a):a,u=i.filter(l=>c.topics[0]===l.selector);if(u.length===0)return null;let f,d;for(let l of u)try{f=kn({...c,abi:[l.abi],strict:!0}),d=l;break}catch{}if(!f&&!o){d=u[0];try{f=kn({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{let l=d.abi.inputs?.some(m=>!("name"in m&&m.name));return{...c,args:l?[]:{},eventName:d.abi.name}}}return!f||!d||s&&!s.includes(f.eventName)||!T9({args:f.args,inputs:d.abi.inputs,matchArgs:r})?null:{...f,...c}}).filter(Boolean)}function T9(e){let{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function o(s,i,a){try{return s.type==="address"?de(i,a):s.type==="string"||s.type==="bytes"?te(Ee(i))===a:i===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((s,i)=>{if(s==null)return!0;let a=r[i];return a?(Array.isArray(s)?s:[s]).some(u=>o(a,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof n=="object"&&!Array.isArray(n)?Object.entries(n).every(([s,i])=>{if(i==null)return!0;let a=r.find(u=>u.name===s);return a?(Array.isArray(i)?i:[i]).some(u=>o(a,u,t[s])):!1}):!1}var pi=p(()=>{Jt();ue();Zr();St();ca();Wu()});async function Za(e,{address:t,blockHash:r,fromBlock:n,toBlock:o,event:s,events:i,args:a,strict:c}={}){let u=c??!1,f=i??(s?[s]:void 0),d=[];f&&(d=[f.flatMap(y=>nr({abi:[y],eventName:y.name,args:i?void 0:a}))],s&&(d=d[0]));let l;r?l=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):l=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof n=="bigint"?I(n):n,toBlock:typeof o=="bigint"?I(o):o}]});let m=l.map(h=>Ue(h));return f?ur({abi:f,args:a,logs:m,strict:u}):m}var qd=p(()=>{ei();pi();L();Zr()});async function Ja(e,t){let{abi:r,address:n,args:o,blockHash:s,eventName:i,fromBlock:a,toBlock:c,strict:u}=t,f=i?nt({abi:r,name:i}):void 0,d=f?void 0:r.filter(l=>l.type==="event");return R(e,Za,"getLogs")({address:n,args:o,blockHash:s,event:f,events:d,fromBlock:a,toBlock:c,strict:u})}var jd=p(()=>{ln();ee();qd()});function Fe(e){let{abi:t,args:r,functionName:n,data:o}=e,s=t[0];if(n){let a=nt({abi:t,args:r,name:n});if(!a)throw new Ot(n,{docsPath:Jl});s=a}if(s.type!=="function")throw new Ot(void 0,{docsPath:Jl});if(!s.outputs)throw new Zn(s.name,{docsPath:Jl});let i=pt(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}var Jl,Br=p(()=>{le();ro();ln();Jl="/docs/contract/decodeFunctionResult"});var Z6,J6=p(()=>{Z6="0.1.1"});function Y6(){return Z6}var X6=p(()=>{J6()});function Q6(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Q6(e.cause,t):t?null:e}var D,Nt=p(()=>{X6();D=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,r={}){let n=(()=>{if(r.cause instanceof e){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:r.cause?.message?r.cause.message:r.details})(),o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=r.docsOrigin??e.prototype.docsOrigin,i=`${s}${o??""}`,a=!!(r.version??e.prototype.showVersion),c=r.version??e.prototype.version,u=[t||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||o||a?["",n?`Details: ${n}`:void 0,o?`See: ${i}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(f=>typeof f=="string").join(`
42
- `);super(u,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{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,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=r.cause,this.details=n,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return Q6(this,t)}};Object.defineProperty(D,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${Y6()}`}});D.setStaticOptions(D.defaultStaticOptions)});function Ya(e,t){if(fr(e)>t)throw new Gd({givenSize:fr(e),maxSize:t})}function e5(e,t){if(typeof t=="number"&&t>0&&t>fr(e)-1)throw new Ku({offset:t,position:"start",size:fr(e)})}function t5(e,t,r){if(typeof t=="number"&&typeof r=="number"&&fr(e)!==r-t)throw new Ku({offset:r,position:"end",size:fr(e)})}function Yl(e){if(e>=Cn.zero&&e<=Cn.nine)return e-Cn.zero;if(e>=Cn.A&&e<=Cn.F)return e-(Cn.A-10);if(e>=Cn.a&&e<=Cn.f)return e-(Cn.a-10)}function r5(e,t={}){let{dir:r,size:n=32}=t;if(n===0)return e;if(e.length>n)throw new Vd({size:e.length,targetSize:n,type:"Bytes"});let o=new Uint8Array(n);for(let s=0;s<n;s++){let i=r==="right";o[i?s:n-s-1]=e[i?s:e.length-s-1]}return o}function Xl(e,t={}){let{dir:r="left"}=t,n=e,o=0;for(let s=0;s<n.length-1&&n[r==="left"?s:n.length-s-1].toString()==="0";s++)o++;return n=r==="left"?n.slice(o):n.slice(0,n.length-o),n}var Cn,n5=p(()=>{ns();Cn={zero:48,nine:57,A:65,F:70,a:97,f:102}});function Xa(e,t){if(xe(e)>t)throw new Wd({givenSize:xe(e),maxSize:t})}function o5(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new Zu({offset:t,position:"start",size:xe(e)})}function s5(e,t,r){if(typeof t=="number"&&typeof r=="number"&&xe(e)!==r-t)throw new Zu({offset:r,position:"end",size:xe(e)})}function Ql(e,t={}){let{dir:r,size:n=32}=t;if(n===0)return e;let o=e.replace("0x","");if(o.length>n*2)throw new Kd({size:Math.ceil(o.length/2),targetSize:n,type:"Hex"});return`0x${o[r==="right"?"padEnd":"padStart"](n*2,"0")}`}function i5(e,t={}){let{dir:r="left"}=t,n=e.replace("0x",""),o=0;for(let s=0;s<n.length-1&&n[r==="left"?s:n.length-s-1].toString()==="0";s++)o++;return n=r==="left"?n.slice(o):n.slice(0,n.length-o),n==="0"?"0x":r==="right"&&n.length%2===1?`0x${n}0`:`0x${n}`}var eh=p(()=>{We()});function os(e,t,r){return JSON.stringify(e,(n,o)=>typeof t=="function"?t(n,o):typeof o=="bigint"?o.toString()+S9:o,r)}var S9,Ju=p(()=>{S9="#__bigint"});function k9(e){if(!(e instanceof Uint8Array)){if(!e)throw new Qa(e);if(typeof e!="object")throw new Qa(e);if(!("BYTES_PER_ELEMENT"in e))throw new Qa(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Qa(e)}}function c5(e){return e instanceof Uint8Array?e:typeof e=="string"?ec(e):C9(e)}function C9(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ec(e,t={}){let{size:r}=t,n=e;r&&(Xa(e,r),n=Yr(e,r));let o=n.slice(2);o.length%2&&(o=`0${o}`);let s=o.length/2,i=new Uint8Array(s);for(let a=0,c=0;a<s;a++){let u=Yl(o.charCodeAt(c++)),f=Yl(o.charCodeAt(c++));if(u===void 0||f===void 0)throw new D(`Invalid byte sequence ("${o[c-2]}${o[c-1]}" in "${o}").`);i[a]=u<<4|f}return i}function u5(e,t={}){let{size:r}=t,n=B9.encode(e);return typeof r=="number"?(Ya(n,r),R9(n,r)):n}function R9(e,t){return r5(e,{dir:"right",size:t})}function fr(e){return e.length}function f5(e,t,r,n={}){let{strict:o}=n;e5(e,t);let s=e.slice(t,r);return o&&t5(s,t,r),s}function d5(e,t={}){let{size:r}=t;typeof r<"u"&&Ya(e,r);let n=ke(e,t);return nh(n,t)}function m5(e,t={}){let{size:r}=t,n=e;if(typeof r<"u"&&(Ya(n,r),n=rh(n)),n.length>1||n[0]>1)throw new th(n);return!!n[0]}function Jr(e,t={}){let{size:r}=t;typeof r<"u"&&Ya(e,r);let n=ke(e,t);return Jd(n,t)}function p5(e,t={}){let{size:r}=t,n=e;return typeof r<"u"&&(Ya(n,r),n=$9(n)),I9.decode(n)}function rh(e){return Xl(e,{dir:"left"})}function $9(e){return Xl(e,{dir:"right"})}function l5(e){try{return k9(e),!0}catch{return!1}}var I9,B9,th,Qa,Gd,Ku,Vd,ns=p(()=>{Nt();We();n5();eh();Ju();I9=new TextDecoder,B9=new TextEncoder;th=class extends D{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}},Qa=class extends D{constructor(t){super(`Value \`${typeof t=="object"?os(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}},Gd=class extends D{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Ku=class extends D{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}},Vd=class extends D{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}});function M9(e,t={}){let{strict:r=!1}=t;if(!e)throw new Yd(e);if(typeof e!="string")throw new Yd(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Xd(e);if(!e.startsWith("0x"))throw new Xd(e)}function Te(...e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function tc(e){return e instanceof Uint8Array?ke(e):Array.isArray(e)?ke(new Uint8Array(e)):e}function Qd(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(Xa(r,t.size),Rn(r,t.size)):r}function ke(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=H9[e[o]];let n=`0x${r}`;return typeof t.size=="number"?(Xa(n,t.size),Yr(n,t.size)):n}function se(e,t={}){let{signed:r,size:n}=t,o=BigInt(e),s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<i){let u=typeof e=="bigint"?"n":"";throw new Yu({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:r,size:n,value:`${e}${u}`})}let c=`0x${(r&&o<0?BigInt.asUintN(n*8,BigInt(o)):o).toString(16)}`;return n?Rn(c,n):c}function rc(e,t={}){return ke(N9.encode(e),t)}function Rn(e,t){return Ql(e,{dir:"left",size:t})}function Yr(e,t){return Ql(e,{dir:"right",size:t})}function ge(e,t,r,n={}){let{strict:o}=n;o5(e,t);let s=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&s5(s,t,r),s}function xe(e){return Math.ceil((e.length-2)/2)}function oh(e){return i5(e,{dir:"left"})}function nh(e,t={}){let{signed:r}=t;t.size&&Xa(e,t.size);let n=BigInt(e);if(!r)return n;let o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return n<=i?n:n-s-1n}function Jd(e,t={}){let{signed:r,size:n}=t;return Number(!r&&!n?e:nh(e,t))}function Xu(e,t={}){let{strict:r=!1}=t;try{return M9(e,{strict:r}),!0}catch{return!1}}var N9,H9,Yu,Yd,Xd,Wd,Zu,Kd,We=p(()=>{Nt();eh();Ju();N9=new TextEncoder,H9=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));Yu=class extends D{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${n?" signed":" unsigned"} integer range ${t?`(\`${r}\` to \`${t}\`)`:`(above \`${r}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Yd=class extends D{constructor(t){super(`Value \`${typeof t=="object"?os(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},Xd=class extends D{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},Wd=class extends D{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Zu=class extends D{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},Kd=class extends D{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}});function h5(e){return{address:e.address,amount:se(e.amount),index:se(e.index),validatorIndex:se(e.validatorIndex)}}var y5=p(()=>{We()});function em(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:se(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:se(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:se(e.gasLimit)},...typeof e.number=="bigint"&&{number:se(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:se(e.prevRandao)},...typeof e.time=="bigint"&&{time:se(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(h5)}}}var sh=p(()=>{We();y5()});var dr,ss,x5,tm,g5,ih,ah,ch,nc,Ce,w5,v5,E5,A5,Ke=p(()=>{dr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],ss=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],x5=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],tm=[...x5,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],g5=[...x5,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],ih=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ah=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],ch=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],nc=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Ce=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],w5=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],v5=[{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC1155InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC1155InvalidApprover",type:"error"},{inputs:[{internalType:"uint256",name:"idsLength",type:"uint256"},{internalType:"uint256",name:"valuesLength",type:"uint256"}],name:"ERC1155InvalidArrayLength",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC1155InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC1155InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC1155InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC1155MissingApprovalForAll",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"values",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],E5=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"event",name:"ApprovalForAll",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"operator",type:"address"},{indexed:!1,name:"approved",type:"bool"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"payable",inputs:[{name:"spender",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"getApproved",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"isApprovedForAll",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"operator",type:"address"}],outputs:[{type:"bool"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"owner",type:"address"}]},{type:"function",name:"safeTransferFrom",stateMutability:"payable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]},{type:"function",name:"setApprovalForAll",stateMutability:"nonpayable",inputs:[{name:"operator",type:"address"},{name:"approved",type:"bool"}],outputs:[]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{name:"tokenId",type:"uint256"}]},{type:"function",name:"tokenURI",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transferFrom",stateMutability:"payable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]}],A5=[{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!0,name:"owner",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],name:"allowance",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],name:"approve",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"}],name:"deposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxDeposit",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxMint",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxRedeem",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"}],name:"mint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewMint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"redeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalAssets",outputs:[{name:"totalManagedAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"withdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}]});var T5,P5=p(()=>{T5="0x82ad56cb"});var oc,rm,Qu,sc,ic=p(()=>{oc="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",rm="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Qu="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",sc="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033"});var $n,ac,cc,hi,Nn,uc=p(()=>{V();$n=class extends T{constructor({blockNumber:t,chain:r,contract:n}){super(`Chain "${r.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...t&&n.blockCreated&&n.blockCreated>t?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${n.name}" configured.`]],name:"ChainDoesNotSupportContract"})}},ac=class extends T{constructor({chain:t,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${t.id} \u2013 ${t.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${t.id} \u2013 ${t.name}`],name:"ChainMismatchError"})}},cc=class extends T{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
43
- `),{name:"ChainNotFoundError"})}},hi=class extends T{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}},Nn=class extends T{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}});function Hn(e){let{abi:t,args:r,bytecode:n}=e;if(!r||r.length===0)return n;let o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Gn({docsPath:uh});if(!("inputs"in o))throw new Nr({docsPath:uh});if(!o.inputs||o.inputs.length===0)throw new Nr({docsPath:uh});let s=Oe(o.inputs,r);return Ae([n,s])}var uh,ef=p(()=>{le();Me();wr();uh="/docs/contract/encodeDeployData"});function Ht({blockNumber:e,chain:t,contract:r}){let n=t?.contracts?.[r];if(!n)throw new $n({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new $n({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}var is=p(()=>{uc()});function nm(e,{docsPath:t,...r}){let n=(()=>{let o=Go(e,r);return o instanceof Rt?e:o})();return new co(n,{docsPath:t,...r})}var fh=p(()=>{bn();Gr();zu()});function fc(){let e=()=>{},t=()=>{};return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var om=p(()=>{});function dc({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){let s=async()=>{let f=c();i();let d=f.map(({args:l})=>l);d.length!==0&&e(d).then(l=>{o&&Array.isArray(l)&&l.sort(o);for(let m=0;m<f.length;m++){let{resolve:h}=f[m];h?.([l[m],l])}}).catch(l=>{for(let m=0;m<f.length;m++){let{reject:h}=f[m];h?.(l)}})},i=()=>dh.delete(t),a=()=>c().map(({args:f})=>f),c=()=>dh.get(t)||[],u=f=>dh.set(t,[...c(),f]);return{flush:i,async schedule(f){let{promise:d,resolve:l,reject:m}=fc();return r?.([...a(),f])&&s(),c().length>0?(u({args:f,resolve:l,reject:m}),d):(u({args:f,resolve:l,reject:m}),setTimeout(s,n),d)}}}var dh,sm=p(()=>{om();dh=new Map});var im,am,cm,S5=p(()=>{Je();V();Er();im=class extends T{constructor({callbackSelector:t,cause:r,data:n,extraData:o,sender:s,urls:i}){super(r.shortMessage||"An error occurred while fetching for an offchain result.",{cause:r,metaMessages:[...r.metaMessages||[],r.metaMessages?.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${hn(a)}`)],` Sender: ${s}`,` Data: ${n}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}},am=class extends T{constructor({result:t,url:r}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${hn(r)}`,`Response: ${Y(t)}`],name:"OffchainLookupResponseMalformedError"})}},cm=class extends T{constructor({sender:t,to:r}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${r}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}});function um(e){let{abi:t,data:r}=e,n=De(r,0,4),o=t.find(s=>s.type==="function"&&n===Gt(Le(s)));if(!o)throw new Ji(n,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?pt(o.inputs,De(r,4)):void 0}}var mh=p(()=>{le();jt();Qs();ro();an()});function tf(e){let{abi:t,errorName:r,args:n}=e,o=t[0];if(r){let c=nt({abi:t,args:n,name:r});if(!c)throw new js(r,{docsPath:ph});o=c}if(o.type!=="error")throw new js(void 0,{docsPath:ph});let s=Le(o),i=Gt(s),a="0x";if(n&&n.length>0){if(!o.inputs)throw new Wi(o.name,{docsPath:ph});a=Oe(o.inputs,n)}return Ae([i,a])}var ph,lh=p(()=>{le();Me();Qs();wr();an();ln();ph="/docs/contract/encodeErrorResult"});function fm(e){let{abi:t,functionName:r,result:n}=e,o=t[0];if(r){let i=nt({abi:t,name:r});if(!i)throw new Ot(r,{docsPath:hh});o=i}if(o.type!=="function")throw new Ot(void 0,{docsPath:hh});if(!o.outputs)throw new Zn(o.name,{docsPath:hh});let s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[n];if(Array.isArray(n))return n;throw new Yn(n)})();return Oe(o.outputs,s)}var hh,yh=p(()=>{le();wr();ln();hh="/docs/contract/encodeFunctionResult"});async function bh(e){let{data:t,ccipRequest:r}=e,{args:[n]}=um({abi:ss,data:t}),o=[],s=[];return await Promise.all(n.map(async(i,a)=>{try{s[a]=i.urls.includes(kr)?await bh({data:i.data,ccipRequest:r}):await r(i),o[a]=!1}catch(c){o[a]=!0,s[a]=_9(c)}})),fm({abi:ss,functionName:"query",result:[o,s]})}function _9(e){return e.name==="HttpRequestError"&&e.status?tf({abi:ss,errorName:"HttpError",args:[e.status,e.shortMessage]}):tf({abi:[da],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}var kr,mc=p(()=>{Ke();bu();mh();lh();yh();kr="x-batch-gateway:true"});var I5={};sn(I5,{ccipRequest:()=>yi,offchainLookup:()=>gh,offchainLookupAbiItem:()=>dm,offchainLookupSignature:()=>xh});async function gh(e,{blockNumber:t,blockTag:r,data:n,requestOptions:o,to:s}){let{args:i}=no({data:n,abi:[dm]}),[a,c,u,f,d]=i,{ccipRead:l}=e,m=l&&typeof l?.request=="function"?l.request:yi;try{if(!de(s,a))throw new cm({sender:a,to:s});let h=c.includes(kr)?await bh({data:u,ccipRequest:g=>m({...g,requestOptions:o})}):await m({data:u,requestOptions:o,sender:a,urls:c}),{data:y}=await mr(e,{blockNumber:t,blockTag:r,data:ie([f,Oe([{type:"bytes"},{type:"bytes"}],[h,d])]),requestOptions:o,to:s});return y}catch(h){throw o?.signal?.aborted?Ye(o.signal):It(h)?h:new im({callbackSelector:f,cause:h,data:n,extraData:d,sender:a,urls:c})}}async function yi({data:e,requestOptions:t,sender:r,urls:n}){let o=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){if(t?.signal?.aborted)throw Ye(t.signal);let i=n[s],a=i.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:r}:void 0,u=a==="POST"?{"Content-Type":"application/json"}:{};try{let f=await fetch(i.replace("{sender}",r.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:u,method:a,...t?.signal?{signal:t.signal}:{}}),d;if(f.headers.get("Content-Type")?.startsWith("application/json")?d=(await f.json()).data:d=await f.text(),!f.ok){o=new ot({body:c,details:d?.error?Y(d.error):f.statusText,headers:f.headers,status:f.status,url:i});continue}if(!O(d)){o=new am({result:d,url:i});continue}return d}catch(f){if(t?.signal?.aborted)throw Ye(t.signal);if(It(f))throw f;o=new ot({body:c,details:f.message,url:i})}}throw o}var xh,dm,mm=p(()=>{bi();S5();ar();Er();Au();wr();Jt();Me();ut();mc();Je();xh="0x556f1830",dm={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]}});async function mr(e,t){let{account:r=e.account,authorizationList:n,batch:o=!!e.batch?.multicall,blockHash:s,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",requireCanonical:c,accessList:u,blobs:f,blockOverrides:d,code:l,data:m,factory:h,factoryData:y,gas:g,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:b,nonce:w,requestOptions:A,to:P,value:B,stateOverride:k,...S}=t,N=r?G(r):void 0;if(l&&(h||y))throw new T("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&P)throw new T("Cannot provide both `code` & `to` as parameters.");let _=l&&m,z=h&&y&&P&&m,$=_||z,C=_?C5({code:l,data:m}):z?q9({data:m,factory:h,factoryData:y,to:P}):m;try{_e(t);let H=Zt({blockHash:s,blockNumber:i,blockTag:a,requireCanonical:c}),U=d?em(d):void 0,M=_a(k),F=e.chain?.formatters?.transactionRequest?.format,X=(F||Be)({...$t(S,{format:F}),accessList:u,account:N,authorizationList:n,blobs:f,data:C,gas:g,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:b,nonce:w,to:$?void 0:P,value:B},"call");if(o&&U9({request:X})&&!U&&s===void 0)try{let{deployless:me=!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},He=k5(e,{blockNumber:i,deployless:me});if(!He||!D9(M,He))return await O9(e,{...X,blockHash:s,blockNumber:i,blockTag:a,multicallAddress:He,requestOptions:A,requireCanonical:c,rpcStateOverride:M})}catch(me){if(!(me instanceof hi)&&!(me instanceof $n))throw me}let Ne=(()=>{let me=[X,H];return M&&U?[...me,M,U]:M?[...me,M]:U?[...me,{},U]:me})(),vt=await e.request({method:"eth_call",params:Ne},A);return vt==="0x"?{data:void 0}:{data:vt}}catch(H){if(A?.signal?.aborted)throw Ye(A.signal);if(It(H))throw H;let U=j9(H),{offchainLookup:M,offchainLookupSignature:F}=await Promise.resolve().then(()=>(mm(),I5));if(e.ccipRead!==!1&&U?.slice(0,10)===F&&P)return{data:await M(e,{data:U,requestOptions:A,to:P})};throw $&&U?.slice(0,10)==="0x101bb98d"?new Ia({factory:h}):nm(H,{...t,account:N,chain:e.chain})}}function U9({request:e}){let{data:t,to:r,...n}=e;return!(!t||t.startsWith(T5)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}function L9(e){if(!e)return"default";let t=B5.get(e);if(t!==void 0)return t;let r=F9++;return B5.set(e,r),r}async function O9(e,t){let{batchSize:r=1024,deployless:n=!1,wait:o=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockHash:s,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",requireCanonical:c,data:u,multicallAddress:f,requestOptions:d,rpcStateOverride:l,to:m}=t,h=f!==void 0?f:k5(e,{blockNumber:i,deployless:n}),y=Zt({blockHash:s,blockNumber:i,blockTag:a,requireCanonical:c}),g=typeof y=="string"?y:JSON.stringify(y),v=l?`.${JSON.stringify(l)}`:"",{schedule:E}=dc({id:`${e.uid}.${g}.${L9(d)}${v}`,wait:o,shouldSplitBatch(w){return w.reduce((P,{data:B})=>P+(B.length-2),0)>r*2},fn:async w=>{let A=w.map(S=>({allowFailure:!0,callData:S.data,target:S.to})),P=ne({abi:dr,args:[A],functionName:"aggregate3"}),B={...h===null?{data:C5({code:sc,data:P})}:{to:h,data:P}},k=await e.request({method:"eth_call",params:l?[B,y,l]:[B,y]},d);return Fe({abi:dr,args:[A],functionName:"aggregate3",data:k||"0x"})}}),[{returnData:x,success:b}]=await E({data:u,to:m});if(!b)throw new sr({data:x});return x==="0x"?{data:void 0}:{data:x}}function k5(e,t){let{blockNumber:r,deployless:n}=t;if(n)return null;if(e.chain)return Ht({blockNumber:r,chain:e.chain,contract:"multicall3"});throw new hi}function D9(e,t){return e?Object.keys(e).some(r=>de(r,t)):!1}function C5(e){let{code:t,data:r}=e;return Hn({abi:qi(["constructor(bytes, bytes)"]),bytecode:oc,args:[t,r]})}function q9(e){let{data:t,factory:r,factoryData:n,to:o}=e;return Hn({abi:qi(["constructor(address, bytes, address, bytes)"]),bytecode:rm,args:[o,t,r,n]})}function j9(e){if(!(e instanceof T))return;let t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}var F9,B5,bi=p(()=>{ed();sh();be();Ke();P5();ic();V();uc();bn();Er();Br();ef();Ze();Jt();mi();is();fh();Vo();Sr();sm();Bd();Ir();F9=0,B5=new WeakMap});async function oe(e,t){let{abi:r,address:n,args:o,functionName:s,...i}=t,a=ne({abi:r,args:o,functionName:s});try{let{data:c}=await R(e,mr,"call")({...i,data:a,to:n});return Fe({abi:r,args:o,functionName:s,data:c||"0x"})}catch(c){throw ht(c,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}var it=p(()=>{Br();Ze();Co();ee();bi()});async function as(e,t){let{abi:r,address:n,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...a}=t,c=a.account?G(a.account):e.account,u=ne({abi:r,args:o,functionName:s});try{let{data:f}=await R(e,mr,"call")({batch:!1,data:`${u}${i?i.replace("0x",""):""}`,to:n,...a,account:c}),d=Fe({abi:r,args:o,functionName:s,data:f||"0x"}),l=r.filter(m=>"name"in m&&m.name===t.functionName);return{result:d,request:{abi:l,address:n,args:o,dataSuffix:i,functionName:s,...a,account:c}}}catch(f){throw ht(f,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:c?.address})}}var rf=p(()=>{be();Br();Ze();Co();ee();bi()});function at(e,t,r){let n=++G9,o=()=>pm.get(e)||[],s=()=>{let d=o().filter(l=>l.id!==n);if(d.length===0){pm.delete(e),wh.delete(e);return}pm.set(e,d)},i=()=>{let f=o();if(!f.some(l=>l.id===n))return;let d=wh.get(e);if(f.length===1&&d){let l=d();l instanceof Promise&&l.catch(()=>{})}s()},a=o();if(pm.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return i;let c={};for(let f in t)c[f]=((...d)=>{let l=o();if(l.length!==0)for(let m of l)m.fns[f]?.(...d)});let u=r(c);return typeof u=="function"&&wh.set(e,u),i}var pm,wh,G9,cs=p(()=>{pm=new Map,wh=new Map,G9=0});async function xi(e,{signal:t}={}){return new Promise((r,n)=>{if(t?.aborted){n(Ye(t));return}let o=()=>t?.removeEventListener("abort",i),s=setTimeout(()=>{o(),r()},e),i=()=>{clearTimeout(s),o(),n(Ye(t))};t?.addEventListener("abort",i,{once:!0})})}var lm=p(()=>{Er()});function pr(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0,s=()=>o=!1;return(async()=>{let a;t&&(a=await e({unpoll:s}));let c=await r?.(a)??n;await xi(c);let u=async()=>{o&&(await e({unpoll:s}),await xi(n),u())};u()})(),s}var gi=p(()=>{lm()});function R5(e){let t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),r=t(e,V9),n=t(e,W9);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function hm(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){let n=R5(t),o=n.response.get();if(o&&r>0&&Date.now()-o.created.getTime()<r)return o.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{let i=await s;return n.response.set({created:new Date,data:i}),i}finally{n.promise.clear()}}var V9,W9,vh=p(()=>{V9=new Map,W9=new Map});async function Xr(e,{cacheTime:t=e.cacheTime}={}){let r=await hm(()=>e.request({method:"eth_blockNumber"}),{cacheKey:K9(e.uid),cacheTime:t});return BigInt(r)}var K9,pc=p(()=>{vh();K9=e=>`blockNumber.${e}`});async function us(e,{filter:t}){let r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof n[0]=="string")return n;let o=n.map(s=>Ue(s));return!("abi"in t)||!t.abi?o:ur({abi:t.abi,logs:o,strict:r})}var nf=p(()=>{pi();Zr()});async function fs(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}var of=p(()=>{});function ym(e,t){let{abi:r,address:n,args:o,batch:s=!0,eventName:i,fromBlock:a,onError:c,onLogs:u,poll:f,pollingInterval:d=e.pollingInterval,strict:l}=t;return(typeof f<"u"?f:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{let g=l??!1,v=Y(["watchContractEvent",n,o,s,e.uid,i,d,g,a]);return at(v,{onLogs:u,onError:c},E=>{let x;a!==void 0&&(x=a-1n);let b,w=!1,A=pr(async()=>{if(!w){try{b=await R(e,fa,"createContractEventFilter")({abi:r,address:n,args:o,eventName:i,strict:g,fromBlock:a})}catch{}w=!0;return}try{let P;if(b)P=await R(e,us,"getFilterChanges")({filter:b});else{let B=await R(e,Xr,"getBlockNumber")({});x&&x<B?P=await R(e,Ja,"getContractEvents")({abi:r,address:n,args:o,eventName:i,fromBlock:x+1n,toBlock:B,strict:g}):P=[],x=B}if(P.length===0)return;if(s)E.onLogs(P);else for(let B of P)E.onLogs([B])}catch(P){b&&P instanceof Bt&&(w=!1),E.onError?.(P)}},{emitOnBegin:!0,interval:d});return async()=>{b&&await R(e,fs,"uninstallFilter")({filter:b}),A()}})})():(()=>{let g=l??!1,v=Y(["watchContractEvent",n,o,s,e.uid,i,d,g]),E=!0,x=()=>E=!1;return at(v,{onLogs:u,onError:c},b=>((async()=>{try{let w=(()=>{if(e.transport.type==="fallback"){let B=e.transport.transports.find(k=>k.config.type==="webSocket"||k.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),A=i?nr({abi:r,eventName:i,args:o}):[],{unsubscribe:P}=await w.subscribe({params:["logs",{address:n,topics:A}],onData(B){if(!E)return;let k=B.result;try{let{eventName:S,args:N}=kn({abi:r,data:k.data,topics:k.topics,strict:l}),_=Ue(k,{args:N,eventName:S});b.onLogs([_])}catch(S){let N,_;if(S instanceof yr||S instanceof Hr){if(l)return;N=S.abiItem.name,_=S.abiItem.inputs?.some($=>!("name"in $&&$.name))}let z=Ue(k,{args:_?[]:{},eventName:N});b.onLogs([z])}},onError(B){b.onError?.(B)}});x=P,E||x()}catch(w){c?.(w)}})(),()=>x()))})()}var Eh=p(()=>{le();ko();Wu();ei();Zr();ee();cs();gi();Je();ld();pc();jd();nf();of()});var Re,lr,Qr=p(()=>{V();Re=class extends T{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
44
- `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}},lr=class extends T{constructor({docsPath:t,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:t,metaMessages:r,name:"AccountTypeNotSupportedError"})}}});function ds({chain:e,currentChainId:t}){if(!e)throw new cc;if(t!==e.id)throw new ac({chain:e,currentChainId:t})}var sf=p(()=>{uc()});async function lc(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}var bm=p(()=>{});async function ms(e,t){let{account:r=e.account,assertChainId:n=!0,chain:o=e.chain,accessList:s,authorizationList:i,blobs:a,data:c,dataSuffix:u=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,type:g,value:v,...E}=t;if(typeof r>"u")throw new Re({docsPath:"/docs/actions/wallet/sendTransaction"});let x=r?G(r):null,b;try{_e(t);let w=await(async()=>{if(t.to)return t.to;if(t.to!==null&&i&&i.length>0)return await zo({authorization:i[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`.")})})();if(x?.type==="json-rpc"||x===null){let A;o!==null&&(A=await R(e,Ve,"getChainId")({}),n&&ds({currentChainId:A,chain:o}));let P=e.chain?.formatters?.transactionRequest?.format,k=(P||Be)({...$t(E,{format:P}),accessList:s,account:x,authorizationList:i,blobs:a,chainId:A,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,to:w,type:g,value:v},"sendTransaction"),S=Ah.get(e.uid),N=S?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:N,params:[k]},{retryCount:0})}catch(_){if(S===!1)throw _;let z=_;if(z.name==="InvalidInputRpcError"||z.name==="InvalidParamsRpcError"||z.name==="MethodNotFoundRpcError"||z.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[k]},{retryCount:0}).then($=>(Ah.set(e.uid,!0),$)).catch($=>{let C=$;throw C.name==="MethodNotFoundRpcError"||C.name==="MethodNotSupportedRpcError"?(Ah.set(e.uid,!1),z):C});throw z}}if(x?.type==="local"){if(x.nonceManager&&typeof y>"u"){let k=E.chainId,S=await(async()=>typeof k=="number"?k:o?o.id:R(e,Ve,"getChainId")({}))();b={address:x.address,chainId:S}}let A=await R(e,Kr,"prepareTransactionRequest")({account:x,accessList:s,authorizationList:i,blobs:a,chain:o,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,nonceManager:x.nonceManager,parameters:[...Gu,"sidecars"],type:g,value:v,...E,to:w}),P=o?.serializers?.transaction,B=await x.signTransaction(A,{serializer:P});return await R(e,lc,"sendRawTransaction")({serializedTransaction:B})}throw x?.type==="smart"?new lr({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new lr({docsPath:"/docs/actions/wallet/sendTransaction",type:x?.type})}catch(w){throw w instanceof lr?w:(b&&x?.nonceManager?.reset(b),ts(w,{...t,account:x,chain:t.chain||void 0}))}}var Ah,af=p(()=>{be();Qr();V();Mu();sf();Me();ju();Vo();Sr();ee();eo();Ir();Bn();Wa();bm();Ah=new rt(128)});async function Xt(e,t){return Xt.internal(e,ms,"sendTransaction",t)}var hc=p(()=>{be();Qr();Ze();Co();ee();af();(function(e){async function t(r,n,o,s){let{abi:i,account:a=r.account,address:c,args:u,functionName:f,...d}=s;if(typeof a>"u")throw new Re({docsPath:"/docs/contract/writeContract"});let l=a?G(a):null,m=ne({abi:i,args:u,functionName:f});try{return await R(r,n,o)({data:m,to:c,account:l,...d})}catch(h){throw ht(h,{abi:i,address:c,args:u,docsPath:"/docs/contract/writeContract",functionName:f,sender:l?.address})}}e.internal=t})(Xt||(Xt={}))});function $5({abi:e,address:t,client:r}){let n=r,[o,s]=n?"public"in n&&"wallet"in n?[n.public,n.wallet]:"public"in n?[n.public,void 0]:"wallet"in n?[void 0,n.wallet]:[n,n]:[void 0,void 0],i=o!=null,a=s!=null,c={},u=!1,f=!1,d=!1;for(let l of e)if(l.type==="function"?l.stateMutability==="view"||l.stateMutability==="pure"?u=!0:f=!0:l.type==="event"&&(d=!0),u&&f&&d)break;return i&&(u&&(c.read=new Proxy({},{get(l,m){return(...h)=>{let{args:y,options:g}=xm(h);return R(o,oe,"readContract")({abi:e,address:t,functionName:m,args:y,...g})}}})),f&&(c.simulate=new Proxy({},{get(l,m){return(...h)=>{let{args:y,options:g}=xm(h);return R(o,as,"simulateContract")({abi:e,address:t,functionName:m,args:y,...g})}}})),d&&(c.createEventFilter=new Proxy({},{get(l,m){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===m),{args:g,options:v}=Th(h,y);return R(o,fa,"createContractEventFilter")({abi:e,address:t,eventName:m,args:g,...v})}}}),c.getEvents=new Proxy({},{get(l,m){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===m),{args:g,options:v}=Th(h,y);return R(o,Ja,"getContractEvents")({abi:e,address:t,eventName:m,args:g,...v})}}}),c.watchEvent=new Proxy({},{get(l,m){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===m),{args:g,options:v}=Th(h,y);return R(o,ym,"watchContractEvent")({abi:e,address:t,eventName:m,args:g,...v})}}}))),a&&f&&(c.write=new Proxy({},{get(l,m){return(...h)=>{let{args:y,options:g}=xm(h);return R(s,Xt,"writeContract")({abi:e,address:t,functionName:m,args:y,...g})}}})),(i||a)&&f&&(c.estimateGas=new Proxy({},{get(l,m){return(...h)=>{let{args:y,options:g}=xm(h);return R(o??s,rs,"estimateContractGas")({abi:e,address:t,functionName:m,args:y,...g,account:g.account??s.account})}}})),c.address=t,c.abi=e,c}function xm(e){let t=e.length&&Array.isArray(e[0]),r=t?e[0]:[],n=(t?e[1]:e[0])??{};return{args:r,options:n}}function Th(e,t){let r=!1;Array.isArray(e[0])?r=!0:e.length===1?r=t.inputs.some(s=>s.indexed):e.length===2&&(r=!0);let n=r?e[0]:void 0,o=(r?e[1]:e[0])??{};return{args:n,options:o}}var N5=p(()=>{ee();ld();Vu();jd();it();rf();Eh();hc()});var yc,Ph=p(()=>{V();yc=class extends T{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}});function Mn(e,{delay:t=100,retryCount:r=2,shouldRetry:n=()=>!0,signal:o}={}){return new Promise((s,i)=>{let a=async({count:c=0}={})=>{if(o?.aborted){i(Ye(o));return}let u=async({error:f})=>{let d=typeof t=="function"?t({count:c,error:f}):t;if(d)try{await xi(d,{signal:o})}catch(l){i(l);return}a({count:c+1})};try{let f=await e();s(f)}catch(f){if(o?.aborted){i(Ye(o));return}if(It(f)){i(f);return}if(c<r&&await n({count:c,error:f}))return u({error:f});i(f)}};a()})}var cf=p(()=>{Er();lm()});function zn(e,t){let r={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Ue(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Z(e.transactionIndex):null,status:e.status?Sh[e.status]:null,type:e.type?Fu[e.type]||e.type:null};return e.blobGasPrice&&(r.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(r.blobGasUsed=BigInt(e.blobGasUsed)),r}var Sh,H5,bc=p(()=>{ve();_u();Zr();La();Sh={"0x0":"reverted","0x1":"success"};H5=Wo("transactionReceipt",zn)});async function gm(e,t){let{account:r=e.account,chain:n=e.chain,experimental_fallback:o,experimental_fallbackDelay:s=32,forceAtomic:i=!1,id:a,version:c="2.0.0"}=t,u=r?G(r):null,f=t.capabilities;e.dataSuffix&&!t.capabilities?.dataSuffix&&(typeof e.dataSuffix=="string"?f={...t.capabilities,dataSuffix:{value:e.dataSuffix,optional:!0}}:f={...t.capabilities,dataSuffix:{value:e.dataSuffix.value,...e.dataSuffix.required?{}:{optional:!0}}});let d=t.calls.map(l=>{let m=l,h=m.abi?ne({abi:m.abi,functionName:m.functionName,args:m.args}):m.data;return{data:m.dataSuffix&&h?ie([h,m.dataSuffix]):h,to:m.to,value:m.value?I(m.value):void 0}});try{let l=await e.request({method:"wallet_sendCalls",params:[{atomicRequired:i,calls:d,capabilities:f,chainId:I(n.id),from:u?.address,id:a,version:c}]},{retryCount:0});return typeof l=="string"?{id:l}:l}catch(l){let m=l;if(o&&(m.name==="MethodNotFoundRpcError"||m.name==="MethodNotSupportedRpcError"||m.name==="UnknownRpcError"||m.details.toLowerCase().includes("does not exist / is not available")||m.details.toLowerCase().includes("missing or invalid. request()")||m.details.toLowerCase().includes("did not match any variant of untagged enum")||m.details.toLowerCase().includes("account upgraded to unsupported contract")||m.details.toLowerCase().includes("eip-7702 not supported")||m.details.toLowerCase().includes("unsupported wc_ method")||m.details.toLowerCase().includes("feature toggled misconfigured")||m.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(f&&Object.values(f).some(v=>!v.optional)){let v="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new Dr(new T(v,{details:v}))}if(i&&d.length>1){let g="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new qr(new T(g,{details:g}))}let h=[];for(let g of d){try{let v=await ms(e,{account:u,chain:n,data:g.data,to:g.to,value:g.value?j(g.value):void 0});h.push({status:"fulfilled",value:v})}catch(v){h.push({reason:v,status:"rejected"})}s>0&&await new Promise(v=>setTimeout(v,s))}if(h.every(g=>g.status==="rejected"))throw h[0].reason;let y=h.map(g=>g.status==="fulfilled"?g.value:Bh);return{id:ie([...y,I(n.id,{size:32}),Ih])}}throw ts(l,{...t,account:u,chain:t.chain})}}var Ih,Bh,wm=p(()=>{be();V();ko();Ze();Me();ve();L();ju();af();Ih="0x5792579257925792579257925792579257925792579257925792579257925792",Bh=I(0,{size:32})});async function vm(e,t){async function r(f){if(f.endsWith(Ih.slice(2))){let l=he(_r(f,-64,-32)),m=_r(f,0,-64).slice(2).match(/.{1,64}/g),h=await Promise.all(m.map(g=>Bh.slice(2)!==g?e.request({method:"eth_getTransactionReceipt",params:[`0x${g}`]},{dedupe:!0}):void 0)),y=h.some(g=>g===null)?100:h.every(g=>g?.status==="0x1")?200:h.every(g=>g?.status==="0x0")?500:600;return{atomic:!1,chainId:Z(l),receipts:h.filter(Boolean),status:y,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[f]})}let{atomic:n=!1,chainId:o,receipts:s,version:i="2.0.0",...a}=await r(t.id),[c,u]=(()=>{let f=a.status;return f>=100&&f<200?["pending",f]:f>=200&&f<300?["success",f]:f>=300&&f<700?["failure",f]:f==="CONFIRMED"?["success",200]:f==="PENDING"?["pending",100]:[void 0,f]})();return{...a,atomic:n,chainId:o?Z(o):void 0,receipts:s?.map(f=>({...f,blockNumber:j(f.blockNumber),gasUsed:j(f.gasUsed),status:Sh[f.status]}))??[],statusCode:u,status:c,version:i}}var kh=p(()=>{jt();cn();ve();bc();wm()});async function Em(e,t){let{id:r,pollingInterval:n=e.pollingInterval,status:o=({statusCode:y})=>y===200||y>=300,retryCount:s=4,retryDelay:i=({count:y})=>~~(1<<y)*200,timeout:a=6e4,throwOnFailure:c=!1}=t,u=Y(["waitForCallsStatus",e.uid,r]),{promise:f,resolve:d,reject:l}=fc(),m,h=at(u,{resolve:d,reject:l},y=>{let g=pr(async()=>{let v=E=>{clearTimeout(m),g(),E(),h()};try{let E=await Mn(async()=>{let x=await R(e,vm,"getCallsStatus")({id:r});if(c&&x.status==="failure")throw new yc(x);return x},{retryCount:s,delay:i});if(!o(E))return;v(()=>y.resolve(E))}catch(E){v(()=>y.reject(E))}},{interval:n,emitOnBegin:!0});return g});return m=a?setTimeout(()=>{h(),clearTimeout(m),l(new uf({id:r}))},a):void 0,await f}var uf,Am=p(()=>{V();Ph();ee();cs();gi();om();cf();Je();kh();uf=class extends T{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}});function Sm(e=11){if(!Pm||Tm+e>256*2){Pm="",Tm=0;for(let t=0;t<256;t++)Pm+=(256+Math.random()*256|0).toString(16).substring(1)}return Pm.substring(Tm,Tm+++e)}var Tm,Pm,Ch=p(()=>{Tm=256});function ps(e){let{batch:t,chain:r,ccipRead:n,dataSuffix:o,key:s="base",name:i="Base Client",tokens:a,type:c="base"}=e,u=e.experimental_blockTag??(typeof r?.experimental_preconfirmationTime=="number"?"pending":void 0),f=r?.blockTime??12e3,d=Math.min(Math.max(Math.floor(f/2),500),4e3),l=e.pollingInterval??d,m=e.cacheTime??l,h=e.account?G(e.account):void 0,{config:y,request:g,value:v}=e.transport({account:h,chain:r,pollingInterval:l}),E={...y,...v},x={account:h,batch:t,cacheTime:m,ccipRead:n,chain:r,dataSuffix:o,key:s,name:i,pollingInterval:l,request:g,tokens:a,transport:E,type:c,uid:Sm(),...u?{experimental_blockTag:u}:{}};function b(w){return A=>{let P=A(w);for(let k in x)delete P[k];let B={...w,...P};for(let k in P){let S=w[k],N=P[k];M5(S)&&M5(N)&&(B[k]={...S,...N})}return Object.assign(B,{extend:b(B)})}}return Object.assign(x,{extend:b(x)})}function M5(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function en(e,t){let r=(n={})=>t(e,n);for(let n of["call","calls","callWithPeriod","estimateGas","simulate"])if(Object.hasOwn(t,n)){let o=t[n];r[n]=(s={})=>o.length>=2?o(e,s):o.length===0?o():o(s)}for(let n of["extractEvent","extractEvents"])Object.hasOwn(t,n)&&(r[n]=t[n]);return r}function z5(){return null}var wi=p(()=>{be();Ch()});function xc(e){if(!(e instanceof T))return!1;let t=e.walk(r=>r instanceof yn);return t instanceof yn?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}var Im=p(()=>{V();bn()});function Bm(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;let t=`0x${e.slice(1,65)}`;return O(t)?t:null}var Rh=p(()=>{ut()});function vi(e){let t=new Uint8Array(32).fill(0);if(!e)return K(t);let r=e.split(".");for(let n=r.length-1;n>=0;n-=1){let o=Bm(r[n]),s=o?Ee(o):te(Dt(r[n]),"bytes");t=te(ie([t,s]),"bytes")}return K(t)}var km=p(()=>{Me();ue();L();St();Rh()});function _5(e){return`[${e.slice(2)}]`}var U5=p(()=>{});function Cm(e){let t=new Uint8Array(32).fill(0);return e?Bm(e)||te(Dt(e)):K(t)}var $h=p(()=>{ue();L();St();Rh()});function gc(e){let t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);let r=new Uint8Array(Dt(t).byteLength+2),n=0,o=t.split(".");for(let s=0;s<o.length;s++){let i=Dt(o[s]);i.byteLength>255&&(i=Dt(_5(Cm(o[s])))),r[n]=i.length,r.set(i,n+1),n+=i.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}var Rm=p(()=>{ue();U5();$h()});async function F5(e,t){let{blockNumber:r,blockTag:n,coinType:o,name:s,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(l=>s.endsWith(l)))return null;let d=o!=null?[vi(s),BigInt(o)]:[vi(s)];try{let l=ne({abi:ah,functionName:"addr",args:d}),m={address:u,abi:tm,functionName:"resolveWithGateways",args:[pe(gc(s)),l,i??[kr]],blockNumber:r,blockTag:n},y=await R(e,oe,"readContract")(m);if(y[0]==="0x")return null;let g=Z9({coinType:o,data:y[0],args:d});return g==="0x"||he(g)==="0x00"?null:g}catch(l){if(a)throw l;if(xc(l))return null;throw l}}function Z9({coinType:e,data:t,args:r}){try{return Fe({abi:ah,args:r,functionName:"addr",data:t})}catch(n){if(e==null)throw n;let o=he(t);if(J(o)===20)return ye(o);throw n}}var L5=p(()=>{Ke();Br();Ze();dt();is();et();cn();L();Im();mc();km();Rm();ee();it()});var $m,tn,ls,wc,vc,Nm=p(()=>{V();$m=class extends T{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}},tn=class extends T{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}},ls=class extends T{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}},wc=class extends T{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}},vc=class extends T{constructor({chainId:t}){super(`Invalid ENSIP-11 chainId: ${t}. Must be between 0 and 0x7fffffff, or 1.`,{name:"EnsInvalidChainIdError"})}}});async function eT(e){try{let t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(r=>{let n=new Image;n.onload=()=>{r(!0)},n.onerror=()=>{r(!1)},n.src=e})}}function O5(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Nh({uri:e,gatewayUrls:t}){let r=X9.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};let n=O5(t?.ipfs,"https://ipfs.io"),o=O5(t?.arweave,"https://arweave.net"),s=e.match(J9),{protocol:i,subpath:a,target:c,subtarget:u=""}=s?.groups||{},f=i==="ipns:/"||a==="ipns/",d=i==="ipfs:/"||a==="ipfs/"||Y9.test(e);if(e.startsWith("http")&&!f&&!d){let m=e;return t?.arweave&&(m=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:m,isOnChain:!1,isEncoded:!1}}if((f||d)&&c)return{uri:`${n}/${f?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&c)return{uri:`${o}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let l=e.replace(Q9,"");if(l.startsWith("<svg")&&(l=`data:image/svg+xml;base64,${btoa(l)}`),l.startsWith("data:")||l.startsWith("{"))return{uri:l,isOnChain:!0,isEncoded:!1};throw new ls({uri:e})}function Hh(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new $m({data:e});return e.image||e.image_url||e.image_data}async function D5({gatewayUrls:e,uri:t}){try{let r=await fetch(t).then(o=>o.json());return await Hm({gatewayUrls:e,uri:Hh(r)})}catch{throw new ls({uri:t})}}async function Hm({gatewayUrls:e,uri:t}){let{uri:r,isOnChain:n}=Nh({uri:t,gatewayUrls:e});if(n||await eT(r))return r;throw new ls({uri:t})}function q5(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));let[r,n,o]=t.split("/"),[s,i]=r.split(":"),[a,c]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new tn({reason:"Only EIP-155 supported"});if(!i)throw new tn({reason:"Chain ID not found"});if(!c)throw new tn({reason:"Contract address not found"});if(!o)throw new tn({reason:"Token ID not found"});if(!a)throw new tn({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:o}}async function j5(e,{nft:t}){if(t.namespace==="erc721")return oe(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return oe(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new wc({namespace:t.namespace})}var J9,Y9,X9,Q9,G5=p(()=>{it();Nm();J9=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Y9=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,X9=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Q9=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/});async function V5(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?tT(e,{gatewayUrls:t,record:r}):Hm({uri:r,gatewayUrls:t})}async function tT(e,{gatewayUrls:t,record:r}){let n=q5(r),o=await j5(e,{nft:n}),{uri:s,isOnChain:i,isEncoded:a}=Nh({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){let u=a?atob(s.replace("data:application/json;base64,","")):s,f=JSON.parse(u);return Hm({uri:Hh(f),gatewayUrls:t})}let c=n.tokenID;return n.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),D5({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,c)})}var W5=p(()=>{G5()});async function Mm(e,t){let{blockNumber:r,blockTag:n,key:o,name:s,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(d=>s.endsWith(d)))return null;try{let d={address:u,abi:tm,args:[pe(gc(s)),ne({abi:ih,functionName:"text",args:[vi(s),o]}),i??[kr]],functionName:"resolveWithGateways",blockNumber:r,blockTag:n},m=await R(e,oe,"readContract")(d);if(m[0]==="0x")return null;let h=Fe({abi:ih,functionName:"text",data:m[0]});return h===""?null:h}catch(d){if(a)throw d;if(xc(d))return null;throw d}}var Mh=p(()=>{Ke();Br();Ze();is();L();Im();mc();km();Rm();ee();it()});async function K5(e,{blockNumber:t,blockTag:r,assetGatewayUrls:n,name:o,gatewayUrls:s,strict:i,universalResolverAddress:a}){let c=await R(e,Mm,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:o,universalResolverAddress:a,gatewayUrls:s,strict:i});if(!c)return null;try{return await V5(e,{record:c,gatewayUrls:n})}catch{return null}}var Z5=p(()=>{W5();ee();Mh()});async function J5(e,t){let{address:r,blockNumber:n,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})();try{let f={address:u,abi:g5,args:[r,s,i??[kr]],functionName:"reverseWithGateways",blockNumber:n,blockTag:o},d=R(e,oe,"readContract"),[l]=await d(f);return l||null}catch(f){if(a)throw f;if(xc(f))return null;throw f}}var Y5=p(()=>{Ke();is();Im();mc();ee();it()});async function X5(e,t){let{blockNumber:r,blockTag:n,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:s,contract:"ensUniversalResolver"})})(),a=s?.ensTlds;if(a&&!a.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${a?.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);let[c]=await R(e,oe,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[pe(gc(o))],blockNumber:r,blockTag:n});return c}var Q5=p(()=>{is();L();Rm();ee();it()});async function zm(e,t){let{account:r=e.account,blockNumber:n,blockTag:o="latest",blobs:s,data:i,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:d,to:l,value:m,...h}=t,y=r?G(r):void 0;try{_e(t);let v=(typeof n=="bigint"?I(n):void 0)||o,E=e.chain?.formatters?.transactionRequest?.format,b=(E||Be)({...$t(h,{format:E}),account:y,blobs:s,data:i,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:d,to:l,value:m},"createAccessList"),w=await e.request({method:"eth_createAccessList",params:[b,v]});if(w.error)throw new T(w.error,{details:w.error});return{accessList:w.accessList,gasUsed:BigInt(w.gasUsed)}}catch(g){throw nm(g,{...t,account:y,chain:e.chain})}}var zh=p(()=>{be();V();L();fh();Vo();Sr();Ir()});async function e2(e){let t=to(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}var t2=p(()=>{yu()});async function _m(e,{address:t,args:r,event:n,events:o,fromBlock:s,strict:i,toBlock:a}={}){let c=o??(n?[n]:void 0),u=to(e,{method:"eth_newFilter"}),f=[];c&&(f=[c.flatMap(m=>nr({abi:[m],eventName:m.name,args:r}))],n&&(f=f[0]));let d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?I(s):s,toBlock:typeof a=="bigint"?I(a):a,...f.length?{topics:f}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!i,toBlock:a,type:"event"}}var _h=p(()=>{ei();L();yu()});async function Um(e){let t=to(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}var Uh=p(()=>{yu()});async function r2(e,{address:t,blockHash:r,blockNumber:n,blockTag:o=e.experimental_blockTag??"latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});if(e.batch?.multicall&&e.chain?.contracts?.multicall3){let c=e.chain.contracts.multicall3.address,u=ne({abi:dr,functionName:"getEthBalance",args:[t]}),{data:f}=await R(e,mr,"call")({to:c,data:u,blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});return Fe({abi:dr,functionName:"getEthBalance",args:[t],data:f||"0x"})}let a=await e.request({method:"eth_getBalance",params:[t,i]});return BigInt(a)}var n2=p(()=>{Ke();Br();Ze();mi();ee();bi()});async function o2(e){let t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}var s2=p(()=>{});async function i2(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest"}={}){let o=r!==void 0?I(r):void 0,s=await e.request({method:"eth_getBlockReceipts",params:[t||o||n]},{dedupe:!!(t||o)});if(!s)throw new Wr({blockHash:t,blockNumber:r});let i=e.chain?.formatters?.transactionReceipt?.format||zn;return s.map(a=>i(a,"getBlockReceipts"))}var a2=p(()=>{Uu();L();bc()});async function c2(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){let o=r!==void 0?I(r):void 0,s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||n]},{dedupe:!!o}),Z(s)}var u2=p(()=>{ve();L()});async function Ei(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),a=await e.request({method:"eth_getCode",params:[t,i]},{dedupe:typeof n=="bigint"||r!==void 0});if(a!=="0x")return a}var Fm=p(()=>{mi()});async function f2(e,{address:t,blockNumber:r,blockTag:n="latest"}){let o=await Ei(e,{address:t,...r!==void 0?{blockNumber:r}:{blockTag:n}});if(o&&J(o)===23&&o.startsWith("0xef0100"))return ye(De(o,3,23))}var d2=p(()=>{dt();et();jt();Fm()});var Lm,m2=p(()=>{V();Lm=class extends T{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}});async function p2(e,t){let{address:r,factory:n,factoryData:o}=t;try{let[s,i,a,c,u,f,d]=await R(e,oe,"readContract")({abi:rT,address:r,functionName:"eip712Domain",factory:n,factoryData:o});return{domain:{name:i,version:a,chainId:Number(c),verifyingContract:u,salt:f},extensions:d,fields:s}}catch(s){let i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Lm({address:r}):i}}var rT,l2=p(()=>{m2();ee();it();rT=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}]});function h2(e){return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map(t=>t.map(r=>BigInt(r)))}}var y2=p(()=>{});async function b2(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:o}){let s=typeof r=="bigint"?I(r):void 0,i=await e.request({method:"eth_feeHistory",params:[I(t),s||n,o]},{dedupe:!!s});return h2(i)}var x2=p(()=>{L();y2()});async function g2(e,{filter:t}){let r=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Ue(s));return t.abi?ur({abi:t.abi,logs:o,strict:r}):o}var w2=p(()=>{pi();Zr()});function v2(e,t){if(e.length!==t.length)throw new Wn({expectedLength:e.length,givenLength:t.length});let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n];r.push(E2(o,s))}return Ae(r)}function E2(e,t,r=!1){if(e==="address"){let i=t;if(!Q(i))throw new ae({address:i});return tt(i.toLowerCase(),{size:r?32:null})}if(e==="string")return tr(t);if(e==="bytes")return t;if(e==="bool")return tt(Zs(t),{size:r?32:1});let n=e.match(ua);if(n){let[i,a,c="256"]=n,u=Number.parseInt(c,10)/8;return I(t,{size:r?32:u,signed:a==="int"})}let o=e.match(dd);if(o){let[i,a]=o;if(Number.parseInt(a,10)!==(t.length-2)/2)throw new Jn({expectedSize:Number.parseInt(a,10),givenSize:(t.length-2)/2});return tt(t,{dir:"right",size:r?32:null})}let s=e.match(j1);if(s&&Array.isArray(t)){let[i,a]=s,c=[];for(let u=0;u<t.length;u++)c.push(E2(a,t[u],!0));return c.length===0?"0x":Ae(c)}throw new Qi(e)}var A2=p(()=>{le();rr();mt();Me();Xn();L();md()});function ff(e){return!e||typeof e!="object"||!("BYTES_PER_ELEMENT"in e)?!1:e.BYTES_PER_ELEMENT===1&&e.constructor.name==="Uint8Array"}var Fh=p(()=>{});function T2(e){return e.opcode==="CREATE2"?Oh(e):Lh(e)}function Lh(e){let t=Ee(ye(e.from)),r=Ee(e.nonce);return r[0]===0&&(r=new Uint8Array([])),ye(`0x${te(wt([t,r],"bytes")).slice(26)}`)}function Oh(e){let t=Ee(ye(e.from)),r=tt(ff(e.salt)?e.salt:Ee(e.salt),{size:32}),n="bytecodeHash"in e?ff(e.bytecodeHash)?e.bytecodeHash:Ee(e.bytecodeHash):te(e.bytecode,"bytes");return ye(De(te(ie([Ee("0xff"),t,r,n])),12))}var P2=p(()=>{Me();Fh();Xn();jt();ue();Hu();St();dt()});function Om(e){let{authorizationList:t}=e;if(t)for(let r of t){let{chainId:n}=r,o=r.address;if(!Q(o))throw new ae({address:o});if(n<0)throw new Nn({chainId:n})}hs(e)}function Dm(e){let{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new ja;for(let r of t){let n=J(r),o=Z(De(r,0,1));if(n!==32)throw new _d({hash:r,size:n});if(o!==1)throw new Ud({hash:r,version:o})}}hs(e)}function hs(e){let{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:n,to:o}=e;if(t<=0)throw new Nn({chainId:t});if(o&&!Q(o))throw new ae({address:o});if(n&&n>Ko)throw new Ct({maxFeePerGas:n});if(r&&n&&r>n)throw new cr({maxFeePerGas:n,maxPriorityFeePerGas:r})}function Ec(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:o,to:s}=e;if(t<=0)throw new Nn({chainId:t});if(s&&!Q(s))throw new ae({address:s});if(r||o)throw new T("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>Ko)throw new Ct({maxFeePerGas:n})}function Ac(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:o,to:s}=e;if(s&&!Q(s))throw new ae({address:s});if(typeof t<"u"&&t<=0)throw new Nn({chainId:t});if(r||o)throw new T("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>Ko)throw new Ct({maxFeePerGas:n})}var qm=p(()=>{kd();rr();V();Wl();uc();Gr();mt();et();jt();ve()});function Ai(e){if(!e||e.length===0)return[];let t=[];for(let r=0;r<e.length;r++){let{address:n,storageKeys:o}=e[r];for(let s=0;s<o.length;s++)if(o[s].length-2!==64)throw new Aa({storageKey:o[s]});if(!Q(n,{strict:!1}))throw new ae({address:n});t.push([n,o])}return t}var Dh=p(()=>{rr();lt();mt()});function jm(e,t){let r=Ga(e);return r==="eip1559"?sT(e,t):r==="eip2930"?iT(e,t):r==="eip4844"?oT(e,t):r==="eip7702"?nT(e,t):aT(e,t)}function nT(e,t){let{authorizationList:r,chainId:n,gas:o,nonce:s,to:i,value:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:d}=e;Om(e);let l=Ai(f),m=S2(r);return Ae(["0x04",wt([I(n),s?I(s):"0x",u?I(u):"0x",c?I(c):"0x",o?I(o):"0x",i??"0x",a?I(a):"0x",d??"0x",l,m,...Tc(e,t)])])}function oT(e,t){let{chainId:r,gas:n,nonce:o,to:s,value:i,maxFeePerBlobGas:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:d}=e;Dm(e);let l=e.blobVersionedHashes,m=e.sidecars;if(e.blobs&&(typeof l>"u"||typeof m>"u")){let x=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(A=>K(A)),b=e.kzg,w=Xo({blobs:x,kzg:b});if(typeof l>"u"&&(l=qa({commitments:w})),typeof m>"u"){let A=Qo({blobs:x,commitments:w,kzg:b});m=es({blobs:x,commitments:w,proofs:A})}}let h=Ai(f),y=[I(r),o?I(o):"0x",u?I(u):"0x",c?I(c):"0x",n?I(n):"0x",s??"0x",i?I(i):"0x",d??"0x",h,a?I(a):"0x",l??[],...Tc(e,t)],g=[],v=[],E=[];if(m)for(let x=0;x<m.length;x++){let{blob:b,commitment:w,proof:A}=m[x];g.push(b),v.push(w),E.push(A)}return Ae(["0x03",m?wt([y,g,v,E]):wt(y)])}function sT(e,t){let{chainId:r,gas:n,nonce:o,to:s,value:i,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:u,data:f}=e;hs(e);let d=Ai(u),l=[I(r),o?I(o):"0x",c?I(c):"0x",a?I(a):"0x",n?I(n):"0x",s??"0x",i?I(i):"0x",f??"0x",d,...Tc(e,t)];return Ae(["0x02",wt(l)])}function iT(e,t){let{chainId:r,gas:n,data:o,nonce:s,to:i,value:a,accessList:c,gasPrice:u}=e;Ec(e);let f=Ai(c),d=[I(r),s?I(s):"0x",u?I(u):"0x",n?I(n):"0x",i??"0x",a?I(a):"0x",o??"0x",f,...Tc(e,t)];return Ae(["0x01",wt(d)])}function aT(e,t){let{chainId:r=0,gas:n,data:o,nonce:s,to:i,value:a,gasPrice:c}=e;Ac(e);let u=[s?I(s):"0x",c?I(c):"0x",n?I(n):"0x",i??"0x",a?I(a):"0x",o??"0x"];if(t){let f=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(r>0)return BigInt(r*2)+BigInt(35n+t.v-27n);let m=27n+(t.v===27n?0n:1n);if(t.v!==m)throw new so({v:t.v});return m})(),d=he(t.r),l=he(t.s);u=[...u,I(f),d==="0x00"?"0x":d,l==="0x00"?"0x":l]}else r>0&&(u=[...u,I(r),"0x","0x"]);return wt(u)}function Tc(e,t){let r=t??e,{v:n,yParity:o}=r;if(typeof r.r>"u")return[];if(typeof r.s>"u")return[];if(typeof n>"u"&&typeof o>"u")return[];let s=he(r.r),i=he(r.s);return[typeof o=="number"?o?I(1):"0x":n===0n?"0x":n===1n?I(1):n===27n?"0x":I(1),s==="0x00"?"0x":s,i==="0x00"?"0x":i]}var Gm=p(()=>{lt();I2();Ou();Du();Md();qu();Me();cn();L();Hu();qm();Ld();Dh()});function S2(e){if(!e||e.length===0)return[];let t=[];for(let r of e){let{chainId:n,nonce:o,...s}=r,i=r.address;t.push([n?pe(n):"0x",i,o?pe(o):"0x",...Tc({},s)])}return t}var I2=p(()=>{L();Gm()});async function B2({address:e,authorization:t,signature:r}){return de(ye(e),await zo({authorization:t,signature:r}))}var k2=p(()=>{dt();Jt();Mu()});function C2(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(Vm.get(r))return Vm.get(r);let n=e().finally(()=>Vm.delete(r));return Vm.set(r,n),n}var Vm,R2=p(()=>{eo();Vm=new rt(8192)});function $2(e,t={}){return async(r,n={})=>{let{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:a=3,signal:c,uid:u}={...t,...n},{method:f}=r;if(s?.exclude?.includes(f))throw new Or(new Error("method not supported"),{method:f});if(s?.include&&!s.include.includes(f))throw new Or(new Error("method not supported"),{method:f});if(c?.aborted)throw Ye(c);let d=o?uT(`${u}.${Y(r)}`):void 0;return C2(()=>Mn(async()=>{try{return await e(r,c?{signal:c}:void 0)}catch(l){if(c?.aborted)throw Ye(c);if(It(l))throw l;let m=l;switch(m.code){case fo.code:throw new fo(m);case mo.code:throw new mo(m);case po.code:throw new po(m,{method:r.method});case lo.code:throw new lo(m);case Ar.code:throw new Ar(m);case Bt.code:throw new Bt(m);case ho.code:throw new ho(m);case yo.code:throw new yo(m);case Lr.code:throw new Lr(m);case Or.code:throw new Or(m,{method:r.method});case wn.code:throw new wn(m);case bo.code:throw new bo(m);case Tr.code:throw new Tr(m);case xo.code:throw new xo(m);case go.code:throw new go(m);case wo.code:throw new wo(m);case vo.code:throw new vo(m);case Eo.code:throw new Eo(m);case Dr.code:throw new Dr(m);case Ao.code:throw new Ao(m);case To.code:throw new To(m);case Po.code:throw new Po(m);case So.code:throw new So(m);case Io.code:throw new Io(m);case qr.code:throw new qr(m);case 5e3:throw new Tr(m);case Bo.code:throw new Bo(m);default:throw l instanceof T?l:new Ba(m)}}},{delay:({count:l,error:m})=>{if(m&&m instanceof ot){let h=m?.headers?.get("Retry-After");if(h?.match(/\d/))return Number.parseInt(h,10)*1e3}return~~(1<<l)*i},retryCount:a,signal:c,shouldRetry:({error:l})=>cT(l)}),{enabled:o,id:d})}}function cT(e){return It(e)?!1:"code"in e&&typeof e.code=="number"?e.code===-1||e.code===wn.code||e.code===Ar.code||e.code===429:e instanceof ot&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function uT(e,t=0){let r=3735928559^t,n=1103547991^t;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);r=Math.imul(r^s,2654435761),n=Math.imul(n^s,1597334677)}return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>16,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>16,3266489909),(4294967296*(2097151&n)+(r>>>0)).toString(36)}var N2=p(()=>{V();ar();ko();Er();R2();cf();Je()});function H2({batchGateways:e,ccipRequest:t=yi}){return{async request({data:r,sender:n,urls:o}){if(o.includes(kr))return t({data:r,sender:n,urls:e});{let[s,i]=Fe({abi:ss,functionName:"query",data:await t({data:ne({abi:ss,functionName:"query",args:[[{sender:n,data:r,urls:o}]]}),sender:n,urls:e})});if(s[0]){let a;try{let c=no({abi:[...ss,da],data:i[0]});if(c.errorName==="HttpError")a=new ot({body:{message:c.args[1]},status:c.args[0],url:o.join(" | ")});else{let u=c.args[0];u&&(a=new Error(u))}}catch{}throw a??new Error("An unknown error occurred.")}return i[0]}}}}var M2=p(()=>{Ke();bu();ar();Au();Br();Ze();mm();mc()});function z2(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};function r(n){return o=>{let s=typeof o=="function"?o(n):o,i={...n,...s};return Object.assign(i,{extend:r(i)})}}return Object.assign(t,{extend:r(t)})}function _2(){return{}}var U2=p(()=>{});function F2({chains:e,id:t}){return e.find(r=>r.id===t)}var L2=p(()=>{});function df(e,t="hex"){let r=(()=>{if(typeof e=="string"){if(e.length>3&&e.length%2!==0)throw new na(e);return re(e)}return e})(),n=vr(r,{recursiveReadLimit:Number.POSITIVE_INFINITY});return q2(n,t)}function q2(e,t="hex",r=0){if(r>=O2)throw new oa({limit:O2});if(e.bytes.length===0)return t==="hex"?K(e.bytes):e.bytes;let n=e.readByte();if(n<128&&e.decrementPosition(1),n<192){let s=D2(e,n,128),i=e.readBytes(s);return t==="hex"?K(i):i}let o=D2(e,n,192);return fT(e,o,t,r+1)}function D2(e,t,r){if(r===128&&t<128)return 1;if(t<=r+55)return t-r;if(t===r+55+1)return e.readUint8();if(t===r+55+2)return e.readUint16();if(t===r+55+3)return e.readUint24();if(t===r+55+4)return e.readUint32();throw new T("Invalid RLP prefix")}function fT(e,t,r,n){let o=e.position,s=[];for(;e.position-o<t;)s.push(q2(e,r,n));return s}var O2,qh=p(()=>{V();Ks();pa();ue();L();O2=1024});function Wm(e){return O(e)&&J(e)===32}var jh=p(()=>{ut();et()});function j2(e,t,r,n){return e===0?t^r^n:e===1?t&r|~t&n:e===2?(t|~r)^n:e===3?t&n|r&~n:t^(r|~n)}var dT,G2,mT,V2,W2,K2,Z2,pT,lT,hT,yT,Km,Zm,J2,Y2=p(()=>{dl();dn();dT=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),G2=Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)),mT=G2.map(e=>(9*e+5)%16),V2=(()=>{let r=[[G2],[mT]];for(let n=0;n<4;n++)for(let o of r)o.push(o[n].map(s=>dT[s]));return r})(),W2=V2[0],K2=V2[1],Z2=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),pT=W2.map((e,t)=>e.map(r=>Z2[t][r])),lT=K2.map((e,t)=>e.map(r=>Z2[t][r])),hT=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),yT=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);Km=new Uint32Array(16),Zm=class extends ka{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:r,h2:n,h3:o,h4:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.h0=t|0,this.h1=r|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,r){for(let m=0;m<16;m++,r+=4)Km[m]=t.getUint32(r,!0);let n=this.h0|0,o=n,s=this.h1|0,i=s,a=this.h2|0,c=a,u=this.h3|0,f=u,d=this.h4|0,l=d;for(let m=0;m<5;m++){let h=4-m,y=hT[m],g=yT[m],v=W2[m],E=K2[m],x=pT[m],b=lT[m];for(let w=0;w<16;w++){let A=mu(n+j2(m,s,a,u)+Km[v[w]]+y,x[w])+d|0;n=d,d=u,u=mu(a,10)|0,a=s,s=A}for(let w=0;w<16;w++){let A=mu(o+j2(h,i,c,f)+Km[E[w]]+g,b[w])+l|0;o=l,l=f,f=mu(c,10)|0,c=i,i=A}}this.set(this.h1+a+f|0,this.h2+u+l|0,this.h3+d+o|0,this.h4+n+i|0,this.h0+s+c|0)}roundClean(){qt(Km)}destroy(){this.destroyed=!0,qt(this.buffer),this.set(0,0,0,0,0)}},J2=aa(()=>new Zm)});var X2,Q2=p(()=>{Y2();X2=J2});function ew(e,t){let r=t||"hex",n=X2(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:pe(n)}var tw=p(()=>{Q2();ut();ue();L()});var rw=p(()=>{lu()});var nw=p(()=>{fd()});var ow=p(()=>{lu()});var sw=p(()=>{fd()});function Gh(e){let{source:t}=e,r=new Map,n=new rt(8192),o=new Map,s=({address:a,chainId:c})=>`${a}.${c}`,i=a=>{r.delete(a),o.delete(a)};return{async consume({address:a,chainId:c,client:u}){let f=s({address:a,chainId:c}),d=this.get({address:a,chainId:c,client:u});this.increment({address:a,chainId:c});let l=await d;return await t.set({address:a,chainId:c},l),n.set(f,l),l},async increment({address:a,chainId:c}){let u=s({address:a,chainId:c}),f=r.get(u)??0;r.set(u,f+1)},async get({address:a,chainId:c,client:u}){let f=s({address:a,chainId:c}),d=o.get(f);return d||(d=(async()=>{try{let m=await t.get({address:a,chainId:c,client:u}),h=n.get(f)??0;return h>0&&m<=h?h+1:(n.delete(f),m)}finally{i(f)}})(),o.set(f,d)),(r.get(f)??0)+await d},reset({address:a,chainId:c}){let u=s({address:a,chainId:c});n.delete(u),i(u)}}}function bT(){return{async get(e){let{address:t,client:r}=e;return Yo(r,{address:t,blockTag:"pending"})},set(){}}}var iw,aw=p(()=>{Lu();eo();iw=Gh({source:bT()})});function Pc(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise((o,s)=>{(async()=>{let i,a=new AbortController;try{r>0&&(i=setTimeout(()=>{n?a.abort():s(t)},r)),o(await e({signal:a?.signal||null}))}catch(c){if(a?.signal.aborted&&It(c)){s(t);return}s(c)}finally{clearTimeout(i)}})()})}var Jm=p(()=>{Er()});function xT(){return{current:0,take(){return this.current++},reset(){this.current=0}}}var mf,Vh=p(()=>{mf=xT()});function cw(e,t={}){let{url:r,headers:n}=vT(e);return{async request(o){let{body:s,fetchFn:i=t.fetchFn??fetch,maxResponseBodySize:a=t.maxResponseBodySize??gT,onRequest:c=t.onRequest,onResponse:u=t.onResponse,timeout:f=t.timeout??1e4}=o,d={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:l,method:m,signal:h}=d;try{let y=await Pc(async({signal:E})=>{let x={...d,body:Array.isArray(s)?Y(s.map(P=>({jsonrpc:"2.0",id:P.id??mf.take(),...P}))):Y({jsonrpc:"2.0",id:s.id??mf.take(),...s}),headers:{...n,"Content-Type":"application/json",...l},method:m||"POST",signal:h||(f>0?E:null)},b=new Request(r,x),w=await c?.(b,x)??{...x,url:r};return await i(w.url??r,w)},{errorInstance:new gn({body:s,url:r}),timeout:f,signal:!0});u&&await u(y);let g,v=await wT(y,{maxResponseBodySize:a});if(y.headers.get("Content-Type")?.startsWith("application/json"))g=JSON.parse(v);else{g=v;try{g=JSON.parse(g||"{}")}catch(E){if(y.ok)throw E;g={error:g}}}if(!y.ok){if(typeof g.error?.code=="number"&&typeof g.error?.message=="string")return g;throw new ot({body:s,details:Y(g.error)||y.statusText,headers:y.headers,status:y.status,url:r})}return g}catch(y){throw h?.aborted?Ye(h):It(y)||y instanceof ot||y instanceof xn||y instanceof gn?y:new ot({body:s,cause:y,url:r})}}}}async function wT(e,{maxResponseBodySize:t}){if(t===!1)return e.text();let r=e.headers.get("Content-Length");if(r){let a=Number(r);if(a>t)throw new xn({maxSize:t,size:a})}if(!e.body){let a=await e.text(),c=new TextEncoder().encode(a).length;if(c>t)throw new xn({maxSize:t,size:c});return a}let n=e.body.getReader(),o=new TextDecoder,s="",i=0;try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(i+=c.byteLength,i>t)throw await n.cancel(),new xn({maxSize:t,size:i});s+=o.decode(c,{stream:!0})}return s+=o.decode(),s}finally{n.releaseLock()}}function vT(e){try{let t=new URL(e),r=(()=>{if(t.username){let n=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(n)}`}}}})();return{url:t.toString(),...r}}catch{return{url:e}}}var gT,uw=p(()=>{ar();Er();Jm();Je();Vh();gT=10485760});async function fw(e){let{getSocket:t,keepAlive:r=!0,key:n="socket",reconnect:o=!0,url:s}=e,{interval:i=3e4}=typeof r=="object"?r:{},{attempts:a=5,delay:c=2e3}=typeof o=="object"?o:{},u=JSON.stringify({keepAlive:r,key:n,url:s,reconnect:o}),f=Wh.get(u);if(f)return f;let d=0,{schedule:l}=dc({id:u,fn:async()=>{let y=new Map,g=new Map,v,E,x,b,w=!1,A=!1;function P(){if(o&&!A&&d<a){if(w)return;w=!0,d++,E?.close(),b=setTimeout(async()=>{if(b=void 0,A){w=!1;return}await B().catch(console.error),w=!1},c)}else y.clear(),g.clear()}async function B(){let k=await t({onClose(){for(let S of y.values())S.onError?.(new Fr({url:s}));for(let S of g.values())S.onError?.(new Fr({url:s}));P()},onError(S){v=S;for(let N of y.values())N.onError?.(v);for(let N of g.values())N.onError?.(v);P()},onOpen(){v=void 0,d=0},onResponse(S){let N=S.method==="eth_subscription",_=N?S.params.subscription:S.id,z=N?g:y,$=z.get(_);$&&$.onResponse(S),N||z.delete(_)}});if(A)return k.close(),k;if(E=k,r&&(x&&clearInterval(x),x=setInterval(()=>E.ping?.(),i)),o&&g.size>0){let S=g.entries();for(let[N,{onResponse:_,body:z,onError:$}]of S)z&&(g.delete(N),f?.request({body:z,onResponse:_,onError:$}))}return k}return await B(),v=void 0,f={close(){A=!0,x&&clearInterval(x),b&&(clearTimeout(b),b=void 0,w=!1),E.close(),Wh.delete(u)},get socket(){return E},request({body:k,onError:S,onResponse:N}){v&&S&&S(v);let _=k.id??mf.take(),z=$=>{typeof $.id=="number"&&_!==$.id||(k.method==="eth_subscribe"&&typeof $.result=="string"&&g.set($.result,{onResponse:z,onError:S,body:k}),N($))};k.method==="eth_unsubscribe"&&g.delete(k.params?.[0]),y.set(_,{onResponse:z,onError:S});try{E.request({body:{jsonrpc:"2.0",id:_,...k}})}catch($){S?.($)}},requestAsync({body:k,timeout:S=1e4}){return Pc(()=>new Promise((N,_)=>this.request({body:k,onError:_,onResponse:N})),{errorInstance:new gn({body:k,url:s}),timeout:S})},requests:y,subscriptions:g,url:s},Wh.set(u,f),[f]}}),[m,[h]]=await l();return h}var Wh,dw=p(()=>{ar();sm();Jm();Vh();Wh=new Map});function mw(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}var pw=p(()=>{});var lw={};sn(lw,{WebSocket:()=>ET});var ET,hw=p(()=>{pw();ET=mw()});async function Sc(e,t={}){let{keepAlive:r,reconnect:n}=t;return fw({async getSocket({onClose:o,onError:s,onOpen:i,onResponse:a}){let c=await Promise.resolve().then(()=>(hw(),lw)).then(m=>m.WebSocket),u=new c(e);function f(){u.removeEventListener("close",f),u.removeEventListener("message",d),u.removeEventListener("error",s),u.removeEventListener("open",i),o()}function d({data:m}){if(!(typeof m=="string"&&m.trim().length===0))try{let h=JSON.parse(m);a(h)}catch(h){s(h)}}u.addEventListener("close",f),u.addEventListener("message",d),u.addEventListener("error",s),u.addEventListener("open",i),u.readyState===c.CONNECTING&&await new Promise((m,h)=>{u&&(u.onopen=m,u.onerror=h)});let{close:l}=u;return Object.assign(u,{close(){l.bind(u)(),f()},ping(){try{if(u.readyState===u.CLOSED||u.readyState===u.CLOSING)throw new si({url:u.url,cause:new Fr({url:u.url})});let m={jsonrpc:"2.0",id:null,method:"net_version",params:[]};u.send(JSON.stringify(m))}catch(m){s(m)}},request({body:m}){if(u.readyState===u.CLOSED||u.readyState===u.CLOSING)throw new si({body:m,url:u.url,cause:new Fr({url:u.url})});return u.send(JSON.stringify(m))}})},keepAlive:r,reconnect:n,url:e})}var Kh=p(()=>{ar();dw()});async function yw(e){let t=await Sc(e);return Object.assign(t.socket,{requests:t.requests,subscriptions:t.subscriptions})}var bw=p(()=>{Kh()});var Ym,Zh=p(()=>{Ym=`Ethereum Signed Message:
45
- `});function Xm(e){let t=typeof e=="string"?tr(e):typeof e.raw=="string"?e.raw:K(e.raw),r=tr(`${Ym}${J(t)}`);return ie([r,t])}var Jh=p(()=>{Zh();Me();et();L()});function ys(e,t){return te(Xm(e),t)}var pf=p(()=>{St();Jh()});var Ic,Bc,kc,Yh=p(()=>{Je();V();Ic=class extends T{constructor({domain:t}){super(`Invalid domain "${Y(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}},Bc=class extends T{constructor({primaryType:t,types:r}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}},kc=class extends T{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}});function Qm(e){let{domain:t,message:r,primaryType:n,types:o}=e,s=(c,u)=>{let f={...u};for(let d of c){let{name:l,type:m}=d;m==="address"&&(f[l]=f[l].toLowerCase())}return f},i=o.EIP712Domain?t?s(o.EIP712Domain,t):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(o[n],r)})();return Y({domain:i,message:a,primaryType:n,types:o})}function Cc(e){let{domain:t,message:r,primaryType:n,types:o}=e,s=(i,a)=>{for(let c of i){let{name:u,type:f}=c,d=a[u],l=f.match(ua);if(l&&(typeof d=="number"||typeof d=="bigint")){let[y,g,v]=l;I(d,{signed:g==="int",size:Number.parseInt(v,10)/8})}if(f==="address"&&typeof d=="string"&&!Q(d))throw new ae({address:d});let m=f.match(dd);if(m){let[y,g]=m;if(g&&J(d)!==Number.parseInt(g,10))throw new Jn({expectedSize:Number.parseInt(g,10),givenSize:J(d)})}let h=o[f];h&&(AT(f),s(h,d))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new Ic({domain:t});s(o.EIP712Domain,t)}if(n!=="EIP712Domain")if(o[n])s(o[n],r);else throw new Bc({primaryType:n,types:o})}function Ti({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId=="number"||typeof e?.chainId=="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function xw({domain:e}){return lf({domain:e,types:{EIP712Domain:Ti({domain:e})}})}function AT(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new kc({type:e})}var e0=p(()=>{le();rr();Yh();mt();et();L();md();hf();Je()});function Rc(e){let{domain:t={},message:r,primaryType:n}=e,o={EIP712Domain:Ti({domain:t}),...e.types};Cc({domain:t,message:r,primaryType:n,types:o});let s=["0x1901"];return t&&s.push(lf({domain:t,types:o})),n!=="EIP712Domain"&&s.push(t0({data:r,primaryType:n,types:o})),te(ie(s))}function lf({domain:e,types:t}){return t0({data:e,primaryType:"EIP712Domain",types:t})}function t0({data:e,primaryType:t,types:r}){let n=gw({data:e,primaryType:t,types:r});return te(n)}function gw({data:e,primaryType:t,types:r}){let n=[{type:"bytes32"}],o=[TT({primaryType:t,types:r})];for(let s of r[t]){let[i,a]=vw({types:r,name:s.name,type:s.type,value:e[s.name]});n.push(i),o.push(a)}return Oe(n,o)}function TT({primaryType:e,types:t}){let r=pe(PT({primaryType:e,types:t}));return te(r)}function PT({primaryType:e,types:t}){let r="",n=ww({primaryType:e,types:t});n.delete(e);let o=[e,...Array.from(n).sort()];for(let s of o)r+=`${s}(${t[s].map(({name:i,type:a})=>`${a} ${i}`).join(",")})`;return r}function ww({primaryType:e,types:t},r=new Set){let o=e.match(/^\w*/u)?.[0];if(r.has(o)||t[o]===void 0)return r;r.add(o);for(let s of t[o])ww({primaryType:s.type,types:t},r);return r}function vw({types:e,name:t,type:r,value:n}){if(e[r]!==void 0)return[{type:"bytes32"},te(gw({data:n,primaryType:r,types:e}))];if(r==="bytes")return[{type:"bytes32"},te(n)];if(r==="string")return[{type:"bytes32"},te(pe(n))];if(r.lastIndexOf("]")===r.length-1){let o=r.slice(0,r.lastIndexOf("[")),s=n.map(i=>vw({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},te(Oe(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:r},n]}var hf=p(()=>{wr();Me();L();St();e0()});var r0,Ew,n0=p(()=>{r0="0x6492649264926492649264926492649264926492649264926492649264926492",Ew="0x0000000000000000000000000000000000000000000000000000000000000000"});function o0(e){return _r(e,-32)===r0}var Xh=p(()=>{n0();jt()});var Aw,Tw=p(()=>{Aw="1.2.4"});var $e,$c=p(()=>{Tw();$e=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${Aw}`].join(`
46
- `);super(s),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"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t}}});function Qt(e,t){return e.exec(t)?.groups}var Qh,ey,s0,yf=p(()=>{Qh=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ey=/^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)?$/,s0=/^\(.+?\).*?$/});function i0(e){let t=e.type;if(Pw.test(e.type)&&"components"in e){t="(";let r=e.components.length;for(let o=0;o<r;o++){let s=e.components[o];t+=i0(s),o<r-1&&(t+=", ")}let n=Qt(Pw,e.type);return t+=`)${n?.array||""}`,i0({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var Pw,Sw=p(()=>{yf();Pw=/^tuple(?<array>(\[(\d*)\])*)$/});function _n(e){let t="",r=e.length;for(let n=0;n<r;n++){let o=e[n];t+=i0(o),n!==r-1&&(t+=", ")}return t}var ty=p(()=>{Sw()});function bf(e){return e.type==="function"?`function ${e.name}(${_n(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${_n(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${_n(e.inputs)})`:e.type==="error"?`error ${e.name}(${_n(e.inputs)})`:e.type==="constructor"?`constructor(${_n(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var Iw=p(()=>{ty()});function kw(e){return Bw.test(e)}function Cw(e){return Qt(Bw,e)}function $w(e){return Rw.test(e)}function Nw(e){return Qt(Rw,e)}function Mw(e){return Hw.test(e)}function zw(e){return Qt(Hw,e)}function Nc(e){return _w.test(e)}function Uw(e){return Qt(_w,e)}function Lw(e){return Fw.test(e)}function Ow(e){return Qt(Fw,e)}function qw(e){return Dw.test(e)}function jw(e){return Qt(Dw,e)}function Gw(e){return ST.test(e)}var Bw,Rw,Hw,_w,Fw,Dw,ST,ry,Vw,a0,xf=p(()=>{yf();Bw=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Rw=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Hw=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;_w=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;Fw=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;Dw=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;ST=/^receive\(\) external payable$/;ry=new Set(["memory","indexed","storage","calldata"]),Vw=new Set(["indexed"]),a0=new Set(["calldata","memory","storage"])});var c0,u0,f0,d0=p(()=>{$c();c0=class extends $e{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}},u0=class extends $e{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" 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"})}},f0=class extends $e{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}});var m0,p0,l0,h0,y0,b0,x0=p(()=>{$c();m0=class extends $e{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},p0=class extends $e{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},l0=class extends $e{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" 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"})}},h0=class extends $e{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},y0=class extends $e{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" 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"})}},b0=class extends $e{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}});var rn,g0,w0,ny=p(()=>{$c();rn=class extends $e{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},g0=class extends $e{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},w0=class extends $e{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}});var v0,Ww=p(()=>{$c();v0=class extends $e{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}});var E0,Kw=p(()=>{$c();E0=class extends $e{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}});function Zw(e,t,r){let n="";if(r)for(let o of Object.entries(r)){if(!o)continue;let s="";for(let i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;n+=`(${o[0]}{${s}})`}return t?`${t}:${e}${n}`:`${e}${n}`}var A0,Jw=p(()=>{A0=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 oy(e,t={}){if(Mw(e))return IT(e,t);if($w(e))return BT(e,t);if(kw(e))return kT(e,t);if(Lw(e))return CT(e,t);if(qw(e))return RT(e);if(Gw(e))return{type:"receive",stateMutability:"payable"};throw new g0({signature:e})}function IT(e,t={}){let r=zw(e);if(!r)throw new rn({signature:e,type:"function"});let n=Mt(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(Cr(n[a],{modifiers:a0,structs:t,type:"function"}));let i=[];if(r.returns){let a=Mt(r.returns),c=a.length;for(let u=0;u<c;u++)i.push(Cr(a[u],{modifiers:a0,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:i}}function BT(e,t={}){let r=Nw(e);if(!r)throw new rn({signature:e,type:"event"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{modifiers:Vw,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}function kT(e,t={}){let r=Cw(e);if(!r)throw new rn({signature:e,type:"error"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}function CT(e,t={}){let r=Ow(e);if(!r)throw new rn({signature:e,type:"constructor"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}function RT(e){let t=jw(e);if(!t)throw new rn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function Cr(e,t){let r=Zw(e,t?.type,t?.structs);if(A0.has(r))return A0.get(r);let n=s0.test(e),o=Qt(n?NT:$T,e);if(!o)throw new p0({param:e});if(o.name&&zT(o.name))throw new l0({param:e,name:o.name});let s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},c,u={};if(n){c="tuple";let d=Mt(o.type),l=[],m=d.length;for(let h=0;h<m;h++)l.push(Cr(d[h],{structs:a}));u={components:l}}else if(o.type in a)c="tuple",u={components:a[o.type]};else if(HT.test(o.type))c=`${o.type}256`;else if(o.type==="address payable")c="address";else if(c=o.type,t?.type!=="struct"&&!sy(c))throw new f0({type:c});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new h0({param:e,type:t?.type,modifier:o.modifier});if(a0.has(o.modifier)&&!_T(c,!!o.array))throw new y0({param:e,type:t?.type,modifier:o.modifier})}let f={type:`${c}${o.array??""}`,...s,...i,...u};return A0.set(r,f),f}function Mt(e,t=[],r="",n=0){let o=e.trim().length;for(let s=0;s<o;s++){let i=e[s],a=e.slice(s+1);switch(i){case",":return n===0?Mt(a,[...t,r.trim()]):Mt(a,t,`${r}${i}`,n);case"(":return Mt(a,t,`${r}${i}`,n+1);case")":return Mt(a,t,`${r}${i}`,n-1);default:return Mt(a,t,`${r}${i}`,n)}}if(r==="")return t;if(n!==0)throw new E0({current:r,depth:n});return t.push(r.trim()),t}function sy(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Qh.test(e)||ey.test(e)}function zT(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Qh.test(e)||ey.test(e)||MT.test(e)}function _T(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var $T,NT,HT,MT,gf=p(()=>{yf();d0();x0();ny();Kw();Jw();xf();$T=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,NT=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,HT=/^u?int$/;MT=/^(?: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 T0(e){let t={},r=e.length;for(let i=0;i<r;i++){let a=e[i];if(!Nc(a))continue;let c=Uw(a);if(!c)throw new rn({signature:a,type:"struct"});let u=c.properties.split(";"),f=[],d=u.length;for(let l=0;l<d;l++){let h=u[l].trim();if(!h)continue;let y=Cr(h,{type:"struct"});f.push(y)}if(!f.length)throw new w0({signature:a});t[c.name]=f}let n={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){let[a,c]=o[i];n[a]=Yw(c,t)}return n}function Yw(e=[],t={},r=new Set){let n=[],o=e.length;for(let s=0;s<o;s++){let i=e[s];if(s0.test(i.type))n.push(i);else{let c=Qt(UT,i.type);if(!c?.type)throw new b0({abiParameter:i});let{array:u,type:f}=c;if(f in t){if(r.has(f))throw new v0({type:f});n.push({...i,type:`tuple${u??""}`,components:Yw(t[f],t,new Set([...r,f]))})}else if(sy(f))n.push(i);else throw new u0({type:f})}}return n}var UT,iy=p(()=>{yf();d0();x0();ny();Ww();xf();gf();UT=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/});function P0(e){let t;if(typeof e=="string")t=oy(e);else{let r=T0(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!Nc(s)){t=oy(s,r);break}}}if(!t)throw new c0({signature:e});return t}var Xw=p(()=>{d0();xf();iy();gf()});function S0(e){let t=[];if(typeof e=="string"){let r=Mt(e),n=r.length;for(let o=0;o<n;o++)t.push(Cr(r[o],{modifiers:ry}))}else{let r=T0(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(Nc(s))continue;let i=Mt(s),a=i.length;for(let c=0;c<a;c++)t.push(Cr(i[c],{modifiers:ry,structs:r}))}}if(t.length===0)throw new m0({params:e});return t}var Qw=p(()=>{x0();xf();iy();gf();gf()});var ay=p(()=>{Iw();ty();Xw();Qw()});var I0,t8=p(()=>{I0=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=this.keys().next().value;n&&this.delete(n)}return this}}});var FT,B0,r8=p(()=>{t8();FT={checksum:new I0(8192)},B0=FT.checksum});function Pi(e,t={}){let{as:r=typeof e=="string"?"Hex":"Bytes"}=t,n=ud(c5(e));return r==="Bytes"?n:ke(n)}var k0=p(()=>{Yp();ns();We()});function n8(e,t={}){let{compressed:r}=t,{prefix:n,x:o,y:s}=e;if(r===!1||typeof o=="bigint"&&typeof s=="bigint"){if(n!==4)throw new C0({prefix:n,cause:new dy});return}if(r===!0||typeof o=="bigint"&&typeof s>"u"){if(n!==3&&n!==2)throw new C0({prefix:n,cause:new fy});return}throw new uy({publicKey:e})}function o8(e){let t=(()=>{if(Xu(e))return s8(e);if(l5(e))return OT(e);let{prefix:r,x:n,y:o}=e;return typeof n=="bigint"&&typeof o=="bigint"?{prefix:r??4,x:n,y:o}:{prefix:r,x:n}})();return n8(t),t}function OT(e){return s8(ke(e))}function s8(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new my({publicKey:e});if(e.length===130){let n=BigInt(ge(e,0,32)),o=BigInt(ge(e,32,64));return{prefix:4,x:n,y:o}}if(e.length===132){let n=Number(ge(e,0,1)),o=BigInt(ge(e,1,33)),s=BigInt(ge(e,33,65));return{prefix:n,x:o,y:s}}let t=Number(ge(e,0,1)),r=BigInt(ge(e,1,33));return{prefix:t,x:r}}function py(e,t={}){n8(e);let{prefix:r,x:n,y:o}=e,{includePrefix:s=!0}=t;return Te(s?se(r,{size:1}):"0x",se(n,{size:32}),typeof o=="bigint"?se(o,{size:32}):"0x")}var uy,C0,fy,dy,my,ly=p(()=>{ns();Nt();We();Ju();uy=class extends D{constructor({publicKey:t}){super(`Value \`${os(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}},C0=class extends D{constructor({prefix:t,cause:r}){super(`Prefix "${t}" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}},fy=class extends D{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}},dy=class extends D{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}},my=class extends D{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${xe(tc(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}});function Si(e,t={}){let{strict:r=!0}=t;if(!DT.test(e))throw new R0({address:e,cause:new hy});if(r){if(e.toLowerCase()===e)return;if($0(e)!==e)throw new R0({address:e,cause:new yy})}}function $0(e){if(B0.has(e))return B0.get(e);Si(e,{strict:!1});let t=e.substring(2).toLowerCase(),r=Pi(u5(t),{as:"Bytes"}),n=t.split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&n[s]&&(n[s]=n[s].toUpperCase()),(r[s>>1]&15)>=8&&n[s+1]&&(n[s+1]=n[s+1].toUpperCase());let o=`0x${n.join("")}`;return B0.set(e,o),o}function qT(e,t={}){let{checksum:r=!1}=t;return Si(e),r?$0(e):e}function a8(e,t={}){let r=Pi(`0x${py(e).slice(4)}`).substring(26);return qT(`0x${r}`,t)}function N0(e,t={}){let{strict:r=!0}=t??{};try{return Si(e,{strict:r}),!0}catch{return!1}}var DT,R0,hy,yy,wf=p(()=>{ns();r8();Nt();k0();ly();DT=/^0x[a-fA-F0-9]{40}$/;R0=class extends D{constructor({address:t,cause:r}){super(`Address "${t}" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},hy=class extends D{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},yy=class extends D{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}});var c8,u8,M0,vG,EG,AG,TG,PG,SG,IG,BG,kG,CG,RG,$G,NG,HG,MG,zG,_G,UG,FG,LG,OG,DG,qG,jG,GG,VG,WG,KG,ZG,JG,YG,XG,QG,eV,tV,rV,nV,oV,sV,iV,aV,cV,uV,fV,dV,mV,pV,lV,hV,yV,bV,xV,gV,wV,vV,EV,AV,TV,PV,SV,IV,BV,kV,CV,RV,$V,NV,HV,MV,zV,_V,UV,FV,LV,OV,DV,qV,jV,GV,VV,WV,KV,ZV,JV,YV,XV,QV,eW,tW,rW,nW,oW,sW,iW,aW,by,z0=p(()=>{c8=/^(.*)\[([0-9]*)\]$/,u8=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,M0=/^(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)?$/,vG=2n**(8n-1n)-1n,EG=2n**(16n-1n)-1n,AG=2n**(24n-1n)-1n,TG=2n**(32n-1n)-1n,PG=2n**(40n-1n)-1n,SG=2n**(48n-1n)-1n,IG=2n**(56n-1n)-1n,BG=2n**(64n-1n)-1n,kG=2n**(72n-1n)-1n,CG=2n**(80n-1n)-1n,RG=2n**(88n-1n)-1n,$G=2n**(96n-1n)-1n,NG=2n**(104n-1n)-1n,HG=2n**(112n-1n)-1n,MG=2n**(120n-1n)-1n,zG=2n**(128n-1n)-1n,_G=2n**(136n-1n)-1n,UG=2n**(144n-1n)-1n,FG=2n**(152n-1n)-1n,LG=2n**(160n-1n)-1n,OG=2n**(168n-1n)-1n,DG=2n**(176n-1n)-1n,qG=2n**(184n-1n)-1n,jG=2n**(192n-1n)-1n,GG=2n**(200n-1n)-1n,VG=2n**(208n-1n)-1n,WG=2n**(216n-1n)-1n,KG=2n**(224n-1n)-1n,ZG=2n**(232n-1n)-1n,JG=2n**(240n-1n)-1n,YG=2n**(248n-1n)-1n,XG=2n**(256n-1n)-1n,QG=-(2n**(8n-1n)),eV=-(2n**(16n-1n)),tV=-(2n**(24n-1n)),rV=-(2n**(32n-1n)),nV=-(2n**(40n-1n)),oV=-(2n**(48n-1n)),sV=-(2n**(56n-1n)),iV=-(2n**(64n-1n)),aV=-(2n**(72n-1n)),cV=-(2n**(80n-1n)),uV=-(2n**(88n-1n)),fV=-(2n**(96n-1n)),dV=-(2n**(104n-1n)),mV=-(2n**(112n-1n)),pV=-(2n**(120n-1n)),lV=-(2n**(128n-1n)),hV=-(2n**(136n-1n)),yV=-(2n**(144n-1n)),bV=-(2n**(152n-1n)),xV=-(2n**(160n-1n)),gV=-(2n**(168n-1n)),wV=-(2n**(176n-1n)),vV=-(2n**(184n-1n)),EV=-(2n**(192n-1n)),AV=-(2n**(200n-1n)),TV=-(2n**(208n-1n)),PV=-(2n**(216n-1n)),SV=-(2n**(224n-1n)),IV=-(2n**(232n-1n)),BV=-(2n**(240n-1n)),kV=-(2n**(248n-1n)),CV=-(2n**(256n-1n)),RV=2n**8n-1n,$V=2n**16n-1n,NV=2n**24n-1n,HV=2n**32n-1n,MV=2n**40n-1n,zV=2n**48n-1n,_V=2n**56n-1n,UV=2n**64n-1n,FV=2n**72n-1n,LV=2n**80n-1n,OV=2n**88n-1n,DV=2n**96n-1n,qV=2n**104n-1n,jV=2n**112n-1n,GV=2n**120n-1n,VV=2n**128n-1n,WV=2n**136n-1n,KV=2n**144n-1n,ZV=2n**152n-1n,JV=2n**160n-1n,YV=2n**168n-1n,XV=2n**176n-1n,QV=2n**184n-1n,eW=2n**192n-1n,tW=2n**200n-1n,rW=2n**208n-1n,nW=2n**216n-1n,oW=2n**224n-1n,sW=2n**232n-1n,iW=2n**240n-1n,aW=2n**248n-1n,by=2n**256n-1n});function Ii(e,t,r){let{checksumAddress:n,staticPosition:o}=r,s=wy(t.type);if(s){let[i,a]=s;return GT(e,{...t,type:a},{checksumAddress:n,length:i,staticPosition:o})}if(t.type==="tuple")return ZT(e,t,{checksumAddress:n,staticPosition:o});if(t.type==="address")return jT(e,{checksum:n});if(t.type==="bool")return VT(e);if(t.type.startsWith("bytes"))return WT(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return KT(e,t);if(t.type==="string")return JT(e,{staticPosition:o});throw new Hc(t.type)}function jT(e,t={}){let{checksum:r=!1}=t,n=e.readBytes(32);return[(s=>r?$0(s):s)(ke(f5(n,-20))),32]}function GT(e,t,r){let{checksumAddress:n,length:o,staticPosition:s}=r;if(!o){let c=Jr(e.readBytes(xy)),u=s+c,f=u+d8;e.setPosition(u);let d=Jr(e.readBytes(d8)),l=vf(t),m=0,h=[];for(let y=0;y<d;++y){e.setPosition(f+(l?y*32:m));let[g,v]=Ii(e,t,{checksumAddress:n,staticPosition:f});m+=v,h.push(g)}return e.setPosition(s+32),[h,32]}if(vf(t)){let c=Jr(e.readBytes(xy)),u=s+c,f=[];for(let d=0;d<o;++d){e.setPosition(u+d*32);let[l]=Ii(e,t,{checksumAddress:n,staticPosition:u});f.push(l)}return e.setPosition(s+32),[f,32]}let i=0,a=[];for(let c=0;c<o;++c){let[u,f]=Ii(e,t,{checksumAddress:n,staticPosition:s+i});i+=f,a.push(u)}return[a,i]}function VT(e){return[m5(e.readBytes(32),{size:32}),32]}function WT(e,t,{staticPosition:r}){let[n,o]=t.type.split("bytes");if(!o){let i=Jr(e.readBytes(32));e.setPosition(r+i);let a=Jr(e.readBytes(32));if(a===0)return e.setPosition(r+32),["0x",32];let c=e.readBytes(a);return e.setPosition(r+32),[ke(c),32]}return[ke(e.readBytes(Number.parseInt(o,10),32)),32]}function KT(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[n>48?d5(o,{signed:r}):Jr(o,{signed:r}),32]}function ZT(e,t,r){let{checksumAddress:n,staticPosition:o}=r,s=t.components.length===0||t.components.some(({name:c})=>!c),i=s?[]:{},a=0;if(vf(t)){let c=Jr(e.readBytes(xy)),u=o+c;for(let f=0;f<t.components.length;++f){let d=t.components[f];e.setPosition(u+a);let[l,m]=Ii(e,d,{checksumAddress:n,staticPosition:u});a+=m,i[s?f:d?.name]=l}return e.setPosition(o+32),[i,32]}for(let c=0;c<t.components.length;++c){let u=t.components[c],[f,d]=Ii(e,u,{checksumAddress:n,staticPosition:o});i[s?c:u?.name]=f,a+=d}return[i,a]}function JT(e,{staticPosition:t}){let r=Jr(e.readBytes(32)),n=t+r;e.setPosition(n);let o=Jr(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let s=e.readBytes(o,32),i=p5(rh(s));return e.setPosition(t+32),[i,32]}function m8({checksumAddress:e,parameters:t,values:r}){let n=[];for(let o=0;o<t.length;o++)n.push(gy({checksumAddress:e,parameter:t[o],value:r[o]}));return n}function gy({checksumAddress:e=!1,parameter:t,value:r}){let n=t,o=wy(n.type);if(o){let[s,i]=o;return XT(r,{checksumAddress:e,length:s,parameter:{...n,type:i}})}if(n.type==="tuple")return nP(r,{checksumAddress:e,parameter:n});if(n.type==="address")return YT(r,{checksum:e});if(n.type==="bool")return eP(r);if(n.type.startsWith("uint")||n.type.startsWith("int")){let s=n.type.startsWith("int"),[,,i="256"]=M0.exec(n.type)??[];return tP(r,{signed:s,size:Number(i)})}if(n.type.startsWith("bytes"))return QT(r,{type:n.type});if(n.type==="string")return rP(r);throw new Hc(n.type)}function _0(e){let t=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?t+=32:t+=xe(a)}let r=[],n=[],o=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?(r.push(se(t+o,{size:32})),n.push(a),o+=xe(a)):r.push(a)}return Te(...r,...n)}function YT(e,t){let{checksum:r=!1}=t;return Si(e,{strict:r}),{dynamic:!1,encoded:Rn(e.toLowerCase())}}function XT(e,t){let{checksumAddress:r,length:n,parameter:o}=t,s=n===null;if(!Array.isArray(e))throw new F0(e);if(!s&&e.length!==n)throw new U0({expectedLength:n,givenLength:e.length,type:`${o.type}[${n}]`});let i=!1,a=[];for(let c=0;c<e.length;c++){let u=gy({checksumAddress:r,parameter:o,value:e[c]});u.dynamic&&(i=!0),a.push(u)}if(s||i){let c=_0(a);if(s){let u=se(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Te(u,c):u}}if(i)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Te(...a.map(({encoded:c})=>c))}}function QT(e,{type:t}){let[,r]=t.split("bytes"),n=xe(e);if(!r){let o=e;return n%32!==0&&(o=Yr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Te(Rn(se(n,{size:32})),o)}}if(n!==Number.parseInt(r,10))throw new Ef({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:Yr(e)}}function eP(e){if(typeof e!="boolean")throw new D(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Rn(Qd(e))}}function tP(e,{signed:t,size:r}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,o=t?-n-1n:0n;if(e>n||e<o)throw new Yu({max:n.toString(),min:o.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:se(e,{size:32,signed:t})}}function rP(e){let t=rc(e),r=Math.ceil(xe(t)/32),n=[];for(let o=0;o<r;o++)n.push(Yr(ge(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Te(Yr(se(xe(t),{size:32})),...n)}}function nP(e,t){let{checksumAddress:r,parameter:n}=t,o=!1,s=[];for(let i=0;i<n.components.length;i++){let a=n.components[i],c=Array.isArray(e)?i:a.name,u=gy({checksumAddress:r,parameter:a,value:e[c]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?_0(s):Te(...s.map(({encoded:i})=>i))}}function wy(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function vf(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(vf);let r=wy(e.type);return!!(r&&vf({...e,type:r[1]}))}var d8,xy,p8=p(()=>{Mc();wf();ns();Nt();We();z0();d8=32,xy=32});function O0(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(sP);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}var sP,L0,vy,Ey,Ay=p(()=>{Nt();sP={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Ey({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new vy({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new L0({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new L0({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};L0=class extends D{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}},vy=class extends D{constructor({length:t,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}},Ey=class extends D{constructor({count:t,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}});function zc(e,t,r={}){let{as:n="Array",checksumAddress:o=!1}=r,s=typeof t=="string"?ec(t):t,i=O0(s);if(fr(s)===0&&e.length>0)throw new Sy;if(fr(s)&&fr(s)<32)throw new Py({data:typeof t=="string"?t:ke(t),parameters:e,size:fr(s)});let a=0,c=n==="Array"?[]:{};for(let u=0;u<e.length;++u){let f=e[u];i.setPosition(a);let[d,l]=Ii(i,f,{checksumAddress:o,staticPosition:0});a+=l,n==="Array"?c.push(d):c[f.name??u]=d}return c}function bs(e,t,r){let{checksumAddress:n=!1}=r??{};if(e.length!==t.length)throw new D0({expectedLength:e.length,givenLength:t.length});let o=m8({checksumAddress:n,parameters:e,values:t}),s=_0(o);return s.length===0?"0x":s}function Ty(e,t){if(e.length!==t.length)throw new D0({expectedLength:e.length,givenLength:t.length});let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n];r.push(Ty.encode(o,s))}return Te(...r)}function Tf(e){return Array.isArray(e)&&typeof e[0]=="string"?S0(e):typeof e=="string"?S0(e):e}var Py,Sy,U0,Ef,D0,F0,Hc,Mc=p(()=>{ay();wf();ns();Nt();We();p8();Ay();z0();(function(e){function t(r,n,o=!1){if(r==="address"){let c=n;return Si(c),Rn(c.toLowerCase(),o?32:0)}if(r==="string")return rc(n);if(r==="bytes")return n;if(r==="bool")return Rn(Qd(n),o?32:1);let s=r.match(M0);if(s){let[c,u,f="256"]=s,d=Number.parseInt(f,10)/8;return se(n,{size:o?32:d,signed:u==="int"})}let i=r.match(u8);if(i){let[c,u]=i;if(Number.parseInt(u,10)!==(n.length-2)/2)throw new Ef({expectedSize:Number.parseInt(u,10),value:n});return Yr(n,o?32:0)}let a=r.match(c8);if(a&&Array.isArray(n)){let[c,u]=a,f=[];for(let d=0;d<n.length;d++)f.push(t(u,n[d],!0));return f.length===0?"0x":Te(...f)}throw new Hc(r)}e.encode=t})(Ty||(Ty={}));Py=class extends D{constructor({data:t,parameters:r,size:n}){super(`Data size of ${n} bytes is too small for given parameters.`,{metaMessages:[`Params: (${_n(r)})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}},Sy=class extends D{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}},U0=class extends D{constructor({expectedLength:t,givenLength:r,type:n}){super(`Array length mismatch for type \`${n}\`. Expected: \`${t}\`. Given: \`${r}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}},Ef=class extends D{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${xe(r)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},D0=class extends D{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${r}`].join(`
47
- `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},F0=class extends D{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}},Hc=class extends D{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}});function iP(e,t){let{as:r}=t,n=y8(e),o=O0(new Uint8Array(n.length));return n.encode(o),r==="Hex"?ke(o.bytes):o.bytes}function h8(e,t={}){let{as:r="Hex"}=t;return iP(e,{as:r})}function y8(e){return Array.isArray(e)?aP(e.map(t=>y8(t))):cP(e)}function aP(e){let t=e.reduce((o,s)=>o+s.length,0),r=b8(t);return{length:t<=55?1+t:1+r+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+r),r===1?o.pushUint8(t):r===2?o.pushUint16(t):r===3?o.pushUint24(t):o.pushUint32(t));for(let{encode:s}of e)s(o)}}}function cP(e){let t=typeof e=="string"?ec(e):e,r=b8(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+r),r===1?o.pushUint8(t.length):r===2?o.pushUint16(t.length):r===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function b8(e){if(e<=255)return 1;if(e<=65535)return 2;if(e<=16777215)return 3;if(e<=4294967295)return 4;throw new D("Length is too large.")}var x8=p(()=>{ns();Nt();We();Ay()});function Ry(e,t={}){let{recovered:r}=t;if(typeof e.r>"u")throw new Pf({signature:e});if(typeof e.s>"u")throw new Pf({signature:e});if(r&&typeof e.yParity>"u")throw new Pf({signature:e});if(e.r<0n||e.r>by)throw new By({value:e.r});if(e.s<0n||e.s>by)throw new ky({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new Sf({value:e.yParity})}function fP(e){return g8(ke(e))}function g8(e){if(e.length!==130&&e.length!==132)throw new Iy({signature:e});let t=BigInt(ge(e,0,32)),r=BigInt(ge(e,32,64)),n=(()=>{let o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return Hy(o)}catch{throw new Sf({value:o})}})();return typeof n>"u"?{r:t,s:r}:{r:t,s:r,yParity:n}}function $y(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return Ny(e)}function Ny(e){let t=typeof e=="string"?g8(e):e instanceof Uint8Array?fP(e):typeof e.r=="string"?mP(e):e.v?dP(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Ry(t),t}function dP(e){return{r:e.r,s:e.s,yParity:Hy(e.v)}}function mP(e){let t=(()=>{let r=e.v?Number(e.v):void 0,n=e.yParity?Number(e.yParity):void 0;if(typeof r=="number"&&typeof n!="number"&&(n=Hy(r)),typeof n!="number")throw new Sf({value:e.yParity});return n})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function w8(e){let{r:t,s:r,yParity:n}=e;return[n?"0x01":"0x",t===0n?"0x":oh(se(t)),r===0n?"0x":oh(se(r))]}function Hy(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Cy({value:e})}var Iy,Pf,By,ky,Sf,Cy,My=p(()=>{Nt();We();Ju();z0();Iy=class extends D{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${xe(tc(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Pf=class extends D{constructor({signature:t}){super(`Signature \`${os(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},By=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},ky=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},Sf=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},Cy=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}});function E8(e,t={}){return typeof e.chainId=="string"?pP(e):{...e,...t.signature}}function pP(e){let{address:t,chainId:r,nonce:n}=e,o=$y(e);return{address:t,chainId:Number(r),nonce:BigInt(n),...o}}function A8(e){return lP(e,{presign:!0})}function lP(e,t={}){let{presign:r}=t;return Pi(Te("0x05",h8(hP(r?{address:e.address,chainId:e.chainId,nonce:e.nonce}:e))))}function hP(e){let{address:t,chainId:r,nonce:n}=e,o=$y(e);return[r?se(r):"0x",t,n?se(n):"0x",...o?w8(o):[]]}var T8=p(()=>{k0();We();x8();My()});function P8(e){return a8(bP(e))}function bP(e){let{payload:t,signature:r}=e,{r:n,s:o,yParity:s}=r,a=new xt.Signature(BigInt(n),BigInt(o)).addRecoveryBit(s).recoverPublicKey(tc(t).substring(2));return o8(a)}var S8=p(()=>{fi();wf();We();ly()});var Rr={};sn(Rr,{InvalidWrappedSignatureError:()=>q0,assert:()=>j0,from:()=>gP,magicBytes:()=>zy,suffixParameters:()=>_y,unwrap:()=>I8,validate:()=>vP,wrap:()=>wP});function j0(e){if(typeof e=="string"){if(ge(e,-32)!==zy)throw new q0(e)}else Ry(e.authorization)}function gP(e){return typeof e=="string"?I8(e):e}function I8(e){j0(e);let t=Jd(ge(e,-64,-32)),r=ge(e,-t-64,-64),n=ge(e,0,-t-64),[o,s,i]=zc(_y,r);return{authorization:E8({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:n,...i&&i!=="0x"?{data:i,to:s}:{}}}function wP(e){let{data:t,signature:r}=e;j0(e);let n=P8({payload:A8(e.authorization),signature:Ny(e.authorization)}),o=bs(_y,[{...e.authorization,delegation:e.authorization.address,chainId:BigInt(e.authorization.chainId)},e.to??n,t??"0x"]),s=se(xe(o),{size:32});return Te(r,o,s,zy)}function vP(e){try{return j0(e),!0}catch{return!1}}var zy,_y,q0,B8=p(()=>{Mc();T8();Nt();We();S8();My();zy="0x8010801080108010801080108010801080108010801080108010801080108010",_y=Tf("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");q0=class extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}}});var If=p(()=>{B8()});function G0(e){return Rr.validate(e)}var Uy=p(()=>{If()});function k8(e){if(!o0(e))return{signature:e};let[t,r,n]=pt([{type:"address"},{type:"bytes"},{type:"bytes"}],e);return{address:t,data:r,signature:n}}var C8=p(()=>{ro();Xh()});function R8(e){if(!G0(e))return{signature:e};let{authorization:t,to:r,...n}=Rr.unwrap(e);return{authorization:{address:t.address,chainId:t.chainId,nonce:Number(t.nonce),r:I(t.r,{size:32}),s:I(t.s,{size:32}),yParity:t.yParity},...r?{address:r}:{},...n}}var $8=p(()=>{If();L();Uy()});async function V0({message:e,signature:t}){return gt({hash:ys(e),signature:t})}var Fy=p(()=>{pf();Mo()});async function W0(e){let{domain:t,message:r,primaryType:n,signature:o,types:s}=e;return gt({hash:Rc({domain:t,message:r,primaryType:n,types:s}),signature:o})}var Ly=p(()=>{hf();Mo()});function N8(e){let{address:t,data:r,signature:n,to:o="hex"}=e,s=Ae([Oe([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,r,n]),r0]);return o==="hex"?s:re(s)}var H8=p(()=>{n0();wr();Me();ue()});function M8(e){let{address:t,data:r,signature:n,to:o="hex"}=e,s=Rr.wrap({authorization:{address:e.authorization.address,chainId:e.authorization.chainId,nonce:BigInt(e.authorization.nonce),r:BigInt(e.authorization.r),s:BigInt(e.authorization.s),yParity:e.authorization.yParity},data:r,signature:n,to:t});return o==="hex"?s:re(s)}var z8=p(()=>{If();ue()});async function _8({address:e,hash:t,signature:r}){return de(ye(e),await gt({hash:t,signature:r}))}var U8=p(()=>{dt();Jt();Mo()});async function F8({address:e,message:t,signature:r}){return de(ye(e),await V0({message:t,signature:r}))}var L8=p(()=>{dt();Jt();Fy()});async function O8(e){let{address:t,domain:r,message:n,primaryType:o,signature:s,types:i}=e;return de(ye(t),await W0({domain:r,message:n,primaryType:o,signature:s,types:i}))}var D8=p(()=>{dt();Jt();Ly()});function K0(e){let t=_r(e,0,1);if(t==="0x04")return"eip7702";if(t==="0x03")return"eip4844";if(t==="0x02")return"eip1559";if(t==="0x01")return"eip2930";if(t!=="0x"&&Z(t)>=192)return"legacy";throw new Ea({serializedType:t})}var Oy=p(()=>{lt();jt();ve()});function Z0(e){let t=K0(e);return t==="eip1559"?TP(e):t==="eip2930"?PP(e):t==="eip4844"?AP(e):t==="eip7702"?EP(e):SP(e)}function EP(e){let t=J0(e),[r,n,o,s,i,a,c,u,f,d,l,m,h]=t;if(t.length!==10&&t.length!==13)throw new Ur({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gas:i,to:a,value:c,data:u,accessList:f,authorizationList:d,...t.length>9?{v:l,r:m,s:h}:{}},serializedTransaction:e,type:"eip7702"});let y={chainId:Z(r),type:"eip7702"};return O(a)&&a!=="0x"&&(y.to=a),O(i)&&i!=="0x"&&(y.gas=j(i)),O(u)&&u!=="0x"&&(y.data=u),O(n)&&(y.nonce=n==="0x"?0:Z(n)),O(c)&&c!=="0x"&&(y.value=j(c)),O(s)&&s!=="0x"&&(y.maxFeePerGas=j(s)),O(o)&&o!=="0x"&&(y.maxPriorityFeePerGas=j(o)),f.length!==0&&f!=="0x"&&(y.accessList=Y0(f)),d.length!==0&&d!=="0x"&&(y.authorizationList=IP(d)),Om(y),{...t.length===13?Bf(t):void 0,...y}}function AP(e){let t=J0(e),r=t.length===4,n=r?t[0]:t,o=r?t.slice(1):[],[s,i,a,c,u,f,d,l,m,h,y,g,v,E]=n,[x,b,w]=o;if(!(n.length===11||n.length===14))throw new Ur({attributes:{chainId:s,nonce:i,maxPriorityFeePerGas:a,maxFeePerGas:c,gas:u,to:f,value:d,data:l,accessList:m,...n.length>9?{v:g,r:v,s:E}:{}},serializedTransaction:e,type:"eip4844"});let A={blobVersionedHashes:y,chainId:Z(s),to:f,type:"eip4844"};return O(u)&&u!=="0x"&&(A.gas=j(u)),O(l)&&l!=="0x"&&(A.data=l),O(i)&&(A.nonce=i==="0x"?0:Z(i)),O(d)&&d!=="0x"&&(A.value=j(d)),O(h)&&h!=="0x"&&(A.maxFeePerBlobGas=j(h)),O(c)&&c!=="0x"&&(A.maxFeePerGas=j(c)),O(a)&&a!=="0x"&&(A.maxPriorityFeePerGas=j(a)),m.length!==0&&m!=="0x"&&(A.accessList=Y0(m)),x&&b&&w&&(A.sidecars=es({blobs:x,commitments:b,proofs:w})),Dm(A),{...n.length===14?Bf(n):void 0,...A}}function TP(e){let t=J0(e),[r,n,o,s,i,a,c,u,f,d,l,m]=t;if(!(t.length===9||t.length===12))throw new Ur({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gas:i,to:a,value:c,data:u,accessList:f,...t.length>9?{v:d,r:l,s:m}:{}},serializedTransaction:e,type:"eip1559"});let h={chainId:Z(r),type:"eip1559"};return O(a)&&a!=="0x"&&(h.to=a),O(i)&&i!=="0x"&&(h.gas=j(i)),O(u)&&u!=="0x"&&(h.data=u),O(n)&&(h.nonce=n==="0x"?0:Z(n)),O(c)&&c!=="0x"&&(h.value=j(c)),O(s)&&s!=="0x"&&(h.maxFeePerGas=j(s)),O(o)&&o!=="0x"&&(h.maxPriorityFeePerGas=j(o)),f.length!==0&&f!=="0x"&&(h.accessList=Y0(f)),hs(h),{...t.length===12?Bf(t):void 0,...h}}function PP(e){let t=J0(e),[r,n,o,s,i,a,c,u,f,d,l]=t;if(!(t.length===8||t.length===11))throw new Ur({attributes:{chainId:r,nonce:n,gasPrice:o,gas:s,to:i,value:a,data:c,accessList:u,...t.length>8?{v:f,r:d,s:l}:{}},serializedTransaction:e,type:"eip2930"});let m={chainId:Z(r),type:"eip2930"};return O(i)&&i!=="0x"&&(m.to=i),O(s)&&s!=="0x"&&(m.gas=j(s)),O(c)&&c!=="0x"&&(m.data=c),O(n)&&(m.nonce=n==="0x"?0:Z(n)),O(a)&&a!=="0x"&&(m.value=j(a)),O(o)&&o!=="0x"&&(m.gasPrice=j(o)),u.length!==0&&u!=="0x"&&(m.accessList=Y0(u)),Ec(m),{...t.length===11?Bf(t):void 0,...m}}function SP(e){let t=df(e,"hex"),[r,n,o,s,i,a,c,u,f]=t;if(!(t.length===6||t.length===9))throw new Ur({attributes:{nonce:r,gasPrice:n,gas:o,to:s,value:i,data:a,...t.length>6?{v:c,r:u,s:f}:{}},serializedTransaction:e,type:"legacy"});let d={type:"legacy"};if(O(s)&&s!=="0x"&&(d.to=s),O(o)&&o!=="0x"&&(d.gas=j(o)),O(a)&&a!=="0x"&&(d.data=a),O(r)&&(d.nonce=r==="0x"?0:Z(r)),O(i)&&i!=="0x"&&(d.value=j(i)),O(n)&&n!=="0x"&&(d.gasPrice=j(n)),Ac(d),t.length===6)return d;let l=O(c)&&c!=="0x"?j(c):0n;if(f==="0x"&&u==="0x")return l>0&&(d.chainId=Number(l)),d;let m=l,h=Number((m-35n)/2n);if(h>0)d.chainId=h;else if(m!==27n&&m!==28n)throw new so({v:m});return d.v=m,d.s=f,d.r=u,d.yParity=m%2n===0n?1:0,d}function J0(e){return df(`0x${e.slice(4)}`,"hex")}function Y0(e){let t=[];for(let r=0;r<e.length;r++){let[n,o]=e[r];if(!Q(n,{strict:!1}))throw new ae({address:n});t.push({address:n,storageKeys:o.map(s=>Wm(s)?s:he(s))})}return t}function IP(e){let t=[];for(let r=0;r<e.length;r++){let[n,o,s,i,a,c]=e[r];t.push({address:o,chainId:n==="0x"?0:Z(n),nonce:s==="0x"?0:Z(s),...Bf([i,a,c])})}return t}function Bf(e){let t=e.slice(-3),r=t[0]==="0x"?0n:j(t[0]);if(r!==0n&&r!==1n)throw new wa({yParity:r});let n=r===0n?27n:28n;return{r:Pt(t[1],{size:32}),s:Pt(t[2],{size:32}),v:n,yParity:n===27n?0:1}}var Dy=p(()=>{rr();lt();mt();qu();ut();Xn();cn();ve();qh();jh();qm();Oy()});var _c,qy=p(()=>{V();_c=class extends T{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}});function xs(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new _c({value:e});let[r,n="0"]=e.split("."),o=r.startsWith("-");if(o&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),t===0)Math.round(+`.${n}`)===1&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>t){let[s,i,a]=[n.slice(0,t-1),n.slice(t-1,t),n.slice(t)],c=Math.round(+`${i}.${a}`);c>9?n=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):n=`${s}${c}`,n.length>t&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,t)}else n=n.padEnd(t,"0");return BigInt(`${o?"-":""}${r}${n}`)}var kf=p(()=>{qy()});function q8(e,t="wei"){return xs(e,ha[t])}var j8=p(()=>{ba();kf()});function G8(e,t="wei"){return xs(e,ya[t])}var V8=p(()=>{ba();kf()});var X0=p(()=>{Ze();ve()});function BP(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function W8(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Z(e.nonce):void 0,storageProof:e.storageProof?BP(e.storageProof):void 0}}var K8=p(()=>{X0()});async function Z8(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s,storageKeys:i}){let a=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),c=await e.request({method:"eth_getProof",params:[t,i,a]});return W8(c)}var J8=p(()=>{mi();K8()});async function Y8(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s,slot:i}){let a=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});return await e.request({method:"eth_getStorageAt",params:[t,i,a]})}var X8=p(()=>{mi()});async function Uc(e,{blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s,sender:i,nonce:a}){let c=n||"latest",u=r!==void 0?I(r):void 0,f=null;if(o?f=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?f=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,I(s)]},{dedupe:!0}):(u||c)&&typeof s=="number"?f=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,I(s)]},{dedupe:!!u}):i&&typeof a=="number"&&(f=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,I(a)]},{dedupe:!0})),!f)throw new io({blockHash:t,blockNumber:r,blockTag:c,hash:o,index:s});return(e.chain?.formatters?.transaction?.format||In)(f,"getTransaction")}var Q0=p(()=>{lt();L();La()});async function Q8(e,{hash:t,transactionReceipt:r}){let[n,o]=await Promise.all([R(e,Xr,"getBlockNumber")({}),t?R(e,Uc,"getTransaction")({hash:t}):void 0]),s=r?.blockNumber||o?.blockNumber;return s?n-s+1n:0n}var ev=p(()=>{ee();pc();Q0()});async function Fc(e,{hash:t}){let r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new ao({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||zn)(r,"getTransactionReceipt")}var jy=p(()=>{lt();bc()});async function tv(e,t){let{account:r,authorizationList:n,allowFailure:o=!0,blockHash:s,blockNumber:i,blockOverrides:a,blockTag:c,requireCanonical:u,stateOverride:f}=t,d=t.contracts,{batchSize:l=t.batchSize??1024,deployless:m=t.deployless??!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},h=(()=>{if(t.multicallAddress)return t.multicallAddress;if(m)return null;if(e.chain)return Ht({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),y=[[]],g=0,v=0;for(let b=0;b<d.length;b++){let{abi:w,address:A,args:P,functionName:B}=d[b];try{let k=ne({abi:w,args:P,functionName:B});v+=(k.length-2)/2,l>0&&v>l&&y[g].length>0&&(g++,v=(k.length-2)/2,y[g]=[]),y[g]=[...y[g],{allowFailure:!0,callData:k,target:A}]}catch(k){let S=ht(k,{abi:w,address:A,args:P,docsPath:"/docs/contract/multicall",functionName:B,sender:r});if(!o)throw S;y[g]=[...y[g],{allowFailure:!0,callData:"0x",target:A}]}}let E=await Promise.allSettled(y.map(b=>R(e,oe,"readContract")({...h===null?{code:sc}:{address:h},abi:dr,account:r,args:[b],authorizationList:n,blockHash:s,blockNumber:i,blockOverrides:a,blockTag:c,functionName:"aggregate3",requireCanonical:u,stateOverride:f}))),x=[];for(let b=0;b<E.length;b++){let w=E[b];if(w.status==="rejected"){if(!o)throw w.reason;for(let P=0;P<y[b].length;P++)x.push({status:"failure",error:w.reason,result:void 0});continue}let A=w.value;for(let P=0;P<A.length;P++){let{returnData:B,success:k}=A[P],{callData:S}=y[b][P],{abi:N,address:_,functionName:z,args:$}=d[x.length];try{if(S==="0x")throw new Tt;if(!k)throw new sr({data:B});let C=Fe({abi:N,args:$,data:B,functionName:z});x.push(o?{result:C,status:"success"}:C)}catch(C){let H=ht(C,{abi:N,address:_,args:$,docsPath:"/docs/contract/multicall",functionName:z});if(!o)throw H;x.push({error:H,result:void 0,status:"failure"})}}}if(x.length!==d.length)throw new T("multicall results mismatch");return x}var rv=p(()=>{Ke();ic();le();V();bn();Br();Ze();is();Co();ee();it()});async function Cf(e,t){let{blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:a}=t;try{let c=[];for(let l of o){let m=l.blockOverrides?em(l.blockOverrides):void 0,h=l.calls.map(g=>{let v=g,E=v.account?G(v.account):void 0,x=v.abi?ne(v):v.data,b={...v,account:E,data:v.dataSuffix?ie([x||"0x",v.dataSuffix]):x,from:v.from??E?.address};return _e(b),Be(b)}),y=l.stateOverrides?_a(l.stateOverrides):void 0;c.push({blockOverrides:m,calls:h,stateOverrides:y})}let f=(typeof r=="bigint"?I(r):void 0)||n;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:s,traceTransfers:i,validation:a},f]})).map((l,m)=>({...di(l),calls:l.calls.map((h,y)=>{let{abi:g,args:v,functionName:E,to:x}=o[m].calls[y],b=h.error?.data??h.returnData,w=BigInt(h.gasUsed),A=h.logs?.map(S=>Ue(S)),P=h.status==="0x1"?"success":"failure",B=g&&P==="success"&&b!=="0x"?Fe({abi:g,data:b,functionName:E}):null,k=(()=>{if(P==="success")return;let S;if(b==="0x"?S=new Tt:b&&(S=new sr({data:b})),!!S)return ht(S,{abi:g??[],address:x??"0x",args:v,functionName:E??"<unknown>"})})();return{data:b,gasUsed:w,logs:A,status:P,...P==="success"?{result:B}:{error:k}}})}))}catch(c){let u=c,f=Go(u,{});throw f instanceof Rt?u:f}}var Gy=p(()=>{sh();be();le();bn();Gr();Br();Ze();Me();L();Co();zu();Cd();Zr();Sr();Bd();Ir()});function tp(e){let t=!0,r="",n=0,o="",s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(["(",")",","].includes(a)&&(t=!0),a==="("&&n++,a===")"&&n--,!!t){if(n===0){if(a===" "&&["event","function","error",""].includes(o))o="";else if(o+=a,a===")"){s=!0;break}continue}if(a===" "){e[i-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=a,r+=a}}if(!s)throw new D("Unable to normalize signature.");return o}function ep(e,t){let r=typeof e,n=t.type;switch(n){case"address":return N0(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>ep(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>ep(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Vy(e,t,r){for(let n in e){let o=e[n],s=t[n];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Vy(o.components,s.components,r[n]);let i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?N0(r[n],{strict:!1}):i.includes("address")&&i.includes("bytes")?N0(r[n],{strict:!1}):!1)return i}}var nv=p(()=>{wf();Nt()});function rp(e,t={}){let{prepare:r=!0}=t,n=Array.isArray(e)?P0(e):typeof e=="string"?P0(e):e;return{...n,...r?{hash:Lc(n)}:{}}}function Rf(e,t,r){let{args:n=[],prepare:o=!0}=r??{},s=Xu(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Ky(u)===ge(t,0,4):u.type==="event"?Lc(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new gs({name:t});if(i.length===1)return{...i[0],...o?{hash:Lc(i[0])}:{}};let a;for(let u of i){if(!("inputs"in u))continue;if(!n||n.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:Lc(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==n.length)continue;if(n.every((d,l)=>{let m="inputs"in u&&u.inputs[l];return m?ep(d,m):!1})){if(a&&"inputs"in a&&a.inputs){let d=Vy(u.inputs,a.inputs,n);if(d)throw new Wy({abiItem:u,type:d[0]},{abiItem:a,type:d[1]})}a=u}}let c=(()=>{if(a)return a;let[u,...f]=i;return{...u,overloads:f}})();if(!c)throw new gs({name:t});return{...c,...o?{hash:Lc(c)}:{}}}function Ky(...e){let t=(()=>{if(Array.isArray(e[0])){let[r,n]=e;return Rf(r,n)}return e[0]})();return ge(Lc(t),0,4)}function CP(...e){let t=(()=>{if(Array.isArray(e[0])){let[n,o]=e;return Rf(n,o)}return e[0]})(),r=typeof t=="string"?t:bf(t);return tp(r)}function Lc(...e){let t=(()=>{if(Array.isArray(e[0])){let[r,n]=e;return Rf(r,n)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Pi(rc(CP(t)))}var Wy,gs,Zy=p(()=>{ay();Nt();k0();We();nv();Wy=class extends D{constructor(t,r){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${tp(bf(t.abiItem))}\`, and`,`\`${r.type}\` in \`${tp(bf(r.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}},gs=class extends D{constructor({name:t,data:r,type:n="item"}){let o=t?` with name "${t}"`:r?` with data "${r}"`:"";super(`ABI ${n}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}});function sv(...e){let[t,r]=(()=>{if(Array.isArray(e[0])){let[s,i]=e;return[RP(s),i]}return e})(),{bytecode:n,args:o}=r;return Te(n,t.inputs?.length&&o?.length?bs(t.inputs,o):"0x")}function iv(e){return rp(e)}function RP(e){let t=e.find(r=>r.type==="constructor");if(!t)throw new gs({name:"constructor"});return t}var av=p(()=>{Zy();Mc();We()});function uv(...e){let[t,r=[]]=(()=>{if(Array.isArray(e[0])){let[u,f,d]=e;return[cv(u,f,{args:d}),d]}let[a,c]=e;return[a,c]})(),{overloads:n}=t,o=n?cv([t,...n],t.name,{args:r}):t,s=NP(o),i=r.length>0?bs(o.inputs,r):void 0;return i?Te(s,i):s}function Bi(e,t={}){return rp(e,t)}function cv(e,t,r){let n=Rf(e,t,r);if(n.type!=="function")throw new gs({name:t,type:"function"});return n}function NP(e){return Ky(e)}var fv=p(()=>{Zy();Mc();We()});var np,zt,Jy=p(()=>{np="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000"});async function dv(e,t){let{blockNumber:r,blockTag:n,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:a,validation:c}=t,u=t.account?G(t.account):void 0;if(i&&!u)throw new T("`account` is required when `traceAssetChanges` is true");let f=u?sv(iv("constructor(bytes, bytes)"),{bytecode:oc,args:[MP,uv(Bi("function getBalance(address)"),[u.address])]}):void 0,d=i?await Promise.all(t.calls.map(async M=>{if(!M.data&&!M.abi)return;let{accessList:F}=await zm(e,{account:u.address,...M,data:M.abi?ne(M):M.data});return F.map(({address:q,storageKeys:X})=>X.length>0?q:null)})).then(M=>M.flat().filter(Boolean)):[],l=await Cf(e,{blockNumber:r,blockTag:n,blocks:[...i?[{calls:[{data:f}],stateOverrides:s},{calls:d.map((M,F)=>({abi:[Bi("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:M,from:zt,nonce:F})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(M=>({...M,from:u?.address})),stateOverrides:s},...i?[{calls:[{data:f}]},{calls:d.map((M,F)=>({abi:[Bi("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:M,from:zt,nonce:F})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((M,F)=>({to:M,abi:[Bi("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:F})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((M,F)=>({to:M,abi:[Bi("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:F})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((M,F)=>({to:M,abi:[Bi("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:F})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:a,validation:c}),m=i?l[2]:l[0],[h,y,,g,v,E,x,b]=i?l:[],{calls:w,...A}=m,P=w.slice(0,-1)??[],B=h?.calls??[],k=y?.calls??[],S=[...B,...k].map(M=>M.status==="success"?j(M.data):null),N=g?.calls??[],_=v?.calls??[],z=[...N,..._].map(M=>M.status==="success"?j(M.data):null),$=(E?.calls??[]).map(M=>M.status==="success"?M.result:null),C=(b?.calls??[]).map(M=>M.status==="success"?M.result:null),H=(x?.calls??[]).map(M=>M.status==="success"?M.result:null),U=[];for(let[M,F]of z.entries()){let q=S[M];if(typeof F!="bigint"||typeof q!="bigint")continue;let X=$[M-1],Ne=C[M-1],vt=H[M-1],me=M===0?{address:np,decimals:18,symbol:"ETH"}:{address:d[M-1],decimals:vt||X?Number(X??1):void 0,symbol:Ne??void 0};U.some(He=>He.token.address===me.address)||U.push({token:me,value:{pre:q,post:F,diff:F-q}})}return{assetChanges:U,block:A,results:P}}var MP,mv=p(()=>{av();fv();be();Jy();ic();V();Ze();X0();zh();Gy();MP="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033"});var $f={};sn($f,{InvalidWrappedSignatureError:()=>op,assert:()=>Xy,from:()=>UP,magicBytes:()=>Yy,universalSignatureValidatorAbi:()=>_P,universalSignatureValidatorBytecode:()=>zP,unwrap:()=>pv,validate:()=>LP,wrap:()=>FP});function Xy(e){if(ge(e,-32)!==Yy)throw new op(e)}function UP(e){return typeof e=="string"?pv(e):e}function pv(e){Xy(e);let[t,r,n]=zc(Tf("address, bytes, bytes"),e);return{data:r,signature:n,to:t}}function FP(e){let{data:t,signature:r,to:n}=e;return Te(bs(Tf("address, bytes, bytes"),[n,t,r]),Yy)}function LP(e){try{return Xy(e),!0}catch{return!1}}var Yy,zP,_P,op,lv=p(()=>{Mc();Nt();We();Yy="0x6492649264926492649264926492649264926492649264926492649264926492",zP="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",_P=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];op=class extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}});var hv=p(()=>{lv()});function Nf({r:e,s:t,to:r="hex",v:n,yParity:o}){let s=(()=>{if(o===0||o===1)return o;if(n&&(n===27n||n===28n||n>=35n))return n%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new xt.Signature(j(e),j(t)).toCompactHex()}${s===0?"1b":"1c"}`;return r==="hex"?i:re(i)}var Qy=p(()=>{fi();ve();ue()});async function ws(e,t){let{address:r,chain:n=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??n?.contracts?.erc6492Verifier?.address,multicallAddress:i=t.multicallAddress??n?.contracts?.multicall3?.address,mode:a="auto"}=t;if(n?.verifyHash)return await n.verifyHash(e,t);let c=(()=>{let u=t.signature;return O(u)?u:typeof u=="object"&&"r"in u&&"s"in u?Nf(u):K(u)})();try{if(a==="eoa")try{if(de(ye(r),await gt({hash:o,signature:c})))return!0}catch{}return Rr.validate(c)?await OP(e,{...t,multicallAddress:i,signature:c}):await DP(e,{...t,verifierAddress:s,signature:c})}catch(u){if(a!=="eoa")try{if(de(ye(r),await gt({hash:o,signature:c})))return!0}catch{}if(u instanceof Un)return!1;throw u}}async function OP(e,t){let{address:r,blockNumber:n,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:a,data:c,signature:u,to:f}=Rr.unwrap(t.signature);if(await Ei(e,{address:r,blockNumber:n,blockTag:o})===Ae(["0xef0100",a.address]))return await qP(e,{address:r,blockNumber:n,blockTag:o,hash:s,signature:u});let l={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:I(a.r,{size:32}),s:I(a.s,{size:32}),yParity:a.yParity};if(!await B2({address:r,authorization:l}))throw new Un;let h=await R(e,oe,"readContract")({...i?{address:i}:{code:sc},authorizationList:[l],abi:dr,blockNumber:n,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:f??r,callData:c}]:[],{allowFailure:!0,target:r,callData:ne({abi:ch,functionName:"isValidSignature",args:[s,u]})}]]});if(h[h.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new Un}async function DP(e,t){let{address:r,factory:n,factoryData:o,hash:s,signature:i,verifierAddress:a,...c}=t,u=await(async()=>!n&&!o||$f.validate(i)?i:$f.wrap({data:o,signature:i,to:n}))(),f=a?{to:a,data:ne({abi:nc,functionName:"isValidSig",args:[r,s,u]}),...c}:{data:Hn({abi:nc,args:[r,s,u],bytecode:Qu}),...c},{data:d}=await R(e,mr,"call")(f).catch(l=>{throw l instanceof co?new Un:l});if(ia(d??"0x0"))return!0;throw new Un}async function qP(e,t){let{address:r,blockNumber:n,blockTag:o,hash:s,signature:i}=t;if((await R(e,oe,"readContract")({address:r,abi:ch,args:[s,i],blockNumber:n,blockTag:o,functionName:"isValidSignature"}).catch(c=>{throw c instanceof uo?new Un:c})).startsWith("0x1626ba7e"))return!0;throw new Un}var Un,Hf=p(()=>{hv();If();Ke();ic();bn();ef();Ze();dt();Jt();k2();Me();ut();ve();L();ee();Mo();Qy();bi();Fm();it();Un=class extends Error{}});async function yv(e,{address:t,message:r,factory:n,factoryData:o,signature:s,...i}){let a=ys(r);return R(e,ws,"verifyHash")({address:t,factory:n,factoryData:o,hash:a,signature:s,...i})}var bv=p(()=>{ee();pf();Hf()});async function xv(e,t){let{address:r,factory:n,factoryData:o,signature:s,message:i,primaryType:a,types:c,domain:u,...f}=t,d=Rc({message:i,primaryType:a,types:c,domain:u});return R(e,ws,"verifyHash")({address:r,factory:n,factoryData:o,hash:d,signature:s,...f})}var gv=p(()=>{ee();hf();Hf()});function sp(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:n,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){let a=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),c;return a?(()=>{let d=Y(["watchBlockNumber",e.uid,t,r,i]);return at(d,{onBlockNumber:n,onError:o},l=>pr(async()=>{try{let m=await R(e,Xr,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(m===c)return;if(m-c>1&&r)for(let h=c+1n;h<m;h++)l.onBlockNumber(h,c),c=h}(c===void 0||m>c)&&(l.onBlockNumber(m,c),c=m)}catch(m){l.onError?.(m)}},{emitOnBegin:t,interval:i}))})():(()=>{let d=Y(["watchBlockNumber",e.uid,t,r]);return at(d,{onBlockNumber:n,onError:o},l=>{let m=!0,h=()=>m=!1;return(async()=>{try{let y=(()=>{if(e.transport.type==="fallback"){let v=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),{unsubscribe:g}=await y.subscribe({params:["newHeads"],onData(v){if(!m)return;let E=j(v.result?.number);l.onBlockNumber(E,c),c=E},onError(v){l.onError?.(v)}});h=g,m||h()}catch(y){o?.(y)}})(),()=>h()})})()}var eb=p(()=>{ve();ee();cs();gi();Je();pc()});async function ip(e,t){let{checkReplacement:r=!0,confirmations:n=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:a=({count:w})=>~~(1<<w)*200,timeout:c=18e4}=t,u=Y(["waitForTransactionReceipt",e.uid,o]),f=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval,d,l,m,h=!1,y,g,{promise:v,resolve:E,reject:x}=fc(),b=c?setTimeout(()=>{g?.(),y?.(),x(new Pa({hash:o}))},c):void 0;return y=at(u,{onReplaced:s,resolve:E,reject:x},async w=>{if(m=await R(e,Fc,"getTransactionReceipt")({hash:o}).catch(()=>{}),m&&n<=1){clearTimeout(b),w.resolve(m),y?.();return}g=R(e,sp,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:f,async onBlockNumber(A){let P=k=>{clearTimeout(b),g?.(),k(),y?.()},B=A;if(!h)try{if(m){if(n>1&&(!m.blockNumber||B-m.blockNumber+1n<n))return;P(()=>w.resolve(m));return}if(r&&!d&&(h=!0,await Mn(async()=>{d=await R(e,Uc,"getTransaction")({hash:o}),d.blockNumber&&(B=d.blockNumber)},{delay:a,retryCount:i}),h=!1),m=await R(e,Fc,"getTransactionReceipt")({hash:o}),n>1&&(!m.blockNumber||B-m.blockNumber+1n<n))return;P(()=>w.resolve(m))}catch(k){if(k instanceof io||k instanceof ao){if(!d){h=!1;return}try{l=d,h=!0;let S=await Mn(()=>R(e,Ge,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:a,retryCount:i,shouldRetry:({error:z})=>z instanceof Wr});h=!1;let N=S.transactions.find(({from:z,nonce:$})=>z===l.from&&$===l.nonce);if(!N||(m=await R(e,Fc,"getTransactionReceipt")({hash:N.hash}),n>1&&(!m.blockNumber||B-m.blockNumber+1n<n)))return;let _="replaced";N.to===l.to&&N.value===l.value&&N.input===l.input?_="repriced":N.from===N.to&&N.value===0n&&(_="cancelled"),P(()=>{w.onReplaced?.({reason:_,replacedTransaction:l,transaction:N,transactionReceipt:m}),w.resolve(m)})}catch(S){P(()=>w.reject(S))}}else P(()=>w.reject(k))}}})}),v}var tb=p(()=>{Uu();lt();ee();cs();om();cf();Je();Jo();Q0();jy();eb()});function wv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:o,onError:s,includeTransactions:i,poll:a,pollingInterval:c=e.pollingInterval}){let u=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=i??!1,d;return u?(()=>{let h=Y(["watchBlocks",e.uid,t,r,n,f,c]);return at(h,{onBlock:o,onError:s},y=>pr(async()=>{try{let g=await R(e,Ge,"getBlock")({blockTag:t,includeTransactions:f});if(g.number!==null&&d?.number!=null){if(g.number===d.number)return;if(g.number-d.number>1&&r)for(let v=d?.number+1n;v<g.number;v++){let E=await R(e,Ge,"getBlock")({blockNumber:v,includeTransactions:f});y.onBlock(E,d),d=E}}(d?.number==null||t==="pending"&&g?.number==null||g.number!==null&&g.number>d.number)&&(y.onBlock(g,d),d=g)}catch(g){y.onError?.(g)}},{emitOnBegin:n,interval:c}))})():(()=>{let h=!0,y=!0,g=()=>h=!1;return(async()=>{try{n&&R(e,Ge,"getBlock")({blockTag:t,includeTransactions:f}).then(x=>{h&&y&&(o(x,void 0),y=!1)}).catch(s);let v=(()=>{if(e.transport.type==="fallback"){let x=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return x?x.value:e.transport}return e.transport})(),{unsubscribe:E}=await v.subscribe({params:["newHeads"],async onData(x){if(!h)return;let b=await R(e,Ge,"getBlock")({blockNumber:x.result?.number,includeTransactions:f}).catch(()=>{});h&&(o(b,d),y=!1,d=b)},onError(x){s?.(x)}});g=E,h||g()}catch(v){s?.(v)}})(),()=>g()})()}var vv=p(()=>{ee();cs();gi();Je();Jo()});function Ev(e,{address:t,args:r,batch:n=!0,event:o,events:s,fromBlock:i,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:d}){let l=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),m=d??!1;return l?(()=>{let g=Y(["watchEvent",t,r,n,e.uid,o,f,i]);return at(g,{onLogs:c,onError:a},v=>{let E;i!==void 0&&(E=i-1n);let x,b=!1,w=pr(async()=>{if(!b){try{x=await R(e,_m,"createEventFilter")({address:t,args:r,event:o,events:s,strict:m,fromBlock:i})}catch{}b=!0;return}try{let A;if(x)A=await R(e,us,"getFilterChanges")({filter:x});else{let P=await R(e,Xr,"getBlockNumber")({});E&&E!==P?A=await R(e,Za,"getLogs")({address:t,args:r,event:o,events:s,fromBlock:E+1n,toBlock:P}):A=[],E=P}if(A.length===0)return;if(n)v.onLogs(A);else for(let P of A)v.onLogs([P])}catch(A){x&&A instanceof Bt&&(b=!1),v.onError?.(A)}},{emitOnBegin:!0,interval:f});return async()=>{x&&await R(e,fs,"uninstallFilter")({filter:x}),w()}})})():(()=>{let g=!0,v=()=>g=!1;return(async()=>{try{let E=(()=>{if(e.transport.type==="fallback"){let A=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),x=s??(o?[o]:void 0),b=[];x&&(b=[x.flatMap(P=>nr({abi:[P],eventName:P.name,args:r}))],o&&(b=b[0]));let{unsubscribe:w}=await E.subscribe({params:["logs",{address:t,topics:b}],onData(A){if(!g)return;let P=A.result;try{let{eventName:B,args:k}=kn({abi:x??[],data:P.data,topics:P.topics,strict:m}),S=Ue(P,{args:k,eventName:B});c([S])}catch(B){let k,S;if(B instanceof yr||B instanceof Hr){if(d)return;k=B.abiItem.name,S=B.abiItem.inputs?.some(_=>!("name"in _&&_.name))}let N=Ue(P,{args:S?[]:{},eventName:k});c([N])}},onError(A){a?.(A)}});v=w,g||v()}catch(E){a?.(E)}})(),()=>v()})()}var Av=p(()=>{le();ko();Wu();ei();Zr();ee();cs();gi();Je();_h();pc();nf();qd();of()});function Tv(e,{batch:t=!0,onError:r,onTransactions:n,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{let u=Y(["watchPendingTransactions",e.uid,t,s]);return at(u,{onTransactions:n,onError:r},f=>{let d,l=pr(async()=>{try{if(!d)try{d=await R(e,Um,"createPendingTransactionFilter")({});return}catch(h){throw l(),h}let m=await R(e,us,"getFilterChanges")({filter:d});if(m.length===0)return;if(t)f.onTransactions(m);else for(let h of m)f.onTransactions([h])}catch(m){f.onError?.(m)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await R(e,fs,"uninstallFilter")({filter:d}),l()}})})():(()=>{let u=!0,f=()=>u=!1;return(async()=>{try{let{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(l){if(!u)return;let m=l.result;n([m])},onError(l){r?.(l)}});f=d,u||f()}catch(d){r?.(d)}})(),()=>f()})()}var Pv=p(()=>{ee();cs();gi();Je();Uh();nf();of()});function Sv(e){let{scheme:t,statement:r,...n}=e.match(jP)?.groups??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:a,requestId:c,...u}=e.match(GP)?.groups??{},f=e.split("Resources:")[1]?.split(`
48
- - `).slice(1);return{...n,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...f?{resources:f}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}var jP,GP,Iv=p(()=>{jP=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,GP=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/});function Bv(e){let{address:t,domain:r,message:n,nonce:o,scheme:s,time:i=new Date}=e;if(r&&n.domain!==r||o&&n.nonce!==o||s&&n.scheme!==s||n.expirationTime&&i>=n.expirationTime||n.notBefore&&i<n.notBefore)return!1;try{if(!n.address||!Q(n.address,{strict:!1})||t&&!de(n.address,t))return!1}catch{return!1}return!0}var kv=p(()=>{mt();Jt()});async function Cv(e,t){let{address:r,domain:n,message:o,nonce:s,scheme:i,signature:a,time:c=new Date,...u}=t,f=Sv(o);if(!f.address||!Bv({address:r,domain:n,message:f,nonce:s,scheme:i,time:c}))return!1;let l=ys(o);return ws(e,{address:f.address,hash:l,signature:a,...u})}var Rv=p(()=>{pf();Iv();kv();Hf()});function Oc(e,t){return{amount:e,decimals:t,formatted:or(e,t)}}function ap(e,t){if(typeof e=="bigint")return e;let r=e.decimals??t;return xs(e.formatted,VP(r))}function VP(e){if(e===void 0)throw new Error("Token decimals are required. Pass `amount.decimals` or select a declared token.");return e}function cp(e,t){return typeof e=="bigint"?t:e.decimals??t}function Qe(e,t){let{decimals:r,token:n}=t,o=nb(e,n);if(o)return{address:o.address,decimals:r??o.decimals};if(Q(n,{strict:!1}))return{address:n,decimals:r??KP(e,n)};throw new Error(`Token "${n}" is not a declared ERC-20 token on the client's \`tokens\` array (with an address for the client's chain), and is not a valid address.`)}function nb(e,t){let r=e.tokens,n=e.chain?.id;if(!r||n===void 0)return;let o=WP(r,t);if(o)return rb(o,n);if(Q(t,{strict:!1}))for(let s of r){let i=rb(s,n);if(i&&de(i.address,t))return i}}function rb(e,t){let r=e.addresses[t];if(r)return{address:r,currency:e.currency,decimals:e.decimals,name:e.name,popular:e.popular,symbol:e.symbol}}function WP(e,t){let r=t.toLowerCase();for(let n of e)if(n.symbol?.toLowerCase()===r)return n}function KP(e,t){let r=e.tokens,n=e.chain?.id;if(r&&n!==void 0)for(let o of r){let s=rb(o,n);if(s&&de(s.address,t))return s.decimals}}async function Dc(e,t){let{address:r,decimals:n}=Qe(e,t);return n!==void 0?{address:r,decimals:n}:{address:r,decimals:await oe(e,{abi:Ce,address:r,functionName:"decimals"})}}function qc(e){let{account:t,chain:r,gas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:i}=e;return{account:t,chain:r,gas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:i}}function nn(e){return{...e,data:ne(e),to:e.address}}var Fn=p(()=>{Ke();mt();Jt();X0();ti();kf();it()});async function Ln(e,t){return Ln.inner(Xt,e,t)}function ZP(e,t){let{amount:r,spender:n,token:o}=t,{address:s,decimals:i}=Qe(e,{token:o});return{abi:Ce,address:s,args:[n,ap(r,i)],functionName:"approve"}}var ob=p(()=>{Ke();pi();Vu();rf();hc();Fn();(function(e){async function t(i,a,c){return await i(a,{...c,...e.call(a,c)})}e.inner=t;function r(i,a){return nn(ZP(i,a))}e.call=r;async function n(i,a){return rs(i,{...qc(a),...e.call(i,a)})}e.estimateGas=n;async function o(i,a){return as(i,{...qc(a),...e.call(i,a)})}e.simulate=o;function s(i){let[a]=ur({abi:Ce,logs:i,eventName:"Approval",strict:!0});if(!a)throw new Error("`Approval` event not found.");return a}e.extractEvent=s})(Ln||(Ln={}))});async function jc(e,{serializedTransaction:t,throwOnReceiptRevert:r,timeout:n}){let o=await e.request({method:"eth_sendRawTransactionSync",params:n?[t,n]:[t]},{retryCount:0}),i=(e.chain?.formatters?.transactionReceipt?.format||zn)(o);if(i.status==="reverted"&&r)throw new ni({receipt:i});return i}var up=p(()=>{lt();bc()});async function fp(e,t){let{account:r=e.account,assertChainId:n=!0,chain:o=e.chain,accessList:s,authorizationList:i,blobs:a,data:c,dataSuffix:u=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,pollingInterval:g,throwOnReceiptRevert:v,type:E,value:x,...b}=t,w=t.timeout??Math.max((o?.blockTime??0)*3,5e3);if(typeof r>"u")throw new Re({docsPath:"/docs/actions/wallet/sendTransactionSync"});let A=r?G(r):null,P;try{_e(t);let B=await(async()=>{if(t.to)return t.to;if(t.to!==null&&i&&i.length>0)return await zo({authorization:i[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`.")})})();if(A?.type==="json-rpc"||A===null){let k;o!==null&&(k=await R(e,Ve,"getChainId")({}),n&&ds({currentChainId:k,chain:o}));let S=e.chain?.formatters?.transactionRequest?.format,_=(S||Be)({...$t(b,{format:S}),accessList:s,account:A,authorizationList:i,blobs:a,chainId:k,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,to:B,type:E,value:x},"sendTransaction"),z=sb.get(e.uid),$=z?"wallet_sendTransaction":"eth_sendTransaction",C=await(async()=>{try{return await e.request({method:$,params:[_]},{retryCount:0})}catch(U){if(z===!1)throw U;let M=U;if(M.name==="InvalidInputRpcError"||M.name==="InvalidParamsRpcError"||M.name==="MethodNotFoundRpcError"||M.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[_]},{retryCount:0}).then(F=>(sb.set(e.uid,!0),F)).catch(F=>{let q=F;throw q.name==="MethodNotFoundRpcError"||q.name==="MethodNotSupportedRpcError"?(sb.set(e.uid,!1),M):q});throw M}})(),H=await R(e,ip,"waitForTransactionReceipt")({checkReplacement:!1,hash:C,pollingInterval:g,timeout:w});if(v&&H.status==="reverted")throw new ni({receipt:H});return H}if(A?.type==="local"){if(A.nonceManager&&typeof y>"u"){let _=b.chainId,z=await(async()=>typeof _=="number"?_:o?o.id:R(e,Ve,"getChainId")({}))();P={address:A.address,chainId:z}}let k=await R(e,Kr,"prepareTransactionRequest")({account:A,accessList:s,authorizationList:i,blobs:a,chain:o,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:y,nonceManager:A.nonceManager,parameters:[...Gu,"sidecars"],type:E,value:x,...b,to:B}),S=o?.serializers?.transaction,N=await A.signTransaction(k,{serializer:S});return await R(e,jc,"sendRawTransactionSync")({serializedTransaction:N,throwOnReceiptRevert:v,timeout:t.timeout})}throw A?.type==="smart"?new lr({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new lr({docsPath:"/docs/actions/wallet/sendTransactionSync",type:A?.type})}catch(B){throw B instanceof lr?B:(P&&!(B instanceof ni)&&A?.nonceManager?.reset(P),ts(B,{...t,account:A,chain:t.chain||void 0}))}}var sb,ib=p(()=>{be();Qr();V();lt();Mu();sf();Me();ju();Vo();Sr();ee();eo();Ir();Bn();tb();Wa();up();sb=new rt(128)});async function Gc(e,t){return Xt.internal(e,fp,"sendTransactionSync",t)}var dp=p(()=>{ib();hc()});async function ab(e,t){let{amount:r,token:n,throwOnReceiptRevert:o=!0}=t,{decimals:s}=Qe(e,{token:n}),i=cp(r,s),a=await Ln.inner(Gc,e,{...t,throwOnReceiptRevert:o}),{args:c}=Ln.extractEvent(a.logs);return{...c,...i===void 0?{}:{decimals:i,formatted:or(c.value,i)},receipt:a}}var $v=p(()=>{ti();dp();ob();Fn()});async function Vc(e,t){let{account:r,decimals:n,spender:o,token:s,...i}=t,[a,{decimals:c}]=await Promise.all([oe(e,{...i,...Vc.call(e,{account:r,spender:o,token:s})}),Dc(e,{decimals:n,token:s})]);return Oc(a,c)}var Nv=p(()=>{Ke();it();Fn();(function(e){function t(r,n){return nn({address:Qe(r,n).address,abi:Ce,functionName:"allowance",args:[n.account,n.spender]})}e.call=t})(Vc||(Vc={}))});async function Wc(e,t){let{account:r=e.account,decimals:n,token:o,...s}=t;if(!r)throw new Re;let i=G(r).address,[a,{decimals:c}]=await Promise.all([oe(e,{...s,...Wc.call(e,{account:i,token:o})}),Dc(e,{decimals:n,token:o})]);return Oc(a,c)}var Hv=p(()=>{be();Ke();Qr();it();Fn();(function(e){function t(r,n){let o=n.account??r.account;if(!o)throw new Re;let s=G(o).address;return nn({address:Qe(r,n).address,abi:Ce,functionName:"balanceOf",args:[s]})}e.call=t})(Wc||(Wc={}))});async function cb(e,t){let{token:r,...n}=t,{address:o}=Qe(e,{token:r}),s=nb(e,r),[i,a,c]=await Promise.all([s?.decimals??oe(e,{...n,abi:Ce,address:o,functionName:"decimals"}),s?.name??oe(e,{...n,abi:Ce,address:o,functionName:"name"}),s?.symbol??oe(e,{...n,abi:Ce,address:o,functionName:"symbol"})]);return{decimals:i,name:a,symbol:c}}var Mv=p(()=>{Ke();it();Fn()});async function Kc(e,t){let{decimals:r,token:n,...o}=t,[s,{decimals:i}]=await Promise.all([oe(e,{...o,...Kc.call(e,{token:n})}),Dc(e,{decimals:r,token:n})]);return Oc(s,i)}var zv=p(()=>{Ke();it();Fn();(function(e){function t(r,n){return nn({address:Qe(r,n).address,abi:Ce,args:[],functionName:"totalSupply"})}e.call=t})(Kc||(Kc={}))});async function On(e,t){return On.inner(Xt,e,t)}function JP(e,t){let{amount:r,from:n,to:o,token:s}=t,{address:i,decimals:a}=Qe(e,{token:s}),c=ap(r,a);return n?{abi:Ce,address:i,args:[n,o,c],functionName:"transferFrom"}:{abi:Ce,address:i,args:[o,c],functionName:"transfer"}}var ub=p(()=>{Ke();pi();Vu();rf();hc();Fn();(function(e){async function t(i,a,c){return await i(a,{...c,...e.call(a,c)})}e.inner=t;function r(i,a){return nn(JP(i,a))}e.call=r;async function n(i,a){return rs(i,{...qc(a),...e.call(i,a)})}e.estimateGas=n;async function o(i,a){return as(i,{...qc(a),...e.call(i,a)})}e.simulate=o;function s(i){let[a]=ur({abi:Ce,logs:i,eventName:"Transfer",strict:!0});if(!a)throw new Error("`Transfer` event not found.");return a}e.extractEvent=s})(On||(On={}))});async function fb(e,t){let{amount:r,token:n,throwOnReceiptRevert:o=!0}=t,{decimals:s}=Qe(e,{token:n}),i=cp(r,s),a=await On.inner(Gc,e,{...t,throwOnReceiptRevert:o}),{args:c}=On.extractEvent(a.logs);return{...c,...i===void 0?{}:{decimals:i,formatted:or(c.value,i)},receipt:a}}var _v=p(()=>{ti();dp();Fn();ub()});var db=p(()=>{ob();$v();Nv();Hv();Mv();zv();ub();_v()});function mp(e){return{call:t=>mr(e,t),createAccessList:t=>zm(e,t),createBlockFilter:()=>e2(e),createContractEventFilter:t=>fa(e,t),createEventFilter:t=>_m(e,t),createPendingTransactionFilter:()=>Um(e),estimateContractGas:t=>rs(e,t),estimateGas:t=>Ka(e,t),getBalance:t=>r2(e,t),getBlobBaseFee:()=>o2(e),getBlock:t=>Ge(e,t),getBlockNumber:t=>Xr(e,t),getBlockReceipts:t=>i2(e,t),getBlockTransactionCount:t=>c2(e,t),getBytecode:t=>Ei(e,t),getChainId:()=>Ve(e),getCode:t=>Ei(e,t),getContractEvents:t=>Ja(e,t),getDelegation:t=>f2(e,t),getEip712Domain:t=>p2(e,t),getEnsAddress:t=>F5(e,t),getEnsAvatar:t=>K5(e,t),getEnsName:t=>J5(e,t),getEnsResolver:t=>X5(e,t),getEnsText:t=>Mm(e,t),getFeeHistory:t=>b2(e,t),estimateFeesPerGas:t=>j6(e,t),getFilterChanges:t=>us(e,t),getFilterLogs:t=>g2(e,t),getGasPrice:()=>Oa(e),getLogs:t=>Za(e,t),getProof:t=>Z8(e,t),estimateMaxPriorityFeePerGas:t=>q6(e,t),fillTransaction:t=>Va(e,t),getStorageAt:t=>Y8(e,t),getTransaction:t=>Uc(e,t),getTransactionConfirmations:t=>Q8(e,t),getTransactionCount:t=>Yo(e,t),getTransactionReceipt:t=>Fc(e,t),multicall:t=>tv(e,t),prepareTransactionRequest:t=>Kr(e,t),readContract:t=>oe(e,t),sendRawTransaction:t=>lc(e,t),sendRawTransactionSync:t=>jc(e,t),simulate:t=>Cf(e,t),simulateBlocks:t=>Cf(e,t),simulateCalls:t=>dv(e,t),simulateContract:t=>as(e,t),verifyHash:t=>ws(e,t),verifyMessage:t=>yv(e,t),verifySiweMessage:t=>Cv(e,t),verifyTypedData:t=>xv(e,t),uninstallFilter:t=>fs(e,t),waitForTransactionReceipt:t=>ip(e,t),watchBlocks:t=>wv(e,t),watchBlockNumber:t=>sp(e,t),watchContractEvent:t=>ym(e,t),watchEvent:t=>Ev(e,t),watchPendingTransactions:t=>Tv(e,t),token:YP(e)}}function YP(e){return{getAllowance:en(e,Vc),getBalance:en(e,Wc),getMetadata:en(e,cb),getTotalSupply:en(e,Kc)}}var mb=p(()=>{L5();Z5();Y5();Q5();Mh();bi();zh();t2();ld();_h();Uh();Vu();Gl();Dd();jl();Od();n2();s2();Jo();pc();a2();u2();Bn();Fm();jd();d2();l2();x2();nf();w2();Rd();qd();J8();X8();Q0();ev();Lu();jy();rv();it();Gy();mv();rf();of();Hf();bv();gv();tb();eb();vv();Eh();Av();Pv();Rv();db();Wa();bm();up();wi()});function Uv(e){let{key:t="public",name:r="Public Client"}=e;return ps({...e,key:t,name:r,type:"publicClient"}).extend(mp)}var Fv=p(()=>{wi();mb()});async function Lv(e,{hash:t}){await e.request({method:`${e.mode}_dropTransaction`,params:[t]})}var Ov=p(()=>{});async function Dv(e){return e.request({method:`${e.mode}_dumpState`})}var qv=p(()=>{});async function jv(e){return e.mode==="ganache"?await e.request({method:"eth_mining"}):await e.request({method:`${e.mode}_getAutomine`})}var Gv=p(()=>{});async function Vv(e){return await e.request({method:"txpool_content"})}var Wv=p(()=>{});async function Kv(e){let{pending:t,queued:r}=await e.request({method:"txpool_status"});return{pending:Z(t),queued:Z(r)}}var Zv=p(()=>{ve()});async function Jv(e,{address:t}){await e.request({method:`${e.mode}_impersonateAccount`,params:[t]})}var Yv=p(()=>{});async function Xv(e,{seconds:t}){return await e.request({method:"evm_increaseTime",params:[I(t)]})}var Qv=p(()=>{L()});async function e3(e){return await e.request({method:"txpool_inspect"})}var t3=p(()=>{});async function r3(e,{state:t}){await e.request({method:`${e.mode}_loadState`,params:[t]})}var n3=p(()=>{});async function o3(e,{blocks:t,interval:r}){e.mode==="ganache"?await e.request({method:"evm_mine",params:[{blocks:I(t)}]}):await e.request({method:`${e.mode}_mine`,params:[I(t),I(r||0)]})}var s3=p(()=>{L()});async function i3(e){await e.request({method:`${e.mode}_removeBlockTimestampInterval`})}var a3=p(()=>{});async function c3(e,{blockNumber:t,jsonRpcUrl:r}={}){await e.request({method:`${e.mode}_reset`,params:[{forking:{blockNumber:Number(t),jsonRpcUrl:r}}]})}var u3=p(()=>{});async function f3(e,{id:t}){await e.request({method:"evm_revert",params:[t]})}var d3=p(()=>{});async function m3(e,t){let{accessList:r,data:n,from:o,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:d,...l}=t,m=e.chain?.formatters?.transactionRequest?.format,y=(m||Be)({...$t(l,{format:m}),accessList:r,data:n,from:o,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:d},"sendUnsignedTransaction");return await e.request({method:"eth_sendUnsignedTransaction",params:[y]})}var p3=p(()=>{Vo();Sr()});async function l3(e,t){e.mode==="ganache"?t?await e.request({method:"miner_start"}):await e.request({method:"miner_stop"}):await e.request({method:"evm_setAutomine",params:[t]})}var h3=p(()=>{});async function y3(e,{address:t,value:r}){e.mode==="ganache"?await e.request({method:"evm_setAccountBalance",params:[t,I(r)]}):await e.request({method:`${e.mode}_setBalance`,params:[t,I(r)]})}var b3=p(()=>{L()});async function x3(e,{gasLimit:t}){await e.request({method:"evm_setBlockGasLimit",params:[I(t)]})}var g3=p(()=>{L()});async function w3(e,{interval:t}){let r=e.mode==="hardhat"?t*1e3:t;await e.request({method:`${e.mode}_setBlockTimestampInterval`,params:[r]})}var v3=p(()=>{});async function E3(e,{address:t,bytecode:r}){e.mode==="ganache"?await e.request({method:"evm_setAccountCode",params:[t,r]}):await e.request({method:`${e.mode}_setCode`,params:[t,r]})}var A3=p(()=>{});async function T3(e,{address:t}){await e.request({method:`${e.mode}_setCoinbase`,params:[t]})}var P3=p(()=>{});async function S3(e,{interval:t}){let r=e.mode==="hardhat"?t*1e3:t;await e.request({method:"evm_setIntervalMining",params:[r]})}var I3=p(()=>{});async function B3(e,t){await e.request({method:`${e.mode}_setLoggingEnabled`,params:[t]})}var k3=p(()=>{});async function C3(e,{gasPrice:t}){await e.request({method:`${e.mode}_setMinGasPrice`,params:[I(t)]})}var R3=p(()=>{L()});async function $3(e,{baseFeePerGas:t}){await e.request({method:`${e.mode}_setNextBlockBaseFeePerGas`,params:[I(t)]})}var N3=p(()=>{L()});async function H3(e,{timestamp:t}){await e.request({method:"evm_setNextBlockTimestamp",params:[I(t)]})}var M3=p(()=>{L()});async function z3(e,{address:t,nonce:r}){await e.request({method:`${e.mode}_setNonce`,params:[t,I(r)]})}var _3=p(()=>{L()});async function U3(e,t){await e.request({method:`${e.mode}_setRpcUrl`,params:[t]})}var F3=p(()=>{});async function L3(e,{address:t,index:r,value:n}){await e.request({method:`${e.mode}_setStorageAt`,params:[t,typeof r=="number"?I(r):r,n]})}var O3=p(()=>{L()});async function D3(e){return await e.request({method:"evm_snapshot"})}var q3=p(()=>{});async function j3(e,{address:t}){await e.request({method:`${e.mode}_stopImpersonatingAccount`,params:[t]})}var G3=p(()=>{});function pp({mode:e}){return t=>{let r=t.extend(()=>({mode:e}));return{dropTransaction:n=>Lv(r,n),dumpState:()=>Dv(r),getAutomine:()=>jv(r),getTxpoolContent:()=>Vv(r),getTxpoolStatus:()=>Kv(r),impersonateAccount:n=>Jv(r,n),increaseTime:n=>Xv(r,n),inspectTxpool:()=>e3(r),loadState:n=>r3(r,n),mine:n=>o3(r,n),removeBlockTimestampInterval:()=>i3(r),reset:n=>c3(r,n),revert:n=>f3(r,n),sendUnsignedTransaction:n=>m3(r,n),setAutomine:n=>l3(r,n),setBalance:n=>y3(r,n),setBlockGasLimit:n=>x3(r,n),setBlockTimestampInterval:n=>w3(r,n),setCode:n=>E3(r,n),setCoinbase:n=>T3(r,n),setIntervalMining:n=>S3(r,n),setLoggingEnabled:n=>B3(r,n),setMinGasPrice:n=>C3(r,n),setNextBlockBaseFeePerGas:n=>$3(r,n),setNextBlockTimestamp:n=>H3(r,n),setNonce:n=>z3(r,n),setRpcUrl:n=>U3(r,n),setStorageAt:n=>L3(r,n),snapshot:()=>D3(r),stopImpersonatingAccount:n=>j3(r,n)}}}var pb=p(()=>{Ov();qv();Gv();Wv();Zv();Yv();Qv();t3();n3();s3();a3();u3();d3();p3();h3();b3();g3();v3();A3();P3();I3();k3();R3();N3();M3();_3();F3();O3();q3();G3()});function V3(e){let{key:t="test",name:r="Test Client",mode:n}=e;return ps({...e,key:t,name:r,type:"testClient"}).extend(s=>({mode:n,...pp({mode:n})(s)}))}var W3=p(()=>{wi();pb()});async function K3(e,{chain:t}){let{id:r,name:n,nativeCurrency:o,rpcUrls:s,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:I(r),chainName:n,nativeCurrency:o,rpcUrls:s.default.http,blockExplorerUrls:i?Object.values(i).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}var Z3=p(()=>{L()});function J3(e,t){let{abi:r,args:n,bytecode:o,...s}=t,i=Hn({abi:r,args:n,bytecode:o});return ms(e,{...s,...s.authorizationList?{to:null}:{},data:i})}var Y3=p(()=>{ef();af()});async function X3(e){return e.account?.type==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(r=>gr(r))}var Q3=p(()=>{dt()});async function e4(e,t={}){let{account:r=e.account,chainId:n}=t,o=r?G(r):void 0,s=n?[o?.address,[I(n)]]:[o?.address],i=await e.request({method:"wallet_getCapabilities",params:s}),a={};for(let[c,u]of Object.entries(i)){a[Number(c)]={};for(let[f,d]of Object.entries(u))f==="addSubAccount"&&(f="unstable_addSubAccount"),a[Number(c)][f]=d}return typeof n=="number"?a[n]:a}var t4=p(()=>{be();L()});async function r4(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}var n4=p(()=>{});async function lp(e,t){let{account:r=e.account,chainId:n,nonce:o}=t;if(!r)throw new Re({docsPath:"/docs/eip7702/prepareAuthorization"});let s=G(r),i=(()=>{if(t.executor)return t.executor==="self"?t.executor:G(t.executor)})(),a={address:t.contractAddress??t.address,chainId:n,nonce:o};return typeof a.chainId>"u"&&(a.chainId=e.chain?.id??await R(e,Ve,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await R(e,Yo,"getTransactionCount")({address:s.address,blockTag:"pending"}),(i==="self"||i?.address&&de(i.address,s.address))&&(a.nonce+=1)),a}var lb=p(()=>{be();Qr();Jt();ee();Bn();Lu()});async function o4(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>ye(r))}var s4=p(()=>{dt()});async function i4(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}var a4=p(()=>{});async function c4(e,t){let{chain:r=e.chain}=t,n=t.timeout??Math.max((r?.blockTime??0)*3,5e3),o=await R(e,gm,"sendCalls")(t);return await R(e,Em,"waitForCallsStatus")({...t,id:o.id,timeout:n})}var u4=p(()=>{ee();wm();Am()});async function f4(e,t){let{id:r}=t;await e.request({method:"wallet_showCallsStatus",params:[r]})}var d4=p(()=>{});async function m4(e,t){let{account:r=e.account}=t;if(!r)throw new Re({docsPath:"/docs/eip7702/signAuthorization"});let n=G(r);if(!n.signAuthorization)throw new lr({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});let o=await lp(e,t);return n.signAuthorization(o)}var p4=p(()=>{be();Qr();lb()});async function l4(e,{account:t=e.account,message:r}){if(!t)throw new Re({docsPath:"/docs/actions/wallet/signMessage"});let n=G(t);if(n.signMessage)return n.signMessage({message:r});let o=typeof r=="string"?tr(r):r.raw instanceof Uint8Array?pe(r.raw):r.raw;return e.request({method:"personal_sign",params:[o,n.address]},{retryCount:0})}var h4=p(()=>{be();Qr();L()});async function y4(e,t){let{account:r=e.account,chain:n=e.chain,...o}=t;if(!r)throw new Re({docsPath:"/docs/actions/wallet/signTransaction"});let s=G(r);_e({account:s,...t});let i=await R(e,Ve,"getChainId")({});n!==null&&ds({currentChainId:i,chain:n});let c=(n?.formatters||e.chain?.formatters)?.transactionRequest?.format||Be;return s.signTransaction?s.signTransaction({...o,account:s,chainId:i},{serializer:e.chain?.serializers?.transaction}):await e.request({method:"eth_signTransaction",params:[{...c({...o,account:s},"signTransaction"),chainId:I(i),from:s.address}]},{retryCount:0})}var b4=p(()=>{be();Qr();sf();L();Sr();ee();Ir();Bn()});async function x4(e,t){let{account:r=e.account,domain:n,message:o,primaryType:s}=t;if(!r)throw new Re({docsPath:"/docs/actions/wallet/signTypedData"});let i=G(r),a={EIP712Domain:Ti({domain:n}),...t.types};if(Cc({domain:n,message:o,primaryType:s,types:a}),i.signTypedData)return i.signTypedData({domain:n,message:o,primaryType:s,types:a});let c=Qm({domain:n,message:o,primaryType:s,types:a});return e.request({method:"eth_signTypedData_v4",params:[i.address,c]},{retryCount:0})}var g4=p(()=>{be();Qr();e0()});async function w4(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:I(t)}]},{retryCount:0})}var v4=p(()=>{L()});async function E4(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}var A4=p(()=>{});function hp(e){return{addChain:t=>K3(e,t),deployContract:t=>J3(e,t),fillTransaction:t=>Va(e,t),getAddresses:()=>X3(e),getCallsStatus:t=>vm(e,t),getCapabilities:t=>e4(e,t),getChainId:()=>Ve(e),getPermissions:()=>r4(e),prepareAuthorization:t=>lp(e,t),prepareTransactionRequest:t=>Kr(e,t),requestAddresses:()=>o4(e),requestPermissions:t=>i4(e,t),sendCalls:t=>gm(e,t),sendCallsSync:t=>c4(e,t),sendRawTransaction:t=>lc(e,t),sendRawTransactionSync:t=>jc(e,t),sendTransaction:t=>ms(e,t),sendTransactionSync:t=>fp(e,t),showCallsStatus:t=>f4(e,t),signAuthorization:t=>m4(e,t),signMessage:t=>l4(e,t),signTransaction:t=>y4(e,t),signTypedData:t=>x4(e,t),switchChain:t=>w4(e,t),waitForCallsStatus:t=>Em(e,t),watchAsset:t=>E4(e,t),writeContract:t=>Xt(e,t),writeContractSync:t=>Gc(e,t),token:{approve:en(e,Ln),approveSync:en(e,ab),transfer:en(e,On),transferSync:en(e,fb)}}}var hb=p(()=>{Od();Bn();db();Z3();Y3();Q3();kh();t4();n4();lb();Wa();s4();a4();wm();u4();bm();up();af();ib();d4();p4();h4();b4();g4();v4();Am();A4();hc();dp();wi()});function T4(e){let{key:t="wallet",name:r="Wallet Client",transport:n}=e;return ps({...e,key:t,name:r,transport:n,type:"walletClient"}).extend(hp)}var P4=p(()=>{wi();hb()});function on({key:e,methods:t,name:r,request:n,retryCount:o=3,retryDelay:s=150,timeout:i,type:a},c){let u=Sm();return{config:{key:e,methods:t,name:r,request:n,retryCount:o,retryDelay:s,timeout:i,type:a},request:$2(n,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:c}}var Zc=p(()=>{N2();Ch()});function S4(e,t={}){let{key:r="custom",methods:n,name:o="Custom Provider",retryDelay:s}=t;return({retryCount:i})=>on({key:r,methods:n,name:o,request:e.request.bind(e),retryCount:t.retryCount??i,retryDelay:s,type:"custom"})}var I4=p(()=>{Zc()});function B4(e,t={}){let{key:r="fallback",name:n="Fallback",rank:o=!1,shouldThrow:s=yb,retryCount:i,retryDelay:a}=t;return(({chain:c,pollingInterval:u=4e3,timeout:f,...d})=>{let l=e,m=()=>{},h=on({key:r,name:n,async request({method:y,params:g}){let v,E=async(x=0)=>{let b=l[x]({...d,chain:c,retryCount:0,timeout:f});try{let w=await b.request({method:y,params:g});return m({method:y,params:g,response:w,transport:b,status:"success"}),w}catch(w){if(m({error:w,method:y,params:g,transport:b,status:"error"}),s(w)||x===l.length-1||(v??(v=l.slice(x+1).some(A=>{let{include:P,exclude:B}=A({chain:c}).config.methods||{};return P?P.includes(y):B?!B.includes(y):!0})),!v))throw w;return E(x+1)}};return E()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:y=>m=y,transports:l.map(y=>y({chain:c,retryCount:0}))});if(o){let y=typeof o=="object"?o:{};XP({chain:c,interval:y.interval??u,onTransports:g=>l=g,ping:y.ping,sampleCount:y.sampleCount,timeout:y.timeout,transports:l,weights:y.weights})}return h})}function yb(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===Lr.code||e.code===Tr.code||e.code===Bo.code||Kt.nodeMessage.test(e.message)||e.code===5e3))}function XP({chain:e,interval:t=4e3,onTransports:r,ping:n,sampleCount:o=10,timeout:s=1e3,transports:i,weights:a={}}){let{stability:c=.7,latency:u=.3}=a,f=[],d=async()=>{let l=await Promise.all(i.map(async y=>{let g=y({chain:e,retryCount:0,timeout:s}),v=Date.now(),E,x;try{await(n?n({transport:g}):g.request({method:"net_listening"})),x=1}catch{x=0}finally{E=Date.now()}return{latency:E-v,success:x}}));f.push(l),f.length>o&&f.shift();let m=Math.max(...f.map(y=>Math.max(...y.map(({latency:g})=>g)))),h=i.map((y,g)=>{let v=f.map(A=>A[g].latency),x=1-v.reduce((A,P)=>A+P,0)/v.length/m,b=f.map(A=>A[g].success),w=b.reduce((A,P)=>A+P,0)/b.length;return w===0?[0,g]:[u*x+c*w,g]}).sort((y,g)=>g[0]-y[0]);r(h.map(([,y])=>i[y])),await xi(t),d()};d()}var k4=p(()=>{Gr();ko();lm();Zc()});var vs,yp=p(()=>{V();vs=class extends T{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}});function eS(e){if(!e)return"default";let t=C4.get(e);if(t!==void 0)return t;let r=QP++;return C4.set(e,r),r}function R4(e,t={}){let{batch:r,fetchFn:n,fetchOptions:o,key:s="http",maxResponseBodySize:i,methods:a,name:c="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:f,retryDelay:d,raw:l}=t;return({chain:m,retryCount:h,timeout:y})=>{let{batchSize:g=1e3,wait:v=0}=typeof r=="object"?r:{},E=t.retryCount??h,x=y??t.timeout??1e4,b=e||m?.rpcUrls.default.http[0];if(!b)throw new vs;let w=cw(b,{fetchFn:n,fetchOptions:o,maxResponseBodySize:i,onRequest:u,onResponse:f,timeout:x});return on({key:s,methods:a,name:c,async request({method:A,params:P},B){let k={method:A,params:P},S=B?.signal?{signal:B.signal}:void 0,{schedule:N}=dc({id:`${b}.${eS(B?.signal)}`,wait:v,shouldSplitBatch(C){return C.length>g},fn:C=>w.request({body:C,fetchOptions:S}),sort:(C,H)=>C.id-H.id}),_=async C=>r?N(C):[await w.request({body:C,fetchOptions:S})],[{error:z,result:$}]=await _(k);if(l)return{error:z,result:$};if(z)throw new ir({body:k,error:z,url:b});return $},retryCount:E,retryDelay:d,timeout:x,type:"http"},{fetchOptions:o,url:b})}}var QP,C4,$4=p(()=>{ar();yp();sm();uw();Zc();QP=0,C4=new WeakMap});function N4(e,t={}){let{keepAlive:r,key:n="webSocket",methods:o,name:s="WebSocket JSON-RPC",reconnect:i,retryDelay:a}=t;return({chain:c,retryCount:u,timeout:f})=>{let d=t.retryCount??u,l=f??t.timeout??1e4,m=e||c?.rpcUrls.default.webSocket?.[0],h={keepAlive:r,reconnect:i};if(!m)throw new vs;return on({key:n,methods:o,name:s,async request({method:y,params:g}){let v={method:y,params:g},E=await Sc(m,h),{error:x,result:b}=await E.requestAsync({body:v,timeout:l});if(x)throw new ir({body:v,error:x,url:m});return b},retryCount:d,retryDelay:a,timeout:l,type:"webSocket"},{getSocket(){return yw(m)},getRpcClient(){return Sc(m,h)},async subscribe({params:y,onData:g,onError:v}){let E=await Sc(m,h),{result:x}=await new Promise((b,w)=>E.request({body:{method:"eth_subscribe",params:y},onError(A){w(A),v?.(A)},onResponse(A){if(A.error){w(A.error),v?.(A.error);return}if(typeof A.id=="number"){b(A);return}A.method==="eth_subscription"&&g(A.params)}}));return{subscriptionId:x,async unsubscribe(){return new Promise(b=>E.request({body:{method:"eth_unsubscribe",params:[x]},onResponse:b}))}}}})}}var H4=p(()=>{ar();yp();bw();Kh();Zc()});var bp,M4=p(()=>{bp=class extends Error{constructor(t,r){super(r),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t,this.details=r}}});function z4(e){let{abi:t,bytecode:r,data:n}=e;if(n===r)return{bytecode:r};let o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Gn({docsPath:bb});if(!("inputs"in o))throw new Nr({docsPath:bb});if(!o.inputs||o.inputs.length===0)throw new Nr({docsPath:bb});return{args:pt(o.inputs,`0x${n.replace(r,"")}`),bytecode:r}}var bb,_4=p(()=>{le();ro();bb="/docs/contract/decodeDeployData"});function U4(e){let t=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(a=>re(a)):e.blobs,n=r.reduce((a,c)=>a+c.length,0),o=vr(new Uint8Array(n)),s=!0;for(let a of r){let c=vr(a);for(;s&&c.position<a.length;){c.incrementPosition(1);let u=31;a.length-c.position<31&&(u=a.length-c.position);for(let f in Array.from({length:u})){let d=c.readByte();if(d===128&&!c.inspectBytes(c.remaining).includes(128)){s=!1;break}o.pushByte(d)}}}let i=o.bytes.slice(0,o.position);return t==="hex"?K(i):i}var F4=p(()=>{pa();ue();L()});function L4(e){let{sidecars:t,version:r}=e,n=e.to??(typeof t[0].blob=="string"?"hex":"bytes"),o=[];for(let{commitment:s}of t)o.push(Da({commitment:s,to:n,version:r}));return o}var O4=p(()=>{Hd()});function D4(e){if(e===1)return 60n;if(e>=tS||e<0)throw new vc({chainId:e});return BigInt((2147483648|e)>>>0)}var tS,q4=p(()=>{Nm();tS=2147483648});function xp({blobToKzgCommitment:e,computeBlobKzgProof:t}){return{blobToKzgCommitment:e,computeBlobKzgProof:t}}var xb=p(()=>{});function j4(e,t){try{e.loadTrustedSetup(t)}catch(r){let n=r;if(!n.message.includes("trusted setup is already loaded"))throw n}return xp(e)}var G4=p(()=>{xb()});function V4({r:e,yParityAndS:t}){let r=re(t),n=r[0]&128?1:0,o=r;return n===1&&(o[0]&=127),{r:e,s:K(o),yParity:n}}var W4=p(()=>{ue();L()});function gb(e){let{r:t,s:r}=xt.Signature.fromCompact(e.slice(2,130));return{r:I(t,{size:32}),yParityAndS:I(r,{size:32})}}var K4=p(()=>{fi();L()});function wb(e){let{r:t,s:r}=xt.Signature.fromCompact(e.slice(2,130)),n=+`0x${e.slice(130)}`,[o,s]=(()=>{if(n===0||n===1)return[void 0,n];if(n===27)return[BigInt(n),0];if(n===28)return[BigInt(n),1];throw new Error("Invalid yParityOrV value")})();return typeof o<"u"?{r:I(t,{size:32}),s:I(r,{size:32}),v:o,yParity:s}:{r:I(t,{size:32}),s:I(r,{size:32}),yParity:s}}var Z4=p(()=>{fi();L()});async function J4(e){let{serializedTransaction:t,signature:r}=e,n=Z0(t),o=r??{r:n.r,s:n.s,v:n.v,yParity:n.yParity},s=jm({...n,r:void 0,s:void 0,v:void 0,yParity:void 0,sidecars:void 0});return await gt({hash:te(s),signature:o})}var Y4=p(()=>{St();Dy();Gm();Mo()});function vb({r:e,yParityAndS:t}){return`0x${new xt.Signature(j(e),j(t)).toCompactHex()}`}var X4=p(()=>{fi();ve()});function Q4(e){let{r:t,s:r,v:n,yParity:o}=e,s=Number(o??n-27n),i=r;if(s===1){let a=re(r);a[0]|=128,i=K(a)}return{r:t,yParityAndS:i}}var eE=p(()=>{ue();L()});var tE={};sn(tE,{AbiConstructorNotFoundError:()=>Gn,AbiConstructorParamsNotFoundError:()=>Nr,AbiDecodingDataSizeInvalidError:()=>rd,AbiDecodingDataSizeTooSmallError:()=>Vn,AbiDecodingZeroDataError:()=>Tt,AbiEncodingArrayLengthMismatchError:()=>Gi,AbiEncodingBytesSizeMismatchError:()=>Vi,AbiEncodingLengthMismatchError:()=>Wn,AbiErrorInputsNotFoundError:()=>Wi,AbiErrorNotFoundError:()=>js,AbiErrorSignatureNotFoundError:()=>Kn,AbiEventNotFoundError:()=>Gs,AbiEventSignatureEmptyTopicsError:()=>Ki,AbiEventSignatureNotFoundError:()=>Zi,AbiFunctionNotFoundError:()=>Ot,AbiFunctionOutputsNotFoundError:()=>Zn,AbiFunctionSignatureNotFoundError:()=>Ji,AccountStateConflictError:()=>xa,AtomicReadyWalletRejectedUpgradeError:()=>Io,AtomicityNotSupportedError:()=>qr,BaseError:()=>T,BaseFeeScalarError:()=>Zo,BlockNotFoundError:()=>Wr,BundleFailedError:()=>yc,BundleTooLargeError:()=>So,BytesSizeMismatchError:()=>Jn,CallExecutionError:()=>co,ChainDisconnectedError:()=>vo,ChainDoesNotSupportContract:()=>$n,ChainMismatchError:()=>ac,ChainNotFoundError:()=>cc,CircularReferenceError:()=>Os,ClientChainNotConfiguredError:()=>hi,ContractFunctionExecutionError:()=>uo,ContractFunctionRevertedError:()=>yn,ContractFunctionZeroDataError:()=>Sa,CounterfactualDeploymentFailedError:()=>Ia,DecodeLogDataMismatch:()=>yr,DecodeLogTopicsMismatch:()=>Hr,DuplicateIdError:()=>To,EIP1193ProviderRpcError:()=>bp,Eip1559FeesNotSupportedError:()=>Vr,EnsAvatarInvalidNftUriError:()=>tn,EnsAvatarUnsupportedNamespaceError:()=>wc,EnsAvatarUriResolutionError:()=>ls,EnsInvalidChainIdError:()=>vc,EstimateGasExecutionError:()=>za,ExecutionRevertedError:()=>Kt,FeeCapTooHighError:()=>Ct,FeeCapTooLowError:()=>_o,FeeConflictError:()=>xd,FilterTypeNotSupportedError:()=>ea,HttpRequestError:()=>ot,InsufficientFundsError:()=>Oo,IntegerOutOfRangeError:()=>Mr,InternalRpcError:()=>Ar,IntrinsicGasTooHighError:()=>Do,IntrinsicGasTooLowError:()=>qo,InvalidAbiDecodingTypeError:()=>Xi,InvalidAbiEncodingTypeError:()=>Yi,InvalidAbiItemError:()=>Cs,InvalidAbiParameterError:()=>$s,InvalidAbiParametersError:()=>Ns,InvalidAbiTypeParameterError:()=>Us,InvalidAddressError:()=>ae,InvalidArrayError:()=>Yn,InvalidBytesBooleanError:()=>ta,InvalidChainIdError:()=>Nn,InvalidDecimalNumberError:()=>_c,InvalidDefinitionTypeError:()=>ji,InvalidDomainError:()=>Ic,InvalidFunctionModifierError:()=>_s,InvalidHexBooleanError:()=>ra,InvalidHexValueError:()=>na,InvalidInputRpcError:()=>Bt,InvalidLegacyVError:()=>so,InvalidModifierError:()=>zs,InvalidParameterError:()=>Hs,InvalidParamsRpcError:()=>lo,InvalidParenthesisError:()=>Ds,InvalidPrimaryTypeError:()=>Bc,InvalidRequestRpcError:()=>mo,InvalidSerializableTransactionError:()=>va,InvalidSerializedTransactionError:()=>Ur,InvalidSerializedTransactionTypeError:()=>Ea,InvalidSignatureError:()=>Lt,InvalidStorageKeySizeError:()=>Aa,InvalidStructSignatureError:()=>Ls,InvalidStructTypeError:()=>kc,InvalidYParityError:()=>wa,JsonRpcVersionUnsupportedError:()=>bo,LimitExceededRpcError:()=>wn,MaxFeePerGasTooLowError:()=>Ua,MethodNotFoundRpcError:()=>po,MethodNotSupportedRpcError:()=>Or,NonceMaxValueError:()=>Lo,NonceTooHighError:()=>Uo,NonceTooLowError:()=>Fo,ParseRpcError:()=>fo,ProviderDisconnectedError:()=>wo,ProviderRpcError:()=>je,RawContractError:()=>sr,ResourceNotFoundRpcError:()=>ho,ResourceUnavailableRpcError:()=>yo,ResponseBodyTooLargeError:()=>xn,RlpDepthLimitExceededError:()=>oa,RpcError:()=>qe,RpcRequestError:()=>ir,SizeExceedsPaddingSizeError:()=>Ws,SizeOverflowError:()=>sa,SliceOffsetOutOfBoundsError:()=>Vs,SocketClosedError:()=>Fr,SolidityProtectedKeywordError:()=>Ms,StateAssignmentConflictError:()=>ga,SwitchChainError:()=>Eo,TimeoutError:()=>gn,TipAboveFeeCapError:()=>cr,TransactionExecutionError:()=>Ta,TransactionNotFoundError:()=>io,TransactionReceiptNotFoundError:()=>ao,TransactionRejectedRpcError:()=>Lr,TransactionTypeNotSupportedError:()=>jo,UnauthorizedProviderError:()=>xo,UnknownBundleIdError:()=>Po,UnknownNodeError:()=>Rt,UnknownRpcError:()=>Ba,UnknownSignatureError:()=>Fs,UnknownTypeError:()=>Rs,UnsupportedChainIdError:()=>Ao,UnsupportedNonOptionalCapabilityError:()=>Dr,UnsupportedPackedAbiType:()=>Qi,UnsupportedProviderMethodError:()=>go,UrlRequiredError:()=>vs,UserRejectedRequestError:()=>Tr,WaitForCallsStatusTimeoutError:()=>uf,WaitForTransactionReceiptTimeoutError:()=>Pa,WebSocketRequestError:()=>si,assertCurrentChain:()=>ds,assertRequest:()=>_e,assertTransactionEIP1559:()=>hs,assertTransactionEIP2930:()=>Ec,assertTransactionLegacy:()=>Ac,blobsToCommitments:()=>Xo,blobsToProofs:()=>Qo,boolToBytes:()=>Wp,boolToHex:()=>Zs,bytesToBigInt:()=>gu,bytesToBool:()=>wu,bytesToHex:()=>K,bytesToNumber:()=>Vt,bytesToRlp:()=>jx,bytesToString:()=>vu,ccipFetch:()=>yi,ccipReadTunnel:()=>H2,ccipRequest:()=>yi,checksumAddress:()=>gr,commitmentToVersionedHash:()=>Da,commitmentsToVersionedHashes:()=>qa,compactSignatureToHex:()=>vb,compactSignatureToSignature:()=>V4,concat:()=>ie,concatBytes:()=>el,concatHex:()=>Ae,createClient:()=>ps,createNonceManager:()=>Gh,createPublicClient:()=>Uv,createTestClient:()=>V3,createTransport:()=>on,createWalletClient:()=>T4,custom:()=>S4,decodeAbiParameters:()=>pt,decodeDeployData:()=>z4,decodeErrorResult:()=>no,decodeEventLog:()=>kn,decodeFunctionData:()=>um,decodeFunctionResult:()=>Fe,defineBlock:()=>D6,defineChain:()=>z2,defineKzg:()=>xp,defineTransaction:()=>O6,defineTransactionReceipt:()=>H5,defineTransactionRequest:()=>Xx,deploylessCallViaBytecodeBytecode:()=>oc,deploylessCallViaFactoryBytecode:()=>rm,domainSeparator:()=>xw,encodeAbiParameters:()=>Oe,encodeDeployData:()=>Hn,encodeErrorResult:()=>tf,encodeEventTopics:()=>nr,encodeFunctionData:()=>ne,encodeFunctionResult:()=>fm,encodePacked:()=>v2,erc1155Abi:()=>v5,erc20Abi:()=>Ce,erc20Abi_bytes32:()=>w5,erc4626Abi:()=>A5,erc6492SignatureValidatorAbi:()=>nc,erc6492SignatureValidatorByteCode:()=>Qu,erc721Abi:()=>E5,ethAddress:()=>np,etherUnits:()=>ha,extendSchema:()=>_2,extractChain:()=>F2,fallback:()=>B4,formatBlock:()=>di,formatEther:()=>oo,formatGwei:()=>Se,formatLog:()=>Ue,formatTransaction:()=>In,formatTransactionReceipt:()=>zn,formatTransactionRequest:()=>Be,formatUnits:()=>or,fromBlobs:()=>U4,fromBytes:()=>Y1,fromHex:()=>Vp,fromRlp:()=>df,getAbiItem:()=>nt,getAddress:()=>ye,getChainContractAddress:()=>Ht,getContract:()=>$5,getContractAddress:()=>T2,getContractError:()=>ht,getCreate2Address:()=>Oh,getCreateAddress:()=>Lh,getEventSelector:()=>xr,getEventSignature:()=>mn,getFunctionSelector:()=>Gt,getFunctionSignature:()=>mn,getSerializedTransactionType:()=>K0,getTransactionType:()=>Ga,getTypesForEIP712Domain:()=>Ti,gweiUnits:()=>ya,hashDomain:()=>lf,hashMessage:()=>ys,hashStruct:()=>t0,hashTypedData:()=>Rc,hexToBigInt:()=>j,hexToBool:()=>ia,hexToBytes:()=>re,hexToCompactSignature:()=>gb,hexToNumber:()=>Z,hexToRlp:()=>Gx,hexToSignature:()=>wb,hexToString:()=>od,http:()=>R4,isAddress:()=>Q,isAddressEqual:()=>de,isBytes:()=>ff,isErc6492Signature:()=>o0,isErc8010Signature:()=>G0,isHash:()=>Wm,isHex:()=>O,keccak256:()=>te,labelhash:()=>Cm,maxInt104:()=>mg,maxInt112:()=>pg,maxInt120:()=>lg,maxInt128:()=>hg,maxInt136:()=>yg,maxInt144:()=>bg,maxInt152:()=>xg,maxInt16:()=>tg,maxInt160:()=>gg,maxInt168:()=>wg,maxInt176:()=>vg,maxInt184:()=>Eg,maxInt192:()=>Ag,maxInt200:()=>Tg,maxInt208:()=>Pg,maxInt216:()=>Sg,maxInt224:()=>Ig,maxInt232:()=>Bg,maxInt24:()=>rg,maxInt240:()=>kg,maxInt248:()=>Cg,maxInt256:()=>Rg,maxInt32:()=>ng,maxInt40:()=>og,maxInt48:()=>sg,maxInt56:()=>ig,maxInt64:()=>ag,maxInt72:()=>cg,maxInt8:()=>eg,maxInt80:()=>ug,maxInt88:()=>fg,maxInt96:()=>dg,maxUint104:()=>E6,maxUint112:()=>A6,maxUint120:()=>T6,maxUint128:()=>P6,maxUint136:()=>S6,maxUint144:()=>I6,maxUint152:()=>B6,maxUint16:()=>d6,maxUint160:()=>k6,maxUint168:()=>C6,maxUint176:()=>R6,maxUint184:()=>$6,maxUint192:()=>N6,maxUint200:()=>H6,maxUint208:()=>M6,maxUint216:()=>z6,maxUint224:()=>_6,maxUint232:()=>U6,maxUint24:()=>m6,maxUint240:()=>F6,maxUint248:()=>L6,maxUint256:()=>Ko,maxUint32:()=>p6,maxUint40:()=>l6,maxUint48:()=>h6,maxUint56:()=>y6,maxUint64:()=>b6,maxUint72:()=>x6,maxUint8:()=>f6,maxUint80:()=>g6,maxUint88:()=>w6,maxUint96:()=>v6,minInt104:()=>jg,minInt112:()=>Gg,minInt120:()=>Vg,minInt128:()=>Wg,minInt136:()=>Kg,minInt144:()=>Zg,minInt152:()=>Jg,minInt16:()=>Ng,minInt160:()=>Yg,minInt168:()=>Xg,minInt176:()=>Qg,minInt184:()=>e6,minInt192:()=>t6,minInt200:()=>r6,minInt208:()=>n6,minInt216:()=>o6,minInt224:()=>s6,minInt232:()=>i6,minInt24:()=>Hg,minInt240:()=>a6,minInt248:()=>c6,minInt256:()=>u6,minInt32:()=>Mg,minInt40:()=>zg,minInt48:()=>_g,minInt56:()=>Ug,minInt64:()=>Fg,minInt72:()=>Lg,minInt8:()=>$g,minInt80:()=>Og,minInt88:()=>Dg,minInt96:()=>qg,multicall3Abi:()=>dr,namehash:()=>vi,nonceManager:()=>iw,numberToBytes:()=>Kp,numberToHex:()=>I,offchainLookup:()=>gh,offchainLookupAbiItem:()=>dm,offchainLookupSignature:()=>xh,pad:()=>tt,padBytes:()=>Gp,padHex:()=>Pt,parseAbi:()=>qi,parseAbiItem:()=>Lp,parseAbiParameter:()=>Op,parseAbiParameters:()=>Dp,parseCompactSignature:()=>gb,parseErc6492Signature:()=>k8,parseErc8010Signature:()=>R8,parseEther:()=>q8,parseEventLogs:()=>ur,parseGwei:()=>G8,parseSignature:()=>wb,parseTransaction:()=>Z0,parseUnits:()=>xs,prepareEncodeFunctionData:()=>hd,presignMessagePrefix:()=>Ym,publicActions:()=>mp,recoverAddress:()=>gt,recoverMessageAddress:()=>V0,recoverPublicKey:()=>Id,recoverTransactionAddress:()=>J4,recoverTypedDataAddress:()=>W0,ripemd160:()=>ew,rpcSchema:()=>z5,rpcTransactionType:()=>Dl,serializeAccessList:()=>Ai,serializeCompactSignature:()=>vb,serializeErc6492Signature:()=>N8,serializeErc8010Signature:()=>M8,serializeSignature:()=>Nf,serializeTransaction:()=>jm,serializeTypedData:()=>Qm,setErrorConfig:()=>x1,setupKzg:()=>j4,sha256:()=>Nd,shouldThrow:()=>yb,sidecarsToVersionedHashes:()=>L4,signatureToCompactSignature:()=>Q4,signatureToHex:()=>Nf,size:()=>J,slice:()=>De,sliceBytes:()=>hu,sliceHex:()=>_r,stringToBytes:()=>Dt,stringToHex:()=>tr,stringify:()=>Y,testActions:()=>pp,toBlobSidecars:()=>es,toBlobs:()=>Fd,toBytes:()=>Ee,toCoinType:()=>D4,toEventHash:()=>pn,toEventSelector:()=>xr,toEventSignature:()=>mn,toFunctionHash:()=>pn,toFunctionSelector:()=>Gt,toFunctionSignature:()=>mn,toHex:()=>pe,toPrefixedMessage:()=>Xm,toRlp:()=>wt,transactionType:()=>Fu,trim:()=>he,universalSignatureValidatorAbi:()=>nc,universalSignatureValidatorByteCode:()=>Qu,validateTypedData:()=>Cc,verifyHash:()=>_8,verifyMessage:()=>F8,verifyTypedData:()=>O8,walletActions:()=>hp,webSocket:()=>N4,weiUnits:()=>ex,withCache:()=>hm,withRetry:()=>Mn,withTimeout:()=>Pc,zeroAddress:()=>zt,zeroHash:()=>Ew});var rE=p(()=>{ed();N5();Am();wi();Fv();W3();P4();mb();pb();hb();Zc();I4();k4();$4();H4();Ke();Jy();n0();ic();kd();Zh();ba();le();rr();V();Uu();Ph();uc();bn();du();Ks();Nm();Ol();Fa();jp();Gr();ar();ko();bd();lt();yp();Yh();qy();M4();ro();_4();Au();Wu();mh();Br();wr();ef();lh();ei();Ze();yh();A2();ln();pi();ol();dt();P2();mt();Jt();Ou();Du();Md();Hd();F4();O4();qu();Kl();mm();M2();sf();U2();L2();is();Me();Fh();ut();Xn();et();jt();cn();il();ve();qh();ue();L();Hu();$h();km();q4();Co();Cd();Zr();La();bc();Sr();jh();St();tw();Vl();rw();ca();nw();ow();Qs();sw();xb();G4();aw();vh();cf();Jm();W4();pf();hf();Xh();Uy();K4();C8();$8();Z4();Mo();Fy();Ll();Y4();Ly();X4();H8();z8();Qy();eE();Jh();U8();L8();D8();Je();Ir();qm();Oy();Ld();Dy();Dh();Gm();e0();Tu();ri();ti();j8();V8();kf()});function sS(e=""){return String(e||"").replace(/^0x/i,"").replace(/[^0-9a-fA-F]/g,"").toLowerCase()}function oE(e=""){let t=sS(e);if(t.length>64)throw new Error("ABI word is too long.");return t.padEnd(64,"0")}function Eb(e=0){return Number(e||0).toString(16).padStart(64,"0")}function iS(e=""){return Array.from(new TextEncoder().encode(String(e||""))).map(t=>t.toString(16).padStart(2,"0")).join("")}function aS(e=""){let t=iS(e),r=t.length/2,n=Math.ceil(r/32)*64;return Eb(r)+t.padEnd(n,"0")}function cS({contentId:e,ratingValue:t,reviewHash:r,unlockRef:n}){return oS+oE(e)+Eb(t)+oE(r||Ab)+Eb(128)+aS(n||"")}function Pb(e,t={}){let r=t.contentId||t.contentHash;if(!r)throw new Error("contentId/contentHash is required. Use the Nibgate backend prepare endpoint or pass a known content hash.");return r}function fE(e=""){if(!e)return Ab;throw new Error("Text review hashing is not available in direct-browser mode. Pass reviewHash from your app/backend.")}async function uS(e,t={}){if(t.contentId||t.contentHash)return{contentId:t.contentId||t.contentHash};let r=t.prepareUrl||t.indexUrl?.replace(/\/index$/,"/prepare");if(!r)throw new Error("contentId/contentHash or prepareUrl is required for onchain rating.");let n=await fetch(r,{method:"POST",headers:{"content-type":"application/json",...t.indexHeaders||{}},body:JSON.stringify({siteId:t.siteId,token:t.token,resource:e,url:e.url,path:e.path})}),o=await n.json().catch(()=>({}));if(!n.ok||!o.contentHash)throw new Error(o.error||"Could not prepare Nibgate onchain rating.");return o}async function gp(e,t={}){let r=we(e),n=nu(t.rating??t.stars??t);if(!n.ratingValue)throw new Error("Rating must be between 0.1 and 5 stars.");let o=t.provider||globalThis?.ethereum;if(!o?.request)throw new Error("Connect an EVM wallet to rate this content onchain.");let s=t.contractAddress||t.reputationContract||Tb;if(!s)throw new Error("Nibgate reputation contract address is not configured.");let i=await o.request({method:"eth_requestAccounts"}),a=Array.isArray(i)&&i[0]||"";if(!a)throw new Error("No wallet account selected.");let c=await uS(r,t),u=c.contentHash||c.contentId||Pb(r,t),f=t.reviewHash||Ab,d=String(t.unlockRef||t.paymentId||t.txHash||""),l=cS({contentId:u,ratingValue:n.ratingValue,reviewHash:f,unlockRef:d}),m=await o.request({method:"eth_sendTransaction",params:[{from:a,to:s,data:l}]}),h=hr(r,{rating:n.rating,ratingValue:n.ratingValue,walletAddress:a,txHash:m,contentHash:u,reviewHash:f,proofType:"onchain_pending",proof:d,paymentId:t.paymentId,actor:t.actor||"human"});return er("content_rating",h),t.indexUrl&&await fetch(t.indexUrl,{method:"POST",headers:{"content-type":"application/json",...t.indexHeaders||{}},body:JSON.stringify({siteId:t.siteId,token:t.token,txHash:m,resource:r,url:r.url,path:r.path,actor:t.actor||"human"})}).catch(()=>null),{txHash:m,walletAddress:a,contentId:u,ratingValue:n.ratingValue,reviewHash:f}}var oS,Ab,sE,iE,aE,cE,Tb,uE,Sb=p(()=>{Kf();_t();Ui();oS="0xc62fad09",Ab=`0x${"0".repeat(64)}`,sE="nibgate:content:v1",iE=5042002,aE="Arc Testnet",cE="https://rpc.testnet.arc.io",Tb="0x9f27fd62e75f86a3c7addfdba443aab1f930e281",uE=[{type:"function",name:"rateContent",stateMutability:"nonpayable",inputs:[{name:"contentId",type:"bytes32"},{name:"rating",type:"uint8"},{name:"reviewHash",type:"bytes32"},{name:"unlockRef",type:"string"}],outputs:[]}]});var dE={};sn(dE,{createOnchainRating:()=>zf,mountRatingUI:()=>_f,rateResource:()=>Jc});function Jc(e,t={},r={}){let n=we(e),o=nu(t),s={...r,...o,ratingMessage:r.ratingMessage||t.message||t.ratingMessage||Wf(n,o,r),ratingSignature:r.ratingSignature||t.signature||t.ratingSignature||void 0,resource:n};return er("content_rating",s)}function zf(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe(),o=typeof t.status=="string"?n?.document.querySelector(t.status):t.status,s=typeof t.ratingTarget=="string"?n?.document.querySelector(t.ratingTarget):t.ratingTarget,i=t.ratingButtons||t.buttons||"[data-nibgate-rating-value], [data-rating]",c=(Array.isArray(t.buttons)?t.buttons:typeof t.buttons=="string"?Array.from(n?.document.querySelectorAll(t.buttons)||[]):t.buttons?[t.buttons]:null)||Array.from(n?.document.querySelectorAll(i)||[]),u=t.source||"nibgate-onchain-rating",f=!1,d=t.payment||null;function l(b){typeof t.onStatus=="function"&&t.onStatus(b),o&&(o.textContent=b||"")}function m(b){f=!!b,c.forEach(w=>{w&&"disabled"in w&&(w.disabled=f)})}function h(b=null){return d=b||null,d}function y(b){return s&&("hidden"in s&&(s.hidden=!b),s.setAttribute("aria-hidden",b?"false":"true")),!!b}function g(b){let w=b?.dataset?.nibgateRatingValue||b?.dataset?.rating||b?.value||b?.textContent,A=Number.parseFloat(String(w||"").replace(/[^\d.]/g,""));return Number.isFinite(A)?A:Number(t.rating||t.stars||0)}async function v(b={}){m(!0);try{let w=Number.parseFloat(b.rating??b.stars??b.value??t.rating??t.stars);if(!Number.isFinite(w))throw new Error("Choose a rating before sending.");let A=b.paymentId||t.paymentId||(typeof t.getPaymentId=="function"?t.getPaymentId():d?.paymentId),P=b.unlockRef||t.unlockRef||(typeof t.getUnlockRef=="function"?t.getUnlockRef():null)||A||d?.txHash||d?.transactionHash||"";l(t.pendingMessage||"Send the onchain rating transaction...");let B=await gp(r.resource,{...t,...b,rating:w,paymentId:A,unlockRef:P,source:u});return l(t.successMessage||"Rating sent to Nibgate reputation."),typeof t.onRated=="function"&&t.onRated(B),B}catch(w){let A=w?.message||t.errorMessage||"Rating failed.";throw l(A),typeof t.onError=="function"&&t.onError(w),w}finally{m(!1)}}function E(){return c.forEach(b=>{b?.addEventListener?.("click",()=>v({rating:g(b)}).catch(()=>null))}),t.visible!==void 0&&y(!!t.visible),x}let x={resource:r.resource,rate:v,mount:E,setPayment:h,setVisible:y};return t.autoMount!==!1&&E(),x}function _f(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe();if(!n)return null;let o=typeof t.target=="string"?n.document.querySelector(t.target):t.target;if(!o)return null;let s=[1,2,3,4,5],i=0,a=n.document.createElement("div");a.className="nibgate-rating-ui",a.style.cssText="display:flex;align-items:center;gap:4px;padding:8px 0";let c=s.map(l=>{let m=n.document.createElement("button");return m.type="button",m.dataset.nibgateRatingValue=String(l),m.setAttribute("aria-label",`${l} star${l>1?"s":""}`),m.innerHTML="\u2606",m.style.cssText="background:none;border:none;font-size:24px;cursor:pointer;color:#ccc;transition:color 0.15s;padding:2px;line-height:1",m.addEventListener("mouseenter",()=>{c.forEach((h,y)=>h.style.color=y<l?"#f5b342":"#ccc")}),m.addEventListener("mouseleave",()=>{c.forEach((h,y)=>h.style.color=y<i?"#f5b342":"#ccc")}),m.addEventListener("click",()=>{i=l,c.forEach((h,y)=>h.style.color=y<l?"#f5b342":"#ccc"),Jc(r.resource,{rating:l}).catch(()=>{})}),a.appendChild(m),m}),u=n.document.createElement("span");u.style.cssText="font-size:13px;color:#888;margin-left:8px",u.textContent=t.label||"Rate this content",a.appendChild(u),o.appendChild(a);function f(l,m={}){return r.rate({...m,rating:l})}function d(l){i=l,c.forEach((m,h)=>m.style.color=h<l?"#f5b342":"#ccc")}return{resource:r.resource,container:a,setRating:d,rate:f}}var wp=p(()=>{_t();Kf();Ui();Is();Sb();qn()});var mS={};sn(mS,{ACCESS_MODES:()=>zi,CONTENT_TYPES:()=>Mi,NIBGATE_CONTENT_HASH_NAMESPACE:()=>sE,NIBGATE_CONTENT_SETTING_FIELDS:()=>bE,NIBGATE_REPUTATION_ABI:()=>uE,NIBGATE_REPUTATION_CHAIN_ID:()=>iE,NIBGATE_REPUTATION_CHAIN_NAME:()=>aE,NIBGATE_REPUTATION_CONTRACT:()=>Tb,NIBGATE_REPUTATION_RPC_URL:()=>cE,PAYMENT_RAILS:()=>Qc,UNLOCK_MODES:()=>eu,checkResourceAccess:()=>Ut,contentRatingHash:()=>Pb,createCircleGatewayBrowserAdapter:()=>Mf,createEvmGatewayUnlock:()=>ki,createGate:()=>ct,createHostedUnlock:()=>nE,createNibgate:()=>Ib,createNibgateContentSettings:()=>xE,createOnchainRating:()=>zf,createTransferCheckout:()=>Uf,createWalletCheckout:()=>Vf,mountRatingUI:()=>_f,nibgate:()=>Bb,normalizeAccessPolicy:()=>Ss,normalizeContentType:()=>Ps,normalizePaymentRail:()=>Hi,normalizeResource:()=>we,normalizeUnlockPolicy:()=>_i,payAndUnlockResource:()=>ru,payWithPaymentSignature:()=>tu,payWithTransfer:()=>vp,rateContentOnchain:()=>gp,rateResource:()=>Jc,renderDefaultGatewayWalletUI:()=>yE,renderDefaultRatingUI:()=>hE,renderDefaultUnlockUI:()=>lE,reviewTextHash:()=>fE,settingsToAccessPolicy:()=>gE,settingsToUnlockPolicy:()=>wE,setupResourcePage:()=>Gf,trackResourcePage:()=>Bs,validateResourceMetadata:()=>Lf});qn();Ui();qf();Np();qn();_t();Is();qn();function Bs(e,t={}){let r=ct(e,t.gateOptions||{}),n=Lf(r.resource,t.validation||{});return(n.warnings.length||n.errors.length)&&t.warn!==!1&&fe()?.console?.warn&&fe().console.warn("Nibgate content metadata needs attention",n),r.content({source:t.source,metadataQuality:{score:n.score,warnings:n.warnings,errors:n.errors},...t.content||{}}),r.view({source:t.source,path:t.path||fe()?.location?.pathname||r.resource.path,referrer:t.referrer??fe()?.document?.referrer??"",...t.view||{}}),r}function Gf(e,t={}){let r=Bs(e,t),n=fe();if(!n)return r;let o=typeof t.button=="string"?n.document.querySelector(t.button):t.button,s=typeof t.status=="string"?n.document.querySelector(t.status):t.status,i=t.onStatus||(a=>{s&&(s.textContent=a||"")});return o&&o.addEventListener("click",async()=>{o.disabled=!0;try{await Ut(e,{...t,onStatus:i})}finally{o.disabled=!1}}),r}async function Ut(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.accessPath||r.resource.accessPath||"/api/nibgate/access",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.checkingMessage||"Checking access route..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"nibgate-access-route"});let s=await fetch(n,{method:t.method||"GET",headers:{accept:"application/json",...$p(r.resource)?{"x-nibgate-payment-proof":$p(r.resource)}:{},...t.headers||{}},body:t.body}),i=await s.json().catch(()=>({}));if(s.status===402){if(r.track("payment_challenge_returned",{source:t.source,challenge:i,resource:r.resource}),o(t.challengeMessage||"Payment challenge returned. Continue with checkout."),typeof t.createPaymentSignature=="function"||typeof t.checkout=="function")return tu(e,{...t,challenge:i,paymentRequiredHeader:s.headers.get("PAYMENT-REQUIRED")||s.headers.get("payment-required")||""});if(t.autoPay&&t.payPath){let c=await ru(e,t);return c.ok&&t.retryAfterPay!==!1?Ut(e,{...t,autoPay:!1}):c}return{ok:!1,status:s.status,challenge:i,resource:r.resource,response:s}}if(!s.ok)return o(i.error||t.errorMessage||"Access check failed"),{ok:!1,status:s.status,error:i.error||"Access check failed",payload:i,resource:r.resource,response:s};let a=t.payment||i.payment||null;return a&&(r.unlockCompleted(a),r.paymentCompleted(a)),o(t.successMessage||"Access allowed and Nibgate events emitted."),{ok:!0,status:s.status,payload:i,payment:a,resource:r.resource,response:s}}async function tu(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.accessPath||r.resource.accessPath||"/api/nibgate/access",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.paymentMessage||"Waiting for wallet payment approval..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"wallet-gateway"});let s=t.paymentSignature||"",i=t.memo||"",a=t.payment||{};if(!s){let l=t.paymentRequiredHeader||"",m=t.challenge||null,y=await(t.createPaymentSignature||t.checkout)({resource:r.resource,challenge:m,paymentRequiredHeader:l,accessPath:n});s=y?.paymentSignature||y?.signature||y?.payment||"",i=y?.memo||y?.paymentMemo||"",a=y?.metadata||y?.paymentMetadata||y||{}}if(!s){let l="Wallet did not return a payment signature.";return r.track("payment_failed",{source:t.source,error:l}),o(l),{ok:!1,status:400,error:l,resource:r.resource}}let c=await fetch(n,{method:t.method||"GET",headers:{accept:"application/json","payment-signature":s,...i?{"payment-memo":i}:{},...t.headers||{}}}),u=await c.text(),f={};try{f=u?JSON.parse(u):{}}catch{f={error:u||"Payment verification failed"}}if(!c.ok){let l=f.detail||f.reason||f.invalidReason||f.error||u||"Payment verification failed",m=typeof l=="string"?l:jf(l);return r.track("payment_failed",{source:t.source,status:c.status,error:m,...a}),o(t.paymentErrorMessage||m),{ok:!1,status:c.status,error:m,payload:f,resource:r.resource,response:c}}let d=f.payment||{paymentProvider:t.paymentProvider||"wallet-gateway",paymentId:s,memo:i,amount:Number(r.resource.price||0),revenue:Number(r.resource.price||0),currency:r.resource.currency||"USDC",...a};return Rp(r.resource,f.unlockProof),r.markUnlocked(d),o(t.paymentSuccessMessage||"Payment verified. Content unlocked."),{ok:!0,status:c.status,payload:f,payment:d,resource:r.resource,response:c}}async function ru(e,t={}){let r=ct(e,t.gateOptions||{}),n=t.payPath||r.resource.payPath||"/api/nibgate/pay",o=typeof t.onStatus=="function"?t.onStatus:()=>{};o(t.paymentMessage||"Starting payment..."),r.unlockStarted({source:t.source,paymentProvider:t.paymentProvider||"circle-gateway"});let s=await fetch(n,{method:t.payMethod||"POST",headers:{accept:"application/json","content-type":"application/json",...t.payHeaders||{}},body:JSON.stringify({resource:r.resource,...t.payPayload||{}})}),i=await s.json().catch(()=>({}));if(!s.ok||!i.ok)return r.track("payment_failed",{source:t.source,status:s.status,error:i.error||"Payment failed",detail:i.detail||""}),o(i.detail||i.error||t.paymentErrorMessage||"Payment failed."),{ok:!1,status:s.status,payload:i,resource:r.resource,response:s};let a=i.payment||{paymentProvider:t.paymentProvider||"circle-gateway",paymentId:i.paymentId||`nibgate_payment_${Date.now()}`,amount:Number(r.resource.price||0),revenue:Number(r.resource.price||0),currency:r.resource.currency||"USDC"};return Rp(r.resource,i.unlockProof),r.markUnlocked(a),o(t.paymentSuccessMessage||"Payment verified. Content unlocked."),{ok:!0,status:s.status,payload:i,payment:a,resource:r.resource,response:s}}_t();Is();function FE(e,t){let r=fe();if(!e||!r)return;let n=typeof e=="string"?r.document.querySelector(e):e;n&&(n.textContent=t||"")}function Mb(e,t){let r=fe();if(!e||!r)return;let n=typeof e=="string"?r.document.querySelector(e):e;n&&"disabled"in n&&(n.disabled=!!t)}function Vf(e,t={}){let r=we(e),n=t.accessPath||r.accessPath||"/api/nibgate/access",o=t.button||null,s=t.status||null,i=typeof t.onStatus=="function"?t.onStatus:f=>FE(s,f),a=t.checkout||t.createPaymentSignature||t.pay;if(typeof a!="function")throw new Error("createWalletCheckout requires checkout/createPaymentSignature/pay callback for the active wallet or Gateway adapter.");async function c(f={}){Mb(o,!0);try{return await Ut(r,{...t,...f,accessPath:n,createPaymentSignature:a,onStatus:i})}finally{Mb(o,!1)}}function u(){let f=fe();if(!f||!o)return{unlock:c};let d=typeof o=="string"?f.document.querySelector(o):o;return d&&d.addEventListener("click",()=>c().catch(l=>i(l.message||"Checkout failed."))),{unlock:c}}return{resource:r,unlock:c,mount:u}}_t();Kf();Ui();qn();qn();Is();qf();qn();async function Mf(e={}){return(await Promise.resolve().then(()=>(Ub(),_b))).createCircleGatewayBrowserAdapter(e)}var rS="https://api.nibgate.xyz/api/hub/pay";function nS(e,t){return t.hosted||t.accessPath==="hosted"?rS:t.accessPath||e.accessPath||"/api/nibgate/access"}function ki(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe(),o=nS(r.resource,t),s=t.source||"nibgate-evm-gateway",i=t.network||"eip155:5042002",a=typeof t.status=="string"?n?.document.querySelector(t.status):t.status,c=typeof t.connectButton=="string"?n?.document.querySelector(t.connectButton):t.connectButton,u=typeof t.disconnectButton=="string"?n?.document.querySelector(t.disconnectButton):t.disconnectButton,f=typeof t.unlockButton=="string"?n?.document.querySelector(t.unlockButton):t.unlockButton,d=typeof t.clearButton=="string"?n?.document.querySelector(t.clearButton):t.clearButton,l=typeof t.walletLabel=="string"?n?.document.querySelector(t.walletLabel):t.walletLabel,m=typeof t.unlockedTarget=="string"?n?.document.querySelector(t.unlockedTarget):t.unlockedTarget,h="",y=!1;function g($){typeof t.onStatus=="function"&&t.onStatus($),a&&(a.textContent=$||"")}function v($){return $?`${$.slice(0,6)}...${$.slice(-4)}`:""}function E(){return n?.ethereum||t.provider||null}function x($){y=!!$,[c,u,f,d].forEach(C=>{C&&"disabled"in C&&(C.disabled=y||C===c&&!E()||C===u&&!h)})}function b(){let $=!!E();l&&(l.textContent=h?v(h):$?"Ready to connect":"No wallet detected"),c&&(c.textContent=h?"Connected":"Connect wallet"),u&&(u.textContent="Disconnect"),c&&"disabled"in c&&(c.disabled=y||!$),u&&"disabled"in u&&(u.disabled=y||!h)}function w($,C={}){f&&(f.textContent=$?"Unlocked":`Unlock for ${r.resource.price} ${r.resource.currency||"USDC"}`),m&&("hidden"in m&&(m.hidden=!$),m.setAttribute("aria-hidden",$?"false":"true")),$&&r.markUnlocked(C)}async function A(){x(!0),g("Opening wallet connection...");try{let $=E();if(!$)throw new Error(t.noWalletMessage||"Install or open an EVM wallet to continue.");let C=await $.request({method:"eth_requestAccounts"});if(h=Array.isArray(C)&&C[0]||"",!h)throw new Error("No wallet account selected.");return b(),g("Wallet connected. You can unlock now."),h}finally{x(!1)}}async function P(){x(!0);try{let $=E();if($?.request&&h)try{await $.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch{}return h="",b(),g(t.disconnectMessage||"Wallet disconnected for this page."),!0}finally{x(!1)}}async function B($){let C=E();if(!C)throw new Error(t.noWalletMessage||"Install or open an EVM wallet to continue.");let H=await C.request({method:"eth_accounts"}).catch(()=>h?[h]:[]),U=Array.isArray(H)&&H[0]?H[0]:h||await A();return U!==h&&(h=U),(await Mf({network:i,signer:{address:U,signTypedData:async F=>{let{createWalletClient:q,custom:X}=await Promise.resolve().then(()=>(rE(),tE));return q({transport:X(C)}).signTypedData({account:U,domain:F.domain,types:F.types,primaryType:F.primaryType,message:F.message})}},clientModule:t.circleClientModule})).pay($)}async function k(){x(!0);try{h||await A(),x(!0),g("Requesting Gateway unlock...");let $=await Ut(r.resource,{accessPath:o,source:s,paymentProvider:t.paymentProvider||"circle-gateway-browser",challengeMessage:t.challengeMessage||"Gateway payment required. Connect your wallet to continue...",paymentMessage:t.paymentMessage||"Approve the Gateway payment proof in your wallet...",successMessage:t.successMessage||`Unlocked ${r.resource.title||"content"}.`,method:t.method,headers:t.headers,body:t.body,checkout:B,onStatus:g});return $.ok&&(w(!0,$.payment||{}),typeof t.onUnlock=="function"&&t.onUnlock($)),$}catch($){let C=$?.message||"Unlock failed. Please try again.";return g(C),{ok:!1,status:0,error:C,resource:r.resource}}finally{x(!1),b()}}function S(){Rb(r.resource),w(!1),g("Local payment proof cleared. The next unlock will require Gateway payment again.")}async function N(){let $=E();try{let C=$?await $.request({method:"eth_accounts"}):[];h=Array.isArray(C)&&C[0]||""}catch{}b(),w(!1)}function _(){return c?.addEventListener?.("click",()=>A().catch($=>g($?.message||"Could not connect wallet."))),u?.addEventListener?.("click",()=>P().catch($=>g($?.message||"Could not disconnect wallet."))),f?.addEventListener?.("click",()=>k()),d?.addEventListener?.("click",S),N(),Bs(r.resource,{source:s}),z}let z={resource:r.resource,connect:A,disconnect:P,unlock:k,clear:S,hydrate:N,mount:_,getWalletAddress:()=>h};return t.autoMount!==!1&&_(),z}function nE(e,t={}){return ki(e,{...t,hosted:!0,noWalletMessage:t.noWalletMessage||"Install MetaMask or another EVM wallet to unlock premium content."})}wp();_t();function Uf(e,t={}){let r=we({...e,paymentRail:"transfer"}),n=t.sendTransfer||t.transfer;if(typeof n!="function")throw new Error("createTransferCheckout requires sendTransfer({ resource, recipient, amount, currency, network }) and a server verifyTransfer hook.");return{resource:r,async pay(o={}){let s=r.recipient||r.payTo,i=String(r.price||r.amount||"0"),a=r.currency||"USDC",c=t.network||o.challenge?.accepts?.[0]?.network||"eip155:5042002",u=await n({resource:r,recipient:s,amount:i,currency:a,network:c,challenge:o.challenge}),f=u?.txHash||u?.hash||u?.transactionHash||u?.paymentId||"";if(!f)throw new Error("Transfer checkout did not return a txHash.");return{paymentSignature:f,signature:f,memo:u.memo||"",metadata:{paymentProvider:"direct-transfer",paymentId:f,txHash:f,recipient:s,amount:Number(i),currency:a,network:c,...u.metadata||u}}}}}async function vp(e,t={}){let n=await(t.checkout||Uf(e,t).pay)({resource:we(e),challenge:t.challenge||null}),o=n?.metadata?.txHash||n?.txHash||n?.paymentSignature||n?.signature||"";if(!o)throw new Error("Transfer checkout did not return a txHash.");return Ut(e,{...t,headers:{...t.headers||{},"x-nibgate-transfer-tx":o},payment:n.metadata||{paymentProvider:"direct-transfer",txHash:o,paymentId:o}})}function Ib(e={}){let t=e.resource?we(e.resource):null;function r(n={}){return we({...t||{},...typeof n=="string"?{id:n}:n})}return{content(n,o={}){return er("content_registered",hr(r(n),o))},registerContent(n,o={}){return er("content_registered",hr(r(n),o))},view(n,o={}){return er("resource_view",hr(r(n),o))},track(n,o={}){return er(n||"custom",o)},unlockStarted(n,o={}){return er("unlock_started",hr(r(n),o))},unlockCompleted(n,o={}){return er("unlock_completed",hr(r(n),o))},paymentCompleted(n,o={}){return er("payment_completed",hr(r(n),o))},rateResource(n,o={},s={}){return Jc(r(n),o,s)},ratingMessage(n,o={},s={}){return Wf(r(n),o,s)},gate(n,o={}){return ct(r(n),{...o,client:this})},trackResourcePage(n,o={}){return Bs(r(n),o)},checkResourceAccess(n,o={}){return Ut(r(n),o)},payWithPaymentSignature(n,o={}){return tu(r(n),o)},createWalletCheckout(n,o={}){return Vf(r(n),o)},createCircleGatewayBrowserAdapter(n={}){return Mf(n)},createTransferCheckout(n,o={}){return Uf(r(n),o)},payWithTransfer(n,o={}){return vp(r(n),o)},createEvmGatewayUnlock(n,o={}){return ki(r(n),o)},createOnchainRating(n,o={}){return zf(r(n),o)},mountRatingUI(n,o={}){return _f(r(n),o)},payAndUnlockResource(n,o={}){return ru(r(n),o)},setupResourcePage(n,o={}){return Gf(r(n),o)},normalizeResource:r,normalizeContentType:Ps,flush:Of}}var Bb=Ib();Hb(Bb);wp();Sb();var mE="nibgate-ui-styles",W={bg:"var(--bg, #f4f4f0)",fg:"var(--fg, #0a0a0a)",muted:"var(--muted, #6b6862)",border:"var(--border, #cecdc3)",accent:"var(--accent, #7c9a6d)",accentSoft:"var(--accent-soft, #d8e8d3)",cardHover:"var(--card-hover, #e0ddd3)"},fS=e=>Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}:${r}`).join(";");function pE(e,t,r){let n=document.createElement(e);for(let[o,s]of Object.entries(t||{}))o==="dataset"?Object.assign(n.dataset,s):o.startsWith("on")?n.addEventListener(o.slice(2).toLowerCase(),s):o==="style"&&typeof s=="object"?n.style.cssText=fS(s):o==="cls"?n.className=s:n.setAttribute(o,String(s));return typeof r=="string"?n.innerHTML=r:r&&(Array.isArray(r)?r:[r]).forEach(o=>{o!=null&&n.appendChild(typeof o=="string"?document.createTextNode(o):o)}),n}function kb(){if(document.getElementById(mE))return;let e=pE("style",{id:mE},`
30
+ `,o+=cx(n.state)),n.stateDiff&&(o+=` stateDiff:
31
+ `,o+=cx(n.stateDiff)),o},` State Override:
32
+ `).slice(0,-1)}var ga,wa,gd=m(()=>{W();ga=class extends T{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},wa=class extends T{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}});function si(e){let t=Object.entries(e).map(([n,o])=>o===void 0||o===!1?null:[n,o]).filter(Boolean),r=t.reduce((n,[o])=>Math.max(n,o.length),0);return t.map(([n,o])=>` ${`${n}:`.padEnd(r+1)} ${o}`).join(`
33
+ `)}var wd,io,va,Ea,Aa,Fr,Ta,Pa,ao,co,oi,Sa,lt=m(()=>{Pu();ni();W();wd=class extends T{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
34
+ `),{name:"FeeConflictError"})}},io=class extends T{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}},va=class extends T{constructor({yParity:t}){super(`Invalid \`yParity\` value "${t}". Expected 0 or 1.`,{name:"InvalidYParityError"})}},Ea=class extends T{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",si(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}},Aa=class extends T{constructor({serializedType:t}){super(`Serialized transaction type "${t}" is invalid.`,{name:"InvalidSerializedTransactionType"}),Object.defineProperty(this,"serializedType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedType=t}},Fr=class extends T{constructor({attributes:t,serializedTransaction:r,type:n}){let o=Object.entries(t).map(([s,i])=>typeof i>"u"?s:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${n}" was provided.`,{metaMessages:[`Serialized Transaction: "${r}"`,o.length>0?`Missing Attributes: ${o.join(", ")}`:""].filter(Boolean),name:"InvalidSerializedTransactionError"}),Object.defineProperty(this,"serializedTransaction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedTransaction=r,this.type=n}},Ta=class extends T{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}},Pa=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l}){let p=si({chain:o&&`${o?.name} (id: ${o?.id})`,from:r?.address,to:d,value:typeof l<"u"&&`${so(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},ao=class extends T{constructor({blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s}){let i="Transaction";n&&s!==void 0&&(i=`Transaction at block time "${n}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),r&&s!==void 0&&(i=`Transaction at block number "${r}" at index "${s}"`),o&&(i=`Transaction with hash "${o}"`),super(`${i} could not be found.`,{name:"TransactionNotFoundError"})}},co=class extends T{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}},oi=class extends T{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}},Sa=class extends T{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}});function Ye(e){if(e?.reason)return e.reason;if(typeof DOMException=="function")return new DOMException("This operation was aborted","AbortError");let t=new Error("This operation was aborted");return t.name="AbortError",t}function It(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}var fx,yn,Er=m(()=>{fx=e=>e;yn=e=>{try{let t=new URL(e);return!t.username&&!t.password?e:(t.username="",t.password="",t.toString())}catch{return e}}});var uo,fo,bn,Ia,Ba,sr,xn=m(()=>{be();xu();Tu();cn();ix();hn();Pu();ni();le();W();gd();lt();Er();uo=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l,stateOverride:p}){let h=r?G(r):void 0,y=si({from:h?.address,to:d,value:typeof l<"u"&&`${so(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});p&&(y+=`
35
+ ${ux(p)}`),super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",y].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}},fo=class extends T{constructor(t,{abi:r,args:n,contractAddress:o,docsPath:s,functionName:i,sender:a}){let c=nt({abi:r,args:n,name:i}),u=c?dl({abiItem:c,args:n,includeFunctionName:!1,includeName:!1}):void 0,f=c?Fe(c,{includeName:!0}):void 0,d=si({address:o&&fx(o),function:f,args:u&&u!=="()"&&`${[...Array(i?.length??0).keys()].map(()=>" ").join("")}${u}`,sender:a});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=r,this.args=n,this.cause=t,this.contractAddress=o,this.functionName=i,this.sender=a}},bn=class extends T{constructor({abi:t,data:r,functionName:n,message:o,cause:s}){let i,a,c,u;if(r&&r!=="0x")try{a=oo({abi:t,data:r,cause:s});let{abiItem:d,errorName:l,args:p}=a;if(l==="Error")u=p[0];else if(l==="Panic"){let[h]=p;u=rx[h]}else{let h=d?Fe(d,{includeName:!0}):void 0,y=d&&p?dl({abiItem:d,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[h?`Error: ${h}`:"",y&&y!=="()"?` ${[...Array(l?.length??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){i=d}else o&&(u=o);let f;i instanceof Zn&&(f=i.signature,c=[`Unable to decode signature "${f}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${f}.`]),super(u&&u!=="execution reverted"||f?[`The contract function "${n}" reverted with the following ${f?"signature":"reason"}:`,u||f].join(`
36
+ `):`The contract function "${n}" reverted.`,{cause:i??s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=r,this.reason=u,this.signature=f}},Ia=class extends T{constructor({functionName:t,cause:r}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${t}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:r})}},Ba=class extends T{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` for factory "${t}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}},sr=class extends T{constructor({data:t,message:r}){super(r||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}});var ot,gn,ii,ir,Or,wn,ar=m(()=>{Je();W();Er();ot=class extends T{constructor({body:t,cause:r,details:n,headers:o,status:s,url:i}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${yn(i)}`,t&&`Request body: ${Y(t)}`].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=t,this.headers=o,this.status=s,this.url=i}},gn=class extends T{constructor({maxSize:t,size:r}){super("HTTP response body exceeded the size limit.",{metaMessages:[`Max: ${t} bytes`,`Received: ${r} bytes`],name:"ResponseBodyTooLargeError"}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t,this.size=r}},ii=class extends T{constructor({body:t,cause:r,details:n,url:o}){super("WebSocket request failed.",{cause:r,details:n,metaMessages:[`URL: ${yn(o)}`,t&&`Request body: ${Y(t)}`].filter(Boolean),name:"WebSocketRequestError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=o}},ir=class extends T{constructor({body:t,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${yn(n)}`,`Request body: ${Y(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{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,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data,this.url=n}},Or=class extends T{constructor({url:t}={}){super("The socket has been closed.",{metaMessages:[t&&`URL: ${yn(t)}`].filter(Boolean),name:"SocketClosedError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=t}},wn=class extends T{constructor({body:t,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${yn(r)}`,`Request body: ${Y(t)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=r}}});var jA,qe,je,po,mo,lo,ho,Ar,Bt,yo,bo,Dr,qr,vn,xo,Tr,go,wo,vo,Eo,Ao,jr,To,Po,So,Io,Bo,Gr,ko,ka,Co=m(()=>{W();ar();jA=-1,qe=class extends T{constructor(t,{code:r,docsPath:n,metaMessages:o,name:s,shortMessage:i}){super(i,{cause:t,docsPath:n,metaMessages:o||t?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof ir?t.code:r??jA}},je=class extends qe{constructor(t,r){super(t,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}},po=class e extends qe{constructor(t){super(t,{code:e.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}};Object.defineProperty(po,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});mo=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}};Object.defineProperty(mo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});lo=class e extends qe{constructor(t,{method:r}={}){super(t,{code:e.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}};Object.defineProperty(lo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});ho=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
37
+ `)})}};Object.defineProperty(ho,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});Ar=class e extends qe{constructor(t){super(t,{code:e.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}};Object.defineProperty(Ar,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});Bt=class e extends qe{constructor(t){super(t,{code:e.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
38
+ `)})}};Object.defineProperty(Bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});yo=class e extends qe{constructor(t){super(t,{code:e.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(yo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});bo=class e extends qe{constructor(t){super(t,{code:e.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}};Object.defineProperty(bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});Dr=class e extends qe{constructor(t){super(t,{code:e.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}};Object.defineProperty(Dr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});qr=class e extends qe{constructor(t,{method:r}={}){super(t,{code:e.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}};Object.defineProperty(qr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});vn=class e extends qe{constructor(t){super(t,{code:e.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}};Object.defineProperty(vn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});xo=class e extends qe{constructor(t){super(t,{code:e.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}};Object.defineProperty(xo,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});Tr=class e extends je{constructor(t){super(t,{code:e.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}};Object.defineProperty(Tr,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});go=class e extends je{constructor(t){super(t,{code:e.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}};Object.defineProperty(go,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});wo=class e extends je{constructor(t,{method:r}={}){super(t,{code:e.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}};Object.defineProperty(wo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});vo=class e extends je{constructor(t){super(t,{code:e.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}};Object.defineProperty(vo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});Eo=class e extends je{constructor(t){super(t,{code:e.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}};Object.defineProperty(Eo,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});Ao=class e extends je{constructor(t){super(t,{code:e.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}};Object.defineProperty(Ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});jr=class e extends je{constructor(t){super(t,{code:e.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}};Object.defineProperty(jr,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});To=class e extends je{constructor(t){super(t,{code:e.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}};Object.defineProperty(To,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});Po=class e extends je{constructor(t){super(t,{code:e.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}};Object.defineProperty(Po,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});So=class e extends je{constructor(t){super(t,{code:e.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}};Object.defineProperty(So,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});Io=class e extends je{constructor(t){super(t,{code:e.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}};Object.defineProperty(Io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});Bo=class e extends je{constructor(t){super(t,{code:e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}};Object.defineProperty(Bo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});Gr=class e extends je{constructor(t){super(t,{code:e.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}};Object.defineProperty(Gr,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});ko=class e extends je{constructor(t){super(t,{code:e.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}};Object.defineProperty(ko,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});ka=class extends qe{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}});function ht(e,{abi:t,address:r,args:n,docsPath:o,functionName:s,sender:i}){let a=e instanceof sr?e:e instanceof T?e.walk(h=>"data"in h)||e.walk():{},{code:c,data:u,details:f,message:d,shortMessage:l}=a,p=e instanceof Tt?new Ia({functionName:s,cause:e}):[GA,Ar.code].includes(c)&&(u||f||d||l)||c===Bt.code&&f==="execution reverted"&&u?new bn({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:a instanceof ir?f:l??d,cause:e}):e;return new fo(p,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:s,sender:i})}var GA,Ro=m(()=>{le();W();xn();ar();Co();GA=3});function dx(e){let t=te(`0x${e.substring(4)}`).substring(26);return gr(`0x${t}`)}var px=m(()=>{dt();St()});function VA(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(r>>o&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,i,n),e.setUint32(t+u,a,n)}function pl(e,t,r){return e&t^~e&r}function ml(e,t,r){return e&t^e&r^t&r}var Ca,En,ll=m(()=>{pn();Ca=class extends eo{constructor(t,r,n,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=ud(this.buffer)}update(t){dn(this),t=Qs(t),Ur(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length;for(let i=0;i<s;){let a=Math.min(o-this.pos,s-i);if(a===o){let c=ud(t);for(;o<=s-i;i+=o)this.process(c,i);continue}n.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){dn(this),cd(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,qt(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(n,0),i=0);for(let d=i;d<o;d++)r[d]=0;VA(n,o-8,BigInt(this.length*8),s),this.process(n,0);let a=ud(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,f[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:s,destroyed:i,pos:a}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=a,o%r&&t.buffer.set(n),t}clone(){return this._cloneInto()}},En=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225])});var WA,$o,vd,ai,hl=m(()=>{ll();pn();WA=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$o=new Uint32Array(64),vd=class extends Ca{constructor(t=32){super(64,t,8,!1),this.A=En[0]|0,this.B=En[1]|0,this.C=En[2]|0,this.D=En[3]|0,this.E=En[4]|0,this.F=En[5]|0,this.G=En[6]|0,this.H=En[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}process(t,r){for(let d=0;d<16;d++,r+=4)$o[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let l=$o[d-15],p=$o[d-2],h=br(l,7)^br(l,18)^l>>>3,y=br(p,17)^br(p,19)^p>>>10;$o[d]=y+$o[d-7]+h+$o[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:f}=this;for(let d=0;d<64;d++){let l=br(a,6)^br(a,11)^br(a,25),p=f+l+pl(a,c,u)+WA[d]+$o[d]|0,y=(br(n,2)^br(n,13)^br(n,22))+ml(n,o,s)|0;f=u,u=c,c=a,a=i+p|0,i=s,s=o,o=n,n=p+y|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,o,s,i,a,c,u,f)}roundClean(){qt($o)}destroy(){this.set(0,0,0,0,0,0,0,0),qt(this.buffer)}},ai=ca(()=>new vd)});var Ed,yl,mx=m(()=>{pn();Ed=class extends eo{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,z1(t);let n=Qs(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),qt(s)}update(t){return dn(this),this.iHash.update(t),this}digestInto(t){dn(this),Ur(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},yl=(e,t,r)=>new Ed(e,t).update(r).digest();yl.create=(e,t)=>new Ed(e,t)});function Ra(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Tn(e){if(!Ra(e))throw new Error("Uint8Array expected")}function $a(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Su(e){let t=e.toString(16);return t.length&1?"0"+t:t}function yx(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?wl:BigInt("0x"+e)}function Na(e){if(Tn(e),bx)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=KA[e[r]];return t}function lx(e){if(e>=An._0&&e<=An._9)return e-An._0;if(e>=An.A&&e<=An.F)return e-(An.A-10);if(e>=An.a&&e<=An.f)return e-(An.a-10)}function Iu(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(bx)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let o=0,s=0;o<r;o++,s+=2){let i=lx(e.charCodeAt(s)),a=lx(e.charCodeAt(s+1));if(i===void 0||a===void 0){let c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}n[o]=i*16+a}return n}function kt(e){return yx(Na(e))}function vl(e){return Tn(e),yx(Na(Uint8Array.from(e).reverse()))}function Vr(e,t){return Iu(e.toString(16).padStart(t*2,"0"))}function El(e,t){return Vr(e,t).reverse()}function ze(e,t,r){let n;if(typeof t=="string")try{n=Iu(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(Ra(t))n=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");let o=n.length;if(typeof r=="number"&&o!==r)throw new Error(e+" of length "+r+" expected, got "+o);return n}function yt(...e){let t=0;for(let n=0;n<e.length;n++){let o=e[n];Tn(o),t+=o.length}let r=new Uint8Array(t);for(let n=0,o=0;n<e.length;n++){let s=e[n];r.set(s,o),o+=s.length}return r}function Ad(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ci(e,t,r){return bl(e)&&bl(t)&&bl(r)&&t<=e&&e<r}function Pn(e,t,r,n){if(!ci(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function xx(e){let t;for(t=0;e>wl;e>>=gl,t+=1);return t}function gx(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=xl(e),o=xl(e),s=0,i=()=>{n.fill(1),o.fill(0),s=0},a=(...d)=>r(o,n,...d),c=(d=xl(0))=>{o=a(hx([0]),d),n=a(),d.length!==0&&(o=a(hx([1]),d),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0,l=[];for(;d<t;){n=a();let p=n.slice();l.push(p),d+=n.length}return yt(...l)};return(d,l)=>{i(),c(d);let p;for(;!(p=l(u()));)c();return i(),p}}function Sn(e,t,r={}){let n=(o,s,i)=>{let a=ZA[s];if(typeof a!="function")throw new Error("invalid validator function");let c=e[o];if(!(i&&c===void 0)&&!a(c,e))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+c)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(r))n(o,s,!0);return e}function Al(e){let t=new WeakMap;return(r,...n)=>{let o=t.get(r);if(o!==void 0)return o;let s=e(r,...n);return t.set(r,s),s}}var wl,gl,bx,KA,An,bl,ui,xl,hx,ZA,Ha=m(()=>{wl=BigInt(0),gl=BigInt(1);bx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",KA=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));An={_0:48,_9:57,A:65,F:70,a:97,f:102};bl=e=>typeof e=="bigint"&&wl<=e;ui=e=>(gl<<BigInt(e))-gl,xl=e=>new Uint8Array(e),hx=e=>Uint8Array.from(e);ZA={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ra(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)}});function Ie(e,t){let r=e%t;return r>=bt?r:t+r}function Wt(e,t,r){let n=e;for(;t-- >bt;)n*=n,n%=r;return n}function Td(e,t){if(e===bt)throw new Error("invert: expected non-zero number");if(t<=bt)throw new Error("invert: expected positive modulus, got "+t);let r=Ie(e,t),n=t,o=bt,s=st,i=st,a=bt;for(;r!==bt;){let u=n/r,f=n%r,d=o-i*u,l=s-a*u;n=r,r=f,o=i,s=a,i=d,a=l}if(n!==st)throw new Error("invert: does not exist");return Ie(o,t)}function Tx(e,t){let r=(e.ORDER+st)/vx,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw new Error("Cannot find square root");return n}function YA(e,t){let r=(e.ORDER-Ex)/Ax,n=e.mul(t,fi),o=e.pow(n,r),s=e.mul(t,o),i=e.mul(e.mul(s,fi),o),a=e.mul(s,e.sub(i,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function XA(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-st,r=0;for(;t%fi===bt;)t/=fi,r++;let n=fi,o=Bu(e);for(;wx(o,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Tx;let s=o.pow(n,t),i=(t+st)/fi;return function(c,u){if(c.is0(u))return u;if(wx(c,u)!==1)throw new Error("Cannot find square root");let f=r,d=c.mul(c.ONE,s),l=c.pow(u,t),p=c.pow(u,i);for(;!c.eql(l,c.ONE);){if(c.is0(l))return c.ZERO;let h=1,y=c.sqr(l);for(;!c.eql(y,c.ONE);)if(h++,y=c.sqr(y),h===f)throw new Error("Cannot find square root");let g=st<<BigInt(f-h-1),v=c.pow(d,g);f=h,d=c.sqr(v),l=c.mul(l,d),p=c.mul(p,v)}return p}}function QA(e){return e%vx===JA?Tx:e%Ax===Ex?YA:XA(e)}function Pd(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=e9.reduce((n,o)=>(n[o]="function",n),t);return Sn(e,r)}function t9(e,t,r){if(r<bt)throw new Error("invalid exponent, negatives unsupported");if(r===bt)return e.ONE;if(r===st)return t;let n=e.ONE,o=t;for(;r>bt;)r&st&&(n=e.mul(n,o)),o=e.sqr(o),r>>=st;return n}function Ma(e,t,r=!1){let n=new Array(t.length).fill(r?e.ZERO:void 0),o=t.reduce((i,a,c)=>e.is0(a)?i:(n[c]=i,e.mul(i,a)),e.ONE),s=e.inv(o);return t.reduceRight((i,a,c)=>e.is0(a)?i:(n[c]=e.mul(i,n[c]),e.mul(i,a)),s),n}function wx(e,t){let r=(e.ORDER-st)/fi,n=e.pow(t,r),o=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),i=e.eql(n,e.neg(e.ONE));if(!o&&!s&&!i)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Tl(e,t){t!==void 0&&Xs(t);let r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Bu(e,t,r=!1,n={}){if(e<=bt)throw new Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:o,nByteLength:s}=Tl(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,a=Object.freeze({ORDER:e,isLE:r,BITS:o,BYTES:s,MASK:ui(o),ZERO:bt,ONE:st,create:c=>Ie(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return bt<=c&&c<e},is0:c=>c===bt,isOdd:c=>(c&st)===st,neg:c=>Ie(-c,e),eql:(c,u)=>c===u,sqr:c=>Ie(c*c,e),add:(c,u)=>Ie(c+u,e),sub:(c,u)=>Ie(c-u,e),mul:(c,u)=>Ie(c*u,e),pow:(c,u)=>t9(a,c,u),div:(c,u)=>Ie(c*Td(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Td(c,e),sqrt:n.sqrt||(c=>(i||(i=QA(e)),i(a,c))),toBytes:c=>r?El(c,s):Vr(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return r?vl(c):kt(c)},invertBatch:c=>Ma(a,c),cmov:(c,u,f)=>f?u:c});return Object.freeze(a)}function Px(e){if(typeof e!="bigint")throw new Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function Pl(e){let t=Px(e);return t+Math.ceil(t/2)}function Sx(e,t,r=!1){let n=e.length,o=Px(t),s=Pl(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=r?vl(e):kt(e),a=Ie(i,t-st)+st;return r?El(a,o):Vr(a,o)}var bt,st,fi,JA,vx,Ex,Ax,e9,ku=m(()=>{pn();Ha();bt=BigInt(0),st=BigInt(1),fi=BigInt(2),JA=BigInt(3),vx=BigInt(4),Ex=BigInt(5),Ax=BigInt(8);e9=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function Sl(e,t){let r=t.negate();return e?r:t}function kx(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Il(e,t){kx(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),o=2**e,s=ui(e),i=BigInt(e);return{windows:r,windowSize:n,mask:s,maxNumber:o,shiftBy:i}}function Bx(e,t,r){let{windowSize:n,mask:o,maxNumber:s,shiftBy:i}=r,a=Number(e&o),c=e>>i;a>n&&(a-=s,c+=Cl);let u=t*n,f=u+Math.abs(a)-1,d=a===0,l=a<0,p=t%2!==0;return{nextN:c,offset:f,isZero:d,isNeg:l,isNegF:p,offsetF:u}}function r9(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,n)=>{if(!(r instanceof t))throw new Error("invalid point at index "+n)})}function n9(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,n)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+n)})}function kl(e){return Cx.get(e)||1}function Rx(e,t){return{constTimeNegate:Sl,hasPrecomputes(r){return kl(r)!==1},unsafeLadder(r,n,o=e.ZERO){let s=r;for(;n>Ix;)n&Cl&&(o=o.add(s)),s=s.double(),n>>=Cl;return o},precomputeWindow(r,n){let{windows:o,windowSize:s}=Il(n,t),i=[],a=r,c=a;for(let u=0;u<o;u++){c=a,i.push(c);for(let f=1;f<s;f++)c=c.add(a),i.push(c);a=c.double()}return i},wNAF(r,n,o){let s=e.ZERO,i=e.BASE,a=Il(r,t);for(let c=0;c<a.windows;c++){let{nextN:u,offset:f,isZero:d,isNeg:l,isNegF:p,offsetF:h}=Bx(o,c,a);o=u,d?i=i.add(Sl(p,n[h])):s=s.add(Sl(l,n[f]))}return{p:s,f:i}},wNAFUnsafe(r,n,o,s=e.ZERO){let i=Il(r,t);for(let a=0;a<i.windows&&o!==Ix;a++){let{nextN:c,offset:u,isZero:f,isNeg:d}=Bx(o,a,i);if(o=c,!f){let l=n[u];s=s.add(d?l.negate():l)}}return s},getPrecomputes(r,n,o){let s=Bl.get(n);return s||(s=this.precomputeWindow(n,r),r!==1&&Bl.set(n,o(s))),s},wNAFCached(r,n,o){let s=kl(r);return this.wNAF(s,this.getPrecomputes(s,r,o),n)},wNAFCachedUnsafe(r,n,o,s){let i=kl(r);return i===1?this.unsafeLadder(r,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,r,o),n,s)},setWindowSize(r,n){kx(n,t),Cx.set(r,n),Bl.delete(r)}}}function $x(e,t,r,n){r9(r,e),n9(n,t);let o=r.length,s=n.length;if(o!==s)throw new Error("arrays of points and scalars must have equal length");let i=e.ZERO,a=xx(BigInt(o)),c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);let u=ui(c),f=new Array(Number(u)+1).fill(i),d=Math.floor((t.BITS-1)/c)*c,l=i;for(let p=d;p>=0;p-=c){f.fill(i);for(let y=0;y<s;y++){let g=n[y],v=Number(g>>BigInt(p)&u);f[v]=f[v].add(r[y])}let h=i;for(let y=f.length-1,g=i;y>0;y--)g=g.add(f[y]),h=h.add(g);if(l=l.add(h),p!==0)for(let y=0;y<c;y++)l=l.double()}return l}function Rl(e){return Pd(e.Fp),Sn(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Tl(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var Ix,Cl,Bl,Cx,Nx=m(()=>{ku();Ha();Ix=BigInt(0),Cl=BigInt(1);Bl=new WeakMap,Cx=new WeakMap});function Hx(e){e.lowS!==void 0&&$a("lowS",e.lowS),e.prehash!==void 0&&$a("prehash",e.prehash)}function o9(e){let t=Rl(e);Sn(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:n,a:o}=t;if(r){if(!n.eql(o,n.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}function $l(e,t){return Na(Vr(e,t))}function s9(e){let t=o9(e),{Fp:r}=t,n=Bu(t.n,t.nBitLength),o=t.toBytes||((x,b,w)=>{let A=b.toAffine();return yt(Uint8Array.from([4]),r.toBytes(A.x),r.toBytes(A.y))}),s=t.fromBytes||(x=>{let b=x.subarray(1),w=r.fromBytes(b.subarray(0,r.BYTES)),A=r.fromBytes(b.subarray(r.BYTES,2*r.BYTES));return{x:w,y:A}});function i(x){let{a:b,b:w}=t,A=r.sqr(x),P=r.mul(A,x);return r.add(r.add(P,r.mul(x,b)),w)}function a(x,b){let w=r.sqr(b),A=i(x);return r.eql(w,A)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");let c=r.mul(r.pow(t.a,Cu),Hl),u=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,u)))throw new Error("bad curve params: a or b");function f(x){return ci(x,ce,t.n)}function d(x){let{allowedPrivateKeyLengths:b,nByteLength:w,wrapPrivateKey:A,n:P}=t;if(b&&typeof x!="bigint"){if(Ra(x)&&(x=Na(x)),typeof x!="string"||!b.includes(x.length))throw new Error("invalid private key");x=x.padStart(w*2,"0")}let B;try{B=typeof x=="bigint"?x:kt(ze("private key",x,w))}catch{throw new Error("invalid private key, expected hex or "+w+" bytes, got "+typeof x)}return A&&(B=Ie(B,P)),Pn("private key",B,ce,P),B}function l(x){if(!(x instanceof y))throw new Error("ProjectivePoint expected")}let p=Al((x,b)=>{let{px:w,py:A,pz:P}=x;if(r.eql(P,r.ONE))return{x:w,y:A};let B=x.is0();b==null&&(b=B?r.ONE:r.inv(P));let R=r.mul(w,b),S=r.mul(A,b),M=r.mul(P,b);if(B)return{x:r.ZERO,y:r.ZERO};if(!r.eql(M,r.ONE))throw new Error("invZ was invalid");return{x:R,y:S}}),h=Al(x=>{if(x.is0()){if(t.allowInfinityPoint&&!r.is0(x.py))return;throw new Error("bad point: ZERO")}let{x:b,y:w}=x.toAffine();if(!r.isValid(b)||!r.isValid(w))throw new Error("bad point: x or y not FE");if(!a(b,w))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(b,w,A){if(b==null||!r.isValid(b))throw new Error("x required");if(w==null||!r.isValid(w)||r.is0(w))throw new Error("y required");if(A==null||!r.isValid(A))throw new Error("z required");this.px=b,this.py=w,this.pz=A,Object.freeze(this)}static fromAffine(b){let{x:w,y:A}=b||{};if(!b||!r.isValid(w)||!r.isValid(A))throw new Error("invalid affine point");if(b instanceof y)throw new Error("projective point not allowed");let P=B=>r.eql(B,r.ZERO);return P(w)&&P(A)?y.ZERO:new y(w,A,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){let w=Ma(r,b.map(A=>A.pz));return b.map((A,P)=>A.toAffine(w[P])).map(y.fromAffine)}static fromHex(b){let w=y.fromAffine(s(ze("pointHex",b)));return w.assertValidity(),w}static fromPrivateKey(b){return y.BASE.multiply(d(b))}static msm(b,w){return $x(y,n,b,w)}_setWindowSize(b){E.setWindowSize(this,b)}assertValidity(){h(this)}hasEvenY(){let{y:b}=this.toAffine();if(r.isOdd)return!r.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){l(b);let{px:w,py:A,pz:P}=this,{px:B,py:R,pz:S}=b,M=r.eql(r.mul(w,S),r.mul(B,P)),z=r.eql(r.mul(A,S),r.mul(R,P));return M&&z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){let{a:b,b:w}=t,A=r.mul(w,Cu),{px:P,py:B,pz:R}=this,S=r.ZERO,M=r.ZERO,z=r.ZERO,_=r.mul(P,P),N=r.mul(B,B),C=r.mul(R,R),k=r.mul(P,B);return k=r.add(k,k),z=r.mul(P,R),z=r.add(z,z),S=r.mul(b,z),M=r.mul(A,C),M=r.add(S,M),S=r.sub(N,M),M=r.add(N,M),M=r.mul(S,M),S=r.mul(k,S),z=r.mul(A,z),C=r.mul(b,C),k=r.sub(_,C),k=r.mul(b,k),k=r.add(k,z),z=r.add(_,_),_=r.add(z,_),_=r.add(_,C),_=r.mul(_,k),M=r.add(M,_),C=r.mul(B,R),C=r.add(C,C),_=r.mul(C,k),S=r.sub(S,_),z=r.mul(C,N),z=r.add(z,z),z=r.add(z,z),new y(S,M,z)}add(b){l(b);let{px:w,py:A,pz:P}=this,{px:B,py:R,pz:S}=b,M=r.ZERO,z=r.ZERO,_=r.ZERO,N=t.a,C=r.mul(t.b,Cu),k=r.mul(w,B),U=r.mul(A,R),H=r.mul(P,S),L=r.add(w,A),q=r.add(B,R);L=r.mul(L,q),q=r.add(k,U),L=r.sub(L,q),q=r.add(w,P);let X=r.add(B,S);return q=r.mul(q,X),X=r.add(k,H),q=r.sub(q,X),X=r.add(A,P),M=r.add(R,S),X=r.mul(X,M),M=r.add(U,H),X=r.sub(X,M),_=r.mul(N,q),M=r.mul(C,H),_=r.add(M,_),M=r.sub(U,_),_=r.add(U,_),z=r.mul(M,_),U=r.add(k,k),U=r.add(U,k),H=r.mul(N,H),q=r.mul(C,q),U=r.add(U,H),H=r.sub(k,H),H=r.mul(N,H),q=r.add(q,H),k=r.mul(U,q),z=r.add(z,k),k=r.mul(X,q),M=r.mul(L,M),M=r.sub(M,k),k=r.mul(L,U),_=r.mul(X,_),_=r.add(_,k),new y(M,z,_)}subtract(b){return this.add(b.negate())}is0(){return this.equals(y.ZERO)}wNAF(b){return E.wNAFCached(this,b,y.normalizeZ)}multiplyUnsafe(b){let{endo:w,n:A}=t;Pn("scalar",b,Pr,A);let P=y.ZERO;if(b===Pr)return P;if(this.is0()||b===ce)return this;if(!w||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,b,y.normalizeZ);let{k1neg:B,k1:R,k2neg:S,k2:M}=w.splitScalar(b),z=P,_=P,N=this;for(;R>Pr||M>Pr;)R&ce&&(z=z.add(N)),M&ce&&(_=_.add(N)),N=N.double(),R>>=ce,M>>=ce;return B&&(z=z.negate()),S&&(_=_.negate()),_=new y(r.mul(_.px,w.beta),_.py,_.pz),z.add(_)}multiply(b){let{endo:w,n:A}=t;Pn("scalar",b,ce,A);let P,B;if(w){let{k1neg:R,k1:S,k2neg:M,k2:z}=w.splitScalar(b),{p:_,f:N}=this.wNAF(S),{p:C,f:k}=this.wNAF(z);_=E.constTimeNegate(R,_),C=E.constTimeNegate(M,C),C=new y(r.mul(C.px,w.beta),C.py,C.pz),P=_.add(C),B=N.add(k)}else{let{p:R,f:S}=this.wNAF(b);P=R,B=S}return y.normalizeZ([P,B])[0]}multiplyAndAddUnsafe(b,w,A){let P=y.BASE,B=(S,M)=>M===Pr||M===ce||!S.equals(P)?S.multiplyUnsafe(M):S.multiply(M),R=B(this,w).add(B(b,A));return R.is0()?void 0:R}toAffine(b){return p(this,b)}isTorsionFree(){let{h:b,isTorsionFree:w}=t;if(b===ce)return!0;if(w)return w(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:b,clearCofactor:w}=t;return b===ce?this:w?w(y,this):this.multiplyUnsafe(t.h)}toRawBytes(b=!0){return $a("isCompressed",b),this.assertValidity(),o(y,this,b)}toHex(b=!0){return $a("isCompressed",b),Na(this.toRawBytes(b))}}y.BASE=new y(t.Gx,t.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);let{endo:g,nBitLength:v}=t,E=Rx(y,g?Math.ceil(v/2):v);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:d,weierstrassEquation:i,isWithinCurveOrder:f}}function i9(e){let t=Rl(e);return Sn(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Mx(e){let t=i9(e),{Fp:r,n,nByteLength:o,nBitLength:s}=t,i=r.BYTES+1,a=2*r.BYTES+1;function c(C){return Ie(C,n)}function u(C){return Td(C,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:d,weierstrassEquation:l,isWithinCurveOrder:p}=s9({...t,toBytes(C,k,U){let H=k.toAffine(),L=r.toBytes(H.x),q=yt;return $a("isCompressed",U),U?q(Uint8Array.from([k.hasEvenY()?2:3]),L):q(Uint8Array.from([4]),L,r.toBytes(H.y))},fromBytes(C){let k=C.length,U=C[0],H=C.subarray(1);if(k===i&&(U===2||U===3)){let L=kt(H);if(!ci(L,ce,r.ORDER))throw new Error("Point is not on curve");let q=l(L),X;try{X=r.sqrt(q)}catch(pe){let He=pe instanceof Error?": "+pe.message:"";throw new Error("Point is not on curve"+He)}let Ne=(X&ce)===ce;return(U&1)===1!==Ne&&(X=r.neg(X)),{x:L,y:X}}else if(k===a&&U===4){let L=r.fromBytes(H.subarray(0,r.BYTES)),q=r.fromBytes(H.subarray(r.BYTES,2*r.BYTES));return{x:L,y:q}}else{let L=i,q=a;throw new Error("invalid Point, expected length of "+L+", or uncompressed "+q+", got "+k)}}});function h(C){let k=n>>ce;return C>k}function y(C){return h(C)?c(-C):C}let g=(C,k,U)=>kt(C.slice(k,U));class v{constructor(k,U,H){Pn("r",k,ce,n),Pn("s",U,ce,n),this.r=k,this.s=U,H!=null&&(this.recovery=H),Object.freeze(this)}static fromCompact(k){let U=o;return k=ze("compactSignature",k,U*2),new v(g(k,0,U),g(k,U,2*U))}static fromDER(k){let{r:U,s:H}=In.toSig(ze("DER",k));return new v(U,H)}assertValidity(){}addRecoveryBit(k){return new v(this.r,this.s,k)}recoverPublicKey(k){let{r:U,s:H,recovery:L}=this,q=P(ze("msgHash",k));if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");let X=L===2||L===3?U+t.n:U;if(X>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let Ne=(L&1)===0?"02":"03",vt=f.fromHex(Ne+$l(X,r.BYTES)),pe=u(X),He=c(-q*pe),Ri=c(H*pe),qn=f.BASE.multiplyAndAddUnsafe(vt,He,Ri);if(!qn)throw new Error("point at infinify");return qn.assertValidity(),qn}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Iu(this.toDERHex())}toDERHex(){return In.hexFromSig(this)}toCompactRawBytes(){return Iu(this.toCompactHex())}toCompactHex(){let k=o;return $l(this.r,k)+$l(this.s,k)}}let E={isValidPrivateKey(C){try{return d(C),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let C=Pl(t.n);return Sx(t.randomBytes(C),t.n)},precompute(C=8,k=f.BASE){return k._setWindowSize(C),k.multiply(BigInt(3)),k}};function x(C,k=!0){return f.fromPrivateKey(C).toRawBytes(k)}function b(C){if(typeof C=="bigint")return!1;if(C instanceof f)return!0;let U=ze("key",C).length,H=r.BYTES,L=H+1,q=2*H+1;if(!(t.allowedPrivateKeyLengths||o===L))return U===L||U===q}function w(C,k,U=!0){if(b(C)===!0)throw new Error("first arg must be private key");if(b(k)===!1)throw new Error("second arg must be public key");return f.fromHex(k).multiply(d(C)).toRawBytes(U)}let A=t.bits2int||function(C){if(C.length>8192)throw new Error("input is too large");let k=kt(C),U=C.length*8-s;return U>0?k>>BigInt(U):k},P=t.bits2int_modN||function(C){return c(A(C))},B=ui(s);function R(C){return Pn("num < 2^"+s,C,Pr,B),Vr(C,o)}function S(C,k,U=M){if(["recovered","canonical"].some(As=>As in U))throw new Error("sign() legacy options not supported");let{hash:H,randomBytes:L}=t,{lowS:q,prehash:X,extraEntropy:Ne}=U;q==null&&(q=!0),C=ze("msgHash",C),Hx(U),X&&(C=ze("prehashed msgHash",H(C)));let vt=P(C),pe=d(k),He=[R(pe),R(vt)];if(Ne!=null&&Ne!==!1){let As=Ne===!0?L(r.BYTES):Ne;He.push(ze("extraEntropy",As))}let Ri=yt(...He),qn=vt;function Sm(As){let $i=A(As);if(!p($i))return;let Im=u($i),Xc=f.BASE.multiply($i).toAffine(),Ts=c(Xc.x);if(Ts===Pr)return;let Qc=c(Im*c(qn+Ts*pe));if(Qc===Pr)return;let Ni=(Xc.x===Ts?0:2)|Number(Xc.y&ce),_b=Qc;return q&&h(Qc)&&(_b=y(Qc),Ni^=1),new v(Ts,_b,Ni)}return{seed:Ri,k2sig:Sm}}let M={lowS:t.lowS,prehash:!1},z={lowS:t.lowS,prehash:!1};function _(C,k,U=M){let{seed:H,k2sig:L}=S(C,k,U),q=t;return gx(q.hash.outputLen,q.nByteLength,q.hmac)(H,L)}f.BASE._setWindowSize(8);function N(C,k,U,H=z){let L=C;k=ze("msgHash",k),U=ze("publicKey",U);let{lowS:q,prehash:X,format:Ne}=H;if(Hx(H),"strict"in H)throw new Error("options.strict was renamed to lowS");if(Ne!==void 0&&Ne!=="compact"&&Ne!=="der")throw new Error("format must be compact or der");let vt=typeof L=="string"||Ra(L),pe=!vt&&!Ne&&typeof L=="object"&&L!==null&&typeof L.r=="bigint"&&typeof L.s=="bigint";if(!vt&&!pe)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let He,Ri;try{if(pe&&(He=new v(L.r,L.s)),vt){try{Ne!=="compact"&&(He=v.fromDER(L))}catch(Ni){if(!(Ni instanceof In.Err))throw Ni}!He&&Ne!=="der"&&(He=v.fromCompact(L))}Ri=f.fromHex(U)}catch{return!1}if(!He||q&&He.hasHighS())return!1;X&&(k=t.hash(k));let{r:qn,s:Sm}=He,As=P(k),$i=u(Sm),Im=c(As*$i),Xc=c(qn*$i),Ts=f.BASE.multiplyAndAddUnsafe(Ri,Im,Xc)?.toAffine();return Ts?c(Ts.x)===qn:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:w,sign:_,verify:N,ProjectivePoint:f,Signature:v,utils:E}}function a9(e,t){let r=e.ORDER,n=Pr;for(let h=r-ce;h%No===Pr;h/=No)n+=ce;let o=n,s=No<<o-ce-ce,i=s*No,a=(r-ce)/i,c=(a-ce)/No,u=i-ce,f=s,d=e.pow(t,a),l=e.pow(t,(a+ce)/No),p=(h,y)=>{let g=d,v=e.pow(y,u),E=e.sqr(v);E=e.mul(E,y);let x=e.mul(h,E);x=e.pow(x,c),x=e.mul(x,v),v=e.mul(x,y),E=e.mul(x,h);let b=e.mul(E,v);x=e.pow(b,f);let w=e.eql(x,e.ONE);v=e.mul(E,l),x=e.mul(b,g),E=e.cmov(v,E,w),b=e.cmov(x,b,w);for(let A=o;A>ce;A--){let P=A-No;P=No<<P-ce;let B=e.pow(b,P),R=e.eql(B,e.ONE);v=e.mul(E,g),g=e.mul(g,g),B=e.mul(b,g),E=e.cmov(v,E,R),b=e.cmov(B,b,R)}return{isValid:w,value:E}};if(e.ORDER%Hl===Cu){let h=(e.ORDER-Cu)/Hl,y=e.sqrt(e.neg(t));p=(g,v)=>{let E=e.sqr(v),x=e.mul(g,v);E=e.mul(E,x);let b=e.pow(E,h);b=e.mul(b,x);let w=e.mul(b,y),A=e.mul(e.sqr(b),v),P=e.eql(A,g),B=e.cmov(w,b,P);return{isValid:P,value:B}}}return p}function zx(e,t){if(Pd(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let r=a9(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let o,s,i,a,c,u,f,d;o=e.sqr(n),o=e.mul(o,t.Z),s=e.sqr(o),s=e.add(s,o),i=e.add(s,e.ONE),i=e.mul(i,t.B),a=e.cmov(t.Z,e.neg(s),!e.eql(s,e.ZERO)),a=e.mul(a,t.A),s=e.sqr(i),u=e.sqr(a),c=e.mul(u,t.A),s=e.add(s,c),s=e.mul(s,i),u=e.mul(u,a),c=e.mul(u,t.B),s=e.add(s,c),f=e.mul(o,i);let{isValid:l,value:p}=r(s,u);d=e.mul(o,n),d=e.mul(d,p),f=e.cmov(f,i,l),d=e.cmov(d,p,l);let h=e.isOdd(n)===e.isOdd(d);d=e.cmov(e.neg(d),d,h);let y=Ma(e,[a],!0)[0];return f=e.mul(f,y),{x:f,y:d}}}var Nl,In,Pr,ce,No,Cu,Hl,Ml=m(()=>{Nx();ku();Ha();Nl=class extends Error{constructor(t=""){super(t)}},In={Err:Nl,_tlv:{encode:(e,t)=>{let{Err:r}=In;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let n=t.length/2,o=Su(n);if(o.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?Su(o.length/2|128):"";return Su(e)+s+o+t},decode(e,t){let{Err:r}=In,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let o=t[n++],s=!!(o&128),i=0;if(!s)i=o;else{let c=o&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of u)i=i<<8|f;if(n+=c,i<128)throw new r("tlv.decode(long): not minimal encoding")}let a=t.subarray(n,n+i);if(a.length!==i)throw new r("tlv.decode: wrong value length");return{v:a,l:t.subarray(n+i)}}},_int:{encode(e){let{Err:t}=In;if(e<Pr)throw new t("integer: negative integers are not allowed");let r=Su(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=In;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return kt(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=In,o=ze("signature",e),{v:s,l:i}=n.decode(48,o);if(i.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=n.decode(2,s),{v:u,l:f}=n.decode(2,c);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=In,n=t.encode(2,r.encode(e.r)),o=t.encode(2,r.encode(e.s)),s=n+o;return t.encode(48,s)}};Pr=BigInt(0),ce=BigInt(1),No=BigInt(2),Cu=BigInt(3),Hl=BigInt(4)});function c9(e){return{hash:e,hmac:(t,...r)=>yl(e,t,U1(...r)),randomBytes:fd}}function _x(e,t){let r=n=>Mx({...e,...c9(n)});return{...r(t),create:r}}var Ux=m(()=>{mx();pn();Ml();});function Ho(e,t){if(Ru(e),Ru(t),e<0||e>=1<<8*t)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function f9(e,t){let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}function Ru(e){if(!Number.isSafeInteger(e))throw new Error("number expected")}function d9(e,t,r,n){Tn(e),Tn(t),Ru(r),t.length>255&&(t=n(yt(Ad("H2C-OVERSIZE-DST-"),t)));let{outputLen:o,blockLen:s}=n,i=Math.ceil(r/o);if(r>65535||i>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=yt(t,Ho(t.length,1)),c=Ho(0,s),u=Ho(r,2),f=new Array(i),d=n(yt(c,e,u,Ho(0,1),a));f[0]=n(yt(d,Ho(1,1),a));for(let p=1;p<=i;p++){let h=[f9(d,f[p-1]),Ho(p+1,1),a];f[p]=n(yt(...h))}return yt(...f).slice(0,r)}function p9(e,t,r,n,o){if(Tn(e),Tn(t),Ru(r),t.length>255){let s=Math.ceil(2*n/8);t=o.create({dkLen:s}).update(Ad("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return o.create({dkLen:r}).update(e).update(Ho(r,2)).update(t).update(Ho(t.length,1)).digest()}function Lx(e,t,r){Sn(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:o,m:s,hash:i,expand:a,DST:c}=r;Tn(e),Ru(t);let u=typeof c=="string"?Ad(c):c,f=n.toString(2).length,d=Math.ceil((f+o)/8),l=t*s*d,p;if(a==="xmd")p=d9(e,u,l,i);else if(a==="xof")p=p9(e,u,l,o,i);else if(a==="_internal_pass")p=e;else throw new Error('expand must be "xmd" or "xof"');let h=new Array(t);for(let y=0;y<t;y++){let g=new Array(s);for(let v=0;v<s;v++){let E=d*(v+y*s),x=p.subarray(E,E+d);g[v]=Ie(u9(x),n)}h[y]=g}return h}function Fx(e,t){let r=t.map(n=>Array.from(n).reverse());return(n,o)=>{let[s,i,a,c]=r.map(d=>d.reduce((l,p)=>e.add(e.mul(l,n),p))),[u,f]=Ma(e,[i,c],!0);return n=e.mul(s,u),o=e.mul(o,e.mul(a,f)),{x:n,y:o}}}function Ox(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");function n(s){return e.fromAffine(t(s))}function o(s){let i=s.clearCofactor();return i.equals(e.ZERO)?e.ZERO:(i.assertValidity(),i)}return{defaults:r,hashToCurve(s,i){let a=Lx(s,2,{...r,DST:r.DST,...i}),c=n(a[0]),u=n(a[1]);return o(c.add(u))},encodeToCurve(s,i){let a=Lx(s,1,{...r,DST:r.encodeDST,...i});return o(n(a[0]))},mapToCurve(s){if(!Array.isArray(s))throw new Error("expected array of bigints");for(let i of s)if(typeof i!="bigint")throw new Error("expected array of bigints");return o(n(s))}}}var u9,Dx=m(()=>{ku();Ha();u9=kt});var Zx={};Nr(Zx,{encodeToCurve:()=>w9,hashToCurve:()=>g9,schnorr:()=>y9,secp256k1:()=>xt,secp256k1_hasher:()=>Dl});function Gx(e){let t=Hu,r=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),i=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,f=u*u*e%t,d=Wt(f,r,t)*f%t,l=Wt(d,r,t)*f%t,p=Wt(l,Id,t)*u%t,h=Wt(p,o,t)*p%t,y=Wt(h,s,t)*h%t,g=Wt(y,a,t)*y%t,v=Wt(g,c,t)*g%t,E=Wt(v,a,t)*y%t,x=Wt(E,r,t)*f%t,b=Wt(x,i,t)*h%t,w=Wt(b,n,t)*u%t,A=Wt(w,Id,t);if(!Mo.eql(Mo.sqr(A),e))throw new Error("Cannot find square root");return A}function Bd(e,...t){let r=jx[e];if(r===void 0){let n=ai(Uint8Array.from(e,o=>o.charCodeAt(0)));r=yt(n,n),jx[e]=r}return ai(yt(r,...t))}function Ul(e){let t=xt.utils.normPrivateKeyToScalar(e),r=Ol.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Nu(-t),bytes:Fl(r)}}function Vx(e){Pn("x",e,$u,Hu);let t=zl(e*e),r=zl(t*e+BigInt(7)),n=Gx(r);n%Id!==Ll&&(n=zl(-n));let o=new Ol(e,n,$u);return o.assertValidity(),o}function Wx(...e){return Nu(za(Bd("BIP0340/challenge",...e)))}function l9(e){return Ul(e).bytes}function h9(e,t,r=fd(32)){let n=ze("message",e),{bytes:o,scalar:s}=Ul(t),i=ze("auxRand",r,32),a=_l(s^za(Bd("BIP0340/aux",i))),c=Bd("BIP0340/nonce",a,o,n),u=Nu(za(c));if(u===Ll)throw new Error("sign failed: k is zero");let{bytes:f,scalar:d}=Ul(u),l=Wx(f,o,n),p=new Uint8Array(64);if(p.set(f,0),p.set(_l(Nu(d+l*s)),32),!Kx(p,n,o))throw new Error("sign: Invalid signature produced");return p}function Kx(e,t,r){let n=ze("signature",e,64),o=ze("message",t),s=ze("publicKey",r,32);try{let i=Vx(za(s)),a=za(n.subarray(0,32));if(!ci(a,$u,Hu))return!1;let c=za(n.subarray(32,64));if(!ci(c,$u,Sd))return!1;let u=Wx(_l(a),Fl(i),o),f=m9(i,c,Nu(-u));return!(!f||!f.hasEvenY()||f.toAffine().x!==a)}catch{return!1}}var Hu,Sd,Ll,$u,Id,qx,Mo,xt,jx,Fl,_l,zl,Nu,Ol,m9,za,y9,b9,x9,Dl,g9,w9,di=m(()=>{hl();pn();Ux();Dx();ku();Ha();Ml();Hu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Sd=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ll=BigInt(0),$u=BigInt(1),Id=BigInt(2),qx=(e,t)=>(e+t/Id)/t;Mo=Bu(Hu,void 0,void 0,{sqrt:Gx}),xt=_x({a:Ll,b:BigInt(7),Fp:Mo,n:Sd,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=Sd,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$u*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,i=BigInt("0x100000000000000000000000000000000"),a=qx(s*e,t),c=qx(-n*e,t),u=Ie(e-a*r-c*o,t),f=Ie(-a*n-c*s,t),d=u>i,l=f>i;if(d&&(u=t-u),l&&(f=t-f),u>i||f>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:l,k2:f}}}},ai),jx={};Fl=e=>e.toRawBytes(!0).slice(1),_l=e=>Vr(e,32),zl=e=>Ie(e,Hu),Nu=e=>Ie(e,Sd),Ol=xt.ProjectivePoint,m9=(e,t,r)=>Ol.BASE.multiplyAndAddUnsafe(e,t,r);za=kt;y9={getPublicKey:l9,sign:h9,verify:Kx,utils:{randomPrivateKey:xt.utils.randomPrivateKey,lift_x:Vx,pointToBytes:Fl,numberToBytesBE:Vr,bytesToNumberBE:kt,taggedHash:Bd,mod:Ie}},b9=Fx(Mo,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(t=>BigInt(t)))),x9=zx(Mo,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Mo.create(BigInt("-11"))}),Dl=Ox(xt.ProjectivePoint,e=>{let{x:t,y:r}=x9(Mo.create(e[0]));return b9(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Mo.ORDER,m:1,k:128,expand:"xmd",hash:ai}),g9=Dl.hashToCurve,w9=Dl.encodeToCurve});async function kd({hash:e,signature:t}){let r=O(e)?e:me(e),{secp256k1:n}=await Promise.resolve().then(()=>(di(),Zx));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){let{r:u,s:f,v:d,yParity:l}=t,p=Number(l??d),h=Jx(p);return new n.Signature(j(u),j(f)).addRecoveryBit(h)}let i=O(t)?t:me(t);if(J(i)!==65)throw new Error("invalid signature length");let a=Z(`0x${i.slice(130)}`),c=Jx(a);return n.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Jx(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}var ql=m(()=>{ut();et();ve();F()});async function gt({hash:e,signature:t}){return dx(await kd({hash:e,signature:t}))}var zo=m(()=>{px();ql()});function wt(e,t="hex"){let r=Qx(e),n=vr(new Uint8Array(r.length));return r.encode(n),t==="hex"?K(n.bytes):n.bytes}function Yx(e,t="bytes"){return wt(e,t)}function Xx(e,t="hex"){return wt(e,t)}function Qx(e){return Array.isArray(e)?v9(e.map(t=>Qx(t))):E9(e)}function v9(e){let t=e.reduce((o,s)=>o+s.length,0),r=eg(t);return{length:t<=55?1+t:1+r+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+r),r===1?o.pushUint8(t):r===2?o.pushUint16(t):r===3?o.pushUint24(t):o.pushUint32(t));for(let{encode:s}of e)s(o)}}}function E9(e){let t=typeof e=="string"?re(e):e,r=eg(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+r),r===1?o.pushUint8(t.length):r===2?o.pushUint16(t.length):r===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function eg(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new T("Length is too large.")}var Mu=m(()=>{W();la();ue();F()});function tg(e){let{chainId:t,nonce:r,to:n}=e,o=e.contractAddress??e.address,s=te(Ae(["0x05",wt([t?I(t):"0x",o,r?I(r):"0x"])]));return n==="bytes"?re(s):s}var rg=m(()=>{Me();ue();F();Mu();St()});async function _o(e){let{authorization:t,signature:r}=e;return gt({hash:tg(t),signature:r??t})}var zu=m(()=>{zo();rg()});var _a,jl=m(()=>{Pu();ni();W();lt();_a=class extends T{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:i,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:f,to:d,value:l}){let p=si({from:r?.address,to:d,value:typeof l<"u"&&`${so(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:i,gasPrice:typeof a<"u"&&`${Se(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${Se(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${Se(u)} gwei`,nonce:f});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",p].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}});var Kt,Ct,Uo,Lo,Fo,Oo,Do,qo,jo,Go,cr,Rt,Wr=m(()=>{ni();W();Kt=class extends T{constructor({cause:t,message:r}={}){let n=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(Kt,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Kt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});Ct=class extends T{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Se(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(Ct,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});Uo=class extends T{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${Se(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(Uo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});Lo=class extends T{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};Object.defineProperty(Lo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});Fo=class extends T{constructor({cause:t,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
39
+ `),{cause:t,name:"NonceTooLowError"})}};Object.defineProperty(Fo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Oo=class extends T{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(Oo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Do=class extends T{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
40
+ `),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(Do,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});qo=class extends T{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(qo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});jo=class extends T{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(jo,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Go=class extends T{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(Go,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});cr=class extends T{constructor({cause:t,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${Se(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${Se(n)} gwei`:""}).`].join(`
41
+ `),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(cr,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});Rt=class extends T{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}}});function Vo(e,t){let r=(e.details||"").toLowerCase(),n=e instanceof T?e.walk(o=>o?.code===Kt.code):e;return n instanceof T?new Kt({cause:e,message:n.details}):Kt.nodeMessage.test(r)?new Kt({cause:e,message:e.details}):Ct.nodeMessage.test(r)?new Ct({cause:e,maxFeePerGas:t?.maxFeePerGas}):Uo.nodeMessage.test(r)?new Uo({cause:e,maxFeePerGas:t?.maxFeePerGas}):Lo.nodeMessage.test(r)?new Lo({cause:e,nonce:t?.nonce}):Fo.nodeMessage.test(r)?new Fo({cause:e,nonce:t?.nonce}):Oo.nodeMessage.test(r)?new Oo({cause:e,nonce:t?.nonce}):Do.nodeMessage.test(r)?new Do({cause:e}):qo.nodeMessage.test(r)?new qo({cause:e,gas:t?.gas}):jo.nodeMessage.test(r)?new jo({cause:e,gas:t?.gas}):Go.nodeMessage.test(r)?new Go({cause:e}):cr.nodeMessage.test(r)?new cr({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Rt({cause:e})}var _u=m(()=>{W();Wr()});function ng(e,{docsPath:t,...r}){let n=(()=>{let o=Vo(e,r);return o instanceof Rt?e:o})();return new _a(n,{docsPath:t,...r})}var og=m(()=>{jl();Wr();_u()});function $t(e,{format:t}){if(!t)return{};let r={};function n(s){let i=Object.keys(s);for(let a of i)a in e&&(r[a]=e[a]),s[a]&&typeof s[a]=="object"&&!Array.isArray(s[a])&&n(s[a])}let o=t(e||{});return n(o),r}var Wo=m(()=>{});function Ko(e,t){return({exclude:r,format:n})=>({exclude:r,format:(o,s)=>{let i=t(o,s);if(r)for(let a of r)delete i[a];return{...i,...n(o,s)}},type:e})}var Uu=m(()=>{});function Be(e,t){let r={};return typeof e.authorizationList<"u"&&(r.authorizationList=A9(e.authorizationList)),typeof e.accessList<"u"&&(r.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(r.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?r.blobs=e.blobs.map(n=>K(n)):r.blobs=e.blobs),typeof e.data<"u"&&(r.data=e.data),e.account&&(r.from=e.account.address),typeof e.from<"u"&&(r.from=e.from),typeof e.gas<"u"&&(r.gas=I(e.gas)),typeof e.gasPrice<"u"&&(r.gasPrice=I(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(r.maxFeePerBlobGas=I(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(r.maxFeePerGas=I(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(r.maxPriorityFeePerGas=I(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(r.nonce=I(e.nonce)),typeof e.to<"u"&&(r.to=e.to),typeof e.type<"u"&&(r.type=Gl[e.type]),typeof e.value<"u"&&(r.value=I(e.value)),r}function A9(e){return e.map(t=>({address:t.address,r:t.r?I(BigInt(t.r)):t.r,s:t.s?I(BigInt(t.s)):t.s,chainId:I(t.chainId),nonce:I(t.nonce),...typeof t.yParity<"u"?{yParity:I(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:I(t.v)}:{}}))}var Gl,sg,Sr=m(()=>{F();Uu();Gl={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};sg=Ko("transactionRequest",Be)});function ig(e){if(!(!e||e.length===0))return e.reduce((t,{slot:r,value:n})=>{if(r.length!==66)throw new du({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new du({size:n.length,targetSize:66,type:"hex"});return t[r]=n,t},{})}function T9(e){let{balance:t,nonce:r,state:n,stateDiff:o,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=I(t)),r!==void 0&&(i.nonce=I(r)),n!==void 0&&(i.state=ig(n)),o!==void 0){if(i.state)throw new wa;i.stateDiff=ig(o)}return i}function Ua(e){if(!e)return;let t={};for(let{address:r,...n}of e){if(!Q(r,{strict:!1}))throw new ae({address:r});if(t[r])throw new ga({address:r});t[r]=T9(n)}return t}var Cd=m(()=>{rr();pu();gd();pt();F()});var ag,cg,ug,fg,dg,pg,mg,lg,hg,yg,bg,xg,gg,wg,vg,Eg,Ag,Tg,Pg,Sg,Ig,Bg,kg,Cg,Rg,$g,Ng,Hg,Mg,zg,_g,Ug,Lg,Fg,Og,Dg,qg,jg,Gg,Vg,Wg,Kg,Zg,Jg,Yg,Xg,Qg,e6,t6,r6,n6,o6,s6,i6,a6,c6,u6,f6,d6,p6,m6,l6,h6,y6,b6,x6,g6,w6,v6,E6,A6,T6,P6,S6,I6,B6,k6,C6,R6,$6,N6,H6,M6,z6,_6,U6,L6,F6,O6,D6,q6,j6,G6,V6,W6,Zo,Rd=m(()=>{ag=2n**(8n-1n)-1n,cg=2n**(16n-1n)-1n,ug=2n**(24n-1n)-1n,fg=2n**(32n-1n)-1n,dg=2n**(40n-1n)-1n,pg=2n**(48n-1n)-1n,mg=2n**(56n-1n)-1n,lg=2n**(64n-1n)-1n,hg=2n**(72n-1n)-1n,yg=2n**(80n-1n)-1n,bg=2n**(88n-1n)-1n,xg=2n**(96n-1n)-1n,gg=2n**(104n-1n)-1n,wg=2n**(112n-1n)-1n,vg=2n**(120n-1n)-1n,Eg=2n**(128n-1n)-1n,Ag=2n**(136n-1n)-1n,Tg=2n**(144n-1n)-1n,Pg=2n**(152n-1n)-1n,Sg=2n**(160n-1n)-1n,Ig=2n**(168n-1n)-1n,Bg=2n**(176n-1n)-1n,kg=2n**(184n-1n)-1n,Cg=2n**(192n-1n)-1n,Rg=2n**(200n-1n)-1n,$g=2n**(208n-1n)-1n,Ng=2n**(216n-1n)-1n,Hg=2n**(224n-1n)-1n,Mg=2n**(232n-1n)-1n,zg=2n**(240n-1n)-1n,_g=2n**(248n-1n)-1n,Ug=2n**(256n-1n)-1n,Lg=-(2n**(8n-1n)),Fg=-(2n**(16n-1n)),Og=-(2n**(24n-1n)),Dg=-(2n**(32n-1n)),qg=-(2n**(40n-1n)),jg=-(2n**(48n-1n)),Gg=-(2n**(56n-1n)),Vg=-(2n**(64n-1n)),Wg=-(2n**(72n-1n)),Kg=-(2n**(80n-1n)),Zg=-(2n**(88n-1n)),Jg=-(2n**(96n-1n)),Yg=-(2n**(104n-1n)),Xg=-(2n**(112n-1n)),Qg=-(2n**(120n-1n)),e6=-(2n**(128n-1n)),t6=-(2n**(136n-1n)),r6=-(2n**(144n-1n)),n6=-(2n**(152n-1n)),o6=-(2n**(160n-1n)),s6=-(2n**(168n-1n)),i6=-(2n**(176n-1n)),a6=-(2n**(184n-1n)),c6=-(2n**(192n-1n)),u6=-(2n**(200n-1n)),f6=-(2n**(208n-1n)),d6=-(2n**(216n-1n)),p6=-(2n**(224n-1n)),m6=-(2n**(232n-1n)),l6=-(2n**(240n-1n)),h6=-(2n**(248n-1n)),y6=-(2n**(256n-1n)),b6=2n**8n-1n,x6=2n**16n-1n,g6=2n**24n-1n,w6=2n**32n-1n,v6=2n**40n-1n,E6=2n**48n-1n,A6=2n**56n-1n,T6=2n**64n-1n,P6=2n**72n-1n,S6=2n**80n-1n,I6=2n**88n-1n,B6=2n**96n-1n,k6=2n**104n-1n,C6=2n**112n-1n,R6=2n**120n-1n,$6=2n**128n-1n,N6=2n**136n-1n,H6=2n**144n-1n,M6=2n**152n-1n,z6=2n**160n-1n,_6=2n**168n-1n,U6=2n**176n-1n,L6=2n**184n-1n,F6=2n**192n-1n,O6=2n**200n-1n,D6=2n**208n-1n,q6=2n**216n-1n,j6=2n**224n-1n,G6=2n**232n-1n,V6=2n**240n-1n,W6=2n**248n-1n,Zo=2n**256n-1n});function _e(e){let{account:t,maxFeePerGas:r,maxPriorityFeePerGas:n,to:o}=e,s=t?G(t):void 0;if(s&&!Q(s.address))throw new ae({address:s.address});if(o&&!Q(o))throw new ae({address:o});if(r&&r>Zo)throw new Ct({maxFeePerGas:r});if(n&&r&&n>r)throw new cr({maxFeePerGas:r,maxPriorityFeePerGas:n})}var Ir=m(()=>{be();Rd();rr();Wr();pt()});var Jo,Kr,La,Fa=m(()=>{ni();W();Jo=class extends T{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}},Kr=class extends T{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}},La=class extends T{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Se(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}});var Zr,Lu=m(()=>{W();Zr=class extends T{constructor({blockHash:t,blockNumber:r}){let n="Block";t&&(n=`Block at hash "${t}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}});function Bn(e,t){let r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,...e.blockTimestamp!=null&&{blockTimestamp:BigInt(e.blockTimestamp)},chainId:e.chainId?Z(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Z(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Fu[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=P9(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}function P9(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}var Fu,K6,Oa=m(()=>{ve();Uu();Fu={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};K6=Ko("transaction",Bn)});function pi(e,t){let r=(e.transactions??[]).map(n=>typeof n=="string"?n:Bn(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:r,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}var Z6,$d=m(()=>{Uu();Oa();Z6=Ko("block",pi)});async function Ge(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",includeTransactions:o}={}){let s=o??!1,i=r!==void 0?I(r):void 0,a=null;if(t?a=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):a=await e.request({method:"eth_getBlockByNumber",params:[i||n,s]},{dedupe:!!i}),!a)throw new Zr({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||pi)(a,"getBlock")}var Yo=m(()=>{Lu();F();$d()});async function Da(e){let t=await e.request({method:"eth_gasPrice"});return BigInt(t)}var Nd=m(()=>{});async function J6(e,t){return Vl(e,t)}async function Vl(e,t){let{block:r,chain:n=e.chain,request:o}=t||{};try{let s=n?.fees?.maxPriorityFeePerGas??n?.fees?.defaultPriorityFee;if(typeof s=="function"){let a=r||await $(e,Ge,"getBlock")({}),c=await s({block:a,client:e,request:o});if(c===null)throw new Error;return c}if(typeof s<"u")return s;let i=await e.request({method:"eth_maxPriorityFeePerGas"});return j(i)}catch{let[s,i]=await Promise.all([r?Promise.resolve(r):$(e,Ge,"getBlock")({}),$(e,Da,"getGasPrice")({})]);if(typeof s.baseFeePerGas!="bigint")throw new Kr;let a=i-s.baseFeePerGas;return a<0n?0n:a}}var Wl=m(()=>{Fa();ve();ee();Yo();Nd()});async function Y6(e,t){return Hd(e,t)}async function Hd(e,t){let{block:r,chain:n=e.chain,request:o,type:s="eip1559"}=t||{},i=await(async()=>typeof n?.fees?.baseFeeMultiplier=="function"?n.fees.baseFeeMultiplier({block:r,client:e,request:o}):n?.fees?.baseFeeMultiplier??1.2)();if(i<1)throw new Jo;let c=10**(i.toString().split(".")[1]?.length??0),u=l=>l*BigInt(Math.ceil(i*c))/BigInt(c),f=r||await $(e,Ge,"getBlock")({});if(typeof n?.fees?.estimateFeesPerGas=="function"){let l=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:u,request:o,type:s});if(l!==null)return l}if(s==="eip1559"){if(typeof f.baseFeePerGas!="bigint")throw new Kr;let l=typeof o?.maxPriorityFeePerGas=="bigint"?o.maxPriorityFeePerGas:await Vl(e,{block:f,chain:n,request:o}),p=u(f.baseFeePerGas);return{maxFeePerGas:o?.maxFeePerGas??p+l,maxPriorityFeePerGas:l}}return{gasPrice:o?.gasPrice??u(await $(e,Da,"getGasPrice")({}))}}var Kl=m(()=>{Fa();ee();Wl();Yo();Nd()});function Zt(e){let{blockHash:t,blockNumber:r,blockTag:n,requireCanonical:o}=e;if(o!==void 0&&!t)throw new T("`requireCanonical` can only be provided when `blockHash` is set.");return t?o?{blockHash:t,requireCanonical:o}:{blockHash:t}:typeof r=="bigint"?I(r):n??"latest"}var mi=m(()=>{W();F()});async function Xo(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),a=await e.request({method:"eth_getTransactionCount",params:[t,i]},{dedupe:typeof n=="bigint"||r!==void 0});return Z(a)}var Ou=m(()=>{mi();ve()});function Qo(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),n=typeof e.blobs[0]=="string"?e.blobs.map(s=>re(s)):e.blobs,o=[];for(let s of n)o.push(Uint8Array.from(t.blobToKzgCommitment(s)));return r==="bytes"?o:o.map(s=>K(s))}var Du=m(()=>{ue();F()});function es(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),n=typeof e.blobs[0]=="string"?e.blobs.map(i=>re(i)):e.blobs,o=typeof e.commitments[0]=="string"?e.commitments.map(i=>re(i)):e.commitments,s=[];for(let i=0;i<n.length;i++){let a=n[i],c=o[i];s.push(Uint8Array.from(t.computeBlobKzgProof(a,c)))}return r==="bytes"?s:s.map(i=>K(i))}var qu=m(()=>{ue();F()});var X6,Q6=m(()=>{hl();X6=ai});function Md(e,t){let r=t||"hex",n=X6(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:me(n)}var Zl=m(()=>{Q6();ut();ue();F()});function qa(e){let{commitment:t,version:r=1}=e,n=e.to??(typeof t=="string"?"hex":"bytes"),o=Md(t,"bytes");return o.set([r],0),n==="bytes"?o:K(o)}var zd=m(()=>{F();Zl()});function ja(e){let{commitments:t,version:r}=e,n=e.to??(typeof t[0]=="string"?"hex":"bytes"),o=[];for(let s of t)o.push(qa({commitment:s,to:n,version:r}));return o}var _d=m(()=>{zd()});var Ud,Ga,Ld,Fd,Jl=m(()=>{W();Ud=class extends T{constructor({maxSize:t,size:r}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${r} bytes`],name:"BlobSizeTooLargeError"})}},Ga=class extends T{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}},Ld=class extends T{constructor({hash:t,size:r}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${r}`],name:"InvalidVersionedHashSizeError"})}},Fd=class extends T{constructor({hash:t,version:r}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${1}`,`Received: ${r}`],name:"InvalidVersionedHashVersionError"})}}});function Od(e){let t=e.to??(typeof e.data=="string"?"hex":"bytes"),r=typeof e.data=="string"?re(e.data):e.data,n=J(r);if(!n)throw new Ga;if(n>761855)throw new Ud({maxSize:761855,size:n});let o=[],s=!0,i=0;for(;s;){let a=vr(new Uint8Array(131072)),c=0;for(;c<4096;){let u=r.slice(i,i+31);if(a.pushByte(0),a.pushBytes(u),u.length<31){a.pushByte(128),s=!1;break}c++,i+=31}o.push(a)}return t==="bytes"?o.map(a=>a.bytes):o.map(a=>K(a.bytes))}var Yl=m(()=>{Jl();la();et();ue();F()});function ts(e){let{data:t,kzg:r,to:n}=e,o=e.blobs??Od({data:t,to:n}),s=e.commitments??Qo({blobs:o,kzg:r,to:n}),i=e.proofs??es({blobs:o,commitments:s,kzg:r,to:n}),a=[];for(let c=0;c<o.length;c++)a.push({blob:o[c],commitment:s[c],proof:i[c]});return a}var ju=m(()=>{Du();qu();Yl()});function Va(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Ea({transaction:e})}var Dd=m(()=>{lt()});function rs(e,{docsPath:t,...r}){let n=(()=>{let o=Vo(e,r);return o instanceof Rt?e:o})();return new Pa(n,{docsPath:t,...r})}var Gu=m(()=>{Wr();lt();_u()});async function Ve(e){let t=await e.request({method:"eth_chainId"},{dedupe:!0});return Z(t)}var kn=m(()=>{ve()});async function Wa(e,t){let{account:r=e.account,accessList:n,authorizationList:o,chain:s=e.chain,blobVersionedHashes:i,blobs:a,data:c,gas:u,gasPrice:f,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:p,nonce:h,nonceManager:y,to:g,type:v,value:E,...x}=t,b=await(async()=>{if(!r||!y||typeof h<"u")return h;let B=G(r),R=s?s.id:await $(e,Ve,"getChainId")({});return await y.consume({address:B.address,chainId:R,client:e})})();_e(t);let w=s?.formatters?.transactionRequest?.format,P=(w||Be)({...$t(x,{format:w}),account:r?G(r):void 0,accessList:n,authorizationList:o,blobs:a,blobVersionedHashes:i,data:c,gas:u,gasPrice:f,maxFeePerBlobGas:d,maxFeePerGas:l,maxPriorityFeePerGas:p,nonce:b,to:g,type:v,value:E},"fillTransaction");try{let B=await e.request({method:"eth_fillTransaction",params:[P]}),S=(s?.formatters?.transaction?.format||Bn)(B.tx);delete S.blockHash,delete S.blockNumber,delete S.r,delete S.s,delete S.transactionIndex,delete S.v,delete S.yParity,S.data=S.input,S.gas&&(S.gas=t.gas??S.gas),S.gasPrice&&(S.gasPrice=t.gasPrice??S.gasPrice),S.maxFeePerBlobGas&&(S.maxFeePerBlobGas=t.maxFeePerBlobGas??S.maxFeePerBlobGas),S.maxFeePerGas&&(S.maxFeePerGas=t.maxFeePerGas??S.maxFeePerGas),S.maxPriorityFeePerGas&&(S.maxPriorityFeePerGas=t.maxPriorityFeePerGas??S.maxPriorityFeePerGas),typeof S.nonce<"u"&&(S.nonce=t.nonce??S.nonce);let M=await(async()=>{if(typeof s?.fees?.baseFeeMultiplier=="function"){let C=await $(e,Ge,"getBlock")({});return s.fees.baseFeeMultiplier({block:C,client:e,request:t})}return s?.fees?.baseFeeMultiplier??1.2})();if(M<1)throw new Jo;let _=10**(M.toString().split(".")[1]?.length??0),N=C=>C*BigInt(Math.ceil(M*_))/BigInt(_);return S.feePayerSignature||(S.maxFeePerGas&&!t.maxFeePerGas&&(S.maxFeePerGas=N(S.maxFeePerGas)),S.gasPrice&&!t.gasPrice&&(S.gasPrice=N(S.gasPrice))),{raw:B.raw,transaction:{from:P.from,...S},...B.capabilities?{capabilities:B.capabilities}:{}}}catch(B){throw rs(B,{...t,chain:e.chain})}}var qd=m(()=>{be();Fa();Gu();Wo();Oa();Sr();ee();Ir();Yo();kn()});async function Jr(e,t){let r=t;r.account??(r.account=e.account),r.parameters??(r.parameters=Vu);let{account:n,chain:o=e.chain,nonceManager:s,parameters:i}=r,a=(()=>{if(typeof o?.prepareTransactionRequest=="function")return{fn:o.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(o?.prepareTransactionRequest))return{fn:o.prepareTransactionRequest[0],runAt:o.prepareTransactionRequest[1].runAt}})(),c;async function u(){return c||(typeof r.chainId<"u"?r.chainId:o?o.id:(c=await $(e,Ve,"getChainId")({}),c))}let f=n&&G(n),d=r.nonce;if(i.includes("nonce")&&typeof d>"u"&&f&&s){let b=await u();d=await s.consume({address:f.address,chainId:b,client:e})}a?.fn&&a.runAt?.includes("beforeFillTransaction")&&(r=await a.fn({...r,chain:o},{client:e,phase:"beforeFillTransaction"}),d??(d=r.nonce));let p=((i.includes("blobVersionedHashes")||i.includes("sidecars"))&&r.kzg&&r.blobs||Xl.get(e.uid)===!1||!["fees","gas"].some(w=>i.includes(w))?!1:!!(i.includes("chainId")&&typeof r.chainId!="number"||i.includes("nonce")&&typeof d!="number"||i.includes("fees")&&typeof r.gasPrice!="bigint"&&(typeof r.maxFeePerGas!="bigint"||typeof r.maxPriorityFeePerGas!="bigint")||i.includes("gas")&&typeof r.gas!="bigint"))?await $(e,Wa,"fillTransaction")({...r,nonce:d}).then(b=>{let{chainId:w,from:A,gas:P,gasPrice:B,nonce:R,maxFeePerBlobGas:S,maxFeePerGas:M,maxPriorityFeePerGas:z,type:_,...N}=b.transaction;return Xl.set(e.uid,!0),{...r,...A?{from:A}:{},..._&&!r.type?{type:_}:{},...typeof w<"u"?{chainId:w}:{},...typeof P<"u"?{gas:P}:{},...typeof B<"u"?{gasPrice:B}:{},...typeof R<"u"?{nonce:R}:{},...typeof S<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerBlobGas:S}:{},...typeof M<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerGas:M}:{},...typeof z<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxPriorityFeePerGas:z}:{},..."nonceKey"in N&&typeof N.nonceKey<"u"?{nonceKey:N.nonceKey}:{},..."keyAuthorization"in N&&typeof N.keyAuthorization<"u"&&N.keyAuthorization!==null&&!("keyAuthorization"in r)?{keyAuthorization:N.keyAuthorization}:{},..."feePayerSignature"in N&&typeof N.feePayerSignature<"u"&&N.feePayerSignature!==null?{feePayerSignature:N.feePayerSignature}:{},..."feeToken"in N&&typeof N.feeToken<"u"&&N.feeToken!==null&&!("feeToken"in r)?{feeToken:N.feeToken}:{},...b.capabilities?{_capabilities:b.capabilities}:{}}}).catch(b=>{let w=b;if(w.name!=="TransactionExecutionError")return r;if(w.walk?.(B=>B.name==="ExecutionRevertedError"))throw b;return w.walk?.(B=>{let R=B;return R.name==="MethodNotFoundRpcError"||R.name==="MethodNotSupportedRpcError"||R.message?.includes("eth_fillTransaction is not available")})&&Xl.set(e.uid,!1),r}):r;d??(d=p.nonce),r={...p,...f?{from:f?.address}:{},...typeof d<"u"?{nonce:d}:{}};let{blobs:h,gas:y,kzg:g,type:v}=r;a?.fn&&a.runAt?.includes("beforeFillParameters")&&(r=await a.fn({...r,chain:o},{client:e,phase:"beforeFillParameters"}));let E;async function x(){return E||(E=await $(e,Ge,"getBlock")({blockTag:"latest"}),E)}if(i.includes("nonce")&&typeof d>"u"&&f&&!s&&(r.nonce=await $(e,Xo,"getTransactionCount")({address:f.address,blockTag:"pending"})),(i.includes("blobVersionedHashes")||i.includes("sidecars"))&&h&&g){let b=Qo({blobs:h,kzg:g});if(i.includes("blobVersionedHashes")){let w=ja({commitments:b,to:"hex"});r.blobVersionedHashes=w}if(i.includes("sidecars")){let w=es({blobs:h,commitments:b,kzg:g}),A=ts({blobs:h,commitments:b,proofs:w,to:"hex"});r.sidecars=A}}if(i.includes("chainId")&&(r.chainId=await u()),(i.includes("fees")||i.includes("type"))&&typeof v>"u")try{r.type=Va(r)}catch{let b=e5.get(e.uid);typeof b>"u"&&(b=typeof(await x())?.baseFeePerGas=="bigint",e5.set(e.uid,b)),r.type=b?"eip1559":"legacy"}if(i.includes("fees"))if(r.type!=="legacy"&&r.type!=="eip2930"){if(typeof r.maxFeePerGas>"u"||typeof r.maxPriorityFeePerGas>"u"){let b=await x(),{maxFeePerGas:w,maxPriorityFeePerGas:A}=await Hd(e,{block:b,chain:o,request:r});if(typeof r.maxPriorityFeePerGas>"u"&&r.maxFeePerGas&&r.maxFeePerGas<A)throw new La({maxPriorityFeePerGas:A});r.maxPriorityFeePerGas=A,r.maxFeePerGas=w}}else{if(typeof r.maxFeePerGas<"u"||typeof r.maxPriorityFeePerGas<"u")throw new Kr;if(typeof r.gasPrice>"u"){let b=await x(),{gasPrice:w}=await Hd(e,{block:b,chain:o,request:r,type:"legacy"});r.gasPrice=w}}return i.includes("gas")&&typeof y>"u"&&(r.gas=await $(e,Za,"estimateGas")({...r,account:f,prepare:f?.type==="local"?[]:["blobVersionedHashes"]})),a?.fn&&a.runAt?.includes("afterFillParameters")&&(r=await a.fn({...r,chain:o},{client:e,phase:"afterFillParameters"})),_e(r),delete r.parameters,r}var Vu,e5,Xl,Ka=m(()=>{be();Kl();jd();Yo();Ou();Fa();Du();qu();_d();ju();ee();to();Ir();Dd();qd();kn();Vu=["blobVersionedHashes","chainId","fees","gas","nonce","type"],e5=new Map,Xl=new rt(128)});async function Za(e,t){let{account:r=e.account,prepare:n=!0}=t,o=r?G(r):void 0,s=(()=>{if(Array.isArray(n))return n;if(o?.type!=="local")return["blobVersionedHashes"]})();try{let i=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await _o({authorization:t.authorizationList[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`")})})(),{accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:f,blockNumber:d,blockTag:l,data:p,gas:h,gasPrice:y,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:x,value:b,stateOverride:w,...A}=n?await Jr(e,{...t,parameters:s,to:i}):t;if(h&&t.gas!==h)return h;let B=(typeof d=="bigint"?I(d):void 0)||l,R=Ua(w);_e(t);let S=e.chain?.formatters?.transactionRequest?.format,z=(S||Be)({...$t(A,{format:S}),account:o,accessList:a,authorizationList:c,blobs:u,blobVersionedHashes:f,data:p,gasPrice:y,maxFeePerBlobGas:g,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:x,to:i,value:b},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:R?[z,B??e.experimental_blockTag??"latest",R]:B?[z,B]:[z]}))}catch(i){throw ng(i,{...t,account:o,chain:e.chain})}}var jd=m(()=>{be();W();zu();F();og();Wo();Sr();Cd();Ir();Ka()});async function ns(e,t){let{abi:r,address:n,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...a}=t,c=ne({abi:r,args:o,functionName:s});try{return await $(e,Za,"estimateGas")({data:`${c}${i?i.replace("0x",""):""}`,to:n,...a})}catch(u){let f=a.account?G(a.account):void 0;throw ht(u,{abi:r,address:n,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:f?.address})}}var Wu=m(()=>{be();Ze();Ro();ee();jd()});function de(e,t){if(!Q(e,{strict:!1}))throw new ae({address:e});if(!Q(t,{strict:!1}))throw new ae({address:t});return e.toLowerCase()===t.toLowerCase()}var Jt=m(()=>{rr();pt()});function Ue(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}var Yr=m(()=>{});function Cn(e){let{abi:t,data:r,strict:n,topics:o}=e,s=n??!0,[i,...a]=o;if(!i)throw new Zi({docsPath:t5});let c=t.find(v=>v.type==="event"&&i===xr(Fe(v)));if(!(c&&"name"in c)||c.type!=="event")throw new Ji(i,{docsPath:t5});let{name:u,inputs:f}=c,d=f?.some(v=>!("name"in v&&v.name)),l=d?[]:{},p=f.map((v,E)=>[v,E]).filter(([v])=>"indexed"in v&&v.indexed),h=[];for(let v=0;v<p.length;v++){let[E,x]=p[v],b=a[v];if(!b){if(s)throw new zr({abiItem:c,param:E});h.push([E,x]);continue}l[d?x:E.name||x]=B9({param:E,value:b})}let y=f.filter(v=>!("indexed"in v&&v.indexed)),g=s?y:[...h.map(([v])=>v),...y];if(g.length>0){if(r&&r!=="0x")try{let v=mt(g,r);if(v){let E=0;if(!s)for(let[x,b]of h)l[d?b:x.name||b]=v[E++];if(d)for(let x=0;x<f.length;x++)l[x]===void 0&&E<v.length&&(l[x]=v[E++]);else for(let x=0;x<y.length;x++)l[y[x].name]=v[E++]}}catch(v){if(s)throw v instanceof Wn||v instanceof ma?new yr({abiItem:c,data:r,params:g,size:J(r)}):v}else if(s)throw new yr({abiItem:c,data:"0x",params:g,size:0})}return{eventName:u,args:Object.values(l).length>0?l:void 0}}function B9({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(mt([e],t)||[])[0]}var t5,Ku=m(()=>{le();cl();et();ua();no();cn();t5="/docs/contract/decodeEventLog"});function ur(e){let{abi:t,args:r,logs:n,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),i=t.filter(a=>a.type==="event").map(a=>({abi:a,selector:xr(a)}));return n.map(a=>{let c=typeof a.blockNumber=="string"?Ue(a):a,u=i.filter(l=>c.topics[0]===l.selector);if(u.length===0)return null;let f,d;for(let l of u)try{f=Cn({...c,abi:[l.abi],strict:!0}),d=l;break}catch{}if(!f&&!o){d=u[0];try{f=Cn({data:c.data,topics:c.topics,abi:[d.abi],strict:!1})}catch{let l=d.abi.inputs?.some(p=>!("name"in p&&p.name));return{...c,args:l?[]:{},eventName:d.abi.name}}}return!f||!d||s&&!s.includes(f.eventName)||!k9({args:f.args,inputs:d.abi.inputs,matchArgs:r})?null:{...f,...c}}).filter(Boolean)}function k9(e){let{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function o(s,i,a){try{return s.type==="address"?de(i,a):s.type==="string"||s.type==="bytes"?te(Ee(i))===a:i===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((s,i)=>{if(s==null)return!0;let a=r[i];return a?(Array.isArray(s)?s:[s]).some(u=>o(a,u,t[i])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof n=="object"&&!Array.isArray(n)?Object.entries(n).every(([s,i])=>{if(i==null)return!0;let a=r.find(u=>u.name===s);return a?(Array.isArray(i)?i:[i]).some(u=>o(a,u,t[s])):!1}):!1}var li=m(()=>{Jt();ue();Yr();St();ua();Ku()});async function Ja(e,{address:t,blockHash:r,fromBlock:n,toBlock:o,event:s,events:i,args:a,strict:c}={}){let u=c??!1,f=i??(s?[s]:void 0),d=[];f&&(d=[f.flatMap(y=>nr({abi:[y],eventName:y.name,args:i?void 0:a}))],s&&(d=d[0]));let l;r?l=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):l=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof n=="bigint"?I(n):n,toBlock:typeof o=="bigint"?I(o):o}]});let p=l.map(h=>Ue(h));return f?ur({abi:f,args:a,logs:p,strict:u}):p}var Gd=m(()=>{ti();li();F();Yr()});async function Ya(e,t){let{abi:r,address:n,args:o,blockHash:s,eventName:i,fromBlock:a,toBlock:c,strict:u}=t,f=i?nt({abi:r,name:i}):void 0,d=f?void 0:r.filter(l=>l.type==="event");return $(e,Ja,"getLogs")({address:n,args:o,blockHash:s,event:f,events:d,fromBlock:a,toBlock:c,strict:u})}var Vd=m(()=>{hn();ee();Gd()});function Le(e){let{abi:t,args:r,functionName:n,data:o}=e,s=t[0];if(n){let a=nt({abi:t,args:r,name:n});if(!a)throw new Ot(n,{docsPath:Ql});s=a}if(s.type!=="function")throw new Ot(void 0,{docsPath:Ql});if(!s.outputs)throw new Jn(s.name,{docsPath:Ql});let i=mt(s.outputs,o);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}var Ql,Br=m(()=>{le();no();hn();Ql="/docs/contract/decodeFunctionResult"});var r5,n5=m(()=>{r5="0.1.1"});function o5(){return r5}var s5=m(()=>{n5()});function i5(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?i5(e.cause,t):t?null:e}var D,Nt=m(()=>{s5();D=class e extends Error{static setStaticOptions(t){e.prototype.docsOrigin=t.docsOrigin,e.prototype.showVersion=t.showVersion,e.prototype.version=t.version}constructor(t,r={}){let n=(()=>{if(r.cause instanceof e){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:r.cause?.message?r.cause.message:r.details})(),o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=r.docsOrigin??e.prototype.docsOrigin,i=`${s}${o??""}`,a=!!(r.version??e.prototype.showVersion),c=r.version??e.prototype.version,u=[t||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||o||a?["",n?`Details: ${n}`:void 0,o?`See: ${i}`:void 0,a?`Version: ${c}`:void 0]:[]].filter(f=>typeof f=="string").join(`
42
+ `);super(u,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{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,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=r.cause,this.details=n,this.docs=i,this.docsOrigin=s,this.docsPath=o,this.shortMessage=t,this.showVersion=a,this.version=c}walk(t){return i5(this,t)}};Object.defineProperty(D,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${o5()}`}});D.setStaticOptions(D.defaultStaticOptions)});function Xa(e,t){if(fr(e)>t)throw new Wd({givenSize:fr(e),maxSize:t})}function a5(e,t){if(typeof t=="number"&&t>0&&t>fr(e)-1)throw new Zu({offset:t,position:"start",size:fr(e)})}function c5(e,t,r){if(typeof t=="number"&&typeof r=="number"&&fr(e)!==r-t)throw new Zu({offset:r,position:"end",size:fr(e)})}function eh(e){if(e>=Rn.zero&&e<=Rn.nine)return e-Rn.zero;if(e>=Rn.A&&e<=Rn.F)return e-(Rn.A-10);if(e>=Rn.a&&e<=Rn.f)return e-(Rn.a-10)}function u5(e,t={}){let{dir:r,size:n=32}=t;if(n===0)return e;if(e.length>n)throw new Kd({size:e.length,targetSize:n,type:"Bytes"});let o=new Uint8Array(n);for(let s=0;s<n;s++){let i=r==="right";o[i?s:n-s-1]=e[i?s:e.length-s-1]}return o}function th(e,t={}){let{dir:r="left"}=t,n=e,o=0;for(let s=0;s<n.length-1&&n[r==="left"?s:n.length-s-1].toString()==="0";s++)o++;return n=r==="left"?n.slice(o):n.slice(0,n.length-o),n}var Rn,f5=m(()=>{os();Rn={zero:48,nine:57,A:65,F:70,a:97,f:102}});function Qa(e,t){if(xe(e)>t)throw new Zd({givenSize:xe(e),maxSize:t})}function d5(e,t){if(typeof t=="number"&&t>0&&t>xe(e)-1)throw new Ju({offset:t,position:"start",size:xe(e)})}function p5(e,t,r){if(typeof t=="number"&&typeof r=="number"&&xe(e)!==r-t)throw new Ju({offset:r,position:"end",size:xe(e)})}function rh(e,t={}){let{dir:r,size:n=32}=t;if(n===0)return e;let o=e.replace("0x","");if(o.length>n*2)throw new Jd({size:Math.ceil(o.length/2),targetSize:n,type:"Hex"});return`0x${o[r==="right"?"padEnd":"padStart"](n*2,"0")}`}function m5(e,t={}){let{dir:r="left"}=t,n=e.replace("0x",""),o=0;for(let s=0;s<n.length-1&&n[r==="left"?s:n.length-s-1].toString()==="0";s++)o++;return n=r==="left"?n.slice(o):n.slice(0,n.length-o),n==="0"?"0x":r==="right"&&n.length%2===1?`0x${n}0`:`0x${n}`}var nh=m(()=>{We()});function ss(e,t,r){return JSON.stringify(e,(n,o)=>typeof t=="function"?t(n,o):typeof o=="bigint"?o.toString()+R9:o,r)}var R9,Yu=m(()=>{R9="#__bigint"});function H9(e){if(!(e instanceof Uint8Array)){if(!e)throw new ec(e);if(typeof e!="object")throw new ec(e);if(!("BYTES_PER_ELEMENT"in e))throw new ec(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new ec(e)}}function h5(e){return e instanceof Uint8Array?e:typeof e=="string"?tc(e):M9(e)}function M9(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function tc(e,t={}){let{size:r}=t,n=e;r&&(Qa(e,r),n=Qr(e,r));let o=n.slice(2);o.length%2&&(o=`0${o}`);let s=o.length/2,i=new Uint8Array(s);for(let a=0,c=0;a<s;a++){let u=eh(o.charCodeAt(c++)),f=eh(o.charCodeAt(c++));if(u===void 0||f===void 0)throw new D(`Invalid byte sequence ("${o[c-2]}${o[c-1]}" in "${o}").`);i[a]=u<<4|f}return i}function y5(e,t={}){let{size:r}=t,n=N9.encode(e);return typeof r=="number"?(Xa(n,r),z9(n,r)):n}function z9(e,t){return u5(e,{dir:"right",size:t})}function fr(e){return e.length}function b5(e,t,r,n={}){let{strict:o}=n;a5(e,t);let s=e.slice(t,r);return o&&c5(s,t,r),s}function x5(e,t={}){let{size:r}=t;typeof r<"u"&&Xa(e,r);let n=ke(e,t);return ih(n,t)}function g5(e,t={}){let{size:r}=t,n=e;if(typeof r<"u"&&(Xa(n,r),n=sh(n)),n.length>1||n[0]>1)throw new oh(n);return!!n[0]}function Xr(e,t={}){let{size:r}=t;typeof r<"u"&&Xa(e,r);let n=ke(e,t);return Xd(n,t)}function w5(e,t={}){let{size:r}=t,n=e;return typeof r<"u"&&(Xa(n,r),n=_9(n)),$9.decode(n)}function sh(e){return th(e,{dir:"left"})}function _9(e){return th(e,{dir:"right"})}function v5(e){try{return H9(e),!0}catch{return!1}}var $9,N9,oh,ec,Wd,Zu,Kd,os=m(()=>{Nt();We();f5();nh();Yu();$9=new TextDecoder,N9=new TextEncoder;oh=class extends D{constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}},ec=class extends D{constructor(t){super(`Value \`${typeof t=="object"?ss(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}},Wd=class extends D{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Zu=class extends D{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}},Kd=class extends D{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}});function F9(e,t={}){let{strict:r=!1}=t;if(!e)throw new Qd(e);if(typeof e!="string")throw new Qd(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e))throw new ep(e);if(!e.startsWith("0x"))throw new ep(e)}function Te(...e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function rc(e){return e instanceof Uint8Array?ke(e):Array.isArray(e)?ke(new Uint8Array(e)):e}function tp(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(Qa(r,t.size),$n(r,t.size)):r}function ke(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=L9[e[o]];let n=`0x${r}`;return typeof t.size=="number"?(Qa(n,t.size),Qr(n,t.size)):n}function se(e,t={}){let{signed:r,size:n}=t,o=BigInt(e),s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<i){let u=typeof e=="bigint"?"n":"";throw new Xu({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:r,size:n,value:`${e}${u}`})}let c=`0x${(r&&o<0?BigInt.asUintN(n*8,BigInt(o)):o).toString(16)}`;return n?$n(c,n):c}function nc(e,t={}){return ke(U9.encode(e),t)}function $n(e,t){return rh(e,{dir:"left",size:t})}function Qr(e,t){return rh(e,{dir:"right",size:t})}function ge(e,t,r,n={}){let{strict:o}=n;d5(e,t);let s=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&p5(s,t,r),s}function xe(e){return Math.ceil((e.length-2)/2)}function ah(e){return m5(e,{dir:"left"})}function ih(e,t={}){let{signed:r}=t;t.size&&Qa(e,t.size);let n=BigInt(e);if(!r)return n;let o=(e.length-2)/2,s=(1n<<BigInt(o)*8n)-1n,i=s>>1n;return n<=i?n:n-s-1n}function Xd(e,t={}){let{signed:r,size:n}=t;return Number(!r&&!n?e:ih(e,t))}function Qu(e,t={}){let{strict:r=!1}=t;try{return F9(e,{strict:r}),!0}catch{return!1}}var U9,L9,Xu,Qd,ep,Zd,Ju,Jd,We=m(()=>{Nt();nh();Yu();U9=new TextEncoder,L9=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));Xu=class extends D{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${n?" signed":" unsigned"} integer range ${t?`(\`${r}\` to \`${t}\`)`:`(above \`${r}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},Qd=class extends D{constructor(t){super(`Value \`${typeof t=="object"?ss(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}},ep=class extends D{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},Zd=class extends D{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Ju=class extends D{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},Jd=class extends D{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}});function E5(e){return{address:e.address,amount:se(e.amount),index:se(e.index),validatorIndex:se(e.validatorIndex)}}var A5=m(()=>{We()});function rp(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:se(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:se(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:se(e.gasLimit)},...typeof e.number=="bigint"&&{number:se(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:se(e.prevRandao)},...typeof e.time=="bigint"&&{time:se(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(E5)}}}var ch=m(()=>{We();A5()});var dr,is,P5,np,S5,uh,fh,dh,oc,Ce,I5,B5,k5,C5,Ke=m(()=>{dr=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],is=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],P5=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],np=[...P5,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],S5=[...P5,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],uh=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],fh=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],dh=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],oc=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Ce=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],I5=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],B5=[{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC1155InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC1155InvalidApprover",type:"error"},{inputs:[{internalType:"uint256",name:"idsLength",type:"uint256"},{internalType:"uint256",name:"valuesLength",type:"uint256"}],name:"ERC1155InvalidArrayLength",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC1155InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC1155InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC1155InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC1155MissingApprovalForAll",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"values",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}],k5=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"event",name:"ApprovalForAll",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"operator",type:"address"},{indexed:!1,name:"approved",type:"bool"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"payable",inputs:[{name:"spender",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"getApproved",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"isApprovedForAll",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"operator",type:"address"}],outputs:[{type:"bool"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"owner",type:"address"}]},{type:"function",name:"safeTransferFrom",stateMutability:"payable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]},{type:"function",name:"setApprovalForAll",stateMutability:"nonpayable",inputs:[{name:"operator",type:"address"},{name:"approved",type:"bool"}],outputs:[]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{name:"tokenId",type:"uint256"}]},{type:"function",name:"tokenURI",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transferFrom",stateMutability:"payable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]}],C5=[{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!0,name:"owner",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],name:"allowance",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],name:"approve",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"}],name:"deposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxDeposit",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxMint",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxRedeem",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"}],name:"mint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewMint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"redeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalAssets",outputs:[{name:"totalManagedAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"withdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}]});var R5,$5=m(()=>{R5="0x82ad56cb"});var sc,op,ef,ic,ac=m(()=>{sc="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",op="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",ef="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",ic="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033"});var Nn,cc,uc,yi,Hn,fc=m(()=>{W();Nn=class extends T{constructor({blockNumber:t,chain:r,contract:n}){super(`Chain "${r.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...t&&n.blockCreated&&n.blockCreated>t?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${n.name}" configured.`]],name:"ChainDoesNotSupportContract"})}},cc=class extends T{constructor({chain:t,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${t.id} \u2013 ${t.name}).`,{metaMessages:[`Current Chain ID: ${r}`,`Expected Chain ID: ${t.id} \u2013 ${t.name}`],name:"ChainMismatchError"})}},uc=class extends T{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
43
+ `),{name:"ChainNotFoundError"})}},yi=class extends T{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}},Hn=class extends T{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}});function Mn(e){let{abi:t,args:r,bytecode:n}=e;if(!r||r.length===0)return n;let o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Vn({docsPath:ph});if(!("inputs"in o))throw new Mr({docsPath:ph});if(!o.inputs||o.inputs.length===0)throw new Mr({docsPath:ph});let s=Oe(o.inputs,r);return Ae([n,s])}var ph,tf=m(()=>{le();Me();wr();ph="/docs/contract/encodeDeployData"});function Ht({blockNumber:e,chain:t,contract:r}){let n=t?.contracts?.[r];if(!n)throw new Nn({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new Nn({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}var as=m(()=>{fc()});function sp(e,{docsPath:t,...r}){let n=(()=>{let o=Vo(e,r);return o instanceof Rt?e:o})();return new uo(n,{docsPath:t,...r})}var mh=m(()=>{xn();Wr();_u()});function dc(){let e=()=>{},t=()=>{};return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var ip=m(()=>{});function pc({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){let s=async()=>{let f=c();i();let d=f.map(({args:l})=>l);d.length!==0&&e(d).then(l=>{o&&Array.isArray(l)&&l.sort(o);for(let p=0;p<f.length;p++){let{resolve:h}=f[p];h?.([l[p],l])}}).catch(l=>{for(let p=0;p<f.length;p++){let{reject:h}=f[p];h?.(l)}})},i=()=>lh.delete(t),a=()=>c().map(({args:f})=>f),c=()=>lh.get(t)||[],u=f=>lh.set(t,[...c(),f]);return{flush:i,async schedule(f){let{promise:d,resolve:l,reject:p}=dc();return r?.([...a(),f])&&s(),c().length>0?(u({args:f,resolve:l,reject:p}),d):(u({args:f,resolve:l,reject:p}),setTimeout(s,n),d)}}}var lh,ap=m(()=>{ip();lh=new Map});var cp,up,fp,N5=m(()=>{Je();W();Er();cp=class extends T{constructor({callbackSelector:t,cause:r,data:n,extraData:o,sender:s,urls:i}){super(r.shortMessage||"An error occurred while fetching for an offchain result.",{cause:r,metaMessages:[...r.metaMessages||[],r.metaMessages?.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map(a=>` ${yn(a)}`)],` Sender: ${s}`,` Data: ${n}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}},up=class extends T{constructor({result:t,url:r}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${yn(r)}`,`Response: ${Y(t)}`],name:"OffchainLookupResponseMalformedError"})}},fp=class extends T{constructor({sender:t,to:r}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${r}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}}});function dp(e){let{abi:t,data:r}=e,n=De(r,0,4),o=t.find(s=>s.type==="function"&&n===Gt(Fe(s)));if(!o)throw new Yi(n,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:o.name,args:"inputs"in o&&o.inputs&&o.inputs.length>0?mt(o.inputs,De(r,4)):void 0}}var hh=m(()=>{le();jt();ei();no();cn()});function rf(e){let{abi:t,errorName:r,args:n}=e,o=t[0];if(r){let c=nt({abi:t,args:n,name:r});if(!c)throw new Gs(r,{docsPath:yh});o=c}if(o.type!=="error")throw new Gs(void 0,{docsPath:yh});let s=Fe(o),i=Gt(s),a="0x";if(n&&n.length>0){if(!o.inputs)throw new Ki(o.name,{docsPath:yh});a=Oe(o.inputs,n)}return Ae([i,a])}var yh,bh=m(()=>{le();Me();ei();wr();cn();hn();yh="/docs/contract/encodeErrorResult"});function pp(e){let{abi:t,functionName:r,result:n}=e,o=t[0];if(r){let i=nt({abi:t,name:r});if(!i)throw new Ot(r,{docsPath:xh});o=i}if(o.type!=="function")throw new Ot(void 0,{docsPath:xh});if(!o.outputs)throw new Jn(o.name,{docsPath:xh});let s=(()=>{if(o.outputs.length===0)return[];if(o.outputs.length===1)return[n];if(Array.isArray(n))return n;throw new Xn(n)})();return Oe(o.outputs,s)}var xh,gh=m(()=>{le();wr();hn();xh="/docs/contract/encodeFunctionResult"});async function wh(e){let{data:t,ccipRequest:r}=e,{args:[n]}=dp({abi:is,data:t}),o=[],s=[];return await Promise.all(n.map(async(i,a)=>{try{s[a]=i.urls.includes(kr)?await wh({data:i.data,ccipRequest:r}):await r(i),o[a]=!1}catch(c){o[a]=!0,s[a]=D9(c)}})),pp({abi:is,functionName:"query",result:[o,s]})}function D9(e){return e.name==="HttpRequestError"&&e.status?rf({abi:is,errorName:"HttpError",args:[e.status,e.shortMessage]}):rf({abi:[pa],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}var kr,mc=m(()=>{Ke();xu();hh();bh();gh();kr="x-batch-gateway:true"});var H5={};Nr(H5,{ccipRequest:()=>bi,offchainLookup:()=>Eh,offchainLookupAbiItem:()=>mp,offchainLookupSignature:()=>vh});async function Eh(e,{blockNumber:t,blockTag:r,data:n,requestOptions:o,to:s}){let{args:i}=oo({data:n,abi:[mp]}),[a,c,u,f,d]=i,{ccipRead:l}=e,p=l&&typeof l?.request=="function"?l.request:bi;try{if(!de(s,a))throw new fp({sender:a,to:s});let h=c.includes(kr)?await wh({data:u,ccipRequest:g=>p({...g,requestOptions:o})}):await p({data:u,requestOptions:o,sender:a,urls:c}),{data:y}=await pr(e,{blockNumber:t,blockTag:r,data:ie([f,Oe([{type:"bytes"},{type:"bytes"}],[h,d])]),requestOptions:o,to:s});return y}catch(h){throw o?.signal?.aborted?Ye(o.signal):It(h)?h:new cp({callbackSelector:f,cause:h,data:n,extraData:d,sender:a,urls:c})}}async function bi({data:e,requestOptions:t,sender:r,urls:n}){let o=new Error("An unknown error occurred.");for(let s=0;s<n.length;s++){if(t?.signal?.aborted)throw Ye(t.signal);let i=n[s],a=i.includes("{data}")?"GET":"POST",c=a==="POST"?{data:e,sender:r}:void 0,u=a==="POST"?{"Content-Type":"application/json"}:{};try{let f=await fetch(i.replace("{sender}",r.toLowerCase()).replace("{data}",e),{body:JSON.stringify(c),headers:u,method:a,...t?.signal?{signal:t.signal}:{}}),d;if(f.headers.get("Content-Type")?.startsWith("application/json")?d=(await f.json()).data:d=await f.text(),!f.ok){o=new ot({body:c,details:d?.error?Y(d.error):f.statusText,headers:f.headers,status:f.status,url:i});continue}if(!O(d)){o=new up({result:d,url:i});continue}return d}catch(f){if(t?.signal?.aborted)throw Ye(t.signal);if(It(f))throw f;o=new ot({body:c,details:f.message,url:i})}}throw o}var vh,mp,lp=m(()=>{xi();N5();ar();Er();Tu();wr();Jt();Me();ut();mc();Je();vh="0x556f1830",mp={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]}});async function pr(e,t){let{account:r=e.account,authorizationList:n,batch:o=!!e.batch?.multicall,blockHash:s,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",requireCanonical:c,accessList:u,blobs:f,blockOverrides:d,code:l,data:p,factory:h,factoryData:y,gas:g,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:b,nonce:w,requestOptions:A,to:P,value:B,stateOverride:R,...S}=t,M=r?G(r):void 0;if(l&&(h||y))throw new T("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&P)throw new T("Cannot provide both `code` & `to` as parameters.");let z=l&&p,_=h&&y&&P&&p,N=z||_,C=z?_5({code:l,data:p}):_?K9({data:p,factory:h,factoryData:y,to:P}):p;try{_e(t);let k=Zt({blockHash:s,blockNumber:i,blockTag:a,requireCanonical:c}),U=d?rp(d):void 0,H=Ua(R),L=e.chain?.formatters?.transactionRequest?.format,X=(L||Be)({...$t(S,{format:L}),accessList:u,account:M,authorizationList:n,blobs:f,data:C,gas:g,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:b,nonce:w,to:N?void 0:P,value:B},"call");if(o&&q9({request:X})&&!U&&s===void 0)try{let{deployless:pe=!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},He=z5(e,{blockNumber:i,deployless:pe});if(!He||!W9(H,He))return await V9(e,{...X,blockHash:s,blockNumber:i,blockTag:a,multicallAddress:He,requestOptions:A,requireCanonical:c,rpcStateOverride:H})}catch(pe){if(!(pe instanceof yi)&&!(pe instanceof Nn))throw pe}let Ne=(()=>{let pe=[X,k];return H&&U?[...pe,H,U]:H?[...pe,H]:U?[...pe,{},U]:pe})(),vt=await e.request({method:"eth_call",params:Ne},A);return vt==="0x"?{data:void 0}:{data:vt}}catch(k){if(A?.signal?.aborted)throw Ye(A.signal);if(It(k))throw k;let U=Z9(k),{offchainLookup:H,offchainLookupSignature:L}=await Promise.resolve().then(()=>(lp(),H5));if(e.ccipRead!==!1&&U?.slice(0,10)===L&&P)return{data:await H(e,{data:U,requestOptions:A,to:P})};throw N&&U?.slice(0,10)==="0x101bb98d"?new Ba({factory:h}):sp(k,{...t,account:M,chain:e.chain})}}function q9({request:e}){let{data:t,to:r,...n}=e;return!(!t||t.startsWith(R5)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}function G9(e){if(!e)return"default";let t=M5.get(e);if(t!==void 0)return t;let r=j9++;return M5.set(e,r),r}async function V9(e,t){let{batchSize:r=1024,deployless:n=!1,wait:o=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockHash:s,blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",requireCanonical:c,data:u,multicallAddress:f,requestOptions:d,rpcStateOverride:l,to:p}=t,h=f!==void 0?f:z5(e,{blockNumber:i,deployless:n}),y=Zt({blockHash:s,blockNumber:i,blockTag:a,requireCanonical:c}),g=typeof y=="string"?y:JSON.stringify(y),v=l?`.${JSON.stringify(l)}`:"",{schedule:E}=pc({id:`${e.uid}.${g}.${G9(d)}${v}`,wait:o,shouldSplitBatch(w){return w.reduce((P,{data:B})=>P+(B.length-2),0)>r*2},fn:async w=>{let A=w.map(S=>({allowFailure:!0,callData:S.data,target:S.to})),P=ne({abi:dr,args:[A],functionName:"aggregate3"}),B={...h===null?{data:_5({code:ic,data:P})}:{to:h,data:P}},R=await e.request({method:"eth_call",params:l?[B,y,l]:[B,y]},d);return Le({abi:dr,args:[A],functionName:"aggregate3",data:R||"0x"})}}),[{returnData:x,success:b}]=await E({data:u,to:p});if(!b)throw new sr({data:x});return x==="0x"?{data:void 0}:{data:x}}function z5(e,t){let{blockNumber:r,deployless:n}=t;if(n)return null;if(e.chain)return Ht({blockNumber:r,chain:e.chain,contract:"multicall3"});throw new yi}function W9(e,t){return e?Object.keys(e).some(r=>de(r,t)):!1}function _5(e){let{code:t,data:r}=e;return Mn({abi:ji(["constructor(bytes, bytes)"]),bytecode:sc,args:[t,r]})}function K9(e){let{data:t,factory:r,factoryData:n,to:o}=e;return Mn({abi:ji(["constructor(address, bytes, address, bytes)"]),bytecode:op,args:[o,t,r,n]})}function Z9(e){if(!(e instanceof T))return;let t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}var j9,M5,xi=m(()=>{rd();ch();be();Ke();$5();ac();W();fc();xn();Er();Br();tf();Ze();Jt();mi();as();mh();Wo();Sr();ap();Cd();Ir();j9=0,M5=new WeakMap});async function oe(e,t){let{abi:r,address:n,args:o,functionName:s,...i}=t,a=ne({abi:r,args:o,functionName:s});try{let{data:c}=await $(e,pr,"call")({...i,data:a,to:n});return Le({abi:r,args:o,functionName:s,data:c||"0x"})}catch(c){throw ht(c,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}var it=m(()=>{Br();Ze();Ro();ee();xi()});async function cs(e,t){let{abi:r,address:n,args:o,functionName:s,dataSuffix:i=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,...a}=t,c=a.account?G(a.account):e.account,u=ne({abi:r,args:o,functionName:s});try{let{data:f}=await $(e,pr,"call")({batch:!1,data:`${u}${i?i.replace("0x",""):""}`,to:n,...a,account:c}),d=Le({abi:r,args:o,functionName:s,data:f||"0x"}),l=r.filter(p=>"name"in p&&p.name===t.functionName);return{result:d,request:{abi:l,address:n,args:o,dataSuffix:i,functionName:s,...a,account:c}}}catch(f){throw ht(f,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:c?.address})}}var nf=m(()=>{be();Br();Ze();Ro();ee();xi()});function at(e,t,r){let n=++J9,o=()=>hp.get(e)||[],s=()=>{let d=o().filter(l=>l.id!==n);if(d.length===0){hp.delete(e),Ah.delete(e);return}hp.set(e,d)},i=()=>{let f=o();if(!f.some(l=>l.id===n))return;let d=Ah.get(e);if(f.length===1&&d){let l=d();l instanceof Promise&&l.catch(()=>{})}s()},a=o();if(hp.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return i;let c={};for(let f in t)c[f]=((...d)=>{let l=o();if(l.length!==0)for(let p of l)p.fns[f]?.(...d)});let u=r(c);return typeof u=="function"&&Ah.set(e,u),i}var hp,Ah,J9,us=m(()=>{hp=new Map,Ah=new Map,J9=0});async function gi(e,{signal:t}={}){return new Promise((r,n)=>{if(t?.aborted){n(Ye(t));return}let o=()=>t?.removeEventListener("abort",i),s=setTimeout(()=>{o(),r()},e),i=()=>{clearTimeout(s),o(),n(Ye(t))};t?.addEventListener("abort",i,{once:!0})})}var yp=m(()=>{Er()});function mr(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0,s=()=>o=!1;return(async()=>{let a;t&&(a=await e({unpoll:s}));let c=await r?.(a)??n;await gi(c);let u=async()=>{o&&(await e({unpoll:s}),await gi(n),u())};u()})(),s}var wi=m(()=>{yp()});function U5(e){let t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:i=>s.set(o,i)}),r=t(e,Y9),n=t(e,X9);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function bp(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){let n=U5(t),o=n.response.get();if(o&&r>0&&Date.now()-o.created.getTime()<r)return o.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{let i=await s;return n.response.set({created:new Date,data:i}),i}finally{n.promise.clear()}}var Y9,X9,Th=m(()=>{Y9=new Map,X9=new Map});async function en(e,{cacheTime:t=e.cacheTime}={}){let r=await bp(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Q9(e.uid),cacheTime:t});return BigInt(r)}var Q9,lc=m(()=>{Th();Q9=e=>`blockNumber.${e}`});async function fs(e,{filter:t}){let r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof n[0]=="string")return n;let o=n.map(s=>Ue(s));return!("abi"in t)||!t.abi?o:ur({abi:t.abi,logs:o,strict:r})}var of=m(()=>{li();Yr()});async function ds(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}var sf=m(()=>{});function xp(e,t){let{abi:r,address:n,args:o,batch:s=!0,eventName:i,fromBlock:a,onError:c,onLogs:u,poll:f,pollingInterval:d=e.pollingInterval,strict:l}=t;return(typeof f<"u"?f:typeof a=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{let g=l??!1,v=Y(["watchContractEvent",n,o,s,e.uid,i,d,g,a]);return at(v,{onLogs:u,onError:c},E=>{let x;a!==void 0&&(x=a-1n);let b,w=!1,A=mr(async()=>{if(!w){try{b=await $(e,da,"createContractEventFilter")({abi:r,address:n,args:o,eventName:i,strict:g,fromBlock:a})}catch{}w=!0;return}try{let P;if(b)P=await $(e,fs,"getFilterChanges")({filter:b});else{let B=await $(e,en,"getBlockNumber")({});x&&x<B?P=await $(e,Ya,"getContractEvents")({abi:r,address:n,args:o,eventName:i,fromBlock:x+1n,toBlock:B,strict:g}):P=[],x=B}if(P.length===0)return;if(s)E.onLogs(P);else for(let B of P)E.onLogs([B])}catch(P){b&&P instanceof Bt&&(w=!1),E.onError?.(P)}},{emitOnBegin:!0,interval:d});return async()=>{b&&await $(e,ds,"uninstallFilter")({filter:b}),A()}})})():(()=>{let g=l??!1,v=Y(["watchContractEvent",n,o,s,e.uid,i,d,g]),E=!0,x=()=>E=!1;return at(v,{onLogs:u,onError:c},b=>((async()=>{try{let w=(()=>{if(e.transport.type==="fallback"){let B=e.transport.transports.find(R=>R.config.type==="webSocket"||R.config.type==="ipc");return B?B.value:e.transport}return e.transport})(),A=i?nr({abi:r,eventName:i,args:o}):[],{unsubscribe:P}=await w.subscribe({params:["logs",{address:n,topics:A}],onData(B){if(!E)return;let R=B.result;try{let{eventName:S,args:M}=Cn({abi:r,data:R.data,topics:R.topics,strict:l}),z=Ue(R,{args:M,eventName:S});b.onLogs([z])}catch(S){let M,z;if(S instanceof yr||S instanceof zr){if(l)return;M=S.abiItem.name,z=S.abiItem.inputs?.some(N=>!("name"in N&&N.name))}let _=Ue(R,{args:z?[]:{},eventName:M});b.onLogs([_])}},onError(B){b.onError?.(B)}});x=P,E||x()}catch(w){c?.(w)}})(),()=>x()))})()}var Ph=m(()=>{le();Co();Ku();ti();Yr();ee();us();wi();Je();yd();lc();Vd();of();sf()});var Re,lr,tn=m(()=>{W();Re=class extends T{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
44
+ `),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}},lr=class extends T{constructor({docsPath:t,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:t,metaMessages:r,name:"AccountTypeNotSupportedError"})}}});function ps({chain:e,currentChainId:t}){if(!e)throw new uc;if(t!==e.id)throw new cc({chain:e,currentChainId:t})}var af=m(()=>{fc()});async function hc(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}var gp=m(()=>{});async function ms(e,t){let{account:r=e.account,assertChainId:n=!0,chain:o=e.chain,accessList:s,authorizationList:i,blobs:a,data:c,dataSuffix:u=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,type:g,value:v,...E}=t;if(typeof r>"u")throw new Re({docsPath:"/docs/actions/wallet/sendTransaction"});let x=r?G(r):null,b;try{_e(t);let w=await(async()=>{if(t.to)return t.to;if(t.to!==null&&i&&i.length>0)return await _o({authorization:i[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`.")})})();if(x?.type==="json-rpc"||x===null){let A;o!==null&&(A=await $(e,Ve,"getChainId")({}),n&&ps({currentChainId:A,chain:o}));let P=e.chain?.formatters?.transactionRequest?.format,R=(P||Be)({...$t(E,{format:P}),accessList:s,account:x,authorizationList:i,blobs:a,chainId:A,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,to:w,type:g,value:v},"sendTransaction"),S=Sh.get(e.uid),M=S?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:M,params:[R]},{retryCount:0})}catch(z){if(S===!1)throw z;let _=z;if(_.name==="InvalidInputRpcError"||_.name==="InvalidParamsRpcError"||_.name==="MethodNotFoundRpcError"||_.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[R]},{retryCount:0}).then(N=>(Sh.set(e.uid,!0),N)).catch(N=>{let C=N;throw C.name==="MethodNotFoundRpcError"||C.name==="MethodNotSupportedRpcError"?(Sh.set(e.uid,!1),_):C});throw _}}if(x?.type==="local"){if(x.nonceManager&&typeof y>"u"){let R=E.chainId,S=await(async()=>typeof R=="number"?R:o?o.id:$(e,Ve,"getChainId")({}))();b={address:x.address,chainId:S}}let A=await $(e,Jr,"prepareTransactionRequest")({account:x,accessList:s,authorizationList:i,blobs:a,chain:o,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,nonceManager:x.nonceManager,parameters:[...Vu,"sidecars"],type:g,value:v,...E,to:w}),P=o?.serializers?.transaction,B=await x.signTransaction(A,{serializer:P});return await $(e,hc,"sendRawTransaction")({serializedTransaction:B})}throw x?.type==="smart"?new lr({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new lr({docsPath:"/docs/actions/wallet/sendTransaction",type:x?.type})}catch(w){throw w instanceof lr?w:(b&&x?.nonceManager?.reset(b),rs(w,{...t,account:x,chain:t.chain||void 0}))}}var Sh,cf=m(()=>{be();tn();W();zu();af();Me();Gu();Wo();Sr();ee();to();Ir();kn();Ka();gp();Sh=new rt(128)});async function Xt(e,t){return Xt.internal(e,ms,"sendTransaction",t)}var yc=m(()=>{be();tn();Ze();Ro();ee();cf();(function(e){async function t(r,n,o,s){let{abi:i,account:a=r.account,address:c,args:u,functionName:f,...d}=s;if(typeof a>"u")throw new Re({docsPath:"/docs/contract/writeContract"});let l=a?G(a):null,p=ne({abi:i,args:u,functionName:f});try{return await $(r,n,o)({data:p,to:c,account:l,...d})}catch(h){throw ht(h,{abi:i,address:c,args:u,docsPath:"/docs/contract/writeContract",functionName:f,sender:l?.address})}}e.internal=t})(Xt||(Xt={}))});function L5({abi:e,address:t,client:r}){let n=r,[o,s]=n?"public"in n&&"wallet"in n?[n.public,n.wallet]:"public"in n?[n.public,void 0]:"wallet"in n?[void 0,n.wallet]:[n,n]:[void 0,void 0],i=o!=null,a=s!=null,c={},u=!1,f=!1,d=!1;for(let l of e)if(l.type==="function"?l.stateMutability==="view"||l.stateMutability==="pure"?u=!0:f=!0:l.type==="event"&&(d=!0),u&&f&&d)break;return i&&(u&&(c.read=new Proxy({},{get(l,p){return(...h)=>{let{args:y,options:g}=wp(h);return $(o,oe,"readContract")({abi:e,address:t,functionName:p,args:y,...g})}}})),f&&(c.simulate=new Proxy({},{get(l,p){return(...h)=>{let{args:y,options:g}=wp(h);return $(o,cs,"simulateContract")({abi:e,address:t,functionName:p,args:y,...g})}}})),d&&(c.createEventFilter=new Proxy({},{get(l,p){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===p),{args:g,options:v}=Ih(h,y);return $(o,da,"createContractEventFilter")({abi:e,address:t,eventName:p,args:g,...v})}}}),c.getEvents=new Proxy({},{get(l,p){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===p),{args:g,options:v}=Ih(h,y);return $(o,Ya,"getContractEvents")({abi:e,address:t,eventName:p,args:g,...v})}}}),c.watchEvent=new Proxy({},{get(l,p){return(...h)=>{let y=e.find(E=>E.type==="event"&&E.name===p),{args:g,options:v}=Ih(h,y);return $(o,xp,"watchContractEvent")({abi:e,address:t,eventName:p,args:g,...v})}}}))),a&&f&&(c.write=new Proxy({},{get(l,p){return(...h)=>{let{args:y,options:g}=wp(h);return $(s,Xt,"writeContract")({abi:e,address:t,functionName:p,args:y,...g})}}})),(i||a)&&f&&(c.estimateGas=new Proxy({},{get(l,p){return(...h)=>{let{args:y,options:g}=wp(h);return $(o??s,ns,"estimateContractGas")({abi:e,address:t,functionName:p,args:y,...g,account:g.account??s.account})}}})),c.address=t,c.abi=e,c}function wp(e){let t=e.length&&Array.isArray(e[0]),r=t?e[0]:[],n=(t?e[1]:e[0])??{};return{args:r,options:n}}function Ih(e,t){let r=!1;Array.isArray(e[0])?r=!0:e.length===1?r=t.inputs.some(s=>s.indexed):e.length===2&&(r=!0);let n=r?e[0]:void 0,o=(r?e[1]:e[0])??{};return{args:n,options:o}}var F5=m(()=>{ee();yd();Wu();Vd();it();nf();Ph();yc()});var bc,Bh=m(()=>{W();bc=class extends T{constructor(t){super(`Call bundle failed with status: ${t.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=t}}});function zn(e,{delay:t=100,retryCount:r=2,shouldRetry:n=()=>!0,signal:o}={}){return new Promise((s,i)=>{let a=async({count:c=0}={})=>{if(o?.aborted){i(Ye(o));return}let u=async({error:f})=>{let d=typeof t=="function"?t({count:c,error:f}):t;if(d)try{await gi(d,{signal:o})}catch(l){i(l);return}a({count:c+1})};try{let f=await e();s(f)}catch(f){if(o?.aborted){i(Ye(o));return}if(It(f)){i(f);return}if(c<r&&await n({count:c,error:f}))return u({error:f});i(f)}};a()})}var uf=m(()=>{Er();yp()});function _n(e,t){let r={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Ue(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Z(e.transactionIndex):null,status:e.status?kh[e.status]:null,type:e.type?Fu[e.type]||e.type:null};return e.blobGasPrice&&(r.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(r.blobGasUsed=BigInt(e.blobGasUsed)),r}var kh,O5,xc=m(()=>{ve();Uu();Yr();Oa();kh={"0x0":"reverted","0x1":"success"};O5=Ko("transactionReceipt",_n)});async function vp(e,t){let{account:r=e.account,chain:n=e.chain,experimental_fallback:o,experimental_fallbackDelay:s=32,forceAtomic:i=!1,id:a,version:c="2.0.0"}=t,u=r?G(r):null,f=t.capabilities;e.dataSuffix&&!t.capabilities?.dataSuffix&&(typeof e.dataSuffix=="string"?f={...t.capabilities,dataSuffix:{value:e.dataSuffix,optional:!0}}:f={...t.capabilities,dataSuffix:{value:e.dataSuffix.value,...e.dataSuffix.required?{}:{optional:!0}}});let d=t.calls.map(l=>{let p=l,h=p.abi?ne({abi:p.abi,functionName:p.functionName,args:p.args}):p.data;return{data:p.dataSuffix&&h?ie([h,p.dataSuffix]):h,to:p.to,value:p.value?I(p.value):void 0}});try{let l=await e.request({method:"wallet_sendCalls",params:[{atomicRequired:i,calls:d,capabilities:f,chainId:I(n.id),from:u?.address,id:a,version:c}]},{retryCount:0});return typeof l=="string"?{id:l}:l}catch(l){let p=l;if(o&&(p.name==="MethodNotFoundRpcError"||p.name==="MethodNotSupportedRpcError"||p.name==="UnknownRpcError"||p.details.toLowerCase().includes("does not exist / is not available")||p.details.toLowerCase().includes("missing or invalid. request()")||p.details.toLowerCase().includes("did not match any variant of untagged enum")||p.details.toLowerCase().includes("account upgraded to unsupported contract")||p.details.toLowerCase().includes("eip-7702 not supported")||p.details.toLowerCase().includes("unsupported wc_ method")||p.details.toLowerCase().includes("feature toggled misconfigured")||p.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(f&&Object.values(f).some(v=>!v.optional)){let v="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new jr(new T(v,{details:v}))}if(i&&d.length>1){let g="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new Gr(new T(g,{details:g}))}let h=[];for(let g of d){try{let v=await ms(e,{account:u,chain:n,data:g.data,to:g.to,value:g.value?j(g.value):void 0});h.push({status:"fulfilled",value:v})}catch(v){h.push({reason:v,status:"rejected"})}s>0&&await new Promise(v=>setTimeout(v,s))}if(h.every(g=>g.status==="rejected"))throw h[0].reason;let y=h.map(g=>g.status==="fulfilled"?g.value:Rh);return{id:ie([...y,I(n.id,{size:32}),Ch])}}throw rs(l,{...t,account:u,chain:t.chain})}}var Ch,Rh,Ep=m(()=>{be();W();Co();Ze();Me();ve();F();Gu();cf();Ch="0x5792579257925792579257925792579257925792579257925792579257925792",Rh=I(0,{size:32})});async function Ap(e,t){async function r(f){if(f.endsWith(Ch.slice(2))){let l=he(Lr(f,-64,-32)),p=Lr(f,0,-64).slice(2).match(/.{1,64}/g),h=await Promise.all(p.map(g=>Rh.slice(2)!==g?e.request({method:"eth_getTransactionReceipt",params:[`0x${g}`]},{dedupe:!0}):void 0)),y=h.some(g=>g===null)?100:h.every(g=>g?.status==="0x1")?200:h.every(g=>g?.status==="0x0")?500:600;return{atomic:!1,chainId:Z(l),receipts:h.filter(Boolean),status:y,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[f]})}let{atomic:n=!1,chainId:o,receipts:s,version:i="2.0.0",...a}=await r(t.id),[c,u]=(()=>{let f=a.status;return f>=100&&f<200?["pending",f]:f>=200&&f<300?["success",f]:f>=300&&f<700?["failure",f]:f==="CONFIRMED"?["success",200]:f==="PENDING"?["pending",100]:[void 0,f]})();return{...a,atomic:n,chainId:o?Z(o):void 0,receipts:s?.map(f=>({...f,blockNumber:j(f.blockNumber),gasUsed:j(f.gasUsed),status:kh[f.status]}))??[],statusCode:u,status:c,version:i}}var $h=m(()=>{jt();un();ve();xc();Ep()});async function Tp(e,t){let{id:r,pollingInterval:n=e.pollingInterval,status:o=({statusCode:y})=>y===200||y>=300,retryCount:s=4,retryDelay:i=({count:y})=>~~(1<<y)*200,timeout:a=6e4,throwOnFailure:c=!1}=t,u=Y(["waitForCallsStatus",e.uid,r]),{promise:f,resolve:d,reject:l}=dc(),p,h=at(u,{resolve:d,reject:l},y=>{let g=mr(async()=>{let v=E=>{clearTimeout(p),g(),E(),h()};try{let E=await zn(async()=>{let x=await $(e,Ap,"getCallsStatus")({id:r});if(c&&x.status==="failure")throw new bc(x);return x},{retryCount:s,delay:i});if(!o(E))return;v(()=>y.resolve(E))}catch(E){v(()=>y.reject(E))}},{interval:n,emitOnBegin:!0});return g});return p=a?setTimeout(()=>{h(),clearTimeout(p),l(new ff({id:r}))},a):void 0,await f}var ff,Pp=m(()=>{W();Bh();ee();us();wi();ip();uf();Je();$h();ff=class extends T{constructor({id:t}){super(`Timed out while waiting for call bundle with id "${t}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}});function Bp(e=11){if(!Ip||Sp+e>256*2){Ip="",Sp=0;for(let t=0;t<256;t++)Ip+=(256+Math.random()*256|0).toString(16).substring(1)}return Ip.substring(Sp,Sp+++e)}var Sp,Ip,Nh=m(()=>{Sp=256});function ls(e){let{batch:t,chain:r,ccipRead:n,dataSuffix:o,key:s="base",name:i="Base Client",tokens:a,type:c="base"}=e,u=e.experimental_blockTag??(typeof r?.experimental_preconfirmationTime=="number"?"pending":void 0),f=r?.blockTime??12e3,d=Math.min(Math.max(Math.floor(f/2),500),4e3),l=e.pollingInterval??d,p=e.cacheTime??l,h=e.account?G(e.account):void 0,{config:y,request:g,value:v}=e.transport({account:h,chain:r,pollingInterval:l}),E={...y,...v},x={account:h,batch:t,cacheTime:p,ccipRead:n,chain:r,dataSuffix:o,key:s,name:i,pollingInterval:l,request:g,tokens:a,transport:E,type:c,uid:Bp(),...u?{experimental_blockTag:u}:{}};function b(w){return A=>{let P=A(w);for(let R in x)delete P[R];let B={...w,...P};for(let R in P){let S=w[R],M=P[R];D5(S)&&D5(M)&&(B[R]={...S,...M})}return Object.assign(B,{extend:b(B)})}}return Object.assign(x,{extend:b(x)})}function D5(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function rn(e,t){let r=(n={})=>t(e,n);for(let n of["call","calls","callWithPeriod","estimateGas","simulate"])if(Object.hasOwn(t,n)){let o=t[n];r[n]=(s={})=>o.length>=2?o(e,s):o.length===0?o():o(s)}for(let n of["extractEvent","extractEvents"])Object.hasOwn(t,n)&&(r[n]=t[n]);return r}function q5(){return null}var vi=m(()=>{be();Nh()});function gc(e){if(!(e instanceof T))return!1;let t=e.walk(r=>r instanceof bn);return t instanceof bn?t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile":!1}var kp=m(()=>{W();xn()});function Cp(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;let t=`0x${e.slice(1,65)}`;return O(t)?t:null}var Hh=m(()=>{ut()});function Ei(e){let t=new Uint8Array(32).fill(0);if(!e)return K(t);let r=e.split(".");for(let n=r.length-1;n>=0;n-=1){let o=Cp(r[n]),s=o?Ee(o):te(Dt(r[n]),"bytes");t=te(ie([t,s]),"bytes")}return K(t)}var Rp=m(()=>{Me();ue();F();St();Hh()});function j5(e){return`[${e.slice(2)}]`}var G5=m(()=>{});function $p(e){let t=new Uint8Array(32).fill(0);return e?Cp(e)||te(Dt(e)):K(t)}var Mh=m(()=>{ue();F();St();Hh()});function wc(e){let t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);let r=new Uint8Array(Dt(t).byteLength+2),n=0,o=t.split(".");for(let s=0;s<o.length;s++){let i=Dt(o[s]);i.byteLength>255&&(i=Dt(j5($p(o[s])))),r[n]=i.length,r.set(i,n+1),n+=i.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}var Np=m(()=>{ue();G5();Mh()});async function V5(e,t){let{blockNumber:r,blockTag:n,coinType:o,name:s,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(l=>s.endsWith(l)))return null;let d=o!=null?[Ei(s),BigInt(o)]:[Ei(s)];try{let l=ne({abi:fh,functionName:"addr",args:d}),p={address:u,abi:np,functionName:"resolveWithGateways",args:[me(wc(s)),l,i??[kr]],blockNumber:r,blockTag:n},y=await $(e,oe,"readContract")(p);if(y[0]==="0x")return null;let g=eT({coinType:o,data:y[0],args:d});return g==="0x"||he(g)==="0x00"?null:g}catch(l){if(a)throw l;if(gc(l))return null;throw l}}function eT({coinType:e,data:t,args:r}){try{return Le({abi:fh,args:r,functionName:"addr",data:t})}catch(n){if(e==null)throw n;let o=he(t);if(J(o)===20)return ye(o);throw n}}var W5=m(()=>{Ke();Br();Ze();dt();as();et();un();F();kp();mc();Rp();Np();ee();it()});var Hp,nn,hs,vc,Ec,Mp=m(()=>{W();Hp=class extends T{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`],name:"EnsAvatarInvalidMetadataError"})}},nn=class extends T{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`,{name:"EnsAvatarInvalidNftUriError"})}},hs=class extends T{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}},vc=class extends T{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}},Ec=class extends T{constructor({chainId:t}){super(`Invalid ENSIP-11 chainId: ${t}. Must be between 0 and 0x7fffffff, or 1.`,{name:"EnsInvalidChainIdError"})}}});async function sT(e){try{let t=await fetch(e,{method:"HEAD"});return t.status===200?t.headers.get("content-type")?.startsWith("image/"):!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!Object.hasOwn(globalThis,"Image")?!1:new Promise(r=>{let n=new Image;n.onload=()=>{r(!0)},n.onerror=()=>{r(!1)},n.src=e})}}function K5(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function zh({uri:e,gatewayUrls:t}){let r=nT.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};let n=K5(t?.ipfs,"https://ipfs.io"),o=K5(t?.arweave,"https://arweave.net"),s=e.match(tT),{protocol:i,subpath:a,target:c,subtarget:u=""}=s?.groups||{},f=i==="ipns:/"||a==="ipns/",d=i==="ipfs:/"||a==="ipfs/"||rT.test(e);if(e.startsWith("http")&&!f&&!d){let p=e;return t?.arweave&&(p=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:p,isOnChain:!1,isEncoded:!1}}if((f||d)&&c)return{uri:`${n}/${f?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&c)return{uri:`${o}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let l=e.replace(oT,"");if(l.startsWith("<svg")&&(l=`data:image/svg+xml;base64,${btoa(l)}`),l.startsWith("data:")||l.startsWith("{"))return{uri:l,isOnChain:!0,isEncoded:!1};throw new hs({uri:e})}function _h(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Hp({data:e});return e.image||e.image_url||e.image_data}async function Z5({gatewayUrls:e,uri:t}){try{let r=await fetch(t).then(o=>o.json());return await zp({gatewayUrls:e,uri:_h(r)})}catch{throw new hs({uri:t})}}async function zp({gatewayUrls:e,uri:t}){let{uri:r,isOnChain:n}=zh({uri:t,gatewayUrls:e});if(n||await sT(r))return r;throw new hs({uri:t})}function J5(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));let[r,n,o]=t.split("/"),[s,i]=r.split(":"),[a,c]=n.split(":");if(!s||s.toLowerCase()!=="eip155")throw new nn({reason:"Only EIP-155 supported"});if(!i)throw new nn({reason:"Chain ID not found"});if(!c)throw new nn({reason:"Contract address not found"});if(!o)throw new nn({reason:"Token ID not found"});if(!a)throw new nn({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i,10),namespace:a.toLowerCase(),contractAddress:c,tokenID:o}}async function Y5(e,{nft:t}){if(t.namespace==="erc721")return oe(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return oe(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new vc({namespace:t.namespace})}var tT,rT,nT,oT,X5=m(()=>{it();Mp();tT=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,rT=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,nT=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,oT=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/});async function Q5(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?iT(e,{gatewayUrls:t,record:r}):zp({uri:r,gatewayUrls:t})}async function iT(e,{gatewayUrls:t,record:r}){let n=J5(r),o=await Y5(e,{nft:n}),{uri:s,isOnChain:i,isEncoded:a}=zh({uri:o,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){let u=a?atob(s.replace("data:application/json;base64,","")):s,f=JSON.parse(u);return zp({uri:_h(f),gatewayUrls:t})}let c=n.tokenID;return n.namespace==="erc1155"&&(c=c.replace("0x","").padStart(64,"0")),Z5({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,c)})}var e2=m(()=>{X5()});async function _p(e,t){let{blockNumber:r,blockTag:n,key:o,name:s,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})(),f=c?.ensTlds;if(f&&!f.some(d=>s.endsWith(d)))return null;try{let d={address:u,abi:np,args:[me(wc(s)),ne({abi:uh,functionName:"text",args:[Ei(s),o]}),i??[kr]],functionName:"resolveWithGateways",blockNumber:r,blockTag:n},p=await $(e,oe,"readContract")(d);if(p[0]==="0x")return null;let h=Le({abi:uh,functionName:"text",data:p[0]});return h===""?null:h}catch(d){if(a)throw d;if(gc(d))return null;throw d}}var Uh=m(()=>{Ke();Br();Ze();as();F();kp();mc();Rp();Np();ee();it()});async function t2(e,{blockNumber:t,blockTag:r,assetGatewayUrls:n,name:o,gatewayUrls:s,strict:i,universalResolverAddress:a}){let c=await $(e,_p,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:o,universalResolverAddress:a,gatewayUrls:s,strict:i});if(!c)return null;try{return await Q5(e,{record:c,gatewayUrls:n})}catch{return null}}var r2=m(()=>{e2();ee();Uh()});async function n2(e,t){let{address:r,blockNumber:n,blockTag:o,coinType:s=60n,gatewayUrls:i,strict:a}=t,{chain:c}=e,u=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})();try{let f={address:u,abi:S5,args:[r,s,i??[kr]],functionName:"reverseWithGateways",blockNumber:n,blockTag:o},d=$(e,oe,"readContract"),[l]=await d(f);return l||null}catch(f){if(a)throw f;if(gc(f))return null;throw f}}var o2=m(()=>{Ke();as();kp();mc();ee();it()});async function s2(e,t){let{blockNumber:r,blockTag:n,name:o}=t,{chain:s}=e,i=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw new Error("client chain not configured. universalResolverAddress is required.");return Ht({blockNumber:r,chain:s,contract:"ensUniversalResolver"})})(),a=s?.ensTlds;if(a&&!a.some(u=>o.endsWith(u)))throw new Error(`${o} is not a valid ENS TLD (${a?.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);let[c]=await $(e,oe,"readContract")({address:i,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[me(wc(o))],blockNumber:r,blockTag:n});return c}var i2=m(()=>{as();F();Np();ee();it()});async function Up(e,t){let{account:r=e.account,blockNumber:n,blockTag:o="latest",blobs:s,data:i,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:d,to:l,value:p,...h}=t,y=r?G(r):void 0;try{_e(t);let v=(typeof n=="bigint"?I(n):void 0)||o,E=e.chain?.formatters?.transactionRequest?.format,b=(E||Be)({...$t(h,{format:E}),account:y,blobs:s,data:i,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:d,to:l,value:p},"createAccessList"),w=await e.request({method:"eth_createAccessList",params:[b,v]});if(w.error)throw new T(w.error,{details:w.error});return{accessList:w.accessList,gasUsed:BigInt(w.gasUsed)}}catch(g){throw sp(g,{...t,account:y,chain:e.chain})}}var Lh=m(()=>{be();W();F();mh();Wo();Sr();Ir()});async function a2(e){let t=ro(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}var c2=m(()=>{bu()});async function Lp(e,{address:t,args:r,event:n,events:o,fromBlock:s,strict:i,toBlock:a}={}){let c=o??(n?[n]:void 0),u=ro(e,{method:"eth_newFilter"}),f=[];c&&(f=[c.flatMap(p=>nr({abi:[p],eventName:p.name,args:r}))],n&&(f=f[0]));let d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?I(s):s,toBlock:typeof a=="bigint"?I(a):a,...f.length?{topics:f}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:s,id:d,request:u(d),strict:!!i,toBlock:a,type:"event"}}var Fh=m(()=>{ti();F();bu()});async function Fp(e){let t=ro(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}var Oh=m(()=>{bu()});async function u2(e,{address:t,blockHash:r,blockNumber:n,blockTag:o=e.experimental_blockTag??"latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});if(e.batch?.multicall&&e.chain?.contracts?.multicall3){let c=e.chain.contracts.multicall3.address,u=ne({abi:dr,functionName:"getEthBalance",args:[t]}),{data:f}=await $(e,pr,"call")({to:c,data:u,blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});return Le({abi:dr,functionName:"getEthBalance",args:[t],data:f||"0x"})}let a=await e.request({method:"eth_getBalance",params:[t,i]});return BigInt(a)}var f2=m(()=>{Ke();Br();Ze();mi();ee();xi()});async function d2(e){let t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}var p2=m(()=>{});async function m2(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest"}={}){let o=r!==void 0?I(r):void 0,s=await e.request({method:"eth_getBlockReceipts",params:[t||o||n]},{dedupe:!!(t||o)});if(!s)throw new Zr({blockHash:t,blockNumber:r});let i=e.chain?.formatters?.transactionReceipt?.format||_n;return s.map(a=>i(a,"getBlockReceipts"))}var l2=m(()=>{Lu();F();xc()});async function h2(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){let o=r!==void 0?I(r):void 0,s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||n]},{dedupe:!!o}),Z(s)}var y2=m(()=>{ve();F()});async function Ai(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s}){let i=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),a=await e.request({method:"eth_getCode",params:[t,i]},{dedupe:typeof n=="bigint"||r!==void 0});if(a!=="0x")return a}var Op=m(()=>{mi()});async function b2(e,{address:t,blockNumber:r,blockTag:n="latest"}){let o=await Ai(e,{address:t,...r!==void 0?{blockNumber:r}:{blockTag:n}});if(o&&J(o)===23&&o.startsWith("0xef0100"))return ye(De(o,3,23))}var x2=m(()=>{dt();et();jt();Op()});var Dp,g2=m(()=>{W();Dp=class extends T{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}});async function w2(e,t){let{address:r,factory:n,factoryData:o}=t;try{let[s,i,a,c,u,f,d]=await $(e,oe,"readContract")({abi:aT,address:r,functionName:"eip712Domain",factory:n,factoryData:o});return{domain:{name:i,version:a,chainId:Number(c),verifyingContract:u,salt:f},extensions:d,fields:s}}catch(s){let i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Dp({address:r}):i}}var aT,v2=m(()=>{g2();ee();it();aT=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}]});function E2(e){return{baseFeePerGas:e.baseFeePerGas.map(t=>BigInt(t)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map(t=>t.map(r=>BigInt(r)))}}var A2=m(()=>{});async function T2(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:o}){let s=typeof r=="bigint"?I(r):void 0,i=await e.request({method:"eth_feeHistory",params:[I(t),s||n,o]},{dedupe:!!s});return E2(i)}var P2=m(()=>{F();A2()});async function S2(e,{filter:t}){let r=t.strict??!1,o=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Ue(s));return t.abi?ur({abi:t.abi,logs:o,strict:r}):o}var I2=m(()=>{li();Yr()});function B2(e,t){if(e.length!==t.length)throw new Kn({expectedLength:e.length,givenLength:t.length});let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n];r.push(k2(o,s))}return Ae(r)}function k2(e,t,r=!1){if(e==="address"){let i=t;if(!Q(i))throw new ae({address:i});return tt(i.toLowerCase(),{size:r?32:null})}if(e==="string")return tr(t);if(e==="bytes")return t;if(e==="bool")return tt(Js(t),{size:r?32:1});let n=e.match(fa);if(n){let[i,a,c="256"]=n,u=Number.parseInt(c,10)/8;return I(t,{size:r?32:u,signed:a==="int"})}let o=e.match(md);if(o){let[i,a]=o;if(Number.parseInt(a,10)!==(t.length-2)/2)throw new Yn({expectedSize:Number.parseInt(a,10),givenSize:(t.length-2)/2});return tt(t,{dir:"right",size:r?32:null})}let s=e.match(Y1);if(s&&Array.isArray(t)){let[i,a]=s,c=[];for(let u=0;u<t.length;u++)c.push(k2(a,t[u],!0));return c.length===0?"0x":Ae(c)}throw new ea(e)}var C2=m(()=>{le();rr();pt();Me();Qn();F();ld()});function df(e){return!e||typeof e!="object"||!("BYTES_PER_ELEMENT"in e)?!1:e.BYTES_PER_ELEMENT===1&&e.constructor.name==="Uint8Array"}var Dh=m(()=>{});function R2(e){return e.opcode==="CREATE2"?jh(e):qh(e)}function qh(e){let t=Ee(ye(e.from)),r=Ee(e.nonce);return r[0]===0&&(r=new Uint8Array([])),ye(`0x${te(wt([t,r],"bytes")).slice(26)}`)}function jh(e){let t=Ee(ye(e.from)),r=tt(df(e.salt)?e.salt:Ee(e.salt),{size:32}),n="bytecodeHash"in e?df(e.bytecodeHash)?e.bytecodeHash:Ee(e.bytecodeHash):te(e.bytecode,"bytes");return ye(De(te(ie([Ee("0xff"),t,r,n])),12))}var $2=m(()=>{Me();Dh();Qn();jt();ue();Mu();St();dt()});function qp(e){let{authorizationList:t}=e;if(t)for(let r of t){let{chainId:n}=r,o=r.address;if(!Q(o))throw new ae({address:o});if(n<0)throw new Hn({chainId:n})}ys(e)}function jp(e){let{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Ga;for(let r of t){let n=J(r),o=Z(De(r,0,1));if(n!==32)throw new Ld({hash:r,size:n});if(o!==1)throw new Fd({hash:r,version:o})}}ys(e)}function ys(e){let{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:n,to:o}=e;if(t<=0)throw new Hn({chainId:t});if(o&&!Q(o))throw new ae({address:o});if(n&&n>Zo)throw new Ct({maxFeePerGas:n});if(r&&n&&r>n)throw new cr({maxFeePerGas:n,maxPriorityFeePerGas:r})}function Ac(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:o,to:s}=e;if(t<=0)throw new Hn({chainId:t});if(s&&!Q(s))throw new ae({address:s});if(r||o)throw new T("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>Zo)throw new Ct({maxFeePerGas:n})}function Tc(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:o,to:s}=e;if(s&&!Q(s))throw new ae({address:s});if(typeof t<"u"&&t<=0)throw new Hn({chainId:t});if(r||o)throw new T("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>Zo)throw new Ct({maxFeePerGas:n})}var Gp=m(()=>{Rd();rr();W();Jl();fc();Wr();pt();et();jt();ve()});function Ti(e){if(!e||e.length===0)return[];let t=[];for(let r=0;r<e.length;r++){let{address:n,storageKeys:o}=e[r];for(let s=0;s<o.length;s++)if(o[s].length-2!==64)throw new Ta({storageKey:o[s]});if(!Q(n,{strict:!1}))throw new ae({address:n});t.push([n,o])}return t}var Gh=m(()=>{rr();lt();pt()});function Vp(e,t){let r=Va(e);return r==="eip1559"?fT(e,t):r==="eip2930"?dT(e,t):r==="eip4844"?uT(e,t):r==="eip7702"?cT(e,t):pT(e,t)}function cT(e,t){let{authorizationList:r,chainId:n,gas:o,nonce:s,to:i,value:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:d}=e;qp(e);let l=Ti(f),p=N2(r);return Ae(["0x04",wt([I(n),s?I(s):"0x",u?I(u):"0x",c?I(c):"0x",o?I(o):"0x",i??"0x",a?I(a):"0x",d??"0x",l,p,...Pc(e,t)])])}function uT(e,t){let{chainId:r,gas:n,nonce:o,to:s,value:i,maxFeePerBlobGas:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:f,data:d}=e;jp(e);let l=e.blobVersionedHashes,p=e.sidecars;if(e.blobs&&(typeof l>"u"||typeof p>"u")){let x=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(A=>K(A)),b=e.kzg,w=Qo({blobs:x,kzg:b});if(typeof l>"u"&&(l=ja({commitments:w})),typeof p>"u"){let A=es({blobs:x,commitments:w,kzg:b});p=ts({blobs:x,commitments:w,proofs:A})}}let h=Ti(f),y=[I(r),o?I(o):"0x",u?I(u):"0x",c?I(c):"0x",n?I(n):"0x",s??"0x",i?I(i):"0x",d??"0x",h,a?I(a):"0x",l??[],...Pc(e,t)],g=[],v=[],E=[];if(p)for(let x=0;x<p.length;x++){let{blob:b,commitment:w,proof:A}=p[x];g.push(b),v.push(w),E.push(A)}return Ae(["0x03",p?wt([y,g,v,E]):wt(y)])}function fT(e,t){let{chainId:r,gas:n,nonce:o,to:s,value:i,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:u,data:f}=e;ys(e);let d=Ti(u),l=[I(r),o?I(o):"0x",c?I(c):"0x",a?I(a):"0x",n?I(n):"0x",s??"0x",i?I(i):"0x",f??"0x",d,...Pc(e,t)];return Ae(["0x02",wt(l)])}function dT(e,t){let{chainId:r,gas:n,data:o,nonce:s,to:i,value:a,accessList:c,gasPrice:u}=e;Ac(e);let f=Ti(c),d=[I(r),s?I(s):"0x",u?I(u):"0x",n?I(n):"0x",i??"0x",a?I(a):"0x",o??"0x",f,...Pc(e,t)];return Ae(["0x01",wt(d)])}function pT(e,t){let{chainId:r=0,gas:n,data:o,nonce:s,to:i,value:a,gasPrice:c}=e;Tc(e);let u=[s?I(s):"0x",c?I(c):"0x",n?I(n):"0x",i??"0x",a?I(a):"0x",o??"0x"];if(t){let f=(()=>{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(t.v===35n?0n:1n);if(r>0)return BigInt(r*2)+BigInt(35n+t.v-27n);let p=27n+(t.v===27n?0n:1n);if(t.v!==p)throw new io({v:t.v});return p})(),d=he(t.r),l=he(t.s);u=[...u,I(f),d==="0x00"?"0x":d,l==="0x00"?"0x":l]}else r>0&&(u=[...u,I(r),"0x","0x"]);return wt(u)}function Pc(e,t){let r=t??e,{v:n,yParity:o}=r;if(typeof r.r>"u")return[];if(typeof r.s>"u")return[];if(typeof n>"u"&&typeof o>"u")return[];let s=he(r.r),i=he(r.s);return[typeof o=="number"?o?I(1):"0x":n===0n?"0x":n===1n?I(1):n===27n?"0x":I(1),s==="0x00"?"0x":s,i==="0x00"?"0x":i]}var Wp=m(()=>{lt();H2();Du();qu();_d();ju();Me();un();F();Mu();Gp();Dd();Gh()});function N2(e){if(!e||e.length===0)return[];let t=[];for(let r of e){let{chainId:n,nonce:o,...s}=r,i=r.address;t.push([n?me(n):"0x",i,o?me(o):"0x",...Pc({},s)])}return t}var H2=m(()=>{F();Wp()});async function M2({address:e,authorization:t,signature:r}){return de(ye(e),await _o({authorization:t,signature:r}))}var z2=m(()=>{dt();Jt();zu()});function _2(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(Kp.get(r))return Kp.get(r);let n=e().finally(()=>Kp.delete(r));return Kp.set(r,n),n}var Kp,U2=m(()=>{to();Kp=new rt(8192)});function L2(e,t={}){return async(r,n={})=>{let{dedupe:o=!1,methods:s,retryDelay:i=150,retryCount:a=3,signal:c,uid:u}={...t,...n},{method:f}=r;if(s?.exclude?.includes(f))throw new qr(new Error("method not supported"),{method:f});if(s?.include&&!s.include.includes(f))throw new qr(new Error("method not supported"),{method:f});if(c?.aborted)throw Ye(c);let d=o?lT(`${u}.${Y(r)}`):void 0;return _2(()=>zn(async()=>{try{return await e(r,c?{signal:c}:void 0)}catch(l){if(c?.aborted)throw Ye(c);if(It(l))throw l;let p=l;switch(p.code){case po.code:throw new po(p);case mo.code:throw new mo(p);case lo.code:throw new lo(p,{method:r.method});case ho.code:throw new ho(p);case Ar.code:throw new Ar(p);case Bt.code:throw new Bt(p);case yo.code:throw new yo(p);case bo.code:throw new bo(p);case Dr.code:throw new Dr(p);case qr.code:throw new qr(p,{method:r.method});case vn.code:throw new vn(p);case xo.code:throw new xo(p);case Tr.code:throw new Tr(p);case go.code:throw new go(p);case wo.code:throw new wo(p);case vo.code:throw new vo(p);case Eo.code:throw new Eo(p);case Ao.code:throw new Ao(p);case jr.code:throw new jr(p);case To.code:throw new To(p);case Po.code:throw new Po(p);case So.code:throw new So(p);case Io.code:throw new Io(p);case Bo.code:throw new Bo(p);case Gr.code:throw new Gr(p);case 5e3:throw new Tr(p);case ko.code:throw new ko(p);default:throw l instanceof T?l:new ka(p)}}},{delay:({count:l,error:p})=>{if(p&&p instanceof ot){let h=p?.headers?.get("Retry-After");if(h?.match(/\d/))return Number.parseInt(h,10)*1e3}return~~(1<<l)*i},retryCount:a,signal:c,shouldRetry:({error:l})=>mT(l)}),{enabled:o,id:d})}}function mT(e){return It(e)?!1:"code"in e&&typeof e.code=="number"?e.code===-1||e.code===vn.code||e.code===Ar.code||e.code===429:e instanceof ot&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function lT(e,t=0){let r=3735928559^t,n=1103547991^t;for(let o=0;o<e.length;o++){let s=e.charCodeAt(o);r=Math.imul(r^s,2654435761),n=Math.imul(n^s,1597334677)}return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>16,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>16,3266489909),(4294967296*(2097151&n)+(r>>>0)).toString(36)}var F2=m(()=>{W();ar();Co();Er();U2();uf();Je()});function O2({batchGateways:e,ccipRequest:t=bi}){return{async request({data:r,sender:n,urls:o}){if(o.includes(kr))return t({data:r,sender:n,urls:e});{let[s,i]=Le({abi:is,functionName:"query",data:await t({data:ne({abi:is,functionName:"query",args:[[{sender:n,data:r,urls:o}]]}),sender:n,urls:e})});if(s[0]){let a;try{let c=oo({abi:[...is,pa],data:i[0]});if(c.errorName==="HttpError")a=new ot({body:{message:c.args[1]},status:c.args[0],url:o.join(" | ")});else{let u=c.args[0];u&&(a=new Error(u))}}catch{}throw a??new Error("An unknown error occurred.")}return i[0]}}}}var D2=m(()=>{Ke();xu();ar();Tu();Br();Ze();lp();mc()});function q2(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};function r(n){return o=>{let s=typeof o=="function"?o(n):o,i={...n,...s};return Object.assign(i,{extend:r(i)})}}return Object.assign(t,{extend:r(t)})}function j2(){return{}}var G2=m(()=>{});function V2({chains:e,id:t}){return e.find(r=>r.id===t)}var W2=m(()=>{});function pf(e,t="hex"){let r=(()=>{if(typeof e=="string"){if(e.length>3&&e.length%2!==0)throw new oa(e);return re(e)}return e})(),n=vr(r,{recursiveReadLimit:Number.POSITIVE_INFINITY});return J2(n,t)}function J2(e,t="hex",r=0){if(r>=K2)throw new sa({limit:K2});if(e.bytes.length===0)return t==="hex"?K(e.bytes):e.bytes;let n=e.readByte();if(n<128&&e.decrementPosition(1),n<192){let s=Z2(e,n,128),i=e.readBytes(s);return t==="hex"?K(i):i}let o=Z2(e,n,192);return hT(e,o,t,r+1)}function Z2(e,t,r){if(r===128&&t<128)return 1;if(t<=r+55)return t-r;if(t===r+55+1)return e.readUint8();if(t===r+55+2)return e.readUint16();if(t===r+55+3)return e.readUint24();if(t===r+55+4)return e.readUint32();throw new T("Invalid RLP prefix")}function hT(e,t,r,n){let o=e.position,s=[];for(;e.position-o<t;)s.push(J2(e,r,n));return s}var K2,Vh=m(()=>{W();Zs();la();ue();F();K2=1024});function Zp(e){return O(e)&&J(e)===32}var Wh=m(()=>{ut();et()});function Y2(e,t,r,n){return e===0?t^r^n:e===1?t&r|~t&n:e===2?(t|~r)^n:e===3?t&n|r&~n:t^(r|~n)}var yT,X2,bT,Q2,ew,tw,rw,xT,gT,wT,vT,Jp,Yp,nw,ow=m(()=>{ll();pn();yT=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),X2=Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)),bT=X2.map(e=>(9*e+5)%16),Q2=(()=>{let r=[[X2],[bT]];for(let n=0;n<4;n++)for(let o of r)o.push(o[n].map(s=>yT[s]));return r})(),ew=Q2[0],tw=Q2[1],rw=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),xT=ew.map((e,t)=>e.map(r=>rw[t][r])),gT=tw.map((e,t)=>e.map(r=>rw[t][r])),wT=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),vT=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);Jp=new Uint32Array(16),Yp=class extends Ca{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:r,h2:n,h3:o,h4:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.h0=t|0,this.h1=r|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,r){for(let p=0;p<16;p++,r+=4)Jp[p]=t.getUint32(r,!0);let n=this.h0|0,o=n,s=this.h1|0,i=s,a=this.h2|0,c=a,u=this.h3|0,f=u,d=this.h4|0,l=d;for(let p=0;p<5;p++){let h=4-p,y=wT[p],g=vT[p],v=ew[p],E=tw[p],x=xT[p],b=gT[p];for(let w=0;w<16;w++){let A=mu(n+Y2(p,s,a,u)+Jp[v[w]]+y,x[w])+d|0;n=d,d=u,u=mu(a,10)|0,a=s,s=A}for(let w=0;w<16;w++){let A=mu(o+Y2(h,i,c,f)+Jp[E[w]]+g,b[w])+l|0;o=l,l=f,f=mu(c,10)|0,c=i,i=A}}this.set(this.h1+a+f|0,this.h2+u+l|0,this.h3+d+o|0,this.h4+n+i|0,this.h0+s+c|0)}roundClean(){qt(Jp)}destroy(){this.destroyed=!0,qt(this.buffer),this.set(0,0,0,0,0)}},nw=ca(()=>new Yp)});var sw,iw=m(()=>{ow();sw=nw});function aw(e,t){let r=t||"hex",n=sw(O(e,{strict:!1})?Ee(e):e);return r==="bytes"?n:me(n)}var cw=m(()=>{iw();ut();ue();F()});var uw=m(()=>{hu()});var fw=m(()=>{pd()});var dw=m(()=>{hu()});var pw=m(()=>{pd()});function Kh(e){let{source:t}=e,r=new Map,n=new rt(8192),o=new Map,s=({address:a,chainId:c})=>`${a}.${c}`,i=a=>{r.delete(a),o.delete(a)};return{async consume({address:a,chainId:c,client:u}){let f=s({address:a,chainId:c}),d=this.get({address:a,chainId:c,client:u});this.increment({address:a,chainId:c});let l=await d;return await t.set({address:a,chainId:c},l),n.set(f,l),l},async increment({address:a,chainId:c}){let u=s({address:a,chainId:c}),f=r.get(u)??0;r.set(u,f+1)},async get({address:a,chainId:c,client:u}){let f=s({address:a,chainId:c}),d=o.get(f);return d||(d=(async()=>{try{let p=await t.get({address:a,chainId:c,client:u}),h=n.get(f)??0;return h>0&&p<=h?h+1:(n.delete(f),p)}finally{i(f)}})(),o.set(f,d)),(r.get(f)??0)+await d},reset({address:a,chainId:c}){let u=s({address:a,chainId:c});n.delete(u),i(u)}}}function ET(){return{async get(e){let{address:t,client:r}=e;return Xo(r,{address:t,blockTag:"pending"})},set(){}}}var mw,lw=m(()=>{Ou();to();mw=Kh({source:ET()})});function Sc(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise((o,s)=>{(async()=>{let i,a=new AbortController;try{r>0&&(i=setTimeout(()=>{n?a.abort():s(t)},r)),o(await e({signal:a?.signal||null}))}catch(c){if(a?.signal.aborted&&It(c)){s(t);return}s(c)}finally{clearTimeout(i)}})()})}var Xp=m(()=>{Er()});function AT(){return{current:0,take(){return this.current++},reset(){this.current=0}}}var mf,Zh=m(()=>{mf=AT()});function hw(e,t={}){let{url:r,headers:n}=ST(e);return{async request(o){let{body:s,fetchFn:i=t.fetchFn??fetch,maxResponseBodySize:a=t.maxResponseBodySize??TT,onRequest:c=t.onRequest,onResponse:u=t.onResponse,timeout:f=t.timeout??1e4}=o,d={...t.fetchOptions??{},...o.fetchOptions??{}},{headers:l,method:p,signal:h}=d;try{let y=await Sc(async({signal:E})=>{let x={...d,body:Array.isArray(s)?Y(s.map(P=>({jsonrpc:"2.0",id:P.id??mf.take(),...P}))):Y({jsonrpc:"2.0",id:s.id??mf.take(),...s}),headers:{...n,"Content-Type":"application/json",...l},method:p||"POST",signal:h||(f>0?E:null)},b=new Request(r,x),w=await c?.(b,x)??{...x,url:r};return await i(w.url??r,w)},{errorInstance:new wn({body:s,url:r}),timeout:f,signal:!0});u&&await u(y);let g,v=await PT(y,{maxResponseBodySize:a});if(y.headers.get("Content-Type")?.startsWith("application/json"))g=JSON.parse(v);else{g=v;try{g=JSON.parse(g||"{}")}catch(E){if(y.ok)throw E;g={error:g}}}if(!y.ok){if(typeof g.error?.code=="number"&&typeof g.error?.message=="string")return g;throw new ot({body:s,details:Y(g.error)||y.statusText,headers:y.headers,status:y.status,url:r})}return g}catch(y){throw h?.aborted?Ye(h):It(y)||y instanceof ot||y instanceof gn||y instanceof wn?y:new ot({body:s,cause:y,url:r})}}}}async function PT(e,{maxResponseBodySize:t}){if(t===!1)return e.text();let r=e.headers.get("Content-Length");if(r){let a=Number(r);if(a>t)throw new gn({maxSize:t,size:a})}if(!e.body){let a=await e.text(),c=new TextEncoder().encode(a).length;if(c>t)throw new gn({maxSize:t,size:c});return a}let n=e.body.getReader(),o=new TextDecoder,s="",i=0;try{for(;;){let{done:a,value:c}=await n.read();if(a)break;if(i+=c.byteLength,i>t)throw await n.cancel(),new gn({maxSize:t,size:i});s+=o.decode(c,{stream:!0})}return s+=o.decode(),s}finally{n.releaseLock()}}function ST(e){try{let t=new URL(e),r=(()=>{if(t.username){let n=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(n)}`}}}})();return{url:t.toString(),...r}}catch{return{url:e}}}var TT,yw=m(()=>{ar();Er();Xp();Je();Zh();TT=10485760});async function bw(e){let{getSocket:t,keepAlive:r=!0,key:n="socket",reconnect:o=!0,url:s}=e,{interval:i=3e4}=typeof r=="object"?r:{},{attempts:a=5,delay:c=2e3}=typeof o=="object"?o:{},u=JSON.stringify({keepAlive:r,key:n,url:s,reconnect:o}),f=Jh.get(u);if(f)return f;let d=0,{schedule:l}=pc({id:u,fn:async()=>{let y=new Map,g=new Map,v,E,x,b,w=!1,A=!1;function P(){if(o&&!A&&d<a){if(w)return;w=!0,d++,E?.close(),b=setTimeout(async()=>{if(b=void 0,A){w=!1;return}await B().catch(console.error),w=!1},c)}else y.clear(),g.clear()}async function B(){let R=await t({onClose(){for(let S of y.values())S.onError?.(new Or({url:s}));for(let S of g.values())S.onError?.(new Or({url:s}));P()},onError(S){v=S;for(let M of y.values())M.onError?.(v);for(let M of g.values())M.onError?.(v);P()},onOpen(){v=void 0,d=0},onResponse(S){let M=S.method==="eth_subscription",z=M?S.params.subscription:S.id,_=M?g:y,N=_.get(z);N&&N.onResponse(S),M||_.delete(z)}});if(A)return R.close(),R;if(E=R,r&&(x&&clearInterval(x),x=setInterval(()=>E.ping?.(),i)),o&&g.size>0){let S=g.entries();for(let[M,{onResponse:z,body:_,onError:N}]of S)_&&(g.delete(M),f?.request({body:_,onResponse:z,onError:N}))}return R}return await B(),v=void 0,f={close(){A=!0,x&&clearInterval(x),b&&(clearTimeout(b),b=void 0,w=!1),E.close(),Jh.delete(u)},get socket(){return E},request({body:R,onError:S,onResponse:M}){v&&S&&S(v);let z=R.id??mf.take(),_=N=>{typeof N.id=="number"&&z!==N.id||(R.method==="eth_subscribe"&&typeof N.result=="string"&&g.set(N.result,{onResponse:_,onError:S,body:R}),M(N))};R.method==="eth_unsubscribe"&&g.delete(R.params?.[0]),y.set(z,{onResponse:_,onError:S});try{E.request({body:{jsonrpc:"2.0",id:z,...R}})}catch(N){S?.(N)}},requestAsync({body:R,timeout:S=1e4}){return Sc(()=>new Promise((M,z)=>this.request({body:R,onError:z,onResponse:M})),{errorInstance:new wn({body:R,url:s}),timeout:S})},requests:y,subscriptions:g,url:s},Jh.set(u,f),[f]}}),[p,[h]]=await l();return h}var Jh,xw=m(()=>{ar();ap();Xp();Zh();Jh=new Map});function gw(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}var ww=m(()=>{});var vw={};Nr(vw,{WebSocket:()=>IT});var IT,Ew=m(()=>{ww();IT=gw()});async function Ic(e,t={}){let{keepAlive:r,reconnect:n}=t;return bw({async getSocket({onClose:o,onError:s,onOpen:i,onResponse:a}){let c=await Promise.resolve().then(()=>(Ew(),vw)).then(p=>p.WebSocket),u=new c(e);function f(){u.removeEventListener("close",f),u.removeEventListener("message",d),u.removeEventListener("error",s),u.removeEventListener("open",i),o()}function d({data:p}){if(!(typeof p=="string"&&p.trim().length===0))try{let h=JSON.parse(p);a(h)}catch(h){s(h)}}u.addEventListener("close",f),u.addEventListener("message",d),u.addEventListener("error",s),u.addEventListener("open",i),u.readyState===c.CONNECTING&&await new Promise((p,h)=>{u&&(u.onopen=p,u.onerror=h)});let{close:l}=u;return Object.assign(u,{close(){l.bind(u)(),f()},ping(){try{if(u.readyState===u.CLOSED||u.readyState===u.CLOSING)throw new ii({url:u.url,cause:new Or({url:u.url})});let p={jsonrpc:"2.0",id:null,method:"net_version",params:[]};u.send(JSON.stringify(p))}catch(p){s(p)}},request({body:p}){if(u.readyState===u.CLOSED||u.readyState===u.CLOSING)throw new ii({body:p,url:u.url,cause:new Or({url:u.url})});return u.send(JSON.stringify(p))}})},keepAlive:r,reconnect:n,url:e})}var Yh=m(()=>{ar();xw()});async function Aw(e){let t=await Ic(e);return Object.assign(t.socket,{requests:t.requests,subscriptions:t.subscriptions})}var Tw=m(()=>{Yh()});var Qp,Xh=m(()=>{Qp=`Ethereum Signed Message:
45
+ `});function e0(e){let t=typeof e=="string"?tr(e):typeof e.raw=="string"?e.raw:K(e.raw),r=tr(`${Qp}${J(t)}`);return ie([r,t])}var Qh=m(()=>{Xh();Me();et();F()});function bs(e,t){return te(e0(e),t)}var lf=m(()=>{St();Qh()});var Bc,kc,Cc,ey=m(()=>{Je();W();Bc=class extends T{constructor({domain:t}){super(`Invalid domain "${Y(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}},kc=class extends T{constructor({primaryType:t,types:r}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}},Cc=class extends T{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}});function t0(e){let{domain:t,message:r,primaryType:n,types:o}=e,s=(c,u)=>{let f={...u};for(let d of c){let{name:l,type:p}=d;p==="address"&&(f[l]=f[l].toLowerCase())}return f},i=o.EIP712Domain?t?s(o.EIP712Domain,t):{}:{},a=(()=>{if(n!=="EIP712Domain")return s(o[n],r)})();return Y({domain:i,message:a,primaryType:n,types:o})}function Rc(e){let{domain:t,message:r,primaryType:n,types:o}=e,s=(i,a)=>{for(let c of i){let{name:u,type:f}=c,d=a[u],l=f.match(fa);if(l&&(typeof d=="number"||typeof d=="bigint")){let[y,g,v]=l;I(d,{signed:g==="int",size:Number.parseInt(v,10)/8})}if(f==="address"&&typeof d=="string"&&!Q(d))throw new ae({address:d});let p=f.match(md);if(p){let[y,g]=p;if(g&&J(d)!==Number.parseInt(g,10))throw new Yn({expectedSize:Number.parseInt(g,10),givenSize:J(d)})}let h=o[f];h&&(BT(f),s(h,d))}};if(o.EIP712Domain&&t){if(typeof t!="object")throw new Bc({domain:t});s(o.EIP712Domain,t)}if(n!=="EIP712Domain")if(o[n])s(o[n],r);else throw new kc({primaryType:n,types:o})}function Pi({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId=="number"||typeof e?.chainId=="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Pw({domain:e}){return hf({domain:e,types:{EIP712Domain:Pi({domain:e})}})}function BT(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Cc({type:e})}var r0=m(()=>{le();rr();ey();pt();et();F();ld();yf();Je()});function $c(e){let{domain:t={},message:r,primaryType:n}=e,o={EIP712Domain:Pi({domain:t}),...e.types};Rc({domain:t,message:r,primaryType:n,types:o});let s=["0x1901"];return t&&s.push(hf({domain:t,types:o})),n!=="EIP712Domain"&&s.push(n0({data:r,primaryType:n,types:o})),te(ie(s))}function hf({domain:e,types:t}){return n0({data:e,primaryType:"EIP712Domain",types:t})}function n0({data:e,primaryType:t,types:r}){let n=Sw({data:e,primaryType:t,types:r});return te(n)}function Sw({data:e,primaryType:t,types:r}){let n=[{type:"bytes32"}],o=[kT({primaryType:t,types:r})];for(let s of r[t]){let[i,a]=Bw({types:r,name:s.name,type:s.type,value:e[s.name]});n.push(i),o.push(a)}return Oe(n,o)}function kT({primaryType:e,types:t}){let r=me(CT({primaryType:e,types:t}));return te(r)}function CT({primaryType:e,types:t}){let r="",n=Iw({primaryType:e,types:t});n.delete(e);let o=[e,...Array.from(n).sort()];for(let s of o)r+=`${s}(${t[s].map(({name:i,type:a})=>`${a} ${i}`).join(",")})`;return r}function Iw({primaryType:e,types:t},r=new Set){let o=e.match(/^\w*/u)?.[0];if(r.has(o)||t[o]===void 0)return r;r.add(o);for(let s of t[o])Iw({primaryType:s.type,types:t},r);return r}function Bw({types:e,name:t,type:r,value:n}){if(e[r]!==void 0)return[{type:"bytes32"},te(Sw({data:n,primaryType:r,types:e}))];if(r==="bytes")return[{type:"bytes32"},te(n)];if(r==="string")return[{type:"bytes32"},te(me(n))];if(r.lastIndexOf("]")===r.length-1){let o=r.slice(0,r.lastIndexOf("[")),s=n.map(i=>Bw({name:t,type:o,types:e,value:i}));return[{type:"bytes32"},te(Oe(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:r},n]}var yf=m(()=>{wr();Me();F();St();r0()});var o0,kw,s0=m(()=>{o0="0x6492649264926492649264926492649264926492649264926492649264926492",kw="0x0000000000000000000000000000000000000000000000000000000000000000"});function i0(e){return Lr(e,-32)===o0}var ty=m(()=>{s0();jt()});var Cw,Rw=m(()=>{Cw="1.2.4"});var $e,Nc=m(()=>{Rw();$e=class e extends Error{constructor(t,r={}){let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath,s=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${Cw}`].join(`
46
+ `);super(s),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"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t}}});function Qt(e,t){return e.exec(t)?.groups}var ry,ny,a0,bf=m(()=>{ry=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ny=/^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)?$/,a0=/^\(.+?\).*?$/});function c0(e){let t=e.type;if($w.test(e.type)&&"components"in e){t="(";let r=e.components.length;for(let o=0;o<r;o++){let s=e.components[o];t+=c0(s),o<r-1&&(t+=", ")}let n=Qt($w,e.type);return t+=`)${n?.array||""}`,c0({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var $w,Nw=m(()=>{bf();$w=/^tuple(?<array>(\[(\d*)\])*)$/});function Un(e){let t="",r=e.length;for(let n=0;n<r;n++){let o=e[n];t+=c0(o),n!==r-1&&(t+=", ")}return t}var oy=m(()=>{Nw()});function xf(e){return e.type==="function"?`function ${e.name}(${Un(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Un(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Un(e.inputs)})`:e.type==="error"?`error ${e.name}(${Un(e.inputs)})`:e.type==="constructor"?`constructor(${Un(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var Hw=m(()=>{oy()});function zw(e){return Mw.test(e)}function _w(e){return Qt(Mw,e)}function Lw(e){return Uw.test(e)}function Fw(e){return Qt(Uw,e)}function Dw(e){return Ow.test(e)}function qw(e){return Qt(Ow,e)}function Hc(e){return jw.test(e)}function Gw(e){return Qt(jw,e)}function Ww(e){return Vw.test(e)}function Kw(e){return Qt(Vw,e)}function Jw(e){return Zw.test(e)}function Yw(e){return Qt(Zw,e)}function Xw(e){return RT.test(e)}var Mw,Uw,Ow,jw,Vw,Zw,RT,sy,Qw,u0,gf=m(()=>{bf();Mw=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Uw=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;Ow=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;jw=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;Vw=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;Zw=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;RT=/^receive\(\) external payable$/;sy=new Set(["memory","indexed","storage","calldata"]),Qw=new Set(["indexed"]),u0=new Set(["calldata","memory","storage"])});var f0,d0,p0,m0=m(()=>{Nc();f0=class extends $e{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}},d0=class extends $e{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" 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"})}},p0=class extends $e{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}});var l0,h0,y0,b0,x0,g0,w0=m(()=>{Nc();l0=class extends $e{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},h0=class extends $e{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},y0=class extends $e{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" 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"})}},b0=class extends $e{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},x0=class extends $e{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" 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"})}},g0=class extends $e{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}});var on,v0,E0,iy=m(()=>{Nc();on=class extends $e{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},v0=class extends $e{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},E0=class extends $e{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}});var A0,e8=m(()=>{Nc();A0=class extends $e{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}});var T0,t8=m(()=>{Nc();T0=class extends $e{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}});function r8(e,t,r){let n="";if(r)for(let o of Object.entries(r)){if(!o)continue;let s="";for(let i of o[1])s+=`[${i.type}${i.name?`:${i.name}`:""}]`;n+=`(${o[0]}{${s}})`}return t?`${t}:${e}${n}`:`${e}${n}`}var P0,n8=m(()=>{P0=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 ay(e,t={}){if(Dw(e))return $T(e,t);if(Lw(e))return NT(e,t);if(zw(e))return HT(e,t);if(Ww(e))return MT(e,t);if(Jw(e))return zT(e);if(Xw(e))return{type:"receive",stateMutability:"payable"};throw new v0({signature:e})}function $T(e,t={}){let r=qw(e);if(!r)throw new on({signature:e,type:"function"});let n=Mt(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(Cr(n[a],{modifiers:u0,structs:t,type:"function"}));let i=[];if(r.returns){let a=Mt(r.returns),c=a.length;for(let u=0;u<c;u++)i.push(Cr(a[u],{modifiers:u0,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:i}}function NT(e,t={}){let r=Fw(e);if(!r)throw new on({signature:e,type:"event"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{modifiers:Qw,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}function HT(e,t={}){let r=_w(e);if(!r)throw new on({signature:e,type:"error"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}function MT(e,t={}){let r=Kw(e);if(!r)throw new on({signature:e,type:"constructor"});let n=Mt(r.parameters),o=[],s=n.length;for(let i=0;i<s;i++)o.push(Cr(n[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}function zT(e){let t=Yw(e);if(!t)throw new on({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function Cr(e,t){let r=r8(e,t?.type,t?.structs);if(P0.has(r))return P0.get(r);let n=a0.test(e),o=Qt(n?UT:_T,e);if(!o)throw new h0({param:e});if(o.name&&OT(o.name))throw new y0({param:e,name:o.name});let s=o.name?{name:o.name}:{},i=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},c,u={};if(n){c="tuple";let d=Mt(o.type),l=[],p=d.length;for(let h=0;h<p;h++)l.push(Cr(d[h],{structs:a}));u={components:l}}else if(o.type in a)c="tuple",u={components:a[o.type]};else if(LT.test(o.type))c=`${o.type}256`;else if(o.type==="address payable")c="address";else if(c=o.type,t?.type!=="struct"&&!cy(c))throw new p0({type:c});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new b0({param:e,type:t?.type,modifier:o.modifier});if(u0.has(o.modifier)&&!DT(c,!!o.array))throw new x0({param:e,type:t?.type,modifier:o.modifier})}let f={type:`${c}${o.array??""}`,...s,...i,...u};return P0.set(r,f),f}function Mt(e,t=[],r="",n=0){let o=e.trim().length;for(let s=0;s<o;s++){let i=e[s],a=e.slice(s+1);switch(i){case",":return n===0?Mt(a,[...t,r.trim()]):Mt(a,t,`${r}${i}`,n);case"(":return Mt(a,t,`${r}${i}`,n+1);case")":return Mt(a,t,`${r}${i}`,n-1);default:return Mt(a,t,`${r}${i}`,n)}}if(r==="")return t;if(n!==0)throw new T0({current:r,depth:n});return t.push(r.trim()),t}function cy(e){return e==="address"||e==="bool"||e==="function"||e==="string"||ry.test(e)||ny.test(e)}function OT(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||ry.test(e)||ny.test(e)||FT.test(e)}function DT(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var _T,UT,LT,FT,wf=m(()=>{bf();m0();w0();iy();t8();n8();gf();_T=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,UT=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,LT=/^u?int$/;FT=/^(?: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 S0(e){let t={},r=e.length;for(let i=0;i<r;i++){let a=e[i];if(!Hc(a))continue;let c=Gw(a);if(!c)throw new on({signature:a,type:"struct"});let u=c.properties.split(";"),f=[],d=u.length;for(let l=0;l<d;l++){let h=u[l].trim();if(!h)continue;let y=Cr(h,{type:"struct"});f.push(y)}if(!f.length)throw new E0({signature:a});t[c.name]=f}let n={},o=Object.entries(t),s=o.length;for(let i=0;i<s;i++){let[a,c]=o[i];n[a]=o8(c,t)}return n}function o8(e=[],t={},r=new Set){let n=[],o=e.length;for(let s=0;s<o;s++){let i=e[s];if(a0.test(i.type))n.push(i);else{let c=Qt(qT,i.type);if(!c?.type)throw new g0({abiParameter:i});let{array:u,type:f}=c;if(f in t){if(r.has(f))throw new A0({type:f});n.push({...i,type:`tuple${u??""}`,components:o8(t[f],t,new Set([...r,f]))})}else if(cy(f))n.push(i);else throw new d0({type:f})}}return n}var qT,uy=m(()=>{bf();m0();w0();iy();e8();gf();wf();qT=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/});function I0(e){let t;if(typeof e=="string")t=ay(e);else{let r=S0(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(!Hc(s)){t=ay(s,r);break}}}if(!t)throw new f0({signature:e});return t}var s8=m(()=>{m0();gf();uy();wf()});function B0(e){let t=[];if(typeof e=="string"){let r=Mt(e),n=r.length;for(let o=0;o<n;o++)t.push(Cr(r[o],{modifiers:sy}))}else{let r=S0(e),n=e.length;for(let o=0;o<n;o++){let s=e[o];if(Hc(s))continue;let i=Mt(s),a=i.length;for(let c=0;c<a;c++)t.push(Cr(i[c],{modifiers:sy,structs:r}))}}if(t.length===0)throw new l0({params:e});return t}var i8=m(()=>{w0();gf();uy();wf();wf()});var fy=m(()=>{Hw();oy();s8();i8()});var k0,c8=m(()=>{k0=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let r=super.get(t);return super.has(t)&&r!==void 0&&(this.delete(t),super.set(t,r)),r}set(t,r){if(super.set(t,r),this.maxSize&&this.size>this.maxSize){let n=this.keys().next().value;n&&this.delete(n)}return this}}});var jT,C0,u8=m(()=>{c8();jT={checksum:new k0(8192)},C0=jT.checksum});function Si(e,t={}){let{as:r=typeof e=="string"?"Hex":"Bytes"}=t,n=dd(h5(e));return r==="Bytes"?n:ke(n)}var R0=m(()=>{el();os();We()});function f8(e,t={}){let{compressed:r}=t,{prefix:n,x:o,y:s}=e;if(r===!1||typeof o=="bigint"&&typeof s=="bigint"){if(n!==4)throw new $0({prefix:n,cause:new ly});return}if(r===!0||typeof o=="bigint"&&typeof s>"u"){if(n!==3&&n!==2)throw new $0({prefix:n,cause:new my});return}throw new py({publicKey:e})}function d8(e){let t=(()=>{if(Qu(e))return p8(e);if(v5(e))return VT(e);let{prefix:r,x:n,y:o}=e;return typeof n=="bigint"&&typeof o=="bigint"?{prefix:r??4,x:n,y:o}:{prefix:r,x:n}})();return f8(t),t}function VT(e){return p8(ke(e))}function p8(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new hy({publicKey:e});if(e.length===130){let n=BigInt(ge(e,0,32)),o=BigInt(ge(e,32,64));return{prefix:4,x:n,y:o}}if(e.length===132){let n=Number(ge(e,0,1)),o=BigInt(ge(e,1,33)),s=BigInt(ge(e,33,65));return{prefix:n,x:o,y:s}}let t=Number(ge(e,0,1)),r=BigInt(ge(e,1,33));return{prefix:t,x:r}}function yy(e,t={}){f8(e);let{prefix:r,x:n,y:o}=e,{includePrefix:s=!0}=t;return Te(s?se(r,{size:1}):"0x",se(n,{size:32}),typeof o=="bigint"?se(o,{size:32}):"0x")}var py,$0,my,ly,hy,by=m(()=>{os();Nt();We();Yu();py=class extends D{constructor({publicKey:t}){super(`Value \`${ss(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}},$0=class extends D{constructor({prefix:t,cause:r}){super(`Prefix "${t}" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}},my=class extends D{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}},ly=class extends D{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}},hy=class extends D{constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${xe(rc(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}});function Ii(e,t={}){let{strict:r=!0}=t;if(!WT.test(e))throw new N0({address:e,cause:new xy});if(r){if(e.toLowerCase()===e)return;if(H0(e)!==e)throw new N0({address:e,cause:new gy})}}function H0(e){if(C0.has(e))return C0.get(e);Ii(e,{strict:!1});let t=e.substring(2).toLowerCase(),r=Si(y5(t),{as:"Bytes"}),n=t.split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&n[s]&&(n[s]=n[s].toUpperCase()),(r[s>>1]&15)>=8&&n[s+1]&&(n[s+1]=n[s+1].toUpperCase());let o=`0x${n.join("")}`;return C0.set(e,o),o}function KT(e,t={}){let{checksum:r=!1}=t;return Ii(e),r?H0(e):e}function l8(e,t={}){let r=Si(`0x${yy(e).slice(4)}`).substring(26);return KT(`0x${r}`,t)}function M0(e,t={}){let{strict:r=!0}=t??{};try{return Ii(e,{strict:r}),!0}catch{return!1}}var WT,N0,xy,gy,vf=m(()=>{os();u8();Nt();R0();by();WT=/^0x[a-fA-F0-9]{40}$/;N0=class extends D{constructor({address:t,cause:r}){super(`Address "${t}" is invalid.`,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}},xy=class extends D{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}},gy=class extends D{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}});var h8,y8,_0,SG,IG,BG,kG,CG,RG,$G,NG,HG,MG,zG,_G,UG,LG,FG,OG,DG,qG,jG,GG,VG,WG,KG,ZG,JG,YG,XG,QG,eV,tV,rV,nV,oV,sV,iV,aV,cV,uV,fV,dV,pV,mV,lV,hV,yV,bV,xV,gV,wV,vV,EV,AV,TV,PV,SV,IV,BV,kV,CV,RV,$V,NV,HV,MV,zV,_V,UV,LV,FV,OV,DV,qV,jV,GV,VV,WV,KV,ZV,JV,YV,XV,QV,eW,tW,rW,nW,oW,sW,iW,aW,cW,uW,fW,dW,pW,wy,U0=m(()=>{h8=/^(.*)\[([0-9]*)\]$/,y8=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,_0=/^(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)?$/,SG=2n**(8n-1n)-1n,IG=2n**(16n-1n)-1n,BG=2n**(24n-1n)-1n,kG=2n**(32n-1n)-1n,CG=2n**(40n-1n)-1n,RG=2n**(48n-1n)-1n,$G=2n**(56n-1n)-1n,NG=2n**(64n-1n)-1n,HG=2n**(72n-1n)-1n,MG=2n**(80n-1n)-1n,zG=2n**(88n-1n)-1n,_G=2n**(96n-1n)-1n,UG=2n**(104n-1n)-1n,LG=2n**(112n-1n)-1n,FG=2n**(120n-1n)-1n,OG=2n**(128n-1n)-1n,DG=2n**(136n-1n)-1n,qG=2n**(144n-1n)-1n,jG=2n**(152n-1n)-1n,GG=2n**(160n-1n)-1n,VG=2n**(168n-1n)-1n,WG=2n**(176n-1n)-1n,KG=2n**(184n-1n)-1n,ZG=2n**(192n-1n)-1n,JG=2n**(200n-1n)-1n,YG=2n**(208n-1n)-1n,XG=2n**(216n-1n)-1n,QG=2n**(224n-1n)-1n,eV=2n**(232n-1n)-1n,tV=2n**(240n-1n)-1n,rV=2n**(248n-1n)-1n,nV=2n**(256n-1n)-1n,oV=-(2n**(8n-1n)),sV=-(2n**(16n-1n)),iV=-(2n**(24n-1n)),aV=-(2n**(32n-1n)),cV=-(2n**(40n-1n)),uV=-(2n**(48n-1n)),fV=-(2n**(56n-1n)),dV=-(2n**(64n-1n)),pV=-(2n**(72n-1n)),mV=-(2n**(80n-1n)),lV=-(2n**(88n-1n)),hV=-(2n**(96n-1n)),yV=-(2n**(104n-1n)),bV=-(2n**(112n-1n)),xV=-(2n**(120n-1n)),gV=-(2n**(128n-1n)),wV=-(2n**(136n-1n)),vV=-(2n**(144n-1n)),EV=-(2n**(152n-1n)),AV=-(2n**(160n-1n)),TV=-(2n**(168n-1n)),PV=-(2n**(176n-1n)),SV=-(2n**(184n-1n)),IV=-(2n**(192n-1n)),BV=-(2n**(200n-1n)),kV=-(2n**(208n-1n)),CV=-(2n**(216n-1n)),RV=-(2n**(224n-1n)),$V=-(2n**(232n-1n)),NV=-(2n**(240n-1n)),HV=-(2n**(248n-1n)),MV=-(2n**(256n-1n)),zV=2n**8n-1n,_V=2n**16n-1n,UV=2n**24n-1n,LV=2n**32n-1n,FV=2n**40n-1n,OV=2n**48n-1n,DV=2n**56n-1n,qV=2n**64n-1n,jV=2n**72n-1n,GV=2n**80n-1n,VV=2n**88n-1n,WV=2n**96n-1n,KV=2n**104n-1n,ZV=2n**112n-1n,JV=2n**120n-1n,YV=2n**128n-1n,XV=2n**136n-1n,QV=2n**144n-1n,eW=2n**152n-1n,tW=2n**160n-1n,rW=2n**168n-1n,nW=2n**176n-1n,oW=2n**184n-1n,sW=2n**192n-1n,iW=2n**200n-1n,aW=2n**208n-1n,cW=2n**216n-1n,uW=2n**224n-1n,fW=2n**232n-1n,dW=2n**240n-1n,pW=2n**248n-1n,wy=2n**256n-1n});function Bi(e,t,r){let{checksumAddress:n,staticPosition:o}=r,s=Ay(t.type);if(s){let[i,a]=s;return JT(e,{...t,type:a},{checksumAddress:n,length:i,staticPosition:o})}if(t.type==="tuple")return eP(e,t,{checksumAddress:n,staticPosition:o});if(t.type==="address")return ZT(e,{checksum:n});if(t.type==="bool")return YT(e);if(t.type.startsWith("bytes"))return XT(e,t,{staticPosition:o});if(t.type.startsWith("uint")||t.type.startsWith("int"))return QT(e,t);if(t.type==="string")return tP(e,{staticPosition:o});throw new Mc(t.type)}function ZT(e,t={}){let{checksum:r=!1}=t,n=e.readBytes(32);return[(s=>r?H0(s):s)(ke(b5(n,-20))),32]}function JT(e,t,r){let{checksumAddress:n,length:o,staticPosition:s}=r;if(!o){let c=Xr(e.readBytes(vy)),u=s+c,f=u+x8;e.setPosition(u);let d=Xr(e.readBytes(x8)),l=Ef(t),p=0,h=[];for(let y=0;y<d;++y){e.setPosition(f+(l?y*32:p));let[g,v]=Bi(e,t,{checksumAddress:n,staticPosition:f});p+=v,h.push(g)}return e.setPosition(s+32),[h,32]}if(Ef(t)){let c=Xr(e.readBytes(vy)),u=s+c,f=[];for(let d=0;d<o;++d){e.setPosition(u+d*32);let[l]=Bi(e,t,{checksumAddress:n,staticPosition:u});f.push(l)}return e.setPosition(s+32),[f,32]}let i=0,a=[];for(let c=0;c<o;++c){let[u,f]=Bi(e,t,{checksumAddress:n,staticPosition:s+i});i+=f,a.push(u)}return[a,i]}function YT(e){return[g5(e.readBytes(32),{size:32}),32]}function XT(e,t,{staticPosition:r}){let[n,o]=t.type.split("bytes");if(!o){let i=Xr(e.readBytes(32));e.setPosition(r+i);let a=Xr(e.readBytes(32));if(a===0)return e.setPosition(r+32),["0x",32];let c=e.readBytes(a);return e.setPosition(r+32),[ke(c),32]}return[ke(e.readBytes(Number.parseInt(o,10),32)),32]}function QT(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),o=e.readBytes(32);return[n>48?x5(o,{signed:r}):Xr(o,{signed:r}),32]}function eP(e,t,r){let{checksumAddress:n,staticPosition:o}=r,s=t.components.length===0||t.components.some(({name:c})=>!c),i=s?[]:{},a=0;if(Ef(t)){let c=Xr(e.readBytes(vy)),u=o+c;for(let f=0;f<t.components.length;++f){let d=t.components[f];e.setPosition(u+a);let[l,p]=Bi(e,d,{checksumAddress:n,staticPosition:u});a+=p,i[s?f:d?.name]=l}return e.setPosition(o+32),[i,32]}for(let c=0;c<t.components.length;++c){let u=t.components[c],[f,d]=Bi(e,u,{checksumAddress:n,staticPosition:o});i[s?c:u?.name]=f,a+=d}return[i,a]}function tP(e,{staticPosition:t}){let r=Xr(e.readBytes(32)),n=t+r;e.setPosition(n);let o=Xr(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let s=e.readBytes(o,32),i=w5(sh(s));return e.setPosition(t+32),[i,32]}function g8({checksumAddress:e,parameters:t,values:r}){let n=[];for(let o=0;o<t.length;o++)n.push(Ey({checksumAddress:e,parameter:t[o],value:r[o]}));return n}function Ey({checksumAddress:e=!1,parameter:t,value:r}){let n=t,o=Ay(n.type);if(o){let[s,i]=o;return nP(r,{checksumAddress:e,length:s,parameter:{...n,type:i}})}if(n.type==="tuple")return cP(r,{checksumAddress:e,parameter:n});if(n.type==="address")return rP(r,{checksum:e});if(n.type==="bool")return sP(r);if(n.type.startsWith("uint")||n.type.startsWith("int")){let s=n.type.startsWith("int"),[,,i="256"]=_0.exec(n.type)??[];return iP(r,{signed:s,size:Number(i)})}if(n.type.startsWith("bytes"))return oP(r,{type:n.type});if(n.type==="string")return aP(r);throw new Mc(n.type)}function L0(e){let t=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?t+=32:t+=xe(a)}let r=[],n=[],o=0;for(let s=0;s<e.length;s++){let{dynamic:i,encoded:a}=e[s];i?(r.push(se(t+o,{size:32})),n.push(a),o+=xe(a)):r.push(a)}return Te(...r,...n)}function rP(e,t){let{checksum:r=!1}=t;return Ii(e,{strict:r}),{dynamic:!1,encoded:$n(e.toLowerCase())}}function nP(e,t){let{checksumAddress:r,length:n,parameter:o}=t,s=n===null;if(!Array.isArray(e))throw new O0(e);if(!s&&e.length!==n)throw new F0({expectedLength:n,givenLength:e.length,type:`${o.type}[${n}]`});let i=!1,a=[];for(let c=0;c<e.length;c++){let u=Ey({checksumAddress:r,parameter:o,value:e[c]});u.dynamic&&(i=!0),a.push(u)}if(s||i){let c=L0(a);if(s){let u=se(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?Te(u,c):u}}if(i)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:Te(...a.map(({encoded:c})=>c))}}function oP(e,{type:t}){let[,r]=t.split("bytes"),n=xe(e);if(!r){let o=e;return n%32!==0&&(o=Qr(o,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:Te($n(se(n,{size:32})),o)}}if(n!==Number.parseInt(r,10))throw new Af({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:Qr(e)}}function sP(e){if(typeof e!="boolean")throw new D(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:$n(tp(e))}}function iP(e,{signed:t,size:r}){if(typeof r=="number"){let n=2n**(BigInt(r)-(t?1n:0n))-1n,o=t?-n-1n:0n;if(e>n||e<o)throw new Xu({max:n.toString(),min:o.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:se(e,{size:32,signed:t})}}function aP(e){let t=nc(e),r=Math.ceil(xe(t)/32),n=[];for(let o=0;o<r;o++)n.push(Qr(ge(t,o*32,(o+1)*32)));return{dynamic:!0,encoded:Te(Qr(se(xe(t),{size:32})),...n)}}function cP(e,t){let{checksumAddress:r,parameter:n}=t,o=!1,s=[];for(let i=0;i<n.components.length;i++){let a=n.components[i],c=Array.isArray(e)?i:a.name,u=Ey({checksumAddress:r,parameter:a,value:e[c]});s.push(u),u.dynamic&&(o=!0)}return{dynamic:o,encoded:o?L0(s):Te(...s.map(({encoded:i})=>i))}}function Ay(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Ef(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Ef);let r=Ay(e.type);return!!(r&&Ef({...e,type:r[1]}))}var x8,vy,w8=m(()=>{zc();vf();os();Nt();We();U0();x8=32,vy=32});function q0(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(fP);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}var fP,D0,Ty,Py,Sy=m(()=>{Nt();fP={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Py({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Ty({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new D0({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new D0({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};D0=class extends D{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}},Ty=class extends D{constructor({length:t,position:r}){super(`Position \`${r}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}},Py=class extends D{constructor({count:t,limit:r}){super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}});function _c(e,t,r={}){let{as:n="Array",checksumAddress:o=!1}=r,s=typeof t=="string"?tc(t):t,i=q0(s);if(fr(s)===0&&e.length>0)throw new ky;if(fr(s)&&fr(s)<32)throw new By({data:typeof t=="string"?t:ke(t),parameters:e,size:fr(s)});let a=0,c=n==="Array"?[]:{};for(let u=0;u<e.length;++u){let f=e[u];i.setPosition(a);let[d,l]=Bi(i,f,{checksumAddress:o,staticPosition:0});a+=l,n==="Array"?c.push(d):c[f.name??u]=d}return c}function xs(e,t,r){let{checksumAddress:n=!1}=r??{};if(e.length!==t.length)throw new j0({expectedLength:e.length,givenLength:t.length});let o=g8({checksumAddress:n,parameters:e,values:t}),s=L0(o);return s.length===0?"0x":s}function Iy(e,t){if(e.length!==t.length)throw new j0({expectedLength:e.length,givenLength:t.length});let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n];r.push(Iy.encode(o,s))}return Te(...r)}function Pf(e){return Array.isArray(e)&&typeof e[0]=="string"?B0(e):typeof e=="string"?B0(e):e}var By,ky,F0,Af,j0,O0,Mc,zc=m(()=>{fy();vf();os();Nt();We();w8();Sy();U0();(function(e){function t(r,n,o=!1){if(r==="address"){let c=n;return Ii(c),$n(c.toLowerCase(),o?32:0)}if(r==="string")return nc(n);if(r==="bytes")return n;if(r==="bool")return $n(tp(n),o?32:1);let s=r.match(_0);if(s){let[c,u,f="256"]=s,d=Number.parseInt(f,10)/8;return se(n,{size:o?32:d,signed:u==="int"})}let i=r.match(y8);if(i){let[c,u]=i;if(Number.parseInt(u,10)!==(n.length-2)/2)throw new Af({expectedSize:Number.parseInt(u,10),value:n});return Qr(n,o?32:0)}let a=r.match(h8);if(a&&Array.isArray(n)){let[c,u]=a,f=[];for(let d=0;d<n.length;d++)f.push(t(u,n[d],!0));return f.length===0?"0x":Te(...f)}throw new Mc(r)}e.encode=t})(Iy||(Iy={}));By=class extends D{constructor({data:t,parameters:r,size:n}){super(`Data size of ${n} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Un(r)})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}},ky=class extends D{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}},F0=class extends D{constructor({expectedLength:t,givenLength:r,type:n}){super(`Array length mismatch for type \`${n}\`. Expected: \`${t}\`. Given: \`${r}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}},Af=class extends D{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${xe(r)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}},j0=class extends D{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${r}`].join(`
47
+ `)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}},O0=class extends D{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}},Mc=class extends D{constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}});function dP(e,t){let{as:r}=t,n=A8(e),o=q0(new Uint8Array(n.length));return n.encode(o),r==="Hex"?ke(o.bytes):o.bytes}function E8(e,t={}){let{as:r="Hex"}=t;return dP(e,{as:r})}function A8(e){return Array.isArray(e)?pP(e.map(t=>A8(t))):mP(e)}function pP(e){let t=e.reduce((o,s)=>o+s.length,0),r=T8(t);return{length:t<=55?1+t:1+r+t,encode(o){t<=55?o.pushByte(192+t):(o.pushByte(247+r),r===1?o.pushUint8(t):r===2?o.pushUint16(t):r===3?o.pushUint24(t):o.pushUint32(t));for(let{encode:s}of e)s(o)}}}function mP(e){let t=typeof e=="string"?tc(e):e,r=T8(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(o){t.length===1&&t[0]<128?o.pushBytes(t):t.length<=55?(o.pushByte(128+t.length),o.pushBytes(t)):(o.pushByte(183+r),r===1?o.pushUint8(t.length):r===2?o.pushUint16(t.length):r===3?o.pushUint24(t.length):o.pushUint32(t.length),o.pushBytes(t))}}}function T8(e){if(e<=255)return 1;if(e<=65535)return 2;if(e<=16777215)return 3;if(e<=4294967295)return 4;throw new D("Length is too large.")}var P8=m(()=>{os();Nt();We();Sy()});function Hy(e,t={}){let{recovered:r}=t;if(typeof e.r>"u")throw new Sf({signature:e});if(typeof e.s>"u")throw new Sf({signature:e});if(r&&typeof e.yParity>"u")throw new Sf({signature:e});if(e.r<0n||e.r>wy)throw new Ry({value:e.r});if(e.s<0n||e.s>wy)throw new $y({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new If({value:e.yParity})}function hP(e){return S8(ke(e))}function S8(e){if(e.length!==130&&e.length!==132)throw new Cy({signature:e});let t=BigInt(ge(e,0,32)),r=BigInt(ge(e,32,64)),n=(()=>{let o=+`0x${e.slice(130)}`;if(!Number.isNaN(o))try{return _y(o)}catch{throw new If({value:o})}})();return typeof n>"u"?{r:t,s:r}:{r:t,s:r,yParity:n}}function My(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return zy(e)}function zy(e){let t=typeof e=="string"?S8(e):e instanceof Uint8Array?hP(e):typeof e.r=="string"?bP(e):e.v?yP(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return Hy(t),t}function yP(e){return{r:e.r,s:e.s,yParity:_y(e.v)}}function bP(e){let t=(()=>{let r=e.v?Number(e.v):void 0,n=e.yParity?Number(e.yParity):void 0;if(typeof r=="number"&&typeof n!="number"&&(n=_y(r)),typeof n!="number")throw new If({value:e.yParity});return n})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function I8(e){let{r:t,s:r,yParity:n}=e;return[n?"0x01":"0x",t===0n?"0x":ah(se(t)),r===0n?"0x":ah(se(r))]}function _y(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Ny({value:e})}var Cy,Sf,Ry,$y,If,Ny,Uy=m(()=>{Nt();We();Yu();U0();Cy=class extends D{constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${xe(rc(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}},Sf=class extends D{constructor({signature:t}){super(`Signature \`${ss(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}},Ry=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}},$y=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}},If=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}},Ny=class extends D{constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}});function k8(e,t={}){return typeof e.chainId=="string"?xP(e):{...e,...t.signature}}function xP(e){let{address:t,chainId:r,nonce:n}=e,o=My(e);return{address:t,chainId:Number(r),nonce:BigInt(n),...o}}function C8(e){return gP(e,{presign:!0})}function gP(e,t={}){let{presign:r}=t;return Si(Te("0x05",E8(wP(r?{address:e.address,chainId:e.chainId,nonce:e.nonce}:e))))}function wP(e){let{address:t,chainId:r,nonce:n}=e,o=My(e);return[r?se(r):"0x",t,n?se(n):"0x",...o?I8(o):[]]}var R8=m(()=>{R0();We();P8();Uy()});function $8(e){return l8(EP(e))}function EP(e){let{payload:t,signature:r}=e,{r:n,s:o,yParity:s}=r,a=new xt.Signature(BigInt(n),BigInt(o)).addRecoveryBit(s).recoverPublicKey(rc(t).substring(2));return d8(a)}var N8=m(()=>{di();vf();We();by()});var Rr={};Nr(Rr,{InvalidWrappedSignatureError:()=>G0,assert:()=>V0,from:()=>TP,magicBytes:()=>Ly,suffixParameters:()=>Fy,unwrap:()=>H8,validate:()=>SP,wrap:()=>PP});function V0(e){if(typeof e=="string"){if(ge(e,-32)!==Ly)throw new G0(e)}else Hy(e.authorization)}function TP(e){return typeof e=="string"?H8(e):e}function H8(e){V0(e);let t=Xd(ge(e,-64,-32)),r=ge(e,-t-64,-64),n=ge(e,0,-t-64),[o,s,i]=_c(Fy,r);return{authorization:k8({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:n,...i&&i!=="0x"?{data:i,to:s}:{}}}function PP(e){let{data:t,signature:r}=e;V0(e);let n=$8({payload:C8(e.authorization),signature:zy(e.authorization)}),o=xs(Fy,[{...e.authorization,delegation:e.authorization.address,chainId:BigInt(e.authorization.chainId)},e.to??n,t??"0x"]),s=se(xe(o),{size:32});return Te(r,o,s,Ly)}function SP(e){try{return V0(e),!0}catch{return!1}}var Ly,Fy,G0,M8=m(()=>{zc();R8();Nt();We();N8();Uy();Ly="0x8010801080108010801080108010801080108010801080108010801080108010",Fy=Pf("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");G0=class extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}}});var Bf=m(()=>{M8()});function W0(e){return Rr.validate(e)}var Oy=m(()=>{Bf()});function z8(e){if(!i0(e))return{signature:e};let[t,r,n]=mt([{type:"address"},{type:"bytes"},{type:"bytes"}],e);return{address:t,data:r,signature:n}}var _8=m(()=>{no();ty()});function U8(e){if(!W0(e))return{signature:e};let{authorization:t,to:r,...n}=Rr.unwrap(e);return{authorization:{address:t.address,chainId:t.chainId,nonce:Number(t.nonce),r:I(t.r,{size:32}),s:I(t.s,{size:32}),yParity:t.yParity},...r?{address:r}:{},...n}}var L8=m(()=>{Bf();F();Oy()});async function K0({message:e,signature:t}){return gt({hash:bs(e),signature:t})}var Dy=m(()=>{lf();zo()});async function Z0(e){let{domain:t,message:r,primaryType:n,signature:o,types:s}=e;return gt({hash:$c({domain:t,message:r,primaryType:n,types:s}),signature:o})}var qy=m(()=>{yf();zo()});function F8(e){let{address:t,data:r,signature:n,to:o="hex"}=e,s=Ae([Oe([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,r,n]),o0]);return o==="hex"?s:re(s)}var O8=m(()=>{s0();wr();Me();ue()});function D8(e){let{address:t,data:r,signature:n,to:o="hex"}=e,s=Rr.wrap({authorization:{address:e.authorization.address,chainId:e.authorization.chainId,nonce:BigInt(e.authorization.nonce),r:BigInt(e.authorization.r),s:BigInt(e.authorization.s),yParity:e.authorization.yParity},data:r,signature:n,to:t});return o==="hex"?s:re(s)}var q8=m(()=>{Bf();ue()});async function j8({address:e,hash:t,signature:r}){return de(ye(e),await gt({hash:t,signature:r}))}var G8=m(()=>{dt();Jt();zo()});async function V8({address:e,message:t,signature:r}){return de(ye(e),await K0({message:t,signature:r}))}var W8=m(()=>{dt();Jt();Dy()});async function K8(e){let{address:t,domain:r,message:n,primaryType:o,signature:s,types:i}=e;return de(ye(t),await Z0({domain:r,message:n,primaryType:o,signature:s,types:i}))}var Z8=m(()=>{dt();Jt();qy()});function J0(e){let t=Lr(e,0,1);if(t==="0x04")return"eip7702";if(t==="0x03")return"eip4844";if(t==="0x02")return"eip1559";if(t==="0x01")return"eip2930";if(t!=="0x"&&Z(t)>=192)return"legacy";throw new Aa({serializedType:t})}var jy=m(()=>{lt();jt();ve()});function Y0(e){let t=J0(e);return t==="eip1559"?kP(e):t==="eip2930"?CP(e):t==="eip4844"?BP(e):t==="eip7702"?IP(e):RP(e)}function IP(e){let t=X0(e),[r,n,o,s,i,a,c,u,f,d,l,p,h]=t;if(t.length!==10&&t.length!==13)throw new Fr({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gas:i,to:a,value:c,data:u,accessList:f,authorizationList:d,...t.length>9?{v:l,r:p,s:h}:{}},serializedTransaction:e,type:"eip7702"});let y={chainId:Z(r),type:"eip7702"};return O(a)&&a!=="0x"&&(y.to=a),O(i)&&i!=="0x"&&(y.gas=j(i)),O(u)&&u!=="0x"&&(y.data=u),O(n)&&(y.nonce=n==="0x"?0:Z(n)),O(c)&&c!=="0x"&&(y.value=j(c)),O(s)&&s!=="0x"&&(y.maxFeePerGas=j(s)),O(o)&&o!=="0x"&&(y.maxPriorityFeePerGas=j(o)),f.length!==0&&f!=="0x"&&(y.accessList=Q0(f)),d.length!==0&&d!=="0x"&&(y.authorizationList=$P(d)),qp(y),{...t.length===13?kf(t):void 0,...y}}function BP(e){let t=X0(e),r=t.length===4,n=r?t[0]:t,o=r?t.slice(1):[],[s,i,a,c,u,f,d,l,p,h,y,g,v,E]=n,[x,b,w]=o;if(!(n.length===11||n.length===14))throw new Fr({attributes:{chainId:s,nonce:i,maxPriorityFeePerGas:a,maxFeePerGas:c,gas:u,to:f,value:d,data:l,accessList:p,...n.length>9?{v:g,r:v,s:E}:{}},serializedTransaction:e,type:"eip4844"});let A={blobVersionedHashes:y,chainId:Z(s),to:f,type:"eip4844"};return O(u)&&u!=="0x"&&(A.gas=j(u)),O(l)&&l!=="0x"&&(A.data=l),O(i)&&(A.nonce=i==="0x"?0:Z(i)),O(d)&&d!=="0x"&&(A.value=j(d)),O(h)&&h!=="0x"&&(A.maxFeePerBlobGas=j(h)),O(c)&&c!=="0x"&&(A.maxFeePerGas=j(c)),O(a)&&a!=="0x"&&(A.maxPriorityFeePerGas=j(a)),p.length!==0&&p!=="0x"&&(A.accessList=Q0(p)),x&&b&&w&&(A.sidecars=ts({blobs:x,commitments:b,proofs:w})),jp(A),{...n.length===14?kf(n):void 0,...A}}function kP(e){let t=X0(e),[r,n,o,s,i,a,c,u,f,d,l,p]=t;if(!(t.length===9||t.length===12))throw new Fr({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:o,maxFeePerGas:s,gas:i,to:a,value:c,data:u,accessList:f,...t.length>9?{v:d,r:l,s:p}:{}},serializedTransaction:e,type:"eip1559"});let h={chainId:Z(r),type:"eip1559"};return O(a)&&a!=="0x"&&(h.to=a),O(i)&&i!=="0x"&&(h.gas=j(i)),O(u)&&u!=="0x"&&(h.data=u),O(n)&&(h.nonce=n==="0x"?0:Z(n)),O(c)&&c!=="0x"&&(h.value=j(c)),O(s)&&s!=="0x"&&(h.maxFeePerGas=j(s)),O(o)&&o!=="0x"&&(h.maxPriorityFeePerGas=j(o)),f.length!==0&&f!=="0x"&&(h.accessList=Q0(f)),ys(h),{...t.length===12?kf(t):void 0,...h}}function CP(e){let t=X0(e),[r,n,o,s,i,a,c,u,f,d,l]=t;if(!(t.length===8||t.length===11))throw new Fr({attributes:{chainId:r,nonce:n,gasPrice:o,gas:s,to:i,value:a,data:c,accessList:u,...t.length>8?{v:f,r:d,s:l}:{}},serializedTransaction:e,type:"eip2930"});let p={chainId:Z(r),type:"eip2930"};return O(i)&&i!=="0x"&&(p.to=i),O(s)&&s!=="0x"&&(p.gas=j(s)),O(c)&&c!=="0x"&&(p.data=c),O(n)&&(p.nonce=n==="0x"?0:Z(n)),O(a)&&a!=="0x"&&(p.value=j(a)),O(o)&&o!=="0x"&&(p.gasPrice=j(o)),u.length!==0&&u!=="0x"&&(p.accessList=Q0(u)),Ac(p),{...t.length===11?kf(t):void 0,...p}}function RP(e){let t=pf(e,"hex"),[r,n,o,s,i,a,c,u,f]=t;if(!(t.length===6||t.length===9))throw new Fr({attributes:{nonce:r,gasPrice:n,gas:o,to:s,value:i,data:a,...t.length>6?{v:c,r:u,s:f}:{}},serializedTransaction:e,type:"legacy"});let d={type:"legacy"};if(O(s)&&s!=="0x"&&(d.to=s),O(o)&&o!=="0x"&&(d.gas=j(o)),O(a)&&a!=="0x"&&(d.data=a),O(r)&&(d.nonce=r==="0x"?0:Z(r)),O(i)&&i!=="0x"&&(d.value=j(i)),O(n)&&n!=="0x"&&(d.gasPrice=j(n)),Tc(d),t.length===6)return d;let l=O(c)&&c!=="0x"?j(c):0n;if(f==="0x"&&u==="0x")return l>0&&(d.chainId=Number(l)),d;let p=l,h=Number((p-35n)/2n);if(h>0)d.chainId=h;else if(p!==27n&&p!==28n)throw new io({v:p});return d.v=p,d.s=f,d.r=u,d.yParity=p%2n===0n?1:0,d}function X0(e){return pf(`0x${e.slice(4)}`,"hex")}function Q0(e){let t=[];for(let r=0;r<e.length;r++){let[n,o]=e[r];if(!Q(n,{strict:!1}))throw new ae({address:n});t.push({address:n,storageKeys:o.map(s=>Zp(s)?s:he(s))})}return t}function $P(e){let t=[];for(let r=0;r<e.length;r++){let[n,o,s,i,a,c]=e[r];t.push({address:o,chainId:n==="0x"?0:Z(n),nonce:s==="0x"?0:Z(s),...kf([i,a,c])})}return t}function kf(e){let t=e.slice(-3),r=t[0]==="0x"?0n:j(t[0]);if(r!==0n&&r!==1n)throw new va({yParity:r});let n=r===0n?27n:28n;return{r:Pt(t[1],{size:32}),s:Pt(t[2],{size:32}),v:n,yParity:n===27n?0:1}}var Gy=m(()=>{rr();lt();pt();ju();ut();Qn();un();ve();Vh();Wh();Gp();jy()});var Uc,Vy=m(()=>{W();Uc=class extends T{constructor({value:t}){super(`Number \`${t}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}});function gs(e,t){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new Uc({value:e});let[r,n="0"]=e.split("."),o=r.startsWith("-");if(o&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),t===0)Math.round(+`.${n}`)===1&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>t){let[s,i,a]=[n.slice(0,t-1),n.slice(t-1,t),n.slice(t)],c=Math.round(+`${i}.${a}`);c>9?n=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):n=`${s}${c}`,n.length>t&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,t)}else n=n.padEnd(t,"0");return BigInt(`${o?"-":""}${r}${n}`)}var Cf=m(()=>{Vy()});function J8(e,t="wei"){return gs(e,ya[t])}var Y8=m(()=>{xa();Cf()});function X8(e,t="wei"){return gs(e,ba[t])}var Q8=m(()=>{xa();Cf()});var em=m(()=>{Ze();ve()});function NP(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function ev(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Z(e.nonce):void 0,storageProof:e.storageProof?NP(e.storageProof):void 0}}var tv=m(()=>{em()});async function rv(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s,storageKeys:i}){let a=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s}),c=await e.request({method:"eth_getProof",params:[t,i,a]});return ev(c)}var nv=m(()=>{mi();tv()});async function ov(e,{address:t,blockHash:r,blockNumber:n,blockTag:o="latest",requireCanonical:s,slot:i}){let a=Zt({blockHash:r,blockNumber:n,blockTag:o,requireCanonical:s});return await e.request({method:"eth_getStorageAt",params:[t,i,a]})}var sv=m(()=>{mi()});async function Lc(e,{blockHash:t,blockNumber:r,blockTag:n,hash:o,index:s,sender:i,nonce:a}){let c=n||"latest",u=r!==void 0?I(r):void 0,f=null;if(o?f=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?f=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,I(s)]},{dedupe:!0}):(u||c)&&typeof s=="number"?f=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,I(s)]},{dedupe:!!u}):i&&typeof a=="number"&&(f=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[i,I(a)]},{dedupe:!0})),!f)throw new ao({blockHash:t,blockNumber:r,blockTag:c,hash:o,index:s});return(e.chain?.formatters?.transaction?.format||Bn)(f,"getTransaction")}var tm=m(()=>{lt();F();Oa()});async function iv(e,{hash:t,transactionReceipt:r}){let[n,o]=await Promise.all([$(e,en,"getBlockNumber")({}),t?$(e,Lc,"getTransaction")({hash:t}):void 0]),s=r?.blockNumber||o?.blockNumber;return s?n-s+1n:0n}var av=m(()=>{ee();lc();tm()});async function Fc(e,{hash:t}){let r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new co({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||_n)(r,"getTransactionReceipt")}var Wy=m(()=>{lt();xc()});async function cv(e,t){let{account:r,authorizationList:n,allowFailure:o=!0,blockHash:s,blockNumber:i,blockOverrides:a,blockTag:c,requireCanonical:u,stateOverride:f}=t,d=t.contracts,{batchSize:l=t.batchSize??1024,deployless:p=t.deployless??!1}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},h=(()=>{if(t.multicallAddress)return t.multicallAddress;if(p)return null;if(e.chain)return Ht({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),y=[[]],g=0,v=0;for(let b=0;b<d.length;b++){let{abi:w,address:A,args:P,functionName:B}=d[b];try{let R=ne({abi:w,args:P,functionName:B});v+=(R.length-2)/2,l>0&&v>l&&y[g].length>0&&(g++,v=(R.length-2)/2,y[g]=[]),y[g]=[...y[g],{allowFailure:!0,callData:R,target:A}]}catch(R){let S=ht(R,{abi:w,address:A,args:P,docsPath:"/docs/contract/multicall",functionName:B,sender:r});if(!o)throw S;y[g]=[...y[g],{allowFailure:!0,callData:"0x",target:A}]}}let E=await Promise.allSettled(y.map(b=>$(e,oe,"readContract")({...h===null?{code:ic}:{address:h},abi:dr,account:r,args:[b],authorizationList:n,blockHash:s,blockNumber:i,blockOverrides:a,blockTag:c,functionName:"aggregate3",requireCanonical:u,stateOverride:f}))),x=[];for(let b=0;b<E.length;b++){let w=E[b];if(w.status==="rejected"){if(!o)throw w.reason;for(let P=0;P<y[b].length;P++)x.push({status:"failure",error:w.reason,result:void 0});continue}let A=w.value;for(let P=0;P<A.length;P++){let{returnData:B,success:R}=A[P],{callData:S}=y[b][P],{abi:M,address:z,functionName:_,args:N}=d[x.length];try{if(S==="0x")throw new Tt;if(!R)throw new sr({data:B});let C=Le({abi:M,args:N,data:B,functionName:_});x.push(o?{result:C,status:"success"}:C)}catch(C){let k=ht(C,{abi:M,address:z,args:N,docsPath:"/docs/contract/multicall",functionName:_});if(!o)throw k;x.push({error:k,result:void 0,status:"failure"})}}}if(x.length!==d.length)throw new T("multicall results mismatch");return x}var uv=m(()=>{Ke();ac();le();W();xn();Br();Ze();as();Ro();ee();it()});async function Rf(e,t){let{blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:s,traceTransfers:i,validation:a}=t;try{let c=[];for(let l of o){let p=l.blockOverrides?rp(l.blockOverrides):void 0,h=l.calls.map(g=>{let v=g,E=v.account?G(v.account):void 0,x=v.abi?ne(v):v.data,b={...v,account:E,data:v.dataSuffix?ie([x||"0x",v.dataSuffix]):x,from:v.from??E?.address};return _e(b),Be(b)}),y=l.stateOverrides?Ua(l.stateOverrides):void 0;c.push({blockOverrides:p,calls:h,stateOverrides:y})}let f=(typeof r=="bigint"?I(r):void 0)||n;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:c,returnFullTransactions:s,traceTransfers:i,validation:a},f]})).map((l,p)=>({...pi(l),calls:l.calls.map((h,y)=>{let{abi:g,args:v,functionName:E,to:x}=o[p].calls[y],b=h.error?.data??h.returnData,w=BigInt(h.gasUsed),A=h.logs?.map(S=>Ue(S)),P=h.status==="0x1"?"success":"failure",B=g&&P==="success"&&b!=="0x"?Le({abi:g,data:b,functionName:E}):null,R=(()=>{if(P==="success")return;let S;if(b==="0x"?S=new Tt:b&&(S=new sr({data:b})),!!S)return ht(S,{abi:g??[],address:x??"0x",args:v,functionName:E??"<unknown>"})})();return{data:b,gasUsed:w,logs:A,status:P,...P==="success"?{result:B}:{error:R}}})}))}catch(c){let u=c,f=Vo(u,{});throw f instanceof Rt?u:f}}var Ky=m(()=>{ch();be();le();xn();Wr();Br();Ze();Me();F();Ro();_u();$d();Yr();Sr();Cd();Ir()});function nm(e){let t=!0,r="",n=0,o="",s=!1;for(let i=0;i<e.length;i++){let a=e[i];if(["(",")",","].includes(a)&&(t=!0),a==="("&&n++,a===")"&&n--,!!t){if(n===0){if(a===" "&&["event","function","error",""].includes(o))o="";else if(o+=a,a===")"){s=!0;break}continue}if(a===" "){e[i-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=a,r+=a}}if(!s)throw new D("Unable to normalize signature.");return o}function rm(e,t){let r=typeof e,n=t.type;switch(n){case"address":return M0(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,s)=>rm(Object.values(e)[s],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>rm(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Zy(e,t,r){for(let n in e){let o=e[n],s=t[n];if(o.type==="tuple"&&s.type==="tuple"&&"components"in o&&"components"in s)return Zy(o.components,s.components,r[n]);let i=[o.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?M0(r[n],{strict:!1}):i.includes("address")&&i.includes("bytes")?M0(r[n],{strict:!1}):!1)return i}}var fv=m(()=>{vf();Nt()});function om(e,t={}){let{prepare:r=!0}=t,n=Array.isArray(e)?I0(e):typeof e=="string"?I0(e):e;return{...n,...r?{hash:Oc(n)}:{}}}function $f(e,t,r){let{args:n=[],prepare:o=!0}=r??{},s=Qu(t,{strict:!1}),i=e.filter(u=>s?u.type==="function"||u.type==="error"?Yy(u)===ge(t,0,4):u.type==="event"?Oc(u)===t:!1:"name"in u&&u.name===t);if(i.length===0)throw new ws({name:t});if(i.length===1)return{...i[0],...o?{hash:Oc(i[0])}:{}};let a;for(let u of i){if(!("inputs"in u))continue;if(!n||n.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...o?{hash:Oc(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==n.length)continue;if(n.every((d,l)=>{let p="inputs"in u&&u.inputs[l];return p?rm(d,p):!1})){if(a&&"inputs"in a&&a.inputs){let d=Zy(u.inputs,a.inputs,n);if(d)throw new Jy({abiItem:u,type:d[0]},{abiItem:a,type:d[1]})}a=u}}let c=(()=>{if(a)return a;let[u,...f]=i;return{...u,overloads:f}})();if(!c)throw new ws({name:t});return{...c,...o?{hash:Oc(c)}:{}}}function Yy(...e){let t=(()=>{if(Array.isArray(e[0])){let[r,n]=e;return $f(r,n)}return e[0]})();return ge(Oc(t),0,4)}function MP(...e){let t=(()=>{if(Array.isArray(e[0])){let[n,o]=e;return $f(n,o)}return e[0]})(),r=typeof t=="string"?t:xf(t);return nm(r)}function Oc(...e){let t=(()=>{if(Array.isArray(e[0])){let[r,n]=e;return $f(r,n)}return e[0]})();return typeof t!="string"&&"hash"in t&&t.hash?t.hash:Si(nc(MP(t)))}var Jy,ws,Xy=m(()=>{fy();Nt();R0();We();fv();Jy=class extends D{constructor(t,r){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${nm(xf(t.abiItem))}\`, and`,`\`${r.type}\` in \`${nm(xf(r.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}},ws=class extends D{constructor({name:t,data:r,type:n="item"}){let o=t?` with name "${t}"`:r?` with data "${r}"`:"";super(`ABI ${n}${o} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}});function pv(...e){let[t,r]=(()=>{if(Array.isArray(e[0])){let[s,i]=e;return[zP(s),i]}return e})(),{bytecode:n,args:o}=r;return Te(n,t.inputs?.length&&o?.length?xs(t.inputs,o):"0x")}function mv(e){return om(e)}function zP(e){let t=e.find(r=>r.type==="constructor");if(!t)throw new ws({name:"constructor"});return t}var lv=m(()=>{Xy();zc();We()});function yv(...e){let[t,r=[]]=(()=>{if(Array.isArray(e[0])){let[u,f,d]=e;return[hv(u,f,{args:d}),d]}let[a,c]=e;return[a,c]})(),{overloads:n}=t,o=n?hv([t,...n],t.name,{args:r}):t,s=UP(o),i=r.length>0?xs(o.inputs,r):void 0;return i?Te(s,i):s}function ki(e,t={}){return om(e,t)}function hv(e,t,r){let n=$f(e,t,r);if(n.type!=="function")throw new ws({name:t,type:"function"});return n}function UP(e){return Yy(e)}var bv=m(()=>{Xy();zc();We()});var sm,zt,Qy=m(()=>{sm="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",zt="0x0000000000000000000000000000000000000000"});async function xv(e,t){let{blockNumber:r,blockTag:n,calls:o,stateOverrides:s,traceAssetChanges:i,traceTransfers:a,validation:c}=t,u=t.account?G(t.account):void 0;if(i&&!u)throw new T("`account` is required when `traceAssetChanges` is true");let f=u?pv(mv("constructor(bytes, bytes)"),{bytecode:sc,args:[FP,yv(ki("function getBalance(address)"),[u.address])]}):void 0,d=i?await Promise.all(t.calls.map(async H=>{if(!H.data&&!H.abi)return;let{accessList:L}=await Up(e,{account:u.address,...H,data:H.abi?ne(H):H.data});return L.map(({address:q,storageKeys:X})=>X.length>0?q:null)})).then(H=>H.flat().filter(Boolean)):[],l=await Rf(e,{blockNumber:r,blockTag:n,blocks:[...i?[{calls:[{data:f}],stateOverrides:s},{calls:d.map((H,L)=>({abi:[ki("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:H,from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]}]:[],{calls:[...o,{to:zt}].map(H=>({...H,from:u?.address})),stateOverrides:s},...i?[{calls:[{data:f}]},{calls:d.map((H,L)=>({abi:[ki("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[u.address],to:H,from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((H,L)=>({to:H,abi:[ki("function decimals() returns (uint256)")],functionName:"decimals",from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((H,L)=>({to:H,abi:[ki("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]},{calls:d.map((H,L)=>({to:H,abi:[ki("function symbol() returns (string)")],functionName:"symbol",from:zt,nonce:L})),stateOverrides:[{address:zt,nonce:0}]}]:[]],traceTransfers:a,validation:c}),p=i?l[2]:l[0],[h,y,,g,v,E,x,b]=i?l:[],{calls:w,...A}=p,P=w.slice(0,-1)??[],B=h?.calls??[],R=y?.calls??[],S=[...B,...R].map(H=>H.status==="success"?j(H.data):null),M=g?.calls??[],z=v?.calls??[],_=[...M,...z].map(H=>H.status==="success"?j(H.data):null),N=(E?.calls??[]).map(H=>H.status==="success"?H.result:null),C=(b?.calls??[]).map(H=>H.status==="success"?H.result:null),k=(x?.calls??[]).map(H=>H.status==="success"?H.result:null),U=[];for(let[H,L]of _.entries()){let q=S[H];if(typeof L!="bigint"||typeof q!="bigint")continue;let X=N[H-1],Ne=C[H-1],vt=k[H-1],pe=H===0?{address:sm,decimals:18,symbol:"ETH"}:{address:d[H-1],decimals:vt||X?Number(X??1):void 0,symbol:Ne??void 0};U.some(He=>He.token.address===pe.address)||U.push({token:pe,value:{pre:q,post:L,diff:L-q}})}return{assetChanges:U,block:A,results:P}}var FP,gv=m(()=>{lv();bv();be();Qy();ac();W();Ze();em();Lh();Ky();FP="0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033"});var Nf={};Nr(Nf,{InvalidWrappedSignatureError:()=>im,assert:()=>tb,from:()=>qP,magicBytes:()=>eb,universalSignatureValidatorAbi:()=>DP,universalSignatureValidatorBytecode:()=>OP,unwrap:()=>wv,validate:()=>GP,wrap:()=>jP});function tb(e){if(ge(e,-32)!==eb)throw new im(e)}function qP(e){return typeof e=="string"?wv(e):e}function wv(e){tb(e);let[t,r,n]=_c(Pf("address, bytes, bytes"),e);return{data:r,signature:n,to:t}}function jP(e){let{data:t,signature:r,to:n}=e;return Te(xs(Pf("address, bytes, bytes"),[n,t,r]),eb)}function GP(e){try{return tb(e),!0}catch{return!1}}var eb,OP,DP,im,vv=m(()=>{zc();Nt();We();eb="0x6492649264926492649264926492649264926492649264926492649264926492",OP="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",DP=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];im=class extends D{constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}});var Ev=m(()=>{vv()});function Hf({r:e,s:t,to:r="hex",v:n,yParity:o}){let s=(()=>{if(o===0||o===1)return o;if(n&&(n===27n||n===28n||n>=35n))return n%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),i=`0x${new xt.Signature(j(e),j(t)).toCompactHex()}${s===0?"1b":"1c"}`;return r==="hex"?i:re(i)}var rb=m(()=>{di();ve();ue()});async function vs(e,t){let{address:r,chain:n=e.chain,hash:o,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??n?.contracts?.erc6492Verifier?.address,multicallAddress:i=t.multicallAddress??n?.contracts?.multicall3?.address,mode:a="auto"}=t;if(n?.verifyHash)return await n.verifyHash(e,t);let c=(()=>{let u=t.signature;return O(u)?u:typeof u=="object"&&"r"in u&&"s"in u?Hf(u):K(u)})();try{if(a==="eoa")try{if(de(ye(r),await gt({hash:o,signature:c})))return!0}catch{}return Rr.validate(c)?await VP(e,{...t,multicallAddress:i,signature:c}):await WP(e,{...t,verifierAddress:s,signature:c})}catch(u){if(a!=="eoa")try{if(de(ye(r),await gt({hash:o,signature:c})))return!0}catch{}if(u instanceof Ln)return!1;throw u}}async function VP(e,t){let{address:r,blockNumber:n,blockTag:o,hash:s,multicallAddress:i}=t,{authorization:a,data:c,signature:u,to:f}=Rr.unwrap(t.signature);if(await Ai(e,{address:r,blockNumber:n,blockTag:o})===Ae(["0xef0100",a.address]))return await KP(e,{address:r,blockNumber:n,blockTag:o,hash:s,signature:u});let l={address:a.address,chainId:Number(a.chainId),nonce:Number(a.nonce),r:I(a.r,{size:32}),s:I(a.s,{size:32}),yParity:a.yParity};if(!await M2({address:r,authorization:l}))throw new Ln;let h=await $(e,oe,"readContract")({...i?{address:i}:{code:ic},authorizationList:[l],abi:dr,blockNumber:n,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:f??r,callData:c}]:[],{allowFailure:!0,target:r,callData:ne({abi:dh,functionName:"isValidSignature",args:[s,u]})}]]});if(h[h.length-1]?.returnData?.startsWith("0x1626ba7e"))return!0;throw new Ln}async function WP(e,t){let{address:r,factory:n,factoryData:o,hash:s,signature:i,verifierAddress:a,...c}=t,u=await(async()=>!n&&!o||Nf.validate(i)?i:Nf.wrap({data:o,signature:i,to:n}))(),f=a?{to:a,data:ne({abi:oc,functionName:"isValidSig",args:[r,s,u]}),...c}:{data:Mn({abi:oc,args:[r,s,u],bytecode:ef}),...c},{data:d}=await $(e,pr,"call")(f).catch(l=>{throw l instanceof uo?new Ln:l});if(aa(d??"0x0"))return!0;throw new Ln}async function KP(e,t){let{address:r,blockNumber:n,blockTag:o,hash:s,signature:i}=t;if((await $(e,oe,"readContract")({address:r,abi:dh,args:[s,i],blockNumber:n,blockTag:o,functionName:"isValidSignature"}).catch(c=>{throw c instanceof fo?new Ln:c})).startsWith("0x1626ba7e"))return!0;throw new Ln}var Ln,Mf=m(()=>{Ev();Bf();Ke();ac();xn();tf();Ze();dt();Jt();z2();Me();ut();ve();F();ee();zo();rb();xi();Op();it();Ln=class extends Error{}});async function Av(e,{address:t,message:r,factory:n,factoryData:o,signature:s,...i}){let a=bs(r);return $(e,vs,"verifyHash")({address:t,factory:n,factoryData:o,hash:a,signature:s,...i})}var Tv=m(()=>{ee();lf();Mf()});async function Pv(e,t){let{address:r,factory:n,factoryData:o,signature:s,message:i,primaryType:a,types:c,domain:u,...f}=t,d=$c({message:i,primaryType:a,types:c,domain:u});return $(e,vs,"verifyHash")({address:r,factory:n,factoryData:o,hash:d,signature:s,...f})}var Sv=m(()=>{ee();yf();Mf()});function am(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:n,onError:o,poll:s,pollingInterval:i=e.pollingInterval}){let a=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),c;return a?(()=>{let d=Y(["watchBlockNumber",e.uid,t,r,i]);return at(d,{onBlockNumber:n,onError:o},l=>mr(async()=>{try{let p=await $(e,en,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(p===c)return;if(p-c>1&&r)for(let h=c+1n;h<p;h++)l.onBlockNumber(h,c),c=h}(c===void 0||p>c)&&(l.onBlockNumber(p,c),c=p)}catch(p){l.onError?.(p)}},{emitOnBegin:t,interval:i}))})():(()=>{let d=Y(["watchBlockNumber",e.uid,t,r]);return at(d,{onBlockNumber:n,onError:o},l=>{let p=!0,h=()=>p=!1;return(async()=>{try{let y=(()=>{if(e.transport.type==="fallback"){let v=e.transport.transports.find(E=>E.config.type==="webSocket"||E.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),{unsubscribe:g}=await y.subscribe({params:["newHeads"],onData(v){if(!p)return;let E=j(v.result?.number);l.onBlockNumber(E,c),c=E},onError(v){l.onError?.(v)}});h=g,p||h()}catch(y){o?.(y)}})(),()=>h()})})()}var nb=m(()=>{ve();ee();us();wi();Je();lc()});async function cm(e,t){let{checkReplacement:r=!0,confirmations:n=1,hash:o,onReplaced:s,retryCount:i=6,retryDelay:a=({count:w})=>~~(1<<w)*200,timeout:c=18e4}=t,u=Y(["waitForTransactionReceipt",e.uid,o]),f=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval,d,l,p,h=!1,y,g,{promise:v,resolve:E,reject:x}=dc(),b=c?setTimeout(()=>{g?.(),y?.(),x(new Sa({hash:o}))},c):void 0;return y=at(u,{onReplaced:s,resolve:E,reject:x},async w=>{if(p=await $(e,Fc,"getTransactionReceipt")({hash:o}).catch(()=>{}),p&&n<=1){clearTimeout(b),w.resolve(p),y?.();return}g=$(e,am,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:f,async onBlockNumber(A){let P=R=>{clearTimeout(b),g?.(),R(),y?.()},B=A;if(!h)try{if(p){if(n>1&&(!p.blockNumber||B-p.blockNumber+1n<n))return;P(()=>w.resolve(p));return}if(r&&!d&&(h=!0,await zn(async()=>{d=await $(e,Lc,"getTransaction")({hash:o}),d.blockNumber&&(B=d.blockNumber)},{delay:a,retryCount:i}),h=!1),p=await $(e,Fc,"getTransactionReceipt")({hash:o}),n>1&&(!p.blockNumber||B-p.blockNumber+1n<n))return;P(()=>w.resolve(p))}catch(R){if(R instanceof ao||R instanceof co){if(!d){h=!1;return}try{l=d,h=!0;let S=await zn(()=>$(e,Ge,"getBlock")({blockNumber:B,includeTransactions:!0}),{delay:a,retryCount:i,shouldRetry:({error:_})=>_ instanceof Zr});h=!1;let M=S.transactions.find(({from:_,nonce:N})=>_===l.from&&N===l.nonce);if(!M||(p=await $(e,Fc,"getTransactionReceipt")({hash:M.hash}),n>1&&(!p.blockNumber||B-p.blockNumber+1n<n)))return;let z="replaced";M.to===l.to&&M.value===l.value&&M.input===l.input?z="repriced":M.from===M.to&&M.value===0n&&(z="cancelled"),P(()=>{w.onReplaced?.({reason:z,replacedTransaction:l,transaction:M,transactionReceipt:p}),w.resolve(p)})}catch(S){P(()=>w.reject(S))}}else P(()=>w.reject(R))}}})}),v}var ob=m(()=>{Lu();lt();ee();us();ip();uf();Je();Yo();tm();Wy();nb()});function Iv(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:o,onError:s,includeTransactions:i,poll:a,pollingInterval:c=e.pollingInterval}){let u=typeof a<"u"?a:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),f=i??!1,d;return u?(()=>{let h=Y(["watchBlocks",e.uid,t,r,n,f,c]);return at(h,{onBlock:o,onError:s},y=>mr(async()=>{try{let g=await $(e,Ge,"getBlock")({blockTag:t,includeTransactions:f});if(g.number!==null&&d?.number!=null){if(g.number===d.number)return;if(g.number-d.number>1&&r)for(let v=d?.number+1n;v<g.number;v++){let E=await $(e,Ge,"getBlock")({blockNumber:v,includeTransactions:f});y.onBlock(E,d),d=E}}(d?.number==null||t==="pending"&&g?.number==null||g.number!==null&&g.number>d.number)&&(y.onBlock(g,d),d=g)}catch(g){y.onError?.(g)}},{emitOnBegin:n,interval:c}))})():(()=>{let h=!0,y=!0,g=()=>h=!1;return(async()=>{try{n&&$(e,Ge,"getBlock")({blockTag:t,includeTransactions:f}).then(x=>{h&&y&&(o(x,void 0),y=!1)}).catch(s);let v=(()=>{if(e.transport.type==="fallback"){let x=e.transport.transports.find(b=>b.config.type==="webSocket"||b.config.type==="ipc");return x?x.value:e.transport}return e.transport})(),{unsubscribe:E}=await v.subscribe({params:["newHeads"],async onData(x){if(!h)return;let b=await $(e,Ge,"getBlock")({blockNumber:x.result?.number,includeTransactions:f}).catch(()=>{});h&&(o(b,d),y=!1,d=b)},onError(x){s?.(x)}});g=E,h||g()}catch(v){s?.(v)}})(),()=>g()})()}var Bv=m(()=>{ee();us();wi();Je();Yo()});function kv(e,{address:t,args:r,batch:n=!0,event:o,events:s,fromBlock:i,onError:a,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:d}){let l=typeof u<"u"?u:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")),p=d??!1;return l?(()=>{let g=Y(["watchEvent",t,r,n,e.uid,o,f,i]);return at(g,{onLogs:c,onError:a},v=>{let E;i!==void 0&&(E=i-1n);let x,b=!1,w=mr(async()=>{if(!b){try{x=await $(e,Lp,"createEventFilter")({address:t,args:r,event:o,events:s,strict:p,fromBlock:i})}catch{}b=!0;return}try{let A;if(x)A=await $(e,fs,"getFilterChanges")({filter:x});else{let P=await $(e,en,"getBlockNumber")({});E&&E!==P?A=await $(e,Ja,"getLogs")({address:t,args:r,event:o,events:s,fromBlock:E+1n,toBlock:P}):A=[],E=P}if(A.length===0)return;if(n)v.onLogs(A);else for(let P of A)v.onLogs([P])}catch(A){x&&A instanceof Bt&&(b=!1),v.onError?.(A)}},{emitOnBegin:!0,interval:f});return async()=>{x&&await $(e,ds,"uninstallFilter")({filter:x}),w()}})})():(()=>{let g=!0,v=()=>g=!1;return(async()=>{try{let E=(()=>{if(e.transport.type==="fallback"){let A=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return A?A.value:e.transport}return e.transport})(),x=s??(o?[o]:void 0),b=[];x&&(b=[x.flatMap(P=>nr({abi:[P],eventName:P.name,args:r}))],o&&(b=b[0]));let{unsubscribe:w}=await E.subscribe({params:["logs",{address:t,topics:b}],onData(A){if(!g)return;let P=A.result;try{let{eventName:B,args:R}=Cn({abi:x??[],data:P.data,topics:P.topics,strict:p}),S=Ue(P,{args:R,eventName:B});c([S])}catch(B){let R,S;if(B instanceof yr||B instanceof zr){if(d)return;R=B.abiItem.name,S=B.abiItem.inputs?.some(z=>!("name"in z&&z.name))}let M=Ue(P,{args:S?[]:{},eventName:R});c([M])}},onError(A){a?.(A)}});v=w,g||v()}catch(E){a?.(E)}})(),()=>v()})()}var Cv=m(()=>{le();Co();Ku();ti();Yr();ee();us();wi();Je();Fh();lc();of();Gd();sf()});function Rv(e,{batch:t=!0,onError:r,onTransactions:n,poll:o,pollingInterval:s=e.pollingInterval}){return(typeof o<"u"?o:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{let u=Y(["watchPendingTransactions",e.uid,t,s]);return at(u,{onTransactions:n,onError:r},f=>{let d,l=mr(async()=>{try{if(!d)try{d=await $(e,Fp,"createPendingTransactionFilter")({});return}catch(h){throw l(),h}let p=await $(e,fs,"getFilterChanges")({filter:d});if(p.length===0)return;if(t)f.onTransactions(p);else for(let h of p)f.onTransactions([h])}catch(p){f.onError?.(p)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await $(e,ds,"uninstallFilter")({filter:d}),l()}})})():(()=>{let u=!0,f=()=>u=!1;return(async()=>{try{let{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(l){if(!u)return;let p=l.result;n([p])},onError(l){r?.(l)}});f=d,u||f()}catch(d){r?.(d)}})(),()=>f()})()}var $v=m(()=>{ee();us();wi();Je();Oh();of();sf()});function Nv(e){let{scheme:t,statement:r,...n}=e.match(ZP)?.groups??{},{chainId:o,expirationTime:s,issuedAt:i,notBefore:a,requestId:c,...u}=e.match(JP)?.groups??{},f=e.split("Resources:")[1]?.split(`
48
+ - `).slice(1);return{...n,...u,...o?{chainId:Number(o)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...a?{notBefore:new Date(a)}:{},...c?{requestId:c}:{},...f?{resources:f}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}var ZP,JP,Hv=m(()=>{ZP=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,JP=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/});function Mv(e){let{address:t,domain:r,message:n,nonce:o,scheme:s,time:i=new Date}=e;if(r&&n.domain!==r||o&&n.nonce!==o||s&&n.scheme!==s||n.expirationTime&&i>=n.expirationTime||n.notBefore&&i<n.notBefore)return!1;try{if(!n.address||!Q(n.address,{strict:!1})||t&&!de(n.address,t))return!1}catch{return!1}return!0}var zv=m(()=>{pt();Jt()});async function _v(e,t){let{address:r,domain:n,message:o,nonce:s,scheme:i,signature:a,time:c=new Date,...u}=t,f=Nv(o);if(!f.address||!Mv({address:r,domain:n,message:f,nonce:s,scheme:i,time:c}))return!1;let l=bs(o);return vs(e,{address:f.address,hash:l,signature:a,...u})}var Uv=m(()=>{lf();Hv();zv();Mf()});function Dc(e,t){return{amount:e,decimals:t,formatted:or(e,t)}}function um(e,t){if(typeof e=="bigint")return e;let r=e.decimals??t;return gs(e.formatted,YP(r))}function YP(e){if(e===void 0)throw new Error("Token decimals are required. Pass `amount.decimals` or select a declared token.");return e}function fm(e,t){return typeof e=="bigint"?t:e.decimals??t}function Qe(e,t){let{decimals:r,token:n}=t,o=ib(e,n);if(o)return{address:o.address,decimals:r??o.decimals};if(Q(n,{strict:!1}))return{address:n,decimals:r??QP(e,n)};throw new Error(`Token "${n}" is not a declared ERC-20 token on the client's \`tokens\` array (with an address for the client's chain), and is not a valid address.`)}function ib(e,t){let r=e.tokens,n=e.chain?.id;if(!r||n===void 0)return;let o=XP(r,t);if(o)return sb(o,n);if(Q(t,{strict:!1}))for(let s of r){let i=sb(s,n);if(i&&de(i.address,t))return i}}function sb(e,t){let r=e.addresses[t];if(r)return{address:r,currency:e.currency,decimals:e.decimals,name:e.name,popular:e.popular,symbol:e.symbol}}function XP(e,t){let r=t.toLowerCase();for(let n of e)if(n.symbol?.toLowerCase()===r)return n}function QP(e,t){let r=e.tokens,n=e.chain?.id;if(r&&n!==void 0)for(let o of r){let s=sb(o,n);if(s&&de(s.address,t))return s.decimals}}async function qc(e,t){let{address:r,decimals:n}=Qe(e,t);return n!==void 0?{address:r,decimals:n}:{address:r,decimals:await oe(e,{abi:Ce,address:r,functionName:"decimals"})}}function jc(e){let{account:t,chain:r,gas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:i}=e;return{account:t,chain:r,gas:n,maxFeePerGas:o,maxPriorityFeePerGas:s,nonce:i}}function sn(e){return{...e,data:ne(e),to:e.address}}var Fn=m(()=>{Ke();pt();Jt();em();ri();Cf();it()});async function On(e,t){return On.inner(Xt,e,t)}function eS(e,t){let{amount:r,spender:n,token:o}=t,{address:s,decimals:i}=Qe(e,{token:o});return{abi:Ce,address:s,args:[n,um(r,i)],functionName:"approve"}}var ab=m(()=>{Ke();li();Wu();nf();yc();Fn();(function(e){async function t(i,a,c){return await i(a,{...c,...e.call(a,c)})}e.inner=t;function r(i,a){return sn(eS(i,a))}e.call=r;async function n(i,a){return ns(i,{...jc(a),...e.call(i,a)})}e.estimateGas=n;async function o(i,a){return cs(i,{...jc(a),...e.call(i,a)})}e.simulate=o;function s(i){let[a]=ur({abi:Ce,logs:i,eventName:"Approval",strict:!0});if(!a)throw new Error("`Approval` event not found.");return a}e.extractEvent=s})(On||(On={}))});async function Gc(e,{serializedTransaction:t,throwOnReceiptRevert:r,timeout:n}){let o=await e.request({method:"eth_sendRawTransactionSync",params:n?[t,n]:[t]},{retryCount:0}),i=(e.chain?.formatters?.transactionReceipt?.format||_n)(o);if(i.status==="reverted"&&r)throw new oi({receipt:i});return i}var dm=m(()=>{lt();xc()});async function pm(e,t){let{account:r=e.account,assertChainId:n=!0,chain:o=e.chain,accessList:s,authorizationList:i,blobs:a,data:c,dataSuffix:u=typeof e.dataSuffix=="string"?e.dataSuffix:e.dataSuffix?.value,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,pollingInterval:g,throwOnReceiptRevert:v,type:E,value:x,...b}=t,w=t.timeout??Math.max((o?.blockTime??0)*3,5e3);if(typeof r>"u")throw new Re({docsPath:"/docs/actions/wallet/sendTransactionSync"});let A=r?G(r):null,P;try{_e(t);let B=await(async()=>{if(t.to)return t.to;if(t.to!==null&&i&&i.length>0)return await _o({authorization:i[0]}).catch(()=>{throw new T("`to` is required. Could not infer from `authorizationList`.")})})();if(A?.type==="json-rpc"||A===null){let R;o!==null&&(R=await $(e,Ve,"getChainId")({}),n&&ps({currentChainId:R,chain:o}));let S=e.chain?.formatters?.transactionRequest?.format,z=(S||Be)({...$t(b,{format:S}),accessList:s,account:A,authorizationList:i,blobs:a,chainId:R,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,to:B,type:E,value:x},"sendTransaction"),_=cb.get(e.uid),N=_?"wallet_sendTransaction":"eth_sendTransaction",C=await(async()=>{try{return await e.request({method:N,params:[z]},{retryCount:0})}catch(U){if(_===!1)throw U;let H=U;if(H.name==="InvalidInputRpcError"||H.name==="InvalidParamsRpcError"||H.name==="MethodNotFoundRpcError"||H.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[z]},{retryCount:0}).then(L=>(cb.set(e.uid,!0),L)).catch(L=>{let q=L;throw q.name==="MethodNotFoundRpcError"||q.name==="MethodNotSupportedRpcError"?(cb.set(e.uid,!1),H):q});throw H}})(),k=await $(e,cm,"waitForTransactionReceipt")({checkReplacement:!1,hash:C,pollingInterval:g,timeout:w});if(v&&k.status==="reverted")throw new oi({receipt:k});return k}if(A?.type==="local"){if(A.nonceManager&&typeof y>"u"){let z=b.chainId,_=await(async()=>typeof z=="number"?z:o?o.id:$(e,Ve,"getChainId")({}))();P={address:A.address,chainId:_}}let R=await $(e,Jr,"prepareTransactionRequest")({account:A,accessList:s,authorizationList:i,blobs:a,chain:o,data:u?ie([c??"0x",u]):c,gas:f,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:h,nonce:y,nonceManager:A.nonceManager,parameters:[...Vu,"sidecars"],type:E,value:x,...b,to:B}),S=o?.serializers?.transaction,M=await A.signTransaction(R,{serializer:S});return await $(e,Gc,"sendRawTransactionSync")({serializedTransaction:M,throwOnReceiptRevert:v,timeout:t.timeout})}throw A?.type==="smart"?new lr({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new lr({docsPath:"/docs/actions/wallet/sendTransactionSync",type:A?.type})}catch(B){throw B instanceof lr?B:(P&&!(B instanceof oi)&&A?.nonceManager?.reset(P),rs(B,{...t,account:A,chain:t.chain||void 0}))}}var cb,ub=m(()=>{be();tn();W();lt();zu();af();Me();Gu();Wo();Sr();ee();to();Ir();kn();ob();Ka();dm();cb=new rt(128)});async function Vc(e,t){return Xt.internal(e,pm,"sendTransactionSync",t)}var mm=m(()=>{ub();yc()});async function fb(e,t){let{amount:r,token:n,throwOnReceiptRevert:o=!0}=t,{decimals:s}=Qe(e,{token:n}),i=fm(r,s),a=await On.inner(Vc,e,{...t,throwOnReceiptRevert:o}),{args:c}=On.extractEvent(a.logs);return{...c,...i===void 0?{}:{decimals:i,formatted:or(c.value,i)},receipt:a}}var Lv=m(()=>{ri();mm();ab();Fn()});async function Wc(e,t){let{account:r,decimals:n,spender:o,token:s,...i}=t,[a,{decimals:c}]=await Promise.all([oe(e,{...i,...Wc.call(e,{account:r,spender:o,token:s})}),qc(e,{decimals:n,token:s})]);return Dc(a,c)}var Fv=m(()=>{Ke();it();Fn();(function(e){function t(r,n){return sn({address:Qe(r,n).address,abi:Ce,functionName:"allowance",args:[n.account,n.spender]})}e.call=t})(Wc||(Wc={}))});async function Kc(e,t){let{account:r=e.account,decimals:n,token:o,...s}=t;if(!r)throw new Re;let i=G(r).address,[a,{decimals:c}]=await Promise.all([oe(e,{...s,...Kc.call(e,{account:i,token:o})}),qc(e,{decimals:n,token:o})]);return Dc(a,c)}var Ov=m(()=>{be();Ke();tn();it();Fn();(function(e){function t(r,n){let o=n.account??r.account;if(!o)throw new Re;let s=G(o).address;return sn({address:Qe(r,n).address,abi:Ce,functionName:"balanceOf",args:[s]})}e.call=t})(Kc||(Kc={}))});async function db(e,t){let{token:r,...n}=t,{address:o}=Qe(e,{token:r}),s=ib(e,r),[i,a,c]=await Promise.all([s?.decimals??oe(e,{...n,abi:Ce,address:o,functionName:"decimals"}),s?.name??oe(e,{...n,abi:Ce,address:o,functionName:"name"}),s?.symbol??oe(e,{...n,abi:Ce,address:o,functionName:"symbol"})]);return{decimals:i,name:a,symbol:c}}var Dv=m(()=>{Ke();it();Fn()});async function Zc(e,t){let{decimals:r,token:n,...o}=t,[s,{decimals:i}]=await Promise.all([oe(e,{...o,...Zc.call(e,{token:n})}),qc(e,{decimals:r,token:n})]);return Dc(s,i)}var qv=m(()=>{Ke();it();Fn();(function(e){function t(r,n){return sn({address:Qe(r,n).address,abi:Ce,args:[],functionName:"totalSupply"})}e.call=t})(Zc||(Zc={}))});async function Dn(e,t){return Dn.inner(Xt,e,t)}function tS(e,t){let{amount:r,from:n,to:o,token:s}=t,{address:i,decimals:a}=Qe(e,{token:s}),c=um(r,a);return n?{abi:Ce,address:i,args:[n,o,c],functionName:"transferFrom"}:{abi:Ce,address:i,args:[o,c],functionName:"transfer"}}var pb=m(()=>{Ke();li();Wu();nf();yc();Fn();(function(e){async function t(i,a,c){return await i(a,{...c,...e.call(a,c)})}e.inner=t;function r(i,a){return sn(tS(i,a))}e.call=r;async function n(i,a){return ns(i,{...jc(a),...e.call(i,a)})}e.estimateGas=n;async function o(i,a){return cs(i,{...jc(a),...e.call(i,a)})}e.simulate=o;function s(i){let[a]=ur({abi:Ce,logs:i,eventName:"Transfer",strict:!0});if(!a)throw new Error("`Transfer` event not found.");return a}e.extractEvent=s})(Dn||(Dn={}))});async function mb(e,t){let{amount:r,token:n,throwOnReceiptRevert:o=!0}=t,{decimals:s}=Qe(e,{token:n}),i=fm(r,s),a=await Dn.inner(Vc,e,{...t,throwOnReceiptRevert:o}),{args:c}=Dn.extractEvent(a.logs);return{...c,...i===void 0?{}:{decimals:i,formatted:or(c.value,i)},receipt:a}}var jv=m(()=>{ri();mm();Fn();pb()});var lb=m(()=>{ab();Lv();Fv();Ov();Dv();qv();pb();jv()});function lm(e){return{call:t=>pr(e,t),createAccessList:t=>Up(e,t),createBlockFilter:()=>a2(e),createContractEventFilter:t=>da(e,t),createEventFilter:t=>Lp(e,t),createPendingTransactionFilter:()=>Fp(e),estimateContractGas:t=>ns(e,t),estimateGas:t=>Za(e,t),getBalance:t=>u2(e,t),getBlobBaseFee:()=>d2(e),getBlock:t=>Ge(e,t),getBlockNumber:t=>en(e,t),getBlockReceipts:t=>m2(e,t),getBlockTransactionCount:t=>h2(e,t),getBytecode:t=>Ai(e,t),getChainId:()=>Ve(e),getCode:t=>Ai(e,t),getContractEvents:t=>Ya(e,t),getDelegation:t=>b2(e,t),getEip712Domain:t=>w2(e,t),getEnsAddress:t=>V5(e,t),getEnsAvatar:t=>t2(e,t),getEnsName:t=>n2(e,t),getEnsResolver:t=>s2(e,t),getEnsText:t=>_p(e,t),getFeeHistory:t=>T2(e,t),estimateFeesPerGas:t=>Y6(e,t),getFilterChanges:t=>fs(e,t),getFilterLogs:t=>S2(e,t),getGasPrice:()=>Da(e),getLogs:t=>Ja(e,t),getProof:t=>rv(e,t),estimateMaxPriorityFeePerGas:t=>J6(e,t),fillTransaction:t=>Wa(e,t),getStorageAt:t=>ov(e,t),getTransaction:t=>Lc(e,t),getTransactionConfirmations:t=>iv(e,t),getTransactionCount:t=>Xo(e,t),getTransactionReceipt:t=>Fc(e,t),multicall:t=>cv(e,t),prepareTransactionRequest:t=>Jr(e,t),readContract:t=>oe(e,t),sendRawTransaction:t=>hc(e,t),sendRawTransactionSync:t=>Gc(e,t),simulate:t=>Rf(e,t),simulateBlocks:t=>Rf(e,t),simulateCalls:t=>xv(e,t),simulateContract:t=>cs(e,t),verifyHash:t=>vs(e,t),verifyMessage:t=>Av(e,t),verifySiweMessage:t=>_v(e,t),verifyTypedData:t=>Pv(e,t),uninstallFilter:t=>ds(e,t),waitForTransactionReceipt:t=>cm(e,t),watchBlocks:t=>Iv(e,t),watchBlockNumber:t=>am(e,t),watchContractEvent:t=>xp(e,t),watchEvent:t=>kv(e,t),watchPendingTransactions:t=>Rv(e,t),token:rS(e)}}function rS(e){return{getAllowance:rn(e,Wc),getBalance:rn(e,Kc),getMetadata:rn(e,db),getTotalSupply:rn(e,Zc)}}var hb=m(()=>{W5();r2();o2();i2();Uh();xi();Lh();c2();yd();Fh();Oh();Wu();Kl();jd();Wl();qd();f2();p2();Yo();lc();l2();y2();kn();Op();Vd();x2();v2();P2();of();I2();Nd();Gd();nv();sv();tm();av();Ou();Wy();uv();it();Ky();gv();nf();sf();Mf();Tv();Sv();ob();nb();Bv();Ph();Cv();$v();Uv();lb();Ka();gp();dm();vi()});function Gv(e){let{key:t="public",name:r="Public Client"}=e;return ls({...e,key:t,name:r,type:"publicClient"}).extend(lm)}var Vv=m(()=>{vi();hb()});async function Wv(e,{hash:t}){await e.request({method:`${e.mode}_dropTransaction`,params:[t]})}var Kv=m(()=>{});async function Zv(e){return e.request({method:`${e.mode}_dumpState`})}var Jv=m(()=>{});async function Yv(e){return e.mode==="ganache"?await e.request({method:"eth_mining"}):await e.request({method:`${e.mode}_getAutomine`})}var Xv=m(()=>{});async function Qv(e){return await e.request({method:"txpool_content"})}var e3=m(()=>{});async function t3(e){let{pending:t,queued:r}=await e.request({method:"txpool_status"});return{pending:Z(t),queued:Z(r)}}var r3=m(()=>{ve()});async function n3(e,{address:t}){await e.request({method:`${e.mode}_impersonateAccount`,params:[t]})}var o3=m(()=>{});async function s3(e,{seconds:t}){return await e.request({method:"evm_increaseTime",params:[I(t)]})}var i3=m(()=>{F()});async function a3(e){return await e.request({method:"txpool_inspect"})}var c3=m(()=>{});async function u3(e,{state:t}){await e.request({method:`${e.mode}_loadState`,params:[t]})}var f3=m(()=>{});async function d3(e,{blocks:t,interval:r}){e.mode==="ganache"?await e.request({method:"evm_mine",params:[{blocks:I(t)}]}):await e.request({method:`${e.mode}_mine`,params:[I(t),I(r||0)]})}var p3=m(()=>{F()});async function m3(e){await e.request({method:`${e.mode}_removeBlockTimestampInterval`})}var l3=m(()=>{});async function h3(e,{blockNumber:t,jsonRpcUrl:r}={}){await e.request({method:`${e.mode}_reset`,params:[{forking:{blockNumber:Number(t),jsonRpcUrl:r}}]})}var y3=m(()=>{});async function b3(e,{id:t}){await e.request({method:"evm_revert",params:[t]})}var x3=m(()=>{});async function g3(e,t){let{accessList:r,data:n,from:o,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:d,...l}=t,p=e.chain?.formatters?.transactionRequest?.format,y=(p||Be)({...$t(l,{format:p}),accessList:r,data:n,from:o,gas:s,gasPrice:i,maxFeePerGas:a,maxPriorityFeePerGas:c,nonce:u,to:f,value:d},"sendUnsignedTransaction");return await e.request({method:"eth_sendUnsignedTransaction",params:[y]})}var w3=m(()=>{Wo();Sr()});async function v3(e,t){e.mode==="ganache"?t?await e.request({method:"miner_start"}):await e.request({method:"miner_stop"}):await e.request({method:"evm_setAutomine",params:[t]})}var E3=m(()=>{});async function A3(e,{address:t,value:r}){e.mode==="ganache"?await e.request({method:"evm_setAccountBalance",params:[t,I(r)]}):await e.request({method:`${e.mode}_setBalance`,params:[t,I(r)]})}var T3=m(()=>{F()});async function P3(e,{gasLimit:t}){await e.request({method:"evm_setBlockGasLimit",params:[I(t)]})}var S3=m(()=>{F()});async function I3(e,{interval:t}){let r=e.mode==="hardhat"?t*1e3:t;await e.request({method:`${e.mode}_setBlockTimestampInterval`,params:[r]})}var B3=m(()=>{});async function k3(e,{address:t,bytecode:r}){e.mode==="ganache"?await e.request({method:"evm_setAccountCode",params:[t,r]}):await e.request({method:`${e.mode}_setCode`,params:[t,r]})}var C3=m(()=>{});async function R3(e,{address:t}){await e.request({method:`${e.mode}_setCoinbase`,params:[t]})}var $3=m(()=>{});async function N3(e,{interval:t}){let r=e.mode==="hardhat"?t*1e3:t;await e.request({method:"evm_setIntervalMining",params:[r]})}var H3=m(()=>{});async function M3(e,t){await e.request({method:`${e.mode}_setLoggingEnabled`,params:[t]})}var z3=m(()=>{});async function _3(e,{gasPrice:t}){await e.request({method:`${e.mode}_setMinGasPrice`,params:[I(t)]})}var U3=m(()=>{F()});async function L3(e,{baseFeePerGas:t}){await e.request({method:`${e.mode}_setNextBlockBaseFeePerGas`,params:[I(t)]})}var F3=m(()=>{F()});async function O3(e,{timestamp:t}){await e.request({method:"evm_setNextBlockTimestamp",params:[I(t)]})}var D3=m(()=>{F()});async function q3(e,{address:t,nonce:r}){await e.request({method:`${e.mode}_setNonce`,params:[t,I(r)]})}var j3=m(()=>{F()});async function G3(e,t){await e.request({method:`${e.mode}_setRpcUrl`,params:[t]})}var V3=m(()=>{});async function W3(e,{address:t,index:r,value:n}){await e.request({method:`${e.mode}_setStorageAt`,params:[t,typeof r=="number"?I(r):r,n]})}var K3=m(()=>{F()});async function Z3(e){return await e.request({method:"evm_snapshot"})}var J3=m(()=>{});async function Y3(e,{address:t}){await e.request({method:`${e.mode}_stopImpersonatingAccount`,params:[t]})}var X3=m(()=>{});function hm({mode:e}){return t=>{let r=t.extend(()=>({mode:e}));return{dropTransaction:n=>Wv(r,n),dumpState:()=>Zv(r),getAutomine:()=>Yv(r),getTxpoolContent:()=>Qv(r),getTxpoolStatus:()=>t3(r),impersonateAccount:n=>n3(r,n),increaseTime:n=>s3(r,n),inspectTxpool:()=>a3(r),loadState:n=>u3(r,n),mine:n=>d3(r,n),removeBlockTimestampInterval:()=>m3(r),reset:n=>h3(r,n),revert:n=>b3(r,n),sendUnsignedTransaction:n=>g3(r,n),setAutomine:n=>v3(r,n),setBalance:n=>A3(r,n),setBlockGasLimit:n=>P3(r,n),setBlockTimestampInterval:n=>I3(r,n),setCode:n=>k3(r,n),setCoinbase:n=>R3(r,n),setIntervalMining:n=>N3(r,n),setLoggingEnabled:n=>M3(r,n),setMinGasPrice:n=>_3(r,n),setNextBlockBaseFeePerGas:n=>L3(r,n),setNextBlockTimestamp:n=>O3(r,n),setNonce:n=>q3(r,n),setRpcUrl:n=>G3(r,n),setStorageAt:n=>W3(r,n),snapshot:()=>Z3(r),stopImpersonatingAccount:n=>Y3(r,n)}}}var yb=m(()=>{Kv();Jv();Xv();e3();r3();o3();i3();c3();f3();p3();l3();y3();x3();w3();E3();T3();S3();B3();C3();$3();H3();z3();U3();F3();D3();j3();V3();K3();J3();X3()});function Q3(e){let{key:t="test",name:r="Test Client",mode:n}=e;return ls({...e,key:t,name:r,type:"testClient"}).extend(s=>({mode:n,...hm({mode:n})(s)}))}var e4=m(()=>{vi();yb()});async function t4(e,{chain:t}){let{id:r,name:n,nativeCurrency:o,rpcUrls:s,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:I(r),chainName:n,nativeCurrency:o,rpcUrls:s.default.http,blockExplorerUrls:i?Object.values(i).map(({url:a})=>a):void 0}]},{dedupe:!0,retryCount:0})}var r4=m(()=>{F()});function n4(e,t){let{abi:r,args:n,bytecode:o,...s}=t,i=Mn({abi:r,args:n,bytecode:o});return ms(e,{...s,...s.authorizationList?{to:null}:{},data:i})}var o4=m(()=>{tf();cf()});async function s4(e){return e.account?.type==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(r=>gr(r))}var i4=m(()=>{dt()});async function a4(e,t={}){let{account:r=e.account,chainId:n}=t,o=r?G(r):void 0,s=n?[o?.address,[I(n)]]:[o?.address],i=await e.request({method:"wallet_getCapabilities",params:s}),a={};for(let[c,u]of Object.entries(i)){a[Number(c)]={};for(let[f,d]of Object.entries(u))f==="addSubAccount"&&(f="unstable_addSubAccount"),a[Number(c)][f]=d}return typeof n=="number"?a[n]:a}var c4=m(()=>{be();F()});async function u4(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}var f4=m(()=>{});async function ym(e,t){let{account:r=e.account,chainId:n,nonce:o}=t;if(!r)throw new Re({docsPath:"/docs/eip7702/prepareAuthorization"});let s=G(r),i=(()=>{if(t.executor)return t.executor==="self"?t.executor:G(t.executor)})(),a={address:t.contractAddress??t.address,chainId:n,nonce:o};return typeof a.chainId>"u"&&(a.chainId=e.chain?.id??await $(e,Ve,"getChainId")({})),typeof a.nonce>"u"&&(a.nonce=await $(e,Xo,"getTransactionCount")({address:s.address,blockTag:"pending"}),(i==="self"||i?.address&&de(i.address,s.address))&&(a.nonce+=1)),a}var bb=m(()=>{be();tn();Jt();ee();kn();Ou()});async function d4(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(r=>ye(r))}var p4=m(()=>{dt()});async function m4(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}var l4=m(()=>{});async function h4(e,t){let{chain:r=e.chain}=t,n=t.timeout??Math.max((r?.blockTime??0)*3,5e3),o=await $(e,vp,"sendCalls")(t);return await $(e,Tp,"waitForCallsStatus")({...t,id:o.id,timeout:n})}var y4=m(()=>{ee();Ep();Pp()});async function b4(e,t){let{id:r}=t;await e.request({method:"wallet_showCallsStatus",params:[r]})}var x4=m(()=>{});async function g4(e,t){let{account:r=e.account}=t;if(!r)throw new Re({docsPath:"/docs/eip7702/signAuthorization"});let n=G(r);if(!n.signAuthorization)throw new lr({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:n.type});let o=await ym(e,t);return n.signAuthorization(o)}var w4=m(()=>{be();tn();bb()});async function v4(e,{account:t=e.account,message:r}){if(!t)throw new Re({docsPath:"/docs/actions/wallet/signMessage"});let n=G(t);if(n.signMessage)return n.signMessage({message:r});let o=typeof r=="string"?tr(r):r.raw instanceof Uint8Array?me(r.raw):r.raw;return e.request({method:"personal_sign",params:[o,n.address]},{retryCount:0})}var E4=m(()=>{be();tn();F()});async function A4(e,t){let{account:r=e.account,chain:n=e.chain,...o}=t;if(!r)throw new Re({docsPath:"/docs/actions/wallet/signTransaction"});let s=G(r);_e({account:s,...t});let i=await $(e,Ve,"getChainId")({});n!==null&&ps({currentChainId:i,chain:n});let c=(n?.formatters||e.chain?.formatters)?.transactionRequest?.format||Be;return s.signTransaction?s.signTransaction({...o,account:s,chainId:i},{serializer:e.chain?.serializers?.transaction}):await e.request({method:"eth_signTransaction",params:[{...c({...o,account:s},"signTransaction"),chainId:I(i),from:s.address}]},{retryCount:0})}var T4=m(()=>{be();tn();af();F();Sr();ee();Ir();kn()});async function P4(e,t){let{account:r=e.account,domain:n,message:o,primaryType:s}=t;if(!r)throw new Re({docsPath:"/docs/actions/wallet/signTypedData"});let i=G(r),a={EIP712Domain:Pi({domain:n}),...t.types};if(Rc({domain:n,message:o,primaryType:s,types:a}),i.signTypedData)return i.signTypedData({domain:n,message:o,primaryType:s,types:a});let c=t0({domain:n,message:o,primaryType:s,types:a});return e.request({method:"eth_signTypedData_v4",params:[i.address,c]},{retryCount:0})}var S4=m(()=>{be();tn();r0()});async function I4(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:I(t)}]},{retryCount:0})}var B4=m(()=>{F()});async function k4(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}var C4=m(()=>{});function bm(e){return{addChain:t=>t4(e,t),deployContract:t=>n4(e,t),fillTransaction:t=>Wa(e,t),getAddresses:()=>s4(e),getCallsStatus:t=>Ap(e,t),getCapabilities:t=>a4(e,t),getChainId:()=>Ve(e),getPermissions:()=>u4(e),prepareAuthorization:t=>ym(e,t),prepareTransactionRequest:t=>Jr(e,t),requestAddresses:()=>d4(e),requestPermissions:t=>m4(e,t),sendCalls:t=>vp(e,t),sendCallsSync:t=>h4(e,t),sendRawTransaction:t=>hc(e,t),sendRawTransactionSync:t=>Gc(e,t),sendTransaction:t=>ms(e,t),sendTransactionSync:t=>pm(e,t),showCallsStatus:t=>b4(e,t),signAuthorization:t=>g4(e,t),signMessage:t=>v4(e,t),signTransaction:t=>A4(e,t),signTypedData:t=>P4(e,t),switchChain:t=>I4(e,t),waitForCallsStatus:t=>Tp(e,t),watchAsset:t=>k4(e,t),writeContract:t=>Xt(e,t),writeContractSync:t=>Vc(e,t),token:{approve:rn(e,On),approveSync:rn(e,fb),transfer:rn(e,Dn),transferSync:rn(e,mb)}}}var xb=m(()=>{qd();kn();lb();r4();o4();i4();$h();c4();f4();bb();Ka();p4();l4();Ep();y4();gp();dm();cf();ub();x4();w4();E4();T4();S4();B4();Pp();C4();yc();mm();vi()});function R4(e){let{key:t="wallet",name:r="Wallet Client",transport:n}=e;return ls({...e,key:t,name:r,transport:n,type:"walletClient"}).extend(bm)}var $4=m(()=>{vi();xb()});function an({key:e,methods:t,name:r,request:n,retryCount:o=3,retryDelay:s=150,timeout:i,type:a},c){let u=Bp();return{config:{key:e,methods:t,name:r,request:n,retryCount:o,retryDelay:s,timeout:i,type:a},request:L2(n,{methods:t,retryCount:o,retryDelay:s,uid:u}),value:c}}var Jc=m(()=>{F2();Nh()});function N4(e,t={}){let{key:r="custom",methods:n,name:o="Custom Provider",retryDelay:s}=t;return({retryCount:i})=>an({key:r,methods:n,name:o,request:e.request.bind(e),retryCount:t.retryCount??i,retryDelay:s,type:"custom"})}var H4=m(()=>{Jc()});function M4(e,t={}){let{key:r="fallback",name:n="Fallback",rank:o=!1,shouldThrow:s=gb,retryCount:i,retryDelay:a}=t;return(({chain:c,pollingInterval:u=4e3,timeout:f,...d})=>{let l=e,p=()=>{},h=an({key:r,name:n,async request({method:y,params:g}){let v,E=async(x=0)=>{let b=l[x]({...d,chain:c,retryCount:0,timeout:f});try{let w=await b.request({method:y,params:g});return p({method:y,params:g,response:w,transport:b,status:"success"}),w}catch(w){if(p({error:w,method:y,params:g,transport:b,status:"error"}),s(w)||x===l.length-1||(v??(v=l.slice(x+1).some(A=>{let{include:P,exclude:B}=A({chain:c}).config.methods||{};return P?P.includes(y):B?!B.includes(y):!0})),!v))throw w;return E(x+1)}};return E()},retryCount:i,retryDelay:a,type:"fallback"},{onResponse:y=>p=y,transports:l.map(y=>y({chain:c,retryCount:0}))});if(o){let y=typeof o=="object"?o:{};nS({chain:c,interval:y.interval??u,onTransports:g=>l=g,ping:y.ping,sampleCount:y.sampleCount,timeout:y.timeout,transports:l,weights:y.weights})}return h})}function gb(e){return!!("code"in e&&typeof e.code=="number"&&(e.code===Dr.code||e.code===Tr.code||e.code===ko.code||Kt.nodeMessage.test(e.message)||e.code===5e3))}function nS({chain:e,interval:t=4e3,onTransports:r,ping:n,sampleCount:o=10,timeout:s=1e3,transports:i,weights:a={}}){let{stability:c=.7,latency:u=.3}=a,f=[],d=async()=>{let l=await Promise.all(i.map(async y=>{let g=y({chain:e,retryCount:0,timeout:s}),v=Date.now(),E,x;try{await(n?n({transport:g}):g.request({method:"net_listening"})),x=1}catch{x=0}finally{E=Date.now()}return{latency:E-v,success:x}}));f.push(l),f.length>o&&f.shift();let p=Math.max(...f.map(y=>Math.max(...y.map(({latency:g})=>g)))),h=i.map((y,g)=>{let v=f.map(A=>A[g].latency),x=1-v.reduce((A,P)=>A+P,0)/v.length/p,b=f.map(A=>A[g].success),w=b.reduce((A,P)=>A+P,0)/b.length;return w===0?[0,g]:[u*x+c*w,g]}).sort((y,g)=>g[0]-y[0]);r(h.map(([,y])=>i[y])),await gi(t),d()};d()}var z4=m(()=>{Wr();Co();yp();Jc()});var Es,xm=m(()=>{W();Es=class extends T{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}});function sS(e){if(!e)return"default";let t=_4.get(e);if(t!==void 0)return t;let r=oS++;return _4.set(e,r),r}function U4(e,t={}){let{batch:r,fetchFn:n,fetchOptions:o,key:s="http",maxResponseBodySize:i,methods:a,name:c="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:f,retryDelay:d,raw:l}=t;return({chain:p,retryCount:h,timeout:y})=>{let{batchSize:g=1e3,wait:v=0}=typeof r=="object"?r:{},E=t.retryCount??h,x=y??t.timeout??1e4,b=e||p?.rpcUrls.default.http[0];if(!b)throw new Es;let w=hw(b,{fetchFn:n,fetchOptions:o,maxResponseBodySize:i,onRequest:u,onResponse:f,timeout:x});return an({key:s,methods:a,name:c,async request({method:A,params:P},B){let R={method:A,params:P},S=B?.signal?{signal:B.signal}:void 0,{schedule:M}=pc({id:`${b}.${sS(B?.signal)}`,wait:v,shouldSplitBatch(C){return C.length>g},fn:C=>w.request({body:C,fetchOptions:S}),sort:(C,k)=>C.id-k.id}),z=async C=>r?M(C):[await w.request({body:C,fetchOptions:S})],[{error:_,result:N}]=await z(R);if(l)return{error:_,result:N};if(_)throw new ir({body:R,error:_,url:b});return N},retryCount:E,retryDelay:d,timeout:x,type:"http"},{fetchOptions:o,url:b})}}var oS,_4,L4=m(()=>{ar();xm();ap();yw();Jc();oS=0,_4=new WeakMap});function F4(e,t={}){let{keepAlive:r,key:n="webSocket",methods:o,name:s="WebSocket JSON-RPC",reconnect:i,retryDelay:a}=t;return({chain:c,retryCount:u,timeout:f})=>{let d=t.retryCount??u,l=f??t.timeout??1e4,p=e||c?.rpcUrls.default.webSocket?.[0],h={keepAlive:r,reconnect:i};if(!p)throw new Es;return an({key:n,methods:o,name:s,async request({method:y,params:g}){let v={method:y,params:g},E=await Ic(p,h),{error:x,result:b}=await E.requestAsync({body:v,timeout:l});if(x)throw new ir({body:v,error:x,url:p});return b},retryCount:d,retryDelay:a,timeout:l,type:"webSocket"},{getSocket(){return Aw(p)},getRpcClient(){return Ic(p,h)},async subscribe({params:y,onData:g,onError:v}){let E=await Ic(p,h),{result:x}=await new Promise((b,w)=>E.request({body:{method:"eth_subscribe",params:y},onError(A){w(A),v?.(A)},onResponse(A){if(A.error){w(A.error),v?.(A.error);return}if(typeof A.id=="number"){b(A);return}A.method==="eth_subscription"&&g(A.params)}}));return{subscriptionId:x,async unsubscribe(){return new Promise(b=>E.request({body:{method:"eth_unsubscribe",params:[x]},onResponse:b}))}}}})}}var O4=m(()=>{ar();xm();Tw();Yh();Jc()});var gm,D4=m(()=>{gm=class extends Error{constructor(t,r){super(r),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t,this.details=r}}});function q4(e){let{abi:t,bytecode:r,data:n}=e;if(n===r)return{bytecode:r};let o=t.find(i=>"type"in i&&i.type==="constructor");if(!o)throw new Vn({docsPath:wb});if(!("inputs"in o))throw new Mr({docsPath:wb});if(!o.inputs||o.inputs.length===0)throw new Mr({docsPath:wb});return{args:mt(o.inputs,`0x${n.replace(r,"")}`),bytecode:r}}var wb,j4=m(()=>{le();no();wb="/docs/contract/decodeDeployData"});function G4(e){let t=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(a=>re(a)):e.blobs,n=r.reduce((a,c)=>a+c.length,0),o=vr(new Uint8Array(n)),s=!0;for(let a of r){let c=vr(a);for(;s&&c.position<a.length;){c.incrementPosition(1);let u=31;a.length-c.position<31&&(u=a.length-c.position);for(let f in Array.from({length:u})){let d=c.readByte();if(d===128&&!c.inspectBytes(c.remaining).includes(128)){s=!1;break}o.pushByte(d)}}}let i=o.bytes.slice(0,o.position);return t==="hex"?K(i):i}var V4=m(()=>{la();ue();F()});function W4(e){let{sidecars:t,version:r}=e,n=e.to??(typeof t[0].blob=="string"?"hex":"bytes"),o=[];for(let{commitment:s}of t)o.push(qa({commitment:s,to:n,version:r}));return o}var K4=m(()=>{zd()});function Z4(e){if(e===1)return 60n;if(e>=iS||e<0)throw new Ec({chainId:e});return BigInt((2147483648|e)>>>0)}var iS,J4=m(()=>{Mp();iS=2147483648});function wm({blobToKzgCommitment:e,computeBlobKzgProof:t}){return{blobToKzgCommitment:e,computeBlobKzgProof:t}}var vb=m(()=>{});function Y4(e,t){try{e.loadTrustedSetup(t)}catch(r){let n=r;if(!n.message.includes("trusted setup is already loaded"))throw n}return wm(e)}var X4=m(()=>{vb()});function Q4({r:e,yParityAndS:t}){let r=re(t),n=r[0]&128?1:0,o=r;return n===1&&(o[0]&=127),{r:e,s:K(o),yParity:n}}var eE=m(()=>{ue();F()});function Eb(e){let{r:t,s:r}=xt.Signature.fromCompact(e.slice(2,130));return{r:I(t,{size:32}),yParityAndS:I(r,{size:32})}}var tE=m(()=>{di();F()});function Ab(e){let{r:t,s:r}=xt.Signature.fromCompact(e.slice(2,130)),n=+`0x${e.slice(130)}`,[o,s]=(()=>{if(n===0||n===1)return[void 0,n];if(n===27)return[BigInt(n),0];if(n===28)return[BigInt(n),1];throw new Error("Invalid yParityOrV value")})();return typeof o<"u"?{r:I(t,{size:32}),s:I(r,{size:32}),v:o,yParity:s}:{r:I(t,{size:32}),s:I(r,{size:32}),yParity:s}}var rE=m(()=>{di();F()});async function nE(e){let{serializedTransaction:t,signature:r}=e,n=Y0(t),o=r??{r:n.r,s:n.s,v:n.v,yParity:n.yParity},s=Vp({...n,r:void 0,s:void 0,v:void 0,yParity:void 0,sidecars:void 0});return await gt({hash:te(s),signature:o})}var oE=m(()=>{St();Gy();Wp();zo()});function Tb({r:e,yParityAndS:t}){return`0x${new xt.Signature(j(e),j(t)).toCompactHex()}`}var sE=m(()=>{di();ve()});function iE(e){let{r:t,s:r,v:n,yParity:o}=e,s=Number(o??n-27n),i=r;if(s===1){let a=re(r);a[0]|=128,i=K(a)}return{r:t,yParityAndS:i}}var aE=m(()=>{ue();F()});var cE={};Nr(cE,{AbiConstructorNotFoundError:()=>Vn,AbiConstructorParamsNotFoundError:()=>Mr,AbiDecodingDataSizeInvalidError:()=>od,AbiDecodingDataSizeTooSmallError:()=>Wn,AbiDecodingZeroDataError:()=>Tt,AbiEncodingArrayLengthMismatchError:()=>Vi,AbiEncodingBytesSizeMismatchError:()=>Wi,AbiEncodingLengthMismatchError:()=>Kn,AbiErrorInputsNotFoundError:()=>Ki,AbiErrorNotFoundError:()=>Gs,AbiErrorSignatureNotFoundError:()=>Zn,AbiEventNotFoundError:()=>Vs,AbiEventSignatureEmptyTopicsError:()=>Zi,AbiEventSignatureNotFoundError:()=>Ji,AbiFunctionNotFoundError:()=>Ot,AbiFunctionOutputsNotFoundError:()=>Jn,AbiFunctionSignatureNotFoundError:()=>Yi,AccountStateConflictError:()=>ga,AtomicReadyWalletRejectedUpgradeError:()=>Bo,AtomicityNotSupportedError:()=>Gr,BaseError:()=>T,BaseFeeScalarError:()=>Jo,BlockNotFoundError:()=>Zr,BundleFailedError:()=>bc,BundleTooLargeError:()=>Io,BytesSizeMismatchError:()=>Yn,CallExecutionError:()=>uo,ChainDisconnectedError:()=>Eo,ChainDoesNotSupportContract:()=>Nn,ChainMismatchError:()=>cc,ChainNotFoundError:()=>uc,CircularReferenceError:()=>Ds,ClientChainNotConfiguredError:()=>yi,ContractFunctionExecutionError:()=>fo,ContractFunctionRevertedError:()=>bn,ContractFunctionZeroDataError:()=>Ia,CounterfactualDeploymentFailedError:()=>Ba,DecodeLogDataMismatch:()=>yr,DecodeLogTopicsMismatch:()=>zr,DuplicateIdError:()=>Po,EIP1193ProviderRpcError:()=>gm,Eip1559FeesNotSupportedError:()=>Kr,EnsAvatarInvalidNftUriError:()=>nn,EnsAvatarUnsupportedNamespaceError:()=>vc,EnsAvatarUriResolutionError:()=>hs,EnsInvalidChainIdError:()=>Ec,EstimateGasExecutionError:()=>_a,ExecutionRevertedError:()=>Kt,FeeCapTooHighError:()=>Ct,FeeCapTooLowError:()=>Uo,FeeConflictError:()=>wd,FilterTypeNotSupportedError:()=>ta,HttpRequestError:()=>ot,InsufficientFundsError:()=>Do,IntegerOutOfRangeError:()=>_r,InternalRpcError:()=>Ar,IntrinsicGasTooHighError:()=>qo,IntrinsicGasTooLowError:()=>jo,InvalidAbiDecodingTypeError:()=>Qi,InvalidAbiEncodingTypeError:()=>Xi,InvalidAbiItemError:()=>Rs,InvalidAbiParameterError:()=>Ns,InvalidAbiParametersError:()=>Hs,InvalidAbiTypeParameterError:()=>Ls,InvalidAddressError:()=>ae,InvalidArrayError:()=>Xn,InvalidBytesBooleanError:()=>ra,InvalidChainIdError:()=>Hn,InvalidDecimalNumberError:()=>Uc,InvalidDefinitionTypeError:()=>Gi,InvalidDomainError:()=>Bc,InvalidFunctionModifierError:()=>Us,InvalidHexBooleanError:()=>na,InvalidHexValueError:()=>oa,InvalidInputRpcError:()=>Bt,InvalidLegacyVError:()=>io,InvalidModifierError:()=>_s,InvalidParameterError:()=>Ms,InvalidParamsRpcError:()=>ho,InvalidParenthesisError:()=>qs,InvalidPrimaryTypeError:()=>kc,InvalidRequestRpcError:()=>mo,InvalidSerializableTransactionError:()=>Ea,InvalidSerializedTransactionError:()=>Fr,InvalidSerializedTransactionTypeError:()=>Aa,InvalidSignatureError:()=>Ft,InvalidStorageKeySizeError:()=>Ta,InvalidStructSignatureError:()=>Os,InvalidStructTypeError:()=>Cc,InvalidYParityError:()=>va,JsonRpcVersionUnsupportedError:()=>xo,LimitExceededRpcError:()=>vn,MaxFeePerGasTooLowError:()=>La,MethodNotFoundRpcError:()=>lo,MethodNotSupportedRpcError:()=>qr,NonceMaxValueError:()=>Oo,NonceTooHighError:()=>Lo,NonceTooLowError:()=>Fo,ParseRpcError:()=>po,ProviderDisconnectedError:()=>vo,ProviderRpcError:()=>je,RawContractError:()=>sr,ResourceNotFoundRpcError:()=>yo,ResourceUnavailableRpcError:()=>bo,ResponseBodyTooLargeError:()=>gn,RlpDepthLimitExceededError:()=>sa,RpcError:()=>qe,RpcRequestError:()=>ir,SizeExceedsPaddingSizeError:()=>Ks,SizeOverflowError:()=>ia,SliceOffsetOutOfBoundsError:()=>Ws,SocketClosedError:()=>Or,SolidityProtectedKeywordError:()=>zs,StateAssignmentConflictError:()=>wa,SwitchChainError:()=>Ao,TimeoutError:()=>wn,TipAboveFeeCapError:()=>cr,TransactionExecutionError:()=>Pa,TransactionNotFoundError:()=>ao,TransactionReceiptNotFoundError:()=>co,TransactionRejectedRpcError:()=>Dr,TransactionTypeNotSupportedError:()=>Go,UnauthorizedProviderError:()=>go,UnknownBundleIdError:()=>So,UnknownNodeError:()=>Rt,UnknownRpcError:()=>ka,UnknownSignatureError:()=>Fs,UnknownTypeError:()=>$s,UnsupportedChainIdError:()=>To,UnsupportedNonOptionalCapabilityError:()=>jr,UnsupportedPackedAbiType:()=>ea,UnsupportedProviderMethodError:()=>wo,UrlRequiredError:()=>Es,UserRejectedRequestError:()=>Tr,WaitForCallsStatusTimeoutError:()=>ff,WaitForTransactionReceiptTimeoutError:()=>Sa,WebSocketRequestError:()=>ii,assertCurrentChain:()=>ps,assertRequest:()=>_e,assertTransactionEIP1559:()=>ys,assertTransactionEIP2930:()=>Ac,assertTransactionLegacy:()=>Tc,blobsToCommitments:()=>Qo,blobsToProofs:()=>es,boolToBytes:()=>Jm,boolToHex:()=>Js,bytesToBigInt:()=>wu,bytesToBool:()=>vu,bytesToHex:()=>K,bytesToNumber:()=>Vt,bytesToRlp:()=>Yx,bytesToString:()=>Eu,ccipFetch:()=>bi,ccipReadTunnel:()=>O2,ccipRequest:()=>bi,checksumAddress:()=>gr,commitmentToVersionedHash:()=>qa,commitmentsToVersionedHashes:()=>ja,compactSignatureToHex:()=>Tb,compactSignatureToSignature:()=>Q4,concat:()=>ie,concatBytes:()=>nl,concatHex:()=>Ae,createClient:()=>ls,createNonceManager:()=>Kh,createPublicClient:()=>Gv,createTestClient:()=>Q3,createTransport:()=>an,createWalletClient:()=>R4,custom:()=>N4,decodeAbiParameters:()=>mt,decodeDeployData:()=>q4,decodeErrorResult:()=>oo,decodeEventLog:()=>Cn,decodeFunctionData:()=>dp,decodeFunctionResult:()=>Le,defineBlock:()=>Z6,defineChain:()=>q2,defineKzg:()=>wm,defineTransaction:()=>K6,defineTransactionReceipt:()=>O5,defineTransactionRequest:()=>sg,deploylessCallViaBytecodeBytecode:()=>sc,deploylessCallViaFactoryBytecode:()=>op,domainSeparator:()=>Pw,encodeAbiParameters:()=>Oe,encodeDeployData:()=>Mn,encodeErrorResult:()=>rf,encodeEventTopics:()=>nr,encodeFunctionData:()=>ne,encodeFunctionResult:()=>pp,encodePacked:()=>B2,erc1155Abi:()=>B5,erc20Abi:()=>Ce,erc20Abi_bytes32:()=>I5,erc4626Abi:()=>C5,erc6492SignatureValidatorAbi:()=>oc,erc6492SignatureValidatorByteCode:()=>ef,erc721Abi:()=>k5,ethAddress:()=>sm,etherUnits:()=>ya,extendSchema:()=>j2,extractChain:()=>V2,fallback:()=>M4,formatBlock:()=>pi,formatEther:()=>so,formatGwei:()=>Se,formatLog:()=>Ue,formatTransaction:()=>Bn,formatTransactionReceipt:()=>_n,formatTransactionRequest:()=>Be,formatUnits:()=>or,fromBlobs:()=>G4,fromBytes:()=>ox,fromHex:()=>Zm,fromRlp:()=>pf,getAbiItem:()=>nt,getAddress:()=>ye,getChainContractAddress:()=>Ht,getContract:()=>L5,getContractAddress:()=>R2,getContractError:()=>ht,getCreate2Address:()=>jh,getCreateAddress:()=>qh,getEventSelector:()=>xr,getEventSignature:()=>mn,getFunctionSelector:()=>Gt,getFunctionSignature:()=>mn,getSerializedTransactionType:()=>J0,getTransactionType:()=>Va,getTypesForEIP712Domain:()=>Pi,gweiUnits:()=>ba,hashDomain:()=>hf,hashMessage:()=>bs,hashStruct:()=>n0,hashTypedData:()=>$c,hexToBigInt:()=>j,hexToBool:()=>aa,hexToBytes:()=>re,hexToCompactSignature:()=>Eb,hexToNumber:()=>Z,hexToRlp:()=>Xx,hexToSignature:()=>Ab,hexToString:()=>id,http:()=>U4,isAddress:()=>Q,isAddressEqual:()=>de,isBytes:()=>df,isErc6492Signature:()=>i0,isErc8010Signature:()=>W0,isHash:()=>Zp,isHex:()=>O,keccak256:()=>te,labelhash:()=>$p,maxInt104:()=>gg,maxInt112:()=>wg,maxInt120:()=>vg,maxInt128:()=>Eg,maxInt136:()=>Ag,maxInt144:()=>Tg,maxInt152:()=>Pg,maxInt16:()=>cg,maxInt160:()=>Sg,maxInt168:()=>Ig,maxInt176:()=>Bg,maxInt184:()=>kg,maxInt192:()=>Cg,maxInt200:()=>Rg,maxInt208:()=>$g,maxInt216:()=>Ng,maxInt224:()=>Hg,maxInt232:()=>Mg,maxInt24:()=>ug,maxInt240:()=>zg,maxInt248:()=>_g,maxInt256:()=>Ug,maxInt32:()=>fg,maxInt40:()=>dg,maxInt48:()=>pg,maxInt56:()=>mg,maxInt64:()=>lg,maxInt72:()=>hg,maxInt8:()=>ag,maxInt80:()=>yg,maxInt88:()=>bg,maxInt96:()=>xg,maxUint104:()=>k6,maxUint112:()=>C6,maxUint120:()=>R6,maxUint128:()=>$6,maxUint136:()=>N6,maxUint144:()=>H6,maxUint152:()=>M6,maxUint16:()=>x6,maxUint160:()=>z6,maxUint168:()=>_6,maxUint176:()=>U6,maxUint184:()=>L6,maxUint192:()=>F6,maxUint200:()=>O6,maxUint208:()=>D6,maxUint216:()=>q6,maxUint224:()=>j6,maxUint232:()=>G6,maxUint24:()=>g6,maxUint240:()=>V6,maxUint248:()=>W6,maxUint256:()=>Zo,maxUint32:()=>w6,maxUint40:()=>v6,maxUint48:()=>E6,maxUint56:()=>A6,maxUint64:()=>T6,maxUint72:()=>P6,maxUint8:()=>b6,maxUint80:()=>S6,maxUint88:()=>I6,maxUint96:()=>B6,minInt104:()=>Yg,minInt112:()=>Xg,minInt120:()=>Qg,minInt128:()=>e6,minInt136:()=>t6,minInt144:()=>r6,minInt152:()=>n6,minInt16:()=>Fg,minInt160:()=>o6,minInt168:()=>s6,minInt176:()=>i6,minInt184:()=>a6,minInt192:()=>c6,minInt200:()=>u6,minInt208:()=>f6,minInt216:()=>d6,minInt224:()=>p6,minInt232:()=>m6,minInt24:()=>Og,minInt240:()=>l6,minInt248:()=>h6,minInt256:()=>y6,minInt32:()=>Dg,minInt40:()=>qg,minInt48:()=>jg,minInt56:()=>Gg,minInt64:()=>Vg,minInt72:()=>Wg,minInt8:()=>Lg,minInt80:()=>Kg,minInt88:()=>Zg,minInt96:()=>Jg,multicall3Abi:()=>dr,namehash:()=>Ei,nonceManager:()=>mw,numberToBytes:()=>Ym,numberToHex:()=>I,offchainLookup:()=>Eh,offchainLookupAbiItem:()=>mp,offchainLookupSignature:()=>vh,pad:()=>tt,padBytes:()=>Km,padHex:()=>Pt,parseAbi:()=>ji,parseAbiItem:()=>qm,parseAbiParameter:()=>jm,parseAbiParameters:()=>Gm,parseCompactSignature:()=>Eb,parseErc6492Signature:()=>z8,parseErc8010Signature:()=>U8,parseEther:()=>J8,parseEventLogs:()=>ur,parseGwei:()=>X8,parseSignature:()=>Ab,parseTransaction:()=>Y0,parseUnits:()=>gs,prepareEncodeFunctionData:()=>bd,presignMessagePrefix:()=>Qp,publicActions:()=>lm,recoverAddress:()=>gt,recoverMessageAddress:()=>K0,recoverPublicKey:()=>kd,recoverTransactionAddress:()=>nE,recoverTypedDataAddress:()=>Z0,ripemd160:()=>aw,rpcSchema:()=>q5,rpcTransactionType:()=>Gl,serializeAccessList:()=>Ti,serializeCompactSignature:()=>Tb,serializeErc6492Signature:()=>F8,serializeErc8010Signature:()=>D8,serializeSignature:()=>Hf,serializeTransaction:()=>Vp,serializeTypedData:()=>t0,setErrorConfig:()=>P1,setupKzg:()=>Y4,sha256:()=>Md,shouldThrow:()=>gb,sidecarsToVersionedHashes:()=>W4,signatureToCompactSignature:()=>iE,signatureToHex:()=>Hf,size:()=>J,slice:()=>De,sliceBytes:()=>yu,sliceHex:()=>Lr,stringToBytes:()=>Dt,stringToHex:()=>tr,stringify:()=>Y,testActions:()=>hm,toBlobSidecars:()=>ts,toBlobs:()=>Od,toBytes:()=>Ee,toCoinType:()=>Z4,toEventHash:()=>ln,toEventSelector:()=>xr,toEventSignature:()=>mn,toFunctionHash:()=>ln,toFunctionSelector:()=>Gt,toFunctionSignature:()=>mn,toHex:()=>me,toPrefixedMessage:()=>e0,toRlp:()=>wt,transactionType:()=>Fu,trim:()=>he,universalSignatureValidatorAbi:()=>oc,universalSignatureValidatorByteCode:()=>ef,validateTypedData:()=>Rc,verifyHash:()=>j8,verifyMessage:()=>V8,verifyTypedData:()=>K8,walletActions:()=>bm,webSocket:()=>F4,weiUnits:()=>ax,withCache:()=>bp,withRetry:()=>zn,withTimeout:()=>Sc,zeroAddress:()=>zt,zeroHash:()=>kw});var uE=m(()=>{rd();F5();Pp();vi();Vv();e4();$4();hb();yb();xb();Jc();H4();z4();L4();O4();Ke();Qy();s0();ac();Rd();Xh();xa();le();rr();W();Lu();Bh();fc();xn();pu();Zs();Mp();jl();Fa();Wm();Wr();ar();Co();gd();lt();xm();ey();Vy();D4();no();j4();Tu();Ku();hh();Br();wr();tf();bh();ti();Ze();gh();C2();hn();li();al();dt();$2();pt();Jt();Du();qu();_d();zd();V4();K4();ju();Yl();lp();D2();af();G2();W2();as();Me();Dh();ut();Qn();et();jt();un();ul();ve();Vh();ue();F();Mu();Mh();Rp();J4();Ro();$d();Yr();Oa();xc();Sr();Wh();St();cw();Zl();uw();ua();fw();dw();ei();pw();vb();X4();lw();Th();uf();Xp();eE();lf();yf();ty();Oy();tE();_8();L8();rE();zo();Dy();ql();oE();qy();sE();O8();q8();rb();aE();Qh();G8();W8();Z8();Je();Ir();Gp();jy();Dd();Gy();Gh();Wp();r0();Pu();ni();ri();Y8();Q8();Cf()});async function zf(e={}){return(await Promise.resolve().then(()=>(Gb(),jb))).createCircleGatewayBrowserAdapter(e)}function cS(e,t){return t.hosted||t.accessPath==="hosted"?aS:t.accessPath||e.accessPath||"/api/nibgate/access"}function Ci(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe(),o=cS(r.resource,t),s=t.source||"nibgate-evm-gateway",i=t.network||"eip155:5042002",a=typeof t.status=="string"?n?.document.querySelector(t.status):t.status,c=typeof t.connectButton=="string"?n?.document.querySelector(t.connectButton):t.connectButton,u=typeof t.disconnectButton=="string"?n?.document.querySelector(t.disconnectButton):t.disconnectButton,f=typeof t.unlockButton=="string"?n?.document.querySelector(t.unlockButton):t.unlockButton,d=typeof t.clearButton=="string"?n?.document.querySelector(t.clearButton):t.clearButton,l=typeof t.walletLabel=="string"?n?.document.querySelector(t.walletLabel):t.walletLabel,p=typeof t.unlockedTarget=="string"?n?.document.querySelector(t.unlockedTarget):t.unlockedTarget,h="",y=!1;function g(N){typeof t.onStatus=="function"&&t.onStatus(N),a&&(a.textContent=N||"")}function v(N){return N?`${N.slice(0,6)}...${N.slice(-4)}`:""}function E(){return n?.ethereum||t.provider||null}function x(N){y=!!N,[c,u,f,d].forEach(C=>{C&&"disabled"in C&&(C.disabled=y||C===c&&!E()||C===u&&!h)})}function b(){let N=!!E();l&&(l.textContent=h?v(h):N?"Ready to connect":"No wallet detected"),c&&(c.textContent=h?"Connected":"Connect wallet"),u&&(u.textContent="Disconnect"),c&&"disabled"in c&&(c.disabled=y||!N),u&&"disabled"in u&&(u.disabled=y||!h)}function w(N,C={}){f&&(f.textContent=N?"Unlocked":`Unlock for ${r.resource.price} ${r.resource.currency||"USDC"}`),p&&("hidden"in p&&(p.hidden=!N),p.setAttribute("aria-hidden",N?"false":"true")),N&&r.markUnlocked(C)}async function A(){x(!0),g("Opening wallet connection...");try{let N=E();if(!N)throw new Error(t.noWalletMessage||"Install or open an EVM wallet to continue.");let C=await N.request({method:"eth_requestAccounts"});if(h=Array.isArray(C)&&C[0]||"",!h)throw new Error("No wallet account selected.");return b(),g("Wallet connected. You can unlock now."),h}finally{x(!1)}}async function P(){x(!0);try{let N=E();if(N?.request&&h)try{await N.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch{}return h="",b(),g(t.disconnectMessage||"Wallet disconnected for this page."),!0}finally{x(!1)}}async function B(N){let C=E();if(!C)throw new Error(t.noWalletMessage||"Install or open an EVM wallet to continue.");let k=await C.request({method:"eth_accounts"}).catch(()=>h?[h]:[]),U=Array.isArray(k)&&k[0]?k[0]:h||await A();return U!==h&&(h=U),(await zf({network:i,signer:{address:U,signTypedData:async L=>{let{createWalletClient:q,custom:X}=await Promise.resolve().then(()=>(uE(),cE));return q({transport:X(C)}).signTypedData({account:U,domain:L.domain,types:L.types,primaryType:L.primaryType,message:L.message})}},clientModule:t.circleClientModule})).pay(N)}async function R(){x(!0);try{h||await A(),x(!0),g("Requesting Gateway unlock...");let N=await Ut(r.resource,{accessPath:o,source:s,paymentProvider:t.paymentProvider||"circle-gateway-browser",challengeMessage:t.challengeMessage||"Gateway payment required. Connect your wallet to continue...",paymentMessage:t.paymentMessage||"Approve the Gateway payment proof in your wallet...",successMessage:t.successMessage||`Unlocked ${r.resource.title||"content"}.`,method:t.method,headers:t.headers,body:t.body,checkout:B,onStatus:g});return N.ok&&(w(!0,N.payment||{}),typeof t.onUnlock=="function"&&t.onUnlock(N)),N}catch(N){let C=N?.message||"Unlock failed. Please try again.";return g(C),{ok:!1,status:0,error:C,resource:r.resource}}finally{x(!1),b()}}function S(){Ub(r.resource),w(!1),g("Local payment proof cleared. The next unlock will require Gateway payment again.")}async function M(){let N=E();try{let C=N?await N.request({method:"eth_accounts"}):[];h=Array.isArray(C)&&C[0]||""}catch{}b(),w(!1)}function z(){return c?.addEventListener?.("click",()=>A().catch(N=>g(N?.message||"Could not connect wallet."))),u?.addEventListener?.("click",()=>P().catch(N=>g(N?.message||"Could not disconnect wallet."))),f?.addEventListener?.("click",()=>R()),d?.addEventListener?.("click",S),M(),ks(r.resource,{source:s}),_}let _={resource:r.resource,connect:A,disconnect:P,unlock:R,clear:S,hydrate:M,mount:z,getWalletAddress:()=>h};return t.autoMount!==!1&&z(),_}function fE(e,t={}){return Ci(e,{...t,hosted:!0,noWalletMessage:t.noWalletMessage||"Install MetaMask or another EVM wallet to unlock premium content."})}var aS,vm=m(()=>{Bs();jf();jn();Li();Wf();aS="https://api.nibgate.xyz/api/hub/pay"});function fS(e=""){return String(e||"").replace(/^0x/i,"").replace(/[^0-9a-fA-F]/g,"").toLowerCase()}function dE(e=""){let t=fS(e);if(t.length>64)throw new Error("ABI word is too long.");return t.padEnd(64,"0")}function Pb(e=0){return Number(e||0).toString(16).padStart(64,"0")}function dS(e=""){return Array.from(new TextEncoder().encode(String(e||""))).map(t=>t.toString(16).padStart(2,"0")).join("")}function pS(e=""){let t=dS(e),r=t.length/2,n=Math.ceil(r/32)*64;return Pb(r)+t.padEnd(n,"0")}function mS({contentId:e,ratingValue:t,reviewHash:r,unlockRef:n}){return uS+dE(e)+Pb(t)+dE(r||Sb)+Pb(128)+pS(n||"")}function Bb(e,t={}){let r=t.contentId||t.contentHash;if(!r)throw new Error("contentId/contentHash is required. Use the Nibgate backend prepare endpoint or pass a known content hash.");return r}function bE(e=""){if(!e)return Sb;throw new Error("Text review hashing is not available in direct-browser mode. Pass reviewHash from your app/backend.")}async function lS(e,t={}){if(t.contentId||t.contentHash)return{contentId:t.contentId||t.contentHash};let r=t.prepareUrl||t.indexUrl?.replace(/\/index$/,"/prepare");if(!r)throw new Error("contentId/contentHash or prepareUrl is required for onchain rating.");let n=await fetch(r,{method:"POST",headers:{"content-type":"application/json",...t.indexHeaders||{}},body:JSON.stringify({siteId:t.siteId,token:t.token,resource:e,url:e.url,path:e.path})}),o=await n.json().catch(()=>({}));if(!n.ok||!o.contentHash)throw new Error(o.error||"Could not prepare Nibgate onchain rating.");return o}async function Em(e,t={}){let r=we(e),n=ou(t.rating??t.stars??t);if(!n.ratingValue)throw new Error("Rating must be between 0.1 and 5 stars.");let o=t.provider||globalThis?.ethereum;if(!o?.request)throw new Error("Connect an EVM wallet to rate this content onchain.");let s=t.contractAddress||t.reputationContract||Ib;if(!s)throw new Error("Nibgate reputation contract address is not configured.");let i=await o.request({method:"eth_requestAccounts"}),a=Array.isArray(i)&&i[0]||"";if(!a)throw new Error("No wallet account selected.");let c=await lS(r,t),u=c.contentHash||c.contentId||Bb(r,t),f=t.reviewHash||Sb,d=String(t.unlockRef||t.paymentId||t.txHash||""),l=mS({contentId:u,ratingValue:n.ratingValue,reviewHash:f,unlockRef:d}),p=await o.request({method:"eth_sendTransaction",params:[{from:a,to:s,data:l}]}),h=hr(r,{rating:n.rating,ratingValue:n.ratingValue,walletAddress:a,txHash:p,contentHash:u,reviewHash:f,proofType:"onchain_pending",proof:d,paymentId:t.paymentId,actor:t.actor||"human"});return er("content_rating",h),t.indexUrl&&await fetch(t.indexUrl,{method:"POST",headers:{"content-type":"application/json",...t.indexHeaders||{}},body:JSON.stringify({siteId:t.siteId,token:t.token,txHash:p,resource:r,url:r.url,path:r.path,actor:t.actor||"human"})}).catch(()=>null),{txHash:p,walletAddress:a,contentId:u,ratingValue:n.ratingValue,reviewHash:f}}var uS,Sb,pE,mE,lE,hE,Ib,yE,kb=m(()=>{Jf();_t();Ui();uS="0xc62fad09",Sb=`0x${"0".repeat(64)}`,pE="nibgate:content:v1",mE=5042002,lE="Arc Testnet",hE="https://rpc.testnet.arc.io",Ib="0x9f27fd62e75f86a3c7addfdba443aab1f930e281",yE=[{type:"function",name:"rateContent",stateMutability:"nonpayable",inputs:[{name:"contentId",type:"bytes32"},{name:"rating",type:"uint8"},{name:"reviewHash",type:"bytes32"},{name:"unlockRef",type:"string"}],outputs:[]}]});var xE={};Nr(xE,{createOnchainRating:()=>_f,mountRatingUI:()=>Uf,rateResource:()=>Yc});function Yc(e,t={},r={}){let n=we(e),o=ou(t),s={...r,...o,ratingMessage:r.ratingMessage||t.message||t.ratingMessage||Zf(n,o,r),ratingSignature:r.ratingSignature||t.signature||t.ratingSignature||void 0,resource:n};return er("content_rating",s)}function _f(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe(),o=typeof t.status=="string"?n?.document.querySelector(t.status):t.status,s=typeof t.ratingTarget=="string"?n?.document.querySelector(t.ratingTarget):t.ratingTarget,i=t.ratingButtons||t.buttons||"[data-nibgate-rating-value], [data-rating]",c=(Array.isArray(t.buttons)?t.buttons:typeof t.buttons=="string"?Array.from(n?.document.querySelectorAll(t.buttons)||[]):t.buttons?[t.buttons]:null)||Array.from(n?.document.querySelectorAll(i)||[]),u=t.source||"nibgate-onchain-rating",f=!1,d=t.payment||null;function l(b){typeof t.onStatus=="function"&&t.onStatus(b),o&&(o.textContent=b||"")}function p(b){f=!!b,c.forEach(w=>{w&&"disabled"in w&&(w.disabled=f)})}function h(b=null){return d=b||null,d}function y(b){return s&&("hidden"in s&&(s.hidden=!b),s.setAttribute("aria-hidden",b?"false":"true")),!!b}function g(b){let w=b?.dataset?.nibgateRatingValue||b?.dataset?.rating||b?.value||b?.textContent,A=Number.parseFloat(String(w||"").replace(/[^\d.]/g,""));return Number.isFinite(A)?A:Number(t.rating||t.stars||0)}async function v(b={}){p(!0);try{let w=Number.parseFloat(b.rating??b.stars??b.value??t.rating??t.stars);if(!Number.isFinite(w))throw new Error("Choose a rating before sending.");let A=b.paymentId||t.paymentId||(typeof t.getPaymentId=="function"?t.getPaymentId():d?.paymentId),P=b.unlockRef||t.unlockRef||(typeof t.getUnlockRef=="function"?t.getUnlockRef():null)||A||d?.txHash||d?.transactionHash||"";l(t.pendingMessage||"Send the onchain rating transaction...");let B=await Em(r.resource,{...t,...b,rating:w,paymentId:A,unlockRef:P,source:u});return l(t.successMessage||"Rating sent to Nibgate reputation."),typeof t.onRated=="function"&&t.onRated(B),B}catch(w){let A=w?.message||t.errorMessage||"Rating failed.";throw l(A),typeof t.onError=="function"&&t.onError(w),w}finally{p(!1)}}function E(){return c.forEach(b=>{b?.addEventListener?.("click",()=>v({rating:g(b)}).catch(()=>null))}),t.visible!==void 0&&y(!!t.visible),x}let x={resource:r.resource,rate:v,mount:E,setPayment:h,setVisible:y};return t.autoMount!==!1&&E(),x}function Uf(e,t={}){let r=ct(e,t.gateOptions||{}),n=fe();if(!n)return null;let o=typeof t.target=="string"?n.document.querySelector(t.target):t.target;if(!o)return null;let s=[1,2,3,4,5],i=0,a=n.document.createElement("div");a.className="nibgate-rating-ui",a.style.cssText="display:flex;align-items:center;gap:4px;padding:8px 0";let c=s.map(l=>{let p=n.document.createElement("button");return p.type="button",p.dataset.nibgateRatingValue=String(l),p.setAttribute("aria-label",`${l} star${l>1?"s":""}`),p.innerHTML="\u2606",p.style.cssText="background:none;border:none;font-size:24px;cursor:pointer;color:#ccc;transition:color 0.15s;padding:2px;line-height:1",p.addEventListener("mouseenter",()=>{c.forEach((h,y)=>h.style.color=y<l?"#f5b342":"#ccc")}),p.addEventListener("mouseleave",()=>{c.forEach((h,y)=>h.style.color=y<i?"#f5b342":"#ccc")}),p.addEventListener("click",()=>{i=l,c.forEach((h,y)=>h.style.color=y<l?"#f5b342":"#ccc"),Yc(r.resource,{rating:l}).catch(()=>{})}),a.appendChild(p),p}),u=n.document.createElement("span");u.style.cssText="font-size:13px;color:#888;margin-left:8px",u.textContent=t.label||"Rate this content",a.appendChild(u),o.appendChild(a);function f(l,p={}){return r.rate({...p,rating:l})}function d(l){i=l,c.forEach((p,h)=>p.style.color=h<l?"#f5b342":"#ccc")}return{resource:r.resource,container:a,setRating:d,rate:f}}var Am=m(()=>{_t();Jf();Ui();Bs();kb();jn()});var vE={};Nr(vE,{renderDefaultGatewayWalletUI:()=>Mb,renderDefaultRatingUI:()=>Hb,renderDefaultUnlockUI:()=>Nb});function wE(e,t,r){let n=document.createElement(e);for(let[o,s]of Object.entries(t||{}))o==="dataset"?Object.assign(n.dataset,s):o.startsWith("on")?n.addEventListener(o.slice(2).toLowerCase(),s):o==="style"&&typeof s=="object"?n.style.cssText=hS(s):o==="cls"?n.className=s:n.setAttribute(o,String(s));return typeof r=="string"?n.innerHTML=r:r&&(Array.isArray(r)?r:[r]).forEach(o=>{o!=null&&n.appendChild(typeof o=="string"?document.createTextNode(o):o)}),n}function $b(){if(document.getElementById(gE))return;let e=wE("style",{id:gE},`
49
49
  @keyframes nfade { from { opacity:0;transform:translateY(6px) } to { opacity:1;transform:translateY(0) } }
50
50
  @keyframes nscale { from { opacity:0;transform:scale(0.96) } to { opacity:1;transform:scale(1) } }
51
51
  @keyframes nshimmer { 0% { transform:translateX(-100%) } 100% { transform:translateX(100%) } }
52
52
 
53
- .nui { font-family:var(--font-content,'Kumbh Sans','ABC Favorit',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif);color:${W.fg};line-height:1.5;-webkit-font-smoothing:antialiased;font-size:19px }
53
+ .nui { font-family:var(--font-content,'Kumbh Sans','ABC Favorit',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif);color:${V.fg};line-height:1.5;-webkit-font-smoothing:antialiased;font-size:19px }
54
54
  .nui *,.nui *::before,.nui *::after { box-sizing:border-box }
55
55
  .nui-btn { display:flex;align-items:center;justify-content:center;gap:8px;font-size:18px;font-weight:600;padding:14px 28px;border-radius:12px;cursor:pointer;transition:all.12s;font-family:inherit;line-height:1;border:none }
56
56
  .nui-btn:disabled { opacity:0.35;cursor:default;pointer-events:none }
57
- .nui-btn:focus-visible { outline:2px solid ${W.accent};outline-offset:2px }
58
- .nui-btn-primary { background:${W.accent};color:${W.bg} }
57
+ .nui-btn:focus-visible { outline:2px solid ${V.accent};outline-offset:2px }
58
+ .nui-btn-primary { background:${V.accent};color:${V.bg} }
59
59
  .nui-btn-primary:hover:not(:disabled) { opacity:0.9 }
60
60
  .nui-btn-primary:active:not(:disabled) { transform:scale(.98) }
61
- .nui-btn-outline { background:transparent;border:1px solid ${W.border};color:${W.fg} }
62
- .nui-btn-outline:hover:not(:disabled) { border-color:${W.accent};color:${W.accent} }
63
- .nui-input { padding:14px 16px;font-size:18px;border-radius:12px;border:1px solid ${W.border};background:transparent;color:${W.fg};width:100%;font-family:inherit;outline:none;transition:border-color.12s }
64
- .nui-input:focus { border-color:${W.accent} }
65
- .nui-input::placeholder { color:${W.muted} }
66
- .nui-label { font-size:17px;font-weight:600;color:${W.muted};margin-bottom:8px;display:block }
61
+ .nui-btn-outline { background:transparent;border:1px solid ${V.border};color:${V.fg} }
62
+ .nui-btn-outline:hover:not(:disabled) { border-color:${V.accent};color:${V.accent} }
63
+ .nui-input { padding:14px 16px;font-size:18px;border-radius:12px;border:1px solid ${V.border};background:transparent;color:${V.fg};width:100%;font-family:inherit;outline:none;transition:border-color.12s }
64
+ .nui-input:focus { border-color:${V.accent} }
65
+ .nui-input::placeholder { color:${V.muted} }
66
+ .nui-label { font-size:17px;font-weight:600;color:${V.muted};margin-bottom:8px;display:block }
67
67
  .nui-mono { font-family:ui-monospace,SFMono-Regular,'SF Mono',Menlo,Consolas,monospace }
68
- .nui-stat { font-size:18px;color:${W.muted};line-height:1.4;min-height:28px }
68
+ .nui-stat { font-size:18px;color:${V.muted};line-height:1.4;min-height:28px }
69
69
  .nui-stat-err { color:#dc2626 }
70
70
  .nui-stat-ok { color:#16a34a }
71
- `);document.head.appendChild(e)}function Ci(e,t,r){return pE(e,t,r)}function dS(e,t){e&&(e.textContent=t||"")}function Ep(e){let t=document.createElement("div");return t.textContent=String(e??""),t.innerHTML}function lE(e,t,r={}){kb();let n=Ci("div",{cls:"nui",style:{animation:"nfade .2s ease-out"}}),o='<svg width="24" height="24" viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle"><path d="M6 16v8a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-8"/><path d="M10 16v-5a6 6 0 0 1 12 0v5"/><circle cx="16" cy="21" r="2"/></svg>';n.innerHTML=`
71
+ `);document.head.appendChild(e)}function $r(e,t,r){return wE(e,t,r)}function yS(e,t){e&&(e.textContent=t||"")}function Pm(e){let t=document.createElement("div");return t.textContent=String(e??""),t.innerHTML}function Nb(e,t,r={}){$b();let n=$r("div",{cls:"nui",style:{animation:"nfade .2s ease-out"}}),o='<svg width="24" height="24" viewBox="0 0 32 32" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:middle"><path d="M6 16v8a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3v-8"/><path d="M10 16v-5a6 6 0 0 1 12 0v5"/><circle cx="16" cy="21" r="2"/></svg>';n.innerHTML=`
72
72
  <div style="display:flex;flex-direction:column;align-items:center;text-align:center;max-width:580px;margin:0 auto;padding:40px 52px">
73
73
  <div id="nibgate-lottie" style="width:165px;height:168px;margin-bottom:24px"></div>
74
- <div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${W.fg};margin-bottom:12px">${Ep(t.price)} USDC</div>
75
- <div style="font-size:21px;color:${W.muted};margin-bottom:48px">Pay to unlock this content</div>
76
- <div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${W.muted};margin-bottom:40px;min-height:28px">Connect wallet</div>
74
+ <div style="font-size:50px;font-weight:700;letter-spacing:-.03em;color:${V.fg};margin-bottom:12px">${Pm(t.price)} USDC</div>
75
+ <div style="font-size:21px;color:${V.muted};margin-bottom:48px">Pay to unlock this content</div>
76
+ <div data-nibgate-wallet-label class="nui-mono" style="font-size:18px;color:${V.muted};margin-bottom:40px;min-height:28px">Connect wallet</div>
77
77
  <div data-nibgate-unlock-wrap style="width:100%;position:relative;border-radius:12px;overflow:hidden;cursor:pointer">
78
78
  <div data-nibgate-unlock-progress style="position:absolute;inset:0;width:0%;background:linear-gradient(90deg,rgba(255,255,255,0.1),rgba(255,255,255,0.45));border-radius:12px;transition:width .05s linear;z-index:2"></div>
79
79
  <div data-nibgate-shimmer style="position:absolute;inset:0;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,0.12),transparent);border-radius:12px;transform:translateX(-100%);z-index:3;pointer-events:none"></div>
80
- <button type="button" data-nibgate-unlock disabled class="nui-btn nui-btn-primary" style="width:100%;padding:24px 32px;font-size:24px;position:relative;z-index:4;background:${W.accent};transition:transform .1s,opacity .15s;display:flex">${o}Hold to pay ${Ep(t.price)} USDC</button></div>
80
+ <button type="button" data-nibgate-unlock disabled class="nui-btn nui-btn-primary" style="width:100%;padding:24px 32px;font-size:24px;position:relative;z-index:4;background:${V.accent};transition:transform .1s,opacity .15s;display:flex">${o}Hold to pay ${Pm(t.price)} USDC</button></div>
81
81
  <div class="nui-stat" style="text-align:center;margin-top:16px" data-nibgate-status></div>
82
82
  </div>
83
- <div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${W.border};padding-top:32px">${r.premiumContentHTML||""}</div>
84
- `,(typeof e=="string"?document.querySelector(e):e)?.appendChild(n),(function(){if(!document.getElementById("nibgate-lottie"))return;function B(S){var N=document.getElementById("nibgate-lottie");N&&window.lottie&&window.lottie.loadAnimation({container:N,animationData:S,loop:!0,autoplay:!0})}if(window.lottie){window._lottieData?B(window._lottieData):fetch("/nibgate-unlock-key.json?t=1").then(function(S){if(!S.ok)throw new Error;return S.json()}).then(function(S){window._lottieData=S,B(S)}).catch(function(){});return}if(!window._lottieLoading){window._lottieLoading=!0;var k=document.createElement("script");k.src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js",k.onload=function(){fetch("/nibgate-unlock-key.json?t=1").then(function(S){if(!S.ok)throw new Error;return S.json()}).then(function(S){window._lottieData=S,B(S)}).catch(function(){})},document.head.appendChild(k)}})();let s=n.querySelector("[data-nibgate-status]"),i=n.querySelector("[data-nibgate-wallet-label]"),a=n.querySelector("[data-nibgate-unlock-wrap]"),c=n.querySelector("[data-nibgate-unlock-progress]"),u=n.querySelector("[data-nibgate-shimmer]"),f=n.querySelector("[data-nibgate-unlock]"),d=1500,l=null,m=!1,h=!1,y=ki(t,{...r,connectButton:null,unlockButton:null,walletLabel:null,status:"[data-nibgate-status]",unlockedTarget:"[data-nibgate-premium]",onStatus:P=>dS(s,P),onUnlock:r.premiumContentUrl?async()=>{let P=n.querySelector("[data-nibgate-premium]");if(P){P.innerHTML="Loading content...";try{let B=await fetch(r.premiumContentUrl);if(!B.ok)throw new Error(`HTTP ${B.status}`);let k=await B.text();P.innerHTML=k}catch{P.innerHTML="Could not load premium content. Refresh and try again."}}}:r.onUnlock});function g(P){return P?P.slice(0,6)+"..."+P.slice(-4):""}function v(){let P=y.getWalletAddress();P?(i.innerHTML=g(P)+' <span data-nibgate-disconnect style="cursor:pointer">\xB7 Disconnect</span>',f.disabled=!1,f.style.cursor="pointer"):(i.textContent="Connect wallet",f.disabled=!0,f.style.cursor="default",f.innerHTML=o+"Hold to pay "+Ep(t.price)+" USDC")}function E(P){f.innerHTML=o+P}function x(){m=!1,h=!1,l=null,f.style.transform="scale(1)",c.style.width="0%",u.style.animation="none",u.style.transform="translateX(-100%)",f.disabled||E("Hold to pay "+Ep(t.price)+" USDC")}function b(P){if(f.disabled||m)return;P.preventDefault(),m=!0,h=!1,f.style.transform="scale(.97)",c.style.transition="none",c.style.width="0%",u.style.animation="nshimmer 1s ease-in-out infinite",u.style.transform="none",E("Hold\u2026"),requestAnimationFrame(()=>{c.style.transition="width "+d+"ms linear",c.style.width="100%"});let B=setTimeout(()=>{m&&!h&&E("Keep holding\u2026")},d*.4),k=setTimeout(()=>{m&&!h&&E("Almost there\u2026")},d*.75);l=setTimeout(()=>{h=!0,m=!1,clearTimeout(B),clearTimeout(k),f.style.transform="scale(1)",u.style.animation="none",c.style.transition="width .05s linear",E("Processing\u2026"),f.disabled=!0,setTimeout(()=>y.unlock().then(v).catch(v),300)},d)}function w(){!m||h||(clearTimeout(l),x())}i.addEventListener("click",P=>{P.target.dataset.nibgateDisconnect!==void 0?y.disconnect().then(v):y.getWalletAddress()||y.connect().then(v).catch(()=>v())}),a.addEventListener("mousedown",b),a.addEventListener("touchstart",b,{passive:!1}),document.addEventListener("mouseup",w),document.addEventListener("touchend",w),a.addEventListener("mouseleave",w),setTimeout(v,200);let A=()=>{document.removeEventListener("mouseup",w),document.removeEventListener("touchend",w)};return n.addEventListener("remove",A),{...y,element:n,destroy:()=>{A(),n.remove()}}}function hE(e,t,r={}){kb();let n=0,o=!1,s=null,i=null,a=Ci("div",{cls:"nui",style:{animation:"nfade .2s ease-out",textAlign:"center",padding:"28px 0"}}),c=Ci("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"4px"}}),u=[];for(let E=1;E<=5;E++){let x=Ci("button",{type:"button","aria-label":`${E} star${E>1?"s":""}`,"data-star":E,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",fontSize:"31px",lineHeight:"1",color:W.border,transition:"color .12s, transform .12s",borderRadius:"4px",fontFamily:"inherit"}},"\u2606");u.push(x),c.appendChild(x)}let f=Ci("span",{style:{fontSize:"17px",color:W.muted,marginLeft:"12px"}});f.textContent="No ratings yet",c.appendChild(f);let d=Ci("div",{style:{fontSize:"17px",color:W.muted,marginTop:"8px",minHeight:"1.4em"}});d.textContent="Tap stars to rate",a.append(c,d),(typeof e=="string"?document.querySelector(e):e)?.appendChild(a);function l(){i&&(clearTimeout(i),i=null),d.textContent=n>0?"":"Tap stars to rate",d.style.color=W.muted}function m(E,x,b){d.textContent=E||"",d.style.color=x||"",b&&(i=setTimeout(l,b))}function h(E){u.forEach((x,b)=>{let w=b<E;x.style.color=w?W.accent:W.border,x.textContent=w?"\u2605":"\u2606",x.style.transform=w?"scale(1.08)":"scale(1)"})}function y(E){m(["","Poor","Below average","Average","Good","Excellent"][E])}async function g(E){if(!(o||!s)){o=!0,u.forEach(x=>{x.disabled=!0,x.style.cursor="default"}),n=E,h(E),m("Submitting\u2026");try{await s.rate({rating:E}),h(E),m("You rated "+E+" \u2605".repeat(E),W.accent,3e3),v()}catch(x){m(x?.message||"Could not save rating. Try again.","#dc2626"),h(n)}finally{o=!1,u.forEach(x=>{x.disabled=!1,x.style.cursor="pointer"})}}}function v(){let E=r.statsUrl||(t.id?`${r.apiBase||"/api"}/rating/${t.id}`:null);E&&fetch(E).then(x=>x.json()).then(x=>{x.count>0?f.textContent=`${x.average.toFixed(1)} \u2014 ${x.count} rating${x.count!==1?"s":""}`:f.textContent="No ratings yet"}).catch(()=>{})}return u.forEach(E=>{let x=parseInt(E.dataset.star);E.addEventListener("mouseenter",()=>{o||(h(x),y(x))}),E.addEventListener("mouseleave",()=>{o||(h(n),l())}),E.addEventListener("click",()=>g(x)),E.addEventListener("keydown",b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g(x))})}),Promise.resolve().then(()=>(wp(),dE)).then(E=>{s=E.createOnchainRating(t,{autoMount:!1,contentId:r.contentId||"0x"+(t.id||"").replace(/-/g,""),onRated:x=>{m("Rating saved",W.accent,3e3),v(),typeof r.onRated=="function"&&r.onRated(x)},onError:x=>{m(x?.message||"Could not save rating. Try again.","#dc2626"),typeof r.onError=="function"&&r.onError(x)}}),v()}).catch(()=>{m("Could not load rating","#dc2626")}),{element:a,destroy:()=>a.remove(),refresh:v,setRating:E=>{n=E,h(E)}}}function yE(e,t={}){kb();let r="deposit",n=Ci("div",{cls:"nui",style:{animation:"nfade .2s ease-out",border:"1px solid "+W.border,borderRadius:"16px",padding:"28px"}});n.innerHTML=`
83
+ <div data-nibgate-premium hidden style="margin-top:32px;border-top:1px solid ${V.border};padding-top:32px">${r.premiumContentHTML||""}</div>
84
+ `,(typeof e=="string"?document.querySelector(e):e)?.appendChild(n),(function(){if(!document.getElementById("nibgate-lottie"))return;function U(L){var q=document.getElementById("nibgate-lottie");q&&window.lottie&&window.lottie.loadAnimation({container:q,animationData:L,loop:!0,autoplay:!0})}if(window.lottie){window._lottieData?U(window._lottieData):fetch("/nibgate-unlock-key.json?t=1").then(function(L){if(!L.ok)throw new Error;return L.json()}).then(function(L){window._lottieData=L,U(L)}).catch(function(){});return}if(!window._lottieLoading){window._lottieLoading=!0;var H=document.createElement("script");H.src="https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js",H.onload=function(){fetch("/nibgate-unlock-key.json?t=1").then(function(L){if(!L.ok)throw new Error;return L.json()}).then(function(L){window._lottieData=L,U(L)}).catch(function(){})},document.head.appendChild(H)}})();let s=n.querySelector("[data-nibgate-status]"),i=n.querySelector("[data-nibgate-wallet-label]"),a=n.querySelector("[data-nibgate-unlock-wrap]"),c=n.querySelector("[data-nibgate-unlock-progress]"),u=n.querySelector("[data-nibgate-shimmer]"),f=n.querySelector("[data-nibgate-unlock]"),d=1500,l=null,p=!1,h=!1,y=Ci(t,{...r,connectButton:null,unlockButton:null,walletLabel:null,status:"[data-nibgate-status]",unlockedTarget:"[data-nibgate-premium]",onStatus:k=>yS(s,k),onUnlock:r.premiumContentUrl?async()=>{let k=n.querySelector("[data-nibgate-premium]");if(k){k.innerHTML="Loading content...";try{let U=await fetch(r.premiumContentUrl);if(!U.ok)throw new Error(`HTTP ${U.status}`);let H=await U.text();k.innerHTML=H}catch{k.innerHTML="Could not load premium content. Refresh and try again."}}}:r.onUnlock});function g(k){return k?k.slice(0,6)+"..."+k.slice(-4):""}function v(){let k=y.getWalletAddress();k?(i.innerHTML=g(k)+' <span data-nibgate-disconnect style="cursor:pointer">\xB7 Disconnect</span>',f.disabled=!1,f.style.cursor="pointer"):(i.textContent="Connect wallet",f.disabled=!0,f.style.cursor="default",f.innerHTML=o+"Hold to pay "+Pm(t.price)+" USDC")}function E(k){f.innerHTML=o+k}function x(){p=!1,h=!1,l=null,f.style.transform="scale(1)",c.style.width="0%",u.style.animation="none",u.style.transform="translateX(-100%)",f.disabled||E("Hold to pay "+Pm(t.price)+" USDC")}function b(k){if(f.disabled||p)return;k.preventDefault(),p=!0,h=!1,f.style.transform="scale(.97)",c.style.transition="none",c.style.width="0%",u.style.animation="nshimmer 1s ease-in-out infinite",u.style.transform="none",E("Hold\u2026"),requestAnimationFrame(()=>{c.style.transition="width "+d+"ms linear",c.style.width="100%"});let U=setTimeout(()=>{p&&!h&&E("Keep holding\u2026")},d*.4),H=setTimeout(()=>{p&&!h&&E("Almost there\u2026")},d*.75);l=setTimeout(()=>{h=!0,p=!1,clearTimeout(U),clearTimeout(H),f.style.transform="scale(1)",u.style.animation="none",c.style.transition="width .05s linear",E("Processing\u2026"),f.disabled=!0,setTimeout(()=>y.unlock().then(v).catch(v),300)},d)}function w(){!p||h||(clearTimeout(l),x())}i.addEventListener("click",k=>{k.target.dataset.nibgateDisconnect!==void 0?y.disconnect().then(v):y.getWalletAddress()||y.connect().then(v).catch(()=>v())}),a.addEventListener("mousedown",b),a.addEventListener("touchstart",b,{passive:!1}),document.addEventListener("mouseup",w),document.addEventListener("touchend",w),a.addEventListener("mouseleave",w),setTimeout(v,200);let A=()=>{document.removeEventListener("mouseup",w),document.removeEventListener("touchend",w)};n.addEventListener("remove",A);let P=null,B=null,R=null;function S(){return'<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="display:inline;vertical-align:baseline"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>'}async function M(){if(P)return;P=$r("div",{style:"position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center;padding:20px;animation:nfade .15s ease-out"});let k=$r("div",{style:"background:"+V.bg+";border-radius:16px;max-width:540px;width:100%;max-height:90vh;overflow:auto;position:relative;box-shadow:0 8px 32px rgba(0,0,0,0.12);animation:nscale .15s ease-out"}),U=$r("button",{style:"position:absolute;top:12px;right:16px;z-index:20;background:none;border:none;font-size:28px;cursor:pointer;color:"+V.muted+";font-family:inherit;line-height:1"},"\xD7");U.addEventListener("click",z),k.appendChild(U),P.appendChild(k),P.addEventListener("click",L=>{L.target===P&&z()}),document.body.appendChild(P),document.addEventListener("keydown",_),(await Promise.resolve().then(()=>(zb(),vE))).renderDefaultGatewayWalletUI(k,r.gatewayOptions||{})}function z(){P&&(P.remove(),P=null,document.removeEventListener("keydown",_))}function _(k){k.key==="Escape"&&z()}function N(){return R&&R.isConnected||(R=$r("span",{"data-nibgate-bal":"",style:"margin-left:6px;cursor:pointer;white-space:nowrap"},S()+" <span data-nibgate-bal-text></span>"),R.addEventListener("click",M),i.parentNode&&i.parentNode.insertBefore(R,i.nextSibling)),R}async function C(){if(stateRef?.destroyed)return;let k=y.getWalletAddress();if(!k)return;let U=N().querySelector("[data-nibgate-bal-text]");if(r.gatewayBalanceUrl)try{let L=await(await fetch(r.gatewayBalanceUrl+"?address="+encodeURIComponent(k))).json();U&&(U.textContent=L?.balance||L?.availableBalance||"\u2026");return}catch{}U&&(U.textContent="\u2026")}return window.ethereum&&(B=setInterval(C,3e3),setTimeout(C,1e3),window.ethereum.on("accountsChanged",C)),{...y,element:n,destroy:()=>{A(),n.remove(),B&&clearInterval(B),z()}}}function Hb(e,t,r={}){$b();let n=0,o=!1,s=null,i=null,a=$r("div",{cls:"nui",style:{animation:"nfade .2s ease-out",textAlign:"center",padding:"28px 0"}}),c=$r("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"4px"}}),u=[];for(let E=1;E<=5;E++){let x=$r("button",{type:"button","aria-label":`${E} star${E>1?"s":""}`,"data-star":E,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",fontSize:"31px",lineHeight:"1",color:V.border,transition:"color .12s, transform .12s",borderRadius:"4px",fontFamily:"inherit"}},"\u2606");u.push(x),c.appendChild(x)}let f=$r("span",{style:{fontSize:"17px",color:V.muted,marginLeft:"12px"}});f.textContent="No ratings yet",c.appendChild(f);let d=$r("div",{style:{fontSize:"17px",color:V.muted,marginTop:"8px",minHeight:"1.4em"}});d.textContent="Tap stars to rate",a.append(c,d),(typeof e=="string"?document.querySelector(e):e)?.appendChild(a);function l(){i&&(clearTimeout(i),i=null),d.textContent=n>0?"":"Tap stars to rate",d.style.color=V.muted}function p(E,x,b){d.textContent=E||"",d.style.color=x||"",b&&(i=setTimeout(l,b))}function h(E){u.forEach((x,b)=>{let w=b<E;x.style.color=w?V.accent:V.border,x.textContent=w?"\u2605":"\u2606",x.style.transform=w?"scale(1.08)":"scale(1)"})}function y(E){p(["","Poor","Below average","Average","Good","Excellent"][E])}async function g(E){if(!(o||!s)){o=!0,u.forEach(x=>{x.disabled=!0,x.style.cursor="default"}),n=E,h(E),p("Submitting\u2026");try{await s.rate({rating:E}),h(E),p("You rated "+E+" \u2605".repeat(E),V.accent,3e3),v()}catch(x){p(x?.message||"Could not save rating. Try again.","#dc2626"),h(n)}finally{o=!1,u.forEach(x=>{x.disabled=!1,x.style.cursor="pointer"})}}}function v(){let E=r.statsUrl||(t.id?`${r.apiBase||"/api"}/rating/${t.id}`:null);E&&fetch(E).then(x=>x.json()).then(x=>{x.count>0?f.textContent=`${x.average.toFixed(1)} \u2014 ${x.count} rating${x.count!==1?"s":""}`:f.textContent="No ratings yet"}).catch(()=>{})}return u.forEach(E=>{let x=parseInt(E.dataset.star);E.addEventListener("mouseenter",()=>{o||(h(x),y(x))}),E.addEventListener("mouseleave",()=>{o||(h(n),l())}),E.addEventListener("click",()=>g(x)),E.addEventListener("keydown",b=>{(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),g(x))})}),Promise.resolve().then(()=>(Am(),xE)).then(E=>{s=E.createOnchainRating(t,{autoMount:!1,contentId:r.contentId||"0x"+(t.id||"").replace(/-/g,""),onRated:x=>{p("Rating saved",V.accent,3e3),v(),typeof r.onRated=="function"&&r.onRated(x)},onError:x=>{p(x?.message||"Could not save rating. Try again.","#dc2626"),typeof r.onError=="function"&&r.onError(x)}}),v()}).catch(()=>{p("Could not load rating","#dc2626")}),{element:a,destroy:()=>a.remove(),refresh:v,setRating:E=>{n=E,h(E)}}}function Mb(e,t={}){$b();let r="deposit",n=$r("div",{cls:"nui",style:{animation:"nfade .2s ease-out",border:"1px solid "+V.border,borderRadius:"16px",padding:"28px"}});n.innerHTML=`
85
85
  <div style="display:flex;gap:12px;margin-bottom:20px">
86
- <div data-gw-wallet-card style="flex:1;background:${W.bg};border:1px solid ${W.border};border-radius:12px;padding:16px">
86
+ <div data-gw-wallet-card style="flex:1;background:${V.bg};border:1px solid ${V.border};border-radius:12px;padding:16px">
87
87
  <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:4px">
88
- <div style="font-size:12px;font-weight:600;color:${W.muted};letter-spacing:.02em">Wallet</div>
89
- <button data-gw-connect style="font-size:12px;font-weight:600;cursor:pointer;border:1px solid ${W.accent};background:transparent;color:${W.accent};border-radius:8px;padding:4px 12px;font-family:inherit">Connect</button>
88
+ <div style="font-size:12px;font-weight:600;color:${V.muted};letter-spacing:.02em">Wallet</div>
89
+ <button data-gw-connect style="font-size:12px;font-weight:600;cursor:pointer;border:1px solid ${V.accent};background:transparent;color:${V.accent};border-radius:8px;padding:4px 12px;font-family:inherit">Connect</button>
90
90
  </div>
91
- <div data-gw-wallet-balance class="nui-mono" style="font-size:24px;font-weight:700;color:${W.fg}">\u2014</div>
91
+ <div data-gw-wallet-balance class="nui-mono" style="font-size:24px;font-weight:700;color:${V.fg}">\u2014</div>
92
92
  </div>
93
- <div style="flex:1;background:${W.bg};border:1px solid ${W.border};border-radius:12px;padding:16px">
94
- <div style="font-size:12px;font-weight:600;color:${W.muted};margin-bottom:4px;letter-spacing:.02em">Gateway</div>
95
- <div data-gw-balance class="nui-mono" style="font-size:24px;font-weight:700;color:${W.fg}">\u2014</div>
93
+ <div style="flex:1;background:${V.bg};border:1px solid ${V.border};border-radius:12px;padding:16px">
94
+ <div style="font-size:12px;font-weight:600;color:${V.muted};margin-bottom:4px;letter-spacing:.02em">Gateway</div>
95
+ <div data-gw-balance class="nui-mono" style="font-size:24px;font-weight:700;color:${V.fg}">\u2014</div>
96
96
  </div>
97
97
  </div>
98
- <div style="display:flex;gap:0;margin-bottom:20px;border-bottom:1px solid ${W.border}">
99
- <button data-tab="deposit" style="flex:1;padding:10px 0;font-size:15px;font-weight:600;cursor:pointer;border:none;background:transparent;color:${W.fg};border-bottom:2px solid ${W.accent};font-family:inherit">Deposit</button>
100
- <button data-tab="withdraw" style="flex:1;padding:10px 0;font-size:15px;font-weight:600;cursor:pointer;border:none;background:transparent;color:${W.muted};border-bottom:2px solid transparent;font-family:inherit">Withdraw</button>
98
+ <div style="display:flex;gap:0;margin-bottom:20px;border-bottom:1px solid ${V.border}">
99
+ <button data-tab="deposit" style="flex:1;padding:10px 0;font-size:15px;font-weight:600;cursor:pointer;border:none;background:transparent;color:${V.fg};border-bottom:2px solid ${V.accent};font-family:inherit">Deposit</button>
100
+ <button data-tab="withdraw" style="flex:1;padding:10px 0;font-size:15px;font-weight:600;cursor:pointer;border:none;background:transparent;color:${V.muted};border-bottom:2px solid transparent;font-family:inherit">Withdraw</button>
101
101
  </div>
102
102
  <div data-gw-form></div>
103
- `,(typeof e=="string"?document.querySelector(e):e)?.appendChild(n);let o=n.querySelector("[data-gw-form]"),s=n.querySelectorAll("[data-tab]");function i(c,u){c.forEach(f=>{let d=f.dataset.tab===u;f.style.color=d?W.fg:W.muted,f.style.borderBottomColor=d?W.accent:"transparent"})}function a(c){r=c,i(s,c),c==="deposit"?o.innerHTML=`
103
+ `,(typeof e=="string"?document.querySelector(e):e)?.appendChild(n);let o=n.querySelector("[data-gw-form]"),s=n.querySelectorAll("[data-tab]");function i(c,u){c.forEach(f=>{let d=f.dataset.tab===u;f.style.color=d?V.fg:V.muted,f.style.borderBottomColor=d?V.accent:"transparent"})}function a(c){r=c,i(s,c),c==="deposit"?o.innerHTML=`
104
104
  <label class="nui-label">Amount (USDC)</label>
105
105
  <input type="number" step="0.01" min="0" placeholder="0.00" data-gw-deposit-amount class="nui-input" style="margin-bottom:16px">
106
106
  <button type="button" data-gw-deposit class="nui-btn nui-btn-primary" style="width:100%;padding:16px 28px;font-size:20px">Deposit</button>
107
- <div data-gw-tx class="nui-mono" style="font-size:12px;color:${W.muted};word-break:break-all;margin-top:12px;display:none"></div>
107
+ <div data-gw-tx class="nui-mono" style="font-size:12px;color:${V.muted};word-break:break-all;margin-top:12px;display:none"></div>
108
108
  `:o.innerHTML=`
109
109
  <label class="nui-label">Amount (USDC)</label>
110
110
  <input type="number" step="0.01" min="0" placeholder="0.00" data-gw-withdraw-amount class="nui-input" style="margin-bottom:16px">
111
111
  <button type="button" data-gw-withdraw class="nui-btn nui-btn-primary" style="width:100%;padding:16px 28px;font-size:20px">Withdraw to your wallet</button>
112
- <div data-gw-tx class="nui-mono" style="font-size:12px;color:${W.muted};word-break:break-all;margin-top:12px;display:none"></div>
113
- `}return a("deposit"),s.forEach(c=>c.addEventListener("click",()=>a(c.dataset.tab))),{element:n,destroy:()=>n.remove(),switchTab:a}}_t();Ff();_t();var bE=[{name:"publishToNibgate",label:"Publish to Nibgate discovery",type:"boolean",defaultValue:!0},{name:"type",label:"Content type",type:"select",options:Mi,defaultValue:"article"},{name:"humanAccess",label:"Human access",type:"select",options:zi,defaultValue:"paid"},{name:"agentAccess",label:"Agent access",type:"select",options:zi,defaultValue:"paid"},{name:"unlockMode",label:"Unlock mode",type:"select",options:eu,defaultValue:"one_time"},{name:"paymentRail",label:"Payment rail",type:"select",options:Qc,defaultValue:"gateway"},{name:"price",label:"Price",type:"text",defaultValue:"0.005"},{name:"currency",label:"Currency",type:"text",defaultValue:"USDC"},{name:"recipient",label:"Recipient wallet",type:"wallet",defaultValue:""},{name:"ratingsEnabled",label:"Enable ratings",type:"boolean",defaultValue:!0},{name:"license",label:"License / terms",type:"textarea",defaultValue:""}];function xE(e={}){let t=Ss(e.access||{humans:e.humanAccess,agents:e.agentAccess}),r=_i(e.unlock||e.unlockMode||"one_time");return{publishToNibgate:e.publishToNibgate??e.publishedToNibgate??!0,type:Ps(e.type||e.contentType||"article"),humanAccess:t.humans,agentAccess:t.agents,unlockMode:r.mode,paymentRail:Hi(e.paymentRail||e.paymentMode||e.rail),price:String(e.price??e.amount??"0.005"),currency:e.currency||"USDC",recipient:e.recipient||e.payTo||e.receiverAddress||e.creatorWallet||"",ratingsEnabled:e.ratingsEnabled??e.enableRatings??e.reputation?.ratingsEnabled??!0,license:e.license||e.terms||""}}function gE(e={}){return Ss({humans:e.humanAccess,agents:e.agentAccess})}function wE(e={}){return _i(e.unlockMode||e.unlock||"one_time")}Ff();return SE(mS);})();
112
+ <div data-gw-tx class="nui-mono" style="font-size:12px;color:${V.muted};word-break:break-all;margin-top:12px;display:none"></div>
113
+ `}return a("deposit"),s.forEach(c=>c.addEventListener("click",()=>a(c.dataset.tab))),{element:n,destroy:()=>n.remove(),switchTab:a}}var gE,V,hS,zb=m(()=>{vm();gE="nibgate-ui-styles",V={bg:"var(--bg, #f4f4f0)",fg:"var(--fg, #0a0a0a)",muted:"var(--muted, #6b6862)",border:"var(--border, #cecdc3)",accent:"var(--accent, #7c9a6d)",accentSoft:"var(--accent-soft, #d8e8d3)",cardHover:"var(--card-hover, #e0ddd3)"},hS=e=>Object.entries(e).map(([t,r])=>`${t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}:${r}`).join(";")});var bS={};Nr(bS,{ACCESS_MODES:()=>zi,CONTENT_TYPES:()=>Mi,NIBGATE_CONTENT_HASH_NAMESPACE:()=>pE,NIBGATE_CONTENT_SETTING_FIELDS:()=>EE,NIBGATE_REPUTATION_ABI:()=>yE,NIBGATE_REPUTATION_CHAIN_ID:()=>mE,NIBGATE_REPUTATION_CHAIN_NAME:()=>lE,NIBGATE_REPUTATION_CONTRACT:()=>Ib,NIBGATE_REPUTATION_RPC_URL:()=>hE,PAYMENT_RAILS:()=>eu,UNLOCK_MODES:()=>tu,checkResourceAccess:()=>Ut,contentRatingHash:()=>Bb,createCircleGatewayBrowserAdapter:()=>zf,createEvmGatewayUnlock:()=>Ci,createGate:()=>ct,createHostedUnlock:()=>fE,createNibgate:()=>Cb,createNibgateContentSettings:()=>AE,createOnchainRating:()=>_f,createTransferCheckout:()=>Lf,createWalletCheckout:()=>Kf,mountRatingUI:()=>Uf,nibgate:()=>Rb,normalizeAccessPolicy:()=>Is,normalizeContentType:()=>Ss,normalizePaymentRail:()=>Hi,normalizeResource:()=>we,normalizeUnlockPolicy:()=>_i,payAndUnlockResource:()=>nu,payWithPaymentSignature:()=>ru,payWithTransfer:()=>Tm,rateContentOnchain:()=>Em,rateResource:()=>Yc,renderDefaultGatewayWalletUI:()=>Mb,renderDefaultRatingUI:()=>Hb,renderDefaultUnlockUI:()=>Nb,reviewTextHash:()=>bE,settingsToAccessPolicy:()=>TE,settingsToUnlockPolicy:()=>PE,setupResourcePage:()=>Vf,trackResourcePage:()=>ks,validateResourceMetadata:()=>Of});jn();Li();_t();Bs();Li();function jE(e,t){let r=fe();if(!e||!r)return;let n=typeof e=="string"?r.document.querySelector(e):e;n&&(n.textContent=t||"")}function Db(e,t){let r=fe();if(!e||!r)return;let n=typeof e=="string"?r.document.querySelector(e):e;n&&"disabled"in n&&(n.disabled=!!t)}function Kf(e,t={}){let r=we(e),n=t.accessPath||r.accessPath||"/api/nibgate/access",o=t.button||null,s=t.status||null,i=typeof t.onStatus=="function"?t.onStatus:f=>jE(s,f),a=t.checkout||t.createPaymentSignature||t.pay;if(typeof a!="function")throw new Error("createWalletCheckout requires checkout/createPaymentSignature/pay callback for the active wallet or Gateway adapter.");async function c(f={}){Db(o,!0);try{return await Ut(r,{...t,...f,accessPath:n,createPaymentSignature:a,onStatus:i})}finally{Db(o,!1)}}function u(){let f=fe();if(!f||!o)return{unlock:c};let d=typeof o=="string"?f.document.querySelector(o):o;return d&&d.addEventListener("click",()=>c().catch(l=>i(l.message||"Checkout failed."))),{unlock:c}}return{resource:r,unlock:c,mount:u}}_t();Jf();Ui();jn();jn();Li();vm();Am();Wf();_t();function Lf(e,t={}){let r=we({...e,paymentRail:"transfer"}),n=t.sendTransfer||t.transfer;if(typeof n!="function")throw new Error("createTransferCheckout requires sendTransfer({ resource, recipient, amount, currency, network }) and a server verifyTransfer hook.");return{resource:r,async pay(o={}){let s=r.recipient||r.payTo,i=String(r.price||r.amount||"0"),a=r.currency||"USDC",c=t.network||o.challenge?.accepts?.[0]?.network||"eip155:5042002",u=await n({resource:r,recipient:s,amount:i,currency:a,network:c,challenge:o.challenge}),f=u?.txHash||u?.hash||u?.transactionHash||u?.paymentId||"";if(!f)throw new Error("Transfer checkout did not return a txHash.");return{paymentSignature:f,signature:f,memo:u.memo||"",metadata:{paymentProvider:"direct-transfer",paymentId:f,txHash:f,recipient:s,amount:Number(i),currency:a,network:c,...u.metadata||u}}}}}async function Tm(e,t={}){let n=await(t.checkout||Lf(e,t).pay)({resource:we(e),challenge:t.challenge||null}),o=n?.metadata?.txHash||n?.txHash||n?.paymentSignature||n?.signature||"";if(!o)throw new Error("Transfer checkout did not return a txHash.");return Ut(e,{...t,headers:{...t.headers||{},"x-nibgate-transfer-tx":o},payment:n.metadata||{paymentProvider:"direct-transfer",txHash:o,paymentId:o}})}function Cb(e={}){let t=e.resource?we(e.resource):null;function r(n={}){return we({...t||{},...typeof n=="string"?{id:n}:n})}return{content(n,o={}){return er("content_registered",hr(r(n),o))},registerContent(n,o={}){return er("content_registered",hr(r(n),o))},view(n,o={}){return er("resource_view",hr(r(n),o))},track(n,o={}){return er(n||"custom",o)},unlockStarted(n,o={}){return er("unlock_started",hr(r(n),o))},unlockCompleted(n,o={}){return er("unlock_completed",hr(r(n),o))},paymentCompleted(n,o={}){return er("payment_completed",hr(r(n),o))},rateResource(n,o={},s={}){return Yc(r(n),o,s)},ratingMessage(n,o={},s={}){return Zf(r(n),o,s)},gate(n,o={}){return ct(r(n),{...o,client:this})},trackResourcePage(n,o={}){return ks(r(n),o)},checkResourceAccess(n,o={}){return Ut(r(n),o)},payWithPaymentSignature(n,o={}){return ru(r(n),o)},createWalletCheckout(n,o={}){return Kf(r(n),o)},createCircleGatewayBrowserAdapter(n={}){return zf(n)},createTransferCheckout(n,o={}){return Lf(r(n),o)},payWithTransfer(n,o={}){return Tm(r(n),o)},createEvmGatewayUnlock(n,o={}){return Ci(r(n),o)},createOnchainRating(n,o={}){return _f(r(n),o)},mountRatingUI(n,o={}){return Uf(r(n),o)},payAndUnlockResource(n,o={}){return nu(r(n),o)},setupResourcePage(n,o={}){return Vf(r(n),o)},normalizeResource:r,normalizeContentType:Ss,flush:Df}}var Rb=Cb();Ob(Rb);vm();Am();Wf();kb();zb();_t();Ff();_t();var EE=[{name:"publishToNibgate",label:"Publish to Nibgate discovery",type:"boolean",defaultValue:!0},{name:"type",label:"Content type",type:"select",options:Mi,defaultValue:"article"},{name:"humanAccess",label:"Human access",type:"select",options:zi,defaultValue:"paid"},{name:"agentAccess",label:"Agent access",type:"select",options:zi,defaultValue:"paid"},{name:"unlockMode",label:"Unlock mode",type:"select",options:tu,defaultValue:"one_time"},{name:"paymentRail",label:"Payment rail",type:"select",options:eu,defaultValue:"gateway"},{name:"price",label:"Price",type:"text",defaultValue:"0.005"},{name:"currency",label:"Currency",type:"text",defaultValue:"USDC"},{name:"recipient",label:"Recipient wallet",type:"wallet",defaultValue:""},{name:"ratingsEnabled",label:"Enable ratings",type:"boolean",defaultValue:!0},{name:"license",label:"License / terms",type:"textarea",defaultValue:""}];function AE(e={}){let t=Is(e.access||{humans:e.humanAccess,agents:e.agentAccess}),r=_i(e.unlock||e.unlockMode||"one_time");return{publishToNibgate:e.publishToNibgate??e.publishedToNibgate??!0,type:Ss(e.type||e.contentType||"article"),humanAccess:t.humans,agentAccess:t.agents,unlockMode:r.mode,paymentRail:Hi(e.paymentRail||e.paymentMode||e.rail),price:String(e.price??e.amount??"0.005"),currency:e.currency||"USDC",recipient:e.recipient||e.payTo||e.receiverAddress||e.creatorWallet||"",ratingsEnabled:e.ratingsEnabled??e.enableRatings??e.reputation?.ratingsEnabled??!0,license:e.license||e.terms||""}}function TE(e={}){return Is({humans:e.humanAccess,agents:e.agentAccess})}function PE(e={}){return _i(e.unlockMode||e.unlock||"one_time")}Ff();return RE(bS);})();
114
114
  /*! Bundled license information:
115
115
 
116
116
  @noble/hashes/esm/utils.js: