const__$G=typeofglobalThis!=="undefined"?globalThis:typeofwindow!=="undefined"?window:typeofglobal!=="undefined"?global:typeofself!=="undefined"?self:{};(function(global,factory){typeofexports==="object"&&typeofmodule!=="undefined"?factory(exports):typeofdefine==="function"&&define.amd?define(["exports"],factory):(global=typeofglobalThis!=="undefined"?globalThis:global||self,factory(global.ethers={}))})(this,function(exports){"use strict";constversion="6.4.0";functioncheckType(value,type,name){consttypes=type.split("|").map(t=>t.trim());for(leti=0;i<types.length;i++){switch(type){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeofvalue===type){return}}}consterror=newError(`invalid value for type ${type}`);error.code="INVALID_ARGUMENT";error.argument=`value.${name}`;error.value=value;throwerror}asyncfunctionresolveProperties(value){constkeys=Object.keys(value);constresults=awaitPromise.all(keys.map(k=>Promise.resolve(value[k])));returnresults.reduce((accum,v,index)=>{accum[keys[index]]=v;returnaccum},{})}functiondefineProperties(target,values,types){for(letkeyinvalues){letvalue=values[key];consttype=types?types[key]:null;if(type){checkType(value,type,key)}Object.defineProperty(target,key,{enumerable:true,value:value,writable:false})}}functionstringify$1(value){if(value==null){return"null"}if(Array.isArray(value)){return"[ "+value.map(stringify$1).join(", ")+" ]"}if(valueinstanceofUint8Array){constHEX="0123456789abcdef";letresult="0x";for(leti=0;i<value.length;i++){result+=HEX[value[i]>>4];result+=HEX[value[i]&15]}returnresult}if(typeofvalue==="object"&&typeofvalue.toJSON==="function"){returnstringify$1(value.toJSON())}switch(typeofvalue){case"boolean":case"symbol":returnvalue.toString();case"bigint":returnBigInt(value).toString();case"number":returnvalue.toString();case"string":returnJSON.stringify(value);case"object":{constkeys=Object.keys(value);keys.sort();return"{ "+keys.map(k=>`${stringify$1(k)}: ${stringify$1(value[k])}`).join(", ")+" }"}}return`[ COULD NOT SERIALIZE ]`}functionisError(error,code){returnerror&&error.code===code}functionisCallException(error){returnisError(error,"CALL_EXCEPTION")}functionmakeError(message,code,info){{constdetails=[];if(info){if("message"ininfo||"code"ininfo||"name"ininfo){thrownewError(`value will overwrite populated values: ${stringify$1(info)}`)}for(constkeyininfo){constvalue=info[key];details.push(key+"="+stringify$1(value))}}details.push(`code=${code}`);details.push(`version=${version}`);if(details.length){message+=" ("+details.join(", ")+")"}}leterror;switch(code){case"INVALID_ARGUMENT":error=newTypeError(message);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":error=newRangeError(message);break;default:error=newError(message)}defineProperties(error,{code:code});if(info){Object.assign(error,info)}returnerror}functionassert$1(check,message,code,info){if(!check){throwmakeError(message,code,info)}}functionassertArgument(check,message,name,value){assert$1(check,message,"INVALID_ARGUMENT",{argument:name,value:value})}functionassertArgumentCount(count,expectedCount,message){if(message==null){message=""}if(message){message=": "+message}assert$1(count>=expectedCount,"missing arguemnt"+message,"MISSING_ARGUMENT",{count:count,expectedCount:expectedCount});assert$1(count<=expectedCount,"too many arguemnts"+message,"UNEXPECTED_ARGUMENT",{count:count,expectedCount:expectedCount})}const_normalizeForms=["NFD","NFC","NFKD","NFKC"].reduce((accum,form)=>{try{if("test".normalize(form)!=="test"){thrownewError("bad")}if(form==="NFD"){constcheck=String.fromCharCode(233).normalize("NFD");constexpected=String.fromCharCode(101,769);if(check!==expected){thrownewError("broken")}}accum.push(form)}catch(error){}returnaccum},[]);functionassertNormalize(form){assert$1(_normalizeForms.indexOf(form)>=0,"platform missing String.prototype.normalize","UNSUPPORTED_OPERATION",{operation:"String.prototype.normalize",info:{form:form}})}functionassertPrivate(givenGuard,guard,className){if(className==null){classNa