functionnumber(n){if(!Number.isSafeInteger(n)||n<0)thrownewError(`Wrong positive integer: ${n}`)}functionbool(b){if(typeofb!=="boolean")thrownewError(`Expected boolean, not ${b}`)}functionbytes(b,...lengths){if(!(binstanceofUint8Array))thrownewTypeError("Expected Uint8Array");if(lengths.length>0&&!lengths.includes(b.length))thrownewTypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`)}functionhash(hash){if(typeofhash!=="function"||typeofhash.create!=="function")thrownewError("Hash should be wrapped by utils.wrapConstructor");number(hash.outputLen);number(hash.blockLen)}functionexists(instance,checkFinished=true){if(instance.destroyed)thrownewError("Hash instance has been destroyed");if(checkFinished&&instance.finished)thrownewError("Hash#digest() has already been called")}functionoutput(out,instance){bytes(out);constmin=instance.outputLen;if(out.length<min){thrownewError(`digestInto() expects output buffer of length at least ${min}`)}}constassert$1={number:number,bool:bool,bytes:bytes,hash:hash,exists:exists,output:output};constu32=arr=>newUint32Array(arr.buffer,arr.byteOffset,Math.floor(arr.byteLength/4));constisLE=newUint8Array(newUint32Array([287454020]).buffer)[0]===68;if(!isLE)thrownewError("Non little-endian hardware is not supported");Array.from({length:256},(v,i)=>i.toString(16).padStart(2,"0"));functionutf8ToBytes(str){if(typeofstr!=="string"){thrownewTypeError(`utf8ToBytes expected string, got ${typeofstr}`)}return(newTextEncoder).encode(str)}functiontoBytes(data){if(typeofdata==="string")data=utf8ToBytes(data);if(!(datainstanceofUint8Array))thrownewTypeError(`Expected input type is Uint8Array (got ${typeofdata})`);returndata}classHash{clone(){returnthis._cloneInto()}}functionwrapConstructor(hashConstructor){consthashC=message=>hashConstructor().update(toBytes(message)).digest();consttmp=hashConstructor();hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=()=>hashConstructor();returnhashC}functionwrapConstructorWithOpts(hashCons){consthashC=(msg,opts)=>hashCons(opts).update(toBytes(msg)).digest();consttmp=hashCons({});hashC.outputLen=tmp.outputLen;hashC.blockLen=tmp.blockLen;hashC.create=opts=>hashCons(opts);returnhashC}constU32_MASK64=BigInt(2**32-1);const_32n=BigInt(32);functionfromBig(n,le=false){if(le)return{h:Number(n&U32_MASK64),l:Number(n>>_32n&U32_MASK64)};return{h:Number(n>>_32n&U32_MASK64)|0,l:Number(n&U32_MASK64)|0}}functionsplit(lst,le=false){letAh=newUint32Array(lst.length);letAl=newUint32Array(lst.length);for(leti=0;i<lst.length;i++){const{h,l}=fromBig(lst[i],le);[Ah[i],Al[i]]=[h,l]}return[Ah,Al]}consttoBig=(h,l)=>BigInt(h>>>0)<<_32n|BigInt(l>>>0);constshrSH=(h,l,s)=>h>>>s;constshrSL=(h,l,s)=>h<<32-s|l>>>s;constrotrSH=(h,l,s)=>h>>>s|l<<32-s;constrotrSL=(h,l,s)=>h<<32-s|l>>>s;constrotrBH=(h,l,s)=>h<<64-s|l>>>s-32;constrotrBL=(h,l,s)=>h>>>s-32|l<<64-s;constrotr32H=(h,l)=>l;constrotr32L=(h,l)=>h;constrotlSH=(h,l,s)=>h<<s|l>>>32-s;constrotlSL=(h,l,s)=>l<<s|h>>>32-s;constrotlBH=(h,l,s)=>l<<s-32|h>>>64-s;constrotlBL=(h,l,s)=>h<<s-32|l>>>64-s;functionadd(Ah,Al,Bh,Bl){constl=(Al>>>0)+(Bl>>>0);return{h:Ah+Bh+(l/2**32|0)|0,l:l|0}}constadd3L=(Al,Bl,Cl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0);constadd3H=(low,Ah,Bh,Ch)=>Ah+Bh+Ch+(low/2**32|0)|0;constadd4L=(Al,Bl,Cl,Dl)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0);constadd4H=(low,Ah,Bh,Ch,Dh)=>Ah+Bh+Ch+Dh+(low/2**32|0)|0;constadd5L=(Al,Bl,Cl,Dl,El)=>(Al>>>0)+(Bl>>>0)+(Cl>>>0)+(Dl>>>0)+(El>>>0);constadd5H=(low,Ah,Bh,Ch,Dh,Eh)=>Ah+Bh+Ch+Dh+Eh+(low/2**32|0)|0;constu64={fromBig:fromBig,split:split,toBig:toBig,shrSH:shrSH,shrSL:shrSL,rotrSH:rotrSH,rotrSL:rotrSL,rotrBH:rotrBH,rotrBL:rotrBL,rotr32H:rotr32H,rotr32L:rotr32L,rotlSH:rotlSH,rotlSL:rotlSL,rotlBH:rotlBH,rotlBL:rotlBL,add:add,add3L:add3L,add3H:add3H,add4L:add4L,add4H:add4H,add5H:add5H,add5L:add5L};constversion="6.0.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"n