@libp2p/autonat 0.0.0-e2267d437 → 1.0.0

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.
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 Ff=Object.create;var En=Object.defineProperty;var Mf=Object.getOwnPropertyDescriptor;var Vf=Object.getOwnPropertyNames;var qf=Object.getPrototypeOf,zf=Object.prototype.hasOwnProperty;var ct=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rt=(t,e)=>{for(var r in e)En(t,r,{get:e[r],enumerable:!0})},Ho=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Vf(e))!zf.call(t,i)&&i!==r&&En(t,i,{get:()=>e[i],enumerable:!(n=Mf(e,i))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?Ff(qf(t)):{},Ho(e||!t||!t.__esModule?En(r,"default",{value:t,enumerable:!0}):r,t)),Hf=t=>Ho(En({},"__esModule",{value:!0}),t);var ft=ct((x2,da)=>{da.exports={options:{usePureJavaScript:!1}}});var ga=ct((m2,ya)=>{var Xi={};ya.exports=Xi;var pa={};Xi.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=Ju(t,e);else{var i=0,s=e.length,o=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%s,c=c/s|0;for(;c>0;)a.push(c%s),c=c/s|0}for(i=0;t[i]===0&&i<t.length-1;++i)n+=o;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};Xi.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=pa[e];if(!r){r=pa[e]=[];for(var n=0;n<e.length;++n)r[e.charCodeAt(n)]=n}t=t.replace(/\s/g,"");for(var i=e.length,s=e.charAt(0),o=[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<o.length;++f)c+=o[f]*i,o[f]=c&255,c>>=8;for(;c>0;)o.push(c&255),c>>=8}for(var u=0;t[u]===s&&u<t.length-1;++u)o.push(0);return typeof Buffer<"u"?Buffer.from(o.reverse()):new Uint8Array(o.reverse())};function Ju(t,e){var r=0,n=e.length,i=e.charAt(0),s=[0];for(r=0;r<t.length();++r){for(var o=0,a=t.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%n,a=a/n|0;for(;a>0;)s.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=s.length-1;r>=0;--r)f+=e[s[r]];return f}});var Et=ct((v2,ba)=>{var xa=ft(),ma=ga(),v=ba.exports=xa.util=xa.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 o=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 s=v.setImmediate;v.setImmediate=function(f){Date.now()-r>15?(r=Date.now(),s(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 tn(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=Ji;function Ji(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 Ji||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=Ji;var ju=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>ju&&(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){tn(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){tn(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 tl(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=tl;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 s;if(e==="hex")return this.accommodate(Math.ceil(t.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.hex.decode(t,s,this.write),this;if(e==="base64")return this.accommodate(Math.ceil(t.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.base64.decode(t,s,this.write),this;if(e==="utf8"&&(t=v.encodeUtf8(t),e="binary"),e==="binary"||e==="raw")return this.accommodate(t.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.raw.decode(s),this;if(e==="utf16")return this.accommodate(t.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=v.text.utf16.encode(s),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){tn(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 tn(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){tn(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="",s="",o=0,a=0;r>0;--r,++o)i=t.charCodeAt(o)^e.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s,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 qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ze=[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],va="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";v.encode64=function(t,e){for(var r="",n="",i,s,o,a=0;a<t.length;)i=t.charCodeAt(a++),s=t.charCodeAt(a++),o=t.charCodeAt(a++),r+=qe.charAt(i>>2),r+=qe.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=qe.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":qe.charAt(o&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,s,o=0;o<t.length;)r=ze[t.charCodeAt(o++)-43],n=ze[t.charCodeAt(o++)-43],i=ze[t.charCodeAt(o++)-43],s=ze[t.charCodeAt(o++)-43],e+=String.fromCharCode(r<<2|n>>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),s!==64&&(e+=String.fromCharCode((i&3)<<6|s)));return e};v.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};v.decodeUtf8=function(t){return decodeURIComponent(escape(t))};v.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:ma.encode,decode:ma.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,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);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,s=r;for(t.length&1&&(i=1,n[s++]=parseInt(t[0],16));i<t.length;i+=2)n[s++]=parseInt(t.substr(i,2),16);return e?s-r:n};v.binary.base64.encode=function(t,e){for(var r="",n="",i,s,o,a=0;a<t.byteLength;)i=t[a++],s=t[a++],o=t[a++],r+=qe.charAt(i>>2),r+=qe.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=qe.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":qe.charAt(o&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,s,o,a,f=0,c=r;f<t.length;)i=ze[t.charCodeAt(f++)-43],s=ze[t.charCodeAt(f++)-43],o=ze[t.charCodeAt(f++)-43],a=ze[t.charCodeAt(f++)-43],n[c++]=i<<2|s>>4,o!==64&&(n[c++]=(s&15)<<4|o>>2,a!==64&&(n[c++]=(o&3)<<6|a));return e?c-r:n.subarray(0,c)};v.binary.base58.encode=function(t,e){return v.binary.baseN.encode(t,va,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,va,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,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);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 s=r,o=r,a=0;a<t.length;++a)i[o++]=t.charCodeAt(a),s+=2;return e?s-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 ji=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}},ts=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},el=function(t,e,r,n){var i=ts(t,e);i===null&&(i={}),i[r]=n,ji(t,e,i)},rl=function(t,e,r){var n=ts(t,e);return n!==null&&(n=r in n?n[r]:null),n},nl=function(t,e,r){var n=ts(t,e);if(n!==null&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),ji(t,e,n)}},il=function(t,e){ji(t,e,null)},In=function(t,e,r){var n=null;typeof r>"u"&&(r=["web","flash"]);var i,s=!1,o=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),s=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),s=!0)}catch(f){o=f}if(s)break}if(!s)throw o;return n};v.setItem=function(t,e,r,n,i){In(el,arguments,i)};v.getItem=function(t,e,r,n){return In(rl,arguments,n)};v.removeItem=function(t,e,r,n){In(nl,arguments,n)};v.clearItems=function(t,e,r){In(il,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,s=[],o=0;r=e.exec(t);){n=t.substring(o,e.lastIndex-2),n.length>0&&s.push(n),o=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i<arguments.length?s.push(arguments[i+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(t.substring(o)),s.join("")};v.formatNumber=function(t,e,r,n){var i=t,s=isNaN(e=Math.abs(e))?2:e,o=r===void 0?",":r,a=n===void 0?".":n,f=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(s),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)+(s?o+Math.abs(i-c).toFixed(s).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(o){return o.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 s=v.hexToBytes(t[i]);s.length<2&&n.putByte(0),n.putBytes(s)}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 s=v.bytesToHex(t[i]+t[i+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var o=r[r.length-1],a=e.length;!o||a!==o.end+1?r.push({start:a,end:a}):(o.end=a,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1))}e.push(s)}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(o){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(o,a,f){if(a===0){var c=Math.floor(o.reduce(function(u,l){return u+l},0)/o.length);return v.cores=Math.max(1,c),URL.revokeObjectURL(r),e(null,v.cores)}i(f,function(u,l){o.push(s(f,l)),n(o,a-1,f)})}function i(o,a){for(var f=[],c=[],u=0;u<o;++u){var l=new Worker(r);l.addEventListener("message",function(p){if(c.push(p.data),c.length===o){for(var d=0;d<o;++d)f[d].terminate();a(null,c)}}),f.push(l)}for(var u=0;u<o;++u)f[u].postMessage(u)}function s(o,a){for(var f=[],c=0;c<o;++c)for(var u=a[c],l=f[c]=[],p=0;p<o;++p)if(c!==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 f.reduce(function(h,y){return Math.max(h,y.length)},0)}}});var Tn=ct((b2,wa)=>{var en=ft();en.pki=en.pki||{};var es=wa.exports=en.pki.oids=en.oids=en.oids||{};function C(t,e){es[t]=e,es[e]=t}function nt(t,e){es[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 nn=ct((w2,Sa)=>{var dt=ft();Et();Tn();var N=Sa.exports=dt.asn1=dt.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(dt.util.isArray(n)){for(var s=[],o=0;o<n.length;++o)n[o]!==void 0&&s.push(n[o]);n=s}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=N.copy(a)),a};N.copy=function(t,e){var r;if(dt.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(dt.util.isArray(t)){if(!dt.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 rn(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 sl=function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var s=r&127;rn(t,e,s),n=t.getInt(s<<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=dt.util.createBuffer(t));var r=t.length(),n=Cn(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 Cn(t,e,r,n){var i;rn(t,e,2);var s=t.getByte();e--;var o=s&192,a=s&31;i=t.length();var f=sl(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,p=(s&32)===32;if(p)if(u=[],f===void 0)for(;;){if(rn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Cn(t,e,r+1,n)),e-=i-t.length()}else for(;f>0;)i=t.length(),u.push(Cn(t,f,r+1,n)),e-=i-t.length(),f-=i-t.length();if(u===void 0&&o===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&(l=t.bytes(f)),u===void 0&&n.decodeBitStrings&&o===N.Class.UNIVERSAL&&a===N.Type.BITSTRING&&f>1){var d=t.read,h=e,y=0;if(a===N.Type.BITSTRING&&(rn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Cn(t,e,r+1,g),m=i-t.length();e-=m,a==N.Type.BITSTRING&&m++;var b=x.tagClass;m===f&&(b===N.Class.UNIVERSAL||b===N.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===N.Type.BMPSTRING)for(u="";f>0;f-=2)rn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(f),e-=f}var R=l===void 0?null:{bitStringContents:l};return N.create(o,a,p,u,R)}N.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=N.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var s=0;s<t.value.length;++s)t.value[s]!==void 0&&n.putBuffer(N.toDer(t.value[s]))}else if(t.type===N.Type.BMPSTRING)for(var s=0;s<t.value.length;++s)n.putInt16(t.value.charCodeAt(s));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 o=n.length(),a="";do a+=String.fromCharCode(o&255),o=o>>>8;while(o>0);e.putByte(a.length|128);for(var s=a.length-1;s>=0;--s)e.putByte(a.charCodeAt(s))}return e.putBuffer(n),e};N.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,s,o,a=2;a<e.length;++a){n=!0,i=[],s=parseInt(e[a],10);do o=s&127,s=s>>>7,n||(o|=128),i.push(o),n=!1;while(s>0);for(var f=i.length-1;f>=0;--f)r.putByte(i[f])}return r};N.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};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),s=parseInt(t.substr(6,2),10),o=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(s,o,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),p=u*60+l;p*=6e4,f==="+"?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),s=parseInt(t.substr(8,2),10),o=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,p=t.charAt(l);if(p==="+"||p==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);c=d*60+h,c*=6e4,p==="+"&&(c*=-1),u=!0}return t.charAt(14)==="."&&(f=parseFloat(t.substr(14),10)*1e3),u?(e.setUTCFullYear(r,n,i),e.setUTCHours(s,o,a,f),e.setTime(+e+c)):(e.setFullYear(r,n,i),e.setHours(s,o,a,f)),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=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};N.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)};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&&dt.util.isArray(e.value))for(var s=0,o=0;i&&o<e.value.length;++o)i=e.value[o].optional||!1,t.value[s]&&(i=N.validate(t.value[s],e.value[o],r,n),i?++s:e.value[o].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 Ea=/[^\\u0000-\\u00ff]/;N.prettyPrint=function(t,e,r){var n="";e=e||0,r=r||2,e>0&&(n+=`
6
- `);for(var i="",s=0;s<e*r;++s)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 zf=Object.create;var Sn=Object.defineProperty;var Hf=Object.getOwnPropertyDescriptor;var $f=Object.getOwnPropertyNames;var Gf=Object.getPrototypeOf,Wf=Object.prototype.hasOwnProperty;var ct=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Rt=(t,e)=>{for(var r in e)Sn(t,r,{get:e[r],enumerable:!0})},Gs=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $f(e))!Wf.call(t,i)&&i!==r&&Sn(t,i,{get:()=>e[i],enumerable:!(n=Hf(e,i))||n.enumerable});return t};var Mt=(t,e,r)=>(r=t!=null?zf(Gf(t)):{},Gs(e||!t||!t.__esModule?Sn(r,"default",{value:t,enumerable:!0}):r,t)),Yf=t=>Gs(Sn({},"__esModule",{value:!0}),t);var ft=ct((rg,xa)=>{xa.exports={options:{usePureJavaScript:!1}}});var ba=ct((ng,va)=>{var ji={};va.exports=ji;var ma={};ji.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=rl(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};ji.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=ma[e];if(!r){r=ma[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 rl(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 Et=ct((ig,Ba)=>{var wa=ft(),Ea=ba(),v=Ba.exports=wa.util=wa.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 en(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}v.ByteBuffer=to;function to(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 to||typeof t=="object"&&typeof t.data=="string"&&typeof t.read=="number")&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}v.ByteStringBuffer=to;var nl=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>nl&&(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){en(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){en(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 il(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=il;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){en(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 en(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){en(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+/=",He=[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],Sa="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=He[t.charCodeAt(s++)-43],n=He[t.charCodeAt(s++)-43],i=He[t.charCodeAt(s++)-43],o=He[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:Ea.encode,decode:Ea.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=He[t.charCodeAt(f++)-43],o=He[t.charCodeAt(f++)-43],s=He[t.charCodeAt(f++)-43],a=He[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,Sa,e)};v.binary.base58.decode=function(t,e){return v.binary.baseN.decode(t,Sa,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 eo=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}},ro=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},ol=function(t,e,r,n){var i=ro(t,e);i===null&&(i={}),i[r]=n,eo(t,e,i)},sl=function(t,e,r){var n=ro(t,e);return n!==null&&(n=r in n?n[r]:null),n},al=function(t,e,r){var n=ro(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),eo(t,e,n)}},cl=function(t,e){eo(t,e,null)},Tn=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){Tn(ol,arguments,i)};v.getItem=function(t,e,r,n){return Tn(sl,arguments,n)};v.removeItem=function(t,e,r,n){Tn(al,arguments,n)};v.clearItems=function(t,e,r){Tn(cl,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(p){if(c.push(p.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]=[],p=0;p<s;++p)if(c!==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 f.reduce(function(h,y){return Math.max(h,y.length)},0)}}});var Cn=ct((og,Aa)=>{var rn=ft();rn.pki=rn.pki||{};var no=Aa.exports=rn.pki.oids=rn.oids=rn.oids||{};function C(t,e){no[t]=e,no[e]=t}function nt(t,e){no[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 on=ct((sg,Ta)=>{var dt=ft();Et();Cn();var k=Ta.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 nn(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 fl=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;nn(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=Rn(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 Rn(t,e,r,n){var i;nn(t,e,2);var o=t.getByte();e--;var s=o&192,a=o&31;i=t.length();var f=fl(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,p=(o&32)===32;if(p)if(u=[],f===void 0)for(;;){if(nn(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),u.push(Rn(t,e,r+1,n)),e-=i-t.length()}else for(;f>0;)i=t.length(),u.push(Rn(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,y=0;if(a===k.Type.BITSTRING&&(nn(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var g={strict:!0,decodeBitStrings:!0},x=Rn(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)nn(t,e,2),u+=String.fromCharCode(t.getInt16()),e-=2;else u=t.getBytes(f),e-=f}var R=l===void 0?null:{bitStringContents:l};return k.create(s,a,p,u,R)}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),p=u*60+l;p*=6e4,f==="+"?e.setTime(+e-p):e.setTime(+e+p)}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,p=t.charAt(l);if(p==="+"||p==="-"){var d=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10);c=d*60+h,c*=6e4,p==="+"&&(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 Ia=/[^\\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 o=0,a="",s=0;s<t.value.length;++s)t.value[s]!==void 0&&(o+=1,a+=N.prettyPrint(t.value[s],e+1,r),s+1<t.value.length&&(a+=","));n+=i+"Sub values: "+o+a}else{if(n+=i+"Value: ",t.type===N.Type.OID){var f=N.derToOid(t.value);n+=f,dt.pki&&dt.pki.oids&&f in dt.pki.oids&&(n+=" ("+dt.pki.oids[f]+") ")}if(t.type===N.Type.INTEGER)try{n+=N.derToInteger(t.value)}catch{n+="0x"+dt.util.bytesToHex(t.value)}else if(t.type===N.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===N.Type.OCTETSTRING)Ea.test(t.value)||(n+="("+t.value+") "),n+="0x"+dt.util.bytesToHex(t.value);else if(t.type===N.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===N.Type.PRINTABLESTRING||t.type===N.Type.IA5String?n+=t.value:Ea.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var ns=ct((E2,Ba)=>{var _t=ft();Et();Ba.exports=_t.cipher=_t.cipher||{};_t.cipher.algorithms=_t.cipher.algorithms||{};_t.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};_t.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};_t.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),_t.cipher.algorithms[t]=e};_t.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in _t.cipher.algorithms?_t.cipher.algorithms[t]:null};var rs=_t.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)};rs.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=_t.util.createBuffer(),this.output=t.output||_t.util.createBuffer(),this.mode.start(e)};rs.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()};rs.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 ss=ct((S2,Aa)=>{var Lt=ft();Et();Lt.cipher=Lt.cipher||{};var Q=Aa.exports=Lt.cipher.modes=Lt.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=Rn(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=Lt.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Rn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32()^this._outBlock[i],e.putInt32(this._inBlock[i]);return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32(),e.putInt32(this._inBlock[i]^this._outBlock[i]);return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Rn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};Q.ofb.prototype.decrypt=Q.ofb.prototype.encrypt;Q.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Lt.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Rn(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};Q.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}_n(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=Lt.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=Lt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Lt.util.createBuffer(t.additionalData):r=Lt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Lt.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(is(n*8)))}this._inBlock=this._j0.slice(0),_n(this._inBlock),this._partialBytes=0,r=Lt.util.createBuffer(r),this._aDataLength=is(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};Q.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^=t.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),_n(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),_n(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=Lt.util.createBuffer();var n=this._aDataLength.concat(is(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,n);var i=[];this.cipher.encrypt(this._j0,i);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^i[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};Q.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],n=e.slice(0),i=0;i<128;++i){var s=t[i/32|0]&1<<31-i%32;s&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r};Q.gcm.prototype.pow=function(t,e){for(var r=t[3]&1,n=3;n>0;--n)e[n]=t[n]>>>1|(t[n-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};Q.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=t[n]>>>(7-r%8)*4&15,s=this._m[r][i];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};Q.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};Q.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,s=new Array(i),o=0;o<i;++o){var a=[0,0,0,0],f=o/n|0,c=(n-1-o%n)*e;a[f]=1<<e-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,t),e)}return s};Q.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,n=r>>>1,i=new Array(r);i[n]=t.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var o=1;o<s;++o){var a=i[s],f=i[o];i[s+o]=[a[0]^f[0],a[1]^f[1],a[2]^f[2],a[3]^f[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var c=i[s^n];i[s]=[t[0]^c[0],t[1]^c[1],t[2]^c[2],t[3]^c[3]]}return i};function Rn(t,e){if(typeof t=="string"&&(t=Lt.util.createBuffer(t)),Lt.util.isArray(t)&&t.length>4){var r=t;t=Lt.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(!Lt.util.isArray(t)){for(var i=[],s=e/4,n=0;n<s;++n)i.push(t.getInt32());t=i}return t}function _n(t){t[t.length-1]=t[t.length-1]+1&4294967295}function is(t){return[t/4294967296|0,t&4294967295]}});var fs=ct((B2,Ra)=>{var ht=ft();ns();ss();Et();Ra.exports=ht.aes=ht.aes||{};ht.aes.startEncrypting=function(t,e,r,n){var i=Ln({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};ht.aes.createEncryptionCipher=function(t,e){return Ln({key:t,output:null,decrypt:!1,mode:e})};ht.aes.startDecrypting=function(t,e,r,n){var i=Ln({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};ht.aes.createDecryptionCipher=function(t,e){return Ln({key:t,output:null,decrypt:!0,mode:e})};ht.aes.Algorithm=function(t,e){cs||Ta();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return as(r._w,n,i,!1)},decrypt:function(n,i){return as(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 s=this.mode.name,o=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=Ca(e,t.decrypt&&!o),this._init=!0}};ht.aes._expandKey=function(t,e){return cs||Ta(),Ca(t,e)};ht.aes._updateBlock=as;Cr("AES-ECB",ht.cipher.modes.ecb);Cr("AES-CBC",ht.cipher.modes.cbc);Cr("AES-CFB",ht.cipher.modes.cfb);Cr("AES-OFB",ht.cipher.modes.ofb);Cr("AES-CTR",ht.cipher.modes.ctr);Cr("AES-GCM",ht.cipher.modes.gcm);function Cr(t,e){var r=function(){return new ht.aes.Algorithm(t,e)};ht.cipher.registerAlgorithm(t,r)}var cs=!1,Tr=4,Ht,os,Ia,sr,re;function Ta(){cs=!0,Ia=[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;Ht=new Array(256),os=new Array(256),sr=new Array(4),re=new Array(4);for(var e=0;e<4;++e)sr[e]=new Array(256),re[e]=new Array(256);for(var r=0,n=0,i,s,o,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,Ht[r]=a,os[a]=r,f=t[a],i=t[r],s=t[i],o=t[s],c=f<<24^a<<16^a<<8^(a^f),u=(i^s^o)<<24^(r^o)<<16^(r^s^o)<<8^(r^i^o);for(var l=0;l<4;++l)sr[l][r]=c,re[l][a]=u,c=c<<24|c>>>8,u=u<<24|u>>>8;r===0?r=n=1:(r=i^t[t[t[i^o]]],n^=t[t[n]])}}function Ca(t,e){for(var r=t.slice(0),n,i=1,s=r.length,o=s+6+1,a=Tr*o,f=s;f<a;++f)n=r[f-1],f%s===0?(n=Ht[n>>>16&255]<<24^Ht[n>>>8&255]<<16^Ht[n&255]<<8^Ht[n>>>24]^Ia[i]<<24,i++):s>6&&f%s===4&&(n=Ht[n>>>24]<<24^Ht[n>>>16&255]<<16^Ht[n>>>8&255]<<8^Ht[n&255]),r[f]=r[f-s]^n;if(e){var c,u=re[0],l=re[1],p=re[2],d=re[3],h=r.slice(0);a=r.length;for(var f=0,y=a-Tr;f<a;f+=Tr,y-=Tr)if(f===0||f===a-Tr)h[f]=r[y],h[f+1]=r[y+3],h[f+2]=r[y+2],h[f+3]=r[y+1];else for(var g=0;g<Tr;++g)c=r[y+g],h[f+(3&-g)]=u[Ht[c>>>24]]^l[Ht[c>>>16&255]]^p[Ht[c>>>8&255]]^d[Ht[c&255]];r=h}return r}function as(t,e,r,n){var i=t.length/4-1,s,o,a,f,c;n?(s=re[0],o=re[1],a=re[2],f=re[3],c=os):(s=sr[0],o=sr[1],a=sr[2],f=sr[3],c=Ht);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=s[u>>>24]^o[l>>>16&255]^a[p>>>8&255]^f[d&255]^t[++x],y=s[l>>>24]^o[p>>>16&255]^a[d>>>8&255]^f[u&255]^t[++x],g=s[p>>>24]^o[d>>>16&255]^a[u>>>8&255]^f[l&255]^t[++x],d=s[d>>>24]^o[u>>>16&255]^a[l>>>8&255]^f[p&255]^t[++x],u=h,l=y,p=g;r[0]=c[u>>>24]<<24^c[l>>>16&255]<<16^c[p>>>8&255]<<8^c[d&255]^t[++x],r[n?3:1]=c[l>>>24]<<24^c[p>>>16&255]<<16^c[d>>>8&255]<<8^c[u&255]^t[++x],r[2]=c[p>>>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[p&255]^t[++x]}function Ln(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(s,o){var a=null;o instanceof ht.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,i.call(n,o)},n}});var Da=ct((A2,La)=>{var yt=ft();ns();ss();Et();La.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=Dn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return Dn({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=Dn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return Dn({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 _a(r._keys,n,i,!1)},decrypt:function(n,i){return _a(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=pl(e),this._init=!0}};de("DES-ECB",yt.cipher.modes.ecb);de("DES-CBC",yt.cipher.modes.cbc);de("DES-CFB",yt.cipher.modes.cfb);de("DES-OFB",yt.cipher.modes.ofb);de("DES-CTR",yt.cipher.modes.ctr);de("3DES-ECB",yt.cipher.modes.ecb);de("3DES-CBC",yt.cipher.modes.cbc);de("3DES-CFB",yt.cipher.modes.cfb);de("3DES-OFB",yt.cipher.modes.ofb);de("3DES-CTR",yt.cipher.modes.ctr);function de(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.cipher.registerAlgorithm(t,r)}var ol=[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],al=[-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],cl=[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],ul=[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],ll=[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],hl=[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],dl=[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 pl(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[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],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,b,R=0;R<y;R++){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 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]|s[E>>>12&15]|o[E>>>8&15]|a[E>>>4&15],z=f[S>>>28]|c[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];b=(z>>>16^D)&65535,g[m++]=D^b,g[m++]=z^b<<16}}return g}function _a(t,e,r,n){var i=t.length===32?3:9,s;i===3?s=n?[30,-2,-2]:[0,32,2]:s=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,a=e[0],f=e[1];o=(a>>>4^f)&252645135,f^=o,a^=o<<4,o=(a>>>16^f)&65535,f^=o,a^=o<<16,o=(f>>>2^a)&858993459,a^=o,f^=o<<2,o=(f>>>8^a)&16711935,a^=o,f^=o<<8,o=(a>>>1^f)&1431655765,f^=o,a^=o<<1,a=a<<1|a>>>31,f=f<<1|f>>>31;for(var c=0;c<i;c+=3){for(var u=s[c+1],l=s[c+2],p=s[c];p!=u;p+=l){var d=f^t[p],h=(f>>>4|f<<28)^t[p+1];o=a,a=f,f=o^(al[d>>>24&63]|fl[d>>>16&63]|ll[d>>>8&63]|dl[d&63]|ol[h>>>24&63]|cl[h>>>16&63]|ul[h>>>8&63]|hl[h&63])}o=a,a=f,f=o}a=a>>>1|a<<31,f=f>>>1|f<<31,o=(a>>>1^f)&1431655765,f^=o,a^=o<<1,o=(f>>>8^a)&16711935,a^=o,f^=o<<8,o=(f>>>2^a)&858993459,a^=o,f^=o<<2,o=(a>>>16^f)&65535,f^=o,a^=o<<16,o=(a>>>4^f)&252645135,f^=o,a^=o<<4,r[0]=a,r[1]=f}function Dn(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(s,o){var a=null;o instanceof yt.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,i.call(n,o)},n}});var or=ct((I2,Pa)=>{var Pn=ft();Pa.exports=Pn.md=Pn.md||{};Pn.md.algorithms=Pn.md.algorithms||{}});var Na=ct((T2,ka)=>{var Se=ft();or();Et();var yl=ka.exports=Se.hmac=Se.hmac||{};yl.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(s,o){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in Se.md.algorithms)e=Se.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(o===null)o=t;else{if(typeof o=="string")o=Se.util.createBuffer(o);else if(Se.util.isArray(o)){var a=o;o=Se.util.createBuffer();for(var f=0;f<a.length;++f)o.putByte(a[f])}var c=o.length();c>e.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=Se.util.createBuffer(),n=Se.util.createBuffer(),c=o.length();for(var f=0;f<c;++f){var a=o.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=o,r=r.bytes(),n=n.bytes()}e.start(),e.update(r)},i.update=function(s){e.update(s)},i.getMac=function(){var s=e.digest().bytes();return e.start(),e.update(n),e.update(s),e.digest()},i.digest=i.getMac,i}});var kn=ct(()=>{});var Oa=ct((_2,Ua)=>{var $t=ft();Na();or();Et();var gl=$t.pkcs5=$t.pkcs5||{},Be;$t.util.isNodejs&&!$t.options.usePureJavaScript&&(Be=kn());Ua.exports=$t.pbkdf2=gl.pbkdf2=function(t,e,r,n,i,s){if(typeof i=="function"&&(s=i,i=null),$t.util.isNodejs&&!$t.options.usePureJavaScript&&Be.pbkdf2&&(i===null||typeof i!="object")&&(Be.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),s?Be.pbkdf2Sync.length===4?Be.pbkdf2(t,e,r,n,function(b,R){if(b)return s(b);s(null,R.toString("binary"))}):Be.pbkdf2(t,e,r,n,i,function(b,R){if(b)return s(b);s(null,R.toString("binary"))}):Be.pbkdf2Sync.length===4?Be.pbkdf2Sync(t,e,r,n).toString("binary"):Be.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in $t.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=$t.md[i].create()}var o=i.digestLength;if(n>4294967295*o){var a=new Error("Derived key is too long.");if(s)return s(a);throw a}var f=Math.ceil(n/o),c=n-(f-1)*o,u=$t.hmac.create();u.start(i,t);var l="",p,d,h;if(!s){for(var y=1;y<=f;++y){u.start(null,null),u.update(e),u.update($t.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=$t.util.xorBytes(p,d,o),h=d;l+=y<f?p:p.substr(0,c)}return l}var y=1,g;function x(){if(y>f)return s(null,l);u.start(null,null),u.update(e),u.update($t.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=$t.util.xorBytes(p,d,o),h=d,++g,$t.util.setImmediate(m);l+=y<f?p:p.substr(0,c),++y,x()}x()}});var Ma=ct((L2,Fa)=>{var Un=ft();Et();var Ka=Fa.exports=Un.pem=Un.pem||{};Ka.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+=Nn(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Nn(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Nn(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Nn(t.headers[i]);return t.procType&&(r+=`\r
10
- `),r+=Un.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)Ia.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:Ia.test(t.value)?n+="0x"+dt.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var oo=ct((ag,Ca)=>{var _t=ft();Et();Ca.exports=_t.cipher=_t.cipher||{};_t.cipher.algorithms=_t.cipher.algorithms||{};_t.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};_t.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=_t.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new _t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};_t.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),_t.cipher.algorithms[t]=e};_t.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in _t.cipher.algorithms?_t.cipher.algorithms[t]:null};var io=_t.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)};io.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=_t.util.createBuffer(),this.output=t.output||_t.util.createBuffer(),this.mode.start(e)};io.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()};io.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 ao=ct((cg,Ra)=>{var Lt=ft();Et();Lt.cipher=Lt.cipher||{};var Q=Ra.exports=Lt.cipher.modes=Lt.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=_n(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=Lt.util.createBuffer(),this._partialBytes=0};Q.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=_n(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=Lt.util.createBuffer(),this._partialBytes=0};Q.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=_n(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=Lt.util.createBuffer(),this._partialBytes=0};Q.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=_n(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}Ln(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=Lt.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=Lt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=Lt.util.createBuffer(t.additionalData):r=Lt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=Lt.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(so(n*8)))}this._inBlock=this._j0.slice(0),Ln(this._inBlock),this._partialBytes=0,r=Lt.util.createBuffer(r),this._aDataLength=so(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),Ln(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),Ln(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=Lt.util.createBuffer();var n=this._aDataLength.concat(so(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 _n(t,e){if(typeof t=="string"&&(t=Lt.util.createBuffer(t)),Lt.util.isArray(t)&&t.length>4){var r=t;t=Lt.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(!Lt.util.isArray(t)){for(var i=[],o=e/4,n=0;n<o;++n)i.push(t.getInt32());t=i}return t}function Ln(t){t[t.length-1]=t[t.length-1]+1&4294967295}function so(t){return[t/4294967296|0,t&4294967295]}});var lo=ct((fg,Pa)=>{var ht=ft();oo();ao();Et();Pa.exports=ht.aes=ht.aes||{};ht.aes.startEncrypting=function(t,e,r,n){var i=Dn({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};ht.aes.createEncryptionCipher=function(t,e){return Dn({key:t,output:null,decrypt:!1,mode:e})};ht.aes.startDecrypting=function(t,e,r,n){var i=Dn({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};ht.aes.createDecryptionCipher=function(t,e){return Dn({key:t,output:null,decrypt:!0,mode:e})};ht.aes.Algorithm=function(t,e){uo||La();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return fo(r._w,n,i,!1)},decrypt:function(n,i){return fo(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=Da(e,t.decrypt&&!s),this._init=!0}};ht.aes._expandKey=function(t,e){return uo||La(),Da(t,e)};ht.aes._updateBlock=fo;Rr("AES-ECB",ht.cipher.modes.ecb);Rr("AES-CBC",ht.cipher.modes.cbc);Rr("AES-CFB",ht.cipher.modes.cfb);Rr("AES-OFB",ht.cipher.modes.ofb);Rr("AES-CTR",ht.cipher.modes.ctr);Rr("AES-GCM",ht.cipher.modes.gcm);function Rr(t,e){var r=function(){return new ht.aes.Algorithm(t,e)};ht.cipher.registerAlgorithm(t,r)}var uo=!1,Cr=4,Ht,co,_a,sr,ne;function La(){uo=!0,_a=[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;Ht=new Array(256),co=new Array(256),sr=new Array(4),ne=new Array(4);for(var e=0;e<4;++e)sr[e]=new Array(256),ne[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,Ht[r]=a,co[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)sr[l][r]=c,ne[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 Da(t,e){for(var r=t.slice(0),n,i=1,o=r.length,s=o+6+1,a=Cr*s,f=o;f<a;++f)n=r[f-1],f%o===0?(n=Ht[n>>>16&255]<<24^Ht[n>>>8&255]<<16^Ht[n&255]<<8^Ht[n>>>24]^_a[i]<<24,i++):o>6&&f%o===4&&(n=Ht[n>>>24]<<24^Ht[n>>>16&255]<<16^Ht[n>>>8&255]<<8^Ht[n&255]),r[f]=r[f-o]^n;if(e){var c,u=ne[0],l=ne[1],p=ne[2],d=ne[3],h=r.slice(0);a=r.length;for(var f=0,y=a-Cr;f<a;f+=Cr,y-=Cr)if(f===0||f===a-Cr)h[f]=r[y],h[f+1]=r[y+3],h[f+2]=r[y+2],h[f+3]=r[y+1];else for(var g=0;g<Cr;++g)c=r[y+g],h[f+(3&-g)]=u[Ht[c>>>24]]^l[Ht[c>>>16&255]]^p[Ht[c>>>8&255]]^d[Ht[c&255]];r=h}return r}function fo(t,e,r,n){var i=t.length/4-1,o,s,a,f,c;n?(o=ne[0],s=ne[1],a=ne[2],f=ne[3],c=co):(o=sr[0],s=sr[1],a=sr[2],f=sr[3],c=Ht);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]^f[d&255]^t[++x],y=o[l>>>24]^s[p>>>16&255]^a[d>>>8&255]^f[u&255]^t[++x],g=o[p>>>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[p&255]^t[++x],u=h,l=y,p=g;r[0]=c[u>>>24]<<24^c[l>>>16&255]<<16^c[p>>>8&255]<<8^c[d&255]^t[++x],r[n?3:1]=c[l>>>24]<<24^c[p>>>16&255]<<16^c[d>>>8&255]<<8^c[u&255]^t[++x],r[2]=c[p>>>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[p&255]^t[++x]}function Dn(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 Ua=ct((ug,ka)=>{var yt=ft();oo();ao();Et();ka.exports=yt.des=yt.des||{};yt.des.startEncrypting=function(t,e,r,n){var i=Pn({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createEncryptionCipher=function(t,e){return Pn({key:t,output:null,decrypt:!1,mode:e})};yt.des.startDecrypting=function(t,e,r,n){var i=Pn({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};yt.des.createDecryptionCipher=function(t,e){return Pn({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 Na(r._keys,n,i,!1)},decrypt:function(n,i){return Na(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=ml(e),this._init=!0}};ye("DES-ECB",yt.cipher.modes.ecb);ye("DES-CBC",yt.cipher.modes.cbc);ye("DES-CFB",yt.cipher.modes.cfb);ye("DES-OFB",yt.cipher.modes.ofb);ye("DES-CTR",yt.cipher.modes.ctr);ye("3DES-ECB",yt.cipher.modes.ecb);ye("3DES-CBC",yt.cipher.modes.cbc);ye("3DES-CFB",yt.cipher.modes.cfb);ye("3DES-OFB",yt.cipher.modes.ofb);ye("3DES-CTR",yt.cipher.modes.ctr);function ye(t,e){var r=function(){return new yt.des.Algorithm(t,e)};yt.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],ll=[-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],hl=[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],dl=[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],pl=[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],yl=[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],gl=[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],xl=[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 ml(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],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,b,R=0;R<y;R++){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 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],z=f[S>>>28]|c[S>>>24&15]|u[S>>>20&15]|l[S>>>16&15]|p[S>>>12&15]|d[S>>>8&15]|h[S>>>4&15];b=(z>>>16^D)&65535,g[m++]=D^b,g[m++]=z^b<<16}}return g}function Na(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],p=o[c];p!=u;p+=l){var d=f^t[p],h=(f>>>4|f<<28)^t[p+1];s=a,a=f,f=s^(ll[d>>>24&63]|dl[d>>>16&63]|yl[d>>>8&63]|xl[d&63]|ul[h>>>24&63]|hl[h>>>16&63]|pl[h>>>8&63]|gl[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 Pn(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 ar=ct((lg,Oa)=>{var Nn=ft();Oa.exports=Nn.md=Nn.md||{};Nn.md.algorithms=Nn.md.algorithms||{}});var Fa=ct((hg,Ka)=>{var Ae=ft();ar();Et();var vl=Ka.exports=Ae.hmac=Ae.hmac||{};vl.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 Ae.md.algorithms)e=Ae.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=Ae.util.createBuffer(s);else if(Ae.util.isArray(s)){var a=s;s=Ae.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=Ae.util.createBuffer(),n=Ae.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 kn=ct(()=>{});var Va=ct((yg,Ma)=>{var $t=ft();Fa();ar();Et();var bl=$t.pkcs5=$t.pkcs5||{},Ie;$t.util.isNodejs&&!$t.options.usePureJavaScript&&(Ie=kn());Ma.exports=$t.pbkdf2=bl.pbkdf2=function(t,e,r,n,i,o){if(typeof i=="function"&&(o=i,i=null),$t.util.isNodejs&&!$t.options.usePureJavaScript&&Ie.pbkdf2&&(i===null||typeof i!="object")&&(Ie.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),o?Ie.pbkdf2Sync.length===4?Ie.pbkdf2(t,e,r,n,function(b,R){if(b)return o(b);o(null,R.toString("binary"))}):Ie.pbkdf2(t,e,r,n,i,function(b,R){if(b)return o(b);o(null,R.toString("binary"))}):Ie.pbkdf2Sync.length===4?Ie.pbkdf2Sync(t,e,r,n).toString("binary"):Ie.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in $t.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=$t.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=$t.hmac.create();u.start(i,t);var l="",p,d,h;if(!o){for(var y=1;y<=f;++y){u.start(null,null),u.update(e),u.update($t.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=$t.util.xorBytes(p,d,s),h=d;l+=y<f?p:p.substr(0,c)}return l}var y=1,g;function x(){if(y>f)return o(null,l);u.start(null,null),u.update(e),u.update($t.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=$t.util.xorBytes(p,d,s),h=d,++g,$t.util.setImmediate(m);l+=y<f?p:p.substr(0,c),++y,x()}x()}});var Ha=ct((gg,za)=>{var On=ft();Et();var qa=za.exports=On.pem=On.pem||{};qa.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+=Un(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=Un(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=Un(n)),t.headers)for(var i=0;i<t.headers.length;++i)r+=Un(t.headers[i]);return t.procType&&(r+=`\r
10
+ `),r+=On.util.encode64(t.body,e.maxline||64)+`\r
11
11
  `,r+="-----END "+t.type+`-----\r
12
- `,r};Ka.decode=function(t){for(var e=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,n=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,s;s=r.exec(t),!!s;){var o=s[1];o==="NEW CERTIFICATE REQUEST"&&(o="CERTIFICATE REQUEST");var a={type:o,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Un.util.decode64(s[3])};if(e.push(a),!!s[2]){for(var f=s[2].split(i),c=0;s&&c<f.length;){for(var u=f[c].replace(/\s+$/,""),l=c+1;l<f.length;++l){var p=f[l];if(!/\s/.test(p[0]))break;u+=p,c=l}if(s=u.match(n),s){for(var d={name:s[1],values:[]},h=s[2].split(","),y=0;y<h.length;++y)d.values.push(xl(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]}}}++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 Nn(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
- `;for(var s=0,o=-1,i=0;i<e.length;++i,++s)if(s>65&&o!==-1){var a=e[o];a===","?(++o,e=e.substr(0,o)+`\r
14
- `+e.substr(o)):e=e.substr(0,o)+`\r
15
- `+a+e.substr(o+1),s=i-o-1,o=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(o=i);return e}function xl(t){return t.replace(/^\s+/,"")}});var Ga=ct((D2,$a)=>{var pe=ft();or();Et();var qa=$a.exports=pe.sha256=pe.sha256||{};pe.md.sha256=pe.md.algorithms.sha256=qa;qa.create=function(){za||ml();var t=null,e=pe.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return e=pe.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=pe.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(i),Va(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=pe.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(us.substr(0,n.blockLength-o));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};Va(l,r,i);var p=pe.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 us=null,za=!1,Ha=null;function ml(){us="\x80",us+=pe.util.fillString("\0",64),Ha=[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],za=!0}function Va(t,e,r){for(var n,i,s,o,a,f,c,u,l,p,d,h,y,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,p=t.h2,d=t.h3,h=t.h4,y=t.h5,g=t.h6,x=t.h7,c=0;c<64;++c)o=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),a=g^h&(y^g),s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&l|p&(u^l),n=x+o+a+Ha[c]+e[c],i=s+f,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 Ya=ct((P2,Wa)=>{var ye=ft();Et();var On=null;ye.util.isNodejs&&!ye.options.usePureJavaScript&&!process.versions["node-webkit"]&&(On=kn());var vl=Wa.exports=ye.prng=ye.prng||{};vl.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,p=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,y=ye.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(y.length()>=c)return u(null,y.getBytes(c));if(e.generated>1048575&&(e.key=null),e.key===null)return ye.util.nextTick(function(){s(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)),ye.util.setImmediate(g)}},e.generateSync=function(c){var u=e.plugin.cipher,l=e.plugin.increment,p=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=ye.util.createBuffer();h.length()<c;){e.generated>1048575&&(e.key=null),e.key===null&&o();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(c)};function s(c){if(e.pools[0].messageLength>=32)return a(),c();var u=32-e.pools[0].messageLength<<5;e.seedFile(u,function(l,p){if(l)return c(l);e.collect(p),a(),c()})}function o(){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 p=c.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}function f(c){var u=null,l=ye.util.globalScope,p=l.crypto||l.msCrypto;p&&p.getRandomValues&&(u=function(E){return p.getRandomValues(E)});var d=ye.util.createBuffer();if(u)for(;d.length()<c;){var h=Math.max(1,Math.min(c-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()<c)for(var x,m,b,R=Math.floor(Math.random()*65536);d.length()<c;){m=16807*(R&65535),x=16807*(R>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),R=m&4294967295;for(var g=0;g<3;++g)b=R>>>(g<<3),b^=Math.floor(Math.random()*256),d.putByte(b&255)}return d.getBytes(c)}return On?(e.seedFile=function(c,u){On.randomBytes(c,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(c){return On.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="",p=0;p<u;p+=8)l+=String.fromCharCode(c>>p&255);e.collect(l)},e.registerWorker=function(c){if(c===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){c.postMessage({forge:{prng:{err:d,bytes:h}}})})};c.addEventListener("message",u)}},e}});var sn=ct((k2,ls)=>{var Dt=ft();fs();Ga();Ya();Et();(function(){if(Dt.random&&Dt.random.getBytes){ls.exports=Dt.random;return}(function(t){var e={},r=new Array(4),n=Dt.util.createBuffer();e.formatKey=function(l){var p=Dt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),Dt.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=Dt.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 Dt.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=Dt.md.sha256;function i(){var l=Dt.prng.create(e);return l.getBytes=function(p,d){return l.generate(p,d)},l.getBytesSync=function(p){return l.generate(p)},l}var s=i(),o=null,a=Dt.util.globalScope,f=a.crypto||a.msCrypto;if(f&&f.getRandomValues&&(o=function(l){return f.getRandomValues(l)}),Dt.options.usePureJavaScript||!Dt.util.isNodejs&&!o){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var u in navigator)try{typeof navigator[u]=="string"&&(c+=navigator[u])}catch{}s.collect(c),c=null}t&&(t().mousemove(function(l){s.collectInt(l.clientX,16),s.collectInt(l.clientY,16)}),t().keypress(function(l){s.collectInt(l.charCode,8)}))}if(!Dt.random)Dt.random=s;else for(var u in s)Dt.random[u]=s[u];Dt.random.createInstance=i,ls.exports=Dt.random})(typeof jQuery<"u"?jQuery:null)})()});var Ja=ct((N2,Xa)=>{var Gt=ft();Et();var hs=[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],Za=[1,2,3,5],bl=function(t,e){return t<<e&65535|(t&65535)>>16-e},wl=function(t,e){return(t&65535)>>e|t<<16-e&65535};Xa.exports=Gt.rc2=Gt.rc2||{};Gt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=Gt.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,s=Math.ceil(i/8),o=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(hs[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-s,hs[r.at(128-s)&o]),a=127-s;a>=0;a--)r.setAt(a,hs[r.at(a+1)^r.at(a+s)]);return r};var Qa=function(t,e,r){var n=!1,i=null,s=null,o=null,a,f,c,u,l=[];for(t=Gt.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]=bl(h[c],Za[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]=wl(h[c],Za[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 p=function(h){var y=[];for(c=0;c<4;c++){var g=i.getInt16Le();o!==null&&(r?g^=o.getInt16Le():o.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(c=0;c<4;c++)o!==null&&(r?o.putInt16Le(y[c]):y[c]^=o.getInt16Le()),s.putInt16Le(y[c])},d=null;return d={start:function(h,y){h&&typeof h=="string"&&(h=Gt.util.createBuffer(h)),n=!1,i=Gt.util.createBuffer(),s=y||new Gt.util.createBuffer,o=h,d.output=s},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)p([[5,a],[1,f],[6,a],[1,f],[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,s,!r);else{var x=s.length(),m=s.at(x-1);m>x?y=!1:s.truncate(m)}return y}},d};Gt.rc2.startEncrypting=function(t,e,r){var n=Gt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createEncryptionCipher=function(t,e){return Qa(t,e,!0)};Gt.rc2.startDecrypting=function(t,e,r){var n=Gt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createDecryptionCipher=function(t,e){return Qa(t,e,!1)}});var Mn=ct((U2,o0)=>{var ds=ft();o0.exports=ds.jsbn=ds.jsbn||{};var Ae,El=0xdeadbeefcafe,ja=(El&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))}ds.jsbn.BigInteger=I;function et(){return new I(null)}function Sl(t,e,r,n,i,s){for(;--s>=0;){var o=e*this.data[t++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=o&67108863}return i}function Bl(t,e,r,n,i,s){for(var o=e&32767,a=e>>15;--s>=0;){var f=this.data[t]&32767,c=this.data[t++]>>15,u=a*f+c*o;f=o*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 t0(t,e,r,n,i,s){for(var o=e&16383,a=e>>14;--s>=0;){var f=this.data[t]&16383,c=this.data[t++]>>14,u=a*f+c*o;f=o*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"?(I.prototype.am=t0,Ae=28):ja&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=Bl,Ae=30):ja&&navigator.appName!="Netscape"?(I.prototype.am=Sl,Ae=26):(I.prototype.am=t0,Ae=28);I.prototype.DB=Ae;I.prototype.DM=(1<<Ae)-1;I.prototype.DV=1<<Ae;var ps=52;I.prototype.FV=Math.pow(2,ps);I.prototype.F1=ps-Ae;I.prototype.F2=2*Ae-ps;var Al="0123456789abcdefghijklmnopqrstuvwxyz",Kn=new Array,Rr,Jt;Rr=48;for(Jt=0;Jt<=9;++Jt)Kn[Rr++]=Jt;Rr=97;for(Jt=10;Jt<36;++Jt)Kn[Rr++]=Jt;Rr=65;for(Jt=10;Jt<36;++Jt)Kn[Rr++]=Jt;function e0(t){return Al.charAt(t)}function r0(t,e){var r=Kn[t.charCodeAt(e)];return r??-1}function Il(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 Tl(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 He(t){var e=et();return e.fromInt(t),e}function Cl(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var o=r==8?t[n]&255:r0(t,n);if(o<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this.data[this.t++]=o>>this.DB-s):this.data[this.t-1]|=o<<s,s+=r,s>=this.DB&&(s-=this.DB)}r==8&&t[0]&128&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&I.ZERO.subTo(this,this)}function Rl(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function _l(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,n,i=!1,s="",o=this.t,a=this.DB-o*this.DB%e;if(o-- >0)for(a<this.DB&&(n=this.data[o]>>a)>0&&(i=!0,s=e0(n));o>=0;)a<e?(n=(this.data[o]&(1<<a)-1)<<e-a,n|=this.data[--o]>>(a+=this.DB-e)):(n=this.data[o]>>(a-=e)&r,a<=0&&(a+=this.DB,--o)),n>0&&(i=!0),i&&(s+=e0(n));return i?s:"0"}function Ll(){var t=et();return I.ZERO.subTo(this,t),t}function Dl(){return this.s<0?this.negate():this}function Pl(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 Fn(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 kl(){return this.t<=0?0:this.DB*(this.t-1)+Fn(this.data[this.t-1]^this.s&this.DM)}function Nl(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 Ul(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 Ol(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,s=Math.floor(t/this.DB),o=this.s<<r&this.DM,a;for(a=this.t-1;a>=0;--a)e.data[a+s+1]=this.data[a]>>n|o,o=(this.data[a]&i)<<r;for(a=s-1;a>=0;--a)e.data[a]=0;e.data[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}function Kl(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)e.data[o-r-1]|=(this.data[o]&s)<<i,e.data[o-r]=this.data[o]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}function Fl(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 Ml(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 Vl(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 ql(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 s=et(),o=this.s,a=t.s,f=this.DB-Fn(n.data[n.t-1]);f>0?(n.lShiftTo(f,s),i.lShiftTo(f,r)):(n.copyTo(s),i.copyTo(r));var c=s.t,u=s.data[c-1];if(u!=0){var l=u*(1<<this.F1)+(c>1?s.data[c-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,y=r.t,g=y-c,x=e??et();for(s.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),I.ONE.dlShiftTo(c,x),x.subTo(s,s);s.t<c;)s.data[s.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]+=s.am(0,m,r,g,0,c))<m)for(s.dlShiftTo(g,x),r.subTo(x,r);r.data[y]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(c,e),o!=a&&I.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),o<0&&I.ZERO.subTo(r,r)}}}function zl(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 ar(t){this.m=t}function Hl(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function $l(t){return t}function Gl(t){t.divRemTo(this.m,null,t)}function Wl(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Yl(t,e){t.squareTo(e),this.reduce(e)}ar.prototype.convert=Hl;ar.prototype.revert=$l;ar.prototype.reduce=Gl;ar.prototype.mulTo=Wl;ar.prototype.sqrTo=Yl;function Zl(){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 cr(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 Ql(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 Xl(t){var e=et();return t.copyTo(e),this.reduce(e),e}function Jl(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 jl(t,e){t.squareTo(e),this.reduce(e)}function th(t,e,r){t.multiplyTo(e,r),this.reduce(r)}cr.prototype.convert=Ql;cr.prototype.revert=Xl;cr.prototype.reduce=Jl;cr.prototype.mulTo=th;cr.prototype.sqrTo=jl;function eh(){return(this.t>0?this.data[0]&1:this.s)==0}function rh(t,e){if(t>4294967295||t<1)return I.ONE;var r=et(),n=et(),i=e.convert(this),s=Fn(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var o=r;r=n,n=o}return e.revert(r)}function nh(t,e){var r;return t<256||e.isEven()?r=new ar(e):r=new cr(e),this.exp(t,r)}I.prototype.copyTo=Il;I.prototype.fromInt=Tl;I.prototype.fromString=Cl;I.prototype.clamp=Rl;I.prototype.dlShiftTo=Nl;I.prototype.drShiftTo=Ul;I.prototype.lShiftTo=Ol;I.prototype.rShiftTo=Kl;I.prototype.subTo=Fl;I.prototype.multiplyTo=Ml;I.prototype.squareTo=Vl;I.prototype.divRemTo=ql;I.prototype.invDigit=Zl;I.prototype.isEven=eh;I.prototype.exp=rh;I.prototype.toString=_l;I.prototype.negate=Ll;I.prototype.abs=Dl;I.prototype.compareTo=Pl;I.prototype.bitLength=kl;I.prototype.mod=zl;I.prototype.modPowInt=nh;I.ZERO=He(0);I.ONE=He(1);function ih(){var t=et();return this.copyTo(t),t}function sh(){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 oh(){return this.t==0?this.s:this.data[0]<<24>>24}function ah(){return this.t==0?this.s:this.data[0]<<16>>16}function ch(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 uh(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=He(r),i=et(),s=et(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o}function lh(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,o=0,a=0;a<t.length;++a){var f=r0(t,a);if(f<0){t.charAt(a)=="-"&&this.signum()==0&&(i=!0);continue}o=e*o+f,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),i&&I.ZERO.subTo(this,this)}function hh(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),ys,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 dh(){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 ph(t){return this.compareTo(t)==0}function yh(t){return this.compareTo(t)<0?this:t}function gh(t){return this.compareTo(t)>0?this:t}function xh(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r.data[n]=e(i,t.data[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function mh(t,e){return t&e}function vh(t){var e=et();return this.bitwiseTo(t,mh,e),e}function ys(t,e){return t|e}function bh(t){var e=et();return this.bitwiseTo(t,ys,e),e}function n0(t,e){return t^e}function wh(t){var e=et();return this.bitwiseTo(t,n0,e),e}function i0(t,e){return t&~e}function Eh(t){var e=et();return this.bitwiseTo(t,i0,e),e}function Sh(){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 Bh(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function Ah(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function Ih(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 Th(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+Ih(this.data[t]);return this.s<0?this.t*this.DB:-1}function Ch(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function Rh(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Ch(this.data[r]^e);return t}function _h(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function Lh(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function Dh(t){return this.changeBit(t,ys)}function Ph(t){return this.changeBit(t,i0)}function kh(t){return this.changeBit(t,n0)}function Nh(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 Uh(t){var e=et();return this.addTo(t,e),e}function Oh(t){var e=et();return this.subTo(t,e),e}function Kh(t){var e=et();return this.multiplyTo(t,e),e}function Fh(t){var e=et();return this.divRemTo(t,e,null),e}function Mh(t){var e=et();return this.divRemTo(t,null,e),e}function Vh(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function qh(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function zh(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 on(){}function s0(t){return t}function Hh(t,e,r){t.multiplyTo(e,r)}function $h(t,e){t.squareTo(e)}on.prototype.convert=s0;on.prototype.revert=s0;on.prototype.mulTo=Hh;on.prototype.sqrTo=$h;function Gh(t){return this.exp(t,new on)}function Wh(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 Yh(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 _r(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 Zh(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 Qh(t){return t}function Xh(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 Jh(t,e){t.squareTo(e),this.reduce(e)}function jh(t,e,r){t.multiplyTo(e,r),this.reduce(r)}_r.prototype.convert=Zh;_r.prototype.revert=Qh;_r.prototype.reduce=Xh;_r.prototype.mulTo=jh;_r.prototype.sqrTo=Jh;function td(t,e){var r=t.bitLength(),n,i=He(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new ar(e):e.isEven()?s=new _r(e):s=new cr(e);var o=new Array,a=3,f=n-1,c=(1<<n)-1;if(o[1]=s.convert(this),n>1){var u=et();for(s.sqrTo(o[1],u);a<=c;)o[a]=et(),s.mulTo(u,o[a-2],o[a]),a+=2}var l=t.t-1,p,d=!0,h=et(),y;for(r=Fn(t.data[l])-1;l>=0;){for(r>=f?p=t.data[l]>>r-f&c:(p=(t.data[l]&(1<<r+1)-1)<<f-r,l>0&&(p|=t.data[l-1]>>this.DB+r-f)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--l),d)o[p].copyTo(i),d=!1;else{for(;a>1;)s.sqrTo(i,h),s.sqrTo(h,i),a-=2;a>0?s.sqrTo(i,h):(y=i,i=h,h=y),s.mulTo(h,o[p],i)}for(;l>=0&&!(t.data[l]&1<<r);)s.sqrTo(i,h),y=i,i=h,h=y,--r<0&&(r=this.DB-1,--l)}return s.revert(i)}function ed(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function rd(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 nd(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return I.ZERO;for(var r=t.clone(),n=this.clone(),i=He(1),s=He(0),o=He(0),a=He(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(o,i),s.subTo(a,s)):(n.subTo(r,n),e&&o.subTo(i,o),a.subTo(s,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 ne=[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],id=(1<<26)/ne[ne.length-1];function sd(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=ne[ne.length-1]){for(e=0;e<ne.length;++e)if(r.data[0]==ne[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ne.length;){for(var n=ne[e],i=e+1;i<ne.length&&n<id;)n*=ne[i++];for(n=r.modInt(n);e<i;)if(n%ne[e++]==0)return!1}return r.millerRabin(t)}function od(t){var e=this.subtract(I.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n=e.shiftRight(r),i=ad(),s,o=0;o<t;++o){do s=new I(this.bitLength(),i);while(s.compareTo(I.ONE)<=0||s.compareTo(e)>=0);var a=s.modPow(n,this);if(a.compareTo(I.ONE)!=0&&a.compareTo(e)!=0){for(var f=1;f++<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 ad(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=ch;I.prototype.toRadix=uh;I.prototype.fromRadix=lh;I.prototype.fromNumber=hh;I.prototype.bitwiseTo=xh;I.prototype.changeBit=Lh;I.prototype.addTo=Nh;I.prototype.dMultiply=qh;I.prototype.dAddOffset=zh;I.prototype.multiplyLowerTo=Wh;I.prototype.multiplyUpperTo=Yh;I.prototype.modInt=rd;I.prototype.millerRabin=od;I.prototype.clone=ih;I.prototype.intValue=sh;I.prototype.byteValue=oh;I.prototype.shortValue=ah;I.prototype.signum=fh;I.prototype.toByteArray=dh;I.prototype.equals=ph;I.prototype.min=yh;I.prototype.max=gh;I.prototype.and=vh;I.prototype.or=bh;I.prototype.xor=wh;I.prototype.andNot=Eh;I.prototype.not=Sh;I.prototype.shiftLeft=Bh;I.prototype.shiftRight=Ah;I.prototype.getLowestSetBit=Th;I.prototype.bitCount=Rh;I.prototype.testBit=_h;I.prototype.setBit=Dh;I.prototype.clearBit=Ph;I.prototype.flipBit=kh;I.prototype.add=Uh;I.prototype.subtract=Oh;I.prototype.multiply=Kh;I.prototype.divide=Fh;I.prototype.remainder=Mh;I.prototype.divideAndRemainder=Vh;I.prototype.modPow=td;I.prototype.modInverse=nd;I.prototype.pow=Gh;I.prototype.gcd=ed;I.prototype.isProbablePrime=sd});var l0=ct((O2,u0)=>{var ge=ft();or();Et();var c0=u0.exports=ge.sha1=ge.sha1||{};ge.md.sha1=ge.md.algorithms.sha1=c0;c0.create=function(){f0||cd();var t=null,e=ge.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s<i;++s)n.fullMessageLength.push(0);return e=ge.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},n},n.start(),n.update=function(i,s){s==="utf8"&&(i=ge.util.encodeUtf8(i));var o=i.length;n.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(i),a0(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=ge.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(gs.substr(0,n.blockLength-o));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};a0(l,r,i);var p=ge.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 gs=null,f0=!1;function cd(){gs="\x80",gs+=ge.util.fillString("\0",64),f0=!0}function a0(t,e,r){for(var n,i,s,o,a,f,c,u,l=r.length();l>=64;){for(i=t.h0,s=t.h1,o=t.h2,a=t.h3,f=t.h4,u=0;u<16;++u)n=r.getInt32(),e[u]=n,c=a^s&(o^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<20;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,c=a^s&(o^a),n=(i<<5|i>>>27)+c+f+1518500249+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<32;++u)n=e[u-3]^e[u-8]^e[u-14]^e[u-16],n=n<<1|n>>>31,e[u]=n,c=s^o^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<40;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,c=s^o^a,n=(i<<5|i>>>27)+c+f+1859775393+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<60;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,c=s&o|a&(s^o),n=(i<<5|i>>>27)+c+f+2400959708+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;u<80;++u)n=e[u-6]^e[u-16]^e[u-28]^e[u-32],n=n<<2|n>>>30,e[u]=n,c=s^o^a,n=(i<<5|i>>>27)+c+f+3395469782+n,f=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+o|0,t.h3=t.h3+a|0,t.h4=t.h4+f|0,l-=64}}});var p0=ct((K2,d0)=>{var xe=ft();Et();sn();l0();var h0=d0.exports=xe.pkcs1=xe.pkcs1||{};h0.encode_rsa_oaep=function(t,e,r){var n,i,s,o;typeof r=="string"?(n=r,i=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),s?s.start():s=xe.md.sha1.create(),o||(o=s);var a=Math.ceil(t.n.bitLength()/8),f=a-2*s.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=""),s.update(n,"raw");for(var u=s.digest(),l="",p=f-e.length,d=0;d<p;d++)l+="\0";var h=u.getBytes()+l+""+e;if(!i)i=xe.random.getBytes(s.digestLength);else if(i.length!==s.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=i.length,c.digestLength=s.digestLength,c}var y=Vn(i,a-s.digestLength-1,o),g=xe.util.xorBytes(h,y,h.length),x=Vn(g,s.digestLength,o),m=xe.util.xorBytes(i,x,i.length);return"\0"+m+g};h0.decode_rsa_oaep=function(t,e,r){var n,i,s;typeof r=="string"?(n=r,i=arguments[3]||void 0):r&&(n=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md));var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var g=new Error("RSAES-OAEP encoded message length is invalid.");throw g.length=e.length,g.expectedLength=o,g}if(i===void 0?i=xe.md.sha1.create():i.start(),s||(s=i),o<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=Vn(u,i.digestLength,s),p=xe.util.xorBytes(c,l,c.length),d=Vn(p,o-i.digestLength-1,s),h=xe.util.xorBytes(u,d,u.length),y=h.substring(0,i.digestLength),g=f!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==y.charAt(x);for(var m=1,b=i.digestLength,R=i.digestLength;R<h.length;R++){var E=h.charCodeAt(R),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,b+=m}if(g||h.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)};function Vn(t,e,r){r||(r=xe.md.sha1.create());for(var n="",i=Math.ceil(e/r.digestLength),s=0;s<i;++s){var o=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(t+o),n+=r.digest().getBytes()}return n.substring(0,e)}});var y0=ct((F2,xs)=>{var $e=ft();Et();Mn();sn();(function(){if($e.prime){xs.exports=$e.prime;return}var t=xs.exports=$e.prime=$e.prime||{},e=$e.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||$e.random,g={nextBytes:function(x){for(var m=y.getBytesSync(x.length),b=0;b<x.length;++b)x[b]=m.charCodeAt(b)}};if(h.name==="PRIMEINC")return s(l,g,h.options,d);throw new Error("Invalid prime generation algorithm: "+h.name)};function s(l,p,d,h){return"workers"in d?f(l,p,d,h):o(l,p,d,h)}function o(l,p,d,h){var y=c(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=c(p,d)),l.isProbablePrime(y))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);$e.util.setImmediate(function(){a(l,p,d,h,y,g,x)})}function f(l,p,d,h){if(typeof Worker>"u")return o(l,p,d,h);var y=c(l,p),g=d.workers,x=d.workLoad||100,m=x*30/8,b=d.workerScript||"forge/prime.worker.js";if(g===-1)return $e.util.estimateCores(function(E,S){E&&(S=2),g=S-1,R()});R();function R(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(b);for(var L=g,S=0;S<g;++S)E[S].addEventListener("message",z);var D=!1;function z(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=c(l,p));var at=y.toString(16);q.target.postMessage({hex:at,workLoad:x}),y.dAddOffset(m,0)}}}}function c(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 zn=ct((M2,E0)=>{var F=ft();nn();Mn();Tn();p0();y0();sn();Et();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,ms=F.util.isNodejs?kn():null,w=F.asn1,jt=F.util;F.pki=F.pki||{};E0.exports=F.pki.rsa=F.rsa=F.rsa||{};var H=F.pki,fd=[6,4,2,4,2,4,6,2],ud={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"}]},ld={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"}]},hd={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"}]},dd=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"}]}]},pd={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"}]},yd=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,[]),s=w.create(w.Class.UNIVERSAL,w.Type.SEQUENCE,!0,[]);s.value.push(w.create(w.Class.UNIVERSAL,w.Type.OID,!1,n)),s.value.push(w.create(w.Class.UNIVERSAL,w.Type.NULL,!1,""));var o=w.create(w.Class.UNIVERSAL,w.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(s),i.value.push(o),w.toDer(i).getBytes()},b0=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),s=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(s)<0;)i=i.add(e.p);var o=i.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return o=o.multiply(n.modInverse(e.n)).mod(e.n),o};H.rsa.encrypt=function(t,e,r){var n=r,i,s=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=w0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var o=new tt(i.toHex(),16),a=b0(o,e,n),f=a.toString(16),c=F.util.createBuffer(),u=s-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 s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=i,s}var o=new tt(F.util.createBuffer(t).toHex(),16);if(o.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=b0(o,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?qn(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)}},s=r.algorithm||"PRIMEINC",o;if(s==="PRIMEINC")o={algorithm:s,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},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+s);return o};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,p){return l|p},s=+new Date,o,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(xd(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: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)}}o=+new Date,a+=o-s,s=o}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(g0("generateKeyPair"))return ms.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(x0("generateKey")&&x0("exportKey"))return jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:v0(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 f=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:f,publicKey:H.setRsaPublicKey(f.n,f.e)})}});if(m0("generateKey")&&m0("exportKey")){var i=jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:v0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var f=a.target.result,c=jt.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);c.oncomplete=function(u){var l=u.target.result,p=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:p,publicKey:H.setRsaPublicKey(p.n,p.e)})},c.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(g0("generateKeyPairSync")){var s=ms.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:H.privateKeyFromPem(s.privateKey),publicKey:H.publicKeyFromPem(s.publicKey)}}}var o=H.rsa.createKeyPairGenerationState(t,e,r);if(!n)return H.rsa.stepKeyPairGenerationState(o,0),o.keys;gd(o,r,n)};H.setRsaPublicKey=H.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,f,c){return w0(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,s)}};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 o=i.encode(n,r,!0);return H.rsa.encrypt(o,r,!0)},r.verify=function(n,i,s,o){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),o===void 0&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),s==="RSASSA-PKCS1-V1_5"?s={verify:function(f,c){c=qn(c,r,!0);var u=w.fromDer(c,{parseAllBytes:o._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,pd,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 f===l.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(f,c){return c=qn(c,r,!0),f===c}});var a=H.rsa.decrypt(i,r,!0,!1);return s.verify(n,a,r.n.bitLength())},r};H.setRsaPrivateKey=H.rsa.setPrivateKey=function(t,e,r,n,i,s,o,a){var f={n:t,e,d:r,p:n,q:i,dP:s,dQ:o,qInv:a};return f.decrypt=function(c,u,l){typeof u=="string"?u=u.toUpperCase():u===void 0&&(u="RSAES-PKCS1-V1_5");var p=H.rsa.decrypt(c,f,!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,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:yd},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return c}},l=1);var p=u.encode(c,f.n.bitLength());return H.rsa.encrypt(p,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,ud,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,ld,e,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,s,o,a,f,c,u,l;return i=F.util.createBuffer(e.privateKeyModulus).toHex(),s=F.util.createBuffer(e.privateKeyPublicExponent).toHex(),o=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(s,16),new tt(o,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,me(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.qInv))])};H.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,dd,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,hd,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var s=F.util.createBuffer(e.publicKeyModulus).toHex(),o=F.util.createBuffer(e.publicKeyExponent).toHex();return H.setRsaPublicKey(new tt(s,16),new tt(o,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,me(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,me(t.e))])};function w0(t,e,r){var n=F.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var f=0;f<o;++f)n.putByte(a)}else for(;o>0;){for(var c=0,u=F.random.getBytes(o),f=0;f<o;++f)a=u.charCodeAt(f),a===0?++c:n.putByte(a);o=c}return n.putByte(0),n.putBytes(t),n}function qn(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8),s=F.util.createBuffer(t),o=s.getByte(),a=s.getByte();if(o!==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(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(a===1)for(f=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++f}else if(a===2)for(f=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++f}var u=s.getByte();if(u!==0||f!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.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(){s(t.pBits,function(a,f){if(a)return r(a);if(t.p=f,t.q!==null)return o(a,t.q);s(t.qBits,o)})}function s(a,f){F.prime.generateProbablePrime(a,n,f)}function o(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,s(t.qBits,o);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,s(t.qBits,o);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 me(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 xd(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 g0(t){return F.util.isNodejs&&typeof ms[t]=="function"}function x0(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 m0(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 v0(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 C0=ct((V2,T0)=>{var U=ft();fs();nn();Da();or();Tn();Oa();Ma();sn();Ja();zn();Et();typeof S0>"u"&&(S0=U.jsbn.BigInteger);var S0,B=U.asn1,$=U.pki=U.pki||{};T0.exports=$.pbe=U.pbe=U.pbe||{};var fr=$.oids,md={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"}]},vd={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"}]}]},bd={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"}]};$.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,s=B.integerToDer(i),o,a,f;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var c,u,l;switch(r.algorithm){case"aes128":o=16,c=16,u=fr["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":o=24,c=16,u=fr["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":o=32,c=16,u=fr["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":o=8,c=8,u=fr.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=I0(d),y=U.pkcs5.pbkdf2(e,n,i,o,h),g=U.random.getBytesSync(c),x=l(y);x.start(g),x.update(B.toDer(t)),x.finish(),f=x.output.getBytes();var m=wd(n,s,o,d);a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(fr.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(fr.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"){o=24;var b=new U.util.ByteBuffer(n),y=$.pbe.generatePkcs12Key(e,b,1,i,o),g=$.pbe.generatePkcs12Key(e,b,2,i,o),x=U.des.createEncryptionCipher(y);x.start(g),x.update(B.toDer(t)),x.finish(),f=x.output.getBytes(),a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(fr["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,s.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var R=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[a,B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,f)]);return R};$.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!B.validate(t,md,n,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=B.derToOid(n.encryptionOid),a=$.pbe.getCipher(o,n.encryptionParams,e),f=U.util.createBuffer(n.encryptedData);return a.update(f),a.finish()&&(r=B.fromDer(a.output)),r};$.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:B.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};$.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)};$.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=$.wrapRsaPrivateKey($.privateKeyToAsn1(t));return n=$.encryptPrivateKeyInfo(n,e,r),$.encryptedPrivateKeyToPem(n)}var i,s,o,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",o=16,s=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",o=24,s=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",o=32,s=U.random.getBytesSync(16),a=U.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",o=24,s=U.random.getBytesSync(8),a=U.des.createEncryptionCipher;break;case"des":i="DES-CBC",o=8,s=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,s.substr(0,8),o),u=a(c);u.start(s),u.update(B.toDer($.privateKeyToAsn1(t))),u.finish();var l={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:U.util.bytesToHex(s).toUpperCase()},body:u.output.getBytes()};return U.pem.encode(l)};$.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 s,o;switch(n.dekInfo.algorithm){case"DES-CBC":s=8,o=U.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,o=U.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,o=U.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,o=U.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,o=U.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,o=function(l){return U.rc2.createDecryptionCipher(l,40)};break;case"RC2-64-CBC":s=8,o=function(l){return U.rc2.createDecryptionCipher(l,64)};break;case"RC2-128-CBC":s=16,o=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),s),c=o(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=$.decryptPrivateKeyInfo(B.fromDer(r),e):r=B.fromDer(r),r!==null&&(r=$.privateKeyFromAsn1(r)),r};$.pbe.generatePkcs12Key=function(t,e,r,n,i,s){var o,a;if(typeof s>"u"||s===null){if(!("sha1"in U.md))throw new Error('"sha1" hash algorithm unavailable.');s=U.md.sha1.create()}var f=s.digestLength,c=s.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,c);var y=c*Math.ceil(d/c),g=new U.util.ByteBuffer;for(a=0;a<y;a++)g.putByte(e.at(a%d));var x=c*Math.ceil(p/c),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%p));var b=g;b.putBuffer(m);for(var R=Math.ceil(i/f),E=1;E<=R;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(b.bytes());for(var L=0;L<n;L++)s.start(),s.update(S.getBytes()),S=s.digest();var D=new U.util.ByteBuffer;for(a=0;a<c;a++)D.putByte(S.at(a%f));var z=Math.ceil(d/c)+Math.ceil(p/c),q=new U.util.ByteBuffer;for(o=0;o<z;o++){var M=new U.util.ByteBuffer(b.getBytes(c)),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)}b=q,u.putBuffer(S)}return u.truncate(u.length()-i),u};$.pbe.getCipher=function(t,e,r){switch(t){case $.oids.pkcs5PBES2:return $.pbe.getCipherForPBES2(t,e,r);case $.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case $.oids["pbewithSHAAnd40BitRC2-CBC"]:return $.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}};$.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!B.validate(e,vd,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(t=B.derToOid(n.kdfOid),t!==$.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=t,s.supportedOids=["pkcs5PBKDF2"],s}if(t=B.derToOid(n.encOid),t!==$.oids["aes128-CBC"]&&t!==$.oids["aes192-CBC"]&&t!==$.oids["aes256-CBC"]&&t!==$.oids["des-EDE3-CBC"]&&t!==$.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=t,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var o=n.kdfSalt,a=U.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var f,c;switch($.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=A0(n.prfOid),l=U.pkcs5.pbkdf2(r,o,a,f,u),p=n.encIv,d=c(l);return d.start(p),d};$.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!B.validate(e,bd,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=U.util.createBuffer(n.salt),a=U.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var f,c,u;switch(t){case $.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,c=8,u=U.des.startDecrypting;break;case $.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,c=8,u=function(y,g){var x=U.rc2.createDecryptionCipher(y,40);return x.start(g,null),x};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=t,s}var l=A0(n.prfOid),p=$.pbe.generatePkcs12Key(r,o,1,a,f,l);l.start();var d=$.pbe.generatePkcs12Key(r,o,2,a,c,l);return u(p,d)};$.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=[B0(n,t+e)],s=16,o=1;s<r;++o,s+=16)i.push(B0(n,i[o-1]+t+e));return i.join("").substr(0,r)};function B0(t,e){return t.start().update(e).digest().getBytes()}function A0(t){var e;if(!t)e="hmacWithSHA1";else if(e=$.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 I0(e)}function I0(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 wd(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($.oids[n]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.NULL,!1,"")])),i}});var gc=ct((im,yc)=>{var pt=ft();or();Et();var pn=yc.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=pn;var dc=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};dc.create=function(){return pn.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=dc;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return pn.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 pn.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;pn.create=function(t){if(pc||Vp(),typeof t>"u"&&(t="SHA-512"),!(t in gr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=gr[t],r=null,n=pt.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var o=64;switch(t){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:o,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),hc(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(Xs.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,f.putInt32(d>>>0),d=l>>>0;f.putInt32(d);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);hc(y,i,f);var g=pt.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 Xs=null,pc=!1,Js=null,gr=null;function Vp(){Xs="\x80",Xs+=pt.util.fillString("\0",128),Js=[[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]],gr={},gr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],gr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],gr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],gr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],pc=!0}function hc(t,e,r){for(var n,i,s,o,a,f,c,u,l,p,d,h,y,g,x,m,b,R,E,S,L,D,z,q,M,X,at,kt,T,k,_,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],_=P[1],n=((k>>>19|_<<13)^(_>>>29|k<<3)^k>>>6)>>>0,i=((k<<13|_>>>19)^(_<<3|k>>>29)^(k<<26|_>>>6))>>>0,O=e[T-15],k=O[0],_=O[1],s=((k>>>1|_<<31)^(k>>>8|_<<24)^k>>>7)>>>0,o=((k<<31|_>>>1)^(k<<24|_>>>8)^(k<<25|_>>>7))>>>0,A=e[T-7],K=e[T-16],_=i+A[1]+o+K[1],e[T][0]=n+A[0]+s+K[0]+(_/4294967296>>>0)>>>0,e[T][1]=_>>>0;for(y=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],b=t[2][0],R=t[2][1],E=t[3][0],S=t[3][1],L=t[4][0],D=t[4][1],z=t[5][0],q=t[5][1],M=t[6][0],X=t[6][1],at=t[7][0],kt=t[7][1],T=0;T<80;++T)c=((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&(z^M))>>>0,p=(X^D&(q^X))>>>0,a=((y>>>28|g<<4)^(g>>>2|y<<30)^(g>>>7|y<<25))>>>0,f=((y<<4|g>>>28)^(g<<30|y>>>2)^(g<<25|y>>>7))>>>0,d=(y&x|b&(y^x))>>>0,h=(g&m|R&(g^m))>>>0,_=kt+u+p+Js[T][1]+e[T][1],n=at+c+l+Js[T][0]+e[T][0]+(_/4294967296>>>0)>>>0,i=_>>>0,_=f+h,s=a+d+(_/4294967296>>>0)>>>0,o=_>>>0,at=M,kt=X,M=z,X=q,z=L,q=D,_=S+i,L=E+n+(_/4294967296>>>0)>>>0,D=_>>>0,E=b,S=R,b=x,R=m,x=y,m=g,_=i+o,y=n+s+(_/4294967296>>>0)>>>0,g=_>>>0;_=t[0][1]+g,t[0][0]=t[0][0]+y+(_/4294967296>>>0)>>>0,t[0][1]=_>>>0,_=t[1][1]+m,t[1][0]=t[1][0]+x+(_/4294967296>>>0)>>>0,t[1][1]=_>>>0,_=t[2][1]+R,t[2][0]=t[2][0]+b+(_/4294967296>>>0)>>>0,t[2][1]=_>>>0,_=t[3][1]+S,t[3][0]=t[3][0]+E+(_/4294967296>>>0)>>>0,t[3][1]=_>>>0,_=t[4][1]+D,t[4][0]=t[4][0]+L+(_/4294967296>>>0)>>>0,t[4][1]=_>>>0,_=t[5][1]+q,t[5][0]=t[5][0]+z+(_/4294967296>>>0)>>>0,t[5][1]=_>>>0,_=t[6][1]+X,t[6][0]=t[6][0]+M+(_/4294967296>>>0)>>>0,t[6][1]=_>>>0,_=t[7][1]+kt,t[7][0]=t[7][0]+at+(_/4294967296>>>0)>>>0,t[7][1]=_>>>0,V-=128}}});var df=ct((r4,hf)=>{"use strict";function lf(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function $1(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 lf(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),lf(new i,r)}}hf.exports=$1});var vf=ct(wn=>{(function(){var t,e,r,n,i,s,o,a;a=function(f){var c,u,l,p;return c=(f&255<<24)>>>24,u=(f&255<<16)>>>16,l=(f&65280)>>>8,p=f&255,[c,u,l,p].join(".")},o=function(f){var c,u,l,p,d,h;for(c=[],l=p=0;p<=3&&f.length!==0;l=++p){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"),s=r("a"),i=r("A"),e=function(f){var c,u,l,p,d;for(p=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)p=p*c+(r(f[l])-n)>>>0;else if(c===16)if("a"<=f[l]&&f[l]<="f")p=p*c+(10+r(f[l])-s)>>>0;else if("A"<=f[l]&&f[l]<="F")p=p*c+(10+r(f[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 f(c,u){var l,p,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=o(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=(o(c)&this.maskLong)>>>0}catch(y){throw l=y,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):(o(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,p;for(p=o(this.first),l=o(this.last),u=0;p<=l;)c(a(p),p,u),u++,p++},f.prototype.toString=function(){return this.base+"/"+this.bitmask},f}(),wn.ip2long=o,wn.long2ip=a,wn.Netmask=t}).call(wn)});var Sf=ct((Ef,Si)=>{(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"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${e}\\.${e}\\.${e}\\.${e}(${s})?$`,"i")};function f(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let y=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;)y++;if(d.substr(0,2)==="::"&&y--,d.substr(-2,2)==="::"&&y--,y>h)return null;for(b=h-y,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 R=d.split(":"),E=[];for(let S=0;S<R.length;S++)E.push(parseInt(R[S],16));return E}(),{parts:h,zoneId:x}}function c(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 c(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,b;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(b=g[m],y&&b!==0)return null;b!==8&&(y=!0),h+=b}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 b=0;b<x.length;b++)y=x[b],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 c(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 b=7;b>=0;b-=1)if(x=this.parts[b],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(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},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,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])],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,b;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(b=m[g],d.kind()===b[0].kind()&&d.match.apply(d,b))return x}return y},typeof Si<"u"&&Si.exports?Si.exports=p:t.ipaddr=p})(Ef)});var xy={};Rt(xy,{autoNAT:()=>gy});var Y=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Ii="ERR_TIMEOUT";var Ti=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Sy=globalThis.CustomEvent??Ti,Ci=(t,...e)=>{try{[...e]}catch{}};var $o=Symbol.for("@libp2p/peer-id");var Pi={};Rt(Pi,{base58btc:()=>At,base58flickr:()=>Qf});function $f(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var s=t.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=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 y=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,y++;for(var b=(m-x)*u+1>>>0,R=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,L=b-1;(E!==0||S<g)&&L!==-1;L--,S++)E+=256*R[L]>>>0,R[L]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var D=b-g;D!==b&&R[D]===0;)D++;for(var z=f.repeat(y);D<b;++D)z+=t.charAt(R[D]);return z}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]===f;)g++,y++;for(var m=(h.length-y)*c+1>>>0,b=new Uint8Array(m);h[y];){var R=r[h.charCodeAt(y)];if(R===255)return;for(var E=0,S=m-1;(R!==0||E<x)&&S!==-1;S--,E++)R+=a*b[S]>>>0,b[S]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");x=E,y++}if(h[y]!==" "){for(var L=m-x;L!==m&&b[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),z=g;L!==m;)D[z++]=b[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 Gf=$f,Wf=Gf,Go=Wf;var Ty=new Uint8Array(0);var 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},we=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 Yo=t=>new TextEncoder().encode(t),Zo=t=>new TextDecoder().decode(t);var Ri=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")}},_i=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 Xo(this,e)}},Li=class{constructor(e){this.decoders=e}or(e){return Xo(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`)}},Xo=(t,e)=>new Li({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Di=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ri(e,r,n),this.decoder=new _i(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},br=({name:t,prefix:e,encode:r,decode:n})=>new Di(t,e,r,n),Fe=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Go(r,e);return br({prefix:t,name:e,encode:n,decode:s=>we(i(s))})},Yf=(t,e,r,n)=>{let i={};for(let u=0;u<e.length;++u)i[e[u]]=u;let s=t.length;for(;t[s-1]==="=";)--s;let o=new Uint8Array(s*r/8|0),a=0,f=0,c=0;for(let u=0;u<s;++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,o[c++]=255&f>>a)}if(a>=r||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},Zf=(t,e,r)=>{let n=e[e.length-1]==="=",i=(1<<r)-1,s="",o=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],o+=8;o>r;)o-=r,s+=e[i&a>>o];if(o&&(s+=e[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},vt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>br({prefix:e,name:t,encode(i){return Zf(i,n,r)},decode(i){return Yf(i,n,r,t)}});var At=Fe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Qf=Fe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ki={};Rt(ki,{base10:()=>Xf});var Xf=Fe({prefix:"9",name:"base10",alphabet:"0123456789"});var Ni={};Rt(Ni,{base16:()=>Jf,base16upper:()=>jf});var Jf=vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jf=vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ui={};Rt(Ui,{base2:()=>tu});var tu=vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Oi={};Rt(Oi,{base256emoji:()=>su});var Jo=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}"),eu=Jo.reduce((t,e,r)=>(t[r]=e,t),[]),ru=Jo.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function nu(t){return t.reduce((e,r)=>(e+=eu[r],e),"")}function iu(t){let e=[];for(let r of t){let n=ru[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var su=br({prefix:"\u{1F680}",name:"base256emoji",encode:nu,decode:iu});var Ki={};Rt(Ki,{base32:()=>Ee,base32hex:()=>fu,base32hexpad:()=>lu,base32hexpadupper:()=>hu,base32hexupper:()=>uu,base32pad:()=>au,base32padupper:()=>cu,base32upper:()=>ou,base32z:()=>du});var Ee=vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ou=vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),au=vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),cu=vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fu=vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uu=vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),lu=vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),hu=vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),du=vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Fi={};Rt(Fi,{base36:()=>pu,base36upper:()=>yu});var pu=Fe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yu=Fe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Mi={};Rt(Mi,{base64:()=>Sn,base64pad:()=>gu,base64url:()=>xu,base64urlpad:()=>mu});var Sn=vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gu=vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xu=vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),mu=vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Vi={};Rt(Vi,{base8:()=>vu});var vu=vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qi={};Rt(qi,{identity:()=>bu});var bu=br({prefix:"\0",name:"identity",encode:t=>Zo(t),decode:t=>Yo(t)});var qy=new TextEncoder,zy=new TextDecoder;var Hi={};Rt(Hi,{identity:()=>Me});var Su=ea,jo=128,Bu=127,Au=~Bu,Iu=Math.pow(2,31);function ea(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Iu;)e[r++]=t&255|jo,t/=128;for(;t&Au;)e[r++]=t&255|jo,t>>>=7;return e[r]=t|0,ea.bytes=r-n+1,e}var Tu=zi,Cu=128,ta=127;function zi(t,n){var r=0,n=n||0,i=0,s=n,o,a=t.length;do{if(s>=a)throw zi.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=i<28?(o&ta)<<i:(o&ta)*Math.pow(2,i),i+=7}while(o>=Cu);return zi.bytes=s-n,r}var Ru=Math.pow(2,7),_u=Math.pow(2,14),Lu=Math.pow(2,21),Du=Math.pow(2,28),Pu=Math.pow(2,35),ku=Math.pow(2,42),Nu=Math.pow(2,49),Uu=Math.pow(2,56),Ou=Math.pow(2,63),Ku=function(t){return t<Ru?1:t<_u?2:t<Lu?3:t<Du?4:t<Pu?5:t<ku?6:t<Nu?7:t<Uu?8:t<Ou?9:10},Fu={encode:Su,decode:Tu,encodingLength:Ku},Mu=Fu,Qr=Mu;var Xr=(t,e=0)=>[Qr.decode(t,e),Qr.decode.bytes],wr=(t,e,r=0)=>(Qr.encode(t,e,r),e),Er=t=>Qr.encodingLength(t);var he=(t,e)=>{let r=e.byteLength,n=Er(t),i=n+Er(r),s=new Uint8Array(i+r);return wr(t,s,0),wr(r,s,n),s.set(e,i),new Sr(t,r,e,s)},nr=t=>{let e=we(t),[r,n]=Xr(e),[i,s]=Xr(e.subarray(n)),o=e.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new Sr(r,i,o,e)},ra=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Wo(t.bytes,r.bytes)}},Sr=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var na=0,Vu="identity",ia=we,qu=t=>he(na,ia(t)),Me={code:na,name:Vu,encode:ia,digest:qu};var Wi={};Rt(Wi,{sha256:()=>Ot,sha512:()=>zu});var Gi=({name:t,code:e,encode:r})=>new $i(t,e,r),$i=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?he(this.code,r):r.then(n=>he(this.code,n))}else throw Error("Unknown type, must be binary type")}};var oa=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Ot=Gi({name:"sha2-256",code:18,encode:oa("SHA-256")}),zu=Gi({name:"sha2-512",code:19,encode:oa("SHA-512")});var aa=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return $u(r,Yi(t),e||At.encoder);default:return Gu(r,Yi(t),e||Ee.encoder)}};var ca=new WeakMap,Yi=t=>{let e=ca.get(t);if(e==null){let r=new Map;return ca.set(t,r),r}return e},ee=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!==Jr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Wu)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=he(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&&ra(e.multihash,n.multihash)}toString(e){return aa(this,e)}toJSON(){return{"/":aa(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:s,bytes:o}=r;return new t(n,i,s,o||fa(n,i,s.bytes))}else if(r[Yu]===!0){let{version:n,multihash:i,code:s}=r,o=nr(i);return t.create(n,s,o)}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!==Jr)throw new Error(`Version 0 CID must use dag-pb (code: ${Jr}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=fa(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Jr,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=we(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new Sr(r.multihashCode,r.digestSize,s,i);return[r.version===0?t.createV0(o):t.createV1(r.codec,o),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[l,p]=Xr(e.subarray(r));return r+=p,l},i=n(),s=Jr;if(i===18?(i=0,r=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),f=n(),c=r+f,u=c-o;return{version:i,codec:s,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=Hu(e,r),s=t.decode(i);if(s.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Yi(s).set(n,e),s}},Hu=(t,e)=>{switch(t[0]){case"Q":{let r=e||At;return[At.prefix,r.decode(`${At.prefix}${t}`)]}case At.prefix:{let r=e||At;return[At.prefix,r.decode(t)]}case Ee.prefix:{let r=e||Ee;return[Ee.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)]}}},$u=(t,e,r)=>{let{prefix:n}=r;if(n!==At.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let s=r.encode(t).slice(1);return e.set(n,s),s}else return i},Gu=(t,e,r)=>{let{prefix:n}=r,i=e.get(n);if(i==null){let s=r.encode(t);return e.set(n,s),s}else return i},Jr=112,Wu=18,fa=(t,e,r)=>{let n=Er(t),i=n+Er(e),s=new Uint8Array(i+r.byteLength);return wr(t,s,0),wr(e,s,n),s.set(r,i),s},Yu=Symbol.for("@ipld/js-cid/CID");var Ve={...qi,...Ui,...Vi,...ki,...Ni,...Ki,...Fi,...Pi,...Mi,...Oi},s2={...Wi,...Hi};function Kt(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 Zu=Symbol.for("nodejs.util.inspect.custom"),ua=Object.values(Ve).map(t=>t.decoder).reduce((t,e)=>t.or(e),Ve.identity.decoder),la=114,Zi=36,Qi=37,jr=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()})`}[$o]=!0;toString(){return this.string==null&&(this.string=At.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return ee.createV1(la,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Kt(this.multihash.bytes,e);if(typeof e=="string")return Qu(e).equals(this);if(e?.multihash?.bytes!=null)return Kt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[Zu](){return`PeerId(${this.toString()})`}},Br=class extends jr{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Ar=class extends jr{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Ir=class extends jr{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function Qu(t,e){if(e=e??ua,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=nr(At.decode(`z${t}`));return t.startsWith("12D")?new Ar({multihash:r}):t.startsWith("16U")?new Ir({multihash:r}):new Br({multihash:r})}return An(ua.decode(t))}function An(t){try{let e=nr(t);if(e.code===Me.code){if(e.digest.length===Zi)return new Ar({multihash:e});if(e.digest.length===Qi)return new Ir({multihash:e})}if(e.code===Ot.code)return new Br({multihash:e})}catch{return Xu(ee.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function Xu(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==la)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Ot.code)return new Br({multihash:t.multihash});if(e.code===Me.code){if(e.digest.length===Zi)return new Ar({multihash:t.multihash});if(e.digest.length===Qi)return new Ir({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function ha(t,e){return t.length===Zi?new Ar({multihash:he(Me.code,t),privateKey:e}):t.length===Qi?new Ir({multihash:he(Me.code,t),privateKey:e}):new Br({multihash:await Ot.digest(t),publicKey:t,privateKey:e})}var cv=Mt(nn(),1),fv=Mt(C0(),1);var d1=Mt(ft(),1);function Ge(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ie(t=0){return globalThis.Buffer?.alloc!=null?Ge(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Vt(t=0){return globalThis.Buffer?.allocUnsafe!=null?Ge(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function _0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var R0=_0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),vs=_0("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=Vt(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Ed={utf8:R0,"utf-8":R0,hex:Ve.base16,latin1:vs,ascii:vs,binary:vs,...Ve},Hn=Ed;function It(t,e="utf8"){let r=Hn[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ge(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var Qs={};Rt(Qs,{Ed25519PrivateKey:()=>yr,Ed25519PublicKey:()=>dn,generateKeyPair:()=>Op,generateKeyPairFromSeed:()=>fc,unmarshalEd25519PrivateKey:()=>Np,unmarshalEd25519PublicKey:()=>Up});function L0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function bs(t,...e){if(!(t instanceof Uint8Array))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 D0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");L0(t.outputLen),L0(t.blockLen)}function Lr(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 P0(t,e){bs(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var $n=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var k0=t=>t instanceof Uint8Array;var Gn=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ie=(t,e)=>t<<32-e|t>>>e,Sd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Sd)throw new Error("Non little-endian hardware is not supported");function ws(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=ws(t)),!k0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Wn(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!k0(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}var Dr=class{clone(){return this._cloneInto()}},tg={}.toString;function Yn(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 Pr(t=32){if($n&&typeof $n.getRandomValues=="function")return $n.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Bd(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),f=n?4:0,c=n?0:4;t.setUint32(e+f,o,n),t.setUint32(e+c,a,n)}var kr=class extends Dr{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=Gn(this.buffer)}update(e){Lr(this);let{view:r,buffer:n,blockLen:i}=this;e=an(e);let s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let f=Gn(e);for(;i<=s-o;o+=i)this.process(f,o);continue}n.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Lr(this),P0(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let l=o;l<i;l++)r[l]=0;Bd(n,i-8,BigInt(this.length*8),s),this.process(n,0);let a=Gn(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],s)}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:s,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=s,e.destroyed=o,i%r&&e.buffer.set(n),e}};var Zn=BigInt(4294967295),Es=BigInt(32);function N0(t,e=!1){return e?{h:Number(t&Zn),l:Number(t>>Es&Zn)}:{h:Number(t>>Es&Zn)|0,l:Number(t&Zn)|0}}function Ad(t,e=!1){let r=new Uint32Array(t.length),n=new Uint32Array(t.length);for(let i=0;i<t.length;i++){let{h:s,l:o}=N0(t[i],e);[r[i],n[i]]=[s,o]}return[r,n]}var Id=(t,e)=>BigInt(t>>>0)<<Es|BigInt(e>>>0),Td=(t,e,r)=>t>>>r,Cd=(t,e,r)=>t<<32-r|e>>>r,Rd=(t,e,r)=>t>>>r|e<<32-r,_d=(t,e,r)=>t<<32-r|e>>>r,Ld=(t,e,r)=>t<<64-r|e>>>r-32,Dd=(t,e,r)=>t>>>r-32|e<<64-r,Pd=(t,e)=>e,kd=(t,e)=>t,Nd=(t,e,r)=>t<<r|e>>>32-r,Ud=(t,e,r)=>e<<r|t>>>32-r,Od=(t,e,r)=>e<<r-32|t>>>64-r,Kd=(t,e,r)=>t<<r-32|e>>>64-r;function Fd(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Md=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Vd=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,qd=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),zd=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Hd=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),$d=(t,e,r,n,i,s)=>e+r+n+i+s+(t/2**32|0)|0;var Gd={fromBig:N0,split:Ad,toBig:Id,shrSH:Td,shrSL:Cd,rotrSH:Rd,rotrSL:_d,rotrBH:Ld,rotrBL:Dd,rotr32H:Pd,rotr32L:kd,rotlSH:Nd,rotlSL:Ud,rotlBH:Od,rotlBL:Kd,add:Fd,add3L:Md,add3H:Vd,add4L:qd,add4H:zd,add5H:$d,add5L:Hd},G=Gd;var[Wd,Yd]=G.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))),We=new Uint32Array(80),Ye=new Uint32Array(80),Ss=class extends kr{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:s,Cl:o,Dh:a,Dl:f,Eh:c,El:u,Fh:l,Fl:p,Gh:d,Gl:h,Hh:y,Hl:g}=this;return[e,r,n,i,s,o,a,f,c,u,l,p,d,h,y,g]}set(e,r,n,i,s,o,a,f,c,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=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=f|0,this.Eh=c|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 b=0;b<16;b++,r+=4)We[b]=e.getUint32(r),Ye[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let R=We[b-15]|0,E=Ye[b-15]|0,S=G.rotrSH(R,E,1)^G.rotrSH(R,E,8)^G.shrSH(R,E,7),L=G.rotrSL(R,E,1)^G.rotrSL(R,E,8)^G.shrSL(R,E,7),D=We[b-2]|0,z=Ye[b-2]|0,q=G.rotrSH(D,z,19)^G.rotrBH(D,z,61)^G.shrSH(D,z,6),M=G.rotrSL(D,z,19)^G.rotrBL(D,z,61)^G.shrSL(D,z,6),X=G.add4L(L,M,Ye[b-7],Ye[b-16]),at=G.add4H(X,S,q,We[b-7],We[b-16]);We[b]=at|0,Ye[b]=X|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:f,Dh:c,Dl:u,Eh:l,El:p,Fh:d,Fl:h,Gh:y,Gl:g,Hh:x,Hl:m}=this;for(let b=0;b<80;b++){let R=G.rotrSH(l,p,14)^G.rotrSH(l,p,18)^G.rotrBH(l,p,41),E=G.rotrSL(l,p,14)^G.rotrSL(l,p,18)^G.rotrBL(l,p,41),S=l&d^~l&y,L=p&h^~p&g,D=G.add5L(m,E,L,Yd[b],Ye[b]),z=G.add5H(D,x,R,S,Wd[b],We[b]),q=D|0,M=G.rotrSH(n,i,28)^G.rotrBH(n,i,34)^G.rotrBH(n,i,39),X=G.rotrSL(n,i,28)^G.rotrBL(n,i,34)^G.rotrBL(n,i,39),at=n&s^n&a^s&a,kt=i&o^i&f^o&f;x=y|0,m=g|0,y=d|0,g=h|0,d=l|0,h=p|0,{h:l,l:p}=G.add(c|0,u|0,z|0,q|0),c=a|0,u=f|0,a=s|0,f=o|0,s=n|0,o=i|0;let T=G.add3L(q,X,kt);n=G.add3H(T,z,M,at),i=T|0}({h:n,l:i}=G.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=G.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:f}=G.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=G.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:l,l:p}=G.add(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:h}=G.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:y,l:g}=G.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:x,l:m}=G.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,s,o,a,f,c,u,l,p,d,h,y,g,x,m)}roundClean(){We.fill(0),Ye.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 Bs=Yn(()=>new Ss);var Jn={};Rt(Jn,{bitGet:()=>ep,bitLen:()=>tp,bitMask:()=>cn,bitSet:()=>rp,bytesToHex:()=>Te,bytesToNumberBE:()=>Ce,bytesToNumberLE:()=>Ze,concatBytes:()=>Re,createHmacDrbg:()=>Ts,ensureBytes:()=>bt,equalBytes:()=>Jd,hexToBytes:()=>ur,hexToNumber:()=>Is,numberToBytesBE:()=>Qe,numberToBytesLE:()=>lr,numberToHexUnpadded:()=>K0,numberToVarBytesBE:()=>Xd,utf8ToBytes:()=>jd,validateObject:()=>ve});var O0=BigInt(0),Qn=BigInt(1),Zd=BigInt(2),Xn=t=>t instanceof Uint8Array,Qd=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Te(t){if(!Xn(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=Qd[t[r]];return e}function K0(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Is(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function ur(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){let i=n*2,s=t.slice(i,i+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[n]=o}return r}function Ce(t){return Is(Te(t))}function Ze(t){if(!Xn(t))throw new Error("Uint8Array expected");return Is(Te(Uint8Array.from(t).reverse()))}function Qe(t,e){return ur(t.toString(16).padStart(e*2,"0"))}function lr(t,e){return Qe(t,e).reverse()}function Xd(t){return ur(K0(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=ur(e)}catch(s){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${s}`)}else if(Xn(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 Re(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!Xn(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function Jd(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function jd(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function tp(t){let e;for(e=0;t>O0;t>>=Qn,e+=1);return e}function ep(t,e){return t>>BigInt(e)&Qn}var rp=(t,e,r)=>t|(r?Qn:O0)<<BigInt(e),cn=t=>(Zd<<BigInt(t-1))-Qn,As=t=>new Uint8Array(t),U0=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=As(t),i=As(t),s=0,o=()=>{n.fill(1),i.fill(0),s=0},a=(...l)=>r(i,n,...l),f=(l=As())=>{i=a(U0([0]),l),n=a(),l.length!==0&&(i=a(U0([1]),l),n=a())},c=()=>{if(s++>=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 Re(...p)};return(l,p)=>{o(),f(l);let d;for(;!(d=p(c()));)f();return o(),d}}var np={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"||t instanceof Uint8Array,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 ve(t,e,r={}){let n=(i,s,o)=>{let a=np[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);let f=t[i];if(!(o&&f===void 0)&&!a(f,t))throw new Error(`Invalid param ${String(i)}=${f} (${typeof f}), expected ${s}`)};for(let[i,s]of Object.entries(e))n(i,s,!1);for(let[i,s]of Object.entries(r))n(i,s,!0);return t}var Tt=BigInt(0),gt=BigInt(1),hr=BigInt(2),ip=BigInt(3),Cs=BigInt(4),F0=BigInt(5),M0=BigInt(8),sp=BigInt(9),op=BigInt(16);function ut(t,e){let r=t%e;return r>=Tt?r:e+r}function ap(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 jn(t,e){if(t===Tt||e<=Tt)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=Tt,s=gt,o=gt,a=Tt;for(;r!==Tt;){let c=n/r,u=n%r,l=i-o*c,p=s-a*c;n=r,r=u,i=o,s=a,o=l,a=p}if(n!==gt)throw new Error("invert: does not exist");return ut(i,e)}function cp(t){let e=(t-gt)/hr,r,n,i;for(r=t-gt,n=0;r%hr===Tt;r/=hr,n++);for(i=hr;i<t&&ap(i,e,t)!==t-gt;i++);if(n===1){let o=(t+gt)/Cs;return function(f,c){let u=f.pow(c,o);if(!f.eql(f.sqr(u),c))throw new Error("Cannot find square root");return u}}let s=(r+gt)/hr;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,s),p=a.pow(f,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<c&&!a.eql(y,a.ONE);d++)y=a.sqr(y);let h=a.pow(u,gt<<BigInt(c-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),c=d}return l}}function fp(t){if(t%Cs===ip){let e=(t+gt)/Cs;return function(n,i){let s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(t%M0===F0){let e=(t-F0)/M0;return function(n,i){let s=n.mul(i,hr),o=n.pow(s,e),a=n.mul(i,o),f=n.mul(n.mul(a,hr),o),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%op,cp(t)}var V0=(t,e)=>(ut(t,e)&gt)===gt,up=["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=up.reduce((n,i)=>(n[i]="function",n),e);return ve(t,r)}function lp(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 hp(t,e){let r=new Array(e.length),n=e.reduce((s,o,a)=>t.is0(o)?s:(r[a]=s,t.mul(s,o)),t.ONE),i=t.inv(n);return e.reduceRight((s,o,a)=>t.is0(o)?s:(r[a]=t.mul(s,r[a]),t.mul(s,o)),i),r}function _s(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function ti(t,e,r=!1,n={}){if(t<=Tt)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:s}=_s(t,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=fp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:s,MASK:cn(i),ZERO:Tt,ONE:gt,create:f=>ut(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=>ut(-f,t),eql:(f,c)=>f===c,sqr:f=>ut(f*f,t),add:(f,c)=>ut(f+c,t),sub:(f,c)=>ut(f-c,t),mul:(f,c)=>ut(f*c,t),pow:(f,c)=>lp(a,f,c),div:(f,c)=>ut(f*jn(c,t),t),sqrN:f=>f*f,addN:(f,c)=>f+c,subN:(f,c)=>f-c,mulN:(f,c)=>f*c,inv:f=>jn(f,t),sqrt:n.sqrt||(f=>o(a,f)),invertBatch:f=>hp(a,f),cmov:(f,c,u)=>u?c:f,toBytes:f=>r?lr(f,s):Qe(f,s),fromBytes:f=>{if(f.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${f.length}`);return r?Ze(f):Ce(f)}});return Object.freeze(a)}function q0(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 z0(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 Ls(t){let e=z0(t);return e+Math.ceil(e/2)}function H0(t,e,r=!1){let n=t.length,i=z0(e),s=Ls(e);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let o=r?Ce(t):Ze(t),a=ut(o,e-gt)+gt;return r?lr(a,i):Qe(a,i)}var pp=BigInt(0),Ds=BigInt(1);function ei(t,e){let r=(i,s)=>{let o=s.negate();return i?o:s},n=i=>{let s=Math.ceil(e/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=t.ZERO,a=i;for(;s>pp;)s&Ds&&(o=o.add(a)),a=a.double(),s>>=Ds;return o},precomputeWindow(i,s){let{windows:o,windowSize:a}=n(s),f=[],c=i,u=c;for(let l=0;l<o;l++){u=c,f.push(u);for(let p=1;p<a;p++)u=u.add(c),f.push(u);c=u.double()}return f},wNAF(i,s,o){let{windows:a,windowSize:f}=n(i),c=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*f,g=Number(o&l);o>>=d,g>f&&(g-=p,o+=Ds);let x=y,m=y+Math.abs(g)-1,b=h%2!==0,R=g<0;g===0?u=u.add(r(b,s[x])):c=c.add(r(R,s[m]))}return{p:c,f:u}},wNAFCached(i,s,o,a){let f=i._WINDOW_SIZE||1,c=s.get(i);return c||(c=this.precomputeWindow(i,f),f!==1&&s.set(i,a(c))),this.wNAF(f,c,o)}}}function fn(t){return Rs(t.Fp),ve(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({..._s(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var se=BigInt(0),Qt=BigInt(1),ri=BigInt(2),yp=BigInt(8),gp={zip215:!0};function xp(t){let e=fn(t);return ve(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function ni(t){let e=xp(t),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:f}=e,c=ri<<BigInt(a*8)-Qt,u=r.create,l=e.uvRatio||((P,A)=>{try{return{isValid:!0,value:r.sqrt(P*r.inv(A))}}catch{return{isValid:!1,value:se}}}),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"&&se<P,y=(P,A)=>h(P)&&h(A)&&P<A,g=P=>P===se||y(P,c);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===se?P:x(P,n)}let b=new Map;function R(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,Qt,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,b.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,st=u(K*K),j=u(V*V),rt=u(Z*Z),wt=u(rt*rt),mt=u(st*A),Nt=u(rt*u(mt+j)),Ut=u(wt+u(O*u(st*j)));if(Nt!==Ut)throw new Error("bad point: equation left != right (1)");let Bt=u(K*V),Ft=u(Z*J);if(Bt!==Ft)throw new Error("bad point: equation left != right (2)")}equals(A){R(A);let{ex:O,ey:K,ez:V}=this,{ex:Z,ey:J,ez:st}=A,j=u(O*st),rt=u(Z*V),wt=u(K*st),mt=u(J*V);return j===rt&&wt===mt}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),st=u(ri*u(V*V)),j=u(A*Z),rt=O+K,wt=u(u(rt*rt)-Z-J),mt=j+J,Nt=mt-st,Ut=j-J,Bt=u(wt*Nt),Ft=u(mt*Ut),be=u(wt*Ut),rr=u(Nt*mt);return new E(Bt,Ft,rr,be)}add(A){R(A);let{a:O,d:K}=e,{ex:V,ey:Z,ez:J,et:st}=this,{ex:j,ey:rt,ez:wt,et:mt}=A;if(O===BigInt(-1)){let Oo=u((Z-V)*(rt+j)),Ko=u((Z+V)*(rt-j)),Ai=u(Ko-Oo);if(Ai===se)return this.double();let Fo=u(J*ri*mt),Mo=u(st*ri*wt),Vo=Mo+Fo,qo=Ko+Oo,zo=Mo-Fo,Nf=u(Vo*Ai),Uf=u(qo*zo),Of=u(Vo*zo),Kf=u(Ai*qo);return new E(Nf,Uf,Kf,Of)}let Nt=u(V*j),Ut=u(Z*rt),Bt=u(st*K*mt),Ft=u(J*wt),be=u((V+Z)*(j+rt)-Nt-Ut),rr=Ft-Bt,Zr=Ft+Bt,Uo=u(Ut-O*Nt),Lf=u(be*rr),Df=u(Zr*Uo),Pf=u(be*Uo),kf=u(rr*Zr);return new E(Lf,Df,kf,Pf)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,b,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===se?L:this.equals(L)||O===Qt?this:this.equals(S)?this.wNAF(O).p:D.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(f).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?yp:r.inv(V));let J=u(O*A),st=u(K*A),j=u(V*A);if(Z)return{x:se,y:Qt};if(j!==Qt)throw new Error("invZ was invalid");return{x:J,y:st}}clearCofactor(){let{h:A}=e;return A===Qt?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(),st=A[Z-1];J[Z-1]=st&-129;let j=Ze(J);j===se||(O?x(j,c):x(j,r.ORDER));let rt=u(j*j),wt=u(rt-Qt),mt=u(K*rt-V),{isValid:Nt,value:Ut}=l(wt,mt);if(!Nt)throw new Error("Point.fromHex: invalid y coordinate");let Bt=(Ut&Qt)===Qt,Ft=(st&128)!==0;if(!O&&Ut===se&&Ft)throw new Error("Point.fromHex: x=0 and x_0=1");return Ft!==Bt&&(Ut=u(-Ut)),E.fromAffine({x:Ut,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=lr(O,r.BYTES);return K[K.length-1]|=A&Qt?128:0,K}toHex(){return Te(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,Qt,u(e.Gx*e.Gy)),E.ZERO=new E(se,Qt,Qt,se);let{BASE:S,ZERO:L}=E,D=ei(E,a*8);function z(P){return ut(P,n)}function q(P){return z(Ze(P))}function M(P){let A=a;P=bt("private key",P,A);let O=bt("hashed private key",s(P),2*A),K=p(O.slice(0,A)),V=O.slice(A,2*A),Z=q(K),J=S.multiply(Z),st=J.toRawBytes();return{head:K,prefix:V,scalar:Z,point:J,pointBytes:st}}function X(P){return M(P).pointBytes}function at(P=new Uint8Array,...A){let O=Re(...A);return q(s(d(O,bt("context",P),!!i)))}function kt(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),st=S.multiply(J).toRawBytes(),j=at(O.context,st,Z,P),rt=z(J+j*V);m(rt);let wt=Re(st,lr(rt,r.BYTES));return bt("result",wt,a*2)}let T=gp;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 st=Ze(P.slice(J,2*J)),j,rt,wt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),wt=S.multiplyUnsafe(st)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let mt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(mt)).subtract(wt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:kt,verify:k,ExtendedPoint:E,utils:{getExtendedPublicKey:M,randomPrivateKey:()=>o(r.BYTES),precompute(P=8,A=E.BASE){return A._setWindowSize(P),A.multiply(BigInt(3)),A}}}}var ks=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),$0=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Eg=BigInt(0),mp=BigInt(1),Ps=BigInt(2),vp=BigInt(5),G0=BigInt(10),bp=BigInt(20),wp=BigInt(40),W0=BigInt(80);function Ep(t){let e=ks,n=t*t%e*t%e,i=xt(n,Ps,e)*n%e,s=xt(i,mp,e)*t%e,o=xt(s,vp,e)*s%e,a=xt(o,G0,e)*o%e,f=xt(a,bp,e)*a%e,c=xt(f,wp,e)*f%e,u=xt(c,W0,e)*c%e,l=xt(u,W0,e)*c%e,p=xt(l,G0,e)*o%e;return{pow_p_5_8:xt(p,Ps,e)*t%e,b2:n}}function Sp(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Bp(t,e){let r=ks,n=ut(e*e*e,r),i=ut(n*n*e,r),s=Ep(t*i).pow_p_5_8,o=ut(t*n*s,r),a=ut(e*o*o,r),f=o,c=ut(o*$0,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*$0,r);return u&&(o=f),(l||p)&&(o=c),V0(o,r)&&(o=ut(-o,r)),{isValid:u||l,value:o}}var _e=ti(ks,void 0,!0),Ns={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:_e,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Bs,randomBytes:Pr,adjustScalarBytes:Sp,uvRatio:Bp},Nr=ni(Ns);function Y0(t,e,r){if(e.length>255)throw new Error("Context is too big");return Wn(ws("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var Sg=ni({...Ns,domain:Y0}),Bg=ni({...Ns,domain:Y0,prehash:Bs});var Ap=(_e.ORDER+BigInt(3))/BigInt(8),Ag=_e.pow(Ps,Ap),Ig=_e.sqrt(_e.neg(_e.ONE)),Tg=(_e.ORDER-BigInt(5))/BigInt(8),Cg=BigInt(486662);var Rg=q0(_e,_e.neg(BigInt(486664)));var _g=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Lg=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Dg=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Pg=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var kg=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Ur=32,Le=64,ii=32;function Z0(){let t=Nr.utils.randomPrivateKey(),e=Nr.getPublicKey(t);return{privateKey:j0(t,e),publicKey:e}}function Q0(t){if(t.length!==ii)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=Nr.getPublicKey(e);return{privateKey:j0(e,r),publicKey:r}}function X0(t,e){let r=t.subarray(0,ii);return Nr.sign(e instanceof Uint8Array?e:e.subarray(),r)}function J0(t,e,r){return Nr.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function j0(t,e){let r=new Uint8Array(Le);for(let n=0;n<ii;n++)r[n]=t[n],r[ii+n]=e[n];return r}function Ct(t,e){if(globalThis.Buffer!=null)return Ge(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,s)=>i+s.length,0));let r=Vt(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Ge(r)}var Wt={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 Us={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Os(t){let e=t?.algorithm??"AES-GCM",r=t?.keyLength??16,n=t?.nonceLength??12,i=t?.digest??"SHA-256",s=t?.saltLength??16,o=t?.iterations??32767,a=Wt.get();r*=8;async function f(l,p){let d=a.getRandomValues(new Uint8Array(s)),h=a.getRandomValues(new Uint8Array(n)),y={name:e,iv:h};typeof p=="string"&&(p=It(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Us,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:o,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Us,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:o,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return Ct([d,y.iv,new Uint8Array(x)])}async function c(l,p){let d=l.subarray(0,s),h=l.subarray(s,s+n),y=l.subarray(s+n),g={name:e,iv:h};typeof p=="string"&&(p=It(p));let x;if(p.length===0)try{let b={name:"PBKDF2",salt:d,iterations:o,hash:{name:i}},R=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,R,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Us,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:d,iterations:o,hash:{name:i}},R=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,R,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,y);return new Uint8Array(m)}return{encrypt:f,decrypt:c}}async function Or(t,e){let n=await Os().encrypt(t,e);return Sn.encode(n)}var Ks=new Float32Array([-0]),Xe=new Uint8Array(Ks.buffer);function ec(t,e,r){Ks[0]=t,e[r]=Xe[0],e[r+1]=Xe[1],e[r+2]=Xe[2],e[r+3]=Xe[3]}function rc(t,e){return Xe[0]=t[e],Xe[1]=t[e+1],Xe[2]=t[e+2],Xe[3]=t[e+3],Ks[0]}var Fs=new Float64Array([-0]),qt=new Uint8Array(Fs.buffer);function nc(t,e,r){Fs[0]=t,e[r]=qt[0],e[r+1]=qt[1],e[r+2]=qt[2],e[r+3]=qt[3],e[r+4]=qt[4],e[r+5]=qt[5],e[r+6]=qt[6],e[r+7]=qt[7]}function ic(t,e){return qt[0]=t[e],qt[1]=t[e+1],qt[2]=t[e+2],qt[3]=t[e+3],qt[4]=t[e+4],qt[5]=t[e+5],qt[6]=t[e+6],qt[7]=t[e+7],Fs[0]}var Tp=BigInt(Number.MAX_SAFE_INTEGER),Cp=BigInt(Number.MIN_SAFE_INTEGER),Yt=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 dr;if(e<Tp&&e>Cp)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>sc&&(i=0n,++n>sc&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return dr;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):dr}},dr=new Yt(0,0);dr.toBigInt=function(){return 0n};dr.zzEncode=dr.zzDecode=function(){return this};dr.length=function(){return 1};var sc=4294967296n;function oc(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 ac(t,e,r){if(r-e<1)return"";let i,s=[],o=0,a;for(;e<r;)a=t[e++],a<128?s[o++]=a:a>191&&a<224?s[o++]=(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,s[o++]=55296+(a>>10),s[o++]=56320+(a&1023)):s[o++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,o>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i!=null?(o>0&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))}function Ms(t,e,r){let n=r,i,s;for(let o=0;o<t.length;++o)i=t.charCodeAt(o),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((s=t.charCodeAt(o+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++o,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 oe(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function si(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var Vs=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,oe(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 oe(this,4);return si(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw oe(this,4);return si(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw oe(this,4);let e=rc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw oe(this,4);let e=ic(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 oe(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return ac(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw oe(this,e);this.pos+=e}else do if(this.pos>=this.len)throw oe(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 Yt(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 oe(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 oe(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 oe(this,8);let e=si(this.buf,this.pos+=4),r=si(this.buf,this.pos+=4);return new Yt(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 qs(t){return new Vs(t instanceof Uint8Array?t:t.subarray())}function ae(t,e){let r=qs(t);return e.decode(r)}function zs(t){let e=t??8192,r=e>>>1,n,i=e;return function(o){if(o<1||o>r)return Vt(o);i+o>e&&(n=Vt(e),i=0);let a=n.subarray(i,i+=o);return i&7&&(i=(i|7)+1),a}}var pr=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Hs(){}var Gs=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Rp=zs();function _p(t){return globalThis.Buffer!=null?Vt(t):Rp(t)}var hn=class{len;head;tail;states;constructor(){this.len=0,this.head=new pr(Hs,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new pr(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Ws((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(un,10,Yt.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Yt.fromBigInt(e);return this._push(un,r.length(),r)}uint64Number(e){let r=Yt.fromNumber(e);return this._push(un,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=Yt.fromBigInt(e).zzEncode();return this._push(un,r.length(),r)}sint64Number(e){let r=Yt.fromNumber(e).zzEncode();return this._push(un,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push($s,1,e?1:0)}fixed32(e){return this._push(ln,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Yt.fromBigInt(e);return this._push(ln,4,r.lo)._push(ln,4,r.hi)}fixed64Number(e){let r=Yt.fromNumber(e);return this._push(ln,4,r.lo)._push(ln,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(ec,4,e)}double(e){return this._push(nc,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push($s,1,0):this.uint32(r)._push(Dp,r,e)}string(e){let r=oc(e);return r!==0?this.uint32(r)._push(Ms,r,e):this._push($s,1,0)}fork(){return this.states=new Gs(this),this.head=this.tail=new pr(Hs,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 pr(Hs,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=_p(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function $s(t,e,r){e[r]=t&255}function Lp(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var Ws=class extends pr{next;constructor(e,r){super(Lp,e,r),this.next=void 0}};function un(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 ln(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 Dp(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(hn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Pp,e,t),this},hn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(kp,e,t),this});function Pp(t,e,r){e.set(t,r)}function kp(t,e,r){t.length<40?Ms(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(It(t),r)}function Ys(){return new hn}function ce(t,e){let r=Ys();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Kr;(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"})(Kr||(Kr={}));function oi(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function Fr(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(s,o){let a=e(s);o.int32(a)},n=function(s){let o=s.int32();return e(o)};return oi("enum",Kr.VARINT,r,n)}function fe(t,e){return oi("message",Kr.LENGTH_DELIMITED,t,e)}var Pt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Pt||(Pt={}));var Zs;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(Zs||(Zs={}));(function(t){t.codec=()=>Fr(Zs)})(Pt||(Pt={}));var De;(function(t){let e;t.codec=()=>(e==null&&(e=fe((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let o=r.uint32();switch(o>>>3){case 1:i.Type=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(o&7);break}}return i})),e),t.encode=r=>ce(r,t.codec()),t.decode=r=>ae(r,t.codec())})(De||(De={}));var Pe;(function(t){let e;t.codec=()=>(e==null&&(e=fe((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n)=>{let i={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let o=r.uint32();switch(o>>>3){case 1:i.Type=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(o&7);break}}return i})),e),t.encode=r=>ce(r,t.codec()),t.decode=r=>ae(r,t.codec())})(Pe||(Pe={}));var dn=class{_key;constructor(e){this._key=Mr(e,Ur)}async verify(e,r){return J0(this._key,r,e)}marshal(){return this._key}get bytes(){return De.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}},yr=class{_key;_publicKey;constructor(e,r){this._key=Mr(e,Le),this._publicKey=Mr(r,Ur)}async sign(e){return X0(this._key,e)}get public(){return new dn(this._publicKey)}marshal(){return this._key}get bytes(){return Pe.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}async id(){let e=Me.digest(this.public.bytes);return At.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Or(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Np(t){if(t.length>Le){t=Mr(t,Le+Ur);let n=t.subarray(0,Le),i=t.subarray(Le,t.length);return new yr(n,i)}t=Mr(t,Le);let e=t.subarray(0,Le),r=t.subarray(Ur);return new yr(e,r)}function Up(t){return t=Mr(t,Ur),new dn(t)}async function Op(){let{privateKey:t,publicKey:e}=Z0();return new yr(t,e)}async function fc(t){let{privateKey:e,publicKey:r}=Q0(t);return new yr(e,r)}function Mr(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Y(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}function lt(t,e="utf8"){let r=Hn[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)}var _x=Mt(Et(),1),Lx=Mt(Mn(),1),uc=Mt(ft(),1);function ue(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=Ct([new Uint8Array(e-r.length),r])}return lt(r,"base64url")}function Xt(t){let e=lc(t);return new uc.default.jsbn.BigInteger(lt(e,"base16"),16)}function lc(t,e){let r=It(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Ct([new Uint8Array(e-r.length),r])}return r}var Kp={"P-256":256,"P-384":384,"P-521":521},Fp=Object.keys(Kp),qx=Fp.join(" / ");var eo={};Rt(eo,{MAX_KEY_SIZE:()=>xn,RsaPrivateKey:()=>Vr,RsaPublicKey:()=>gn,fromJwk:()=>Qp,generateKeyPair:()=>Xp,unmarshalRsaPrivateKey:()=>Yp,unmarshalRsaPublicKey:()=>Zp});var yn=Mt(ft(),1);var Im=Mt(gc(),1);function ci(t){if(isNaN(t)||t<=0)throw new Y("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Pr(t)}var cm=Mt(zn(),1),js=Mt(ft(),1);function xc(t,e){return e.map(r=>Xt(t[r]))}function mc(t){return js.default.pki.setRsaPrivateKey(...xc(t,["n","e","d","p","q","dp","dq","qi"]))}function vc(t){return js.default.pki.setRsaPublicKey(...xc(t,["n","e"]))}var xr={};Rt(xr,{jwkToPkcs1:()=>zp,jwkToPkix:()=>$p,pkcs1ToJwk:()=>qp,pkixToJwk:()=>Hp});var lm=Mt(nn(),1),hm=Mt(zn(),1);var ke=Mt(ft(),1);function qp(t){let e=ke.default.asn1.fromDer(lt(t,"ascii")),r=ke.default.pki.privateKeyFromAsn1(e);return{kty:"RSA",n:ue(r.n),e:ue(r.e),d:ue(r.d),p:ue(r.p),q:ue(r.q),dp:ue(r.dP),dq:ue(r.dQ),qi:ue(r.qInv),alg:"RS256"}}function zp(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 Y("JWK was missing components","ERR_INVALID_PARAMETERS");let e=ke.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 It(ke.default.asn1.toDer(e).getBytes(),"ascii")}function Hp(t){let e=ke.default.asn1.fromDer(lt(t,"ascii")),r=ke.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:ue(r.n),e:ue(r.e)}}function $p(t){if(t.n==null||t.e==null)throw new Y("JWK was missing components","ERR_INVALID_PARAMETERS");let e=ke.default.pki.publicKeyToAsn1({n:Xt(t.n),e:Xt(t.e)});return It(ke.default.asn1.toDer(e).getBytes(),"ascii")}async function bc(t){let e=await Wt.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 Sc(e);return{privateKey:r[0],publicKey:r[1]}}async function to(t){let r=[await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await Gp(t)],n=await Sc({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function wc(t,e){let r=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Wt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function Ec(t,e,r){let n=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Wt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Sc(t){if(t.privateKey==null||t.publicKey==null)throw new Y("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Wt.get().subtle.exportKey("jwk",t.privateKey),Wt.get().subtle.exportKey("jwk",t.publicKey)])}async function Gp(t){return Wt.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 Bc(t,e,r,n){let i=e?vc(t):mc(t),s=lt(r instanceof Uint8Array?r:r.subarray(),"ascii"),o=n(s,i);return It(o,"ascii")}function Ac(t,e){return Bc(t,!0,e,(r,n)=>n.encrypt(r))}function Ic(t,e){return Bc(t,!1,e,(r,n)=>n.decrypt(r))}function fi(t){if(t.kty!=="RSA")throw new Y("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new Y("invalid key modulus","ERR_INVALID_KEY_MODULUS");return It(t.n,"base64url").length*8}var xn=8192,gn=class{_key;constructor(e){this._key=e}async verify(e,r){return Ec(this._key,r,e)}marshal(){return xr.jwkToPkix(this._key)}get bytes(){return De.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Ac(this._key,e)}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}},Vr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return ci(16)}async sign(e){return wc(this._key,e)}get public(){if(this._publicKey==null)throw new Y("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new gn(this._publicKey)}decrypt(e){return Ic(this._key,e)}marshal(){return xr.jwkToPkcs1(this._key)}get bytes(){return Pe.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new yn.default.util.ByteBuffer(this.marshal()),i=yn.default.asn1.fromDer(n),s=yn.default.pki.privateKeyFromAsn1(i),o={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return yn.default.pki.encryptRsaPrivateKey(s,e,o)}else{if(r==="libp2p-key")return Or(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function Yp(t){let e=xr.pkcs1ToJwk(t);if(fi(e)>xn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await to(e);return new Vr(r.privateKey,r.publicKey)}function Zp(t){let e=xr.pkixToJwk(t);if(fi(e)>xn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new gn(e)}async function Qp(t){if(fi(t)>xn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await to(t);return new Vr(e.privateKey,e.publicKey)}async function Xp(t){if(t>xn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await bc(t);return new Vr(e.privateKey,e.publicKey)}var ao={};Rt(ao,{Secp256k1PrivateKey:()=>vn,Secp256k1PublicKey:()=>mn,generateKeyPair:()=>h1,unmarshalSecp256k1PrivateKey:()=>u1,unmarshalSecp256k1PublicKey:()=>l1});var Jp=(t,e,r)=>t&e^~t&r,jp=(t,e,r)=>t&e^t&r^e&r,t1=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]),Je=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),je=new Uint32Array(64),ro=class extends kr{constructor(){super(64,32,8,!1),this.A=Je[0]|0,this.B=Je[1]|0,this.C=Je[2]|0,this.D=Je[3]|0,this.E=Je[4]|0,this.F=Je[5]|0,this.G=Je[6]|0,this.H=Je[7]|0}get(){let{A:e,B:r,C:n,D:i,E:s,F:o,G:a,H:f}=this;return[e,r,n,i,s,o,a,f]}set(e,r,n,i,s,o,a,f){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=f|0}process(e,r){for(let l=0;l<16;l++,r+=4)je[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=je[l-15],d=je[l-2],h=ie(p,7)^ie(p,18)^p>>>3,y=ie(d,17)^ie(d,19)^d>>>10;je[l]=y+je[l-7]+h+je[l-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:f,G:c,H:u}=this;for(let l=0;l<64;l++){let p=ie(a,6)^ie(a,11)^ie(a,25),d=u+p+Jp(a,f,c)+t1[l]+je[l]|0,y=(ie(n,2)^ie(n,13)^ie(n,22))+jp(n,i,s)|0;u=c,c=f,f=a,a=o+d|0,o=s,s=i,i=n,n=d+y|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+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,s,o,a,f,c,u)}roundClean(){je.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Tc=Yn(()=>new ro);function e1(t){let e=fn(t);ve(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:r1,hexToBytes:n1}=Jn,mr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=mr;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:r1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=mr,r=typeof t=="string"?n1(t):t;if(!(r instanceof Uint8Array))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:s}=mr._parseInt(r.subarray(2)),{d:o,l:a}=mr._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:i,s:o}},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)),s=n.length/2,o=i.length/2,a=r(s),f=r(o);return`30${r(o+s+4)}02${f}${i}02${a}${n}`}},Ne=BigInt(0),te=BigInt(1),Nm=BigInt(2),Cc=BigInt(3),Um=BigInt(4);function i1(t){let e=e1(t),{Fp:r}=e,n=e.toBytes||((h,y,g)=>{let x=y.toAffine();return Re(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 s(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),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(h){return typeof h=="bigint"&&Ne<h&&h<e.n}function a(h){if(!o(h))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(h){let{allowedPrivateKeyLengths:y,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(y&&typeof h!="bigint"){if(h instanceof Uint8Array&&(h=Te(h)),typeof h!="string"||!y.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let b;try{b=typeof h=="bigint"?h:Ce(bt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(b=ut(b,m)),a(b),b}let c=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=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(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(f(y))}_setWindowSize(y){this._WINDOW_SIZE=y,c.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=s(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:b,py:R,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(b,m)),L=r.eql(r.mul(x,E),r.mul(R,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,Cc),{px:m,py:b,pz:R}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),z=r.mul(b,b),q=r.mul(R,R),M=r.mul(m,b);return M=r.add(M,M),L=r.mul(m,R),L=r.add(L,L),E=r.mul(y,L),S=r.mul(x,q),S=r.add(E,S),E=r.sub(z,S),S=r.add(z,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(b,R),q=r.add(q,q),D=r.mul(q,M),E=r.sub(E,D),L=r.mul(q,z),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:b,py:R,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,z=e.a,q=r.mul(e.b,Cc),M=r.mul(g,b),X=r.mul(x,R),at=r.mul(m,E),kt=r.add(g,x),T=r.add(b,R);kt=r.mul(kt,T),T=r.add(M,X),kt=r.sub(kt,T),T=r.add(g,m);let k=r.add(b,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(R,E),k=r.mul(k,S),S=r.add(X,at),k=r.sub(k,S),D=r.mul(z,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(z,at),T=r.mul(q,T),X=r.add(X,at),at=r.sub(M,at),at=r.mul(z,at),T=r.add(T,at),M=r.mul(X,T),L=r.add(L,M),M=r.mul(k,T),S=r.mul(kt,S),S=r.sub(S,M),M=r.mul(kt,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,c,y,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,b)=>m.toAffine(x[b])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Ne)return g;if(a(y),y===te)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:b,k2neg:R,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;b>Ne||E>Ne;)b&te&&(S=S.add(D)),E&te&&(L=L.add(D)),D=D.double(),b>>=te,E>>=te;return m&&(S=S.negate()),R&&(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:b}=e;if(b){let{k1neg:R,k1:E,k2neg:S,k2:L}=b.splitScalar(g),{p:D,f:z}=this.wNAF(E),{p:q,f:M}=this.wNAF(L);D=d.constTimeNegate(R,D),q=d.constTimeNegate(S,q),q=new l(r.mul(q.px,b.beta),q.py,q.pz),x=D.add(q),m=z.add(M)}else{let{p:R,f:E}=this.wNAF(g);x=R,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(y,g,x){let m=l.BASE,b=(E,S)=>S===Ne||S===te||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),R=b(this,g).add(b(y,x));return R.is0()?void 0:R}toAffine(y){let{px:g,py:x,pz:m}=this,b=this.is0();y==null&&(y=b?r.ONE:r.inv(m));let R=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:R,y:E}}isTorsionFree(){let{h:y,isTorsionFree:g}=e;if(y===te)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===te?this:g?g(l,this):this.multiplyUnsafe(e.h)}toRawBytes(y=!0){return this.assertValidity(),n(l,this,y)}toHex(y=!0){return Te(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=ei(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:s,isWithinCurveOrder:o}}function s1(t){let e=fn(t);return ve(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Rc(t){let e=s1(t),{Fp:r,n}=e,i=r.BYTES+1,s=2*r.BYTES+1;function o(T){return Ne<T&&T<r.ORDER}function a(T){return ut(T,n)}function f(T){return jn(T,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=i1({...e,toBytes(T,k,_){let P=k.toAffine(),A=r.toBytes(P.x),O=Re;return _?O(Uint8Array.from([k.hasEvenY()?2:3]),A):O(Uint8Array.from([4]),A,r.toBytes(P.y))},fromBytes(T){let k=T.length,_=T[0],P=T.subarray(1);if(k===i&&(_===2||_===3)){let A=Ce(P);if(!o(A))throw new Error("Point is not on curve");let O=l(A),K=r.sqrt(O),V=(K&te)===te;return(_&1)===1!==V&&(K=r.neg(K)),{x:A,y:K}}else if(k===s&&_===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 ${s} uncompressed bytes`)}}),d=T=>Te(Qe(T,e.nByteLength));function h(T){let k=n>>te;return T>k}function y(T){return h(T)?a(-T):T}let g=(T,k,_)=>Ce(T.slice(k,_));class x{constructor(k,_,P){this.r=k,this.s=_,this.recovery=P,this.assertValidity()}static fromCompact(k){let _=e.nByteLength;return k=bt("compactSignature",k,_*2),new x(g(k,0,_),g(k,_,2*_))}static fromDER(k){let{r:_,s:P}=mr.toSig(bt("DER",k));return new x(_,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:_,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?_+e.n:_;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let V=A&1?"03":"02",Z=c.fromHex(V+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 ur(this.toDERHex())}toDERHex(){return mr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ur(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=Ls(e.n);return H0(e.randomBytes(T),e.n)},precompute(T=8,k=c.BASE){return k._setWindowSize(T),k.multiply(BigInt(3)),k}};function b(T,k=!0){return c.fromPrivateKey(T).toRawBytes(k)}function R(T){let k=T instanceof Uint8Array,_=typeof T=="string",P=(k||_)&&T.length;return k?P===i||P===s:_?P===2*i||P===2*s:T instanceof c}function E(T,k,_=!0){if(R(T))throw new Error("first arg must be private key");if(!R(k))throw new Error("second arg must be public key");return c.fromHex(k).multiply(u(T)).toRawBytes(_)}let S=e.bits2int||function(T){let k=Ce(T),_=T.length*8-e.nBitLength;return _>0?k>>BigInt(_):k},L=e.bits2int_modN||function(T){return a(S(T))},D=cn(e.nBitLength);function z(T){if(typeof T!="bigint")throw new Error("bigint expected");if(!(Ne<=T&&T<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Qe(T,e.nByteLength)}function q(T,k,_=M){if(["recovered","canonical"].some(mt=>mt in _))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:A}=e,{lowS:O,prehash:K,extraEntropy:V}=_;O==null&&(O=!0),T=bt("msgHash",T),K&&(T=bt("prehashed msgHash",P(T)));let Z=L(T),J=u(k),st=[z(J),z(Z)];if(V!=null){let mt=V===!0?A(r.BYTES):V;st.push(bt("extraEntropy",mt))}let j=Re(...st),rt=Z;function wt(mt){let Nt=S(mt);if(!p(Nt))return;let Ut=f(Nt),Bt=c.BASE.multiply(Nt).toAffine(),Ft=a(Bt.x);if(Ft===Ne)return;let be=a(Ut*a(rt+Ft*J));if(be===Ne)return;let rr=(Bt.x===Ft?0:2)|Number(Bt.y&te),Zr=be;return O&&h(be)&&(Zr=y(be),rr^=1),new x(Ft,Zr,rr)}return{seed:j,k2sig:wt}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function at(T,k,_=M){let{seed:P,k2sig:A}=q(T,k,_),O=e;return Ts(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}c.BASE._setWindowSize(8);function kt(T,k,_,P=X){let A=T;if(k=bt("msgHash",k),_=bt("publicKey",_),"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"||A instanceof Uint8Array)try{V=x.fromDER(A)}catch(Bt){if(!(Bt instanceof mr.Err))throw Bt;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Bt,s:Ft}=A;V=new x(Bt,Ft)}else throw new Error("PARSE");Z=c.fromHex(_)}catch(Bt){if(Bt.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:st}=V,j=L(k),rt=f(st),wt=a(j*rt),mt=a(J*rt),Nt=c.BASE.multiplyAndAddUnsafe(Z,wt,mt)?.toAffine();return Nt?a(Nt.x)===J:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:E,sign:at,verify:kt,ProjectivePoint:c,Signature:x,utils:m}}var ui=class extends Dr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,D0(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,s=new Uint8Array(i);s.set(n.length>i?e.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(e){return Lr(this),this.iHash.update(e),this}digestInto(e){Lr(this),bs(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:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=s,e.blockLen=o,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()}},no=(t,e,r)=>new ui(t,e).update(r).digest();no.create=(t,e)=>new ui(t,e);function o1(t){return{hash:t,hmac:(e,...r)=>no(t,e,Wn(...r)),randomBytes:Pr}}function _c(t,e){let r=n=>Rc({...t,...o1(n)});return Object.freeze({...r(e),create:r})}var Pc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Lc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),a1=BigInt(1),io=BigInt(2),Dc=(t,e)=>(t+e/io)/e;function c1(t){let e=Pc,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=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,p=xt(l,r,e)*u%e,d=xt(p,io,e)*c%e,h=xt(d,i,e)*d%e,y=xt(h,s,e)*h%e,g=xt(y,a,e)*y%e,x=xt(g,f,e)*g%e,m=xt(x,a,e)*y%e,b=xt(m,r,e)*u%e,R=xt(b,o,e)*h%e,E=xt(R,n,e)*c%e,S=xt(E,io,e);if(!so.eql(so.sqr(S),t))throw new Error("Cannot find square root");return S}var so=ti(Pc,void 0,void 0,{sqrt:c1}),Ue=_c({a:BigInt(0),b:BigInt(7),Fp:so,n:Lc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Lc,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-a1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=Dc(s*t,e),f=Dc(-n*t,e),c=ut(t-a*r-f*i,e),u=ut(-a*n-f*s,e),l=c>o,p=u>o;if(l&&(c=e-c),p&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:p,k2:u}}}},Tc),Ym=BigInt(0);var Zm=Ue.ProjectivePoint;function kc(){return Ue.utils.randomPrivateKey()}async function Nc(t,e){let{digest:r}=await Ot.digest(e instanceof Uint8Array?e:e.subarray());try{return Ue.sign(r,t).toDERRawBytes()}catch(n){throw new Y(String(n),"ERR_INVALID_INPUT")}}async function Uc(t,e,r){try{let{digest:n}=await Ot.digest(r instanceof Uint8Array?r:r.subarray());return Ue.verify(e,n,t)}catch(n){throw new Y(String(n),"ERR_INVALID_INPUT")}}function Oc(t){return Ue.ProjectivePoint.fromHex(t).toRawBytes(!0)}function Kc(t){try{Ue.getPublicKey(t,!0)}catch(e){throw new Y(String(e),"ERR_INVALID_PRIVATE_KEY")}}function oo(t){try{Ue.ProjectivePoint.fromHex(t)}catch(e){throw new Y(String(e),"ERR_INVALID_PUBLIC_KEY")}}function Fc(t){try{return Ue.getPublicKey(t,!0)}catch(e){throw new Y(String(e),"ERR_INVALID_PRIVATE_KEY")}}var mn=class{_key;constructor(e){oo(e),this._key=e}async verify(e,r){return Uc(this._key,r,e)}marshal(){return Oc(this._key)}get bytes(){return De.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}},vn=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??Fc(e),Kc(this._key),oo(this._publicKey)}async sign(e){return Nc(this._key,e)}get public(){return new mn(this._publicKey)}marshal(){return this._key}get bytes(){return Pe.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let{bytes:e}=await Ot.digest(this.bytes);return e}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Or(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function u1(t){return new vn(t)}function l1(t){return new mn(t)}async function h1(){let t=kc();return new vn(t)}var Mc={rsa:eo,ed25519:Qs,secp256k1:ao};function p1(t){let e=Object.keys(Mc).join(" / ");return new Y(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function co(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return Mc[t];throw p1(t)}async function Vc(t,e){return co(t).generateKeyPair(e??2048)}function qc(t,e){return e=(e??"rsa").toLowerCase(),co(e),t.bytes}function zc(t,e){return e=(e??"rsa").toLowerCase(),co(e),t.bytes}var fo;(function(t){let e;t.codec=()=>(e==null&&(e=fe((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={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let o=r.uint32();switch(o>>>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(o&7);break}}return i})),e),t.encode=r=>ce(r,t.codec()),t.decode=r=>ae(r,t.codec())})(fo||(fo={}));var Hc=async()=>{let t=await Vc("Ed25519"),e=await y1(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function y1(t){return ha(qc(t.public),zc(t))}var g1=Math.pow(2,7),x1=Math.pow(2,14),m1=Math.pow(2,21),uo=Math.pow(2,28),lo=Math.pow(2,35),ho=Math.pow(2,42),po=Math.pow(2,49),it=128,zt=127;function Zt(t){if(t<g1)return 1;if(t<x1)return 2;if(t<m1)return 3;if(t<uo)return 4;if(t<lo)return 5;if(t<ho)return 6;if(t<po)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function v1(t,e,r=0){switch(Zt(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 b1(t,e,r=0){switch(Zt(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 w1(t,e){let r=t[e],n=0;if(n+=r&zt,r<it||(r=t[e+1],n+=(r&zt)<<7,r<it)||(r=t[e+2],n+=(r&zt)<<14,r<it)||(r=t[e+3],n+=(r&zt)<<21,r<it)||(r=t[e+4],n+=(r&zt)*uo,r<it)||(r=t[e+5],n+=(r&zt)*lo,r<it)||(r=t[e+6],n+=(r&zt)*ho,r<it)||(r=t[e+7],n+=(r&zt)*po,r<it))return n;throw new RangeError("Could not decode varint")}function E1(t,e){let r=t.get(e),n=0;if(n+=r&zt,r<it||(r=t.get(e+1),n+=(r&zt)<<7,r<it)||(r=t.get(e+2),n+=(r&zt)<<14,r<it)||(r=t.get(e+3),n+=(r&zt)<<21,r<it)||(r=t.get(e+4),n+=(r&zt)*uo,r<it)||(r=t.get(e+5),n+=(r&zt)*lo,r<it)||(r=t.get(e+6),n+=(r&zt)*ho,r<it)||(r=t.get(e+7),n+=(r&zt)*po,r<it))return n;throw new RangeError("Could not decode varint")}function tr(t,e,r=0){return e==null&&(e=Vt(Zt(t))),e instanceof Uint8Array?v1(t,e,r):b1(t,e,r)}function Oe(t,e=0){return t instanceof Uint8Array?w1(t,e):E1(t,e)}var hi=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 s=0,o=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 p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(u===void 0)break;if(s*=e,s+=u,s>c||(o+=1,r!==void 0&&o>r))return}if(o!==0)return!n&&f&&o>1?void 0:s})}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 o=this.readSeparator(":",n,()=>this.readIPv4Addr());if(o!==void 0)return r[i]=o[0],r[i+1]=o[1],r[i+2]=o[2],r[i+3]=o[3],[i+4,!0]}let s=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(s===void 0)return[i,!1];r[i]=s>>8,r[i+1]=s&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 s=new Uint8Array(14),o=16-(n+2),[a]=e(s.subarray(0,o));return r.set(s.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var $c=45,S1=15,qr=new hi;function yo(t){if(!(t.length>S1))return qr.new(t).parseWith(()=>qr.readIPv4Addr())}function go(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>$c))return qr.new(t).parseWith(()=>qr.readIPv6Addr())}function di(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>$c))return qr.new(t).parseWith(()=>qr.readIPAddr())}var Nv=parseInt("0xFFFF",16),Uv=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Yc(t){return!!yo(t)}function Zc(t){return!!go(t)}function zr(t){return!!di(t)}var Qc=Yc,C1=Zc,xo=function(t){let e=0;if(t=t.toString().trim(),Qc(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(C1(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let s=Qc(r[n]),o;s&&(o=xo(r[n]),r[n]=lt(o.slice(0,2),"base16")),o!=null&&++n<8&&r.splice(n,0,lt(o.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 s=[n,1];for(n=9-r.length;n>0;n--)s.push("0");r.splice.apply(r,s)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){let s=parseInt(r[n],16);i[e++]=s>>8&255,i[e++]=s&255}return i}throw new Error("invalid ip address")},Xc=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 s=0;s<r;s++)i.push(t[e+s]);return i.join(".")}if(r===16){let i=[];for(let s=0;s<r;s+=2)i.push(n.getUint16(e+s).toString(16));return i.join(":").replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}return""};var Hr={},mo={},_1=[[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"]];_1.forEach(t=>{let e=L1(...t);mo[e.code]=e,Hr[e.name]=e});function L1(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function ot(t){if(typeof t=="number"){if(mo[t]!=null)return mo[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if(Hr[t]!=null)return Hr[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var vb=ot("ip4"),bb=ot("ip6"),wb=ot("ipcidr");function bo(t,e){switch(ot(t).code){case 4:case 41:return P1(e);case 42:return tf(e);case 6:case 273:case 33:case 132:return rf(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return tf(e);case 421:return O1(e);case 444:return ef(e);case 445:return ef(e);case 466:return U1(e);default:return lt(e,"base16")}}function wo(t,e){switch(ot(t).code){case 4:return Jc(e);case 41:return Jc(e);case 42:return jc(e);case 6:case 273:case 33:case 132:return Eo(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return jc(e);case 421:return k1(e);case 444:return K1(e);case 445:return F1(e);case 466:return N1(e);default:return It(e,"base16")}}var vo=Object.values(Ve).map(t=>t.decoder),D1=function(){let t=vo[0].or(vo[1]);return vo.slice(2).forEach(e=>t=t.or(e)),t}();function Jc(t){if(!zr(t))throw new Error("invalid ip address");return xo(t)}function P1(t){let e=Xc(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 Eo(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function rf(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function jc(t){let e=It(t),r=Uint8Array.from(tr(e.length));return Ct([r,e],r.length+e.length)}function tf(t){let e=Oe(t);if(t=t.slice(Zt(e)),t.length!==e)throw new Error("inconsistent lengths");return lt(t)}function k1(t){let e;t[0]==="Q"||t[0]==="1"?e=nr(At.decode(`z${t}`)).bytes:e=ee.parse(t).multihash.bytes;let r=Uint8Array.from(tr(e.length));return Ct([r,e],r.length+e.length)}function N1(t){let e=D1.decode(t),r=Uint8Array.from(tr(e.length));return Ct([r,e],r.length+e.length)}function U1(t){let e=Oe(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+lt(r,"base64url")}function O1(t){let e=Oe(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return lt(r,"base58btc")}function K1(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=Ee.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=Eo(n);return Ct([r,i],r.length+i.length)}function F1(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=Ee.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=Eo(n);return Ct([r,i],r.length+i.length)}function ef(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=lt(e,"base32"),i=rf(r);return`${n}:${i}`}function nf(t){t=So(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 s=0;s<i.length;s++){let o=i[s],a=ot(o);if(a.size===0){e.push([a.code]),r.push([a.code]);continue}if(s++,s>=i.length)throw of("invalid address: "+t);if(a.path===!0){n=So(i.slice(s).join("/")),e.push([a.code,wo(a.code,n)]),r.push([a.code,n]);break}let f=wo(a.code,i[s]);e.push([a.code,f]),r.push([a.code,bo(a.code,f)])}return{string:sf(r),bytes:Ao(e),tuples:e,stringTuples:r,path:n}}function Bo(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let s=Oe(t,i),o=Zt(s),a=ot(s),f=M1(a,t.slice(i+o));if(f===0){e.push([s]),r.push([s]),i+=o;continue}let c=t.slice(i+o,i+o+f);if(i+=f+o,i>t.length)throw of("Invalid address Uint8Array: "+lt(t,"base16"));e.push([s,c]);let u=bo(s,c);if(r.push([s,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:sf(r),tuples:e,stringTuples:r,path:n}}function sf(t){let e=[];return t.map(r=>{let n=ot(r[0]);return e.push(n.name),r.length>1&&r[1]!=null&&e.push(r[1]),null}),So(e.join("/"))}function Ao(t){return Ct(t.map(e=>{let r=ot(e[0]),n=Uint8Array.from(tr(r.code));return e.length>1&&e[1]!=null&&(n=Ct([n,e[1]])),n}))}function M1(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Oe(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Zt(r)}}function So(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function of(t){return new Error("Error parsing address: "+t)}var V1=Symbol.for("nodejs.util.inspect.custom"),Io=Symbol.for("@multiformats/js-multiaddr/multiaddr"),q1=[ot("dns").code,ot("dns4").code,ot("dns6").code,ot("dnsaddr").code],pi=class t{bytes;#e;#t;#r;#n;[Io]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Bo(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=nf(e)}else if(cf(e))r=Bo(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,s="",o=ot("tcp"),a=ot("udp"),f=ot("ip4"),c=ot("ip6"),u=ot("dns6"),l=ot("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(s=`%${h??""}`),q1.includes(d)&&(r=o.name,i=443,n=`${h??""}${s}`,e=d===u.code?6:4),(d===o.code||d===a.code)&&(r=ot(d).name,i=parseInt(h??"")),(d===f.code||d===c.code)&&(r=ot(d).name,n=`${h??""}${s}`,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({},ot(e)))}protoCodes(){return this.#t.map(([e])=>e)}protoNames(){return this.#t.map(([e])=>ot(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(Ao(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===Hr.p2p.code&&e.push([n,i]),n===Hr["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?lt(At.decode(`z${n}`),"base58btc"):lt(ee.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Kt(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(s=>s.resolvable);if(r==null)return[this];let n=af.get(r.name);if(n==null)throw new Y(`no available resolver for ${r.name}`,"ERR_NO_AVAILABLE_RESOLVER");return(await n(this,e)).map(s=>new t(s))}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)}[V1](){return`Multiaddr(${this.#e})`}};var af=new Map;function cf(t){return!!t?.[Io]}function yi(t){return new pi(t)}function z1(t){return t[Symbol.asyncIterator]!=null}function H1(t){if(z1(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var To=H1;var uf=Symbol.for("@achingbrain/uint8arraylist");function ff(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 gi(t){return!!t?.[uf]}var $r=class t{bufs;length;[uf]=!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(gi(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(gi(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=ff(this.bufs,e);return r.buf[r.index]}set(e,r){let n=ff(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(gi(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 Ct(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Ct(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),s=new t;return s.length=i,s.bufs=[...n],s}_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 s=0;s<this.bufs.length;s++){let o=this.bufs[s],a=i,f=a+o.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(o);break}let l=e-a;n.push(o.subarray(l,l+(r-e)));break}if(c){if(e===0){n.push(o);continue}n.push(o.subarray(e-a));continue}if(u){if(r===f){n.push(o);break}n.push(o.subarray(0,r-a));break}n.push(o)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!gi(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 s=256,o=new Int32Array(s);for(let l=0;l<s;l++)o[l]=-1;for(let l=0;l<i;l++)o[n[l]]=l;let a=o,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let l=r;l<=f;l+=u){u=0;for(let p=c;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=Vt(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=Ie(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=Ie(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=Ie(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=Vt(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=Ie(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=Ie(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=Ie(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=Ie(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=Ie(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(!Kt(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,s)=>i+s.byteLength,0)),n.length=r,n}};function xi(t){return t[Symbol.asyncIterator]!=null}var mi=t=>{let e=Zt(t),r=Vt(e);return tr(t,r),mi.bytes=e,r};mi.bytes=0;function bn(t,e){e=e??{};let r=e.lengthEncoder??mi;function*n(i){let s=r(i.byteLength);s instanceof Uint8Array?yield s:yield*s,i instanceof Uint8Array?yield i:yield*i}return xi(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}bn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??mi;return new $r(r(t.byteLength),t)};var Gr=Mt(df(),1);var G1=8,W1=1024*1024*4,vr;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(vr||(vr={}));var Co=t=>{let e=Oe(t);return Co.bytes=Zt(e),e};Co.bytes=0;function Wr(t,e){let r=new $r,n=vr.LENGTH,i=-1,s=e?.lengthDecoder??Co,o=e?.maxLengthLength??G1,a=e?.maxDataLength??W1;function*f(){for(;r.byteLength>0;){if(n===vr.LENGTH)try{if(i=s(r),i<0)throw(0,Gr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Gr.default)(new Error("message length too long"),"ERR_MSG_DATA_TOO_LONG");let c=s.bytes;r.consume(c),e?.onLength!=null&&e.onLength(i),n=vr.DATA}catch(c){if(c instanceof RangeError){if(r.byteLength>o)throw(0,Gr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw c}if(n===vr.DATA){if(r.byteLength<i)break;let c=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(c),yield c,n=vr.LENGTH}}}return xi(t)?async function*(){for await(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,Gr.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,Gr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Wr.fromReader=(t,e)=>{let r=1,n=async function*(){for(;;)try{let{done:s,value:o}=await t.next(r);if(s===!0)return;o!=null&&(yield o)}catch(s){if(s.code==="ERR_UNDER_READ")return{done:!0,value:null};throw s}finally{r=1}}();return Wr(n,{...e??{},onLength:s=>{r=s}})};function Z1(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 pf=Z1;function Q1(t){return t[Symbol.asyncIterator]!=null}function X1(t,e){if(Q1(t))return async function*(){for await(let a of t)yield e(a)}();let r=pf(t),{value:n,done:i}=r.next();if(i===!0)return function*(){}();let s=e(n);if(typeof s.then=="function")return async function*(){yield await s;for await(let a of r)yield e(a)}();let o=e;return function*(){yield s;for(let a of r)yield o(a)}()}var yf=X1;function Ke(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var vi=globalThis.CustomEvent??Event;async function*Ro(t,e={}){let r=e.concurrency??1/0;r<1&&(r=1/0);let n=e.ordered==null?!1:e.ordered,i=new EventTarget,s=[],o=Ke(),a=Ke(),f=!1,c,u=!1;i.addEventListener("task-complete",()=>{a.resolve()}),Promise.resolve().then(async()=>{try{for await(let h of t){if(s.length===r&&(o=Ke(),await o.promise),u)break;let y={done:!1};s.push(y),h().then(g=>{y.done=!0,y.ok=!0,y.value=g,i.dispatchEvent(new vi("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new vi("task-complete"))})}f=!0,i.dispatchEvent(new vi("task-complete"))}catch(h){c=h,i.dispatchEvent(new vi("task-complete"))}});function l(){return n?s[0]?.done:!!s.find(h=>h.done)}function*p(){for(;s.length>0&&s[0].done;){let h=s[0];if(s.shift(),h.ok)yield h.value;else throw u=!0,o.resolve(),h.err;o.resolve()}}function*d(){for(;l();)for(let h=0;h<s.length;h++)if(s[h].done){let y=s[h];if(s.splice(h,1),h--,y.ok)yield y.value;else throw u=!0,o.resolve(),y.err;o.resolve()}}for(;;){if(l()||(a=Ke(),await a.promise),c!=null)throw c;if(n?yield*p():yield*d(),f&&s.length===0)break}}var bi=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}},Yr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new bi(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 bi(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 _o=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function wi(t={}){return J1(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 J1(t,e){e=e??{};let r=e.onEnd,n=new Yr,i,s,o,a=Ke(),f=async()=>{try{return n.isEmpty()?o?{done:!0}:await new Promise((g,x)=>{s=m=>{s=null,n.push(m);try{g(t(n))}catch(b){x(b)}return i}}):t(n)}finally{n.isEmpty()&&queueMicrotask(()=>{a.resolve(),a=Ke()})}},c=g=>s!=null?s(g):(n.push(g),i),u=g=>(n=new Yr,s!=null?s({error:g}):(n.push({error:g}),i)),l=g=>{if(o)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})},p=g=>o?i:(o=!0,g!=null?u(g):c({done:!0})),d=()=>(n=new Yr,p(),{done:!0}),h=g=>(p(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:f,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,b;x!=null&&(m=new Promise((R,E)=>{b=()=>{E(new _o)},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 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 j1(t){return t[Symbol.asyncIterator]!=null}function ty(...t){let e=[];for(let r of t)j1(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=wi({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 gf=ty;function Do(t,...e){if(t==null)throw new Error("Empty pipeline");if(Lo(t)){let n=t;t=()=>n.source}else if(mf(t)||xf(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Lo(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++)Lo(r[n])&&(r[n]=ry(r[n]));return ey(...r)}var ey=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},xf=t=>t?.[Symbol.asyncIterator]!=null,mf=t=>t?.[Symbol.iterator]!=null,Lo=t=>t==null?!1:t.sink!=null&&t.source!=null,ry=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=wi({objectMode:!0});r.then(()=>{n.end()},o=>{n.end(o)});let i,s=t.source;if(xf(s))i=async function*(){yield*s,n.end()};else if(mf(s))i=function*(){yield*s,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return gf(n,i())}return t.source};var Af=Mt(vf(),1);var bf="[a-fA-F\\d:]",er=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${bf})|(?<=${bf})(?=\\s|$))`:"",le="(?: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}",St="[a-fA-F\\d]{1,4}",Ei=`
12
+ `,r};qa.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:On.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 p=f[l];if(!/\s/.test(p[0]))break;u+=p,c=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]}}}++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 Un(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
+ `;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
+ `+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 Qa=ct((xg,Za)=>{var ge=ft();ar();Et();var Ga=Za.exports=ge.sha256=ge.sha256||{};ge.md.sha256=ge.md.algorithms.sha256=Ga;Ga.create=function(){Wa||El();var t=null,e=ge.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=ge.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=ge.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),$a(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=ge.util.createBuffer();i.putBytes(e.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,s=o&n.blockLength-1;i.putBytes(ho.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};$a(l,r,i);var p=ge.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 ho=null,Wa=!1,Ya=null;function El(){ho="\x80",ho+=ge.util.fillString("\0",64),Ya=[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],Wa=!0}function $a(t,e,r){for(var n,i,o,s,a,f,c,u,l,p,d,h,y,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,p=t.h2,d=t.h3,h=t.h4,y=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&(y^g),o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),f=u&l|p&(u^l),n=x+s+a+Ya[c]+e[c],i=o+f,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 Ja=ct((mg,Xa)=>{var xe=ft();Et();var Kn=null;xe.util.isNodejs&&!xe.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Kn=kn());var Sl=Xa.exports=xe.prng=xe.prng||{};Sl.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,p=e.plugin.increment,d=e.plugin.formatKey,h=e.plugin.formatSeed,y=xe.util.createBuffer();e.key=null,g();function g(x){if(x)return u(x);if(y.length()>=c)return u(null,y.getBytes(c));if(e.generated>1048575&&(e.key=null),e.key===null)return xe.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)),xe.util.setImmediate(g)}},e.generateSync=function(c){var u=e.plugin.cipher,l=e.plugin.increment,p=e.plugin.formatKey,d=e.plugin.formatSeed;e.key=null;for(var h=xe.util.createBuffer();h.length()<c;){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(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,p){if(l)return c(l);e.collect(p),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 p=c.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}function f(c){var u=null,l=xe.util.globalScope,p=l.crypto||l.msCrypto;p&&p.getRandomValues&&(u=function(E){return p.getRandomValues(E)});var d=xe.util.createBuffer();if(u)for(;d.length()<c;){var h=Math.max(1,Math.min(c-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()<c)for(var x,m,b,R=Math.floor(Math.random()*65536);d.length()<c;){m=16807*(R&65535),x=16807*(R>>16),m+=(x&32767)<<16,m+=x>>15,m=(m&2147483647)+(m>>31),R=m&4294967295;for(var g=0;g<3;++g)b=R>>>(g<<3),b^=Math.floor(Math.random()*256),d.putByte(b&255)}return d.getBytes(c)}return Kn?(e.seedFile=function(c,u){Kn.randomBytes(c,function(l,p){if(l)return u(l);u(null,p.toString())})},e.seedFileSync=function(c){return Kn.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="",p=0;p<u;p+=8)l+=String.fromCharCode(c>>p&255);e.collect(l)},e.registerWorker=function(c){if(c===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){c.postMessage({forge:{prng:{err:d,bytes:h}}})})};c.addEventListener("message",u)}},e}});var sn=ct((vg,po)=>{var Dt=ft();lo();Qa();Ja();Et();(function(){if(Dt.random&&Dt.random.getBytes){po.exports=Dt.random;return}(function(t){var e={},r=new Array(4),n=Dt.util.createBuffer();e.formatKey=function(l){var p=Dt.util.createBuffer(l);return l=new Array(4),l[0]=p.getInt32(),l[1]=p.getInt32(),l[2]=p.getInt32(),l[3]=p.getInt32(),Dt.aes._expandKey(l,!1)},e.formatSeed=function(l){var p=Dt.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 Dt.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=Dt.md.sha256;function i(){var l=Dt.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=Dt.util.globalScope,f=a.crypto||a.msCrypto;if(f&&f.getRandomValues&&(s=function(l){return f.getRandomValues(l)}),Dt.options.usePureJavaScript||!Dt.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(!Dt.random)Dt.random=o;else for(var u in o)Dt.random[u]=o[u];Dt.random.createInstance=i,po.exports=Dt.random})(typeof jQuery<"u"?jQuery:null)})()});var r0=ct((bg,e0)=>{var Gt=ft();Et();var yo=[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],ja=[1,2,3,5],Bl=function(t,e){return t<<e&65535|(t&65535)>>16-e},Al=function(t,e){return(t&65535)>>e|t<<16-e&65535};e0.exports=Gt.rc2=Gt.rc2||{};Gt.rc2.expandKey=function(t,e){typeof t=="string"&&(t=Gt.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(yo[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-o,yo[r.at(128-o)&s]),a=127-o;a>=0;a--)r.setAt(a,yo[r.at(a+1)^r.at(a+o)]);return r};var t0=function(t,e,r){var n=!1,i=null,o=null,s=null,a,f,c,u,l=[];for(t=Gt.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]=Bl(h[c],ja[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]=Al(h[c],ja[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 p=function(h){var y=[];for(c=0;c<4;c++){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(c=0;c<4;c++)s!==null&&(r?s.putInt16Le(y[c]):y[c]^=s.getInt16Le()),o.putInt16Le(y[c])},d=null;return d={start:function(h,y){h&&typeof h=="string"&&(h=Gt.util.createBuffer(h)),n=!1,i=Gt.util.createBuffer(),o=y||new Gt.util.createBuffer,s=h,d.output=o},update:function(h){for(n||i.putBuffer(h);i.length()>=8;)p([[5,a],[1,f],[6,a],[1,f],[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};Gt.rc2.startEncrypting=function(t,e,r){var n=Gt.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createEncryptionCipher=function(t,e){return t0(t,e,!0)};Gt.rc2.startDecrypting=function(t,e,r){var n=Gt.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};Gt.rc2.createDecryptionCipher=function(t,e){return t0(t,e,!1)}});var Vn=ct((wg,u0)=>{var go=ft();u0.exports=go.jsbn=go.jsbn||{};var Te,Il=0xdeadbeefcafe,n0=(Il&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))}go.jsbn.BigInteger=I;function et(){return new I(null)}function Tl(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 Cl(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 i0(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"?(I.prototype.am=i0,Te=28):n0&&navigator.appName=="Microsoft Internet Explorer"?(I.prototype.am=Cl,Te=30):n0&&navigator.appName!="Netscape"?(I.prototype.am=Tl,Te=26):(I.prototype.am=i0,Te=28);I.prototype.DB=Te;I.prototype.DM=(1<<Te)-1;I.prototype.DV=1<<Te;var xo=52;I.prototype.FV=Math.pow(2,xo);I.prototype.F1=xo-Te;I.prototype.F2=2*Te-xo;var Rl="0123456789abcdefghijklmnopqrstuvwxyz",Fn=new Array,_r,Jt;_r=48;for(Jt=0;Jt<=9;++Jt)Fn[_r++]=Jt;_r=97;for(Jt=10;Jt<36;++Jt)Fn[_r++]=Jt;_r=65;for(Jt=10;Jt<36;++Jt)Fn[_r++]=Jt;function o0(t){return Rl.charAt(t)}function s0(t,e){var r=Fn[t.charCodeAt(e)];return r??-1}function _l(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 Ll(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 $e(t){var e=et();return e.fromInt(t),e}function Dl(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:s0(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 Pl(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function Nl(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=o0(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+=o0(n));return i?o:"0"}function kl(){var t=et();return I.ZERO.subTo(this,t),t}function Ul(){return this.s<0?this.negate():this}function Ol(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 Mn(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 Kl(){return this.t<=0?0:this.DB*(this.t-1)+Mn(this.data[this.t-1]^this.s&this.DM)}function Fl(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 Ml(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 Vl(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 ql(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 zl(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 Hl(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 $l(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 Gl(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-Mn(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),p=this.FV/l,d=(1<<this.F1)/l,h=1<<this.F2,y=r.t,g=y-c,x=e??et();for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r.data[r.t++]=1,r.subTo(x,r)),I.ONE.dlShiftTo(c,x),x.subTo(o,o);o.t<c;)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,c))<m)for(o.dlShiftTo(g,x),r.subTo(x,r);r.data[y]<--m;)r.subTo(x,r)}e!=null&&(r.drShiftTo(c,e),s!=a&&I.ZERO.subTo(e,e)),r.t=c,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&I.ZERO.subTo(r,r)}}}function Wl(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 Yl(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function Zl(t){return t}function Ql(t){t.divRemTo(this.m,null,t)}function Xl(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Jl(t,e){t.squareTo(e),this.reduce(e)}cr.prototype.convert=Yl;cr.prototype.revert=Zl;cr.prototype.reduce=Ql;cr.prototype.mulTo=Xl;cr.prototype.sqrTo=Jl;function jl(){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 fr(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 th(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 eh(t){var e=et();return t.copyTo(e),this.reduce(e),e}function rh(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 nh(t,e){t.squareTo(e),this.reduce(e)}function ih(t,e,r){t.multiplyTo(e,r),this.reduce(r)}fr.prototype.convert=th;fr.prototype.revert=eh;fr.prototype.reduce=rh;fr.prototype.mulTo=ih;fr.prototype.sqrTo=nh;function oh(){return(this.t>0?this.data[0]&1:this.s)==0}function sh(t,e){if(t>4294967295||t<1)return I.ONE;var r=et(),n=et(),i=e.convert(this),o=Mn(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 ah(t,e){var r;return t<256||e.isEven()?r=new cr(e):r=new fr(e),this.exp(t,r)}I.prototype.copyTo=_l;I.prototype.fromInt=Ll;I.prototype.fromString=Dl;I.prototype.clamp=Pl;I.prototype.dlShiftTo=Fl;I.prototype.drShiftTo=Ml;I.prototype.lShiftTo=Vl;I.prototype.rShiftTo=ql;I.prototype.subTo=zl;I.prototype.multiplyTo=Hl;I.prototype.squareTo=$l;I.prototype.divRemTo=Gl;I.prototype.invDigit=jl;I.prototype.isEven=oh;I.prototype.exp=sh;I.prototype.toString=Nl;I.prototype.negate=kl;I.prototype.abs=Ul;I.prototype.compareTo=Ol;I.prototype.bitLength=Kl;I.prototype.mod=Wl;I.prototype.modPowInt=ah;I.ZERO=$e(0);I.ONE=$e(1);function ch(){var t=et();return this.copyTo(t),t}function fh(){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 lh(){return this.t==0?this.s:this.data[0]<<16>>16}function hh(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function dh(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function ph(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=$e(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 yh(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=s0(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&&I.ZERO.subTo(this,this)}function gh(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),mo,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 xh(){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 mh(t){return this.compareTo(t)==0}function vh(t){return this.compareTo(t)<0?this:t}function bh(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 Eh(t,e){return t&e}function Sh(t){var e=et();return this.bitwiseTo(t,Eh,e),e}function mo(t,e){return t|e}function Bh(t){var e=et();return this.bitwiseTo(t,mo,e),e}function a0(t,e){return t^e}function Ah(t){var e=et();return this.bitwiseTo(t,a0,e),e}function c0(t,e){return t&~e}function Ih(t){var e=et();return this.bitwiseTo(t,c0,e),e}function Th(){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 Ch(t){var e=et();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function Rh(t){var e=et();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function _h(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 Lh(){for(var t=0;t<this.t;++t)if(this.data[t]!=0)return t*this.DB+_h(this.data[t]);return this.s<0?this.t*this.DB:-1}function Dh(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function Ph(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=Dh(this.data[r]^e);return t}function Nh(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this.data[e]&1<<t%this.DB)!=0}function kh(t,e){var r=I.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function Uh(t){return this.changeBit(t,mo)}function Oh(t){return this.changeBit(t,c0)}function Kh(t){return this.changeBit(t,a0)}function Fh(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 Mh(t){var e=et();return this.addTo(t,e),e}function Vh(t){var e=et();return this.subTo(t,e),e}function qh(t){var e=et();return this.multiplyTo(t,e),e}function zh(t){var e=et();return this.divRemTo(t,e,null),e}function Hh(t){var e=et();return this.divRemTo(t,null,e),e}function $h(t){var e=et(),r=et();return this.divRemTo(t,e,r),new Array(e,r)}function Gh(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Wh(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 an(){}function f0(t){return t}function Yh(t,e,r){t.multiplyTo(e,r)}function Zh(t,e){t.squareTo(e)}an.prototype.convert=f0;an.prototype.revert=f0;an.prototype.mulTo=Yh;an.prototype.sqrTo=Zh;function Qh(t){return this.exp(t,new an)}function Xh(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 Jh(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 Lr(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 jh(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 td(t){return t}function ed(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 rd(t,e){t.squareTo(e),this.reduce(e)}function nd(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Lr.prototype.convert=jh;Lr.prototype.revert=td;Lr.prototype.reduce=ed;Lr.prototype.mulTo=nd;Lr.prototype.sqrTo=rd;function id(t,e){var r=t.bitLength(),n,i=$e(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 Lr(e):o=new fr(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,p,d=!0,h=et(),y;for(r=Mn(t.data[l])-1;l>=0;){for(r>=f?p=t.data[l]>>r-f&c:(p=(t.data[l]&(1<<r+1)-1)<<f-r,l>0&&(p|=t.data[l-1]>>this.DB+r-f)),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 od(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 sd(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 ad(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return I.ZERO;for(var r=t.clone(),n=this.clone(),i=$e(1),o=$e(0),s=$e(0),a=$e(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],cd=(1<<26)/ie[ie.length-1];function fd(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<cd;)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=ld(),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 f=1;f++<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 ld(){return{nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(Math.random()*256)}}}I.prototype.chunkSize=hh;I.prototype.toRadix=ph;I.prototype.fromRadix=yh;I.prototype.fromNumber=gh;I.prototype.bitwiseTo=wh;I.prototype.changeBit=kh;I.prototype.addTo=Fh;I.prototype.dMultiply=Gh;I.prototype.dAddOffset=Wh;I.prototype.multiplyLowerTo=Xh;I.prototype.multiplyUpperTo=Jh;I.prototype.modInt=sd;I.prototype.millerRabin=ud;I.prototype.clone=ch;I.prototype.intValue=fh;I.prototype.byteValue=uh;I.prototype.shortValue=lh;I.prototype.signum=dh;I.prototype.toByteArray=xh;I.prototype.equals=mh;I.prototype.min=vh;I.prototype.max=bh;I.prototype.and=Sh;I.prototype.or=Bh;I.prototype.xor=Ah;I.prototype.andNot=Ih;I.prototype.not=Th;I.prototype.shiftLeft=Ch;I.prototype.shiftRight=Rh;I.prototype.getLowestSetBit=Lh;I.prototype.bitCount=Ph;I.prototype.testBit=Nh;I.prototype.setBit=Uh;I.prototype.clearBit=Oh;I.prototype.flipBit=Kh;I.prototype.add=Mh;I.prototype.subtract=Vh;I.prototype.multiply=qh;I.prototype.divide=zh;I.prototype.remainder=Hh;I.prototype.divideAndRemainder=$h;I.prototype.modPow=id;I.prototype.modInverse=ad;I.prototype.pow=Qh;I.prototype.gcd=od;I.prototype.isProbablePrime=fd});var y0=ct((Eg,p0)=>{var me=ft();ar();Et();var h0=p0.exports=me.sha1=me.sha1||{};me.md.sha1=me.md.algorithms.sha1=h0;h0.create=function(){d0||hd();var t=null,e=me.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=me.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},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),l0(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(vo.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};l0(l,r,i);var p=me.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 vo=null,d0=!1;function hd(){vo="\x80",vo+=me.util.fillString("\0",64),d0=!0}function l0(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 m0=ct((Sg,x0)=>{var ve=ft();Et();sn();y0();var g0=x0.exports=ve.pkcs1=ve.pkcs1||{};g0.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),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="",p=f-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 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 y=qn(i,a-o.digestLength-1,s),g=ve.util.xorBytes(h,y,h.length),x=qn(g,o.digestLength,s),m=ve.util.xorBytes(i,x,i.length);return"\0"+m+g};g0.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(),f=e.charAt(0),c=e.substring(1,i.digestLength+1),u=e.substring(1+i.digestLength),l=qn(u,i.digestLength,o),p=ve.util.xorBytes(c,l,c.length),d=qn(p,s-i.digestLength-1,o),h=ve.util.xorBytes(u,d,u.length),y=h.substring(0,i.digestLength),g=f!=="\0",x=0;x<i.digestLength;++x)g|=a.charAt(x)!==y.charAt(x);for(var m=1,b=i.digestLength,R=i.digestLength;R<h.length;R++){var E=h.charCodeAt(R),S=E&1^1,L=m?65534:0;g|=E&L,m=m&S,b+=m}if(g||h.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return h.substring(b+1)};function qn(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 v0=ct((Bg,bo)=>{var Ge=ft();Et();Vn();sn();(function(){if(Ge.prime){bo.exports=Ge.prime;return}var t=bo.exports=Ge.prime=Ge.prime||{},e=Ge.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||Ge.random,g={nextBytes:function(x){for(var m=y.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,p,d,h){return"workers"in d?f(l,p,d,h):s(l,p,d,h)}function s(l,p,d,h){var y=c(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=c(p,d)),l.isProbablePrime(y))return x(null,l);l.dAddOffset(r[h++%8],0)}while(g<0||+new Date-m<g);Ge.util.setImmediate(function(){a(l,p,d,h,y,g,x)})}function f(l,p,d,h){if(typeof Worker>"u")return s(l,p,d,h);var y=c(l,p),g=d.workers,x=d.workLoad||100,m=x*30/8,b=d.workerScript||"forge/prime.worker.js";if(g===-1)return Ge.util.estimateCores(function(E,S){E&&(S=2),g=S-1,R()});R();function R(){g=Math.max(1,g);for(var E=[],S=0;S<g;++S)E[S]=new Worker(b);for(var L=g,S=0;S<g;++S)E[S].addEventListener("message",z);var D=!1;function z(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=c(l,p));var at=y.toString(16);q.target.postMessage({hex:at,workLoad:x}),y.dAddOffset(m,0)}}}}function c(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 Hn=ct((Ag,I0)=>{var F=ft();on();Vn();Cn();m0();v0();sn();Et();typeof tt>"u"&&(tt=F.jsbn.BigInteger);var tt,wo=F.util.isNodejs?kn():null,w=F.asn1,jt=F.util;F.pki=F.pki||{};I0.exports=F.pki.rsa=F.rsa=F.rsa||{};var H=F.pki,dd=[6,4,2,4,2,4,6,2],pd={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"}]},yd={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"}]},gd={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"}]},xd=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"}]}]},md={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"}]},vd=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()},B0=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=A0(t,e,r)):(i=F.util.createBuffer(),i.putBytes(t));for(var s=new tt(i.toHex(),16),a=B0(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=B0(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?zn(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,p){return l|p},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(wd(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(dd[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(b0("generateKeyPair"))return wo.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(w0("generateKey")&&w0("exportKey"))return jt.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S0(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 f=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(a)));n(null,{privateKey:f,publicKey:H.setRsaPublicKey(f.n,f.e)})}});if(E0("generateKey")&&E0("exportKey")){var i=jt.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:S0(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var f=a.target.result,c=jt.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);c.oncomplete=function(u){var l=u.target.result,p=H.privateKeyFromAsn1(w.fromDer(F.util.createBuffer(l)));n(null,{privateKey:p,publicKey:H.setRsaPublicKey(p.n,p.e)})},c.onerror=function(u){n(u)}},i.onerror=function(a){n(a)};return}}else if(b0("generateKeyPairSync")){var o=wo.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;bd(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 A0(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=zn(c,r,!0);var u=w.fromDer(c,{parseAllBytes:s._parseAllDigestBytes}),l={},p=[];if(!w.validate(u,md,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 f===l.digest}}:(o==="NONE"||o==="NULL"||o===null)&&(o={verify:function(f,c){return c=zn(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 p=H.rsa.decrypt(c,f,!1,!1);if(u==="RSAES-PKCS1-V1_5")u={decode:zn};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,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:vd},l=1):(u==="NONE"||u==="NULL"||u===null)&&(u={encode:function(){return c}},l=1);var p=u.encode(c,f.n.bitLength());return H.rsa.encrypt(p,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,pd,e,r)&&(t=w.fromDer(F.util.createBuffer(e.privateKey))),e={},r=[],!w.validate(t,yd,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,be(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.e)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.d)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.p)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.q)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.dP)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.dQ)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.qInv))])};H.publicKeyFromAsn1=function(t){var e={},r=[];if(w.validate(t,xd,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,gd,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,be(t.n)),w.create(w.Class.UNIVERSAL,w.Type.INTEGER,!1,be(t.e))])};function A0(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 zn(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 bd(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 be(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 b0(t){return F.util.isNodejs&&typeof wo[t]=="function"}function w0(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 E0(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 S0(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 D0=ct((Ig,L0)=>{var U=ft();lo();on();Ua();ar();Cn();Va();Ha();sn();r0();Hn();Et();typeof T0>"u"&&(T0=U.jsbn.BigInteger);var T0,B=U.asn1,$=U.pki=U.pki||{};L0.exports=$.pbe=U.pbe=U.pbe||{};var ur=$.oids,Ed={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"}]},Sd={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"}]}]},Bd={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"}]};$.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,f;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var c,u,l;switch(r.algorithm){case"aes128":s=16,c=16,u=ur["aes128-CBC"],l=U.aes.createEncryptionCipher;break;case"aes192":s=24,c=16,u=ur["aes192-CBC"],l=U.aes.createEncryptionCipher;break;case"aes256":s=32,c=16,u=ur["aes256-CBC"],l=U.aes.createEncryptionCipher;break;case"des":s=8,c=8,u=ur.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=_0(d),y=U.pkcs5.pbkdf2(e,n,i,s,h),g=U.random.getBytesSync(c),x=l(y);x.start(g),x.update(B.toDer(t)),x.finish(),f=x.output.getBytes();var m=Ad(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(ur.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(ur.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 b=new U.util.ByteBuffer(n),y=$.pbe.generatePkcs12Key(e,b,1,i,s),g=$.pbe.generatePkcs12Key(e,b,2,i,s),x=U.des.createEncryptionCipher(y);x.start(g),x.update(B.toDer(t)),x.finish(),f=x.output.getBytes(),a=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[B.create(B.Class.UNIVERSAL,B.Type.OID,!1,B.oidToDer(ur["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 R=B.create(B.Class.UNIVERSAL,B.Type.SEQUENCE,!0,[a,B.create(B.Class.UNIVERSAL,B.Type.OCTETSTRING,!1,f)]);return R};$.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!B.validate(t,Ed,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=$.pbe.getCipher(s,n.encryptionParams,e),f=U.util.createBuffer(n.encryptedData);return a.update(f),a.finish()&&(r=B.fromDer(a.output)),r};$.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:B.toDer(t).getBytes()};return U.pem.encode(r,{maxline:e})};$.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)};$.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=$.wrapRsaPrivateKey($.privateKeyToAsn1(t));return n=$.encryptPrivateKeyInfo(n,e,r),$.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(B.toDer($.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)};$.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=$.decryptPrivateKeyInfo(B.fromDer(r),e):r=B.fromDer(r),r!==null&&(r=$.privateKeyFromAsn1(r)),r};$.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 p=l.length(),d=e.length(),h=new U.util.ByteBuffer;h.fillWithByte(r,c);var y=c*Math.ceil(d/c),g=new U.util.ByteBuffer;for(a=0;a<y;a++)g.putByte(e.at(a%d));var x=c*Math.ceil(p/c),m=new U.util.ByteBuffer;for(a=0;a<x;a++)m.putByte(l.at(a%p));var b=g;b.putBuffer(m);for(var R=Math.ceil(i/f),E=1;E<=R;E++){var S=new U.util.ByteBuffer;S.putBytes(h.bytes()),S.putBytes(b.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<c;a++)D.putByte(S.at(a%f));var z=Math.ceil(d/c)+Math.ceil(p/c),q=new U.util.ByteBuffer;for(s=0;s<z;s++){var M=new U.util.ByteBuffer(b.getBytes(c)),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)}b=q,u.putBuffer(S)}return u.truncate(u.length()-i),u};$.pbe.getCipher=function(t,e,r){switch(t){case $.oids.pkcs5PBES2:return $.pbe.getCipherForPBES2(t,e,r);case $.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case $.oids["pbewithSHAAnd40BitRC2-CBC"]:return $.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}};$.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!B.validate(e,Sd,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!==$.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!==$.oids["aes128-CBC"]&&t!==$.oids["aes192-CBC"]&&t!==$.oids["aes256-CBC"]&&t!==$.oids["des-EDE3-CBC"]&&t!==$.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($.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=R0(n.prfOid),l=U.pkcs5.pbkdf2(r,s,a,f,u),p=n.encIv,d=c(l);return d.start(p),d};$.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!B.validate(e,Bd,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 $.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,c=8,u=U.des.startDecrypting;break;case $.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,c=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=R0(n.prfOid),p=$.pbe.generatePkcs12Key(r,s,1,a,f,l);l.start();var d=$.pbe.generatePkcs12Key(r,s,2,a,c,l);return u(p,d)};$.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=[C0(n,t+e)],o=16,s=1;o<r;++s,o+=16)i.push(C0(n,i[s-1]+t+e));return i.join("").substr(0,r)};function C0(t,e){return t.start().update(e).digest().getBytes()}function R0(t){var e;if(!t)e="hmacWithSHA1";else if(e=$.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 _0(e)}function _0(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 Ad(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($.oids[n]).getBytes()),B.create(B.Class.UNIVERSAL,B.Type.NULL,!1,"")])),i}});var bc=ct((Hm,vc)=>{var pt=ft();ar();Et();var yn=vc.exports=pt.sha512=pt.sha512||{};pt.md.sha512=pt.md.algorithms.sha512=yn;var xc=pt.sha384=pt.sha512.sha384=pt.sha512.sha384||{};xc.create=function(){return yn.create("SHA-384")};pt.md.sha384=pt.md.algorithms.sha384=xc;pt.sha512.sha256=pt.sha512.sha256||{create:function(){return yn.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 yn.create("SHA-512/224")}};pt.md["sha512/224"]=pt.md.algorithms["sha512/224"]=pt.sha512.sha224;yn.create=function(t){if(mc||$p(),typeof t>"u"&&(t="SHA-512"),!(t in xr))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=xr[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),gc(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(ts.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,f.putInt32(d>>>0),d=l>>>0;f.putInt32(d);for(var y=new Array(r.length),h=0;h<r.length;++h)y[h]=r[h].slice(0);gc(y,i,f);var g=pt.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 ts=null,mc=!1,es=null,xr=null;function $p(){ts="\x80",ts+=pt.util.fillString("\0",128),es=[[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]],xr={},xr["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],xr["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],xr["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],xr["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],mc=!0}function gc(t,e,r){for(var n,i,o,s,a,f,c,u,l,p,d,h,y,g,x,m,b,R,E,S,L,D,z,q,M,X,at,Nt,T,N,_,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],N=P[0],_=P[1],n=((N>>>19|_<<13)^(_>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|_>>>19)^(_<<3|N>>>29)^(N<<26|_>>>6))>>>0,O=e[T-15],N=O[0],_=O[1],o=((N>>>1|_<<31)^(N>>>8|_<<24)^N>>>7)>>>0,s=((N<<31|_>>>1)^(N<<24|_>>>8)^(N<<25|_>>>7))>>>0,A=e[T-7],K=e[T-16],_=i+A[1]+s+K[1],e[T][0]=n+A[0]+o+K[0]+(_/4294967296>>>0)>>>0,e[T][1]=_>>>0;for(y=t[0][0],g=t[0][1],x=t[1][0],m=t[1][1],b=t[2][0],R=t[2][1],E=t[3][0],S=t[3][1],L=t[4][0],D=t[4][1],z=t[5][0],q=t[5][1],M=t[6][0],X=t[6][1],at=t[7][0],Nt=t[7][1],T=0;T<80;++T)c=((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&(z^M))>>>0,p=(X^D&(q^X))>>>0,a=((y>>>28|g<<4)^(g>>>2|y<<30)^(g>>>7|y<<25))>>>0,f=((y<<4|g>>>28)^(g<<30|y>>>2)^(g<<25|y>>>7))>>>0,d=(y&x|b&(y^x))>>>0,h=(g&m|R&(g^m))>>>0,_=Nt+u+p+es[T][1]+e[T][1],n=at+c+l+es[T][0]+e[T][0]+(_/4294967296>>>0)>>>0,i=_>>>0,_=f+h,o=a+d+(_/4294967296>>>0)>>>0,s=_>>>0,at=M,Nt=X,M=z,X=q,z=L,q=D,_=S+i,L=E+n+(_/4294967296>>>0)>>>0,D=_>>>0,E=b,S=R,b=x,R=m,x=y,m=g,_=i+s,y=n+o+(_/4294967296>>>0)>>>0,g=_>>>0;_=t[0][1]+g,t[0][0]=t[0][0]+y+(_/4294967296>>>0)>>>0,t[0][1]=_>>>0,_=t[1][1]+m,t[1][0]=t[1][0]+x+(_/4294967296>>>0)>>>0,t[1][1]=_>>>0,_=t[2][1]+R,t[2][0]=t[2][0]+b+(_/4294967296>>>0)>>>0,t[2][1]=_>>>0,_=t[3][1]+S,t[3][0]=t[3][0]+E+(_/4294967296>>>0)>>>0,t[3][1]=_>>>0,_=t[4][1]+D,t[4][0]=t[4][0]+L+(_/4294967296>>>0)>>>0,t[4][1]=_>>>0,_=t[5][1]+q,t[5][0]=t[5][0]+z+(_/4294967296>>>0)>>>0,t[5][1]=_>>>0,_=t[6][1]+X,t[6][0]=t[6][0]+M+(_/4294967296>>>0)>>>0,t[6][1]=_>>>0,_=t[7][1]+Nt,t[7][0]=t[7][0]+at+(_/4294967296>>>0)>>>0,t[7][1]=_>>>0,V-=128}}});var xf=ct((G4,gf)=>{"use strict";function yf(t,e){for(let r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}function Z1(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 yf(t,r)}catch{r.message=t.message,r.stack=t.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(t)),yf(new i,r)}}gf.exports=Z1});var Sf=ct(En=>{(function(){var t,e,r,n,i,o,s,a;a=function(f){var c,u,l,p;return c=(f&255<<24)>>>24,u=(f&255<<16)>>>16,l=(f&65280)>>>8,p=f&255,[c,u,l,p].join(".")},s=function(f){var c,u,l,p,d,h;for(c=[],l=p=0;p<=3&&f.length!==0;l=++p){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,p,d;for(p=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)p=p*c+(r(f[l])-n)>>>0;else if(c===16)if("a"<=f[l]&&f[l]<="f")p=p*c+(10+r(f[l])-o)>>>0;else if("A"<=f[l]&&f[l]<="F")p=p*c+(10+r(f[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 f(c,u){var l,p,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(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(c)&this.maskLong)>>>0}catch(y){throw l=y,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,p;for(p=s(this.first),l=s(this.last),u=0;p<=l;)c(a(p),p,u),u++,p++},f.prototype.toString=function(){return this.base+"/"+this.bitmask},f}(),En.ip2long=s,En.long2ip=a,En.Netmask=t}).call(En)});var Tf=ct((If,Ai)=>{(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 y=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;)y++;if(d.substr(0,2)==="::"&&y--,d.substr(-2,2)==="::"&&y--,y>h)return null;for(b=h-y,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 R=d.split(":"),E=[];for(let S=0;S<R.length;S++)E.push(parseInt(R[S],16));return E}(),{parts:h,zoneId:x}}function c(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 c(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,b;for(x=3;x>=0;x-=1)if(m=this.octets[x],m in g){if(b=g[m],y&&b!==0)return null;b!==8&&(y=!0),h+=b}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 b=0;b<x.length;b++)y=x[b],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 c(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 b=7;b>=0;b-=1)if(x=this.parts[b],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(b){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${b})`)}},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,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])],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,b;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(b=m[g],d.kind()===b[0].kind()&&d.match.apply(d,b))return x}return y},typeof Ai<"u"&&Ai.exports?Ai.exports=p:t.ipaddr=p})(If)});var wy={};Rt(wy,{autoNAT:()=>by});var Sy=Symbol.for("@libp2p/connection");var Ay=Symbol.for("@libp2p/content-routing");var Cy=Symbol.for("@libp2p/peer-discovery");var Ws=Symbol.for("@libp2p/peer-id");var Ly=Symbol.for("@libp2p/peer-routing");var Ys;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(Ys||(Ys={}));var ky=Symbol.for("@libp2p/transport");var Zs;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(Zs||(Zs={}));var Y=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var Ci="ERR_TIMEOUT";var Ri=class extends Event{detail;constructor(e,r){super(e,r),this.detail=r?.detail}},Vy=globalThis.CustomEvent??Ri,_i=(t,...e)=>{try{[...e]}catch{}};var ki={};Rt(ki,{base58btc:()=>At,base58flickr:()=>tu});function Zf(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 y=0,g=0,x=0,m=h.length;x!==m&&h[x]===0;)x++,y++;for(var b=(m-x)*u+1>>>0,R=new Uint8Array(b);x!==m;){for(var E=h[x],S=0,L=b-1;(E!==0||S<g)&&L!==-1;L--,S++)E+=256*R[L]>>>0,R[L]=E%a>>>0,E=E/a>>>0;if(E!==0)throw new Error("Non-zero carry");g=S,x++}for(var D=b-g;D!==b&&R[D]===0;)D++;for(var z=f.repeat(y);D<b;++D)z+=t.charAt(R[D]);return z}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]===f;)g++,y++;for(var m=(h.length-y)*c+1>>>0,b=new Uint8Array(m);h[y];){var R=r[h.charCodeAt(y)];if(R===255)return;for(var E=0,S=m-1;(R!==0||E<x)&&S!==-1;S--,E++)R+=a*b[S]>>>0,b[S]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");x=E,y++}if(h[y]!==" "){for(var L=m-x;L!==m&&b[L]===0;)L++;for(var D=new Uint8Array(g+(m-L)),z=g;L!==m;)D[z++]=b[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 Qf=Zf,Xf=Qf,Qs=Xf;var d2=new Uint8Array(0);var Xs=(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},Se=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 Js=t=>new TextEncoder().encode(t),js=t=>new TextDecoder().decode(t);var Li=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")}},Di=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 ea(this,e)}},Pi=class{constructor(e){this.decoders=e}or(e){return ea(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`)}},ea=(t,e)=>new Pi({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}}),Ni=class{constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Li(e,r,n),this.decoder=new Di(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},wr=({name:t,prefix:e,encode:r,decode:n})=>new Ni(t,e,r,n),Me=({prefix:t,name:e,alphabet:r})=>{let{encode:n,decode:i}=Qs(r,e);return wr({prefix:t,name:e,encode:n,decode:o=>Se(i(o))})},Jf=(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},jf=(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},vt=({name:t,prefix:e,bitsPerChar:r,alphabet:n})=>wr({prefix:e,name:t,encode(i){return jf(i,n,r)},decode(i){return Jf(i,n,r,t)}});var At=Me({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),tu=Me({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ui={};Rt(Ui,{base10:()=>eu});var eu=Me({prefix:"9",name:"base10",alphabet:"0123456789"});var Oi={};Rt(Oi,{base16:()=>ru,base16upper:()=>nu});var ru=vt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nu=vt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ki={};Rt(Ki,{base2:()=>iu});var iu=vt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fi={};Rt(Fi,{base256emoji:()=>fu});var ra=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}"),ou=ra.reduce((t,e,r)=>(t[r]=e,t),[]),su=ra.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function au(t){return t.reduce((e,r)=>(e+=ou[r],e),"")}function cu(t){let e=[];for(let r of t){let n=su[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(n)}return new Uint8Array(e)}var fu=wr({prefix:"\u{1F680}",name:"base256emoji",encode:au,decode:cu});var Mi={};Rt(Mi,{base32:()=>Be,base32hex:()=>du,base32hexpad:()=>yu,base32hexpadupper:()=>gu,base32hexupper:()=>pu,base32pad:()=>lu,base32padupper:()=>hu,base32upper:()=>uu,base32z:()=>xu});var Be=vt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),uu=vt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),lu=vt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hu=vt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),du=vt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),pu=vt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yu=vt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gu=vt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),xu=vt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Vi={};Rt(Vi,{base36:()=>mu,base36upper:()=>vu});var mu=Me({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vu=Me({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var qi={};Rt(qi,{base64:()=>Bn,base64pad:()=>bu,base64url:()=>wu,base64urlpad:()=>Eu});var Bn=vt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bu=vt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wu=vt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Eu=vt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var zi={};Rt(zi,{base8:()=>Su});var Su=vt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Hi={};Rt(Hi,{identity:()=>Bu});var Bu=wr({prefix:"\0",name:"identity",encode:t=>js(t),decode:t=>Js(t)});var C2=new TextEncoder,R2=new TextDecoder;var Gi={};Rt(Gi,{identity:()=>Ve});var Tu=oa,na=128,Cu=127,Ru=~Cu,_u=Math.pow(2,31);function oa(t,e,r){e=e||[],r=r||0;for(var n=r;t>=_u;)e[r++]=t&255|na,t/=128;for(;t&Ru;)e[r++]=t&255|na,t>>>=7;return e[r]=t|0,oa.bytes=r-n+1,e}var Lu=$i,Du=128,ia=127;function $i(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw $i.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&ia)<<i:(s&ia)*Math.pow(2,i),i+=7}while(s>=Du);return $i.bytes=o-n,r}var Pu=Math.pow(2,7),Nu=Math.pow(2,14),ku=Math.pow(2,21),Uu=Math.pow(2,28),Ou=Math.pow(2,35),Ku=Math.pow(2,42),Fu=Math.pow(2,49),Mu=Math.pow(2,56),Vu=Math.pow(2,63),qu=function(t){return t<Pu?1:t<Nu?2:t<ku?3:t<Uu?4:t<Ou?5:t<Ku?6:t<Fu?7:t<Mu?8:t<Vu?9:10},zu={encode:Tu,decode:Lu,encodingLength:qu},Hu=zu,Xr=Hu;var Jr=(t,e=0)=>[Xr.decode(t,e),Xr.decode.bytes],Er=(t,e,r=0)=>(Xr.encode(t,e,r),e),Sr=t=>Xr.encodingLength(t);var pe=(t,e)=>{let r=e.byteLength,n=Sr(t),i=n+Sr(r),o=new Uint8Array(i+r);return Er(t,o,0),Er(r,o,n),o.set(e,i),new Br(t,r,e,o)},ir=t=>{let e=Se(t),[r,n]=Jr(e),[i,o]=Jr(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Br(r,i,s,e)},sa=(t,e)=>{if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Xs(t.bytes,r.bytes)}},Br=class{constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var aa=0,$u="identity",ca=Se,Gu=t=>pe(aa,ca(t)),Ve={code:aa,name:$u,encode:ca,digest:Gu};var Zi={};Rt(Zi,{sha256:()=>Ot,sha512:()=>Wu});var Yi=({name:t,code:e,encode:r})=>new Wi(t,e,r),Wi=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?pe(this.code,r):r.then(n=>pe(this.code,n))}else throw Error("Unknown type, must be binary type")}};var ua=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Ot=Yi({name:"sha2-256",code:18,encode:ua("SHA-256")}),Wu=Yi({name:"sha2-512",code:19,encode:ua("SHA-512")});var la=(t,e)=>{let{bytes:r,version:n}=t;switch(n){case 0:return Zu(r,Qi(t),e||At.encoder);default:return Qu(r,Qi(t),e||Be.encoder)}};var ha=new WeakMap,Qi=t=>{let e=ha.get(t);if(e==null){let r=new Map;return ha.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!==jr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Xu)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=pe(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&&sa(e.multihash,n.multihash)}toString(e){return la(this,e)}toJSON(){return{"/":la(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||da(n,i,o.bytes))}else if(r[Ju]===!0){let{version:n,multihash:i,code:o}=r,s=ir(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!==jr)throw new Error(`Version 0 CID must use dag-pb (code: ${jr}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=da(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,jr,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=Se(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 Br(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]=Jr(e.subarray(r));return r+=p,l},i=n(),o=jr;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]=Yu(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 Qi(o).set(n,e),o}},Yu=(t,e)=>{switch(t[0]){case"Q":{let r=e||At;return[At.prefix,r.decode(`${At.prefix}${t}`)]}case At.prefix:{let r=e||At;return[At.prefix,r.decode(t)]}case Be.prefix:{let r=e||Be;return[Be.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)]}}},Zu=(t,e,r)=>{let{prefix:n}=r;if(n!==At.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},Qu=(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},jr=112,Xu=18,da=(t,e,r)=>{let n=Sr(t),i=n+Sr(e),o=new Uint8Array(i+r.byteLength);return Er(t,o,0),Er(e,o,n),o.set(r,i),o},Ju=Symbol.for("@ipld/js-cid/CID");var qe={...Hi,...Ki,...zi,...Ui,...Oi,...Mi,...Vi,...ki,...qi,...Fi},$2={...Zi,...Gi};function Kt(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 ju=Symbol.for("nodejs.util.inspect.custom"),pa=Object.values(qe).map(t=>t.decoder).reduce((t,e)=>t.or(e),qe.identity.decoder),ya=114,Xi=36,Ji=37,tn=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()})`}[Ws]=!0;toString(){return this.string==null&&(this.string=At.encode(this.multihash.bytes).slice(1)),this.string}toCID(){return re.createV1(ya,this.multihash)}toBytes(){return this.multihash.bytes}toJSON(){return this.toString()}equals(e){if(e instanceof Uint8Array)return Kt(this.multihash.bytes,e);if(typeof e=="string")return tl(e).equals(this);if(e?.multihash?.bytes!=null)return Kt(this.multihash.bytes,e.multihash.bytes);throw new Error("not valid Id")}[ju](){return`PeerId(${this.toString()})`}},Ar=class extends tn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Ir=class extends tn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.multihash.digest}},Tr=class extends tn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.multihash.digest}};function tl(t,e){if(e=e??pa,t.charAt(0)==="1"||t.charAt(0)==="Q"){let r=ir(At.decode(`z${t}`));return t.startsWith("12D")?new Ir({multihash:r}):t.startsWith("16U")?new Tr({multihash:r}):new Ar({multihash:r})}return In(pa.decode(t))}function In(t){try{let e=ir(t);if(e.code===Ve.code){if(e.digest.length===Xi)return new Ir({multihash:e});if(e.digest.length===Ji)return new Tr({multihash:e})}if(e.code===Ot.code)return new Ar({multihash:e})}catch{return el(re.decode(t))}throw new Error("Supplied PeerID CID is invalid")}function el(t){if(t==null||t.multihash==null||t.version==null||t.version===1&&t.code!==ya)throw new Error("Supplied PeerID CID is invalid");let e=t.multihash;if(e.code===Ot.code)return new Ar({multihash:t.multihash});if(e.code===Ve.code){if(e.digest.length===Xi)return new Ir({multihash:t.multihash});if(e.digest.length===Ji)return new Tr({multihash:t.multihash})}throw new Error("Supplied PeerID CID is invalid")}async function ga(t,e){return t.length===Xi?new Ir({multihash:pe(Ve.code,t),privateKey:e}):t.length===Ji?new Tr({multihash:pe(Ve.code,t),privateKey:e}):new Ar({multihash:await Ot.digest(t),publicKey:t,privateKey:e})}var Xv=Mt(on(),1),Jv=Mt(D0(),1);var x1=Mt(ft(),1);function We(t){return globalThis.Buffer!=null?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Ce(t=0){return globalThis.Buffer?.alloc!=null?We(globalThis.Buffer.alloc(t)):new Uint8Array(t)}function Vt(t=0){return globalThis.Buffer?.allocUnsafe!=null?We(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function N0(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var P0=N0("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Eo=N0("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=Vt(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Id={utf8:P0,"utf-8":P0,hex:qe.base16,latin1:Eo,ascii:Eo,binary:Eo,...qe},$n=Id;function It(t,e="utf8"){let r=$n[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?We(globalThis.Buffer.from(t,"utf-8")):r.decoder.decode(`${r.prefix}${t}`)}var jo={};Rt(jo,{Ed25519PrivateKey:()=>gr,Ed25519PublicKey:()=>pn,generateKeyPair:()=>Vp,generateKeyPairFromSeed:()=>yc,unmarshalEd25519PrivateKey:()=>Fp,unmarshalEd25519PublicKey:()=>Mp});var Vg=Mt(Et(),1),qg=Mt(Vn(),1),k0=Mt(ft(),1);function Tt(t,e){if(globalThis.Buffer!=null)return We(globalThis.Buffer.concat(t,e));e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Vt(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return We(r)}function lt(t,e="utf8"){let r=$n[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=Tt([new Uint8Array(e-r.length),r])}return lt(r,"base64url")}function Qt(t){let e=U0(t);return new k0.default.jsbn.BigInteger(lt(e,"base16"),16)}function U0(t,e){let r=It(t,"base64urlpad");if(e!=null){if(r.length>e)throw new Error("byte array longer than desired length");r=Tt([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 O0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function So(t,...e){if(!(t instanceof Uint8Array))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 K0(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");O0(t.outputLen),O0(t.blockLen)}function Dr(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 F0(t,e){So(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Gn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var M0=t=>t instanceof Uint8Array;var Wn=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),se=(t,e)=>t<<32-e|t>>>e,Td=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Td)throw new Error("Non little-endian hardware is not supported");function Bo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function cn(t){if(typeof t=="string"&&(t=Bo(t)),!M0(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Yn(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!M0(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}var Pr=class{clone(){return this._cloneInto()}},Qg={}.toString;function Zn(t){let e=n=>t().update(cn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Nr(t=32){if(Gn&&typeof Gn.getRandomValues=="function")return Gn.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Cd(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 kr=class extends Pr{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=Wn(this.buffer)}update(e){Dr(this);let{view:r,buffer:n,blockLen:i}=this;e=cn(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=Wn(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){Dr(this),F0(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;Cd(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=Wn(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 Qn=BigInt(4294967295),Ao=BigInt(32);function V0(t,e=!1){return e?{h:Number(t&Qn),l:Number(t>>Ao&Qn)}:{h:Number(t>>Ao&Qn)|0,l:Number(t&Qn)|0}}function Rd(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}=V0(t[i],e);[r[i],n[i]]=[o,s]}return[r,n]}var _d=(t,e)=>BigInt(t>>>0)<<Ao|BigInt(e>>>0),Ld=(t,e,r)=>t>>>r,Dd=(t,e,r)=>t<<32-r|e>>>r,Pd=(t,e,r)=>t>>>r|e<<32-r,Nd=(t,e,r)=>t<<32-r|e>>>r,kd=(t,e,r)=>t<<64-r|e>>>r-32,Ud=(t,e,r)=>t>>>r-32|e<<64-r,Od=(t,e)=>e,Kd=(t,e)=>t,Fd=(t,e,r)=>t<<r|e>>>32-r,Md=(t,e,r)=>e<<r|t>>>32-r,Vd=(t,e,r)=>e<<r-32|t>>>64-r,qd=(t,e,r)=>t<<r-32|e>>>64-r;function zd(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var Hd=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),$d=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Gd=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Wd=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Yd=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Zd=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Qd={fromBig:V0,split:Rd,toBig:_d,shrSH:Ld,shrSL:Dd,rotrSH:Pd,rotrSL:Nd,rotrBH:kd,rotrBL:Ud,rotr32H:Od,rotr32L:Kd,rotlSH:Fd,rotlSL:Md,rotlBH:Vd,rotlBL:qd,add:zd,add3L:Hd,add3H:$d,add4L:Gd,add4H:Wd,add5H:Zd,add5L:Yd},G=Qd;var[Xd,Jd]=G.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))),Ye=new Uint32Array(80),Ze=new Uint32Array(80),Io=class extends kr{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:p,Gh:d,Gl:h,Hh:y,Hl:g}=this;return[e,r,n,i,o,s,a,f,c,u,l,p,d,h,y,g]}set(e,r,n,i,o,s,a,f,c,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=f|0,this.Eh=c|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 b=0;b<16;b++,r+=4)Ye[b]=e.getUint32(r),Ze[b]=e.getUint32(r+=4);for(let b=16;b<80;b++){let R=Ye[b-15]|0,E=Ze[b-15]|0,S=G.rotrSH(R,E,1)^G.rotrSH(R,E,8)^G.shrSH(R,E,7),L=G.rotrSL(R,E,1)^G.rotrSL(R,E,8)^G.shrSL(R,E,7),D=Ye[b-2]|0,z=Ze[b-2]|0,q=G.rotrSH(D,z,19)^G.rotrBH(D,z,61)^G.shrSH(D,z,6),M=G.rotrSL(D,z,19)^G.rotrBL(D,z,61)^G.shrSL(D,z,6),X=G.add4L(L,M,Ze[b-7],Ze[b-16]),at=G.add4H(X,S,q,Ye[b-7],Ye[b-16]);Ye[b]=at|0,Ze[b]=X|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:f,Dh:c,Dl:u,Eh:l,El:p,Fh:d,Fl:h,Gh:y,Gl:g,Hh:x,Hl:m}=this;for(let b=0;b<80;b++){let R=G.rotrSH(l,p,14)^G.rotrSH(l,p,18)^G.rotrBH(l,p,41),E=G.rotrSL(l,p,14)^G.rotrSL(l,p,18)^G.rotrBL(l,p,41),S=l&d^~l&y,L=p&h^~p&g,D=G.add5L(m,E,L,Jd[b],Ze[b]),z=G.add5H(D,x,R,S,Xd[b],Ye[b]),q=D|0,M=G.rotrSH(n,i,28)^G.rotrBH(n,i,34)^G.rotrBH(n,i,39),X=G.rotrSL(n,i,28)^G.rotrBL(n,i,34)^G.rotrBL(n,i,39),at=n&o^n&a^o&a,Nt=i&s^i&f^s&f;x=y|0,m=g|0,y=d|0,g=h|0,d=l|0,h=p|0,{h:l,l:p}=G.add(c|0,u|0,z|0,q|0),c=a|0,u=f|0,a=o|0,f=s|0,o=n|0,s=i|0;let T=G.add3L(q,X,Nt);n=G.add3H(T,z,M,at),i=T|0}({h:n,l:i}=G.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=G.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:f}=G.add(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=G.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:l,l:p}=G.add(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:h}=G.add(this.Fh|0,this.Fl|0,d|0,h|0),{h:y,l:g}=G.add(this.Gh|0,this.Gl|0,y|0,g|0),{h:x,l:m}=G.add(this.Hh|0,this.Hl|0,x|0,m|0),this.set(n,i,o,s,a,f,c,u,l,p,d,h,y,g,x,m)}roundClean(){Ye.fill(0),Ze.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 To=Zn(()=>new Io);var jn={};Rt(jn,{bitGet:()=>op,bitLen:()=>ip,bitMask:()=>fn,bitSet:()=>sp,bytesToHex:()=>Re,bytesToNumberBE:()=>_e,bytesToNumberLE:()=>Qe,concatBytes:()=>Le,createHmacDrbg:()=>_o,ensureBytes:()=>bt,equalBytes:()=>rp,hexToBytes:()=>lr,hexToNumber:()=>Ro,numberToBytesBE:()=>Xe,numberToBytesLE:()=>hr,numberToHexUnpadded:()=>H0,numberToVarBytesBE:()=>ep,utf8ToBytes:()=>np,validateObject:()=>we});var z0=BigInt(0),Xn=BigInt(1),jd=BigInt(2),Jn=t=>t instanceof Uint8Array,tp=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Re(t){if(!Jn(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=tp[t[r]];return e}function H0(t){let e=t.toString(16);return e.length&1?`0${e}`:e}function Ro(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function lr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);let e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let r=new Uint8Array(e/2);for(let n=0;n<r.length;n++){let i=n*2,o=t.slice(i,i+2),s=Number.parseInt(o,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");r[n]=s}return r}function _e(t){return Ro(Re(t))}function Qe(t){if(!Jn(t))throw new Error("Uint8Array expected");return Ro(Re(Uint8Array.from(t).reverse()))}function Xe(t,e){return lr(t.toString(16).padStart(e*2,"0"))}function hr(t,e){return Xe(t,e).reverse()}function ep(t){return lr(H0(t))}function bt(t,e,r){let n;if(typeof e=="string")try{n=lr(e)}catch(o){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`)}else if(Jn(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 Le(...t){let e=new Uint8Array(t.reduce((n,i)=>n+i.length,0)),r=0;return t.forEach(n=>{if(!Jn(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function rp(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function np(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ip(t){let e;for(e=0;t>z0;t>>=Xn,e+=1);return e}function op(t,e){return t>>BigInt(e)&Xn}var sp=(t,e,r)=>t|(r?Xn:z0)<<BigInt(e),fn=t=>(jd<<BigInt(t-1))-Xn,Co=t=>new Uint8Array(t),q0=t=>Uint8Array.from(t);function _o(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=Co(t),i=Co(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},a=(...l)=>r(i,n,...l),f=(l=Co())=>{i=a(q0([0]),l),n=a(),l.length!==0&&(i=a(q0([1]),l),n=a())},c=()=>{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 Le(...p)};return(l,p)=>{s(),f(l);let d;for(;!(d=p(c()));)f();return s(),d}}var ap={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"||t instanceof Uint8Array,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 we(t,e,r={}){let n=(i,o,s)=>{let a=ap[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 Ct=BigInt(0),gt=BigInt(1),dr=BigInt(2),cp=BigInt(3),Lo=BigInt(4),$0=BigInt(5),G0=BigInt(8),fp=BigInt(9),up=BigInt(16);function ut(t,e){let r=t%e;return r>=Ct?r:e+r}function lp(t,e,r){if(r<=Ct||e<Ct)throw new Error("Expected power/modulo > 0");if(r===gt)return Ct;let n=gt;for(;e>Ct;)e&gt&&(n=n*t%r),t=t*t%r,e>>=gt;return n}function xt(t,e,r){let n=t;for(;e-- >Ct;)n*=n,n%=r;return n}function ti(t,e){if(t===Ct||e<=Ct)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let r=ut(t,e),n=e,i=Ct,o=gt,s=gt,a=Ct;for(;r!==Ct;){let c=n/r,u=n%r,l=i-s*c,p=o-a*c;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==gt)throw new Error("invert: does not exist");return ut(i,e)}function hp(t){let e=(t-gt)/dr,r,n,i;for(r=t-gt,n=0;r%dr===Ct;r/=dr,n++);for(i=dr;i<t&&lp(i,e,t)!==t-gt;i++);if(n===1){let s=(t+gt)/Lo;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)/dr;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),p=a.pow(f,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<c&&!a.eql(y,a.ONE);d++)y=a.sqr(y);let h=a.pow(u,gt<<BigInt(c-d-1));u=a.sqr(h),l=a.mul(l,h),p=a.mul(p,u),c=d}return l}}function dp(t){if(t%Lo===cp){let e=(t+gt)/Lo;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%G0===$0){let e=(t-$0)/G0;return function(n,i){let o=n.mul(i,dr),s=n.pow(o,e),a=n.mul(i,s),f=n.mul(n.mul(a,dr),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%up,hp(t)}var W0=(t,e)=>(ut(t,e)&gt)===gt,pp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Do(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=pp.reduce((n,i)=>(n[i]="function",n),e);return we(t,r)}function yp(t,e,r){if(r<Ct)throw new Error("Expected power > 0");if(r===Ct)return t.ONE;if(r===gt)return e;let n=t.ONE,i=e;for(;r>Ct;)r&gt&&(n=t.mul(n,i)),i=t.sqr(i),r>>=gt;return n}function gp(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 Po(t,e){let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function ei(t,e,r=!1,n={}){if(t<=Ct)throw new Error(`Expected Field ORDER > 0, got ${t}`);let{nBitLength:i,nByteLength:o}=Po(t,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=dp(t),a=Object.freeze({ORDER:t,BITS:i,BYTES:o,MASK:fn(i),ZERO:Ct,ONE:gt,create:f=>ut(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return Ct<=f&&f<t},is0:f=>f===Ct,isOdd:f=>(f&gt)===gt,neg:f=>ut(-f,t),eql:(f,c)=>f===c,sqr:f=>ut(f*f,t),add:(f,c)=>ut(f+c,t),sub:(f,c)=>ut(f-c,t),mul:(f,c)=>ut(f*c,t),pow:(f,c)=>yp(a,f,c),div:(f,c)=>ut(f*ti(c,t),t),sqrN:f=>f*f,addN:(f,c)=>f+c,subN:(f,c)=>f-c,mulN:(f,c)=>f*c,inv:f=>ti(f,t),sqrt:n.sqrt||(f=>s(a,f)),invertBatch:f=>gp(a,f),cmov:(f,c,u)=>u?c:f,toBytes:f=>r?hr(f,o):Xe(f,o),fromBytes:f=>{if(f.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${f.length}`);return r?Qe(f):_e(f)}});return Object.freeze(a)}function Y0(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 Z0(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 No(t){let e=Z0(t);return e+Math.ceil(e/2)}function Q0(t,e,r=!1){let n=t.length,i=Z0(e),o=No(e);if(n<16||n<o||n>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);let s=r?_e(t):Qe(t),a=ut(s,e-gt)+gt;return r?hr(a,i):Xe(a,i)}var mp=BigInt(0),ko=BigInt(1);function ri(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>mp;)o&ko&&(s=s.add(a)),a=a.double(),o>>=ko;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 p=1;p<a;p++)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),p=2**i,d=BigInt(i);for(let h=0;h<a;h++){let y=h*f,g=Number(s&l);s>>=d,g>f&&(g-=p,s+=ko);let x=y,m=y+Math.abs(g)-1,b=h%2!==0,R=g<0;g===0?u=u.add(r(b,o[x])):c=c.add(r(R,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 un(t){return Do(t.Fp),we(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Po(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}var ae=BigInt(0),Xt=BigInt(1),ni=BigInt(2),vp=BigInt(8),bp={zip215:!0};function wp(t){let e=un(t);return we(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function ii(t){let e=wp(t),{Fp:r,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:f}=e,c=ni<<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:ae}}}),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"&&ae<P,y=(P,A)=>h(P)&&h(A)&&P<A,g=P=>P===ae||y(P,c);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===ae?P:x(P,n)}let b=new Map;function R(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,b.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),wt=u(rt*rt),mt=u(ot*A),kt=u(rt*u(mt+j)),Ut=u(wt+u(O*u(ot*j)));if(kt!==Ut)throw new Error("bad point: equation left != right (1)");let Bt=u(K*V),Ft=u(Z*J);if(Bt!==Ft)throw new Error("bad point: equation left != right (2)")}equals(A){R(A);let{ex:O,ey:K,ez:V}=this,{ex:Z,ey:J,ez:ot}=A,j=u(O*ot),rt=u(Z*V),wt=u(K*ot),mt=u(J*V);return j===rt&&wt===mt}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(ni*u(V*V)),j=u(A*Z),rt=O+K,wt=u(u(rt*rt)-Z-J),mt=j+J,kt=mt-ot,Ut=j-J,Bt=u(wt*kt),Ft=u(mt*Ut),Ee=u(wt*Ut),nr=u(kt*mt);return new E(Bt,Ft,nr,Ee)}add(A){R(A);let{a:O,d:K}=e,{ex:V,ey:Z,ez:J,et:ot}=this,{ex:j,ey:rt,ez:wt,et:mt}=A;if(O===BigInt(-1)){let Fs=u((Z-V)*(rt+j)),Ms=u((Z+V)*(rt-j)),Ti=u(Ms-Fs);if(Ti===ae)return this.double();let Vs=u(J*ni*mt),qs=u(ot*ni*wt),zs=qs+Vs,Hs=Ms+Fs,$s=qs-Vs,Ff=u(zs*Ti),Mf=u(Hs*$s),Vf=u(zs*$s),qf=u(Ti*Hs);return new E(Ff,Mf,qf,Vf)}let kt=u(V*j),Ut=u(Z*rt),Bt=u(ot*K*mt),Ft=u(J*wt),Ee=u((V+Z)*(j+rt)-kt-Ut),nr=Ft-Bt,Qr=Ft+Bt,Ks=u(Ut-O*kt),kf=u(Ee*nr),Uf=u(Qr*Ks),Of=u(Ee*Ks),Kf=u(nr*Qr);return new E(kf,Uf,Kf,Of)}subtract(A){return this.add(A.negate())}wNAF(A){return D.wNAFCached(this,b,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===ae?L:this.equals(L)||O===Xt?this:this.equals(S)?this.wNAF(O).p:D.unsafeLadder(this,O)}isSmallOrder(){return this.multiplyUnsafe(f).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?vp:r.inv(V));let J=u(O*A),ot=u(K*A),j=u(V*A);if(Z)return{x:ae,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=Qe(J);j===ae||(O?x(j,c):x(j,r.ORDER));let rt=u(j*j),wt=u(rt-Xt),mt=u(K*rt-V),{isValid:kt,value:Ut}=l(wt,mt);if(!kt)throw new Error("Point.fromHex: invalid y coordinate");let Bt=(Ut&Xt)===Xt,Ft=(ot&128)!==0;if(!O&&Ut===ae&&Ft)throw new Error("Point.fromHex: x=0 and x_0=1");return Ft!==Bt&&(Ut=u(-Ut)),E.fromAffine({x:Ut,y:j})}static fromPrivateKey(A){return M(A).point}toRawBytes(){let{x:A,y:O}=this.toAffine(),K=hr(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(ae,Xt,Xt,ae);let{BASE:S,ZERO:L}=E,D=ri(E,a*8);function z(P){return ut(P,n)}function q(P){return z(Qe(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=Le(...A);return q(o(d(O,bt("context",P),!!i)))}function Nt(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=z(J+j*V);m(rt);let wt=Le(ot,hr(rt,r.BYTES));return bt("result",wt,a*2)}let T=bp;function N(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=Qe(P.slice(J,2*J)),j,rt,wt;try{j=E.fromHex(O,Z),rt=E.fromHex(P.slice(0,J),Z),wt=S.multiplyUnsafe(ot)}catch{return!1}if(!Z&&j.isSmallOrder())return!1;let mt=at(V,rt.toRawBytes(),j.toRawBytes(),A);return rt.add(j.multiplyUnsafe(mt)).subtract(wt).clearCofactor().equals(E.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:X,sign:Nt,verify:N,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 Oo=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),X0=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mx=BigInt(0),Ep=BigInt(1),Uo=BigInt(2),Sp=BigInt(5),J0=BigInt(10),Bp=BigInt(20),Ap=BigInt(40),j0=BigInt(80);function Ip(t){let e=Oo,n=t*t%e*t%e,i=xt(n,Uo,e)*n%e,o=xt(i,Ep,e)*t%e,s=xt(o,Sp,e)*o%e,a=xt(s,J0,e)*s%e,f=xt(a,Bp,e)*a%e,c=xt(f,Ap,e)*f%e,u=xt(c,j0,e)*c%e,l=xt(u,j0,e)*c%e,p=xt(l,J0,e)*s%e;return{pow_p_5_8:xt(p,Uo,e)*t%e,b2:n}}function Tp(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}function Cp(t,e){let r=Oo,n=ut(e*e*e,r),i=ut(n*n*e,r),o=Ip(t*i).pow_p_5_8,s=ut(t*n*o,r),a=ut(e*s*s,r),f=s,c=ut(s*X0,r),u=a===t,l=a===ut(-t,r),p=a===ut(-t*X0,r);return u&&(s=f),(l||p)&&(s=c),W0(s,r)&&(s=ut(-s,r)),{isValid:u||l,value:s}}var De=ei(Oo,void 0,!0),Ko={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:De,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:To,randomBytes:Nr,adjustScalarBytes:Tp,uvRatio:Cp},Ur=ii(Ko);function tc(t,e,r){if(e.length>255)throw new Error("Context is too big");return Yn(Bo("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,e.length]),e,t)}var vx=ii({...Ko,domain:tc}),bx=ii({...Ko,domain:tc,prehash:To});var Rp=(De.ORDER+BigInt(3))/BigInt(8),wx=De.pow(Uo,Rp),Ex=De.sqrt(De.neg(De.ONE)),Sx=(De.ORDER-BigInt(5))/BigInt(8),Bx=BigInt(486662);var Ax=Y0(De,De.neg(BigInt(486664)));var Ix=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Tx=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),Cx=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Rx=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var _x=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Or=32,Pe=64,oi=32;function ec(){let t=Ur.utils.randomPrivateKey(),e=Ur.getPublicKey(t);return{privateKey:oc(t,e),publicKey:e}}function rc(t){if(t.length!==oi)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=Ur.getPublicKey(e);return{privateKey:oc(e,r),publicKey:r}}function nc(t,e){let r=t.subarray(0,oi);return Ur.sign(e instanceof Uint8Array?e:e.subarray(),r)}function ic(t,e,r){return Ur.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}function oc(t,e){let r=new Uint8Array(Pe);for(let n=0;n<oi;n++)r[n]=t[n],r[oi+n]=e[n];return r}var Wt={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 Fo={alg:"A128GCM",ext:!0,k:"scm9jmO_4BJAgdwWGVulLg",key_ops:["encrypt","decrypt"],kty:"oct"};function Mo(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=Wt.get();r*=8;async function f(l,p){let d=a.getRandomValues(new Uint8Array(o)),h=a.getRandomValues(new Uint8Array(n)),y={name:e,iv:h};typeof p=="string"&&(p=It(p));let g;if(p.length===0){g=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["encrypt"]);try{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}catch{g=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["encrypt"])}}else{let m={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},b=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);g=await a.subtle.deriveKey(m,b,{name:e,length:r},!0,["encrypt"])}let x=await a.subtle.encrypt(y,g,l);return Tt([d,y.iv,new Uint8Array(x)])}async function c(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=It(p));let x;if(p.length===0)try{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},R=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,R,{name:e,length:r},!0,["decrypt"])}catch{x=await a.subtle.importKey("jwk",Fo,{name:"AES-GCM"},!0,["decrypt"])}else{let b={name:"PBKDF2",salt:d,iterations:s,hash:{name:i}},R=await a.subtle.importKey("raw",p,{name:"PBKDF2"},!1,["deriveKey"]);x=await a.subtle.deriveKey(b,R,{name:e,length:r},!0,["decrypt"])}let m=await a.subtle.decrypt(g,x,y);return new Uint8Array(m)}return{encrypt:f,decrypt:c}}async function Kr(t,e){let n=await Mo().encrypt(t,e);return Bn.encode(n)}var Vo=new Float32Array([-0]),Je=new Uint8Array(Vo.buffer);function ac(t,e,r){Vo[0]=t,e[r]=Je[0],e[r+1]=Je[1],e[r+2]=Je[2],e[r+3]=Je[3]}function cc(t,e){return Je[0]=t[e],Je[1]=t[e+1],Je[2]=t[e+2],Je[3]=t[e+3],Vo[0]}var qo=new Float64Array([-0]),qt=new Uint8Array(qo.buffer);function fc(t,e,r){qo[0]=t,e[r]=qt[0],e[r+1]=qt[1],e[r+2]=qt[2],e[r+3]=qt[3],e[r+4]=qt[4],e[r+5]=qt[5],e[r+6]=qt[6],e[r+7]=qt[7]}function uc(t,e){return qt[0]=t[e],qt[1]=t[e+1],qt[2]=t[e+2],qt[3]=t[e+3],qt[4]=t[e+4],qt[5]=t[e+5],qt[6]=t[e+6],qt[7]=t[e+7],qo[0]}var Lp=BigInt(Number.MAX_SAFE_INTEGER),Dp=BigInt(Number.MIN_SAFE_INTEGER),Yt=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 pr;if(e<Lp&&e>Dp)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>lc&&(i=0n,++n>lc&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return pr;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):pr}},pr=new Yt(0,0);pr.toBigInt=function(){return 0n};pr.zzEncode=pr.zzDecode=function(){return this};pr.length=function(){return 1};var lc=4294967296n;function hc(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 dc(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 zo(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 si(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var Ho=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 si(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw ce(this,4);return si(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw ce(this,4);let e=cc(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw ce(this,4);let e=uc(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 dc(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 Yt(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=si(this.buf,this.pos+=4),r=si(this.buf,this.pos+=4);return new Yt(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 $o(t){return new Ho(t instanceof Uint8Array?t:t.subarray())}function fe(t,e){let r=$o(t);return e.decode(r)}function Go(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Vt(s);i+s>e&&(n=Vt(e),i=0);let a=n.subarray(i,i+=s);return i&7&&(i=(i|7)+1),a}}var yr=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Wo(){}var Zo=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Pp=Go();function Np(t){return globalThis.Buffer!=null?Vt(t):Pp(t)}var dn=class{len;head;tail;states;constructor(){this.len=0,this.head=new yr(Wo,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new yr(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Qo((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,Yt.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Yt.fromBigInt(e);return this._push(ln,r.length(),r)}uint64Number(e){let r=Yt.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=Yt.fromBigInt(e).zzEncode();return this._push(ln,r.length(),r)}sint64Number(e){let r=Yt.fromNumber(e).zzEncode();return this._push(ln,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Yo,1,e?1:0)}fixed32(e){return this._push(hn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Yt.fromBigInt(e);return this._push(hn,4,r.lo)._push(hn,4,r.hi)}fixed64Number(e){let r=Yt.fromNumber(e);return this._push(hn,4,r.lo)._push(hn,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(ac,4,e)}double(e){return this._push(fc,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(Yo,1,0):this.uint32(r)._push(Up,r,e)}string(e){let r=hc(e);return r!==0?this.uint32(r)._push(zo,r,e):this._push(Yo,1,0)}fork(){return this.states=new Zo(this),this.head=this.tail=new yr(Wo,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 yr(Wo,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=Np(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function Yo(t,e,r){e[r]=t&255}function kp(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var Qo=class extends yr{next;constructor(e,r){super(kp,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 hn(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 Up(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(dn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Op,e,t),this},dn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(Kp,e,t),this});function Op(t,e,r){e.set(t,r)}function Kp(t,e,r){t.length<40?zo(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(It(t),r)}function Xo(){return new dn}function ue(t,e){let r=Xo();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Fr;(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"})(Fr||(Fr={}));function ai(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function Mr(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 ai("enum",Fr.VARINT,r,n)}function le(t,e){return ai("message",Fr.LENGTH_DELIMITED,t,e)}var Pt;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.Secp256k1="Secp256k1"})(Pt||(Pt={}));var Jo;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.Secp256k1=2]="Secp256k1"})(Jo||(Jo={}));(function(t){t.codec=()=>Mr(Jo)})(Pt||(Pt={}));var Ne;(function(t){let e;t.codec=()=>(e==null&&(e=le((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.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=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>ue(r,t.codec()),t.decode=r=>fe(r,t.codec())})(Ne||(Ne={}));var ke;(function(t){let e;t.codec=()=>(e==null&&(e=le((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Pt.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=Pt.codec().decode(r);break;case 2:i.Data=r.bytes();break;default:r.skipType(s&7);break}}return i})),e),t.encode=r=>ue(r,t.codec()),t.decode=r=>fe(r,t.codec())})(ke||(ke={}));var pn=class{_key;constructor(e){this._key=Vr(e,Or)}verify(e,r){return ic(this._key,r,e)}marshal(){return this._key}get bytes(){return Ne.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},gr=class{_key;_publicKey;constructor(e,r){this._key=Vr(e,Pe),this._publicKey=Vr(r,Or)}sign(e){return nc(this._key,e)}get public(){return new pn(this._publicKey)}marshal(){return this._key}get bytes(){return ke.encode({Type:Pt.Ed25519,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}async id(){let e=Ve.digest(this.public.bytes);return At.encode(e.bytes).substring(1)}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Kr(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function Fp(t){if(t.length>Pe){t=Vr(t,Pe+Or);let n=t.subarray(0,Pe),i=t.subarray(Pe,t.length);return new gr(n,i)}t=Vr(t,Pe);let e=t.subarray(0,Pe),r=t.subarray(Or);return new gr(e,r)}function Mp(t){return t=Vr(t,Or),new pn(t)}async function Vp(){let{privateKey:t,publicKey:e}=ec();return new gr(t,e)}async function yc(t){let{privateKey:e,publicKey:r}=rc(t);return new gr(e,r)}function Vr(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Y(`Key must be a Uint8Array of length ${e}, got ${t.length}`,"ERR_INVALID_KEY_TYPE");return t}var qp={"P-256":256,"P-384":384,"P-521":521},zp=Object.keys(qp),Cm=zp.join(" / ");var is={};Rt(is,{MAX_KEY_SIZE:()=>mn,RsaPrivateKey:()=>qr,RsaPublicKey:()=>xn,fromJwk:()=>t1,generateKeyPair:()=>e1,unmarshalRsaPrivateKey:()=>Jp,unmarshalRsaPublicKey:()=>jp});var gn=Mt(ft(),1);var hv=Mt(bc(),1);function fi(t){if(isNaN(t)||t<=0)throw new Y("random bytes length must be a Number bigger than 0","ERR_INVALID_LENGTH");return Nr(t)}var Ym=Mt(Hn(),1),rs=Mt(ft(),1);function wc(t,e){return e.map(r=>Qt(t[r]))}function Ec(t){return rs.default.pki.setRsaPrivateKey(...wc(t,["n","e","d","p","q","dp","dq","qi"]))}function Sc(t){return rs.default.pki.setRsaPublicKey(...wc(t,["n","e"]))}var mr={};Rt(mr,{jwkToPkcs1:()=>Wp,jwkToPkix:()=>Zp,pkcs1ToJwk:()=>Gp,pkixToJwk:()=>Yp});var Xm=Mt(on(),1),Jm=Mt(Hn(),1);var Ue=Mt(ft(),1);function Gp(t){let e=Ue.default.asn1.fromDer(lt(t,"ascii")),r=Ue.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 Wp(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 Y("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Ue.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 It(Ue.default.asn1.toDer(e).getBytes(),"ascii")}function Yp(t){let e=Ue.default.asn1.fromDer(lt(t,"ascii")),r=Ue.default.pki.publicKeyFromAsn1(e);return{kty:"RSA",n:oe(r.n),e:oe(r.e)}}function Zp(t){if(t.n==null||t.e==null)throw new Y("JWK was missing components","ERR_INVALID_PARAMETERS");let e=Ue.default.pki.publicKeyToAsn1({n:Qt(t.n),e:Qt(t.e)});return It(Ue.default.asn1.toDer(e).getBytes(),"ascii")}async function Bc(t){let e=await Wt.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 Tc(e);return{privateKey:r[0],publicKey:r[1]}}async function ns(t){let r=[await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await Qp(t)],n=await Tc({privateKey:r[0],publicKey:r[1]});return{privateKey:n[0],publicKey:n[1]}}async function Ac(t,e){let r=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),n=await Wt.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,e instanceof Uint8Array?e:e.subarray());return new Uint8Array(n,0,n.byteLength)}async function Ic(t,e,r){let n=await Wt.get().subtle.importKey("jwk",t,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return Wt.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},n,e,r instanceof Uint8Array?r:r.subarray())}async function Tc(t){if(t.privateKey==null||t.publicKey==null)throw new Y("Private and public key are required","ERR_INVALID_PARAMETERS");return Promise.all([Wt.get().subtle.exportKey("jwk",t.privateKey),Wt.get().subtle.exportKey("jwk",t.publicKey)])}async function Qp(t){return Wt.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 Cc(t,e,r,n){let i=e?Sc(t):Ec(t),o=lt(r instanceof Uint8Array?r:r.subarray(),"ascii"),s=n(o,i);return It(s,"ascii")}function Rc(t,e){return Cc(t,!0,e,(r,n)=>n.encrypt(r))}function _c(t,e){return Cc(t,!1,e,(r,n)=>n.decrypt(r))}function ui(t){if(t.kty!=="RSA")throw new Y("invalid key type","ERR_INVALID_KEY_TYPE");if(t.n==null)throw new Y("invalid key modulus","ERR_INVALID_KEY_MODULUS");return It(t.n,"base64url").length*8}var mn=8192,xn=class{_key;constructor(e){this._key=e}verify(e,r){return Ic(this._key,r,e)}marshal(){return mr.jwkToPkix(this._key)}get bytes(){return Ne.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}encrypt(e){return Rc(this._key,e)}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}},qr=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r}genSecret(){return fi(16)}sign(e){return Ac(this._key,e)}get public(){if(this._publicKey==null)throw new Y("public key not provided","ERR_PUBKEY_NOT_PROVIDED");return new xn(this._publicKey)}decrypt(e){return _c(this._key,e)}marshal(){return mr.jwkToPkcs1(this._key)}get bytes(){return ke.encode({Type:Pt.RSA,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="pkcs-8"){if(r==="pkcs-8"){let n=new gn.default.util.ByteBuffer(this.marshal()),i=gn.default.asn1.fromDer(n),o=gn.default.pki.privateKeyFromAsn1(i),s={algorithm:"aes256",count:1e4,saltSize:128/8,prfAlgorithm:"sha512"};return gn.default.pki.encryptRsaPrivateKey(o,e,s)}else{if(r==="libp2p-key")return Kr(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}}};async function Jp(t){let e=mr.pkcs1ToJwk(t);if(ui(e)>mn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let r=await ns(e);return new qr(r.privateKey,r.publicKey)}function jp(t){let e=mr.pkixToJwk(t);if(ui(e)>mn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");return new xn(e)}async function t1(t){if(ui(t)>mn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await ns(t);return new qr(e.privateKey,e.publicKey)}async function e1(t){if(t>mn)throw new Y("key size is too large","ERR_KEY_SIZE_TOO_LARGE");let e=await Bc(t);return new qr(e.privateKey,e.publicKey)}var us={};Rt(us,{Secp256k1PrivateKey:()=>bn,Secp256k1PublicKey:()=>vn,generateKeyPair:()=>g1,unmarshalSecp256k1PrivateKey:()=>p1,unmarshalSecp256k1PublicKey:()=>y1});var r1=(t,e,r)=>t&e^~t&r,n1=(t,e,r)=>t&e^t&r^e&r,i1=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]),je=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),tr=new Uint32Array(64),os=class extends kr{constructor(){super(64,32,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[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)tr[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=tr[l-15],d=tr[l-2],h=se(p,7)^se(p,18)^p>>>3,y=se(d,17)^se(d,19)^d>>>10;tr[l]=y+tr[l-7]+h+tr[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 p=se(a,6)^se(a,11)^se(a,25),d=u+p+r1(a,f,c)+i1[l]+tr[l]|0,y=(se(n,2)^se(n,13)^se(n,22))+n1(n,i,o)|0;u=c,c=f,f=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,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(){tr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Lc=Zn(()=>new os);function o1(t){let e=un(t);we(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:s1,hexToBytes:a1}=jn,vr={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){let{Err:e}=vr;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:s1(n),l:t.subarray(r+2)}},toSig(t){let{Err:e}=vr,r=typeof t=="string"?a1(t):t;if(!(r instanceof Uint8Array))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}=vr._parseInt(r.subarray(2)),{d:s,l:a}=vr._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}`}},Oe=BigInt(0),ee=BigInt(1),Ev=BigInt(2),Dc=BigInt(3),Sv=BigInt(4);function c1(t){let e=o1(t),{Fp:r}=e,n=e.toBytes||((h,y,g)=>{let x=y.toAffine();return Le(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"&&Oe<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:y,nByteLength:g,wrapPrivateKey:x,n:m}=e;if(y&&typeof h!="bigint"){if(h instanceof Uint8Array&&(h=Re(h)),typeof h!="string"||!y.includes(h.length))throw new Error("Invalid key");h=h.padStart(g*2,"0")}let b;try{b=typeof h=="bigint"?h:_e(bt("private key",h,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof h}`)}return x&&(b=ut(b,m)),a(b),b}let c=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=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(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(f(y))}_setWindowSize(y){this._WINDOW_SIZE=y,c.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:b,py:R,pz:E}=y,S=r.eql(r.mul(g,E),r.mul(b,m)),L=r.eql(r.mul(x,E),r.mul(R,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,Dc),{px:m,py:b,pz:R}=this,E=r.ZERO,S=r.ZERO,L=r.ZERO,D=r.mul(m,m),z=r.mul(b,b),q=r.mul(R,R),M=r.mul(m,b);return M=r.add(M,M),L=r.mul(m,R),L=r.add(L,L),E=r.mul(y,L),S=r.mul(x,q),S=r.add(E,S),E=r.sub(z,S),S=r.add(z,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(b,R),q=r.add(q,q),D=r.mul(q,M),E=r.sub(E,D),L=r.mul(q,z),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:b,py:R,pz:E}=y,S=r.ZERO,L=r.ZERO,D=r.ZERO,z=e.a,q=r.mul(e.b,Dc),M=r.mul(g,b),X=r.mul(x,R),at=r.mul(m,E),Nt=r.add(g,x),T=r.add(b,R);Nt=r.mul(Nt,T),T=r.add(M,X),Nt=r.sub(Nt,T),T=r.add(g,m);let N=r.add(b,E);return T=r.mul(T,N),N=r.add(M,at),T=r.sub(T,N),N=r.add(x,m),S=r.add(R,E),N=r.mul(N,S),S=r.add(X,at),N=r.sub(N,S),D=r.mul(z,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(z,at),T=r.mul(q,T),X=r.add(X,at),at=r.sub(M,at),at=r.mul(z,at),T=r.add(T,at),M=r.mul(X,T),L=r.add(L,M),M=r.mul(N,T),S=r.mul(Nt,S),S=r.sub(S,M),M=r.mul(Nt,X),D=r.mul(N,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,c,y,g=>{let x=r.invertBatch(g.map(m=>m.pz));return g.map((m,b)=>m.toAffine(x[b])).map(l.fromAffine)})}multiplyUnsafe(y){let g=l.ZERO;if(y===Oe)return g;if(a(y),y===ee)return this;let{endo:x}=e;if(!x)return d.unsafeLadder(this,y);let{k1neg:m,k1:b,k2neg:R,k2:E}=x.splitScalar(y),S=g,L=g,D=this;for(;b>Oe||E>Oe;)b&ee&&(S=S.add(D)),E&ee&&(L=L.add(D)),D=D.double(),b>>=ee,E>>=ee;return m&&(S=S.negate()),R&&(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:b}=e;if(b){let{k1neg:R,k1:E,k2neg:S,k2:L}=b.splitScalar(g),{p:D,f:z}=this.wNAF(E),{p:q,f:M}=this.wNAF(L);D=d.constTimeNegate(R,D),q=d.constTimeNegate(S,q),q=new l(r.mul(q.px,b.beta),q.py,q.pz),x=D.add(q),m=z.add(M)}else{let{p:R,f:E}=this.wNAF(g);x=R,m=E}return l.normalizeZ([x,m])[0]}multiplyAndAddUnsafe(y,g,x){let m=l.BASE,b=(E,S)=>S===Oe||S===ee||!E.equals(m)?E.multiplyUnsafe(S):E.multiply(S),R=b(this,g).add(b(y,x));return R.is0()?void 0:R}toAffine(y){let{px:g,py:x,pz:m}=this,b=this.is0();y==null&&(y=b?r.ONE:r.inv(m));let R=r.mul(g,y),E=r.mul(x,y),S=r.mul(m,y);if(b)return{x:r.ZERO,y:r.ZERO};if(!r.eql(S,r.ONE))throw new Error("invZ was invalid");return{x:R,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=ri(l,e.endo?Math.ceil(p/2):p);return{CURVE:e,ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:o,isWithinCurveOrder:s}}function f1(t){let e=un(t);return we(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Pc(t){let e=f1(t),{Fp:r,n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(T){return Oe<T&&T<r.ORDER}function a(T){return ut(T,n)}function f(T){return ti(T,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:p}=c1({...e,toBytes(T,N,_){let P=N.toAffine(),A=r.toBytes(P.x),O=Le;return _?O(Uint8Array.from([N.hasEvenY()?2:3]),A):O(Uint8Array.from([4]),A,r.toBytes(P.y))},fromBytes(T){let N=T.length,_=T[0],P=T.subarray(1);if(N===i&&(_===2||_===3)){let A=_e(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(_&1)===1!==V&&(K=r.neg(K)),{x:A,y:K}}else if(N===o&&_===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 ${N} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),d=T=>Re(Xe(T,e.nByteLength));function h(T){let N=n>>ee;return T>N}function y(T){return h(T)?a(-T):T}let g=(T,N,_)=>_e(T.slice(N,_));class x{constructor(N,_,P){this.r=N,this.s=_,this.recovery=P,this.assertValidity()}static fromCompact(N){let _=e.nByteLength;return N=bt("compactSignature",N,_*2),new x(g(N,0,_),g(N,_,2*_))}static fromDER(N){let{r:_,s:P}=vr.toSig(bt("DER",N));return new x(_,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(N){return new x(this.r,this.s,N)}recoverPublicKey(N){let{r:_,s:P,recovery:A}=this,O=L(bt("msgHash",N));if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");let K=A===2||A===3?_+e.n:_;if(K>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");let V=A&1?"03":"02",Z=c.fromHex(V+d(K)),J=f(K),ot=a(-O*J),j=a(P*J),rt=c.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 lr(this.toDERHex())}toDERHex(){return vr.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return lr(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=No(e.n);return Q0(e.randomBytes(T),e.n)},precompute(T=8,N=c.BASE){return N._setWindowSize(T),N.multiply(BigInt(3)),N}};function b(T,N=!0){return c.fromPrivateKey(T).toRawBytes(N)}function R(T){let N=T instanceof Uint8Array,_=typeof T=="string",P=(N||_)&&T.length;return N?P===i||P===o:_?P===2*i||P===2*o:T instanceof c}function E(T,N,_=!0){if(R(T))throw new Error("first arg must be private key");if(!R(N))throw new Error("second arg must be public key");return c.fromHex(N).multiply(u(T)).toRawBytes(_)}let S=e.bits2int||function(T){let N=_e(T),_=T.length*8-e.nBitLength;return _>0?N>>BigInt(_):N},L=e.bits2int_modN||function(T){return a(S(T))},D=fn(e.nBitLength);function z(T){if(typeof T!="bigint")throw new Error("bigint expected");if(!(Oe<=T&&T<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Xe(T,e.nByteLength)}function q(T,N,_=M){if(["recovered","canonical"].some(mt=>mt in _))throw new Error("sign() legacy options not supported");let{hash:P,randomBytes:A}=e,{lowS:O,prehash:K,extraEntropy:V}=_;O==null&&(O=!0),T=bt("msgHash",T),K&&(T=bt("prehashed msgHash",P(T)));let Z=L(T),J=u(N),ot=[z(J),z(Z)];if(V!=null){let mt=V===!0?A(r.BYTES):V;ot.push(bt("extraEntropy",mt))}let j=Le(...ot),rt=Z;function wt(mt){let kt=S(mt);if(!p(kt))return;let Ut=f(kt),Bt=c.BASE.multiply(kt).toAffine(),Ft=a(Bt.x);if(Ft===Oe)return;let Ee=a(Ut*a(rt+Ft*J));if(Ee===Oe)return;let nr=(Bt.x===Ft?0:2)|Number(Bt.y&ee),Qr=Ee;return O&&h(Ee)&&(Qr=y(Ee),nr^=1),new x(Ft,Qr,nr)}return{seed:j,k2sig:wt}}let M={lowS:e.lowS,prehash:!1},X={lowS:e.lowS,prehash:!1};function at(T,N,_=M){let{seed:P,k2sig:A}=q(T,N,_),O=e;return _o(O.hash.outputLen,O.nByteLength,O.hmac)(P,A)}c.BASE._setWindowSize(8);function Nt(T,N,_,P=X){let A=T;if(N=bt("msgHash",N),_=bt("publicKey",_),"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"||A instanceof Uint8Array)try{V=x.fromDER(A)}catch(Bt){if(!(Bt instanceof vr.Err))throw Bt;V=x.fromCompact(A)}else if(typeof A=="object"&&typeof A.r=="bigint"&&typeof A.s=="bigint"){let{r:Bt,s:Ft}=A;V=new x(Bt,Ft)}else throw new Error("PARSE");Z=c.fromHex(_)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(O&&V.hasHighS())return!1;K&&(N=e.hash(N));let{r:J,s:ot}=V,j=L(N),rt=f(ot),wt=a(j*rt),mt=a(J*rt),kt=c.BASE.multiplyAndAddUnsafe(Z,wt,mt)?.toAffine();return kt?a(kt.x)===J:!1}return{CURVE:e,getPublicKey:b,getSharedSecret:E,sign:at,verify:Nt,ProjectivePoint:c,Signature:x,utils:m}}var li=class extends Pr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,K0(e);let n=cn(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 Dr(this),this.iHash.update(e),this}digestInto(e){Dr(this),So(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()}},ss=(t,e,r)=>new li(t,e).update(r).digest();ss.create=(t,e)=>new li(t,e);function u1(t){return{hash:t,hmac:(e,...r)=>ss(t,e,Yn(...r)),randomBytes:Nr}}function Nc(t,e){let r=n=>Pc({...t,...u1(n)});return Object.freeze({...r(e),create:r})}var Oc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),kc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l1=BigInt(1),as=BigInt(2),Uc=(t,e)=>(t+e/as)/e;function h1(t){let e=Oc,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,p=xt(l,r,e)*u%e,d=xt(p,as,e)*c%e,h=xt(d,i,e)*d%e,y=xt(h,o,e)*h%e,g=xt(y,a,e)*y%e,x=xt(g,f,e)*g%e,m=xt(x,a,e)*y%e,b=xt(m,r,e)*u%e,R=xt(b,s,e)*h%e,E=xt(R,n,e)*c%e,S=xt(E,as,e);if(!cs.eql(cs.sqr(S),t))throw new Error("Cannot find square root");return S}var cs=ei(Oc,void 0,void 0,{sqrt:h1}),he=Nc({a:BigInt(0),b:BigInt(7),Fp:cs,n:kc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=kc,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-l1*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Uc(o*t,e),f=Uc(-n*t,e),c=ut(t-a*r-f*i,e),u=ut(-a*n-f*o,e),l=c>s,p=u>s;if(l&&(c=e-c),p&&(u=e-u),c>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:p,k2:u}}}},Lc),kv=BigInt(0);var Uv=he.ProjectivePoint;function Kc(){return he.utils.randomPrivateKey()}function Fc(t,e){let r=Ot.digest(e instanceof Uint8Array?e:e.subarray());if(te(r))return r.then(({digest:n})=>he.sign(n,t).toDERRawBytes()).catch(n=>{throw new Y(String(n),"ERR_INVALID_INPUT")});try{return he.sign(r.digest,t).toDERRawBytes()}catch(n){throw new Y(String(n),"ERR_INVALID_INPUT")}}function Mc(t,e,r){let n=Ot.digest(r instanceof Uint8Array?r:r.subarray());if(te(n))return n.then(({digest:i})=>he.verify(e,i,t)).catch(i=>{throw new Y(String(i),"ERR_INVALID_INPUT")});try{return he.verify(e,n.digest,t)}catch(i){throw new Y(String(i),"ERR_INVALID_INPUT")}}function Vc(t){return he.ProjectivePoint.fromHex(t).toRawBytes(!0)}function qc(t){try{he.getPublicKey(t,!0)}catch(e){throw new Y(String(e),"ERR_INVALID_PRIVATE_KEY")}}function fs(t){try{he.ProjectivePoint.fromHex(t)}catch(e){throw new Y(String(e),"ERR_INVALID_PUBLIC_KEY")}}function zc(t){try{return he.getPublicKey(t,!0)}catch(e){throw new Y(String(e),"ERR_INVALID_PRIVATE_KEY")}}var vn=class{_key;constructor(e){fs(e),this._key=e}verify(e,r){return Mc(this._key,r,e)}marshal(){return Vc(this._key)}get bytes(){return Ne.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}async hash(){let e=Ot.digest(this.bytes),r;return te(e)?{bytes:r}=await e:r=e.bytes,r}},bn=class{_key;_publicKey;constructor(e,r){this._key=e,this._publicKey=r??zc(e),qc(this._key),fs(this._publicKey)}sign(e){return Fc(this._key,e)}get public(){return new vn(this._publicKey)}marshal(){return this._key}get bytes(){return ke.encode({Type:Pt.Secp256k1,Data:this.marshal()}).subarray()}equals(e){return Kt(this.bytes,e.bytes)}hash(){let e=Ot.digest(this.bytes);return te(e)?e.then(({bytes:r})=>r):e.bytes}async id(){let e=await this.public.hash();return lt(e,"base58btc")}async export(e,r="libp2p-key"){if(r==="libp2p-key")return Kr(this.bytes,e);throw new Y(`export format '${r}' is not supported`,"ERR_INVALID_EXPORT_FORMAT")}};function p1(t){return new bn(t)}function y1(t){return new vn(t)}async function g1(){let t=Kc();return new bn(t)}var Hc={rsa:is,ed25519:jo,secp256k1:us};function m1(t){let e=Object.keys(Hc).join(" / ");return new Y(`invalid or unsupported key type ${t}. Must be ${e}`,"ERR_UNSUPPORTED_KEY_TYPE")}function ls(t){if(t=t.toLowerCase(),t==="rsa"||t==="ed25519"||t==="secp256k1")return Hc[t];throw m1(t)}async function $c(t,e){return ls(t).generateKeyPair(e??2048)}function Gc(t,e){return e=(e??"rsa").toLowerCase(),ls(e),t.bytes}function Wc(t,e){return e=(e??"rsa").toLowerCase(),ls(e),t.bytes}var hs;(function(t){let e;t.codec=()=>(e==null&&(e=le((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=>ue(r,t.codec()),t.decode=r=>fe(r,t.codec())})(hs||(hs={}));var Yc=async()=>{let t=await $c("Ed25519"),e=await v1(t);if(e.type==="Ed25519")return e;throw new Error(`Generated unexpected PeerId type "${e.type}"`)};async function v1(t){return ga(Gc(t.public),Wc(t))}var hi=class extends Error{code;props;constructor(e,r,n){super(e),this.code=r,this.name=n?.name??"CodeError",this.props=n??{}}};var b1=Math.pow(2,7),w1=Math.pow(2,14),E1=Math.pow(2,21),ds=Math.pow(2,28),ps=Math.pow(2,35),ys=Math.pow(2,42),gs=Math.pow(2,49),it=128,zt=127;function Zt(t){if(t<b1)return 1;if(t<w1)return 2;if(t<E1)return 3;if(t<ds)return 4;if(t<ps)return 5;if(t<ys)return 6;if(t<gs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function S1(t,e,r=0){switch(Zt(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 B1(t,e,r=0){switch(Zt(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 A1(t,e){let r=t[e],n=0;if(n+=r&zt,r<it||(r=t[e+1],n+=(r&zt)<<7,r<it)||(r=t[e+2],n+=(r&zt)<<14,r<it)||(r=t[e+3],n+=(r&zt)<<21,r<it)||(r=t[e+4],n+=(r&zt)*ds,r<it)||(r=t[e+5],n+=(r&zt)*ps,r<it)||(r=t[e+6],n+=(r&zt)*ys,r<it)||(r=t[e+7],n+=(r&zt)*gs,r<it))return n;throw new RangeError("Could not decode varint")}function I1(t,e){let r=t.get(e),n=0;if(n+=r&zt,r<it||(r=t.get(e+1),n+=(r&zt)<<7,r<it)||(r=t.get(e+2),n+=(r&zt)<<14,r<it)||(r=t.get(e+3),n+=(r&zt)<<21,r<it)||(r=t.get(e+4),n+=(r&zt)*ds,r<it)||(r=t.get(e+5),n+=(r&zt)*ps,r<it)||(r=t.get(e+6),n+=(r&zt)*ys,r<it)||(r=t.get(e+7),n+=(r&zt)*gs,r<it))return n;throw new RangeError("Could not decode varint")}function er(t,e,r=0){return e==null&&(e=Vt(Zt(t))),e instanceof Uint8Array?S1(t,e,r):B1(t,e,r)}function Ke(t,e=0){return t instanceof Uint8Array?A1(t,e):I1(t,e)}var pi=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 p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});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 Zc=45,T1=15,zr=new pi;function xs(t){if(!(t.length>T1))return zr.new(t).parseWith(()=>zr.readIPv4Addr())}function ms(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Zc))return zr.new(t).parseWith(()=>zr.readIPv6Addr())}function yi(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Zc))return zr.new(t).parseWith(()=>zr.readIPAddr())}var Ab=parseInt("0xFFFF",16),Ib=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);function Jc(t){return!!xs(t)}function jc(t){return!!ms(t)}function Hr(t){return!!yi(t)}var tf=Jc,D1=jc,vs=function(t){let e=0;if(t=t.toString().trim(),tf(t)){let r=new Uint8Array(e+4);return t.split(/\./g).forEach(n=>{r[e++]=parseInt(n,10)&255}),r}if(D1(t)){let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=tf(r[n]),s;o&&(s=vs(r[n]),r[n]=lt(s.slice(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,lt(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")},ef=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 $r={},bs={},N1=[[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"]];N1.forEach(t=>{let e=k1(...t);bs[e.code]=e,$r[e.name]=e});function k1(t,e,r,n,i){return{code:t,size:e,name:r,resolvable:!!n,path:!!i}}function st(t){if(typeof t=="number"){if(bs[t]!=null)return bs[t];throw new Error(`no protocol with code: ${t}`)}else if(typeof t=="string"){if($r[t]!=null)return $r[t];throw new Error(`no protocol with name: ${t}`)}throw new Error(`invalid protocol id type: ${typeof t}`)}var f4=st("ip4"),u4=st("ip6"),l4=st("ipcidr");function Es(t,e){switch(st(t).code){case 4:case 41:return O1(e);case 42:return of(e);case 6:case 273:case 33:case 132:return af(e).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return of(e);case 421:return V1(e);case 444:return sf(e);case 445:return sf(e);case 466:return M1(e);default:return lt(e,"base16")}}function Ss(t,e){switch(st(t).code){case 4:return rf(e);case 41:return rf(e);case 42:return nf(e);case 6:case 273:case 33:case 132:return Bs(parseInt(e,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return nf(e);case 421:return K1(e);case 444:return q1(e);case 445:return z1(e);case 466:return F1(e);default:return It(e,"base16")}}var ws=Object.values(qe).map(t=>t.decoder),U1=function(){let t=ws[0].or(ws[1]);return ws.slice(2).forEach(e=>t=t.or(e)),t}();function rf(t){if(!Hr(t))throw new Error("invalid ip address");return vs(t)}function O1(t){let e=ef(t,0,t.length);if(e==null)throw new Error("ipBuff is required");if(!Hr(e))throw new Error("invalid ip address");return e}function Bs(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,t),new Uint8Array(e)}function af(t){return new DataView(t.buffer).getUint16(t.byteOffset)}function nf(t){let e=It(t),r=Uint8Array.from(er(e.length));return Tt([r,e],r.length+e.length)}function of(t){let e=Ke(t);if(t=t.slice(Zt(e)),t.length!==e)throw new Error("inconsistent lengths");return lt(t)}function K1(t){let e;t[0]==="Q"||t[0]==="1"?e=ir(At.decode(`z${t}`)).bytes:e=re.parse(t).multihash.bytes;let r=Uint8Array.from(er(e.length));return Tt([r,e],r.length+e.length)}function F1(t){let e=U1.decode(t),r=Uint8Array.from(er(e.length));return Tt([r,e],r.length+e.length)}function M1(t){let e=Ke(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return"u"+lt(r,"base64url")}function V1(t){let e=Ke(t),r=t.slice(Zt(e));if(r.length!==e)throw new Error("inconsistent lengths");return lt(r,"base58btc")}function q1(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=Be.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=Bs(n);return Tt([r,i],r.length+i.length)}function z1(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=Be.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=Bs(n);return Tt([r,i],r.length+i.length)}function sf(t){let e=t.slice(0,t.length-2),r=t.slice(t.length-2),n=lt(e,"base32"),i=af(r);return`${n}:${i}`}function cf(t){t=As(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 uf("invalid address: "+t);if(a.path===!0){n=As(i.slice(o).join("/")),e.push([a.code,Ss(a.code,n)]),r.push([a.code,n]);break}let f=Ss(a.code,i[o]);e.push([a.code,f]),r.push([a.code,Es(a.code,f)])}return{string:ff(r),bytes:Ts(e),tuples:e,stringTuples:r,path:n}}function Is(t){let e=[],r=[],n=null,i=0;for(;i<t.length;){let o=Ke(t,i),s=Zt(o),a=st(o),f=H1(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 uf("Invalid address Uint8Array: "+lt(t,"base16"));e.push([o,c]);let u=Es(o,c);if(r.push([o,u]),a.path===!0){n=u;break}}return{bytes:Uint8Array.from(t),string:ff(r),tuples:e,stringTuples:r,path:n}}function ff(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}),As(e.join("/"))}function Ts(t){return Tt(t.map(e=>{let r=st(e[0]),n=Uint8Array.from(er(r.code));return e.length>1&&e[1]!=null&&(n=Tt([n,e[1]])),n}))}function H1(t,e){if(t.size>0)return t.size/8;if(t.size===0)return 0;{let r=Ke(e instanceof Uint8Array?e:Uint8Array.from(e));return r+Zt(r)}}function As(t){return"/"+t.trim().split("/").filter(e=>e).join("/")}function uf(t){return new Error("Error parsing address: "+t)}var $1=Symbol.for("nodejs.util.inspect.custom"),Cs=Symbol.for("@multiformats/js-multiaddr/multiaddr"),G1=[st("dns").code,st("dns4").code,st("dns6").code,st("dnsaddr").code],gi=class t{bytes;#e;#t;#r;#n;[Cs]=!0;constructor(e){e==null&&(e="");let r;if(e instanceof Uint8Array)r=Is(e);else if(typeof e=="string"){if(e.length>0&&e.charAt(0)!=="/")throw new Error(`multiaddr "${e}" must start with a "/"`);r=cf(e)}else if(hf(e))r=Is(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"),f=st("ip4"),c=st("ip6"),u=st("dns6"),l=st("ip6zone");for(let[d,h]of this.stringTuples())d===l.code&&(o=`%${h??""}`),G1.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===f.code||d===c.code)&&(r=st(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({},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(Ts(r.slice(0,n)));return this}getPeerId(){try{let e=[];this.stringTuples().forEach(([n,i])=>{n===$r.p2p.code&&e.push([n,i]),n===$r["p2p-circuit"].code&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?lt(At.decode(`z${n}`),"base58btc"):lt(re.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return this.#n}equals(e){return Kt(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=lf.get(r.name);if(n==null)throw new hi(`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)}[$1](){return`Multiaddr(${this.#e})`}};var lf=new Map;function hf(t){return!!t?.[Cs]}function xi(t){return new gi(t)}function W1(t){return t[Symbol.asyncIterator]!=null}function Y1(t){if(W1(t))return(async()=>{for await(let e of t)return e})();for(let e of t)return e}var Rs=Y1;var pf=Symbol.for("@achingbrain/uint8arraylist");function df(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 mi(t){return!!t?.[pf]}var Gr=class t{bufs;length;[pf]=!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(mi(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(mi(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=df(this.bufs,e);return r.buf[r.index]}set(e,r){let n=df(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(mi(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 Tt(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Tt(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(!mi(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 p=c;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=Vt(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=Ce(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=Ce(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=Ce(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=Vt(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=Ce(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=Ce(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=Ce(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=Ce(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=Ce(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(!Kt(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 vi(t){return t[Symbol.asyncIterator]!=null}var bi=t=>{let e=Zt(t),r=Vt(e);return er(t,r),bi.bytes=e,r};bi.bytes=0;function wn(t,e){e=e??{};let r=e.lengthEncoder??bi;function*n(i){let o=r(i.byteLength);o instanceof Uint8Array?yield o:yield*o,i instanceof Uint8Array?yield i:yield*i}return vi(t)?async function*(){for await(let i of t)yield*n(i)}():function*(){for(let i of t)yield*n(i)}()}wn.single=(t,e)=>{e=e??{};let r=e.lengthEncoder??bi;return new Gr(r(t.byteLength),t)};var Wr=Mt(xf(),1);var Q1=8,X1=1024*1024*4,br;(function(t){t[t.LENGTH=0]="LENGTH",t[t.DATA=1]="DATA"})(br||(br={}));var _s=t=>{let e=Ke(t);return _s.bytes=Zt(e),e};_s.bytes=0;function Yr(t,e){let r=new Gr,n=br.LENGTH,i=-1,o=e?.lengthDecoder??_s,s=e?.maxLengthLength??Q1,a=e?.maxDataLength??X1;function*f(){for(;r.byteLength>0;){if(n===br.LENGTH)try{if(i=o(r),i<0)throw(0,Wr.default)(new Error("invalid message length"),"ERR_INVALID_MSG_LENGTH");if(i>a)throw(0,Wr.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=br.DATA}catch(c){if(c instanceof RangeError){if(r.byteLength>s)throw(0,Wr.default)(new Error("message length length too long"),"ERR_MSG_LENGTH_TOO_LONG");break}throw c}if(n===br.DATA){if(r.byteLength<i)break;let c=r.sublist(0,i);r.consume(i),e?.onData!=null&&e.onData(c),yield c,n=br.LENGTH}}}return vi(t)?async function*(){for await(let c of t)r.append(c),yield*f();if(r.byteLength>0)throw(0,Wr.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,Wr.default)(new Error("unexpected end of input"),"ERR_UNEXPECTED_EOF")}()}Yr.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 Yr(n,{...e??{},onLength:o=>{r=o}})};function j1(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 mf=j1;function ty(t){return t[Symbol.asyncIterator]!=null}function ey(t,e){if(ty(t))return async function*(){for await(let a of t)yield e(a)}();let r=mf(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 vf=ey;function Fe(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var wi=globalThis.CustomEvent??Event;async function*Ls(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=Fe(),a=Fe(),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=Fe(),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 wi("task-complete"))},g=>{y.done=!0,y.err=g,i.dispatchEvent(new wi("task-complete"))})}f=!0,i.dispatchEvent(new wi("task-complete"))}catch(h){c=h,i.dispatchEvent(new wi("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=Fe(),await a.promise),c!=null)throw c;if(n?yield*p():yield*d(),f&&o.length===0)break}}var Ei=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}},Zr=class{size;hwm;head;tail;constructor(e={}){this.hwm=e.splitLimit??16,this.head=new Ei(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 Ei(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 Ds=class extends Error{type;code;constructor(e,r){super(e??"The operation was aborted"),this.type="aborted",this.code=r??"ABORT_ERR"}};function Si(t={}){return ry(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 ry(t,e){e=e??{};let r=e.onEnd,n=new Zr,i,o,s,a=Fe(),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=Fe()})}},c=g=>o!=null?o(g):(n.push(g),i),u=g=>(n=new Zr,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})},p=g=>s?i:(s=!0,g!=null?u(g):c({done:!0})),d=()=>(n=new Zr,p(),{done:!0}),h=g=>(p(g),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:f,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,b;x!=null&&(m=new Promise((R,E)=>{b=()=>{E(new Ds)},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 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 ny(t){return t[Symbol.asyncIterator]!=null}function iy(...t){let e=[];for(let r of t)ny(r)||e.push(r);return e.length===t.length?function*(){for(let r of e)yield*r}():async function*(){let r=Si({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 bf=iy;function Ns(t,...e){if(t==null)throw new Error("Empty pipeline");if(Ps(t)){let n=t;t=()=>n.source}else if(Ef(t)||wf(t)){let n=t;t=()=>n}let r=[t,...e];if(r.length>1&&Ps(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++)Ps(r[n])&&(r[n]=sy(r[n]));return oy(...r)}var oy=(...t)=>{let e;for(;t.length>0;)e=t.shift()(e);return e},wf=t=>t?.[Symbol.asyncIterator]!=null,Ef=t=>t?.[Symbol.iterator]!=null,Ps=t=>t==null?!1:t.sink!=null&&t.source!=null,sy=t=>e=>{let r=t.sink(e);if(r?.then!=null){let n=Si({objectMode:!0});r.then(()=>{n.end()},s=>{n.end(s)});let i,o=t.source;if(wf(o))i=async function*(){yield*o,n.end()};else if(Ef(o))i=function*(){yield*o,n.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return bf(n,i())}return t.source};var Rf=Mt(Sf(),1);var Bf="[a-fA-F\\d:]",rr=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Bf})|(?<=${Bf})(?=\\s|$))`:"",de="(?: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}",St="[a-fA-F\\d]{1,4}",Bi=`
16
16
  (?:
17
17
  (?:${St}:){7}(?:${St}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
18
- (?:${St}:){6}(?:${le}|:${St}|:)| // 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
- (?:${St}:){5}(?::${le}|(?::${St}){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
- (?:${St}:){4}(?:(?::${St}){0,1}:${le}|(?::${St}){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
- (?:${St}:){3}(?:(?::${St}){0,2}:${le}|(?::${St}){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
- (?:${St}:){2}(?:(?::${St}){0,3}:${le}|(?::${St}){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
- (?:${St}:){1}(?:(?::${St}){0,4}:${le}|(?::${St}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
24
- (?::(?:(?::${St}){0,5}:${le}|(?::${St}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
18
+ (?:${St}:){6}(?:${de}|:${St}|:)| // 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
+ (?:${St}:){5}(?::${de}|(?::${St}){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
+ (?:${St}:){4}(?:(?::${St}){0,1}:${de}|(?::${St}){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
+ (?:${St}:){3}(?:(?::${St}){0,2}:${de}|(?::${St}){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
+ (?:${St}:){2}(?:(?::${St}){0,3}:${de}|(?::${St}){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
+ (?:${St}:){1}(?:(?::${St}){0,4}:${de}|(?::${St}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
24
+ (?::(?:(?::${St}){0,5}:${de}|(?::${St}){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(),ny=new RegExp(`(?:^${le}$)|(?:^${Ei}$)`),iy=new RegExp(`^${le}$`),sy=new RegExp(`^${Ei}$`),Po=t=>t&&t.exact?ny:new RegExp(`(?:${er(t)}${le}${er(t)})|(?:${er(t)}${Ei}${er(t)})`,"g");Po.v4=t=>t&&t.exact?iy:new RegExp(`${er(t)}${le}${er(t)}`,"g");Po.v6=t=>t&&t.exact?sy:new RegExp(`${er(t)}${Ei}${er(t)}`,"g");var wf=Po;var If=Mt(Sf(),1),{isValid:oy,parse:ay}=If.default,cy=["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"],fy=cy.map(t=>new Af.Netmask(t));function uy(t){for(let e of fy)if(e.contains(t))return!0;return!1}function Bf(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 Tf=t=>{if(oy(t)){let e=ay(t);if(e.kind()==="ipv4")return uy(e.toNormalizedString());if(e.kind()==="ipv6")return Bf(t)}else if(zr(t)&&wf.v6().test(t))return Bf(t)};var ko=Tf;var Cf="libp2p",Rf="autonat",_f="1.0.0";var W;(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=()=>Fr(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=()=>Fr(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let s;(function(c){let u;c.codec=()=>(u==null&&(u=fe((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),c.encode=l=>ce(l,c.codec()),c.decode=l=>ae(l,c.codec())})(s=t.PeerInfo||(t.PeerInfo={}));let o;(function(c){let u;c.codec=()=>(u==null&&(u=fe((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),c.encode=l=>ce(l,c.codec()),c.decode=l=>ae(l,c.codec())})(o=t.Dial||(t.Dial={}));let a;(function(c){let u;c.codec=()=>(u==null&&(u=fe((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),c.encode=l=>ce(l,c.codec()),c.decode=l=>ae(l,c.codec())})(a=t.DialResponse||(t.DialResponse={}));let f;t.codec=()=>(f==null&&(f=fe((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={},p=u==null?c.len:c.pos+u;for(;c.pos<p;){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=>ce(c,t.codec()),t.decode=c=>ae(c,t.codec())})(W||(W={}));var No=4,Bi=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??Cf}/${Rf}/${_f}`,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 Y("handleIncomingAutonatStream timeout",Ii))};r.addEventListener("abort",n,{once:!0}),Ci(1/0,r);let i=this.components.addressManager.getAddresses().map(s=>s.toOptions().host);try{let s=this;await Do(e.stream,o=>Wr(o),async function*(o){let a=await To(o);if(a==null){s.log("no message received"),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let f;try{f=W.decode(a)}catch(y){s.log.error("could not decode message",y),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"Could not decode message"}});return}let c=f.dial;if(c==null){s.log.error("dial was missing from message"),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"No Dial message found in message"}});return}let u,l=c.peer;if(l==null||l.id==null){s.log.error("PeerId missing from message"),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=An(l.id)}catch(y){s.log.error("invalid PeerId",y),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"bad peer id"}});return}if(s.log("incoming request from %p",u),!e.connection.remotePeer.equals(u)){s.log("target peer %p did not equal sending peer %p",u,e.connection.remotePeer),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let p=l.addrs.map(y=>yi(y)).filter(y=>{let g=y.toOptions().host===e.connection.remoteAddr.toOptions().host;return s.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=!(ko(g)??!1);return s.log.trace("host %s was public %s",g,x),x}).filter(y=>{let g=y.toOptions().host,x=!i.includes(g);return s.log.trace("host %s was not our host %s",g,x),x}).filter(y=>{let g=!!s.components.transportManager.transportForMultiaddr(y);return s.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){s.log("no valid multiaddrs for %p in message",u),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_DIAL_REFUSED,statusText:"no dialable addresses"}});return}s.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 s.components.connectionManager.openConnection(y,{signal:r}),!g.remoteAddr.equals(y))throw s.log.error("tried to dial %a but dialed %a",y,g.remoteAddr),new Error("Unexpected remote address");s.log("Success %p",u),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.OK,addr:g.remoteAddr.decapsulateCode(ot("p2p").code).bytes}});return}catch(x){s.log("could not dial %p",u,x),d=x.message}finally{g!=null&&await g.close()}}yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},o=>bn(o),e.stream)}catch(s){this.log.error("error handling incoming autonat stream",s)}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(s=>{let o=s.toOptions();return!(ko(o.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);Ci(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let s=W.encode({type:W.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await Hc()).toBytes(),f={},c=[],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 Y("verifyAddress timeout",Ii))},n.addEventListener("abort",p,{once:!0});let y=await Do([s],x=>bn(x),h,x=>Wr(x),async x=>To(x));if(y==null){this.log("no response received from %p",d.remotePeer);return}let g=W.decode(y);if(g.type!==W.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===W.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",p)}};for await(let l of Ro(yf(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:No}))try{if(l==null)continue;let p=l.addr==null?r[0]:yi(l.addr);if(this.log("autonat response for %a is %s",p,l.status),l.status===W.ResponseStatus.E_BAD_REQUEST||l.status===W.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(f[d]==null&&(f[d]={success:0,failure:0}),l.status===W.ResponseStatus.OK?f[d].success++:l.status===W.ResponseStatus.E_DIAL_ERROR&&f[d].failure++,f[d].success===No){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(f[d].failure===No){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 gy(t={}){return e=>new Bi(e,t)}return Hf(xy);})();
26
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),ay=new RegExp(`(?:^${de}$)|(?:^${Bi}$)`),cy=new RegExp(`^${de}$`),fy=new RegExp(`^${Bi}$`),ks=t=>t&&t.exact?ay:new RegExp(`(?:${rr(t)}${de}${rr(t)})|(?:${rr(t)}${Bi}${rr(t)})`,"g");ks.v4=t=>t&&t.exact?cy:new RegExp(`${rr(t)}${de}${rr(t)}`,"g");ks.v6=t=>t&&t.exact?fy:new RegExp(`${rr(t)}${Bi}${rr(t)}`,"g");var Af=ks;var _f=Mt(Tf(),1),{isValid:uy,parse:ly}=_f.default,hy=["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"],dy=hy.map(t=>new Rf.Netmask(t));function py(t){for(let e of dy)if(e.contains(t))return!0;return!1}function Cf(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 Lf=t=>{if(uy(t)){let e=ly(t);if(e.kind()==="ipv4")return py(e.toNormalizedString());if(e.kind()==="ipv6")return Cf(t)}else if(Hr(t)&&Af.v6().test(t))return Cf(t)};var Us=Lf;var Df="libp2p",Pf="autonat",Nf="1.0.0";var W;(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=()=>Mr(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=()=>Mr(i)}(n=t.ResponseStatus||(t.ResponseStatus={}));let o;(function(c){let u;c.codec=()=>(u==null&&(u=le((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),c.encode=l=>ue(l,c.codec()),c.decode=l=>fe(l,c.codec())})(o=t.PeerInfo||(t.PeerInfo={}));let s;(function(c){let u;c.codec=()=>(u==null&&(u=le((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),c.encode=l=>ue(l,c.codec()),c.decode=l=>fe(l,c.codec())})(s=t.Dial||(t.Dial={}));let a;(function(c){let u;c.codec=()=>(u==null&&(u=le((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),c.encode=l=>ue(l,c.codec()),c.decode=l=>fe(l,c.codec())})(a=t.DialResponse||(t.DialResponse={}));let f;t.codec=()=>(f==null&&(f=le((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={},p=u==null?c.len:c.pos+u;for(;c.pos<p;){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=>ue(c,t.codec()),t.decode=c=>fe(c,t.codec())})(W||(W={}));var Os=4,Ii=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??Df}/${Pf}/${Nf}`,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 Y("handleIncomingAutonatStream timeout",Ci))};r.addEventListener("abort",n,{once:!0}),_i(1/0,r);let i=this.components.addressManager.getAddresses().map(o=>o.toOptions().host);try{let o=this;await Ns(e.stream,s=>Yr(s),async function*(s){let a=await Rs(s);if(a==null){o.log("no message received"),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"No message was sent"}});return}let f;try{f=W.decode(a)}catch(y){o.log.error("could not decode message",y),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"missing peer info"}});return}try{u=In(l.id)}catch(y){o.log.error("invalid PeerId",y),yield W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_BAD_REQUEST,statusText:"peer id mismatch"}});return}let p=l.addrs.map(y=>xi(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=!(Us(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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.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 W.encode({type:W.MessageType.DIAL_RESPONSE,dialResponse:{status:W.ResponseStatus.E_DIAL_ERROR,statusText:d,addr:h.bytes}})},s=>wn(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!(Us(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);_i(1/0,n);let i=this;try{this.log("verify multiaddrs %s",r.map(l=>l.toString()).join(", "));let o=W.encode({type:W.MessageType.DIAL,dial:{peer:{id:this.components.peerId.toBytes(),addrs:r.map(l=>l.bytes)}}}),a=(await Yc()).toBytes(),f={},c=[],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 Y("verifyAddress timeout",Ci))},n.addEventListener("abort",p,{once:!0});let y=await Ns([o],x=>wn(x),h,x=>Yr(x),async x=>Rs(x));if(y==null){this.log("no response received from %p",d.remotePeer);return}let g=W.decode(y);if(g.type!==W.MessageType.DIAL_RESPONSE||g.dialResponse==null){this.log("invalid autonat response from %p",d.remotePeer);return}if(g.dialResponse.status===W.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",p)}};for await(let l of Ls(vf(this.components.peerRouting.getClosestPeers(a,{signal:n}),p=>async()=>u(p)),{concurrency:Os}))try{if(l==null)continue;let p=l.addr==null?r[0]:xi(l.addr);if(this.log("autonat response for %a is %s",p,l.status),l.status===W.ResponseStatus.E_BAD_REQUEST||l.status===W.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(f[d]==null&&(f[d]={success:0,failure:0}),l.status===W.ResponseStatus.OK?f[d].success++:l.status===W.ResponseStatus.E_DIAL_ERROR&&f[d].failure++,f[d].success===Os){this.log("%a is externally dialable",p),e.confirmObservedAddr(p);return}if(f[d].failure===Os){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 by(t={}){return e=>new Ii(e,t)}return Yf(wy);})();
27
27
  /*! Bundled license information:
28
28
 
29
29
  @noble/hashes/esm/utils.js: