UNPKG

@libp2p/floodsub

Version:

libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).

2 lines • 135 kB
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PFloodsub = factory()}(typeof self !== 'undefined' ? self : this, function () { "use strict";var Libp2PFloodsub=(()=>{var ac=Object.create;var gr=Object.defineProperty;var uc=Object.getOwnPropertyDescriptor;var fc=Object.getOwnPropertyNames;var lc=Object.getPrototypeOf,hc=Object.prototype.hasOwnProperty;var dc=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),pt=(r,t)=>{for(var e in t)gr(r,e,{get:t[e],enumerable:!0})},ts=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fc(t))!hc.call(r,o)&&o!==e&&gr(r,o,{get:()=>t[o],enumerable:!(n=uc(t,o))||n.enumerable});return r};var pc=(r,t,e)=>(e=r!=null?ac(lc(r)):{},ts(t||!r||!r.__esModule?gr(e,"default",{value:r,enumerable:!0}):e,r)),mc=r=>ts(gr({},"__esModule",{value:!0}),r);var Ki=dc(($0,Ko)=>{"use strict";var gf=Object.prototype.hasOwnProperty,mt="~";function fr(){}Object.create&&(fr.prototype=Object.create(null),new fr().__proto__||(mt=!1));function yf(r,t,e){this.fn=r,this.context=t,this.once=e||!1}function Oi(r,t,e,n,o){if(typeof e!="function")throw new TypeError("The listener must be a function");var s=new yf(e,n||r,o),i=mt?mt+t:t;return r._events[i]?r._events[i].fn?r._events[i]=[r._events[i],s]:r._events[i].push(s):(r._events[i]=s,r._eventsCount++),r}function Xr(r,t){--r._eventsCount===0?r._events=new fr:delete r._events[t]}function ht(){this._events=new fr,this._eventsCount=0}ht.prototype.eventNames=function(){var t=[],e,n;if(this._eventsCount===0)return t;for(n in e=this._events)gf.call(e,n)&&t.push(mt?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};ht.prototype.listeners=function(t){var e=mt?mt+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,s=n.length,i=new Array(s);o<s;o++)i[o]=n[o].fn;return i};ht.prototype.listenerCount=function(t){var e=mt?mt+t:t,n=this._events[e];return n?n.fn?1:n.length:0};ht.prototype.emit=function(t,e,n,o,s,i){var c=mt?mt+t:t;if(!this._events[c])return!1;var a=this._events[c],f=arguments.length,u,l;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),f){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,e),!0;case 3:return a.fn.call(a.context,e,n),!0;case 4:return a.fn.call(a.context,e,n,o),!0;case 5:return a.fn.call(a.context,e,n,o,s),!0;case 6:return a.fn.call(a.context,e,n,o,s,i),!0}for(l=1,u=new Array(f-1);l<f;l++)u[l-1]=arguments[l];a.fn.apply(a.context,u)}else{var p=a.length,x;for(l=0;l<p;l++)switch(a[l].once&&this.removeListener(t,a[l].fn,void 0,!0),f){case 1:a[l].fn.call(a[l].context);break;case 2:a[l].fn.call(a[l].context,e);break;case 3:a[l].fn.call(a[l].context,e,n);break;case 4:a[l].fn.call(a[l].context,e,n,o);break;default:if(!u)for(x=1,u=new Array(f-1);x<f;x++)u[x-1]=arguments[x];a[l].fn.apply(a[l].context,u)}}return!0};ht.prototype.on=function(t,e,n){return Oi(this,t,e,n,!1)};ht.prototype.once=function(t,e,n){return Oi(this,t,e,n,!0)};ht.prototype.removeListener=function(t,e,n,o){var s=mt?mt+t:t;if(!this._events[s])return this;if(!e)return Xr(this,s),this;var i=this._events[s];if(i.fn)i.fn===e&&(!o||i.once)&&(!n||i.context===n)&&Xr(this,s);else{for(var c=0,a=[],f=i.length;c<f;c++)(i[c].fn!==e||o&&!i[c].once||n&&i[c].context!==n)&&a.push(i[c]);a.length?this._events[s]=a.length===1?a[0]:a:Xr(this,s)}return this};ht.prototype.removeAllListeners=function(t){var e;return t?(e=mt?mt+t:t,this._events[e]&&Xr(this,e)):(this._events=new fr,this._eventsCount=0),this};ht.prototype.off=ht.prototype.removeListener;ht.prototype.addListener=ht.prototype.on;ht.prefixed=mt;ht.EventEmitter=ht;typeof Ko<"u"&&(Ko.exports=ht)});var If={};pt(If,{floodsub:()=>Bf,multicodec:()=>Go});var dn=Symbol.for("@libp2p/peer-id");var He;(function(r){r.Accept="accept",r.Ignore="ignore",r.Reject="reject"})(He||(He={}));var es=Symbol.for("@libp2p/pubsub");var tt=class extends Error{static name="InvalidParametersError";constructor(t="Invalid parameters"){super(t),this.name="InvalidParametersError"}},Ee=class extends Error{static name="InvalidPublicKeyError";constructor(t="Invalid public key"){super(t),this.name="InvalidPublicKeyError"}};var yr=class extends Error{static name="InvalidMultihashError";constructor(t="Invalid Multihash"){super(t),this.name="InvalidMultihashError"}};var $=class extends Error{static name="InvalidMessageError";constructor(t="Invalid message"){super(t),this.name="InvalidMessageError"}};var xr=class extends Error{static name="NotStartedError";constructor(t="Not started"){super(t),this.name="NotStartedError"}};var se=class extends Error{static name="UnsupportedKeyTypeError";constructor(t="Unsupported key type"){super(t),this.name="UnsupportedKeyTypeError"}};var Se=class extends EventTarget{#t=new Map;constructor(){super()}listenerCount(t){let e=this.#t.get(t);return e==null?0:e.length}addEventListener(t,e,n){super.addEventListener(t,e,n);let o=this.#t.get(t);o==null&&(o=[],this.#t.set(t,o)),o.push({callback:e,once:(n!==!0&&n!==!1&&n?.once)??!1})}removeEventListener(t,e,n){super.removeEventListener(t.toString(),e??null,n);let o=this.#t.get(t);o!=null&&(o=o.filter(({callback:s})=>s!==e),this.#t.set(t,o))}dispatchEvent(t){let e=super.dispatchEvent(t),n=this.#t.get(t.type);return n==null||(n=n.filter(({once:o})=>!o),this.#t.set(t.type,n)),e}safeDispatchEvent(t,e={}){return this.dispatchEvent(new CustomEvent(t,e))}};var rs=Symbol.for("@libp2p/service-capabilities"),ns=Symbol.for("@libp2p/service-dependencies");var yn={};pt(yn,{base58btc:()=>j,base58flickr:()=>Ec});var tl=new Uint8Array(0);function os(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function Mt(r){if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")}function ss(r){return new TextEncoder().encode(r)}function is(r){return new TextDecoder().decode(r)}function bc(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var o=0;o<r.length;o++){var s=r.charAt(o),i=s.charCodeAt(0);if(e[i]!==255)throw new TypeError(s+" is ambiguous");e[i]=o}var c=r.length,a=r.charAt(0),f=Math.log(c)/Math.log(256),u=Math.log(256)/Math.log(c);function l(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var g=0,h=0,y=0,S=E.length;y!==S&&E[y]===0;)y++,g++;for(var m=(S-y)*u+1>>>0,B=new Uint8Array(m);y!==S;){for(var D=E[y],N=0,I=m-1;(D!==0||N<h)&&I!==-1;I--,N++)D+=256*B[I]>>>0,B[I]=D%c>>>0,D=D/c>>>0;if(D!==0)throw new Error("Non-zero carry");h=N,y++}for(var _=m-h;_!==m&&B[_]===0;)_++;for(var L=a.repeat(g);_<m;++_)L+=r.charAt(B[_]);return L}function p(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var g=0;if(E[g]!==" "){for(var h=0,y=0;E[g]===a;)h++,g++;for(var S=(E.length-g)*f+1>>>0,m=new Uint8Array(S);E[g];){var B=e[E.charCodeAt(g)];if(B===255)return;for(var D=0,N=S-1;(B!==0||D<y)&&N!==-1;N--,D++)B+=c*m[N]>>>0,m[N]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");y=D,g++}if(E[g]!==" "){for(var I=S-y;I!==S&&m[I]===0;)I++;for(var _=new Uint8Array(h+(S-I)),L=h;I!==S;)_[L++]=m[I++];return _}}}function x(E){var g=p(E);if(g)return g;throw new Error(`Non-${t} character`)}return{encode:l,decodeUnsafe:p,decode:x}}var gc=bc,yc=gc,as=yc;var pn=class{name;prefix;baseEncode;constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},mn=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,e,n){this.name=t,this.prefix=e;let o=e.codePointAt(0);if(o===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=o,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return us(this,t)}},bn=class{decoders;constructor(t){this.decoders=t}or(t){return us(this,t)}decode(t){let e=t[0],n=this.decoders[e];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function us(r,t){return new bn({...r.decoders??{[r.prefix]:r},...t.decoders??{[t.prefix]:t}})}var gn=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,e,n,o){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=o,this.encoder=new pn(t,e,n),this.decoder=new mn(t,e,o)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function ve({name:r,prefix:t,encode:e,decode:n}){return new gn(r,t,e,n)}function Zt({name:r,prefix:t,alphabet:e}){let{encode:n,decode:o}=as(e,r);return ve({prefix:t,name:r,encode:n,decode:s=>Mt(o(s))})}function xc(r,t,e,n){let o={};for(let u=0;u<t.length;++u)o[t[u]]=u;let s=r.length;for(;r[s-1]==="=";)--s;let i=new Uint8Array(s*e/8|0),c=0,a=0,f=0;for(let u=0;u<s;++u){let l=o[r[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<e|l,c+=e,c>=8&&(c-=8,i[f++]=255&a>>c)}if(c>=e||(255&a<<8-c)!==0)throw new SyntaxError("Unexpected end of data");return i}function wc(r,t,e){let n=t[t.length-1]==="=",o=(1<<e)-1,s="",i=0,c=0;for(let a=0;a<r.length;++a)for(c=c<<8|r[a],i+=8;i>e;)i-=e,s+=t[o&c>>i];if(i!==0&&(s+=t[o&c<<e-i]),n)for(;(s.length*e&7)!==0;)s+="=";return s}function X({name:r,prefix:t,bitsPerChar:e,alphabet:n}){return ve({prefix:t,name:r,encode(o){return wc(o,n,e)},decode(o){return xc(o,n,e,r)}})}var j=Zt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ec=Zt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xn={};pt(xn,{base32:()=>Ae,base32hex:()=>Bc,base32hexpad:()=>Lc,base32hexpadupper:()=>Tc,base32hexupper:()=>Ic,base32pad:()=>vc,base32padupper:()=>Ac,base32upper:()=>Sc,base32z:()=>_c});var Ae=X({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Sc=X({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),vc=X({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ac=X({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Bc=X({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Ic=X({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Lc=X({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Tc=X({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),_c=X({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var wn={};pt(wn,{base36:()=>ze,base36upper:()=>Dc});var ze=Zt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Dc=Zt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Nc=hs,fs=128,Rc=127,Uc=~Rc,Pc=Math.pow(2,31);function hs(r,t,e){t=t||[],e=e||0;for(var n=e;r>=Pc;)t[e++]=r&255|fs,r/=128;for(;r&Uc;)t[e++]=r&255|fs,r>>>=7;return t[e]=r|0,hs.bytes=e-n+1,t}var kc=En,Cc=128,ls=127;function En(r,n){var e=0,n=n||0,o=0,s=n,i,c=r.length;do{if(s>=c)throw En.bytes=0,new RangeError("Could not decode varint");i=r[s++],e+=o<28?(i&ls)<<o:(i&ls)*Math.pow(2,o),o+=7}while(i>=Cc);return En.bytes=s-n,e}var Mc=Math.pow(2,7),Oc=Math.pow(2,14),Kc=Math.pow(2,21),qc=Math.pow(2,28),Hc=Math.pow(2,35),zc=Math.pow(2,42),Vc=Math.pow(2,49),Fc=Math.pow(2,56),Gc=Math.pow(2,63),Zc=function(r){return r<Mc?1:r<Oc?2:r<Kc?3:r<qc?4:r<Hc?5:r<zc?6:r<Vc?7:r<Fc?8:r<Gc?9:10},Yc={encode:Nc,decode:kc,encodingLength:Zc},Wc=Yc,Ve=Wc;function Fe(r,t=0){return[Ve.decode(r,t),Ve.decode.bytes]}function Be(r,t,e=0){return Ve.encode(r,t,e),t}function Ie(r){return Ve.encodingLength(r)}function Lt(r,t){let e=t.byteLength,n=Ie(r),o=n+Ie(e),s=new Uint8Array(o+e);return Be(r,s,0),Be(e,s,n),s.set(t,o),new Le(r,e,t,s)}function Yt(r){let t=Mt(r),[e,n]=Fe(t),[o,s]=Fe(t.subarray(n)),i=t.subarray(n+s);if(i.byteLength!==o)throw new Error("Incorrect length");return new Le(e,o,i,t)}function ds(r,t){if(r===t)return!0;{let e=t;return r.code===e.code&&r.size===e.size&&e.bytes instanceof Uint8Array&&os(r.bytes,e.bytes)}}var Le=class{code;size;digest;bytes;constructor(t,e,n,o){this.code=t,this.size=e,this.digest=n,this.bytes=o}};function ps(r,t){let{bytes:e,version:n}=r;switch(n){case 0:return $c(e,Sn(r),t??j.encoder);default:return jc(e,Sn(r),t??Ae.encoder)}}var ms=new WeakMap;function Sn(r){let t=ms.get(r);if(t==null){let e=new Map;return ms.set(r,e),e}return t}var gt=class r{code;version;multihash;bytes;"/";constructor(t,e,n,o){this.code=e,this.version=t,this.multihash=n,this.bytes=o,this["/"]=o}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:e}=this;if(t!==Ge)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(e.code!==Jc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return r.createV0(e)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:e}=this.multihash,n=Lt(t,e);return r.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return r.equals(this,t)}static equals(t,e){let n=e;return n!=null&&t.code===n.code&&t.version===n.version&&ds(t.multihash,n.multihash)}toString(t){return ps(this,t)}toJSON(){return{"/":ps(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let e=t;if(e instanceof r)return e;if(e["/"]!=null&&e["/"]===e.bytes||e.asCID===e){let{version:n,code:o,multihash:s,bytes:i}=e;return new r(n,o,s,i??bs(n,o,s.bytes))}else if(e[Qc]===!0){let{version:n,multihash:o,code:s}=e,i=Yt(o);return r.create(n,s,i)}else return null}static create(t,e,n){if(typeof e!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(e!==Ge)throw new Error(`Version 0 CID must use dag-pb (code: ${Ge}) block encoding`);return new r(t,e,n,n.bytes)}case 1:{let o=bs(t,e,n.bytes);return new r(t,e,n,o)}default:throw new Error("Invalid version")}}static createV0(t){return r.create(0,Ge,t)}static createV1(t,e){return r.create(1,t,e)}static decode(t){let[e,n]=r.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return e}static decodeFirst(t){let e=r.inspectBytes(t),n=e.size-e.multihashSize,o=Mt(t.subarray(n,n+e.multihashSize));if(o.byteLength!==e.multihashSize)throw new Error("Incorrect length");let s=o.subarray(e.multihashSize-e.digestSize),i=new Le(e.multihashCode,e.digestSize,s,o);return[e.version===0?r.createV0(i):r.createV1(e.codec,i),t.subarray(e.size)]}static inspectBytes(t){let e=0,n=()=>{let[l,p]=Fe(t.subarray(e));return e+=p,l},o=n(),s=Ge;if(o===18?(o=0,e=0):s=n(),o!==0&&o!==1)throw new RangeError(`Invalid CID version ${o}`);let i=e,c=n(),a=n(),f=e+a,u=f-i;return{version:o,codec:s,multihashCode:c,digestSize:a,multihashSize:u,size:f}}static parse(t,e){let[n,o]=Xc(t,e),s=r.decode(o);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Sn(s).set(n,t),s}};function Xc(r,t){switch(r[0]){case"Q":{let e=t??j;return[j.prefix,e.decode(`${j.prefix}${r}`)]}case j.prefix:{let e=t??j;return[j.prefix,e.decode(r)]}case Ae.prefix:{let e=t??Ae;return[Ae.prefix,e.decode(r)]}case ze.prefix:{let e=t??ze;return[ze.prefix,e.decode(r)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[r[0],t.decode(r)]}}}function $c(r,t,e){let{prefix:n}=e;if(n!==j.prefix)throw Error(`Cannot string encode V0 in ${e.name} encoding`);let o=t.get(n);if(o==null){let s=e.encode(r).slice(1);return t.set(n,s),s}else return o}function jc(r,t,e){let{prefix:n}=e,o=t.get(n);if(o==null){let s=e.encode(r);return t.set(n,s),s}else return o}var Ge=112,Jc=18;function bs(r,t,e){let n=Ie(r),o=n+Ie(t),s=new Uint8Array(o+e.byteLength);return Be(r,s,0),Be(t,s,n),s.set(e,o),s}var Qc=Symbol.for("@ipld/js-cid/CID");var vn={};pt(vn,{identity:()=>Ot});var gs=0,ta="identity",ys=Mt;function ea(r){return Lt(gs,ys(r))}var Ot={code:gs,name:ta,encode:ys,digest:ea};function At(r,t){if(r===t)return!0;if(r.byteLength!==t.byteLength)return!1;for(let e=0;e<r.byteLength;e++)if(r[e]!==t[e])return!1;return!0}function xs(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function ra(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Te(r,...t){if(!ra(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function ws(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");xs(r.outputLen),xs(r.blockLen)}function _e(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Es(r,t){Te(r);let e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}var ie=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Er(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function Tt(r,t){return r<<32-t|r>>>t}function Ss(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function Ze(r){return typeof r=="string"&&(r=Ss(r)),Te(r),r}function An(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Te(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}var De=class{clone(){return this._cloneInto()}};function Sr(r){let t=n=>r().update(Ze(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Ne(r=32){if(ie&&typeof ie.getRandomValues=="function")return ie.getRandomValues(new Uint8Array(r));if(ie&&typeof ie.randomBytes=="function")return ie.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function na(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),i=Number(e>>o&s),c=Number(e&s),a=n?4:0,f=n?0:4;r.setUint32(t+a,i,n),r.setUint32(t+f,c,n)}function vs(r,t,e){return r&t^~r&e}function As(r,t,e){return r&t^r&e^t&e}var Re=class extends De{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Er(this.buffer)}update(t){_e(this);let{view:e,buffer:n,blockLen:o}=this;t=Ze(t);let s=t.length;for(let i=0;i<s;){let c=Math.min(o-this.pos,s-i);if(c===o){let a=Er(t);for(;o<=s-i;i+=o)this.process(a,i);continue}n.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){_e(this),Es(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;e[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>o-i&&(this.process(n,0),i=0);for(let l=i;l<o;l++)e[l]=0;na(n,o-8,BigInt(this.length*8),s),this.process(n,0);let c=Er(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=a/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)c.setUint32(4*l,u[l],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:i,pos:c}=this;return t.length=o,t.pos=c,t.finished=s,t.destroyed=i,o%e&&t.buffer.set(n),t}};var vr=BigInt(4294967295),Bn=BigInt(32);function Bs(r,t=!1){return t?{h:Number(r&vr),l:Number(r>>Bn&vr)}:{h:Number(r>>Bn&vr)|0,l:Number(r&vr)|0}}function oa(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:i}=Bs(r[o],t);[e[o],n[o]]=[s,i]}return[e,n]}var sa=(r,t)=>BigInt(r>>>0)<<Bn|BigInt(t>>>0),ia=(r,t,e)=>r>>>e,ca=(r,t,e)=>r<<32-e|t>>>e,aa=(r,t,e)=>r>>>e|t<<32-e,ua=(r,t,e)=>r<<32-e|t>>>e,fa=(r,t,e)=>r<<64-e|t>>>e-32,la=(r,t,e)=>r>>>e-32|t<<64-e,ha=(r,t)=>t,da=(r,t)=>r,pa=(r,t,e)=>r<<e|t>>>32-e,ma=(r,t,e)=>t<<e|r>>>32-e,ba=(r,t,e)=>t<<e-32|r>>>64-e,ga=(r,t,e)=>r<<e-32|t>>>64-e;function ya(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var xa=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),wa=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,Ea=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),Sa=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,va=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),Aa=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var Ba={fromBig:Bs,split:oa,toBig:sa,shrSH:ia,shrSL:ca,rotrSH:aa,rotrSL:ua,rotrBH:fa,rotrBL:la,rotr32H:ha,rotr32L:da,rotlSH:pa,rotlSL:ma,rotlBH:ba,rotlBL:ga,add:ya,add3L:xa,add3H:wa,add4L:Ea,add4H:Sa,add5H:Aa,add5L:va},k=Ba;var[Ia,La]=k.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),Xt=new Uint32Array(80),$t=new Uint32Array(80),In=class extends Re{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:i,Dh:c,Dl:a,Eh:f,El:u,Fh:l,Fl:p,Gh:x,Gl:E,Hh:g,Hl:h}=this;return[t,e,n,o,s,i,c,a,f,u,l,p,x,E,g,h]}set(t,e,n,o,s,i,c,a,f,u,l,p,x,E,g,h){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=a|0,this.Eh=f|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=x|0,this.Gl=E|0,this.Hh=g|0,this.Hl=h|0}process(t,e){for(let m=0;m<16;m++,e+=4)Xt[m]=t.getUint32(e),$t[m]=t.getUint32(e+=4);for(let m=16;m<80;m++){let B=Xt[m-15]|0,D=$t[m-15]|0,N=k.rotrSH(B,D,1)^k.rotrSH(B,D,8)^k.shrSH(B,D,7),I=k.rotrSL(B,D,1)^k.rotrSL(B,D,8)^k.shrSL(B,D,7),_=Xt[m-2]|0,L=$t[m-2]|0,F=k.rotrSH(_,L,19)^k.rotrBH(_,L,61)^k.shrSH(_,L,6),K=k.rotrSL(_,L,19)^k.rotrBL(_,L,61)^k.shrSL(_,L,6),M=k.add4L(I,K,$t[m-7],$t[m-16]),Q=k.add4H(M,N,F,Xt[m-7],Xt[m-16]);Xt[m]=Q|0,$t[m]=M|0}let{Ah:n,Al:o,Bh:s,Bl:i,Ch:c,Cl:a,Dh:f,Dl:u,Eh:l,El:p,Fh:x,Fl:E,Gh:g,Gl:h,Hh:y,Hl:S}=this;for(let m=0;m<80;m++){let B=k.rotrSH(l,p,14)^k.rotrSH(l,p,18)^k.rotrBH(l,p,41),D=k.rotrSL(l,p,14)^k.rotrSL(l,p,18)^k.rotrBL(l,p,41),N=l&x^~l&g,I=p&E^~p&h,_=k.add5L(S,D,I,La[m],$t[m]),L=k.add5H(_,y,B,N,Ia[m],Xt[m]),F=_|0,K=k.rotrSH(n,o,28)^k.rotrBH(n,o,34)^k.rotrBH(n,o,39),M=k.rotrSL(n,o,28)^k.rotrBL(n,o,34)^k.rotrBL(n,o,39),Q=n&s^n&c^s&c,v=o&i^o&a^i&a;y=g|0,S=h|0,g=x|0,h=E|0,x=l|0,E=p|0,{h:l,l:p}=k.add(f|0,u|0,L|0,F|0),f=c|0,u=a|0,c=s|0,a=i|0,s=n|0,i=o|0;let T=k.add3L(F,M,v);n=k.add3H(T,L,K,Q),o=T|0}({h:n,l:o}=k.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:i}=k.add(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:a}=k.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:f,l:u}=k.add(this.Dh|0,this.Dl|0,f|0,u|0),{h:l,l:p}=k.add(this.Eh|0,this.El|0,l|0,p|0),{h:x,l:E}=k.add(this.Fh|0,this.Fl|0,x|0,E|0),{h:g,l:h}=k.add(this.Gh|0,this.Gl|0,g|0,h|0),{h:y,l:S}=k.add(this.Hh|0,this.Hl|0,y|0,S|0),this.set(n,o,s,i,c,a,f,u,l,p,x,E,g,h,y,S)}roundClean(){Xt.fill(0),$t.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Is=Sr(()=>new In);var Ir={};pt(Ir,{aInRange:()=>yt,abool:()=>_t,abytes:()=>Ue,bitGet:()=>Ua,bitLen:()=>Dn,bitMask:()=>We,bitSet:()=>Pa,bytesToHex:()=>qt,bytesToNumberBE:()=>Ht,bytesToNumberLE:()=>Jt,concatBytes:()=>zt,createHmacDrbg:()=>Nn,ensureBytes:()=>Y,equalBytes:()=>Na,hexToBytes:()=>ae,hexToNumber:()=>_n,inRange:()=>Ye,isBytes:()=>jt,memoized:()=>fe,notImplemented:()=>Ca,numberToBytesBE:()=>Qt,numberToBytesLE:()=>ue,numberToHexUnpadded:()=>ce,numberToVarBytesBE:()=>Da,utf8ToBytes:()=>Ra,validateObject:()=>Pt});var Ar=BigInt(0),Br=BigInt(1),Ta=BigInt(2);function jt(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Ue(r){if(!jt(r))throw new Error("Uint8Array expected")}function _t(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}var _a=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function qt(r){Ue(r);let t="";for(let e=0;e<r.length;e++)t+=_a[r[e]];return t}function ce(r){let t=r.toString(16);return t.length&1?"0"+t:t}function _n(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?Ar:BigInt("0x"+r)}var Kt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ls(r){if(r>=Kt._0&&r<=Kt._9)return r-Kt._0;if(r>=Kt.A&&r<=Kt.F)return r-(Kt.A-10);if(r>=Kt.a&&r<=Kt.f)return r-(Kt.a-10)}function ae(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(e);for(let o=0,s=0;o<e;o++,s+=2){let i=Ls(r.charCodeAt(s)),c=Ls(r.charCodeAt(s+1));if(i===void 0||c===void 0){let a=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[o]=i*16+c}return n}function Ht(r){return _n(qt(r))}function Jt(r){return Ue(r),_n(qt(Uint8Array.from(r).reverse()))}function Qt(r,t){return ae(r.toString(16).padStart(t*2,"0"))}function ue(r,t){return Qt(r,t).reverse()}function Da(r){return ae(ce(r))}function Y(r,t,e){let n;if(typeof t=="string")try{n=ae(t)}catch(s){throw new Error(r+" must be hex string or Uint8Array, cause: "+s)}else if(jt(t))n=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(r+" of length "+e+" expected, got "+o);return n}function zt(...r){let t=0;for(let n=0;n<r.length;n++){let o=r[n];Ue(o),t+=o.length}let e=new Uint8Array(t);for(let n=0,o=0;n<r.length;n++){let s=r[n];e.set(s,o),o+=s.length}return e}function Na(r,t){if(r.length!==t.length)return!1;let e=0;for(let n=0;n<r.length;n++)e|=r[n]^t[n];return e===0}function Ra(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}var Ln=r=>typeof r=="bigint"&&Ar<=r;function Ye(r,t,e){return Ln(r)&&Ln(t)&&Ln(e)&&t<=r&&r<e}function yt(r,t,e,n){if(!Ye(t,e,n))throw new Error("expected valid "+r+": "+e+" <= n < "+n+", got "+t)}function Dn(r){let t;for(t=0;r>Ar;r>>=Br,t+=1);return t}function Ua(r,t){return r>>BigInt(t)&Br}function Pa(r,t,e){return r|(e?Br:Ar)<<BigInt(t)}var We=r=>(Ta<<BigInt(r-1))-Br,Tn=r=>new Uint8Array(r),Ts=r=>Uint8Array.from(r);function Nn(r,t,e){if(typeof r!="number"||r<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 e!="function")throw new Error("hmacFn must be a function");let n=Tn(r),o=Tn(r),s=0,i=()=>{n.fill(1),o.fill(0),s=0},c=(...l)=>e(o,n,...l),a=(l=Tn())=>{o=c(Ts([0]),l),n=c(),l.length!==0&&(o=c(Ts([1]),l),n=c())},f=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,p=[];for(;l<t;){n=c();let x=n.slice();p.push(x),l+=n.length}return zt(...p)};return(l,p)=>{i(),a(l);let x;for(;!(x=p(f()));)a();return i(),x}}var ka={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||jt(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Pt(r,t,e={}){let n=(o,s,i)=>{let c=ka[s];if(typeof c!="function")throw new Error("invalid validator function");let a=r[o];if(!(i&&a===void 0)&&!c(a,r))throw new Error("param "+String(o)+" is invalid. Expected "+s+", got "+a)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var Ca=()=>{throw new Error("not implemented")};function fe(r){let t=new WeakMap;return(e,...n)=>{let o=t.get(e);if(o!==void 0)return o;let s=r(e,...n);return t.set(e,s),s}}var et=BigInt(0),G=BigInt(1),le=BigInt(2),Ma=BigInt(3),Rn=BigInt(4),_s=BigInt(5),Ds=BigInt(8),Oa=BigInt(9),Ka=BigInt(16);function z(r,t){let e=r%t;return e>=et?e:t+e}function qa(r,t,e){if(t<et)throw new Error("invalid exponent, negatives unsupported");if(e<=et)throw new Error("invalid modulus");if(e===G)return et;let n=G;for(;t>et;)t&G&&(n=n*r%e),r=r*r%e,t>>=G;return n}function Z(r,t,e){let n=r;for(;t-- >et;)n*=n,n%=e;return n}function Lr(r,t){if(r===et)throw new Error("invert: expected non-zero number");if(t<=et)throw new Error("invert: expected positive modulus, got "+t);let e=z(r,t),n=t,o=et,s=G,i=G,c=et;for(;e!==et;){let f=n/e,u=n%e,l=o-i*f,p=s-c*f;n=e,e=u,o=i,s=c,i=l,c=p}if(n!==G)throw new Error("invert: does not exist");return z(o,t)}function Ha(r){let t=(r-G)/le,e,n,o;for(e=r-G,n=0;e%le===et;e/=le,n++);for(o=le;o<r&&qa(o,t,r)!==r-G;o++)if(o>1e3)throw new Error("Cannot find square root: likely non-prime P");if(n===1){let i=(r+G)/Rn;return function(a,f){let u=a.pow(f,i);if(!a.eql(a.sqr(u),f))throw new Error("Cannot find square root");return u}}let s=(e+G)/le;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let f=n,u=c.pow(c.mul(c.ONE,o),e),l=c.pow(a,s),p=c.pow(a,e);for(;!c.eql(p,c.ONE);){if(c.eql(p,c.ZERO))return c.ZERO;let x=1;for(let g=c.sqr(p);x<f&&!c.eql(g,c.ONE);x++)g=c.sqr(g);let E=c.pow(u,G<<BigInt(f-x-1));u=c.sqr(E),l=c.mul(l,E),p=c.mul(p,u),f=x}return l}}function za(r){if(r%Rn===Ma){let t=(r+G)/Rn;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Ds===_s){let t=(r-_s)/Ds;return function(n,o){let s=n.mul(o,le),i=n.pow(s,t),c=n.mul(o,i),a=n.mul(n.mul(c,le),i),f=n.mul(c,n.sub(a,n.ONE));if(!n.eql(n.sqr(f),o))throw new Error("Cannot find square root");return f}}return r%Ka,Ha(r)}var Ns=(r,t)=>(z(r,t)&G)===G,Va=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Un(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Va.reduce((n,o)=>(n[o]="function",n),t);return Pt(r,e)}function Fa(r,t,e){if(e<et)throw new Error("invalid exponent, negatives unsupported");if(e===et)return r.ONE;if(e===G)return t;let n=r.ONE,o=t;for(;e>et;)e&G&&(n=r.mul(n,o)),o=r.sqr(o),e>>=G;return n}function Ga(r,t){let e=new Array(t.length),n=t.reduce((s,i,c)=>r.is0(i)?s:(e[c]=s,r.mul(s,i)),r.ONE),o=r.inv(n);return t.reduceRight((s,i,c)=>r.is0(i)?s:(e[c]=r.mul(s,e[c]),r.mul(s,i)),o),e}function Pn(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function te(r,t,e=!1,n={}){if(r<=et)throw new Error("invalid field: expected ORDER > 0, got "+r);let{nBitLength:o,nByteLength:s}=Pn(r,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let i,c=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:s,MASK:We(o),ZERO:et,ONE:G,create:a=>z(a,r),isValid:a=>{if(typeof a!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof a);return et<=a&&a<r},is0:a=>a===et,isOdd:a=>(a&G)===G,neg:a=>z(-a,r),eql:(a,f)=>a===f,sqr:a=>z(a*a,r),add:(a,f)=>z(a+f,r),sub:(a,f)=>z(a-f,r),mul:(a,f)=>z(a*f,r),pow:(a,f)=>Fa(c,a,f),div:(a,f)=>z(a*Lr(f,r),r),sqrN:a=>a*a,addN:(a,f)=>a+f,subN:(a,f)=>a-f,mulN:(a,f)=>a*f,inv:a=>Lr(a,r),sqrt:n.sqrt||(a=>(i||(i=za(r)),i(c,a))),invertBatch:a=>Ga(c,a),cmov:(a,f,u)=>u?f:a,toBytes:a=>e?ue(a,s):Qt(a,s),fromBytes:a=>{if(a.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+a.length);return e?Jt(a):Ht(a)}});return Object.freeze(c)}function Rs(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function kn(r){let t=Rs(r);return t+Math.ceil(t/2)}function Us(r,t,e=!1){let n=r.length,o=Rs(t),s=kn(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);let i=e?Jt(r):Ht(r),c=z(i,t-G)+G;return e?ue(c,o):Qt(c,o)}var Ps=BigInt(0),Tr=BigInt(1);function Cn(r,t){let e=t.negate();return r?e:t}function ks(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function Mn(r,t){ks(r,t);let e=Math.ceil(t/r)+1,n=2**(r-1);return{windows:e,windowSize:n}}function Za(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function Ya(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}var On=new WeakMap,Cs=new WeakMap;function Kn(r){return Cs.get(r)||1}function _r(r,t){return{constTimeNegate:Cn,hasPrecomputes(e){return Kn(e)!==1},unsafeLadder(e,n,o=r.ZERO){let s=e;for(;n>Ps;)n&Tr&&(o=o.add(s)),s=s.double(),n>>=Tr;return o},precomputeWindow(e,n){let{windows:o,windowSize:s}=Mn(n,t),i=[],c=e,a=c;for(let f=0;f<o;f++){a=c,i.push(a);for(let u=1;u<s;u++)a=a.add(c),i.push(a);c=a.double()}return i},wNAF(e,n,o){let{windows:s,windowSize:i}=Mn(e,t),c=r.ZERO,a=r.BASE,f=BigInt(2**e-1),u=2**e,l=BigInt(e);for(let p=0;p<s;p++){let x=p*i,E=Number(o&f);o>>=l,E>i&&(E-=u,o+=Tr);let g=x,h=x+Math.abs(E)-1,y=p%2!==0,S=E<0;E===0?a=a.add(Cn(y,n[g])):c=c.add(Cn(S,n[h]))}return{p:c,f:a}},wNAFUnsafe(e,n,o,s=r.ZERO){let{windows:i,windowSize:c}=Mn(e,t),a=BigInt(2**e-1),f=2**e,u=BigInt(e);for(let l=0;l<i;l++){let p=l*c;if(o===Ps)break;let x=Number(o&a);if(o>>=u,x>c&&(x-=f,o+=Tr),x===0)continue;let E=n[p+Math.abs(x)-1];x<0&&(E=E.negate()),s=s.add(E)}return s},getPrecomputes(e,n,o){let s=On.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&On.set(n,o(s))),s},wNAFCached(e,n,o){let s=Kn(e);return this.wNAF(s,this.getPrecomputes(s,e,o),n)},wNAFCachedUnsafe(e,n,o,s){let i=Kn(e);return i===1?this.unsafeLadder(e,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,e,o),n,s)},setWindowSize(e,n){ks(n,t),Cs.set(e,n),On.delete(e)}}}function Dr(r,t,e,n){if(Za(e,r),Ya(n,t),e.length!==n.length)throw new Error("arrays of points and scalars must have equal length");let o=r.ZERO,s=Dn(BigInt(e.length)),i=s>12?s-3:s>4?s-2:s?2:1,c=(1<<i)-1,a=new Array(c+1).fill(o),f=Math.floor((t.BITS-1)/i)*i,u=o;for(let l=f;l>=0;l-=i){a.fill(o);for(let x=0;x<n.length;x++){let E=n[x],g=Number(E>>BigInt(l)&BigInt(c));a[g]=a[g].add(e[x])}let p=o;for(let x=a.length-1,E=o;x>0;x--)E=E.add(a[x]),p=p.add(E);if(u=u.add(p),l!==0)for(let x=0;x<i;x++)u=u.double()}return u}function Xe(r){return Un(r.Fp),Pt(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Pn(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var Dt=BigInt(0),xt=BigInt(1),Nr=BigInt(2),Wa=BigInt(8),Xa={zip215:!0};function $a(r){let t=Xe(r);return Pt(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Ms(r){let t=$a(r),{Fp:e,n,prehash:o,hash:s,randomBytes:i,nByteLength:c,h:a}=t,f=Nr<<BigInt(c*8)-xt,u=e.create,l=te(t.n,t.nBitLength),p=t.uvRatio||((b,d)=>{try{return{isValid:!0,value:e.sqrt(b*e.inv(d))}}catch{return{isValid:!1,value:Dt}}}),x=t.adjustScalarBytes||(b=>b),E=t.domain||((b,d,w)=>{if(_t("phflag",w),d.length||w)throw new Error("Contexts/pre-hash are not supported");return b});function g(b,d){yt("coordinate "+b,d,Dt,f)}function h(b){if(!(b instanceof m))throw new Error("ExtendedPoint expected")}let y=fe((b,d)=>{let{ex:w,ey:A,ez:R}=b,U=b.is0();d==null&&(d=U?Wa:e.inv(R));let C=u(w*d),O=u(A*d),P=u(R*d);if(U)return{x:Dt,y:xt};if(P!==xt)throw new Error("invZ was invalid");return{x:C,y:O}}),S=fe(b=>{let{a:d,d:w}=t;if(b.is0())throw new Error("bad point: ZERO");let{ex:A,ey:R,ez:U,et:C}=b,O=u(A*A),P=u(R*R),H=u(U*U),V=u(H*H),nt=u(O*d),ot=u(H*u(nt+P)),it=u(V+u(w*u(O*P)));if(ot!==it)throw new Error("bad point: equation left != right (1)");let at=u(A*R),bt=u(U*C);if(at!==bt)throw new Error("bad point: equation left != right (2)");return!0});class m{constructor(d,w,A,R){this.ex=d,this.ey=w,this.ez=A,this.et=R,g("x",d),g("y",w),g("z",A),g("t",R),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(d){if(d instanceof m)throw new Error("extended point not allowed");let{x:w,y:A}=d||{};return g("x",w),g("y",A),new m(w,A,xt,u(w*A))}static normalizeZ(d){let w=e.invertBatch(d.map(A=>A.ez));return d.map((A,R)=>A.toAffine(w[R])).map(m.fromAffine)}static msm(d,w){return Dr(m,l,d,w)}_setWindowSize(d){N.setWindowSize(this,d)}assertValidity(){S(this)}equals(d){h(d);let{ex:w,ey:A,ez:R}=this,{ex:U,ey:C,ez:O}=d,P=u(w*O),H=u(U*R),V=u(A*O),nt=u(C*R);return P===H&&V===nt}is0(){return this.equals(m.ZERO)}negate(){return new m(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:d}=t,{ex:w,ey:A,ez:R}=this,U=u(w*w),C=u(A*A),O=u(Nr*u(R*R)),P=u(d*U),H=w+A,V=u(u(H*H)-U-C),nt=P+C,ot=nt-O,it=P-C,at=u(V*ot),bt=u(nt*it),dt=u(V*it),Ut=u(ot*nt);return new m(at,bt,Ut,dt)}add(d){h(d);let{a:w,d:A}=t,{ex:R,ey:U,ez:C,et:O}=this,{ex:P,ey:H,ez:V,et:nt}=d;if(w===BigInt(-1)){let Yo=u((U-R)*(H+P)),Wo=u((U+R)*(H-P)),hn=u(Wo-Yo);if(hn===Dt)return this.double();let Xo=u(C*Nr*nt),$o=u(O*Nr*V),jo=$o+Xo,Jo=Wo+Yo,Qo=$o-Xo,oc=u(jo*hn),sc=u(Jo*Qo),ic=u(jo*Qo),cc=u(hn*Jo);return new m(oc,sc,cc,ic)}let ot=u(R*P),it=u(U*H),at=u(O*A*nt),bt=u(C*V),dt=u((R+U)*(P+H)-ot-it),Ut=bt-at,Ct=bt+at,qe=u(it-w*ot),tc=u(dt*Ut),ec=u(Ct*qe),rc=u(dt*qe),nc=u(Ut*Ct);return new m(tc,ec,nc,rc)}subtract(d){return this.add(d.negate())}wNAF(d){return N.wNAFCached(this,d,m.normalizeZ)}multiply(d){let w=d;yt("scalar",w,xt,n);let{p:A,f:R}=this.wNAF(w);return m.normalizeZ([A,R])[0]}multiplyUnsafe(d,w=m.ZERO){let A=d;return yt("scalar",A,Dt,n),A===Dt?D:this.is0()||A===xt?this:N.wNAFCachedUnsafe(this,A,m.normalizeZ,w)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return N.unsafeLadder(this,n).is0()}toAffine(d){return y(this,d)}clearCofactor(){let{h:d}=t;return d===xt?this:this.multiplyUnsafe(d)}static fromHex(d,w=!1){let{d:A,a:R}=t,U=e.BYTES;d=Y("pointHex",d,U),_t("zip215",w);let C=d.slice(),O=d[U-1];C[U-1]=O&-129;let P=Jt(C),H=w?f:e.ORDER;yt("pointHex.y",P,Dt,H);let V=u(P*P),nt=u(V-xt),ot=u(A*V-R),{isValid:it,value:at}=p(nt,ot);if(!it)throw new Error("Point.fromHex: invalid y coordinate");let bt=(at&xt)===xt,dt=(O&128)!==0;if(!w&&at===Dt&&dt)throw new Error("Point.fromHex: x=0 and x_0=1");return dt!==bt&&(at=u(-at)),m.fromAffine({x:at,y:P})}static fromPrivateKey(d){return L(d).point}toRawBytes(){let{x:d,y:w}=this.toAffine(),A=ue(w,e.BYTES);return A[A.length-1]|=d&xt?128:0,A}toHex(){return qt(this.toRawBytes())}}m.BASE=new m(t.Gx,t.Gy,xt,u(t.Gx*t.Gy)),m.ZERO=new m(Dt,xt,xt,Dt);let{BASE:B,ZERO:D}=m,N=_r(m,c*8);function I(b){return z(b,n)}function _(b){return I(Jt(b))}function L(b){let d=e.BYTES;b=Y("private key",b,d);let w=Y("hashed private key",s(b),2*d),A=x(w.slice(0,d)),R=w.slice(d,2*d),U=_(A),C=B.multiply(U),O=C.toRawBytes();return{head:A,prefix:R,scalar:U,point:C,pointBytes:O}}function F(b){return L(b).pointBytes}function K(b=new Uint8Array,...d){let w=zt(...d);return _(s(E(w,Y("context",b),!!o)))}function M(b,d,w={}){b=Y("message",b),o&&(b=o(b));let{prefix:A,scalar:R,pointBytes:U}=L(d),C=K(w.context,A,b),O=B.multiply(C).toRawBytes(),P=K(w.context,O,U,b),H=I(C+P*R);yt("signature.s",H,Dt,n);let V=zt(O,ue(H,e.BYTES));return Y("result",V,e.BYTES*2)}let Q=Xa;function v(b,d,w,A=Q){let{context:R,zip215:U}=A,C=e.BYTES;b=Y("signature",b,2*C),d=Y("message",d),w=Y("publicKey",w,C),U!==void 0&&_t("zip215",U),o&&(d=o(d));let O=Jt(b.slice(C,2*C)),P,H,V;try{P=m.fromHex(w,U),H=m.fromHex(b.slice(0,C),U),V=B.multiplyUnsafe(O)}catch{return!1}if(!U&&P.isSmallOrder())return!1;let nt=K(R,H.toRawBytes(),P.toRawBytes(),d);return H.add(P.multiplyUnsafe(nt)).subtract(V).clearCofactor().equals(m.ZERO)}return B._setWindowSize(8),{CURVE:t,getPublicKey:F,sign:M,verify:v,ExtendedPoint:m,utils:{getExtendedPublicKey:L,randomPrivateKey:()=>i(e.BYTES),precompute(b=8,d=m.BASE){return d._setWindowSize(b),d.multiply(BigInt(3)),d}}}}var qn=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Os=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Zl=BigInt(0),ja=BigInt(1),Ks=BigInt(2),Yl=BigInt(3),Ja=BigInt(5),Qa=BigInt(8);function tu(r){let t=BigInt(10),e=BigInt(20),n=BigInt(40),o=BigInt(80),s=qn,c=r*r%s*r%s,a=Z(c,Ks,s)*c%s,f=Z(a,ja,s)*r%s,u=Z(f,Ja,s)*f%s,l=Z(u,t,s)*u%s,p=Z(l,e,s)*l%s,x=Z(p,n,s)*p%s,E=Z(x,o,s)*x%s,g=Z(E,o,s)*x%s,h=Z(g,t,s)*u%s;return{pow_p_5_8:Z(h,Ks,s)*r%s,b2:c}}function eu(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function ru(r,t){let e=qn,n=z(t*t*t,e),o=z(n*n*t,e),s=tu(r*o).pow_p_5_8,i=z(r*n*s,e),c=z(t*i*i,e),a=i,f=z(i*Os,e),u=c===r,l=c===z(-r,e),p=c===z(-r*Os,e);return u&&(i=a),(l||p)&&(i=f),Ns(i,e)&&(i=z(-i,e)),{isValid:u||l,value:i}}var nu=te(qn,void 0,!0),ou={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:nu,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Qa,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Is,randomBytes:Ne,adjustScalarBytes:eu,uvRatio:ru},qs=Ms(ou);var Rr=32;function Hs(r,t,e){return qs.verify(t,e instanceof Uint8Array?e:e.subarray(),r)}var Ur=class{type="Ed25519";raw;constructor(t){this.raw=Hn(t,Rr)}toMultihash(){return Ot.digest(he(this))}toCID(){return gt.createV1(114,this.toMultihash())}toString(){return j.encode(this.toMultihash().bytes).substring(1)}equals(t){return t==null||!(t.raw instanceof Uint8Array)?!1:At(this.raw,t.raw)}verify(t,e){return Hs(this.raw,e,t)}};function zn(r){return r=Hn(r,Rr),new Ur(r)}function Hn(r,t){if(r=Uint8Array.from(r??[]),r.length!==t)throw new tt(`Key must be a Uint8Array of length ${t}, got ${r.length}`);return r}function Vt(r=0){return new Uint8Array(r)}function ut(r=0){return new Uint8Array(r)}var iu=Math.pow(2,7),cu=Math.pow(2,14),au=Math.pow(2,21),Vn=Math.pow(2,28),Fn=Math.pow(2,35),Gn=Math.pow(2,42),Zn=Math.pow(2,49),q=128,ft=127;function Nt(r){if(r<iu)return 1;if(r<cu)return 2;if(r<au)return 3;if(r<Vn)return 4;if(r<Fn)return 5;if(r<Gn)return 6;if(r<Zn)return 7;if(Number.MAX_SAFE_INTEGER!=null&&r>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Yn(r,t,e=0){switch(Nt(r)){case 8:t[e++]=r&255|q,r/=128;case 7:t[e++]=r&255|q,r/=128;case 6:t[e++]=r&255|q,r/=128;case 5:t[e++]=r&255|q,r/=128;case 4:t[e++]=r&255|q,r>>>=7;case 3:t[e++]=r&255|q,r>>>=7;case 2:t[e++]=r&255|q,r>>>=7;case 1:{t[e++]=r&255,r>>>=7;break}default:throw new Error("unreachable")}return t}function uu(r,t,e=0){switch(Nt(r)){case 8:t.set(e++,r&255|q),r/=128;case 7:t.set(e++,r&255|q),r/=128;case 6:t.set(e++,r&255|q),r/=128;case 5:t.set(e++,r&255|q),r/=128;case 4:t.set(e++,r&255|q),r>>>=7;case 3:t.set(e++,r&255|q),r>>>=7;case 2:t.set(e++,r&255|q),r>>>=7;case 1:{t.set(e++,r&255),r>>>=7;break}default:throw new Error("unreachable")}return t}function Wn(r,t){let e=r[t],n=0;if(n+=e&ft,e<q||(e=r[t+1],n+=(e&ft)<<7,e<q)||(e=r[t+2],n+=(e&ft)<<14,e<q)||(e=r[t+3],n+=(e&ft)<<21,e<q)||(e=r[t+4],n+=(e&ft)*Vn,e<q)||(e=r[t+5],n+=(e&ft)*Fn,e<q)||(e=r[t+6],n+=(e&ft)*Gn,e<q)||(e=r[t+7],n+=(e&ft)*Zn,e<q))return n;throw new RangeError("Could not decode varint")}function fu(r,t){let e=r.get(t),n=0;if(n+=e&ft,e<q||(e=r.get(t+1),n+=(e&ft)<<7,e<q)||(e=r.get(t+2),n+=(e&ft)<<14,e<q)||(e=r.get(t+3),n+=(e&ft)<<21,e<q)||(e=r.get(t+4),n+=(e&ft)*Vn,e<q)||(e=r.get(t+5),n+=(e&ft)*Fn,e<q)||(e=r.get(t+6),n+=(e&ft)*Gn,e<q)||(e=r.get(t+7),n+=(e&ft)*Zn,e<q))return n;throw new RangeError("Could not decode varint")}function Vs(r,t,e=0){return t==null&&(t=ut(Nt(r))),t instanceof Uint8Array?Yn(r,t,e):uu(r,t,e)}function Fs(r,t=0){return r instanceof Uint8Array?Wn(r,t):fu(r,t)}var Xn=new Float32Array([-0]),ee=new Uint8Array(Xn.buffer);function Zs(r,t,e){Xn[0]=r,t[e]=ee[0],t[e+1]=ee[1],t[e+2]=ee[2],t[e+3]=ee[3]}function Ys(r,t){return ee[0]=r[t],ee[1]=r[t+1],ee[2]=r[t+2],ee[3]=r[t+3],Xn[0]}var $n=new Float64Array([-0]),lt=new Uint8Array($n.buffer);function Ws(r,t,e){$n[0]=r,t[e]=lt[0],t[e+1]=lt[1],t[e+2]=lt[2],t[e+3]=lt[3],t[e+4]=lt[4],t[e+5]=lt[5],t[e+6]=lt[6],t[e+7]=lt[7]}function Xs(r,t){return lt[0]=r[t],lt[1]=r[t+1],lt[2]=r[t+2],lt[3]=r[t+3],lt[4]=r[t+4],lt[5]=r[t+5],lt[6]=r[t+6],lt[7]=r[t+7],$n[0]}var lu=BigInt(Number.MAX_SAFE_INTEGER),hu=BigInt(Number.MIN_SAFE_INTEGER),vt=class r{lo;hi;constructor(t,e){this.lo=t|0,this.hi=e|0}toNumber(t=!1){if(!t&&this.hi>>>31>0){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(t=!1){if(t)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let e=~this.lo+1>>>0,n=~this.hi>>>0;return e===0&&(n=n+1>>>0),-(BigInt(e)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(t=!1){return this.toBigInt(t).toString()}zzEncode(){let t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this}zzDecode(){let t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this}length(){let t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}static fromBigInt(t){if(t===0n)return de;if(t<lu&&t>hu)return this.fromNumber(Number(t));let e=t<0n;e&&(t=-t);let n=t>>32n,o=t-(n<<32n);return e&&(n=~n|0n,o=~o|0n,++o>$s&&(o=0n,++n>$s&&(n=0n))),new r(Number(o),Number(n))}static fromNumber(t){if(t===0)return de;let e=t<0;e&&(t=-t);let n=t>>>0,o=(t-n)/4294967296>>>0;return e&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new r(n,o)}static from(t){return typeof t=="number"?r.fromNumber(t):typeof t=="bigint"?r.fromBigInt(t):typeof t=="string"?r.fromBigInt(BigInt(t)):t.low!=null||t.high!=null?new r(t.low>>>0,t.high>>>0):de}},de=new vt(0,0);de.toBigInt=function(){return 0n};de.zzEncode=de.zzDecode=function(){return this};de.length=function(){return 1};var $s=4294967296n;function js(r){let t=0,e=0;for(let n=0;n<r.length;++n)e=r.charCodeAt(n),e<128?t+=1:e<2048?t+=2:(e&64512)===55296&&(r.charCodeAt(n+1)&64512)===56320?(++n,t+=4):t+=3;return t}function Js(r,t,e){if(e-t<1)return"";let o,s=[],i=0,c;for(;t<e;)c=r[t++],c<128?s[i++]=c:c>191&&c<224?s[i++]=(c&31)<<6|r[t++]&63:c>239&&c<365?(c=((c&7)<<18|(r[t++]&63)<<12|(r[t++]&63)<<6|r[t++]&63)-65536,s[i++]=55296+(c>>10),s[i++]=56320+(c&1023)):s[i++]=(c&15)<<12|(r[t++]&63)<<6|r[t++]&63,i>8191&&((o??(o=[])).push(String.fromCharCode.apply(String,s)),i=0);return o!=null?(i>0&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))}function jn(r,t,e){let n=e,o,s;for(let i=0;i<r.length;++i)o=r.charCodeAt(i),o<128?t[e++]=o:o<2048?(t[e++]=o>>6|192,t[e++]=o&63|128):(o&64512)===55296&&((s=r.charCodeAt(i+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++i,t[e++]=o>>18|240,t[e++]=o>>12&63|128,t[e++]=o>>6&63|128,t[e++]=o&63|128):(t[e++]=o>>12|224,t[e++]=o>>6&63|128,t[e++]=o&63|128);return e-n}function Rt(r,t){return RangeError(`index out of range: ${r.pos} + ${t??1} > ${r.len}`)}function Pr(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24