{"size": 371110, "ext": "js", "max_stars_repo_path": "node_modules/@chainsafe/libp2p-noise/dist/index.min.js", "max_stars_repo_name": "oscariia/bizbeast-dapp-test-3", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/@chainsafe/libp2p-noise/dist/index.min.js", "max_issues_repo_name": "oscariia/bizbeast-dapp-test-3", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/@chainsafe/libp2p-noise/dist/index.min.js", "max_forks_repo_name": "oscariia/bizbeast-dapp-test-3", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 6185.1666666667, "max_line_length": 105740, "alphanum_fraction": 0.6902023659}
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ChainsafeLibp2pNoise = factory()}(typeof self !== 'undefined' ? self : this, function () {
var ChainsafeLibp2pNoise=(()=>{var I1=Object.create,Qi=Object.defineProperty,T1=Object.getPrototypeOf,P1=Object.prototype.hasOwnProperty,K1=Object.getOwnPropertyNames,L1=Object.getOwnPropertyDescriptor;var R1=t=>Qi(t,"__esModule",{value:!0});var z=(t,e)=>()=>(t&&(e=t(t=0)),e),S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ee=(t,e)=>{for(var r in e)Qi(t,r,{get:e[r],enumerable:!0})},k1=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K1(e))!P1.call(t,n)&&n!=="default"&&Qi(t,n,{get:()=>e[n],enumerable:!(r=L1(e,n))||r.enumerable});return t},Se=t=>k1(R1(Qi(t!=null?I1(T1(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var uc=S(Ji=>{l();"use strict";Ji.byteLength=D1;Ji.toByteArray=N1;Ji.fromByteArray=U1;var It=[],pt=[],F1=typeof Uint8Array!="undefined"?Uint8Array:Array,Ua="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var ln=0,M1=Ua.length;ln<M1;++ln)It[ln]=Ua[ln],pt[Ua.charCodeAt(ln)]=ln;pt["-".charCodeAt(0)]=62;pt["_".charCodeAt(0)]=63;function fc(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function D1(t){var e=fc(t),r=e[0],n=e[1];return(r+n)*3/4-n}function O1(t,e,r){return(e+r)*3/4-r}function N1(t){var e,r=fc(t),n=r[0],i=r[1],s=new F1(O1(t,n,i)),a=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)e=pt[t.charCodeAt(c)]<<18|pt[t.charCodeAt(c+1)]<<12|pt[t.charCodeAt(c+2)]<<6|pt[t.charCodeAt(c+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e=pt[t.charCodeAt(c)]<<2|pt[t.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=pt[t.charCodeAt(c)]<<10|pt[t.charCodeAt(c+1)]<<4|pt[t.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function q1(t){return It[t>>18&63]+It[t>>12&63]+It[t>>6&63]+It[t&63]}function H1(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(q1(n));return i.join("")}function U1(t){for(var e,r=t.length,n=r%3,i=[],s=16383,a=0,o=r-n;a<o;a+=s)i.push(H1(t,a,a+s>o?o:a+s));return n===1?(e=t[r-1],i.push(It[e>>2]+It[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(It[e>>10]+It[e>>4&63]+It[e<<2&63]+"=")),i.join("")}});var hc=S(Fa=>{l();Fa.read=function(t,e,r,n,i){var s,a,o=i*8-n-1,c=(1<<o)-1,f=c>>1,u=-7,h=r?i-1:0,p=r?-1:1,y=t[e+h];for(h+=p,s=y&(1<<-u)-1,y>>=-u,u+=o;u>0;s=s*256+t[e+h],h+=p,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=n;u>0;a=a*256+t[e+h],h+=p,u-=8);if(s===0)s=1-f;else{if(s===c)return a?NaN:(y?-1:1)*Infinity;a=a+Math.pow(2,n),s=s-f}return(y?-1:1)*a*Math.pow(2,s-n)};Fa.write=function(t,e,r,n,i,s){var a,o,c,f=s*8-i-1,u=(1<<f)-1,h=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,d=n?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===Infinity?(o=isNaN(e)?1:0,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+h>=1?e+=p/c:e+=p*Math.pow(2,1-h),e*c>=2&&(a++,c/=2),a+h>=u?(o=0,a=u):a+h>=1?(o=(e*c-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=o&255,y+=d,o/=256,i-=8);for(a=a<<i|o,f+=i;f>0;t[r+y]=a&255,y+=d,a/=256,f-=8);t[r+y-d]|=g*128}});var _e=S(pn=>{l();"use strict";var Ma=uc(),dn=hc(),lc=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;pn.Buffer=B;pn.SlowBuffer=V1;pn.INSPECT_MAX_BYTES=50;var es=2147483647;pn.kMaxLength=es;B.TYPED_ARRAY_SUPPORT=z1();!B.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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 z1(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(B.prototype,"parent",{enumerable:!0,get:function(){if(!!B.isBuffer(this))return this.buffer}});Object.defineProperty(B.prototype,"offset",{enumerable:!0,get:function(){if(!!B.isBuffer(this))return this.byteOffset}});function Qt(t){if(t>es)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,B.prototype),e}function B(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Oa(t)}return pc(t,e,r)}B.poolSize=8192;function pc(t,e,r){if(typeof t=="string")return G1(t,e);if(ArrayBuffer.isView(t))return W1(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Tt(t,ArrayBuffer)||t&&Tt(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Tt(t,SharedArrayBuffer)||t&&Tt(t.buffer,SharedArrayBuffer)))return qa(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return B.from(n,e,r);let i=j1(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return B.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}B.from=function(t,e,r){return pc(t,e,r)};Object.setPrototypeOf(B.prototype,Uint8Array.prototype);Object.setPrototypeOf(B,Uint8Array);function dc(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function $1(t,e,r){return dc(t),t<=0?Qt(t):e!==void 0?typeof r=="string"?Qt(t).fill(e,r):Qt(t).fill(e):Qt(t)}B.alloc=function(t,e,r){return $1(t,e,r)};function Oa(t){return dc(t),Qt(t<0?0:Ha(t)|0)}B.allocUnsafe=function(t){return Oa(t)};B.allocUnsafeSlow=function(t){return Oa(t)};function G1(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!B.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=yc(t,e)|0,n=Qt(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Va(t){let e=t.length<0?0:Ha(t.length)|0,r=Qt(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function W1(t){if(Tt(t,Uint8Array)){let e=new Uint8Array(t);return qa(e.buffer,e.byteOffset,e.byteLength)}return Va(t)}function qa(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,B.prototype),n}function j1(t){if(B.isBuffer(t)){let e=Ha(t.length)|0,r=Qt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||za(t.length)?Qt(0):Va(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Va(t.data)}function Ha(t){if(t>=es)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+es.toString(16)+" bytes");return t|0}function V1(t){return+t!=t&&(t=0),B.alloc(+t)}B.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==B.prototype};B.compare=function(e,r){if(Tt(e,Uint8Array)&&(e=B.from(e,e.offset,e.byteLength)),Tt(r,Uint8Array)&&(r=B.from(r,r.offset,r.byteLength)),!B.isBuffer(e)||!B.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,a=Math.min(n,i);s<a;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};B.isEncoding=function(e){switch(String(e).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}};B.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return B.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=B.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let a=e[n];if(Tt(a,Uint8Array))s+a.length>i.length?(B.isBuffer(a)||(a=B.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(B.isBuffer(a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return i};function yc(t,e){if(B.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Tt(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Ga(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return gc(t).length;default:if(i)return n?-1:Ga(t).length;e=(""+e).toLowerCase(),i=!0}}B.byteLength=yc;function eg(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Q1(this,e,r);case"utf8":case"utf-8":return xc(this,e,r);case"ascii":return Y1(this,e,r);case"latin1":case"binary":return Z1(this,e,r);case"base64":return X1(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return J1(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}B.prototype._isBuffer=!0;function zr(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}B.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)zr(this,r,r+1);return this};B.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)zr(this,r,r+3),zr(this,r+1,r+2);return this};B.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)zr(this,r,r+7),zr(this,r+1,r+6),zr(this,r+2,r+5),zr(this,r+3,r+4);return this};B.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?xc(this,0,e):eg.apply(this,arguments)};B.prototype.toLocaleString=B.prototype.toString;B.prototype.equals=function(e){if(!B.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:B.compare(this,e)===0};B.prototype.inspect=function(){let e="",r=pn.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};lc&&(B.prototype[lc]=B.prototype.inspect);B.prototype.compare=function(e,r,n,i,s){if(Tt(e,Uint8Array)&&(e=B.from(e,e.offset,e.byteLength)),!B.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let a=s-i,o=n-r,c=Math.min(a,o),f=this.slice(i,s),u=e.slice(r,n);for(let h=0;h<c;++h)if(f[h]!==u[h]){a=f[h],o=u[h];break}return a<o?-1:o<a?1:0};function bc(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,za(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=B.from(e,n)),B.isBuffer(e))return e.length===0?-1:vc(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):vc(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function vc(t,e,r,n,i){let s=1,a=t.length,o=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function c(u,h){return s===1?u[h]:u.readUInt16BE(h*s)}let f;if(i){let u=-1;for(f=r;f<a;f++)if(c(t,f)===c(e,u===-1?0:f-u)){if(u===-1&&(u=f),f-u+1===o)return u*s}else u!==-1&&(f-=f-u),u=-1}else for(r+o>a&&(r=a-o),f=r;f>=0;f--){let u=!0;for(let h=0;h<o;h++)if(c(t,f+h)!==c(e,h)){u=!1;break}if(u)return f}return-1}B.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};B.prototype.indexOf=function(e,r,n){return bc(this,e,r,n,!0)};B.prototype.lastIndexOf=function(e,r,n){return bc(this,e,r,n,!1)};function tg(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let a;for(a=0;a<n;++a){let o=parseInt(e.substr(a*2,2),16);if(za(o))return a;t[r+a]=o}return a}function rg(t,e,r,n){return ts(Ga(e,t.length-r),t,r,n)}function ig(t,e,r,n){return ts(ng(e),t,r,n)}function sg(t,e,r,n){return ts(gc(e),t,r,n)}function og(t,e,r,n){return ts(ag(e,t.length-r),t,r,n)}B.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"hex":return tg(this,e,r,n);case"utf8":case"utf-8":return rg(this,e,r,n);case"ascii":case"latin1":case"binary":return ig(this,e,r,n);case"base64":return sg(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return og(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}};B.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function X1(t,e,r){return e===0&&r===t.length?Ma.fromByteArray(t):Ma.fromByteArray(t.slice(e,r))}function xc(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],a=null,o=s>239?4:s>223?3:s>191?2:1;if(i+o<=r){let c,f,u,h;switch(o){case 1:s<128&&(a=s);break;case 2:c=t[i+1],(c&192)==128&&(h=(s&31)<<6|c&63,h>127&&(a=h));break;case 3:c=t[i+1],f=t[i+2],(c&192)==128&&(f&192)==128&&(h=(s&15)<<12|(c&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(a=h));break;case 4:c=t[i+1],f=t[i+2],u=t[i+3],(c&192)==128&&(f&192)==128&&(u&192)==128&&(h=(s&15)<<18|(c&63)<<12|(f&63)<<6|u&63,h>65535&&h<1114112&&(a=h))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),i+=o}return cg(n)}var mc=4096;function cg(t){let e=t.length;if(e<=mc)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=mc));return r}function Y1(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Z1(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Q1(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=fg[t[s]];return i}function J1(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}B.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,B.prototype),i};function De(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}B.prototype.readUintLE=B.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||De(e,r,this.length);let i=this[e],s=1,a=0;for(;++a<r&&(s*=256);)i+=this[e+a]*s;return i};B.prototype.readUintBE=B.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||De(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};B.prototype.readUint8=B.prototype.readUInt8=function(e,r){return e=e>>>0,r||De(e,1,this.length),this[e]};B.prototype.readUint16LE=B.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||De(e,2,this.length),this[e]|this[e+1]<<8};B.prototype.readUint16BE=B.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||De(e,2,this.length),this[e]<<8|this[e+1]};B.prototype.readUint32LE=B.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||De(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};B.prototype.readUint32BE=B.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||De(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};B.prototype.readBigUInt64LE=lr(function(e){e=e>>>0,yn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&$n(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});B.prototype.readBigUInt64BE=lr(function(e){e=e>>>0,yn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&$n(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});B.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||De(e,r,this.length);let i=this[e],s=1,a=0;for(;++a<r&&(s*=256);)i+=this[e+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};B.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||De(e,r,this.length);let i=r,s=1,a=this[e+--i];for(;i>0&&(s*=256);)a+=this[e+--i]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};B.prototype.readInt8=function(e,r){return e=e>>>0,r||De(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};B.prototype.readInt16LE=function(e,r){e=e>>>0,r||De(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};B.prototype.readInt16BE=function(e,r){e=e>>>0,r||De(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};B.prototype.readInt32LE=function(e,r){return e=e>>>0,r||De(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};B.prototype.readInt32BE=function(e,r){return e=e>>>0,r||De(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};B.prototype.readBigInt64LE=lr(function(e){e=e>>>0,yn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&$n(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});B.prototype.readBigInt64BE=lr(function(e){e=e>>>0,yn(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&$n(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});B.prototype.readFloatLE=function(e,r){return e=e>>>0,r||De(e,4,this.length),dn.read(this,e,!0,23,4)};B.prototype.readFloatBE=function(e,r){return e=e>>>0,r||De(e,4,this.length),dn.read(this,e,!1,23,4)};B.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||De(e,8,this.length),dn.read(this,e,!0,52,8)};B.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||De(e,8,this.length),dn.read(this,e,!1,52,8)};function at(t,e,r,n,i,s){if(!B.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}B.prototype.writeUintLE=B.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;at(this,e,r,n,o,0)}let s=1,a=0;for(this[r]=e&255;++a<n&&(s*=256);)this[r+a]=e/s&255;return r+n};B.prototype.writeUintBE=B.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let o=Math.pow(2,8*n)-1;at(this,e,r,n,o,0)}let s=n-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+n};B.prototype.writeUint8=B.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,1,255,0),this[r]=e&255,r+1};B.prototype.writeUint16LE=B.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};B.prototype.writeUint16BE=B.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};B.prototype.writeUint32LE=B.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};B.prototype.writeUint32BE=B.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Ec(t,e,r,n,i){wc(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function Sc(t,e,r,n,i){wc(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}B.prototype.writeBigUInt64LE=lr(function(e,r=0){return Ec(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});B.prototype.writeBigUInt64BE=lr(function(e,r=0){return Sc(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});B.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let c=Math.pow(2,8*n-1);at(this,e,r,n,c-1,-c)}let s=0,a=1,o=0;for(this[r]=e&255;++s<n&&(a*=256);)e<0&&o===0&&this[r+s-1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+n};B.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let c=Math.pow(2,8*n-1);at(this,e,r,n,c-1,-c)}let s=n-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+n};B.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};B.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};B.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};B.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};B.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||at(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};B.prototype.writeBigInt64LE=lr(function(e,r=0){return Ec(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});B.prototype.writeBigInt64BE=lr(function(e,r=0){return Sc(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Bc(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _c(t,e,r,n,i){return e=+e,r=r>>>0,i||Bc(t,e,r,4,34028234663852886e22,-34028234663852886e22),dn.write(t,e,r,n,23,4),r+4}B.prototype.writeFloatLE=function(e,r,n){return _c(this,e,r,!0,n)};B.prototype.writeFloatBE=function(e,r,n){return _c(this,e,r,!1,n)};function Ac(t,e,r,n,i){return e=+e,r=r>>>0,i||Bc(t,e,r,8,17976931348623157e292,-17976931348623157e292),dn.write(t,e,r,n,52,8),r+8}B.prototype.writeDoubleLE=function(e,r,n){return Ac(this,e,r,!0,n)};B.prototype.writeDoubleBE=function(e,r,n){return Ac(this,e,r,!1,n)};B.prototype.copy=function(e,r,n,i){if(!B.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};B.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!B.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let a=e.charCodeAt(0);(i==="utf8"&&a<128||i==="latin1")&&(e=a)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let a=B.isBuffer(e)?e:B.from(e,i),o=a.length;if(o===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=a[s%o]}return this};var gn={};function Wa(t,e,r){gn[t]=class extends r{constructor(){super();Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Wa("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Wa("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Wa("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Cc(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Cc(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Cc(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function ug(t,e,r){yn(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&$n(e,t.length-(r+1))}function wc(t,e,r,n,i,s){if(t>r||t<e){let a=typeof e=="bigint"?"n":"",o;throw s>3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new gn.ERR_OUT_OF_RANGE("value",o,t)}ug(n,i,s)}function yn(t,e){if(typeof t!="number")throw new gn.ERR_INVALID_ARG_TYPE(e,"number",t)}function $n(t,e,r){throw Math.floor(t)!==t?(yn(t,r),new gn.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new gn.ERR_BUFFER_OUT_OF_BOUNDS:new gn.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var hg=/[^+/0-9A-Za-z-_]/g;function lg(t){if(t=t.split("=")[0],t=t.trim().replace(hg,""),t.length<2)return"";for(;t.length%4!=0;)t=t+"=";return t}function Ga(t,e){e=e||Infinity;let r,n=t.length,i=null,s=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ng(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ag(t,e){let r,n,i,s=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function gc(t){return Ma.toByteArray(lg(t))}function ts(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Tt(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function za(t){return t!==t}var fg=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function lr(t){return typeof BigInt=="undefined"?pg:t}function pg(){throw new Error("BigInt not supported")}});var Buffer,l=z(()=>{({Buffer}=_e())});var Tc=S(ja=>{l();"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Ic=65536,dg=function(){function t(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self!="undefined"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return t.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var r=new Uint8Array(e),n=0;n<r.length;n+=Ic)this._crypto.getRandomValues(r.subarray(n,n+Math.min(r.length-n,Ic)));return r},t}();ja.BrowserRandomSource=dg});var Pt=S($a=>{l();"use strict";Object.defineProperty($a,"__esModule",{value:!0});function yg(t){for(var e=0;e<t.length;e++)t[e]=0;return t}$a.wipe=yg});var Gr=S(()=>{l()});var Pc=S(Xa=>{l();"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var gg=Pt(),xg=function(){function t(){this.isAvailable=!1,this.isInstantiated=!1;var e=Gr();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return t.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var n=new Uint8Array(e),i=0;i<n.length;i++)n[i]=r[i];return gg.wipe(r),n},t}();Xa.NodeRandomSource=xg});var Kc=S(Ya=>{l();"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var vg=Tc(),bg=Pc(),mg=function(){function t(){if(this.isAvailable=!1,this.name="",this._source=new vg.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new bg.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return t.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},t}();Ya.SystemRandomSource=mg});var Lc=S(ut=>{l();"use strict";Object.defineProperty(ut,"__esModule",{value:!0});function wg(t,e){var r=t>>>16&65535,n=t&65535,i=e>>>16&65535,s=e&65535;return n*s+(r*s+n*i<<16>>>0)|0}ut.mul=Math.imul||wg;function Eg(t,e){return t+e|0}ut.add=Eg;function Sg(t,e){return t-e|0}ut.sub=Sg;function Bg(t,e){return t<<e|t>>>32-e}ut.rotl=Bg;function _g(t,e){return t<<32-e|t>>>e}ut.rotr=_g;function Ag(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t}ut.isInteger=Number.isInteger||Ag;ut.MAX_SAFE_INTEGER=9007199254740991;ut.isSafeInteger=function(t){return ut.isInteger(t)&&t>=-ut.MAX_SAFE_INTEGER&&t<=ut.MAX_SAFE_INTEGER}});var Xn=S(Z=>{l();"use strict";Object.defineProperty(Z,"__esModule",{value:!0});var Rc=Lc();function Cg(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}Z.readInt16BE=Cg;function Ig(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}Z.readUint16BE=Ig;function Tg(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}Z.readInt16LE=Tg;function Pg(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}Z.readUint16LE=Pg;function kc(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}Z.writeUint16BE=kc;Z.writeInt16BE=kc;function Dc(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}Z.writeUint16LE=Dc;Z.writeInt16LE=Dc;function Za(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}Z.readInt32BE=Za;function Qa(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}Z.readUint32BE=Qa;function Ja(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}Z.readInt32LE=Ja;function eo(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}Z.readUint32LE=eo;function rs(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}Z.writeUint32BE=rs;Z.writeInt32BE=rs;function ns(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}Z.writeUint32LE=ns;Z.writeInt32LE=ns;function Kg(t,e){e===void 0&&(e=0);var r=Za(t,e),n=Za(t,e+4);return r*4294967296+n-(n>>31)*4294967296}Z.readInt64BE=Kg;function Lg(t,e){e===void 0&&(e=0);var r=Qa(t,e),n=Qa(t,e+4);return r*4294967296+n}Z.readUint64BE=Lg;function Rg(t,e){e===void 0&&(e=0);var r=Ja(t,e),n=Ja(t,e+4);return n*4294967296+r-(r>>31)*4294967296}Z.readInt64LE=Rg;function kg(t,e){e===void 0&&(e=0);var r=eo(t,e),n=eo(t,e+4);return n*4294967296+r}Z.readUint64LE=kg;function Nc(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),rs(t/4294967296>>>0,e,r),rs(t>>>0,e,r+4),e}Z.writeUint64BE=Nc;Z.writeInt64BE=Nc;function Uc(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),ns(t>>>0,e,r),ns(t/4294967296>>>0,e,r+4),e}Z.writeUint64LE=Uc;Z.writeInt64LE=Uc;function Dg(t,e,r){if(r===void 0&&(r=0),t%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=t/8+r-1;s>=r;s--)n+=e[s]*i,i*=256;return n}Z.readUintBE=Dg;function Ng(t,e,r){if(r===void 0&&(r=0),t%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=r;s<r+t/8;s++)n+=e[s]*i,i*=256;return n}Z.readUintLE=Ng;function Ug(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!=0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Rc.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=t/8+n-1;s>=n;s--)r[s]=e/i&255,i*=256;return r}Z.writeUintBE=Ug;function Fg(t,e,r,n){if(r===void 0&&(r=new Uint8Array(t/8)),n===void 0&&(n=0),t%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Rc.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+t/8;s++)r[s]=e/i&255,i*=256;return r}Z.writeUintLE=Fg;function Mg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}Z.readFloat32BE=Mg;function Og(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}Z.readFloat32LE=Og;function qg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}Z.readFloat64BE=qg;function Hg(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}Z.readFloat64LE=Hg;function Vg(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t),e}Z.writeFloat32BE=Vg;function zg(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(r,t,!0),e}Z.writeFloat32LE=zg;function Gg(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t),e}Z.writeFloat64BE=Gg;function Wg(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(r,t,!0),e}Z.writeFloat64LE=Wg});var qc=S(St=>{l();"use strict";Object.defineProperty(St,"__esModule",{value:!0});var jg=Kc(),$g=Xn(),Fc=Pt();St.defaultRandomSource=new jg.SystemRandomSource;function to(t,e){return e===void 0&&(e=St.defaultRandomSource),e.randomBytes(t)}St.randomBytes=to;function Xg(t){t===void 0&&(t=St.defaultRandomSource);var e=to(4,t),r=$g.readUint32LE(e);return Fc.wipe(e),r}St.randomUint32=Xg;var Mc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function Oc(t,e,r){if(e===void 0&&(e=Mc),r===void 0&&(r=St.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var n="",i=e.length,s=256-256%i;t>0;){for(var a=to(Math.ceil(t*256/s),r),o=0;o<a.length&&t>0;o++){var c=a[o];c<s&&(n+=e.charAt(c%i),t--)}Fc.wipe(a)}return n}St.randomString=Oc;function Yg(t,e,r){e===void 0&&(e=Mc),r===void 0&&(r=St.defaultRandomSource);var n=Math.ceil(t/(Math.log(e.length)/Math.LN2));return Oc(n,e,r)}St.randomStringForEntropy=Yg});var as=S(ot=>{l();"use strict";Object.defineProperty(ot,"__esModule",{value:!0});var Zg=qc(),Qg=Pt();ot.PUBLIC_KEY_LENGTH=32;ot.SECRET_KEY_LENGTH=32;ot.SHARED_KEY_LENGTH=32;function Kt(t){var e=new Float64Array(16);if(t)for(var r=0;r<t.length;r++)e[r]=t[r];return e}var Hc=new Uint8Array(32);Hc[0]=9;var Jg=Kt([56129,1]);function ro(t){for(var e=1,r=0;r<16;r++){var n=t[r]+e+65535;e=Math.floor(n/65536),t[r]=n-e*65536}t[0]+=e-1+37*(e-1)}function Yn(t,e,r){for(var n=~(r-1),i=0;i<16;i++){var s=n&(t[i]^e[i]);t[i]^=s,e[i]^=s}}function e2(t,e){for(var r=Kt(),n=Kt(),i=0;i<16;i++)n[i]=e[i];ro(n),ro(n),ro(n);for(var s=0;s<2;s++){r[0]=n[0]-65517;for(var i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,Yn(n,r,1-a)}for(var i=0;i<16;i++)t[2*i]=n[i]&255,t[2*i+1]=n[i]>>8}function t2(t,e){for(var r=0;r<16;r++)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}function is(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]+r[n]}function ss(t,e,r){for(var n=0;n<16;n++)t[n]=e[n]-r[n]}function Jt(t,e,r){var n,i,s=0,a=0,o=0,c=0,f=0,u=0,h=0,p=0,y=0,d=0,g=0,v=0,b=0,w=0,E=0,T=0,A=0,C=0,L=0,k=0,F=0,q=0,X=0,j=0,ne=0,ge=0,O=0,V=0,I=0,H=0,be=0,J=r[0],ee=r[1],te=r[2],ae=r[3],oe=r[4],ce=r[5],fe=r[6],ue=r[7],ze=r[8],Ge=r[9],We=r[10],je=r[11],$e=r[12],Xe=r[13],Ye=r[14],Ze=r[15];n=e[0],s+=n*J,a+=n*ee,o+=n*te,c+=n*ae,f+=n*oe,u+=n*ce,h+=n*fe,p+=n*ue,y+=n*ze,d+=n*Ge,g+=n*We,v+=n*je,b+=n*$e,w+=n*Xe,E+=n*Ye,T+=n*Ze,n=e[1],a+=n*J,o+=n*ee,c+=n*te,f+=n*ae,u+=n*oe,h+=n*ce,p+=n*fe,y+=n*ue,d+=n*ze,g+=n*Ge,v+=n*We,b+=n*je,w+=n*$e,E+=n*Xe,T+=n*Ye,A+=n*Ze,n=e[2],o+=n*J,c+=n*ee,f+=n*te,u+=n*ae,h+=n*oe,p+=n*ce,y+=n*fe,d+=n*ue,g+=n*ze,v+=n*Ge,b+=n*We,w+=n*je,E+=n*$e,T+=n*Xe,A+=n*Ye,C+=n*Ze,n=e[3],c+=n*J,f+=n*ee,u+=n*te,h+=n*ae,p+=n*oe,y+=n*ce,d+=n*fe,g+=n*ue,v+=n*ze,b+=n*Ge,w+=n*We,E+=n*je,T+=n*$e,A+=n*Xe,C+=n*Ye,L+=n*Ze,n=e[4],f+=n*J,u+=n*ee,h+=n*te,p+=n*ae,y+=n*oe,d+=n*ce,g+=n*fe,v+=n*ue,b+=n*ze,w+=n*Ge,E+=n*We,T+=n*je,A+=n*$e,C+=n*Xe,L+=n*Ye,k+=n*Ze,n=e[5],u+=n*J,h+=n*ee,p+=n*te,y+=n*ae,d+=n*oe,g+=n*ce,v+=n*fe,b+=n*ue,w+=n*ze,E+=n*Ge,T+=n*We,A+=n*je,C+=n*$e,L+=n*Xe,k+=n*Ye,F+=n*Ze,n=e[6],h+=n*J,p+=n*ee,y+=n*te,d+=n*ae,g+=n*oe,v+=n*ce,b+=n*fe,w+=n*ue,E+=n*ze,T+=n*Ge,A+=n*We,C+=n*je,L+=n*$e,k+=n*Xe,F+=n*Ye,q+=n*Ze,n=e[7],p+=n*J,y+=n*ee,d+=n*te,g+=n*ae,v+=n*oe,b+=n*ce,w+=n*fe,E+=n*ue,T+=n*ze,A+=n*Ge,C+=n*We,L+=n*je,k+=n*$e,F+=n*Xe,q+=n*Ye,X+=n*Ze,n=e[8],y+=n*J,d+=n*ee,g+=n*te,v+=n*ae,b+=n*oe,w+=n*ce,E+=n*fe,T+=n*ue,A+=n*ze,C+=n*Ge,L+=n*We,k+=n*je,F+=n*$e,q+=n*Xe,X+=n*Ye,j+=n*Ze,n=e[9],d+=n*J,g+=n*ee,v+=n*te,b+=n*ae,w+=n*oe,E+=n*ce,T+=n*fe,A+=n*ue,C+=n*ze,L+=n*Ge,k+=n*We,F+=n*je,q+=n*$e,X+=n*Xe,j+=n*Ye,ne+=n*Ze,n=e[10],g+=n*J,v+=n*ee,b+=n*te,w+=n*ae,E+=n*oe,T+=n*ce,A+=n*fe,C+=n*ue,L+=n*ze,k+=n*Ge,F+=n*We,q+=n*je,X+=n*$e,j+=n*Xe,ne+=n*Ye,ge+=n*Ze,n=e[11],v+=n*J,b+=n*ee,w+=n*te,E+=n*ae,T+=n*oe,A+=n*ce,C+=n*fe,L+=n*ue,k+=n*ze,F+=n*Ge,q+=n*We,X+=n*je,j+=n*$e,ne+=n*Xe,ge+=n*Ye,O+=n*Ze,n=e[12],b+=n*J,w+=n*ee,E+=n*te,T+=n*ae,A+=n*oe,C+=n*ce,L+=n*fe,k+=n*ue,F+=n*ze,q+=n*Ge,X+=n*We,j+=n*je,ne+=n*$e,ge+=n*Xe,O+=n*Ye,V+=n*Ze,n=e[13],w+=n*J,E+=n*ee,T+=n*te,A+=n*ae,C+=n*oe,L+=n*ce,k+=n*fe,F+=n*ue,q+=n*ze,X+=n*Ge,j+=n*We,ne+=n*je,ge+=n*$e,O+=n*Xe,V+=n*Ye,I+=n*Ze,n=e[14],E+=n*J,T+=n*ee,A+=n*te,C+=n*ae,L+=n*oe,k+=n*ce,F+=n*fe,q+=n*ue,X+=n*ze,j+=n*Ge,ne+=n*We,ge+=n*je,O+=n*$e,V+=n*Xe,I+=n*Ye,H+=n*Ze,n=e[15],T+=n*J,A+=n*ee,C+=n*te,L+=n*ae,k+=n*oe,F+=n*ce,q+=n*fe,X+=n*ue,j+=n*ze,ne+=n*Ge,ge+=n*We,O+=n*je,V+=n*$e,I+=n*Xe,H+=n*Ye,be+=n*Ze,s+=38*A,a+=38*C,o+=38*L,c+=38*k,f+=38*F,u+=38*q,h+=38*X,p+=38*j,y+=38*ne,d+=38*ge,g+=38*O,v+=38*V,b+=38*I,w+=38*H,E+=38*be,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=u+i+65535,i=Math.floor(n/65536),u=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=p+i+65535,i=Math.floor(n/65536),p=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=g+i+65535,i=Math.floor(n/65536),g=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=b+i+65535,i=Math.floor(n/65536),b=n-i*65536,n=w+i+65535,i=Math.floor(n/65536),w=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=T+i+65535,i=Math.floor(n/65536),T=n-i*65536,s+=i-1+37*(i-1),t[0]=s,t[1]=a,t[2]=o,t[3]=c,t[4]=f,t[5]=u,t[6]=h,t[7]=p,t[8]=y,t[9]=d,t[10]=g,t[11]=v,t[12]=b,t[13]=w,t[14]=E,t[15]=T}function Zn(t,e){Jt(t,e,e)}function r2(t,e){for(var r=Kt(),n=0;n<16;n++)r[n]=e[n];for(var n=253;n>=0;n--)Zn(r,r),n!==2&&n!==4&&Jt(r,r,e);for(var n=0;n<16;n++)t[n]=r[n]}function no(t,e){for(var r=new Uint8Array(32),n=new Float64Array(80),i=Kt(),s=Kt(),a=Kt(),o=Kt(),c=Kt(),f=Kt(),u=0;u<31;u++)r[u]=t[u];r[31]=t[31]&127|64,r[0]&=248,t2(n,e);for(var u=0;u<16;u++)s[u]=n[u];i[0]=o[0]=1;for(var u=254;u>=0;--u){var h=r[u>>>3]>>>(u&7)&1;Yn(i,s,h),Yn(a,o,h),is(c,i,a),ss(i,i,a),is(a,s,o),ss(s,s,o),Zn(o,c),Zn(f,i),Jt(i,a,i),Jt(a,s,c),is(c,i,a),ss(i,i,a),Zn(s,i),ss(a,o,f),Jt(i,a,Jg),is(i,i,o),Jt(a,a,i),Jt(i,o,f),Jt(o,s,n),Zn(s,c),Yn(i,s,h),Yn(a,o,h)}for(var u=0;u<16;u++)n[u+16]=i[u],n[u+32]=a[u],n[u+48]=s[u],n[u+64]=o[u];var p=n.subarray(32),y=n.subarray(16);r2(p,p),Jt(y,y,p);var d=new Uint8Array(32);return e2(d,y),d}ot.scalarMult=no;function Vc(t){return no(t,Hc)}ot.scalarMultBase=Vc;function zc(t){if(t.length!==ot.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+ot.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(t),r=Vc(e);return{publicKey:r,secretKey:e}}ot.generateKeyPairFromSeed=zc;function n2(t){var e=Zg.randomBytes(32,t),r=zc(e);return Qg.wipe(e),r}ot.generateKeyPair=n2;function i2(t,e,r){if(r===void 0&&(r=!1),t.length!==ot.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==ot.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var n=no(t,e);if(r){for(var i=0,s=0;s<n.length;s++)i|=n[s];if(i===0)throw new Error("X25519: invalid shared key")}return n}ot.sharedKey=i2});var Wc=S((lE,Gc)=>{l();Gc.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}});var Wr=S((pE,jc)=>{l();"use strict";var{Buffer:Bt}=_e(),$c=Symbol.for("BufferList");function me(t){if(!(this instanceof me))return new me(t);me._init.call(this,t)}me._init=function(e){Object.defineProperty(this,$c,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};me.prototype._new=function(e){return new me(e)};me.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let n=0;n<this._bufs.length;n++){let i=r+this._bufs[n].length;if(e<i||n===this._bufs.length-1)return[n,e-r];r=i}};me.prototype._reverseOffset=function(t){let e=t[0],r=t[1];for(let n=0;n<e;n++)r+=this._bufs[n].length;return r};me.prototype.get=function(e){if(e>this.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};me.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};me.prototype.copy=function(e,r,n,i){if((typeof n!="number"||n<0)&&(n=0),(typeof i!="number"||i>this.length)&&(i=this.length),n>=this.length||i<=0)return e||Bt.alloc(0);let s=!!e,a=this._offset(n),o=i-n,c=o,f=s&&r||0,u=a[1];if(n===0&&i===this.length){if(!s)return this._bufs.length===1?this._bufs[0]:Bt.concat(this._bufs,this.length);for(let h=0;h<this._bufs.length;h++)this._bufs[h].copy(e,f),f+=this._bufs[h].length;return e}if(c<=this._bufs[a[0]].length-u)return s?this._bufs[a[0]].copy(e,r,u,u+c):this._bufs[a[0]].slice(u,u+c);s||(e=Bt.allocUnsafe(o));for(let h=a[0];h<this._bufs.length;h++){let p=this._bufs[h].length-u;if(c>p)this._bufs[h].copy(e,f,u),f+=p;else{this._bufs[h].copy(e,f,u,u+c),f+=p;break}c-=p,u&&(u=0)}return e.length>f?e.slice(0,f):e};me.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let n=this._offset(e),i=this._offset(r),s=this._bufs.slice(n[0],i[0]+1);return i[1]===0?s.pop():s[s.length-1]=s[s.length-1].slice(0,i[1]),n[1]!==0&&(s[0]=s[0].slice(n[1])),this._new(s)};me.prototype.toString=function(e,r,n){return this.slice(r,n).toString(e)};me.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};me.prototype.duplicate=function(){let e=this._new();for(let r=0;r<this._bufs.length;r++)e.append(this._bufs[r]);return e};me.prototype.append=function(e){if(e==null)return this;if(e.buffer)this._appendBuffer(Bt.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let r=0;r<e.length;r++)this.append(e[r]);else if(this._isBufferList(e))for(let r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else typeof e=="number"&&(e=e.toString()),this._appendBuffer(Bt.from(e));return this};me.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length};me.prototype.indexOf=function(t,e,r){if(r===void 0&&typeof e=="string"&&(r=e,e=void 0),typeof t=="function"||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof t=="number"?t=Bt.from([t]):typeof t=="string"?t=Bt.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=Bt.from(t.buffer,t.byteOffset,t.byteLength):Bt.isBuffer(t)||(t=Bt.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),t.length===0)return e>this.length?this.length:e;let n=this._offset(e),i=n[0],s=n[1];for(;i<this._bufs.length;i++){let a=this._bufs[i];for(;s<a.length;)if(a.length-s>=t.length){let c=a.indexOf(t,s);if(c!==-1)return this._reverseOffset([i,c]);s=a.length-t.length+1}else{let c=this._reverseOffset([i,s]);if(this._match(c,t))return c;s++}s=0}return-1};me.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0};(function(){let t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let e in t)(function(r){t[r]===null?me.prototype[r]=function(n,i){return this.slice(n,n+i)[r](0,i)}:me.prototype[r]=function(n=0){return this.slice(n,n+t[r])[r](0)}})(e)})();me.prototype._isBufferList=function(e){return e instanceof me||me.isBufferList(e)};me.isBufferList=function(e){return e!=null&&e[$c]};jc.exports=me});var Yc=S((dE,Xc)=>{l();var io=Wr();Xc.exports=t=>{let e=async function*(){let r=yield,n=new io;for await(let i of t){if(!r){r=yield n.append(i),n=new io;continue}for(n.append(i);n.length>=r;){let s=n.shallowSlice(0,r);if(n.consume(r),r=yield s,!r){n.length&&(r=yield n,n=new io);break}}}if(r)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:n})}();return e.next(),e}});var Qc=S((gE,Zc)=>{l();Zc.exports=class{constructor(e){if(!(e>0)||(e-1&e)!=0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){let e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}}});var tf=S((vE,Jc)=>{l();var ef=Qc();Jc.exports=class{constructor(e){this.hwm=e||16,this.head=new ef(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){let r=this.head;this.head=r.next=new ef(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next){let r=this.tail.next;return this.tail.next=null,this.tail=r,this.tail.shift()}return e}isEmpty(){return this.head.isEmpty()}}});var nf=S((bE,rf)=>{l();var so=tf();rf.exports=t=>{t=t||{};let e;typeof t=="function"?(e=t,t={}):e=t.onEnd;let r=new so,n,i,s,a=()=>{if(!r.isEmpty()){if(t.writev){let g,v=[];for(;!r.isEmpty();){if(g=r.shift(),g.error)throw g.error;v.push(g.value)}return{done:g.done,value:v}}let d=r.shift();if(d.error)throw d.error;return d}return s?{done:!0}:new Promise((d,g)=>{i=v=>(i=null,v.error?g(v.error):t.writev&&!v.done?d({done:v.done,value:[v.value]}):d(v),n)})},o=d=>i?i(d):(r.push(d),n),c=d=>(r=new so,i?i({error:d}):(r.push({error:d}),n)),f=d=>s?n:o({done:!1,value:d}),u=d=>s?n:(s=!0,d?c(d):o({done:!0})),h=()=>(r=new so,u(),{done:!0}),p=d=>(u(d),{done:!0});if(n={[Symbol.asyncIterator](){return this},next:a,return:h,throw:p,push:f,end:u},!e)return n;let y=n;return n={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(d){return y.throw(d),e&&(e(d),e=null),{done:!0}},return(){return y.return(),e&&(e(),e=null),{done:!0}},push:f,end(d){return y.end(d),e&&(e(d),e=null),n}},n}});var af=S((mE,sf)=>{l();"use strict";var s2=()=>{let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t};sf.exports=s2});var cf=S((wE,of)=>{l();"use strict";var a2=Yc(),o2=nf(),c2=af();of.exports=t=>{let e=o2(),r=a2(t.source),n=c2(),i,s=t.sink(async function*(){yield*e,yield*await n.promise}());return s.catch(o=>{i=o}),{reader:r,writer:e,stream:{sink:o=>i?Promise.reject(i):(n.resolve(o),s),source:r},rest:()=>e.end(),write:e.push,read:async()=>(await r.next()).value}}});var hf=S((EE,ff)=>{l();ff.exports=ao;var uf=128,f2=127,u2=~f2,h2=Math.pow(2,31);function ao(t,e,r){if(Number.MAX_SAFE_INTEGER&&t>Number.MAX_SAFE_INTEGER)throw ao.bytes=0,new RangeError("Could not encode varint");e=e||[],r=r||0;for(var n=r;t>=h2;)e[r++]=t&255|uf,t/=128;for(;t&u2;)e[r++]=t&255|uf,t>>>=7;return e[r]=t|0,ao.bytes=r-n+1,e}});var df=S((SE,lf)=>{l();lf.exports=oo;var l2=128,pf=127;function oo(t,e){var r=0,e=e||0,n=0,i=e,s,a=t.length;do{if(i>=a||n>49)throw oo.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=n<28?(s&pf)<<n:(s&pf)*Math.pow(2,n),n+=7}while(s>=l2);return oo.bytes=i-e,r}});var gf=S((BE,yf)=>{l();var p2=Math.pow(2,7),d2=Math.pow(2,14),y2=Math.pow(2,21),g2=Math.pow(2,28),x2=Math.pow(2,35),v2=Math.pow(2,42),b2=Math.pow(2,49),m2=Math.pow(2,56),w2=Math.pow(2,63);yf.exports=function(t){return t<p2?1:t<d2?2:t<y2?3:t<g2?4:t<x2?5:t<v2?6:t<b2?7:t<m2?8:t<w2?9:10}});var Qn=S((_E,xf)=>{l();xf.exports={encode:hf(),decode:df(),encodingLength:gf()}});var co=S((AE,vf)=>{l();"use strict";var bf=Qn(),{Buffer:E2}=_e(),mf=(t,e,r)=>{let n=bf.encode(t,e,r);return mf.bytes=bf.encode.bytes,e||E2.from(n)};vf.exports=mf});var Af=S((CE,os)=>{l();"use strict";var{Buffer:wf}=_e(),Ef=Wr(),Sf=co(),fo=8,Bf=10*1024;function _f(t){t=t||{};let e=Math.max(t.poolSize||Bf,t.minPoolSize||fo),r=t.lengthEncoder||Sf;return async function*(i){let s=wf.alloc(e),a=0;for await(let o of i){r(o.length,s,a);let c=s.slice(a,a+r.bytes);a+=r.bytes,s.length-a<fo&&(s=wf.alloc(e),a=0),yield new Ef().append(c).append(o)}}}_f.single=(t,e)=>{e=e||{};let r=e.lengthEncoder||Sf;return new Ef([r(t.length),t.slice()])};os.exports=_f;os.exports.MIN_POOL_SIZE=fo;os.exports.DEFAULT_POOL_SIZE=Bf});var uo=S((IE,Cf)=>{l();"use strict";var If=Qn(),{Buffer:S2}=_e(),B2=t=>new Proxy({},{get:(e,r)=>r[0]==="l"?t[r]:t.get(parseInt(r))}),Tf=t=>{let e=If.decode(S2.isBuffer(t)?t:B2(t));return Tf.bytes=If.decode.bytes,e};Cf.exports=Tf});var Rf=S((TE,cs)=>{l();"use strict";var{Buffer:_2}=_e(),ho=Wr(),A2=uo(),Pf=8,Kf=1024*1024*4,Lf=_2.alloc(0),pr={LENGTH:"readLength",DATA:"readData"},C2={[pr.LENGTH]:(t,e,r,n)=>{e=e.append(t);let i;try{i=n.lengthDecoder(e)}catch(s){if(e.length>n.maxLengthLength)throw Object.assign(s,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(s instanceof RangeError)return{mode:pr.LENGTH,buffer:e,chunk:void 0,state:void 0,data:void 0};throw s}if(i>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return t=e.shallowSlice(n.lengthDecoder.bytes),e=new ho,n.onLength&&n.onLength(i),i<=0?(n.onData&&n.onData(Lf),{mode:pr.LENGTH,chunk:t,buffer:e,data:Lf}):{mode:pr.DATA,chunk:t,buffer:e,state:{dataLength:i},data:void 0}},[pr.DATA]:(t,e,r,n)=>{if(e=e.append(t),!r)throw new Error("state is required");if(e.length<r.dataLength)return{mode:pr.DATA,buffer:e,state:r,chunk:void 0,data:void 0};let{dataLength:i}=r,s=e.shallowSlice(0,i),a=e.length>i?e.shallowSlice(i):void 0;return e=new ho,n.onData&&n.onData(s),{mode:pr.LENGTH,chunk:a,buffer:e,state:void 0,data:s}}};function lo(t){t=t||{};let e={lengthDecoder:t.lengthDecoder||A2,maxLengthLength:t.maxLengthLength||Pf,maxDataLength:t.maxDataLength||Kf,onLength:t.onLength,onData:t.onData};return async function*(n){let i=new ho,s=pr.LENGTH,a;for await(let o of n){let c=o;for(;c;){let f=C2[s](c,i,a,e);s=f.mode,c=f.chunk,i=f.buffer,a=f.state,f.data&&(yield f.data)}}if(i.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}lo.fromReader=(t,e)=>{let r=1,n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await t.next(r)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}};return lo({...e||{},onLength:s=>{r=s}})(n)};cs.exports=lo;cs.exports.MAX_LENGTH_LENGTH=Pf;cs.exports.MAX_DATA_LENGTH=Kf});var Nf=S((PE,kf)=>{l();"use strict";var{Buffer:I2}=_e(),Df=(t,e,r)=>(e=e||I2.allocUnsafe(4),e.writeInt32BE(t,r),e);Df.bytes=4;kf.exports=Df});var Mf=S((KE,Uf)=>{l();"use strict";var Ff=t=>{if(t.length<4)throw RangeError("Could not decode int32BE");return t.readInt32BE(0)};Ff.bytes=4;Uf.exports=Ff});var Of=S(jr=>{l();"use strict";jr.encode=Af();jr.decode=Rf();jr.varintEncode=co();jr.varintDecode=uo();jr.int32BEEncode=Nf();jr.int32BEDecode=Mf()});var Vf=S((RE,qf)=>{l();"use strict";var T2=Wc(),P2=cf(),Hf=Of();qf.exports=(t,e={})=>{let r=P2(t),n=Hf.decode.fromReader(r.reader,e),i=!1,s={read:async a=>{let{value:o,done:c}=await r.reader.next(a);if(c&&o.length<a)throw new Error("Couldn't read enough bytes");if(i=c,!o)throw new Error("Value is null");return o},readLP:async()=>{let{value:a,done:o}=await n.next();if(i=o,!a)throw new Error("Value is null");return a},readPB:async a=>{let o=await s.readLP();if(!o)throw new Error("Value is null");let c=T2(o)?o:o.slice();return a.decode(c)},write:a=>{r.writer.push(a)},writeLP:a=>{s.write(Hf.encode.single(a,e))},writePB:(a,o)=>{s.writeLP(o.encode(a))},pb:a=>({read:()=>s.readPB(a),write:o=>s.writePB(o,a)}),unwrap:()=>(r.rest(),r.stream)};return s}});var Gf=S((kE,zf)=>{l();zf.exports=function(e){if(e){if(typeof e[Symbol.iterator]=="function")return e[Symbol.iterator]();if(typeof e[Symbol.asyncIterator]=="function")return e[Symbol.asyncIterator]();if(typeof e.next=="function")return e}throw new Error("argument is not an iterator or iterable")}});var jf=S((DE,Wf)=>{l();"use strict";var K2=Gf();Wf.exports=function(){let e,r,n=async s=>{if(e)throw new Error("already piped");e=K2(s),r&&r(e)},i={[Symbol.asyncIterator](){return this},next(){return e?e.next():new Promise(s=>{r=a=>{r=null,s(a.next())}})}};return{sink:n,source:i}}});var Yf=S((NE,$f)=>{l();var Xf=jf();$f.exports=function(){var t=Xf(),e=Xf();return[{source:t.source,sink:e.sink},{source:e.source,sink:t.sink}]}});var Zf=S((UE,Jn)=>{l();"use strict";var{Buffer:fs}=_e(),us=Wr();Jn.exports=async function*(t){for await(let e of t)fs.isBuffer(e)?yield e:us.isBufferList(e)?yield e.slice():yield fs.from(e)};Jn.exports.toBuffer=Jn.exports;Jn.exports.toList=async function*(t){for await(let e of t)fs.isBuffer(e)?yield new us().append(e):us.isBufferList(e)?yield e:yield new us().append(fs.from(e))}});var eu=S((FE,xn)=>{l();var Qf=(...t)=>{let e;for(;t.length;)e=t.shift()(e);return e},po=t=>t&&(typeof t[Symbol.asyncIterator]=="function"||typeof t[Symbol.iterator]=="function"||typeof t.next=="function"),hs=t=>t&&typeof t.sink=="function"&&po(t.source),L2=t=>e=>(t.sink(e),t.source),Jf=(...t)=>{if(hs(t[0])){let e=t[0];t[0]=()=>e.source}else if(po(t[0])){let e=t[0];t[0]=()=>e}if(t.length>1&&hs(t[t.length-1])&&(t[t.length-1]=t[t.length-1].sink),t.length>2)for(let e=1;e<t.length-1;e++)hs(t[e])&&(t[e]=L2(t[e]));return Qf(...t)};xn.exports=Jf;xn.exports.pipe=Jf;xn.exports.rawPipe=Qf;xn.exports.isIterable=po;xn.exports.isDuplex=hs});var yo=S((ME,tu)=>{l();"use strict";var ru=Qn(),{Buffer:R2}=_e(),nu=(t,e,r)=>{let n=ru.encode(t,e,r);return nu.bytes=ru.encode.bytes,e||R2.from(n)};tu.exports=nu});var fu=S((OE,ls)=>{l();"use strict";var{Buffer:iu}=_e(),su=Wr(),au=yo(),go=8,ou=10*1024;function cu(t){t=t||{};let e=Math.max(t.poolSize||ou,t.minPoolSize||go),r=t.lengthEncoder||au;return async function*(i){let s=iu.alloc(e),a=0;for await(let o of i){r(o.length,s,a);let c=s.slice(a,a+r.bytes);a+=r.bytes,s.length-a<go&&(s=iu.alloc(e),a=0),yield new su().append(c).append(o)}}}cu.single=(t,e)=>{e=e||{};let r=e.lengthEncoder||au;return new su([r(t.length),t.slice()])};ls.exports=cu;ls.exports.MIN_POOL_SIZE=go;ls.exports.DEFAULT_POOL_SIZE=ou});var xo=S((qE,uu)=>{l();"use strict";var hu=Qn(),{Buffer:k2}=_e(),D2=t=>new Proxy({},{get:(e,r)=>r[0]==="l"?t[r]:t.get(parseInt(r))}),lu=t=>{let e=hu.decode(k2.isBuffer(t)?t:D2(t));return lu.bytes=hu.decode.bytes,e};uu.exports=lu});var gu=S((HE,ps)=>{l();"use strict";var{Buffer:N2}=_e(),vo=Wr(),U2=xo(),pu=8,du=1024*1024*4,yu=N2.alloc(0),dr={LENGTH:"readLength",DATA:"readData"},F2={[dr.LENGTH]:(t,e,r,n)=>{e=e.append(t);let i;try{i=n.lengthDecoder(e)}catch(s){if(e.length>n.maxLengthLength)throw Object.assign(s,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(s instanceof RangeError)return{mode:dr.LENGTH,buffer:e,chunk:void 0,state:void 0,data:void 0};throw s}if(i>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return t=e.shallowSlice(n.lengthDecoder.bytes),e=new vo,n.onLength&&n.onLength(i),i<=0?(n.onData&&n.onData(yu),{mode:dr.LENGTH,chunk:t,buffer:e,data:yu}):{mode:dr.DATA,chunk:t,buffer:e,state:{dataLength:i},data:void 0}},[dr.DATA]:(t,e,r,n)=>{if(e=e.append(t),!r)throw new Error("state is required");if(e.length<r.dataLength)return{mode:dr.DATA,buffer:e,state:r,chunk:void 0,data:void 0};let{dataLength:i}=r,s=e.shallowSlice(0,i),a=e.length>i?e.shallowSlice(i):void 0;return e=new vo,n.onData&&n.onData(s),{mode:dr.LENGTH,chunk:a,buffer:e,state:void 0,data:s}}};function bo(t){t=t||{};let e={lengthDecoder:t.lengthDecoder||U2,maxLengthLength:t.maxLengthLength||pu,maxDataLength:t.maxDataLength||du,onLength:t.onLength,onData:t.onData};return async function*(n){let i=new vo,s=dr.LENGTH,a;for await(let o of n){let c=o;for(;c;){let f=F2[s](c,i,a,e);s=f.mode,c=f.chunk,i=f.buffer,a=f.state,f.data&&(yield f.data)}}if(i.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}bo.fromReader=(t,e)=>{let r=1,n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await t.next(r)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}};return bo({...e||{},onLength:s=>{r=s}})(n)};ps.exports=bo;ps.exports.MAX_LENGTH_LENGTH=pu;ps.exports.MAX_DATA_LENGTH=du});var bu=S((VE,xu)=>{l();"use strict";var{Buffer:M2}=_e(),vu=(t,e,r)=>(e=e||M2.allocUnsafe(4),e.writeInt32BE(t,r),e);vu.bytes=4;xu.exports=vu});var Eu=S((zE,mu)=>{l();"use strict";var wu=t=>{if(t.length<4)throw RangeError("Could not decode int32BE");return t.readInt32BE(0)};wu.bytes=4;mu.exports=wu});var Su=S($r=>{l();"use strict";$r.encode=fu();$r.decode=gu();$r.varintEncode=yo();$r.varintDecode=xo();$r.int32BEEncode=bu();$r.int32BEDecode=Eu()});var Bu=S(mo=>{l();"use strict";Object.defineProperty(mo,"__esModule",{value:!0});function O2(t){return typeof t.saveState!="undefined"&&typeof t.restoreState!="undefined"&&typeof t.cleanSavedState!="undefined"}mo.isSerializableHash=O2});var ds=S(vn=>{l();"use strict";Object.defineProperty(vn,"__esModule",{value:!0});function q2(t,e,r){return~(t-1)&e|t-1&r}vn.select=q2;function H2(t,e){return(t|0)-(e|0)-1>>>31&1}vn.lessOrEqual=H2;function _u(t,e){if(t.length!==e.length)return 0;for(var r=0,n=0;n<t.length;n++)r|=t[n]^e[n];return 1&r-1>>>8}vn.compare=_u;function V2(t,e){return t.length===0||e.length===0?!1:_u(t,e)!==0}vn.equal=V2});var Cu=S(ei=>{l();"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var Lt=Bu(),z2=ds(),G2=Pt(),Au=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var n=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(n).clean():n.set(r);for(var i=0;i<n.length;i++)n[i]^=54;this._inner.update(n);for(var i=0;i<n.length;i++)n[i]^=54^92;this._outer.update(n),Lt.isSerializableHash(this._inner)&&Lt.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),G2.wipe(n)}return t.prototype.reset=function(){if(!Lt.isSerializableHash(this._inner)||!Lt.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){Lt.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Lt.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!Lt.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!Lt.isSerializableHash(this._inner)||!Lt.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!Lt.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();ei.HMAC=Au;function W2(t,e,r){var n=new Au(t,e);n.update(r);var i=n.digest();return n.clean(),i}ei.hmac=W2;ei.equal=z2.equal});var Pu=S(wo=>{l();"use strict";Object.defineProperty(wo,"__esModule",{value:!0});var Iu=Cu(),Tu=Pt(),j2=function(){function t(e,r,n,i){n===void 0&&(n=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var s=Iu.hmac(this._hash,n,r);this._hmac=new Iu.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),n=0;n<r.length;n++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[n]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),Tu.wipe(this._buffer),Tu.wipe(this._counter),this._bufpos=0},t}();wo.HKDF=j2});var So=S(yr=>{l();"use strict";Object.defineProperty(yr,"__esModule",{value:!0});var ys=Xn(),gs=Pt();yr.DIGEST_LENGTH=32;yr.BLOCK_SIZE=64;var Ku=function(){function t(){this.digestLength=yr.DIGEST_LENGTH,this.blockSize=yr.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return t.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},t.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},t.prototype.clean=function(){gs.wipe(this._buffer),gs.wipe(this._temp),this.reset()},t.prototype.update=function(e,r){if(r===void 0&&(r=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=r,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&r>0;)this._buffer[this._bufferLength++]=e[n++],r--;this._bufferLength===this.blockSize&&(Eo(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(r>=this.blockSize&&(n=Eo(this._temp,this._state,e,n,r),r%=this.blockSize);r>0;)this._buffer[this._bufferLength++]=e[n++],r--;return this},t.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,s=r<<3,a=r%64<56?64:128;this._buffer[n]=128;for(var o=n+1;o<a-8;o++)this._buffer[o]=0;ys.writeUint32BE(i,this._buffer,a-8),ys.writeUint32BE(s,this._buffer,a-4),Eo(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(var o=0;o<this.digestLength/4;o++)ys.writeUint32BE(this._state[o],e,o*4);return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},t.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},t.prototype.cleanSavedState=function(e){gs.wipe(e.state),e.buffer&&gs.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},t}();yr.SHA256=Ku;var $2=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function Eo(t,e,r,n,i){for(;i>=64;){for(var s=e[0],a=e[1],o=e[2],c=e[3],f=e[4],u=e[5],h=e[6],p=e[7],y=0;y<16;y++){var d=n+y*4;t[y]=ys.readUint32BE(r,d)}for(var y=16;y<64;y++){var g=t[y-2],v=(g>>>17|g<<32-17)^(g>>>19|g<<32-19)^g>>>10;g=t[y-15];var b=(g>>>7|g<<32-7)^(g>>>18|g<<32-18)^g>>>3;t[y]=(v+t[y-7]|0)+(b+t[y-16]|0)}for(var y=0;y<64;y++){var v=(((f>>>6|f<<32-6)^(f>>>11|f<<32-11)^(f>>>25|f<<32-25))+(f&u^~f&h)|0)+(p+($2[y]+t[y]|0)|0)|0,b=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&a^s&o^a&o)|0;p=h,h=u,u=f,f=c+v|0,c=o,o=a,a=s,s=v+b|0}e[0]+=s,e[1]+=a,e[2]+=o,e[3]+=c,e[4]+=f,e[5]+=u,e[6]+=h,e[7]+=p,n+=64,i-=64}return n}function X2(t){var e=new Ku;e.update(t);var r=e.digest();return e.clean(),r}yr.hash=X2});function Lu(t,e,r){e=e||[],r=r||0;for(var n=r;t>=J2;)e[r++]=t&255|Ru,t/=128;for(;t&Q2;)e[r++]=t&255|Ru,t>>>=7;return e[r]=t|0,Lu.bytes=r-n+1,e}function Bo(t,e){var r=0,e=e||0,n=0,i=e,s,a=t.length;do{if(i>=a)throw Bo.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=n<28?(s&ku)<<n:(s&ku)*Math.pow(2,n),n+=7}while(s>=tx);return Bo.bytes=i-e,r}var Y2,Ru,Z2,Q2,J2,ex,tx,ku,rx,nx,ix,sx,ax,ox,cx,fx,ux,hx,lx,px,ti,Du=z(()=>{l();Y2=Lu,Ru=128,Z2=127,Q2=~Z2,J2=Math.pow(2,31);ex=Bo,tx=128,ku=127;rx=Math.pow(2,7),nx=Math.pow(2,14),ix=Math.pow(2,21),sx=Math.pow(2,28),ax=Math.pow(2,35),ox=Math.pow(2,42),cx=Math.pow(2,49),fx=Math.pow(2,56),ux=Math.pow(2,63),hx=function(t){return t<rx?1:t<nx?2:t<ix?3:t<sx?4:t<ax?5:t<ox?6:t<cx?7:t<fx?8:t<ux?9:10},lx={encode:Y2,decode:ex,encodingLength:hx},px=lx,ti=px});var ri,bn,mn,_o=z(()=>{l();Du();ri=t=>[ti.decode(t),ti.decode.bytes],bn=(t,e,r=0)=>(ti.encode(t,e,r),e),mn=t=>ti.encodingLength(t)});var t4,Nu,gr,ni=z(()=>{l();t4=new Uint8Array(0),Nu=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},gr=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}});var Uu={};Ee(Uu,{Digest:()=>wn,create:()=>ii,decode:()=>Ao,equals:()=>Co});var ii,Ao,Co,wn,xs=z(()=>{l();ni();_o();ii=(t,e)=>{let r=e.byteLength,n=mn(t),i=n+mn(r),s=new Uint8Array(i+r);return bn(t,s,0),bn(r,s,n),s.set(e,i),new wn(t,r,e,s)},Ao=t=>{let e=gr(t),[r,n]=ri(e),[i,s]=ri(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new wn(r,i,a,e)},Co=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&Nu(t.bytes,e.bytes),wn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});function dx(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=i}var o=t.length,c=t.charAt(0),f=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function h(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var g=0,v=0,b=0,w=d.length;b!==w&&d[b]===0;)b++,g++;for(var E=(w-b)*u+1>>>0,T=new Uint8Array(E);b!==w;){for(var A=d[b],C=0,L=E-1;(A!==0||C<v)&&L!==-1;L--,C++)A+=256*T[L]>>>0,T[L]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");v=C,b++}for(var k=E-v;k!==E&&T[k]===0;)k++;for(var F=c.repeat(g);k<E;++k)F+=t.charAt(T[k]);return F}function p(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var g=0;if(d[g]!==" "){for(var v=0,b=0;d[g]===c;)v++,g++;for(var w=(d.length-g)*f+1>>>0,E=new Uint8Array(w);d[g];){var T=r[d.charCodeAt(g)];if(T===255)return;for(var A=0,C=w-1;(T!==0||A<b)&&C!==-1;C--,A++)T+=o*E[C]>>>0,E[C]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");b=A,g++}if(d[g]!==" "){for(var L=w-b;L!==w&&E[L]===0;)L++;for(var k=new Uint8Array(v+(w-L)),F=v;L!==w;)k[F++]=E[L++];return k}}}function y(d){var g=p(d);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:p,decode:y}}var yx,gx,Fu,Mu=z(()=>{l();yx=dx,gx=yx,Fu=gx});var Ou,qu,vs,Hu,Vu,En,xx,vx,Ne,Sn=z(()=>{l();Mu();ni();Ou=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},qu=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){let r={[this.prefix]:this,...e.decoders||{[e.prefix]:e}};return new vs(r)}},vs=class{constructor(e){this.decoders=e}or(e){let r=e.decoders||{[e.prefix]:e};return new vs({...this.decoders,...r})}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Hu=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ou(e,r,n),this.decoder=new qu(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Vu=({name:t,prefix:e,encode:r,decode:n})=>new Hu(t,e,r,n),En=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Fu(r,e);return Vu({prefix:t,name:e,encode:n,decode:s=>gr(i(s))})},xx=(t,e,r,n)=>{let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let s=t.length;for(;t[s-1]==="=";)--s;let a=new Uint8Array(s*r/8|0),o=0,c=0,f=0;for(let u=0;u<s;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|h,o+=r,o>=8&&(o-=8,a[f++]=255&c>>o)}if(o>=r||255&c<<8-o)throw new SyntaxError("Unexpected end of data");return a},vx=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,s="",a=0,o=0;for(let c=0;c<t.length;++c)for(o=o<<8|t[c],a+=8;a>r;)a-=r,s+=e[i&o>>a];if(a&&(s+=e[i&o<<r-a]),n)for(;s.length*r&7;)s+="=";return s},Ne=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Vu({prefix:e,name:t,encode(i){return vx(i,n,r)},decode(i){return xx(i,n,r,t)}})});var bs={};Ee(bs,{base58btc:()=>Rt,base58flickr:()=>bx});var Rt,bx,si=z(()=>{l();Sn();Rt=En({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),bx=En({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Io={};Ee(Io,{base32:()=>Bn,base32hex:()=>Sx,base32hexpad:()=>_x,base32hexpadupper:()=>Ax,base32hexupper:()=>Bx,base32pad:()=>wx,base32padupper:()=>Ex,base32upper:()=>mx,base32z:()=>Cx});var Bn,mx,wx,Ex,Sx,Bx,_x,Ax,Cx,ms=z(()=>{l();Sn();Bn=Ne({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),mx=Ne({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wx=Ne({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ex=Ne({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Sx=Ne({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Bx=Ne({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),_x=Ne({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ax=Ne({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cx=Ne({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var zu={};Ee(zu,{CID:()=>Ve});var Ve,Ix,Tx,Px,ai,Kx,Gu,Wu,ws,Es,kx,Lx,Rx,ju=z(()=>{l();_o();xs();si();ms();ni();Ve=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Es,byteLength:Es,code:ws,version:ws,multihash:ws,bytes:ws,_baseCache:Es,asCID:Es})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==ai)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Kx)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ve.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ii(e,r);return Ve.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&Co(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return Tx(r,i,e||Rt.encoder);default:return Px(r,i,e||Bn.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return Lx(/^0\.0/,Rx),!!(e&&(e[Wu]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof Ve)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new Ve(r,n,i,s||Gu(r,n,i.bytes))}else if(e!=null&&e[Wu]===!0){let{version:r,multihash:n,code:i}=e,s=Ao(n);return Ve.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==ai)throw new Error(`Version 0 CID must use dag-pb (code: ${ai}) block encoding`);return new Ve(e,r,n,n.bytes)}case 1:{let i=Gu(e,r,n.bytes);return new Ve(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ve.create(0,ai,e)}static createV1(e,r){return Ve.create(1,e,r)}static decode(e){let[r,n]=Ve.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=Ve.inspectBytes(e),n=r.size-r.multihashSize,i=gr(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),a=new wn(r.multihashCode,r.digestSize,s,i);return[r.version===0?Ve.createV0(a):Ve.createV1(r.codec,a),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[h,p]=ri(e.subarray(r));return r+=p,h},i=n(),s=ai;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,o=n(),c=n(),f=r+c,u=f-a;return{version:i,codec:s,multihashCode:o,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=Ix(e,r),s=Ve.decode(i);return s._baseCache.set(n,e),s}},Ix=(t,e)=>{switch(t[0]){case"Q":{let r=e||Rt;return[Rt.prefix,r.decode(`${Rt.prefix}${t}`)]}case Rt.prefix:{let r=e||Rt;return[Rt.prefix,r.decode(t)]}case Bn.prefix:{let r=e||Bn;return[Bn.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},Tx=(t,e,r)=>{let{prefix:n}=r;if(n!==Rt.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},Px=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},ai=112,Kx=18,Gu=(t,e,r)=>{let n=mn(t),i=n+mn(e),s=new Uint8Array(i+r.byteLength);return bn(t,s,0),bn(e,s,n),s.set(r,i),s},Wu=Symbol.for("@ipld/js-cid/CID"),ws={writable:!1,configurable:!1,enumerable:!0},Es={writable:!1,enumerable:!1,configurable:!1},kx="0.0.0-dev",Lx=(t,e)=>{if(t.test(kx))console.warn(e);else throw new Error(e)},Rx=`CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:

if (CID.isCID(value)) {
  doSomethingWithCID(value)
}

Is replaced with:

const cid = CID.asCID(value)
if (cid) {
  // Make sure to use cid instead of value
  doSomethingWithCID(cid)
}
`});var $u={};Ee($u,{base36:()=>Dx,base36upper:()=>Nx});var Dx,Nx,Xu=z(()=>{l();Sn();Dx=En({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Nx=En({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var Ss={};Ee(Ss,{base64:()=>Ux,base64pad:()=>Fx,base64url:()=>Mx,base64urlpad:()=>Ox});var Ux,Fx,Mx,Ox,Bs=z(()=>{l();Sn();Ux=Ne({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Fx=Ne({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Mx=Ne({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ox=Ne({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});var Yu={};Ee(Yu,{base16:()=>qx,base16upper:()=>Hx});var qx,Hx,Zu=z(()=>{l();Sn();qx=Ne({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Hx=Ne({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var Ju=S((v4,Qu)=>{l();"use strict";Qu.exports=Vx;function Vx(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(o,c){r[n]=function(u){if(s)if(s=!1,u)c(u);else{for(var h=new Array(arguments.length-1),p=0;p<h.length;)h[p++]=arguments[p];o.apply(null,h)}};try{t.apply(e||null,r)}catch(f){s&&(s=!1,c(f))}})}});var nh=S(eh=>{l();"use strict";var _s=eh;_s.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var _n=new Array(64),th=new Array(123);for(var kt=0;kt<64;)th[_n[kt]=kt<26?kt+65:kt<52?kt+71:kt<62?kt-4:kt-59|43]=kt++;_s.encode=function(e,r,n){for(var i=null,s=[],a=0,o=0,c;r<n;){var f=e[r++];switch(o){case 0:s[a++]=_n[f>>2],c=(f&3)<<4,o=1;break;case 1:s[a++]=_n[c|f>>4],c=(f&15)<<2,o=2;break;case 2:s[a++]=_n[c|f>>6],s[a++]=_n[f&63],o=0;break}a>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=_n[c],s[a++]=61,o===1&&(s[a++]=61)),i?(a&&i.push(String.fromCharCode.apply(String,s.slice(0,a))),i.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var rh="invalid encoding";_s.decode=function(e,r,n){for(var i=n,s=0,a,o=0;o<e.length;){var c=e.charCodeAt(o++);if(c===61&&s>1)break;if((c=th[c])===void 0)throw Error(rh);switch(s){case 0:a=c,s=1;break;case 1:r[n++]=a<<2|(c&48)>>4,a=c,s=2;break;case 2:r[n++]=(a&15)<<4|(c&60)>>2,a=c,s=3;break;case 3:r[n++]=(a&3)<<6|c,s=0;break}}if(s===1)throw Error(rh);return n-i};_s.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var sh=S((m4,ih)=>{l();"use strict";ih.exports=As;function As(){this._listeners={}}As.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};As.prototype.off=function(e,r){if(e===void 0)this._listeners={};else if(r===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i;return this};As.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var lh=S((w4,ah)=>{l();"use strict";ah.exports=oh(oh);function oh(t){return typeof Float32Array!="undefined"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,f,u){e[0]=c,f[u]=r[0],f[u+1]=r[1],f[u+2]=r[2],f[u+3]=r[3]}function s(c,f,u){e[0]=c,f[u]=r[3],f[u+1]=r[2],f[u+2]=r[1],f[u+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function a(c,f){return r[0]=c[f],r[1]=c[f+1],r[2]=c[f+2],r[3]=c[f+3],e[0]}function o(c,f){return r[3]=c[f],r[2]=c[f+1],r[1]=c[f+2],r[0]=c[f+3],e[0]}t.readFloatLE=n?a:o,t.readFloatBE=n?o:a}():function(){function e(n,i,s,a){var o=i<0?1:0;if(o&&(i=-i),i===0)n(1/i>0?0:2147483648,s,a);else if(isNaN(i))n(2143289344,s,a);else if(i>34028234663852886e22)n((o<<31|2139095040)>>>0,s,a);else if(i<11754943508222875e-54)n((o<<31|Math.round(i/1401298464324817e-60))>>>0,s,a);else{var c=Math.floor(Math.log(i)/Math.LN2),f=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((o<<31|c+127<<23|f)>>>0,s,a)}}t.writeFloatLE=e.bind(null,ch),t.writeFloatBE=e.bind(null,fh);function r(n,i,s){var a=n(i,s),o=(a>>31)*2+1,c=a>>>23&255,f=a&8388607;return c===255?f?NaN:o*Infinity:c===0?o*1401298464324817e-60*f:o*Math.pow(2,c-150)*(f+8388608)}t.readFloatLE=r.bind(null,uh),t.readFloatBE=r.bind(null,hh)}(),typeof Float64Array!="undefined"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,f,u){e[0]=c,f[u]=r[0],f[u+1]=r[1],f[u+2]=r[2],f[u+3]=r[3],f[u+4]=r[4],f[u+5]=r[5],f[u+6]=r[6],f[u+7]=r[7]}function s(c,f,u){e[0]=c,f[u]=r[7],f[u+1]=r[6],f[u+2]=r[5],f[u+3]=r[4],f[u+4]=r[3],f[u+5]=r[2],f[u+6]=r[1],f[u+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function a(c,f){return r[0]=c[f],r[1]=c[f+1],r[2]=c[f+2],r[3]=c[f+3],r[4]=c[f+4],r[5]=c[f+5],r[6]=c[f+6],r[7]=c[f+7],e[0]}function o(c,f){return r[7]=c[f],r[6]=c[f+1],r[5]=c[f+2],r[4]=c[f+3],r[3]=c[f+4],r[2]=c[f+5],r[1]=c[f+6],r[0]=c[f+7],e[0]}t.readDoubleLE=n?a:o,t.readDoubleBE=n?o:a}():function(){function e(n,i,s,a,o,c){var f=a<0?1:0;if(f&&(a=-a),a===0)n(0,o,c+i),n(1/a>0?0:2147483648,o,c+s);else if(isNaN(a))n(0,o,c+i),n(2146959360,o,c+s);else if(a>17976931348623157e292)n(0,o,c+i),n((f<<31|2146435072)>>>0,o,c+s);else{var u;if(a<22250738585072014e-324)u=a/5e-324,n(u>>>0,o,c+i),n((f<<31|u/4294967296)>>>0,o,c+s);else{var h=Math.floor(Math.log(a)/Math.LN2);h===1024&&(h=1023),u=a*Math.pow(2,-h),n(u*4503599627370496>>>0,o,c+i),n((f<<31|h+1023<<20|u*1048576&1048575)>>>0,o,c+s)}}}t.writeDoubleLE=e.bind(null,ch,0,4),t.writeDoubleBE=e.bind(null,fh,4,0);function r(n,i,s,a,o){var c=n(a,o+i),f=n(a,o+s),u=(f>>31)*2+1,h=f>>>20&2047,p=4294967296*(f&1048575)+c;return h===2047?p?NaN:u*Infinity:h===0?u*5e-324*p:u*Math.pow(2,h-1075)*(p+4503599627370496)}t.readDoubleLE=r.bind(null,uh,0,4),t.readDoubleBE=r.bind(null,hh,4,0)}(),t}function ch(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function fh(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function uh(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function hh(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var ph=S((exports,module)=>{l();"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}});var yh=S(dh=>{l();"use strict";var To=dh;To.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)==55296&&(e.charCodeAt(i+1)&64512)==56320?(++i,r+=4):r+=3;return r};To.read=function(e,r,n){var i=n-r;if(i<1)return"";for(var s=null,a=[],o=0,c;r<n;)c=e[r++],c<128?a[o++]=c:c>191&&c<224?a[o++]=(c&31)<<6|e[r++]&63:c>239&&c<365?(c=((c&7)<<18|(e[r++]&63)<<12|(e[r++]&63)<<6|e[r++]&63)-65536,a[o++]=55296+(c>>10),a[o++]=56320+(c&1023)):a[o++]=(c&15)<<12|(e[r++]&63)<<6|e[r++]&63,o>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),o=0);return s?(o&&s.push(String.fromCharCode.apply(String,a.slice(0,o))),s.join("")):String.fromCharCode.apply(String,a.slice(0,o))};To.write=function(e,r,n){for(var i=n,s,a,o=0;o<e.length;++o)s=e.charCodeAt(o),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)==55296&&((a=e.charCodeAt(o+1))&64512)==56320?(s=65536+((s&1023)<<10)+(a&1023),++o,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var xh=S((S4,gh)=>{l();"use strict";gh.exports=zx;function zx(t,e,r){var n=r||8192,i=n>>>1,s=null,a=n;return function(c){if(c<1||c>i)return t(c);a+c>n&&(s=t(n),a=0);var f=e.call(s,a,a+=c);return a&7&&(a=(a|7)+1),f}}});var bh=S((B4,vh)=>{l();"use strict";vh.exports=Ue;var oi=xr();function Ue(t,e){this.lo=t>>>0,this.hi=e>>>0}var Xr=Ue.zero=new Ue(0,0);Xr.toNumber=function(){return 0};Xr.zzEncode=Xr.zzDecode=function(){return this};Xr.length=function(){return 1};var Gx=Ue.zeroHash="\0\0\0\0\0\0\0\0";Ue.fromNumber=function(e){if(e===0)return Xr;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Ue(n,i)};Ue.from=function(e){if(typeof e=="number")return Ue.fromNumber(e);if(oi.isString(e))if(oi.Long)e=oi.Long.fromString(e);else return Ue.fromNumber(parseInt(e,10));return e.low||e.high?new Ue(e.low>>>0,e.high>>>0):Xr};Ue.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Ue.prototype.toLong=function(e){return oi.Long?new oi.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var vr=String.prototype.charCodeAt;Ue.fromHash=function(e){return e===Gx?Xr:new Ue((vr.call(e,0)|vr.call(e,1)<<8|vr.call(e,2)<<16|vr.call(e,3)<<24)>>>0,(vr.call(e,4)|vr.call(e,5)<<8|vr.call(e,6)<<16|vr.call(e,7)<<24)>>>0)};Ue.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Ue.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Ue.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Ue.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var xr=S(Po=>{l();"use strict";var M=Po;M.asPromise=Ju();M.base64=nh();M.EventEmitter=sh();M.float=lh();M.inquire=ph();M.utf8=yh();M.pool=xh();M.LongBits=bh();M.isNode=Boolean(typeof globalThis!="undefined"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);M.global=M.isNode&&globalThis||typeof window!="undefined"&&window||typeof self!="undefined"&&self||Po;M.emptyArray=Object.freeze?Object.freeze([]):[];M.emptyObject=Object.freeze?Object.freeze({}):{};M.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};M.isString=function(e){return typeof e=="string"||e instanceof String};M.isObject=function(e){return e&&typeof e=="object"};M.isset=M.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};M.Buffer=function(){try{var t=M.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(e){return null}}();M._Buffer_from=null;M._Buffer_allocUnsafe=null;M.newBuffer=function(e){return typeof e=="number"?M.Buffer?M._Buffer_allocUnsafe(e):new M.Array(e):M.Buffer?M._Buffer_from(e):typeof Uint8Array=="undefined"?e:new Uint8Array(e)};M.Array=typeof Uint8Array!="undefined"?Uint8Array:Array;M.Long=M.global.dcodeIO&&M.global.dcodeIO.Long||M.global.Long||M.inquire("long");M.key2Re=/^true|false|0|1$/;M.key32Re=/^-?(?:0|[1-9][0-9]*)$/;M.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;M.longToHash=function(e){return e?M.LongBits.from(e).toHash():M.LongBits.zeroHash};M.longFromHash=function(e,r){var n=M.LongBits.fromHash(e);return M.Long?M.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function mh(t,e,r){for(var n=Object.keys(e),i=0;i<n.length;++i)(t[n[i]]===void 0||!r)&&(t[n[i]]=e[n[i]]);return t}M.merge=mh;M.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function wh(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&mh(this,n)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return t}}),e.prototype.toString=function(){return this.name+": "+this.message},e}M.newError=wh;M.ProtocolError=wh("ProtocolError");M.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};M.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};M.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};M._configure=function(){var t=M.Buffer;if(!t){M._Buffer_from=M._Buffer_allocUnsafe=null;return}M._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},M._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var Uo=S((A4,Eh)=>{l();"use strict";Eh.exports=ie;var dt=xr(),Ko,Cs=dt.LongBits,Sh=dt.base64,Bh=dt.utf8;function ci(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function Lo(){}function Wx(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function ie(){this.len=0,this.head=new ci(Lo,0,0),this.tail=this.head,this.states=null}var _h=function(){return dt.Buffer?function(){return(ie.create=function(){return new Ko})()}:function(){return new ie}};ie.create=_h();ie.alloc=function(e){return new dt.Array(e)};dt.Array!==Array&&(ie.alloc=dt.pool(ie.alloc,dt.Array.prototype.subarray));ie.prototype._push=function(e,r,n){return this.tail=this.tail.next=new ci(e,r,n),this.len+=r,this};function Ro(t,e,r){e[r]=t&255}function jx(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function ko(t,e){this.len=t,this.next=void 0,this.val=e}ko.prototype=Object.create(ci.prototype);ko.prototype.fn=jx;ie.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new ko((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};ie.prototype.int32=function(e){return e<0?this._push(Do,10,Cs.fromNumber(e)):this.uint32(e)};ie.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function Do(t,e,r){for(;t.hi;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}ie.prototype.uint64=function(e){var r=Cs.from(e);return this._push(Do,r.length(),r)};ie.prototype.int64=ie.prototype.uint64;ie.prototype.sint64=function(e){var r=Cs.from(e).zzEncode();return this._push(Do,r.length(),r)};ie.prototype.bool=function(e){return this._push(Ro,1,e?1:0)};function No(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}ie.prototype.fixed32=function(e){return this._push(No,4,e>>>0)};ie.prototype.sfixed32=ie.prototype.fixed32;ie.prototype.fixed64=function(e){var r=Cs.from(e);return this._push(No,4,r.lo)._push(No,4,r.hi)};ie.prototype.sfixed64=ie.prototype.fixed64;ie.prototype.float=function(e){return this._push(dt.float.writeFloatLE,4,e)};ie.prototype.double=function(e){return this._push(dt.float.writeDoubleLE,8,e)};var $x=dt.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};ie.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(Ro,1,0);if(dt.isString(e)){var n=ie.alloc(r=Sh.length(e));Sh.decode(e,n,0),e=n}return this.uint32(r)._push($x,r,e)};ie.prototype.string=function(e){var r=Bh.length(e);return r?this.uint32(r)._push(Bh.write,r,e):this._push(Ro,1,0)};ie.prototype.fork=function(){return this.states=new Wx(this),this.head=this.tail=new ci(Lo,0,0),this.len=0,this};ie.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ci(Lo,0,0),this.len=0),this};ie.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};ie.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};ie._configure=function(t){Ko=t,ie.create=_h(),Ko._configure()}});var Ih=S((C4,Ah)=>{l();"use strict";Ah.exports=Dt;var Ch=Uo();(Dt.prototype=Object.create(Ch.prototype)).constructor=Dt;var br=xr();function Dt(){Ch.call(this)}Dt._configure=function(){Dt.alloc=br._Buffer_allocUnsafe,Dt.writeBytesBuffer=br.Buffer&&br.Buffer.prototype instanceof Uint8Array&&br.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Dt.prototype.bytes=function(e){br.isString(e)&&(e=br._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Dt.writeBytesBuffer,r,e),this};function Xx(t,e,r){t.length<40?br.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Dt.prototype.string=function(e){var r=br.Buffer.byteLength(e);return this.uint32(r),r&&this._push(Xx,r,e),this};Dt._configure()});var Oo=S((I4,Th)=>{l();"use strict";Th.exports=Le;var Nt=xr(),Fo,Ph=Nt.LongBits,Yx=Nt.utf8;function _t(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function Le(t){this.buf=t,this.pos=0,this.len=t.length}var Kh=typeof Uint8Array!="undefined"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new Le(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new Le(e);throw Error("illegal buffer")},Lh=function(){return Nt.Buffer?function(r){return(Le.create=function(i){return Nt.Buffer.isBuffer(i)?new Fo(i):Kh(i)})(r)}:Kh};Le.create=Lh();Le.prototype._slice=Nt.Array.prototype.subarray||Nt.Array.prototype.slice;Le.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,_t(this,10);return e}}();Le.prototype.int32=function(){return this.uint32()|0};Le.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function Mo(){var t=new Ph(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw _t(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw _t(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}Le.prototype.bool=function(){return this.uint32()!==0};function Is(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}Le.prototype.fixed32=function(){if(this.pos+4>this.len)throw _t(this,4);return Is(this.buf,this.pos+=4)};Le.prototype.sfixed32=function(){if(this.pos+4>this.len)throw _t(this,4);return Is(this.buf,this.pos+=4)|0};function Rh(){if(this.pos+8>this.len)throw _t(this,8);return new Ph(Is(this.buf,this.pos+=4),Is(this.buf,this.pos+=4))}Le.prototype.float=function(){if(this.pos+4>this.len)throw _t(this,4);var e=Nt.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};Le.prototype.double=function(){if(this.pos+8>this.len)throw _t(this,4);var e=Nt.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};Le.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw _t(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};Le.prototype.string=function(){var e=this.bytes();return Yx.read(e,0,e.length)};Le.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw _t(this,e);this.pos+=e}else do if(this.pos>=this.len)throw _t(this);while(this.buf[this.pos++]&128);return this};Le.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!=4;)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};Le._configure=function(t){Fo=t,Le.create=Lh(),Fo._configure();var e=Nt.Long?"toLong":"toNumber";Nt.merge(Le.prototype,{int64:function(){return Mo.call(this)[e](!1)},uint64:function(){return Mo.call(this)[e](!0)},sint64:function(){return Mo.call(this).zzDecode()[e](!1)},fixed64:function(){return Rh.call(this)[e](!0)},sfixed64:function(){return Rh.call(this)[e](!1)}})}});var Uh=S((T4,kh)=>{l();"use strict";kh.exports=Yr;var Dh=Oo();(Yr.prototype=Object.create(Dh.prototype)).constructor=Yr;var Nh=xr();function Yr(t){Dh.call(this,t)}Yr._configure=function(){Nh.Buffer&&(Yr.prototype._slice=Nh.Buffer.prototype.slice)};Yr.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};Yr._configure()});var Mh=S((P4,Fh)=>{l();"use strict";Fh.exports=fi;var qo=xr();(fi.prototype=Object.create(qo.EventEmitter.prototype)).constructor=fi;function fi(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");qo.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(r)}fi.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var a=this;if(!s)return qo.asPromise(t,a,e,r,n,i);if(!a.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return a.rpcImpl(e,r[a.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,f){if(c)return a.emit("error",c,e),s(c);if(f===null){a.end(!0);return}if(!(f instanceof n))try{f=n[a.responseDelimited?"decodeDelimited":"decode"](f)}catch(u){return a.emit("error",u,e),s(u)}return a.emit("data",f,e),s(null,f)})}catch(o){a.emit("error",o,e),setTimeout(function(){s(o)},0);return}};fi.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var qh=S(Oh=>{l();"use strict";var Zx=Oh;Zx.Service=Mh()});var Vh=S((L4,Hh)=>{l();"use strict";Hh.exports={}});var Wh=S(zh=>{l();"use strict";var ct=zh;ct.build="minimal";ct.Writer=Uo();ct.BufferWriter=Ih();ct.Reader=Oo();ct.BufferReader=Uh();ct.util=xr();ct.rpc=qh();ct.roots=Vh();ct.configure=Gh;function Gh(){ct.util._configure(),ct.Writer._configure(ct.BufferWriter),ct.Reader._configure(ct.BufferReader)}Gh()});var Ts=S((k4,jh)=>{l();"use strict";jh.exports=Wh()});var Ks=S((D4,$h)=>{l();"use strict";var Zr=Ts(),Ps=Zr.Reader,Xh=Zr.Writer,Qe=Zr.util,yt=Zr.roots["libp2p-crypto-keys"]||(Zr.roots["libp2p-crypto-keys"]={});yt.KeyType=function(){var t={},e=Object.create(t);return e[t[0]="RSA"]=0,e[t[1]="Ed25519"]=1,e[t[2]="Secp256k1"]=2,e}();yt.PublicKey=function(){function t(e){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)e[r[n]]!=null&&(this[r[n]]=e[r[n]])}return t.prototype.Type=0,t.prototype.Data=Qe.newBuffer([]),t.encode=function(r,n){return n||(n=Xh.create()),n.uint32(8).int32(r.Type),n.uint32(18).bytes(r.Data),n},t.decode=function(r,n){r instanceof Ps||(r=Ps.create(r));for(var i=n===void 0?r.len:r.pos+n,s=new yt.PublicKey;r.pos<i;){var a=r.uint32();switch(a>>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("Type"))throw Qe.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw Qe.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof yt.PublicKey)return r;var n=new yt.PublicKey;switch(r.Type){case"RSA":case 0:n.Type=0;break;case"Ed25519":case 1:n.Type=1;break;case"Secp256k1":case 2:n.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?Qe.base64.decode(r.Data,n.Data=Qe.newBuffer(Qe.base64.length(r.Data)),0):r.Data.length&&(n.Data=r.Data)),n},t.toObject=function(r,n){n||(n={});var i={};return n.defaults&&(i.Type=n.enums===String?"RSA":0,n.bytes===String?i.Data="":(i.Data=[],n.bytes!==Array&&(i.Data=Qe.newBuffer(i.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(i.Type=n.enums===String?yt.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(i.Data=n.bytes===String?Qe.base64.encode(r.Data,0,r.Data.length):n.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,Zr.util.toJSONOptions)},t}();yt.PrivateKey=function(){function t(e){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)e[r[n]]!=null&&(this[r[n]]=e[r[n]])}return t.prototype.Type=0,t.prototype.Data=Qe.newBuffer([]),t.encode=function(r,n){return n||(n=Xh.create()),n.uint32(8).int32(r.Type),n.uint32(18).bytes(r.Data),n},t.decode=function(r,n){r instanceof Ps||(r=Ps.create(r));for(var i=n===void 0?r.len:r.pos+n,s=new yt.PrivateKey;r.pos<i;){var a=r.uint32();switch(a>>>3){case 1:s.Type=r.int32();break;case 2:s.Data=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("Type"))throw Qe.ProtocolError("missing required 'Type'",{instance:s});if(!s.hasOwnProperty("Data"))throw Qe.ProtocolError("missing required 'Data'",{instance:s});return s},t.fromObject=function(r){if(r instanceof yt.PrivateKey)return r;var n=new yt.PrivateKey;switch(r.Type){case"RSA":case 0:n.Type=0;break;case"Ed25519":case 1:n.Type=1;break;case"Secp256k1":case 2:n.Type=2;break}return r.Data!=null&&(typeof r.Data=="string"?Qe.base64.decode(r.Data,n.Data=Qe.newBuffer(Qe.base64.length(r.Data)),0):r.Data.length&&(n.Data=r.Data)),n},t.toObject=function(r,n){n||(n={});var i={};return n.defaults&&(i.Type=n.enums===String?"RSA":0,n.bytes===String?i.Data="":(i.Data=[],n.bytes!==Array&&(i.Data=Qe.newBuffer(i.Data)))),r.Type!=null&&r.hasOwnProperty("Type")&&(i.Type=n.enums===String?yt.KeyType[r.Type]:r.Type),r.Data!=null&&r.hasOwnProperty("Data")&&(i.Data=n.bytes===String?Qe.base64.encode(r.Data,0,r.Data.length):n.bytes===Array?Array.prototype.slice.call(r.Data):r.Data),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,Zr.util.toJSONOptions)},t}();$h.exports=yt});var xe=S((N4,Yh)=>{l();Yh.exports={options:{usePureJavaScript:!1}}});var Jh=S((U4,Zh)=>{l();var Ho={};Zh.exports=Ho;var Qh={};Ho.encode=function(t,e,r){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(t instanceof Uint8Array))n=Qx(t,e);else{var i=0,s=e.length,a=e.charAt(0),o=[0];for(i=0;i<t.length;++i){for(var c=0,f=t[i];c<o.length;++c)f+=o[c]<<8,o[c]=f%s,f=f/s|0;for(;f>0;)o.push(f%s),f=f/s|0}for(i=0;t[i]===0&&i<t.length-1;++i)n+=a;for(i=o.length-1;i>=0;--i)n+=e[o[i]]}if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
`)}return n};Ho.decode=function(t,e){if(typeof t!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var r=Qh[e];if(!r){r=Qh[e]=[];for(var n=0;n<e.length;++n)r[e.charCodeAt(n)]=n}t=t.replace(/\s/g,"");for(var i=e.length,s=e.charAt(0),a=[0],n=0;n<t.length;n++){var o=r[t.charCodeAt(n)];if(o===void 0)return;for(var c=0,f=o;c<a.length;++c)f+=a[c]*i,a[c]=f&255,f>>=8;for(;f>0;)a.push(f&255),f>>=8}for(var u=0;t[u]===s&&u<t.length-1;++u)a.push(0);return typeof Buffer!="undefined"?Buffer.from(a.reverse()):new Uint8Array(a.reverse())};function Qx(t,e){var r=0,n=e.length,i=e.charAt(0),s=[0];for(r=0;r<t.length();++r){for(var a=0,o=t.at(r);a<s.length;++a)o+=s[a]<<8,s[a]=o%n,o=o/n|0;for(;o>0;)s.push(o%n),o=o/n|0}var c="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)c+=i;for(r=s.length-1;r>=0;--r)c+=e[s[r]];return c}});var Re=S((F4,el)=>{l();var tl=xe(),rl=Jh(),x=el.exports=tl.util=tl.util||{};(function(){if(typeof process!="undefined"&&process.nextTick&&!process.browser){x.nextTick=process.nextTick,typeof setImmediate=="function"?x.setImmediate=setImmediate:x.setImmediate=x.nextTick;return}if(typeof setImmediate=="function"){x.setImmediate=function(){return setImmediate.apply(void 0,arguments)},x.nextTick=function(o){return setImmediate(o)};return}if(x.setImmediate=function(o){setTimeout(o,0)},typeof window!="undefined"&&typeof window.postMessage=="function"){let o=function(c){if(c.source===window&&c.data===t){c.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(u){u()})}};var a=o,t="forge.setImmediate",e=[];x.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver!="undefined"){var r=Date.now(),n=!0,i=document.createElement("div"),e=[];new MutationObserver(function(){var c=e.slice();e.length=0,c.forEach(function(f){f()})}).observe(i,{attributes:!0});var s=x.setImmediate;x.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),s(c)):(e.push(c),e.length===1&&i.setAttribute("a",n=!n))}}x.nextTick=x.setImmediate})();x.isNodejs=typeof process!="undefined"&&process.versions&&process.versions.node;x.globalScope=function(){return x.isNodejs?globalThis:typeof self=="undefined"?window:self}();x.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};x.isArrayBuffer=function(t){return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer};x.isArrayBufferView=function(t){return t&&x.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function ui(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}x.ByteBuffer=Vo;function Vo(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(x.isArrayBuffer(t)||x.isArrayBufferView(t))if(typeof Buffer!="undefined"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(n){for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof Vo||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}x.ByteStringBuffer=Vo;var Jx=4096;x.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>Jx&&(this.data.substr(0,1),this._constructedStringLength=0)};x.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};x.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};x.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};x.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this};x.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};x.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(x.encodeUtf8(t))};x.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};x.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};x.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};x.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};x.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};x.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};x.ByteStringBuffer.prototype.putInt=function(t,e){ui(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};x.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};x.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};x.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};x.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};x.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t};x.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t};x.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};x.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t};x.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t};x.ByteStringBuffer.prototype.getInt=function(t){ui(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};x.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};x.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};x.ByteStringBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};x.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};x.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};x.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};x.ByteStringBuffer.prototype.copy=function(){var t=x.createBuffer(this.data);return t.read=this.read,t};x.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};x.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};x.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};x.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t};x.ByteStringBuffer.prototype.toString=function(){return x.decodeUtf8(this.bytes())};function ev(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=x.isArrayBuffer(t),n=x.isArrayBufferView(t);if(r||n){r?this.data=new DataView(t):this.data=new DataView(t.buffer,t.byteOffset,t.byteLength),this.write="writeOffset"in e?e.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,t!=null&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}x.DataBuffer=ev;x.DataBuffer.prototype.length=function(){return this.write-this.read};x.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};x.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this};x.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};x.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};x.DataBuffer.prototype.putBytes=function(t,e){if(x.isArrayBufferView(t)){var r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=r.byteLength-r.byteOffset;this.accommodate(n);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=n,this}if(x.isArrayBuffer(t)){var r=new Uint8Array(t);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(t instanceof x.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&x.isArrayBufferView(t.data)){var r=new Uint8Array(t.data.byteLength,t.read,t.length());this.accommodate(r.byteLength);var i=new Uint8Array(t.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(t instanceof x.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var s;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.hex.decode(t,s,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.base64.decode(t,s,this.write),this;if(e==="utf8"&&(t=x.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=x.binary.raw.decode(s),this;if(e==="utf16")return this.accommodate(t.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=x.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};x.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};x.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};x.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};x.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};x.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};x.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};x.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};x.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};x.DataBuffer.prototype.putInt=function(t,e){ui(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};x.DataBuffer.prototype.putSignedInt=function(t,e){return ui(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};x.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};x.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};x.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};x.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};x.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};x.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};x.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};x.DataBuffer.prototype.getInt=function(t){ui(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};x.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};x.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};x.DataBuffer.prototype.bytes=function(t){return typeof t=="undefined"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};x.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};x.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};x.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};x.DataBuffer.prototype.copy=function(){return new x.DataBuffer(this)};x.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};x.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};x.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};x.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t};x.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return x.binary.raw.encode(e);if(t==="hex")return x.binary.hex.encode(e);if(t==="base64")return x.binary.base64.encode(e);if(t==="utf8")return x.text.utf8.decode(e);if(t==="utf16")return x.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};x.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=x.encodeUtf8(t)),new x.ByteBuffer(t)};x.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};x.xorBytes=function(t,e,r){for(var n="",i="",s="",a=0,o=0;r>0;--r,++a)i=t.charCodeAt(a)^e.charCodeAt(a),o>=10&&(n+=s,s="",o=0),s+=String.fromCharCode(i),++o;return n+=s,n};x.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e};x.bytesToHex=function(t){return x.createBuffer(t).toHex()};x.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var mr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",wr=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],nl="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";x.encode64=function(t,e){for(var r="",n="",i,s,a,o=0;o<t.length;)i=t.charCodeAt(o++),s=t.charCodeAt(o++),a=t.charCodeAt(o++),r+=mr.charAt(i>>2),r+=mr.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=mr.charAt((s&15)<<2|a>>6),r+=isNaN(a)?"=":mr.charAt(a&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
`,r=r.substr(e));return n+=r,n};x.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,s,a=0;a<t.length;)r=wr[t.charCodeAt(a++)-43],n=wr[t.charCodeAt(a++)-43],i=wr[t.charCodeAt(a++)-43],s=wr[t.charCodeAt(a++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),s!==64&&(e+=String.fromCharCode((i&3)<<6|s)));return e};x.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};x.decodeUtf8=function(t){return decodeURIComponent(escape(t))};x.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:rl.encode,decode:rl.decode}};x.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};x.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);return e?i-r:n};x.binary.hex.encode=x.bytesToHex;x.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2))),r=r||0;var i=0,s=r;for(t.length&1&&(i=1,n[s++]=parseInt(t[0],16));i<t.length;i+=2)n[s++]=parseInt(t.substr(i,2),16);return e?s-r:n};x.binary.base64.encode=function(t,e){for(var r="",n="",i,s,a,o=0;o<t.byteLength;)i=t[o++],s=t[o++],a=t[o++],r+=mr.charAt(i>>2),r+=mr.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=mr.charAt((s&15)<<2|a>>6),r+=isNaN(a)?"=":mr.charAt(a&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
`,r=r.substr(e));return n+=r,n};x.binary.base64.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,s,a,o,c=0,f=r;c<t.length;)i=wr[t.charCodeAt(c++)-43],s=wr[t.charCodeAt(c++)-43],a=wr[t.charCodeAt(c++)-43],o=wr[t.charCodeAt(c++)-43],n[f++]=i<<2|s>>4,a!==64&&(n[f++]=(s&15)<<4|a>>2,o!==64&&(n[f++]=(a&3)<<6|o));return e?f-r:n.subarray(0,f)};x.binary.base58.encode=function(t,e){return x.binary.baseN.encode(t,nl,e)};x.binary.base58.decode=function(t,e){return x.binary.baseN.decode(t,nl,e)};x.text={utf8:{},utf16:{}};x.text.utf8.encode=function(t,e,r){t=x.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);return e?i-r:n};x.text.utf8.decode=function(t){return x.decodeUtf8(String.fromCharCode.apply(null,t))};x.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length*2));var i=new Uint16Array(n.buffer);r=r||0;for(var s=r,a=r,o=0;o<t.length;++o)i[a++]=t.charCodeAt(o),s+=2;return e?s-r:n};x.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};x.deflate=function(t,e,r){if(e=x.decode64(t.deflate(x.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};x.inflate=function(t,e,r){var n=t.inflate(x.encode64(e)).rval;return n===null?null:x.decode64(n)};var zo=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=x.encode64(JSON.stringify(r)),n=t.setItem(e,r)),typeof n!="undefined"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},Go=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(r.rval===null){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(x.decode64(r))),r},tv=function(t,e,r,n){var i=Go(t,e);i===null&&(i={}),i[r]=n,zo(t,e,i)},rv=function(t,e,r){var n=Go(t,e);return n!==null&&(n=r in n?n[r]:null),n},nv=function(t,e,r){var n=Go(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),zo(t,e,n)}},iv=function(t,e){zo(t,e,null)},Ls=function(t,e,r){var n=null;typeof r=="undefined"&&(r=["web","flash"]);var i,s=!1,a=null;for(var o in r){i=r[o];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),s=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),s=!0)}catch(c){a=c}if(s)break}if(!s)throw a;return n};x.setItem=function(t,e,r,n,i){Ls(tv,arguments,i)};x.getItem=function(t,e,r,n){return Ls(rv,arguments,n)};x.removeItem=function(t,e,r,n){Ls(nv,arguments,n)};x.clearItems=function(t,e,r){Ls(iv,arguments,r)};x.parseUrl=function(t){var e=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;e.lastIndex=0;var r=e.exec(t),n=r===null?null:{full:t,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?(n.port!==80&&n.scheme==="http"||n.port!==443&&n.scheme==="https")&&(n.fullHost+=":"+n.port):n.scheme==="http"?n.port=80:n.scheme==="https"&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var Rs=null;x.getQueryVariables=function(t){var e=function(n){for(var i={},s=n.split("&"),a=0;a<s.length;a++){var o=s[a].indexOf("="),c,f;o>0?(c=s[a].substring(0,o),f=s[a].substring(o+1)):(c=s[a],f=null),c in i||(i[c]=[]),!(c in Object.prototype)&&f!==null&&i[c].push(unescape(f))}return i},r;return typeof t=="undefined"?(Rs===null&&(typeof window!="undefined"&&window.location&&window.location.search?Rs=e(window.location.search.substring(1)):Rs={}),r=Rs):r=e(t),r};x.parseFragment=function(t){var e=t,r="",n=t.indexOf("?");n>0&&(e=t.substring(0,n),r=t.substring(n+1));var i=e.split("/");i.length>0&&i[0]===""&&i.shift();var s=r===""?{}:x.getQueryVariables(r);return{pathString:e,queryString:r,path:i,query:s}};x.makeRequest=function(t){var e=x.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(n){return typeof n=="undefined"?e.path:e.path[n]},getQuery:function(n,i){var s;return typeof n=="undefined"?s=e.query:(s=e.query[n],s&&typeof i!="undefined"&&(s=s[i])),s},getQueryLast:function(n,i){var s,a=r.getQuery(n);return a?s=a[a.length-1]:s=i,s}};return r};x.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var n=jQuery.param(e||{});return r=r||"",t+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")};x.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};x.format=function(t){for(var e=/%./g,r,n,i=0,s=[],a=0;r=e.exec(t);){n=t.substring(a,e.lastIndex-2),n.length>0&&s.push(n),a=e.lastIndex;var o=r[0][1];switch(o){case"s":case"o":i<arguments.length?s.push(arguments[i+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(t.substring(a)),s.join("")};x.formatNumber=function(t,e,r,n){var i=t,s=isNaN(e=Math.abs(e))?2:e,a=r===void 0?",":r,o=n===void 0?".":n,c=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+o:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?a+Math.abs(i-f).toFixed(s).slice(2):"")};x.formatSize=function(t){return t>=1073741824?t=x.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=x.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=x.formatNumber(t/1024,0)+" KiB":t=x.formatNumber(t,0)+" bytes",t};x.bytesFromIP=function(t){return t.indexOf(".")!==-1?x.bytesFromIPv4(t):t.indexOf(":")!==-1?x.bytesFromIPv6(t):null};x.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=x.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};x.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(a){return a.length===0&&++e,!0});for(var r=(8-t.length+e)*2,n=x.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var s=x.hexToBytes(t[i]);s.length<2&&n.putByte(0),n.putBytes(s)}return n.getBytes()};x.bytesToIP=function(t){return t.length===4?x.bytesToIPv4(t):t.length===16?x.bytesToIPv6(t):null};x.bytesToIPv4=function(t){if(t.length!==4)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")};x.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var s=x.bytesToHex(t[i]+t[i+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var a=r[r.length-1],o=e.length;!a||o!==a.end+1?r.push({start:o,end:o}):(a.end=o,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(s)}if(r.length>0){var c=r[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),c.start===0&&e.unshift(""),c.end===7&&e.push(""))}return e.join(":")};x.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in x&&!t.update)return e(null,x.cores);if(typeof navigator!="undefined"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return x.cores=navigator.hardwareConcurrency,e(null,x.cores);if(typeof Worker=="undefined")return x.cores=1,e(null,x.cores);if(typeof Blob=="undefined")return x.cores=2,e(null,x.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){for(var o=Date.now(),c=o+4;Date.now()<c;);self.postMessage({st:o,et:c})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(a,o,c){if(o===0){var f=Math.floor(a.reduce(function(u,h){return u+h},0)/a.length);return x.cores=Math.max(1,f),URL.revokeObjectURL(r),e(null,x.cores)}i(c,function(u,h){a.push(s(c,h)),n(a,o-1,c)})}function i(a,o){for(var c=[],f=[],u=0;u<a;++u){var h=new Worker(r);h.addEventListener("message",function(p){if(f.push(p.data),f.length===a){for(var y=0;y<a;++y)c[y].terminate();o(null,f)}}),c.push(h)}for(var u=0;u<a;++u)c[u].postMessage(u)}function s(a,o){for(var c=[],f=0;f<a;++f)for(var u=o[f],h=c[f]=[],p=0;p<a;++p)if(f!==p){var y=o[p];(u.st>y.st&&u.st<y.et||y.st>u.st&&y.st<u.et)&&h.push(p)}return c.reduce(function(d,g){return Math.max(d,g.length)},0)}}});var ks=S((M4,il)=>{l();var hi=xe();hi.pki=hi.pki||{};var Wo=il.exports=hi.pki.oids=hi.oids=hi.oids||{};function R(t,e){Wo[t]=e,Wo[e]=t}function pe(t,e){Wo[t]=e}R("1.2.840.113549.1.1.1","rsaEncryption");R("1.2.840.113549.1.1.4","md5WithRSAEncryption");R("1.2.840.113549.1.1.5","sha1WithRSAEncryption");R("1.2.840.113549.1.1.7","RSAES-OAEP");R("1.2.840.113549.1.1.8","mgf1");R("1.2.840.113549.1.1.9","pSpecified");R("1.2.840.113549.1.1.10","RSASSA-PSS");R("1.2.840.113549.1.1.11","sha256WithRSAEncryption");R("1.2.840.113549.1.1.12","sha384WithRSAEncryption");R("1.2.840.113549.1.1.13","sha512WithRSAEncryption");R("1.3.101.112","EdDSA25519");R("1.2.840.10040.4.3","dsa-with-sha1");R("1.3.14.3.2.7","desCBC");R("1.3.14.3.2.26","sha1");R("2.16.840.1.101.3.4.2.1","sha256");R("2.16.840.1.101.3.4.2.2","sha384");R("2.16.840.1.101.3.4.2.3","sha512");R("1.2.840.113549.2.5","md5");R("1.2.840.113549.1.7.1","data");R("1.2.840.113549.1.7.2","signedData");R("1.2.840.113549.1.7.3","envelopedData");R("1.2.840.113549.1.7.4","signedAndEnvelopedData");R("1.2.840.113549.1.7.5","digestedData");R("1.2.840.113549.1.7.6","encryptedData");R("1.2.840.113549.1.9.1","emailAddress");R("1.2.840.113549.1.9.2","unstructuredName");R("1.2.840.113549.1.9.3","contentType");R("1.2.840.113549.1.9.4","messageDigest");R("1.2.840.113549.1.9.5","signingTime");R("1.2.840.113549.1.9.6","counterSignature");R("1.2.840.113549.1.9.7","challengePassword");R("1.2.840.113549.1.9.8","unstructuredAddress");R("1.2.840.113549.1.9.14","extensionRequest");R("1.2.840.113549.1.9.20","friendlyName");R("1.2.840.113549.1.9.21","localKeyId");R("1.2.840.113549.1.9.22.1","x509Certificate");R("1.2.840.113549.1.12.10.1.1","keyBag");R("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");R("1.2.840.113549.1.12.10.1.3","certBag");R("1.2.840.113549.1.12.10.1.4","crlBag");R("1.2.840.113549.1.12.10.1.5","secretBag");R("1.2.840.113549.1.12.10.1.6","safeContentsBag");R("1.2.840.113549.1.5.13","pkcs5PBES2");R("1.2.840.113549.1.5.12","pkcs5PBKDF2");R("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");R("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");R("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");R("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");R("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");R("1.2.840.113549.2.7","hmacWithSHA1");R("1.2.840.113549.2.8","hmacWithSHA224");R("1.2.840.113549.2.9","hmacWithSHA256");R("1.2.840.113549.2.10","hmacWithSHA384");R("1.2.840.113549.2.11","hmacWithSHA512");R("1.2.840.113549.3.7","des-EDE3-CBC");R("2.16.840.1.101.3.4.1.2","aes128-CBC");R("2.16.840.1.101.3.4.1.22","aes192-CBC");R("2.16.840.1.101.3.4.1.42","aes256-CBC");R("2.5.4.3","commonName");R("2.5.4.5","serialName");R("2.5.4.6","countryName");R("2.5.4.7","localityName");R("2.5.4.8","stateOrProvinceName");R("2.5.4.9","streetAddress");R("2.5.4.10","organizationName");R("2.5.4.11","organizationalUnitName");R("2.5.4.13","description");R("2.5.4.15","businessCategory");R("2.5.4.17","postalCode");R("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");R("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");R("2.16.840.1.113730.1.1","nsCertType");R("2.16.840.1.113730.1.13","nsComment");pe("2.5.29.1","authorityKeyIdentifier");pe("2.5.29.2","keyAttributes");pe("2.5.29.3","certificatePolicies");pe("2.5.29.4","keyUsageRestriction");pe("2.5.29.5","policyMapping");pe("2.5.29.6","subtreesConstraint");pe("2.5.29.7","subjectAltName");pe("2.5.29.8","issuerAltName");pe("2.5.29.9","subjectDirectoryAttributes");pe("2.5.29.10","basicConstraints");pe("2.5.29.11","nameConstraints");pe("2.5.29.12","policyConstraints");pe("2.5.29.13","basicConstraints");R("2.5.29.14","subjectKeyIdentifier");R("2.5.29.15","keyUsage");pe("2.5.29.16","privateKeyUsagePeriod");R("2.5.29.17","subjectAltName");R("2.5.29.18","issuerAltName");R("2.5.29.19","basicConstraints");pe("2.5.29.20","cRLNumber");pe("2.5.29.21","cRLReason");pe("2.5.29.22","expirationDate");pe("2.5.29.23","instructionCode");pe("2.5.29.24","invalidityDate");pe("2.5.29.25","cRLDistributionPoints");pe("2.5.29.26","issuingDistributionPoint");pe("2.5.29.27","deltaCRLIndicator");pe("2.5.29.28","issuingDistributionPoint");pe("2.5.29.29","certificateIssuer");pe("2.5.29.30","nameConstraints");R("2.5.29.31","cRLDistributionPoints");R("2.5.29.32","certificatePolicies");pe("2.5.29.33","policyMappings");pe("2.5.29.34","policyConstraints");R("2.5.29.35","authorityKeyIdentifier");pe("2.5.29.36","policyConstraints");R("2.5.29.37","extKeyUsage");pe("2.5.29.46","freshestCRL");pe("2.5.29.54","inhibitAnyPolicy");R("1.3.6.1.4.1.11129.2.4.2","timestampList");R("1.3.6.1.5.5.7.1.1","authorityInfoAccess");R("1.3.6.1.5.5.7.3.1","serverAuth");R("1.3.6.1.5.5.7.3.2","clientAuth");R("1.3.6.1.5.5.7.3.3","codeSigning");R("1.3.6.1.5.5.7.3.4","emailProtection");R("1.3.6.1.5.5.7.3.8","timeStamping")});var pi=S((O4,sl)=>{l();var Ae=xe();Re();ks();var D=sl.exports=Ae.asn1=Ae.asn1||{};D.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};D.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};D.create=function(t,e,r,n,i){if(Ae.util.isArray(n)){for(var s=[],a=0;a<n.length;++a)n[a]!==void 0&&s.push(n[a]);n=s}var o={tagClass:t,type:e,constructed:r,composed:r||Ae.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(o.bitStringContents=i.bitStringContents,o.original=D.copy(o)),o};D.copy=function(t,e){var r;if(Ae.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(D.copy(t[n],e));return r}return typeof t=="string"?t:(r={tagClass:t.tagClass,type:t.type,constructed:t.constructed,composed:t.composed,value:D.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};D.equals=function(t,e,r){if(Ae.util.isArray(t)){if(!Ae.util.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;++n)if(!D.equals(t[n],e[n]))return!1;return!0}if(typeof t!=typeof e)return!1;if(typeof t=="string")return t===e;var i=t.tagClass===e.tagClass&&t.type===e.type&&t.constructed===e.constructed&&t.composed===e.composed&&D.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};D.getBerValueLength=function(t){var e=t.getByte();if(e!==128){var r,n=e&128;return n?r=t.getInt((e&127)<<3):r=e,r}};function li(t,e,r){if(r>e){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}var sv=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var s=r&127;li(t,e,s),n=t.getInt(s<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};D.fromDer=function(t,e){return e===void 0&&(e={strict:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=Ae.util.createBuffer(t)),Ds(t,t.length(),0,e)};function Ds(t,e,r,n){var i;li(t,e,2);var s=t.getByte();e--;var a=s&192,o=s&31;i=t.length();var c=sv(t,e);if(e-=i-t.length(),c!==void 0&&c>e){if(n.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=t.length(),f.remaining=e,f.requested=c,f}c=e}var u,h,p=(s&32)==32;if(p)if(u=[],c===void 0)for(;;){if(li(t,e,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),e-=2;break}i=t.length(),u.push(Ds(t,e,r+1,n)),e-=i-t.length()}else for(;c>0;)i=t.length(),u.push(Ds(t,c,r+1,n)),e-=i-t.length(),c-=i-t.length();if(u===void 0&&a===D.Class.UNIVERSAL&&o===D.Type.BITSTRING&&(h=t.bytes(c)),u===void 0&&n.decodeBitStrings&&a===D.Class.UNIVERSAL&&o===D.Type.BITSTRING&&c>1){var y=t.read,d=e,g=0;if(o===D.Type.BITSTRING&&(li(t,e,1),g=t.getByte(),e--),g===0)try{i=t.length();var v={verbose:n.verbose,strict:!0,decodeBitStrings:!0},b=Ds(t,e,r+1,v),w=i-t.length();e-=w,o==D.Type.BITSTRING&&w++;var E=b.tagClass;w===c&&(E===D.Class.UNIVERSAL||E===D.Class.CONTEXT_SPECIFIC)&&(u=[b])}catch(A){}u===void 0&&(t.read=y,e=d)}if(u===void 0){if(c===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");c=e}if(o===D.Type.BMPSTRING)for(u="";c>0;c-=2)li(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(c)}var T=h===void 0?null:{bitStringContents:h};return D.create(a,o,p,u,T)}D.toDer=function(t){var e=Ae.util.createBuffer(),r=t.tagClass|t.type,n=Ae.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=D.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var s=0;s<t.value.length;++s)t.value[s]!==void 0&&n.putBuffer(D.toDer(t.value[s]))}else if(t.type===D.Type.BMPSTRING)for(var s=0;s<t.value.length;++s)n.putInt16(t.value.charCodeAt(s));else t.type===D.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&(t.value.charCodeAt(1)&128)==0||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)==128)?n.putBytes(t.value.substr(1)):n.putBytes(t.value);if(e.putByte(r),n.length()<=127)e.putByte(n.length()&127);else{var a=n.length(),o="";do o+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)e.putByte(o.charCodeAt(s))}return e.putBuffer(n),e};D.oidToDer=function(t){var e=t.split("."),r=Ae.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,s,a,o=2;o<e.length;++o){n=!0,i=[],s=parseInt(e[o],10);do a=s&127,s=s>>>7,n||(a|=128),i.push(a),n=!1;while(s>0);for(var c=i.length-1;c>=0;--c)r.putByte(i[c])}return r};D.derToOid=function(t){var e;typeof t=="string"&&(t=Ae.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)r=t.getByte(),n=n<<7,r&128?n+=r&127:(e+="."+(n+r),n=0);return e};D.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,i=parseInt(t.substr(4,2),10),s=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=0;if(t.length>11){var c=t.charAt(10),f=10;c!=="+"&&c!=="-"&&(o=parseInt(t.substr(10,2),10),f+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(s,a,o,0),f&&(c=t.charAt(f),c==="+"||c==="-")){var u=parseInt(t.substr(f+1,2),10),h=parseInt(t.substr(f+4,2),10),p=u*60+h;p*=6e4,c==="+"?e.setTime(+e-p):e.setTime(+e+p)}return e};D.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,i=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=parseInt(t.substr(10,2),10),o=parseInt(t.substr(12,2),10),c=0,f=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var h=t.length-5,p=t.charAt(h);if(p==="+"||p==="-"){var y=parseInt(t.substr(h+1,2),10),d=parseInt(t.substr(h+4,2),10);f=y*60+d,f*=6e4,p==="+"&&(f*=-1),u=!0}return t.charAt(14)==="."&&(c=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(s,a,o,c),e.setTime(+e+f)):(e.setFullYear(r,n,i),e.setHours(s,a,o,c)),e};D.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};D.dateToGeneralizedTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push(""+t.getUTCFullYear()),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+="Z",e};D.integerToDer=function(t){var e=Ae.util.createBuffer();if(t>=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};D.derToInteger=function(t){typeof t=="string"&&(t=Ae.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};D.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass=="undefined")&&(t.type===e.type||typeof e.type=="undefined"))if(t.constructed===e.constructed||typeof e.constructed=="undefined"){if(i=!0,e.value&&Ae.util.isArray(e.value))for(var s=0,a=0;i&&a<e.value.length;++a)i=e.value[a].optional||!1,t.value[s]&&(i=D.validate(t.value[s],e.value[a],r,n),i?++s:e.value[a].optional&&(i=!0)),!i&&n&&n.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+t.value.length+'"');if(i&&r&&(e.capture&&(r[e.capture]=t.value),e.captureAsn1&&(r[e.captureAsn1]=t),e.captureBitStringContents&&"bitStringContents"in t&&(r[e.captureBitStringContents]=t.bitStringContents),e.captureBitStringValue&&"bitStringContents"in t)){var o;if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{var c=t.bitStringContents.charCodeAt(0);if(c!==0)throw new Error("captureBitStringValue only supported for zero unused bits");r[e.captureBitStringValue]=t.bitStringContents.slice(1)}}}else n&&n.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+t.constructed+'"');else n&&(t.tagClass!==e.tagClass&&n.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&n.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));return i};var al=/[^\\u0000-\\u00ff]/;D.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
`);for(var i="",s=0;s<e*r;++s)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case D.Class.UNIVERSAL:n+="Universal:";break;case D.Class.APPLICATION:n+="Application:";break;case D.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case D.Class.PRIVATE:n+="Private:";break}if(t.tagClass===D.Class.UNIVERSAL)switch(n+=t.type,t.type){case D.Type.NONE:n+=" (None)";break;case D.Type.BOOLEAN:n+=" (Boolean)";break;case D.Type.INTEGER:n+=" (Integer)";break;case D.Type.BITSTRING:n+=" (Bit string)";break;case D.Type.OCTETSTRING:n+=" (Octet string)";break;case D.Type.NULL:n+=" (Null)";break;case D.Type.OID:n+=" (Object Identifier)";break;case D.Type.ODESC:n+=" (Object Descriptor)";break;case D.Type.EXTERNAL:n+=" (External or Instance of)";break;case D.Type.REAL:n+=" (Real)";break;case D.Type.ENUMERATED:n+=" (Enumerated)";break;case D.Type.EMBEDDED:n+=" (Embedded PDV)";break;case D.Type.UTF8:n+=" (UTF8)";break;case D.Type.ROID:n+=" (Relative Object Identifier)";break;case D.Type.SEQUENCE:n+=" (Sequence)";break;case D.Type.SET:n+=" (Set)";break;case D.Type.PRINTABLESTRING:n+=" (Printable String)";break;case D.Type.IA5String:n+=" (IA5String (ASCII))";break;case D.Type.UTCTIME:n+=" (UTC time)";break;case D.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case D.Type.BMPSTRING:n+=" (BMP String)";break}else n+=t.type;if(n+=`
`,n+=i+"Constructed: "+t.constructed+`
`,t.composed){for(var a=0,o="",s=0;s<t.value.length;++s)t.value[s]!==void 0&&(a+=1,o+=D.prettyPrint(t.value[s],e+1,r),s+1<t.value.length&&(o+=","));n+=i+"Sub values: "+a+o}else{if(n+=i+"Value: ",t.type===D.Type.OID){var c=D.derToOid(t.value);n+=c,Ae.pki&&Ae.pki.oids&&c in Ae.pki.oids&&(n+=" ("+Ae.pki.oids[c]+") ")}if(t.type===D.Type.INTEGER)try{n+=D.derToInteger(t.value)}catch(u){n+="0x"+Ae.util.bytesToHex(t.value)}else if(t.type===D.Type.BITSTRING){if(t.value.length>1?n+="0x"+Ae.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var f=t.value.charCodeAt(0);f==1?n+=" (1 unused bit shown)":f>1&&(n+=" ("+f+" unused bits shown)")}}else t.type===D.Type.OCTETSTRING?(al.test(t.value)||(n+="("+t.value+") "),n+="0x"+Ae.util.bytesToHex(t.value)):t.type===D.Type.UTF8?n+=Ae.util.decodeUtf8(t.value):t.type===D.Type.PRINTABLESTRING||t.type===D.Type.IA5String?n+=t.value:al.test(t.value)?n+="0x"+Ae.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var $o=S((q4,ol)=>{l();var Fe=xe();Re();ol.exports=Fe.cipher=Fe.cipher||{};Fe.cipher.algorithms=Fe.cipher.algorithms||{};Fe.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Fe.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Fe.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Fe.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Fe.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Fe.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Fe.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Fe.cipher.algorithms[t]=e};Fe.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Fe.cipher.algorithms?Fe.cipher.algorithms[t]:null};var jo=Fe.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};jo.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=Fe.util.createBuffer(),this.output=t.output||Fe.util.createBuffer(),this.mode.start(e)};jo.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};jo.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var Yo=S((H4,cl)=>{l();var Me=xe();Re();Me.cipher=Me.cipher||{};var Q=cl.exports=Me.cipher.modes=Me.cipher.modes||{};Q.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.ecb.prototype.start=function(t){};Q.ecb.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])};Q.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.ecb.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};Q.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=Ns(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};Q.cbc.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock};Q.cbc.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)};Q.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0};Q.cbc.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};Q.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Me.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Ns(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32()^this._outBlock[i],e.putInt32(this._inBlock[i]);return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32(),e.putInt32(this._inBlock[i]^this._outBlock[i]);return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Me.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Ns(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb.prototype.decrypt=Q.ofb.prototype.encrypt;Q.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Me.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Ns(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Us(this._inBlock)};Q.ctr.prototype.decrypt=Q.ctr.prototype.encrypt;Q.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Me.util.createBuffer(),this._partialBytes=0,this._R=3774873600};Q.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=Me.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Me.util.createBuffer(t.additionalData):r=Me.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Me.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Xo(n*8)))}this._inBlock=this._j0.slice(0),Us(this._inBlock),this._partialBytes=0,r=Me.util.createBuffer(r),this._aDataLength=Xo(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Q.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^=t.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Us(this._inBlock)};Q.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Us(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize};Q.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=Me.util.createBuffer();var n=this._aDataLength.concat(Xo(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^i[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};Q.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],n=e.slice(0),i=0;i<128;++i){var s=t[i/32|0]&1<<31-i%32;s&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r};Q.gcm.prototype.pow=function(t,e){for(var r=t[3]&1,n=3;n>0;--n)e[n]=t[n]>>>1|(t[n-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Q.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=t[n]>>>(7-r%8)*4&15,s=this._m[r][i];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};Q.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Q.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,s=new Array(i),a=0;a<i;++a){var o=[0,0,0,0],c=a/n|0,f=(n-1-a%n)*e;o[c]=1<<e-1<<f,s[a]=this.generateSubHashTable(this.multiply(o,t),e)}return s};Q.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,n=r>>>1,i=new Array(r);i[n]=t.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var a=1;a<s;++a){var o=i[s],c=i[a];i[s+a]=[o[0]^c[0],o[1]^c[1],o[2]^c[2],o[3]^c[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var f=i[s^n];i[s]=[t[0]^f[0],t[1]^f[1],t[2]^f[2],t[3]^f[3]]}return i};function Ns(t,e){if(typeof t=="string"&&(t=Me.util.createBuffer(t)),Me.util.isArray(t)&&t.length>4){var r=t;t=Me.util.createBuffer();for(var n=0;n<r.length;++n)t.putByte(r[n])}if(t.length()<e)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+e+" bytes.");if(!Me.util.isArray(t)){for(var i=[],s=e/4,n=0;n<s;++n)i.push(t.getInt32());t=i}return t}function Us(t){t[t.length-1]=t[t.length-1]+1&4294967295}function Xo(t){return[t/4294967296|0,t&4294967295]}});var e0=S((V4,fl)=>{l();var we=xe();$o();Yo();Re();fl.exports=we.aes=we.aes||{};we.aes.startEncrypting=function(t,e,r,n){var i=Fs({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};we.aes.createEncryptionCipher=function(t,e){return Fs({key:t,output:null,decrypt:!1,mode:e})};we.aes.startDecrypting=function(t,e,r,n){var i=Fs({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};we.aes.createDecryptionCipher=function(t,e){return Fs({key:t,output:null,decrypt:!0,mode:e})};we.aes.Algorithm=function(t,e){Zo||ul();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return Qo(r._w,n,i,!1)},decrypt:function(n,i){return Qo(r._w,n,i,!0)}}}),r._init=!1};we.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=we.util.createBuffer(e);else if(we.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=we.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!we.util.isArray(e)){r=e,e=[];var i=r.length();if(i===16||i===24||i===32){i=i>>>2;for(var n=0;n<i;++n)e.push(r.getInt32())}}if(!we.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,a=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=hl(e,t.decrypt&&!a),this._init=!0}};we.aes._expandKey=function(t,e){return Zo||ul(),hl(t,e)};we.aes._updateBlock=Qo;An("AES-ECB",we.cipher.modes.ecb);An("AES-CBC",we.cipher.modes.cbc);An("AES-CFB",we.cipher.modes.cfb);An("AES-OFB",we.cipher.modes.ofb);An("AES-CTR",we.cipher.modes.ctr);An("AES-GCM",we.cipher.modes.gcm);function An(t,e){var r=function(){return new we.aes.Algorithm(t,e)};we.cipher.registerAlgorithm(t,r)}var Zo=!1,Cn=4,rt,Jo,ll,Qr,At;function ul(){Zo=!0,ll=[0,1,2,4,8,16,32,64,128,27,54];for(var t=new Array(256),e=0;e<128;++e)t[e]=e<<1,t[e+128]=e+128<<1^283;rt=new Array(256),Jo=new Array(256),Qr=new Array(4),At=new Array(4);for(var e=0;e<4;++e)Qr[e]=new Array(256),At[e]=new Array(256);for(var r=0,n=0,i,s,a,o,c,f,u,e=0;e<256;++e){o=n^n<<1^n<<2^n<<3^n<<4,o=o>>8^o&255^99,rt[r]=o,Jo[o]=r,c=t[o],i=t[r],s=t[i],a=t[s],f=c<<24^o<<16^o<<8^(o^c),u=(i^s^a)<<24^(r^a)<<16^(r^s^a)<<8^(r^i^a);for(var h=0;h<4;++h)Qr[h][r]=f,At[h][o]=u,f=f<<24|f>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^a]]],n^=t[t[n]])}}function hl(t,e){for(var r=t.slice(0),n,i=1,s=r.length,a=s+6+1,o=Cn*a,c=s;c<o;++c)n=r[c-1],c%s==0?(n=rt[n>>>16&255]<<24^rt[n>>>8&255]<<16^rt[n&255]<<8^rt[n>>>24]^ll[i]<<24,i++):s>6&&c%s==4&&(n=rt[n>>>24]<<24^rt[n>>>16&255]<<16^rt[n>>>8&255]<<8^rt[n&255]),r[c]=r[c-s]^n;if(e){var f,u=At[0],h=At[1],p=At[2],y=At[3],d=r.slice(0);o=r.length;for(var c=0,g=o-Cn;c<o;c+=Cn,g-=Cn)if(c===0||c===o-Cn)d[c]=r[g],d[c+1]=r[g+3],d[c+2]=r[g+2],d[c+3]=r[g+1];else for(var v=0;v<Cn;++v)f=r[g+v],d[c+(3&-v)]=u[rt[f>>>24]]^h[rt[f>>>16&255]]^p[rt[f>>>8&255]]^y[rt[f&255]];r=d}return r}function Qo(t,e,r,n){var i=t.length/4-1,s,a,o,c,f;n?(s=At[0],a=At[1],o=At[2],c=At[3],f=Jo):(s=Qr[0],a=Qr[1],o=Qr[2],c=Qr[3],f=rt);var u,h,p,y,d,g,v;u=e[0]^t[0],h=e[n?3:1]^t[1],p=e[2]^t[2],y=e[n?1:3]^t[3];for(var b=3,w=1;w<i;++w)d=s[u>>>24]^a[h>>>16&255]^o[p>>>8&255]^c[y&255]^t[++b],g=s[h>>>24]^a[p>>>16&255]^o[y>>>8&255]^c[u&255]^t[++b],v=s[p>>>24]^a[y>>>16&255]^o[u>>>8&255]^c[h&255]^t[++b],y=s[y>>>24]^a[u>>>16&255]^o[h>>>8&255]^c[p&255]^t[++b],u=d,h=g,p=v;r[0]=f[u>>>24]<<24^f[h>>>16&255]<<16^f[p>>>8&255]<<8^f[y&255]^t[++b],r[n?3:1]=f[h>>>24]<<24^f[p>>>16&255]<<16^f[y>>>8&255]<<8^f[u&255]^t[++b],r[2]=f[p>>>24]<<24^f[y>>>16&255]<<16^f[u>>>8&255]<<8^f[h&255]^t[++b],r[n?1:3]=f[y>>>24]<<24^f[u>>>16&255]<<16^f[h>>>8&255]<<8^f[p&255]^t[++b]}function Fs(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=we.cipher.createDecipher(r,t.key):n=we.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(s,a){var o=null;a instanceof we.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,i.call(n,a)},n}});var yl=S((z4,pl)=>{l();var Ce=xe();$o();Yo();Re();pl.exports=Ce.des=Ce.des||{};Ce.des.startEncrypting=function(t,e,r,n){var i=Ms({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};Ce.des.createEncryptionCipher=function(t,e){return Ms({key:t,output:null,decrypt:!1,mode:e})};Ce.des.startDecrypting=function(t,e,r,n){var i=Ms({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};Ce.des.createDecryptionCipher=function(t,e){return Ms({key:t,output:null,decrypt:!0,mode:e})};Ce.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return dl(r._keys,n,i,!1)},decrypt:function(n,i){return dl(r._keys,n,i,!0)}}}),r._init=!1};Ce.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=Ce.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=av(e),this._init=!0}};Ut("DES-ECB",Ce.cipher.modes.ecb);Ut("DES-CBC",Ce.cipher.modes.cbc);Ut("DES-CFB",Ce.cipher.modes.cfb);Ut("DES-OFB",Ce.cipher.modes.ofb);Ut("DES-CTR",Ce.cipher.modes.ctr);Ut("3DES-ECB",Ce.cipher.modes.ecb);Ut("3DES-CBC",Ce.cipher.modes.cbc);Ut("3DES-CFB",Ce.cipher.modes.cfb);Ut("3DES-OFB",Ce.cipher.modes.ofb);Ut("3DES-CTR",Ce.cipher.modes.ctr);function Ut(t,e){var r=function(){return new Ce.des.Algorithm(t,e)};Ce.cipher.registerAlgorithm(t,r)}var ov=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],cv=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],fv=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],uv=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],hv=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],lv=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],pv=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],dv=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function av(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],u=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],y=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],d=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=t.length()>8?3:1,v=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],w=0,E,T=0;T<g;T++){var A=t.getInt32(),C=t.getInt32();E=(A>>>4^C)&252645135,C^=E,A^=E<<4,E=(C>>>-16^A)&65535,A^=E,C^=E<<-16,E=(A>>>2^C)&858993459,C^=E,A^=E<<2,E=(C>>>-16^A)&65535,A^=E,C^=E<<-16,E=(A>>>1^C)&1431655765,C^=E,A^=E<<1,E=(C>>>8^A)&16711935,A^=E,C^=E<<8,E=(A>>>1^C)&1431655765,C^=E,A^=E<<1,E=A<<8|C>>>20&240,A=C<<24|C<<8&16711680|C>>>8&65280|C>>>24&240,C=E;for(var L=0;L<b.length;++L){b[L]?(A=A<<2|A>>>26,C=C<<2|C>>>26):(A=A<<1|A>>>27,C=C<<1|C>>>27),A&=-15,C&=-15;var k=e[A>>>28]|r[A>>>24&15]|n[A>>>20&15]|i[A>>>16&15]|s[A>>>12&15]|a[A>>>8&15]|o[A>>>4&15],F=c[C>>>28]|f[C>>>24&15]|u[C>>>20&15]|h[C>>>16&15]|p[C>>>12&15]|y[C>>>8&15]|d[C>>>4&15];E=(F>>>16^k)&65535,v[w++]=k^E,v[w++]=F^E<<16}}return v}function dl(t,e,r,n){var i=t.length===32?3:9,s;i===3?s=n?[30,-2,-2]:[0,32,2]:s=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,o=e[0],c=e[1];a=(o>>>4^c)&252645135,c^=a,o^=a<<4,a=(o>>>16^c)&65535,c^=a,o^=a<<16,a=(c>>>2^o)&858993459,o^=a,c^=a<<2,a=(c>>>8^o)&16711935,o^=a,c^=a<<8,a=(o>>>1^c)&1431655765,c^=a,o^=a<<1,o=o<<1|o>>>31,c=c<<1|c>>>31;for(var f=0;f<i;f+=3){for(var u=s[f+1],h=s[f+2],p=s[f];p!=u;p+=h){var y=c^t[p],d=(c>>>4|c<<28)^t[p+1];a=o,o=c,c=a^(cv[y>>>24&63]|uv[y>>>16&63]|lv[y>>>8&63]|dv[y&63]|ov[d>>>24&63]|fv[d>>>16&63]|hv[d>>>8&63]|pv[d&63])}a=o,o=c,c=a}o=o>>>1|o<<31,c=c>>>1|c<<31,a=(o>>>1^c)&1431655765,c^=a,o^=a<<1,a=(c>>>8^o)&16711935,o^=a,c^=a<<8,a=(c>>>2^o)&858993459,o^=a,c^=a<<2,a=(o>>>16^c)&65535,c^=a,o^=a<<16,a=(o>>>4^c)&252645135,c^=a,o^=a<<4,r[0]=o,r[1]=c}function Ms(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=Ce.cipher.createDecipher(r,t.key):n=Ce.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(s,a){var o=null;a instanceof Ce.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,i.call(n,a)},n}});var Jr=S((G4,gl)=>{l();var Os=xe();gl.exports=Os.md=Os.md||{};Os.md.algorithms=Os.md.algorithms||{}});var vl=S((W4,xl)=>{l();var er=xe();Jr();Re();var yv=xl.exports=er.hmac=er.hmac||{};yv.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(s,a){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in er.md.algorithms)e=er.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(a===null)a=t;else{if(typeof a=="string")a=er.util.createBuffer(a);else if(er.util.isArray(a)){var o=a;a=er.util.createBuffer();for(var c=0;c<o.length;++c)a.putByte(o[c])}var f=a.length();f>e.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),r=er.util.createBuffer(),n=er.util.createBuffer(),f=a.length();for(var c=0;c<f;++c){var o=a.at(c);r.putByte(54^o),n.putByte(92^o)}if(f<e.blockLength)for(var o=e.blockLength-f,c=0;c<o;++c)r.putByte(54),n.putByte(92);t=a,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(s){e.update(s)},i.getMac=function(){var s=e.digest().bytes();return e.start(),e.update(n),e.update(s),e.digest()},i.digest=i.getMac,i}});var ml=S((j4,bl)=>{l();var nt=xe();vl();Jr();Re();var gv=nt.pkcs5=nt.pkcs5||{},tr;nt.util.isNodejs&&!nt.options.usePureJavaScript&&(tr=Gr());bl.exports=nt.pbkdf2=gv.pbkdf2=function(t,e,r,n,i,s){if(typeof i=="function"&&(s=i,i=null),nt.util.isNodejs&&!nt.options.usePureJavaScript&&tr.pbkdf2&&(i===null||typeof i!="object")&&(tr.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),s?tr.pbkdf2Sync.length===4?tr.pbkdf2(t,e,r,n,function(E,T){if(E)return s(E);s(null,T.toString("binary"))}):tr.pbkdf2(t,e,r,n,i,function(E,T){if(E)return s(E);s(null,T.toString("binary"))}):tr.pbkdf2Sync.length===4?tr.pbkdf2Sync(t,e,r,n).toString("binary"):tr.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i=="undefined"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in nt.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=nt.md[i].create()}var a=i.digestLength;if(n>4294967295*a){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var c=Math.ceil(n/a),f=n-(c-1)*a,u=nt.hmac.create();u.start(i,t);var h="",p,y,d;if(!s){for(var g=1;g<=c;++g){u.start(null,null),u.update(e),u.update(nt.util.int32ToBytes(g)),p=d=u.digest().getBytes();for(var v=2;v<=r;++v)u.start(null,null),u.update(d),y=u.digest().getBytes(),p=nt.util.xorBytes(p,y,a),d=y;h+=g<c?p:p.substr(0,f)}return h}var g=1,v;function b(){if(g>c)return s(null,h);u.start(null,null),u.update(e),u.update(nt.util.int32ToBytes(g)),p=d=u.digest().getBytes(),v=2,w()}function w(){if(v<=r)return u.start(null,null),u.update(d),y=u.digest().getBytes(),p=nt.util.xorBytes(p,y,a),d=y,++v,nt.util.setImmediate(w);h+=g<c?p:p.substr(0,f),++g,b()}b()}});var Sl=S(($4,wl)=>{l();var qs=xe();Re();var El=wl.exports=qs.pem=qs.pem||{};El.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
`,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=Hs(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Hs(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Hs(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Hs(t.headers[i]);return t.procType&&(r+=`\r
`),r+=qs.util.encode64(t.body,e.maxline||64)+`\r
`,r+="-----END "+t.type+`-----\r
`,r};El.decode=function(t){for(var e=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,s;s=r.exec(t),!!s;){var a={type:s[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:qs.util.decode64(s[3])};if(e.push(a),!!s[2]){for(var o=s[2].split(i),c=0;s&&c<o.length;){for(var f=o[c].replace(/\s+$/,""),u=c+1;u<o.length;++u){var h=o[u];if(!/\s/.test(h[0]))break;f+=h,c=u}if(s=f.match(n),s){for(var p={name:s[1],values:[]},y=s[2].split(","),d=0;d<y.length;++d)p.values.push(xv(y[d]));if(a.procType)if(!a.contentDomain&&p.name==="Content-Domain")a.contentDomain=y[0]||"";else if(!a.dekInfo&&p.name==="DEK-Info"){if(p.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:y[0],parameters:y[1]||null}}else a.headers.push(p);else{if(p.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(p.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:y[0],type:y[1]}}}++c}if(a.procType==="ENCRYPTED"&&!a.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(e.length===0)throw new Error("Invalid PEM formatted message.");return e};function Hs(t){for(var e=t.name+": ",r=[],n=function(c,f){return" "+f},i=0;i<t.values.length;++i)r.push(t.values[i].replace(/^(\S+\r\n)/,n));e+=r.join(",")+`\r
`;for(var s=0,a=-1,i=0;i<e.length;++i,++s)if(s>65&&a!==-1){var o=e[a];o===","?(++a,e=e.substr(0,a)+`\r
 `+e.substr(a)):e=e.substr(0,a)+`\r
`+o+e.substr(a+1),s=i-a-1,a=-1,++i}else(e[i]===" "||e[i]==="	"||e[i]===",")&&(a=i);return e}function xv(t){return t.replace(/^\s+/,"")}});var Tl=S((X4,Bl)=>{l();var Ft=xe();Jr();Re();var _l=Bl.exports=Ft.sha256=Ft.sha256||{};Ft.md.sha256=Ft.md.algorithms.sha256=_l;_l.create=function(){Al||vv();var t=null,e=Ft.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return e=Ft.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=Ft.util.encodeUtf8(i));var a=i.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var o=n.fullMessageLength.length-1;o>=0;--o)n.fullMessageLength[o]+=a[1],a[1]=a[0]+(n.fullMessageLength[o]/4294967296>>>0),n.fullMessageLength[o]=n.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(i),Cl(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=Ft.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=s&n.blockLength-1;i.putBytes(t0.substr(0,n.blockLength-a));for(var o,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)o=n.fullMessageLength[u+1]*8,c=o/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=o>>>0;i.putInt32(f);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};Cl(h,r,i);var p=Ft.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},n};var t0=null,Al=!1,Il=null;function vv(){t0=String.fromCharCode(128),t0+=Ft.util.fillString(String.fromCharCode(0),64),Il=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Al=!0}function Cl(t,e,r){for(var n,i,s,a,o,c,f,u,h,p,y,d,g,v,b,w=r.length();w>=64;){for(f=0;f<16;++f)e[f]=r.getInt32();for(;f<64;++f)n=e[f-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[f]=n+e[f-7]+i+e[f-16]|0;for(u=t.h0,h=t.h1,p=t.h2,y=t.h3,d=t.h4,g=t.h5,v=t.h6,b=t.h7,f=0;f<64;++f)a=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),o=v^d&(g^v),s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),c=u&h|p&(u^h),n=b+a+o+Il[f]+e[f],i=s+c,b=v,v=g,g=d,d=y+n>>>0,y=p,p=h,h=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+h|0,t.h2=t.h2+p|0,t.h3=t.h3+y|0,t.h4=t.h4+d|0,t.h5=t.h5+g|0,t.h6=t.h6+v|0,t.h7=t.h7+b|0,w-=64}}});var Kl=S((Y4,Pl)=>{l();var Mt=xe();Re();var Vs=null;Mt.util.isNodejs&&!Mt.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Vs=Gr());var bv=Pl.exports=Mt.prng=Mt.prng||{};bv.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();e.pools=n,e.pool=0,e.generate=function(f,u){if(!u)return e.generateSync(f);var h=e.plugin.cipher,p=e.plugin.increment,y=e.plugin.formatKey,d=e.plugin.formatSeed,g=Mt.util.createBuffer();e.key=null,v();function v(b){if(b)return u(b);if(g.length()>=f)return u(null,g.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return Mt.util.nextTick(function(){s(v)});var w=h(e.key,e.seed);e.generated+=w.length,g.putBytes(w),e.key=y(h(e.key,p(e.seed))),e.seed=d(h(e.key,e.seed)),Mt.util.setImmediate(v)}},e.generateSync=function(f){var u=e.plugin.cipher,h=e.plugin.increment,p=e.plugin.formatKey,y=e.plugin.formatSeed;e.key=null;for(var d=Mt.util.createBuffer();d.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&a();var g=u(e.key,e.seed);e.generated+=g.length,d.putBytes(g),e.key=p(u(e.key,h(e.seed))),e.seed=y(u(e.key,e.seed))}return d.getBytes(f)};function s(f){if(e.pools[0].messageLength>=32)return o(),f();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(h,p){if(h)return f(h);e.collect(p),o(),f()})}function a(){if(e.pools[0].messageLength>=32)return o();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),o()}function o(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var u=1,h=0;h<32;++h)e.reseeds%u==0&&(f.update(e.pools[h].digest().getBytes()),e.pools[h].start()),u=u<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var p=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}function c(f){var u=null,h=Mt.util.globalScope,p=h.crypto||h.msCrypto;p&&p.getRandomValues&&(u=function(A){return p.getRandomValues(A)});var y=Mt.util.createBuffer();if(u)for(;y.length()<f;){var d=Math.max(1,Math.min(f-y.length(),65536)/4),g=new Uint32Array(Math.floor(d));try{u(g);for(var v=0;v<g.length;++v)y.putInt32(g[v])}catch(A){if(!(typeof QuotaExceededError!="undefined"&&A instanceof QuotaExceededError))throw A}}if(y.length()<f)for(var b,w,E,T=Math.floor(Math.random()*65536);y.length()<f;){w=16807*(T&65535),b=16807*(T>>16),w+=(b&32767)<<16,w+=b>>15,w=(w&2147483647)+(w>>31),T=w&4294967295;for(var v=0;v<3;++v)E=T>>>(v<<3),E^=Math.floor(Math.random()*256),y.putByte(String.fromCharCode(E&255))}return y.getBytes(f)}return Vs?(e.seedFile=function(f,u){Vs.randomBytes(f,function(h,p){if(h)return u(h);u(null,p.toString())})},e.seedFileSync=function(f){return Vs.randomBytes(f).toString()}):(e.seedFile=function(f,u){try{u(null,c(f))}catch(h){u(h)}},e.seedFileSync=c),e.collect=function(f){for(var u=f.length,h=0;h<u;++h)e.pools[e.pool].update(f.substr(h,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,u){for(var h="",p=0;p<u;p+=8)h+=String.fromCharCode(f>>p&255);e.collect(h)},e.registerWorker=function(f){if(f===self)e.seedFile=function(h,p){function y(d){var g=d.data;g.forge&&g.forge.prng&&(self.removeEventListener("message",y),p(g.forge.prng.err,g.forge.prng.bytes))}self.addEventListener("message",y),self.postMessage({forge:{prng:{needed:h}}})};else{var u=function(h){var p=h.data;p.forge&&p.forge.prng&&e.seedFile(p.forge.prng.needed,function(y,d){f.postMessage({forge:{prng:{err:y,bytes:d}}})})};f.addEventListener("message",u)}},e}});var di=S((Z4,r0)=>{l();var Oe=xe();e0();Tl();Kl();Re();(function(){if(Oe.random&&Oe.random.getBytes){r0.exports=Oe.random;return}(function(t){var e={},r=new Array(4),n=Oe.util.createBuffer();e.formatKey=function(h){var p=Oe.util.createBuffer(h);return h=new Array(4),h[0]=p.getInt32(),h[1]=p.getInt32(),h[2]=p.getInt32(),h[3]=p.getInt32(),Oe.aes._expandKey(h,!1)},e.formatSeed=function(h){var p=Oe.util.createBuffer(h);return h=new Array(4),h[0]=p.getInt32(),h[1]=p.getInt32(),h[2]=p.getInt32(),h[3]=p.getInt32(),h},e.cipher=function(h,p){return Oe.aes._updateBlock(h,p,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(h){return++h[3],h},e.md=Oe.md.sha256;function i(){var h=Oe.prng.create(e);return h.getBytes=function(p,y){return h.generate(p,y)},h.getBytesSync=function(p){return h.generate(p)},h}var s=i(),a=null,o=Oe.util.globalScope,c=o.crypto||o.msCrypto;if(c&&c.getRandomValues&&(a=function(h){return c.getRandomValues(h)}),Oe.options.usePureJavaScript||!Oe.util.isNodejs&&!a){if(typeof window=="undefined"||window.document===void 0,s.collectInt(+new Date,32),typeof navigator!="undefined"){var f="";for(var u in navigator)try{typeof navigator[u]=="string"&&(f+=navigator[u])}catch(h){}s.collect(f),f=null}t&&(t().mousemove(function(h){s.collectInt(h.clientX,16),s.collectInt(h.clientY,16)}),t().keypress(function(h){s.collectInt(h.charCode,8)}))}if(!Oe.random)Oe.random=s;else for(var u in s)Oe.random[u]=s[u];Oe.random.createInstance=i,r0.exports=Oe.random})(typeof jQuery!="undefined"?jQuery:null)})()});var Dl=S((Q4,Ll)=>{l();var ft=xe();Re();var n0=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Rl=[1,2,3,5],mv=function(t,e){return t<<e&65535|(t&65535)>>16-e},wv=function(t,e){return(t&65535)>>e|t<<16-e&65535};Ll.exports=ft.rc2=ft.rc2||{};ft.rc2.expandKey=function(t,e){typeof t=="string"&&(t=ft.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,s=Math.ceil(i/8),a=255>>(i&7),o;for(o=n;o<128;o++)r.putByte(n0[r.at(o-1)+r.at(o-n)&255]);for(r.setAt(128-s,n0[r.at(128-s)&a]),o=127-s;o>=0;o--)r.setAt(o,n0[r.at(o+1)^r.at(o+s)]);return r};var kl=function(t,e,r){var n=!1,i=null,s=null,a=null,o,c,f,u,h=[];for(t=ft.rc2.expandKey(t,e),f=0;f<64;f++)h.push(t.getInt16Le());r?(o=function(d){for(f=0;f<4;f++)d[f]+=h[u]+(d[(f+3)%4]&d[(f+2)%4])+(~d[(f+3)%4]&d[(f+1)%4]),d[f]=mv(d[f],Rl[f]),u++},c=function(d){for(f=0;f<4;f++)d[f]+=h[d[(f+3)%4]&63]}):(o=function(d){for(f=3;f>=0;f--)d[f]=wv(d[f],Rl[f]),d[f]-=h[u]+(d[(f+3)%4]&d[(f+2)%4])+(~d[(f+3)%4]&d[(f+1)%4]),u--},c=function(d){for(f=3;f>=0;f--)d[f]-=h[d[(f+3)%4]&63]});var p=function(d){var g=[];for(f=0;f<4;f++){var v=i.getInt16Le();a!==null&&(r?v^=a.getInt16Le():a.putInt16Le(v)),g.push(v&65535)}u=r?0:63;for(var b=0;b<d.length;b++)for(var w=0;w<d[b][0];w++)d[b][1](g);for(f=0;f<4;f++)a!==null&&(r?a.putInt16Le(g[f]):g[f]^=a.getInt16Le()),s.putInt16Le(g[f])},y=null;return y={start:function(d,g){d&&typeof d=="string"&&(d=ft.util.createBuffer(d)),n=!1,i=ft.util.createBuffer(),s=g||new ft.util.createBuffer,a=d,y.output=s},update:function(d){for(n||i.putBuffer(d);i.length()>=8;)p([[5,o],[1,c],[6,o],[1,c],[5,o]])},finish:function(d){var g=!0;if(r)if(d)g=d(8,i,!r);else{var v=i.length()===8?8:8-i.length();i.fillWithByte(v,v)}if(g&&(n=!0,y.update()),!r&&(g=i.length()===0,g))if(d)g=d(8,s,!r);else{var b=s.length(),w=s.at(b-1);w>b?g=!1:s.truncate(w)}return g}},y};ft.rc2.startEncrypting=function(t,e,r){var n=ft.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};ft.rc2.createEncryptionCipher=function(t,e){return kl(t,e,!0)};ft.rc2.startDecrypting=function(t,e,r){var n=ft.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};ft.rc2.createDecryptionCipher=function(t,e){return kl(t,e,!1)}});var Ws=S((J4,Nl)=>{l();var i0=xe();Nl.exports=i0.jsbn=i0.jsbn||{};var rr,Ev=244837814094590,Ul=(Ev&16777215)==15715070;function P(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}i0.jsbn.BigInteger=P;function se(){return new P(null)}function Sv(t,e,r,n,i,s){for(;--s>=0;){var a=e*this.data[t++]+r.data[n]+i;i=Math.floor(a/67108864),r.data[n++]=a&67108863}return i}function Bv(t,e,r,n,i,s){for(var a=e&32767,o=e>>15;--s>=0;){var c=this.data[t]&32767,f=this.data[t++]>>15,u=o*c+f*a;c=a*c+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(u>>>15)+o*f+(i>>>30),r.data[n++]=c&1073741823}return i}function Fl(t,e,r,n,i,s){for(var a=e&16383,o=e>>14;--s>=0;){var c=this.data[t]&16383,f=this.data[t++]>>14,u=o*c+f*a;c=a*c+((u&16383)<<14)+r.data[n]+i,i=(c>>28)+(u>>14)+o*f,r.data[n++]=c&268435455}return i}typeof navigator=="undefined"?(P.prototype.am=Fl,rr=28):Ul&&navigator.appName=="Microsoft Internet Explorer"?(P.prototype.am=Bv,rr=30):Ul&&navigator.appName!="Netscape"?(P.prototype.am=Sv,rr=26):(P.prototype.am=Fl,rr=28);P.prototype.DB=rr;P.prototype.DM=(1<<rr)-1;P.prototype.DV=1<<rr;var s0=52;P.prototype.FV=Math.pow(2,s0);P.prototype.F1=s0-rr;P.prototype.F2=2*rr-s0;var _v="0123456789abcdefghijklmnopqrstuvwxyz",zs=new Array,In,gt;In="0".charCodeAt(0);for(gt=0;gt<=9;++gt)zs[In++]=gt;In="a".charCodeAt(0);for(gt=10;gt<36;++gt)zs[In++]=gt;In="A".charCodeAt(0);for(gt=10;gt<36;++gt)zs[In++]=gt;function Ml(t){return _v.charAt(t)}function Ol(t,e){var r=zs[t.charCodeAt(e)];return r??-1}function Av(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}function Cv(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function Er(t){var e=se();return e.fromInt(t),e}function Iv(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=r==8?t[n]&255:Ol(t,n);if(a<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this.data[this.t++]=a>>this.DB-s):this.data[this.t-1]|=a<<s,s+=r,s>=this.DB&&(s-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&P.ZERO.subTo(this,this)}function Tv(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function Pv(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,n,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(n=this.data[a]>>o)>0&&(i=!0,s=Ml(n));a>=0;)o<e?(n=(this.data[a]&(1<<o)-1)<<e-o,n|=this.data[--a]>>(o+=this.DB-e)):(n=this.data[a]>>(o-=e)&r,o<=0&&(o+=this.DB,--a)),n>0&&(i=!0),i&&(s+=Ml(n));return i?s:"0"}function Kv(){var t=se();return P.ZERO.subTo(this,t),t}function Lv(){return this.s<0?this.negate():this}function Rv(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}function Gs(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function kv(){return this.t<=0?0:this.DB*(this.t-1)+Gs(this.data[this.t-1]^this.s&this.DM)}function Dv(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}function Nv(t,e){for(var r=t;r<this.t;++r)e.data[r-t]=this.data[r];e.t=Math.max(this.t-t,0),e.s=this.s}function Uv(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,s=Math.floor(t/this.DB),a=this.s<<r&this.DM,o;for(o=this.t-1;o>=0;--o)e.data[o+s+1]=this.data[o]>>n|a,a=(this.data[o]&i)<<r;for(o=s-1;o>=0;--o)e.data[o]=0;e.data[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}function Fv(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)e.data[a-r-1]|=(this.data[a]&s)<<i,e.data[a-r]=this.data[a]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}function Mv(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]-t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()}function Ov(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e.data[i]=0;for(i=0;i<n.t;++i)e.data[i+r.t]=r.am(0,n.data[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&P.ZERO.subTo(e,e)}function qv(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t.data[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e.data[r],t,2*r,0,1);(t.data[r+e.t]+=e.am(r+1,2*e.data[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}function Hv(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e!=null&&e.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=se());var s=se(),a=this.s,o=t.s,c=this.DB-Gs(n.data[n.t-1]);c>0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var f=s.t,u=s.data[f-1];if(u!=0){var h=u*(1<<this.F1)+(f>1?s.data[f-2]>>this.F2:0),p=this.FV/h,y=(1<<this.F1)/h,d=1<<this.F2,g=r.t,v=g-f,b=e??se();for(s.dlShiftTo(v,b),r.compareTo(b)>=0&&(r.data[r.t++]=1,r.subTo(b,r)),P.ONE.dlShiftTo(f,b),b.subTo(s,s);s.t<f;)s.data[s.t++]=0;for(;--v>=0;){var w=r.data[--g]==u?this.DM:Math.floor(r.data[g]*p+(r.data[g-1]+d)*y);if((r.data[g]+=s.am(0,w,r,v,0,f))<w)for(s.dlShiftTo(v,b),r.subTo(b,r);r.data[g]<--w;)r.subTo(b,r)}e!=null&&(r.drShiftTo(f,e),a!=o&&P.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&P.ZERO.subTo(r,r)}}}function Vv(t){var e=se();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(P.ZERO)>0&&t.subTo(e,e),e}function en(t){this.m=t}function zv(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function Gv(t){return t}function Wv(t){t.divRemTo(this.m,null,t)}function jv(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function $v(t,e){t.squareTo(e),this.reduce(e)}en.prototype.convert=zv;en.prototype.revert=Gv;en.prototype.reduce=Wv;en.prototype.mulTo=jv;en.prototype.sqrTo=$v;function Xv(){if(this.t<1)return 0;var t=this.data[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function tn(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function Yv(t){var e=se();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(P.ZERO)>0&&this.m.subTo(e,e),e}function Zv(t){var e=se();return t.copyTo(e),this.reduce(e),e}function Qv(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t.data[e]&32767,n=r*this.mpl+((r*this.mph+(t.data[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function Jv(t,e){t.squareTo(e),this.reduce(e)}function eb(t,e,r){t.multiplyTo(e,r),this.reduce(r)}tn.prototype.convert=Yv;tn.prototype.revert=Zv;tn.prototype.reduce=Qv;tn.prototype.mulTo=eb;tn.prototype.sqrTo=Jv;function tb(){return(this.t>0?this.data[0]&1:this.s)==0}function rb(t,e){if(t>4294967295||t<1)return P.ONE;var r=se(),n=se(),i=e.convert(this),s=Gs(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)}function nb(t,e){var r;return t<256||e.isEven()?r=new en(e):r=new tn(e),this.exp(t,r)}P.prototype.copyTo=Av;P.prototype.fromInt=Cv;P.prototype.fromString=Iv;P.prototype.clamp=Tv;P.prototype.dlShiftTo=Dv;P.prototype.drShiftTo=Nv;P.prototype.lShiftTo=Uv;P.prototype.rShiftTo=Fv;P.prototype.subTo=Mv;P.prototype.multiplyTo=Ov;P.prototype.squareTo=qv;P.prototype.divRemTo=Hv;P.prototype.invDigit=Xv;P.prototype.isEven=tb;P.prototype.exp=rb;P.prototype.toString=Pv;P.prototype.negate=Kv;P.prototype.abs=Lv;P.prototype.compareTo=Rv;P.prototype.bitLength=kv;P.prototype.mod=Vv;P.prototype.modPowInt=nb;P.ZERO=Er(0);P.ONE=Er(1);function ib(){var t=se();return this.copyTo(t),t}function sb(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function ab(){return this.t==0?this.s:this.data[0]<<24>>24}function ob(){return this.t==0?this.s:this.data[0]<<16>>16}function cb(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function fb(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function ub(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=Er(r),i=se(),s=se(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(t)+a}function hb(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o<t.length;++o){var c=Ol(t,o);if(c<0){t.charAt(o)=="-"&&this.signum()==0&&(i=!0);continue}a=e*a+c,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&P.ZERO.subTo(this,this)}function lb(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(P.ONE.shiftLeft(t-1),a0,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(P.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function pb(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,n,i=0;if(t-- >0)for(r<this.DB&&(n=this.data[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this.data[t]&(1<<r)-1)<<8-r,n|=this.data[--t]>>(r+=this.DB-8)):(n=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(n&128)!=0&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function db(t){return this.compareTo(t)==0}function yb(t){return this.compareTo(t)<0?this:t}function gb(t){return this.compareTo(t)>0?this:t}function xb(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r.data[n]=e(i,t.data[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function vb(t,e){return t&e}function bb(t){var e=se();return this.bitwiseTo(t,vb,e),e}function a0(t,e){return t|e}function mb(t){var e=se();return this.bitwiseTo(t,a0,e),e}function ql(t,e){return t^e}function wb(t){var e=se();return this.bitwiseTo(t,ql,e),e}function Hl(t,e){return t&~e}function Eb(t){var e=se();return this.bitwiseTo(t,Hl,e),e}function Sb(){for(var t=se(),e=0;e<this.t;++e)t.data[e]=this.DM&~this.data[e];return t.t=this.t,t.s=~this.s,t}function Bb(t){var e=se();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function _b(t){var e=se();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function Ab(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}function Cb(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+Ab(this.data[t]);return this.s<0?this.t*this.DB:-1}function Ib(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function Tb(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Ib(this.data[r]^e);return t}function Pb(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function Kb(t,e){var r=P.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function Lb(t){return this.changeBit(t,a0)}function Rb(t){return this.changeBit(t,Hl)}function kb(t){return this.changeBit(t,ql)}function Db(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]+t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()}function Nb(t){var e=se();return this.addTo(t,e),e}function Ub(t){var e=se();return this.subTo(t,e),e}function Fb(t){var e=se();return this.multiplyTo(t,e),e}function Mb(t){var e=se();return this.divRemTo(t,e,null),e}function Ob(t){var e=se();return this.divRemTo(t,null,e),e}function qb(t){var e=se(),r=se();return this.divRemTo(t,e,r),new Array(e,r)}function Hb(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Vb(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}function yi(){}function Vl(t){return t}function zb(t,e,r){t.multiplyTo(e,r)}function Gb(t,e){t.squareTo(e)}yi.prototype.convert=Vl;yi.prototype.revert=Vl;yi.prototype.mulTo=zb;yi.prototype.sqrTo=Gb;function Wb(t){return this.exp(t,new yi)}function jb(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r.data[n+this.t]=this.am(0,t.data[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t.data[n],r,n,0,e-n);r.clamp()}function $b(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r.data[this.t+n-e]=this.am(e-n,t.data[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}function Tn(t){this.r2=se(),this.q3=se(),P.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Xb(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=se();return t.copyTo(e),this.reduce(e),e}function Yb(t){return t}function Zb(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Qb(t,e){t.squareTo(e),this.reduce(e)}function Jb(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Tn.prototype.convert=Xb;Tn.prototype.revert=Yb;Tn.prototype.reduce=Zb;Tn.prototype.mulTo=Jb;Tn.prototype.sqrTo=Qb;function em(t,e){var r=t.bitLength(),n,i=Er(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new en(e):e.isEven()?s=new Tn(e):s=new tn(e);var a=new Array,o=3,c=n-1,f=(1<<n)-1;if(a[1]=s.convert(this),n>1){var u=se();for(s.sqrTo(a[1],u);o<=f;)a[o]=se(),s.mulTo(u,a[o-2],a[o]),o+=2}var h=t.t-1,p,y=!0,d=se(),g;for(r=Gs(t.data[h])-1;h>=0;){for(r>=c?p=t.data[h]>>r-c&f:(p=(t.data[h]&(1<<r+1)-1)<<c-r,h>0&&(p|=t.data[h-1]>>this.DB+r-c)),o=n;(p&1)==0;)p>>=1,--o;if((r-=o)<0&&(r+=this.DB,--h),y)a[p].copyTo(i),y=!1;else{for(;o>1;)s.sqrTo(i,d),s.sqrTo(d,i),o-=2;o>0?s.sqrTo(i,d):(g=i,i=d,d=g),s.mulTo(d,a[p],i)}for(;h>=0&&(t.data[h]&1<<r)==0;)s.sqrTo(i,d),g=i,i=d,d=g,--r<0&&(r=this.DB-1,--h)}return s.revert(i)}function tm(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function rm(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r}function nm(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return P.ZERO;for(var r=t.clone(),n=this.clone(),i=Er(1),s=Er(0),a=Er(0),o=Er(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(o,s)):(n.subTo(r,n),e&&a.subTo(i,a),o.subTo(s,o))}if(n.compareTo(P.ONE)!=0)return P.ZERO;if(o.compareTo(t)>=0)return o.subtract(t);if(o.signum()<0)o.addTo(t,o);else return o;return o.signum()<0?o.add(t):o}var Ct=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],im=(1<<26)/Ct[Ct.length-1];function sm(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=Ct[Ct.length-1]){for(e=0;e<Ct.length;++e)if(r.data[0]==Ct[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Ct.length;){for(var n=Ct[e],i=e+1;i<Ct.length&&n<im;)n*=Ct[i++];for(n=r.modInt(n);e<i;)if(n%Ct[e++]==0)return!1}return r.millerRabin(t)}function om(t){var e=this.subtract(P.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=am(),s,a=0;a<t;++a){do s=new P(this.bitLength(),i);while(s.compareTo(P.ONE)<=0||s.compareTo(e)>=0);var o=s.modPow(n,this);if(o.compareTo(P.ONE)!=0&&o.compareTo(e)!=0){for(var c=1;c++<r&&o.compareTo(e)!=0;)if(o=o.modPowInt(2,this),o.compareTo(P.ONE)==0)return!1;if(o.compareTo(e)!=0)return!1}}return!0}function am(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}P.prototype.chunkSize=cb;P.prototype.toRadix=ub;P.prototype.fromRadix=hb;P.prototype.fromNumber=lb;P.prototype.bitwiseTo=xb;P.prototype.changeBit=Kb;P.prototype.addTo=Db;P.prototype.dMultiply=Hb;P.prototype.dAddOffset=Vb;P.prototype.multiplyLowerTo=jb;P.prototype.multiplyUpperTo=$b;P.prototype.modInt=rm;P.prototype.millerRabin=om;P.prototype.clone=ib;P.prototype.intValue=sb;P.prototype.byteValue=ab;P.prototype.shortValue=ob;P.prototype.signum=fb;P.prototype.toByteArray=pb;P.prototype.equals=db;P.prototype.min=yb;P.prototype.max=gb;P.prototype.and=bb;P.prototype.or=mb;P.prototype.xor=wb;P.prototype.andNot=Eb;P.prototype.not=Sb;P.prototype.shiftLeft=Bb;P.prototype.shiftRight=_b;P.prototype.getLowestSetBit=Cb;P.prototype.bitCount=Tb;P.prototype.testBit=Pb;P.prototype.setBit=Lb;P.prototype.clearBit=Rb;P.prototype.flipBit=kb;P.prototype.add=Nb;P.prototype.subtract=Ub;P.prototype.multiply=Fb;P.prototype.divide=Mb;P.prototype.remainder=Ob;P.prototype.divideAndRemainder=qb;P.prototype.modPow=em;P.prototype.modInverse=nm;P.prototype.pow=Wb;P.prototype.gcd=tm;P.prototype.isProbablePrime=sm});var $l=S((eS,zl)=>{l();var Ot=xe();Jr();Re();var Gl=zl.exports=Ot.sha1=Ot.sha1||{};Ot.md.sha1=Ot.md.algorithms.sha1=Gl;Gl.create=function(){Wl||cm();var t=null,e=Ot.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return e=Ot.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=Ot.util.encodeUtf8(i));var a=i.length;n.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var o=n.fullMessageLength.length-1;o>=0;--o)n.fullMessageLength[o]+=a[1],a[1]=a[0]+(n.fullMessageLength[o]/4294967296>>>0),n.fullMessageLength[o]=n.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(i),jl(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=Ot.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,a=s&n.blockLength-1;i.putBytes(o0.substr(0,n.blockLength-a));for(var o,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)o=n.fullMessageLength[u+1]*8,c=o/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=o>>>0;i.putInt32(f);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};jl(h,r,i);var p=Ot.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},n};var o0=null,Wl=!1;function cm(){o0=String.fromCharCode(128),o0+=Ot.util.fillString(String.fromCharCode(0),64),Wl=!0}function jl(t,e,r){for(var n,i,s,a,o,c,f,u,h=r.length();h>=64;){for(i=t.h0,s=t.h1,a=t.h2,o=t.h3,c=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,f=o^s&(a^o),n=(i<<5|i>>>27)+f+c+1518500249+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<20;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=o^s&(a^o),n=(i<<5|i>>>27)+f+c+1518500249+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<32;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,f=s^a^o,n=(i<<5|i>>>27)+f+c+1859775393+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<40;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=s^a^o,n=(i<<5|i>>>27)+f+c+1859775393+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<60;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=s&a|o&(s^a),n=(i<<5|i>>>27)+f+c+2400959708+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<80;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,f=s^a^o,n=(i<<5|i>>>27)+f+c+3395469782+n,c=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+a|0,t.h3=t.h3+o|0,t.h4=t.h4+c|0,h-=64}}});var Zl=S((tS,Xl)=>{l();var qt=xe();Re();di();$l();var Yl=Xl.exports=qt.pkcs1=qt.pkcs1||{};Yl.encode_rsa_oaep=function(t,e,r){var n,i,s,a;typeof r=="string"?(n=r,i=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md)),s?s.start():s=qt.md.sha1.create(),a||(a=s);var o=Math.ceil(t.n.bitLength()/8),c=o-2*s.digestLength-2;if(e.length>c){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=c,f}n||(n=""),s.update(n,"raw");for(var u=s.digest(),h="",p=c-e.length,y=0;y<p;y++)h+="\0";var d=u.getBytes()+h+""+e;if(!i)i=qt.random.getBytes(s.digestLength);else if(i.length!==s.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=i.length,f.digestLength=s.digestLength,f}var g=js(i,o-s.digestLength-1,a),v=qt.util.xorBytes(d,g,d.length),b=js(v,s.digestLength,a),w=qt.util.xorBytes(i,b,i.length);return"\0"+w+v};Yl.decode_rsa_oaep=function(t,e,r){var n,i,s;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var a=Math.ceil(t.n.bitLength()/8);if(e.length!==a){var v=new Error("RSAES-OAEP encoded message length is invalid.");throw v.length=e.length,v.expectedLength=a,v}if(i===void 0?i=qt.md.sha1.create():i.start(),s||(s=i),a<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");n||(n=""),i.update(n,"raw");for(var o=i.digest().getBytes(),c=e.charAt(0),f=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),h=js(u,i.digestLength,s),p=qt.util.xorBytes(f,h,f.length),y=js(p,a-i.digestLength-1,s),d=qt.util.xorBytes(u,y,u.length),g=d.substring(0,i.digestLength),v=c!=="\0",b=0;b<i.digestLength;++b)v|=o.charAt(b)!==g.charAt(b);for(var w=1,E=i.digestLength,T=i.digestLength;T<d.length;T++){var A=d.charCodeAt(T),C=A&1^1,L=w?65534:0;v|=A&L,w=w&C,E+=w}if(v||d.charCodeAt(E)!==1)throw new Error("Invalid RSAES-OAEP padding.");return d.substring(E+1)};function js(t,e,r){r||(r=qt.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),s=0;s<i;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(t+a),n+=r.digest().getBytes()}return n.substring(0,e)}});var Ql=S((rS,c0)=>{l();var Sr=xe();Re();Ws();di();(function(){if(Sr.prime){c0.exports=Sr.prime;return}var t=c0.exports=Sr.prime=Sr.prime||{},e=Sr.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(h,p){return h|p};t.generateProbablePrime=function(h,p,y){typeof p=="function"&&(y=p,p={}),p=p||{};var d=p.algorithm||"PRIMEINC";typeof d=="string"&&(d={name:d}),d.options=d.options||{};var g=p.prng||Sr.random,v={nextBytes:function(b){for(var w=g.getBytesSync(b.length),E=0;E<b.length;++E)b[E]=w.charCodeAt(E)}};if(d.name==="PRIMEINC")return s(h,v,d.options,y);throw new Error("Invalid prime generation algorithm: "+d.name)};function s(h,p,y,d){return"workers"in y?c(h,p,y,d):a(h,p,y,d)}function a(h,p,y,d){var g=f(h,p),v=0,b=u(g.bitLength());"millerRabinTests"in y&&(b=y.millerRabinTests);var w=10;"maxBlockTime"in y&&(w=y.maxBlockTime),o(g,h,p,v,b,w,d)}function o(h,p,y,d,g,v,b){var w=+new Date;do{if(h.bitLength()>p&&(h=f(p,y)),h.isProbablePrime(g))return b(null,h);h.dAddOffset(r[d++%8],0)}while(v<0||+new Date-w<v);Sr.util.setImmediate(function(){o(h,p,y,d,g,v,b)})}function c(h,p,y,d){if(typeof Worker=="undefined")return a(h,p,y,d);var g=f(h,p),v=y.workers,b=y.workLoad||100,w=b*30/8,E=y.workerScript||"forge/prime.worker.js";if(v===-1)return Sr.util.estimateCores(function(A,C){A&&(C=2),v=C-1,T()});T();function T(){v=Math.max(1,v);for(var A=[],C=0;C<v;++C)A[C]=new Worker(E);for(var L=v,C=0;C<v;++C)A[C].addEventListener("message",F);var k=!1;function F(q){if(!k){--L;var X=q.data;if(X.found){for(var j=0;j<A.length;++j)A[j].terminate();return k=!0,d(null,new e(X.prime,16))}g.bitLength()>h&&(g=f(h,p));var ne=g.toString(16);q.target.postMessage({hex:ne,workLoad:b}),g.dAddOffset(w,0)}}}}function f(h,p){var y=new e(h,p),d=h-1;return y.testBit(d)||y.bitwiseTo(e.ONE.shiftLeft(d),i,y),y.dAddOffset(31-y.mod(n).byteValue(),0),y}function u(h){return h<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2}})()});var Xs=S((nS,Jl)=>{l();var G=xe();pi();Ws();ks();Zl();Ql();di();Re();typeof re=="undefined"&&(re=G.jsbn.BigInteger);var re,f0=G.util.isNodejs?Gr():null,m=G.asn1,xt=G.util;G.pki=G.pki||{};Jl.exports=G.pki.rsa=G.rsa=G.rsa||{};var W=G.pki,fm=[6,4,2,4,2,4,6,2],um={name:"PrivateKeyInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},hm={name:"RSAPrivateKey",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},lm={name:"RSAPublicKey",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},pm=G.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:m.Class.UNIVERSAL,type:m.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},dm=function(t){var e;if(t.algorithm in W.oids)e=W.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=m.oidToDer(e).getBytes(),i=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[]),s=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[]);s.value.push(m.create(m.Class.UNIVERSAL,m.Type.OID,!1,n)),s.value.push(m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,""));var a=m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(s),i.value.push(a),m.toDer(i).getBytes()},ep=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(re.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(re.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new re(G.util.bytesToHex(G.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(re.ONE));t=t.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var i=t.mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(s)<0;)i=i.add(e.p);var a=i.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return a=a.multiply(n.modInverse(e.n)).mod(e.n),a};W.rsa.encrypt=function(t,e,r){var n=r,i,s=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=tp(t,e,r)):(i=G.util.createBuffer(),i.putBytes(t));for(var a=new re(i.toHex(),16),o=ep(a,e,n),c=o.toString(16),f=G.util.createBuffer(),u=s-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(G.util.hexToBytes(c)),f.getBytes()};W.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=i,s}var a=new re(G.util.createBuffer(t).toHex(),16);if(a.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=ep(a,e,r),c=o.toString(16),f=G.util.createBuffer(),u=i-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(G.util.hexToBytes(c)),n!==!1?$s(f.getBytes(),e,r):f.getBytes()};W.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||G.random,i={nextBytes:function(o){for(var c=n.getBytesSync(o.length),f=0;f<o.length;++f)o[f]=c.charCodeAt(f)}},s=r.algorithm||"PRIMEINC",a;if(s==="PRIMEINC")a={algorithm:s,state:0,bits:t,rng:i,eInt:e||65537,e:new re(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw new Error("Invalid key generation algorithm: "+s);return a};W.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new re(null);r.fromInt(30);for(var n=0,i=function(h,p){return h|p},s=+new Date,a,o=0;t.keys===null&&(e<=0||o<e);){if(t.state===0){var c=t.p===null?t.pBits:t.qBits,f=c-1;t.pqState===0?(t.num=new re(c,t.rng),t.num.testBit(f)||t.num.bitwiseTo(re.ONE.shiftLeft(f),i,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),n=0,++t.pqState):t.pqState===1?t.num.bitLength()>c?t.pqState=0:t.num.isProbablePrime(ym(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(fm[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(re.ONE).gcd(t.e).compareTo(re.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(re.ONE),t.q1=t.q.subtract(re.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(re.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var u=t.e.modInverse(t.phi);t.keys={privateKey:W.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:W.rsa.setPublicKey(t.n,t.e)}}a=+new Date,o+=a-s,s=a}return t.keys!==null};W.rsa.generateKeyPair=function(t,e,r,n){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(n=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!G.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(rp("generateKeyPair"))return f0.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,c,f){if(o)return n(o);n(null,{privateKey:W.privateKeyFromPem(f),publicKey:W.publicKeyFromPem(c)})});if(np("generateKey")&&np("exportKey"))return xt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:sp(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return xt.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){n(o)}).then(function(o){if(o){var c=W.privateKeyFromAsn1(m.fromDer(G.util.createBuffer(o)));n(null,{privateKey:c,publicKey:W.setRsaPublicKey(c.n,c.e)})}});if(ip("generateKey")&&ip("exportKey")){var i=xt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:sp(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(o){var c=o.target.result,f=xt.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(u){var h=u.target.result,p=W.privateKeyFromAsn1(m.fromDer(G.util.createBuffer(h)));n(null,{privateKey:p,publicKey:W.setRsaPublicKey(p.n,p.e)})},f.onerror=function(u){n(u)}},i.onerror=function(o){n(o)};return}}else if(rp("generateKeyPairSync")){var s=f0.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:W.privateKeyFromPem(s.privateKey),publicKey:W.publicKeyFromPem(s.publicKey)}}}var a=W.rsa.createKeyPairGenerationState(t,e,r);if(!n)return W.rsa.stepKeyPairGenerationState(a,0),a.keys;gm(a,r,n)};W.setRsaPublicKey=W.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(o,c,f){return tp(o,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(o,c){return G.pkcs1.encode_rsa_oaep(c,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(o){return o}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var a=i.encode(n,r,!0);return W.rsa.encrypt(a,r,!0)},r.verify=function(n,i,s){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),s==="RSASSA-PKCS1-V1_5"?s={verify:function(o,c){c=$s(c,r,!0);var f=m.fromDer(c);return o===f.value[1].value}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(o,c){return c=$s(c,r,!0),o===c}});var a=W.rsa.decrypt(i,r,!0,!1);return s.verify(n,a,r.n.bitLength())},r};W.setRsaPrivateKey=W.rsa.setPrivateKey=function(t,e,r,n,i,s,a,o){var c={n:t,e,d:r,p:n,q:i,dP:s,dQ:a,qInv:o};return c.decrypt=function(f,u,h){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var p=W.rsa.decrypt(f,c,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:$s};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(y,d){return G.pkcs1.decode_rsa_oaep(d,y,h)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(y){return y}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(p,c,!1)},c.sign=function(f,u){var h=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:dm},h=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return f}},h=1);var p=u.encode(f,c.n.bitLength());return W.rsa.encrypt(p,c,h)},c};W.wrapRsaPrivateKey=function(t){return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(0).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(W.oids.rsaEncryption).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")]),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,m.toDer(t).getBytes())])};W.privateKeyFromAsn1=function(t){var e={},r=[];if(m.validate(t,um,e,r)&&(t=m.fromDer(G.util.createBuffer(e.privateKey))),e={},r=[],!m.validate(t,hm,e,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,s,a,o,c,f,u,h;return i=G.util.createBuffer(e.privateKeyModulus).toHex(),s=G.util.createBuffer(e.privateKeyPublicExponent).toHex(),a=G.util.createBuffer(e.privateKeyPrivateExponent).toHex(),o=G.util.createBuffer(e.privateKeyPrime1).toHex(),c=G.util.createBuffer(e.privateKeyPrime2).toHex(),f=G.util.createBuffer(e.privateKeyExponent1).toHex(),u=G.util.createBuffer(e.privateKeyExponent2).toHex(),h=G.util.createBuffer(e.privateKeyCoefficient).toHex(),W.setRsaPrivateKey(new re(i,16),new re(s,16),new re(a,16),new re(o,16),new re(c,16),new re(f,16),new re(u,16),new re(h,16))};W.privateKeyToAsn1=W.privateKeyToRSAPrivateKey=function(t){return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,m.integerToDer(0).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.n)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.e)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.d)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.p)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.q)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.dP)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.dQ)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.qInv))])};W.publicKeyFromAsn1=function(t){var e={},r=[];if(m.validate(t,pm,e,r)){var n=m.derToOid(e.publicKeyOid);if(n!==W.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!m.validate(t,lm,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var s=G.util.createBuffer(e.publicKeyModulus).toHex(),a=G.util.createBuffer(e.publicKeyExponent).toHex();return W.setRsaPublicKey(new re(s,16),new re(a,16))};W.publicKeyToAsn1=W.publicKeyToSubjectPublicKeyInfo=function(t){return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(W.oids.rsaEncryption).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")]),m.create(m.Class.UNIVERSAL,m.Type.BITSTRING,!1,[W.publicKeyToRSAPublicKey(t)])])};W.publicKeyToRSAPublicKey=function(t){return m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.n)),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,Ht(t.e))])};function tp(t,e,r){var n=G.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var a=i-3-t.length,o;if(r===0||r===1){o=r===0?0:255;for(var c=0;c<a;++c)n.putByte(o)}else for(;a>0;){for(var f=0,u=G.random.getBytes(a),c=0;c<a;++c)o=u.charCodeAt(c),o===0?++f:n.putByte(o);a=f}return n.putByte(0),n.putBytes(t),n}function $s(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),s=G.util.createBuffer(t),a=s.getByte(),o=s.getByte();if(a!==0||r&&o!==0&&o!==1||!r&&o!=2||r&&o===0&&typeof n=="undefined")throw new Error("Encryption block is invalid.");var c=0;if(o===0){c=i-3-n;for(var f=0;f<c;++f)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(o===1)for(c=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++c}else if(o===2)for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}var u=s.getByte();if(u!==0||c!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function gm(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),i();function i(){s(t.pBits,function(o,c){if(o)return r(o);if(t.p=c,t.q!==null)return a(o,t.q);s(t.qBits,a)})}function s(o,c){G.prime.generateProbablePrime(o,n,c)}function a(o,c){if(o)return r(o);if(t.q=c,t.p.compareTo(t.q)<0){var f=t.p;t.p=t.q,t.q=f}if(t.p.subtract(re.ONE).gcd(t.e).compareTo(re.ONE)!==0){t.p=null,i();return}if(t.q.subtract(re.ONE).gcd(t.e).compareTo(re.ONE)!==0){t.q=null,s(t.qBits,a);return}if(t.p1=t.p.subtract(re.ONE),t.q1=t.q.subtract(re.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(re.ONE)!==0){t.p=t.q=null,i();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,s(t.qBits,a);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:W.rsa.setPrivateKey(t.n,t.e,u,t.p,t.q,u.mod(t.p1),u.mod(t.q1),t.q.modInverse(t.p)),publicKey:W.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function Ht(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=G.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&(r.charCodeAt(1)&128)==0||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)==128)?r.substr(1):r}function ym(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function rp(t){return G.util.isNodejs&&typeof f0[t]=="function"}function np(t){return typeof xt.globalScope!="undefined"&&typeof xt.globalScope.crypto=="object"&&typeof xt.globalScope.crypto.subtle=="object"&&typeof xt.globalScope.crypto.subtle[t]=="function"}function ip(t){return typeof xt.globalScope!="undefined"&&typeof xt.globalScope.msCrypto=="object"&&typeof xt.globalScope.msCrypto.subtle=="object"&&typeof xt.globalScope.msCrypto.subtle[t]=="function"}function sp(t){for(var e=G.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var hp=S((iS,ap)=>{l();var N=xe();e0();pi();yl();Jr();ks();ml();Sl();di();Dl();Xs();Re();typeof op=="undefined"&&(op=N.jsbn.BigInteger);var op,_=N.asn1,Y=N.pki=N.pki||{};ap.exports=Y.pbe=N.pbe=N.pbe||{};var rn=Y.oids,xm={name:"EncryptedPrivateKeyInfo",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:_.Class.UNIVERSAL,type:_.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:_.Class.UNIVERSAL,type:_.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},vm={name:"PBES2Algorithms",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:_.Class.UNIVERSAL,type:_.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:_.Class.UNIVERSAL,type:_.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:_.Class.UNIVERSAL,type:_.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:_.Class.UNIVERSAL,type:_.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:_.Class.UNIVERSAL,type:_.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:_.Class.UNIVERSAL,type:_.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:_.Class.UNIVERSAL,type:_.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},bm={name:"pkcs-12PbeParams",tagClass:_.Class.UNIVERSAL,type:_.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:_.Class.UNIVERSAL,type:_.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:_.Class.UNIVERSAL,type:_.Type.INTEGER,constructed:!1,capture:"iterations"}]};Y.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=N.random.getBytesSync(r.saltSize),i=r.count,s=_.integerToDer(i),a,o,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var f,u,h;switch(r.algorithm){case"aes128":a=16,f=16,u=rn["aes128-CBC"],h=N.aes.createEncryptionCipher;break;case"aes192":a=24,f=16,u=rn["aes192-CBC"],h=N.aes.createEncryptionCipher;break;case"aes256":a=32,f=16,u=rn["aes256-CBC"],h=N.aes.createEncryptionCipher;break;case"des":a=8,f=8,u=rn.desCBC,h=N.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var y="hmacWith"+r.prfAlgorithm.toUpperCase(),d=cp(y),g=N.pkcs5.pbkdf2(e,n,i,a,d),v=N.random.getBytesSync(f),b=h(g);b.start(v),b.update(_.toDer(t)),b.finish(),c=b.output.getBytes();var w=mm(n,s,a,y);o=_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OID,!1,_.oidToDer(rn.pkcs5PBES2).getBytes()),_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OID,!1,_.oidToDer(rn.pkcs5PBKDF2).getBytes()),w]),_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OID,!1,_.oidToDer(u).getBytes()),_.create(_.Class.UNIVERSAL,_.Type.OCTETSTRING,!1,v)])])])}else if(r.algorithm==="3des"){a=24;var E=new N.util.ByteBuffer(n),g=Y.pbe.generatePkcs12Key(e,E,1,i,a),v=Y.pbe.generatePkcs12Key(e,E,2,i,a),b=N.des.createEncryptionCipher(g);b.start(v),b.update(_.toDer(t)),b.finish(),c=b.output.getBytes(),o=_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OID,!1,_.oidToDer(rn["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OCTETSTRING,!1,n),_.create(_.Class.UNIVERSAL,_.Type.INTEGER,!1,s.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var T=_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[o,_.create(_.Class.UNIVERSAL,_.Type.OCTETSTRING,!1,c)]);return T};Y.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!_.validate(t,xm,n,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var a=_.derToOid(n.encryptionOid),o=Y.pbe.getCipher(a,n.encryptionParams,e),c=N.util.createBuffer(n.encryptedData);return o.update(c),o.finish()&&(r=_.fromDer(o.output)),r};Y.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:_.toDer(t).getBytes()};return N.pem.encode(r,{maxline:e})};Y.encryptedPrivateKeyFromPem=function(t){var e=N.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return _.fromDer(e.body)};Y.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=Y.wrapRsaPrivateKey(Y.privateKeyToAsn1(t));return n=Y.encryptPrivateKeyInfo(n,e,r),Y.encryptedPrivateKeyToPem(n)}var i,s,a,o;switch(r.algorithm){case"aes128":i="AES-128-CBC",a=16,s=N.random.getBytesSync(16),o=N.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",a=24,s=N.random.getBytesSync(16),o=N.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",a=32,s=N.random.getBytesSync(16),o=N.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",a=24,s=N.random.getBytesSync(8),o=N.des.createEncryptionCipher;break;case"des":i="DES-CBC",a=8,s=N.random.getBytesSync(8),o=N.des.createEncryptionCipher;break;default:var c=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw c.algorithm=r.algorithm,c}var f=N.pbe.opensslDeriveBytes(e,s.substr(0,8),a),u=o(f);u.start(s),u.update(_.toDer(Y.privateKeyToAsn1(t))),u.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:N.util.bytesToHex(s).toUpperCase()},body:u.output.getBytes()};return N.pem.encode(h)};Y.decryptRsaPrivateKey=function(t,e){var r=null,n=N.pem.decode(t)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var s,a;switch(n.dekInfo.algorithm){case"DES-CBC":s=8,a=N.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,a=N.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,a=N.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,a=N.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,a=N.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,a=function(h){return N.rc2.createDecryptionCipher(h,40)};break;case"RC2-64-CBC":s=8,a=function(h){return N.rc2.createDecryptionCipher(h,64)};break;case"RC2-128-CBC":s=16,a=function(h){return N.rc2.createDecryptionCipher(h,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var o=N.util.hexToBytes(n.dekInfo.parameters),c=N.pbe.opensslDeriveBytes(e,o.substr(0,8),s),f=a(c);if(f.start(o),f.update(N.util.createBuffer(n.body)),f.finish())r=f.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=Y.decryptPrivateKeyInfo(_.fromDer(r),e):r=_.fromDer(r),r!==null&&(r=Y.privateKeyFromAsn1(r)),r};Y.pbe.generatePkcs12Key=function(t,e,r,n,i,s){var a,o;if(typeof s=="undefined"||s===null){if(!("sha1"in N.md))throw new Error('"sha1" hash algorithm unavailable.');s=N.md.sha1.create()}var c=s.digestLength,f=s.blockLength,u=new N.util.ByteBuffer,h=new N.util.ByteBuffer;if(t!=null){for(o=0;o<t.length;o++)h.putInt16(t.charCodeAt(o));h.putInt16(0)}var p=h.length(),y=e.length(),d=new N.util.ByteBuffer;d.fillWithByte(r,f);var g=f*Math.ceil(y/f),v=new N.util.ByteBuffer;for(o=0;o<g;o++)v.putByte(e.at(o%y));var b=f*Math.ceil(p/f),w=new N.util.ByteBuffer;for(o=0;o<b;o++)w.putByte(h.at(o%p));var E=v;E.putBuffer(w);for(var T=Math.ceil(i/c),A=1;A<=T;A++){var C=new N.util.ByteBuffer;C.putBytes(d.bytes()),C.putBytes(E.bytes());for(var L=0;L<n;L++)s.start(),s.update(C.getBytes()),C=s.digest();var k=new N.util.ByteBuffer;for(o=0;o<f;o++)k.putByte(C.at(o%c));var F=Math.ceil(y/f)+Math.ceil(p/f),q=new N.util.ByteBuffer;for(a=0;a<F;a++){var X=new N.util.ByteBuffer(E.getBytes(f)),j=511;for(o=k.length()-1;o>=0;o--)j=j>>8,j+=k.at(o)+X.at(o),X.setAt(o,j&255);q.putBuffer(X)}E=q,u.putBuffer(C)}return u.truncate(u.length()-i),u};Y.pbe.getCipher=function(t,e,r){switch(t){case Y.oids.pkcs5PBES2:return Y.pbe.getCipherForPBES2(t,e,r);case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:return Y.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};Y.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!_.validate(e,vm,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(t=_.derToOid(n.kdfOid),t!==Y.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=t,s.supportedOids=["pkcs5PBKDF2"],s}if(t=_.derToOid(n.encOid),t!==Y.oids["aes128-CBC"]&&t!==Y.oids["aes192-CBC"]&&t!==Y.oids["aes256-CBC"]&&t!==Y.oids["des-EDE3-CBC"]&&t!==Y.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=t,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var a=n.kdfSalt,o=N.util.createBuffer(n.kdfIterationCount);o=o.getInt(o.length()<<3);var c,f;switch(Y.oids[t]){case"aes128-CBC":c=16,f=N.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=N.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=N.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=N.des.createDecryptionCipher;break;case"desCBC":c=8,f=N.des.createDecryptionCipher;break}var u=fp(n.prfOid),h=N.pkcs5.pbkdf2(r,a,o,c,u),p=n.encIv,y=f(h);return y.start(p),y};Y.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!_.validate(e,bm,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var a=N.util.createBuffer(n.salt),o=N.util.createBuffer(n.iterations);o=o.getInt(o.length()<<3);var c,f,u;switch(t){case Y.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,u=N.des.startDecrypting;break;case Y.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,u=function(g,v){var b=N.rc2.createDecryptionCipher(g,40);return b.start(v,null),b};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=t,s}var h=fp(n.prfOid),p=Y.pbe.generatePkcs12Key(r,a,1,o,c,h);h.start();var y=Y.pbe.generatePkcs12Key(r,a,2,o,f,h);return u(p,y)};Y.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n=="undefined"||n===null){if(!("md5"in N.md))throw new Error('"md5" hash algorithm unavailable.');n=N.md.md5.create()}e===null&&(e="");for(var i=[up(n,t+e)],s=16,a=1;s<r;++a,s+=16)i.push(up(n,i[a-1]+t+e));return i.join("").substr(0,r)};function up(t,e){return t.start().update(e).digest().getBytes()}function fp(t){var e;if(!t)e="hmacWithSHA1";else if(e=Y.oids[_.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return cp(e)}function cp(t){var e=N.md;switch(t){case"hmacWithSHA224":e=N.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!e||!(t in e))throw new Error("Unknown hash algorithm: "+t);return e[t].create()}function mm(t,e,r,n){var i=_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OCTETSTRING,!1,t),_.create(_.Class.UNIVERSAL,_.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(_.create(_.Class.UNIVERSAL,_.Type.INTEGER,!1,N.util.hexToBytes(r.toString(16))),_.create(_.Class.UNIVERSAL,_.Type.SEQUENCE,!0,[_.create(_.Class.UNIVERSAL,_.Type.OID,!1,_.oidToDer(Y.oids[n]).getBytes()),_.create(_.Class.UNIVERSAL,_.Type.NULL,!1,"")])),i}});var Vt=S((sS,lp)=>{l();"use strict";function pp(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function wm(t,e,r){if(!t||typeof t=="string")throw new TypeError("Please pass an Error to err-code");r||(r={}),typeof e=="object"&&(r=e,e=""),e&&(r.code=e);try{return pp(t,r)}catch(n){r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),pp(new i,r)}}lp.exports=wm});function Em(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),a=s.charCodeAt(0);if(r[a]!==255)throw new TypeError(s+" is ambiguous");r[a]=i}var o=t.length,c=t.charAt(0),f=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function h(d){if(d instanceof Uint8Array||(ArrayBuffer.isView(d)?d=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):Array.isArray(d)&&(d=Uint8Array.from(d))),!(d instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(d.length===0)return"";for(var g=0,v=0,b=0,w=d.length;b!==w&&d[b]===0;)b++,g++;for(var E=(w-b)*u+1>>>0,T=new Uint8Array(E);b!==w;){for(var A=d[b],C=0,L=E-1;(A!==0||C<v)&&L!==-1;L--,C++)A+=256*T[L]>>>0,T[L]=A%o>>>0,A=A/o>>>0;if(A!==0)throw new Error("Non-zero carry");v=C,b++}for(var k=E-v;k!==E&&T[k]===0;)k++;for(var F=c.repeat(g);k<E;++k)F+=t.charAt(T[k]);return F}function p(d){if(typeof d!="string")throw new TypeError("Expected String");if(d.length===0)return new Uint8Array;var g=0;if(d[g]!==" "){for(var v=0,b=0;d[g]===c;)v++,g++;for(var w=(d.length-g)*f+1>>>0,E=new Uint8Array(w);d[g];){var T=r[d.charCodeAt(g)];if(T===255)return;for(var A=0,C=w-1;(T!==0||A<b)&&C!==-1;C--,A++)T+=o*E[C]>>>0,E[C]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");b=A,g++}if(d[g]!==" "){for(var L=w-b;L!==w&&E[L]===0;)L++;for(var k=new Uint8Array(v+(w-L)),F=v;L!==w;)k[F++]=E[L++];return k}}}function y(d){var g=p(d);if(g)return g;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:p,decode:y}}var Sm,Bm,dp,yp=z(()=>{l();Sm=Em,Bm=Sm,dp=Bm});var oS,xp,nr,vp,bp,Br=z(()=>{l();oS=new Uint8Array(0),xp=(t,e)=>{if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0},nr=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},vp=t=>new TextEncoder().encode(t),bp=t=>new TextDecoder().decode(t)});var mp,wp,Ys,Ep,Zs,_r,_m,Am,Ke,zt=z(()=>{l();yp();Br();mp=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},wp=class{constructor(e,r,n){this.name=e,this.prefix=r,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){let r={[this.prefix]:this,...e.decoders||{[e.prefix]:e}};return new Ys(r)}},Ys=class{constructor(e){this.decoders=e}or(e){let r=e.decoders||{[e.prefix]:e};return new Ys({...this.decoders,...r})}decode(e){let r=e[0],n=this.decoders[r];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},Ep=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new mp(e,r,n),this.decoder=new wp(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Zs=({name:t,prefix:e,encode:r,decode:n})=>new Ep(t,e,r,n),_r=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=dp(r,e);return Zs({prefix:t,name:e,encode:n,decode:s=>nr(i(s))})},_m=(t,e,r,n)=>{let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let s=t.length;for(;t[s-1]==="=";)--s;let a=new Uint8Array(s*r/8|0),o=0,c=0,f=0;for(let u=0;u<s;++u){let h=i[t[u]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|h,o+=r,o>=8&&(o-=8,a[f++]=255&c>>o)}if(o>=r||255&c<<8-o)throw new SyntaxError("Unexpected end of data");return a},Am=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,s="",a=0,o=0;for(let c=0;c<t.length;++c)for(o=o<<8|t[c],a+=8;a>r;)a-=r,s+=e[i&o>>a];if(a&&(s+=e[i&o<<r-a]),n)for(;s.length*r&7;)s+="=";return s},Ke=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Zs({prefix:e,name:t,encode(i){return Am(i,n,r)},decode(i){return _m(i,n,r,t)}})});var u0={};Ee(u0,{identity:()=>Cm});var Cm,Sp=z(()=>{l();zt();Br();Cm=Zs({prefix:"\0",name:"identity",encode:t=>bp(t),decode:t=>vp(t)})});var h0={};Ee(h0,{base2:()=>Im});var Im,Bp=z(()=>{l();zt();Im=Ke({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var l0={};Ee(l0,{base8:()=>Tm});var Tm,_p=z(()=>{l();zt();Tm=Ke({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var p0={};Ee(p0,{base10:()=>Pm});var Pm,Ap=z(()=>{l();zt();Pm=_r({prefix:"9",name:"base10",alphabet:"0123456789"})});var d0={};Ee(d0,{base16:()=>Km,base16upper:()=>Lm});var Km,Lm,Cp=z(()=>{l();zt();Km=Ke({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Lm=Ke({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var y0={};Ee(y0,{base32:()=>Pn,base32hex:()=>Nm,base32hexpad:()=>Fm,base32hexpadupper:()=>Mm,base32hexupper:()=>Um,base32pad:()=>km,base32padupper:()=>Dm,base32upper:()=>Rm,base32z:()=>Om});var Pn,Rm,km,Dm,Nm,Um,Fm,Mm,Om,g0=z(()=>{l();zt();Pn=Ke({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Rm=Ke({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),km=Ke({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Dm=Ke({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Nm=Ke({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Um=Ke({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Fm=Ke({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Mm=Ke({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Om=Ke({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var x0={};Ee(x0,{base36:()=>qm,base36upper:()=>Hm});var qm,Hm,Ip=z(()=>{l();zt();qm=_r({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Hm=_r({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var v0={};Ee(v0,{base58btc:()=>Gt,base58flickr:()=>Vm});var Gt,Vm,b0=z(()=>{l();zt();Gt=_r({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Vm=_r({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var m0={};Ee(m0,{base64:()=>zm,base64pad:()=>Gm,base64url:()=>Wm,base64urlpad:()=>jm});var zm,Gm,Wm,jm,Tp=z(()=>{l();zt();zm=Ke({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gm=Ke({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Wm=Ke({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),jm=Ke({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function Pp(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Zm;)e[r++]=t&255|Kp,t/=128;for(;t&Ym;)e[r++]=t&255|Kp,t>>>=7;return e[r]=t|0,Pp.bytes=r-n+1,e}function w0(t,e){var r=0,e=e||0,n=0,i=e,s,a=t.length;do{if(i>=a)throw w0.bytes=0,new RangeError("Could not decode varint");s=t[i++],r+=n<28?(s&Lp)<<n:(s&Lp)*Math.pow(2,n),n+=7}while(s>=Jm);return w0.bytes=i-e,r}var $m,Kp,Xm,Ym,Zm,Qm,Jm,Lp,ew,tw,rw,nw,iw,sw,aw,ow,cw,fw,uw,hw,gi,Rp=z(()=>{l();$m=Pp,Kp=128,Xm=127,Ym=~Xm,Zm=Math.pow(2,31);Qm=w0,Jm=128,Lp=127;ew=Math.pow(2,7),tw=Math.pow(2,14),rw=Math.pow(2,21),nw=Math.pow(2,28),iw=Math.pow(2,35),sw=Math.pow(2,42),aw=Math.pow(2,49),ow=Math.pow(2,56),cw=Math.pow(2,63),fw=function(t){return t<ew?1:t<tw?2:t<rw?3:t<nw?4:t<iw?5:t<sw?6:t<aw?7:t<ow?8:t<cw?9:10},uw={encode:$m,decode:Qm,encodingLength:fw},hw=uw,gi=hw});var xi,Kn,Ln,Qs=z(()=>{l();Rp();xi=t=>[gi.decode(t),gi.decode.bytes],Kn=(t,e,r=0)=>(gi.encode(t,e,r),e),Ln=t=>gi.encodingLength(t)});var Js,Np,Up,vi,ea=z(()=>{l();Br();Qs();Js=(t,e)=>{let r=e.byteLength,n=Ln(t),i=n+Ln(r),s=new Uint8Array(i+r);return Kn(t,s,0),Kn(r,s,n),s.set(e,i),new vi(t,r,e,s)},Np=t=>{let e=nr(t),[r,n]=xi(e),[i,s]=xi(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new vi(r,i,a,e)},Up=(t,e)=>t===e?!0:t.code===e.code&&t.size===e.size&&xp(t.bytes,e.bytes),vi=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}}});var bi,Mp,ta=z(()=>{l();ea();bi=({name:t,code:e,encode:r})=>new Mp(t,e,r),Mp=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}async digest(e){if(e instanceof Uint8Array){let r=await this.encode(e);return Js(this.code,r)}else throw Error("Unknown type, must be binary type")}}});var E0={};Ee(E0,{sha256:()=>lw,sha512:()=>pw});var Op,lw,pw,qp=z(()=>{l();ta();Op=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),lw=bi({name:"sha2-256",code:18,encode:Op("SHA-256")}),pw=bi({name:"sha2-512",code:19,encode:Op("SHA-512")})});var S0={};Ee(S0,{identity:()=>dw});var dw,Hp=z(()=>{l();ta();Br();dw=bi({name:"identity",code:0,encode:t=>nr(t)})});var Vp=z(()=>{l();Br()});var zp=z(()=>{l()});var qe,xw,vw,bw,mi,mw,Gp,Wp,ra,na,Sw,ww,Ew,jp=z(()=>{l();Qs();ea();b0();g0();Br();qe=class{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:na,byteLength:na,code:ra,version:ra,multihash:ra,bytes:ra,_baseCache:na,asCID:na})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:r}=this;if(e!==mi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==mw)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return qe.createV0(r)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Js(e,r);return qe.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&Up(this.multihash,e.multihash)}toString(e){let{bytes:r,version:n,_baseCache:i}=this;switch(n){case 0:return vw(r,i,e||Gt.encoder);default:return bw(r,i,e||Pn.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return ww(/^0\.0/,Ew),!!(e&&(e[Wp]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof qe)return e;if(e!=null&&e.asCID===e){let{version:r,code:n,multihash:i,bytes:s}=e;return new qe(r,n,i,s||Gp(r,n,i.bytes))}else if(e!=null&&e[Wp]===!0){let{version:r,multihash:n,code:i}=e,s=Np(n);return qe.create(r,i,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(r!==mi)throw new Error(`Version 0 CID must use dag-pb (code: ${mi}) block encoding`);return new qe(e,r,n,n.bytes)}case 1:{let i=Gp(e,r,n.bytes);return new qe(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return qe.create(0,mi,e)}static createV1(e,r){return qe.create(1,e,r)}static decode(e){let[r,n]=qe.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=qe.inspectBytes(e),n=r.size-r.multihashSize,i=nr(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),a=new vi(r.multihashCode,r.digestSize,s,i);return[r.version===0?qe.createV0(a):qe.createV1(r.codec,a),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[h,p]=xi(e.subarray(r));return r+=p,h},i=n(),s=mi;if(i===18?(i=0,r=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,o=n(),c=n(),f=r+c,u=f-a;return{version:i,codec:s,multihashCode:o,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=xw(e,r),s=qe.decode(i);return s._baseCache.set(n,e),s}},xw=(t,e)=>{switch(t[0]){case"Q":{let r=e||Gt;return[Gt.prefix,r.decode(`${Gt.prefix}${t}`)]}case Gt.prefix:{let r=e||Gt;return[Gt.prefix,r.decode(t)]}case Pn.prefix:{let r=e||Pn;return[Pn.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}},vw=(t,e,r)=>{let{prefix:n}=r;if(n!==Gt.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},bw=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},mi=112,mw=18,Gp=(t,e,r)=>{let n=Ln(t),i=n+Ln(e),s=new Uint8Array(i+r.byteLength);return Kn(t,s,0),Kn(e,s,n),s.set(r,i),s},Wp=Symbol.for("@ipld/js-cid/CID"),ra={writable:!1,configurable:!1,enumerable:!0},na={writable:!1,enumerable:!1,configurable:!1},Sw="0.0.0-dev",ww=(t,e)=>{if(t.test(Sw))console.warn(e);else throw new Error(e)},Ew=`CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:

if (CID.isCID(value)) {
  doSomethingWithCID(value)
}

Is replaced with:

const cid = CID.asCID(value)
if (cid) {
  // Make sure to use cid instead of value
  doSomethingWithCID(cid)
}
`});var $p=z(()=>{l();jp();Qs();Br();ta();ea()});var B0,OS,Xp=z(()=>{l();Sp();Bp();_p();Ap();Cp();g0();Ip();b0();Tp();qp();Hp();Vp();zp();$p();B0={...u0,...h0,...l0,...p0,...d0,...y0,...x0,...v0,...m0},OS={...E0,...S0}});function Yp(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Zp,_0,Bw,ia,A0=z(()=>{l();Xp();Zp=Yp("utf8","u",t=>{let e=new TextDecoder("utf8");return"u"+e.decode(t)},t=>new TextEncoder().encode(t.substring(1))),_0=Yp("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Bw={utf8:Zp,"utf-8":Zp,hex:B0.base16,latin1:_0,ascii:_0,binary:_0,...B0},ia=Bw});var Ar={};Ee(Ar,{fromString:()=>_w});function _w(t,e="utf8"){let r=ia[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var Cr=z(()=>{l();A0()});var wi={};Ee(wi,{concat:()=>Aw});function Aw(t,e){e||(e=t.reduce((i,s)=>i+s.length,0));let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var Ei=z(()=>{l()});var Si=S(Qp=>{l();"use strict";Qp.get=(t=globalThis)=>{let e=t.crypto;if(!e||!e.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}});var C0=S((GS,Jp)=>{l();"use strict";var{concat:Cw}=(Ei(),wi),{fromString:ed}=(Cr(),Ar),Iw=Si();function Tw({algorithm:t="AES-GCM",nonceLength:e=12,keyLength:r=16,digest:n="SHA-256",saltLength:i=16,iterations:s=32767}={}){let a=Iw.get();r*=8;async function o(f,u){let h=a.getRandomValues(new Uint8Array(i)),p=a.getRandomValues(new Uint8Array(e)),y={name:t,iv:p},d={name:"PBKDF2",salt:h,iterations:s,hash:{name:n}},g=await a.subtle.importKey("raw",ed(u),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),v=await a.subtle.deriveKey(d,g,{name:t,length:r},!0,["encrypt"]),b=await a.subtle.encrypt(y,v,f);return Cw([h,y.iv,new Uint8Array(b)])}async function c(f,u){let h=f.slice(0,i),p=f.slice(i,i+e),y=f.slice(i+e),d={name:t,iv:p},g={name:"PBKDF2",salt:h,iterations:s,hash:{name:n}},v=await a.subtle.importKey("raw",ed(u),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),b=await a.subtle.deriveKey(g,v,{name:t,length:r},!0,["decrypt"]),w=await a.subtle.decrypt(d,b,y);return new Uint8Array(w)}return{encrypt:o,decrypt:c}}Jp.exports={create:Tw}});var rd=S((WS,td)=>{l();"use strict";var{base64:Pw}=(Bs(),Ss),Kw=C0();td.exports={import:async function(t,e){let r=Pw.decode(t);return await Kw.create().decrypt(r,e)}}});var Bi,nd,I0=z(()=>{l();xs();Bi=({name:t,code:e,encode:r})=>new nd(t,e,r),nd=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}async digest(e){if(e instanceof Uint8Array){let r=await this.encode(e);return ii(this.code,r)}else throw Error("Unknown type, must be binary type")}}});var _i={};Ee(_i,{sha256:()=>Lw,sha512:()=>Rw});var id,Lw,Rw,Ai=z(()=>{l();I0();id=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Lw=Bi({name:"sha2-256",code:18,encode:id("SHA-256")}),Rw=Bi({name:"sha2-512",code:19,encode:id("SHA-512")})});var Rn={};Ee(Rn,{equals:()=>T0});function T0(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}var nn=z(()=>{l()});var Ir={};Ee(Ir,{toString:()=>kw});function kw(t,e="utf8"){let r=ia[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var Tr=z(()=>{l();A0()});var fd=S((ZS,sd)=>{l();var Be=xe();Jr();Re();var Ci=sd.exports=Be.sha512=Be.sha512||{};Be.md.sha512=Be.md.algorithms.sha512=Ci;var ad=Be.sha384=Be.sha512.sha384=Be.sha512.sha384||{};ad.create=function(){return Ci.create("SHA-384")};Be.md.sha384=Be.md.algorithms.sha384=ad;Be.sha512.sha256=Be.sha512.sha256||{create:function(){return Ci.create("SHA-512/256")}};Be.md["sha512/256"]=Be.md.algorithms["sha512/256"]=Be.sha512.sha256;Be.sha512.sha224=Be.sha512.sha224||{create:function(){return Ci.create("SHA-512/224")}};Be.md["sha512/224"]=Be.md.algorithms["sha512/224"]=Be.sha512.sha224;Ci.create=function(t){if(od||Dw(),typeof t=="undefined"&&(t="SHA-512"),!(t in sn))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=sn[t],r=null,n=Be.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var a=64;switch(t){case"SHA-384":a=48;break;case"SHA-512/256":a=32;break;case"SHA-512/224":a=28;break}var o={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:a,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var c=o.messageLengthSize/4,f=0;f<c;++f)o.fullMessageLength.push(0);n=Be.util.createBuffer(),r=new Array(e.length);for(var f=0;f<e.length;++f)r[f]=e[f].slice(0);return o},o.start(),o.update=function(c,f){f==="utf8"&&(c=Be.util.encodeUtf8(c));var u=c.length;o.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var h=o.fullMessageLength.length-1;h>=0;--h)o.fullMessageLength[h]+=u[1],u[1]=u[0]+(o.fullMessageLength[h]/4294967296>>>0),o.fullMessageLength[h]=o.fullMessageLength[h]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(c),cd(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),o},o.digest=function(){var c=Be.util.createBuffer();c.putBytes(n.bytes());var f=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,u=f&o.blockLength-1;c.putBytes(P0.substr(0,o.blockLength-u));for(var h,p,y=o.fullMessageLength[0]*8,d=0;d<o.fullMessageLength.length-1;++d)h=o.fullMessageLength[d+1]*8,p=h/4294967296>>>0,y+=p,c.putInt32(y>>>0),y=h>>>0;c.putInt32(y);for(var g=new Array(r.length),d=0;d<r.length;++d)g[d]=r[d].slice(0);cd(g,i,c);var v=Be.util.createBuffer(),b;t==="SHA-512"?b=g.length:t==="SHA-384"?b=g.length-2:b=g.length-4;for(var d=0;d<b;++d)v.putInt32(g[d][0]),(d!==b-1||t!=="SHA-512/224")&&v.putInt32(g[d][1]);return v},o};var P0=null,od=!1,K0=null,sn=null;function Dw(){P0=String.fromCharCode(128),P0+=Be.util.fillString(String.fromCharCode(0),128),K0=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],sn={},sn["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],sn["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],sn["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],sn["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],od=!0}function cd(t,e,r){for(var n,i,s,a,o,c,f,u,h,p,y,d,g,v,b,w,E,T,A,C,L,k,F,q,X,j,ne,ge,O,V,I,H,be,J,ee,te=r.length();te>=128;){for(O=0;O<16;++O)e[O][0]=r.getInt32()>>>0,e[O][1]=r.getInt32()>>>0;for(;O<80;++O)H=e[O-2],V=H[0],I=H[1],n=((V>>>19|I<<13)^(I>>>29|V<<3)^V>>>6)>>>0,i=((V<<13|I>>>19)^(I<<3|V>>>29)^(V<<26|I>>>6))>>>0,J=e[O-15],V=J[0],I=J[1],s=((V>>>1|I<<31)^(V>>>8|I<<24)^V>>>7)>>>0,a=((V<<31|I>>>1)^(V<<24|I>>>8)^(V<<25|I>>>7))>>>0,be=e[O-7],ee=e[O-16],I=i+be[1]+a+ee[1],e[O][0]=n+be[0]+s+ee[0]+(I/4294967296>>>0)>>>0,e[O][1]=I>>>0;for(g=t[0][0],v=t[0][1],b=t[1][0],w=t[1][1],E=t[2][0],T=t[2][1],A=t[3][0],C=t[3][1],L=t[4][0],k=t[4][1],F=t[5][0],q=t[5][1],X=t[6][0],j=t[6][1],ne=t[7][0],ge=t[7][1],O=0;O<80;++O)f=((L>>>14|k<<18)^(L>>>18|k<<14)^(k>>>9|L<<23))>>>0,u=((L<<18|k>>>14)^(L<<14|k>>>18)^(k<<23|L>>>9))>>>0,h=(X^L&(F^X))>>>0,p=(j^k&(q^j))>>>0,o=((g>>>28|v<<4)^(v>>>2|g<<30)^(v>>>7|g<<25))>>>0,c=((g<<4|v>>>28)^(v<<30|g>>>2)^(v<<25|g>>>7))>>>0,y=(g&b|E&(g^b))>>>0,d=(v&w|T&(v^w))>>>0,I=ge+u+p+K0[O][1]+e[O][1],n=ne+f+h+K0[O][0]+e[O][0]+(I/4294967296>>>0)>>>0,i=I>>>0,I=c+d,s=o+y+(I/4294967296>>>0)>>>0,a=I>>>0,ne=X,ge=j,X=F,j=q,F=L,q=k,I=C+i,L=A+n+(I/4294967296>>>0)>>>0,k=I>>>0,A=E,C=T,E=b,T=w,b=g,w=v,I=i+a,g=n+s+(I/4294967296>>>0)>>>0,v=I>>>0;I=t[0][1]+v,t[0][0]=t[0][0]+g+(I/4294967296>>>0)>>>0,t[0][1]=I>>>0,I=t[1][1]+w,t[1][0]=t[1][0]+b+(I/4294967296>>>0)>>>0,t[1][1]=I>>>0,I=t[2][1]+T,t[2][0]=t[2][0]+E+(I/4294967296>>>0)>>>0,t[2][1]=I>>>0,I=t[3][1]+C,t[3][0]=t[3][0]+A+(I/4294967296>>>0)>>>0,t[3][1]=I>>>0,I=t[4][1]+k,t[4][0]=t[4][0]+L+(I/4294967296>>>0)>>>0,t[4][1]=I>>>0,I=t[5][1]+q,t[5][0]=t[5][0]+F+(I/4294967296>>>0)>>>0,t[5][1]=I>>>0,I=t[6][1]+j,t[6][0]=t[6][0]+X+(I/4294967296>>>0)>>>0,t[6][1]=I>>>0,I=t[7][1]+ge,t[7][0]=t[7][0]+ne+(I/4294967296>>>0)>>>0,t[7][1]=I>>>0,te-=128}}});var hd=S((QS,ud)=>{l();"use strict";var sa=65536;function Nw(t){let e=new Uint8Array(t),r=0;if(t>0)if(t>sa)for(;r<t;)r+sa>t?(crypto.getRandomValues(e.subarray(r,r+(t-r))),r+=t-r):(crypto.getRandomValues(e.subarray(r,r+sa)),r+=sa);else crypto.getRandomValues(e);return e}ud.exports=Nw});var L0=S((JS,ld)=>{l();"use strict";var Uw=hd(),Fw=Vt();ld.exports=function(t){if(isNaN(t)||t<=0)throw Fw(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return Uw(t)}});var aa=S(Ii=>{l();"use strict";Re();Ws();var Mw=xe(),{fromString:Ow}=(Cr(),Ar),{toString:pd}=(Tr(),Ir),{concat:dd}=(Ei(),wi);Ii.bigIntegerToUintBase64url=(t,e)=>{let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.slice(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=dd([new Uint8Array(e-r.length),r])}return pd(r,"base64url")};Ii.base64urlToBigInteger=t=>{let e=Ii.base64urlToBuffer(t);return new Mw.jsbn.BigInteger(pd(e,"base16"),16)};Ii.base64urlToBuffer=(t,e)=>{let r=Ow(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=dd([new Uint8Array(e-r.length),r])}return r}});var xd=S(Ti=>{l();"use strict";pi();Xs();var Pr=xe(),{bigIntegerToUintBase64url:Wt,base64urlToBigInteger:jt}=aa(),{fromString:yd}=(Cr(),Ar),{toString:gd}=(Tr(),Ir);Ti.pkcs1ToJwk=function(t){let e=Pr.asn1.fromDer(gd(t,"ascii")),r=Pr.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:Wt(r.n),e:Wt(r.e),d:Wt(r.d),p:Wt(r.p),q:Wt(r.q),dp:Wt(r.dP),dq:Wt(r.dQ),qi:Wt(r.qInv),alg:"RS256",kid:"2011-04-29"}};Ti.jwkToPkcs1=function(t){let e=Pr.pki.privateKeyToAsn1({n:jt(t.n),e:jt(t.e),d:jt(t.d),p:jt(t.p),q:jt(t.q),dP:jt(t.dp),dQ:jt(t.dq),qInv:jt(t.qi)});return yd(Pr.asn1.toDer(e).getBytes(),"ascii")};Ti.pkixToJwk=function(t){let e=Pr.asn1.fromDer(gd(t,"ascii")),r=Pr.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:Wt(r.n),e:Wt(r.e),alg:"RS256",kid:"2011-04-29"}};Ti.jwkToPkix=function(t){let e=Pr.pki.publicKeyToAsn1({n:jt(t.n),e:jt(t.e)});return yd(Pr.asn1.toDer(e).getBytes(),"ascii")}});var wd=S((r6,vd)=>{l();"use strict";Xs();var bd=xe(),{base64urlToBigInteger:qw}=aa();function md(t,e){return e.map(r=>qw(t[r]))}function Hw(t){return bd.pki.setRsaPrivateKey(...md(t,["n","e","d","p","q","dp","dq","qi"]))}function Vw(t){return bd.pki.setRsaPublicKey(...md(t,["n","e"]))}vd.exports={jwk2pub:Vw,jwk2priv:Hw}});var Bd=S(ir=>{l();"use strict";var sr=Si(),zw=L0(),{toString:Gw}=(Tr(),Ir),{fromString:Ww}=(Cr(),Ar);ir.utils=xd();ir.generateKey=async function(t){let e=await sr.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await Ed(e);return{privateKey:r[0],publicKey:r[1]}};ir.unmarshalPrivateKey=async function(t){let r=[await sr.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await jw(t)],n=await Ed({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}};ir.getRandomValues=zw;ir.hashAndSign=async function(t,e){let r=await sr.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await sr.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(e));return new Uint8Array(n,n.byteOffset,n.byteLength)};ir.hashAndVerify=async function(t,e,r){let n=await sr.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return sr.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r)};function Ed(t){return Promise.all([sr.get().subtle.exportKey("jwk",t.privateKey),sr.get().subtle.exportKey("jwk",t.publicKey)])}function jw(t){return sr.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}var{jwk2pub:$w,jwk2priv:Xw}=wd();function Sd(t,e,r,n){let i=e?$w(t):Xw(t),s=Gw(Uint8Array.from(r),"ascii"),a=n(s,i);return Ww(a,"ascii")}ir.encrypt=function(t,e){return Sd(t,!0,e,(r,n)=>n.encrypt(r))};ir.decrypt=function(t,e){return Sd(t,!1,e,(r,n)=>n.decrypt(r))}});var oa=S((i6,_d)=>{l();"use strict";var{base64:Yw}=(Bs(),Ss),Zw=C0();_d.exports={export:async function(t,e){let n=await Zw.create().encrypt(t,e);return Yw.encode(n)}}});var Pd=S((s6,Ad)=>{l();"use strict";var{sha256:Cd}=(Ai(),_i),Id=Vt(),{equals:Td}=(nn(),Rn),{toString:Qw}=(Tr(),Ir);fd();var ca=xe(),vt=Bd(),fa=Ks(),Jw=oa(),ua=class{constructor(e){this._key=e}async verify(e,r){return vt.hashAndVerify(this._key,r,e)}marshal(){return vt.utils.jwkToPkix(this._key)}get bytes(){return fa.PublicKey.encode({Type:fa.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return vt.encrypt(this._key,e)}equals(e){return Td(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Cd.digest(this.bytes);return e}},Pi=class{constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return vt.getRandomValues(16)}async sign(e){return vt.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw Id(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new ua(this._publicKey)}decrypt(e){return vt.decrypt(this._key,e)}marshal(){return vt.utils.jwkToPkcs1(this._key)}get bytes(){return fa.PrivateKey.encode({Type:fa.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return Td(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Cd.digest(this.bytes);return e}async id(){let e=await this.public.hash();return Qw(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new ca.util.ByteBuffer(this.marshal()),i=ca.asn1.fromDer(n),s=ca.pki.privateKeyFromAsn1(i),a={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return ca.pki.encryptRsaPrivateKey(s,e,a)}else{if(r==="libp2p-key")return Jw.export(this.bytes,e);throw Id(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}};async function e3(t){let e=vt.utils.pkcs1ToJwk(t),r=await vt.unmarshalPrivateKey(e);return new Pi(r.privateKey,r.publicKey)}function t3(t){let e=vt.utils.pkixToJwk(t);return new ua(e)}async function r3(t){let e=await vt.unmarshalPrivateKey(t);return new Pi(e.privateKey,e.publicKey)}async function n3(t){let e=await vt.generateKey(t);return new Pi(e.privateKey,e.publicKey)}Ad.exports={RsaPublicKey:ua,RsaPrivateKey:Pi,unmarshalRsaPublicKey:t3,unmarshalRsaPrivateKey:e3,generateKeyPair:n3,fromJwk:r3}});var R0={};Ee(R0,{identity:()=>i3});var i3,k0=z(()=>{l();I0();ni();i3=Bi({name:"identity",code:0,encode:t=>gr(t)})});var Fd=S((Ie,Kd)=>{l();"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.utils=Ie.verify=Ie.sign=Ie.getPublicKey=Ie.SignResult=Ie.Signature=Ie.Point=Ie.ExtendedPoint=Ie.CURVE=void 0;var Pe={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,P:2n**255n-19n,n:2n**252n+27742317777372353535851937790883648493n,h:8n,Gx:15112221349535400772501151409588531511454012693041857206046113283949847762202n,Gy:46316835694926478169428394003475163141307993866256225615783033603165251855960n};Ie.CURVE=Pe;var it=32,Ki=19681161376707505956807079304988542015446066515923890162744021073123829784752n,s3=25063068953384623474111414158702152701244531502492656460079210482610430750235n,a3=54469307008909316920995813868745141605393597292927456921205312896311721017578n,o3=1159843021668779879193775521855586647937357759715417654439879720876111806838n,c3=40440834346308536858101042469323190826248399146238708352240133220865137265952n,ve=class{constructor(e,r,n,i){this.x=e,this.y=r,this.z=n,this.t=i}static fromAffine(e){if(!(e instanceof Te))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(Te.ZERO)?ve.ZERO:new ve(e.x,e.y,1n,K(e.x*e.y))}static toAffineBatch(e){let r=f3(e.map(n=>n.z));return e.map((n,i)=>n.toAffine(r[i]))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}static fromRistrettoHash(e){let r=N0(e.slice(0,it)),n=this.calcElligatorRistrettoMap(r),i=N0(e.slice(it,it*2)),s=this.calcElligatorRistrettoMap(i);return n.add(s)}static calcElligatorRistrettoMap(e){let{d:r}=Pe,n=K(Ki*e*e),i=K((n+1n)*o3),s=-1n,a=K((s-r*n)*K(n+r)),{isValid:o,value:c}=F0(i,a),f=K(c*e);Kr(f)||(f=K(-f)),o||(c=f),o||(s=n);let u=K(s*(n-1n)*c3-a),h=c*c,p=K((c+c)*a),y=K(u*s3),d=K(1n-h),g=K(1n+h);return new ve(K(p*g),K(d*y),K(y*g),K(p*d))}static fromRistrettoBytes(e){let{a:r,d:n}=Pe,i="ExtendedPoint.fromRistrettoBytes: Cannot convert bytes to Ristretto Point",s=N0(e);if(!u3(Ld(s,it),e)||Kr(s))throw new Error(i);let a=K(s*s),o=K(1n+r*a),c=K(1n-r*a),f=K(o*o),u=K(c*c),h=K(r*n*f-u),{isValid:p,value:y}=kd(K(h*u)),d=K(y*c),g=K(y*d*h),v=K((s+s)*d);Kr(v)&&(v=K(-v));let b=K(o*g),w=K(v*b);if(!p||Kr(w)||b===0n)throw new Error(i);return new ve(v,b,1n,w)}toRistrettoBytes(){let{x:e,y:r,z:n,t:i}=this,s=K((n+r)*(n-r)),a=K(e*r),{value:o}=kd(K(s*a**2n)),c=K(o*s),f=K(o*a),u=K(c*f*i),h;Kr(i*u)?([e,r]=[K(r*Ki),K(e*Ki)],h=K(c*a3)):h=f,Kr(e*u)&&(r=K(-r));let p=K((n-r)*h);return Kr(p)&&(p=K(-p)),Ld(p,it)}equals(e){let r=this,n=e,[i,s,a,o]=[r.t,n.t,r.z,n.z];return K(i*o)===K(s*a)}negate(){return new ve(K(-this.x),this.y,this.z,K(-this.t))}double(){let e=this.x,r=this.y,n=this.z,{a:i}=Pe,s=K(e**2n),a=K(r**2n),o=K(2n*n**2n),c=K(i*s),f=K((e+r)**2n-s-a),u=K(c+a),h=K(u-o),p=K(c-a),y=K(f*h),d=K(u*p),g=K(f*p),v=K(h*u);return new ve(y,d,v,g)}add(e){let r=this.x,n=this.y,i=this.z,s=this.t,a=e.x,o=e.y,c=e.z,f=e.t,u=K((n-r)*(o+a)),h=K((n+r)*(o-a)),p=K(h-u);if(p===0n)return this.double();let y=K(i*2n*f),d=K(s*2n*c),g=K(d+y),v=K(h+u),b=K(d-y),w=K(g*p),E=K(v*b),T=K(g*b),A=K(p*v);return new ve(w,E,A,T)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){if(!Rd(e))throw new TypeError("Point#multiply: expected number or bigint");let r=K(BigInt(e),Pe.n);if(r===1n)return this;let n=ve.ZERO,i=this;for(;r>0n;)r&1n&&(n=n.add(i)),i=i.double(),r>>=1n;return n}precomputeWindow(e){let r=256/e+1,n=[],i=this,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let o=1;o<2**(e-1);o++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,r){!r&&this.equals(ve.BASE)&&(r=Te.BASE);let n=r&&r._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=r&&D0.get(r);i||(i=this.precomputeWindow(n),r&&n!==1&&(i=ve.normalizeZ(i),D0.set(r,i)));let s=ve.ZERO,a=ve.ZERO,o=256/n+1,c=2**(n-1),f=BigInt(2**n-1),u=2**n,h=BigInt(n);for(let p=0;p<o;p++){let y=p*c,d=Number(e&f);if(e>>=h,d>c&&(d-=u,e+=1n),d===0)a=a.add(p%2?i[y].negate():i[y]);else{let g=i[y+Math.abs(d)-1];s=s.add(d<0?g.negate():g)}}return[s,a]}multiply(e,r){if(!Rd(e))throw new TypeError("Point#multiply: expected number or bigint");let n=K(BigInt(e),Pe.n);return ve.normalizeZ(this.wNAF(n,r))[0]}toAffine(e=U0(this.z)){let r=K(this.x*e),n=K(this.y*e);return new Te(r,n)}};Ie.ExtendedPoint=ve;ve.BASE=new ve(Pe.Gx,Pe.Gy,1n,K(Pe.Gx*Pe.Gy));ve.ZERO=new ve(0n,1n,1n,0n);var D0=new WeakMap,Te=class{constructor(e,r){this.x=e,this.y=r}_setWindowSize(e){this._WINDOW_SIZE=e,D0.delete(this)}static fromHex(e){let{d:r,P:n}=Pe,i=e instanceof Uint8Array?e:Li(e);if(i.length!==32)throw new Error("Point.fromHex: expected 32 bytes");let s=i[31],a=s&~128,o=(s&128)!=0,c=Uint8Array.from(Array.from(i.slice(0,31)).concat(a)),f=kn(c);if(f>=n)throw new Error("Point.fromHex expects hex <= Fp");let u=K(f*f),h=K(u-1n),p=K(r*u+1n),{isValid:y,value:d}=F0(h,p);if(!y)throw new Error("Point.fromHex: invalid y coordinate");let g=(d&1n)===1n;return o!==g&&(d=K(-d)),new Te(d,f)}static async fromPrivateKey(e){let r=await Ie.utils.sha512(Ud(e));return Te.BASE.multiply(Nd(r))}toRawBytes(){let e=M0(this.y),r=new Uint8Array(it);for(let i=e.length-2,s=0;s<it&&i>=0;i-=2,s++)r[s]=Number.parseInt(e[i]+e[i+1],16);let n=this.x&1n?128:0;return r[it-1]|=n,r}toHex(){return Dd(this.toRawBytes())}toX25519(){return K((1n+this.y)*U0(1n-this.y))}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new Te(K(-this.x),this.y)}add(e){return ve.fromAffine(this).add(ve.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return ve.fromAffine(this).multiply(e,this).toAffine()}};Ie.Point=Te;Te.BASE=new Te(Pe.Gx,Pe.Gy);Te.ZERO=new Te(0n,1n);var Lr=class{constructor(e,r){this.r=e,this.s=r}static fromHex(e){e=O0(e);let r=Te.fromHex(e.slice(0,32)),n=kn(e.slice(32));if(!h3(n))throw new Error("Signature.fromHex expects s <= CURVE.n");return new Lr(r,n)}toRawBytes(){let e=Li(M0(this.s)).reverse(),r=new Uint8Array(it);r.set(e);let n=new Uint8Array(it*2);return n.set(this.r.toRawBytes()),n.set(r,32),n}toHex(){return Dd(this.toRawBytes())}};Ie.Signature=Lr;Ie.SignResult=Lr;function l3(...t){if(t.length===1)return t[0];let e=t.reduce((n,i)=>n+i.length,0),r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}function Dd(t){let e="";for(let r=0;r<t.length;r++)e+=t[r].toString(16).padStart(2,"0");return e}function Li(t){if(typeof t!="string")throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let n=r*2;e[r]=Number.parseInt(t.slice(n,n+2),16)}return e}function M0(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Ld(t,e=it){let r=M0(t).padStart(e*2,"0");return Li(r).reverse()}function Kr(t){return(K(t)&1n)===1n}function Rd(t){return!!(typeof t=="bigint"&&t>0n||typeof t=="number"&&t>0&&Number.isSafeInteger(t))}function kn(t){let e=0n;for(let r=0;r<t.length;r++)e+=BigInt(t[r])<<8n*BigInt(r);return e}function N0(t){return K(kn(t)&2n**255n-1n)}function K(t,e=Pe.P){let r=t%e;return r>=0n?r:e+r}function U0(t,e=Pe.P){if(t===0n||e<=0n)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=K(t,e),n=e,[i,s,a,o]=[0n,1n,1n,0n];for(;r!==0n;){let f=n/r,u=n%r,h=i-a*f,p=s-o*f;[n,r]=[r,u],[i,s]=[a,o],[a,o]=[h,p]}if(n!==1n)throw new Error("invert: does not exist");return K(i,e)}function f3(t,e=Pe.P){let r=t.length,n=new Array(r),i=1n;for(let s=0;s<r;s++)t[s]!==0n&&(n[s]=i,i=K(i*t[s],e));i=U0(i,e);for(let s=r-1;s>=0;s--){if(t[s]===0n)continue;let a=K(i*t[s],e);t[s]=K(i*n[s],e),i=a}return t}function $t(t,e){let{P:r}=Pe,n=t;for(;e-- >0n;)n*=n,n%=r;return n}function p3(t){let{P:e}=Pe,n=t*t%e*t%e,i=$t(n,2n)*n%e,s=$t(i,1n)*t%e,a=$t(s,5n)*s%e,o=$t(a,10n)*a%e,c=$t(o,20n)*o%e,f=$t(c,40n)*c%e,u=$t(f,80n)*f%e,h=$t(u,80n)*f%e,p=$t(h,10n)*a%e;return $t(p,2n)*t%e}function F0(t,e){let r=K(e*e*e),n=K(r*r*e),i=K(t*r*p3(t*n)),s=K(e*i*i),a=i,o=K(i*Ki),c=s===t,f=s===K(-t),u=s===K(-t*Ki);return c&&(i=a),(f||u)&&(i=o),Kr(i)&&(i=K(-i)),{isValid:c||f,value:i}}function kd(t){return F0(1n,t)}async function q0(...t){let e=l3(...t),r=await Ie.utils.sha512(e),n=kn(r);return K(n,Pe.n)}function d3(t){return t.slice(it)}function Nd(t){let e=it-1,r=t.slice(0,it);return r[0]&=248,r[e]&=127,r[e]|=64,K(kn(r),Pe.n)}function u3(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function O0(t){return t instanceof Uint8Array?t:Li(t)}function h3(t){return 0<t&&t<Pe.n}function Ud(t){let e;if(typeof t=="bigint"||typeof t=="number"&&Number.isSafeInteger(t)){if(e=BigInt(t),e<0n||e>2n**256n)throw new Error("Expected 32 bytes of private key");t=e.toString(16).padStart(it*2,"0")}if(typeof t=="string"){if(t.length!==64)throw new Error("Expected 32 bytes of private key");return Li(t)}else if(t instanceof Uint8Array){if(t.length!==32)throw new Error("Expected 32 bytes of private key");return t}else throw new TypeError("Expected valid private key")}async function y3(t){let e=await Te.fromPrivateKey(t);return typeof t=="string"?e.toHex():e.toRawBytes()}Ie.getPublicKey=y3;async function g3(t,e){let r=await Ie.utils.sha512(Ud(e)),n=Nd(r),i=Te.BASE.multiply(n),s=O0(t),a=await q0(d3(r),s),o=Te.BASE.multiply(a),c=await q0(o.toRawBytes(),i.toRawBytes(),s),f=K(a+c*n,Pe.n),u=new Lr(o,f);return typeof t=="string"?u.toHex():u.toRawBytes()}Ie.sign=g3;async function x3(t,e,r){e=O0(e),r instanceof Te||(r=Te.fromHex(r)),t instanceof Lr||(t=Lr.fromHex(t));let n=await q0(t.r.toRawBytes(),r.toRawBytes(),e),i=ve.fromAffine(r).multiplyUnsafe(n),s=ve.BASE.multiply(t.s);return ve.fromAffine(t.r).add(i).subtract(s).multiplyUnsafe(8n).equals(ve.ZERO)}Ie.verify=x3;Te.BASE._setWindowSize(8);var Rr=(()=>{let t=typeof self=="object"&&"crypto"in self?self.crypto:void 0;return{node:typeof Kd!="undefined"&&!0&&!t?Gr():void 0,web:t}})();Ie.utils={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],randomBytes:(t=32)=>{if(Rr.web)return Rr.web.getRandomValues(new Uint8Array(t));if(Rr.node){let{randomBytes:e}=Rr.node;return new Uint8Array(e(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let t=1024;for(;t--;){let e=Ie.utils.randomBytes(32),r=kn(e);if(r>1n&&r<Pe.n)return e}throw new Error("Valid private key was not found in 1024 iterations. PRNG is broken")},sha512:async t=>{if(Rr.web){let e=await Rr.web.subtle.digest("SHA-512",t.buffer);return new Uint8Array(e)}else{if(Rr.node)return Uint8Array.from(Rr.node.createHash("sha512").update(t).digest());throw new Error("The environment doesn't have sha512 function")}},precompute(t=8,e=Te.BASE){let r=e.equals(Te.BASE)?e:new Te(e.x,e.y);return r._setWindowSize(t),r.multiply(1n),r}}});var Od=S(kr=>{l();"use strict";var Ri=Fd(),v3=32,b3=64,ha=32;kr.publicKeyLength=v3;kr.privateKeyLength=b3;kr.generateKey=async function(){let t=Ri.utils.randomPrivateKey(),e=await Ri.getPublicKey(t);return{privateKey:Md(t,e),publicKey:e}};kr.generateKeyFromSeed=async function(t){if(t.length!==ha)throw new TypeError('"seed" must be 32 bytes in length.');if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');let e=t,r=await Ri.getPublicKey(e);return{privateKey:Md(e,r),publicKey:r}};kr.hashAndSign=function(t,e){let r=t.slice(0,ha);return Ri.sign(e,r)};kr.hashAndVerify=function(t,e,r){return Ri.verify(e,r,t)};function Md(t,e){let r=new Uint8Array(kr.privateKeyLength);for(let n=0;n<ha;n++)r[n]=t[n],r[ha+n]=e[n];return r}});var Gd=S((f6,qd)=>{l();"use strict";var Hd=Vt(),{equals:Vd}=(nn(),Rn),{sha256:zd}=(Ai(),_i),{base58btc:m3}=(si(),bs),{identity:w3}=(k0(),R0),Je=Od(),la=Ks(),E3=oa(),pa=class{constructor(e){this._key=Dn(e,Je.publicKeyLength)}async verify(e,r){return Je.hashAndVerify(this._key,r,e)}marshal(){return this._key}get bytes(){return la.PublicKey.encode({Type:la.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return Vd(this.bytes,e.bytes)}async hash(){let{bytes:e}=await zd.digest(this.bytes);return e}},Nn=class{constructor(e,r){this._key=Dn(e,Je.privateKeyLength),this._publicKey=Dn(r,Je.publicKeyLength)}async sign(e){return Je.hashAndSign(this._key,e)}get public(){return new pa(this._publicKey)}marshal(){return this._key}get bytes(){return la.PrivateKey.encode({Type:la.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return Vd(this.bytes,e.bytes)}async hash(){let{bytes:e}=await zd.digest(this.bytes);return e}async id(){let e=await w3.digest(this.public.bytes);return m3.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return E3.export(this.bytes,e);throw Hd(new Error(`export format '${r}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}};function S3(t){if(t.length>Je.privateKeyLength){t=Dn(t,Je.privateKeyLength+Je.publicKeyLength);let n=t.slice(0,Je.privateKeyLength),i=t.slice(Je.privateKeyLength,t.length);return new Nn(n,i)}t=Dn(t,Je.privateKeyLength);let e=t.slice(0,Je.privateKeyLength),r=t.slice(Je.publicKeyLength);return new Nn(e,r)}function B3(t){return t=Dn(t,Je.publicKeyLength),new pa(t)}async function _3(){let{privateKey:t,publicKey:e}=await Je.generateKey();return new Nn(t,e)}async function A3(t){let{privateKey:e,publicKey:r}=await Je.generateKeyFromSeed(t);return new Nn(e,r)}function Dn(t,e){if(t=Uint8Array.from(t||[]),t.length!==e)throw Hd(new Error(`Key must be a Uint8Array of length ${e}, got ${t.length}`),"ERR_INVALID_KEY_TYPE");return t}qd.exports={Ed25519PublicKey:pa,Ed25519PrivateKey:Nn,unmarshalEd25519PrivateKey:S3,unmarshalEd25519PublicKey:B3,generateKeyPair:_3,generateKeyPairFromSeed:A3}});var ay=S((he,Wd)=>{l();"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.utils=he.schnorr=he.verify=he.signSync=he.sign=he.getSharedSecret=he.recoverPublicKey=he.getPublicKey=he.SignResult=he.Signature=he.Point=he.CURVE=void 0;var de={a:0n,b:7n,P:2n**256n-2n**32n-977n,n:2n**256n-432420386565659656852420866394968145599n,h:1n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n,beta:0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501een};he.CURVE=de;function jd(t){let{a:e,b:r}=de;return U(t**3n+e*t+r)}var da=de.a===0n,le=class{constructor(e,r,n){this.x=e,this.y=r,this.z=n}static fromAffine(e){if(!(e instanceof ye))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new le(e.x,e.y,1n)}static toAffineBatch(e){let r=C3(e.map(n=>n.z));return e.map((n,i)=>n.toAffine(r[i]))}static normalizeZ(e){return le.toAffineBatch(e).map(le.fromAffine)}equals(e){let r=this,n=e,i=U(r.z*r.z),s=U(r.z*i),a=U(n.z*n.z),o=U(n.z*a);return U(r.x*a)===U(i*n.x)&&U(r.y*o)===U(s*n.y)}negate(){return new le(this.x,U(-this.y),this.z)}double(){let e=this.x,r=this.y,n=this.z,i=U(e**2n),s=U(r**2n),a=U(s**2n),o=U(2n*(U(U((e+s)**2n))-i-a)),c=U(3n*i),f=U(c**2n),u=U(f-2n*o),h=U(c*(o-u)-8n*a),p=U(2n*r*n);return new le(u,h,p)}add(e){if(!(e instanceof le))throw new TypeError("JacobianPoint#add: expected JacobianPoint");let r=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z;if(s===0n||a===0n)return this;if(r===0n||n===0n)return e;let c=U(i**2n),f=U(o**2n),u=U(r*f),h=U(s*c),p=U(n*o*f),y=U(U(a*i)*c),d=U(h-u),g=U(y-p);if(d===0n)return g===0n?this.double():le.ZERO;let v=U(d**2n),b=U(d*v),w=U(u*v),E=U(g**2n-b-2n*w),T=U(g*(w-E)-p*b),A=U(i*o*d);return new le(E,T,A)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){if(!$d(e))throw new TypeError("Point#multiply: expected valid scalar");let r=U(BigInt(e),de.n);if(!da){let u=le.ZERO,h=this;for(;r>0n;)r&1n&&(u=u.add(h)),h=h.double(),r>>=1n;return u}let[n,i,s,a]=Xd(r),o=le.ZERO,c=le.ZERO,f=this;for(;i>0n||a>0n;)i&1n&&(o=o.add(f)),a&1n&&(c=c.add(f)),f=f.double(),i>>=1n,a>>=1n;return n&&(o=o.negate()),s&&(c=c.negate()),c=new le(U(c.x*de.beta),c.y,c.z),o.add(c)}precomputeWindow(e){let r=da?128/e+1:256/e+1,n=[],i=this,s=i;for(let a=0;a<r;a++){s=i,n.push(s);for(let o=1;o<2**(e-1);o++)s=s.add(i),n.push(s);i=s.double()}return n}wNAF(e,r){!r&&this.equals(le.BASE)&&(r=ye.BASE);let n=r&&r._WINDOW_SIZE||1;if(256%n)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let i=r&&H0.get(r);i||(i=this.precomputeWindow(n),r&&n!==1&&(i=le.normalizeZ(i),H0.set(r,i)));let s=le.ZERO,a=le.ZERO,o=da?128/n+1:256/n+1,c=2**(n-1),f=BigInt(2**n-1),u=2**n,h=BigInt(n);for(let p=0;p<o;p++){let y=p*c,d=Number(e&f);if(e>>=h,d>c&&(d-=u,e+=1n),d===0)a=a.add(p%2?i[y].negate():i[y]);else{let g=i[y+Math.abs(d)-1];s=s.add(d<0?g.negate():g)}}return[s,a]}multiply(e,r){if(!$d(e))throw new TypeError("Point#multiply: expected valid scalar");let n=U(BigInt(e),de.n),i,s;if(da){let[a,o,c,f]=Xd(n),u,h,p,y;[u,p]=this.wNAF(o,r),[h,y]=this.wNAF(f,r),a&&(u=u.negate()),c&&(h=h.negate()),h=new le(U(h.x*de.beta),h.y,h.z),[i,s]=[u.add(h),p.add(y)]}else[i,s]=this.wNAF(n,r);return le.normalizeZ([i,s])[0]}toAffine(e=ki(this.z)){let r=e**2n,n=U(this.x*r),i=U(this.y*r*e);return new ye(n,i)}};le.BASE=new le(de.Gx,de.Gy,1n);le.ZERO=new le(0n,1n,0n);var H0=new WeakMap,ye=class{constructor(e,r){this.x=e,this.y=r}_setWindowSize(e){this._WINDOW_SIZE=e,H0.delete(this)}static fromCompressedHex(e){let r=e.length===32,n=bt(r?e:e.slice(1)),i=jd(n),s=I3(i),a=(s&1n)===1n;r?a&&(s=U(-s)):(e[0]&1)==1!==a&&(s=U(-s));let o=new ye(n,s);return o.assertValidity(),o}static fromUncompressedHex(e){let r=bt(e.slice(1,33)),n=bt(e.slice(33)),i=new ye(r,n);return i.assertValidity(),i}static fromHex(e){let r=ya(e),n=r[0];if(r.length===32||r.length===33&&(n===2||n===3))return this.fromCompressedHex(r);if(r.length===65&&n===4)return this.fromUncompressedHex(r);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${r.length}`)}static fromPrivateKey(e){return ye.BASE.multiply(Un(e))}static fromSignature(e,r,n){let i=e instanceof Uint8Array?bt(e):ar(e),s=Yd(r),{r:a,s:o}=s;if(n!==0&&n!==1)throw new Error("Cannot recover signature: invalid yParity bit");let c=2+(n&1),f=ye.fromHex(`0${c}${Dr(a)}`),u=le.fromAffine(f).multiplyUnsafe(o),h=le.BASE.multiply(i),p=ki(a,de.n),d=u.subtract(h).multiplyUnsafe(p).toAffine();return d.assertValidity(),d}toRawBytes(e=!1){return Nr(this.toHex(e))}toHex(e=!1){let r=Dr(this.x);return e?`${this.y&1n?"03":"02"}${r}`:`04${r}${Dr(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){let e="Point is not on elliptic curve",{P:r}=de,{x:n,y:i}=this;if(n===0n||i===0n||n>=r||i>=r)throw new Error(e);let s=U(i*i),a=jd(n);if((s-a)%r!==0n)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new ye(this.x,U(-this.y))}double(){return le.fromAffine(this).double().toAffine()}add(e){return le.fromAffine(this).add(le.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return le.fromAffine(this).multiply(e,this).toAffine()}};he.Point=ye;ye.BASE=new ye(de.Gx,de.Gy);ye.ZERO=new ye(0n,0n);function Zd(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}var or=class{constructor(e,r){this.r=e,this.s=r}static fromCompact(e){if(typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError("Signature.fromCompact: Expected string or Uint8Array");let r=e instanceof Uint8Array?ga(e):e;if(r.length!==128)throw new Error("Signature.fromCompact: Expected 64-byte hex");let n=new or(ar(r.slice(0,64)),ar(r.slice(64,128)));return n.assertValidity(),n}static fromDER(e){let r="Signature.fromDER";if(typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError(`${r}: Expected string or Uint8Array`);let n=e instanceof Uint8Array?ga(e):e,i=Ni(n.slice(2,4));if(n.slice(0,2)!=="30"||i!==n.length-4||n.slice(4,6)!=="02")throw new Error(`${r}: Invalid signature ${n}`);let s=Ni(n.slice(6,8)),a=8+s,o=n.slice(8,a);if(o.startsWith("00")&&Ni(o.slice(2,4))<=127)throw new Error(`${r}: Invalid r with trailing length`);let c=ar(o);if(n.slice(a,a+2)!=="02")throw new Error(`${r}: Invalid r-s separator`);let u=Ni(n.slice(a+2,a+4)),h=i-u-s-10;if(h>0||h===-4)throw new Error(`${r}: Invalid total length`);if(u>i-s-4)throw new Error(`${r}: Invalid s`);let p=a+4,y=n.slice(p,p+u);if(y.startsWith("00")&&Ni(y.slice(2,4))<=127)throw new Error(`${r}: Invalid s with trailing length`);let d=ar(y),g=new or(c,d);return g.assertValidity(),g}static fromHex(e){return this.fromDER(e)}assertValidity(){let{r:e,s:r}=this;if(!Ui(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ui(r))throw new Error("Invalid Signature: s must be 0 < s < n")}toDERRawBytes(e=!1){return Nr(this.toDERHex(e))}toDERHex(e=!1){let r=Zd(Di(this.s));if(e)return r;let n=Zd(Di(this.r)),i=Di(n.length/2),s=Di(r.length/2);return`30${Di(n.length/2+r.length/2+4)}02${i}${n}02${s}${r}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return Nr(this.toCompactHex())}toCompactHex(){return Dr(this.r)+Dr(this.s)}};he.Signature=or;he.SignResult=or;function Qd(...t){if(t.length===1)return t[0];let e=t.reduce((n,i)=>n+i.length,0),r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let s=t[n];r.set(s,i),i+=s.length}return r}function ga(t){let e="";for(let r=0;r<t.length;r++)e+=t[r].toString(16).padStart(2,"0");return e}function Dr(t){return t.toString(16).padStart(64,"0")}function xa(t){return Nr(Dr(t))}function Di(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function ar(t){if(typeof t!="string")throw new TypeError("hexToNumber: expected string, got "+typeof t);return BigInt(`0x${t}`)}function Nr(t){if(typeof t!="string")throw new TypeError("hexToBytes: expected string, got "+typeof t);if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex");let e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){let n=r*2;e[r]=Number.parseInt(t.slice(n,n+2),16)}return e}function ya(t){return t instanceof Uint8Array?t:Nr(t)}function bt(t){return ar(ga(t))}function Ni(t){return Number.parseInt(t,16)*2}function $d(t){return!!(typeof t=="bigint"&&t>0n||typeof t=="number"&&t>0&&Number.isSafeInteger(t))}function U(t,e=de.P){let r=t%e;return r>=0?r:e+r}function mt(t,e){let{P:r}=de,n=t;for(;e-- >0n;)n*=n,n%=r;return n}function I3(t){let{P:e}=de,r=t*t*t%e,n=r*r*t%e,i=mt(n,3n)*n%e,s=mt(i,3n)*n%e,a=mt(s,2n)*r%e,o=mt(a,11n)*a%e,c=mt(o,22n)*o%e,f=mt(c,44n)*c%e,u=mt(f,88n)*f%e,h=mt(u,44n)*c%e,p=mt(h,3n)*n%e,y=mt(p,23n)*o%e,d=mt(y,6n)*r%e;return mt(d,2n)}function ki(t,e=de.P){if(t===0n||e<=0n)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=U(t,e),n=e,[i,s,a,o]=[0n,1n,1n,0n];for(;r!==0n;){let f=n/r,u=n%r,h=i-a*f,p=s-o*f;[n,r]=[r,u],[i,s]=[a,o],[a,o]=[h,p]}if(n!==1n)throw new Error("invert: does not exist");return U(i,e)}function C3(t,e=de.P){let r=t.length,n=new Array(r),i=1n;for(let s=0;s<r;s++)t[s]!==0n&&(n[s]=i,i=U(i*t[s],e));i=ki(i,e);for(let s=r-1;s>=0;s--){if(t[s]===0n)continue;let a=U(i*t[s],e);t[s]=U(i*n[s],e),i=a}return t}var Jd=(t,e)=>(t+e/2n)/e,va=2n**128n;function Xd(t){let{n:e}=de,r=0x3086d221a7d46bcde86c90e49284eb15n,n=-0xe4437ed6010e88286f547fa90abfe4c3n,i=0x114ca50f7a8e2f3f657c1108d9d44cfd8n,s=r,a=Jd(s*t,e),o=Jd(-n*t,e),c=U(t-a*r-o*i,e),f=U(-a*n-o*s,e),u=c>va,h=f>va;if(u&&(c=e-c),h&&(f=e-f),c>va||f>va)throw new Error("splitScalarEndo: Endomorphism failed");return[u,c,h,f]}function T3(t){typeof t!="string"&&(t=ga(t));let e=ar(t||"0"),n=t.length/2*8-256;return n>0&&(e=e>>BigInt(n)),e>=de.n&&(e-=de.n),e}function ey(t,e){if(t==null)throw new Error(`sign: expected valid msgHash, not "${t}"`);let r=typeof t=="string"?ar(t):bt(t),n=xa(r),i=bt(n),s=xa(e),a=new Uint8Array(32).fill(1),o=new Uint8Array(32).fill(0),c=Uint8Array.from([0]),f=Uint8Array.from([1]);return[n,i,s,a,o,c,f]}async function P3(t,e){let r=Un(e),[n,i,s,a,o,c,f]=ey(t,r),u=he.utils.hmacSha256;o=await u(o,a,c,s,n),a=await u(o,a),o=await u(o,a,f,s,n),a=await u(o,a);for(let h=0;h<1e3;h++){a=await u(o,a);let p=ty(a,i,r);if(p)return p;o=await u(o,a,c),a=await u(o,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}function K3(t,e){let r=Un(e),[n,i,s,a,o,c,f]=ey(t,r),u=he.utils.hmacSha256Sync;if(!u)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");if(o=u(o,a,c,s,n),o instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");a=u(o,a),o=u(o,a,f,s,n),a=u(o,a);for(let h=0;h<1e3;h++){a=u(o,a);let p=ty(a,i,r);if(p)return p;o=u(o,a,c),a=u(o,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}function Ui(t){return 0<t&&t<de.n}function ty(t,e,r){let n=bt(t);if(!Ui(n))return;let i=de.n,s=ye.BASE.multiply(n),a=U(s.x,i),o=U(ki(n,i)*(e+a*r),i);if(!(a===0n||o===0n))return[s,a,o]}function Un(t){let e;if(typeof t=="bigint")e=t;else if(typeof t=="number"&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if(typeof t=="string"){if(t.length!==64)throw new Error("Expected 32 bytes of private key");e=ar(t)}else if(t instanceof Uint8Array){if(t.length!==32)throw new Error("Expected 32 bytes of private key");e=bt(t)}else throw new TypeError("Expected valid private key");if(!Ui(e))throw new Error("Expected private key: 0 < key < n");return e}function V0(t){return t instanceof ye?(t.assertValidity(),t):ye.fromHex(t)}function Yd(t){return t instanceof or?(t.assertValidity(),t):or.fromDER(t)}function L3(t,e=!1){let r=ye.fromPrivateKey(t);return typeof t=="string"?r.toHex(e):r.toRawBytes(e)}he.getPublicKey=L3;function R3(t,e,r){let n=ye.fromSignature(t,e,r);return typeof t=="string"?n.toHex():n.toRawBytes()}he.recoverPublicKey=R3;function ry(t){let e=t instanceof Uint8Array,r=typeof t=="string",n=(e||r)&&t.length;return e?n===33||n===65:r?n===66||n===130:t instanceof ye}function k3(t,e,r=!1){if(ry(t))throw new TypeError("getSharedSecret: first arg must be private key");if(!ry(e))throw new TypeError("getSharedSecret: second arg must be public key");let n=V0(e);n.assertValidity();let i=n.multiply(Un(t));return typeof t=="string"?i.toHex(r):i.toRawBytes(r)}he.getSharedSecret=k3;function ny(t,e,r=!1){let[n,i,s]=t,{canonical:a,der:o,recovered:c}=e,f=(n.x===i?0:2)|Number(n.y&1n),u=s,h=de.n>>1n;s>h&&a&&(u=de.n-s,f^=1);let p=new or(i,u);p.assertValidity();let y=o===!1?p.toCompactHex():p.toDERHex(),d=r?y:Nr(y);return c?[d,f]:d}async function D3(t,e,r={}){return ny(await P3(t,e),r,typeof t=="string")}he.sign=D3;function N3(t,e,r={}){return ny(K3(t,e),r,typeof t=="string")}he.signSync=N3;function U3(t,e,r){let{n}=de,i;try{i=Yd(t)}catch(v){return!1}let{r:s,s:a}=i,o=T3(e);if(o===0n)return!1;let c=le.fromAffine(V0(r)),f=ki(a,n),u=U(o*f,n),h=U(s*f,n),p=le.BASE.multiply(u),y=c.multiplyUnsafe(h),d=p.add(y).toAffine();return U(d.x,n)===s}he.verify=U3;async function z0(t,...e){let r=new Uint8Array(t.split("").map(s=>s.charCodeAt(0))),n=await he.utils.sha256(r),i=await he.utils.sha256(Qd(n,n,...e));return bt(i)}async function iy(t,e,r){let n=xa(t),i=await z0("BIP0340/challenge",n,e.toRawX(),r);return U(i,de.n)}function G0(t){return U(t.y,2n)===0n}var an=class{constructor(e,r){if(this.r=e,this.s=r,e<=0n||r<=0n||e>=de.P||r>=de.n)throw new Error("Invalid signature")}static fromHex(e){let r=ya(e);if(r.length!==64)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${r.length}`);let n=bt(r.slice(0,32)),i=bt(r.slice(32));return new an(n,i)}toHex(){return Dr(this.r)+Dr(this.s)}toRawBytes(){return Nr(this.toHex())}};function F3(t){let e=ye.fromPrivateKey(t);return typeof t=="string"?e.toHexX():e.toRawX()}async function M3(t,e,r=he.utils.randomBytes()){if(t==null)throw new TypeError(`sign: Expected valid message, not "${t}"`);e||(e=0n);let{n}=de,i=ya(t),s=Un(e),a=ya(r);if(a.length!==32)throw new TypeError("sign: Expected 32 bytes of aux randomness");let o=ye.fromPrivateKey(s),c=G0(o)?s:n-s,f=await z0("BIP0340/aux",a),u=c^f,h=await z0("BIP0340/nonce",xa(u),o.toRawX(),i),p=U(h,n);if(p===0n)throw new Error("sign: Creation of signature failed. k is zero");let y=ye.fromPrivateKey(p),d=G0(y)?p:n-p,g=await iy(y.x,o,i),v=new an(y.x,U(d+g*c,n));if(!await sy(v.toRawBytes(),i,o.toRawX()))throw new Error("sign: Invalid signature produced");return typeof t=="string"?v.toHex():v.toRawBytes()}async function sy(t,e,r){let n=t instanceof an?t:an.fromHex(t),i=typeof e=="string"?Nr(e):e,s=V0(r),a=await iy(n.r,s,i),o=ye.fromPrivateKey(n.s),c=s.multiply(a),f=o.subtract(c);return!(f.equals(ye.BASE)||!G0(f)||f.x!==n.r)}he.schnorr={Signature:an,getPublicKey:F3,sign:M3,verify:sy};ye.BASE._setWindowSize(8);var ht=(()=>{let t=typeof self=="object"&&"crypto"in self?self.crypto:void 0;return{node:typeof Wd!="undefined"&&!0&&!t?Gr():void 0,web:t}})();he.utils={isValidPrivateKey(t){try{return Un(t),!0}catch(e){return!1}},randomBytes:(t=32)=>{if(ht.web)return ht.web.getRandomValues(new Uint8Array(t));if(ht.node){let{randomBytes:e}=ht.node;return new Uint8Array(e(t).buffer)}else throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let t=8;for(;t--;){let e=he.utils.randomBytes(32),r=bt(e);if(Ui(r)&&r!==1n)return e}throw new Error("Valid private key was not found in 8 iterations. PRNG is broken")},sha256:async t=>{if(ht.web){let e=await ht.web.subtle.digest("SHA-256",t.buffer);return new Uint8Array(e)}else if(ht.node){let{createHash:e}=ht.node;return Uint8Array.from(e("sha256").update(t).digest())}else throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(t,...e)=>{if(ht.web){let r=await ht.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=Qd(...e),i=await ht.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}else if(ht.node){let{createHmac:r}=ht.node,n=r("sha256",t);for(let i of e)n.update(i);return Uint8Array.from(n.digest())}else throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(t=8,e=ye.BASE){let r=e===ye.BASE?e:new ye(e.x,e.y);return r._setWindowSize(t),r.multiply(3n),r}}});var fy=S((u6,oy)=>{l();"use strict";var Fi=Vt(),Ur=ay(),{sha256:cy}=(Ai(),_i);oy.exports=()=>{let t=32;function e(){return Ur.utils.randomPrivateKey()}async function r(f,u){let{digest:h}=await cy.digest(u);try{return await Ur.sign(h,f)}catch(p){throw Fi(p,"ERR_INVALID_INPUT")}}async function n(f,u,h){try{let{digest:p}=await cy.digest(h);return Ur.verify(u,p,f)}catch(p){throw Fi(p,"ERR_INVALID_INPUT")}}function i(f){return Ur.Point.fromHex(f).toRawBytes(!0)}function s(f){return Ur.Point.fromHex(f).toRawBytes(!1)}function a(f){try{Ur.getPublicKey(f,!0)}catch(u){throw Fi(u,"ERR_INVALID_PRIVATE_KEY")}}function o(f){try{Ur.Point.fromHex(f)}catch(u){throw Fi(u,"ERR_INVALID_PUBLIC_KEY")}}function c(f){try{return Ur.getPublicKey(f,!0)}catch(u){throw Fi(u,"ERR_INVALID_PRIVATE_KEY")}}return{generateKey:e,privateKeyLength:t,hashAndSign:r,hashAndVerify:n,compressPublicKey:i,decompressPublicKey:s,validatePrivateKey:a,validatePublicKey:o,computePublicKey:c}}});var py=S((h6,uy)=>{l();"use strict";var{sha256:hy}=(Ai(),_i),O3=Vt(),{equals:ly}=(nn(),Rn),{toString:q3}=(Tr(),Ir),H3=oa();uy.exports=(t,e,r)=>{r=r||fy()();class n{constructor(f){r.validatePublicKey(f),this._key=f}verify(f,u){return r.hashAndVerify(this._key,u,f)}marshal(){return r.compressPublicKey(this._key)}get bytes(){return t.PublicKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(f){return ly(this.bytes,f.bytes)}async hash(){let{bytes:f}=await hy.digest(this.bytes);return f}}class i{constructor(f,u){this._key=f,this._publicKey=u||r.computePublicKey(f),r.validatePrivateKey(this._key),r.validatePublicKey(this._publicKey)}sign(f){return r.hashAndSign(this._key,f)}get public(){return new n(this._publicKey)}marshal(){return this._key}get bytes(){return t.PrivateKey.encode({Type:t.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(f){return ly(this.bytes,f.bytes)}async hash(){let{bytes:f}=await hy.digest(this.bytes);return f}async id(){let f=await this.public.hash();return q3(f,"base58btc")}async export(f,u="libp2p-key"){if(u==="libp2p-key")return H3.export(this.bytes,f);throw O3(new Error(`export format '${u}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function s(c){return new i(c)}function a(c){return new n(c)}async function o(){let c=await r.generateKey();return new i(c)}return{Secp256k1PublicKey:n,Secp256k1PrivateKey:i,unmarshalSecp256k1PrivateKey:s,unmarshalSecp256k1PublicKey:a,generateKeyPair:o}}});var yy=S((l6,dy)=>{l();"use strict";dy.exports={SHA1:20,SHA256:32,SHA512:64}});var vy=S(gy=>{l();"use strict";var xy=Si(),V3=yy(),z3={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},G3=async(t,e)=>{let r=await xy.get().subtle.sign({name:"HMAC"},t,e);return new Uint8Array(r,r.byteOffset,r.byteLength)};gy.create=async function(t,e){let r=z3[t],n=await xy.get().subtle.importKey("raw",e,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{async digest(i){return G3(n,i)},length:V3[t]}}});var Sy=S((d6,by)=>{l();"use strict";var my=Vt(),{concat:wy}=(Ei(),wi),{fromString:W3}=(Cr(),Ar),j3=vy(),Ey={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};by.exports=async(t,e,r)=>{let n=Ey[t];if(!n){let w=Object.keys(Ey).join(" / ");throw my(new Error(`unknown cipher type '${t}'. Must be ${w}`),"ERR_INVALID_CIPHER_TYPE")}if(!e)throw my(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");let i=n.keySize,s=n.ivSize,a=20,o=W3("key expansion"),c=2*(s+i+a),f=await j3.create(e,r),u=await f.digest(o),h=[],p=0;for(;p<c;){let w=await f.digest(wy([u,o])),E=w.length;p+E>c&&(E=c-p),h.push(w),p+=E,u=await f.digest(u)}let y=c/2,d=wy(h),g=d.slice(0,y),v=d.slice(y,c),b=w=>({iv:w.slice(0,s),cipherKey:w.slice(s,s+i),macKey:w.slice(s+i)});return{k1:b(g),k2:b(v)}}});var _y=S((y6,By)=>{l();"use strict";var $3=Vt();By.exports=function(t,e){if(!t.includes(e)){let r=t.join(" / ");throw $3(new Error(`Unknown curve: ${e}. Must be ${r}`),"ERR_INVALID_CURVE")}}});var Ky=S(Ay=>{l();"use strict";var X3=Vt(),Mi=Si(),{base64urlToBuffer:Cy}=aa(),Y3=_y(),{toString:W0}=(Tr(),Ir),{concat:Z3}=(Ei(),wi),{equals:Q3}=(nn(),Rn),Iy={"P-256":256,"P-384":384,"P-521":521};Ay.generateEphmeralKeyPair=async function(t){Y3(Object.keys(Iy),t);let e=await Mi.get().subtle.generateKey({name:"ECDH",namedCurve:t},!0,["deriveBits"]),r=async(i,s)=>{let a;s?a=await Mi.get().subtle.importKey("jwk",e8(t,s),{name:"ECDH",namedCurve:t},!1,["deriveBits"]):a=e.privateKey;let o=[await Mi.get().subtle.importKey("jwk",Ty(t,i),{name:"ECDH",namedCurve:t},!1,[]),a],c=await Mi.get().subtle.deriveBits({name:"ECDH",namedCurve:t,public:o[0]},o[1],Iy[t]);return new Uint8Array(c,c.byteOffset,c.byteLength)},n=await Mi.get().subtle.exportKey("jwk",e.publicKey);return{key:J3(n),genSharedKey:r}};var Py={"P-256":32,"P-384":48,"P-521":66};function J3(t){let e=Py[t.crv];return Z3([Uint8Array.from([4]),Cy(t.x,e),Cy(t.y,e)],1+e*2)}function Ty(t,e){let r=Py[t];if(Q3(!e.slice(0,1),Uint8Array.from([4])))throw X3(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:t,x:W0(e.slice(1,r+1),"base64url"),y:W0(e.slice(1+r),"base64url"),ext:!0}}var e8=(t,e)=>({...Ty(t,e.public),d:W0(e.private,"base64url")})});var Ry=S((x6,Ly)=>{l();"use strict";var t8=Ky();Ly.exports=async t=>t8.generateEphmeralKeyPair(t)});var Ny=S((v6,ky)=>{l();"use strict";var Xt=Ks();pi();hp();var j0=xe(),Oi=Vt(),{fromString:r8}=(Cr(),Ar),n8=rd(),wt={rsa:Pd(),ed25519:Gd(),secp256k1:py()(Xt,L0())},ba={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function Fn(t){let e=wt[t.toLowerCase()];if(!e){let r=Object.keys(wt).join(" / ");throw Oi(new Error(`invalid or unsupported key type ${t}. Must be ${r}`),"ERR_UNSUPPORTED_KEY_TYPE")}return e}var i8=async(t,e)=>Fn(t).generateKeyPair(e),s8=async(t,e,r)=>{let n=Fn(t);if(t.toLowerCase()!=="ed25519")throw Oi(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(e,r)},a8=t=>{let e=Xt.PublicKey.decode(t),r=e.Data;switch(e.Type){case Xt.KeyType.RSA:return wt.rsa.unmarshalRsaPublicKey(r);case Xt.KeyType.Ed25519:return wt.ed25519.unmarshalEd25519PublicKey(r);case Xt.KeyType.Secp256k1:if(wt.secp256k1)return wt.secp256k1.unmarshalSecp256k1PublicKey(r);throw Oi(new Error(ba.message),ba.code);default:Fn(e.Type)}},o8=(t,e)=>(e=(e||"rsa").toLowerCase(),Fn(e),t.bytes),Dy=async t=>{let e=Xt.PrivateKey.decode(t),r=e.Data;switch(e.Type){case Xt.KeyType.RSA:return wt.rsa.unmarshalRsaPrivateKey(r);case Xt.KeyType.Ed25519:return wt.ed25519.unmarshalEd25519PrivateKey(r);case Xt.KeyType.Secp256k1:if(wt.secp256k1)return wt.secp256k1.unmarshalSecp256k1PrivateKey(r);throw Oi(new Error(ba.message),ba.code);default:Fn(e.Type)}},c8=(t,e)=>(e=(e||"rsa").toLowerCase(),Fn(e),t.bytes),f8=async(t,e)=>{try{let i=await n8.import(t,e);return Dy(i)}catch(i){}let r=j0.pki.decryptRsaPrivateKey(t,e);if(r===null)throw Oi(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=j0.asn1.toDer(j0.pki.privateKeyToAsn1(r));return n=r8(n.getBytes(),"ascii"),wt.rsa.unmarshalRsaPrivateKey(n)};ky.exports={supportedKeys:wt,keysPBM:Xt,keyStretcher:Sy(),generateEphemeralKeyPair:Ry(),generateKeyPair:i8,generateKeyPairFromSeed:s8,unmarshalPublicKey:a8,marshalPublicKey:o8,unmarshalPrivateKey:Dy,marshalPrivateKey:c8,import:f8}});var Uy=S((b6,$0)=>{l();"use strict";function u8(t,{className:e,symbolName:r}){let n=Symbol.for(r),i={[e]:class extends t{constructor(...s){super(...s);Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return e}}}[e];return i[`is${e}`]=s=>!!(s&&s[n]),i}function h8(t,{className:e,symbolName:r,withoutNew:n}){let i=Symbol.for(r),s={[e]:function(...a){if(n&&!(this instanceof s))return new s(...a);let o=t.call(this,...a)||this;return o&&!o[i]&&Object.defineProperty(o,i,{value:!0}),o}}[e];return s.prototype=Object.create(t.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get(){return e}}),s[`is${e}`]=a=>!!(a&&a[i]),s}$0.exports=u8;$0.exports.proto=h8});var Oy=S((m6,Fy)=>{l();"use strict";var Mn=Ts(),My=Mn.Reader,l8=Mn.Writer,ke=Mn.util,qi=Mn.roots["libp2p-peer-id"]||(Mn.roots["libp2p-peer-id"]={});qi.PeerIdProto=function(){function t(e){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)e[r[n]]!=null&&(this[r[n]]=e[r[n]])}return t.prototype.id=ke.newBuffer([]),t.prototype.pubKey=ke.newBuffer([]),t.prototype.privKey=ke.newBuffer([]),t.encode=function(r,n){return n||(n=l8.create()),n.uint32(10).bytes(r.id),r.pubKey!=null&&Object.hasOwnProperty.call(r,"pubKey")&&n.uint32(18).bytes(r.pubKey),r.privKey!=null&&Object.hasOwnProperty.call(r,"privKey")&&n.uint32(26).bytes(r.privKey),n},t.decode=function(r,n){r instanceof My||(r=My.create(r));for(var i=n===void 0?r.len:r.pos+n,s=new qi.PeerIdProto;r.pos<i;){var a=r.uint32();switch(a>>>3){case 1:s.id=r.bytes();break;case 2:s.pubKey=r.bytes();break;case 3:s.privKey=r.bytes();break;default:r.skipType(a&7);break}}if(!s.hasOwnProperty("id"))throw ke.ProtocolError("missing required 'id'",{instance:s});return s},t.fromObject=function(r){if(r instanceof qi.PeerIdProto)return r;var n=new qi.PeerIdProto;return r.id!=null&&(typeof r.id=="string"?ke.base64.decode(r.id,n.id=ke.newBuffer(ke.base64.length(r.id)),0):r.id.length&&(n.id=r.id)),r.pubKey!=null&&(typeof r.pubKey=="string"?ke.base64.decode(r.pubKey,n.pubKey=ke.newBuffer(ke.base64.length(r.pubKey)),0):r.pubKey.length&&(n.pubKey=r.pubKey)),r.privKey!=null&&(typeof r.privKey=="string"?ke.base64.decode(r.privKey,n.privKey=ke.newBuffer(ke.base64.length(r.privKey)),0):r.privKey.length&&(n.privKey=r.privKey)),n},t.toObject=function(r,n){n||(n={});var i={};return n.defaults&&(n.bytes===String?i.id="":(i.id=[],n.bytes!==Array&&(i.id=ke.newBuffer(i.id))),n.bytes===String?i.pubKey="":(i.pubKey=[],n.bytes!==Array&&(i.pubKey=ke.newBuffer(i.pubKey))),n.bytes===String?i.privKey="":(i.privKey=[],n.bytes!==Array&&(i.privKey=ke.newBuffer(i.privKey)))),r.id!=null&&r.hasOwnProperty("id")&&(i.id=n.bytes===String?ke.base64.encode(r.id,0,r.id.length):n.bytes===Array?Array.prototype.slice.call(r.id):r.id),r.pubKey!=null&&r.hasOwnProperty("pubKey")&&(i.pubKey=n.bytes===String?ke.base64.encode(r.pubKey,0,r.pubKey.length):n.bytes===Array?Array.prototype.slice.call(r.pubKey):r.pubKey),r.privKey!=null&&r.hasOwnProperty("privKey")&&(i.privKey=n.bytes===String?ke.base64.encode(r.privKey,0,r.privKey.length):n.bytes===Array?Array.prototype.slice.call(r.privKey):r.privKey),i},t.prototype.toJSON=function(){return this.constructor.toObject(this,Mn.util.toJSONOptions)},t}();Fy.exports=qi});var Xy=S((et,qy)=>{l();"use strict";var{CID:X0}=(ju(),zu),p8=(ms(),Io),d8=(Xu(),$u),y8=(si(),bs),g8=(Bs(),Ss),{base58btc:Y0}=(si(),bs),{base32:x8}=(ms(),Io),{base16:Hy}=(Zu(),Yu),Hi=(xs(),Uu),Yt=Ny(),v8=Uy(),{PeerIdProto:Vy}=Oy(),{equals:on}=(nn(),Rn),{fromString:Vi}=(Cr(),Ar),{toString:b8}=(Tr(),Ir),{identity:ma}=(k0(),R0),zy={...p8,...d8,...y8,...g8},m8=Object.keys(zy).reduce((t,e)=>t.or(zy[e]),x8.decoder),w8=112,Gy=114,Wy=class{constructor(e,r,n){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(r&&n&&!on(r.public.bytes,n.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=Y0.encode(this.id).substring(1),this._privKey=r,this._pubKey=n}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{let e=Hi.decode(this.id);e.code===ma.code&&(this._pubKey=Yt.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return Yt.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return Yt.marshalPrivateKey(this.privKey)}marshal(e){return Vy.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let r=6;return e.length<r&&(r=e.length),"<peer.ID "+e.substr(0,r)+">"}toJSON(){return{id:this.toB58String(),privKey:jy(this.marshalPrivKey()),pubKey:jy(this.marshalPubKey())}}toHexString(){return Hy.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){let e=X0.createV1(Gy,Hi.decode(this.id));Object.defineProperty(this,"_idCIDString",{value:e.toString(),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return on(this.id,e);if(e.id)return on(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&on(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(Hi.decode(this.id).code===ma.code)return!0}catch(e){}return!1}},Zt=v8(Wy,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});et=qy.exports=Zt;var zi=t=>t.bytes.length<=42?Hi.create(ma.code,t.bytes).bytes:t.hash(),Z0=async(t,e)=>{let r=await zi(e);return new Zt(r,t,e)};et.create=async t=>{t=t||{},t.bits=t.bits||2048,t.keyType=t.keyType||"RSA";let e=await Yt.generateKeyPair(t.keyType,t.bits);return Z0(e,e.public)};et.createFromHexString=t=>new Zt(Hy.decode("f"+t));et.createFromBytes=t=>{try{let e=X0.decode(t);if(!$y(e))throw new Error("Supplied PeerID CID is invalid");return et.createFromCID(e)}catch{if(Hi.decode(t).code!==ma.code)throw new Error("Supplied PeerID CID is invalid");return new Zt(t)}};et.createFromB58String=t=>et.createFromBytes(Y0.decode("z"+t));var $y=t=>t.code===Gy||t.code===w8;et.createFromCID=t=>{if(t=X0.asCID(t),!t||!$y(t))throw new Error("Supplied PeerID CID is invalid");return new Zt(t.multihash.bytes)};et.createFromPubKey=async t=>{let e=t;if(typeof e=="string"&&(e=Vi(t,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let r=await Yt.unmarshalPublicKey(e);return Z0(void 0,r)};et.createFromPrivKey=async t=>{if(typeof t=="string"&&(t=Vi(t,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");let e=await Yt.unmarshalPrivateKey(t);return Z0(e,e.public)};et.createFromJSON=async t=>{let e=Y0.decode("z"+t.id),r=t.privKey&&Vi(t.privKey,"base64pad"),n=t.pubKey&&Vi(t.pubKey,"base64pad"),i=n&&await Yt.unmarshalPublicKey(n);if(!r)return new Zt(e,void 0,i);let s=await Yt.unmarshalPrivateKey(r),a=await zi(s.public),o;if(i&&(o=await zi(i)),i&&!on(a,o))throw new Error("Public and private key do not match");if(e&&!on(a,e))throw new Error("Id and private key do not match");return new Zt(e,s,i)};et.createFromProtobuf=async t=>{typeof t=="string"&&(t=Vi(t,"base16"));let{id:e,privKey:r,pubKey:n}=Vy.decode(t);r=r?await Yt.unmarshalPrivateKey(r):!1,n=n?await Yt.unmarshalPublicKey(n):!1;let i,s;if(r&&(s=await zi(r.public)),n&&(i=await zi(n)),r){if(n&&!on(s,i))throw new Error("Public and private key do not match");return new Zt(s,r,r.public)}if(n)return new Zt(i,void 0,n);if(e)return new Zt(e);throw new Error("Protobuf did not contain any usable key material")};et.parse=t=>((t.charAt(0)==="1"||t.charAt(0)==="Q")&&(t=`z${t}`),et.createFromBytes(m8.decode(t)));et.isPeerId=t=>Boolean(typeof t=="object"&&t._id&&t._idB58String);function jy(t){if(t)return b8(t,"base64pad")}});var Zy=S((Yy,Gi)=>{l();(function(t,e){typeof define=="function"&&define.amd?define(["protobufjs/minimal"],e):typeof Gi=="object"&&Gi&&Gi.exports&&(Gi.exports=e(Ts()))})(Yy,function(t){"use strict";var e=t.Reader,r=t.Writer,n=t.util,i=t.roots["libp2p-noise"]||(t.roots["libp2p-noise"]={});return i.pb=function(){var s={};return s.NoiseHandshakePayload=function(){function a(o){if(o)for(var c=Object.keys(o),f=0;f<c.length;++f)o[c[f]]!=null&&(this[c[f]]=o[c[f]])}return a.prototype.identityKey=n.newBuffer([]),a.prototype.identitySig=n.newBuffer([]),a.prototype.data=n.newBuffer([]),a.create=function(c){return new a(c)},a.encode=function(c,f){return f||(f=r.create()),c.identityKey!=null&&Object.hasOwnProperty.call(c,"identityKey")&&f.uint32(10).bytes(c.identityKey),c.identitySig!=null&&Object.hasOwnProperty.call(c,"identitySig")&&f.uint32(18).bytes(c.identitySig),c.data!=null&&Object.hasOwnProperty.call(c,"data")&&f.uint32(26).bytes(c.data),f},a.encodeDelimited=function(c,f){return this.encode(c,f).ldelim()},a.decode=function(c,f){c instanceof e||(c=e.create(c));for(var u=f===void 0?c.len:c.pos+f,h=new i.pb.NoiseHandshakePayload;c.pos<u;){var p=c.uint32();switch(p>>>3){case 1:h.identityKey=c.bytes();break;case 2:h.identitySig=c.bytes();break;case 3:h.data=c.bytes();break;default:c.skipType(p&7);break}}return h},a.decodeDelimited=function(c){return c instanceof e||(c=new e(c)),this.decode(c,c.uint32())},a.verify=function(c){return typeof c!="object"||c===null?"object expected":c.identityKey!=null&&c.hasOwnProperty("identityKey")&&!(c.identityKey&&typeof c.identityKey.length=="number"||n.isString(c.identityKey))?"identityKey: buffer expected":c.identitySig!=null&&c.hasOwnProperty("identitySig")&&!(c.identitySig&&typeof c.identitySig.length=="number"||n.isString(c.identitySig))?"identitySig: buffer expected":c.data!=null&&c.hasOwnProperty("data")&&!(c.data&&typeof c.data.length=="number"||n.isString(c.data))?"data: buffer expected":null},a.fromObject=function(c){if(c instanceof i.pb.NoiseHandshakePayload)return c;var f=new i.pb.NoiseHandshakePayload;return c.identityKey!=null&&(typeof c.identityKey=="string"?n.base64.decode(c.identityKey,f.identityKey=n.newBuffer(n.base64.length(c.identityKey)),0):c.identityKey.length&&(f.identityKey=c.identityKey)),c.identitySig!=null&&(typeof c.identitySig=="string"?n.base64.decode(c.identitySig,f.identitySig=n.newBuffer(n.base64.length(c.identitySig)),0):c.identitySig.length&&(f.identitySig=c.identitySig)),c.data!=null&&(typeof c.data=="string"?n.base64.decode(c.data,f.data=n.newBuffer(n.base64.length(c.data)),0):c.data.length&&(f.data=c.data)),f},a.toObject=function(c,f){f||(f={});var u={};return f.defaults&&(f.bytes===String?u.identityKey="":(u.identityKey=[],f.bytes!==Array&&(u.identityKey=n.newBuffer(u.identityKey))),f.bytes===String?u.identitySig="":(u.identitySig=[],f.bytes!==Array&&(u.identitySig=n.newBuffer(u.identitySig))),f.bytes===String?u.data="":(u.data=[],f.bytes!==Array&&(u.data=n.newBuffer(u.data)))),c.identityKey!=null&&c.hasOwnProperty("identityKey")&&(u.identityKey=f.bytes===String?n.base64.encode(c.identityKey,0,c.identityKey.length):f.bytes===Array?Array.prototype.slice.call(c.identityKey):c.identityKey),c.identitySig!=null&&c.hasOwnProperty("identitySig")&&(u.identitySig=f.bytes===String?n.base64.encode(c.identitySig,0,c.identitySig.length):f.bytes===Array?Array.prototype.slice.call(c.identitySig):c.identitySig),c.data!=null&&c.hasOwnProperty("data")&&(u.data=f.bytes===String?n.base64.encode(c.data,0,c.data.length):f.bytes===Array?Array.prototype.slice.call(c.data):c.data),u},a.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},a}(),s}(),i})});var s1=S(Sa=>{l();"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var tt=Xn(),J0=Pt(),_8=20;function A8(t,e,r){for(var n=1634760805,i=857760878,s=2036477234,a=1797285236,o=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],u=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=r[19]<<24|r[18]<<16|r[17]<<8|r[16],p=r[23]<<24|r[22]<<16|r[21]<<8|r[20],y=r[27]<<24|r[26]<<16|r[25]<<8|r[24],d=r[31]<<24|r[30]<<16|r[29]<<8|r[28],g=e[3]<<24|e[2]<<16|e[1]<<8|e[0],v=e[7]<<24|e[6]<<16|e[5]<<8|e[4],b=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=n,T=i,A=s,C=a,L=o,k=c,F=f,q=u,X=h,j=p,ne=y,ge=d,O=g,V=v,I=b,H=w,be=0;be<_8;be+=2)E=E+L|0,O^=E,O=O>>>32-16|O<<16,X=X+O|0,L^=X,L=L>>>32-12|L<<12,T=T+k|0,V^=T,V=V>>>32-16|V<<16,j=j+V|0,k^=j,k=k>>>32-12|k<<12,A=A+F|0,I^=A,I=I>>>32-16|I<<16,ne=ne+I|0,F^=ne,F=F>>>32-12|F<<12,C=C+q|0,H^=C,H=H>>>32-16|H<<16,ge=ge+H|0,q^=ge,q=q>>>32-12|q<<12,A=A+F|0,I^=A,I=I>>>32-8|I<<8,ne=ne+I|0,F^=ne,F=F>>>32-7|F<<7,C=C+q|0,H^=C,H=H>>>32-8|H<<8,ge=ge+H|0,q^=ge,q=q>>>32-7|q<<7,T=T+k|0,V^=T,V=V>>>32-8|V<<8,j=j+V|0,k^=j,k=k>>>32-7|k<<7,E=E+L|0,O^=E,O=O>>>32-8|O<<8,X=X+O|0,L^=X,L=L>>>32-7|L<<7,E=E+k|0,H^=E,H=H>>>32-16|H<<16,ne=ne+H|0,k^=ne,k=k>>>32-12|k<<12,T=T+F|0,O^=T,O=O>>>32-16|O<<16,ge=ge+O|0,F^=ge,F=F>>>32-12|F<<12,A=A+q|0,V^=A,V=V>>>32-16|V<<16,X=X+V|0,q^=X,q=q>>>32-12|q<<12,C=C+L|0,I^=C,I=I>>>32-16|I<<16,j=j+I|0,L^=j,L=L>>>32-12|L<<12,A=A+q|0,V^=A,V=V>>>32-8|V<<8,X=X+V|0,q^=X,q=q>>>32-7|q<<7,C=C+L|0,I^=C,I=I>>>32-8|I<<8,j=j+I|0,L^=j,L=L>>>32-7|L<<7,T=T+F|0,O^=T,O=O>>>32-8|O<<8,ge=ge+O|0,F^=ge,F=F>>>32-7|F<<7,E=E+k|0,H^=E,H=H>>>32-8|H<<8,ne=ne+H|0,k^=ne,k=k>>>32-7|k<<7;tt.writeUint32LE(E+n|0,t,0),tt.writeUint32LE(T+i|0,t,4),tt.writeUint32LE(A+s|0,t,8),tt.writeUint32LE(C+a|0,t,12),tt.writeUint32LE(L+o|0,t,16),tt.writeUint32LE(k+c|0,t,20),tt.writeUint32LE(F+f|0,t,24),tt.writeUint32LE(q+u|0,t,28),tt.writeUint32LE(X+h|0,t,32),tt.writeUint32LE(j+p|0,t,36),tt.writeUint32LE(ne+y|0,t,40),tt.writeUint32LE(ge+d|0,t,44),tt.writeUint32LE(O+g|0,t,48),tt.writeUint32LE(V+v|0,t,52),tt.writeUint32LE(I+b|0,t,56),tt.writeUint32LE(H+w|0,t,60)}function i1(t,e,r,n,i){if(i===void 0&&(i=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=i}for(var o=new Uint8Array(64),c=0;c<r.length;c+=64){A8(o,s,t);for(var f=c;f<c+64&&f<r.length;f++)n[f]=r[f]^o[f-c];C8(s,0,a)}return J0.wipe(o),i===0&&J0.wipe(s),n}Sa.streamXOR=i1;function I8(t,e,r,n){return n===void 0&&(n=0),J0.wipe(r),i1(t,e,r,r,n)}Sa.stream=I8;function C8(t,e,r){for(var n=1;r--;)n=n+(t[e]&255)|0,t[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}});var o1=S(fr=>{l();"use strict";Object.defineProperty(fr,"__esModule",{value:!0});var T8=ds(),Ba=Pt();fr.DIGEST_LENGTH=16;var a1=function(){function t(e){this.digestLength=fr.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=r&8191;var n=e[2]|e[3]<<8;this._r[1]=(r>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var a=e[8]|e[9]<<8;this._r[4]=(s>>>4|a<<12)&255,this._r[5]=a>>>1&8190;var o=e[10]|e[11]<<8;this._r[6]=(a>>>14|o<<2)&8191;var c=e[12]|e[13]<<8;this._r[7]=(o>>>11|c<<5)&8065;var f=e[14]|e[15]<<8;this._r[8]=(c>>>8|f<<8)&8191,this._r[9]=f>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return t.prototype._blocks=function(e,r,n){for(var i=this._fin?0:1<<11,s=this._h[0],a=this._h[1],o=this._h[2],c=this._h[3],f=this._h[4],u=this._h[5],h=this._h[6],p=this._h[7],y=this._h[8],d=this._h[9],g=this._r[0],v=this._r[1],b=this._r[2],w=this._r[3],E=this._r[4],T=this._r[5],A=this._r[6],C=this._r[7],L=this._r[8],k=this._r[9];n>=16;){var F=e[r+0]|e[r+1]<<8;s+=F&8191;var q=e[r+2]|e[r+3]<<8;a+=(F>>>13|q<<3)&8191;var X=e[r+4]|e[r+5]<<8;o+=(q>>>10|X<<6)&8191;var j=e[r+6]|e[r+7]<<8;c+=(X>>>7|j<<9)&8191;var ne=e[r+8]|e[r+9]<<8;f+=(j>>>4|ne<<12)&8191,u+=ne>>>1&8191;var ge=e[r+10]|e[r+11]<<8;h+=(ne>>>14|ge<<2)&8191;var O=e[r+12]|e[r+13]<<8;p+=(ge>>>11|O<<5)&8191;var V=e[r+14]|e[r+15]<<8;y+=(O>>>8|V<<8)&8191,d+=V>>>5|i;var I=0,H=I;H+=s*g,H+=a*(5*k),H+=o*(5*L),H+=c*(5*C),H+=f*(5*A),I=H>>>13,H&=8191,H+=u*(5*T),H+=h*(5*E),H+=p*(5*w),H+=y*(5*b),H+=d*(5*v),I+=H>>>13,H&=8191;var be=I;be+=s*v,be+=a*g,be+=o*(5*k),be+=c*(5*L),be+=f*(5*C),I=be>>>13,be&=8191,be+=u*(5*A),be+=h*(5*T),be+=p*(5*E),be+=y*(5*w),be+=d*(5*b),I+=be>>>13,be&=8191;var J=I;J+=s*b,J+=a*v,J+=o*g,J+=c*(5*k),J+=f*(5*L),I=J>>>13,J&=8191,J+=u*(5*C),J+=h*(5*A),J+=p*(5*T),J+=y*(5*E),J+=d*(5*w),I+=J>>>13,J&=8191;var ee=I;ee+=s*w,ee+=a*b,ee+=o*v,ee+=c*g,ee+=f*(5*k),I=ee>>>13,ee&=8191,ee+=u*(5*L),ee+=h*(5*C),ee+=p*(5*A),ee+=y*(5*T),ee+=d*(5*E),I+=ee>>>13,ee&=8191;var te=I;te+=s*E,te+=a*w,te+=o*b,te+=c*v,te+=f*g,I=te>>>13,te&=8191,te+=u*(5*k),te+=h*(5*L),te+=p*(5*C),te+=y*(5*A),te+=d*(5*T),I+=te>>>13,te&=8191;var ae=I;ae+=s*T,ae+=a*E,ae+=o*w,ae+=c*b,ae+=f*v,I=ae>>>13,ae&=8191,ae+=u*g,ae+=h*(5*k),ae+=p*(5*L),ae+=y*(5*C),ae+=d*(5*A),I+=ae>>>13,ae&=8191;var oe=I;oe+=s*A,oe+=a*T,oe+=o*E,oe+=c*w,oe+=f*b,I=oe>>>13,oe&=8191,oe+=u*v,oe+=h*g,oe+=p*(5*k),oe+=y*(5*L),oe+=d*(5*C),I+=oe>>>13,oe&=8191;var ce=I;ce+=s*C,ce+=a*A,ce+=o*T,ce+=c*E,ce+=f*w,I=ce>>>13,ce&=8191,ce+=u*b,ce+=h*v,ce+=p*g,ce+=y*(5*k),ce+=d*(5*L),I+=ce>>>13,ce&=8191;var fe=I;fe+=s*L,fe+=a*C,fe+=o*A,fe+=c*T,fe+=f*E,I=fe>>>13,fe&=8191,fe+=u*w,fe+=h*b,fe+=p*v,fe+=y*g,fe+=d*(5*k),I+=fe>>>13,fe&=8191;var ue=I;ue+=s*k,ue+=a*L,ue+=o*C,ue+=c*A,ue+=f*T,I=ue>>>13,ue&=8191,ue+=u*E,ue+=h*w,ue+=p*b,ue+=y*v,ue+=d*g,I+=ue>>>13,ue&=8191,I=(I<<2)+I|0,I=I+H|0,H=I&8191,I=I>>>13,be+=I,s=H,a=be,o=J,c=ee,f=te,u=ae,h=oe,p=ce,y=fe,d=ue,r+=16,n-=16}this._h[0]=s,this._h[1]=a,this._h[2]=o,this._h[3]=c,this._h[4]=f,this._h[5]=u,this._h[6]=h,this._h[7]=p,this._h[8]=y,this._h[9]=d},t.prototype.finish=function(e,r){r===void 0&&(r=0);var n=new Uint16Array(10),i,s,a,o;if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=i,i=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,o=1;o<10;o++)n[o]=this._h[o]+i,i=n[o]>>>13,n[o]&=8191;for(n[9]-=1<<13,s=(i^1)-1,o=0;o<10;o++)n[o]&=s;for(s=~s,o=0;o<10;o++)this._h[o]=this._h[o]&s|n[o];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,a=this._h[0]+this._pad[0],this._h[0]=a&65535,o=1;o<8;o++)a=(this._h[o]+this._pad[o]|0)+(a>>>16)|0,this._h[o]=a&65535;return e[r+0]=this._h[0]>>>0,e[r+1]=this._h[0]>>>8,e[r+2]=this._h[1]>>>0,e[r+3]=this._h[1]>>>8,e[r+4]=this._h[2]>>>0,e[r+5]=this._h[2]>>>8,e[r+6]=this._h[3]>>>0,e[r+7]=this._h[3]>>>8,e[r+8]=this._h[4]>>>0,e[r+9]=this._h[4]>>>8,e[r+10]=this._h[5]>>>0,e[r+11]=this._h[5]>>>8,e[r+12]=this._h[6]>>>0,e[r+13]=this._h[6]>>>8,e[r+14]=this._h[7]>>>0,e[r+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var r=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s<i;s++)this._buffer[this._leftover+s]=e[r+s];if(n-=i,r+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,r,i),r+=i,n-=i),n){for(var s=0;s<n;s++)this._buffer[this._leftover+s]=e[r+s];this._leftover+=n}return this},t.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},t.prototype.clean=function(){return Ba.wipe(this._buffer),Ba.wipe(this._r),Ba.wipe(this._h),Ba.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},t}();fr.Poly1305=a1;function P8(t,e){var r=new a1(t);r.update(e);var n=r.digest();return r.clean(),n}fr.oneTimeAuth=P8;function K8(t,e){return t.length!==fr.DIGEST_LENGTH||e.length!==fr.DIGEST_LENGTH?!1:T8.equal(t,e)}fr.equal=K8});var u1=S(ur=>{l();"use strict";Object.defineProperty(ur,"__esModule",{value:!0});var _a=s1(),L8=o1(),Wi=Pt(),c1=Xn(),R8=ds();ur.KEY_LENGTH=32;ur.NONCE_LENGTH=12;ur.TAG_LENGTH=16;var f1=new Uint8Array(16),k8=function(){function t(e){if(this.nonceLength=ur.NONCE_LENGTH,this.tagLength=ur.TAG_LENGTH,e.length!==ur.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return t.prototype.seal=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);_a.stream(this._key,s,a,4);var o=r.length+this.tagLength,c;if(i){if(i.length!==o)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(o);return _a.streamXOR(this._key,s,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),n),Wi.wipe(s),c},t.prototype.open=function(e,r,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);_a.stream(this._key,s,a,4);var o=new Uint8Array(this.tagLength);if(this._authenticate(o,a,r.subarray(0,r.length-this.tagLength),n),!R8.equal(o,r.subarray(r.length-this.tagLength,r.length)))return null;var c=r.length-this.tagLength,f;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");f=i}else f=new Uint8Array(c);return _a.streamXOR(this._key,s,r.subarray(0,r.length-this.tagLength),f,4),Wi.wipe(s),f},t.prototype.clean=function(){return Wi.wipe(this._key),this},t.prototype._authenticate=function(e,r,n,i){var s=new L8.Poly1305(r);i&&(s.update(i),i.length%16>0&&s.update(f1.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(f1.subarray(n.length%16));var a=new Uint8Array(8);i&&c1.writeUint64LE(i.length,a),s.update(a),c1.writeUint64LE(n.length,a),s.update(a);for(var o=s.digest(),c=0;c<o.length;c++)e[c]=o[c];s.clean(),Wi.wipe(o),Wi.wipe(a)},t}();ur.ChaCha20Poly1305=k8});var l1=S((A6,h1)=>{l();var On=1e3,qn=On*60,Hn=qn*60,cn=Hn*24,D8=cn*7,N8=cn*365.25;h1.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return U8(t);if(r==="number"&&isFinite(t))return e.long?M8(t):F8(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function U8(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!!e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*N8;case"weeks":case"week":case"w":return r*D8;case"days":case"day":case"d":return r*cn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Hn;case"minutes":case"minute":case"mins":case"min":case"m":return r*qn;case"seconds":case"second":case"secs":case"sec":case"s":return r*On;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function F8(t){var e=Math.abs(t);return e>=cn?Math.round(t/cn)+"d":e>=Hn?Math.round(t/Hn)+"h":e>=qn?Math.round(t/qn)+"m":e>=On?Math.round(t/On)+"s":t+"ms"}function M8(t){var e=Math.abs(t);return e>=cn?Aa(t,e,cn,"day"):e>=Hn?Aa(t,e,Hn,"hour"):e>=qn?Aa(t,e,qn,"minute"):e>=On?Aa(t,e,On,"second"):t+" ms"}function Aa(t,e,r,n){var i=e>=r*1.5;return Math.round(t/r)+" "+n+(i?"s":"")}});var d1=S((C6,p1)=>{l();function O8(t){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=a,r.humanize=l1(),r.destroy=f,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let h=0;for(let p=0;p<u.length;p++)h=(h<<5)-h+u.charCodeAt(p),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=e;function r(u){let h,p=null;function y(...d){if(!y.enabled)return;let g=y,v=Number(new Date),b=v-(h||v);g.diff=b,g.prev=h,g.curr=v,h=v,d[0]=r.coerce(d[0]),typeof d[0]!="string"&&d.unshift("%O");let w=0;d[0]=d[0].replace(/%([a-zA-Z%])/g,(T,A)=>{if(T==="%%")return"%";w++;let C=r.formatters[A];if(typeof C=="function"){let L=d[w];T=C.call(g,L),d.splice(w,1),w--}return T}),r.formatArgs.call(g,d),(g.log||r.log).apply(g,d)}return y.namespace=u,y.useColors=r.useColors(),y.color=r.selectColor(u),y.extend=n,y.destroy=r.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>p===null?r.enabled(u):p,set:d=>{p=d}}),typeof r.init=="function"&&r.init(y),y}function n(u,h){let p=r(this.namespace+(typeof h=="undefined"?":":h)+u);return p.log=this.log,p}function i(u){r.save(u),r.names=[],r.skips=[];let h,p=(typeof u=="string"?u:"").split(/[\s,]+/),y=p.length;for(h=0;h<y;h++)!p[h]||(u=p[h].replace(/\*/g,".*?"),u[0]==="-"?r.skips.push(new RegExp("^"+u.substr(1)+"$")):r.names.push(new RegExp("^"+u+"$")))}function s(){let u=[...r.names.map(o),...r.skips.map(o).map(h=>"-"+h)].join(",");return r.enable(""),u}function a(u){if(u[u.length-1]==="*")return!0;let h,p;for(h=0,p=r.skips.length;h<p;h++)if(r.skips[h].test(u))return!1;for(h=0,p=r.names.length;h<p;h++)if(r.names[h].test(u))return!0;return!1}function o(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){return u instanceof Error?u.stack||u.message:u}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}p1.exports=O8});var y1=S((lt,Ca)=>{l();lt.formatArgs=q8;lt.save=H8;lt.load=V8;lt.useColors=z8;lt.storage=G8();lt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();lt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function z8(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function q8(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Ca.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,n=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),t.splice(n,0,e)}lt.log=console.debug||console.log||(()=>{});function H8(t){try{t?lt.storage.setItem("debug",t):lt.storage.removeItem("debug")}catch(e){}}function V8(){let t;try{t=lt.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function G8(){try{return localStorage}catch(t){}}Ca.exports=d1()(lt);var{formatters:W8}=Ca.exports;W8.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var $8={};Ee($8,{NOISE:()=>X8,Noise:()=>Na});l();l();var _1=Se(as()),jn=Se(_e()),oc=Se(Vf()),A1=Se(Yf()),cc=Se(Zf()),C1=Se(eu()),Da=Se(Su());l();var Wn=Se(_e());l();var Vr=Se(_e());l();var Qy=Se(Pu()),Jy=Se(So()),e1=Se(as()),st=Se(_e()),wa=Se(Xy()),t1=Se(Zy());nn();var Ea=t1.pb.NoiseHandshakePayload;function Fr(){let t=e1.generateKeyPair();return{publicKey:st.Buffer.from(t.publicKey.buffer,t.publicKey.byteOffset,t.publicKey.length),privateKey:st.Buffer.from(t.secretKey.buffer,t.secretKey.byteOffset,t.secretKey.length)}}async function n1(t,e,r){let n=await S8(t,r1(e)),i=r??st.Buffer.alloc(0);return E8(t.marshalPubKey(),n,i)}function E8(t,e,r){let n=Ea.create({identityKey:st.Buffer.from(t),identitySig:e,data:r??null});return st.Buffer.from(Ea.encode(n).finish())}async function S8(t,e){return st.Buffer.from(await t.privKey.sign(e))}async function Mr(t){return await wa.default.createFromPubKey(st.Buffer.from(t.identityKey))}function Or(t){return Ea.toObject(Ea.decode(st.Buffer.from(t)))}function r1(t){return st.Buffer.concat([st.Buffer.from("noise-libp2p-static-key:"),t])}async function B8(t,e){let r=await wa.default.createFromPubKey(e);return T0(r.id,t)}async function qr(t,e,r){let n=st.Buffer.from(e.identityKey);if(!await B8(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");let i=r1(t),s=await wa.default.createFromPubKey(n);if(!e.identitySig||!s.pubKey.verify(i,st.Buffer.from(e.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return s}function Q0(t,e){let n=new Qy.HKDF(Jy.SHA256,e,t).expand(96),i=st.Buffer.from(n.buffer,n.byteOffset,n.length),s=i.slice(0,32),a=i.slice(32,64),o=i.slice(64,96);return[s,a,o]}function cr(t){return!(!st.Buffer.isBuffer(t)||t.length!==32)}l();var He=Se(_e()),v1=Se(as()),b1=Se(So()),tc=Se(u1());l();var x1=Se(y1());l();var fn=65535,ec=fn-16,g1=process.env.DUMP_SESSION_KEYS;var $=(0,x1.default)("libp2p:noise"),Et;g1?Et=$:Et=()=>{};function Ia(t){Et(`LOCAL_STATIC_PUBLIC_KEY ${t.publicKey.toString("hex")}`),Et(`LOCAL_STATIC_PRIVATE_KEY ${t.privateKey.toString("hex")}`)}function Hr(t){t?(Et(`LOCAL_PUBLIC_EPHEMERAL_KEY ${t.publicKey.toString("hex")}`),Et(`LOCAL_PRIVATE_EPHEMERAL_KEY ${t.privateKey.toString("hex")}`)):Et("Missing local ephemeral keys.")}function Vn(t){Et(`REMOTE_STATIC_PUBLIC_KEY ${t.toString("hex")}`)}function hr(t){Et(`REMOTE_EPHEMERAL_PUBLIC_KEY ${t.toString("hex")}`)}function Ta(t){t.cs1&&t.cs2?(Et(`CIPHER_STATE_1 ${t.cs1.n} ${t.cs1.k.toString("hex")}`),Et(`CIPHER_STATE_2 ${t.cs2.n} ${t.cs2.k.toString("hex")}`)):Et("Missing cipher state.")}var j8=0,ji=class{encryptWithAd(e,r,n){let i=this.encrypt(e.k,e.n,r,n);return this.setNonce(e,this.incrementNonce(e.n)),i}decryptWithAd(e,r,n){let{plaintext:i,valid:s}=this.decrypt(e.k,e.n,r,n);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:i,valid:s}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,r){e.n=r}createEmptyKey(){return He.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){let r=He.Buffer.alloc(12);return r.writeUInt32LE(e,4),r}encrypt(e,r,n,i){let s=this.nonceToBytes(r),o=new tc.ChaCha20Poly1305(e).seal(s,i,n);return He.Buffer.from(o.buffer,o.byteOffset,o.length)}encryptAndHash(e,r){let n;return this.hasKey(e.cs)?n=this.encryptWithAd(e.cs,e.h,r):n=r,this.mixHash(e,n),n}decrypt(e,r,n,i){let s=this.nonceToBytes(r),o=new tc.ChaCha20Poly1305(e).open(s,i,n);return o?{plaintext:He.Buffer.from(o.buffer,o.byteOffset,o.length),valid:!0}:{plaintext:He.Buffer.from(""),valid:!1}}decryptAndHash(e,r){let n,i=!0;return this.hasKey(e.cs)?{plaintext:n,valid:i}=this.decryptWithAd(e.cs,e.h,r):n=r,this.mixHash(e,r),{plaintext:n,valid:i}}dh(e,r){try{let n=v1.sharedKey(e,r),i=He.Buffer.from(n.buffer,n.byteOffset,n.length),s=He.Buffer.alloc(32);return i.copy(s),s}catch(n){return $(n.message),He.Buffer.alloc(32)}}mixHash(e,r){e.h=this.getHash(e.h,r)}getHash(e,r){let n=b1.hash(He.Buffer.from([...e,...r]));return He.Buffer.from(n.buffer,n.byteOffset,n.length)}mixKey(e,r){let[n,i]=Q0(e.ck,r);e.cs=this.initializeKey(i),e.ck=n}initializeKey(e){return{k:e,n:j8}}initializeSymmetric(e){let r=He.Buffer.from(e,"utf-8"),n=this.hashProtocolName(r),i=n,s=this.createEmptyKey();return{cs:this.initializeKey(s),ck:i,h:n}}hashProtocolName(e){if(e.length<=32){let r=He.Buffer.alloc(32);return e.copy(r),r}else return this.getHash(e,He.Buffer.alloc(0))}split(e){let[r,n]=Q0(e.ck,He.Buffer.alloc(0)),i=this.initializeKey(r),s=this.initializeKey(n);return{cs1:i,cs2:s}}writeMessageRegular(e,r){let n=this.encryptWithAd(e,He.Buffer.alloc(0),r),i=this.createEmptyKey(),s=He.Buffer.alloc(0);return{ne:i,ns:s,ciphertext:n}}readMessageRegular(e,r){return this.decryptWithAd(e,He.Buffer.alloc(0),r.ciphertext)}};var rc=class extends ji{initializeInitiator(e,r,n,i){let s="Noise_XX_25519_ChaChaPoly_SHA256",a=this.initializeSymmetric(s);this.mixHash(a,e);let o=Vr.Buffer.alloc(32);return{ss:a,s:r,rs:n,psk:i,re:o}}initializeResponder(e,r,n,i){let s="Noise_XX_25519_ChaChaPoly_SHA256",a=this.initializeSymmetric(s);this.mixHash(a,e);let o=Vr.Buffer.alloc(32);return{ss:a,s:r,rs:n,psk:i,re:o}}writeMessageA(e,r,n){let i=Vr.Buffer.alloc(0);n!==void 0?e.e=n:e.e=Fr();let s=e.e.publicKey;this.mixHash(e.ss,s);let a=this.encryptAndHash(e.ss,r);return{ne:s,ns:i,ciphertext:a}}writeMessageB(e,r){e.e=Fr();let n=e.e.publicKey;this.mixHash(e.ss,n),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let i=Vr.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let a=this.encryptAndHash(e.ss,r);return{ne:n,ns:s,ciphertext:a}}writeMessageC(e,r){let n=Vr.Buffer.from(e.s.publicKey),i=this.encryptAndHash(e.ss,n);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let s=this.encryptAndHash(e.ss,r),o={ne:this.createEmptyKey(),ns:i,ciphertext:s},{cs1:c,cs2:f}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:c,cs2:f}}readMessageA(e,r){return cr(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,r.ciphertext)}readMessageB(e,r){if(cr(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));let{plaintext:n,valid:i}=this.decryptAndHash(e.ss,r.ns);i&&n.length===32&&cr(n)&&(e.rs=n),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:s,valid:a}=this.decryptAndHash(e.ss,r.ciphertext);return{plaintext:s,valid:i&&a}}readMessageC(e,r){let{plaintext:n,valid:i}=this.decryptAndHash(e.ss,r.ns);if(i&&n.length===32&&cr(n)&&(e.rs=n),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let{plaintext:s,valid:a}=this.decryptAndHash(e.ss,r.ciphertext),{cs1:o,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:i&&a,cs1:o,cs2:c}}initSession(e,r,n){let i=this.createEmptyKey(),s=Vr.Buffer.alloc(32),a;return e?a=this.initializeInitiator(r,n,s,i):a=this.initializeResponder(r,n,s,i),{hs:a,i:e,mc:0}}sendMessage(e,r,n){let i;if(e.mc===0)i=this.writeMessageA(e.hs,r,n);else if(e.mc===1)i=this.writeMessageB(e.hs,r);else if(e.mc===2){let{h:s,messageBuffer:a,cs1:o,cs2:c}=this.writeMessageC(e.hs,r);i=a,e.h=s,e.cs1=o,e.cs2=c}else if(e.mc>2)if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(e.cs1,r)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(e.cs2,r)}else throw new Error("Session invalid.");return e.mc++,i}recvMessage(e,r){let n=Vr.Buffer.alloc(0),i=!1;if(e.mc===0)({plaintext:n,valid:i}=this.readMessageA(e.hs,r));else if(e.mc===1)({plaintext:n,valid:i}=this.readMessageB(e.hs,r));else if(e.mc===2){let{h:s,plaintext:a,valid:o,cs1:c,cs2:f}=this.readMessageC(e.hs,r);n=a,i=o,e.h=s,e.cs1=c,e.cs2=f}return e.mc++,{plaintext:n,valid:i}}};l();var un=Se(_e()),$i=(t,e,r)=>(e=e||un.Buffer.allocUnsafe(2),e.writeUInt16BE(t,r),e);$i.bytes=2;var Xi=t=>{if(t.length<2)throw RangeError("Could not decode int16BE");return t.readUInt16BE(0)};Xi.bytes=2;function Pa(t){return un.Buffer.concat([t.ne,t.ciphertext])}function Ka(t){return un.Buffer.concat([t.ne,t.ns,t.ciphertext])}function m1(t){return un.Buffer.concat([t.ns,t.ciphertext])}function zn(t){if(t.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:t.slice(0,32),ciphertext:t.slice(32,t.length),ns:un.Buffer.alloc(0)}}function Gn(t){if(t.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:t.slice(0,32),ns:t.slice(32,80),ciphertext:t.slice(80,t.length)}}function w1(t){if(t.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:un.Buffer.alloc(0),ns:t.slice(0,48),ciphertext:t.slice(48,t.length)}}var Yi=class{constructor(e,r,n,i,s,a,o){this.isInitiator=e,this.payload=r,this.prologue=n,this.staticKeypair=i,this.connection=s,a&&(this.remotePeer=a),this.xx=o??new rc,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=Wn.Buffer.alloc(0)}async propose(){if(Ia(this.session.hs.s),this.isInitiator){$("Stage 0 - Initiator starting to send first message.");let e=this.xx.sendMessage(this.session,Wn.Buffer.alloc(0));this.connection.writeLP(Pa(e)),$("Stage 0 - Initiator finished sending first message."),Hr(this.session.hs.e)}else{$("Stage 0 - Responder waiting to receive first message...");let e=zn((await this.connection.readLP()).slice()),{valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 0 validation fail");$("Stage 0 - Responder received first message."),hr(this.session.hs.re)}}async exchange(){if(this.isInitiator){$("Stage 1 - Initiator waiting to receive first message from responder...");let e=Gn((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Error("xx handshake stage 1 validation fail");$("Stage 1 - Initiator received the message."),hr(this.session.hs.re),Vn(this.session.hs.rs),$("Initiator going to check remote's signature...");try{let i=await Or(r);this.remotePeer=this.remotePeer||await Mr(i),this.remotePeer=await qr(e.ns,i,this.remotePeer),this.setRemoteEarlyData(i.data)}catch(i){let s=i;throw new Error(`Error occurred while verifying signed payload: ${s.message}`)}$("All good with the signature!")}else{$("Stage 1 - Responder sending out first message with signed payload and static key.");let e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(Ka(e)),$("Stage 1 - Responder sent the second handshake message with signed payload."),Hr(this.session.hs.e)}}async finish(){if(this.isInitiator){$("Stage 2 - Initiator sending third handshake message.");let e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(m1(e)),$("Stage 2 - Initiator sent message with signed payload.")}else{$("Stage 2 - Responder waiting for third handshake message...");let e=w1((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Error("xx handshake stage 2 validation fail");$("Stage 2 - Responder received the message, finished handshake.");try{let i=await Or(r);this.remotePeer=this.remotePeer||await Mr(i),await qr(this.session.hs.rs,i,this.remotePeer),this.setRemoteEarlyData(i.data)}catch(i){let s=i;throw new Error(`Error occurred while verifying signed payload: ${s.message}`)}}Ta(this.session)}encrypt(e,r){let n=this.getCS(r);return this.xx.encryptWithAd(n,Wn.Buffer.alloc(0),e)}decrypt(e,r){let n=this.getCS(r,!1);return this.xx.decryptWithAd(n,Wn.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,r=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?r?e.cs1:e.cs2:r?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=Wn.Buffer.from(e.buffer,e.byteOffset,e.length))}};l();l();var Zi=Se(_e());var nc=class extends ji{initSession(e,r,n,i){let s=this.createEmptyKey(),a;return e?a=this.initializeInitiator(r,n,i,s):a=this.initializeResponder(r,n,i,s),{hs:a,i:e,mc:0}}sendMessage(e,r){let n;if(e.mc===0)n=this.writeMessageA(e.hs,r);else if(e.mc===1){let{messageBuffer:i,h:s,cs1:a,cs2:o}=this.writeMessageB(e.hs,r);n=i,e.h=s,e.cs1=a,e.cs2=o}else if(e.mc>1)if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,r)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,r)}else throw new Error("Session invalid.");return e.mc++,n}recvMessage(e,r){let n=Zi.Buffer.alloc(0),i=!1;if(e.mc===0&&({plaintext:n,valid:i}=this.readMessageA(e.hs,r)),e.mc===1){let{plaintext:s,valid:a,h:o,cs1:c,cs2:f}=this.readMessageB(e.hs,r);n=s,i=a,e.h=o,e.cs1=c,e.cs2=f}return e.mc++,{plaintext:n,valid:i}}writeMessageA(e,r){e.e=Fr();let n=e.e.publicKey;this.mixHash(e.ss,n),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let i=Zi.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));let a=this.encryptAndHash(e.ss,r);return{ne:n,ns:s,ciphertext:a}}writeMessageB(e,r){e.e=Fr();let n=e.e.publicKey;this.mixHash(e.ss,n),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));let i=this.encryptAndHash(e.ss,r),s=this.createEmptyKey(),a={ne:n,ns:s,ciphertext:i},{cs1:o,cs2:c}=this.split(e.ss);return{messageBuffer:a,cs1:o,cs2:c,h:e.ss.h}}readMessageA(e,r){cr(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let{plaintext:n,valid:i}=this.decryptAndHash(e.ss,r.ns);i&&n.length===32&&cr(n)&&(e.rs=n),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));let{plaintext:s,valid:a}=this.decryptAndHash(e.ss,r.ciphertext);return{plaintext:s,valid:i&&a}}readMessageB(e,r){if(cr(r.ne)&&(e.re=r.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));let{plaintext:n,valid:i}=this.decryptAndHash(e.ss,r.ciphertext),{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,valid:i,plaintext:n,cs1:s,cs2:a}}initializeInitiator(e,r,n,i){let s="Noise_IK_25519_ChaChaPoly_SHA256",a=this.initializeSymmetric(s);this.mixHash(a,e),this.mixHash(a,n);let o=Zi.Buffer.alloc(32);return{ss:a,s:r,rs:n,re:o,psk:i}}initializeResponder(e,r,n,i){let s="Noise_IK_25519_ChaChaPoly_SHA256",a=this.initializeSymmetric(s);this.mixHash(a,e),this.mixHash(a,r.publicKey);let o=Zi.Buffer.alloc(32);return{ss:a,s:r,rs:n,re:o,psk:i}}};var hn=Se(_e());l();var La=class extends Error{constructor(e,r){super(r);this.initialMsg=e,this.name="FailedIKhandshake"}};var ic=class{constructor(e,r,n,i,s,a,o,c){this.isInitiator=e,this.payload=hn.Buffer.from(r),this.prologue=n,this.staticKeypair=i,this.connection=s,o&&(this.remotePeer=o),this.ik=c??new nc,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=hn.Buffer.alloc(0)}async stage0(){if(Ia(this.session.hs.s),Vn(this.session.hs.rs),this.isInitiator){$("IK Stage 0 - Initiator sending message...");let e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(Ka(e)),$("IK Stage 0 - Initiator sent message."),Hr(this.session.hs.e)}else{$("IK Stage 0 - Responder receiving message...");let e=await this.connection.readLP();try{let r=Gn(e.slice()),{plaintext:n,valid:i}=this.ik.recvMessage(this.session,r);if(!i)throw new Error("ik handshake stage 0 decryption validation fail");$("IK Stage 0 - Responder got message, going to verify payload.");let s=await Or(n);this.remotePeer=this.remotePeer||await Mr(s),await qr(this.session.hs.rs,s,this.remotePeer),this.setRemoteEarlyData(s.data),$("IK Stage 0 - Responder successfully verified payload!"),hr(this.session.hs.re)}catch(r){let n=r;throw $("Responder breaking up with IK handshake in stage 0."),new La(e,`Error occurred while verifying initiator's signed payload: ${n.message}`)}}}async stage1(){if(this.isInitiator){$("IK Stage 1 - Initiator receiving message...");let e=(await this.connection.readLP()).slice(),r=zn(hn.Buffer.from(e)),{plaintext:n,valid:i}=this.ik.recvMessage(this.session,r);$("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!i)throw new Error("ik stage 1 decryption validation fail");let s=await Or(n);this.remotePeer=this.remotePeer||await Mr(s),await qr(r.ns.slice(0,32),s,this.remotePeer),this.setRemoteEarlyData(s.data),$("IK Stage 1 - Initiator successfully verified payload!"),hr(this.session.hs.re)}catch(s){let a=s;throw $("Initiator breaking up with IK handshake in stage 1."),new La(e,`Error occurred while verifying responder's signed payload: ${a.message}`)}}else{$("IK Stage 1 - Responder sending message...");let e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(Pa(e)),$("IK Stage 1 - Responder sent message..."),Hr(this.session.hs.e)}Ta(this.session)}decrypt(e,r){let n=this.getCS(r,!1);return this.ik.decryptWithAd(n,hn.Buffer.alloc(0),e)}encrypt(e,r){let n=this.getCS(r);return this.ik.encryptWithAd(n,hn.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,r=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?r?e.cs1:e.cs2:r?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=hn.Buffer.from(e.buffer,e.byteOffset,e.length))}};l();var Ra=Se(_e());var sc=class extends Yi{constructor(e,r,n,i,s,a,o,c,f){super(e,r,n,i,s,o,f);c&&(this.ephemeralKeys=c),this.initialMsg=a}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,Ra.Buffer.alloc(0),this.ephemeralKeys),$("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),Hr(this.session.hs.e);else{$("XX Fallback Stage 0 - Responder decoding initial msg from IK.");let e=zn(this.initialMsg),{valid:r}=this.xx.recvMessage(this.session,{ne:e.ne,ns:Ra.Buffer.alloc(0),ciphertext:Ra.Buffer.alloc(0)});if(!r)throw new Error("xx fallback stage 0 decryption validation fail");$("XX Fallback Stage 0 - Responder used received message from IK."),hr(this.session.hs.re)}}async exchange(){if(this.isInitiator){let e=Gn(this.initialMsg),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,e);if(!n)throw new Error("xx fallback stage 1 decryption validation fail");$("XX Fallback Stage 1 - Initiator used received message from IK."),hr(this.session.hs.re),Vn(this.session.hs.rs),$("Initiator going to check remote's signature...");try{let i=await Or(r);this.remotePeer=this.remotePeer||await Mr(i),await qr(this.session.hs.rs,i,this.remotePeer),this.setRemoteEarlyData(i.data)}catch(i){let s=i;throw new Error(`Error occurred while verifying signed payload from responder: ${s.message}`)}$("All good with the signature!")}else $("XX Fallback Stage 1 - Responder start"),await super.exchange(),$("XX Fallback Stage 1 - Responder end")}};l();var ac=Se(_e());function E1(t){return async function*(e){for await(let r of e){let n=ac.Buffer.from(r.buffer,r.byteOffset,r.length);for(let i=0;i<n.length;i+=ec){let s=i+ec;s>n.length&&(s=n.length),yield t.encrypt(n.slice(i,s),t.session)}}}}function S1(t){return async function*(e){for await(let r of e){let n=ac.Buffer.from(r.buffer,r.byteOffset,r.length);for(let i=0;i<n.length;i+=fn){let s=i+fn;s>n.length&&(s=n.length);let a=n.slice(i,s),{plaintext:o,valid:c}=await t.decrypt(a,t.session);if(!c)throw new Error("Failed to validate decrypted chunk");yield o}}}}l();var B1=class{constructor(){this.storage=new Map}store(e,r){this.storage.set(e.id,r)}load(e){return e?this.storage.get(e.id)??null:null}resetStorage(){this.storage.clear()}},ka=new B1;var Na=class{constructor(e,r){this.protocol="/noise";this.prologue=jn.Buffer.alloc(0);if(this.earlyData=r??jn.Buffer.alloc(0),this.useNoisePipes=!1,e){let n=_1.generateKeyPairFromSeed(e);this.staticKeys={privateKey:jn.Buffer.from(n.secretKey.buffer,n.secretKey.byteOffset,n.secretKey.length),publicKey:jn.Buffer.from(n.publicKey.buffer,n.publicKey.byteOffset,n.publicKey.length)}}else this.staticKeys=Fr()}async secureOutbound(e,r,n){let i=(0,oc.default)(r,{lengthEncoder:$i,lengthDecoder:Xi,maxDataLength:fn}),s=await this.performHandshake({connection:i,isInitiator:!0,localPeer:e,remotePeer:n});return{conn:await this.createSecureConnection(i,s),remoteEarlyData:s.remoteEarlyData,remotePeer:s.remotePeer}}async secureInbound(e,r,n){let i=(0,oc.default)(r,{lengthEncoder:$i,lengthDecoder:Xi,maxDataLength:fn}),s=await this.performHandshake({connection:i,isInitiator:!1,localPeer:e,remotePeer:n});return{conn:await this.createSecureConnection(i,s),remoteEarlyData:s.remoteEarlyData,remotePeer:s.remotePeer}}async performHandshake(e){let r=await n1(e.localPeer,this.staticKeys.publicKey,this.earlyData),n=this.useNoisePipes;if(e.isInitiator&&ka.load(e.remotePeer)===null&&(n=!1),n){let{remotePeer:i,connection:s,isInitiator:a}=e,o=new ic(a,r,this.prologue,this.staticKeys,s,ka.load(e.remotePeer)??jn.Buffer.alloc(32),i);try{return await this.performIKHandshake(o)}catch(c){let f;return e.isInitiator&&(f=o.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,r,c.initialMsg,f)}}else return await this.performXXHandshake(e,r)}async performXXFallbackHandshake(e,r,n,i){let{isInitiator:s,remotePeer:a,connection:o}=e,c=new sc(s,r,this.prologue,this.staticKeys,o,n,a,i);try{await c.propose(),await c.exchange(),await c.finish()}catch(f){$(f);let u=f;throw new Error(`Error occurred during XX Fallback handshake: ${u.message}`)}return c}async performXXHandshake(e,r){let{isInitiator:n,remotePeer:i,connection:s}=e,a=new Yi(n,r,this.prologue,this.staticKeys,s,i);try{await a.propose(),await a.exchange(),await a.finish(),this.useNoisePipes&&a.remotePeer&&ka.store(a.remotePeer,a.getRemoteStaticKey())}catch(o){let c=o;throw new Error(`Error occurred during XX handshake: ${c.message}`)}return a}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,r){let[n,i]=(0,A1.default)(),s=e.unwrap();return await(0,C1.default)(n,cc.default,E1(r),(0,Da.encode)({lengthEncoder:$i}),s,(0,Da.decode)({lengthDecoder:Xi}),cc.default,S1(r),n),i}};var X8=new Na;return $8;})();
/*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! noble-ed25519 - MIT License (c) Paul Miller (paulmillr.com) */
/*! noble-secp256k1 - MIT License (c) Paul Miller (paulmillr.com) */
return ChainsafeLibp2pNoise}));
