@libp2p/autonat 1.0.5-230afea4b → 1.0.5-28587d24f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.min.js +19 -19
  2. package/package.json +6 -6
package/dist/index.min.js CHANGED
@@ -1,29 +1,29 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PAutonat = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PAutonat=(()=>{var yu=Object.create;var Rn=Object.defineProperty;var gu=Object.getOwnPropertyDescriptor;var xu=Object.getOwnPropertyNames;var mu=Object.getPrototypeOf,bu=Object.prototype.hasOwnProperty;var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),It=(t,e)=>{for(var r in e)Rn(t,r,{get:e[r],enumerable:!0})},oa=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of xu(e))!bu.call(t,i)&&i!==r&&Rn(t,i,{get:()=>e[i],enumerable:!(n=gu(e,i))||n.enumerable});return t};var Ut=(t,e,r)=>(r=t!=null?yu(mu(t)):{},oa(e||!t||!t.__esModule?Rn(r,"default",{value:t,enumerable:!0}):r,t)),vu=t=>oa(Rn({},"__esModule",{value:!0}),t);var ct=ft((kg,Ra)=>{Ra.exports={options:{usePureJavaScript:!1}}});var Pa=ft((Ng,Da)=>{var fo={};Da.exports=fo;var La={};fo.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=Cl(t,e);else{var i=0,o=e.length,s=e.charAt(0),a=[0];for(i=0;i<t.length;++i){for(var c=0,f=t[i];c<a.length;++c)f+=a[c]<<8,a[c]=f%o,f=f/o|0;for(;f>0;)a.push(f%o),f=f/o|0}for(i=0;t[i]===0&&i<t.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=e[a[i]]}if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
3
- `)}return n};fo.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=La[e];if(!r){r=La[e]=[];for(var n=0;n<e.length;++n)r[e.charCodeAt(n)]=n}t=t.replace(/\s/g,"");for(var i=e.length,o=e.charAt(0),s=[0],n=0;n<t.length;n++){var a=r[t.charCodeAt(n)];if(a===void 0)return;for(var c=0,f=a;c<s.length;++c)f+=s[c]*i,s[c]=f&255,f>>=8;for(;f>0;)s.push(f&255),f>>=8}for(var u=0;t[u]===o&&u<t.length-1;++u)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function Cl(t,e){var r=0,n=e.length,i=e.charAt(0),o=[0];for(r=0;r<t.length();++r){for(var s=0,a=t.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var c="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)c+=i;for(r=o.length-1;r>=0;--r)c+=e[o[r]];return c}});var wt=ft((Ug,Oa)=>{var ka=ct(),Na=Pa(),b=Oa.exports=ka.util=ka.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){b.nextTick=process.nextTick,typeof setImmediate=="function"?b.setImmediate=setImmediate:b.setImmediate=b.nextTick;return}if(typeof setImmediate=="function"){b.setImmediate=function(){return setImmediate.apply(void 0,arguments)},b.nextTick=function(a){return setImmediate(a)};return}if(b.setImmediate=function(a){setTimeout(a,0)},typeof window<"u"&&typeof window.postMessage=="function"){let a=function(c){if(c.source===window&&c.data===t){c.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(u){u()})}};var s=a,t="forge.setImmediate",e=[];b.setImmediate=function(c){e.push(c),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",a,!0)}if(typeof MutationObserver<"u"){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 o=b.setImmediate;b.setImmediate=function(c){Date.now()-r>15?(r=Date.now(),o(c)):(e.push(c),e.length===1&&i.setAttribute("a",n=!n))}}b.nextTick=b.setImmediate})();b.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;b.globalScope=function(){return b.isNodejs?globalThis:typeof self>"u"?window:self}();b.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};b.isArrayBuffer=function(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer};b.isArrayBufferView=function(t){return t&&b.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function an(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}b.ByteBuffer=co;function co(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(b.isArrayBuffer(t)||b.isArrayBufferView(t))if(typeof Buffer<"u"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof co||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}b.ByteStringBuffer=co;var _l=4096;b.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>_l&&(this.data.substr(0,1),this._constructedStringLength=0)};b.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};b.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};b.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};b.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};b.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};b.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(b.encodeUtf8(t))};b.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};b.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};b.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))};b.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};b.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};b.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))};b.ByteStringBuffer.prototype.putInt=function(t,e){an(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};b.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};b.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};b.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};b.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};b.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};b.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};b.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};b.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};b.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};b.ByteStringBuffer.prototype.getInt=function(t){an(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};b.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};b.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};b.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};b.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};b.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};b.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};b.ByteStringBuffer.prototype.copy=function(){var t=b.createBuffer(this.data);return t.read=this.read,t};b.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};b.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};b.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};b.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};b.ByteStringBuffer.prototype.toString=function(){return b.decodeUtf8(this.bytes())};function Rl(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=b.isArrayBuffer(t),n=b.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)}b.DataBuffer=Rl;b.DataBuffer.prototype.length=function(){return this.write-this.read};b.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};b.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};b.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};b.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};b.DataBuffer.prototype.putBytes=function(t,e){if(b.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(b.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 b.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&b.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 b.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var o;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=b.binary.hex.decode(t,o,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),o=new Uint8Array(this.data.buffer,this.write),this.write+=b.binary.base64.decode(t,o,this.write),this;if(e==="utf8"&&(t=b.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=b.binary.raw.decode(o),this;if(e==="utf16")return this.accommodate(t.length*2),o=new Uint16Array(this.data.buffer,this.write),this.write+=b.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};b.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};b.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};b.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};b.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};b.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};b.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};b.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};b.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};b.DataBuffer.prototype.putInt=function(t,e){an(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};b.DataBuffer.prototype.putSignedInt=function(t,e){return an(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};b.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};b.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};b.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};b.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};b.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};b.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};b.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};b.DataBuffer.prototype.getInt=function(t){an(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};b.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};b.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};b.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};b.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};b.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};b.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};b.DataBuffer.prototype.copy=function(){return new b.DataBuffer(this)};b.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};b.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};b.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};b.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};b.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return b.binary.raw.encode(e);if(t==="hex")return b.binary.hex.encode(e);if(t==="base64")return b.binary.base64.encode(e);if(t==="utf8")return b.text.utf8.decode(e);if(t==="utf16")return b.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};b.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=b.encodeUtf8(t)),new b.ByteBuffer(t)};b.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};b.xorBytes=function(t,e,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=t.charCodeAt(s)^e.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n};b.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};b.bytesToHex=function(t){return b.createBuffer(t).toHex()};b.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var $e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ge=[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],Ua="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";b.encode64=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.length;)i=t.charCodeAt(a++),o=t.charCodeAt(a++),s=t.charCodeAt(a++),r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
4
- `,r=r.substr(e));return n+=r,n};b.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,o,s=0;s<t.length;)r=Ge[t.charCodeAt(s++)-43],n=Ge[t.charCodeAt(s++)-43],i=Ge[t.charCodeAt(s++)-43],o=Ge[t.charCodeAt(s++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),o!==64&&(e+=String.fromCharCode((i&3)<<6|o)));return e};b.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};b.decodeUtf8=function(t){return decodeURIComponent(escape(t))};b.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Na.encode,decode:Na.decode}};b.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};b.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};b.binary.hex.encode=b.bytesToHex;b.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,o=r;for(t.length&1&&(i=1,n[o++]=parseInt(t[0],16));i<t.length;i+=2)n[o++]=parseInt(t.substr(i,2),16);return e?o-r:n};b.binary.base64.encode=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.byteLength;)i=t[a++],o=t[a++],s=t[a++],r+=$e.charAt(i>>2),r+=$e.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=$e.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":$e.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
5
- `,r=r.substr(e));return n+=r,n};b.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,o,s,a,c=0,f=r;c<t.length;)i=Ge[t.charCodeAt(c++)-43],o=Ge[t.charCodeAt(c++)-43],s=Ge[t.charCodeAt(c++)-43],a=Ge[t.charCodeAt(c++)-43],n[f++]=i<<2|o>>4,s!==64&&(n[f++]=(o&15)<<4|s>>2,a!==64&&(n[f++]=(s&3)<<6|a));return e?f-r:n.subarray(0,f)};b.binary.base58.encode=function(t,e){return b.binary.baseN.encode(t,Ua,e)};b.binary.base58.decode=function(t,e){return b.binary.baseN.decode(t,Ua,e)};b.text={utf8:{},utf16:{}};b.text.utf8.encode=function(t,e,r){t=b.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};b.text.utf8.decode=function(t){return b.decodeUtf8(String.fromCharCode.apply(null,t))};b.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 o=r,s=r,a=0;a<t.length;++a)i[s++]=t.charCodeAt(a),o+=2;return e?o-r:n};b.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};b.deflate=function(t,e,r){if(e=b.decode64(t.deflate(b.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};b.inflate=function(t,e,r){var n=t.inflate(b.encode64(e)).rval;return n===null?null:b.decode64(n)};var uo=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=b.encode64(JSON.stringify(r)),n=t.setItem(e,r)),typeof n<"u"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},lo=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(b.decode64(r))),r},Ll=function(t,e,r,n){var i=lo(t,e);i===null&&(i={}),i[r]=n,uo(t,e,i)},Dl=function(t,e,r){var n=lo(t,e);return n!==null&&(n=r in n?n[r]:null),n},Pl=function(t,e,r){var n=lo(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),uo(t,e,n)}},kl=function(t,e){uo(t,e,null)},kn=function(t,e,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,o=!1,s=null;for(var a in r){i=r[a];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),o=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return n};b.setItem=function(t,e,r,n,i){kn(Ll,arguments,i)};b.getItem=function(t,e,r,n){return kn(Dl,arguments,n)};b.removeItem=function(t,e,r,n){kn(Pl,arguments,n)};b.clearItems=function(t,e,r){kn(kl,arguments,r)};b.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};b.format=function(t){for(var e=/%./g,r,n,i=0,o=[],s=0;r=e.exec(t);){n=t.substring(s,e.lastIndex-2),n.length>0&&o.push(n),s=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[i+++1]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(t.substring(s)),o.join("")};b.formatNumber=function(t,e,r,n){var i=t,o=isNaN(e=Math.abs(e))?2:e,s=r===void 0?",":r,a=n===void 0?".":n,c=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+a:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-f).toFixed(o).slice(2):"")};b.formatSize=function(t){return t>=1073741824?t=b.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=b.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=b.formatNumber(t/1024,0)+" KiB":t=b.formatNumber(t,0)+" bytes",t};b.bytesFromIP=function(t){return t.indexOf(".")!==-1?b.bytesFromIPv4(t):t.indexOf(":")!==-1?b.bytesFromIPv6(t):null};b.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=b.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};b.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(s){return s.length===0&&++e,!0});for(var r=(8-t.length+e)*2,n=b.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var o=b.hexToBytes(t[i]);o.length<2&&n.putByte(0),n.putBytes(o)}return n.getBytes()};b.bytesToIP=function(t){return t.length===4?b.bytesToIPv4(t):t.length===16?b.bytesToIPv6(t):null};b.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(".")};b.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var o=b.bytesToHex(t[i]+t[i+1]);o[0]==="0"&&o!=="0";)o=o.substr(1);if(o==="0"){var s=r[r.length-1],a=e.length;!s||a!==s.end+1?r.push({start:a,end:a}):(s.end=a,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(o)}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(":")};b.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in b&&!t.update)return e(null,b.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return b.cores=navigator.hardwareConcurrency,e(null,b.cores);if(typeof Worker>"u")return b.cores=1,e(null,b.cores);if(typeof Blob>"u")return b.cores=2,e(null,b.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){for(var a=Date.now(),c=a+4;Date.now()<c;);self.postMessage({st:a,et:c})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(s,a,c){if(a===0){var f=Math.floor(s.reduce(function(u,l){return u+l},0)/s.length);return b.cores=Math.max(1,f),URL.revokeObjectURL(r),e(null,b.cores)}i(c,function(u,l){s.push(o(c,l)),n(s,a-1,c)})}function i(s,a){for(var c=[],f=[],u=0;u<s;++u){var l=new Worker(r);l.addEventListener("message",function(p){if(f.push(p.data),f.length===s){for(var d=0;d<s;++d)c[d].terminate();a(null,f)}}),c.push(l)}for(var u=0;u<s;++u)c[u].postMessage(u)}function o(s,a){for(var c=[],f=0;f<s;++f)for(var u=a[f],l=c[f]=[],p=0;p<s;++p)if(f!==p){var d=a[p];(u.st>d.st&&u.st<d.et||d.st>u.st&&d.st<u.et)&&l.push(p)}return c.reduce(function(h,y){return Math.max(h,y.length)},0)}}});var Nn=ft((Og,Ka)=>{var fn=ct();fn.pki=fn.pki||{};var ho=Ka.exports=fn.pki.oids=fn.oids=fn.oids||{};function C(t,e){ho[t]=e,ho[e]=t}function nt(t,e){ho[t]=e}C("1.2.840.113549.1.1.1","rsaEncryption");C("1.2.840.113549.1.1.4","md5WithRSAEncryption");C("1.2.840.113549.1.1.5","sha1WithRSAEncryption");C("1.2.840.113549.1.1.7","RSAES-OAEP");C("1.2.840.113549.1.1.8","mgf1");C("1.2.840.113549.1.1.9","pSpecified");C("1.2.840.113549.1.1.10","RSASSA-PSS");C("1.2.840.113549.1.1.11","sha256WithRSAEncryption");C("1.2.840.113549.1.1.12","sha384WithRSAEncryption");C("1.2.840.113549.1.1.13","sha512WithRSAEncryption");C("1.3.101.112","EdDSA25519");C("1.2.840.10040.4.3","dsa-with-sha1");C("1.3.14.3.2.7","desCBC");C("1.3.14.3.2.26","sha1");C("1.3.14.3.2.29","sha1WithRSASignature");C("2.16.840.1.101.3.4.2.1","sha256");C("2.16.840.1.101.3.4.2.2","sha384");C("2.16.840.1.101.3.4.2.3","sha512");C("2.16.840.1.101.3.4.2.4","sha224");C("2.16.840.1.101.3.4.2.5","sha512-224");C("2.16.840.1.101.3.4.2.6","sha512-256");C("1.2.840.113549.2.2","md2");C("1.2.840.113549.2.5","md5");C("1.2.840.113549.1.7.1","data");C("1.2.840.113549.1.7.2","signedData");C("1.2.840.113549.1.7.3","envelopedData");C("1.2.840.113549.1.7.4","signedAndEnvelopedData");C("1.2.840.113549.1.7.5","digestedData");C("1.2.840.113549.1.7.6","encryptedData");C("1.2.840.113549.1.9.1","emailAddress");C("1.2.840.113549.1.9.2","unstructuredName");C("1.2.840.113549.1.9.3","contentType");C("1.2.840.113549.1.9.4","messageDigest");C("1.2.840.113549.1.9.5","signingTime");C("1.2.840.113549.1.9.6","counterSignature");C("1.2.840.113549.1.9.7","challengePassword");C("1.2.840.113549.1.9.8","unstructuredAddress");C("1.2.840.113549.1.9.14","extensionRequest");C("1.2.840.113549.1.9.20","friendlyName");C("1.2.840.113549.1.9.21","localKeyId");C("1.2.840.113549.1.9.22.1","x509Certificate");C("1.2.840.113549.1.12.10.1.1","keyBag");C("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");C("1.2.840.113549.1.12.10.1.3","certBag");C("1.2.840.113549.1.12.10.1.4","crlBag");C("1.2.840.113549.1.12.10.1.5","secretBag");C("1.2.840.113549.1.12.10.1.6","safeContentsBag");C("1.2.840.113549.1.5.13","pkcs5PBES2");C("1.2.840.113549.1.5.12","pkcs5PBKDF2");C("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");C("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");C("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");C("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");C("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");C("1.2.840.113549.2.7","hmacWithSHA1");C("1.2.840.113549.2.8","hmacWithSHA224");C("1.2.840.113549.2.9","hmacWithSHA256");C("1.2.840.113549.2.10","hmacWithSHA384");C("1.2.840.113549.2.11","hmacWithSHA512");C("1.2.840.113549.3.7","des-EDE3-CBC");C("2.16.840.1.101.3.4.1.2","aes128-CBC");C("2.16.840.1.101.3.4.1.22","aes192-CBC");C("2.16.840.1.101.3.4.1.42","aes256-CBC");C("2.5.4.3","commonName");C("2.5.4.4","surname");C("2.5.4.5","serialNumber");C("2.5.4.6","countryName");C("2.5.4.7","localityName");C("2.5.4.8","stateOrProvinceName");C("2.5.4.9","streetAddress");C("2.5.4.10","organizationName");C("2.5.4.11","organizationalUnitName");C("2.5.4.12","title");C("2.5.4.13","description");C("2.5.4.15","businessCategory");C("2.5.4.17","postalCode");C("2.5.4.42","givenName");C("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");C("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");C("2.16.840.1.113730.1.1","nsCertType");C("2.16.840.1.113730.1.13","nsComment");nt("2.5.29.1","authorityKeyIdentifier");nt("2.5.29.2","keyAttributes");nt("2.5.29.3","certificatePolicies");nt("2.5.29.4","keyUsageRestriction");nt("2.5.29.5","policyMapping");nt("2.5.29.6","subtreesConstraint");nt("2.5.29.7","subjectAltName");nt("2.5.29.8","issuerAltName");nt("2.5.29.9","subjectDirectoryAttributes");nt("2.5.29.10","basicConstraints");nt("2.5.29.11","nameConstraints");nt("2.5.29.12","policyConstraints");nt("2.5.29.13","basicConstraints");C("2.5.29.14","subjectKeyIdentifier");C("2.5.29.15","keyUsage");nt("2.5.29.16","privateKeyUsagePeriod");C("2.5.29.17","subjectAltName");C("2.5.29.18","issuerAltName");C("2.5.29.19","basicConstraints");nt("2.5.29.20","cRLNumber");nt("2.5.29.21","cRLReason");nt("2.5.29.22","expirationDate");nt("2.5.29.23","instructionCode");nt("2.5.29.24","invalidityDate");nt("2.5.29.25","cRLDistributionPoints");nt("2.5.29.26","issuingDistributionPoint");nt("2.5.29.27","deltaCRLIndicator");nt("2.5.29.28","issuingDistributionPoint");nt("2.5.29.29","certificateIssuer");nt("2.5.29.30","nameConstraints");C("2.5.29.31","cRLDistributionPoints");C("2.5.29.32","certificatePolicies");nt("2.5.29.33","policyMappings");nt("2.5.29.34","policyConstraints");C("2.5.29.35","authorityKeyIdentifier");nt("2.5.29.36","policyConstraints");C("2.5.29.37","extKeyUsage");nt("2.5.29.46","freshestCRL");nt("2.5.29.54","inhibitAnyPolicy");C("1.3.6.1.4.1.11129.2.4.2","timestampList");C("1.3.6.1.5.5.7.1.1","authorityInfoAccess");C("1.3.6.1.5.5.7.3.1","serverAuth");C("1.3.6.1.5.5.7.3.2","clientAuth");C("1.3.6.1.5.5.7.3.3","codeSigning");C("1.3.6.1.5.5.7.3.4","emailProtection");C("1.3.6.1.5.5.7.3.8","timeStamping")});var un=ft((Kg,Ma)=>{var ht=ct();wt();Nn();var N=Ma.exports=ht.asn1=ht.asn1||{};N.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};N.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};N.create=function(t,e,r,n,i){if(ht.util.isArray(n)){for(var o=[],s=0;s<n.length;++s)n[s]!==void 0&&o.push(n[s]);n=o}var a={tagClass:t,type:e,constructed:r,composed:r||ht.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(a.bitStringContents=i.bitStringContents,a.original=N.copy(a)),a};N.copy=function(t,e){var r;if(ht.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(N.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:N.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};N.equals=function(t,e,r){if(ht.util.isArray(t)){if(!ht.util.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;++n)if(!N.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&&N.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};N.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 cn(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 Nl=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var o=r&127;cn(t,e,o),n=t.getInt(o<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};N.fromDer=function(t,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=ht.util.createBuffer(t));var r=t.length(),n=Un(t,t.length(),0,e);if(e.parseAllBytes&&t.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=t.length(),i}return n};function Un(t,e,r,n){var i;cn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var c=Nl(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,l,p=(o&32)===32;if(p)if(u=[],c===void 0)for(;;){if(cn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Un(t,e,r+1,n)),e-=i-t.length()}else for(;c>0;)i=t.length(),u.push(Un(t,c,r+1,n)),e-=i-t.length(),c-=i-t.length();if(u===void 0&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&(l=t.bytes(c)),u===void 0&&n.decodeBitStrings&&s===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&c>1){var d=t.read,h=e,y=0;if(a===N.Type.BITSTRING&&(cn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Un(t,e,r+1,g),m=i-t.length();e-=m,a==N.Type.BITSTRING&&m++;var v=x.tagClass;m===c&&(v===N.Class.UNIVERSAL||v===N.Class.CONTEXT_SPECIFIC)&&(u=[x])}catch{}u===void 0&&(t.read=d,e=h)}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(a===N.Type.BMPSTRING)for(u="";c>0;c-=2)cn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(c),e-=c}var _=l===void 0?null:{bitStringContents:l};return N.create(s,a,p,u,_)}N.toDer=function(t){var e=ht.util.createBuffer(),r=t.tagClass|t.type,n=ht.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=N.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var o=0;o<t.value.length;++o)t.value[o]!==void 0&&n.putBuffer(N.toDer(t.value[o]))}else if(t.type===N.Type.BMPSTRING)for(var o=0;o<t.value.length;++o)n.putInt16(t.value.charCodeAt(o));else t.type===N.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&!(t.value.charCodeAt(1)&128)||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 s=n.length(),a="";do a+=String.fromCharCode(s&255),s=s>>>8;while(s>0);e.putByte(a.length|128);for(var o=a.length-1;o>=0;--o)e.putByte(a.charCodeAt(o))}return e.putBuffer(n),e};N.oidToDer=function(t){var e=t.split("."),r=ht.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,o,s,a=2;a<e.length;++a){n=!0,i=[],o=parseInt(e[a],10);do s=o&127,o=o>>>7,n||(s|=128),i.push(s),n=!1;while(o>0);for(var c=i.length-1;c>=0;--c)r.putByte(i[c])}return r};N.derToOid=function(t){var e;typeof t=="string"&&(t=ht.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};N.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),o=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var c=t.charAt(10),f=10;c!=="+"&&c!=="-"&&(a=parseInt(t.substr(10,2),10),f+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,0),f&&(c=t.charAt(f),c==="+"||c==="-")){var u=parseInt(t.substr(f+1,2),10),l=parseInt(t.substr(f+4,2),10),p=u*60+l;p*=6e4,c==="+"?e.setTime(+e-p):e.setTime(+e+p)}return e};N.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),o=parseInt(t.substr(8,2),10),s=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),c=0,f=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var l=t.length-5,p=t.charAt(l);if(p==="+"||p==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);f=d*60+h,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(o,s,a,c),e.setTime(+e+f)):(e.setFullYear(r,n,i),e.setHours(o,s,a,c)),e};N.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};N.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};N.integerToDer=function(t){var e=ht.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};N.derToInteger=function(t){typeof t=="string"&&(t=ht.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)};N.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass>"u")&&(t.type===e.type||typeof e.type>"u"))if(t.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&ht.util.isArray(e.value))for(var o=0,s=0;i&&s<e.value.length;++s)i=e.value[s].optional||!1,t.value[o]&&(i=N.validate(t.value[o],e.value[s],r,n),i?++o:e.value[s].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 a;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 Fa=/[^\\u0000-\\u00ff]/;N.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
6
- `);for(var i="",o=0;o<e*r;++o)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case N.Class.UNIVERSAL:n+="Universal:";break;case N.Class.APPLICATION:n+="Application:";break;case N.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case N.Class.PRIVATE:n+="Private:";break}if(t.tagClass===N.Class.UNIVERSAL)switch(n+=t.type,t.type){case N.Type.NONE:n+=" (None)";break;case N.Type.BOOLEAN:n+=" (Boolean)";break;case N.Type.INTEGER:n+=" (Integer)";break;case N.Type.BITSTRING:n+=" (Bit string)";break;case N.Type.OCTETSTRING:n+=" (Octet string)";break;case N.Type.NULL:n+=" (Null)";break;case N.Type.OID:n+=" (Object Identifier)";break;case N.Type.ODESC:n+=" (Object Descriptor)";break;case N.Type.EXTERNAL:n+=" (External or Instance of)";break;case N.Type.REAL:n+=" (Real)";break;case N.Type.ENUMERATED:n+=" (Enumerated)";break;case N.Type.EMBEDDED:n+=" (Embedded PDV)";break;case N.Type.UTF8:n+=" (UTF8)";break;case N.Type.ROID:n+=" (Relative Object Identifier)";break;case N.Type.SEQUENCE:n+=" (Sequence)";break;case N.Type.SET:n+=" (Set)";break;case N.Type.PRINTABLESTRING:n+=" (Printable String)";break;case N.Type.IA5String:n+=" (IA5String (ASCII))";break;case N.Type.UTCTIME:n+=" (UTC time)";break;case N.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case N.Type.BMPSTRING:n+=" (BMP String)";break}else n+=t.type;if(n+=`
2
+ "use strict";var Libp2PAutonat=(()=>{var bl=Object.create;var zn=Object.defineProperty;var vl=Object.getOwnPropertyDescriptor;var wl=Object.getOwnPropertyNames;var El=Object.getPrototypeOf,Sl=Object.prototype.hasOwnProperty;var ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nt=(t,e)=>{for(var r in e)zn(t,r,{get:e[r],enumerable:!0})},za=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of wl(e))!Sl.call(t,i)&&i!==r&&zn(t,i,{get:()=>e[i],enumerable:!(n=vl(e,i))||n.enumerable});return t};var Ot=(t,e,r)=>(r=t!=null?bl(El(t)):{},za(e||!t||!t.__esModule?zn(r,"default",{value:t,enumerable:!0}):r,t)),Al=t=>za(zn({},"__esModule",{value:!0}),t);var ut=ft((Qm,p0)=>{p0.exports={options:{usePureJavaScript:!1}}});var x0=ft((Xm,g0)=>{var Ao={};g0.exports=Ao;var y0={};Ao.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=Dh(t,e);else{var i=0,o=e.length,s=e.charAt(0),a=[0];for(i=0;i<t.length;++i){for(var f=0,c=t[i];f<a.length;++f)c+=a[f]<<8,a[f]=c%o,c=c/o|0;for(;c>0;)a.push(c%o),c=c/o|0}for(i=0;t[i]===0&&i<t.length-1;++i)n+=s;for(i=a.length-1;i>=0;--i)n+=e[a[i]]}if(r){var u=new RegExp(".{1,"+r+"}","g");n=n.match(u).join(`\r
3
+ `)}return n};Ao.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=y0[e];if(!r){r=y0[e]=[];for(var n=0;n<e.length;++n)r[e.charCodeAt(n)]=n}t=t.replace(/\s/g,"");for(var i=e.length,o=e.charAt(0),s=[0],n=0;n<t.length;n++){var a=r[t.charCodeAt(n)];if(a===void 0)return;for(var f=0,c=a;f<s.length;++f)c+=s[f]*i,s[f]=c&255,c>>=8;for(;c>0;)s.push(c&255),c>>=8}for(var u=0;t[u]===o&&u<t.length-1;++u)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function Dh(t,e){var r=0,n=e.length,i=e.charAt(0),o=[0];for(r=0;r<t.length();++r){for(var s=0,a=t.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.push(a%n),a=a/n|0}var f="";for(r=0;t.at(r)===0&&r<t.length()-1;++r)f+=i;for(r=o.length-1;r>=0;--r)f+=e[o[r]];return f}});var St=ft((Jm,w0)=>{var m0=ut(),b0=x0(),v=w0.exports=m0.util=m0.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){v.nextTick=process.nextTick,typeof setImmediate=="function"?v.setImmediate=setImmediate:v.setImmediate=v.nextTick;return}if(typeof setImmediate=="function"){v.setImmediate=function(){return setImmediate.apply(void 0,arguments)},v.nextTick=function(a){return setImmediate(a)};return}if(v.setImmediate=function(a){setTimeout(a,0)},typeof window<"u"&&typeof window.postMessage=="function"){let a=function(f){if(f.source===window&&f.data===t){f.stopPropagation();var c=e.slice();e.length=0,c.forEach(function(u){u()})}};var s=a,t="forge.setImmediate",e=[];v.setImmediate=function(f){e.push(f),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",a,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),n=!0,i=document.createElement("div"),e=[];new MutationObserver(function(){var f=e.slice();e.length=0,f.forEach(function(c){c()})}).observe(i,{attributes:!0});var o=v.setImmediate;v.setImmediate=function(f){Date.now()-r>15?(r=Date.now(),o(f)):(e.push(f),e.length===1&&i.setAttribute("a",n=!n))}}v.nextTick=v.setImmediate})();v.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;v.globalScope=function(){return v.isNodejs?globalThis:typeof self>"u"?window:self}();v.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};v.isArrayBuffer=function(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer};v.isArrayBufferView=function(t){return t&&v.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function mn(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=Bo;function Bo(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(v.isArrayBuffer(t)||v.isArrayBufferView(t))if(typeof Buffer<"u"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof Bo||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=Bo;var Ph=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>Ph&&(this.data.substr(0,1),this._constructedStringLength=0)};v.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};v.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};v.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};v.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};v.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};v.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(v.encodeUtf8(t))};v.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};v.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};v.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))};v.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};v.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};v.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))};v.ByteStringBuffer.prototype.putInt=function(t,e){mn(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};v.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)};v.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())};v.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};v.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t};v.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};v.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};v.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t};v.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};v.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};v.ByteStringBuffer.prototype.getInt=function(t){mn(t);var e=0;do e=(e<<8)+this.data.charCodeAt(this.read++),t-=8;while(t>0);return e};v.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.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};v.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};v.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};v.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};v.ByteStringBuffer.prototype.copy=function(){var t=v.createBuffer(this.data);return t.read=this.read,t};v.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};v.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};v.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};v.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};v.ByteStringBuffer.prototype.toString=function(){return v.decodeUtf8(this.bytes())};function Nh(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=v.isArrayBuffer(t),n=v.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)}v.DataBuffer=Nh;v.DataBuffer.prototype.length=function(){return this.write-this.read};v.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};v.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};v.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};v.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this};v.DataBuffer.prototype.putBytes=function(t,e){if(v.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(v.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 v.DataBuffer||typeof t=="object"&&typeof t.read=="number"&&typeof t.write=="number"&&v.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 v.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary",typeof t=="string"){var o;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.hex.decode(t,o,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.base64.decode(t,o,this.write),this;if(e==="utf8"&&(t=v.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),o=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.raw.decode(o),this;if(e==="utf16")return this.accommodate(t.length*2),o=new Uint16Array(this.data.buffer,this.write),this.write+=v.text.utf16.encode(o),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)};v.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this};v.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")};v.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this};v.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};v.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};v.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};v.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};v.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};v.DataBuffer.prototype.putInt=function(t,e){mn(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};v.DataBuffer.prototype.putSignedInt=function(t,e){return mn(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)};v.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};v.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t};v.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t};v.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t};v.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t};v.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t};v.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t};v.DataBuffer.prototype.getInt=function(t){mn(t);var e=0;do e=(e<<8)+this.data.getInt8(this.read++),t-=8;while(t>0);return e};v.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e};v.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};v.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};v.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};v.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};v.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};v.DataBuffer.prototype.copy=function(){return new v.DataBuffer(this)};v.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};v.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};v.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};v.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};v.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if(t=t||"utf8",t==="binary"||t==="raw")return v.binary.raw.encode(e);if(t==="hex")return v.binary.hex.encode(e);if(t==="base64")return v.binary.base64.encode(e);if(t==="utf8")return v.text.utf8.decode(e);if(t==="utf16")return v.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)};v.createBuffer=function(t,e){return e=e||"raw",t!==void 0&&e==="utf8"&&(t=v.encodeUtf8(t)),new v.ByteBuffer(t)};v.fillString=function(t,e){for(var r="";e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};v.xorBytes=function(t,e,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=t.charCodeAt(s)^e.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o,n};v.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};v.bytesToHex=function(t){return v.createBuffer(t).toHex()};v.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Qe=[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],v0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";v.encode64=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.length;)i=t.charCodeAt(a++),o=t.charCodeAt(a++),s=t.charCodeAt(a++),r+=Ze.charAt(i>>2),r+=Ze.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=Ze.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":Ze.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
4
+ `,r=r.substr(e));return n+=r,n};v.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,o,s=0;s<t.length;)r=Qe[t.charCodeAt(s++)-43],n=Qe[t.charCodeAt(s++)-43],i=Qe[t.charCodeAt(s++)-43],o=Qe[t.charCodeAt(s++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),o!==64&&(e+=String.fromCharCode((i&3)<<6|o)));return e};v.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};v.decodeUtf8=function(t){return decodeURIComponent(escape(t))};v.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:b0.encode,decode:b0.decode}};v.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};v.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.binary.hex.encode=v.bytesToHex;v.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,o=r;for(t.length&1&&(i=1,n[o++]=parseInt(t[0],16));i<t.length;i+=2)n[o++]=parseInt(t.substr(i,2),16);return e?o-r:n};v.binary.base64.encode=function(t,e){for(var r="",n="",i,o,s,a=0;a<t.byteLength;)i=t[a++],o=t[a++],s=t[a++],r+=Ze.charAt(i>>2),r+=Ze.charAt((i&3)<<4|o>>4),isNaN(o)?r+="==":(r+=Ze.charAt((o&15)<<2|s>>6),r+=isNaN(s)?"=":Ze.charAt(s&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r
5
+ `,r=r.substr(e));return n+=r,n};v.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,o,s,a,f=0,c=r;f<t.length;)i=Qe[t.charCodeAt(f++)-43],o=Qe[t.charCodeAt(f++)-43],s=Qe[t.charCodeAt(f++)-43],a=Qe[t.charCodeAt(f++)-43],n[c++]=i<<2|o>>4,s!==64&&(n[c++]=(o&15)<<4|s>>2,a!==64&&(n[c++]=(s&3)<<6|a));return e?c-r:n.subarray(0,c)};v.binary.base58.encode=function(t,e){return v.binary.baseN.encode(t,v0,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,v0,e)};v.text={utf8:{},utf16:{}};v.text.utf8.encode=function(t,e,r){t=v.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,o=0;o<t.length;++o)n[i++]=t.charCodeAt(o);return e?i-r:n};v.text.utf8.decode=function(t){return v.decodeUtf8(String.fromCharCode.apply(null,t))};v.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 o=r,s=r,a=0;a<t.length;++a)i[s++]=t.charCodeAt(a),o+=2;return e?o-r:n};v.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))};v.deflate=function(t,e,r){if(e=v.decode64(t.deflate(v.encode64(e)).rval),r){var n=2,i=e.charCodeAt(1);i&32&&(n=6),e=e.substring(n,e.length-4)}return e};v.inflate=function(t,e,r){var n=t.inflate(v.encode64(e)).rval;return n===null?null:v.decode64(n)};var Io=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(r===null?n=t.removeItem(e):(r=v.encode64(JSON.stringify(r)),n=t.setItem(e,r)),typeof n<"u"&&n.rval!==!0){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},To=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(v.decode64(r))),r},kh=function(t,e,r,n){var i=To(t,e);i===null&&(i={}),i[r]=n,Io(t,e,i)},Uh=function(t,e,r){var n=To(t,e);return n!==null&&(n=r in n?n[r]:null),n},Oh=function(t,e,r){var n=To(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var o in n){i=!1;break}i&&(n=null),Io(t,e,n)}},Kh=function(t,e){Io(t,e,null)},Wn=function(t,e,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,o=!1,s=null;for(var a in r){i=r[a];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),o=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),o=!0)}catch(f){s=f}if(o)break}if(!o)throw s;return n};v.setItem=function(t,e,r,n,i){Wn(kh,arguments,i)};v.getItem=function(t,e,r,n){return Wn(Uh,arguments,n)};v.removeItem=function(t,e,r,n){Wn(Oh,arguments,n)};v.clearItems=function(t,e,r){Wn(Kh,arguments,r)};v.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};v.format=function(t){for(var e=/%./g,r,n,i=0,o=[],s=0;r=e.exec(t);){n=t.substring(s,e.lastIndex-2),n.length>0&&o.push(n),s=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[i+++1]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(t.substring(s)),o.join("")};v.formatNumber=function(t,e,r,n){var i=t,o=isNaN(e=Math.abs(e))?2:e,s=r===void 0?",":r,a=n===void 0?".":n,f=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",u=c.length>3?c.length%3:0;return f+(u?c.substr(0,u)+a:"")+c.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-c).toFixed(o).slice(2):"")};v.formatSize=function(t){return t>=1073741824?t=v.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=v.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=v.formatNumber(t/1024,0)+" KiB":t=v.formatNumber(t,0)+" bytes",t};v.bytesFromIP=function(t){return t.indexOf(".")!==-1?v.bytesFromIPv4(t):t.indexOf(":")!==-1?v.bytesFromIPv6(t):null};v.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=v.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()};v.bytesFromIPv6=function(t){var e=0;t=t.split(":").filter(function(s){return s.length===0&&++e,!0});for(var r=(8-t.length+e)*2,n=v.createBuffer(),i=0;i<8;++i){if(!t[i]||t[i].length===0){n.fillWithByte(0,r),r=0;continue}var o=v.hexToBytes(t[i]);o.length<2&&n.putByte(0),n.putBytes(o)}return n.getBytes()};v.bytesToIP=function(t){return t.length===4?v.bytesToIPv4(t):t.length===16?v.bytesToIPv6(t):null};v.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(".")};v.bytesToIPv6=function(t){if(t.length!==16)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var o=v.bytesToHex(t[i]+t[i+1]);o[0]==="0"&&o!=="0";)o=o.substr(1);if(o==="0"){var s=r[r.length-1],a=e.length;!s||a!==s.end+1?r.push({start:a,end:a}):(s.end=a,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(o)}if(r.length>0){var f=r[n];f.end-f.start>0&&(e.splice(f.start,f.end-f.start+1,""),f.start===0&&e.unshift(""),f.end===7&&e.push(""))}return e.join(":")};v.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in v&&!t.update)return e(null,v.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return v.cores=navigator.hardwareConcurrency,e(null,v.cores);if(typeof Worker>"u")return v.cores=1,e(null,v.cores);if(typeof Blob>"u")return v.cores=2,e(null,v.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){for(var a=Date.now(),f=a+4;Date.now()<f;);self.postMessage({st:a,et:f})})}.toString(),")()"],{type:"application/javascript"}));n([],5,16);function n(s,a,f){if(a===0){var c=Math.floor(s.reduce(function(u,l){return u+l},0)/s.length);return v.cores=Math.max(1,c),URL.revokeObjectURL(r),e(null,v.cores)}i(f,function(u,l){s.push(o(f,l)),n(s,a-1,f)})}function i(s,a){for(var f=[],c=[],u=0;u<s;++u){var l=new Worker(r);l.addEventListener("message",function(y){if(c.push(y.data),c.length===s){for(var d=0;d<s;++d)f[d].terminate();a(null,c)}}),f.push(l)}for(var u=0;u<s;++u)f[u].postMessage(u)}function o(s,a){for(var f=[],c=0;c<s;++c)for(var u=a[c],l=f[c]=[],y=0;y<s;++y)if(c!==y){var d=a[y];(u.st>d.st&&u.st<d.et||d.st>u.st&&d.st<u.et)&&l.push(y)}return f.reduce(function(h,p){return Math.max(h,p.length)},0)}}});var Yn=ft((jm,E0)=>{var bn=ut();bn.pki=bn.pki||{};var Co=E0.exports=bn.pki.oids=bn.oids=bn.oids||{};function R(t,e){Co[t]=e,Co[e]=t}function it(t,e){Co[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("1.3.14.3.2.29","sha1WithRSASignature");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("2.16.840.1.101.3.4.2.4","sha224");R("2.16.840.1.101.3.4.2.5","sha512-224");R("2.16.840.1.101.3.4.2.6","sha512-256");R("1.2.840.113549.2.2","md2");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.4","surname");R("2.5.4.5","serialNumber");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.12","title");R("2.5.4.13","description");R("2.5.4.15","businessCategory");R("2.5.4.17","postalCode");R("2.5.4.42","givenName");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");it("2.5.29.1","authorityKeyIdentifier");it("2.5.29.2","keyAttributes");it("2.5.29.3","certificatePolicies");it("2.5.29.4","keyUsageRestriction");it("2.5.29.5","policyMapping");it("2.5.29.6","subtreesConstraint");it("2.5.29.7","subjectAltName");it("2.5.29.8","issuerAltName");it("2.5.29.9","subjectDirectoryAttributes");it("2.5.29.10","basicConstraints");it("2.5.29.11","nameConstraints");it("2.5.29.12","policyConstraints");it("2.5.29.13","basicConstraints");R("2.5.29.14","subjectKeyIdentifier");R("2.5.29.15","keyUsage");it("2.5.29.16","privateKeyUsagePeriod");R("2.5.29.17","subjectAltName");R("2.5.29.18","issuerAltName");R("2.5.29.19","basicConstraints");it("2.5.29.20","cRLNumber");it("2.5.29.21","cRLReason");it("2.5.29.22","expirationDate");it("2.5.29.23","instructionCode");it("2.5.29.24","invalidityDate");it("2.5.29.25","cRLDistributionPoints");it("2.5.29.26","issuingDistributionPoint");it("2.5.29.27","deltaCRLIndicator");it("2.5.29.28","issuingDistributionPoint");it("2.5.29.29","certificateIssuer");it("2.5.29.30","nameConstraints");R("2.5.29.31","cRLDistributionPoints");R("2.5.29.32","certificatePolicies");it("2.5.29.33","policyMappings");it("2.5.29.34","policyConstraints");R("2.5.29.35","authorityKeyIdentifier");it("2.5.29.36","policyConstraints");R("2.5.29.37","extKeyUsage");it("2.5.29.46","freshestCRL");it("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 wn=ft((tb,A0)=>{var dt=ut();St();Yn();var k=A0.exports=dt.asn1=dt.asn1||{};k.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};k.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};k.create=function(t,e,r,n,i){if(dt.util.isArray(n)){for(var o=[],s=0;s<n.length;++s)n[s]!==void 0&&o.push(n[s]);n=o}var a={tagClass:t,type:e,constructed:r,composed:r||dt.util.isArray(n),value:n};return i&&"bitStringContents"in i&&(a.bitStringContents=i.bitStringContents,a.original=k.copy(a)),a};k.copy=function(t,e){var r;if(dt.util.isArray(t)){r=[];for(var n=0;n<t.length;++n)r.push(k.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:k.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)};k.equals=function(t,e,r){if(dt.util.isArray(t)){if(!dt.util.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;++n)if(!k.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&&k.equals(t.value,e.value);return r&&r.includeBitStringContents&&(i=i&&t.bitStringContents===e.bitStringContents),i};k.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 vn(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 Fh=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var o=r&127;vn(t,e,o),n=t.getInt(o<<3)}if(n<0)throw new Error("Negative length: "+n);return n}};k.fromDer=function(t,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=dt.util.createBuffer(t));var r=t.length(),n=Zn(t,t.length(),0,e);if(e.parseAllBytes&&t.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=t.length(),i}return n};function Zn(t,e,r,n){var i;vn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var f=Fh(t,e);if(e-=i-t.length(),f!==void 0&&f>e){if(n.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=t.length(),c.remaining=e,c.requested=f,c}f=e}var u,l,y=(o&32)===32;if(y)if(u=[],f===void 0)for(;;){if(vn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Zn(t,e,r+1,n)),e-=i-t.length()}else for(;f>0;)i=t.length(),u.push(Zn(t,f,r+1,n)),e-=i-t.length(),f-=i-t.length();if(u===void 0&&s===k.Class.UNIVERSAL&&a===k.Type.BITSTRING&&(l=t.bytes(f)),u===void 0&&n.decodeBitStrings&&s===k.Class.UNIVERSAL&&a===k.Type.BITSTRING&&f>1){var d=t.read,h=e,p=0;if(a===k.Type.BITSTRING&&(vn(t,e,1),p=t.getByte(),e--),p===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Zn(t,e,r+1,g),m=i-t.length();e-=m,a==k.Type.BITSTRING&&m++;var b=x.tagClass;m===f&&(b===k.Class.UNIVERSAL||b===k.Class.CONTEXT_SPECIFIC)&&(u=[x])}catch{}u===void 0&&(t.read=d,e=h)}if(u===void 0){if(f===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=e}if(a===k.Type.BMPSTRING)for(u="";f>0;f-=2)vn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(f),e-=f}var I=l===void 0?null:{bitStringContents:l};return k.create(s,a,y,u,I)}k.toDer=function(t){var e=dt.util.createBuffer(),r=t.tagClass|t.type,n=dt.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=k.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var o=0;o<t.value.length;++o)t.value[o]!==void 0&&n.putBuffer(k.toDer(t.value[o]))}else if(t.type===k.Type.BMPSTRING)for(var o=0;o<t.value.length;++o)n.putInt16(t.value.charCodeAt(o));else t.type===k.Type.INTEGER&&t.value.length>1&&(t.value.charCodeAt(0)===0&&!(t.value.charCodeAt(1)&128)||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 s=n.length(),a="";do a+=String.fromCharCode(s&255),s=s>>>8;while(s>0);e.putByte(a.length|128);for(var o=a.length-1;o>=0;--o)e.putByte(a.charCodeAt(o))}return e.putBuffer(n),e};k.oidToDer=function(t){var e=t.split("."),r=dt.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,o,s,a=2;a<e.length;++a){n=!0,i=[],o=parseInt(e[a],10);do s=o&127,o=o>>>7,n||(s|=128),i.push(s),n=!1;while(o>0);for(var f=i.length-1;f>=0;--f)r.putByte(i[f])}return r};k.derToOid=function(t){var e;typeof t=="string"&&(t=dt.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};k.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),o=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var f=t.charAt(10),c=10;f!=="+"&&f!=="-"&&(a=parseInt(t.substr(10,2),10),c+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,0),c&&(f=t.charAt(c),f==="+"||f==="-")){var u=parseInt(t.substr(c+1,2),10),l=parseInt(t.substr(c+4,2),10),y=u*60+l;y*=6e4,f==="+"?e.setTime(+e-y):e.setTime(+e+y)}return e};k.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),o=parseInt(t.substr(8,2),10),s=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),f=0,c=0,u=!1;t.charAt(t.length-1)==="Z"&&(u=!0);var l=t.length-5,y=t.charAt(l);if(y==="+"||y==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);c=d*60+h,c*=6e4,y==="+"&&(c*=-1),u=!0}return t.charAt(14)==="."&&(f=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(o,s,a,f),e.setTime(+e+c)):(e.setFullYear(r,n,i),e.setHours(o,s,a,f)),e};k.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};k.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};k.integerToDer=function(t){var e=dt.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};k.derToInteger=function(t){typeof t=="string"&&(t=dt.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)};k.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass>"u")&&(t.type===e.type||typeof e.type>"u"))if(t.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&dt.util.isArray(e.value))for(var o=0,s=0;i&&s<e.value.length;++s)i=e.value[s].optional||!1,t.value[o]&&(i=k.validate(t.value[o],e.value[s],r,n),i?++o:e.value[s].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 a;if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{var f=t.bitStringContents.charCodeAt(0);if(f!==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 S0=/[^\\u0000-\\u00ff]/;k.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
6
+ `);for(var i="",o=0;o<e*r;++o)i+=" ";switch(n+=i+"Tag: ",t.tagClass){case k.Class.UNIVERSAL:n+="Universal:";break;case k.Class.APPLICATION:n+="Application:";break;case k.Class.CONTEXT_SPECIFIC:n+="Context-Specific:";break;case k.Class.PRIVATE:n+="Private:";break}if(t.tagClass===k.Class.UNIVERSAL)switch(n+=t.type,t.type){case k.Type.NONE:n+=" (None)";break;case k.Type.BOOLEAN:n+=" (Boolean)";break;case k.Type.INTEGER:n+=" (Integer)";break;case k.Type.BITSTRING:n+=" (Bit string)";break;case k.Type.OCTETSTRING:n+=" (Octet string)";break;case k.Type.NULL:n+=" (Null)";break;case k.Type.OID:n+=" (Object Identifier)";break;case k.Type.ODESC:n+=" (Object Descriptor)";break;case k.Type.EXTERNAL:n+=" (External or Instance of)";break;case k.Type.REAL:n+=" (Real)";break;case k.Type.ENUMERATED:n+=" (Enumerated)";break;case k.Type.EMBEDDED:n+=" (Embedded PDV)";break;case k.Type.UTF8:n+=" (UTF8)";break;case k.Type.ROID:n+=" (Relative Object Identifier)";break;case k.Type.SEQUENCE:n+=" (Sequence)";break;case k.Type.SET:n+=" (Set)";break;case k.Type.PRINTABLESTRING:n+=" (Printable String)";break;case k.Type.IA5String:n+=" (IA5String (ASCII))";break;case k.Type.UTCTIME:n+=" (UTC time)";break;case k.Type.GENERALIZEDTIME:n+=" (Generalized time)";break;case k.Type.BMPSTRING:n+=" (BMP String)";break}else n+=t.type;if(n+=`
7
7
  `,n+=i+"Constructed: "+t.constructed+`
8
- `,t.composed){for(var s=0,a="",o=0;o<t.value.length;++o)t.value[o]!==void 0&&(s+=1,a+=N.prettyPrint(t.value[o],e+1,r),o+1<t.value.length&&(a+=","));n+=i+"Sub values: "+s+a}else{if(n+=i+"Value: ",t.type===N.Type.OID){var c=N.derToOid(t.value);n+=c,ht.pki&&ht.pki.oids&&c in ht.pki.oids&&(n+=" ("+ht.pki.oids[c]+") ")}if(t.type===N.Type.INTEGER)try{n+=N.derToInteger(t.value)}catch{n+="0x"+ht.util.bytesToHex(t.value)}else if(t.type===N.Type.BITSTRING){if(t.value.length>1?n+="0x"+ht.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 if(t.type===N.Type.OCTETSTRING)Fa.test(t.value)||(n+="("+t.value+") "),n+="0x"+ht.util.bytesToHex(t.value);else if(t.type===N.Type.UTF8)try{n+=ht.util.decodeUtf8(t.value)}catch(u){if(u.message==="URI malformed")n+="0x"+ht.util.bytesToHex(t.value)+" (malformed UTF8)";else throw u}else t.type===N.Type.PRINTABLESTRING||t.type===N.Type.IA5String?n+=t.value:Fa.test(t.value)?n+="0x"+ht.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var yo=ft((Fg,Va)=>{var Tt=ct();wt();Va.exports=Tt.cipher=Tt.cipher||{};Tt.cipher.algorithms=Tt.cipher.algorithms||{};Tt.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Tt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Tt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Tt.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Tt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Tt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Tt.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Tt.cipher.algorithms[t]=e};Tt.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Tt.cipher.algorithms?Tt.cipher.algorithms[t]:null};var po=Tt.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)};po.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=Tt.util.createBuffer(),this.output=t.output||Tt.util.createBuffer(),this.mode.start(e)};po.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()};po.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 xo=ft((Mg,qa)=>{var Ct=ct();wt();Ct.cipher=Ct.cipher||{};var Q=qa.exports=Ct.cipher.modes=Ct.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=On(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=Ct.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=Ct.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=Ct.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=On(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Kn(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=Ct.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=Ct.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Ct.util.createBuffer(t.additionalData):r=Ct.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Ct.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(go(n*8)))}this._inBlock=this._j0.slice(0),Kn(this._inBlock),this._partialBytes=0,r=Ct.util.createBuffer(r),this._aDataLength=go(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}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),o>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Kn(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),Kn(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=Ct.util.createBuffer();var n=this._aDataLength.concat(go(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^i[o]);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 o=t[i/32|0]&1<<31-i%32;o&&(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,o=this._m[r][i];e[0]^=o[0],e[1]^=o[1],e[2]^=o[2],e[3]^=o[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,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=s/n|0,f=(n-1-s%n)*e;a[c]=1<<e-1<<f,o[s]=this.generateSubHashTable(this.multiply(a,t),e)}return o};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 o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var f=i[o^n];i[o]=[t[0]^f[0],t[1]^f[1],t[2]^f[2],t[3]^f[3]]}return i};function On(t,e){if(typeof t=="string"&&(t=Ct.util.createBuffer(t)),Ct.util.isArray(t)&&t.length>4){var r=t;t=Ct.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(!Ct.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Kn(t){t[t.length-1]=t[t.length-1]+1&4294967295}function go(t){return[t/4294967296|0,t&4294967295]}});var wo=ft((Vg,Ga)=>{var lt=ct();yo();xo();wt();Ga.exports=lt.aes=lt.aes||{};lt.aes.startEncrypting=function(t,e,r,n){var i=Fn({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};lt.aes.createEncryptionCipher=function(t,e){return Fn({key:t,output:null,decrypt:!1,mode:e})};lt.aes.startDecrypting=function(t,e,r,n){var i=Fn({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};lt.aes.createDecryptionCipher=function(t,e){return Fn({key:t,output:null,decrypt:!0,mode:e})};lt.aes.Algorithm=function(t,e){vo||za();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return bo(r._w,n,i,!1)},decrypt:function(n,i){return bo(r._w,n,i,!0)}}}),r._init=!1};lt.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=lt.util.createBuffer(e);else if(lt.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=lt.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!lt.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(!lt.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var o=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(o)!==-1;this._w=$a(e,t.decrypt&&!s),this._init=!0}};lt.aes._expandKey=function(t,e){return vo||za(),$a(t,e)};lt.aes._updateBlock=bo;Pr("AES-ECB",lt.cipher.modes.ecb);Pr("AES-CBC",lt.cipher.modes.cbc);Pr("AES-CFB",lt.cipher.modes.cfb);Pr("AES-OFB",lt.cipher.modes.ofb);Pr("AES-CTR",lt.cipher.modes.ctr);Pr("AES-GCM",lt.cipher.modes.gcm);function Pr(t,e){var r=function(){return new lt.aes.Algorithm(t,e)};lt.cipher.registerAlgorithm(t,r)}var vo=!1,Dr=4,Ft,mo,Ha,ar,ne;function za(){vo=!0,Ha=[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;Ft=new Array(256),mo=new Array(256),ar=new Array(4),ne=new Array(4);for(var e=0;e<4;++e)ar[e]=new Array(256),ne[e]=new Array(256);for(var r=0,n=0,i,o,s,a,c,f,u,e=0;e<256;++e){a=n^n<<1^n<<2^n<<3^n<<4,a=a>>8^a&255^99,Ft[r]=a,mo[a]=r,c=t[a],i=t[r],o=t[i],s=t[o],f=c<<24^a<<16^a<<8^(a^c),u=(i^o^s)<<24^(r^s)<<16^(r^o^s)<<8^(r^i^s);for(var l=0;l<4;++l)ar[l][r]=f,ne[l][a]=u,f=f<<24|f>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^s]]],n^=t[t[n]])}}function $a(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Dr*s,c=o;c<a;++c)n=r[c-1],c%o===0?(n=Ft[n>>>16&255]<<24^Ft[n>>>8&255]<<16^Ft[n&255]<<8^Ft[n>>>24]^Ha[i]<<24,i++):o>6&&c%o===4&&(n=Ft[n>>>24]<<24^Ft[n>>>16&255]<<16^Ft[n>>>8&255]<<8^Ft[n&255]),r[c]=r[c-o]^n;if(e){var f,u=ne[0],l=ne[1],p=ne[2],d=ne[3],h=r.slice(0);a=r.length;for(var c=0,y=a-Dr;c<a;c+=Dr,y-=Dr)if(c===0||c===a-Dr)h[c]=r[y],h[c+1]=r[y+3],h[c+2]=r[y+2],h[c+3]=r[y+1];else for(var g=0;g<Dr;++g)f=r[y+g],h[c+(3&-g)]=u[Ft[f>>>24]]^l[Ft[f>>>16&255]]^p[Ft[f>>>8&255]]^d[Ft[f&255]];r=h}return r}function bo(t,e,r,n){var i=t.length/4-1,o,s,a,c,f;n?(o=ne[0],s=ne[1],a=ne[2],c=ne[3],f=mo):(o=ar[0],s=ar[1],a=ar[2],c=ar[3],f=Ft);var u,l,p,d,h,y,g;u=e[0]^t[0],l=e[n?3:1]^t[1],p=e[2]^t[2],d=e[n?1:3]^t[3];for(var x=3,m=1;m<i;++m)h=o[u>>>24]^s[l>>>16&255]^a[p>>>8&255]^c[d&255]^t[++x],y=o[l>>>24]^s[p>>>16&255]^a[d>>>8&255]^c[u&255]^t[++x],g=o[p>>>24]^s[d>>>16&255]^a[u>>>8&255]^c[l&255]^t[++x],d=o[d>>>24]^s[u>>>16&255]^a[l>>>8&255]^c[p&255]^t[++x],u=h,l=y,p=g;r[0]=f[u>>>24]<<24^f[l>>>16&255]<<16^f[p>>>8&255]<<8^f[d&255]^t[++x],r[n?3:1]=f[l>>>24]<<24^f[p>>>16&255]<<16^f[d>>>8&255]<<8^f[u&255]^t[++x],r[2]=f[p>>>24]<<24^f[d>>>16&255]<<16^f[u>>>8&255]<<8^f[l&255]^t[++x],r[n?1:3]=f[d>>>24]<<24^f[u>>>16&255]<<16^f[l>>>8&255]<<8^f[p&255]^t[++x]}function Fn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=lt.cipher.createDecipher(r,t.key):n=lt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof lt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var Za=ft((qg,Ya)=>{var pt=ct();yo();xo();wt();Ya.exports=pt.des=pt.des||{};pt.des.startEncrypting=function(t,e,r,n){var i=Mn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};pt.des.createEncryptionCipher=function(t,e){return Mn({key:t,output:null,decrypt:!1,mode:e})};pt.des.startDecrypting=function(t,e,r,n){var i=Mn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};pt.des.createDecryptionCipher=function(t,e){return Mn({key:t,output:null,decrypt:!0,mode:e})};pt.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return Wa(r._keys,n,i,!1)},decrypt:function(n,i){return Wa(r._keys,n,i,!0)}}}),r._init=!1};pt.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=pt.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=zl(e),this._init=!0}};ge("DES-ECB",pt.cipher.modes.ecb);ge("DES-CBC",pt.cipher.modes.cbc);ge("DES-CFB",pt.cipher.modes.cfb);ge("DES-OFB",pt.cipher.modes.ofb);ge("DES-CTR",pt.cipher.modes.ctr);ge("3DES-ECB",pt.cipher.modes.ecb);ge("3DES-CBC",pt.cipher.modes.cbc);ge("3DES-CFB",pt.cipher.modes.cfb);ge("3DES-OFB",pt.cipher.modes.ofb);ge("3DES-CTR",pt.cipher.modes.ctr);function ge(t,e){var r=function(){return new pt.des.Algorithm(t,e)};pt.cipher.registerAlgorithm(t,r)}var Ul=[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],Ol=[-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],Kl=[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],Fl=[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],Ml=[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],Vl=[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],ql=[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],Hl=[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 zl(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],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[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],l=[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],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=t.length()>8?3:1,g=[],x=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],m=0,v,_=0;_<y;_++){var E=t.getInt32(),S=t.getInt32();v=(E>>>4^S)&252645135,S^=v,E^=v<<4,v=(S>>>-16^E)&65535,E^=v,S^=v<<-16,v=(E>>>2^S)&858993459,S^=v,E^=v<<2,v=(S>>>-16^E)&65535,E^=v,S^=v<<-16,v=(E>>>1^S)&1431655765,S^=v,E^=v<<1,v=(S>>>8^E)&16711935,E^=v,S^=v<<8,v=(E>>>1^S)&1431655765,S^=v,E^=v<<1,v=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=v;for(var L=0;L<x.length;++L){x[L]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var D=e[E>>>28]|r[E>>>24&15]|n[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|s[E>>>8&15]|a[E>>>4&15],H=c[S>>>28]|f[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];v=(H>>>16^D)&65535,g[m++]=D^v,g[m++]=H^v<<16}}return g}function Wa(t,e,r,n){var i=t.length===32?3:9,o;i===3?o=n?[30,-2,-2]:[0,32,2]:o=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,a=e[0],c=e[1];s=(a>>>4^c)&252645135,c^=s,a^=s<<4,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,a=a<<1|a>>>31,c=c<<1|c>>>31;for(var f=0;f<i;f+=3){for(var u=o[f+1],l=o[f+2],p=o[f];p!=u;p+=l){var d=c^t[p],h=(c>>>4|c<<28)^t[p+1];s=a,a=c,c=s^(Ol[d>>>24&63]|Fl[d>>>16&63]|Vl[d>>>8&63]|Hl[d&63]|Ul[h>>>24&63]|Kl[h>>>16&63]|Ml[h>>>8&63]|ql[h&63])}s=a,a=c,c=s}a=a>>>1|a<<31,c=c>>>1|c<<31,s=(a>>>1^c)&1431655765,c^=s,a^=s<<1,s=(c>>>8^a)&16711935,a^=s,c^=s<<8,s=(c>>>2^a)&858993459,a^=s,c^=s<<2,s=(a>>>16^c)&65535,c^=s,a^=s<<16,s=(a>>>4^c)&252645135,c^=s,a^=s<<4,r[0]=a,r[1]=c}function Mn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=pt.cipher.createDecipher(r,t.key):n=pt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof pt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var fr=ft((Hg,Qa)=>{var Vn=ct();Qa.exports=Vn.md=Vn.md||{};Vn.md.algorithms=Vn.md.algorithms||{}});var Ja=ft((zg,Xa)=>{var Ie=ct();fr();wt();var $l=Xa.exports=Ie.hmac=Ie.hmac||{};$l.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(o,s){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in Ie.md.algorithms)e=Ie.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else e=o;if(s===null)s=t;else{if(typeof s=="string")s=Ie.util.createBuffer(s);else if(Ie.util.isArray(s)){var a=s;s=Ie.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var f=s.length();f>e.blockLength&&(e.start(),e.update(s.bytes()),s=e.digest()),r=Ie.util.createBuffer(),n=Ie.util.createBuffer(),f=s.length();for(var c=0;c<f;++c){var a=s.at(c);r.putByte(54^a),n.putByte(92^a)}if(f<e.blockLength)for(var a=e.blockLength-f,c=0;c<a;++c)r.putByte(54),n.putByte(92);t=s,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(o){e.update(o)},i.getMac=function(){var o=e.digest().bytes();return e.start(),e.update(n),e.update(o),e.digest()},i.digest=i.getMac,i}});var qn=ft(()=>{});var t0=ft((Wg,ja)=>{var Mt=ct();Ja();fr();wt();var Gl=Mt.pkcs5=Mt.pkcs5||{},Te;Mt.util.isNodejs&&!Mt.options.usePureJavaScript&&(Te=qn());ja.exports=Mt.pbkdf2=Gl.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),Mt.util.isNodejs&&!Mt.options.usePureJavaScript&&Te.pbkdf2&&(i===null||typeof i!="object")&&(Te.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?Te.pbkdf2Sync.length===4?Te.pbkdf2(t,e,r,n,function(v,_){if(v)return o(v);o(null,_.toString("binary"))}):Te.pbkdf2(t,e,r,n,i,function(v,_){if(v)return o(v);o(null,_.toString("binary"))}):Te.pbkdf2Sync.length===4?Te.pbkdf2Sync(t,e,r,n).toString("binary"):Te.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in Mt.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=Mt.md[i].create()}var s=i.digestLength;if(n>4294967295*s){var a=new Error("Derived key is too long.");if(o)return o(a);throw a}var c=Math.ceil(n/s),f=n-(c-1)*s,u=Mt.hmac.create();u.start(i,t);var l="",p,d,h;if(!o){for(var y=1;y<=c;++y){u.start(null,null),u.update(e),u.update(Mt.util.int32ToBytes(y)),p=h=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(h),d=u.digest().getBytes(),p=Mt.util.xorBytes(p,d,s),h=d;l+=y<c?p:p.substr(0,f)}return l}var y=1,g;function x(){if(y>c)return o(null,l);u.start(null,null),u.update(e),u.update(Mt.util.int32ToBytes(y)),p=h=u.digest().getBytes(),g=2,m()}function m(){if(g<=r)return u.start(null,null),u.update(h),d=u.digest().getBytes(),p=Mt.util.xorBytes(p,d,s),h=d,++g,Mt.util.setImmediate(m);l+=y<c?p:p.substr(0,f),++y,x()}x()}});var n0=ft((Yg,r0)=>{var zn=ct();wt();var e0=r0.exports=zn.pem=zn.pem||{};e0.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
9
- `,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=Hn(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Hn(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Hn(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Hn(t.headers[i]);return t.procType&&(r+=`\r
10
- `),r+=zn.util.encode64(t.body,e.maxline||64)+`\r
8
+ `,t.composed){for(var s=0,a="",o=0;o<t.value.length;++o)t.value[o]!==void 0&&(s+=1,a+=k.prettyPrint(t.value[o],e+1,r),o+1<t.value.length&&(a+=","));n+=i+"Sub values: "+s+a}else{if(n+=i+"Value: ",t.type===k.Type.OID){var f=k.derToOid(t.value);n+=f,dt.pki&&dt.pki.oids&&f in dt.pki.oids&&(n+=" ("+dt.pki.oids[f]+") ")}if(t.type===k.Type.INTEGER)try{n+=k.derToInteger(t.value)}catch{n+="0x"+dt.util.bytesToHex(t.value)}else if(t.type===k.Type.BITSTRING){if(t.value.length>1?n+="0x"+dt.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var c=t.value.charCodeAt(0);c==1?n+=" (1 unused bit shown)":c>1&&(n+=" ("+c+" unused bits shown)")}}else if(t.type===k.Type.OCTETSTRING)S0.test(t.value)||(n+="("+t.value+") "),n+="0x"+dt.util.bytesToHex(t.value);else if(t.type===k.Type.UTF8)try{n+=dt.util.decodeUtf8(t.value)}catch(u){if(u.message==="URI malformed")n+="0x"+dt.util.bytesToHex(t.value)+" (malformed UTF8)";else throw u}else t.type===k.Type.PRINTABLESTRING||t.type===k.Type.IA5String?n+=t.value:S0.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var _o=ft((eb,B0)=>{var Ct=ut();St();B0.exports=Ct.cipher=Ct.cipher||{};Ct.cipher.algorithms=Ct.cipher.algorithms||{};Ct.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Ct.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Ct.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Ct.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Ct.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Ct.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Ct.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Ct.cipher.algorithms[t]=e};Ct.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Ct.cipher.algorithms?Ct.cipher.algorithms[t]:null};var Ro=Ct.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)};Ro.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=Ct.util.createBuffer(),this.output=t.output||Ct.util.createBuffer(),this.mode.start(e)};Ro.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()};Ro.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 Do=ft((rb,I0)=>{var Rt=ut();St();Rt.cipher=Rt.cipher||{};var Q=I0.exports=Rt.cipher.modes=Rt.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=Qn(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=Rt.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Qn(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=Rt.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Qn(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>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),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!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=Rt.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Qn(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}Xn(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=Rt.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=Rt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Rt.util.createBuffer(t.additionalData):r=Rt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Rt.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(Lo(n*8)))}this._inBlock=this._j0.slice(0),Xn(this._inBlock),this._partialBytes=0,r=Rt.util.createBuffer(r),this._aDataLength=Lo(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 o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(o<=0||r){if(r){var s=n%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}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),o>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Xn(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),Xn(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=Rt.util.createBuffer();var n=this._aDataLength.concat(Lo(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^i[o]);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 o=t[i/32|0]&1<<31-i%32;o&&(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,o=this._m[r][i];e[0]^=o[0],e[1]^=o[1],e[2]^=o[2],e[3]^=o[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,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],f=s/n|0,c=(n-1-s%n)*e;a[f]=1<<e-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,t),e)}return o};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 o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],f=i[s];i[o+s]=[a[0]^f[0],a[1]^f[1],a[2]^f[2],a[3]^f[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var c=i[o^n];i[o]=[t[0]^c[0],t[1]^c[1],t[2]^c[2],t[3]^c[3]]}return i};function Qn(t,e){if(typeof t=="string"&&(t=Rt.util.createBuffer(t)),Rt.util.isArray(t)&&t.length>4){var r=t;t=Rt.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(!Rt.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Xn(t){t[t.length-1]=t[t.length-1]+1&4294967295}function Lo(t){return[t/4294967296|0,t&4294967295]}});var Uo=ft((nb,_0)=>{var ht=ut();_o();Do();St();_0.exports=ht.aes=ht.aes||{};ht.aes.startEncrypting=function(t,e,r,n){var i=Jn({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};ht.aes.createEncryptionCipher=function(t,e){return Jn({key:t,output:null,decrypt:!1,mode:e})};ht.aes.startDecrypting=function(t,e,r,n){var i=Jn({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};ht.aes.createDecryptionCipher=function(t,e){return Jn({key:t,output:null,decrypt:!0,mode:e})};ht.aes.Algorithm=function(t,e){ko||C0();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return No(r._w,n,i,!1)},decrypt:function(n,i){return No(r._w,n,i,!0)}}}),r._init=!1};ht.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=ht.util.createBuffer(e);else if(ht.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=ht.util.createBuffer();for(var n=0;n<r.length;++n)e.putByte(r[n])}if(!ht.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(!ht.util.isArray(e)||!(e.length===4||e.length===6||e.length===8))throw new Error("Invalid key parameter.");var o=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(o)!==-1;this._w=R0(e,t.decrypt&&!s),this._init=!0}};ht.aes._expandKey=function(t,e){return ko||C0(),R0(t,e)};ht.aes._updateBlock=No;Mr("AES-ECB",ht.cipher.modes.ecb);Mr("AES-CBC",ht.cipher.modes.cbc);Mr("AES-CFB",ht.cipher.modes.cfb);Mr("AES-OFB",ht.cipher.modes.ofb);Mr("AES-CTR",ht.cipher.modes.ctr);Mr("AES-GCM",ht.cipher.modes.gcm);function Mr(t,e){var r=function(){return new ht.aes.Algorithm(t,e)};ht.cipher.registerAlgorithm(t,r)}var ko=!1,Fr=4,Mt,Po,T0,hr,ie;function C0(){ko=!0,T0=[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;Mt=new Array(256),Po=new Array(256),hr=new Array(4),ie=new Array(4);for(var e=0;e<4;++e)hr[e]=new Array(256),ie[e]=new Array(256);for(var r=0,n=0,i,o,s,a,f,c,u,e=0;e<256;++e){a=n^n<<1^n<<2^n<<3^n<<4,a=a>>8^a&255^99,Mt[r]=a,Po[a]=r,f=t[a],i=t[r],o=t[i],s=t[o],c=f<<24^a<<16^a<<8^(a^f),u=(i^o^s)<<24^(r^s)<<16^(r^o^s)<<8^(r^i^s);for(var l=0;l<4;++l)hr[l][r]=c,ie[l][a]=u,c=c<<24|c>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^s]]],n^=t[t[n]])}}function R0(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Fr*s,f=o;f<a;++f)n=r[f-1],f%o===0?(n=Mt[n>>>16&255]<<24^Mt[n>>>8&255]<<16^Mt[n&255]<<8^Mt[n>>>24]^T0[i]<<24,i++):o>6&&f%o===4&&(n=Mt[n>>>24]<<24^Mt[n>>>16&255]<<16^Mt[n>>>8&255]<<8^Mt[n&255]),r[f]=r[f-o]^n;if(e){var c,u=ie[0],l=ie[1],y=ie[2],d=ie[3],h=r.slice(0);a=r.length;for(var f=0,p=a-Fr;f<a;f+=Fr,p-=Fr)if(f===0||f===a-Fr)h[f]=r[p],h[f+1]=r[p+3],h[f+2]=r[p+2],h[f+3]=r[p+1];else for(var g=0;g<Fr;++g)c=r[p+g],h[f+(3&-g)]=u[Mt[c>>>24]]^l[Mt[c>>>16&255]]^y[Mt[c>>>8&255]]^d[Mt[c&255]];r=h}return r}function No(t,e,r,n){var i=t.length/4-1,o,s,a,f,c;n?(o=ie[0],s=ie[1],a=ie[2],f=ie[3],c=Po):(o=hr[0],s=hr[1],a=hr[2],f=hr[3],c=Mt);var u,l,y,d,h,p,g;u=e[0]^t[0],l=e[n?3:1]^t[1],y=e[2]^t[2],d=e[n?1:3]^t[3];for(var x=3,m=1;m<i;++m)h=o[u>>>24]^s[l>>>16&255]^a[y>>>8&255]^f[d&255]^t[++x],p=o[l>>>24]^s[y>>>16&255]^a[d>>>8&255]^f[u&255]^t[++x],g=o[y>>>24]^s[d>>>16&255]^a[u>>>8&255]^f[l&255]^t[++x],d=o[d>>>24]^s[u>>>16&255]^a[l>>>8&255]^f[y&255]^t[++x],u=h,l=p,y=g;r[0]=c[u>>>24]<<24^c[l>>>16&255]<<16^c[y>>>8&255]<<8^c[d&255]^t[++x],r[n?3:1]=c[l>>>24]<<24^c[y>>>16&255]<<16^c[d>>>8&255]<<8^c[u&255]^t[++x],r[2]=c[y>>>24]<<24^c[d>>>16&255]<<16^c[u>>>8&255]<<8^c[l&255]^t[++x],r[n?1:3]=c[d>>>24]<<24^c[u>>>16&255]<<16^c[l>>>8&255]<<8^c[y&255]^t[++x]}function Jn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=ht.cipher.createDecipher(r,t.key):n=ht.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof ht.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var P0=ft((ib,D0)=>{var yt=ut();_o();Do();St();D0.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=jn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return jn({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=jn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return jn({key:t,output:null,decrypt:!0,mode:e})};yt.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return L0(r._keys,n,i,!1)},decrypt:function(n,i){return L0(r._keys,n,i,!0)}}}),r._init=!1};yt.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=yt.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=Yh(e),this._init=!0}};xe("DES-ECB",yt.cipher.modes.ecb);xe("DES-CBC",yt.cipher.modes.cbc);xe("DES-CFB",yt.cipher.modes.cfb);xe("DES-OFB",yt.cipher.modes.ofb);xe("DES-CTR",yt.cipher.modes.ctr);xe("3DES-ECB",yt.cipher.modes.ecb);xe("3DES-CBC",yt.cipher.modes.cbc);xe("3DES-CFB",yt.cipher.modes.cfb);xe("3DES-OFB",yt.cipher.modes.ofb);xe("3DES-CTR",yt.cipher.modes.ctr);function xe(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.cipher.registerAlgorithm(t,r)}var Mh=[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],Vh=[-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],qh=[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],zh=[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],Hh=[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],$h=[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],Gh=[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],Wh=[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 Yh(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],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[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],l=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],y=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],h=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],p=t.length()>8?3:1,g=[],x=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],m=0,b,I=0;I<p;I++){var E=t.getInt32(),S=t.getInt32();b=(E>>>4^S)&252645135,S^=b,E^=b<<4,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>2^S)&858993459,S^=b,E^=b<<2,b=(S>>>-16^E)&65535,E^=b,S^=b<<-16,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=(S>>>8^E)&16711935,E^=b,S^=b<<8,b=(E>>>1^S)&1431655765,S^=b,E^=b<<1,b=E<<8|S>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=b;for(var _=0;_<x.length;++_){x[_]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),E&=-15,S&=-15;var L=e[E>>>28]|r[E>>>24&15]|n[E>>>20&15]|i[E>>>16&15]|o[E>>>12&15]|s[E>>>8&15]|a[E>>>4&15],V=f[S>>>28]|c[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|y[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];b=(V>>>16^L)&65535,g[m++]=L^b,g[m++]=V^b<<16}}return g}function L0(t,e,r,n){var i=t.length===32?3:9,o;i===3?o=n?[30,-2,-2]:[0,32,2]:o=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,a=e[0],f=e[1];s=(a>>>4^f)&252645135,f^=s,a^=s<<4,s=(a>>>16^f)&65535,f^=s,a^=s<<16,s=(f>>>2^a)&858993459,a^=s,f^=s<<2,s=(f>>>8^a)&16711935,a^=s,f^=s<<8,s=(a>>>1^f)&1431655765,f^=s,a^=s<<1,a=a<<1|a>>>31,f=f<<1|f>>>31;for(var c=0;c<i;c+=3){for(var u=o[c+1],l=o[c+2],y=o[c];y!=u;y+=l){var d=f^t[y],h=(f>>>4|f<<28)^t[y+1];s=a,a=f,f=s^(Vh[d>>>24&63]|zh[d>>>16&63]|$h[d>>>8&63]|Wh[d&63]|Mh[h>>>24&63]|qh[h>>>16&63]|Hh[h>>>8&63]|Gh[h&63])}s=a,a=f,f=s}a=a>>>1|a<<31,f=f>>>1|f<<31,s=(a>>>1^f)&1431655765,f^=s,a^=s<<1,s=(f>>>8^a)&16711935,a^=s,f^=s<<8,s=(f>>>2^a)&858993459,a^=s,f^=s<<2,s=(a>>>16^f)&65535,f^=s,a^=s<<16,s=(a>>>4^f)&252645135,f^=s,a^=s<<4,r[0]=a,r[1]=f}function jn(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=yt.cipher.createDecipher(r,t.key):n=yt.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(o,s){var a=null;s instanceof yt.util.ByteBuffer&&(a=s,s={}),s=s||{},s.output=a,s.iv=o,i.call(n,s)},n}});var dr=ft((ob,N0)=>{var ti=ut();N0.exports=ti.md=ti.md||{};ti.md.algorithms=ti.md.algorithms||{}});var U0=ft((sb,k0)=>{var Re=ut();dr();St();var Zh=k0.exports=Re.hmac=Re.hmac||{};Zh.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(o,s){if(o!==null)if(typeof o=="string")if(o=o.toLowerCase(),o in Re.md.algorithms)e=Re.md.algorithms[o].create();else throw new Error('Unknown hash algorithm "'+o+'"');else e=o;if(s===null)s=t;else{if(typeof s=="string")s=Re.util.createBuffer(s);else if(Re.util.isArray(s)){var a=s;s=Re.util.createBuffer();for(var f=0;f<a.length;++f)s.putByte(a[f])}var c=s.length();c>e.blockLength&&(e.start(),e.update(s.bytes()),s=e.digest()),r=Re.util.createBuffer(),n=Re.util.createBuffer(),c=s.length();for(var f=0;f<c;++f){var a=s.at(f);r.putByte(54^a),n.putByte(92^a)}if(c<e.blockLength)for(var a=e.blockLength-c,f=0;f<a;++f)r.putByte(54),n.putByte(92);t=s,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(o){e.update(o)},i.getMac=function(){var o=e.digest().bytes();return e.start(),e.update(n),e.update(o),e.digest()},i.digest=i.getMac,i}});var ei=ft(()=>{});var K0=ft((fb,O0)=>{var Vt=ut();U0();dr();St();var Qh=Vt.pkcs5=Vt.pkcs5||{},_e;Vt.util.isNodejs&&!Vt.options.usePureJavaScript&&(_e=ei());O0.exports=Vt.pbkdf2=Qh.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),Vt.util.isNodejs&&!Vt.options.usePureJavaScript&&_e.pbkdf2&&(i===null||typeof i!="object")&&(_e.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?_e.pbkdf2Sync.length===4?_e.pbkdf2(t,e,r,n,function(b,I){if(b)return o(b);o(null,I.toString("binary"))}):_e.pbkdf2(t,e,r,n,i,function(b,I){if(b)return o(b);o(null,I.toString("binary"))}):_e.pbkdf2Sync.length===4?_e.pbkdf2Sync(t,e,r,n).toString("binary"):_e.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in Vt.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=Vt.md[i].create()}var s=i.digestLength;if(n>4294967295*s){var a=new Error("Derived key is too long.");if(o)return o(a);throw a}var f=Math.ceil(n/s),c=n-(f-1)*s,u=Vt.hmac.create();u.start(i,t);var l="",y,d,h;if(!o){for(var p=1;p<=f;++p){u.start(null,null),u.update(e),u.update(Vt.util.int32ToBytes(p)),y=h=u.digest().getBytes();for(var g=2;g<=r;++g)u.start(null,null),u.update(h),d=u.digest().getBytes(),y=Vt.util.xorBytes(y,d,s),h=d;l+=p<f?y:y.substr(0,c)}return l}var p=1,g;function x(){if(p>f)return o(null,l);u.start(null,null),u.update(e),u.update(Vt.util.int32ToBytes(p)),y=h=u.digest().getBytes(),g=2,m()}function m(){if(g<=r)return u.start(null,null),u.update(h),d=u.digest().getBytes(),y=Vt.util.xorBytes(y,d,s),h=d,++g,Vt.util.setImmediate(m);l+=p<f?y:y.substr(0,c),++p,x()}x()}});var V0=ft((ub,M0)=>{var ni=ut();St();var F0=M0.exports=ni.pem=ni.pem||{};F0.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r
9
+ `,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=ri(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=ri(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=ri(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=ri(t.headers[i]);return t.procType&&(r+=`\r
10
+ `),r+=ni.util.encode64(t.body,e.maxline||64)+`\r
11
11
  `,r+="-----END "+t.type+`-----\r
12
- `,r};e0.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/,o;o=r.exec(t),!!o;){var s=o[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var a={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:zn.util.decode64(o[3])};if(e.push(a),!!o[2]){for(var c=o[2].split(i),f=0;o&&f<c.length;){for(var u=c[f].replace(/\s+$/,""),l=f+1;l<c.length;++l){var p=c[l];if(!/\s/.test(p[0]))break;u+=p,f=l}if(o=u.match(n),o){for(var d={name:o[1],values:[]},h=o[2].split(","),y=0;y<h.length;++y)d.values.push(Wl(h[y]));if(a.procType)if(!a.contentDomain&&d.name==="Content-Domain")a.contentDomain=h[0]||"";else if(!a.dekInfo&&d.name==="DEK-Info"){if(d.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:h[0],parameters:h[1]||null}}else a.headers.push(d);else{if(d.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(d.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:h[0],type:h[1]}}}++f}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 Hn(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
12
+ `,r};F0.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/,o;o=r.exec(t),!!o;){var s=o[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var a={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:ni.util.decode64(o[3])};if(e.push(a),!!o[2]){for(var f=o[2].split(i),c=0;o&&c<f.length;){for(var u=f[c].replace(/\s+$/,""),l=c+1;l<f.length;++l){var y=f[l];if(!/\s/.test(y[0]))break;u+=y,c=l}if(o=u.match(n),o){for(var d={name:o[1],values:[]},h=o[2].split(","),p=0;p<h.length;++p)d.values.push(Xh(h[p]));if(a.procType)if(!a.contentDomain&&d.name==="Content-Domain")a.contentDomain=h[0]||"";else if(!a.dekInfo&&d.name==="DEK-Info"){if(d.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');a.dekInfo={algorithm:h[0],parameters:h[1]||null}}else a.headers.push(d);else{if(d.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(d.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');a.procType={version:h[0],type:h[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 ri(t){for(var e=t.name+": ",r=[],n=function(f,c){return" "+c},i=0;i<t.values.length;++i)r.push(t.values[i].replace(/^(\S+\r\n)/,n));e+=r.join(",")+`\r
13
13
  `;for(var o=0,s=-1,i=0;i<e.length;++i,++o)if(o>65&&s!==-1){var a=e[s];a===","?(++s,e=e.substr(0,s)+`\r
14
14
  `+e.substr(s)):e=e.substr(0,s)+`\r
15
- `+a+e.substr(s+1),o=i-s-1,s=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(s=i);return e}function Wl(t){return t.replace(/^\s+/,"")}});var c0=ft((Zg,f0)=>{var xe=ct();fr();wt();var o0=f0.exports=xe.sha256=xe.sha256||{};xe.md.sha256=xe.md.algorithms.sha256=o0;o0.create=function(){s0||Yl();var t=null,e=xe.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,o=0;o<i;++o)n.fullMessageLength.push(0);return e=xe.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,o){o==="utf8"&&(i=xe.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),i0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=xe.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(Eo.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};i0(l,r,i);var p=xe.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p.putInt32(l.h5),p.putInt32(l.h6),p.putInt32(l.h7),p},n};var Eo=null,s0=!1,a0=null;function Yl(){Eo="\x80",Eo+=xe.util.fillString("\0",64),a0=[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],s0=!0}function i0(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m=r.length();m>=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,l=t.h1,p=t.h2,d=t.h3,h=t.h4,y=t.h5,g=t.h6,x=t.h7,f=0;f<64;++f)s=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),a=g^h&(y^g),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),c=u&l|p&(u^l),n=x+s+a+a0[f]+e[f],i=o+c,x=g,g=y,y=h,h=d+n>>>0,d=p,p=l,l=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+l|0,t.h2=t.h2+p|0,t.h3=t.h3+d|0,t.h4=t.h4+h|0,t.h5=t.h5+y|0,t.h6=t.h6+g|0,t.h7=t.h7+x|0,m-=64}}});var l0=ft((Qg,u0)=>{var me=ct();wt();var $n=null;me.util.isNodejs&&!me.options.usePureJavaScript&&!process.versions["node-webkit"]&&($n=qn());var Zl=u0.exports=me.prng=me.prng||{};Zl.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 l=e.plugin.cipher,p=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,y=me.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(y.length()>=f)return u(null,y.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return me.util.nextTick(function(){o(g)});var m=l(e.key,e.seed);e.generated+=m.length,y.putBytes(m),e.key=d(l(e.key,p(e.seed))),e.seed=h(l(e.key,e.seed)),me.util.setImmediate(g)}},e.generateSync=function(f){var u=e.plugin.cipher,l=e.plugin.increment,p=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=me.util.createBuffer();h.length()<f;){e.generated>1048575&&(e.key=null),e.key===null&&s();var y=u(e.key,e.seed);e.generated+=y.length,h.putBytes(y),e.key=p(u(e.key,l(e.seed))),e.seed=d(u(e.key,e.seed))}return h.getBytes(f)};function o(f){if(e.pools[0].messageLength>=32)return a(),f();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,p){if(l)return f(l);e.collect(p),a(),f()})}function s(){if(e.pools[0].messageLength>=32)return a();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var u=1,l=0;l<32;++l)e.reseeds%u===0&&(f.update(e.pools[l].digest().getBytes()),e.pools[l].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,l=me.util.globalScope,p=l.crypto||l.msCrypto;p&&p.getRandomValues&&(u=function(E){return p.getRandomValues(E)});var d=me.util.createBuffer();if(u)for(;d.length()<f;){var h=Math.max(1,Math.min(f-d.length(),65536)/4),y=new Uint32Array(Math.floor(h));try{u(y);for(var g=0;g<y.length;++g)d.putInt32(y[g])}catch(E){if(!(typeof QuotaExceededError<"u"&&E instanceof QuotaExceededError))throw E}}if(d.length()<f)for(var x,m,v,_=Math.floor(Math.random()*65536);d.length()<f;){m=16807*(_&65535),x=16807*(_>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),_=m&4294967295;for(var g=0;g<3;++g)v=_>>>(g<<3),v^=Math.floor(Math.random()*256),d.putByte(v&255)}return d.getBytes(f)}return $n?(e.seedFile=function(f,u){$n.randomBytes(f,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(f){return $n.randomBytes(f).toString()}):(e.seedFile=function(f,u){try{u(null,c(f))}catch(l){u(l)}},e.seedFileSync=c),e.collect=function(f){for(var u=f.length,l=0;l<u;++l)e.pools[e.pool].update(f.substr(l,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(f,u){for(var l="",p=0;p<u;p+=8)l+=String.fromCharCode(f>>p&255);e.collect(l)},e.registerWorker=function(f){if(f===self)e.seedFile=function(l,p){function d(h){var y=h.data;y.forge&&y.forge.prng&&(self.removeEventListener("message",d),p(y.forge.prng.err,y.forge.prng.bytes))}self.addEventListener("message",d),self.postMessage({forge:{prng:{needed:l}}})};else{var u=function(l){var p=l.data;p.forge&&p.forge.prng&&e.seedFile(p.forge.prng.needed,function(d,h){f.postMessage({forge:{prng:{err:d,bytes:h}}})})};f.addEventListener("message",u)}},e}});var ln=ft((Xg,So)=>{var _t=ct();wo();c0();l0();wt();(function(){if(_t.random&&_t.random.getBytes){So.exports=_t.random;return}(function(t){var e={},r=new Array(4),n=_t.util.createBuffer();e.formatKey=function(l){var p=_t.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),_t.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=_t.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),l},e.cipher=function(l,p){return _t.aes._updateBlock(l,p,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(l){return++l[3],l},e.md=_t.md.sha256;function i(){var l=_t.prng.create(e);return l.getBytes=function(p,d){return l.generate(p,d)},l.getBytesSync=function(p){return l.generate(p)},l}var o=i(),s=null,a=_t.util.globalScope,c=a.crypto||a.msCrypto;if(c&&c.getRandomValues&&(s=function(l){return c.getRandomValues(l)}),_t.options.usePureJavaScript||!_t.util.isNodejs&&!s){if(typeof window>"u"||window.document,o.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var u in navigator)try{typeof navigator[u]=="string"&&(f+=navigator[u])}catch{}o.collect(f),f=null}t&&(t().mousemove(function(l){o.collectInt(l.clientX,16),o.collectInt(l.clientY,16)}),t().keypress(function(l){o.collectInt(l.charCode,8)}))}if(!_t.random)_t.random=o;else for(var u in o)_t.random[u]=o[u];_t.random.createInstance=i,So.exports=_t.random})(typeof jQuery<"u"?jQuery:null)})()});var y0=ft((Jg,p0)=>{var qt=ct();wt();var Bo=[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],h0=[1,2,3,5],Ql=function(t,e){return t<<e&65535|(t&65535)>>16-e},Xl=function(t,e){return(t&65535)>>e|t<<16-e&65535};p0.exports=qt.rc2=qt.rc2||{};qt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=qt.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,o=Math.ceil(i/8),s=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(Bo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,Bo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,Bo[r.at(a+1)^r.at(a+o)]);return r};var d0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,c,f,u,l=[];for(t=qt.rc2.expandKey(t,e),f=0;f<64;f++)l.push(t.getInt16Le());r?(a=function(h){for(f=0;f<4;f++)h[f]+=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),h[f]=Ql(h[f],h0[f]),u++},c=function(h){for(f=0;f<4;f++)h[f]+=l[h[(f+3)%4]&63]}):(a=function(h){for(f=3;f>=0;f--)h[f]=Xl(h[f],h0[f]),h[f]-=l[u]+(h[(f+3)%4]&h[(f+2)%4])+(~h[(f+3)%4]&h[(f+1)%4]),u--},c=function(h){for(f=3;f>=0;f--)h[f]-=l[h[(f+3)%4]&63]});var p=function(h){var y=[];for(f=0;f<4;f++){var g=i.getInt16Le();s!==null&&(r?g^=s.getInt16Le():s.putInt16Le(g)),y.push(g&65535)}u=r?0:63;for(var x=0;x<h.length;x++)for(var m=0;m<h[x][0];m++)h[x][1](y);for(f=0;f<4;f++)s!==null&&(r?s.putInt16Le(y[f]):y[f]^=s.getInt16Le()),o.putInt16Le(y[f])},d=null;return d={start:function(h,y){h&&typeof h=="string"&&(h=qt.util.createBuffer(h)),n=!1,i=qt.util.createBuffer(),o=y||new qt.util.createBuffer,s=h,d.output=o},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)p([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(h){var y=!0;if(r)if(h)y=h(8,i,!r);else{var g=i.length()===8?8:8-i.length();i.fillWithByte(g,g)}if(y&&(n=!0,d.update()),!r&&(y=i.length()===0,y))if(h)y=h(8,o,!r);else{var x=o.length(),m=o.at(x-1);m>x?y=!1:o.truncate(m)}return y}},d};qt.rc2.startEncrypting=function(t,e,r){var n=qt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};qt.rc2.createEncryptionCipher=function(t,e){return d0(t,e,!0)};qt.rc2.startDecrypting=function(t,e,r){var n=qt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};qt.rc2.createDecryptionCipher=function(t,e){return d0(t,e,!1)}});var Yn=ft((jg,S0)=>{var Ao=ct();S0.exports=Ao.jsbn=Ao.jsbn||{};var Ce,Jl=0xdeadbeefcafe,g0=(Jl&16777215)==15715070;function I(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))}Ao.jsbn.BigInteger=I;function et(){return new I(null)}function jl(t,e,r,n,i,o){for(;--o>=0;){var s=e*this.data[t++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=s&67108863}return i}function th(t,e,r,n,i,o){for(var s=e&32767,a=e>>15;--o>=0;){var c=this.data[t]&32767,f=this.data[t++]>>15,u=a*c+f*s;c=s*c+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(c>>>30)+(u>>>15)+a*f+(i>>>30),r.data[n++]=c&1073741823}return i}function x0(t,e,r,n,i,o){for(var s=e&16383,a=e>>14;--o>=0;){var c=this.data[t]&16383,f=this.data[t++]>>14,u=a*c+f*s;c=s*c+((u&16383)<<14)+r.data[n]+i,i=(c>>28)+(u>>14)+a*f,r.data[n++]=c&268435455}return i}typeof navigator>"u"?(I.prototype.am=x0,Ce=28):g0&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=th,Ce=30):g0&&navigator.appName!="Netscape"?(I.prototype.am=jl,Ce=26):(I.prototype.am=x0,Ce=28);I.prototype.DB=Ce;I.prototype.DM=(1<<Ce)-1;I.prototype.DV=1<<Ce;var Io=52;I.prototype.FV=Math.pow(2,Io);I.prototype.F1=Io-Ce;I.prototype.F2=2*Ce-Io;var eh="0123456789abcdefghijklmnopqrstuvwxyz",Gn=new Array,kr,Jt;kr=48;for(Jt=0;Jt<=9;++Jt)Gn[kr++]=Jt;kr=97;for(Jt=10;Jt<36;++Jt)Gn[kr++]=Jt;kr=65;for(Jt=10;Jt<36;++Jt)Gn[kr++]=Jt;function m0(t){return eh.charAt(t)}function b0(t,e){var r=Gn[t.charCodeAt(e)];return r??-1}function rh(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 nh(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 We(t){var e=et();return e.fromInt(t),e}function ih(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,o=0;--n>=0;){var s=r==8?t[n]&255:b0(t,n);if(s<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this.data[this.t++]=s>>this.DB-o):this.data[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&I.ZERO.subTo(this,this)}function oh(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function sh(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,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=m0(n));s>=0;)a<e?(n=(this.data[s]&(1<<a)-1)<<e-a,n|=this.data[--s]>>(a+=this.DB-e)):(n=this.data[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=m0(n));return i?o:"0"}function ah(){var t=et();return I.ZERO.subTo(this,t),t}function fh(){return this.s<0?this.negate():this}function ch(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 Wn(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 uh(){return this.t<=0?0:this.DB*(this.t-1)+Wn(this.data[this.t-1]^this.s&this.DM)}function lh(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 hh(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 dh(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<<r;for(a=o-1;a>=0;--a)e.data[a]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}function ph(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,o=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)e.data[s-r-1]|=(this.data[s]&o)<<i,e.data[s-r]=this.data[s]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}function yh(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 gh(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&&I.ZERO.subTo(e,e)}function xh(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 mh(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=et());var o=et(),s=this.s,a=t.s,c=this.DB-Wn(n.data[n.t-1]);c>0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var f=o.t,u=o.data[f-1];if(u!=0){var l=u*(1<<this.F1)+(f>1?o.data[f-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,y=r.t,g=y-f,x=e??et();for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),I.ONE.dlShiftTo(f,x),x.subTo(o,o);o.t<f;)o.data[o.t++]=0;for(;--g>=0;){var m=r.data[--y]==u?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+h)*d);if((r.data[y]+=o.am(0,m,r,g,0,f))<m)for(o.dlShiftTo(g,x),r.subTo(x,r);r.data[y]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(f,e),s!=a&&I.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&I.ZERO.subTo(r,r)}}}function bh(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(I.ZERO)>0&&t.subTo(e,e),e}function cr(t){this.m=t}function vh(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function wh(t){return t}function Eh(t){t.divRemTo(this.m,null,t)}function Sh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Bh(t,e){t.squareTo(e),this.reduce(e)}cr.prototype.convert=vh;cr.prototype.revert=wh;cr.prototype.reduce=Eh;cr.prototype.mulTo=Sh;cr.prototype.sqrTo=Bh;function Ah(){if(this.t<1)return 0;var t=this.data[0];if(!(t&1))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 ur(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 Ih(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(I.ZERO)>0&&this.m.subTo(e,e),e}function Th(t){var e=et();return t.copyTo(e),this.reduce(e),e}function Ch(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 _h(t,e){t.squareTo(e),this.reduce(e)}function Rh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}ur.prototype.convert=Ih;ur.prototype.revert=Th;ur.prototype.reduce=Ch;ur.prototype.mulTo=Rh;ur.prototype.sqrTo=_h;function Lh(){return(this.t>0?this.data[0]&1:this.s)==0}function Dh(t,e){if(t>4294967295||t<1)return I.ONE;var r=et(),n=et(),i=e.convert(this),o=Wn(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}function Ph(t,e){var r;return t<256||e.isEven()?r=new cr(e):r=new ur(e),this.exp(t,r)}I.prototype.copyTo=rh;I.prototype.fromInt=nh;I.prototype.fromString=ih;I.prototype.clamp=oh;I.prototype.dlShiftTo=lh;I.prototype.drShiftTo=hh;I.prototype.lShiftTo=dh;I.prototype.rShiftTo=ph;I.prototype.subTo=yh;I.prototype.multiplyTo=gh;I.prototype.squareTo=xh;I.prototype.divRemTo=mh;I.prototype.invDigit=Ah;I.prototype.isEven=Lh;I.prototype.exp=Dh;I.prototype.toString=sh;I.prototype.negate=ah;I.prototype.abs=fh;I.prototype.compareTo=ch;I.prototype.bitLength=uh;I.prototype.mod=bh;I.prototype.modPowInt=Ph;I.ZERO=We(0);I.ONE=We(1);function kh(){var t=et();return this.copyTo(t),t}function Nh(){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 Uh(){return this.t==0?this.s:this.data[0]<<24>>24}function Oh(){return this.t==0?this.s:this.data[0]<<16>>16}function Kh(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Fh(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Mh(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=We(r),i=et(),o=et(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}function Vh(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var c=b0(t,a);if(c<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=e*s+c,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&I.ZERO.subTo(this,this)}function qh(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(I.ONE.shiftLeft(t-1),To,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(I.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 Hh(){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&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function zh(t){return this.compareTo(t)==0}function $h(t){return this.compareTo(t)<0?this:t}function Gh(t){return this.compareTo(t)>0?this:t}function Wh(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;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 Yh(t,e){return t&e}function Zh(t){var e=et();return this.bitwiseTo(t,Yh,e),e}function To(t,e){return t|e}function Qh(t){var e=et();return this.bitwiseTo(t,To,e),e}function v0(t,e){return t^e}function Xh(t){var e=et();return this.bitwiseTo(t,v0,e),e}function w0(t,e){return t&~e}function Jh(t){var e=et();return this.bitwiseTo(t,w0,e),e}function jh(){for(var t=et(),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 td(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function ed(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function rd(t){if(t==0)return-1;var e=0;return t&65535||(t>>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function nd(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+rd(this.data[t]);return this.s<0?this.t*this.DB:-1}function id(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function od(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=id(this.data[r]^e);return t}function sd(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function ad(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function fd(t){return this.changeBit(t,To)}function cd(t){return this.changeBit(t,w0)}function ud(t){return this.changeBit(t,v0)}function ld(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 hd(t){var e=et();return this.addTo(t,e),e}function dd(t){var e=et();return this.subTo(t,e),e}function pd(t){var e=et();return this.multiplyTo(t,e),e}function yd(t){var e=et();return this.divRemTo(t,e,null),e}function gd(t){var e=et();return this.divRemTo(t,null,e),e}function xd(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function md(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bd(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 hn(){}function E0(t){return t}function vd(t,e,r){t.multiplyTo(e,r)}function wd(t,e){t.squareTo(e)}hn.prototype.convert=E0;hn.prototype.revert=E0;hn.prototype.mulTo=vd;hn.prototype.sqrTo=wd;function Ed(t){return this.exp(t,new hn)}function Sd(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 Bd(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 Nr(t){this.r2=et(),this.q3=et(),I.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Ad(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=et();return t.copyTo(e),this.reduce(e),e}function Id(t){return t}function Td(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 Cd(t,e){t.squareTo(e),this.reduce(e)}function _d(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Nr.prototype.convert=Ad;Nr.prototype.revert=Id;Nr.prototype.reduce=Td;Nr.prototype.mulTo=_d;Nr.prototype.sqrTo=Cd;function Rd(t,e){var r=t.bitLength(),n,i=We(1),o;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?o=new cr(e):e.isEven()?o=new Nr(e):o=new ur(e);var s=new Array,a=3,c=n-1,f=(1<<n)-1;if(s[1]=o.convert(this),n>1){var u=et();for(o.sqrTo(s[1],u);a<=f;)s[a]=et(),o.mulTo(u,s[a-2],s[a]),a+=2}var l=t.t-1,p,d=!0,h=et(),y;for(r=Wn(t.data[l])-1;l>=0;){for(r>=c?p=t.data[l]>>r-c&f:(p=(t.data[l]&(1<<r+1)-1)<<c-r,l>0&&(p|=t.data[l-1]>>this.DB+r-c)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),d)s[p].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,h),o.sqrTo(h,i),a-=2;a>0?o.sqrTo(i,h):(y=i,i=h,h=y),o.mulTo(h,s[p],i)}for(;l>=0&&!(t.data[l]&1<<r);)o.sqrTo(i,h),y=i,i=h,h=y,--r<0&&(r=this.DB-1,--l)}return o.revert(i)}function Ld(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(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,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 o>0&&r.lShiftTo(o,r),r}function Dd(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 Pd(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return I.ZERO;for(var r=t.clone(),n=this.clone(),i=We(1),o=We(0),s=We(0),a=We(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}if(n.compareTo(I.ONE)!=0)return I.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}var ie=[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],kd=(1<<26)/ie[ie.length-1];function Nd(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ie[ie.length-1]){for(e=0;e<ie.length;++e)if(r.data[0]==ie[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ie.length;){for(var n=ie[e],i=e+1;i<ie.length&&n<kd;)n*=ie[i++];for(n=r.modInt(n);e<i;)if(n%ie[e++]==0)return!1}return r.millerRabin(t)}function Ud(t){var e=this.subtract(I.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=Od(),o,s=0;s<t;++s){do o=new I(this.bitLength(),i);while(o.compareTo(I.ONE)<=0||o.compareTo(e)>=0);var a=o.modPow(n,this);if(a.compareTo(I.ONE)!=0&&a.compareTo(e)!=0){for(var c=1;c++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(I.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function Od(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=Kh;I.prototype.toRadix=Mh;I.prototype.fromRadix=Vh;I.prototype.fromNumber=qh;I.prototype.bitwiseTo=Wh;I.prototype.changeBit=ad;I.prototype.addTo=ld;I.prototype.dMultiply=md;I.prototype.dAddOffset=bd;I.prototype.multiplyLowerTo=Sd;I.prototype.multiplyUpperTo=Bd;I.prototype.modInt=Dd;I.prototype.millerRabin=Ud;I.prototype.clone=kh;I.prototype.intValue=Nh;I.prototype.byteValue=Uh;I.prototype.shortValue=Oh;I.prototype.signum=Fh;I.prototype.toByteArray=Hh;I.prototype.equals=zh;I.prototype.min=$h;I.prototype.max=Gh;I.prototype.and=Zh;I.prototype.or=Qh;I.prototype.xor=Xh;I.prototype.andNot=Jh;I.prototype.not=jh;I.prototype.shiftLeft=td;I.prototype.shiftRight=ed;I.prototype.getLowestSetBit=nd;I.prototype.bitCount=od;I.prototype.testBit=sd;I.prototype.setBit=fd;I.prototype.clearBit=cd;I.prototype.flipBit=ud;I.prototype.add=hd;I.prototype.subtract=dd;I.prototype.multiply=pd;I.prototype.divide=yd;I.prototype.remainder=gd;I.prototype.divideAndRemainder=xd;I.prototype.modPow=Rd;I.prototype.modInverse=Pd;I.prototype.pow=Ed;I.prototype.gcd=Ld;I.prototype.isProbablePrime=Nd});var C0=ft((tx,T0)=>{var be=ct();fr();wt();var A0=T0.exports=be.sha1=be.sha1||{};be.md.sha1=be.md.algorithms.sha1=A0;A0.create=function(){I0||Kd();var t=null,e=be.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,o=0;o<i;++o)n.fullMessageLength.push(0);return e=be.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=be.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),B0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=be.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(Co.substr(0,n.blockLength-s));for(var a,c,f=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,c=a/4294967296>>>0,f+=c,i.putInt32(f>>>0),f=a>>>0;i.putInt32(f);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};B0(l,r,i);var p=be.util.createBuffer();return p.putInt32(l.h0),p.putInt32(l.h1),p.putInt32(l.h2),p.putInt32(l.h3),p.putInt32(l.h4),p},n};var Co=null,I0=!1;function Kd(){Co="\x80",Co+=be.util.fillString("\0",64),I0=!0}function B0(t,e,r){for(var n,i,o,s,a,c,f,u,l=r.length();l>=64;){for(i=t.h0,o=t.h1,s=t.h2,a=t.h3,c=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,f=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=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=a^o&(s^a),n=(i<<5|i>>>27)+f+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=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=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=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=o^s^a,n=(i<<5|i>>>27)+f+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=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=o&s|a&(o^s),n=(i<<5|i>>>27)+f+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=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=o^s^a,n=(i<<5|i>>>27)+f+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+o|0,t.h2=t.h2+s|0,t.h3=t.h3+a|0,t.h4=t.h4+c|0,l-=64}}});var L0=ft((ex,R0)=>{var ve=ct();wt();ln();C0();var _0=R0.exports=ve.pkcs1=ve.pkcs1||{};_0.encode_rsa_oaep=function(t,e,r){var n,i,o,s;typeof r=="string"?(n=r,i=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),o?o.start():o=ve.md.sha1.create(),s||(s=o);var a=Math.ceil(t.n.bitLength()/8),c=a-2*o.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=""),o.update(n,"raw");for(var u=o.digest(),l="",p=c-e.length,d=0;d<p;d++)l+="\0";var h=u.getBytes()+l+""+e;if(!i)i=ve.random.getBytes(o.digestLength);else if(i.length!==o.digestLength){var f=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw f.seedLength=i.length,f.digestLength=o.digestLength,f}var y=Zn(i,a-o.digestLength-1,s),g=ve.util.xorBytes(h,y,h.length),x=Zn(g,o.digestLength,s),m=ve.util.xorBytes(i,x,i.length);return"\0"+m+g};_0.decode_rsa_oaep=function(t,e,r){var n,i,o;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&&(o=r.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var g=new Error("RSAES-OAEP encoded message length is invalid.");throw g.length=e.length,g.expectedLength=s,g}if(i===void 0?i=ve.md.sha1.create():i.start(),o||(o=i),s<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 a=i.digest().getBytes(),c=e.charAt(0),f=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),l=Zn(u,i.digestLength,o),p=ve.util.xorBytes(f,l,f.length),d=Zn(p,s-i.digestLength-1,o),h=ve.util.xorBytes(u,d,u.length),y=h.substring(0,i.digestLength),g=c!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==y.charAt(x);for(var m=1,v=i.digestLength,_=i.digestLength;_<h.length;_++){var E=h.charCodeAt(_),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,v+=m}if(g||h.charCodeAt(v)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(v+1)};function Zn(t,e,r){r||(r=ve.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),o=0;o<i;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,o&255);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}});var D0=ft((rx,_o)=>{var Ye=ct();wt();Yn();ln();(function(){if(Ye.prime){_o.exports=Ye.prime;return}var t=_o.exports=Ye.prime=Ye.prime||{},e=Ye.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(l,p){return l|p};t.generateProbablePrime=function(l,p,d){typeof p=="function"&&(d=p,p={}),p=p||{};var h=p.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var y=p.prng||Ye.random,g={nextBytes:function(x){for(var m=y.getBytesSync(x.length),v=0;v<x.length;++v)x[v]=m.charCodeAt(v)}};if(h.name==="PRIMEINC")return o(l,g,h.options,d);throw new Error("Invalid prime generation algorithm: "+h.name)};function o(l,p,d,h){return"workers"in d?c(l,p,d,h):s(l,p,d,h)}function s(l,p,d,h){var y=f(l,p),g=0,x=u(y.bitLength());"millerRabinTests"in d&&(x=d.millerRabinTests);var m=10;"maxBlockTime"in d&&(m=d.maxBlockTime),a(y,l,p,g,x,m,h)}function a(l,p,d,h,y,g,x){var m=+new Date;do{if(l.bitLength()>p&&(l=f(p,d)),l.isProbablePrime(y))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);Ye.util.setImmediate(function(){a(l,p,d,h,y,g,x)})}function c(l,p,d,h){if(typeof Worker>"u")return s(l,p,d,h);var y=f(l,p),g=d.workers,x=d.workLoad||100,m=x*30/8,v=d.workerScript||"forge/prime.worker.js";if(g===-1)return Ye.util.estimateCores(function(E,S){E&&(S=2),g=S-1,_()});_();function _(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(v);for(var L=g,S=0;S<g;++S)E[S].addEventListener("message",H);var D=!1;function H(q){if(!D){--L;var M=q.data;if(M.found){for(var X=0;X<E.length;++X)E[X].terminate();return D=!0,h(null,new e(M.prime,16))}y.bitLength()>l&&(y=f(l,p));var at=y.toString(16);q.target.postMessage({hex:at,workLoad:x}),y.dAddOffset(m,0)}}}}function f(l,p){var d=new e(l,p),h=l-1;return d.testBit(h)||d.bitwiseTo(e.ONE.shiftLeft(h),i,d),d.dAddOffset(31-d.mod(n).byteValue(),0),d}function u(l){return l<=100?27:l<=150?18:l<=200?15:l<=250?12:l<=300?9:l<=350?8:l<=400?7:l<=500?6:l<=600?5:l<=800?4:l<=1250?3:2}})()});var Xn=ft((nx,F0)=>{var F=ct();un();Yn();Nn();L0();D0();ln();wt();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,Ro=F.util.isNodejs?qn():null,w=F.asn1,jt=F.util;F.pki=F.pki||{};F0.exports=F.pki.rsa=F.rsa=F.rsa||{};var z=F.pki,Fd=[6,4,2,4,2,4,6,2],Md={name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Vd={name:"RSAPrivateKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},qd={name:"RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Hd=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},zd={name:"DigestInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:w.Class.UNIVERSAL,type:w.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},$d=function(t){var e;if(t.algorithm in z.oids)e=z.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=w.oidToDer(e).getBytes(),i=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]),o=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]);o.value.push(w.create(w.Class.UNIVERSAL,w.Type.OID,!1,n)),o.value.push(w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,""));var s=w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(o),i.value.push(s),w.toDer(i).getBytes()},O0=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(tt.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(tt.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new tt(F.util.bytesToHex(F.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(tt.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),o=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(o)<0;)i=i.add(e.p);var s=i.subtract(o).multiply(e.qInv).mod(e.p).multiply(e.q).add(o);return s=s.multiply(n.modInverse(e.n)).mod(e.n),s};z.rsa.encrypt=function(t,e,r){var n=r,i,o=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=K0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=O0(s,e,n),c=a.toString(16),f=F.util.createBuffer(),u=o-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),f.getBytes()};z.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=t.length,o.expected=i,o}var s=new tt(F.util.createBuffer(t).toHex(),16);if(s.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=O0(s,e,r),c=a.toString(16),f=F.util.createBuffer(),u=i-Math.ceil(c.length/2);u>0;)f.putByte(0),--u;return f.putBytes(F.util.hexToBytes(c)),n!==!1?Qn(f.getBytes(),e,r):f.getBytes()};z.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||F.random,i={nextBytes:function(a){for(var c=n.getBytesSync(a.length),f=0;f<a.length;++f)a[f]=c.charCodeAt(f)}},o=r.algorithm||"PRIMEINC",s;if(o==="PRIMEINC")s={algorithm:o,state:0,bits:t,rng:i,eInt:e||65537,e:new tt(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+o);return s};z.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new tt(null);r.fromInt(30);for(var n=0,i=function(l,p){return l|p},o=+new Date,s,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var c=t.p===null?t.pBits:t.qBits,f=c-1;t.pqState===0?(t.num=new tt(c,t.rng),t.num.testBit(f)||t.num.bitwiseTo(tt.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(Wd(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(Fd[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(tt.ONE).gcd(t.e).compareTo(tt.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(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(tt.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:z.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:z.rsa.setPublicKey(t.n,t.e)}}s=+new Date,a+=s-o,o=s}return t.keys!==null};z.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),!F.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(P0("generateKeyPair"))return Ro.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,c,f){if(a)return n(a);n(null,{privateKey:z.privateKeyFromPem(f),publicKey:z.publicKeyFromPem(c)})});if(k0("generateKey")&&k0("exportKey"))return jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:U0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return jt.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var c=z.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:c,publicKey:z.setRsaPublicKey(c.n,c.e)})}});if(N0("generateKey")&&N0("exportKey")){var i=jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:U0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var c=a.target.result,f=jt.globalScope.msCrypto.subtle.exportKey("pkcs8",c.privateKey);f.oncomplete=function(u){var l=u.target.result,p=z.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:p,publicKey:z.setRsaPublicKey(p.n,p.e)})},f.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(P0("generateKeyPairSync")){var o=Ro.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:z.privateKeyFromPem(o.privateKey),publicKey:z.publicKeyFromPem(o.publicKey)}}}var s=z.rsa.createKeyPairGenerationState(t,e,r);if(!n)return z.rsa.stepKeyPairGenerationState(s,0),s.keys;Gd(s,r,n)};z.setRsaPublicKey=z.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,o){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,c,f){return K0(a,c,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,c){return F.pkcs1.encode_rsa_oaep(c,a,o)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var s=i.encode(n,r,!0);return z.rsa.encrypt(s,r,!0)},r.verify=function(n,i,o,s){typeof o=="string"?o=o.toUpperCase():o===void 0&&(o="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),o==="RSASSA-PKCS1-V1_5"?o={verify:function(c,f){f=Qn(f,r,!0);var u=w.fromDer(f,{parseAllBytes:s._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,zd,l,p)){var d=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw d.errors=p,d}var h=w.derToOid(l.algorithmIdentifier);if(!(h===F.oids.md2||h===F.oids.md5||h===F.oids.sha1||h===F.oids.sha224||h===F.oids.sha256||h===F.oids.sha384||h===F.oids.sha512||h===F.oids["sha512-224"]||h===F.oids["sha512-256"])){var d=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw d.oid=h,d}if((h===F.oids.md2||h===F.oids.md5)&&!("parameters"in l))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return c===l.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(c,f){return f=Qn(f,r,!0),c===f}});var a=z.rsa.decrypt(i,r,!0,!1);return o.verify(n,a,r.n.bitLength())},r};z.setRsaPrivateKey=z.rsa.setPrivateKey=function(t,e,r,n,i,o,s,a){var c={n:t,e,d:r,p:n,q:i,dP:o,dQ:s,qInv:a};return c.decrypt=function(f,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var p=z.rsa.decrypt(f,c,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:Qn};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(d,h){return F.pkcs1.decode_rsa_oaep(h,d,l)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(d){return d}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(p,c,!1)},c.sign=function(f,u){var l=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:$d},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return f}},l=1);var p=u.encode(f,c.n.bitLength());return z.rsa.encrypt(p,c,l)},c};z.wrapRsaPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(z.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,w.toDer(t).getBytes())])};z.privateKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,Md,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,Vd,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,o,s,a,c,f,u,l;return i=F.util.createBuffer(e.privateKeyModulus).toHex(),o=F.util.createBuffer(e.privateKeyPublicExponent).toHex(),s=F.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=F.util.createBuffer(e.privateKeyPrime1).toHex(),c=F.util.createBuffer(e.privateKeyPrime2).toHex(),f=F.util.createBuffer(e.privateKeyExponent1).toHex(),u=F.util.createBuffer(e.privateKeyExponent2).toHex(),l=F.util.createBuffer(e.privateKeyCoefficient).toHex(),z.setRsaPrivateKey(new tt(i,16),new tt(o,16),new tt(s,16),new tt(a,16),new tt(c,16),new tt(f,16),new tt(u,16),new tt(l,16))};z.privateKeyToAsn1=z.privateKeyToRSAPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.qInv))])};z.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,Hd,e,r)){var n=w.derToOid(e.publicKeyOid);if(n!==z.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!w.validate(t,qd,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var o=F.util.createBuffer(e.publicKeyModulus).toHex(),s=F.util.createBuffer(e.publicKeyExponent).toHex();return z.setRsaPublicKey(new tt(o,16),new tt(s,16))};z.publicKeyToAsn1=z.publicKeyToSubjectPublicKeyInfo=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(z.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.BITSTRING,!1,[z.publicKeyToRSAPublicKey(t)])])};z.publicKeyToRSAPublicKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,we(t.e))])};function K0(t,e,r){var n=F.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var s=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var c=0;c<s;++c)n.putByte(a)}else for(;s>0;){for(var f=0,u=F.random.getBytes(s),c=0;c<s;++c)a=u.charCodeAt(c),a===0?++f:n.putByte(a);s=f}return n.putByte(0),n.putBytes(t),n}function Qn(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),o=F.util.createBuffer(t),s=o.getByte(),a=o.getByte();if(s!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var c=0;if(a===0){c=i-3-n;for(var f=0;f<c;++f)if(o.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(c=0;o.length()>1;){if(o.getByte()!==255){--o.read;break}++c}else if(a===2)for(c=0;o.length()>1;){if(o.getByte()===0){--o.read;break}++c}var u=o.getByte();if(u!==0||c!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function Gd(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(){o(t.pBits,function(a,c){if(a)return r(a);if(t.p=c,t.q!==null)return s(a,t.q);o(t.qBits,s)})}function o(a,c){F.prime.generateProbablePrime(a,n,c)}function s(a,c){if(a)return r(a);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(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.p=null,i();return}if(t.q.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.q=null,o(t.qBits,s);return}if(t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(tt.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,o(t.qBits,s);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:z.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:z.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function we(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=F.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Wd(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 P0(t){return F.util.isNodejs&&typeof Ro[t]=="function"}function k0(t){return typeof jt.globalScope<"u"&&typeof jt.globalScope.crypto=="object"&&typeof jt.globalScope.crypto.subtle=="object"&&typeof jt.globalScope.crypto.subtle[t]=="function"}function N0(t){return typeof jt.globalScope<"u"&&typeof jt.globalScope.msCrypto=="object"&&typeof jt.globalScope.msCrypto.subtle=="object"&&typeof jt.globalScope.msCrypto.subtle[t]=="function"}function U0(t){for(var e=F.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var $0=ft((ix,z0)=>{var U=ct();wo();un();Za();fr();Nn();t0();n0();ln();y0();Xn();wt();typeof M0>"u"&&(M0=U.jsbn.BigInteger);var M0,B=U.asn1,G=U.pki=U.pki||{};z0.exports=G.pbe=U.pbe=U.pbe||{};var lr=G.oids,Yd={name:"EncryptedPrivateKeyInfo",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Zd={name:"PBES2Algorithms",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:B.Class.UNIVERSAL,type:B.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Qd={name:"pkcs-12PbeParams",tagClass:B.Class.UNIVERSAL,type:B.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:B.Class.UNIVERSAL,type:B.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:B.Class.UNIVERSAL,type:B.Type.INTEGER,constructed:!1,capture:"iterations"}]};G.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=U.random.getBytesSync(r.saltSize),i=r.count,o=B.integerToDer(i),s,a,c;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var f,u,l;switch(r.algorithm){case"aes128":s=16,f=16,u=lr["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":s=24,f=16,u=lr["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":s=32,f=16,u=lr["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":s=8,f=8,u=lr.desCBC,l=U.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var d="hmacWith"+r.prfAlgorithm.toUpperCase(),h=H0(d),y=U.pkcs5.pbkdf2(e,n,i,s,h),g=U.random.getBytesSync(f),x=l(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes();var m=Xd(n,o,s,d);a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr.pkcs5PBES2).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr.pkcs5PBKDF2).getBytes()),m]),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(u).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,g)])])])}else if(r.algorithm==="3des"){s=24;var v=new U.util.ByteBuffer(n),y=G.pbe.generatePkcs12Key(e,v,1,i,s),g=G.pbe.generatePkcs12Key(e,v,2,i,s),x=U.des.createEncryptionCipher(y);x.start(g),x.update(B.toDer(t)),x.finish(),c=x.output.getBytes(),a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(lr["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,n),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,o.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var _=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[a,B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,c)]);return _};G.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!B.validate(t,Yd,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=B.derToOid(n.encryptionOid),a=G.pbe.getCipher(s,n.encryptionParams,e),c=U.util.createBuffer(n.encryptedData);return a.update(c),a.finish()&&(r=B.fromDer(a.output)),r};G.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:B.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};G.encryptedPrivateKeyFromPem=function(t){var e=U.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 B.fromDer(e.body)};G.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=G.wrapRsaPrivateKey(G.privateKeyToAsn1(t));return n=G.encryptPrivateKeyInfo(n,e,r),G.encryptedPrivateKeyToPem(n)}var i,o,s,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,o=U.random.getBytesSync(8),a=U.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=U.pbe.opensslDeriveBytes(e,o.substr(0,8),s),u=a(f);u.start(o),u.update(B.toDer(G.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:U.util.bytesToHex(o).toUpperCase()},body:u.output.getBytes()};return U.pem.encode(l)};G.decryptRsaPrivateKey=function(t,e){var r=null,n=U.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 o,s;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,s=U.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,s=U.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,s=U.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,s=U.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,s=U.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,s=function(l){return U.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":o=8,s=function(l){return U.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":o=16,s=function(l){return U.rc2.createDecryptionCipher(l,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 a=U.util.hexToBytes(n.dekInfo.parameters),c=U.pbe.opensslDeriveBytes(e,a.substr(0,8),o),f=s(c);if(f.start(a),f.update(U.util.createBuffer(n.body)),f.finish())r=f.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=G.decryptPrivateKeyInfo(B.fromDer(r),e):r=B.fromDer(r),r!==null&&(r=G.privateKeyFromAsn1(r)),r};G.pbe.generatePkcs12Key=function(t,e,r,n,i,o){var s,a;if(typeof o>"u"||o===null){if(!("sha1"in U.md))throw new Error('"sha1" hash algorithm unavailable.');o=U.md.sha1.create()}var c=o.digestLength,f=o.blockLength,u=new U.util.ByteBuffer,l=new U.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)l.putInt16(t.charCodeAt(a));l.putInt16(0)}var p=l.length(),d=e.length(),h=new U.util.ByteBuffer;h.fillWithByte(r,f);var y=f*Math.ceil(d/f),g=new U.util.ByteBuffer;for(a=0;a<y;a++)g.putByte(e.at(a%d));var x=f*Math.ceil(p/f),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%p));var v=g;v.putBuffer(m);for(var _=Math.ceil(i/c),E=1;E<=_;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(v.bytes());for(var L=0;L<n;L++)o.start(),o.update(S.getBytes()),S=o.digest();var D=new U.util.ByteBuffer;for(a=0;a<f;a++)D.putByte(S.at(a%c));var H=Math.ceil(d/f)+Math.ceil(p/f),q=new U.util.ByteBuffer;for(s=0;s<H;s++){var M=new U.util.ByteBuffer(v.getBytes(f)),X=511;for(a=D.length()-1;a>=0;a--)X=X>>8,X+=D.at(a)+M.at(a),M.setAt(a,X&255);q.putBuffer(M)}v=q,u.putBuffer(S)}return u.truncate(u.length()-i),u};G.pbe.getCipher=function(t,e,r){switch(t){case G.oids.pkcs5PBES2:return G.pbe.getCipherForPBES2(t,e,r);case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case G.oids["pbewithSHAAnd40BitRC2-CBC"]:return G.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}};G.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!B.validate(e,Zd,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if(t=B.derToOid(n.kdfOid),t!==G.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=t,o.supportedOids=["pkcs5PBKDF2"],o}if(t=B.derToOid(n.encOid),t!==G.oids["aes128-CBC"]&&t!==G.oids["aes192-CBC"]&&t!==G.oids["aes256-CBC"]&&t!==G.oids["des-EDE3-CBC"]&&t!==G.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,a=U.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var c,f;switch(G.oids[t]){case"aes128-CBC":c=16,f=U.aes.createDecryptionCipher;break;case"aes192-CBC":c=24,f=U.aes.createDecryptionCipher;break;case"aes256-CBC":c=32,f=U.aes.createDecryptionCipher;break;case"des-EDE3-CBC":c=24,f=U.des.createDecryptionCipher;break;case"desCBC":c=8,f=U.des.createDecryptionCipher;break}var u=q0(n.prfOid),l=U.pkcs5.pbkdf2(r,s,a,c,u),p=n.encIv,d=f(l);return d.start(p),d};G.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!B.validate(e,Qd,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=U.util.createBuffer(n.salt),a=U.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var c,f,u;switch(t){case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,f=8,u=U.des.startDecrypting;break;case G.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,f=8,u=function(y,g){var x=U.rc2.createDecryptionCipher(y,40);return x.start(g,null),x};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=t,o}var l=q0(n.prfOid),p=G.pbe.generatePkcs12Key(r,s,1,a,c,l);l.start();var d=G.pbe.generatePkcs12Key(r,s,2,a,f,l);return u(p,d)};G.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n>"u"||n===null){if(!("md5"in U.md))throw new Error('"md5" hash algorithm unavailable.');n=U.md.md5.create()}e===null&&(e="");for(var i=[V0(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(V0(n,i[s-1]+t+e));return i.join("").substr(0,r)};function V0(t,e){return t.start().update(e).digest().getBytes()}function q0(t){var e;if(!t)e="hmacWithSHA1";else if(e=G.oids[B.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return H0(e)}function H0(t){var e=U.md;switch(t){case"hmacWithSHA224":e=U.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 Xd(t,e,r,n){var i=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,t),B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(B.create(B.Class.UNIVERSAL,B.Type.INTEGER,!1,U.util.hexToBytes(r.toString(16))),B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(G.oids[n]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.NULL,!1,"")])),i}});var Ff=ft((Lb,Kf)=>{var dt=ct();fr();wt();var vn=Kf.exports=dt.sha512=dt.sha512||{};dt.md.sha512=dt.md.algorithms.sha512=vn;var Uf=dt.sha384=dt.sha512.sha384=dt.sha512.sha384||{};Uf.create=function(){return vn.create("SHA-384")};dt.md.sha384=dt.md.algorithms.sha384=Uf;dt.sha512.sha256=dt.sha512.sha256||{create:function(){return vn.create("SHA-512/256")}};dt.md["sha512/256"]=dt.md.algorithms["sha512/256"]=dt.sha512.sha256;dt.sha512.sha224=dt.sha512.sha224||{create:function(){return vn.create("SHA-512/224")}};dt.md["sha512/224"]=dt.md.algorithms["sha512/224"]=dt.sha512.sha224;vn.create=function(t){if(Of||b1(),typeof t>"u"&&(t="SHA-512"),!(t in wr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=wr[t],r=null,n=dt.util.createBuffer(),i=new Array(80),o=0;o<80;++o)i[o]=new Array(2);var s=64;switch(t){case"SHA-384":s=48;break;case"SHA-512/256":s=32;break;case"SHA-512/224":s=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:s,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var c=a.messageLengthSize/4,f=0;f<c;++f)a.fullMessageLength.push(0);n=dt.util.createBuffer(),r=new Array(e.length);for(var f=0;f<e.length;++f)r[f]=e[f].slice(0);return a},a.start(),a.update=function(c,f){f==="utf8"&&(c=dt.util.encodeUtf8(c));var u=c.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=u[1],u[1]=u[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(c),Nf(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var c=dt.util.createBuffer();c.putBytes(n.bytes());var f=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=f&a.blockLength-1;c.putBytes(us.substr(0,a.blockLength-u));for(var l,p,d=a.fullMessageLength[0]*8,h=0;h<a.fullMessageLength.length-1;++h)l=a.fullMessageLength[h+1]*8,p=l/4294967296>>>0,d+=p,c.putInt32(d>>>0),d=l>>>0;c.putInt32(d);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);Nf(y,i,c);var g=dt.util.createBuffer(),x;t==="SHA-512"?x=y.length:t==="SHA-384"?x=y.length-2:x=y.length-4;for(var h=0;h<x;++h)g.putInt32(y[h][0]),(h!==x-1||t!=="SHA-512/224")&&g.putInt32(y[h][1]);return g},a};var us=null,Of=!1,ls=null,wr=null;function b1(){us="\x80",us+=dt.util.fillString("\0",128),ls=[[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]],wr={},wr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],wr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],wr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],wr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Of=!0}function Nf(t,e,r){for(var n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m,v,_,E,S,L,D,H,q,M,X,at,Lt,T,k,R,P,A,O,K,V=r.length();V>=128;){for(T=0;T<16;++T)e[T][0]=r.getInt32()>>>0,e[T][1]=r.getInt32()>>>0;for(;T<80;++T)P=e[T-2],k=P[0],R=P[1],n=((k>>>19|R<<13)^(R>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|R>>>19)^(R<<3|k>>>29)^(k<<26|R>>>6))>>>0,O=e[T-15],k=O[0],R=O[1],o=((k>>>1|R<<31)^(k>>>8|R<<24)^k>>>7)>>>0,s=((k<<31|R>>>1)^(k<<24|R>>>8)^(k<<25|R>>>7))>>>0,A=e[T-7],K=e[T-16],R=i+A[1]+s+K[1],e[T][0]=n+A[0]+o+K[0]+(R/4294967296>>>0)>>>0,e[T][1]=R>>>0;for(y=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],v=t[2][0],_=t[2][1],E=t[3][0],S=t[3][1],L=t[4][0],D=t[4][1],H=t[5][0],q=t[5][1],M=t[6][0],X=t[6][1],at=t[7][0],Lt=t[7][1],T=0;T<80;++T)f=((L>>>14|D<<18)^(L>>>18|D<<14)^(D>>>9|L<<23))>>>0,u=((L<<18|D>>>14)^(L<<14|D>>>18)^(D<<23|L>>>9))>>>0,l=(M^L&(H^M))>>>0,p=(X^D&(q^X))>>>0,a=((y>>>28|g<<4)^(g>>>2|y<<30)^(g>>>7|y<<25))>>>0,c=((y<<4|g>>>28)^(g<<30|y>>>2)^(g<<25|y>>>7))>>>0,d=(y&x|v&(y^x))>>>0,h=(g&m|_&(g^m))>>>0,R=Lt+u+p+ls[T][1]+e[T][1],n=at+f+l+ls[T][0]+e[T][0]+(R/4294967296>>>0)>>>0,i=R>>>0,R=c+h,o=a+d+(R/4294967296>>>0)>>>0,s=R>>>0,at=M,Lt=X,M=H,X=q,H=L,q=D,R=S+i,L=E+n+(R/4294967296>>>0)>>>0,D=R>>>0,E=v,S=_,v=x,_=m,x=y,m=g,R=i+s,y=n+o+(R/4294967296>>>0)>>>0,g=R>>>0;R=t[0][1]+g,t[0][0]=t[0][0]+y+(R/4294967296>>>0)>>>0,t[0][1]=R>>>0,R=t[1][1]+m,t[1][0]=t[1][0]+x+(R/4294967296>>>0)>>>0,t[1][1]=R>>>0,R=t[2][1]+_,t[2][0]=t[2][0]+v+(R/4294967296>>>0)>>>0,t[2][1]=R>>>0,R=t[3][1]+S,t[3][0]=t[3][0]+E+(R/4294967296>>>0)>>>0,t[3][1]=R>>>0,R=t[4][1]+D,t[4][0]=t[4][0]+L+(R/4294967296>>>0)>>>0,t[4][1]=R>>>0,R=t[5][1]+q,t[5][0]=t[5][0]+H+(R/4294967296>>>0)>>>0,t[5][1]=R>>>0,R=t[6][1]+X,t[6][0]=t[6][0]+M+(R/4294967296>>>0)>>>0,t[6][1]=R>>>0,R=t[7][1]+Lt,t[7][0]=t[7][0]+at+(R/4294967296>>>0)>>>0,t[7][1]=R>>>0,V-=128}}});var Hc=ft((s8,qc)=>{"use strict";function Vc(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function By(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 Vc(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),Vc(new i,r)}}qc.exports=By});var Zc=ft(_n=>{(function(){var t,e,r,n,i,o,s,a;a=function(c){var f,u,l,p;return f=(c&255<<24)>>>24,u=(c&255<<16)>>>16,l=(c&65280)>>>8,p=c&255,[f,u,l,p].join(".")},s=function(c){var f,u,l,p,d,h;for(f=[],l=p=0;p<=3&&c.length!==0;l=++p){if(l>0){if(c[0]!==".")throw new Error("Invalid IP");c=c.substring(1)}h=e(c),d=h[0],u=h[1],c=c.substring(u),f.push(d)}if(c.length!==0)throw new Error("Invalid IP");switch(f.length){case 1:if(f[0]>4294967295)throw new Error("Invalid IP");return f[0]>>>0;case 2:if(f[0]>255||f[1]>16777215)throw new Error("Invalid IP");return(f[0]<<24|f[1])>>>0;case 3:if(f[0]>255||f[1]>255||f[2]>65535)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2])>>>0;case 4:if(f[0]>255||f[1]>255||f[2]>255||f[3]>255)throw new Error("Invalid IP");return(f[0]<<24|f[1]<<16|f[2]<<8|f[3])>>>0;default:throw new Error("Invalid IP")}},r=function(c){return c.charCodeAt(0)},n=r("0"),o=r("a"),i=r("A"),e=function(c){var f,u,l,p,d;for(p=0,f=10,u="9",l=0,c.length>1&&c[l]==="0"&&(c[l+1]==="x"||c[l+1]==="X"?(l+=2,f=16):"0"<=c[l+1]&&c[l+1]<="9"&&(l++,f=8,u="7")),d=l;l<c.length;){if("0"<=c[l]&&c[l]<=u)p=p*f+(r(c[l])-n)>>>0;else if(f===16)if("a"<=c[l]&&c[l]<="f")p=p*f+(10+r(c[l])-o)>>>0;else if("A"<=c[l]&&c[l]<="F")p=p*f+(10+r(c[l])-i)>>>0;else break;else break;if(p>4294967295)throw new Error("too large");l++}if(l===d)throw new Error("empty octet");return[p,l]},t=function(){function c(f,u){var l,p,d,h;if(typeof f!="string")throw new Error("Missing `net' parameter");if(u||(h=f.split("/",2),f=h[0],u=h[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=s(u)}catch(y){throw l=y,new Error("Invalid mask: "+u)}for(p=d=32;d>=0;p=--d)if(this.maskLong===4294967295<<32-p>>>0){this.bitmask=p;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(s(f)&this.maskLong)>>>0}catch(y){throw l=y,new Error("Invalid net address: "+f)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return c.prototype.contains=function(f){return typeof f=="string"&&(f.indexOf("/")>0||f.split(".").length!==4)&&(f=new c(f)),f instanceof c?this.contains(f.base)&&this.contains(f.broadcast||f.last):(s(f)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},c.prototype.next=function(f){return f==null&&(f=1),new c(a(this.netLong+this.size*f),this.mask)},c.prototype.forEach=function(f){var u,l,p;for(p=s(this.first),l=s(this.last),u=0;p<=l;)f(a(p),p,u),u++,p++},c.prototype.toString=function(){return this.base+"/"+this.bitmask},c}(),_n.ip2long=s,_n.long2ip=a,_n.Netmask=t}).call(_n)});var jc=ft((Jc,ki)=>{(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function c(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let y=0,g=-1,x=(d.match(a.zoneIndex)||[])[0],m,v;for(x&&(x=x.substring(1),d=d.replace(/%.+$/,""));(g=d.indexOf(":",g+1))>=0;)y++;if(d.substr(0,2)==="::"&&y--,d.substr(-2,2)==="::"&&y--,y>h)return null;for(v=h-y,m=":";v--;)m+="0:";return d=d.replace("::",m),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){let _=d.split(":"),E=[];for(let S=0;S<_.length;S++)E.push(parseInt(_[S],16));return E}(),{parts:h,zoneId:x}}function f(d,h,y,g){if(d.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,m;for(;g>0;){if(m=y-g,m<0&&(m=0),d[x]>>m!==h[x]>>m)return!1;g-=y,x+=1}return!0}function u(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(n.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function l(d,h){for(;d.length<h;)d=`0${d}`;return d}let p={};p.IPv4=function(){function d(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let y,g;for(y=0;y<h.length;y++)if(g=h[y],!(0<=g&&g<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return f(this.octets,h.octets,8,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,m,v;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(v=g[m],y&&v!==0)return null;v!==8&&(y=!0),h+=v}else return null;return 32-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),p.IPv4.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<4;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.isIPv4=function(d){return this.parser(d)!==null},p.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(d){return!!(p.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<4;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},p.IPv4.parse=function(d){let h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},p.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){let y=parseInt(h[2]);if(y>=0&&y<=32){let g=[this.parse(h[1]),y];return Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},p.IPv4.parser=function(d){let h,y,g;if(h=d.match(r.fourOctet))return function(){let x=h.slice(1,6),m=[];for(let v=0;v<x.length;v++)y=x[v],m.push(u(y));return m}();if(h=d.match(r.longValue)){if(g=u(h[1]),g>4294967295||g<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],m;for(m=0;m<=24;m+=8)x.push(g>>m&255);return x}().reverse()}else return(h=d.match(r.twoOctet))?function(){let x=h.slice(1,4),m=[];if(g=u(x[1]),g>16777215||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(g>>16&255),m.push(g>>8&255),m.push(g&255),m}():(h=d.match(r.threeOctet))?function(){let x=h.slice(1,5),m=[];if(g=u(x[2]),g>65535||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(u(x[1])),m.push(g>>8&255),m.push(g&255),m}():null},p.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<4&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.IPv6=function(){function d(h,y){let g,x;if(h.length===16)for(this.parts=[],g=0;g<=14;g+=2)this.parts.push(h[g]<<8|h[g+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=0;g<this.parts.length;g++)if(x=this.parts[g],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");y&&(this.zoneId=y)}return d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],reserved:[[new d([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[new d([8193,4,274,0,0,0,0,0]),48],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(h,y){let g;if(y===void 0&&(g=h,h=g[0],y=g[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return f(this.parts,h.parts,16,y)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,y=!1,g={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},x,m;for(let v=7;v>=0;v-=1)if(x=this.parts[v],x in g){if(m=g[x],y&&m!==0)return null;m!==16&&(y=!0),h+=m}else return null;return 128-h},d.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h,y=[],g=this.parts;for(let x=0;x<g.length;x++)h=g[x],y.push(h>>8),y.push(h&255);return y},d.prototype.toFixedLengthString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(l(this.parts[x].toString(16),4));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),y=h[0],g=h[1];return new p.IPv4([y>>8,y&255,g>>8,g&255])},d.prototype.toNormalizedString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(this.parts[x].toString(16));return g}.call(this).join(":"),y="";return this.zoneId&&(y=`%${this.zoneId}`),h+y},d.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,y=this.toNormalizedString(),g=0,x=-1,m;for(;m=h.exec(y);)m[0].length>x&&(g=m.index,x=m[0].length);return x<0?y:`${y.substring(0,g)}::${y.substring(g+x)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),p.IPv6.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),y=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<16;)x.push(parseInt(y[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},p.IPv6.isIPv6=function(d){return this.parser(d)!==null},p.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(d){let h,y,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],y=0;y<16;)x.push(parseInt(g[y],10)&parseInt(m[y],10)),y++;return new this(x)}catch(v){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${v})`)}},p.IPv6.parse=function(d){let h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},p.IPv6.parseCIDR=function(d){let h,y,g;if((y=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(y[2]),h>=0&&h<=128))return g=[this.parse(y[1]),h],Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},p.IPv6.parser=function(d){let h,y,g,x,m,v;if(g=d.match(a.deprecatedTransitional))return this.parser(`::ffff:${g[1]}`);if(a.native.test(d))return c(d,8);if((g=d.match(a.transitional))&&(v=g[6]||"",h=c(g[1].slice(0,-1)+v,6),h.parts)){for(m=[parseInt(g[2]),parseInt(g[3]),parseInt(g[4]),parseInt(g[5])],y=0;y<m.length;y++)if(x=m[y],!(0<=x&&x<=255))return null;return h.parts.push(m[0]<<8|m[1]),h.parts.push(m[2]<<8|m[3]),{parts:h.parts,zoneId:h.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y=0,g=Math.floor(d/8);for(;y<g;)h[y]=255,y++;return g<16&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},p.fromByteArray=function(d){let h=d.length;if(h===4)return new p.IPv4(d);if(h===16)return new p.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},p.isValid=function(d){return p.IPv6.isValid(d)||p.IPv4.isValid(d)},p.parse=function(d){if(p.IPv6.isValid(d))return p.IPv6.parse(d);if(p.IPv4.isValid(d))return p.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},p.parseCIDR=function(d){try{return p.IPv6.parseCIDR(d)}catch{try{return p.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},p.process=function(d){let h=this.parse(d);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},p.subnetMatch=function(d,h,y){let g,x,m,v;y==null&&(y="unicast");for(x in h)if(Object.prototype.hasOwnProperty.call(h,x)){for(m=h[x],m[0]&&!(m[0]instanceof Array)&&(m=[m]),g=0;g<m.length;g++)if(v=m[g],d.kind()===v[0].kind()&&d.match.apply(d,v))return x}return y},typeof ki<"u"&&ki.exports?ki.exports=p:t.ipaddr=p})(Jc)});var Qy={};It(Qy,{autoNAT:()=>Zy});var Jy=Symbol.for("@libp2p/connection");var t2=Symbol.for("@libp2p/content-routing");var n2=Symbol.for("@libp2p/peer-discovery");var sa=Symbol.for("@libp2p/peer-id");var s2=Symbol.for("@libp2p/peer-routing");var aa;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(aa||(aa={}));var u2=Symbol.for("@libp2p/transport");var fa;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(fa||(fa={}));var $=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Oi="ERR_TIMEOUT";var Ki=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},d2=globalThis.CustomEvent??Ki;var Fi=(t,...e)=>{try{[...e]}catch{}};var zi={};It(zi,{base58btc:()=>Bt,base58flickr:()=>Iu});function wu(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 o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,c=t.charAt(0),f=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,y++;for(var v=(m-x)*u+1>>>0,_=new Uint8Array(v);x!==m;){for(var E=h[x],S=0,L=v-1;(E!==0||S<g)&&L!==-1;L--,S++)E+=256*_[L]>>>0,_[L]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var D=v-g;D!==v&&_[D]===0;)D++;for(var H=c.repeat(y);D<v;++D)H+=t.charAt(_[D]);return H}function p(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var y=0;if(h[y]!==" "){for(var g=0,x=0;h[y]===c;)g++,y++;for(var m=(h.length-y)*f+1>>>0,v=new Uint8Array(m);h[y];){var _=r[h.charCodeAt(y)];if(_===255)return;for(var E=0,S=m-1;(_!==0||E<x)&&S!==-1;S--,E++)_+=a*v[S]>>>0,v[S]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");x=E,y++}if(h[y]!==" "){for(var L=m-x;L!==m&&v[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),H=g;L!==m;)D[H++]=v[L++];return D}}}function d(h){var y=p(h);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:d}}var Eu=wu,Su=Eu,ca=Su;var z2=new Uint8Array(0);var ua=(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},Be=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 la=t=>new TextEncoder().encode(t),ha=t=>new TextDecoder().decode(t);var Mi=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")}},Vi=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return pa(this,e)}},qi=class{constructor(e){this.decoders=e}or(e){return pa(this,e)}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`)}},pa=(t,e)=>new qi({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Hi=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Mi(e,r,n),this.decoder=new Vi(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Ar=({name:t,prefix:e,encode:r,decode:n})=>new Hi(t,e,r,n),He=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=ca(r,e);return Ar({prefix:t,name:e,encode:n,decode:o=>Be(i(o))})},Bu=(t,e,r,n)=>{let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,c=0,f=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<r|l,a+=r,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},Au=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},mt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Ar({prefix:e,name:t,encode(i){return Au(i,n,r)},decode(i){return Bu(i,n,r,t)}});var Bt=He({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Iu=He({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var $i={};It($i,{base10:()=>Tu});var Tu=He({prefix:"9",name:"base10",alphabet:"0123456789"});var Gi={};It(Gi,{base16:()=>Cu,base16upper:()=>_u});var Cu=mt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_u=mt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Wi={};It(Wi,{base2:()=>Ru});var Ru=mt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Yi={};It(Yi,{base256emoji:()=>Nu});var ya=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Lu=ya.reduce((t,e,r)=>(t[r]=e,t),[]),Du=ya.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Pu(t){return t.reduce((e,r)=>(e+=Lu[r],e),"")}function ku(t){let e=[];for(let r of t){let n=Du[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Nu=Ar({prefix:"\u{1F680}",name:"base256emoji",encode:Pu,decode:ku});var Zi={};It(Zi,{base32:()=>Ae,base32hex:()=>Fu,base32hexpad:()=>Vu,base32hexpadupper:()=>qu,base32hexupper:()=>Mu,base32pad:()=>Ou,base32padupper:()=>Ku,base32upper:()=>Uu,base32z:()=>Hu});var Ae=mt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Uu=mt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ou=mt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Ku=mt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Fu=mt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Mu=mt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Vu=mt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qu=mt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Hu=mt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Qi={};It(Qi,{base36:()=>zu,base36upper:()=>$u});var zu=He({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$u=He({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Xi={};It(Xi,{base64:()=>Ln,base64pad:()=>Gu,base64url:()=>Wu,base64urlpad:()=>Yu});var Ln=mt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Gu=mt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Wu=mt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Yu=mt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ji={};It(Ji,{base8:()=>Zu});var Zu=mt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ji={};It(ji,{identity:()=>Qu});var Qu=Ar({prefix:"\0",name:"identity",encode:t=>ha(t),decode:t=>la(t)});var og=new TextEncoder,sg=new TextDecoder;var eo={};It(eo,{identity:()=>ze});var ju=ma,ga=128,tl=127,el=~tl,rl=Math.pow(2,31);function ma(t,e,r){e=e||[],r=r||0;for(var n=r;t>=rl;)e[r++]=t&255|ga,t/=128;for(;t&el;)e[r++]=t&255|ga,t>>>=7;return e[r]=t|0,ma.bytes=r-n+1,e}var nl=to,il=128,xa=127;function to(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw to.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&xa)<<i:(s&xa)*Math.pow(2,i),i+=7}while(s>=il);return to.bytes=o-n,r}var ol=Math.pow(2,7),sl=Math.pow(2,14),al=Math.pow(2,21),fl=Math.pow(2,28),cl=Math.pow(2,35),ul=Math.pow(2,42),ll=Math.pow(2,49),hl=Math.pow(2,56),dl=Math.pow(2,63),pl=function(t){return t<ol?1:t<sl?2:t<al?3:t<fl?4:t<cl?5:t<ul?6:t<ll?7:t<hl?8:t<dl?9:10},yl={encode:ju,decode:nl,encodingLength:pl},gl=yl,rn=gl;var nn=(t,e=0)=>[rn.decode(t,e),rn.decode.bytes],Ir=(t,e,r=0)=>(rn.encode(t,e,r),e),Tr=t=>rn.encodingLength(t);var ye=(t,e)=>{let r=e.byteLength,n=Tr(t),i=n+Tr(r),o=new Uint8Array(i+r);return Ir(t,o,0),Ir(r,o,n),o.set(e,i),new Cr(t,r,e,o)},or=t=>{let e=Be(t),[r,n]=nn(e),[i,o]=nn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Cr(r,i,s,e)},ba=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&ua(t.bytes,r.bytes)}},Cr=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var va=0,xl="identity",wa=Be,ml=t=>ye(va,wa(t)),ze={code:va,name:xl,encode:wa,digest:ml};var io={};It(io,{sha256:()=>kt,sha512:()=>bl});var no=({name:t,code:e,encode:r})=>new ro(t,e,r),ro=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ye(this.code,r):r.then(n=>ye(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Sa=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),kt=no({name:"sha2-256",code:18,encode:Sa("SHA-256")}),bl=no({name:"sha2-512",code:19,encode:Sa("SHA-512")});var Ba=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return wl(r,oo(t),e||Bt.encoder);default:return El(r,oo(t),e||Ae.encoder)}};var Aa=new WeakMap,oo=t=>{let e=Aa.get(t);if(e==null){let r=new Map;return Aa.set(t,r),r}return e},re=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==on)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Sl)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ye(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&ba(e.multihash,n.multihash)}toString(e){return Ba(this,e)}toJSON(){return{"/":Ba(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s||Ia(n,i,o.bytes))}else if(r[Bl]===!0){let{version:n,multihash:i,code:o}=r,s=or(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==on)throw new Error(`Version 0 CID must use dag-pb (code: ${on}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Ia(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,on,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Be(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Cr(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=nn(e.subarray(r));return r+=p,l},i=n(),o=on;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),c=n(),f=r+c,u=f-s;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u,size:f}}static parse(e,r){let[n,i]=vl(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return oo(o).set(n,e),o}},vl=(t,e)=>{switch(t[0]){case"Q":{let r=e||Bt;return[Bt.prefix,r.decode(`${Bt.prefix}${t}`)]}case Bt.prefix:{let r=e||Bt;return[Bt.prefix,r.decode(t)]}case Ae.prefix:{let r=e||Ae;return[Ae.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)]}}},wl=(t,e,r)=>{let{prefix:n}=r;if(n!==Bt.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},El=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},on=112,Sl=18,Ia=(t,e,r)=>{let n=Tr(t),i=n+Tr(e),o=new Uint8Array(i+r.byteLength);return Ir(t,o,0),Ir(e,o,n),o.set(r,i),o},Bl=Symbol.for("@ipld/js-cid/CID");var Vt={...ji,...Wi,...Ji,...$i,...Gi,...Zi,...Qi,...zi,...Xi,...Yi},Eg={...io,...eo};function Yt(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 Al=Symbol.for("nodejs.util.inspect.custom"),Ta=Object.values(Vt).map(t=>t.decoder).reduce((t,e)=>t.or(e),Vt.identity.decoder),Ca=114,so=36,ao=37,sn=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[sa]=!0;toString(){return this.string==null&&(this.string=Bt.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return re.createV1(Ca,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Yt(this.multihash.bytes,e);if(typeof e=="string")return Il(e).equals(this);if(e?.multihash?.bytes!=null)return Yt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Al](){return`PeerId(${this.toString()})`}},_r=class extends sn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Rr=class extends sn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Lr=class extends sn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function Il(t,e){if(e=e??Ta,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=or(Bt.decode(`z${t}`));return t.startsWith("12D")?new Rr({multihash:r}):t.startsWith("16U")?new Lr({multihash:r}):new _r({multihash:r})}return Pn(Ta.decode(t))}function Pn(t){try{let e=or(t);if(e.code===ze.code){if(e.digest.length===so)return new Rr({multihash:e});if(e.digest.length===ao)return new Lr({multihash:e})}if(e.code===kt.code)return new _r({multihash:e})}catch{return Tl(re.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Tl(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==Ca)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===kt.code)return new _r({multihash:t.multihash});if(e.code===ze.code){if(e.digest.length===so)return new Rr({multihash:t.multihash});if(e.digest.length===ao)return new Lr({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function _a(t,e){return t.length===so?new Rr({multihash:ye(ze.code,t),privateKey:e}):t.length===ao?new Lr({multihash:ye(ze.code,t),privateKey:e}):new _r({multihash:await kt.digest(t),publicKey:t,privateKey:e})}var Kv=Ut(un(),1),Fv=Ut($0(),1);var $1=Ut(ct(),1);function hr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Jn(t=0){return globalThis.Buffer?.allocUnsafe!=null?hr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function W0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var G0=W0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Lo=W0("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=Jn(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Jd={utf8:G0,"utf-8":G0,hex:Vt.base16,latin1:Lo,ascii:Lo,binary:Lo,...Vt},jn=Jd;function Ht(t,e="utf8"){let r=jn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?hr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var cs={};It(cs,{Ed25519PrivateKey:()=>vr,Ed25519PublicKey:()=>bn,generateKeyPair:()=>y1,generateKeyPairFromSeed:()=>kf,unmarshalEd25519PrivateKey:()=>d1,unmarshalEd25519PublicKey:()=>p1});var bx=Ut(wt(),1),vx=Ut(Yn(),1),Y0=Ut(ct(),1);function dr(t,e){if(globalThis.Buffer!=null)return hr(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Jn(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return hr(r)}function Zt(t,e="utf8"){let r=jn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function oe(t,e){let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.subarray(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=dr([new Uint8Array(e-r.length),r])}return Zt(r,"base64url")}function Qt(t){let e=Z0(t);return new Y0.default.jsbn.BigInteger(Zt(e,"base16"),16)}function Z0(t,e){let r=Ht(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=dr([new Uint8Array(e-r.length),r])}return r}function te(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}function Q0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function jd(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Do(t,...e){if(!jd(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function X0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Q0(t.outputLen),Q0(t.blockLen)}function Ur(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function J0(t,e){Do(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var ti=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function j0(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var ei=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),se=(t,e)=>t<<32-e|t>>>e,tp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!tp)throw new Error("Non little-endian hardware is not supported");function Po(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function dn(t){if(typeof t=="string"&&(t=Po(t)),!j0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function ri(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!j0(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Or=class{clone(){return this._cloneInto()}},Cx={}.toString;function ni(t){let e=n=>t().update(dn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Kr(t=32){if(ti&&typeof ti.getRandomValues=="function")return ti.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function ep(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),c=n?4:0,f=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+f,a,n)}var Fr=class extends Or{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ei(this.buffer)}update(e){Ur(this);let{view:r,buffer:n,blockLen:i}=this;e=dn(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let c=ei(e);for(;i<=o-s;s+=i)this.process(c,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ur(this),J0(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;ep(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=ei(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let f=c/4,u=this.get();if(f>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<f;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var ii=BigInt(4294967295),ko=BigInt(32);function tf(t,e=!1){return e?{h:Number(t&ii),l:Number(t>>ko&ii)}:{h:Number(t>>ko&ii)|0,l:Number(t&ii)|0}}function rp(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=tf(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var np=(t,e)=>BigInt(t>>>0)<<ko|BigInt(e>>>0),ip=(t,e,r)=>t>>>r,op=(t,e,r)=>t<<32-r|e>>>r,sp=(t,e,r)=>t>>>r|e<<32-r,ap=(t,e,r)=>t<<32-r|e>>>r,fp=(t,e,r)=>t<<64-r|e>>>r-32,cp=(t,e,r)=>t>>>r-32|e<<64-r,up=(t,e)=>e,lp=(t,e)=>t,hp=(t,e,r)=>t<<r|e>>>32-r,dp=(t,e,r)=>e<<r|t>>>32-r,pp=(t,e,r)=>e<<r-32|t>>>64-r,yp=(t,e,r)=>t<<r-32|e>>>64-r;function gp(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var xp=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),mp=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,bp=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),vp=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,wp=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Ep=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Sp={fromBig:tf,split:rp,toBig:np,shrSH:ip,shrSL:op,rotrSH:sp,rotrSL:ap,rotrBH:fp,rotrBL:cp,rotr32H:up,rotr32L:lp,rotlSH:hp,rotlSL:dp,rotlBH:pp,rotlBL:yp,add:gp,add3L:xp,add3H:mp,add4L:bp,add4H:vp,add5H:Ep,add5L:wp},W=Sp;var[Bp,Ap]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),Ze=new Uint32Array(80),Qe=new Uint32Array(80),No=class extends Fr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:f,El:u,Fh:l,Fl:p,Gh:d,Gl:h,Hh:y,Hl:g}=this;return[e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g]}set(e,r,n,i,o,s,a,c,f,u,l,p,d,h,y,g){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=f|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=d|0,this.Gl=h|0,this.Hh=y|0,this.Hl=g|0}process(e,r){for(let v=0;v<16;v++,r+=4)Ze[v]=e.getUint32(r),Qe[v]=e.getUint32(r+=4);for(let v=16;v<80;v++){let _=Ze[v-15]|0,E=Qe[v-15]|0,S=W.rotrSH(_,E,1)^W.rotrSH(_,E,8)^W.shrSH(_,E,7),L=W.rotrSL(_,E,1)^W.rotrSL(_,E,8)^W.shrSL(_,E,7),D=Ze[v-2]|0,H=Qe[v-2]|0,q=W.rotrSH(D,H,19)^W.rotrBH(D,H,61)^W.shrSH(D,H,6),M=W.rotrSL(D,H,19)^W.rotrBL(D,H,61)^W.shrSL(D,H,6),X=W.add4L(L,M,Qe[v-7],Qe[v-16]),at=W.add4H(X,S,q,Ze[v-7],Ze[v-16]);Ze[v]=at|0,Qe[v]=X|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:f,Dl:u,Eh:l,El:p,Fh:d,Fl:h,Gh:y,Gl:g,Hh:x,Hl:m}=this;for(let v=0;v<80;v++){let _=W.rotrSH(l,p,14)^W.rotrSH(l,p,18)^W.rotrBH(l,p,41),E=W.rotrSL(l,p,14)^W.rotrSL(l,p,18)^W.rotrBL(l,p,41),S=l&d^~l&y,L=p&h^~p&g,D=W.add5L(m,E,L,Ap[v],Qe[v]),H=W.add5H(D,x,_,S,Bp[v],Ze[v]),q=D|0,M=W.rotrSH(n,i,28)^W.rotrBH(n,i,34)^W.rotrBH(n,i,39),X=W.rotrSL(n,i,28)^W.rotrBL(n,i,34)^W.rotrBL(n,i,39),at=n&o^n&a^o&a,Lt=i&s^i&c^s&c;x=y|0,m=g|0,y=d|0,g=h|0,d=l|0,h=p|0,{h:l,l:p}=W.add(f|0,u|0,H|0,q|0),f=a|0,u=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let T=W.add3L(q,X,Lt);n=W.add3H(T,H,M,at),i=T|0}({h:n,l:i}=W.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=W.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=W.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:f,l:u}=W.add(this.Dh|0,this.Dl|0,f|0,u|0),{h:l,l:p}=W.add(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:h}=W.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:y,l:g}=W.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:x,l:m}=W.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,o,s,a,c,f,u,l,p,d,h,y,g,x,m)}roundClean(){Ze.fill(0),Qe.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Uo=ni(()=>new No);var si={};It(si,{bitGet:()=>Dp,bitLen:()=>Lp,bitMask:()=>pn,bitSet:()=>Pp,bytesToHex:()=>Re,bytesToNumberBE:()=>Le,bytesToNumberLE:()=>Xe,concatBytes:()=>De,createHmacDrbg:()=>Fo,ensureBytes:()=>bt,equalBytes:()=>_p,hexToBytes:()=>pr,hexToNumber:()=>Ko,isBytes:()=>ae,numberToBytesBE:()=>Je,numberToBytesLE:()=>yr,numberToHexUnpadded:()=>of,numberToVarBytesBE:()=>Cp,utf8ToBytes:()=>Rp,validateObject:()=>Ee});var nf=BigInt(0),oi=BigInt(1),Ip=BigInt(2);function ae(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var Tp=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Re(t){if(!ae(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Tp[t[r]];return e}function of(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Ko(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var _e={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function ef(t){if(t>=_e._0&&t<=_e._9)return t-_e._0;if(t>=_e._A&&t<=_e._F)return t-(_e._A-10);if(t>=_e._a&&t<=_e._f)return t-(_e._a-10)}function pr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=ef(t.charCodeAt(o)),a=ef(t.charCodeAt(o+1));if(s===void 0||a===void 0){let c=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+o)}n[i]=s*16+a}return n}function Le(t){return Ko(Re(t))}function Xe(t){if(!ae(t))throw new Error("Uint8Array expected");return Ko(Re(Uint8Array.from(t).reverse()))}function Je(t,e){return pr(t.toString(16).padStart(e*2,"0"))}function yr(t,e){return Je(t,e).reverse()}function Cp(t){return pr(of(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=pr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ae(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function De(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!ae(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function _p(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function Rp(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function Lp(t){let e;for(e=0;t>nf;t>>=oi,e+=1);return e}function Dp(t,e){return t>>BigInt(e)&oi}var Pp=(t,e,r)=>t|(r?oi:nf)<<BigInt(e),pn=t=>(Ip<<BigInt(t-1))-oi,Oo=t=>new Uint8Array(t),rf=t=>Uint8Array.from(t);function Fo(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Oo(t),i=Oo(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),c=(l=Oo())=>{i=a(rf([0]),l),n=a(),l.length!==0&&(i=a(rf([1]),l),n=a())},f=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,p=[];for(;l<e;){n=a();let d=n.slice();p.push(d),l+=n.length}return De(...p)};return(l,p)=>{s(),c(l);let d;for(;!(d=p(f()));)c();return s(),d}}var kp={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ae(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Ee(t,e,r={}){let n=(i,o,s)=>{let a=kp[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let c=t[i];if(!(s&&c===void 0)&&!a(c,t))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var At=BigInt(0),yt=BigInt(1),gr=BigInt(2),Np=BigInt(3),Mo=BigInt(4),sf=BigInt(5),af=BigInt(8),Up=BigInt(9),Op=BigInt(16);function ut(t,e){let r=t%e;return r>=At?r:e+r}function Kp(t,e,r){if(r<=At||e<At)throw new Error("Expected power/modulo > 0");if(r===yt)return At;let n=yt;for(;e>At;)e&yt&&(n=n*t%r),t=t*t%r,e>>=yt;return n}function gt(t,e,r){let n=t;for(;e-- >At;)n*=n,n%=r;return n}function ai(t,e){if(t===At||e<=At)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=At,o=yt,s=yt,a=At;for(;r!==At;){let f=n/r,u=n%r,l=i-s*f,p=o-a*f;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==yt)throw new Error("invert: does not exist");return ut(i,e)}function Fp(t){let e=(t-yt)/gr,r,n,i;for(r=t-yt,n=0;r%gr===At;r/=gr,n++);for(i=gr;i<t&&Kp(i,e,t)!==t-yt;i++);if(n===1){let s=(t+yt)/Mo;return function(c,f){let u=c.pow(f,s);if(!c.eql(c.sqr(u),f))throw new Error("Cannot find square root");return u}}let o=(r+yt)/gr;return function(a,c){if(a.pow(c,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let f=n,u=a.pow(a.mul(a.ONE,i),r),l=a.pow(c,o),p=a.pow(c,r);for(;!a.eql(p,a.ONE);){if(a.eql(p,a.ZERO))return a.ZERO;let d=1;for(let y=a.sqr(p);d<f&&!a.eql(y,a.ONE);d++)y=a.sqr(y);let h=a.pow(u,yt<<BigInt(f-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),f=d}return l}}function Mp(t){if(t%Mo===Np){let e=(t+yt)/Mo;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%af===sf){let e=(t-sf)/af;return function(n,i){let o=n.mul(i,gr),s=n.pow(o,e),a=n.mul(i,s),c=n.mul(n.mul(a,gr),s),f=n.mul(a,n.sub(c,n.ONE));if(!n.eql(n.sqr(f),i))throw new Error("Cannot find square root");return f}}return t%Op,Fp(t)}var ff=(t,e)=>(ut(t,e)&yt)===yt,Vp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Vo(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Vp.reduce((n,i)=>(n[i]="function",n),e);return Ee(t,r)}function qp(t,e,r){if(r<At)throw new Error("Expected power > 0");if(r===At)return t.ONE;if(r===yt)return e;let n=t.ONE,i=e;for(;r>At;)r&yt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=yt;return n}function Hp(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function qo(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function fi(t,e,r=!1,n={}){if(t<=At)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=qo(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=Mp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:pn(i),ZERO:At,ONE:yt,create:c=>ut(c,t),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return At<=c&&c<t},is0:c=>c===At,isOdd:c=>(c&yt)===yt,neg:c=>ut(-c,t),eql:(c,f)=>c===f,sqr:c=>ut(c*c,t),add:(c,f)=>ut(c+f,t),sub:(c,f)=>ut(c-f,t),mul:(c,f)=>ut(c*f,t),pow:(c,f)=>qp(a,c,f),div:(c,f)=>ut(c*ai(f,t),t),sqrN:c=>c*c,addN:(c,f)=>c+f,subN:(c,f)=>c-f,mulN:(c,f)=>c*f,inv:c=>ai(c,t),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>Hp(a,c),cmov:(c,f,u)=>u?f:c,toBytes:c=>r?yr(c,o):Je(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return r?Xe(c):Le(c)}});return Object.freeze(a)}function cf(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function uf(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function Ho(t){let e=uf(t);return e+Math.ceil(e/2)}function lf(t,e,r=!1){let n=t.length,i=uf(e),o=Ho(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?Le(t):Xe(t),a=ut(s,e-yt)+yt;return r?yr(a,i):Je(a,i)}var $p=BigInt(0),zo=BigInt(1);function ci(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>$p;)o&zo&&(s=s.add(a)),a=a.double(),o>>=zo;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),c=[],f=i,u=f;for(let l=0;l<s;l++){u=f,c.push(u);for(let p=1;p<a;p++)u=u.add(f),c.push(u);f=u.double()}return c},wNAF(i,o,s){let{windows:a,windowSize:c}=n(i),f=t.ZERO,u=t.BASE,l=BigInt(2**i-1),p=2**i,d=BigInt(i);for(let h=0;h<a;h++){let y=h*c,g=Number(s&l);s>>=d,g>c&&(g-=p,s+=zo);let x=y,m=y+Math.abs(g)-1,v=h%2!==0,_=g<0;g===0?u=u.add(r(v,o[x])):f=f.add(r(_,o[m]))}return{p:f,f:u}},wNAFCached(i,o,s,a){let c=i._WINDOW_SIZE||1,f=o.get(i);return f||(f=this.precomputeWindow(i,c),c!==1&&o.set(i,a(f))),this.wNAF(c,f,s)}}}function yn(t){return Vo(t.Fp),Ee(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...qo(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var fe=BigInt(0),Xt=BigInt(1),ui=BigInt(2),Gp=BigInt(8),Wp={zip215:!0};function Yp(t){let e=yn(t);return Ee(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function li(t){let e=Yp(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,f=ui<<BigInt(a*8)-Xt,u=r.create,l=e.uvRatio||((P,A)=>{try{return{isValid:!0,value:r.sqrt(P*r.inv(A))}}catch{return{isValid:!1,value:fe}}}),p=e.adjustScalarBytes||(P=>P),d=e.domain||((P,A,O)=>{if(A.length||O)throw new Error("Contexts/pre-hash are not supported");return P}),h=P=>typeof P=="bigint"&&fe<P,y=(P,A)=>h(P)&&h(A)&&P<A,g=P=>P===fe||y(P,f);function x(P,A){if(y(P,A))return P;throw new Error(`Expected valid scalar < ${A}, got ${typeof P} ${P}`)}function m(P){return P===fe?P:x(P,n)}let v=new Map;function _(P){if(!(P instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(A,O,K,V){if(this.ex=A,this.ey=O,this.ez=K,this.et=V,!g(A))throw new Error("x required");if(!g(O))throw new Error("y required");if(!g(K))throw new Error("z required");if(!g(V))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(A){if(A instanceof E)throw new Error("extended point not allowed");let{x:O,y:K}=A||{};if(!g(O)||!g(K))throw new Error("invalid affine point");return new E(O,K,Xt,u(O*K))}static normalizeZ(A){let O=r.invertBatch(A.map(K=>K.ez));return A.map((K,V)=>K.toAffine(O[V])).map(E.fromAffine)}_setWindowSize(A){this._WINDOW_SIZE=A,v.delete(this)}assertValidity(){let{a:A,d:O}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:K,ey:V,ez:Z,et:J}=this,ot=u(K*K),j=u(V*V),rt=u(Z*Z),vt=u(rt*rt),xt=u(ot*A),Dt=u(rt*u(xt+j)),Pt=u(vt+u(O*u(ot*j)));if(Dt!==Pt)throw new Error("bad point: equation left != right (1)");let St=u(K*V),Nt=u(Z*J);if(St!==Nt)throw new Error("bad point: equation left != right (2)")}equals(A){_(A);let{ex:O,ey:K,ez:V}=this,{ex:Z,ey:J,ez:ot}=A,j=u(O*ot),rt=u(Z*V),vt=u(K*ot),xt=u(J*V);return j===rt&&vt===xt}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:A}=e,{ex:O,ey:K,ez:V}=this,Z=u(O*O),J=u(K*K),ot=u(ui*u(V*V)),j=u(A*Z),rt=O+K,vt=u(u(rt*rt)-Z-J),xt=j+J,Dt=xt-ot,Pt=j-J,St=u(vt*Dt),Nt=u(xt*Pt),Se=u(vt*Pt),ir=u(Dt*xt);return new E(St,Nt,ir,Se)}add(A){_(A);let{a:O,d:K}=e,{ex:V,ey:Z,ez:J,et:ot}=this,{ex:j,ey:rt,ez:vt,et:xt}=A;if(O===BigInt(-1)){let Js=u((Z-V)*(rt+j)),js=u((Z+V)*(rt-j)),Ui=u(js-Js);if(Ui===fe)return this.double();let ta=u(J*ui*xt),ea=u(ot*ui*vt),ra=ea+ta,na=js+Js,ia=ea-ta,lu=u(ra*Ui),hu=u(na*ia),du=u(ra*ia),pu=u(Ui*na);return new E(lu,hu,pu,du)}let Dt=u(V*j),Pt=u(Z*rt),St=u(ot*K*xt),Nt=u(J*vt),Se=u((V+Z)*(j+rt)-Dt-Pt),ir=Nt-St,en=Nt+St,Xs=u(Pt-O*Dt),au=u(Se*ir),fu=u(en*Xs),cu=u(Se*Xs),uu=u(ir*en);return new E(au,fu,uu,cu)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,v,A,E.normalizeZ)}multiply(A){let{p:O,f:K}=this.wNAF(x(A,n));return E.normalizeZ([O,K])[0]}multiplyUnsafe(A){let O=m(A);return O===fe?L:this.equals(L)||O===Xt?this:this.equals(S)?this.wNAF(O).p:D.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return D.unsafeLadder(this,n).is0()}toAffine(A){let{ex:O,ey:K,ez:V}=this,Z=this.is0();A==null&&(A=Z?Gp:r.inv(V));let J=u(O*A),ot=u(K*A),j=u(V*A);if(Z)return{x:fe,y:Xt};if(j!==Xt)throw new Error("invZ was invalid");return{x:J,y:ot}}clearCofactor(){let{h:A}=e;return A===Xt?this:this.multiplyUnsafe(A)}static fromHex(A,O=!1){let{d:K,a:V}=e,Z=r.BYTES;A=bt("pointHex",A,Z);let J=A.slice(),ot=A[Z-1];J[Z-1]=ot&-129;let j=Xe(J);j===fe||(O?x(j,f):x(j,r.ORDER));let rt=u(j*j),vt=u(rt-Xt),xt=u(K*rt-V),{isValid:Dt,value:Pt}=l(vt,xt);if(!Dt)throw new Error("Point.fromHex: invalid y coordinate");let St=(Pt&Xt)===Xt,Nt=(ot&128)!==0;if(!O&&Pt===fe&&Nt)throw new Error("Point.fromHex: x=0 and x_0=1");return Nt!==St&&(Pt=u(-Pt)),E.fromAffine({x:Pt,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=yr(O,r.BYTES);return K[K.length-1]|=A&Xt?128:0,K}toHex(){return Re(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Xt,u(e.Gx*e.Gy)),E.ZERO=new E(fe,Xt,Xt,fe);let{BASE:S,ZERO:L}=E,D=ci(E,a*8);function H(P){return ut(P,n)}function q(P){return H(Xe(P))}function M(P){let A=a;P=bt("private key",P,A);let O=bt("hashed private key",o(P),2*A),K=p(O.slice(0,A)),V=O.slice(A,2*A),Z=q(K),J=S.multiply(Z),ot=J.toRawBytes();return{head:K,prefix:V,scalar:Z,point:J,pointBytes:ot}}function X(P){return M(P).pointBytes}function at(P=new Uint8Array,...A){let O=De(...A);return q(o(d(O,bt("context",P),!!i)))}function Lt(P,A,O={}){P=bt("message",P),i&&(P=i(P));let{prefix:K,scalar:V,pointBytes:Z}=M(A),J=at(O.context,K,P),ot=S.multiply(J).toRawBytes(),j=at(O.context,ot,Z,P),rt=H(J+j*V);m(rt);let vt=De(ot,yr(rt,r.BYTES));return bt("result",vt,a*2)}let T=Wp;function k(P,A,O,K=T){let{context:V,zip215:Z}=K,J=r.BYTES;P=bt("signature",P,2*J),A=bt("message",A),i&&(A=i(A));let ot=Xe(P.slice(J,2*J)),j,rt,vt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),vt=S.multiplyUnsafe(ot)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let xt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(xt)).subtract(vt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:Lt,verify:k,ExtendedPoint:E,utils:{getExtendedPublicKey:M,randomPrivateKey:()=>s(r.BYTES),precompute(P=8,A=E.BASE){return A._setWindowSize(P),A.multiply(BigInt(3)),A}}}}var Go=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),hf=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Qx=BigInt(0),Zp=BigInt(1),$o=BigInt(2),Qp=BigInt(5),df=BigInt(10),Xp=BigInt(20),Jp=BigInt(40),pf=BigInt(80);function jp(t){let e=Go,n=t*t%e*t%e,i=gt(n,$o,e)*n%e,o=gt(i,Zp,e)*t%e,s=gt(o,Qp,e)*o%e,a=gt(s,df,e)*s%e,c=gt(a,Xp,e)*a%e,f=gt(c,Jp,e)*c%e,u=gt(f,pf,e)*f%e,l=gt(u,pf,e)*f%e,p=gt(l,df,e)*s%e;return{pow_p_5_8:gt(p,$o,e)*t%e,b2:n}}function t1(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function e1(t,e){let r=Go,n=ut(e*e*e,r),i=ut(n*n*e,r),o=jp(t*i).pow_p_5_8,s=ut(t*n*o,r),a=ut(e*s*s,r),c=s,f=ut(s*hf,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*hf,r);return u&&(s=c),(l||p)&&(s=f),ff(s,r)&&(s=ut(-s,r)),{isValid:u||l,value:s}}var Pe=fi(Go,void 0,!0),Wo={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Pe,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Uo,randomBytes:Kr,adjustScalarBytes:t1,uvRatio:e1},Mr=li(Wo);function yf(t,e,r){if(e.length>255)throw new Error("Context is too big");return ri(Po("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var Xx=li({...Wo,domain:yf}),Jx=li({...Wo,domain:yf,prehash:Uo});var r1=(Pe.ORDER+BigInt(3))/BigInt(8),jx=Pe.pow($o,r1),tm=Pe.sqrt(Pe.neg(Pe.ONE)),em=(Pe.ORDER-BigInt(5))/BigInt(8),rm=BigInt(486662);var nm=cf(Pe,Pe.neg(BigInt(486664)));var im=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),om=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),sm=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),am=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var fm=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Vr=32,ke=64,hi=32;function gf(){let t=Mr.utils.randomPrivateKey(),e=Mr.getPublicKey(t);return{privateKey:vf(t,e),publicKey:e}}function xf(t){if(t.length!==hi)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=Mr.getPublicKey(e);return{privateKey:vf(e,r),publicKey:r}}function mf(t,e){let r=t.subarray(0,hi);return Mr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function bf(t,e,r){return Mr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function vf(t,e){let r=new Uint8Array(ke);for(let n=0;n<hi;n++)r[n]=t[n],r[hi+n]=e[n];return r}var zt={get(t=globalThis){let e=t.crypto;if(e==null||e.subtle==null)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/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var Yo={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Zo(t){let e=t?.algorithm??"AES-GCM",r=t?.keyLength??16,n=t?.nonceLength??12,i=t?.digest??"SHA-256",o=t?.saltLength??16,s=t?.iterations??32767,a=zt.get();r*=8;async function c(l,p){let d=a.getRandomValues(new Uint8Array(o)),h=a.getRandomValues(new Uint8Array(n)),y={name:e,iv:h};typeof p=="string"&&(p=Ht(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},v=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,v,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},v=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,v,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return dr([d,y.iv,new Uint8Array(x)])}async function f(l,p){let d=l.subarray(0,o),h=l.subarray(o,o+n),y=l.subarray(o+n),g={name:e,iv:h};typeof p=="string"&&(p=Ht(p));let x;if(p.length===0)try{let v={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(v,_,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Yo,{name:"AES-GCM"},!0,["decrypt"])}else{let v={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},_=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(v,_,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,y);return new Uint8Array(m)}return{encrypt:c,decrypt:f}}async function qr(t,e){let n=await Zo().encrypt(t,e);return Ln.encode(n)}var Qo=new Float32Array([-0]),je=new Uint8Array(Qo.buffer);function Ef(t,e,r){Qo[0]=t,e[r]=je[0],e[r+1]=je[1],e[r+2]=je[2],e[r+3]=je[3]}function Sf(t,e){return je[0]=t[e],je[1]=t[e+1],je[2]=t[e+2],je[3]=t[e+3],Qo[0]}var Xo=new Float64Array([-0]),Ot=new Uint8Array(Xo.buffer);function Bf(t,e,r){Xo[0]=t,e[r]=Ot[0],e[r+1]=Ot[1],e[r+2]=Ot[2],e[r+3]=Ot[3],e[r+4]=Ot[4],e[r+5]=Ot[5],e[r+6]=Ot[6],e[r+7]=Ot[7]}function Af(t,e){return Ot[0]=t[e],Ot[1]=t[e+1],Ot[2]=t[e+2],Ot[3]=t[e+3],Ot[4]=t[e+4],Ot[5]=t[e+5],Ot[6]=t[e+6],Ot[7]=t[e+7],Xo[0]}var i1=BigInt(Number.MAX_SAFE_INTEGER),o1=BigInt(Number.MIN_SAFE_INTEGER),$t=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let 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}static fromBigInt(e){if(e===0n)return xr;if(e<i1&&e>o1)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>If&&(i=0n,++n>If&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return xr;let r=e<0;r&&(e=-e);let 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 t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):xr}},xr=new $t(0,0);xr.toBigInt=function(){return 0n};xr.zzEncode=xr.zzDecode=function(){return this};xr.length=function(){return 1};var If=4294967296n;function Tf(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Cf(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function Jo(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function ce(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function di(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var jo=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;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,ce(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ce(this,4);return di(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ce(this,4);return di(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ce(this,4);let e=Sf(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ce(this,4);let e=Af(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw ce(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Cf(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ce(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ce(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new $t(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw ce(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw ce(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ce(this,8);let e=di(this.buf,this.pos+=4),r=di(this.buf,this.pos+=4);return new $t(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ts(t){return new jo(t instanceof Uint8Array?t:t.subarray())}function ue(t,e){let r=ts(t);return e.decode(r)}function pi(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function mr(t=0){return globalThis.Buffer?.allocUnsafe!=null?pi(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Lf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Rf=Lf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),es=Lf("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=mr(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),s1={utf8:Rf,"utf-8":Rf,hex:Vt.base16,latin1:es,ascii:es,binary:es,...Vt},Df=s1;function Pf(t,e="utf8"){let r=Df[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?pi(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function rs(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return mr(s);i+s>e&&(n=mr(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var br=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function ns(){}var os=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},a1=rs();function f1(t){return globalThis.Buffer!=null?mr(t):a1(t)}var mn=class{len;head;tail;states;constructor(){this.len=0,this.head=new br(ns,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new br(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new ss((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(gn,10,$t.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=$t.fromBigInt(e);return this._push(gn,r.length(),r)}uint64Number(e){let r=$t.fromNumber(e);return this._push(gn,r.length(),r)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=$t.fromBigInt(e).zzEncode();return this._push(gn,r.length(),r)}sint64Number(e){let r=$t.fromNumber(e).zzEncode();return this._push(gn,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(is,1,e?1:0)}fixed32(e){return this._push(xn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=$t.fromBigInt(e);return this._push(xn,4,r.lo)._push(xn,4,r.hi)}fixed64Number(e){let r=$t.fromNumber(e);return this._push(xn,4,r.lo)._push(xn,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Ef,4,e)}double(e){return this._push(Bf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(is,1,0):this.uint32(r)._push(u1,r,e)}string(e){let r=Tf(e);return r!==0?this.uint32(r)._push(Jo,r,e):this._push(is,1,0)}fork(){return this.states=new os(this),this.head=this.tail=new br(ns,0,0),this.len=0,this}reset(){return this.states!=null?(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 br(ns,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=f1(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function is(t,e,r){e[r]=t&255}function c1(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var ss=class extends br{next;constructor(e,r){super(c1,e,r),this.next=void 0}};function gn(t,e,r){for(;t.hi!==0;)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}function xn(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 u1(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(mn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(l1,e,t),this},mn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(h1,e,t),this});function l1(t,e,r){e.set(t,r)}function h1(t,e,r){t.length<40?Jo(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(Pf(t),r)}function as(){return new mn}function le(t,e){let r=as();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Hr;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Hr||(Hr={}));function yi(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function zr(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return yi("enum",Hr.VARINT,r,n)}function he(t,e){return yi("message",Hr.LENGTH_DELIMITED,t,e)}var Rt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Rt||(Rt={}));var fs;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(fs||(fs={}));(function(t){t.codec=()=>zr(fs)})(Rt||(Rt={}));var Ne;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Rt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Rt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Ne||(Ne={}));var Ue;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Rt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Rt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Ue||(Ue={}));var bn=class{_key;constructor(e){this._key=$r(e,Vr)}verify(e,r){return bf(this._key,r,e)}marshal(){return this._key}get bytes(){return Ne.encode({Type:Rt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},vr=class{_key;_publicKey;constructor(e,r){this._key=$r(e,ke),this._publicKey=$r(r,Vr)}sign(e){return mf(this._key,e)}get public(){return new bn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Rt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}async hash(){let e=kt.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=ze.digest(this.public.bytes);return Bt.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function d1(t){if(t.length>ke){t=$r(t,ke+Vr);let n=t.subarray(0,ke),i=t.subarray(ke,t.length);return new vr(n,i)}t=$r(t,ke);let e=t.subarray(0,ke),r=t.subarray(Vr);return new vr(e,r)}function p1(t){return t=$r(t,Vr),new bn(t)}async function y1(){let{privateKey:t,publicKey:e}=gf();return new vr(t,e)}async function kf(t){let{privateKey:e,publicKey:r}=xf(t);return new vr(e,r)}function $r(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var g1={"P-256":256,"P-384":384,"P-521":521},x1=Object.keys(g1),yb=x1.join(" / ");var ps={};It(ps,{MAX_KEY_SIZE:()=>Sn,RsaPrivateKey:()=>Gr,RsaPublicKey:()=>En,fromJwk:()=>C1,generateKeyPair:()=>_1,unmarshalRsaPrivateKey:()=>I1,unmarshalRsaPublicKey:()=>T1});var wn=Ut(ct(),1);var jb=Ut(Ff(),1);function xi(t){if(isNaN(t)||t<=0)throw new $("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Kr(t)}var Nb=Ut(Xn(),1),hs=Ut(ct(),1);function Mf(t,e){return e.map(r=>Qt(t[r]))}function Vf(t){return hs.default.pki.setRsaPrivateKey(...Mf(t,["n","e","d","p","q","dp","dq","qi"]))}function qf(t){return hs.default.pki.setRsaPublicKey(...Mf(t,["n","e"]))}var Er={};It(Er,{jwkToPkcs1:()=>w1,jwkToPkix:()=>S1,pkcs1ToJwk:()=>v1,pkixToJwk:()=>E1});var Kb=Ut(un(),1),Fb=Ut(Xn(),1);var Oe=Ut(ct(),1);function v1(t){let e=Oe.default.asn1.fromDer(Zt(t,"ascii")),r=Oe.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e),d:oe(r.d),p:oe(r.p),q:oe(r.q),dp:oe(r.dP),dq:oe(r.dQ),qi:oe(r.qInv),alg:"RS256"}}function w1(t){if(t.n==null||t.e==null||t.d==null||t.p==null||t.q==null||t.dp==null||t.dq==null||t.qi==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Oe.default.pki.privateKeyToAsn1({n:Qt(t.n),e:Qt(t.e),d:Qt(t.d),p:Qt(t.p),q:Qt(t.q),dP:Qt(t.dp),dQ:Qt(t.dq),qInv:Qt(t.qi)});return Ht(Oe.default.asn1.toDer(e).getBytes(),"ascii")}function E1(t){let e=Oe.default.asn1.fromDer(Zt(t,"ascii")),r=Oe.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e)}}function S1(t){if(t.n==null||t.e==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Oe.default.pki.publicKeyToAsn1({n:Qt(t.n),e:Qt(t.e)});return Ht(Oe.default.asn1.toDer(e).getBytes(),"ascii")}async function Hf(t){let e=await zt.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 Gf(e);return{privateKey:r[0],publicKey:r[1]}}async function ds(t){let r=[await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await B1(t)],n=await Gf({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function zf(t,e){let r=await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await zt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function $f(t,e,r){let n=await zt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return zt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Gf(t){if(t.privateKey==null||t.publicKey==null)throw new $("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([zt.get().subtle.exportKey("jwk",t.privateKey),zt.get().subtle.exportKey("jwk",t.publicKey)])}async function B1(t){return zt.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function Wf(t,e,r,n){let i=e?qf(t):Vf(t),o=Zt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return Ht(s,"ascii")}function Yf(t,e){return Wf(t,!0,e,(r,n)=>n.encrypt(r))}function Zf(t,e){return Wf(t,!1,e,(r,n)=>n.decrypt(r))}function mi(t){if(t.kty!=="RSA")throw new $("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new $("invalid key modulus","ERR_INVALID_KEY_MODULUS");return Ht(t.n,"base64url").length*8}var Sn=8192,En=class{_key;constructor(e){this._key=e}verify(e,r){return $f(this._key,r,e)}marshal(){return Er.jwkToPkix(this._key)}get bytes(){return Ne.encode({Type:Rt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Yf(this._key,e)}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},Gr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return xi(16)}sign(e){return zf(this._key,e)}get public(){if(this._publicKey==null)throw new $("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new En(this._publicKey)}decrypt(e){return Zf(this._key,e)}marshal(){return Er.jwkToPkcs1(this._key)}get bytes(){return Ue.encode({Type:Rt.RSA,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Zt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new wn.default.util.ByteBuffer(this.marshal()),i=wn.default.asn1.fromDer(n),o=wn.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return wn.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function I1(t){let e=Er.pkcs1ToJwk(t);if(mi(e)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await ds(e);return new Gr(r.privateKey,r.publicKey)}function T1(t){let e=Er.pkixToJwk(t);if(mi(e)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new En(e)}async function C1(t){if(mi(t)>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await ds(t);return new Gr(e.privateKey,e.publicKey)}async function _1(t){if(t>Sn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await Hf(t);return new Gr(e.privateKey,e.publicKey)}var vs={};It(vs,{Secp256k1PrivateKey:()=>An,Secp256k1PublicKey:()=>Bn,generateKeyPair:()=>z1,unmarshalSecp256k1PrivateKey:()=>q1,unmarshalSecp256k1PublicKey:()=>H1});var R1=(t,e,r)=>t&e^~t&r,L1=(t,e,r)=>t&e^t&r^e&r,D1=new Uint32Array([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]),tr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),er=new Uint32Array(64),ys=class extends Fr{constructor(){super(64,32,8,!1),this.A=tr[0]|0,this.B=tr[1]|0,this.C=tr[2]|0,this.D=tr[3]|0,this.E=tr[4]|0,this.F=tr[5]|0,this.G=tr[6]|0,this.H=tr[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,r,n,i,o,s,a,c]}set(e,r,n,i,o,s,a,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)er[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=er[l-15],d=er[l-2],h=se(p,7)^se(p,18)^p>>>3,y=se(d,17)^se(d,19)^d>>>10;er[l]=y+er[l-7]+h+er[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:f,H:u}=this;for(let l=0;l<64;l++){let p=se(a,6)^se(a,11)^se(a,25),d=u+p+R1(a,c,f)+D1[l]+er[l]|0,y=(se(n,2)^se(n,13)^se(n,22))+L1(n,i,o)|0;u=f,f=c,c=a,a=s+d|0,s=o,o=i,i=n,n=d+y|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,f=f+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,c,f,u)}roundClean(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Qf=ni(()=>new ys);function P1(t){let e=yn(t);Ee(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:k1,hexToBytes:N1}=si,Sr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Sr;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:k1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Sr,r=typeof t=="string"?N1(t):t;if(!ae(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=Sr._parseInt(r.subarray(2)),{d:s,l:a}=Sr._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=f=>Number.parseInt(f[0],16)&8?"00"+f:f,r=f=>{let u=f.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),c=r(s);return`30${r(s+o+4)}02${c}${i}02${a}${n}`}},Ke=BigInt(0),ee=BigInt(1),cv=BigInt(2),Xf=BigInt(3),uv=BigInt(4);function U1(t){let e=P1(t),{Fp:r}=e,n=e.toBytes||((h,y,g)=>{let x=y.toAffine();return De(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(h=>{let y=h.subarray(1),g=r.fromBytes(y.subarray(0,r.BYTES)),x=r.fromBytes(y.subarray(r.BYTES,2*r.BYTES));return{x:g,y:x}});function o(h){let{a:y,b:g}=e,x=r.sqr(h),m=r.mul(x,h);return r.add(r.add(m,r.mul(h,y)),g)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(h){return typeof h=="bigint"&&Ke<h&&h<e.n}function a(h){if(!s(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function c(h){let{allowedPrivateKeyLengths:y,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(y&&typeof h!="bigint"){if(ae(h)&&(h=Re(h)),typeof h!="string"||!y.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let v;try{v=typeof h=="bigint"?h:Le(bt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(v=ut(v,m)),a(v),v}let f=new Map;function u(h){if(!(h instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(y,g,x){if(this.px=y,this.py=g,this.pz=x,y==null||!r.isValid(y))throw new Error("x required");if(g==null||!r.isValid(g))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required")}static fromAffine(y){let{x:g,y:x}=y||{};if(!y||!r.isValid(g)||!r.isValid(x))throw new Error("invalid affine point");if(y instanceof l)throw new Error("projective point not allowed");let m=v=>r.eql(v,r.ZERO);return m(g)&&m(x)?l.ZERO:new l(g,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){let g=r.invertBatch(y.map(x=>x.pz));return y.map((x,m)=>x.toAffine(g[m])).map(l.fromAffine)}static fromHex(y){let g=l.fromAffine(i(bt("pointHex",y)));return g.assertValidity(),g}static fromPrivateKey(y){return l.BASE.multiply(c(y))}_setWindowSize(y){this._WINDOW_SIZE=y,f.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:y,y:g}=this.toAffine();if(!r.isValid(y)||!r.isValid(g))throw new Error("bad point: x or y not FE");let x=r.sqr(g),m=o(y);if(!r.eql(x,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y}=this.toAffine();if(r.isOdd)return!r.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){u(y);let{px:g,py:x,pz:m}=this,{px:v,py:_,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(v,m)),L=r.eql(r.mul(x,E),r.mul(_,m));return S&&L}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:y,b:g}=e,x=r.mul(g,Xf),{px:m,py:v,pz:_}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),H=r.mul(v,v),q=r.mul(_,_),M=r.mul(m,v);return M=r.add(M,M),L=r.mul(m,_),L=r.add(L,L),E=r.mul(y,L),S=r.mul(x,q),S=r.add(E,S),E=r.sub(H,S),S=r.add(H,S),S=r.mul(E,S),E=r.mul(M,E),L=r.mul(x,L),q=r.mul(y,q),M=r.sub(D,q),M=r.mul(y,M),M=r.add(M,L),L=r.add(D,D),D=r.add(L,D),D=r.add(D,q),D=r.mul(D,M),S=r.add(S,D),q=r.mul(v,_),q=r.add(q,q),D=r.mul(q,M),E=r.sub(E,D),L=r.mul(q,H),L=r.add(L,L),L=r.add(L,L),new l(E,S,L)}add(y){u(y);let{px:g,py:x,pz:m}=this,{px:v,py:_,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,H=e.a,q=r.mul(e.b,Xf),M=r.mul(g,v),X=r.mul(x,_),at=r.mul(m,E),Lt=r.add(g,x),T=r.add(v,_);Lt=r.mul(Lt,T),T=r.add(M,X),Lt=r.sub(Lt,T),T=r.add(g,m);let k=r.add(v,E);return T=r.mul(T,k),k=r.add(M,at),T=r.sub(T,k),k=r.add(x,m),S=r.add(_,E),k=r.mul(k,S),S=r.add(X,at),k=r.sub(k,S),D=r.mul(H,T),S=r.mul(q,at),D=r.add(S,D),S=r.sub(X,D),D=r.add(X,D),L=r.mul(S,D),X=r.add(M,M),X=r.add(X,M),at=r.mul(H,at),T=r.mul(q,T),X=r.add(X,at),at=r.sub(M,at),at=r.mul(H,at),T=r.add(T,at),M=r.mul(X,T),L=r.add(L,M),M=r.mul(k,T),S=r.mul(Lt,S),S=r.sub(S,M),M=r.mul(Lt,X),D=r.mul(k,D),D=r.add(D,M),new l(S,L,D)}subtract(y){return this.add(y.negate())}is0(){return this.equals(l.ZERO)}wNAF(y){return d.wNAFCached(this,f,y,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,v)=>m.toAffine(x[v])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Ke)return g;if(a(y),y===ee)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:v,k2neg:_,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;v>Ke||E>Ke;)v&ee&&(S=S.add(D)),E&ee&&(L=L.add(D)),D=D.double(),v>>=ee,E>>=ee;return m&&(S=S.negate()),_&&(L=L.negate()),L=new l(r.mul(L.px,x.beta),L.py,L.pz),S.add(L)}multiply(y){a(y);let g=y,x,m,{endo:v}=e;if(v){let{k1neg:_,k1:E,k2neg:S,k2:L}=v.splitScalar(g),{p:D,f:H}=this.wNAF(E),{p:q,f:M}=this.wNAF(L);D=d.constTimeNegate(_,D),q=d.constTimeNegate(S,q),q=new l(r.mul(q.px,v.beta),q.py,q.pz),x=D.add(q),m=H.add(M)}else{let{p:_,f:E}=this.wNAF(g);x=_,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(y,g,x){let m=l.BASE,v=(E,S)=>S===Ke||S===ee||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),_=v(this,g).add(v(y,x));return _.is0()?void 0:_}toAffine(y){let{px:g,py:x,pz:m}=this,v=this.is0();y==null&&(y=v?r.ONE:r.inv(m));let _=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(v)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:_,y:E}}isTorsionFree(){let{h:y,isTorsionFree:g}=e;if(y===ee)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:y,clearCofactor:g}=e;return y===ee?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(y=!0){return this.assertValidity(),n(l,this,y)}toHex(y=!0){return Re(this.toRawBytes(y))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let p=e.nBitLength,d=ci(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:s}}function O1(t){let e=yn(t);return Ee(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Jf(t){let e=O1(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(T){return Ke<T&&T<r.ORDER}function a(T){return ut(T,n)}function c(T){return ai(T,n)}let{ProjectivePoint:f,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=U1({...e,toBytes(T,k,R){let P=k.toAffine(),A=r.toBytes(P.x),O=De;return R?O(Uint8Array.from([k.hasEvenY()?2:3]),A):O(Uint8Array.from([4]),A,r.toBytes(P.y))},fromBytes(T){let k=T.length,R=T[0],P=T.subarray(1);if(k===i&&(R===2||R===3)){let A=Le(P);if(!s(A))throw new Error("Point is not on curve");let O=l(A),K=r.sqrt(O),V=(K&ee)===ee;return(R&1)===1!==V&&(K=r.neg(K)),{x:A,y:K}}else if(k===o&&R===4){let A=r.fromBytes(P.subarray(0,r.BYTES)),O=r.fromBytes(P.subarray(r.BYTES,2*r.BYTES));return{x:A,y:O}}else throw new Error(`Point of length ${k} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),d=T=>Re(Je(T,e.nByteLength));function h(T){let k=n>>ee;return T>k}function y(T){return h(T)?a(-T):T}let g=(T,k,R)=>Le(T.slice(k,R));class x{constructor(k,R,P){this.r=k,this.s=R,this.recovery=P,this.assertValidity()}static fromCompact(k){let R=e.nByteLength;return k=bt("compactSignature",k,R*2),new x(g(k,0,R),g(k,R,2*R))}static fromDER(k){let{r:R,s:P}=Sr.toSig(bt("DER",k));return new x(R,P)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(k){return new x(this.r,this.s,k)}recoverPublicKey(k){let{r:R,s:P,recovery:A}=this,O=L(bt("msgHash",k));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let K=A===2||A===3?R+e.n:R;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let V=A&1?"03":"02",Z=f.fromHex(V+d(K)),J=c(K),ot=a(-O*J),j=a(P*J),rt=f.BASE.multiplyAndAddUnsafe(Z,ot,j);if(!rt)throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return pr(this.toDERHex())}toDERHex(){return Sr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return pr(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}let m={isValidPrivateKey(T){try{return u(T),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let T=Ho(e.n);return lf(e.randomBytes(T),e.n)},precompute(T=8,k=f.BASE){return k._setWindowSize(T),k.multiply(BigInt(3)),k}};function v(T,k=!0){return f.fromPrivateKey(T).toRawBytes(k)}function _(T){let k=ae(T),R=typeof T=="string",P=(k||R)&&T.length;return k?P===i||P===o:R?P===2*i||P===2*o:T instanceof f}function E(T,k,R=!0){if(_(T))throw new Error("first arg must be private key");if(!_(k))throw new Error("second arg must be public key");return f.fromHex(k).multiply(u(T)).toRawBytes(R)}let S=e.bits2int||function(T){let k=Le(T),R=T.length*8-e.nBitLength;return R>0?k>>BigInt(R):k},L=e.bits2int_modN||function(T){return a(S(T))},D=pn(e.nBitLength);function H(T){if(typeof T!="bigint")throw new Error("bigint expected");if(!(Ke<=T&&T<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Je(T,e.nByteLength)}function q(T,k,R=M){if(["recovered","canonical"].some(xt=>xt in R))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:A}=e,{lowS:O,prehash:K,extraEntropy:V}=R;O==null&&(O=!0),T=bt("msgHash",T),K&&(T=bt("prehashed msgHash",P(T)));let Z=L(T),J=u(k),ot=[H(J),H(Z)];if(V!=null){let xt=V===!0?A(r.BYTES):V;ot.push(bt("extraEntropy",xt))}let j=De(...ot),rt=Z;function vt(xt){let Dt=S(xt);if(!p(Dt))return;let Pt=c(Dt),St=f.BASE.multiply(Dt).toAffine(),Nt=a(St.x);if(Nt===Ke)return;let Se=a(Pt*a(rt+Nt*J));if(Se===Ke)return;let ir=(St.x===Nt?0:2)|Number(St.y&ee),en=Se;return O&&h(Se)&&(en=y(Se),ir^=1),new x(Nt,en,ir)}return{seed:j,k2sig:vt}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function at(T,k,R=M){let{seed:P,k2sig:A}=q(T,k,R),O=e;return Fo(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}f.BASE._setWindowSize(8);function Lt(T,k,R,P=X){let A=T;if(k=bt("msgHash",k),R=bt("publicKey",R),"strict"in P)throw new Error("options.strict was renamed to lowS");let{lowS:O,prehash:K}=P,V,Z;try{if(typeof A=="string"||ae(A))try{V=x.fromDER(A)}catch(St){if(!(St instanceof Sr.Err))throw St;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:St,s:Nt}=A;V=new x(St,Nt)}else throw new Error("PARSE");Z=f.fromHex(R)}catch(St){if(St.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&V.hasHighS())return!1;K&&(k=e.hash(k));let{r:J,s:ot}=V,j=L(k),rt=c(ot),vt=a(j*rt),xt=a(J*rt),Dt=f.BASE.multiplyAndAddUnsafe(Z,vt,xt)?.toAffine();return Dt?a(Dt.x)===J:!1}return{CURVE:e,getPublicKey:v,getSharedSecret:E,sign:at,verify:Lt,ProjectivePoint:f,Signature:x,utils:m}}var bi=class extends Or{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,X0(e);let n=dn(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return Ur(this),this.iHash.update(e),this}digestInto(e){Ur(this),Do(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},gs=(t,e,r)=>new bi(t,e).update(r).digest();gs.create=(t,e)=>new bi(t,e);function K1(t){return{hash:t,hmac:(e,...r)=>gs(t,e,ri(...r)),randomBytes:Kr}}function jf(t,e){let r=n=>Jf({...t,...K1(n)});return Object.freeze({...r(e),create:r})}var rc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),F1=BigInt(1),xs=BigInt(2),ec=(t,e)=>(t+e/xs)/e;function M1(t){let e=rc,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),f=t*t*t%e,u=f*f*t%e,l=gt(u,r,e)*u%e,p=gt(l,r,e)*u%e,d=gt(p,xs,e)*f%e,h=gt(d,i,e)*d%e,y=gt(h,o,e)*h%e,g=gt(y,a,e)*y%e,x=gt(g,c,e)*g%e,m=gt(x,a,e)*y%e,v=gt(m,r,e)*u%e,_=gt(v,s,e)*h%e,E=gt(_,n,e)*f%e,S=gt(E,xs,e);if(!ms.eql(ms.sqr(S),t))throw new Error("Cannot find square root");return S}var ms=fi(rc,void 0,void 0,{sqrt:M1}),de=jf({a:BigInt(0),b:BigInt(7),Fp:ms,n:tc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=tc,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-F1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=ec(o*t,e),c=ec(-n*t,e),f=ut(t-a*r-c*i,e),u=ut(-a*n-c*o,e),l=f>s,p=u>s;if(l&&(f=e-f),p&&(u=e-u),f>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:f,k2neg:p,k2:u}}}},Qf),Ev=BigInt(0);var Sv=de.ProjectivePoint;function nc(){return de.utils.randomPrivateKey()}function ic(t,e){let r=kt.digest(e instanceof Uint8Array?e:e.subarray());if(te(r))return r.then(({digest:n})=>de.sign(n,t).toDERRawBytes()).catch(n=>{throw new $(String(n),"ERR_INVALID_INPUT")});try{return de.sign(r.digest,t).toDERRawBytes()}catch(n){throw new $(String(n),"ERR_INVALID_INPUT")}}function oc(t,e,r){let n=kt.digest(r instanceof Uint8Array?r:r.subarray());if(te(n))return n.then(({digest:i})=>de.verify(e,i,t)).catch(i=>{throw new $(String(i),"ERR_INVALID_INPUT")});try{return de.verify(e,n.digest,t)}catch(i){throw new $(String(i),"ERR_INVALID_INPUT")}}function sc(t){return de.ProjectivePoint.fromHex(t).toRawBytes(!0)}function ac(t){try{de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}function bs(t){try{de.ProjectivePoint.fromHex(t)}catch(e){throw new $(String(e),"ERR_INVALID_PUBLIC_KEY")}}function fc(t){try{return de.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}var Bn=class{_key;constructor(e){bs(e),this._key=e}verify(e,r){return oc(this._key,r,e)}marshal(){return sc(this._key)}get bytes(){return Ne.encode({Type:Rt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}async hash(){let e=kt.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}},An=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??fc(e),ac(this._key),bs(this._publicKey)}sign(e){return ic(this._key,e)}get public(){return new Bn(this._publicKey)}marshal(){return this._key}get bytes(){return Ue.encode({Type:Rt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Yt(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Zt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return qr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function q1(t){return new An(t)}function H1(t){return new Bn(t)}async function z1(){let t=nc();return new An(t)}var cc={rsa:ps,ed25519:cs,secp256k1:vs};function G1(t){let e=Object.keys(cc).join(" / ");return new $(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function ws(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return cc[t];throw G1(t)}async function uc(t,e){return ws(t).generateKeyPair(e??2048)}function lc(t,e){return e=(e??"rsa").toLowerCase(),ws(e),t.bytes}function hc(t,e){return e=(e??"rsa").toLowerCase(),ws(e),t.bytes}var Es;(function(t){let e;t.codec=()=>(e==null&&(e=he((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.id!=null&&(n.uint32(10),n.bytes(r.id)),r.pubKey!=null&&(n.uint32(18),n.bytes(r.pubKey)),r.privKey!=null&&(n.uint32(26),n.bytes(r.privKey)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.id=r.bytes();break;case 2:i.pubKey=r.bytes();break;case 3:i.privKey=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>le(r,t.codec()),t.decode=r=>ue(r,t.codec())})(Es||(Es={}));var dc=async()=>{let t=await uc("Ed25519"),e=await W1(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function W1(t){return _a(lc(t.public),hc(t))}function pc(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}function Wr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function vi(t=0){return globalThis.Buffer?.allocUnsafe!=null?Wr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function gc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var yc=gc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ss=gc("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=vi(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Y1={utf8:yc,"utf-8":yc,hex:Vt.base16,latin1:Ss,ascii:Ss,binary:Ss,...Vt},wi=Y1;function Gt(t,e="utf8"){let r=wi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function xc(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function mc(t=0){return globalThis.Buffer?.allocUnsafe!=null?xc(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var Z1=Math.pow(2,7),Q1=Math.pow(2,14),X1=Math.pow(2,21),Bs=Math.pow(2,28),As=Math.pow(2,35),Is=Math.pow(2,42),Ts=Math.pow(2,49),it=128,Kt=127;function Wt(t){if(t<Z1)return 1;if(t<Q1)return 2;if(t<X1)return 3;if(t<Bs)return 4;if(t<As)return 5;if(t<Is)return 6;if(t<Ts)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function J1(t,e,r=0){switch(Wt(t)){case 8:e[r++]=t&255|it,t/=128;case 7:e[r++]=t&255|it,t/=128;case 6:e[r++]=t&255|it,t/=128;case 5:e[r++]=t&255|it,t/=128;case 4:e[r++]=t&255|it,t>>>=7;case 3:e[r++]=t&255|it,t>>>=7;case 2:e[r++]=t&255|it,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function j1(t,e,r=0){switch(Wt(t)){case 8:e.set(r++,t&255|it),t/=128;case 7:e.set(r++,t&255|it),t/=128;case 6:e.set(r++,t&255|it),t/=128;case 5:e.set(r++,t&255|it),t/=128;case 4:e.set(r++,t&255|it),t>>>=7;case 3:e.set(r++,t&255|it),t>>>=7;case 2:e.set(r++,t&255|it),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function ty(t,e){let r=t[e],n=0;if(n+=r&Kt,r<it||(r=t[e+1],n+=(r&Kt)<<7,r<it)||(r=t[e+2],n+=(r&Kt)<<14,r<it)||(r=t[e+3],n+=(r&Kt)<<21,r<it)||(r=t[e+4],n+=(r&Kt)*Bs,r<it)||(r=t[e+5],n+=(r&Kt)*As,r<it)||(r=t[e+6],n+=(r&Kt)*Is,r<it)||(r=t[e+7],n+=(r&Kt)*Ts,r<it))return n;throw new RangeError("Could not decode varint")}function ey(t,e){let r=t.get(e),n=0;if(n+=r&Kt,r<it||(r=t.get(e+1),n+=(r&Kt)<<7,r<it)||(r=t.get(e+2),n+=(r&Kt)<<14,r<it)||(r=t.get(e+3),n+=(r&Kt)<<21,r<it)||(r=t.get(e+4),n+=(r&Kt)*Bs,r<it)||(r=t.get(e+5),n+=(r&Kt)*As,r<it)||(r=t.get(e+6),n+=(r&Kt)*Is,r<it)||(r=t.get(e+7),n+=(r&Kt)*Ts,r<it))return n;throw new RangeError("Could not decode varint")}function rr(t,e,r=0){return e==null&&(e=mc(Wt(t))),e instanceof Uint8Array?J1(t,e,r):j1(t,e,r)}function Fe(t,e=0){return t instanceof Uint8Array?ty(t,e):ey(t,e)}function Me(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=vi(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Wr(r)}var Si=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let c=a==="0",f=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(u===void 0)break;if(o*=e,o+=u,o>f||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&c&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var bc=45,ry=15,Yr=new Si;function Cs(t){if(!(t.length>ry))return Yr.new(t).parseWith(()=>Yr.readIPv4Addr())}function _s(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>bc))return Yr.new(t).parseWith(()=>Yr.readIPv6Addr())}function Bi(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>bc))return Yr.new(t).parseWith(()=>Yr.readIPAddr())}var Iw=parseInt("0xFFFF",16),Tw=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Rs(t,e="utf8"){let r=wi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Wr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Ec(t){return!!Cs(t)}function Sc(t){return!!_s(t)}function Zr(t){return!!Bi(t)}var Bc=Ec,ay=Sc,Ls=function(t){let e=0;if(t=t.toString().trim(),Bc(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(ay(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=Bc(r[n]),s;o&&(s=Ls(r[n]),r[n]=Gt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,Gt(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){let o=parseInt(r[n],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},Ac=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let i=[];for(let o=0;o<r;o++)i.push(t[e+o]);return i.join(".")}if(r===16){let i=[];for(let o=0;o<r;o+=2)i.push(n.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Qr={},Ds={},cy=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];cy.forEach(t=>{let e=uy(...t);Ds[e.code]=e,Qr[e.name]=e});function uy(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function st(t){if(typeof t=="number"){if(Ds[t]!=null)return Ds[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Qr[t]!=null)return Qr[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var d4=st("ip4"),p4=st("ip6"),y4=st("ipcidr");function ks(t,e){switch(st(t).code){case 4:case 41:return hy(e);case 42:return Cc(e);case 6:case 273:case 33:case 132:return Rc(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Cc(e);case 421:return gy(e);case 444:return _c(e);case 445:return _c(e);case 466:return yy(e);default:return Gt(e,"base16")}}function Ns(t,e){switch(st(t).code){case 4:return Ic(e);case 41:return Ic(e);case 42:return Tc(e);case 6:case 273:case 33:case 132:return Us(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Tc(e);case 421:return dy(e);case 444:return xy(e);case 445:return my(e);case 466:return py(e);default:return Rs(e,"base16")}}var Ps=Object.values(Vt).map(t=>t.decoder),ly=function(){let t=Ps[0].or(Ps[1]);return Ps.slice(2).forEach(e=>t=t.or(e)),t}();function Ic(t){if(!Zr(t))throw new Error("invalid ip address");return Ls(t)}function hy(t){let e=Ac(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Zr(e))throw new Error("invalid ip address");return e}function Us(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Rc(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Tc(t){let e=Rs(t),r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function Cc(t){let e=Fe(t);if(t=t.slice(Wt(e)),t.length!==e)throw new Error("inconsistent lengths");return Gt(t)}function dy(t){let e;t[0]==="Q"||t[0]==="1"?e=or(Bt.decode(`z${t}`)).bytes:e=re.parse(t).multihash.bytes;let r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function py(t){let e=ly.decode(t),r=Uint8Array.from(rr(e.length));return Me([r,e],r.length+e.length)}function yy(t){let e=Fe(t),r=t.slice(Wt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+Gt(r,"base64url")}function gy(t){let e=Fe(t),r=t.slice(Wt(e));if(r.length!==e)throw new Error("inconsistent lengths");return Gt(r,"base58btc")}function xy(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Ae.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Us(n);return Me([r,i],r.length+i.length)}function my(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Ae.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Us(n);return Me([r,i],r.length+i.length)}function _c(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=Gt(e,"base32"),i=Rc(r);return`${n}:${i}`}function Lc(t){t=Os(t);let e=[],r=[],n=null,i=t.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],a=st(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(o++,o>=i.length)throw Pc("invalid address: "+t);if(a.path===!0){n=Os(i.slice(o).join("/")),e.push([a.code,Ns(a.code,n)]),r.push([a.code,n]);break}let c=Ns(a.code,i[o]);e.push([a.code,c]),r.push([a.code,ks(a.code,c)])}return{string:Dc(r),bytes:Fs(e),tuples:e,stringTuples:r,path:n}}function Ks(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Fe(t,i),s=Wt(o),a=st(o),c=by(a,t.slice(i+s));if(c===0){e.push([o]),r.push([o]),i+=s;continue}let f=t.slice(i+s,i+s+c);if(i+=c+s,i>t.length)throw Pc("Invalid address Uint8Array: "+Gt(t,"base16"));e.push([o,f]);let u=ks(o,f);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:Dc(r),tuples:e,stringTuples:r,path:n}}function Dc(t){let e=[];return t.map(r=>{let n=st(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),Os(e.join("/"))}function Fs(t){return Me(t.map(e=>{let r=st(e[0]),n=Uint8Array.from(rr(r.code));return e.length>1&&e[1]!=null&&(n=Me([n,e[1]])),n}))}function by(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Fe(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Wt(r)}}function Os(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Pc(t){return new Error("Error parsing address: "+t)}var vy=Symbol.for("nodejs.util.inspect.custom"),Ms=Symbol.for("@multiformats/js-multiaddr/multiaddr"),wy=[st("dns").code,st("dns4").code,st("dns6").code,st("dnsaddr").code],Ai=class t{bytes;#e;#t;#r;#n;[Ms]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Ks(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=Lc(e)}else if(Nc(e))r=Ks(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="",s=st("tcp"),a=st("udp"),c=st("ip4"),f=st("ip6"),u=st("dns6"),l=st("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(o=`%${h??""}`),wy.includes(d)&&(r=s.name,i=443,n=`${h??""}${o}`,e=d===u.code?6:4),(d===s.code||d===a.code)&&(r=st(d).name,i=parseInt(h??"")),(d===c.code||d===f.code)&&(r=st(d).name,n=`${h??""}${o}`,e=d===f.code?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}protos(){return this.#t.map(([e])=>Object.assign({},st(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>st(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(Fs(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===Qr.p2p.code&&e.push([n,i]),n===Qr["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?Gt(Bt.decode(`z${n}`),"base58btc"):Gt(re.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return pc(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=kc.get(r.name);if(n==null)throw new $(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(o=>new t(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[vy](){return`Multiaddr(${this.#e})`}};var kc=new Map;function Nc(t){return!!t?.[Ms]}function Ii(t){return new Ai(t)}function Ey(t){return t[Symbol.asyncIterator]!=null}function Sy(t){if(Ey(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Vs=Sy;function In(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ve(t=0){return globalThis.Buffer?.alloc!=null?In(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Tn(t=0){return globalThis.Buffer?.allocUnsafe!=null?In(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function qs(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Tn(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return In(r)}function Uc(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 Kc=Symbol.for("@achingbrain/uint8arraylist");function Oc(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function Ti(t){return!!t?.[Kc]}var Xr=class t{bufs;length;[Kc]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(Ti(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(Ti(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=Oc(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Oc(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(Ti(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return qs(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:qs(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,c=a+s.byteLength;if(i=c,e>=c)continue;let f=e>=a&&e<c,u=r>a&&r<=c;if(f&&u){if(e===a&&r===c){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(f){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(u){if(r===c){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!Ti(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,c=this.byteLength-n.byteLength,f=n.byteLength-1,u;for(let l=r;l<=c;l+=u){u=0;for(let p=f;p>=0;p--){let d=this.get(l+p);if(n[p]!==d){u=Math.max(1,p-a[d]);break}}if(u===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Tn(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=Ve(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=Ve(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=Ve(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Tn(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=Ve(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=Ve(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=Ve(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=Ve(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=Ve(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!Uc(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function Fc(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Mc(t=0){return globalThis.Buffer?.allocUnsafe!=null?Fc(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Ci(t){return t[Symbol.asyncIterator]!=null}var _i=t=>{let e=Wt(t),r=Mc(e);return rr(t,r),_i.bytes=e,r};_i.bytes=0;function Cn(t,e){e=e??{};let r=e.lengthEncoder??_i;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return Ci(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}Cn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??_i;return new Xr(r(t.byteLength),t)};var Jr=Ut(Hc(),1);var Ay=8,Iy=1024*1024*4,Br;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(Br||(Br={}));var Hs=t=>{let e=Fe(t);return Hs.bytes=Wt(e),e};Hs.bytes=0;function jr(t,e){let r=new Xr,n=Br.LENGTH,i=-1,o=e?.lengthDecoder??Hs,s=e?.maxLengthLength??Ay,a=e?.maxDataLength??Iy;function*c(){for(;r.byteLength>0;){if(n===Br.LENGTH)try{if(i=o(r),i<0)throw(0,Jr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Jr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let f=o.bytes;r.consume(f),e?.onLength!=null&&e.onLength(i),n=Br.DATA}catch(f){if(f instanceof RangeError){if(r.byteLength>s)throw(0,Jr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw f}if(n===Br.DATA){if(r.byteLength<i)break;let f=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(f),yield f,n=Br.LENGTH}}}return Ci(t)?async function*(){for await(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Jr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let f of t)r.append(f),yield*c();if(r.byteLength>0)throw(0,Jr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}jr.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:o,value:s}=await t.next(r);if(o===!0)return;s!=null&&(yield s)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{r=1}}();return jr(n,{...e??{},onLength:o=>{r=o}})};function Cy(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var zc=Cy;function _y(t){return t[Symbol.asyncIterator]!=null}function Ry(t,e){if(_y(t))return async function*(){for await(let a of t)yield e(a)}();let r=zc(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var $c=Ry;function qe(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Ri=globalThis.CustomEvent??Event;async function*zs(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=qe(),a=qe(),c=!1,f,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let h of t){if(o.length===r&&(s=qe(),await s.promise),u)break;let y={done:!1};o.push(y),h().then(g=>{y.done=!0,y.ok=!0,y.value=g,i.dispatchEvent(new Ri("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new Ri("task-complete"))})}c=!0,i.dispatchEvent(new Ri("task-complete"))}catch(h){f=h,i.dispatchEvent(new Ri("task-complete"))}});function l(){return n?o[0]?.done:!!o.find(h=>h.done)}function*p(){for(;o.length>0&&o[0].done;){let h=o[0];if(o.shift(),h.ok)yield h.value;else throw u=!0,s.resolve(),h.err;s.resolve()}}function*d(){for(;l();)for(let h=0;h<o.length;h++)if(o[h].done){let y=o[h];if(o.splice(h,1),h--,y.ok)yield y.value;else throw u=!0,s.resolve(),y.err;s.resolve()}}for(;;){if(l()||(a=qe(),await a.promise),f!=null)throw f;if(n?yield*p():yield*d(),c&&o.length===0)break}}var Li=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)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}},tn=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Li(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new Li(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var $s=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Di(t={}){return Ly(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function Ly(t,e){e=e??{};let r=e.onEnd,n=new tn,i,o,s,a=qe(),c=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((g,x)=>{o=m=>{o=null,n.push(m);try{g(t(n))}catch(v){x(v)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=qe()})}},f=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new tn,o!=null?o({error:g}):(n.push({error:g}),i)),l=g=>{if(s)return i;if(e?.objectMode!==!0&&g?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return f({done:!1,value:g})},p=g=>s?i:(s=!0,g!=null?u(g):f({done:!0})),d=()=>(n=new tn,p(),{done:!0}),h=g=>(p(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:c,return:d,throw:h,push:l,end:p,get readableLength(){return n.size},onEmpty:async g=>{let x=g?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let m,v;x!=null&&(m=new Promise((_,E)=>{v=()=>{E(new $s)},x.addEventListener("abort",v)}));try{await Promise.race([a.promise,m])}finally{v!=null&&x!=null&&x?.removeEventListener("abort",v)}}},r==null)return i;let y=i;return i={[Symbol.asyncIterator](){return this},next(){return y.next()},throw(g){return y.throw(g),r!=null&&(r(g),r=void 0),{done:!0}},return(){return y.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(g){return y.end(g),r!=null&&(r(g),r=void 0),i},get readableLength(){return y.readableLength},onEmpty:g=>y.onEmpty(g)},i}function Dy(t){return t[Symbol.asyncIterator]!=null}function Py(...t){let e=[];for(let r of t)Dy(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Di({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Gc=Py;function Ws(t,...e){if(t==null)throw new Error("Empty pipeline");if(Gs(t)){let n=t;t=()=>n.source}else if(Yc(t)||Wc(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Gs(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)Gs(r[n])&&(r[n]=Ny(r[n]));return ky(...r)}var ky=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Wc=t=>t?.[Symbol.asyncIterator]!=null,Yc=t=>t?.[Symbol.iterator]!=null,Gs=t=>t==null?!1:t.sink!=null&&t.source!=null,Ny=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Di({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Wc(o))i=async function*(){yield*o,n.end()};else if(Yc(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Gc(n,i())}return t.source};var eu=Ut(Zc(),1);var Qc="[a-fA-F\\d:]",nr=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Qc})|(?<=${Qc})(?=\\s|$))`:"",pe="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Et="[a-fA-F\\d]{1,4}",Pi=`
15
+ `+a+e.substr(s+1),o=i-s-1,s=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(s=i);return e}function Xh(t){return t.replace(/^\s+/,"")}});var W0=ft((lb,G0)=>{var me=ut();dr();St();var z0=G0.exports=me.sha256=me.sha256||{};me.md.sha256=me.md.algorithms.sha256=z0;z0.create=function(){H0||Jh();var t=null,e=me.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,o=0;o<i;++o)n.fullMessageLength.push(0);return e=me.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,o){o==="utf8"&&(i=me.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),q0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=me.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(Oo.substr(0,n.blockLength-s));for(var a,f,c=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,f=a/4294967296>>>0,c+=f,i.putInt32(c>>>0),c=a>>>0;i.putInt32(c);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};q0(l,r,i);var y=me.util.createBuffer();return y.putInt32(l.h0),y.putInt32(l.h1),y.putInt32(l.h2),y.putInt32(l.h3),y.putInt32(l.h4),y.putInt32(l.h5),y.putInt32(l.h6),y.putInt32(l.h7),y},n};var Oo=null,H0=!1,$0=null;function Jh(){Oo="\x80",Oo+=me.util.fillString("\0",64),$0=[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],H0=!0}function q0(t,e,r){for(var n,i,o,s,a,f,c,u,l,y,d,h,p,g,x,m=r.length();m>=64;){for(c=0;c<16;++c)e[c]=r.getInt32();for(;c<64;++c)n=e[c-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[c-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[c]=n+e[c-7]+i+e[c-16]|0;for(u=t.h0,l=t.h1,y=t.h2,d=t.h3,h=t.h4,p=t.h5,g=t.h6,x=t.h7,c=0;c<64;++c)s=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),a=g^h&(p^g),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&l|y&(u^l),n=x+s+a+$0[c]+e[c],i=o+f,x=g,g=p,p=h,h=d+n>>>0,d=y,y=l,l=u,u=n+i>>>0;t.h0=t.h0+u|0,t.h1=t.h1+l|0,t.h2=t.h2+y|0,t.h3=t.h3+d|0,t.h4=t.h4+h|0,t.h5=t.h5+p|0,t.h6=t.h6+g|0,t.h7=t.h7+x|0,m-=64}}});var Z0=ft((hb,Y0)=>{var be=ut();St();var ii=null;be.util.isNodejs&&!be.options.usePureJavaScript&&!process.versions["node-webkit"]&&(ii=ei());var jh=Y0.exports=be.prng=be.prng||{};jh.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(c,u){if(!u)return e.generateSync(c);var l=e.plugin.cipher,y=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,p=be.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(p.length()>=c)return u(null,p.getBytes(c));if(e.generated>1048575&&(e.key=null),e.key===null)return be.util.nextTick(function(){o(g)});var m=l(e.key,e.seed);e.generated+=m.length,p.putBytes(m),e.key=d(l(e.key,y(e.seed))),e.seed=h(l(e.key,e.seed)),be.util.setImmediate(g)}},e.generateSync=function(c){var u=e.plugin.cipher,l=e.plugin.increment,y=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=be.util.createBuffer();h.length()<c;){e.generated>1048575&&(e.key=null),e.key===null&&s();var p=u(e.key,e.seed);e.generated+=p.length,h.putBytes(p),e.key=y(u(e.key,l(e.seed))),e.seed=d(u(e.key,e.seed))}return h.getBytes(c)};function o(c){if(e.pools[0].messageLength>=32)return a(),c();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,y){if(l)return c(l);e.collect(y),a(),c()})}function s(){if(e.pools[0].messageLength>=32)return a();var c=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(c)),a()}function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var c=e.plugin.md.create();c.update(e.keyBytes);for(var u=1,l=0;l<32;++l)e.reseeds%u===0&&(c.update(e.pools[l].digest().getBytes()),e.pools[l].start()),u=u<<1;e.keyBytes=c.digest().getBytes(),c.start(),c.update(e.keyBytes);var y=c.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(y),e.generated=0}function f(c){var u=null,l=be.util.globalScope,y=l.crypto||l.msCrypto;y&&y.getRandomValues&&(u=function(E){return y.getRandomValues(E)});var d=be.util.createBuffer();if(u)for(;d.length()<c;){var h=Math.max(1,Math.min(c-d.length(),65536)/4),p=new Uint32Array(Math.floor(h));try{u(p);for(var g=0;g<p.length;++g)d.putInt32(p[g])}catch(E){if(!(typeof QuotaExceededError<"u"&&E instanceof QuotaExceededError))throw E}}if(d.length()<c)for(var x,m,b,I=Math.floor(Math.random()*65536);d.length()<c;){m=16807*(I&65535),x=16807*(I>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),I=m&4294967295;for(var g=0;g<3;++g)b=I>>>(g<<3),b^=Math.floor(Math.random()*256),d.putByte(b&255)}return d.getBytes(c)}return ii?(e.seedFile=function(c,u){ii.randomBytes(c,function(l,y){if(l)return u(l);u(null,y.toString())})},e.seedFileSync=function(c){return ii.randomBytes(c).toString()}):(e.seedFile=function(c,u){try{u(null,f(c))}catch(l){u(l)}},e.seedFileSync=f),e.collect=function(c){for(var u=c.length,l=0;l<u;++l)e.pools[e.pool].update(c.substr(l,1)),e.pool=e.pool===31?0:e.pool+1},e.collectInt=function(c,u){for(var l="",y=0;y<u;y+=8)l+=String.fromCharCode(c>>y&255);e.collect(l)},e.registerWorker=function(c){if(c===self)e.seedFile=function(l,y){function d(h){var p=h.data;p.forge&&p.forge.prng&&(self.removeEventListener("message",d),y(p.forge.prng.err,p.forge.prng.bytes))}self.addEventListener("message",d),self.postMessage({forge:{prng:{needed:l}}})};else{var u=function(l){var y=l.data;y.forge&&y.forge.prng&&e.seedFile(y.forge.prng.needed,function(d,h){c.postMessage({forge:{prng:{err:d,bytes:h}}})})};c.addEventListener("message",u)}},e}});var En=ft((db,Ko)=>{var _t=ut();Uo();W0();Z0();St();(function(){if(_t.random&&_t.random.getBytes){Ko.exports=_t.random;return}(function(t){var e={},r=new Array(4),n=_t.util.createBuffer();e.formatKey=function(l){var y=_t.util.createBuffer(l);return l=new Array(4),l[0]=y.getInt32(),l[1]=y.getInt32(),l[2]=y.getInt32(),l[3]=y.getInt32(),_t.aes._expandKey(l,!1)},e.formatSeed=function(l){var y=_t.util.createBuffer(l);return l=new Array(4),l[0]=y.getInt32(),l[1]=y.getInt32(),l[2]=y.getInt32(),l[3]=y.getInt32(),l},e.cipher=function(l,y){return _t.aes._updateBlock(l,y,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(l){return++l[3],l},e.md=_t.md.sha256;function i(){var l=_t.prng.create(e);return l.getBytes=function(y,d){return l.generate(y,d)},l.getBytesSync=function(y){return l.generate(y)},l}var o=i(),s=null,a=_t.util.globalScope,f=a.crypto||a.msCrypto;if(f&&f.getRandomValues&&(s=function(l){return f.getRandomValues(l)}),_t.options.usePureJavaScript||!_t.util.isNodejs&&!s){if(typeof window>"u"||window.document,o.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var u in navigator)try{typeof navigator[u]=="string"&&(c+=navigator[u])}catch{}o.collect(c),c=null}t&&(t().mousemove(function(l){o.collectInt(l.clientX,16),o.collectInt(l.clientY,16)}),t().keypress(function(l){o.collectInt(l.charCode,8)}))}if(!_t.random)_t.random=o;else for(var u in o)_t.random[u]=o[u];_t.random.createInstance=i,Ko.exports=_t.random})(typeof jQuery<"u"?jQuery:null)})()});var j0=ft((pb,J0)=>{var zt=ut();St();var Fo=[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],Q0=[1,2,3,5],td=function(t,e){return t<<e&65535|(t&65535)>>16-e},ed=function(t,e){return(t&65535)>>e|t<<16-e&65535};J0.exports=zt.rc2=zt.rc2||{};zt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=zt.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,o=Math.ceil(i/8),s=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(Fo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,Fo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,Fo[r.at(a+1)^r.at(a+o)]);return r};var X0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,f,c,u,l=[];for(t=zt.rc2.expandKey(t,e),c=0;c<64;c++)l.push(t.getInt16Le());r?(a=function(h){for(c=0;c<4;c++)h[c]+=l[u]+(h[(c+3)%4]&h[(c+2)%4])+(~h[(c+3)%4]&h[(c+1)%4]),h[c]=td(h[c],Q0[c]),u++},f=function(h){for(c=0;c<4;c++)h[c]+=l[h[(c+3)%4]&63]}):(a=function(h){for(c=3;c>=0;c--)h[c]=ed(h[c],Q0[c]),h[c]-=l[u]+(h[(c+3)%4]&h[(c+2)%4])+(~h[(c+3)%4]&h[(c+1)%4]),u--},f=function(h){for(c=3;c>=0;c--)h[c]-=l[h[(c+3)%4]&63]});var y=function(h){var p=[];for(c=0;c<4;c++){var g=i.getInt16Le();s!==null&&(r?g^=s.getInt16Le():s.putInt16Le(g)),p.push(g&65535)}u=r?0:63;for(var x=0;x<h.length;x++)for(var m=0;m<h[x][0];m++)h[x][1](p);for(c=0;c<4;c++)s!==null&&(r?s.putInt16Le(p[c]):p[c]^=s.getInt16Le()),o.putInt16Le(p[c])},d=null;return d={start:function(h,p){h&&typeof h=="string"&&(h=zt.util.createBuffer(h)),n=!1,i=zt.util.createBuffer(),o=p||new zt.util.createBuffer,s=h,d.output=o},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)y([[5,a],[1,f],[6,a],[1,f],[5,a]])},finish:function(h){var p=!0;if(r)if(h)p=h(8,i,!r);else{var g=i.length()===8?8:8-i.length();i.fillWithByte(g,g)}if(p&&(n=!0,d.update()),!r&&(p=i.length()===0,p))if(h)p=h(8,o,!r);else{var x=o.length(),m=o.at(x-1);m>x?p=!1:o.truncate(m)}return p}},d};zt.rc2.startEncrypting=function(t,e,r){var n=zt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};zt.rc2.createEncryptionCipher=function(t,e){return X0(t,e,!0)};zt.rc2.startDecrypting=function(t,e,r){var n=zt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};zt.rc2.createDecryptionCipher=function(t,e){return X0(t,e,!1)}});var ai=ft((yb,ac)=>{var Mo=ut();ac.exports=Mo.jsbn=Mo.jsbn||{};var Le,rd=0xdeadbeefcafe,tc=(rd&16777215)==15715070;function T(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))}Mo.jsbn.BigInteger=T;function et(){return new T(null)}function nd(t,e,r,n,i,o){for(;--o>=0;){var s=e*this.data[t++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=s&67108863}return i}function id(t,e,r,n,i,o){for(var s=e&32767,a=e>>15;--o>=0;){var f=this.data[t]&32767,c=this.data[t++]>>15,u=a*f+c*s;f=s*f+((u&32767)<<15)+r.data[n]+(i&1073741823),i=(f>>>30)+(u>>>15)+a*c+(i>>>30),r.data[n++]=f&1073741823}return i}function ec(t,e,r,n,i,o){for(var s=e&16383,a=e>>14;--o>=0;){var f=this.data[t]&16383,c=this.data[t++]>>14,u=a*f+c*s;f=s*f+((u&16383)<<14)+r.data[n]+i,i=(f>>28)+(u>>14)+a*c,r.data[n++]=f&268435455}return i}typeof navigator>"u"?(T.prototype.am=ec,Le=28):tc&&navigator.appName=="Microsoft Internet Explorer"?(T.prototype.am=id,Le=30):tc&&navigator.appName!="Netscape"?(T.prototype.am=nd,Le=26):(T.prototype.am=ec,Le=28);T.prototype.DB=Le;T.prototype.DM=(1<<Le)-1;T.prototype.DV=1<<Le;var Vo=52;T.prototype.FV=Math.pow(2,Vo);T.prototype.F1=Vo-Le;T.prototype.F2=2*Le-Vo;var od="0123456789abcdefghijklmnopqrstuvwxyz",oi=new Array,Vr,jt;Vr=48;for(jt=0;jt<=9;++jt)oi[Vr++]=jt;Vr=97;for(jt=10;jt<36;++jt)oi[Vr++]=jt;Vr=65;for(jt=10;jt<36;++jt)oi[Vr++]=jt;function rc(t){return od.charAt(t)}function nc(t,e){var r=oi[t.charCodeAt(e)];return r??-1}function sd(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 ad(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 Xe(t){var e=et();return e.fromInt(t),e}function cd(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,o=0;--n>=0;){var s=r==8?t[n]&255:nc(t,n);if(s<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this.data[this.t++]=s:o+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this.data[this.t++]=s>>this.DB-o):this.data[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&t[0]&128&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&T.ZERO.subTo(this,this)}function fd(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function ud(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,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this.data[s]>>a)>0&&(i=!0,o=rc(n));s>=0;)a<e?(n=(this.data[s]&(1<<a)-1)<<e-a,n|=this.data[--s]>>(a+=this.DB-e)):(n=this.data[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=rc(n));return i?o:"0"}function ld(){var t=et();return T.ZERO.subTo(this,t),t}function hd(){return this.s<0?this.negate():this}function dd(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 si(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 pd(){return this.t<=0?0:this.DB*(this.t-1)+si(this.data[this.t-1]^this.s&this.DM)}function yd(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 gd(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 xd(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+o+1]=this.data[a]>>n|s,s=(this.data[a]&i)<<r;for(a=o-1;a>=0;--a)e.data[a]=0;e.data[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}function md(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,o=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)e.data[s-r-1]|=(this.data[s]&o)<<i,e.data[s-r]=this.data[s]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}function bd(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 vd(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&&T.ZERO.subTo(e,e)}function wd(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 Ed(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=et());var o=et(),s=this.s,a=t.s,f=this.DB-si(n.data[n.t-1]);f>0?(n.lShiftTo(f,o),i.lShiftTo(f,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,u=o.data[c-1];if(u!=0){var l=u*(1<<this.F1)+(c>1?o.data[c-2]>>this.F2:0),y=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,p=r.t,g=p-c,x=e??et();for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),T.ONE.dlShiftTo(c,x),x.subTo(o,o);o.t<c;)o.data[o.t++]=0;for(;--g>=0;){var m=r.data[--p]==u?this.DM:Math.floor(r.data[p]*y+(r.data[p-1]+h)*d);if((r.data[p]+=o.am(0,m,r,g,0,c))<m)for(o.dlShiftTo(g,x),r.subTo(x,r);r.data[p]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(c,e),s!=a&&T.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&T.ZERO.subTo(r,r)}}}function Sd(t){var e=et();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(T.ZERO)>0&&t.subTo(e,e),e}function pr(t){this.m=t}function Ad(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function Bd(t){return t}function Id(t){t.divRemTo(this.m,null,t)}function Td(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Cd(t,e){t.squareTo(e),this.reduce(e)}pr.prototype.convert=Ad;pr.prototype.revert=Bd;pr.prototype.reduce=Id;pr.prototype.mulTo=Td;pr.prototype.sqrTo=Cd;function Rd(){if(this.t<1)return 0;var t=this.data[0];if(!(t&1))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 yr(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 _d(t){var e=et();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(T.ZERO)>0&&this.m.subTo(e,e),e}function Ld(t){var e=et();return t.copyTo(e),this.reduce(e),e}function Dd(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 Pd(t,e){t.squareTo(e),this.reduce(e)}function Nd(t,e,r){t.multiplyTo(e,r),this.reduce(r)}yr.prototype.convert=_d;yr.prototype.revert=Ld;yr.prototype.reduce=Dd;yr.prototype.mulTo=Nd;yr.prototype.sqrTo=Pd;function kd(){return(this.t>0?this.data[0]&1:this.s)==0}function Ud(t,e){if(t>4294967295||t<1)return T.ONE;var r=et(),n=et(),i=e.convert(this),o=si(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}function Od(t,e){var r;return t<256||e.isEven()?r=new pr(e):r=new yr(e),this.exp(t,r)}T.prototype.copyTo=sd;T.prototype.fromInt=ad;T.prototype.fromString=cd;T.prototype.clamp=fd;T.prototype.dlShiftTo=yd;T.prototype.drShiftTo=gd;T.prototype.lShiftTo=xd;T.prototype.rShiftTo=md;T.prototype.subTo=bd;T.prototype.multiplyTo=vd;T.prototype.squareTo=wd;T.prototype.divRemTo=Ed;T.prototype.invDigit=Rd;T.prototype.isEven=kd;T.prototype.exp=Ud;T.prototype.toString=ud;T.prototype.negate=ld;T.prototype.abs=hd;T.prototype.compareTo=dd;T.prototype.bitLength=pd;T.prototype.mod=Sd;T.prototype.modPowInt=Od;T.ZERO=Xe(0);T.ONE=Xe(1);function Kd(){var t=et();return this.copyTo(t),t}function Fd(){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 Md(){return this.t==0?this.s:this.data[0]<<24>>24}function Vd(){return this.t==0?this.s:this.data[0]<<16>>16}function qd(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function zd(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Hd(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=Xe(r),i=et(),o=et(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}function $d(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var f=nc(t,a);if(f<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}s=e*s+f,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&T.ZERO.subTo(this,this)}function Gd(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(T.ONE.shiftLeft(t-1),qo,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(T.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 Wd(){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&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function Yd(t){return this.compareTo(t)==0}function Zd(t){return this.compareTo(t)<0?this:t}function Qd(t){return this.compareTo(t)>0?this:t}function Xd(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;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 Jd(t,e){return t&e}function jd(t){var e=et();return this.bitwiseTo(t,Jd,e),e}function qo(t,e){return t|e}function tp(t){var e=et();return this.bitwiseTo(t,qo,e),e}function ic(t,e){return t^e}function ep(t){var e=et();return this.bitwiseTo(t,ic,e),e}function oc(t,e){return t&~e}function rp(t){var e=et();return this.bitwiseTo(t,oc,e),e}function np(){for(var t=et(),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 ip(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function op(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function sp(t){if(t==0)return-1;var e=0;return t&65535||(t>>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function ap(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+sp(this.data[t]);return this.s<0?this.t*this.DB:-1}function cp(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function fp(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=cp(this.data[r]^e);return t}function up(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function lp(t,e){var r=T.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function hp(t){return this.changeBit(t,qo)}function dp(t){return this.changeBit(t,oc)}function pp(t){return this.changeBit(t,ic)}function yp(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 gp(t){var e=et();return this.addTo(t,e),e}function xp(t){var e=et();return this.subTo(t,e),e}function mp(t){var e=et();return this.multiplyTo(t,e),e}function bp(t){var e=et();return this.divRemTo(t,e,null),e}function vp(t){var e=et();return this.divRemTo(t,null,e),e}function wp(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function Ep(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Sp(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 Sn(){}function sc(t){return t}function Ap(t,e,r){t.multiplyTo(e,r)}function Bp(t,e){t.squareTo(e)}Sn.prototype.convert=sc;Sn.prototype.revert=sc;Sn.prototype.mulTo=Ap;Sn.prototype.sqrTo=Bp;function Ip(t){return this.exp(t,new Sn)}function Tp(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 Cp(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 qr(t){this.r2=et(),this.q3=et(),T.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Rp(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=et();return t.copyTo(e),this.reduce(e),e}function _p(t){return t}function Lp(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 Dp(t,e){t.squareTo(e),this.reduce(e)}function Pp(t,e,r){t.multiplyTo(e,r),this.reduce(r)}qr.prototype.convert=Rp;qr.prototype.revert=_p;qr.prototype.reduce=Lp;qr.prototype.mulTo=Pp;qr.prototype.sqrTo=Dp;function Np(t,e){var r=t.bitLength(),n,i=Xe(1),o;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?o=new pr(e):e.isEven()?o=new qr(e):o=new yr(e);var s=new Array,a=3,f=n-1,c=(1<<n)-1;if(s[1]=o.convert(this),n>1){var u=et();for(o.sqrTo(s[1],u);a<=c;)s[a]=et(),o.mulTo(u,s[a-2],s[a]),a+=2}var l=t.t-1,y,d=!0,h=et(),p;for(r=si(t.data[l])-1;l>=0;){for(r>=f?y=t.data[l]>>r-f&c:(y=(t.data[l]&(1<<r+1)-1)<<f-r,l>0&&(y|=t.data[l-1]>>this.DB+r-f)),a=n;!(y&1);)y>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),d)s[y].copyTo(i),d=!1;else{for(;a>1;)o.sqrTo(i,h),o.sqrTo(h,i),a-=2;a>0?o.sqrTo(i,h):(p=i,i=h,h=p),o.mulTo(h,s[y],i)}for(;l>=0&&!(t.data[l]&1<<r);)o.sqrTo(i,h),p=i,i=h,h=p,--r<0&&(r=this.DB-1,--l)}return o.revert(i)}function kp(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(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,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 o>0&&r.lShiftTo(o,r),r}function Up(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 Op(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return T.ZERO;for(var r=t.clone(),n=this.clone(),i=Xe(1),o=Xe(0),s=Xe(0),a=Xe(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!s.isEven()||!a.isEven())&&(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}if(n.compareTo(T.ONE)!=0)return T.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}var oe=[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],Kp=(1<<26)/oe[oe.length-1];function Fp(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=oe[oe.length-1]){for(e=0;e<oe.length;++e)if(r.data[0]==oe[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<oe.length;){for(var n=oe[e],i=e+1;i<oe.length&&n<Kp;)n*=oe[i++];for(n=r.modInt(n);e<i;)if(n%oe[e++]==0)return!1}return r.millerRabin(t)}function Mp(t){var e=this.subtract(T.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=Vp(),o,s=0;s<t;++s){do o=new T(this.bitLength(),i);while(o.compareTo(T.ONE)<=0||o.compareTo(e)>=0);var a=o.modPow(n,this);if(a.compareTo(T.ONE)!=0&&a.compareTo(e)!=0){for(var f=1;f++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(T.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}function Vp(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}T.prototype.chunkSize=qd;T.prototype.toRadix=Hd;T.prototype.fromRadix=$d;T.prototype.fromNumber=Gd;T.prototype.bitwiseTo=Xd;T.prototype.changeBit=lp;T.prototype.addTo=yp;T.prototype.dMultiply=Ep;T.prototype.dAddOffset=Sp;T.prototype.multiplyLowerTo=Tp;T.prototype.multiplyUpperTo=Cp;T.prototype.modInt=Up;T.prototype.millerRabin=Mp;T.prototype.clone=Kd;T.prototype.intValue=Fd;T.prototype.byteValue=Md;T.prototype.shortValue=Vd;T.prototype.signum=zd;T.prototype.toByteArray=Wd;T.prototype.equals=Yd;T.prototype.min=Zd;T.prototype.max=Qd;T.prototype.and=jd;T.prototype.or=tp;T.prototype.xor=ep;T.prototype.andNot=rp;T.prototype.not=np;T.prototype.shiftLeft=ip;T.prototype.shiftRight=op;T.prototype.getLowestSetBit=ap;T.prototype.bitCount=fp;T.prototype.testBit=up;T.prototype.setBit=hp;T.prototype.clearBit=dp;T.prototype.flipBit=pp;T.prototype.add=gp;T.prototype.subtract=xp;T.prototype.multiply=mp;T.prototype.divide=bp;T.prototype.remainder=vp;T.prototype.divideAndRemainder=wp;T.prototype.modPow=Np;T.prototype.modInverse=Op;T.prototype.pow=Ip;T.prototype.gcd=kp;T.prototype.isProbablePrime=Fp});var hc=ft((gb,lc)=>{var ve=ut();dr();St();var fc=lc.exports=ve.sha1=ve.sha1||{};ve.md.sha1=ve.md.algorithms.sha1=fc;fc.create=function(){uc||qp();var t=null,e=ve.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,o=0;o<i;++o)n.fullMessageLength.push(0);return e=ve.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,o){o==="utf8"&&(i=ve.util.encodeUtf8(i));var s=i.length;n.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=s[1],s[1]=s[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return e.putBytes(i),cc(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=ve.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(zo.substr(0,n.blockLength-s));for(var a,f,c=n.fullMessageLength[0]*8,u=0;u<n.fullMessageLength.length-1;++u)a=n.fullMessageLength[u+1]*8,f=a/4294967296>>>0,c+=f,i.putInt32(c>>>0),c=a>>>0;i.putInt32(c);var l={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};cc(l,r,i);var y=ve.util.createBuffer();return y.putInt32(l.h0),y.putInt32(l.h1),y.putInt32(l.h2),y.putInt32(l.h3),y.putInt32(l.h4),y},n};var zo=null,uc=!1;function qp(){zo="\x80",zo+=ve.util.fillString("\0",64),uc=!0}function cc(t,e,r){for(var n,i,o,s,a,f,c,u,l=r.length();l>=64;){for(i=t.h0,o=t.h1,s=t.h2,a=t.h3,f=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,c=a^o&(s^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=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,c=a^o&(s^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=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,c=o&s|a&(o^s),n=(i<<5|i>>>27)+c+f+2400959708+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=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,c=o^s^a,n=(i<<5|i>>>27)+c+f+3395469782+n,f=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+o|0,t.h2=t.h2+s|0,t.h3=t.h3+a|0,t.h4=t.h4+f|0,l-=64}}});var yc=ft((xb,pc)=>{var we=ut();St();En();hc();var dc=pc.exports=we.pkcs1=we.pkcs1||{};dc.encode_rsa_oaep=function(t,e,r){var n,i,o,s;typeof r=="string"?(n=r,i=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),o?o.start():o=we.md.sha1.create(),s||(s=o);var a=Math.ceil(t.n.bitLength()/8),f=a-2*o.digestLength-2;if(e.length>f){var c=new Error("RSAES-OAEP input message length is too long.");throw c.length=e.length,c.maxLength=f,c}n||(n=""),o.update(n,"raw");for(var u=o.digest(),l="",y=f-e.length,d=0;d<y;d++)l+="\0";var h=u.getBytes()+l+""+e;if(!i)i=we.random.getBytes(o.digestLength);else if(i.length!==o.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=i.length,c.digestLength=o.digestLength,c}var p=ci(i,a-o.digestLength-1,s),g=we.util.xorBytes(h,p,h.length),x=ci(g,o.digestLength,s),m=we.util.xorBytes(i,x,i.length);return"\0"+m+g};dc.decode_rsa_oaep=function(t,e,r){var n,i,o;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&&(o=r.mgf1.md));var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var g=new Error("RSAES-OAEP encoded message length is invalid.");throw g.length=e.length,g.expectedLength=s,g}if(i===void 0?i=we.md.sha1.create():i.start(),o||(o=i),s<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 a=i.digest().getBytes(),f=e.charAt(0),c=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),l=ci(u,i.digestLength,o),y=we.util.xorBytes(c,l,c.length),d=ci(y,s-i.digestLength-1,o),h=we.util.xorBytes(u,d,u.length),p=h.substring(0,i.digestLength),g=f!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==p.charAt(x);for(var m=1,b=i.digestLength,I=i.digestLength;I<h.length;I++){var E=h.charCodeAt(I),S=E&1^1,_=m?65534:0;g|=E&_,m=m&S,b+=m}if(g||h.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)};function ci(t,e,r){r||(r=we.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),o=0;o<i;++o){var s=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,o&255);r.start(),r.update(t+s),n+=r.digest().getBytes()}return n.substring(0,e)}});var gc=ft((mb,Ho)=>{var Je=ut();St();ai();En();(function(){if(Je.prime){Ho.exports=Je.prime;return}var t=Ho.exports=Je.prime=Je.prime||{},e=Je.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=function(l,y){return l|y};t.generateProbablePrime=function(l,y,d){typeof y=="function"&&(d=y,y={}),y=y||{};var h=y.algorithm||"PRIMEINC";typeof h=="string"&&(h={name:h}),h.options=h.options||{};var p=y.prng||Je.random,g={nextBytes:function(x){for(var m=p.getBytesSync(x.length),b=0;b<x.length;++b)x[b]=m.charCodeAt(b)}};if(h.name==="PRIMEINC")return o(l,g,h.options,d);throw new Error("Invalid prime generation algorithm: "+h.name)};function o(l,y,d,h){return"workers"in d?f(l,y,d,h):s(l,y,d,h)}function s(l,y,d,h){var p=c(l,y),g=0,x=u(p.bitLength());"millerRabinTests"in d&&(x=d.millerRabinTests);var m=10;"maxBlockTime"in d&&(m=d.maxBlockTime),a(p,l,y,g,x,m,h)}function a(l,y,d,h,p,g,x){var m=+new Date;do{if(l.bitLength()>y&&(l=c(y,d)),l.isProbablePrime(p))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);Je.util.setImmediate(function(){a(l,y,d,h,p,g,x)})}function f(l,y,d,h){if(typeof Worker>"u")return s(l,y,d,h);var p=c(l,y),g=d.workers,x=d.workLoad||100,m=x*30/8,b=d.workerScript||"forge/prime.worker.js";if(g===-1)return Je.util.estimateCores(function(E,S){E&&(S=2),g=S-1,I()});I();function I(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(b);for(var _=g,S=0;S<g;++S)E[S].addEventListener("message",V);var L=!1;function V(z){if(!L){--_;var M=z.data;if(M.found){for(var X=0;X<E.length;++X)E[X].terminate();return L=!0,h(null,new e(M.prime,16))}p.bitLength()>l&&(p=c(l,y));var ct=p.toString(16);z.target.postMessage({hex:ct,workLoad:x}),p.dAddOffset(m,0)}}}}function c(l,y){var d=new e(l,y),h=l-1;return d.testBit(h)||d.bitwiseTo(e.ONE.shiftLeft(h),i,d),d.dAddOffset(31-d.mod(n).byteValue(),0),d}function u(l){return l<=100?27:l<=150?18:l<=200?15:l<=250?12:l<=300?9:l<=350?8:l<=400?7:l<=500?6:l<=600?5:l<=800?4:l<=1250?3:2}})()});var ui=ft((bb,Sc)=>{var F=ut();wn();ai();Yn();yc();gc();En();St();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,$o=F.util.isNodejs?ei():null,w=F.asn1,te=F.util;F.pki=F.pki||{};Sc.exports=F.pki.rsa=F.rsa=F.rsa||{};var H=F.pki,zp=[6,4,2,4,2,4,6,2],Hp={name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},$p={name:"RSAPrivateKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Gp={name:"RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:w.Class.UNIVERSAL,type:w.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Wp=F.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Yp={name:"DigestInfo",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:w.Class.UNIVERSAL,type:w.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:w.Class.UNIVERSAL,type:w.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:w.Class.UNIVERSAL,type:w.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:w.Class.UNIVERSAL,type:w.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Zp=function(t){var e;if(t.algorithm in H.oids)e=H.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=w.oidToDer(e).getBytes(),i=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]),o=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]);o.value.push(w.create(w.Class.UNIVERSAL,w.Type.OID,!1,n)),o.value.push(w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,""));var s=w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(o),i.value.push(s),w.toDer(i).getBytes()},wc=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(tt.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(tt.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new tt(F.util.bytesToHex(F.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(tt.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),o=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(o)<0;)i=i.add(e.p);var s=i.subtract(o).multiply(e.qInv).mod(e.p).multiply(e.q).add(o);return s=s.multiply(n.modInverse(e.n)).mod(e.n),s};H.rsa.encrypt=function(t,e,r){var n=r,i,o=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=Ec(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=wc(s,e,n),f=a.toString(16),c=F.util.createBuffer(),u=o-Math.ceil(f.length/2);u>0;)c.putByte(0),--u;return c.putBytes(F.util.hexToBytes(f)),c.getBytes()};H.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var o=new Error("Encrypted message length is invalid.");throw o.length=t.length,o.expected=i,o}var s=new tt(F.util.createBuffer(t).toHex(),16);if(s.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=wc(s,e,r),f=a.toString(16),c=F.util.createBuffer(),u=i-Math.ceil(f.length/2);u>0;)c.putByte(0),--u;return c.putBytes(F.util.hexToBytes(f)),n!==!1?fi(c.getBytes(),e,r):c.getBytes()};H.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||F.random,i={nextBytes:function(a){for(var f=n.getBytesSync(a.length),c=0;c<a.length;++c)a[c]=f.charCodeAt(c)}},o=r.algorithm||"PRIMEINC",s;if(o==="PRIMEINC")s={algorithm:o,state:0,bits:t,rng:i,eInt:e||65537,e:new tt(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+o);return s};H.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new tt(null);r.fromInt(30);for(var n=0,i=function(l,y){return l|y},o=+new Date,s,a=0;t.keys===null&&(e<=0||a<e);){if(t.state===0){var f=t.p===null?t.pBits:t.qBits,c=f-1;t.pqState===0?(t.num=new tt(f,t.rng),t.num.testBit(c)||t.num.bitwiseTo(tt.ONE.shiftLeft(c),i,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),n=0,++t.pqState):t.pqState===1?t.num.bitLength()>f?t.pqState=0:t.num.isProbablePrime(Xp(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(zp[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(tt.ONE).gcd(t.e).compareTo(tt.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(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(tt.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:H.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:H.rsa.setPublicKey(t.n,t.e)}}s=+new Date,a+=s-o,o=s}return t.keys!==null};H.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),!F.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(xc("generateKeyPair"))return $o.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,f,c){if(a)return n(a);n(null,{privateKey:H.privateKeyFromPem(c),publicKey:H.publicKeyFromPem(f)})});if(mc("generateKey")&&mc("exportKey"))return te.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:vc(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return te.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var f=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:f,publicKey:H.setRsaPublicKey(f.n,f.e)})}});if(bc("generateKey")&&bc("exportKey")){var i=te.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:vc(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var f=a.target.result,c=te.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);c.oncomplete=function(u){var l=u.target.result,y=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:y,publicKey:H.setRsaPublicKey(y.n,y.e)})},c.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(xc("generateKeyPairSync")){var o=$o.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:H.privateKeyFromPem(o.privateKey),publicKey:H.publicKeyFromPem(o.publicKey)}}}var s=H.rsa.createKeyPairGenerationState(t,e,r);if(!n)return H.rsa.stepKeyPairGenerationState(s,0),s.keys;Qp(s,r,n)};H.setRsaPublicKey=H.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,o){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,f,c){return Ec(a,f,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,f){return F.pkcs1.encode_rsa_oaep(f,a,o)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var s=i.encode(n,r,!0);return H.rsa.encrypt(s,r,!0)},r.verify=function(n,i,o,s){typeof o=="string"?o=o.toUpperCase():o===void 0&&(o="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),o==="RSASSA-PKCS1-V1_5"?o={verify:function(f,c){c=fi(c,r,!0);var u=w.fromDer(c,{parseAllBytes:s._parseAllDigestBytes}),l={},y=[];if(!w.validate(u,Yp,l,y)){var d=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw d.errors=y,d}var h=w.derToOid(l.algorithmIdentifier);if(!(h===F.oids.md2||h===F.oids.md5||h===F.oids.sha1||h===F.oids.sha224||h===F.oids.sha256||h===F.oids.sha384||h===F.oids.sha512||h===F.oids["sha512-224"]||h===F.oids["sha512-256"])){var d=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw d.oid=h,d}if((h===F.oids.md2||h===F.oids.md5)&&!("parameters"in l))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return f===l.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(f,c){return c=fi(c,r,!0),f===c}});var a=H.rsa.decrypt(i,r,!0,!1);return o.verify(n,a,r.n.bitLength())},r};H.setRsaPrivateKey=H.rsa.setPrivateKey=function(t,e,r,n,i,o,s,a){var f={n:t,e,d:r,p:n,q:i,dP:o,dQ:s,qInv:a};return f.decrypt=function(c,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var y=H.rsa.decrypt(c,f,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:fi};else if(u==="RSA-OAEP"||u==="RSAES-OAEP")u={decode:function(d,h){return F.pkcs1.decode_rsa_oaep(h,d,l)}};else if(["RAW","NONE","NULL",null].indexOf(u)!==-1)u={decode:function(d){return d}};else throw new Error('Unsupported encryption scheme: "'+u+'".');return u.decode(y,f,!1)},f.sign=function(c,u){var l=!1;typeof u=="string"&&(u=u.toUpperCase()),u===void 0||u==="RSASSA-PKCS1-V1_5"?(u={encode:Zp},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return c}},l=1);var y=u.encode(c,f.n.bitLength());return H.rsa.encrypt(y,f,l)},f};H.wrapRsaPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(H.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,w.toDer(t).getBytes())])};H.privateKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,Hp,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,$p,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,o,s,a,f,c,u,l;return i=F.util.createBuffer(e.privateKeyModulus).toHex(),o=F.util.createBuffer(e.privateKeyPublicExponent).toHex(),s=F.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=F.util.createBuffer(e.privateKeyPrime1).toHex(),f=F.util.createBuffer(e.privateKeyPrime2).toHex(),c=F.util.createBuffer(e.privateKeyExponent1).toHex(),u=F.util.createBuffer(e.privateKeyExponent2).toHex(),l=F.util.createBuffer(e.privateKeyCoefficient).toHex(),H.setRsaPrivateKey(new tt(i,16),new tt(o,16),new tt(s,16),new tt(a,16),new tt(f,16),new tt(c,16),new tt(u,16),new tt(l,16))};H.privateKeyToAsn1=H.privateKeyToRSAPrivateKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,w.integerToDer(0).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.qInv))])};H.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,Wp,e,r)){var n=w.derToOid(e.publicKeyOid);if(n!==H.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!w.validate(t,Gp,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var o=F.util.createBuffer(e.publicKeyModulus).toHex(),s=F.util.createBuffer(e.publicKeyExponent).toHex();return H.setRsaPublicKey(new tt(o,16),new tt(s,16))};H.publicKeyToAsn1=H.publicKeyToSubjectPublicKeyInfo=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.OID,!1,w.oidToDer(H.oids.rsaEncryption).getBytes()),w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,"")]),w.create(w.Class.UNIVERSAL,w.Type.BITSTRING,!1,[H.publicKeyToRSAPublicKey(t)])])};H.publicKeyToRSAPublicKey=function(t){return w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,Ee(t.e))])};function Ec(t,e,r){var n=F.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=t.length,o.max=i-11,o}n.putByte(0),n.putByte(r);var s=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var f=0;f<s;++f)n.putByte(a)}else for(;s>0;){for(var c=0,u=F.random.getBytes(s),f=0;f<s;++f)a=u.charCodeAt(f),a===0?++c:n.putByte(a);s=c}return n.putByte(0),n.putBytes(t),n}function fi(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),o=F.util.createBuffer(t),s=o.getByte(),a=o.getByte();if(s!==0||r&&a!==0&&a!==1||!r&&a!=2||r&&a===0&&typeof n>"u")throw new Error("Encryption block is invalid.");var f=0;if(a===0){f=i-3-n;for(var c=0;c<f;++c)if(o.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(f=0;o.length()>1;){if(o.getByte()!==255){--o.read;break}++f}else if(a===2)for(f=0;o.length()>1;){if(o.getByte()===0){--o.read;break}++f}var u=o.getByte();if(u!==0||f!==i-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function Qp(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(){o(t.pBits,function(a,f){if(a)return r(a);if(t.p=f,t.q!==null)return s(a,t.q);o(t.qBits,s)})}function o(a,f){F.prime.generateProbablePrime(a,n,f)}function s(a,f){if(a)return r(a);if(t.q=f,t.p.compareTo(t.q)<0){var c=t.p;t.p=t.q,t.q=c}if(t.p.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.p=null,i();return}if(t.q.subtract(tt.ONE).gcd(t.e).compareTo(tt.ONE)!==0){t.q=null,o(t.qBits,s);return}if(t.p1=t.p.subtract(tt.ONE),t.q1=t.q.subtract(tt.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(tt.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,o(t.qBits,s);return}var u=t.e.modInverse(t.phi);t.keys={privateKey:H.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:H.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}}function Ee(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=F.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Xp(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 xc(t){return F.util.isNodejs&&typeof $o[t]=="function"}function mc(t){return typeof te.globalScope<"u"&&typeof te.globalScope.crypto=="object"&&typeof te.globalScope.crypto.subtle=="object"&&typeof te.globalScope.crypto.subtle[t]=="function"}function bc(t){return typeof te.globalScope<"u"&&typeof te.globalScope.msCrypto=="object"&&typeof te.globalScope.msCrypto.subtle=="object"&&typeof te.globalScope.msCrypto.subtle[t]=="function"}function vc(t){for(var e=F.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}});var Rc=ft((vb,Cc)=>{var U=ut();Uo();wn();P0();dr();Yn();K0();V0();En();j0();ui();St();typeof Ac>"u"&&(Ac=U.jsbn.BigInteger);var Ac,A=U.asn1,G=U.pki=U.pki||{};Cc.exports=G.pbe=U.pbe=U.pbe||{};var gr=G.oids,Jp={name:"EncryptedPrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},jp={name:"PBES2Algorithms",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},t1={name:"pkcs-12PbeParams",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"iterations"}]};G.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=U.random.getBytesSync(r.saltSize),i=r.count,o=A.integerToDer(i),s,a,f;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var c,u,l;switch(r.algorithm){case"aes128":s=16,c=16,u=gr["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":s=24,c=16,u=gr["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":s=32,c=16,u=gr["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":s=8,c=8,u=gr.desCBC,l=U.des.createEncryptionCipher;break;default:var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}var d="hmacWith"+r.prfAlgorithm.toUpperCase(),h=Tc(d),p=U.pkcs5.pbkdf2(e,n,i,s,h),g=U.random.getBytesSync(c),x=l(p);x.start(g),x.update(A.toDer(t)),x.finish(),f=x.output.getBytes();var m=e1(n,o,s,d);a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(gr.pkcs5PBES2).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(gr.pkcs5PBKDF2).getBytes()),m]),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(u).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,g)])])])}else if(r.algorithm==="3des"){s=24;var b=new U.util.ByteBuffer(n),p=G.pbe.generatePkcs12Key(e,b,1,i,s),g=G.pbe.generatePkcs12Key(e,b,2,i,s),x=U.des.createEncryptionCipher(p);x.start(g),x.update(A.toDer(t)),x.finish(),f=x.output.getBytes(),a=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(gr["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,n),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,o.getBytes())])])}else{var y=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw y.algorithm=r.algorithm,y}var I=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[a,A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,f)]);return I};G.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!A.validate(t,Jp,n,i)){var o=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=A.derToOid(n.encryptionOid),a=G.pbe.getCipher(s,n.encryptionParams,e),f=U.util.createBuffer(n.encryptedData);return a.update(f),a.finish()&&(r=A.fromDer(a.output)),r};G.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:A.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};G.encryptedPrivateKeyFromPem=function(t){var e=U.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 A.fromDer(e.body)};G.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=G.wrapRsaPrivateKey(G.privateKeyToAsn1(t));return n=G.encryptPrivateKeyInfo(n,e,r),G.encryptedPrivateKeyToPem(n)}var i,o,s,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,o=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,o=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var c=U.pbe.opensslDeriveBytes(e,o.substr(0,8),s),u=a(c);u.start(o),u.update(A.toDer(G.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:U.util.bytesToHex(o).toUpperCase()},body:u.output.getBytes()};return U.pem.encode(l)};G.decryptRsaPrivateKey=function(t,e){var r=null,n=U.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 o,s;switch(n.dekInfo.algorithm){case"DES-CBC":o=8,s=U.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,s=U.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,s=U.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,s=U.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,s=U.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,s=function(l){return U.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":o=8,s=function(l){return U.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":o=16,s=function(l){return U.rc2.createDecryptionCipher(l,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 a=U.util.hexToBytes(n.dekInfo.parameters),f=U.pbe.opensslDeriveBytes(e,a.substr(0,8),o),c=s(f);if(c.start(a),c.update(U.util.createBuffer(n.body)),c.finish())r=c.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=G.decryptPrivateKeyInfo(A.fromDer(r),e):r=A.fromDer(r),r!==null&&(r=G.privateKeyFromAsn1(r)),r};G.pbe.generatePkcs12Key=function(t,e,r,n,i,o){var s,a;if(typeof o>"u"||o===null){if(!("sha1"in U.md))throw new Error('"sha1" hash algorithm unavailable.');o=U.md.sha1.create()}var f=o.digestLength,c=o.blockLength,u=new U.util.ByteBuffer,l=new U.util.ByteBuffer;if(t!=null){for(a=0;a<t.length;a++)l.putInt16(t.charCodeAt(a));l.putInt16(0)}var y=l.length(),d=e.length(),h=new U.util.ByteBuffer;h.fillWithByte(r,c);var p=c*Math.ceil(d/c),g=new U.util.ByteBuffer;for(a=0;a<p;a++)g.putByte(e.at(a%d));var x=c*Math.ceil(y/c),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%y));var b=g;b.putBuffer(m);for(var I=Math.ceil(i/f),E=1;E<=I;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(b.bytes());for(var _=0;_<n;_++)o.start(),o.update(S.getBytes()),S=o.digest();var L=new U.util.ByteBuffer;for(a=0;a<c;a++)L.putByte(S.at(a%f));var V=Math.ceil(d/c)+Math.ceil(y/c),z=new U.util.ByteBuffer;for(s=0;s<V;s++){var M=new U.util.ByteBuffer(b.getBytes(c)),X=511;for(a=L.length()-1;a>=0;a--)X=X>>8,X+=L.at(a)+M.at(a),M.setAt(a,X&255);z.putBuffer(M)}b=z,u.putBuffer(S)}return u.truncate(u.length()-i),u};G.pbe.getCipher=function(t,e,r){switch(t){case G.oids.pkcs5PBES2:return G.pbe.getCipherForPBES2(t,e,r);case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case G.oids["pbewithSHAAnd40BitRC2-CBC"]:return G.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}};G.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!A.validate(e,jp,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}if(t=A.derToOid(n.kdfOid),t!==G.oids.pkcs5PBKDF2){var o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw o.oid=t,o.supportedOids=["pkcs5PBKDF2"],o}if(t=A.derToOid(n.encOid),t!==G.oids["aes128-CBC"]&&t!==G.oids["aes192-CBC"]&&t!==G.oids["aes256-CBC"]&&t!==G.oids["des-EDE3-CBC"]&&t!==G.oids.desCBC){var o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw o.oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o}var s=n.kdfSalt,a=U.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var f,c;switch(G.oids[t]){case"aes128-CBC":f=16,c=U.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,c=U.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,c=U.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,c=U.des.createDecryptionCipher;break;case"desCBC":f=8,c=U.des.createDecryptionCipher;break}var u=Ic(n.prfOid),l=U.pkcs5.pbkdf2(r,s,a,f,u),y=n.encIv,d=c(l);return d.start(y),d};G.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!A.validate(e,t1,n,i)){var o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw o.errors=i,o}var s=U.util.createBuffer(n.salt),a=U.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var f,c,u;switch(t){case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,c=8,u=U.des.startDecrypting;break;case G.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,c=8,u=function(p,g){var x=U.rc2.createDecryptionCipher(p,40);return x.start(g,null),x};break;default:var o=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw o.oid=t,o}var l=Ic(n.prfOid),y=G.pbe.generatePkcs12Key(r,s,1,a,f,l);l.start();var d=G.pbe.generatePkcs12Key(r,s,2,a,c,l);return u(y,d)};G.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n>"u"||n===null){if(!("md5"in U.md))throw new Error('"md5" hash algorithm unavailable.');n=U.md.md5.create()}e===null&&(e="");for(var i=[Bc(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(Bc(n,i[s-1]+t+e));return i.join("").substr(0,r)};function Bc(t,e){return t.start().update(e).digest().getBytes()}function Ic(t){var e;if(!t)e="hmacWithSHA1";else if(e=G.oids[A.derToOid(t)],!e){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return Tc(e)}function Tc(t){var e=U.md;switch(t){case"hmacWithSHA224":e=U.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 e1(t,e,r,n){var i=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,t),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,e.getBytes())]);return n!=="hmacWithSHA1"&&i.value.push(A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,U.util.hexToBytes(r.toString(16))),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(G.oids[n]).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")])),i}});var qf=ft((R4,Vf)=>{var pt=ut();dr();St();var kn=Vf.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=kn;var Ff=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};Ff.create=function(){return kn.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=Ff;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return kn.create("SHA-512/256")}};pt.md["sha512/256"]=pt.md.algorithms["sha512/256"]=pt.sha512.sha256;pt.sha512.sha224=pt.sha512.sha224||{create:function(){return kn.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;kn.create=function(t){if(Mf||_2(),typeof t>"u"&&(t="SHA-512"),!(t in Tr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=Tr[t],r=null,n=pt.util.createBuffer(),i=new Array(80),o=0;o<80;++o)i[o]=new Array(2);var s=64;switch(t){case"SHA-384":s=48;break;case"SHA-512/256":s=32;break;case"SHA-512/224":s=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:s,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var f=a.messageLengthSize/4,c=0;c<f;++c)a.fullMessageLength.push(0);n=pt.util.createBuffer(),r=new Array(e.length);for(var c=0;c<e.length;++c)r[c]=e[c].slice(0);return a},a.start(),a.update=function(f,c){c==="utf8"&&(f=pt.util.encodeUtf8(f));var u=f.length;a.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=u[1],u[1]=u[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,u[0]=u[1]/4294967296>>>0;return n.putBytes(f),Kf(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var f=pt.util.createBuffer();f.putBytes(n.bytes());var c=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,u=c&a.blockLength-1;f.putBytes(Gs.substr(0,a.blockLength-u));for(var l,y,d=a.fullMessageLength[0]*8,h=0;h<a.fullMessageLength.length-1;++h)l=a.fullMessageLength[h+1]*8,y=l/4294967296>>>0,d+=y,f.putInt32(d>>>0),d=l>>>0;f.putInt32(d);for(var p=new Array(r.length),h=0;h<r.length;++h)p[h]=r[h].slice(0);Kf(p,i,f);var g=pt.util.createBuffer(),x;t==="SHA-512"?x=p.length:t==="SHA-384"?x=p.length-2:x=p.length-4;for(var h=0;h<x;++h)g.putInt32(p[h][0]),(h!==x-1||t!=="SHA-512/224")&&g.putInt32(p[h][1]);return g},a};var Gs=null,Mf=!1,Ws=null,Tr=null;function _2(){Gs="\x80",Gs+=pt.util.fillString("\0",128),Ws=[[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]],Tr={},Tr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],Tr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],Tr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],Tr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Mf=!0}function Kf(t,e,r){for(var n,i,o,s,a,f,c,u,l,y,d,h,p,g,x,m,b,I,E,S,_,L,V,z,M,X,ct,Dt,C,N,D,P,B,O,K,q=r.length();q>=128;){for(C=0;C<16;++C)e[C][0]=r.getInt32()>>>0,e[C][1]=r.getInt32()>>>0;for(;C<80;++C)P=e[C-2],N=P[0],D=P[1],n=((N>>>19|D<<13)^(D>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|D>>>19)^(D<<3|N>>>29)^(N<<26|D>>>6))>>>0,O=e[C-15],N=O[0],D=O[1],o=((N>>>1|D<<31)^(N>>>8|D<<24)^N>>>7)>>>0,s=((N<<31|D>>>1)^(N<<24|D>>>8)^(N<<25|D>>>7))>>>0,B=e[C-7],K=e[C-16],D=i+B[1]+s+K[1],e[C][0]=n+B[0]+o+K[0]+(D/4294967296>>>0)>>>0,e[C][1]=D>>>0;for(p=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],b=t[2][0],I=t[2][1],E=t[3][0],S=t[3][1],_=t[4][0],L=t[4][1],V=t[5][0],z=t[5][1],M=t[6][0],X=t[6][1],ct=t[7][0],Dt=t[7][1],C=0;C<80;++C)c=((_>>>14|L<<18)^(_>>>18|L<<14)^(L>>>9|_<<23))>>>0,u=((_<<18|L>>>14)^(_<<14|L>>>18)^(L<<23|_>>>9))>>>0,l=(M^_&(V^M))>>>0,y=(X^L&(z^X))>>>0,a=((p>>>28|g<<4)^(g>>>2|p<<30)^(g>>>7|p<<25))>>>0,f=((p<<4|g>>>28)^(g<<30|p>>>2)^(g<<25|p>>>7))>>>0,d=(p&x|b&(p^x))>>>0,h=(g&m|I&(g^m))>>>0,D=Dt+u+y+Ws[C][1]+e[C][1],n=ct+c+l+Ws[C][0]+e[C][0]+(D/4294967296>>>0)>>>0,i=D>>>0,D=f+h,o=a+d+(D/4294967296>>>0)>>>0,s=D>>>0,ct=M,Dt=X,M=V,X=z,V=_,z=L,D=S+i,_=E+n+(D/4294967296>>>0)>>>0,L=D>>>0,E=b,S=I,b=x,I=m,x=p,m=g,D=i+s,p=n+o+(D/4294967296>>>0)>>>0,g=D>>>0;D=t[0][1]+g,t[0][0]=t[0][0]+p+(D/4294967296>>>0)>>>0,t[0][1]=D>>>0,D=t[1][1]+m,t[1][0]=t[1][0]+x+(D/4294967296>>>0)>>>0,t[1][1]=D>>>0,D=t[2][1]+I,t[2][0]=t[2][0]+b+(D/4294967296>>>0)>>>0,t[2][1]=D>>>0,D=t[3][1]+S,t[3][0]=t[3][0]+E+(D/4294967296>>>0)>>>0,t[3][1]=D>>>0,D=t[4][1]+L,t[4][0]=t[4][0]+_+(D/4294967296>>>0)>>>0,t[4][1]=D>>>0,D=t[5][1]+z,t[5][0]=t[5][0]+V+(D/4294967296>>>0)>>>0,t[5][1]=D>>>0,D=t[6][1]+X,t[6][0]=t[6][0]+M+(D/4294967296>>>0)>>>0,t[6][1]=D>>>0,D=t[7][1]+Dt,t[7][0]=t[7][0]+ct+(D/4294967296>>>0)>>>0,t[7][1]=D>>>0,q-=128}}});var Wu=ft((uS,Gu)=>{"use strict";function $u(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function kg(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 $u(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),$u(new i,r)}}Gu.exports=kg});var ju=ft(qn=>{(function(){var t,e,r,n,i,o,s,a;a=function(f){var c,u,l,y;return c=(f&255<<24)>>>24,u=(f&255<<16)>>>16,l=(f&65280)>>>8,y=f&255,[c,u,l,y].join(".")},s=function(f){var c,u,l,y,d,h;for(c=[],l=y=0;y<=3&&f.length!==0;l=++y){if(l>0){if(f[0]!==".")throw new Error("Invalid IP");f=f.substring(1)}h=e(f),d=h[0],u=h[1],f=f.substring(u),c.push(d)}if(f.length!==0)throw new Error("Invalid IP");switch(c.length){case 1:if(c[0]>4294967295)throw new Error("Invalid IP");return c[0]>>>0;case 2:if(c[0]>255||c[1]>16777215)throw new Error("Invalid IP");return(c[0]<<24|c[1])>>>0;case 3:if(c[0]>255||c[1]>255||c[2]>65535)throw new Error("Invalid IP");return(c[0]<<24|c[1]<<16|c[2])>>>0;case 4:if(c[0]>255||c[1]>255||c[2]>255||c[3]>255)throw new Error("Invalid IP");return(c[0]<<24|c[1]<<16|c[2]<<8|c[3])>>>0;default:throw new Error("Invalid IP")}},r=function(f){return f.charCodeAt(0)},n=r("0"),o=r("a"),i=r("A"),e=function(f){var c,u,l,y,d;for(y=0,c=10,u="9",l=0,f.length>1&&f[l]==="0"&&(f[l+1]==="x"||f[l+1]==="X"?(l+=2,c=16):"0"<=f[l+1]&&f[l+1]<="9"&&(l++,c=8,u="7")),d=l;l<f.length;){if("0"<=f[l]&&f[l]<=u)y=y*c+(r(f[l])-n)>>>0;else if(c===16)if("a"<=f[l]&&f[l]<="f")y=y*c+(10+r(f[l])-o)>>>0;else if("A"<=f[l]&&f[l]<="F")y=y*c+(10+r(f[l])-i)>>>0;else break;else break;if(y>4294967295)throw new Error("too large");l++}if(l===d)throw new Error("empty octet");return[y,l]},t=function(){function f(c,u){var l,y,d,h;if(typeof c!="string")throw new Error("Missing `net' parameter");if(u||(h=c.split("/",2),c=h[0],u=h[1]),u||(u=32),typeof u=="string"&&u.indexOf(".")>-1){try{this.maskLong=s(u)}catch(p){throw l=p,new Error("Invalid mask: "+u)}for(y=d=32;d>=0;y=--d)if(this.maskLong===4294967295<<32-y>>>0){this.bitmask=y;break}}else if(u||u===0)this.bitmask=parseInt(u,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(s(c)&this.maskLong)>>>0}catch(p){throw l=p,new Error("Invalid net address: "+c)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+u);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return f.prototype.contains=function(c){return typeof c=="string"&&(c.indexOf("/")>0||c.split(".").length!==4)&&(c=new f(c)),c instanceof f?this.contains(c.base)&&this.contains(c.broadcast||c.last):(s(c)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},f.prototype.next=function(c){return c==null&&(c=1),new f(a(this.netLong+this.size*c),this.mask)},f.prototype.forEach=function(c){var u,l,y;for(y=s(this.first),l=s(this.last),u=0;y<=l;)c(a(y),y,u),u++,y++},f.prototype.toString=function(){return this.base+"/"+this.bitmask},f}(),qn.ip2long=s,qn.long2ip=a,qn.Netmask=t}).call(qn)});var nl=ft((rl,Yi)=>{(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",s="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${s})|(?:::)(?:${s})?)${e}\\.${e}\\.${e}\\.${e}(${o})?$`,"i")};function f(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let p=0,g=-1,x=(d.match(a.zoneIndex)||[])[0],m,b;for(x&&(x=x.substring(1),d=d.replace(/%.+$/,""));(g=d.indexOf(":",g+1))>=0;)p++;if(d.substr(0,2)==="::"&&p--,d.substr(-2,2)==="::"&&p--,p>h)return null;for(b=h-p,m=":";b--;)m+="0:";return d=d.replace("::",m),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){let I=d.split(":"),E=[];for(let S=0;S<I.length;S++)E.push(parseInt(I[S],16));return E}(),{parts:h,zoneId:x}}function c(d,h,p,g){if(d.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let x=0,m;for(;g>0;){if(m=p-g,m<0&&(m=0),d[x]>>m!==h[x]>>m)return!1;g-=p,x+=1}return!0}function u(d){if(i.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(n.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function l(d,h){for(;d.length<h;)d=`0${d}`;return d}let y={};y.IPv4=function(){function d(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let p,g;for(p=0;p<h.length;p++)if(g=h[p],!(0<=g&&g<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return d.prototype.SpecialRanges={unspecified:[[new d([0,0,0,0]),8]],broadcast:[[new d([255,255,255,255]),32]],multicast:[[new d([224,0,0,0]),4]],linkLocal:[[new d([169,254,0,0]),16]],loopback:[[new d([127,0,0,0]),8]],carrierGradeNat:[[new d([100,64,0,0]),10]],private:[[new d([10,0,0,0]),8],[new d([172,16,0,0]),12],[new d([192,168,0,0]),16]],reserved:[[new d([192,0,0,0]),24],[new d([192,0,2,0]),24],[new d([192,88,99,0]),24],[new d([198,18,0,0]),15],[new d([198,51,100,0]),24],[new d([203,0,113,0]),24],[new d([240,0,0,0]),4]]},d.prototype.kind=function(){return"ipv4"},d.prototype.match=function(h,p){let g;if(p===void 0&&(g=h,h=g[0],p=g[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return c(this.octets,h.octets,8,p)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,p=!1,g={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},x,m,b;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(b=g[m],p&&b!==0)return null;b!==8&&(p=!0),h+=b}else return null;return 32-h},d.prototype.range=function(){return y.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return y.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),y.IPv4.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),p=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<4;)x.push(parseInt(p[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},y.IPv4.isIPv4=function(d){return this.parser(d)!==null},y.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},y.IPv4.isValidFourPartDecimal=function(d){return!!(y.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},y.IPv4.networkAddressFromCIDR=function(d){let h,p,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],p=0;p<4;)x.push(parseInt(g[p],10)&parseInt(m[p],10)),p++;return new this(x)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},y.IPv4.parse=function(d){let h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},y.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){let p=parseInt(h[2]);if(p>=0&&p<=32){let g=[this.parse(h[1]),p];return Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},y.IPv4.parser=function(d){let h,p,g;if(h=d.match(r.fourOctet))return function(){let x=h.slice(1,6),m=[];for(let b=0;b<x.length;b++)p=x[b],m.push(u(p));return m}();if(h=d.match(r.longValue)){if(g=u(h[1]),g>4294967295||g<0)throw new Error("ipaddr: address outside defined range");return function(){let x=[],m;for(m=0;m<=24;m+=8)x.push(g>>m&255);return x}().reverse()}else return(h=d.match(r.twoOctet))?function(){let x=h.slice(1,4),m=[];if(g=u(x[1]),g>16777215||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(g>>16&255),m.push(g>>8&255),m.push(g&255),m}():(h=d.match(r.threeOctet))?function(){let x=h.slice(1,5),m=[];if(g=u(x[2]),g>65535||g<0)throw new Error("ipaddr: address outside defined range");return m.push(u(x[0])),m.push(u(x[1])),m.push(g>>8&255),m.push(g&255),m}():null},y.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],p=0,g=Math.floor(d/8);for(;p<g;)h[p]=255,p++;return g<4&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},y.IPv6=function(){function d(h,p){let g,x;if(h.length===16)for(this.parts=[],g=0;g<=14;g+=2)this.parts.push(h[g]<<8|h[g+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(g=0;g<this.parts.length;g++)if(x=this.parts[g],!(0<=x&&x<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");p&&(this.zoneId=p)}return d.prototype.SpecialRanges={unspecified:[new d([0,0,0,0,0,0,0,0]),128],linkLocal:[new d([65152,0,0,0,0,0,0,0]),10],multicast:[new d([65280,0,0,0,0,0,0,0]),8],loopback:[new d([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new d([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new d([0,0,0,0,0,65535,0,0]),96],rfc6145:[new d([0,0,0,0,65535,0,0,0]),96],rfc6052:[new d([100,65435,0,0,0,0,0,0]),96],"6to4":[new d([8194,0,0,0,0,0,0,0]),16],teredo:[new d([8193,0,0,0,0,0,0,0]),32],reserved:[[new d([8193,3512,0,0,0,0,0,0]),32]],benchmarking:[new d([8193,2,0,0,0,0,0,0]),48],amt:[new d([8193,3,0,0,0,0,0,0]),32],as112v6:[new d([8193,4,274,0,0,0,0,0]),48],deprecated:[new d([8193,16,0,0,0,0,0,0]),28],orchid2:[new d([8193,32,0,0,0,0,0,0]),28]},d.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},d.prototype.kind=function(){return"ipv6"},d.prototype.match=function(h,p){let g;if(p===void 0&&(g=h,h=g[0],p=g[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return c(this.parts,h.parts,16,p)},d.prototype.prefixLengthFromSubnetMask=function(){let h=0,p=!1,g={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},x,m;for(let b=7;b>=0;b-=1)if(x=this.parts[b],x in g){if(m=g[x],p&&m!==0)return null;m!==16&&(p=!0),h+=m}else return null;return 128-h},d.prototype.range=function(){return y.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h,p=[],g=this.parts;for(let x=0;x<g.length;x++)h=g[x],p.push(h>>8),p.push(h&255);return p},d.prototype.toFixedLengthString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(l(this.parts[x].toString(16),4));return g}.call(this).join(":"),p="";return this.zoneId&&(p=`%${this.zoneId}`),h+p},d.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),p=h[0],g=h[1];return new y.IPv4([p>>8,p&255,g>>8,g&255])},d.prototype.toNormalizedString=function(){let h=function(){let g=[];for(let x=0;x<this.parts.length;x++)g.push(this.parts[x].toString(16));return g}.call(this).join(":"),p="";return this.zoneId&&(p=`%${this.zoneId}`),h+p},d.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,p=this.toNormalizedString(),g=0,x=-1,m;for(;m=h.exec(p);)m[0].length>x&&(g=m.index,x=m[0].length);return x<0?p:`${p.substring(0,g)}::${p.substring(g+x)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),y.IPv6.broadcastAddressFromCIDR=function(d){try{let h=this.parseCIDR(d),p=h[0].toByteArray(),g=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],m=0;for(;m<16;)x.push(parseInt(p[m],10)|parseInt(g[m],10)^255),m++;return new this(x)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},y.IPv6.isIPv6=function(d){return this.parser(d)!==null},y.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{let h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},y.IPv6.networkAddressFromCIDR=function(d){let h,p,g,x,m;try{for(h=this.parseCIDR(d),g=h[0].toByteArray(),m=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),x=[],p=0;p<16;)x.push(parseInt(g[p],10)&parseInt(m[p],10)),p++;return new this(x)}catch(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},y.IPv6.parse=function(d){let h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},y.IPv6.parseCIDR=function(d){let h,p,g;if((p=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(p[2]),h>=0&&h<=128))return g=[this.parse(p[1]),h],Object.defineProperty(g,"toString",{value:function(){return this.join("/")}}),g;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},y.IPv6.parser=function(d){let h,p,g,x,m,b;if(g=d.match(a.deprecatedTransitional))return this.parser(`::ffff:${g[1]}`);if(a.native.test(d))return f(d,8);if((g=d.match(a.transitional))&&(b=g[6]||"",h=f(g[1].slice(0,-1)+b,6),h.parts)){for(m=[parseInt(g[2]),parseInt(g[3]),parseInt(g[4]),parseInt(g[5])],p=0;p<m.length;p++)if(x=m[p],!(0<=x&&x<=255))return null;return h.parts.push(m[0]<<8|m[1]),h.parts.push(m[2]<<8|m[3]),{parts:h.parts,zoneId:h.zoneId}}return null},y.IPv6.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p=0,g=Math.floor(d/8);for(;p<g;)h[p]=255,p++;return g<16&&(h[g]=Math.pow(2,d%8)-1<<8-d%8),new this(h)},y.fromByteArray=function(d){let h=d.length;if(h===4)return new y.IPv4(d);if(h===16)return new y.IPv6(d);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},y.isValid=function(d){return y.IPv6.isValid(d)||y.IPv4.isValid(d)},y.parse=function(d){if(y.IPv6.isValid(d))return y.IPv6.parse(d);if(y.IPv4.isValid(d))return y.IPv4.parse(d);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},y.parseCIDR=function(d){try{return y.IPv6.parseCIDR(d)}catch{try{return y.IPv4.parseCIDR(d)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},y.process=function(d){let h=this.parse(d);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},y.subnetMatch=function(d,h,p){let g,x,m,b;p==null&&(p="unicast");for(x in h)if(Object.prototype.hasOwnProperty.call(h,x)){for(m=h[x],m[0]&&!(m[0]instanceof Array)&&(m=[m]),g=0;g<m.length;g++)if(b=m[g],d.kind()===b[0].kind()&&d.match.apply(d,b))return x}return p},typeof Yi<"u"&&Yi.exports?Yi.exports=y:t.ipaddr=y})(rl)});var ax={};nt(ax,{autoNAT:()=>sx});var fx=Symbol.for("@libp2p/connection");var lx=Symbol.for("@libp2p/content-routing");var px=Symbol.for("@libp2p/peer-discovery");var Ha=Symbol.for("@libp2p/peer-id");var xx=Symbol.for("@libp2p/peer-routing");var $a;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})($a||($a={}));var wx=Symbol.for("@libp2p/transport");var Ga;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Ga||(Ga={}));var $=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Xi="ERR_TIMEOUT";var Ji=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Ax=globalThis.CustomEvent??Ji;var ji=(t,...e)=>{try{[...e]}catch{}};var io={};nt(io,{base58btc:()=>It,base58flickr:()=>_l});var tm=new Uint8Array(0);function Wa(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}function Te(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")}function Ya(t){return new TextEncoder().encode(t)}function Za(t){return new TextDecoder().decode(t)}function Bl(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 o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var p=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,p++;for(var b=(m-x)*u+1>>>0,I=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,_=b-1;(E!==0||S<g)&&_!==-1;_--,S++)E+=256*I[_]>>>0,I[_]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var L=b-g;L!==b&&I[L]===0;)L++;for(var V=f.repeat(p);L<b;++L)V+=t.charAt(I[L]);return V}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var p=0;if(h[p]!==" "){for(var g=0,x=0;h[p]===f;)g++,p++;for(var m=(h.length-p)*c+1>>>0,b=new Uint8Array(m);h[p];){var I=r[h.charCodeAt(p)];if(I===255)return;for(var E=0,S=m-1;(I!==0||E<x)&&S!==-1;S--,E++)I+=a*b[S]>>>0,b[S]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");x=E,p++}if(h[p]!==" "){for(var _=m-x;_!==m&&b[_]===0;)_++;for(var L=new Uint8Array(g+(m-_)),V=g;_!==m;)L[V++]=b[_++];return L}}}function d(h){var p=y(h);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:d}}var Il=Bl,Tl=Il,Xa=Tl;var to=class{name;prefix;baseEncode;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")}},eo=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ja(this,e)}},ro=class{decoders;constructor(e){this.decoders=e}or(e){return Ja(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ja(t,e){return new ro({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var no=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new to(e,r,n),this.decoder=new eo(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Dr({name:t,prefix:e,encode:r,decode:n}){return new no(t,e,r,n)}function We({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=Xa(r,t);return Dr({prefix:e,name:t,encode:n,decode:o=>Te(i(o))})}function Cl(t,e,r,n){let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,f=0,c=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|l,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Rl(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function bt({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Dr({prefix:e,name:t,encode(i){return Rl(i,n,r)},decode(i){return Cl(i,n,r,t)}})}var It=We({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_l=We({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var oo={};nt(oo,{base10:()=>Ll});var Ll=We({prefix:"9",name:"base10",alphabet:"0123456789"});var so={};nt(so,{base16:()=>Dl,base16upper:()=>Pl});var Dl=bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Pl=bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ao={};nt(ao,{base2:()=>Nl});var Nl=bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var co={};nt(co,{base256emoji:()=>Fl});var ja=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),kl=ja.reduce((t,e,r)=>(t[r]=e,t),[]),Ul=ja.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Ol(t){return t.reduce((e,r)=>(e+=kl[r],e),"")}function Kl(t){let e=[];for(let r of t){let n=Ul[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Fl=Dr({prefix:"\u{1F680}",name:"base256emoji",encode:Ol,decode:Kl});var fo={};nt(fo,{base32:()=>Ce,base32hex:()=>zl,base32hexpad:()=>$l,base32hexpadupper:()=>Gl,base32hexupper:()=>Hl,base32pad:()=>Vl,base32padupper:()=>ql,base32upper:()=>Ml,base32z:()=>Wl});var Ce=bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ml=bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Vl=bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ql=bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),zl=bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Hl=bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$l=bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Gl=bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Wl=bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var uo={};nt(uo,{base36:()=>Yl,base36upper:()=>Zl});var Yl=We({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Zl=We({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var lo={};nt(lo,{base64:()=>Hn,base64pad:()=>Ql,base64url:()=>Xl,base64urlpad:()=>Jl});var Hn=bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ql=bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Xl=bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Jl=bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ho={};nt(ho,{base8:()=>jl});var jl=bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var po={};nt(po,{identity:()=>th});var th=Dr({prefix:"\0",name:"identity",encode:t=>Za(t),decode:t=>Ya(t)});var gm=new TextEncoder,xm=new TextDecoder;var go={};nt(go,{identity:()=>Ye});var nh=r0,t0=128,ih=127,oh=~ih,sh=Math.pow(2,31);function r0(t,e,r){e=e||[],r=r||0;for(var n=r;t>=sh;)e[r++]=t&255|t0,t/=128;for(;t&oh;)e[r++]=t&255|t0,t>>>=7;return e[r]=t|0,r0.bytes=r-n+1,e}var ah=yo,ch=128,e0=127;function yo(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw yo.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&e0)<<i:(s&e0)*Math.pow(2,i),i+=7}while(s>=ch);return yo.bytes=o-n,r}var fh=Math.pow(2,7),uh=Math.pow(2,14),lh=Math.pow(2,21),hh=Math.pow(2,28),dh=Math.pow(2,35),ph=Math.pow(2,42),yh=Math.pow(2,49),gh=Math.pow(2,56),xh=Math.pow(2,63),mh=function(t){return t<fh?1:t<uh?2:t<lh?3:t<hh?4:t<dh?5:t<ph?6:t<yh?7:t<gh?8:t<xh?9:10},bh={encode:nh,decode:ah,encodingLength:mh},vh=bh,pn=vh;function yn(t,e=0){return[pn.decode(t,e),pn.decode.bytes]}function Pr(t,e,r=0){return pn.encode(t,e,r),e}function Nr(t){return pn.encodingLength(t)}function ge(t,e){let r=e.byteLength,n=Nr(t),i=n+Nr(r),o=new Uint8Array(i+r);return Pr(t,o,0),Pr(r,o,n),o.set(e,i),new kr(t,r,e,o)}function ur(t){let e=Te(t),[r,n]=yn(e),[i,o]=yn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new kr(r,i,s,e)}function n0(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Wa(t.bytes,r.bytes)}}var kr=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var i0=0,wh="identity",o0=Te;function Eh(t){return ge(i0,o0(t))}var Ye={code:i0,name:wh,encode:o0,digest:Eh};var bo={};nt(bo,{sha256:()=>kt,sha512:()=>Sh});function mo({name:t,code:e,encode:r}){return new xo(t,e,r)}var xo=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?ge(this.code,r):r.then(n=>ge(this.code,n))}else throw Error("Unknown type, must be binary type")}};function a0(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var kt=mo({name:"sha2-256",code:18,encode:a0("SHA-256")}),Sh=mo({name:"sha2-512",code:19,encode:a0("SHA-512")});function c0(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Bh(r,vo(t),e??It.encoder);default:return Ih(r,vo(t),e??Ce.encoder)}}var f0=new WeakMap;function vo(t){let e=f0.get(t);if(e==null){let r=new Map;return f0.set(t,r),r}return e}var ne=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==gn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Th)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=ge(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&n0(e.multihash,n.multihash)}toString(e){return c0(this,e)}toJSON(){return{"/":c0(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s??u0(n,i,o.bytes))}else if(r[Ch]===!0){let{version:n,multihash:i,code:o}=r,s=ur(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==gn)throw new Error(`Version 0 CID must use dag-pb (code: ${gn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=u0(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,gn,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Te(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new kr(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,y]=yn(e.subarray(r));return r+=y,l},i=n(),o=gn;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=Ah(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return vo(o).set(n,e),o}};function Ah(t,e){switch(t[0]){case"Q":{let r=e??It;return[It.prefix,r.decode(`${It.prefix}${t}`)]}case It.prefix:{let r=e??It;return[It.prefix,r.decode(t)]}case Ce.prefix:{let r=e??Ce;return[Ce.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)]}}}function Bh(t,e,r){let{prefix:n}=r;if(n!==It.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function Ih(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var gn=112,Th=18;function u0(t,e,r){let n=Nr(t),i=n+Nr(e),o=new Uint8Array(i+r.byteLength);return Pr(t,o,0),Pr(e,o,n),o.set(r,i),o}var Ch=Symbol.for("@ipld/js-cid/CID");var qt={...po,...ao,...ho,...oo,...so,...fo,...uo,...io,...lo,...co},Km={...bo,...go};function wo(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 Rh=Symbol.for("nodejs.util.inspect.custom"),l0=Object.values(qt).map(t=>t.decoder).reduce((t,e)=>t.or(e),qt.identity.decoder),h0=114,Eo=36,So=37,xn=class{type;multihash;privateKey;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,this.privateKey=e.privateKey,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[Ha]=!0;toString(){return this.string==null&&(this.string=It.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ne.createV1(h0,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return wo(this.multihash.bytes,e);if(typeof e=="string")return _h(e).equals(this);if(e?.multihash?.bytes!=null)return wo(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Rh](){return`PeerId(${this.toString()})`}},Ur=class extends xn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Or=class extends xn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Kr=class extends xn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function _h(t,e){if(e=e??l0,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=ur(It.decode(`z${t}`));return t.startsWith("12D")?new Or({multihash:r}):t.startsWith("16U")?new Kr({multihash:r}):new Ur({multihash:r})}return Gn(l0.decode(t))}function Gn(t){try{let e=ur(t);if(e.code===Ye.code){if(e.digest.length===Eo)return new Or({multihash:e});if(e.digest.length===So)return new Kr({multihash:e})}if(e.code===kt.code)return new Ur({multihash:e})}catch{return Lh(ne.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Lh(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==h0)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===kt.code)return new Ur({multihash:t.multihash});if(e.code===Ye.code){if(e.digest.length===Eo)return new Or({multihash:t.multihash});if(e.digest.length===So)return new Kr({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function d0(t,e){return t.length===Eo?new Or({multihash:ge(Ye.code,t),privateKey:e}):t.length===So?new Kr({multihash:ge(Ye.code,t),privateKey:e}):new Ur({multihash:await kt.digest(t),publicKey:t,privateKey:e})}var U8=Ot(wn(),1),O8=Ot(Rc(),1);var rg=Ot(ut(),1);function xr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function li(t=0){return globalThis.Buffer?.allocUnsafe!=null?xr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Lc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var _c=Lc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Go=Lc("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=li(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),r1={utf8:_c,"utf-8":_c,hex:qt.base16,latin1:Go,ascii:Go,binary:Go,...qt},hi=r1;function Zt(t,e="utf8"){let r=hi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?xr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var $s={};nt($s,{Ed25519PrivateKey:()=>Ir,Ed25519PublicKey:()=>Nn,generateKeyPair:()=>I2,generateKeyPairFromSeed:()=>Of,unmarshalEd25519PrivateKey:()=>A2,unmarshalEd25519PublicKey:()=>B2});function Se(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 Ub=Ot(St(),1),Ob=Ot(ai(),1),Dc=Ot(ut(),1);function mr(t,e){if(globalThis.Buffer!=null)return xr(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=li(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return xr(r)}function Qt(t,e="utf8"){let r=hi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function se(t,e){let r=Uint8Array.from(t.abs().toByteArray());if(r=r[0]===0?r.subarray(1):r,e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=mr([new Uint8Array(e-r.length),r])}return Qt(r,"base64url")}function Xt(t){let e=Pc(t);return new Dc.default.jsbn.BigInteger(Qt(e,"base16"),16)}function Pc(t,e){let r=Zt(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=mr([new Uint8Array(e-r.length),r])}return r}function ee(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}function Nc(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function n1(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Wo(t,...e){if(!n1(t))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function kc(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Nc(t.outputLen),Nc(t.blockLen)}function zr(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Uc(t,e){Wo(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var di=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Oc(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var pi=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ae=(t,e)=>t<<32-e|t>>>e,i1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!i1)throw new Error("Non little-endian hardware is not supported");function Yo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function An(t){if(typeof t=="string"&&(t=Yo(t)),!Oc(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function yi(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];if(!Oc(i))throw new Error("Uint8Array expected");e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Hr=class{clone(){return this._cloneInto()}},$b={}.toString;function gi(t){let e=n=>t().update(An(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function $r(t=32){if(di&&typeof di.getRandomValues=="function")return di.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function o1(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),f=n?4:0,c=n?0:4;t.setUint32(e+f,s,n),t.setUint32(e+c,a,n)}var Gr=class extends Hr{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=pi(this.buffer)}update(e){zr(this);let{view:r,buffer:n,blockLen:i}=this;e=An(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let f=pi(e);for(;i<=o-s;s+=i)this.process(f,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){zr(this),Uc(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;o1(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=pi(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let c=f/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)a.setUint32(4*l,u[l],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var xi=BigInt(4294967295),Zo=BigInt(32);function Kc(t,e=!1){return e?{h:Number(t&xi),l:Number(t>>Zo&xi)}:{h:Number(t>>Zo&xi)|0,l:Number(t&xi)|0}}function s1(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:o,l:s}=Kc(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var a1=(t,e)=>BigInt(t>>>0)<<Zo|BigInt(e>>>0),c1=(t,e,r)=>t>>>r,f1=(t,e,r)=>t<<32-r|e>>>r,u1=(t,e,r)=>t>>>r|e<<32-r,l1=(t,e,r)=>t<<32-r|e>>>r,h1=(t,e,r)=>t<<64-r|e>>>r-32,d1=(t,e,r)=>t>>>r-32|e<<64-r,p1=(t,e)=>e,y1=(t,e)=>t,g1=(t,e,r)=>t<<r|e>>>32-r,x1=(t,e,r)=>e<<r|t>>>32-r,m1=(t,e,r)=>e<<r-32|t>>>64-r,b1=(t,e,r)=>t<<r-32|e>>>64-r;function v1(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var w1=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),E1=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,S1=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),A1=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,B1=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),I1=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var T1={fromBig:Kc,split:s1,toBig:a1,shrSH:c1,shrSL:f1,rotrSH:u1,rotrSL:l1,rotrBH:h1,rotrBL:d1,rotr32H:p1,rotr32L:y1,rotlSH:g1,rotlSL:x1,rotlBH:m1,rotlBL:b1,add:v1,add3L:w1,add3H:E1,add4L:S1,add4H:A1,add5H:I1,add5L:B1},W=T1;var[C1,R1]=W.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),je=new Uint32Array(80),tr=new Uint32Array(80),Qo=class extends Gr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:f,Eh:c,El:u,Fh:l,Fl:y,Gh:d,Gl:h,Hh:p,Hl:g}=this;return[e,r,n,i,o,s,a,f,c,u,l,y,d,h,p,g]}set(e,r,n,i,o,s,a,f,c,u,l,y,d,h,p,g){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=f|0,this.Eh=c|0,this.El=u|0,this.Fh=l|0,this.Fl=y|0,this.Gh=d|0,this.Gl=h|0,this.Hh=p|0,this.Hl=g|0}process(e,r){for(let b=0;b<16;b++,r+=4)je[b]=e.getUint32(r),tr[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let I=je[b-15]|0,E=tr[b-15]|0,S=W.rotrSH(I,E,1)^W.rotrSH(I,E,8)^W.shrSH(I,E,7),_=W.rotrSL(I,E,1)^W.rotrSL(I,E,8)^W.shrSL(I,E,7),L=je[b-2]|0,V=tr[b-2]|0,z=W.rotrSH(L,V,19)^W.rotrBH(L,V,61)^W.shrSH(L,V,6),M=W.rotrSL(L,V,19)^W.rotrBL(L,V,61)^W.shrSL(L,V,6),X=W.add4L(_,M,tr[b-7],tr[b-16]),ct=W.add4H(X,S,z,je[b-7],je[b-16]);je[b]=ct|0,tr[b]=X|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:f,Dh:c,Dl:u,Eh:l,El:y,Fh:d,Fl:h,Gh:p,Gl:g,Hh:x,Hl:m}=this;for(let b=0;b<80;b++){let I=W.rotrSH(l,y,14)^W.rotrSH(l,y,18)^W.rotrBH(l,y,41),E=W.rotrSL(l,y,14)^W.rotrSL(l,y,18)^W.rotrBL(l,y,41),S=l&d^~l&p,_=y&h^~y&g,L=W.add5L(m,E,_,R1[b],tr[b]),V=W.add5H(L,x,I,S,C1[b],je[b]),z=L|0,M=W.rotrSH(n,i,28)^W.rotrBH(n,i,34)^W.rotrBH(n,i,39),X=W.rotrSL(n,i,28)^W.rotrBL(n,i,34)^W.rotrBL(n,i,39),ct=n&o^n&a^o&a,Dt=i&s^i&f^s&f;x=p|0,m=g|0,p=d|0,g=h|0,d=l|0,h=y|0,{h:l,l:y}=W.add(c|0,u|0,V|0,z|0),c=a|0,u=f|0,a=o|0,f=s|0,o=n|0,s=i|0;let C=W.add3L(z,X,Dt);n=W.add3H(C,V,M,ct),i=C|0}({h:n,l:i}=W.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=W.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:f}=W.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=W.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:l,l:y}=W.add(this.Eh|0,this.El|0,l|0,y|0),{h:d,l:h}=W.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:p,l:g}=W.add(this.Gh|0,this.Gl|0,p|0,g|0),{h:x,l:m}=W.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,o,s,a,f,c,u,l,y,d,h,p,g,x,m)}roundClean(){je.fill(0),tr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Xo=gi(()=>new Qo);var bi={};nt(bi,{bitGet:()=>U1,bitLen:()=>k1,bitMask:()=>Bn,bitSet:()=>O1,bytesToHex:()=>Pe,bytesToNumberBE:()=>Ne,bytesToNumberLE:()=>er,concatBytes:()=>ke,createHmacDrbg:()=>ts,ensureBytes:()=>vt,equalBytes:()=>P1,hexToBytes:()=>br,hexToNumber:()=>jo,isBytes:()=>ce,numberToBytesBE:()=>rr,numberToBytesLE:()=>vr,numberToHexUnpadded:()=>qc,numberToVarBytesBE:()=>D1,utf8ToBytes:()=>N1,validateObject:()=>Ae});var Vc=BigInt(0),mi=BigInt(1),_1=BigInt(2);function ce(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}var L1=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Pe(t){if(!ce(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=L1[t[r]];return e}function qc(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function jo(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}var De={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Fc(t){if(t>=De._0&&t<=De._9)return t-De._0;if(t>=De._A&&t<=De._F)return t-(De._A-10);if(t>=De._a&&t<=De._f)return t-(De._a-10)}function br(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Fc(t.charCodeAt(o)),a=Fc(t.charCodeAt(o+1));if(s===void 0||a===void 0){let f=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+o)}n[i]=s*16+a}return n}function Ne(t){return jo(Pe(t))}function er(t){if(!ce(t))throw new Error("Uint8Array expected");return jo(Pe(Uint8Array.from(t).reverse()))}function rr(t,e){return br(t.toString(16).padStart(e*2,"0"))}function vr(t,e){return rr(t,e).reverse()}function D1(t){return br(qc(t))}function vt(t,e,r){let n;if(typeof e=="string")try{n=br(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(ce(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(`${t} expected ${r} bytes, got ${i}`);return n}function ke(...t){let e=0;for(let i=0;i<t.length;i++){let o=t[i];if(!ce(o))throw new Error("Uint8Array expected");e+=o.length}let r=new Uint8Array(e),n=0;for(let i=0;i<t.length;i++){let o=t[i];r.set(o,n),n+=o.length}return r}function P1(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function N1(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function k1(t){let e;for(e=0;t>Vc;t>>=mi,e+=1);return e}function U1(t,e){return t>>BigInt(e)&mi}var O1=(t,e,r)=>t|(r?mi:Vc)<<BigInt(e),Bn=t=>(_1<<BigInt(t-1))-mi,Jo=t=>new Uint8Array(t),Mc=t=>Uint8Array.from(t);function ts(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Jo(t),i=Jo(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),f=(l=Jo())=>{i=a(Mc([0]),l),n=a(),l.length!==0&&(i=a(Mc([1]),l),n=a())},c=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let l=0,y=[];for(;l<e;){n=a();let d=n.slice();y.push(d),l+=n.length}return ke(...y)};return(l,y)=>{s(),f(l);let d;for(;!(d=y(c()));)f();return s(),d}}var K1={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||ce(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function Ae(t,e,r={}){let n=(i,o,s)=>{let a=K1[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let f=t[i];if(!(s&&f===void 0)&&!a(f,t))throw new Error(`Invalid param ${String(i)}=${f} (${typeof f}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(r))n(i,o,!0);return t}var Tt=BigInt(0),gt=BigInt(1),wr=BigInt(2),F1=BigInt(3),es=BigInt(4),zc=BigInt(5),Hc=BigInt(8),M1=BigInt(9),V1=BigInt(16);function lt(t,e){let r=t%e;return r>=Tt?r:e+r}function q1(t,e,r){if(r<=Tt||e<Tt)throw new Error("Expected power/modulo > 0");if(r===gt)return Tt;let n=gt;for(;e>Tt;)e&gt&&(n=n*t%r),t=t*t%r,e>>=gt;return n}function xt(t,e,r){let n=t;for(;e-- >Tt;)n*=n,n%=r;return n}function vi(t,e){if(t===Tt||e<=Tt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=lt(t,e),n=e,i=Tt,o=gt,s=gt,a=Tt;for(;r!==Tt;){let c=n/r,u=n%r,l=i-s*c,y=o-a*c;n=r,r=u,i=s,o=a,s=l,a=y}if(n!==gt)throw new Error("invert: does not exist");return lt(i,e)}function z1(t){let e=(t-gt)/wr,r,n,i;for(r=t-gt,n=0;r%wr===Tt;r/=wr,n++);for(i=wr;i<t&&q1(i,e,t)!==t-gt;i++);if(n===1){let s=(t+gt)/es;return function(f,c){let u=f.pow(c,s);if(!f.eql(f.sqr(u),c))throw new Error("Cannot find square root");return u}}let o=(r+gt)/wr;return function(a,f){if(a.pow(f,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=n,u=a.pow(a.mul(a.ONE,i),r),l=a.pow(f,o),y=a.pow(f,r);for(;!a.eql(y,a.ONE);){if(a.eql(y,a.ZERO))return a.ZERO;let d=1;for(let p=a.sqr(y);d<c&&!a.eql(p,a.ONE);d++)p=a.sqr(p);let h=a.pow(u,gt<<BigInt(c-d-1));u=a.sqr(h),l=a.mul(l,h),y=a.mul(y,u),c=d}return l}}function H1(t){if(t%es===F1){let e=(t+gt)/es;return function(n,i){let o=n.pow(i,e);if(!n.eql(n.sqr(o),i))throw new Error("Cannot find square root");return o}}if(t%Hc===zc){let e=(t-zc)/Hc;return function(n,i){let o=n.mul(i,wr),s=n.pow(o,e),a=n.mul(i,s),f=n.mul(n.mul(a,wr),s),c=n.mul(a,n.sub(f,n.ONE));if(!n.eql(n.sqr(c),i))throw new Error("Cannot find square root");return c}}return t%V1,z1(t)}var $c=(t,e)=>(lt(t,e)&gt)===gt,$1=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function rs(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=$1.reduce((n,i)=>(n[i]="function",n),e);return Ae(t,r)}function G1(t,e,r){if(r<Tt)throw new Error("Expected power > 0");if(r===Tt)return t.ONE;if(r===gt)return e;let n=t.ONE,i=e;for(;r>Tt;)r&gt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=gt;return n}function W1(t,e){let r=new Array(e.length),n=e.reduce((o,s,a)=>t.is0(s)?o:(r[a]=o,t.mul(o,s)),t.ONE),i=t.inv(n);return e.reduceRight((o,s,a)=>t.is0(s)?o:(r[a]=t.mul(o,r[a]),t.mul(o,s)),i),r}function ns(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function wi(t,e,r=!1,n={}){if(t<=Tt)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=ns(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=H1(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:Bn(i),ZERO:Tt,ONE:gt,create:f=>lt(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return Tt<=f&&f<t},is0:f=>f===Tt,isOdd:f=>(f&gt)===gt,neg:f=>lt(-f,t),eql:(f,c)=>f===c,sqr:f=>lt(f*f,t),add:(f,c)=>lt(f+c,t),sub:(f,c)=>lt(f-c,t),mul:(f,c)=>lt(f*c,t),pow:(f,c)=>G1(a,f,c),div:(f,c)=>lt(f*vi(c,t),t),sqrN:f=>f*f,addN:(f,c)=>f+c,subN:(f,c)=>f-c,mulN:(f,c)=>f*c,inv:f=>vi(f,t),sqrt:n.sqrt||(f=>s(a,f)),invertBatch:f=>W1(a,f),cmov:(f,c,u)=>u?c:f,toBytes:f=>r?vr(f,o):rr(f,o),fromBytes:f=>{if(f.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${f.length}`);return r?er(f):Ne(f)}});return Object.freeze(a)}function Gc(t,e){if(!t.isOdd)throw new Error("Field doesn't have isOdd");let r=t.sqrt(e);return t.isOdd(r)?t.neg(r):r}function Wc(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function is(t){let e=Wc(t);return e+Math.ceil(e/2)}function Yc(t,e,r=!1){let n=t.length,i=Wc(e),o=is(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?Ne(t):er(t),a=lt(s,e-gt)+gt;return r?vr(a,i):rr(a,i)}var Z1=BigInt(0),os=BigInt(1);function Ei(t,e){let r=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:r,unsafeLadder(i,o){let s=t.ZERO,a=i;for(;o>Z1;)o&os&&(s=s.add(a)),a=a.double(),o>>=os;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),f=[],c=i,u=c;for(let l=0;l<s;l++){u=c,f.push(u);for(let y=1;y<a;y++)u=u.add(c),f.push(u);c=u.double()}return f},wNAF(i,o,s){let{windows:a,windowSize:f}=n(i),c=t.ZERO,u=t.BASE,l=BigInt(2**i-1),y=2**i,d=BigInt(i);for(let h=0;h<a;h++){let p=h*f,g=Number(s&l);s>>=d,g>f&&(g-=y,s+=os);let x=p,m=p+Math.abs(g)-1,b=h%2!==0,I=g<0;g===0?u=u.add(r(b,o[x])):c=c.add(r(I,o[m]))}return{p:c,f:u}},wNAFCached(i,o,s,a){let f=i._WINDOW_SIZE||1,c=o.get(i);return c||(c=this.precomputeWindow(i,f),f!==1&&o.set(i,a(c))),this.wNAF(f,c,s)}}}function In(t){return rs(t.Fp),Ae(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ns(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var fe=BigInt(0),Jt=BigInt(1),Si=BigInt(2),Q1=BigInt(8),X1={zip215:!0};function J1(t){let e=In(t);return Ae(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Ai(t){let e=J1(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:f}=e,c=Si<<BigInt(a*8)-Jt,u=r.create,l=e.uvRatio||((P,B)=>{try{return{isValid:!0,value:r.sqrt(P*r.inv(B))}}catch{return{isValid:!1,value:fe}}}),y=e.adjustScalarBytes||(P=>P),d=e.domain||((P,B,O)=>{if(B.length||O)throw new Error("Contexts/pre-hash are not supported");return P}),h=P=>typeof P=="bigint"&&fe<P,p=(P,B)=>h(P)&&h(B)&&P<B,g=P=>P===fe||p(P,c);function x(P,B){if(p(P,B))return P;throw new Error(`Expected valid scalar < ${B}, got ${typeof P} ${P}`)}function m(P){return P===fe?P:x(P,n)}let b=new Map;function I(P){if(!(P instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(B,O,K,q){if(this.ex=B,this.ey=O,this.ez=K,this.et=q,!g(B))throw new Error("x required");if(!g(O))throw new Error("y required");if(!g(K))throw new Error("z required");if(!g(q))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(B){if(B instanceof E)throw new Error("extended point not allowed");let{x:O,y:K}=B||{};if(!g(O)||!g(K))throw new Error("invalid affine point");return new E(O,K,Jt,u(O*K))}static normalizeZ(B){let O=r.invertBatch(B.map(K=>K.ez));return B.map((K,q)=>K.toAffine(O[q])).map(E.fromAffine)}_setWindowSize(B){this._WINDOW_SIZE=B,b.delete(this)}assertValidity(){let{a:B,d:O}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:K,ey:q,ez:Z,et:J}=this,st=u(K*K),j=u(q*q),rt=u(Z*Z),Et=u(rt*rt),mt=u(st*B),Pt=u(rt*u(mt+j)),Nt=u(Et+u(O*u(st*j)));if(Pt!==Nt)throw new Error("bad point: equation left != right (1)");let Bt=u(K*q),Ut=u(Z*J);if(Bt!==Ut)throw new Error("bad point: equation left != right (2)")}equals(B){I(B);let{ex:O,ey:K,ez:q}=this,{ex:Z,ey:J,ez:st}=B,j=u(O*st),rt=u(Z*q),Et=u(K*st),mt=u(J*q);return j===rt&&Et===mt}is0(){return this.equals(E.ZERO)}negate(){return new E(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:B}=e,{ex:O,ey:K,ez:q}=this,Z=u(O*O),J=u(K*K),st=u(Si*u(q*q)),j=u(B*Z),rt=O+K,Et=u(u(rt*rt)-Z-J),mt=j+J,Pt=mt-st,Nt=j-J,Bt=u(Et*Pt),Ut=u(mt*Nt),Ie=u(Et*Nt),fr=u(Pt*mt);return new E(Bt,Ut,fr,Ie)}add(B){I(B);let{a:O,d:K}=e,{ex:q,ey:Z,ez:J,et:st}=this,{ex:j,ey:rt,ez:Et,et:mt}=B;if(O===BigInt(-1)){let Ua=u((Z-q)*(rt+j)),Oa=u((Z+q)*(rt-j)),Qi=u(Oa-Ua);if(Qi===fe)return this.double();let Ka=u(J*Si*mt),Fa=u(st*Si*Et),Ma=Fa+Ka,Va=Oa+Ua,qa=Fa-Ka,yl=u(Ma*Qi),gl=u(Va*qa),xl=u(Ma*qa),ml=u(Qi*Va);return new E(yl,gl,ml,xl)}let Pt=u(q*j),Nt=u(Z*rt),Bt=u(st*K*mt),Ut=u(J*Et),Ie=u((q+Z)*(j+rt)-Pt-Nt),fr=Ut-Bt,dn=Ut+Bt,ka=u(Nt-O*Pt),ll=u(Ie*fr),hl=u(dn*ka),dl=u(Ie*ka),pl=u(fr*dn);return new E(ll,hl,pl,dl)}subtract(B){return this.add(B.negate())}wNAF(B){return L.wNAFCached(this,b,B,E.normalizeZ)}multiply(B){let{p:O,f:K}=this.wNAF(x(B,n));return E.normalizeZ([O,K])[0]}multiplyUnsafe(B){let O=m(B);return O===fe?_:this.equals(_)||O===Jt?this:this.equals(S)?this.wNAF(O).p:L.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(f).is0()}isTorsionFree(){return L.unsafeLadder(this,n).is0()}toAffine(B){let{ex:O,ey:K,ez:q}=this,Z=this.is0();B==null&&(B=Z?Q1:r.inv(q));let J=u(O*B),st=u(K*B),j=u(q*B);if(Z)return{x:fe,y:Jt};if(j!==Jt)throw new Error("invZ was invalid");return{x:J,y:st}}clearCofactor(){let{h:B}=e;return B===Jt?this:this.multiplyUnsafe(B)}static fromHex(B,O=!1){let{d:K,a:q}=e,Z=r.BYTES;B=vt("pointHex",B,Z);let J=B.slice(),st=B[Z-1];J[Z-1]=st&-129;let j=er(J);j===fe||(O?x(j,c):x(j,r.ORDER));let rt=u(j*j),Et=u(rt-Jt),mt=u(K*rt-q),{isValid:Pt,value:Nt}=l(Et,mt);if(!Pt)throw new Error("Point.fromHex: invalid y coordinate");let Bt=(Nt&Jt)===Jt,Ut=(st&128)!==0;if(!O&&Nt===fe&&Ut)throw new Error("Point.fromHex: x=0 and x_0=1");return Ut!==Bt&&(Nt=u(-Nt)),E.fromAffine({x:Nt,y:j})}static fromPrivateKey(B){return M(B).point}toRawBytes(){let{x:B,y:O}=this.toAffine(),K=vr(O,r.BYTES);return K[K.length-1]|=B&Jt?128:0,K}toHex(){return Pe(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Jt,u(e.Gx*e.Gy)),E.ZERO=new E(fe,Jt,Jt,fe);let{BASE:S,ZERO:_}=E,L=Ei(E,a*8);function V(P){return lt(P,n)}function z(P){return V(er(P))}function M(P){let B=a;P=vt("private key",P,B);let O=vt("hashed private key",o(P),2*B),K=y(O.slice(0,B)),q=O.slice(B,2*B),Z=z(K),J=S.multiply(Z),st=J.toRawBytes();return{head:K,prefix:q,scalar:Z,point:J,pointBytes:st}}function X(P){return M(P).pointBytes}function ct(P=new Uint8Array,...B){let O=ke(...B);return z(o(d(O,vt("context",P),!!i)))}function Dt(P,B,O={}){P=vt("message",P),i&&(P=i(P));let{prefix:K,scalar:q,pointBytes:Z}=M(B),J=ct(O.context,K,P),st=S.multiply(J).toRawBytes(),j=ct(O.context,st,Z,P),rt=V(J+j*q);m(rt);let Et=ke(st,vr(rt,r.BYTES));return vt("result",Et,a*2)}let C=X1;function N(P,B,O,K=C){let{context:q,zip215:Z}=K,J=r.BYTES;P=vt("signature",P,2*J),B=vt("message",B),i&&(B=i(B));let st=er(P.slice(J,2*J)),j,rt,Et;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),Et=S.multiplyUnsafe(st)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let mt=ct(q,rt.toRawBytes(),j.toRawBytes(),B);return rt.add(j.multiplyUnsafe(mt)).subtract(Et).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:Dt,verify:N,ExtendedPoint:E,utils:{getExtendedPublicKey:M,randomPrivateKey:()=>s(r.BYTES),precompute(P=8,B=E.BASE){return B._setWindowSize(P),B.multiply(BigInt(3)),B}}}}var as=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Zc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),dv=BigInt(0),j1=BigInt(1),ss=BigInt(2),ty=BigInt(5),Qc=BigInt(10),ey=BigInt(20),ry=BigInt(40),Xc=BigInt(80);function ny(t){let e=as,n=t*t%e*t%e,i=xt(n,ss,e)*n%e,o=xt(i,j1,e)*t%e,s=xt(o,ty,e)*o%e,a=xt(s,Qc,e)*s%e,f=xt(a,ey,e)*a%e,c=xt(f,ry,e)*f%e,u=xt(c,Xc,e)*c%e,l=xt(u,Xc,e)*c%e,y=xt(l,Qc,e)*s%e;return{pow_p_5_8:xt(y,ss,e)*t%e,b2:n}}function iy(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function oy(t,e){let r=as,n=lt(e*e*e,r),i=lt(n*n*e,r),o=ny(t*i).pow_p_5_8,s=lt(t*n*o,r),a=lt(e*s*s,r),f=s,c=lt(s*Zc,r),u=a===t,l=a===lt(-t,r),y=a===lt(-t*Zc,r);return u&&(s=f),(l||y)&&(s=c),$c(s,r)&&(s=lt(-s,r)),{isValid:u||l,value:s}}var Ue=wi(as,void 0,!0),cs={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ue,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Xo,randomBytes:$r,adjustScalarBytes:iy,uvRatio:oy},Wr=Ai(cs);function Jc(t,e,r){if(e.length>255)throw new Error("Context is too big");return yi(Yo("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var pv=Ai({...cs,domain:Jc}),yv=Ai({...cs,domain:Jc,prehash:Xo});var sy=(Ue.ORDER+BigInt(3))/BigInt(8),gv=Ue.pow(ss,sy),xv=Ue.sqrt(Ue.neg(Ue.ONE)),mv=(Ue.ORDER-BigInt(5))/BigInt(8),bv=BigInt(486662);var vv=Gc(Ue,Ue.neg(BigInt(486664)));var wv=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Ev=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Sv=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Av=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var Bv=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Yr=32,Oe=64,Bi=32;function jc(){let t=Wr.utils.randomPrivateKey(),e=Wr.getPublicKey(t);return{privateKey:nf(t,e),publicKey:e}}function tf(t){if(t.length!==Bi)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=Wr.getPublicKey(e);return{privateKey:nf(e,r),publicKey:r}}function ef(t,e){let r=t.subarray(0,Bi);return Wr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function rf(t,e,r){return Wr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function nf(t,e){let r=new Uint8Array(Oe);for(let n=0;n<Bi;n++)r[n]=t[n],r[Bi+n]=e[n];return r}var Ht={get(t=globalThis){let e=t.crypto;if(e==null||e.subtle==null)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/blob/main/packages/crypto/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return e}};var fs={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function us(t){let e=t?.algorithm??"AES-GCM",r=t?.keyLength??16,n=t?.nonceLength??12,i=t?.digest??"SHA-256",o=t?.saltLength??16,s=t?.iterations??32767,a=Ht.get();r*=8;async function f(l,y){let d=a.getRandomValues(new Uint8Array(o)),h=a.getRandomValues(new Uint8Array(n)),p={name:e,iv:h};typeof y=="string"&&(y=Zt(y));let g;if(y.length===0){g=await a.subtle.importKey("jwk",fs,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",fs,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(p,g,l);return mr([d,p.iv,new Uint8Array(x)])}async function c(l,y){let d=l.subarray(0,o),h=l.subarray(o,o+n),p=l.subarray(o+n),g={name:e,iv:h};typeof y=="string"&&(y=Zt(y));let x;if(y.length===0)try{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},I=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,I,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",fs,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},I=await a.subtle.importKey("raw",y,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,I,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,p);return new Uint8Array(m)}return{encrypt:f,decrypt:c}}async function Zr(t,e){let n=await us().encrypt(t,e);return Hn.encode(n)}var ls=new Float32Array([-0]),nr=new Uint8Array(ls.buffer);function sf(t,e,r){ls[0]=t,e[r]=nr[0],e[r+1]=nr[1],e[r+2]=nr[2],e[r+3]=nr[3]}function af(t,e){return nr[0]=t[e],nr[1]=t[e+1],nr[2]=t[e+2],nr[3]=t[e+3],ls[0]}var hs=new Float64Array([-0]),Kt=new Uint8Array(hs.buffer);function cf(t,e,r){hs[0]=t,e[r]=Kt[0],e[r+1]=Kt[1],e[r+2]=Kt[2],e[r+3]=Kt[3],e[r+4]=Kt[4],e[r+5]=Kt[5],e[r+6]=Kt[6],e[r+7]=Kt[7]}function ff(t,e){return Kt[0]=t[e],Kt[1]=t[e+1],Kt[2]=t[e+2],Kt[3]=t[e+3],Kt[4]=t[e+4],Kt[5]=t[e+5],Kt[6]=t[e+6],Kt[7]=t[e+7],hs[0]}var cy=BigInt(Number.MAX_SAFE_INTEGER),fy=BigInt(Number.MIN_SAFE_INTEGER),$t=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let 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}static fromBigInt(e){if(e===0n)return Er;if(e<cy&&e>fy)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>uf&&(i=0n,++n>uf&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return Er;let r=e<0;r&&(e=-e);let 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 t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):Er}},Er=new $t(0,0);Er.toBigInt=function(){return 0n};Er.zzEncode=Er.zzDecode=function(){return this};Er.length=function(){return 1};var uf=4294967296n;function lf(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function hf(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ds(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function ue(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function Ii(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var ps=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;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,ue(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw ue(this,4);return Ii(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ue(this,4);return Ii(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ue(this,4);let e=af(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ue(this,4);let e=ff(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw ue(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return hf(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw ue(this,e);this.pos+=e}else do if(this.pos>=this.len)throw ue(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new $t(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw ue(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw ue(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw ue(this,8);let e=Ii(this.buf,this.pos+=4),r=Ii(this.buf,this.pos+=4);return new $t(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){return this.readLongVarint().toNumber(!0)}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ys(t){return new ps(t instanceof Uint8Array?t:t.subarray())}function le(t,e){let r=ys(t);return e.decode(r)}function Sr(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ke(t=0){return globalThis.Buffer?.alloc!=null?Sr(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Gt(t=0){return globalThis.Buffer?.allocUnsafe!=null?Sr(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var vs={};nt(vs,{base10:()=>yy});function uy(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 o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var p=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,p++;for(var b=(m-x)*u+1>>>0,I=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,_=b-1;(E!==0||S<g)&&_!==-1;_--,S++)E+=256*I[_]>>>0,I[_]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var L=b-g;L!==b&&I[L]===0;)L++;for(var V=f.repeat(p);L<b;++L)V+=t.charAt(I[L]);return V}function y(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;var p=0;if(h[p]!==" "){for(var g=0,x=0;h[p]===f;)g++,p++;for(var m=(h.length-p)*c+1>>>0,b=new Uint8Array(m);h[p];){var I=r[h.charCodeAt(p)];if(I===255)return;for(var E=0,S=m-1;(I!==0||E<x)&&S!==-1;S--,E++)I+=a*b[S]>>>0,b[S]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");x=E,p++}if(h[p]!==" "){for(var _=m-x;_!==m&&b[_]===0;)_++;for(var L=new Uint8Array(g+(m-_)),V=g;_!==m;)L[V++]=b[_++];return L}}}function d(h){var p=y(h);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:d}}var ly=uy,hy=ly,pf=hy;var $v=new Uint8Array(0);var yf=(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},Fe=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 gf=t=>new TextEncoder().encode(t),xf=t=>new TextDecoder().decode(t);var gs=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")}},xs=class{constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return bf(this,e)}},ms=class{constructor(e){this.decoders=e}or(e){return bf(this,e)}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`)}},bf=(t,e)=>new ms({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),bs=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new gs(e,r,n),this.decoder=new xs(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Qr=({name:t,prefix:e,encode:r,decode:n})=>new bs(t,e,r,n),ir=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=pf(r,e);return Qr({prefix:t,name:e,encode:n,decode:o=>Fe(i(o))})},dy=(t,e,r,n)=>{let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,f=0,c=0;for(let u=0;u<o;++u){let l=i[t[u]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<r|l,a+=r,a>=8&&(a-=8,s[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return s},py=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o},wt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>Qr({prefix:e,name:t,encode(i){return py(i,n,r)},decode(i){return dy(i,n,r,t)}});var yy=ir({prefix:"9",name:"base10",alphabet:"0123456789"});var ws={};nt(ws,{base16:()=>gy,base16upper:()=>xy});var gy=wt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),xy=wt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Es={};nt(Es,{base2:()=>my});var my=wt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ss={};nt(Ss,{base256emoji:()=>Sy});var vf=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),by=vf.reduce((t,e,r)=>(t[r]=e,t),[]),vy=vf.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function wy(t){return t.reduce((e,r)=>(e+=by[r],e),"")}function Ey(t){let e=[];for(let r of t){let n=vy[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var Sy=Qr({prefix:"\u{1F680}",name:"base256emoji",encode:wy,decode:Ey});var As={};nt(As,{base32:()=>Xr,base32hex:()=>Ty,base32hexpad:()=>Ry,base32hexpadupper:()=>_y,base32hexupper:()=>Cy,base32pad:()=>By,base32padupper:()=>Iy,base32upper:()=>Ay,base32z:()=>Ly});var Xr=wt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Ay=wt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),By=wt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Iy=wt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Ty=wt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Cy=wt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Ry=wt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),_y=wt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Ly=wt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Bs={};nt(Bs,{base36:()=>Dy,base36upper:()=>Py});var Dy=ir({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Py=ir({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Is={};nt(Is,{base58btc:()=>Be,base58flickr:()=>Ny});var Be=ir({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ny=ir({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ts={};nt(Ts,{base64:()=>ky,base64pad:()=>Uy,base64url:()=>Oy,base64urlpad:()=>Ky});var ky=wt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Uy=wt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Oy=wt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ky=wt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Cs={};nt(Cs,{base8:()=>Fy});var Fy=wt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Rs={};nt(Rs,{identity:()=>My});var My=Qr({prefix:"\0",name:"identity",encode:t=>xf(t),decode:t=>gf(t)});var sw=new TextEncoder,aw=new TextDecoder;var Ls={};nt(Ls,{identity:()=>f2});var zy=Sf,wf=128,Hy=127,$y=~Hy,Gy=Math.pow(2,31);function Sf(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Gy;)e[r++]=t&255|wf,t/=128;for(;t&$y;)e[r++]=t&255|wf,t>>>=7;return e[r]=t|0,Sf.bytes=r-n+1,e}var Wy=_s,Yy=128,Ef=127;function _s(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw _s.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Ef)<<i:(s&Ef)*Math.pow(2,i),i+=7}while(s>=Yy);return _s.bytes=o-n,r}var Zy=Math.pow(2,7),Qy=Math.pow(2,14),Xy=Math.pow(2,21),Jy=Math.pow(2,28),jy=Math.pow(2,35),t2=Math.pow(2,42),e2=Math.pow(2,49),r2=Math.pow(2,56),n2=Math.pow(2,63),i2=function(t){return t<Zy?1:t<Qy?2:t<Xy?3:t<Jy?4:t<jy?5:t<t2?6:t<e2?7:t<r2?8:t<n2?9:10},o2={encode:zy,decode:Wy,encodingLength:i2},s2=o2,Tn=s2;var Cn=(t,e=0)=>[Tn.decode(t,e),Tn.decode.bytes],Jr=(t,e,r=0)=>(Tn.encode(t,e,r),e),jr=t=>Tn.encodingLength(t);var Ar=(t,e)=>{let r=e.byteLength,n=jr(t),i=n+jr(r),o=new Uint8Array(i+r);return Jr(t,o,0),Jr(r,o,n),o.set(e,i),new tn(t,r,e,o)},Af=t=>{let e=Fe(t),[r,n]=Cn(e),[i,o]=Cn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new tn(r,i,s,e)},Bf=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&yf(t.bytes,r.bytes)}},tn=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var If=0,a2="identity",Tf=Fe,c2=t=>Ar(If,Tf(t)),f2={code:If,name:a2,encode:Tf,digest:c2};var Ns={};nt(Ns,{sha256:()=>u2,sha512:()=>l2});var Ps=({name:t,code:e,encode:r})=>new Ds(t,e,r),Ds=class{constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Ar(this.code,r):r.then(n=>Ar(this.code,n))}else throw Error("Unknown type, must be binary type")}};var Rf=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),u2=Ps({name:"sha2-256",code:18,encode:Rf("SHA-256")}),l2=Ps({name:"sha2-512",code:19,encode:Rf("SHA-512")});var _f=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return d2(r,ks(t),e||Be.encoder);default:return p2(r,ks(t),e||Xr.encoder)}};var Lf=new WeakMap,ks=t=>{let e=Lf.get(t);if(e==null){let r=new Map;return Lf.set(t,r),r}return e},Ci=class t{constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==_n)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==y2)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Ar(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n&&e.code===n.code&&e.version===n.version&&Bf(e.multihash,n.multihash)}toString(e){return _f(this,e)}toJSON(){return{"/":_f(this)}}link(){return this}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s||Df(n,i,o.bytes))}else if(r[g2]===!0){let{version:n,multihash:i,code:o}=r,s=Af(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==_n)throw new Error(`Version 0 CID must use dag-pb (code: ${_n}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Df(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,_n,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Fe(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new tn(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,y]=Cn(e.subarray(r));return r+=y,l},i=n(),o=_n;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=h2(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ks(o).set(n,e),o}},h2=(t,e)=>{switch(t[0]){case"Q":{let r=e||Be;return[Be.prefix,r.decode(`${Be.prefix}${t}`)]}case Be.prefix:{let r=e||Be;return[Be.prefix,r.decode(t)]}case Xr.prefix:{let r=e||Xr;return[Xr.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)]}}},d2=(t,e,r)=>{let{prefix:n}=r;if(n!==Be.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i},p2=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i},_n=112,y2=18,Df=(t,e,r)=>{let n=jr(t),i=n+jr(e),o=new Uint8Array(i+r.byteLength);return Jr(t,o,0),Jr(e,o,n),o.set(r,i),o},g2=Symbol.for("@ipld/js-cid/CID");var Us={...Rs,...Es,...Cs,...vs,...ws,...As,...Bs,...Is,...Ts,...Ss},Sw={...Ns,...Ls};function Nf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Pf=Nf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Os=Nf("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=Gt(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),x2={utf8:Pf,"utf-8":Pf,hex:Us.base16,latin1:Os,ascii:Os,binary:Os,...Us},kf=x2;function Uf(t,e="utf8"){let r=kf[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Sr(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Ks(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Gt(s);i+s>e&&(n=Gt(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var Br=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Fs(){}var Vs=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},m2=Ks();function b2(t){return globalThis.Buffer!=null?Gt(t):m2(t)}var Pn=class{len;head;tail;states;constructor(){this.len=0,this.head=new Br(Fs,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new Br(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new qs((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Ln,10,$t.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=$t.fromBigInt(e);return this._push(Ln,r.length(),r)}uint64Number(e){let r=$t.fromNumber(e);return this._push(Ln,r.length(),r)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=$t.fromBigInt(e).zzEncode();return this._push(Ln,r.length(),r)}sint64Number(e){let r=$t.fromNumber(e).zzEncode();return this._push(Ln,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Ms,1,e?1:0)}fixed32(e){return this._push(Dn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=$t.fromBigInt(e);return this._push(Dn,4,r.lo)._push(Dn,4,r.hi)}fixed64Number(e){let r=$t.fromNumber(e);return this._push(Dn,4,r.lo)._push(Dn,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(sf,4,e)}double(e){return this._push(cf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(Ms,1,0):this.uint32(r)._push(w2,r,e)}string(e){let r=lf(e);return r!==0?this.uint32(r)._push(ds,r,e):this._push(Ms,1,0)}fork(){return this.states=new Vs(this),this.head=this.tail=new Br(Fs,0,0),this.len=0,this}reset(){return this.states!=null?(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 Br(Fs,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=b2(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function Ms(t,e,r){e[r]=t&255}function v2(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var qs=class extends Br{next;constructor(e,r){super(v2,e,r),this.next=void 0}};function Ln(t,e,r){for(;t.hi!==0;)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}function Dn(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 w2(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(Pn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(E2,e,t),this},Pn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(S2,e,t),this});function E2(t,e,r){e.set(t,r)}function S2(t,e,r){t.length<40?ds(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(Uf(t),r)}function zs(){return new Pn}function he(t,e){let r=zs();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var en;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(en||(en={}));function Ri(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function rn(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return Ri("enum",en.VARINT,r,n)}function de(t,e){return Ri("message",en.LENGTH_DELIMITED,t,e)}var Lt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Lt||(Lt={}));var Hs;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(Hs||(Hs={}));(function(t){t.codec=()=>rn(Hs)})(Lt||(Lt={}));var Me;(function(t){let e;t.codec=()=>(e==null&&(e=de((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Lt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Lt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>he(r,t.codec()),t.decode=r=>le(r,t.codec())})(Me||(Me={}));var Ve;(function(t){let e;t.codec=()=>(e==null&&(e=de((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Lt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.Type=Lt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>he(r,t.codec()),t.decode=r=>le(r,t.codec())})(Ve||(Ve={}));var Nn=class{_key;constructor(e){this._key=nn(e,Yr)}verify(e,r){return rf(this._key,r,e)}marshal(){return this._key}get bytes(){return Me.encode({Type:Lt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Se(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return ee(e)?e.then(({bytes:r})=>r):e.bytes}},Ir=class{_key;_publicKey;constructor(e,r){this._key=nn(e,Oe),this._publicKey=nn(r,Yr)}sign(e){return ef(this._key,e)}get public(){return new Nn(this._publicKey)}marshal(){return this._key}get bytes(){return Ve.encode({Type:Lt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Se(this.bytes,e.bytes)}async hash(){let e=kt.digest(this.bytes),r;return ee(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=Ye.digest(this.public.bytes);return It.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Zr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function A2(t){if(t.length>Oe){t=nn(t,Oe+Yr);let n=t.subarray(0,Oe),i=t.subarray(Oe,t.length);return new Ir(n,i)}t=nn(t,Oe);let e=t.subarray(0,Oe),r=t.subarray(Yr);return new Ir(e,r)}function B2(t){return t=nn(t,Yr),new Nn(t)}async function I2(){let{privateKey:t,publicKey:e}=jc();return new Ir(t,e)}async function Of(t){let{privateKey:e,publicKey:r}=tf(t);return new Ir(e,r)}function nn(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new $(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var T2={"P-256":256,"P-384":384,"P-521":521},C2=Object.keys(T2),d4=C2.join(" / ");var Qs={};nt(Qs,{MAX_KEY_SIZE:()=>Kn,RsaPrivateKey:()=>on,RsaPublicKey:()=>On,fromJwk:()=>F2,generateKeyPair:()=>M2,unmarshalRsaPrivateKey:()=>O2,unmarshalRsaPublicKey:()=>K2});var Un=Ot(ut(),1);var X4=Ot(qf(),1);function Li(t){if(isNaN(t)||t<=0)throw new $("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return $r(t)}var P4=Ot(ui(),1),Ys=Ot(ut(),1);function zf(t,e){return e.map(r=>Xt(t[r]))}function Hf(t){return Ys.default.pki.setRsaPrivateKey(...zf(t,["n","e","d","p","q","dp","dq","qi"]))}function $f(t){return Ys.default.pki.setRsaPublicKey(...zf(t,["n","e"]))}var Cr={};nt(Cr,{jwkToPkcs1:()=>D2,jwkToPkix:()=>N2,pkcs1ToJwk:()=>L2,pkixToJwk:()=>P2});var U4=Ot(wn(),1),O4=Ot(ui(),1);var qe=Ot(ut(),1);function L2(t){let e=qe.default.asn1.fromDer(Qt(t,"ascii")),r=qe.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:se(r.n),e:se(r.e),d:se(r.d),p:se(r.p),q:se(r.q),dp:se(r.dP),dq:se(r.dQ),qi:se(r.qInv),alg:"RS256"}}function D2(t){if(t.n==null||t.e==null||t.d==null||t.p==null||t.q==null||t.dp==null||t.dq==null||t.qi==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=qe.default.pki.privateKeyToAsn1({n:Xt(t.n),e:Xt(t.e),d:Xt(t.d),p:Xt(t.p),q:Xt(t.q),dP:Xt(t.dp),dQ:Xt(t.dq),qInv:Xt(t.qi)});return Zt(qe.default.asn1.toDer(e).getBytes(),"ascii")}function P2(t){let e=qe.default.asn1.fromDer(Qt(t,"ascii")),r=qe.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:se(r.n),e:se(r.e)}}function N2(t){if(t.n==null||t.e==null)throw new $("JWK was missing components","ERR_INVALID_PARAMETERS");let e=qe.default.pki.publicKeyToAsn1({n:Xt(t.n),e:Xt(t.e)});return Zt(qe.default.asn1.toDer(e).getBytes(),"ascii")}async function Gf(t){let e=await Ht.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 Zf(e);return{privateKey:r[0],publicKey:r[1]}}async function Zs(t){let r=[await Ht.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await k2(t)],n=await Zf({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function Wf(t,e){let r=await Ht.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Ht.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function Yf(t,e,r){let n=await Ht.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Ht.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Zf(t){if(t.privateKey==null||t.publicKey==null)throw new $("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Ht.get().subtle.exportKey("jwk",t.privateKey),Ht.get().subtle.exportKey("jwk",t.publicKey)])}async function k2(t){return Ht.get().subtle.importKey("jwk",{kty:t.kty,n:t.n,e:t.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}function Qf(t,e,r,n){let i=e?$f(t):Hf(t),o=Qt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return Zt(s,"ascii")}function Xf(t,e){return Qf(t,!0,e,(r,n)=>n.encrypt(r))}function Jf(t,e){return Qf(t,!1,e,(r,n)=>n.decrypt(r))}function Di(t){if(t.kty!=="RSA")throw new $("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new $("invalid key modulus","ERR_INVALID_KEY_MODULUS");return Zt(t.n,"base64url").length*8}var Kn=8192,On=class{_key;constructor(e){this._key=e}verify(e,r){return Yf(this._key,r,e)}marshal(){return Cr.jwkToPkix(this._key)}get bytes(){return Me.encode({Type:Lt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Xf(this._key,e)}equals(e){return Se(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return ee(e)?e.then(({bytes:r})=>r):e.bytes}},on=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return Li(16)}sign(e){return Wf(this._key,e)}get public(){if(this._publicKey==null)throw new $("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new On(this._publicKey)}decrypt(e){return Jf(this._key,e)}marshal(){return Cr.jwkToPkcs1(this._key)}get bytes(){return Ve.encode({Type:Lt.RSA,Data:this.marshal()}).subarray()}equals(e){return Se(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return ee(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Qt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new Un.default.util.ByteBuffer(this.marshal()),i=Un.default.asn1.fromDer(n),o=Un.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return Un.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return Zr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function O2(t){let e=Cr.pkcs1ToJwk(t);if(Di(e)>Kn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await Zs(e);return new on(r.privateKey,r.publicKey)}function K2(t){let e=Cr.pkixToJwk(t);if(Di(e)>Kn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new On(e)}async function F2(t){if(Di(t)>Kn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await Zs(t);return new on(e.privateKey,e.publicKey)}async function M2(t){if(t>Kn)throw new $("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await Gf(t);return new on(e.privateKey,e.publicKey)}var ra={};nt(ra,{Secp256k1PrivateKey:()=>Mn,Secp256k1PublicKey:()=>Fn,generateKeyPair:()=>eg,unmarshalSecp256k1PrivateKey:()=>j2,unmarshalSecp256k1PublicKey:()=>tg});var V2=(t,e,r)=>t&e^~t&r,q2=(t,e,r)=>t&e^t&r^e&r,z2=new Uint32Array([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]),or=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),sr=new Uint32Array(64),Xs=class extends Gr{constructor(){super(64,32,8,!1),this.A=or[0]|0,this.B=or[1]|0,this.C=or[2]|0,this.D=or[3]|0,this.E=or[4]|0,this.F=or[5]|0,this.G=or[6]|0,this.H=or[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:f}=this;return[e,r,n,i,o,s,a,f]}set(e,r,n,i,o,s,a,f){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=f|0}process(e,r){for(let l=0;l<16;l++,r+=4)sr[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let y=sr[l-15],d=sr[l-2],h=ae(y,7)^ae(y,18)^y>>>3,p=ae(d,17)^ae(d,19)^d>>>10;sr[l]=p+sr[l-7]+h+sr[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:f,G:c,H:u}=this;for(let l=0;l<64;l++){let y=ae(a,6)^ae(a,11)^ae(a,25),d=u+y+V2(a,f,c)+z2[l]+sr[l]|0,p=(ae(n,2)^ae(n,13)^ae(n,22))+q2(n,i,o)|0;u=c,c=f,f=a,a=s+d|0,s=o,o=i,i=n,n=d+p|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,f=f+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,f,c,u)}roundClean(){sr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var jf=gi(()=>new Xs);function H2(t){let e=In(t);Ae(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof r!="object"||typeof r.beta!="bigint"||typeof r.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:$2,hexToBytes:G2}=bi,Rr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=Rr;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");let r=t[1],n=t.subarray(2,r+2);if(!r||n.length!==r)throw new e("Invalid signature integer: wrong length");if(n[0]&128)throw new e("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:$2(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=Rr,r=typeof t=="string"?G2(t):t;if(!ce(r))throw new Error("ui8a expected");let n=r.length;if(n<2||r[0]!=48)throw new e("Invalid signature tag");if(r[1]!==n-2)throw new e("Invalid signature: incorrect length");let{d:i,l:o}=Rr._parseInt(r.subarray(2)),{d:s,l:a}=Rr._parseInt(o);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(t){let e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,r=c=>{let u=c.toString(16);return u.length&1?`0${u}`:u},n=e(r(t.s)),i=e(r(t.r)),o=n.length/2,s=i.length/2,a=r(o),f=r(s);return`30${r(s+o+4)}02${f}${i}02${a}${n}`}},ze=BigInt(0),re=BigInt(1),a8=BigInt(2),tu=BigInt(3),c8=BigInt(4);function W2(t){let e=H2(t),{Fp:r}=e,n=e.toBytes||((h,p,g)=>{let x=p.toAffine();return ke(Uint8Array.from([4]),r.toBytes(x.x),r.toBytes(x.y))}),i=e.fromBytes||(h=>{let p=h.subarray(1),g=r.fromBytes(p.subarray(0,r.BYTES)),x=r.fromBytes(p.subarray(r.BYTES,2*r.BYTES));return{x:g,y:x}});function o(h){let{a:p,b:g}=e,x=r.sqr(h),m=r.mul(x,h);return r.add(r.add(m,r.mul(h,p)),g)}if(!r.eql(r.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function s(h){return typeof h=="bigint"&&ze<h&&h<e.n}function a(h){if(!s(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(h){let{allowedPrivateKeyLengths:p,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(p&&typeof h!="bigint"){if(ce(h)&&(h=Pe(h)),typeof h!="string"||!p.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let b;try{b=typeof h=="bigint"?h:Ne(vt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(b=lt(b,m)),a(b),b}let c=new Map;function u(h){if(!(h instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(p,g,x){if(this.px=p,this.py=g,this.pz=x,p==null||!r.isValid(p))throw new Error("x required");if(g==null||!r.isValid(g))throw new Error("y required");if(x==null||!r.isValid(x))throw new Error("z required")}static fromAffine(p){let{x:g,y:x}=p||{};if(!p||!r.isValid(g)||!r.isValid(x))throw new Error("invalid affine point");if(p instanceof l)throw new Error("projective point not allowed");let m=b=>r.eql(b,r.ZERO);return m(g)&&m(x)?l.ZERO:new l(g,x,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(p){let g=r.invertBatch(p.map(x=>x.pz));return p.map((x,m)=>x.toAffine(g[m])).map(l.fromAffine)}static fromHex(p){let g=l.fromAffine(i(vt("pointHex",p)));return g.assertValidity(),g}static fromPrivateKey(p){return l.BASE.multiply(f(p))}_setWindowSize(p){this._WINDOW_SIZE=p,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:p,y:g}=this.toAffine();if(!r.isValid(p)||!r.isValid(g))throw new Error("bad point: x or y not FE");let x=r.sqr(g),m=o(p);if(!r.eql(x,m))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:p}=this.toAffine();if(r.isOdd)return!r.isOdd(p);throw new Error("Field doesn't support isOdd")}equals(p){u(p);let{px:g,py:x,pz:m}=this,{px:b,py:I,pz:E}=p,S=r.eql(r.mul(g,E),r.mul(b,m)),_=r.eql(r.mul(x,E),r.mul(I,m));return S&&_}negate(){return new l(this.px,r.neg(this.py),this.pz)}double(){let{a:p,b:g}=e,x=r.mul(g,tu),{px:m,py:b,pz:I}=this,E=r.ZERO,S=r.ZERO,_=r.ZERO,L=r.mul(m,m),V=r.mul(b,b),z=r.mul(I,I),M=r.mul(m,b);return M=r.add(M,M),_=r.mul(m,I),_=r.add(_,_),E=r.mul(p,_),S=r.mul(x,z),S=r.add(E,S),E=r.sub(V,S),S=r.add(V,S),S=r.mul(E,S),E=r.mul(M,E),_=r.mul(x,_),z=r.mul(p,z),M=r.sub(L,z),M=r.mul(p,M),M=r.add(M,_),_=r.add(L,L),L=r.add(_,L),L=r.add(L,z),L=r.mul(L,M),S=r.add(S,L),z=r.mul(b,I),z=r.add(z,z),L=r.mul(z,M),E=r.sub(E,L),_=r.mul(z,V),_=r.add(_,_),_=r.add(_,_),new l(E,S,_)}add(p){u(p);let{px:g,py:x,pz:m}=this,{px:b,py:I,pz:E}=p,S=r.ZERO,_=r.ZERO,L=r.ZERO,V=e.a,z=r.mul(e.b,tu),M=r.mul(g,b),X=r.mul(x,I),ct=r.mul(m,E),Dt=r.add(g,x),C=r.add(b,I);Dt=r.mul(Dt,C),C=r.add(M,X),Dt=r.sub(Dt,C),C=r.add(g,m);let N=r.add(b,E);return C=r.mul(C,N),N=r.add(M,ct),C=r.sub(C,N),N=r.add(x,m),S=r.add(I,E),N=r.mul(N,S),S=r.add(X,ct),N=r.sub(N,S),L=r.mul(V,C),S=r.mul(z,ct),L=r.add(S,L),S=r.sub(X,L),L=r.add(X,L),_=r.mul(S,L),X=r.add(M,M),X=r.add(X,M),ct=r.mul(V,ct),C=r.mul(z,C),X=r.add(X,ct),ct=r.sub(M,ct),ct=r.mul(V,ct),C=r.add(C,ct),M=r.mul(X,C),_=r.add(_,M),M=r.mul(N,C),S=r.mul(Dt,S),S=r.sub(S,M),M=r.mul(Dt,X),L=r.mul(N,L),L=r.add(L,M),new l(S,_,L)}subtract(p){return this.add(p.negate())}is0(){return this.equals(l.ZERO)}wNAF(p){return d.wNAFCached(this,c,p,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,b)=>m.toAffine(x[b])).map(l.fromAffine)})}multiplyUnsafe(p){let g=l.ZERO;if(p===ze)return g;if(a(p),p===re)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,p);let{k1neg:m,k1:b,k2neg:I,k2:E}=x.splitScalar(p),S=g,_=g,L=this;for(;b>ze||E>ze;)b&re&&(S=S.add(L)),E&re&&(_=_.add(L)),L=L.double(),b>>=re,E>>=re;return m&&(S=S.negate()),I&&(_=_.negate()),_=new l(r.mul(_.px,x.beta),_.py,_.pz),S.add(_)}multiply(p){a(p);let g=p,x,m,{endo:b}=e;if(b){let{k1neg:I,k1:E,k2neg:S,k2:_}=b.splitScalar(g),{p:L,f:V}=this.wNAF(E),{p:z,f:M}=this.wNAF(_);L=d.constTimeNegate(I,L),z=d.constTimeNegate(S,z),z=new l(r.mul(z.px,b.beta),z.py,z.pz),x=L.add(z),m=V.add(M)}else{let{p:I,f:E}=this.wNAF(g);x=I,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(p,g,x){let m=l.BASE,b=(E,S)=>S===ze||S===re||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),I=b(this,g).add(b(p,x));return I.is0()?void 0:I}toAffine(p){let{px:g,py:x,pz:m}=this,b=this.is0();p==null&&(p=b?r.ONE:r.inv(m));let I=r.mul(g,p),E=r.mul(x,p),S=r.mul(m,p);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:I,y:E}}isTorsionFree(){let{h:p,isTorsionFree:g}=e;if(p===re)return!0;if(g)return g(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:p,clearCofactor:g}=e;return p===re?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(p=!0){return this.assertValidity(),n(l,this,p)}toHex(p=!0){return Pe(this.toRawBytes(p))}}l.BASE=new l(e.Gx,e.Gy,r.ONE),l.ZERO=new l(r.ZERO,r.ONE,r.ZERO);let y=e.nBitLength,d=Ei(l,e.endo?Math.ceil(y/2):y);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:o,isWithinCurveOrder:s}}function Y2(t){let e=In(t);return Ae(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function eu(t){let e=Y2(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(C){return ze<C&&C<r.ORDER}function a(C){return lt(C,n)}function f(C){return vi(C,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:y}=W2({...e,toBytes(C,N,D){let P=N.toAffine(),B=r.toBytes(P.x),O=ke;return D?O(Uint8Array.from([N.hasEvenY()?2:3]),B):O(Uint8Array.from([4]),B,r.toBytes(P.y))},fromBytes(C){let N=C.length,D=C[0],P=C.subarray(1);if(N===i&&(D===2||D===3)){let B=Ne(P);if(!s(B))throw new Error("Point is not on curve");let O=l(B),K=r.sqrt(O),q=(K&re)===re;return(D&1)===1!==q&&(K=r.neg(K)),{x:B,y:K}}else if(N===o&&D===4){let B=r.fromBytes(P.subarray(0,r.BYTES)),O=r.fromBytes(P.subarray(r.BYTES,2*r.BYTES));return{x:B,y:O}}else throw new Error(`Point of length ${N} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),d=C=>Pe(rr(C,e.nByteLength));function h(C){let N=n>>re;return C>N}function p(C){return h(C)?a(-C):C}let g=(C,N,D)=>Ne(C.slice(N,D));class x{constructor(N,D,P){this.r=N,this.s=D,this.recovery=P,this.assertValidity()}static fromCompact(N){let D=e.nByteLength;return N=vt("compactSignature",N,D*2),new x(g(N,0,D),g(N,D,2*D))}static fromDER(N){let{r:D,s:P}=Rr.toSig(vt("DER",N));return new x(D,P)}assertValidity(){if(!y(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!y(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(N){return new x(this.r,this.s,N)}recoverPublicKey(N){let{r:D,s:P,recovery:B}=this,O=_(vt("msgHash",N));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");let K=B===2||B===3?D+e.n:D;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let q=B&1?"03":"02",Z=c.fromHex(q+d(K)),J=f(K),st=a(-O*J),j=a(P*J),rt=c.BASE.multiplyAndAddUnsafe(Z,st,j);if(!rt)throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return br(this.toDERHex())}toDERHex(){return Rr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return br(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}let m={isValidPrivateKey(C){try{return u(C),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let C=is(e.n);return Yc(e.randomBytes(C),e.n)},precompute(C=8,N=c.BASE){return N._setWindowSize(C),N.multiply(BigInt(3)),N}};function b(C,N=!0){return c.fromPrivateKey(C).toRawBytes(N)}function I(C){let N=ce(C),D=typeof C=="string",P=(N||D)&&C.length;return N?P===i||P===o:D?P===2*i||P===2*o:C instanceof c}function E(C,N,D=!0){if(I(C))throw new Error("first arg must be private key");if(!I(N))throw new Error("second arg must be public key");return c.fromHex(N).multiply(u(C)).toRawBytes(D)}let S=e.bits2int||function(C){let N=Ne(C),D=C.length*8-e.nBitLength;return D>0?N>>BigInt(D):N},_=e.bits2int_modN||function(C){return a(S(C))},L=Bn(e.nBitLength);function V(C){if(typeof C!="bigint")throw new Error("bigint expected");if(!(ze<=C&&C<L))throw new Error(`bigint expected < 2^${e.nBitLength}`);return rr(C,e.nByteLength)}function z(C,N,D=M){if(["recovered","canonical"].some(mt=>mt in D))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:B}=e,{lowS:O,prehash:K,extraEntropy:q}=D;O==null&&(O=!0),C=vt("msgHash",C),K&&(C=vt("prehashed msgHash",P(C)));let Z=_(C),J=u(N),st=[V(J),V(Z)];if(q!=null){let mt=q===!0?B(r.BYTES):q;st.push(vt("extraEntropy",mt))}let j=ke(...st),rt=Z;function Et(mt){let Pt=S(mt);if(!y(Pt))return;let Nt=f(Pt),Bt=c.BASE.multiply(Pt).toAffine(),Ut=a(Bt.x);if(Ut===ze)return;let Ie=a(Nt*a(rt+Ut*J));if(Ie===ze)return;let fr=(Bt.x===Ut?0:2)|Number(Bt.y&re),dn=Ie;return O&&h(Ie)&&(dn=p(Ie),fr^=1),new x(Ut,dn,fr)}return{seed:j,k2sig:Et}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function ct(C,N,D=M){let{seed:P,k2sig:B}=z(C,N,D),O=e;return ts(O.hash.outputLen,O.nByteLength,O.hmac)(P,B)}c.BASE._setWindowSize(8);function Dt(C,N,D,P=X){let B=C;if(N=vt("msgHash",N),D=vt("publicKey",D),"strict"in P)throw new Error("options.strict was renamed to lowS");let{lowS:O,prehash:K}=P,q,Z;try{if(typeof B=="string"||ce(B))try{q=x.fromDER(B)}catch(Bt){if(!(Bt instanceof Rr.Err))throw Bt;q=x.fromCompact(B)}else if(typeof B=="object"&&typeof B.r=="bigint"&&typeof B.s=="bigint"){let{r:Bt,s:Ut}=B;q=new x(Bt,Ut)}else throw new Error("PARSE");Z=c.fromHex(D)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&q.hasHighS())return!1;K&&(N=e.hash(N));let{r:J,s:st}=q,j=_(N),rt=f(st),Et=a(j*rt),mt=a(J*rt),Pt=c.BASE.multiplyAndAddUnsafe(Z,Et,mt)?.toAffine();return Pt?a(Pt.x)===J:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:E,sign:ct,verify:Dt,ProjectivePoint:c,Signature:x,utils:m}}var Pi=class extends Hr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,kc(e);let n=An(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(e){return zr(this),this.iHash.update(e),this}digestInto(e){zr(this),Wo(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Js=(t,e,r)=>new Pi(t,e).update(r).digest();Js.create=(t,e)=>new Pi(t,e);function Z2(t){return{hash:t,hmac:(e,...r)=>Js(t,e,yi(...r)),randomBytes:$r}}function ru(t,e){let r=n=>eu({...t,...Z2(n)});return Object.freeze({...r(e),create:r})}var ou=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),nu=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Q2=BigInt(1),js=BigInt(2),iu=(t,e)=>(t+e/js)/e;function X2(t){let e=ou,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,l=xt(u,r,e)*u%e,y=xt(l,r,e)*u%e,d=xt(y,js,e)*c%e,h=xt(d,i,e)*d%e,p=xt(h,o,e)*h%e,g=xt(p,a,e)*p%e,x=xt(g,f,e)*g%e,m=xt(x,a,e)*p%e,b=xt(m,r,e)*u%e,I=xt(b,s,e)*h%e,E=xt(I,n,e)*c%e,S=xt(E,js,e);if(!ta.eql(ta.sqr(S),t))throw new Error("Cannot find square root");return S}var ta=wi(ou,void 0,void 0,{sqrt:X2}),pe=ru({a:BigInt(0),b:BigInt(7),Fp:ta,n:nu,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=nu,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Q2*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=iu(o*t,e),f=iu(-n*t,e),c=lt(t-a*r-f*i,e),u=lt(-a*n-f*o,e),l=c>s,y=u>s;if(l&&(c=e-c),y&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:y,k2:u}}}},jf),v8=BigInt(0);var w8=pe.ProjectivePoint;function su(){return pe.utils.randomPrivateKey()}function au(t,e){let r=kt.digest(e instanceof Uint8Array?e:e.subarray());if(ee(r))return r.then(({digest:n})=>pe.sign(n,t).toDERRawBytes()).catch(n=>{throw new $(String(n),"ERR_INVALID_INPUT")});try{return pe.sign(r.digest,t).toDERRawBytes()}catch(n){throw new $(String(n),"ERR_INVALID_INPUT")}}function cu(t,e,r){let n=kt.digest(r instanceof Uint8Array?r:r.subarray());if(ee(n))return n.then(({digest:i})=>pe.verify(e,i,t)).catch(i=>{throw new $(String(i),"ERR_INVALID_INPUT")});try{return pe.verify(e,n.digest,t)}catch(i){throw new $(String(i),"ERR_INVALID_INPUT")}}function fu(t){return pe.ProjectivePoint.fromHex(t).toRawBytes(!0)}function uu(t){try{pe.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}function ea(t){try{pe.ProjectivePoint.fromHex(t)}catch(e){throw new $(String(e),"ERR_INVALID_PUBLIC_KEY")}}function lu(t){try{return pe.getPublicKey(t,!0)}catch(e){throw new $(String(e),"ERR_INVALID_PRIVATE_KEY")}}var Fn=class{_key;constructor(e){ea(e),this._key=e}verify(e,r){return cu(this._key,r,e)}marshal(){return fu(this._key)}get bytes(){return Me.encode({Type:Lt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Se(this.bytes,e.bytes)}async hash(){let e=kt.digest(this.bytes),r;return ee(e)?{bytes:r}=await e:r=e.bytes,r}},Mn=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??lu(e),uu(this._key),ea(this._publicKey)}sign(e){return au(this._key,e)}get public(){return new Fn(this._publicKey)}marshal(){return this._key}get bytes(){return Ve.encode({Type:Lt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Se(this.bytes,e.bytes)}hash(){let e=kt.digest(this.bytes);return ee(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return Qt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Zr(this.bytes,e);throw new $(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function j2(t){return new Mn(t)}function tg(t){return new Fn(t)}async function eg(){let t=su();return new Mn(t)}var hu={rsa:Qs,ed25519:$s,secp256k1:ra};function ng(t){let e=Object.keys(hu).join(" / ");return new $(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function na(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return hu[t];throw ng(t)}async function du(t,e){return na(t).generateKeyPair(e??2048)}function pu(t,e){return e=(e??"rsa").toLowerCase(),na(e),t.bytes}function yu(t,e){return e=(e??"rsa").toLowerCase(),na(e),t.bytes}function ia(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function gu(t=0){return globalThis.Buffer?.allocUnsafe!=null?ia(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function mu(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var xu=mu("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),oa=mu("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=gu(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Z8={utf8:xu,"utf-8":xu,hex:qt.base16,latin1:oa,ascii:oa,binary:oa,...qt};var sa;(function(t){let e;t.codec=()=>(e==null&&(e=de((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.id!=null&&(n.uint32(10),n.bytes(r.id)),r.pubKey!=null&&(n.uint32(18),n.bytes(r.pubKey)),r.privKey!=null&&(n.uint32(26),n.bytes(r.privKey)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},o=n==null?r.len:r.pos+n;for(;r.pos<o;){let s=r.uint32();switch(s>>>3){case 1:i.id=r.bytes();break;case 2:i.pubKey=r.bytes();break;case 3:i.privKey=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>he(r,t.codec()),t.decode=r=>le(r,t.codec())})(sa||(sa={}));var bu=async()=>{let t=await du("Ed25519"),e=await ig(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function ig(t){return d0(pu(t.public),yu(t))}function vu(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}function _r(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ni(t=0){return globalThis.Buffer?.allocUnsafe!=null?_r(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Eu(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var wu=Eu("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),aa=Eu("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=Ni(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),og={utf8:wu,"utf-8":wu,hex:qt.base16,latin1:aa,ascii:aa,binary:aa,...qt},ki=og;function Wt(t,e="utf8"){let r=ki[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Su(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Au(t=0){return globalThis.Buffer?.allocUnsafe!=null?Su(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}var sg=Math.pow(2,7),ag=Math.pow(2,14),cg=Math.pow(2,21),ca=Math.pow(2,28),fa=Math.pow(2,35),ua=Math.pow(2,42),la=Math.pow(2,49),ot=128,Ft=127;function Yt(t){if(t<sg)return 1;if(t<ag)return 2;if(t<cg)return 3;if(t<ca)return 4;if(t<fa)return 5;if(t<ua)return 6;if(t<la)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function fg(t,e,r=0){switch(Yt(t)){case 8:e[r++]=t&255|ot,t/=128;case 7:e[r++]=t&255|ot,t/=128;case 6:e[r++]=t&255|ot,t/=128;case 5:e[r++]=t&255|ot,t/=128;case 4:e[r++]=t&255|ot,t>>>=7;case 3:e[r++]=t&255|ot,t>>>=7;case 2:e[r++]=t&255|ot,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function ug(t,e,r=0){switch(Yt(t)){case 8:e.set(r++,t&255|ot),t/=128;case 7:e.set(r++,t&255|ot),t/=128;case 6:e.set(r++,t&255|ot),t/=128;case 5:e.set(r++,t&255|ot),t/=128;case 4:e.set(r++,t&255|ot),t>>>=7;case 3:e.set(r++,t&255|ot),t>>>=7;case 2:e.set(r++,t&255|ot),t>>>=7;case 1:{e.set(r++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function lg(t,e){let r=t[e],n=0;if(n+=r&Ft,r<ot||(r=t[e+1],n+=(r&Ft)<<7,r<ot)||(r=t[e+2],n+=(r&Ft)<<14,r<ot)||(r=t[e+3],n+=(r&Ft)<<21,r<ot)||(r=t[e+4],n+=(r&Ft)*ca,r<ot)||(r=t[e+5],n+=(r&Ft)*fa,r<ot)||(r=t[e+6],n+=(r&Ft)*ua,r<ot)||(r=t[e+7],n+=(r&Ft)*la,r<ot))return n;throw new RangeError("Could not decode varint")}function hg(t,e){let r=t.get(e),n=0;if(n+=r&Ft,r<ot||(r=t.get(e+1),n+=(r&Ft)<<7,r<ot)||(r=t.get(e+2),n+=(r&Ft)<<14,r<ot)||(r=t.get(e+3),n+=(r&Ft)<<21,r<ot)||(r=t.get(e+4),n+=(r&Ft)*ca,r<ot)||(r=t.get(e+5),n+=(r&Ft)*fa,r<ot)||(r=t.get(e+6),n+=(r&Ft)*ua,r<ot)||(r=t.get(e+7),n+=(r&Ft)*la,r<ot))return n;throw new RangeError("Could not decode varint")}function ar(t,e,r=0){return e==null&&(e=Au(Yt(t))),e instanceof Uint8Array?fg(t,e,r):ug(t,e,r)}function He(t,e=0){return t instanceof Uint8Array?lg(t,e):hg(t,e)}function $e(t,e){if(globalThis.Buffer!=null)return _r(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Ni(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return _r(r)}var Oi=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let f=a==="0",c=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let y=Number.parseInt(l,e);if(!Number.isNaN(y))return y});if(u===void 0)break;if(o*=e,o+=u,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&f&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Bu=45,dg=15,sn=new Oi;function ha(t){if(!(t.length>dg))return sn.new(t).parseWith(()=>sn.readIPv4Addr())}function da(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Bu))return sn.new(t).parseWith(()=>sn.readIPv6Addr())}function Ki(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Bu))return sn.new(t).parseWith(()=>sn.readIPAddr())}var UE=parseInt("0xFFFF",16),OE=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function pa(t,e="utf8"){let r=ki[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?_r(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}function Cu(t){return!!ha(t)}function Ru(t){return!!da(t)}function an(t){return!!Ki(t)}var _u=Cu,mg=Ru,ya=function(t){let e=0;if(t=t.toString().trim(),_u(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(mg(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=_u(r[n]),s;o&&(s=ya(r[n]),r[n]=Wt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,Wt(s.slice(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){let o=parseInt(r[n],16);i[e++]=o>>8&255,i[e++]=o&255}return i}throw new Error("invalid ip address")},Lu=function(t,e=0,r){e=~~e,r=r??t.length-e;let n=new DataView(t.buffer);if(r===4){let i=[];for(let o=0;o<r;o++)i.push(t[e+o]);return i.join(".")}if(r===16){let i=[];for(let o=0;o<r;o+=2)i.push(n.getUint16(e+o).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var cn={},ga={},vg=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,-1,"ip6zone"],[43,8,"ipcidr"],[53,-1,"dns",!0],[54,-1,"dns4",!0],[55,-1,"dns6",!0],[56,-1,"dnsaddr",!0],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[280,0,"webrtc-direct"],[281,0,"webrtc"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,-1,"unix",!1,!0],[421,-1,"ipfs"],[421,-1,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,-1,"garlic64"],[448,0,"tls"],[449,-1,"sni"],[460,0,"quic"],[461,0,"quic-v1"],[465,0,"webtransport"],[466,-1,"certhash"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,-1,"memory"]];vg.forEach(t=>{let e=wg(...t);ga[e.code]=e,cn[e.name]=e});function wg(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function at(t){if(typeof t=="number"){if(ga[t]!=null)return ga[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(cn[t]!=null)return cn[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var S3=at("ip4"),A3=at("ip6"),B3=at("ipcidr");function ma(t,e){switch(at(t).code){case 4:case 41:return Sg(e);case 42:return Nu(e);case 6:case 273:case 33:case 132:return Uu(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Nu(e);case 421:return Tg(e);case 444:return ku(e);case 445:return ku(e);case 466:return Ig(e);default:return Wt(e,"base16")}}function ba(t,e){switch(at(t).code){case 4:return Du(e);case 41:return Du(e);case 42:return Pu(e);case 6:case 273:case 33:case 132:return va(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return Pu(e);case 421:return Ag(e);case 444:return Cg(e);case 445:return Rg(e);case 466:return Bg(e);default:return pa(e,"base16")}}var xa=Object.values(qt).map(t=>t.decoder),Eg=function(){let t=xa[0].or(xa[1]);return xa.slice(2).forEach(e=>t=t.or(e)),t}();function Du(t){if(!an(t))throw new Error("invalid ip address");return ya(t)}function Sg(t){let e=Lu(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!an(e))throw new Error("invalid ip address");return e}function va(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function Uu(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function Pu(t){let e=pa(t),r=Uint8Array.from(ar(e.length));return $e([r,e],r.length+e.length)}function Nu(t){let e=He(t);if(t=t.slice(Yt(e)),t.length!==e)throw new Error("inconsistent lengths");return Wt(t)}function Ag(t){let e;t[0]==="Q"||t[0]==="1"?e=ur(It.decode(`z${t}`)).bytes:e=ne.parse(t).multihash.bytes;let r=Uint8Array.from(ar(e.length));return $e([r,e],r.length+e.length)}function Bg(t){let e=Eg.decode(t),r=Uint8Array.from(ar(e.length));return $e([r,e],r.length+e.length)}function Ig(t){let e=He(t),r=t.slice(Yt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+Wt(r,"base64url")}function Tg(t){let e=He(t),r=t.slice(Yt(e));if(r.length!==e)throw new Error("inconsistent lengths");return Wt(r,"base58btc")}function Cg(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Ce.decode("b"+e[0]),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=va(n);return $e([r,i],r.length+i.length)}function Rg(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Ce.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=va(n);return $e([r,i],r.length+i.length)}function ku(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=Wt(e,"base32"),i=Uu(r);return`${n}:${i}`}function Ou(t){t=wa(t);let e=[],r=[],n=null,i=t.split("/").slice(1);if(i.length===1&&i[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let o=0;o<i.length;o++){let s=i[o],a=at(s);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(o++,o>=i.length)throw Fu("invalid address: "+t);if(a.path===!0){n=wa(i.slice(o).join("/")),e.push([a.code,ba(a.code,n)]),r.push([a.code,n]);break}let f=ba(a.code,i[o]);e.push([a.code,f]),r.push([a.code,ma(a.code,f)])}return{string:Ku(r),bytes:Sa(e),tuples:e,stringTuples:r,path:n}}function Ea(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=He(t,i),s=Yt(o),a=at(o),f=_g(a,t.slice(i+s));if(f===0){e.push([o]),r.push([o]),i+=s;continue}let c=t.slice(i+s,i+s+f);if(i+=f+s,i>t.length)throw Fu("Invalid address Uint8Array: "+Wt(t,"base16"));e.push([o,c]);let u=ma(o,c);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:Ku(r),tuples:e,stringTuples:r,path:n}}function Ku(t){let e=[];return t.map(r=>{let n=at(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),wa(e.join("/"))}function Sa(t){return $e(t.map(e=>{let r=at(e[0]),n=Uint8Array.from(ar(r.code));return e.length>1&&e[1]!=null&&(n=$e([n,e[1]])),n}))}function _g(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=He(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Yt(r)}}function wa(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function Fu(t){return new Error("Error parsing address: "+t)}var Lg=Symbol.for("nodejs.util.inspect.custom"),Aa=Symbol.for("@multiformats/js-multiaddr/multiaddr"),Dg=[at("dns").code,at("dns4").code,at("dns6").code,at("dnsaddr").code],Fi=class t{bytes;#e;#t;#r;#n;[Aa]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Ea(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=Ou(e)}else if(Vu(e))r=Ea(e.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=r.bytes,this.#e=r.string,this.#t=r.tuples,this.#r=r.stringTuples,this.#n=r.path}toString(){return this.#e}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="",s=at("tcp"),a=at("udp"),f=at("ip4"),c=at("ip6"),u=at("dns6"),l=at("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(o=`%${h??""}`),Dg.includes(d)&&(r=s.name,i=443,n=`${h??""}${o}`,e=d===u.code?6:4),(d===s.code||d===a.code)&&(r=at(d).name,i=parseInt(h??"")),(d===f.code||d===c.code)&&(r=at(d).name,n=`${h??""}${o}`,e=d===c.code?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}protos(){return this.#t.map(([e])=>Object.assign({},at(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>at(e).name)}tuples(){return this.#t}stringTuples(){return this.#r}encapsulate(e){return e=new t(e),new t(this.toString()+e.toString())}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i))}decapsulateCode(e){let r=this.tuples();for(let n=r.length-1;n>=0;n--)if(r[n][0]===e)return new t(Sa(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===cn.p2p.code&&e.push([n,i]),n===cn["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?Wt(It.decode(`z${n}`),"base58btc"):Wt(ne.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return vu(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=Mu.get(r.name);if(n==null)throw new $(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(o=>new t(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(e){let r=(e??this).protos();return!(r.length!==2||r[0].code!==4&&r[0].code!==41||r[1].code!==6&&r[1].code!==273)}[Lg](){return`Multiaddr(${this.#e})`}};var Mu=new Map;function Vu(t){return!!t?.[Aa]}function Mi(t){return new Fi(t)}function Pg(t){return t[Symbol.asyncIterator]!=null}function Ng(t){if(Pg(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Ba=Ng;function Ia(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Gt(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Sr(r)}function qu(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 Hu=Symbol.for("@achingbrain/uint8arraylist");function zu(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function Vi(t){return!!t?.[Hu]}var fn=class t{bufs;length;[Hu]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(Vi(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(Vi(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=zu(this.bufs,e);return r.buf[r.index]}set(e,r){let n=zu(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(Vi(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return Ia(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Ia(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,f=a+s.byteLength;if(i=f,e>=f)continue;let c=e>=a&&e<f,u=r>a&&r<=f;if(c&&u){if(e===a&&r===f){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(c){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(u){if(r===f){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!Vi(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let l=r;l<=f;l+=u){u=0;for(let y=c;y>=0;y--){let d=this.get(l+y);if(n[y]!==d){u=Math.max(1,y-a[d]);break}}if(u===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Gt(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=Ke(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=Ke(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=Ke(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Gt(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=Ke(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=Ke(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=Ke(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=Ke(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=Ke(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!qu(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function qi(t){return t[Symbol.asyncIterator]!=null}var zi=t=>{let e=Yt(t),r=Gt(e);return ar(t,r),zi.bytes=e,r};zi.bytes=0;function Vn(t,e){e=e??{};let r=e.lengthEncoder??zi;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return qi(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}Vn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??zi;return new fn(r(t.byteLength),t)};var un=Ot(Wu(),1);var Ug=8,Og=1024*1024*4,Lr;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(Lr||(Lr={}));var Ta=t=>{let e=He(t);return Ta.bytes=Yt(e),e};Ta.bytes=0;function ln(t,e){let r=new fn,n=Lr.LENGTH,i=-1,o=e?.lengthDecoder??Ta,s=e?.maxLengthLength??Ug,a=e?.maxDataLength??Og;function*f(){for(;r.byteLength>0;){if(n===Lr.LENGTH)try{if(i=o(r),i<0)throw(0,un.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,un.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let c=o.bytes;r.consume(c),e?.onLength!=null&&e.onLength(i),n=Lr.DATA}catch(c){if(c instanceof RangeError){if(r.byteLength>s)throw(0,un.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw c}if(n===Lr.DATA){if(r.byteLength<i)break;let c=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(c),yield c,n=Lr.LENGTH}}}return qi(t)?async function*(){for await(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,un.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}():function*(){for(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,un.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}ln.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:o,value:s}=await t.next(r);if(o===!0)return;s!=null&&(yield s)}catch(o){if(o.code==="ERR_UNDER_READ")return{done:!0,value:null};throw o}finally{r=1}}();return ln(n,{...e??{},onLength:o=>{r=o}})};function Fg(t){let[e,r]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],n=[];return{peek:()=>e.next(),push:i=>{n.push(i)},next:()=>n.length>0?{done:!1,value:n.shift()}:e.next(),[r](){return this}}}var Yu=Fg;function Mg(t){return t[Symbol.asyncIterator]!=null}function Vg(t,e){if(Mg(t))return async function*(){for await(let a of t)yield e(a)}();let r=Yu(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let o=e(n);if(typeof o.then=="function")return async function*(){yield await o;for await(let a of r)yield e(a)}();let s=e;return function*(){yield o;for(let a of r)yield s(a)}()}var Zu=Vg;function Ge(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Hi=globalThis.CustomEvent??Event;async function*Ca(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,o=[],s=Ge(),a=Ge(),f=!1,c,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let h of t){if(o.length===r&&(s=Ge(),await s.promise),u)break;let p={done:!1};o.push(p),h().then(g=>{p.done=!0,p.ok=!0,p.value=g,i.dispatchEvent(new Hi("task-complete"))},g=>{p.done=!0,p.err=g,i.dispatchEvent(new Hi("task-complete"))})}f=!0,i.dispatchEvent(new Hi("task-complete"))}catch(h){c=h,i.dispatchEvent(new Hi("task-complete"))}});function l(){return n?o[0]?.done:!!o.find(h=>h.done)}function*y(){for(;o.length>0&&o[0].done;){let h=o[0];if(o.shift(),h.ok)yield h.value;else throw u=!0,s.resolve(),h.err;s.resolve()}}function*d(){for(;l();)for(let h=0;h<o.length;h++)if(o[h].done){let p=o[h];if(o.splice(h,1),h--,p.ok)yield p.value;else throw u=!0,s.resolve(),p.err;s.resolve()}}for(;;){if(l()||(a=Ge(),await a.promise),c!=null)throw c;if(n?yield*y():yield*d(),f&&o.length===0)break}}var $i=class{buffer;mask;top;btm;next;constructor(e){if(!(e>0)||e-1&e)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}},hn=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new $i(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return e?.byteLength!=null?e.byteLength:1}push(e){if(e?.value!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){let r=this.head;this.head=r.next=new $i(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){let r=this.tail.next;this.tail.next=null,this.tail=r,e=this.tail.shift()}return e?.value!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}};var Ra=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Gi(t={}){return qg(r=>{let n=r.shift();if(n==null)return{done:!0};if(n.error!=null)throw n.error;return{done:n.done===!0,value:n.value}},t)}function qg(t,e){e=e??{};let r=e.onEnd,n=new hn,i,o,s,a=Ge(),f=async()=>{try{return n.isEmpty()?s?{done:!0}:await new Promise((g,x)=>{o=m=>{o=null,n.push(m);try{g(t(n))}catch(b){x(b)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Ge()})}},c=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new hn,o!=null?o({error:g}):(n.push({error:g}),i)),l=g=>{if(s)return i;if(e?.objectMode!==!0&&g?.byteLength==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return c({done:!1,value:g})},y=g=>s?i:(s=!0,g!=null?u(g):c({done:!0})),d=()=>(n=new hn,y(),{done:!0}),h=g=>(y(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:f,return:d,throw:h,push:l,end:y,get readableLength(){return n.size},onEmpty:async g=>{let x=g?.signal;if(x?.throwIfAborted(),n.isEmpty())return;let m,b;x!=null&&(m=new Promise((I,E)=>{b=()=>{E(new Ra)},x.addEventListener("abort",b)}));try{await Promise.race([a.promise,m])}finally{b!=null&&x!=null&&x?.removeEventListener("abort",b)}}},r==null)return i;let p=i;return i={[Symbol.asyncIterator](){return this},next(){return p.next()},throw(g){return p.throw(g),r!=null&&(r(g),r=void 0),{done:!0}},return(){return p.return(),r!=null&&(r(),r=void 0),{done:!0}},push:l,end(g){return p.end(g),r!=null&&(r(g),r=void 0),i},get readableLength(){return p.readableLength},onEmpty:g=>p.onEmpty(g)},i}function zg(t){return t[Symbol.asyncIterator]!=null}function Hg(...t){let e=[];for(let r of t)zg(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Gi({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(t.map(async n=>{for await(let i of n)r.push(i)})),r.end()}catch(n){r.end(n)}}),yield*r}()}var Qu=Hg;function La(t,...e){if(t==null)throw new Error("Empty pipeline");if(_a(t)){let n=t;t=()=>n.source}else if(Ju(t)||Xu(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&_a(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let n=1;n<r.length-1;n++)_a(r[n])&&(r[n]=Gg(r[n]));return $g(...r)}var $g=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},Xu=t=>t?.[Symbol.asyncIterator]!=null,Ju=t=>t?.[Symbol.iterator]!=null,_a=t=>t==null?!1:t.sink!=null&&t.source!=null,Gg=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Gi({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(Xu(o))i=async function*(){yield*o,n.end()};else if(Ju(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Qu(n,i())}return t.source};var ol=Ot(ju(),1);var tl="[a-fA-F\\d:]",cr=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${tl})|(?<=${tl})(?=\\s|$))`:"",ye="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",At="[a-fA-F\\d]{1,4}",Wi=`
16
16
  (?:
17
- (?:${Et}:){7}(?:${Et}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
18
- (?:${Et}:){6}(?:${pe}|:${Et}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
19
- (?:${Et}:){5}(?::${pe}|(?::${Et}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
20
- (?:${Et}:){4}(?:(?::${Et}){0,1}:${pe}|(?::${Et}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
21
- (?:${Et}:){3}(?:(?::${Et}){0,2}:${pe}|(?::${Et}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
22
- (?:${Et}:){2}(?:(?::${Et}){0,3}:${pe}|(?::${Et}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
23
- (?:${Et}:){1}(?:(?::${Et}){0,4}:${pe}|(?::${Et}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
24
- (?::(?:(?::${Et}){0,5}:${pe}|(?::${Et}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
17
+ (?:${At}:){7}(?:${At}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
18
+ (?:${At}:){6}(?:${ye}|:${At}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
19
+ (?:${At}:){5}(?::${ye}|(?::${At}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
20
+ (?:${At}:){4}(?:(?::${At}){0,1}:${ye}|(?::${At}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
21
+ (?:${At}:){3}(?:(?::${At}){0,2}:${ye}|(?::${At}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
22
+ (?:${At}:){2}(?:(?::${At}){0,3}:${ye}|(?::${At}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
23
+ (?:${At}:){1}(?:(?::${At}){0,4}:${ye}|(?::${At}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
24
+ (?::(?:(?::${At}){0,5}:${ye}|(?::${At}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
25
25
  )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
26
- `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Uy=new RegExp(`(?:^${pe}$)|(?:^${Pi}$)`),Oy=new RegExp(`^${pe}$`),Ky=new RegExp(`^${Pi}$`),Ys=t=>t&&t.exact?Uy:new RegExp(`(?:${nr(t)}${pe}${nr(t)})|(?:${nr(t)}${Pi}${nr(t)})`,"g");Ys.v4=t=>t&&t.exact?Oy:new RegExp(`${nr(t)}${pe}${nr(t)}`,"g");Ys.v6=t=>t&&t.exact?Ky:new RegExp(`${nr(t)}${Pi}${nr(t)}`,"g");var Xc=Ys;var ru=Ut(jc(),1),{isValid:Fy,parse:My}=ru.default,Vy=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],qy=Vy.map(t=>new eu.Netmask(t));function Hy(t){for(let e of qy)if(e.contains(t))return!0;return!1}function tu(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}var nu=t=>{if(Fy(t)){let e=My(t);if(e.kind()==="ipv4")return Hy(e.toNormalizedString());if(e.kind()==="ipv6")return tu(t)}else if(Zr(t)&&Xc.v6().test(t))return tu(t)};var Zs=nu;var iu="libp2p",ou="autonat",su="1.0.0";var Y;(function(t){let e;(function(f){f.DIAL="DIAL",f.DIAL_RESPONSE="DIAL_RESPONSE"})(e=t.MessageType||(t.MessageType={}));let r;(function(f){f[f.DIAL=0]="DIAL",f[f.DIAL_RESPONSE=1]="DIAL_RESPONSE"})(r||(r={})),function(f){f.codec=()=>zr(r)}(e=t.MessageType||(t.MessageType={}));let n;(function(f){f.OK="OK",f.E_DIAL_ERROR="E_DIAL_ERROR",f.E_DIAL_REFUSED="E_DIAL_REFUSED",f.E_BAD_REQUEST="E_BAD_REQUEST",f.E_INTERNAL_ERROR="E_INTERNAL_ERROR"})(n=t.ResponseStatus||(t.ResponseStatus={}));let i;(function(f){f[f.OK=0]="OK",f[f.E_DIAL_ERROR=100]="E_DIAL_ERROR",f[f.E_DIAL_REFUSED=101]="E_DIAL_REFUSED",f[f.E_BAD_REQUEST=200]="E_BAD_REQUEST",f[f.E_INTERNAL_ERROR=300]="E_INTERNAL_ERROR"})(i||(i={})),function(f){f.codec=()=>zr(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{if(d.lengthDelimited!==!1&&p.fork(),l.id!=null&&(p.uint32(10),p.bytes(l.id)),l.addrs!=null)for(let h of l.addrs)p.uint32(18),p.bytes(h);d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={addrs:[]},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.id=l.bytes();break;case 2:d.addrs.push(l.bytes());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.peer!=null&&(p.uint32(10),t.PeerInfo.codec().encode(l.peer,p)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.peer=t.PeerInfo.codec().decode(l,l.uint32());break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(s=t.Dial||(t.Dial={}));let a;(function(f){let u;f.codec=()=>(u==null&&(u=he((l,p,d={})=>{d.lengthDelimited!==!1&&p.fork(),l.status!=null&&(p.uint32(8),t.ResponseStatus.codec().encode(l.status,p)),l.statusText!=null&&(p.uint32(18),p.string(l.statusText)),l.addr!=null&&(p.uint32(26),p.bytes(l.addr)),d.lengthDelimited!==!1&&p.ldelim()},(l,p)=>{let d={},h=p==null?l.len:l.pos+p;for(;l.pos<h;){let y=l.uint32();switch(y>>>3){case 1:d.status=t.ResponseStatus.codec().decode(l);break;case 2:d.statusText=l.string();break;case 3:d.addr=l.bytes();break;default:l.skipType(y&7);break}}return d})),u),f.encode=l=>le(l,f.codec()),f.decode=l=>ue(l,f.codec())})(a=t.DialResponse||(t.DialResponse={}));let c;t.codec=()=>(c==null&&(c=he((f,u,l={})=>{l.lengthDelimited!==!1&&u.fork(),f.type!=null&&(u.uint32(8),t.MessageType.codec().encode(f.type,u)),f.dial!=null&&(u.uint32(18),t.Dial.codec().encode(f.dial,u)),f.dialResponse!=null&&(u.uint32(26),t.DialResponse.codec().encode(f.dialResponse,u)),l.lengthDelimited!==!1&&u.ldelim()},(f,u)=>{let l={},p=u==null?f.len:f.pos+u;for(;f.pos<p;){let d=f.uint32();switch(d>>>3){case 1:l.type=t.MessageType.codec().decode(f);break;case 2:l.dial=t.Dial.codec().decode(f,f.uint32());break;case 3:l.dialResponse=t.DialResponse.codec().decode(f,f.uint32());break;default:f.skipType(d&7);break}}return l})),c),t.encode=f=>le(f,t.codec()),t.decode=f=>ue(f,t.codec())})(Y||(Y={}));var Qs=4,Ni=class{components;startupDelay;refreshInterval;protocol;timeout;maxInboundStreams;maxOutboundStreams;verifyAddressTimeout;started;log;constructor(e,r){this.components=e,this.log=e.logger.forComponent("libp2p:autonat"),this.started=!1,this.protocol=`/${r.protocolPrefix??iu}/${ou}/${su}`,this.timeout=r.timeout??3e4,this.maxInboundStreams=r.maxInboundStreams??1,this.maxOutboundStreams=r.maxOutboundStreams??1,this.startupDelay=r.startupDelay??5e3,this.refreshInterval=r.refreshInterval??6e4,this._verifyExternalAddresses=this._verifyExternalAddresses.bind(this)}isStarted(){return this.started}async start(){this.started||(await this.components.registrar.handle(this.protocol,e=>{this.handleIncomingAutonatStream(e).catch(r=>{this.log.error("error handling incoming autonat stream",r)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.startupDelay),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.protocol),clearTimeout(this.verifyAddressTimeout),this.started=!1}async handleIncomingAutonatStream(e){let r=AbortSignal.timeout(this.timeout),n=()=>{e.stream.abort(new $("handleIncomingAutonatStream timeout",Oi))};r.addEventListener("abort",n,{once:!0}),Fi(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await Ws(e.stream,s=>jr(s),async function*(s){let a=await Vs(s);if(a==null){o.log("no message received"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let c;try{c=Y.decode(a)}catch(y){o.log.error("could not decode message",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let f=c.dial;if(f==null){o.log.error("dial was missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,l=f.peer;if(l==null||l.id==null){o.log.error("PeerId missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=Pn(l.id)}catch(y){o.log.error("invalid PeerId",y),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"bad peer id"}});return}if(o.log("incoming request from %p",u),!e.connection.remotePeer.equals(u)){o.log("target peer %p did not equal sending peer %p",u,e.connection.remotePeer),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let p=l.addrs.map(y=>Ii(y)).filter(y=>{let g=y.toOptions().host===e.connection.remoteAddr.toOptions().host;return o.log.trace("request to dial %a was sent from %a is same host %s",y,e.connection.remoteAddr,g),g}).filter(y=>{let g=y.toOptions().host,x=!(Zs(g)??!1);return o.log.trace("host %s was public %s",g,x),x}).filter(y=>{let g=y.toOptions().host,x=!i.includes(g);return o.log.trace("host %s was not our host %s",g,x),x}).filter(y=>{let g=!!o.components.transportManager.transportForMultiaddr(y);return o.log.trace("transport for %a is supported %s",y,g),g}).map(y=>(y.getPeerId()==null&&(y=y.encapsulate(`/p2p/${u.toString()}`)),y));if(p.length===0){o.log("no valid multiaddrs for %p in message",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}o.log("dial multiaddrs %s for peer %p",p.map(y=>y.toString()).join(", "),u);let d="",h=p[0];for await(let y of p){let g;h=y;try{if(g=await o.components.connectionManager.openConnection(y,{signal:r}),!g.remoteAddr.equals(y))throw o.log.error("tried to dial %a but dialed %a",y,g.remoteAddr),new Error("Unexpected remote address");o.log("Success %p",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.OK,addr:g.remoteAddr.decapsulateCode(st("p2p").code).bytes}});return}catch(x){o.log("could not dial %p",u,x),d=x.message}finally{g!=null&&await g.close()}}yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},s=>Cn(s),e.stream)}catch(o){this.log.error("error handling incoming autonat stream",o)}finally{r.removeEventListener("abort",n)}}_verifyExternalAddresses(){this.verifyExternalAddresses().catch(e=>{this.log.error("error verifying external address",e)})}async verifyExternalAddresses(){if(clearTimeout(this.verifyAddressTimeout),!this.isStarted())return;let e=this.components.addressManager,r=e.getObservedAddrs().filter(o=>{let s=o.toOptions();return!(Zs(s.host)??!1)});if(r.length===0){this.log("no public addresses found, not requesting verification"),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval);return}let n=AbortSignal.timeout(this.timeout);Fi(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let o=Y.encode({type:Y.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await dc()).toBytes(),c={},f=[],u=async l=>{let p=()=>{};try{this.log("asking %p to verify multiaddr",l.id);let d=await i.components.connectionManager.openConnection(l.id,{signal:n}),h=await d.newStream(this.protocol,{signal:n});p=()=>{h.abort(new $("verifyAddress timeout",Oi))},n.addEventListener("abort",p,{once:!0});let y=await Ws([o],x=>Cn(x),h,x=>jr(x),async x=>Vs(x));if(y==null){this.log("no response received from %p",d.remotePeer);return}let g=Y.decode(y);if(g.type!==Y.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===Y.ResponseStatus.OK){let x=d.remoteAddr.toOptions(),m;if(x.family===4)m=x.host.split(".")[0];else if(x.family===6)m=x.host.split(":")[0];else{this.log('remote address "%s" was not IP4 or IP6?',x.host);return}if(f.includes(m)){this.log("already have response from network segment %d - %s",m,x.host);return}f.push(m)}return g.dialResponse}catch(d){this.log.error("error asking remote to verify multiaddr",d)}finally{n.removeEventListener("abort",p)}};for await(let l of zs($c(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:Qs}))try{if(l==null)continue;let p=l.addr==null?r[0]:Ii(l.addr);if(this.log("autonat response for %a is %s",p,l.status),l.status===Y.ResponseStatus.E_BAD_REQUEST||l.status===Y.ResponseStatus.E_DIAL_REFUSED||l.addr==null&&r.length>1)continue;if(!r.some(h=>h.equals(p))){this.log("peer reported %a as %s but it was not in our observed address list",p,l.status);continue}let d=p.toString();if(c[d]==null&&(c[d]={success:0,failure:0}),l.status===Y.ResponseStatus.OK?c[d].success++:l.status===Y.ResponseStatus.E_DIAL_ERROR&&c[d].failure++,c[d].success===Qs){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(c[d].failure===Qs){this.log("%a is not externally dialable",p),e.removeObservedAddr(p);return}}catch(p){this.log.error("could not verify external address",p)}}finally{this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval)}}};function Zy(t={}){return e=>new Ni(e,t)}return vu(Qy);})();
26
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),Wg=new RegExp(`(?:^${ye}$)|(?:^${Wi}$)`),Yg=new RegExp(`^${ye}$`),Zg=new RegExp(`^${Wi}$`),Da=t=>t&&t.exact?Wg:new RegExp(`(?:${cr(t)}${ye}${cr(t)})|(?:${cr(t)}${Wi}${cr(t)})`,"g");Da.v4=t=>t&&t.exact?Yg:new RegExp(`${cr(t)}${ye}${cr(t)}`,"g");Da.v6=t=>t&&t.exact?Zg:new RegExp(`${cr(t)}${Wi}${cr(t)}`,"g");var el=Da;var sl=Ot(nl(),1),{isValid:Qg,parse:Xg}=sl.default,Jg=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],jg=Jg.map(t=>new ol.Netmask(t));function tx(t){for(let e of jg)if(e.contains(t))return!0;return!1}function il(t){return/^::$/.test(t)||/^::1$/.test(t)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(t)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(t)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(t)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(t)||/^ff([0-9a-fA-F]{2,2}):/i.test(t)}var al=t=>{if(Qg(t)){let e=Xg(t);if(e.kind()==="ipv4")return tx(e.toNormalizedString());if(e.kind()==="ipv6")return il(t)}else if(an(t)&&el.v6().test(t))return il(t)};var Pa=al;var cl="libp2p",fl="autonat",ul="1.0.0";var Y;(function(t){let e;(function(c){c.DIAL="DIAL",c.DIAL_RESPONSE="DIAL_RESPONSE"})(e=t.MessageType||(t.MessageType={}));let r;(function(c){c[c.DIAL=0]="DIAL",c[c.DIAL_RESPONSE=1]="DIAL_RESPONSE"})(r||(r={})),function(c){c.codec=()=>rn(r)}(e=t.MessageType||(t.MessageType={}));let n;(function(c){c.OK="OK",c.E_DIAL_ERROR="E_DIAL_ERROR",c.E_DIAL_REFUSED="E_DIAL_REFUSED",c.E_BAD_REQUEST="E_BAD_REQUEST",c.E_INTERNAL_ERROR="E_INTERNAL_ERROR"})(n=t.ResponseStatus||(t.ResponseStatus={}));let i;(function(c){c[c.OK=0]="OK",c[c.E_DIAL_ERROR=100]="E_DIAL_ERROR",c[c.E_DIAL_REFUSED=101]="E_DIAL_REFUSED",c[c.E_BAD_REQUEST=200]="E_BAD_REQUEST",c[c.E_INTERNAL_ERROR=300]="E_INTERNAL_ERROR"})(i||(i={})),function(c){c.codec=()=>rn(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(c){let u;c.codec=()=>(u==null&&(u=de((l,y,d={})=>{if(d.lengthDelimited!==!1&&y.fork(),l.id!=null&&(y.uint32(10),y.bytes(l.id)),l.addrs!=null)for(let h of l.addrs)y.uint32(18),y.bytes(h);d.lengthDelimited!==!1&&y.ldelim()},(l,y)=>{let d={addrs:[]},h=y==null?l.len:l.pos+y;for(;l.pos<h;){let p=l.uint32();switch(p>>>3){case 1:d.id=l.bytes();break;case 2:d.addrs.push(l.bytes());break;default:l.skipType(p&7);break}}return d})),u),c.encode=l=>he(l,c.codec()),c.decode=l=>le(l,c.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(c){let u;c.codec=()=>(u==null&&(u=de((l,y,d={})=>{d.lengthDelimited!==!1&&y.fork(),l.peer!=null&&(y.uint32(10),t.PeerInfo.codec().encode(l.peer,y)),d.lengthDelimited!==!1&&y.ldelim()},(l,y)=>{let d={},h=y==null?l.len:l.pos+y;for(;l.pos<h;){let p=l.uint32();switch(p>>>3){case 1:d.peer=t.PeerInfo.codec().decode(l,l.uint32());break;default:l.skipType(p&7);break}}return d})),u),c.encode=l=>he(l,c.codec()),c.decode=l=>le(l,c.codec())})(s=t.Dial||(t.Dial={}));let a;(function(c){let u;c.codec=()=>(u==null&&(u=de((l,y,d={})=>{d.lengthDelimited!==!1&&y.fork(),l.status!=null&&(y.uint32(8),t.ResponseStatus.codec().encode(l.status,y)),l.statusText!=null&&(y.uint32(18),y.string(l.statusText)),l.addr!=null&&(y.uint32(26),y.bytes(l.addr)),d.lengthDelimited!==!1&&y.ldelim()},(l,y)=>{let d={},h=y==null?l.len:l.pos+y;for(;l.pos<h;){let p=l.uint32();switch(p>>>3){case 1:d.status=t.ResponseStatus.codec().decode(l);break;case 2:d.statusText=l.string();break;case 3:d.addr=l.bytes();break;default:l.skipType(p&7);break}}return d})),u),c.encode=l=>he(l,c.codec()),c.decode=l=>le(l,c.codec())})(a=t.DialResponse||(t.DialResponse={}));let f;t.codec=()=>(f==null&&(f=de((c,u,l={})=>{l.lengthDelimited!==!1&&u.fork(),c.type!=null&&(u.uint32(8),t.MessageType.codec().encode(c.type,u)),c.dial!=null&&(u.uint32(18),t.Dial.codec().encode(c.dial,u)),c.dialResponse!=null&&(u.uint32(26),t.DialResponse.codec().encode(c.dialResponse,u)),l.lengthDelimited!==!1&&u.ldelim()},(c,u)=>{let l={},y=u==null?c.len:c.pos+u;for(;c.pos<y;){let d=c.uint32();switch(d>>>3){case 1:l.type=t.MessageType.codec().decode(c);break;case 2:l.dial=t.Dial.codec().decode(c,c.uint32());break;case 3:l.dialResponse=t.DialResponse.codec().decode(c,c.uint32());break;default:c.skipType(d&7);break}}return l})),f),t.encode=c=>he(c,t.codec()),t.decode=c=>le(c,t.codec())})(Y||(Y={}));var Na=4,Zi=class{components;startupDelay;refreshInterval;protocol;timeout;maxInboundStreams;maxOutboundStreams;verifyAddressTimeout;started;log;constructor(e,r){this.components=e,this.log=e.logger.forComponent("libp2p:autonat"),this.started=!1,this.protocol=`/${r.protocolPrefix??cl}/${fl}/${ul}`,this.timeout=r.timeout??3e4,this.maxInboundStreams=r.maxInboundStreams??1,this.maxOutboundStreams=r.maxOutboundStreams??1,this.startupDelay=r.startupDelay??5e3,this.refreshInterval=r.refreshInterval??6e4,this._verifyExternalAddresses=this._verifyExternalAddresses.bind(this)}isStarted(){return this.started}async start(){this.started||(await this.components.registrar.handle(this.protocol,e=>{this.handleIncomingAutonatStream(e).catch(r=>{this.log.error("error handling incoming autonat stream",r)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams}),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.startupDelay),this.started=!0)}async stop(){await this.components.registrar.unhandle(this.protocol),clearTimeout(this.verifyAddressTimeout),this.started=!1}async handleIncomingAutonatStream(e){let r=AbortSignal.timeout(this.timeout),n=()=>{e.stream.abort(new $("handleIncomingAutonatStream timeout",Xi))};r.addEventListener("abort",n,{once:!0}),ji(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await La(e.stream,s=>ln(s),async function*(s){let a=await Ba(s);if(a==null){o.log("no message received"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let f;try{f=Y.decode(a)}catch(p){o.log.error("could not decode message",p),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let c=f.dial;if(c==null){o.log.error("dial was missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,l=c.peer;if(l==null||l.id==null){o.log.error("PeerId missing from message"),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=Gn(l.id)}catch(p){o.log.error("invalid PeerId",p),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"bad peer id"}});return}if(o.log("incoming request from %p",u),!e.connection.remotePeer.equals(u)){o.log("target peer %p did not equal sending peer %p",u,e.connection.remotePeer),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let y=l.addrs.map(p=>Mi(p)).filter(p=>{let g=p.toOptions().host===e.connection.remoteAddr.toOptions().host;return o.log.trace("request to dial %a was sent from %a is same host %s",p,e.connection.remoteAddr,g),g}).filter(p=>{let g=p.toOptions().host,x=!(Pa(g)??!1);return o.log.trace("host %s was public %s",g,x),x}).filter(p=>{let g=p.toOptions().host,x=!i.includes(g);return o.log.trace("host %s was not our host %s",g,x),x}).filter(p=>{let g=!!o.components.transportManager.transportForMultiaddr(p);return o.log.trace("transport for %a is supported %s",p,g),g}).map(p=>(p.getPeerId()==null&&(p=p.encapsulate(`/p2p/${u.toString()}`)),p));if(y.length===0){o.log("no valid multiaddrs for %p in message",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}o.log("dial multiaddrs %s for peer %p",y.map(p=>p.toString()).join(", "),u);let d="",h=y[0];for await(let p of y){let g;h=p;try{if(g=await o.components.connectionManager.openConnection(p,{signal:r}),!g.remoteAddr.equals(p))throw o.log.error("tried to dial %a but dialed %a",p,g.remoteAddr),new Error("Unexpected remote address");o.log("Success %p",u),yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.OK,addr:g.remoteAddr.decapsulateCode(at("p2p").code).bytes}});return}catch(x){o.log("could not dial %p",u,x),d=x.message}finally{g!=null&&await g.close()}}yield Y.encode({type:Y.MessageType.DIAL_RESPONSE,dialResponse:{status:Y.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},s=>Vn(s),e.stream)}catch(o){this.log.error("error handling incoming autonat stream",o)}finally{r.removeEventListener("abort",n)}}_verifyExternalAddresses(){this.verifyExternalAddresses().catch(e=>{this.log.error("error verifying external address",e)})}async verifyExternalAddresses(){if(clearTimeout(this.verifyAddressTimeout),!this.isStarted())return;let e=this.components.addressManager,r=e.getObservedAddrs().filter(o=>{let s=o.toOptions();return!(Pa(s.host)??!1)});if(r.length===0){this.log("no public addresses found, not requesting verification"),this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval);return}let n=AbortSignal.timeout(this.timeout);ji(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let o=Y.encode({type:Y.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await bu()).toBytes(),f={},c=[],u=async l=>{let y=()=>{};try{this.log("asking %p to verify multiaddr",l.id);let d=await i.components.connectionManager.openConnection(l.id,{signal:n}),h=await d.newStream(this.protocol,{signal:n});y=()=>{h.abort(new $("verifyAddress timeout",Xi))},n.addEventListener("abort",y,{once:!0});let p=await La([o],x=>Vn(x),h,x=>ln(x),async x=>Ba(x));if(p==null){this.log("no response received from %p",d.remotePeer);return}let g=Y.decode(p);if(g.type!==Y.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===Y.ResponseStatus.OK){let x=d.remoteAddr.toOptions(),m;if(x.family===4)m=x.host.split(".")[0];else if(x.family===6)m=x.host.split(":")[0];else{this.log('remote address "%s" was not IP4 or IP6?',x.host);return}if(c.includes(m)){this.log("already have response from network segment %d - %s",m,x.host);return}c.push(m)}return g.dialResponse}catch(d){this.log.error("error asking remote to verify multiaddr",d)}finally{n.removeEventListener("abort",y)}};for await(let l of Ca(Zu(this.components.peerRouting.getClosestPeers(a,{signal:n}),y=>async()=>u(y)),{concurrency:Na}))try{if(l==null)continue;let y=l.addr==null?r[0]:Mi(l.addr);if(this.log("autonat response for %a is %s",y,l.status),l.status===Y.ResponseStatus.E_BAD_REQUEST||l.status===Y.ResponseStatus.E_DIAL_REFUSED||l.addr==null&&r.length>1)continue;if(!r.some(h=>h.equals(y))){this.log("peer reported %a as %s but it was not in our observed address list",y,l.status);continue}let d=y.toString();if(f[d]==null&&(f[d]={success:0,failure:0}),l.status===Y.ResponseStatus.OK?f[d].success++:l.status===Y.ResponseStatus.E_DIAL_ERROR&&f[d].failure++,f[d].success===Na){this.log("%a is externally dialable",y),e.confirmObservedAddr(y);return}if(f[d].failure===Na){this.log("%a is not externally dialable",y),e.removeObservedAddr(y);return}}catch(y){this.log.error("could not verify external address",y)}}finally{this.verifyAddressTimeout=setTimeout(this._verifyExternalAddresses,this.refreshInterval)}}};function sx(t={}){return e=>new Zi(e,t)}return Al(ax);})();
27
27
  /*! Bundled license information:
28
28
 
29
29
  @noble/hashes/esm/utils.js: