UNPKG

@eotl/simple-signed-records

Version:

Minimal cryptographic identity and content verification for decentralized apps

7 lines 546 kB
"use strict";var buffer$1={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup[45]=62;revLookup[95]=63;function getLens(y){var m=y.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=m);var v=E===m?0:4-E%4;return[E,v]}function byteLength(y){var m=getLens(y),E=m[0],v=m[1];return(E+v)*3/4-v}function _byteLength(y,m,E){return(m+E)*3/4-E}function toByteArray(y){var m,E=getLens(y),v=E[0],B=E[1],r=new Arr(_byteLength(y,v,B)),c=0,h=B>0?v-4:v,o;for(o=0;o<h;o+=4)m=revLookup[y.charCodeAt(o)]<<18|revLookup[y.charCodeAt(o+1)]<<12|revLookup[y.charCodeAt(o+2)]<<6|revLookup[y.charCodeAt(o+3)],r[c++]=m>>16&255,r[c++]=m>>8&255,r[c++]=m&255;return B===2&&(m=revLookup[y.charCodeAt(o)]<<2|revLookup[y.charCodeAt(o+1)]>>4,r[c++]=m&255),B===1&&(m=revLookup[y.charCodeAt(o)]<<10|revLookup[y.charCodeAt(o+1)]<<4|revLookup[y.charCodeAt(o+2)]>>2,r[c++]=m>>8&255,r[c++]=m&255),r}function tripletToBase64(y){return lookup[y>>18&63]+lookup[y>>12&63]+lookup[y>>6&63]+lookup[y&63]}function encodeChunk(y,m,E){for(var v,B=[],r=m;r<E;r+=3)v=(y[r]<<16&16711680)+(y[r+1]<<8&65280)+(y[r+2]&255),B.push(tripletToBase64(v));return B.join("")}function fromByteArray(y){for(var m,E=y.length,v=E%3,B=[],r=16383,c=0,h=E-v;c<h;c+=r)B.push(encodeChunk(y,c,c+r>h?h:c+r));return v===1?(m=y[E-1],B.push(lookup[m>>2]+lookup[m<<4&63]+"==")):v===2&&(m=(y[E-2]<<8)+y[E-1],B.push(lookup[m>>10]+lookup[m>>4&63]+lookup[m<<2&63]+"=")),B.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ieee754.read=function(y,m,E,v,B){var r,c,h=B*8-v-1,o=(1<<h)-1,u=o>>1,t=-7,s=E?B-1:0,d=E?-1:1,g=y[m+s];for(s+=d,r=g&(1<<-t)-1,g>>=-t,t+=h;t>0;r=r*256+y[m+s],s+=d,t-=8);for(c=r&(1<<-t)-1,r>>=-t,t+=v;t>0;c=c*256+y[m+s],s+=d,t-=8);if(r===0)r=1-u;else{if(r===o)return c?NaN:(g?-1:1)*(1/0);c=c+Math.pow(2,v),r=r-u}return(g?-1:1)*c*Math.pow(2,r-v)};ieee754.write=function(y,m,E,v,B,r){var c,h,o,u=r*8-B-1,t=(1<<u)-1,s=t>>1,d=B===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=v?0:r-1,M=v?1:-1,q=m<0||m===0&&1/m<0?1:0;for(m=Math.abs(m),isNaN(m)||m===1/0?(h=isNaN(m)?1:0,c=t):(c=Math.floor(Math.log(m)/Math.LN2),m*(o=Math.pow(2,-c))<1&&(c--,o*=2),c+s>=1?m+=d/o:m+=d*Math.pow(2,1-s),m*o>=2&&(c++,o/=2),c+s>=t?(h=0,c=t):c+s>=1?(h=(m*o-1)*Math.pow(2,B),c=c+s):(h=m*Math.pow(2,s-1)*Math.pow(2,B),c=0));B>=8;y[E+g]=h&255,g+=M,h/=256,B-=8);for(c=c<<B|h,u+=B;u>0;y[E+g]=c&255,g+=M,c/=256,u-=8);y[E+g-M]|=q*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh <https://feross.org> * @license MIT */(function(y){const m=base64Js,E=ieee754,v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;y.Buffer=t,y.SlowBuffer=G,y.INSPECT_MAX_BYTES=50;const B=2147483647;y.kMaxLength=B;const{Uint8Array:r,ArrayBuffer:c,SharedArrayBuffer:h}=globalThis;t.TYPED_ARRAY_SUPPORT=o(),!t.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const L=new r(1),$={foo:function(){return 42}};return Object.setPrototypeOf($,r.prototype),Object.setPrototypeOf(L,$),L.foo()===42}catch{return!1}}Object.defineProperty(t.prototype,"parent",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.buffer}}),Object.defineProperty(t.prototype,"offset",{enumerable:!0,get:function(){if(t.isBuffer(this))return this.byteOffset}});function u(L){if(L>B)throw new RangeError('The value "'+L+'" is invalid for option "size"');const $=new r(L);return Object.setPrototypeOf($,t.prototype),$}function t(L,$,C){if(typeof L=="number"){if(typeof $=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(L)}return s(L,$,C)}t.poolSize=8192;function s(L,$,C){if(typeof L=="string")return q(L,$);if(c.isView(L))return I(L);if(L==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof L);if(er(L,c)||L&&er(L.buffer,c)||typeof h<"u"&&(er(L,h)||L&&er(L.buffer,h)))return P(L,$,C);if(typeof L=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const V=L.valueOf&&L.valueOf();if(V!=null&&V!==L)return t.from(V,$,C);const re=N(L);if(re)return re;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof L[Symbol.toPrimitive]=="function")return t.from(L[Symbol.toPrimitive]("string"),$,C);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof L)}t.from=function(L,$,C){return s(L,$,C)},Object.setPrototypeOf(t.prototype,r.prototype),Object.setPrototypeOf(t,r);function d(L){if(typeof L!="number")throw new TypeError('"size" argument must be of type number');if(L<0)throw new RangeError('The value "'+L+'" is invalid for option "size"')}function g(L,$,C){return d(L),L<=0?u(L):$!==void 0?typeof C=="string"?u(L).fill($,C):u(L).fill($):u(L)}t.alloc=function(L,$,C){return g(L,$,C)};function M(L){return d(L),u(L<0?0:O(L)|0)}t.allocUnsafe=function(L){return M(L)},t.allocUnsafeSlow=function(L){return M(L)};function q(L,$){if((typeof $!="string"||$==="")&&($="utf8"),!t.isEncoding($))throw new TypeError("Unknown encoding: "+$);const C=Z(L,$)|0;let V=u(C);const re=V.write(L,$);return re!==C&&(V=V.slice(0,re)),V}function T(L){const $=L.length<0?0:O(L.length)|0,C=u($);for(let V=0;V<$;V+=1)C[V]=L[V]&255;return C}function I(L){if(er(L,r)){const $=new r(L);return P($.buffer,$.byteOffset,$.byteLength)}return T(L)}function P(L,$,C){if($<0||L.byteLength<$)throw new RangeError('"offset" is outside of buffer bounds');if(L.byteLength<$+(C||0))throw new RangeError('"length" is outside of buffer bounds');let V;return $===void 0&&C===void 0?V=new r(L):C===void 0?V=new r(L,$):V=new r(L,$,C),Object.setPrototypeOf(V,t.prototype),V}function N(L){if(t.isBuffer(L)){const $=O(L.length)|0,C=u($);return C.length===0||L.copy(C,0,0,$),C}if(L.length!==void 0)return typeof L.length!="number"||Ve(L.length)?u(0):T(L);if(L.type==="Buffer"&&Array.isArray(L.data))return T(L.data)}function O(L){if(L>=B)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+B.toString(16)+" bytes");return L|0}function G(L){return+L!=L&&(L=0),t.alloc(+L)}t.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==t.prototype},t.compare=function($,C){if(er($,r)&&($=t.from($,$.offset,$.byteLength)),er(C,r)&&(C=t.from(C,C.offset,C.byteLength)),!t.isBuffer($)||!t.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===C)return 0;let V=$.length,re=C.length;for(let oe=0,ue=Math.min(V,re);oe<ue;++oe)if($[oe]!==C[oe]){V=$[oe],re=C[oe];break}return V<re?-1:re<V?1:0},t.isEncoding=function($){switch(String($).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function($,C){if(!Array.isArray($))throw new TypeError('"list" argument must be an Array of Buffers');if($.length===0)return t.alloc(0);let V;if(C===void 0)for(C=0,V=0;V<$.length;++V)C+=$[V].length;const re=t.allocUnsafe(C);let oe=0;for(V=0;V<$.length;++V){let ue=$[V];if(er(ue,r))oe+ue.length>re.length?(t.isBuffer(ue)||(ue=t.from(ue)),ue.copy(re,oe)):r.prototype.set.call(re,ue,oe);else if(t.isBuffer(ue))ue.copy(re,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=ue.length}return re};function Z(L,$){if(t.isBuffer(L))return L.length;if(c.isView(L)||er(L,c))return L.byteLength;if(typeof L!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof L);const C=L.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&C===0)return 0;let re=!1;for(;;)switch($){case"ascii":case"latin1":case"binary":return C;case"utf8":case"utf-8":return ze(L).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C*2;case"hex":return C>>>1;case"base64":return Ke(L).length;default:if(re)return V?-1:ze(L).length;$=(""+$).toLowerCase(),re=!0}}t.byteLength=Z;function ie(L,$,C){let V=!1;if(($===void 0||$<0)&&($=0),$>this.length||((C===void 0||C>this.length)&&(C=this.length),C<=0)||(C>>>=0,$>>>=0,C<=$))return"";for(L||(L="utf8");;)switch(L){case"hex":return n(this,$,C);case"utf8":case"utf-8":return p(this,$,C);case"ascii":return b(this,$,C);case"latin1":case"binary":return x(this,$,C);case"base64":return l(this,$,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,$,C);default:if(V)throw new TypeError("Unknown encoding: "+L);L=(L+"").toLowerCase(),V=!0}}t.prototype._isBuffer=!0;function ne(L,$,C){const V=L[$];L[$]=L[C],L[C]=V}t.prototype.swap16=function(){const $=this.length;if($%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;C<$;C+=2)ne(this,C,C+1);return this},t.prototype.swap32=function(){const $=this.length;if($%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let C=0;C<$;C+=4)ne(this,C,C+3),ne(this,C+1,C+2);return this},t.prototype.swap64=function(){const $=this.length;if($%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let C=0;C<$;C+=8)ne(this,C,C+7),ne(this,C+1,C+6),ne(this,C+2,C+5),ne(this,C+3,C+4);return this},t.prototype.toString=function(){const $=this.length;return $===0?"":arguments.length===0?p(this,0,$):ie.apply(this,arguments)},t.prototype.toLocaleString=t.prototype.toString,t.prototype.equals=function($){if(!t.isBuffer($))throw new TypeError("Argument must be a Buffer");return this===$?!0:t.compare(this,$)===0},t.prototype.inspect=function(){let $="";const C=y.INSPECT_MAX_BYTES;return $=this.toString("hex",0,C).replace(/(.{2})/g,"$1 ").trim(),this.length>C&&($+=" ... "),"<Buffer "+$+">"},v&&(t.prototype[v]=t.prototype.inspect),t.prototype.compare=function($,C,V,re,oe){if(er($,r)&&($=t.from($,$.offset,$.byteLength)),!t.isBuffer($))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(C===void 0&&(C=0),V===void 0&&(V=$?$.length:0),re===void 0&&(re=0),oe===void 0&&(oe=this.length),C<0||V>$.length||re<0||oe>this.length)throw new RangeError("out of range index");if(re>=oe&&C>=V)return 0;if(re>=oe)return-1;if(C>=V)return 1;if(C>>>=0,V>>>=0,re>>>=0,oe>>>=0,this===$)return 0;let ue=oe-re,je=V-C;const Le=Math.min(ue,je),Ee=this.slice(re,oe),nr=$.slice(C,V);for(let Ue=0;Ue<Le;++Ue)if(Ee[Ue]!==nr[Ue]){ue=Ee[Ue],je=nr[Ue];break}return ue<je?-1:je<ue?1:0};function te(L,$,C,V,re){if(L.length===0)return-1;if(typeof C=="string"?(V=C,C=0):C>2147483647?C=2147483647:C<-2147483648&&(C=-2147483648),C=+C,Ve(C)&&(C=re?0:L.length-1),C<0&&(C=L.length+C),C>=L.length){if(re)return-1;C=L.length-1}else if(C<0)if(re)C=0;else return-1;if(typeof $=="string"&&($=t.from($,V)),t.isBuffer($))return $.length===0?-1:be(L,$,C,V,re);if(typeof $=="number")return $=$&255,typeof r.prototype.indexOf=="function"?re?r.prototype.indexOf.call(L,$,C):r.prototype.lastIndexOf.call(L,$,C):be(L,[$],C,V,re);throw new TypeError("val must be string, number or Buffer")}function be(L,$,C,V,re){let oe=1,ue=L.length,je=$.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(L.length<2||$.length<2)return-1;oe=2,ue/=2,je/=2,C/=2}function Le(nr,Ue){return oe===1?nr[Ue]:nr.readUInt16BE(Ue*oe)}let Ee;if(re){let nr=-1;for(Ee=C;Ee<ue;Ee++)if(Le(L,Ee)===Le($,nr===-1?0:Ee-nr)){if(nr===-1&&(nr=Ee),Ee-nr+1===je)return nr*oe}else nr!==-1&&(Ee-=Ee-nr),nr=-1}else for(C+je>ue&&(C=ue-je),Ee=C;Ee>=0;Ee--){let nr=!0;for(let Ue=0;Ue<je;Ue++)if(Le(L,Ee+Ue)!==Le($,Ue)){nr=!1;break}if(nr)return Ee}return-1}t.prototype.includes=function($,C,V){return this.indexOf($,C,V)!==-1},t.prototype.indexOf=function($,C,V){return te(this,$,C,V,!0)},t.prototype.lastIndexOf=function($,C,V){return te(this,$,C,V,!1)};function W(L,$,C,V){C=Number(C)||0;const re=L.length-C;V?(V=Number(V),V>re&&(V=re)):V=re;const oe=$.length;V>oe/2&&(V=oe/2);let ue;for(ue=0;ue<V;++ue){const je=parseInt($.substr(ue*2,2),16);if(Ve(je))return ue;L[C+ue]=je}return ue}function _(L,$,C,V){return Re(ze($,L.length-C),L,C,V)}function f(L,$,C,V){return Re(qe($),L,C,V)}function e(L,$,C,V){return Re(Ke($),L,C,V)}function a(L,$,C,V){return Re(fr($,L.length-C),L,C,V)}t.prototype.write=function($,C,V,re){if(C===void 0)re="utf8",V=this.length,C=0;else if(V===void 0&&typeof C=="string")re=C,V=this.length,C=0;else if(isFinite(C))C=C>>>0,isFinite(V)?(V=V>>>0,re===void 0&&(re="utf8")):(re=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const oe=this.length-C;if((V===void 0||V>oe)&&(V=oe),$.length>0&&(V<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");re||(re="utf8");let ue=!1;for(;;)switch(re){case"hex":return W(this,$,C,V);case"utf8":case"utf-8":return _(this,$,C,V);case"ascii":case"latin1":case"binary":return f(this,$,C,V);case"base64":return e(this,$,C,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,$,C,V);default:if(ue)throw new TypeError("Unknown encoding: "+re);re=(""+re).toLowerCase(),ue=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function l(L,$,C){return $===0&&C===L.length?m.fromByteArray(L):m.fromByteArray(L.slice($,C))}function p(L,$,C){C=Math.min(L.length,C);const V=[];let re=$;for(;re<C;){const oe=L[re];let ue=null,je=oe>239?4:oe>223?3:oe>191?2:1;if(re+je<=C){let Le,Ee,nr,Ue;switch(je){case 1:oe<128&&(ue=oe);break;case 2:Le=L[re+1],(Le&192)===128&&(Ue=(oe&31)<<6|Le&63,Ue>127&&(ue=Ue));break;case 3:Le=L[re+1],Ee=L[re+2],(Le&192)===128&&(Ee&192)===128&&(Ue=(oe&15)<<12|(Le&63)<<6|Ee&63,Ue>2047&&(Ue<55296||Ue>57343)&&(ue=Ue));break;case 4:Le=L[re+1],Ee=L[re+2],nr=L[re+3],(Le&192)===128&&(Ee&192)===128&&(nr&192)===128&&(Ue=(oe&15)<<18|(Le&63)<<12|(Ee&63)<<6|nr&63,Ue>65535&&Ue<1114112&&(ue=Ue))}}ue===null?(ue=65533,je=1):ue>65535&&(ue-=65536,V.push(ue>>>10&1023|55296),ue=56320|ue&1023),V.push(ue),re+=je}return S(V)}const w=4096;function S(L){const $=L.length;if($<=w)return String.fromCharCode.apply(String,L);let C="",V=0;for(;V<$;)C+=String.fromCharCode.apply(String,L.slice(V,V+=w));return C}function b(L,$,C){let V="";C=Math.min(L.length,C);for(let re=$;re<C;++re)V+=String.fromCharCode(L[re]&127);return V}function x(L,$,C){let V="";C=Math.min(L.length,C);for(let re=$;re<C;++re)V+=String.fromCharCode(L[re]);return V}function n(L,$,C){const V=L.length;(!$||$<0)&&($=0),(!C||C<0||C>V)&&(C=V);let re="";for(let oe=$;oe<C;++oe)re+=Pe[L[oe]];return re}function R(L,$,C){const V=L.slice($,C);let re="";for(let oe=0;oe<V.length-1;oe+=2)re+=String.fromCharCode(V[oe]+V[oe+1]*256);return re}t.prototype.slice=function($,C){const V=this.length;$=~~$,C=C===void 0?V:~~C,$<0?($+=V,$<0&&($=0)):$>V&&($=V),C<0?(C+=V,C<0&&(C=0)):C>V&&(C=V),C<$&&(C=$);const re=this.subarray($,C);return Object.setPrototypeOf(re,t.prototype),re};function X(L,$,C){if(L%1!==0||L<0)throw new RangeError("offset is not uint");if(L+$>C)throw new RangeError("Trying to access beyond buffer length")}t.prototype.readUintLE=t.prototype.readUIntLE=function($,C,V){$=$>>>0,C=C>>>0,V||X($,C,this.length);let re=this[$],oe=1,ue=0;for(;++ue<C&&(oe*=256);)re+=this[$+ue]*oe;return re},t.prototype.readUintBE=t.prototype.readUIntBE=function($,C,V){$=$>>>0,C=C>>>0,V||X($,C,this.length);let re=this[$+--C],oe=1;for(;C>0&&(oe*=256);)re+=this[$+--C]*oe;return re},t.prototype.readUint8=t.prototype.readUInt8=function($,C){return $=$>>>0,C||X($,1,this.length),this[$]},t.prototype.readUint16LE=t.prototype.readUInt16LE=function($,C){return $=$>>>0,C||X($,2,this.length),this[$]|this[$+1]<<8},t.prototype.readUint16BE=t.prototype.readUInt16BE=function($,C){return $=$>>>0,C||X($,2,this.length),this[$]<<8|this[$+1]},t.prototype.readUint32LE=t.prototype.readUInt32LE=function($,C){return $=$>>>0,C||X($,4,this.length),(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216},t.prototype.readUint32BE=t.prototype.readUInt32BE=function($,C){return $=$>>>0,C||X($,4,this.length),this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])},t.prototype.readBigUInt64LE=ur(function($){$=$>>>0,Ae($,"offset");const C=this[$],V=this[$+7];(C===void 0||V===void 0)&&Be($,this.length-8);const re=C+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24,oe=this[++$]+this[++$]*2**8+this[++$]*2**16+V*2**24;return BigInt(re)+(BigInt(oe)<<BigInt(32))}),t.prototype.readBigUInt64BE=ur(function($){$=$>>>0,Ae($,"offset");const C=this[$],V=this[$+7];(C===void 0||V===void 0)&&Be($,this.length-8);const re=C*2**24+this[++$]*2**16+this[++$]*2**8+this[++$],oe=this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+V;return(BigInt(re)<<BigInt(32))+BigInt(oe)}),t.prototype.readIntLE=function($,C,V){$=$>>>0,C=C>>>0,V||X($,C,this.length);let re=this[$],oe=1,ue=0;for(;++ue<C&&(oe*=256);)re+=this[$+ue]*oe;return oe*=128,re>=oe&&(re-=Math.pow(2,8*C)),re},t.prototype.readIntBE=function($,C,V){$=$>>>0,C=C>>>0,V||X($,C,this.length);let re=C,oe=1,ue=this[$+--re];for(;re>0&&(oe*=256);)ue+=this[$+--re]*oe;return oe*=128,ue>=oe&&(ue-=Math.pow(2,8*C)),ue},t.prototype.readInt8=function($,C){return $=$>>>0,C||X($,1,this.length),this[$]&128?(255-this[$]+1)*-1:this[$]},t.prototype.readInt16LE=function($,C){$=$>>>0,C||X($,2,this.length);const V=this[$]|this[$+1]<<8;return V&32768?V|4294901760:V},t.prototype.readInt16BE=function($,C){$=$>>>0,C||X($,2,this.length);const V=this[$+1]|this[$]<<8;return V&32768?V|4294901760:V},t.prototype.readInt32LE=function($,C){return $=$>>>0,C||X($,4,this.length),this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24},t.prototype.readInt32BE=function($,C){return $=$>>>0,C||X($,4,this.length),this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]},t.prototype.readBigInt64LE=ur(function($){$=$>>>0,Ae($,"offset");const C=this[$],V=this[$+7];(C===void 0||V===void 0)&&Be($,this.length-8);const re=this[$+4]+this[$+5]*2**8+this[$+6]*2**16+(V<<24);return(BigInt(re)<<BigInt(32))+BigInt(C+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24)}),t.prototype.readBigInt64BE=ur(function($){$=$>>>0,Ae($,"offset");const C=this[$],V=this[$+7];(C===void 0||V===void 0)&&Be($,this.length-8);const re=(C<<24)+this[++$]*2**16+this[++$]*2**8+this[++$];return(BigInt(re)<<BigInt(32))+BigInt(this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+V)}),t.prototype.readFloatLE=function($,C){return $=$>>>0,C||X($,4,this.length),E.read(this,$,!0,23,4)},t.prototype.readFloatBE=function($,C){return $=$>>>0,C||X($,4,this.length),E.read(this,$,!1,23,4)},t.prototype.readDoubleLE=function($,C){return $=$>>>0,C||X($,8,this.length),E.read(this,$,!0,52,8)},t.prototype.readDoubleBE=function($,C){return $=$>>>0,C||X($,8,this.length),E.read(this,$,!1,52,8)};function Q(L,$,C,V,re,oe){if(!t.isBuffer(L))throw new TypeError('"buffer" argument must be a Buffer instance');if($>re||$<oe)throw new RangeError('"value" argument is out of bounds');if(C+V>L.length)throw new RangeError("Index out of range")}t.prototype.writeUintLE=t.prototype.writeUIntLE=function($,C,V,re){if($=+$,C=C>>>0,V=V>>>0,!re){const je=Math.pow(2,8*V)-1;Q(this,$,C,V,je,0)}let oe=1,ue=0;for(this[C]=$&255;++ue<V&&(oe*=256);)this[C+ue]=$/oe&255;return C+V},t.prototype.writeUintBE=t.prototype.writeUIntBE=function($,C,V,re){if($=+$,C=C>>>0,V=V>>>0,!re){const je=Math.pow(2,8*V)-1;Q(this,$,C,V,je,0)}let oe=V-1,ue=1;for(this[C+oe]=$&255;--oe>=0&&(ue*=256);)this[C+oe]=$/ue&255;return C+V},t.prototype.writeUint8=t.prototype.writeUInt8=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,1,255,0),this[C]=$&255,C+1},t.prototype.writeUint16LE=t.prototype.writeUInt16LE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,2,65535,0),this[C]=$&255,this[C+1]=$>>>8,C+2},t.prototype.writeUint16BE=t.prototype.writeUInt16BE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,2,65535,0),this[C]=$>>>8,this[C+1]=$&255,C+2},t.prototype.writeUint32LE=t.prototype.writeUInt32LE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,4,4294967295,0),this[C+3]=$>>>24,this[C+2]=$>>>16,this[C+1]=$>>>8,this[C]=$&255,C+4},t.prototype.writeUint32BE=t.prototype.writeUInt32BE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,4,4294967295,0),this[C]=$>>>24,this[C+1]=$>>>16,this[C+2]=$>>>8,this[C+3]=$&255,C+4};function Y(L,$,C,V,re){_e($,V,re,L,C,7);let oe=Number($&BigInt(4294967295));L[C++]=oe,oe=oe>>8,L[C++]=oe,oe=oe>>8,L[C++]=oe,oe=oe>>8,L[C++]=oe;let ue=Number($>>BigInt(32)&BigInt(4294967295));return L[C++]=ue,ue=ue>>8,L[C++]=ue,ue=ue>>8,L[C++]=ue,ue=ue>>8,L[C++]=ue,C}function D(L,$,C,V,re){_e($,V,re,L,C,7);let oe=Number($&BigInt(4294967295));L[C+7]=oe,oe=oe>>8,L[C+6]=oe,oe=oe>>8,L[C+5]=oe,oe=oe>>8,L[C+4]=oe;let ue=Number($>>BigInt(32)&BigInt(4294967295));return L[C+3]=ue,ue=ue>>8,L[C+2]=ue,ue=ue>>8,L[C+1]=ue,ue=ue>>8,L[C]=ue,C+8}t.prototype.writeBigUInt64LE=ur(function($,C=0){return Y(this,$,C,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeBigUInt64BE=ur(function($,C=0){return D(this,$,C,BigInt(0),BigInt("0xffffffffffffffff"))}),t.prototype.writeIntLE=function($,C,V,re){if($=+$,C=C>>>0,!re){const Le=Math.pow(2,8*V-1);Q(this,$,C,V,Le-1,-Le)}let oe=0,ue=1,je=0;for(this[C]=$&255;++oe<V&&(ue*=256);)$<0&&je===0&&this[C+oe-1]!==0&&(je=1),this[C+oe]=($/ue>>0)-je&255;return C+V},t.prototype.writeIntBE=function($,C,V,re){if($=+$,C=C>>>0,!re){const Le=Math.pow(2,8*V-1);Q(this,$,C,V,Le-1,-Le)}let oe=V-1,ue=1,je=0;for(this[C+oe]=$&255;--oe>=0&&(ue*=256);)$<0&&je===0&&this[C+oe+1]!==0&&(je=1),this[C+oe]=($/ue>>0)-je&255;return C+V},t.prototype.writeInt8=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,1,127,-128),$<0&&($=255+$+1),this[C]=$&255,C+1},t.prototype.writeInt16LE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,2,32767,-32768),this[C]=$&255,this[C+1]=$>>>8,C+2},t.prototype.writeInt16BE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,2,32767,-32768),this[C]=$>>>8,this[C+1]=$&255,C+2},t.prototype.writeInt32LE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,4,2147483647,-2147483648),this[C]=$&255,this[C+1]=$>>>8,this[C+2]=$>>>16,this[C+3]=$>>>24,C+4},t.prototype.writeInt32BE=function($,C,V){return $=+$,C=C>>>0,V||Q(this,$,C,4,2147483647,-2147483648),$<0&&($=4294967295+$+1),this[C]=$>>>24,this[C+1]=$>>>16,this[C+2]=$>>>8,this[C+3]=$&255,C+4},t.prototype.writeBigInt64LE=ur(function($,C=0){return Y(this,$,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),t.prototype.writeBigInt64BE=ur(function($,C=0){return D(this,$,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function U(L,$,C,V,re,oe){if(C+V>L.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("Index out of range")}function J(L,$,C,V,re){return $=+$,C=C>>>0,re||U(L,$,C,4),E.write(L,$,C,V,23,4),C+4}t.prototype.writeFloatLE=function($,C,V){return J(this,$,C,!0,V)},t.prototype.writeFloatBE=function($,C,V){return J(this,$,C,!1,V)};function se(L,$,C,V,re){return $=+$,C=C>>>0,re||U(L,$,C,8),E.write(L,$,C,V,52,8),C+8}t.prototype.writeDoubleLE=function($,C,V){return se(this,$,C,!0,V)},t.prototype.writeDoubleBE=function($,C,V){return se(this,$,C,!1,V)},t.prototype.copy=function($,C,V,re){if(!t.isBuffer($))throw new TypeError("argument should be a Buffer");if(V||(V=0),!re&&re!==0&&(re=this.length),C>=$.length&&(C=$.length),C||(C=0),re>0&&re<V&&(re=V),re===V||$.length===0||this.length===0)return 0;if(C<0)throw new RangeError("targetStart out of bounds");if(V<0||V>=this.length)throw new RangeError("Index out of range");if(re<0)throw new RangeError("sourceEnd out of bounds");re>this.length&&(re=this.length),$.length-C<re-V&&(re=$.length-C+V);const oe=re-V;return this===$&&typeof r.prototype.copyWithin=="function"?this.copyWithin(C,V,re):r.prototype.set.call($,this.subarray(V,re),C),oe},t.prototype.fill=function($,C,V,re){if(typeof $=="string"){if(typeof C=="string"?(re=C,C=0,V=this.length):typeof V=="string"&&(re=V,V=this.length),re!==void 0&&typeof re!="string")throw new TypeError("encoding must be a string");if(typeof re=="string"&&!t.isEncoding(re))throw new TypeError("Unknown encoding: "+re);if($.length===1){const ue=$.charCodeAt(0);(re==="utf8"&&ue<128||re==="latin1")&&($=ue)}}else typeof $=="number"?$=$&255:typeof $=="boolean"&&($=Number($));if(C<0||this.length<C||this.length<V)throw new RangeError("Out of range index");if(V<=C)return this;C=C>>>0,V=V===void 0?this.length:V>>>0,$||($=0);let oe;if(typeof $=="number")for(oe=C;oe<V;++oe)this[oe]=$;else{const ue=t.isBuffer($)?$:t.from($,re),je=ue.length;if(je===0)throw new TypeError('The value "'+$+'" is invalid for argument "value"');for(oe=0;oe<V-C;++oe)this[oe+C]=ue[oe%je]}return this};const K={};function j(L,$,C){K[L]=class extends C{constructor(){super(),Object.defineProperty(this,"message",{value:$.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${L}]`,this.stack,delete this.name}get code(){return L}set code(re){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:re,writable:!0})}toString(){return`${this.name} [${L}]: ${this.message}`}}}j("ERR_BUFFER_OUT_OF_BOUNDS",function(L){return L?`${L} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),j("ERR_INVALID_ARG_TYPE",function(L,$){return`The "${L}" argument must be of type number. Received type ${typeof $}`},TypeError),j("ERR_OUT_OF_RANGE",function(L,$,C){let V=`The value of "${L}" is out of range.`,re=C;return Number.isInteger(C)&&Math.abs(C)>2**32?re=he(String(C)):typeof C=="bigint"&&(re=String(C),(C>BigInt(2)**BigInt(32)||C<-(BigInt(2)**BigInt(32)))&&(re=he(re)),re+="n"),V+=` It must be ${$}. Received ${re}`,V},RangeError);function he(L){let $="",C=L.length;const V=L[0]==="-"?1:0;for(;C>=V+4;C-=3)$=`_${L.slice(C-3,C)}${$}`;return`${L.slice(0,C)}${$}`}function ve(L,$,C){Ae($,"offset"),(L[$]===void 0||L[$+C]===void 0)&&Be($,L.length-(C+1))}function _e(L,$,C,V,re,oe){if(L>C||L<$){const ue=typeof $=="bigint"?"n":"";let je;throw $===0||$===BigInt(0)?je=`>= 0${ue} and < 2${ue} ** ${(oe+1)*8}${ue}`:je=`>= -(2${ue} ** ${(oe+1)*8-1}${ue}) and < 2 ** ${(oe+1)*8-1}${ue}`,new K.ERR_OUT_OF_RANGE("value",je,L)}ve(V,re,oe)}function Ae(L,$){if(typeof L!="number")throw new K.ERR_INVALID_ARG_TYPE($,"number",L)}function Be(L,$,C){throw Math.floor(L)!==L?(Ae(L,C),new K.ERR_OUT_OF_RANGE("offset","an integer",L)):$<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${$}`,L)}const Ie=/[^+/0-9A-Za-z-_]/g;function de(L){if(L=L.split("=")[0],L=L.trim().replace(Ie,""),L.length<2)return"";for(;L.length%4!==0;)L=L+"=";return L}function ze(L,$){$=$||1/0;let C;const V=L.length;let re=null;const oe=[];for(let ue=0;ue<V;++ue){if(C=L.charCodeAt(ue),C>55295&&C<57344){if(!re){if(C>56319){($-=3)>-1&&oe.push(239,191,189);continue}else if(ue+1===V){($-=3)>-1&&oe.push(239,191,189);continue}re=C;continue}if(C<56320){($-=3)>-1&&oe.push(239,191,189),re=C;continue}C=(re-55296<<10|C-56320)+65536}else re&&($-=3)>-1&&oe.push(239,191,189);if(re=null,C<128){if(($-=1)<0)break;oe.push(C)}else if(C<2048){if(($-=2)<0)break;oe.push(C>>6|192,C&63|128)}else if(C<65536){if(($-=3)<0)break;oe.push(C>>12|224,C>>6&63|128,C&63|128)}else if(C<1114112){if(($-=4)<0)break;oe.push(C>>18|240,C>>12&63|128,C>>6&63|128,C&63|128)}else throw new Error("Invalid code point")}return oe}function qe(L){const $=[];for(let C=0;C<L.length;++C)$.push(L.charCodeAt(C)&255);return $}function fr(L,$){let C,V,re;const oe=[];for(let ue=0;ue<L.length&&!(($-=2)<0);++ue)C=L.charCodeAt(ue),V=C>>8,re=C%256,oe.push(re),oe.push(V);return oe}function Ke(L){return m.toByteArray(de(L))}function Re(L,$,C,V){let re;for(re=0;re<V&&!(re+C>=$.length||re>=L.length);++re)$[re+C]=L[re];return re}function er(L,$){return L instanceof $||L!=null&&L.constructor!=null&&L.constructor.name!=null&&L.constructor.name===$.name}function Ve(L){return L!==L}const Pe=function(){const L="0123456789abcdef",$=new Array(256);for(let C=0;C<16;++C){const V=C*16;for(let re=0;re<16;++re)$[V+re]=L[C]+L[re]}return $}();function ur(L){return typeof BigInt>"u"?or:L}function or(){throw new Error("BigInt not supported")}})(buffer$1);const Buffer$1=buffer$1.Buffer,Blob=buffer$1.Blob,BlobOptions=buffer$1.BlobOptions,Buffer$1$1=buffer$1.Buffer,File=buffer$1.File,FileOptions=buffer$1.FileOptions,INSPECT_MAX_BYTES=buffer$1.INSPECT_MAX_BYTES,SlowBuffer=buffer$1.SlowBuffer,TranscodeEncoding=buffer$1.TranscodeEncoding,atob$1=buffer$1.atob,btoa$1=buffer$1.btoa,constants$1=buffer$1.constants,isAscii=buffer$1.isAscii,isUtf8=buffer$1.isUtf8,kMaxLength=buffer$1.kMaxLength,kStringMaxLength=buffer$1.kStringMaxLength,resolveObjectURL=buffer$1.resolveObjectURL,transcode=buffer$1.transcode,dist=Object.freeze(Object.defineProperty({__proto__:null,Blob,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$1,constants:constants$1,default:Buffer$1,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$1(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}function getAugmentedNamespace(y){if(y.__esModule)return y;var m=y.default;if(typeof m=="function"){var E=function v(){return this instanceof v?Reflect.construct(m,arguments,this.constructor):m.apply(this,arguments)};E.prototype=m.prototype}else E={};return Object.defineProperty(E,"__esModule",{value:!0}),Object.keys(y).forEach(function(v){var B=Object.getOwnPropertyDescriptor(y,v);Object.defineProperty(E,v,B.get?B:{enumerable:!0,get:function(){return y[v]}})}),E}function commonjsRequire(y){throw new Error('Could not dynamically require "'+y+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var naclFast={exports:{}},cryptoBrowserify={};function getDefaultExportFromCjs(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var browser$c={exports:{}},process=browser$c.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(y){if(cachedSetTimeout===setTimeout)return setTimeout(y,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(y,0);try{return cachedSetTimeout(y,0)}catch{try{return cachedSetTimeout.call(null,y,0)}catch{return cachedSetTimeout.call(this,y,0)}}}function runClearTimeout(y){if(cachedClearTimeout===clearTimeout)return clearTimeout(y);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(y);try{return cachedClearTimeout(y)}catch{try{return cachedClearTimeout.call(null,y)}catch{return cachedClearTimeout.call(this,y)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var y=runTimeout(cleanUpNextTick);draining=!0;for(var m=queue.length;m;){for(currentQueue=queue,queue=[];++queueIndex<m;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,m=queue.length}currentQueue=null,draining=!1,runClearTimeout(y)}}process.nextTick=function(y){var m=new Array(arguments.length-1);if(arguments.length>1)for(var E=1;E<arguments.length;E++)m[E-1]=arguments[E];queue.push(new Item(y,m)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(y,m){this.fun=y,this.array=m}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=!0;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(y){return[]};process.binding=function(y){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(y){throw new Error("process.chdir is not supported")};process.umask=function(){return 0};var browserExports$1=browser$c.exports;const process$1=getDefaultExportFromCjs(browserExports$1);var browser$b={exports:{}},safeBuffer$1={exports:{}};const require$$1$2=getAugmentedNamespace(dist);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(y,m){var E=require$$1$2,v=E.Buffer;function B(c,h){for(var o in c)h[o]=c[o]}v.from&&v.alloc&&v.allocUnsafe&&v.allocUnsafeSlow?y.exports=E:(B(E,m),m.Buffer=r);function r(c,h,o){return v(c,h,o)}r.prototype=Object.create(v.prototype),B(v,r),r.from=function(c,h,o){if(typeof c=="number")throw new TypeError("Argument must not be a number");return v(c,h,o)},r.alloc=function(c,h,o){if(typeof c!="number")throw new TypeError("Argument must be a number");var u=v(c);return h!==void 0?typeof o=="string"?u.fill(h,o):u.fill(h):u.fill(0),u},r.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return v(c)},r.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return E.SlowBuffer(c)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,MAX_BYTES=65536,MAX_UINT32=4294967295;function oldBrowser(){throw new Error(`Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11`)}var Buffer=safeBufferExports.Buffer,crypto=commonjsGlobal.crypto||commonjsGlobal.msCrypto;crypto&&crypto.getRandomValues?browser$b.exports=randomBytes:browser$b.exports=oldBrowser;function randomBytes(y,m){if(y>MAX_UINT32)throw new RangeError("requested too many random bytes");var E=Buffer.allocUnsafe(y);if(y>0)if(y>MAX_BYTES)for(var v=0;v<y;v+=MAX_BYTES)crypto.getRandomValues(E.slice(v,v+MAX_BYTES));else crypto.getRandomValues(E);return typeof m=="function"?process$1.nextTick(function(){m(null,E)}):E}var browserExports=browser$b.exports,inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser.exports=function(m,E){E&&(m.super_=E,m.prototype=Object.create(E.prototype,{constructor:{value:m,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(m,E){if(E){m.super_=E;var v=function(){};v.prototype=E.prototype,m.prototype=new v,m.prototype.constructor=m}}),inherits_browser.exports}var readableBrowser$1={exports:{}},events={exports:{}},hasRequiredEvents;function requireEvents(){if(hasRequiredEvents)return events.exports;hasRequiredEvents=1;var y=typeof Reflect=="object"?Reflect:null,m=y&&typeof y.apply=="function"?y.apply:function(G,Z,ie){return Function.prototype.apply.call(G,Z,ie)},E;y&&typeof y.ownKeys=="function"?E=y.ownKeys:Object.getOwnPropertySymbols?E=function(G){return Object.getOwnPropertyNames(G).concat(Object.getOwnPropertySymbols(G))}:E=function(G){return Object.getOwnPropertyNames(G)};function v(O){console&&console.warn&&console.warn(O)}var B=Number.isNaN||function(G){return G!==G};function r(){r.init.call(this)}events.exports=r,events.exports.once=I,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var c=10;function h(O){if(typeof O!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof O)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(O){if(typeof O!="number"||O<0||B(O))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+O+".");c=O}}),r.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},r.prototype.setMaxListeners=function(G){if(typeof G!="number"||G<0||B(G))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+G+".");return this._maxListeners=G,this};function o(O){return O._maxListeners===void 0?r.defaultMaxListeners:O._maxListeners}r.prototype.getMaxListeners=function(){return o(this)},r.prototype.emit=function(G){for(var Z=[],ie=1;ie<arguments.length;ie++)Z.push(arguments[ie]);var ne=G==="error",te=this._events;if(te!==void 0)ne=ne&&te.error===void 0;else if(!ne)return!1;if(ne){var be;if(Z.length>0&&(be=Z[0]),be instanceof Error)throw be;var W=new Error("Unhandled error."+(be?" ("+be.message+")":""));throw W.context=be,W}var _=te[G];if(_===void 0)return!1;if(typeof _=="function")m(_,this,Z);else for(var f=_.length,e=M(_,f),ie=0;ie<f;++ie)m(e[ie],this,Z);return!0};function u(O,G,Z,ie){var ne,te,be;if(h(Z),te=O._events,te===void 0?(te=O._events=Object.create(null),O._eventsCount=0):(te.newListener!==void 0&&(O.emit("newListener",G,Z.listener?Z.listener:Z),te=O._events),be=te[G]),be===void 0)be=te[G]=Z,++O._eventsCount;else if(typeof be=="function"?be=te[G]=ie?[Z,be]:[be,Z]:ie?be.unshift(Z):be.push(Z),ne=o(O),ne>0&&be.length>ne&&!be.warned){be.warned=!0;var W=new Error("Possible EventEmitter memory leak detected. "+be.length+" "+String(G)+" listeners added. Use emitter.setMaxListeners() to increase limit");W.name="MaxListenersExceededWarning",W.emitter=O,W.type=G,W.count=be.length,v(W)}return O}r.prototype.addListener=function(G,Z){return u(this,G,Z,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(G,Z){return u(this,G,Z,!0)};function t(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function s(O,G,Z){var ie={fired:!1,wrapFn:void 0,target:O,type:G,listener:Z},ne=t.bind(ie);return ne.listener=Z,ie.wrapFn=ne,ne}r.prototype.once=function(G,Z){return h(Z),this.on(G,s(this,G,Z)),this},r.prototype.prependOnceListener=function(G,Z){return h(Z),this.prependListener(G,s(this,G,Z)),this},r.prototype.removeListener=function(G,Z){var ie,ne,te,be,W;if(h(Z),ne=this._events,ne===void 0)return this;if(ie=ne[G],ie===void 0)return this;if(ie===Z||ie.listener===Z)--this._eventsCount===0?this._events=Object.create(null):(delete ne[G],ne.removeListener&&this.emit("removeListener",G,ie.listener||Z));else if(typeof ie!="function"){for(te=-1,be=ie.length-1;be>=0;be--)if(ie[be]===Z||ie[be].listener===Z){W=ie[be].listener,te=be;break}if(te<0)return this;te===0?ie.shift():q(ie,te),ie.length===1&&(ne[G]=ie[0]),ne.removeListener!==void 0&&this.emit("removeListener",G,W||Z)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(G){var Z,ie,ne;if(ie=this._events,ie===void 0)return this;if(ie.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):ie[G]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete ie[G]),this;if(arguments.length===0){var te=Object.keys(ie),be;for(ne=0;ne<te.length;++ne)be=te[ne],be!=="removeListener"&&this.removeAllListeners(be);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(Z=ie[G],typeof Z=="function")this.removeListener(G,Z);else if(Z!==void 0)for(ne=Z.length-1;ne>=0;ne--)this.removeListener(G,Z[ne]);return this};function d(O,G,Z){var ie=O._events;if(ie===void 0)return[];var ne=ie[G];return ne===void 0?[]:typeof ne=="function"?Z?[ne.listener||ne]:[ne]:Z?T(ne):M(ne,ne.length)}r.prototype.listeners=function(G){return d(this,G,!0)},r.prototype.rawListeners=function(G){return d(this,G,!1)},r.listenerCount=function(O,G){return typeof O.listenerCount=="function"?O.listenerCount(G):g.call(O,G)},r.prototype.listenerCount=g;function g(O){var G=this._events;if(G!==void 0){var Z=G[O];if(typeof Z=="function")return 1;if(Z!==void 0)return Z.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?E(this._events):[]};function M(O,G){for(var Z=new Array(G),ie=0;ie<G;++ie)Z[ie]=O[ie];return Z}function q(O,G){for(;G+1<O.length;G++)O[G]=O[G+1];O.pop()}function T(O){for(var G=new Array(O.length),Z=0;Z<G.length;++Z)G[Z]=O[Z].listener||O[Z];return G}function I(O,G){return new Promise(function(Z,ie){function ne(be){O.removeListener(G,te),ie(be)}function te(){typeof O.removeListener=="function"&&O.removeListener("error",ne),Z([].slice.call(arguments))}N(O,G,te,{once:!0}),G!=="error"&&P(O,ne,{once:!0})})}function P(O,G,Z){typeof O.on=="function"&&N(O,"error",G,Z)}function N(O,G,Z,ie){if(typeof O.on=="function")ie.once?O.once(G,Z):O.on(G,Z);else if(typeof O.addEventListener=="function")O.addEventListener(G,function ne(te){ie.once&&O.removeEventListener(G,ne),Z(te)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof O)}return events.exports}var streamBrowser$1,hasRequiredStreamBrowser$1;function requireStreamBrowser$1(){return hasRequiredStreamBrowser$1||(hasRequiredStreamBrowser$1=1,streamBrowser$1=requireEvents().EventEmitter),streamBrowser$1}var util$1={},types={},shams$1,hasRequiredShams$1;function requireShams$1(){return hasRequiredShams$1||(hasRequiredShams$1=1,shams$1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var m={},E=Symbol("test"),v=Object(E);if(typeof E=="string"||Object.prototype.toString.call(E)!=="[object Symbol]"||Object.prototype.toString.call(v)!=="[object Symbol]")return!1;var B=42;m[E]=B;for(E in m)return!1;if(typeof Object.keys=="function"&&Object.keys(m).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(m).length!==0)return!1;var r=Object.getOwnPropertySymbols(m);if(r.length!==1||r[0]!==E||!Object.prototype.propertyIsEnumerable.call(m,E))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var c=Object.getOwnPropertyDescriptor(m,E);if(c.value!==B||c.enumerable!==!0)return!1}return!0}),shams$1}var shams,hasRequiredShams;function requireShams(){if(hasRequiredShams)return shams;hasRequiredShams=1;var y=requireShams$1();return shams=function(){return y()&&!!Symbol.toStringTag},shams}var esErrors,hasRequiredEsErrors;function requireEsErrors(){return hasRequiredEsErrors||(hasRequiredEsErrors=1,esErrors=Error),esErrors}var _eval,hasRequired_eval;function require_eval(){return hasRequired_eval||(hasRequired_eval=1,_eval=EvalError),_eval}var range,hasRequiredRange;function requireRange(){return hasRequiredRange||(hasRequiredRange=1,range=RangeError),range}var ref,hasRequiredRef;function requireRef(){return hasRequiredRef||(hasRequiredRef=1,ref=ReferenceError),ref}var syntax,hasRequiredSyntax;function requireSyntax(){return hasRequiredSyntax||(hasRequiredSyntax=1,syntax=SyntaxError),syntax}var type,hasRequiredType;function requireType(){return hasRequiredType||(hasRequiredType=1,type=TypeError),type}var uri,hasRequiredUri;function requireUri(){return hasRequiredUri||(hasRequiredUri=1,uri=URIError),uri}var hasSymbols,hasRequiredHasSymbols;function requireHasSymbols(){if(hasRequiredHasSymbols)return hasSymbols;hasRequiredHasSymbols=1;var y=typeof Symbol<"u"&&Symbol,m=requireShams$1();return hasSymbols=function(){return typeof y!="function"||typeof Symbol!="function"||typeof y("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:m()},hasSymbols}var hasProto,hasRequiredHasProto;function requireHasProto(){if(hasRequiredHasProto)return hasProto;hasRequiredHasProto=1;var y={__proto__:null,foo:{}},m=Object;return hasProto=function(){return{__proto__:y}.foo===y.foo&&!(y instanceof m)},hasProto}var implementation,hasRequiredImplementation;function requireImplementation(){if(hasRequiredImplementation)return implementation;hasRequiredImplementation=1;var y="Function.prototype.bind called on incompatible ",m=Object.prototype.toString,E=Math.max,v="[object Function]",B=function(o,u){for(var t=[],s=0;s<o.length;s+=1)t[s]=o[s];for(var d=0;d<u.length;d+=1)t[d+o.length]=u[d];return t},r=function(o,u){for(var t=[],s=u,d=0;s<o.length;s+=1,d+=1)t[d]=o[s];return t},c=function(h,o){for(var u="",t=0;t<h.length;t+=1)u+=h[t],t+1<h.length&&(u+=o);return u};return implementation=function(o){var u=this;if(typeof u!="function"||m.apply(u)!==v)throw new TypeError(y+u);for(var t=r(arguments,1),s,d=function(){if(this instanceof s){var I=u.apply(this,B(t,arguments));return Object(I)===I?I:this}return u.apply(o,B(t,arguments))},g=E(0,u.length-t.length),M=[],q=0;q<g;q++)M[q]="$"+q;if(s=Function("binder","return function ("+c(M,",")+"){ return binder.apply(this,arguments); }")(d),u.prototype){var T=function(){};T.prototype=u.prototype,s.prototype=new T,T.prototype=null}return s},implementation}var functionBind,hasRequiredFunctionBind;function requireFunctionBind(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var y=requireImplementation();return functionBind=Function.prototype.bind||y,functionBind}var hasown,hasRequiredHasown;function requireHasown(){if(hasRequiredHasown)return hasown;hasRequiredHasown=1;var y=Function.prototype.call,m=Object.prototype.hasOwnProperty,E=requireFunctionBind();return hasown=E.call(y,m),hasown}var getIntrinsic,hasRequiredGetIntrinsic;function requireGetIntrinsic(){if(hasRequiredGetIntrinsic)return getIntrinsic;hasRequiredGetIntrinsic=1;var y,m=requireEsErrors(),E=require_eval(),v=requireRange(),B=requireRef(),r=requireSyntax(),c=requireType(),h=requireUri(),o=Function,u=function(p){try{return o('"use strict"; return ('+p+").constructor;")()}catch{}},t=Object.getOwnPropertyDescriptor;if(t)try{t({},"")}catch{t=null}var s=function(){throw new c},d=t?function(){try{return arguments.callee,s}catch{try{return t(arguments,"callee").get}catch{return s}}}():s,g=requireHasSymbols()(),M=requireHasProto()(),q=Object.getPrototypeOf||(M?function(p){return p.__proto__}:null),T={},I=typeof Uint8Array>"u"||!q?y:q(Uint8Array),P={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?y:ArrayBuffer,"%ArrayIteratorPrototype%":g&&q?q([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":T,"%AsyncGenerator%":T,"%AsyncGeneratorFunction%":T,"%AsyncIteratorPrototype%":T,"%Atomics%":typeof Atomics>"u"?y:Atomics,"%BigInt%":typeof BigInt>"u"?y:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?y:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":m,"%eval%":eval,"%EvalError%":E,"%Float32Array%":typeof Float32Array>"u"?y:Float32Array,"%Float64Array%":typeof Float64Array>"u"?y:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?y:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":T,"%Int8Array%":typeof Int8Array>"u"?y:Int8Array,"%Int16Array%":typeof Int16Array>"u"?y:Int16Array,"%Int32Array%":typeof Int32Array>"u"?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":g&&q?q(q([][Symbol.iterator]())):y,"%JSON%":typeof JSON=="object"?JSON:y,"%Map%":typeof Map>"u"?y:Map,"%MapIteratorPrototype%":typeof Map>"u"||!g||!q?y:q(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?y:Promise,"%Proxy%":typeof Proxy>"u"?y:Proxy,"%RangeError%":v,"%ReferenceError%":B,"%Reflect%":typeof Reflect>"u"?y:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?y:Set,"%SetIteratorPrototype%":typeof Set>"u"||!g||!q?y:q(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":g&&q?q(""[Symbol.iterator]()):y,"%Symbol%":g?Symbol:y,"%SyntaxError%":r,"%ThrowTypeError%":d,"%TypedArray%":I,"%TypeError%":c,"%Uint8Array%":typeof Uint8Array>"u"?y:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?y:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?y:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?y:Uint32Array,"%URIError%":h,"%WeakMap%":typeof WeakMap>"u"?y:WeakMap,"%WeakRef%":typeof WeakRef>"u"?y:WeakRef,"%WeakSet%":typeof WeakSet>"u"?y:WeakSet};if(q)try{null.error}catch(p){var N=q(q(p));P["%Error.prototype%"]=N}var O=function p(w){var S;if(w==="%AsyncFunction%")S=u("async function () {}");else if(w==="%GeneratorFunction%")S=u("function* () {}");else if(w==="%AsyncGeneratorFunction%")S=u("async function* () {}");else if(w==="%AsyncGenerator%"){var b=p("%AsyncGeneratorFunction%");b&&(S=b.prototype)}else if(w==="%AsyncIteratorPrototype%"){var x=p("%AsyncGenerator%");x&&q&&(S=q(x.prototype))}return P[w]=S,S},G={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_for