@vibecontrols/vibe-plugin-tool-ssh 2026.518.1 → 2026.525.1

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.
Binary file
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames}=Object;var __hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node,__toESMCache_esm,__toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap,cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:!0});if(canCache)cache.set(mod,to);return to};var __commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var __esm=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res);var __require=import.meta.require;var require_errors=__commonJS((exports,module)=>{module.exports={newInvalidAsn1Error:function(msg){var e=Error();return e.name="InvalidAsn1Error",e.message=msg||"",e}}});var require_types=__commonJS((exports,module)=>{module.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}});var require_safer=__commonJS((exports,module)=>{var buffer=__require("buffer"),Buffer2=buffer.Buffer,safer={},key;for(key in buffer){if(!buffer.hasOwnProperty(key))continue;if(key==="SlowBuffer"||key==="Buffer")continue;safer[key]=buffer[key]}var Safer=safer.Buffer={};for(key in Buffer2){if(!Buffer2.hasOwnProperty(key))continue;if(key==="allocUnsafe"||key==="allocUnsafeSlow")continue;Safer[key]=Buffer2[key]}safer.Buffer.prototype=Buffer2.prototype;if(!Safer.from||Safer.from===Uint8Array.from)Safer.from=function(value,encodingOrOffset,length){if(typeof value==="number")throw TypeError('The "value" argument must not be of type number. Received type '+typeof value);if(value&&typeof value.length>"u")throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value);return Buffer2(value,encodingOrOffset,length)};if(!Safer.alloc)Safer.alloc=function(size,fill,encoding){if(typeof size!=="number")throw TypeError('The "size" argument must be of type number. Received type '+typeof size);if(size<0||size>=2147483648)throw RangeError('The value "'+size+'" is invalid for option "size"');var buf=Buffer2(size);if(!fill||fill.length===0)buf.fill(0);else if(typeof encoding==="string")buf.fill(fill,encoding);else buf.fill(fill);return buf};if(!safer.kStringMaxLength)try{safer.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(e){}if(!safer.constants){if(safer.constants={MAX_LENGTH:safer.kMaxLength},safer.kStringMaxLength)safer.constants.MAX_STRING_LENGTH=safer.kStringMaxLength}module.exports=safer});var require_reader=__commonJS((exports,module)=>{var assert=__require("assert"),Buffer2=require_safer().Buffer,ASN1=require_types(),errors=require_errors(),newInvalidAsn1Error=errors.newInvalidAsn1Error;function Reader(data){if(!data||!Buffer2.isBuffer(data))throw TypeError("data must be a node Buffer");this._buf=data,this._size=data.length,this._len=0,this._offset=0}Object.defineProperty(Reader.prototype,"length",{enumerable:!0,get:function(){return this._len}});Object.defineProperty(Reader.prototype,"offset",{enumerable:!0,get:function(){return this._offset}});Object.defineProperty(Reader.prototype,"remain",{get:function(){return this._size-this._offset}});Object.defineProperty(Reader.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}});Reader.prototype.readByte=function(peek){if(this._size-this._offset<1)return null;var b=this._buf[this._offset]&255;if(!peek)this._offset+=1;return b};Reader.prototype.peek=function(){return this.readByte(!0)};Reader.prototype.readLength=function(offset){if(offset===void 0)offset=this._offset;if(offset>=this._size)return null;var lenB=this._buf[offset++]&255;if(lenB===null)return null;if((lenB&128)===128){if(lenB&=127,lenB===0)throw newInvalidAsn1Error("Indefinite length not supported");if(lenB>4)throw newInvalidAsn1Error("encoding too long");if(this._size-offset<lenB)return null;this._len=0;for(var i=0;i<lenB;i++)this._len=(this._len<<8)+(this._buf[offset++]&255)}else this._len=lenB;return offset};Reader.prototype.readSequence=function(tag){var seq=this.peek();if(seq===null)return null;if(tag!==void 0&&tag!==seq)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+seq.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;return this._offset=o,seq};Reader.prototype.readInt=function(){return this._readTag(ASN1.Integer)};Reader.prototype.readBoolean=function(){return this._readTag(ASN1.Boolean)===0?!1:!0};Reader.prototype.readEnumeration=function(){return this._readTag(ASN1.Enumeration)};Reader.prototype.readString=function(tag,retbuf){if(!tag)tag=ASN1.OctetString;var b=this.peek();if(b===null)return null;if(b!==tag)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+b.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;if(this.length>this._size-o)return null;if(this._offset=o,this.length===0)return retbuf?Buffer2.alloc(0):"";var str=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,retbuf?str:str.toString("utf8")};Reader.prototype.readOID=function(tag){if(!tag)tag=ASN1.OID;var b=this.readString(tag,!0);if(b===null)return null;var values=[],value=0;for(var i=0;i<b.length;i++){var byte=b[i]&255;if(value<<=7,value+=byte&127,(byte&128)===0)values.push(value),value=0}return value=values.shift(),values.unshift(value%40),values.unshift(value/40>>0),values.join(".")};Reader.prototype._readTag=function(tag){assert.ok(tag!==void 0);var b=this.peek();if(b===null)return null;if(b!==tag)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+b.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;if(this.length>4)throw newInvalidAsn1Error("Integer too long: "+this.length);if(this.length>this._size-o)return null;this._offset=o;var fb=this._buf[this._offset],value=0;for(var i=0;i<this.length;i++)value<<=8,value|=this._buf[this._offset++]&255;if((fb&128)===128&&i!==4)value-=1<<i*8;return value>>0};module.exports=Reader});var require_writer=__commonJS((exports,module)=>{var assert=__require("assert"),Buffer2=require_safer().Buffer,ASN1=require_types(),errors=require_errors(),newInvalidAsn1Error=errors.newInvalidAsn1Error,DEFAULT_OPTS={size:1024,growthFactor:8};function merge(from,to){assert.ok(from),assert.equal(typeof from,"object"),assert.ok(to),assert.equal(typeof to,"object");var keys=Object.getOwnPropertyNames(from);return keys.forEach(function(key){if(to[key])return;var value=Object.getOwnPropertyDescriptor(from,key);Object.defineProperty(to,key,value)}),to}function Writer(options){options=merge(DEFAULT_OPTS,options||{}),this._buf=Buffer2.alloc(options.size||1024),this._size=this._buf.length,this._offset=0,this._options=options,this._seq=[]}Object.defineProperty(Writer.prototype,"buffer",{get:function(){if(this._seq.length)throw newInvalidAsn1Error(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}});Writer.prototype.writeByte=function(b){if(typeof b!=="number")throw TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=b};Writer.prototype.writeInt=function(i,tag){if(typeof i!=="number")throw TypeError("argument must be a Number");if(typeof tag!=="number")tag=ASN1.Integer;var sz=4;while(((i&4286578688)===0||(i&4286578688)===-8388608)&&sz>1)sz--,i<<=8;if(sz>4)throw newInvalidAsn1Error("BER ints cannot be > 0xffffffff");this._ensure(2+sz),this._buf[this._offset++]=tag,this._buf[this._offset++]=sz;while(sz-- >0)this._buf[this._offset++]=(i&4278190080)>>>24,i<<=8};Writer.prototype.writeNull=function(){this.writeByte(ASN1.Null),this.writeByte(0)};Writer.prototype.writeEnumeration=function(i,tag){if(typeof i!=="number")throw TypeError("argument must be a Number");if(typeof tag!=="number")tag=ASN1.Enumeration;return this.writeInt(i,tag)};Writer.prototype.writeBoolean=function(b,tag){if(typeof b!=="boolean")throw TypeError("argument must be a Boolean");if(typeof tag!=="number")tag=ASN1.Boolean;this._ensure(3),this._buf[this._offset++]=tag,this._buf[this._offset++]=1,this._buf[this._offset++]=b?255:0};Writer.prototype.writeString=function(s,tag){if(typeof s!=="string")throw TypeError("argument must be a string (was: "+typeof s+")");if(typeof tag!=="number")tag=ASN1.OctetString;var len=Buffer2.byteLength(s);if(this.writeByte(tag),this.writeLength(len),len)this._ensure(len),this._buf.write(s,this._offset),this._offset+=len};Writer.prototype.writeBuffer=function(buf,tag){if(typeof tag!=="number")throw TypeError("tag must be a number");if(!Buffer2.isBuffer(buf))throw TypeError("argument must be a buffer");this.writeByte(tag),this.writeLength(buf.length),this._ensure(buf.length),buf.copy(this._buf,this._offset,0,buf.length),this._offset+=buf.length};Writer.prototype.writeStringArray=function(strings){if(!strings instanceof Array)throw TypeError("argument must be an Array[String]");var self2=this;strings.forEach(function(s){self2.writeString(s)})};Writer.prototype.writeOID=function(s,tag){if(typeof s!=="string")throw TypeError("argument must be a string");if(typeof tag!=="number")tag=ASN1.OID;if(!/^([0-9]+\.){3,}[0-9]+$/.test(s))throw Error("argument is not a valid OID string");function encodeOctet(bytes2,octet){if(octet<128)bytes2.push(octet);else if(octet<16384)bytes2.push(octet>>>7|128),bytes2.push(octet&127);else if(octet<2097152)bytes2.push(octet>>>14|128),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127);else if(octet<268435456)bytes2.push(octet>>>21|128),bytes2.push((octet>>>14|128)&255),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127);else bytes2.push((octet>>>28|128)&255),bytes2.push((octet>>>21|128)&255),bytes2.push((octet>>>14|128)&255),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127)}var tmp=s.split("."),bytes=[];bytes.push(parseInt(tmp[0],10)*40+parseInt(tmp[1],10)),tmp.slice(2).forEach(function(b){encodeOctet(bytes,parseInt(b,10))});var self2=this;this._ensure(2+bytes.length),this.writeByte(tag),this.writeLength(bytes.length),bytes.forEach(function(b){self2.writeByte(b)})};Writer.prototype.writeLength=function(len){if(typeof len!=="number")throw TypeError("argument must be a Number");if(this._ensure(4),len<=127)this._buf[this._offset++]=len;else if(len<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=len;else if(len<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=len>>8,this._buf[this._offset++]=len;else if(len<=16777215)this._buf[this._offset++]=131,this._buf[this._offset++]=len>>16,this._buf[this._offset++]=len>>8,this._buf[this._offset++]=len;else throw newInvalidAsn1Error("Length too long (> 4 bytes)")};Writer.prototype.startSequence=function(tag){if(typeof tag!=="number")tag=ASN1.Sequence|ASN1.Constructor;this.writeByte(tag),this._seq.push(this._offset),this._ensure(3),this._offset+=3};Writer.prototype.endSequence=function(){var seq=this._seq.pop(),start=seq+3,len=this._offset-start;if(len<=127)this._shift(start,len,-2),this._buf[seq]=len;else if(len<=255)this._shift(start,len,-1),this._buf[seq]=129,this._buf[seq+1]=len;else if(len<=65535)this._buf[seq]=130,this._buf[seq+1]=len>>8,this._buf[seq+2]=len;else if(len<=16777215)this._shift(start,len,1),this._buf[seq]=131,this._buf[seq+1]=len>>16,this._buf[seq+2]=len>>8,this._buf[seq+3]=len;else throw newInvalidAsn1Error("Sequence too long")};Writer.prototype._shift=function(start,len,shift){assert.ok(start!==void 0),assert.ok(len!==void 0),assert.ok(shift),this._buf.copy(this._buf,start+shift,start,start+len),this._offset+=shift};Writer.prototype._ensure=function(len){if(assert.ok(len),this._size-this._offset<len){var sz=this._size*this._options.growthFactor;if(sz-this._offset<len)sz+=len;var buf=Buffer2.alloc(sz);this._buf.copy(buf,0,0,this._offset),this._buf=buf,this._size=sz}};module.exports=Writer});var require_ber=__commonJS((exports,module)=>{var errors=require_errors(),types=require_types(),Reader=require_reader(),Writer=require_writer();module.exports={Reader,Writer};for(t in types)if(types.hasOwnProperty(t))module.exports[t]=types[t];var t;for(e in errors)if(errors.hasOwnProperty(e))module.exports[e]=errors[e];var e});var require_lib=__commonJS((exports,module)=>{var Ber=require_ber();module.exports={Ber,BerReader:Ber.Reader,BerWriter:Ber.Writer}});var require_nacl_fast=__commonJS((exports,module)=>{(function(nacl){var gf=function(init){var i,r=new Float64Array(16);if(init)for(i=0;i<init.length;i++)r[i]=init[i];return r},randombytes=function(){throw Error("no PRNG")},_0=new Uint8Array(16),_9=new Uint8Array(32);_9[0]=9;var gf0=gf(),gf1=gf([1]),_121665=gf([56129,1]),D=gf([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),D2=gf([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),X=gf([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Y=gf([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),I=gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function ts64(x,i,h,l){x[i]=h>>24&255,x[i+1]=h>>16&255,x[i+2]=h>>8&255,x[i+3]=h&255,x[i+4]=l>>24&255,x[i+5]=l>>16&255,x[i+6]=l>>8&255,x[i+7]=l&255}function vn(x,xi,y,yi,n){var i,d=0;for(i=0;i<n;i++)d|=x[xi+i]^y[yi+i];return(1&d-1>>>8)-1}function crypto_verify_16(x,xi,y,yi){return vn(x,xi,y,yi,16)}function crypto_verify_32(x,xi,y,yi){return vn(x,xi,y,yi,32)}function core_salsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;x0=x0+j0|0,x1=x1+j1|0,x2=x2+j2|0,x3=x3+j3|0,x4=x4+j4|0,x5=x5+j5|0,x6=x6+j6|0,x7=x7+j7|0,x8=x8+j8|0,x9=x9+j9|0,x10=x10+j10|0,x11=x11+j11|0,x12=x12+j12|0,x13=x13+j13|0,x14=x14+j14|0,x15=x15+j15|0,o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x1>>>0&255,o[5]=x1>>>8&255,o[6]=x1>>>16&255,o[7]=x1>>>24&255,o[8]=x2>>>0&255,o[9]=x2>>>8&255,o[10]=x2>>>16&255,o[11]=x2>>>24&255,o[12]=x3>>>0&255,o[13]=x3>>>8&255,o[14]=x3>>>16&255,o[15]=x3>>>24&255,o[16]=x4>>>0&255,o[17]=x4>>>8&255,o[18]=x4>>>16&255,o[19]=x4>>>24&255,o[20]=x5>>>0&255,o[21]=x5>>>8&255,o[22]=x5>>>16&255,o[23]=x5>>>24&255,o[24]=x6>>>0&255,o[25]=x6>>>8&255,o[26]=x6>>>16&255,o[27]=x6>>>24&255,o[28]=x7>>>0&255,o[29]=x7>>>8&255,o[30]=x7>>>16&255,o[31]=x7>>>24&255,o[32]=x8>>>0&255,o[33]=x8>>>8&255,o[34]=x8>>>16&255,o[35]=x8>>>24&255,o[36]=x9>>>0&255,o[37]=x9>>>8&255,o[38]=x9>>>16&255,o[39]=x9>>>24&255,o[40]=x10>>>0&255,o[41]=x10>>>8&255,o[42]=x10>>>16&255,o[43]=x10>>>24&255,o[44]=x11>>>0&255,o[45]=x11>>>8&255,o[46]=x11>>>16&255,o[47]=x11>>>24&255,o[48]=x12>>>0&255,o[49]=x12>>>8&255,o[50]=x12>>>16&255,o[51]=x12>>>24&255,o[52]=x13>>>0&255,o[53]=x13>>>8&255,o[54]=x13>>>16&255,o[55]=x13>>>24&255,o[56]=x14>>>0&255,o[57]=x14>>>8&255,o[58]=x14>>>16&255,o[59]=x14>>>24&255,o[60]=x15>>>0&255,o[61]=x15>>>8&255,o[62]=x15>>>16&255,o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x5>>>0&255,o[5]=x5>>>8&255,o[6]=x5>>>16&255,o[7]=x5>>>24&255,o[8]=x10>>>0&255,o[9]=x10>>>8&255,o[10]=x10>>>16&255,o[11]=x10>>>24&255,o[12]=x15>>>0&255,o[13]=x15>>>8&255,o[14]=x15>>>16&255,o[15]=x15>>>24&255,o[16]=x6>>>0&255,o[17]=x6>>>8&255,o[18]=x6>>>16&255,o[19]=x6>>>24&255,o[20]=x7>>>0&255,o[21]=x7>>>8&255,o[22]=x7>>>16&255,o[23]=x7>>>24&255,o[24]=x8>>>0&255,o[25]=x8>>>8&255,o[26]=x8>>>16&255,o[27]=x8>>>24&255,o[28]=x9>>>0&255,o[29]=x9>>>8&255,o[30]=x9>>>16&255,o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}var sigma=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64),u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=m[mpos+i]^x[i];u=1;for(i=8;i<16;i++)u=u+(z[i]&255)|0,z[i]=u&255,u>>>=8;b-=64,cpos+=64,mpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=m[mpos+i]^x[i]}return 0}function crypto_stream_salsa20(c,cpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64),u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=x[i];u=1;for(i=8;i<16;i++)u=u+(z[i]&255)|0,z[i]=u&255,u>>>=8;b-=64,cpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=x[i]}return 0}function crypto_stream(c,cpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20(c,cpos,d,sn,s)}function crypto_stream_xor(c,cpos,m,mpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s)}var poly1305=function(key){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t0,t1,t2,t3,t4,t5,t6,t7;t0=key[0]&255|(key[1]&255)<<8,this.r[0]=t0&8191,t1=key[2]&255|(key[3]&255)<<8,this.r[1]=(t0>>>13|t1<<3)&8191,t2=key[4]&255|(key[5]&255)<<8,this.r[2]=(t1>>>10|t2<<6)&7939,t3=key[6]&255|(key[7]&255)<<8,this.r[3]=(t2>>>7|t3<<9)&8191,t4=key[8]&255|(key[9]&255)<<8,this.r[4]=(t3>>>4|t4<<12)&255,this.r[5]=t4>>>1&8190,t5=key[10]&255|(key[11]&255)<<8,this.r[6]=(t4>>>14|t5<<2)&8191,t6=key[12]&255|(key[13]&255)<<8,this.r[7]=(t5>>>11|t6<<5)&8065,t7=key[14]&255|(key[15]&255)<<8,this.r[8]=(t6>>>8|t7<<8)&8191,this.r[9]=t7>>>5&127,this.pad[0]=key[16]&255|(key[17]&255)<<8,this.pad[1]=key[18]&255|(key[19]&255)<<8,this.pad[2]=key[20]&255|(key[21]&255)<<8,this.pad[3]=key[22]&255|(key[23]&255)<<8,this.pad[4]=key[24]&255|(key[25]&255)<<8,this.pad[5]=key[26]&255|(key[27]&255)<<8,this.pad[6]=key[28]&255|(key[29]&255)<<8,this.pad[7]=key[30]&255|(key[31]&255)<<8};poly1305.prototype.blocks=function(m,mpos,bytes){var hibit=this.fin?0:2048,t0,t1,t2,t3,t4,t5,t6,t7,c,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,h0=this.h[0],h1=this.h[1],h2=this.h[2],h3=this.h[3],h4=this.h[4],h5=this.h[5],h6=this.h[6],h7=this.h[7],h8=this.h[8],h9=this.h[9],r0=this.r[0],r1=this.r[1],r2=this.r[2],r3=this.r[3],r4=this.r[4],r5=this.r[5],r6=this.r[6],r7=this.r[7],r8=this.r[8],r9=this.r[9];while(bytes>=16)t0=m[mpos+0]&255|(m[mpos+1]&255)<<8,h0+=t0&8191,t1=m[mpos+2]&255|(m[mpos+3]&255)<<8,h1+=(t0>>>13|t1<<3)&8191,t2=m[mpos+4]&255|(m[mpos+5]&255)<<8,h2+=(t1>>>10|t2<<6)&8191,t3=m[mpos+6]&255|(m[mpos+7]&255)<<8,h3+=(t2>>>7|t3<<9)&8191,t4=m[mpos+8]&255|(m[mpos+9]&255)<<8,h4+=(t3>>>4|t4<<12)&8191,h5+=t4>>>1&8191,t5=m[mpos+10]&255|(m[mpos+11]&255)<<8,h6+=(t4>>>14|t5<<2)&8191,t6=m[mpos+12]&255|(m[mpos+13]&255)<<8,h7+=(t5>>>11|t6<<5)&8191,t7=m[mpos+14]&255|(m[mpos+15]&255)<<8,h8+=(t6>>>8|t7<<8)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=d6>>>13,d6&=8191,d6+=h5*r1,d6+=h6*r0,d6+=h7*(5*r9),d6+=h8*(5*r8),d6+=h9*(5*r7),c+=d6>>>13,d6&=8191,d7=c,d7+=h0*r7,d7+=h1*r6,d7+=h2*r5,d7+=h3*r4,d7+=h4*r3,c=d7>>>13,d7&=8191,d7+=h5*r2,d7+=h6*r1,d7+=h7*r0,d7+=h8*(5*r9),d7+=h9*(5*r8),c+=d7>>>13,d7&=8191,d8=c,d8+=h0*r8,d8+=h1*r7,d8+=h2*r6,d8+=h3*r5,d8+=h4*r4,c=d8>>>13,d8&=8191,d8+=h5*r3,d8+=h6*r2,d8+=h7*r1,d8+=h8*r0,d8+=h9*(5*r9),c+=d8>>>13,d8&=8191,d9=c,d9+=h0*r9,d9+=h1*r8,d9+=h2*r7,d9+=h3*r6,d9+=h4*r5,c=d9>>>13,d9&=8191,d9+=h5*r4,d9+=h6*r3,d9+=h7*r2,d9+=h8*r1,d9+=h9*r0,c+=d9>>>13,d9&=8191,c=(c<<2)+c|0,c=c+d0|0,d0=c&8191,c=c>>>13,d1+=c,h0=d0,h1=d1,h2=d2,h3=d3,h4=d4,h5=d5,h6=d6,h7=d7,h8=d8,h9=d9,mpos+=16,bytes-=16;this.h[0]=h0,this.h[1]=h1,this.h[2]=h2,this.h[3]=h3,this.h[4]=h4,this.h[5]=h5,this.h[6]=h6,this.h[7]=h7,this.h[8]=h8,this.h[9]=h9},poly1305.prototype.finish=function(mac,macpos){var g=new Uint16Array(10),c,mask,f,i;if(this.leftover){i=this.leftover,this.buffer[i++]=1;for(;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}c=this.h[1]>>>13,this.h[1]&=8191;for(i=2;i<10;i++)this.h[i]+=c,c=this.h[i]>>>13,this.h[i]&=8191;this.h[0]+=c*5,c=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=c,c=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=c,g[0]=this.h[0]+5,c=g[0]>>>13,g[0]&=8191;for(i=1;i<10;i++)g[i]=this.h[i]+c,c=g[i]>>>13,g[i]&=8191;g[9]-=8192,mask=(c^1)-1;for(i=0;i<10;i++)g[i]&=mask;mask=~mask;for(i=0;i<10;i++)this.h[i]=this.h[i]&mask|g[i];this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,f=this.h[0]+this.pad[0],this.h[0]=f&65535;for(i=1;i<8;i++)f=(this.h[i]+this.pad[i]|0)+(f>>>16)|0,this.h[i]=f&65535;mac[macpos+0]=this.h[0]>>>0&255,mac[macpos+1]=this.h[0]>>>8&255,mac[macpos+2]=this.h[1]>>>0&255,mac[macpos+3]=this.h[1]>>>8&255,mac[macpos+4]=this.h[2]>>>0&255,mac[macpos+5]=this.h[2]>>>8&255,mac[macpos+6]=this.h[3]>>>0&255,mac[macpos+7]=this.h[3]>>>8&255,mac[macpos+8]=this.h[4]>>>0&255,mac[macpos+9]=this.h[4]>>>8&255,mac[macpos+10]=this.h[5]>>>0&255,mac[macpos+11]=this.h[5]>>>8&255,mac[macpos+12]=this.h[6]>>>0&255,mac[macpos+13]=this.h[6]>>>8&255,mac[macpos+14]=this.h[7]>>>0&255,mac[macpos+15]=this.h[7]>>>8&255},poly1305.prototype.update=function(m,mpos,bytes){var i,want;if(this.leftover){if(want=16-this.leftover,want>bytes)want=bytes;for(i=0;i<want;i++)this.buffer[this.leftover+i]=m[mpos+i];if(bytes-=want,mpos+=want,this.leftover+=want,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(bytes>=16)want=bytes-bytes%16,this.blocks(m,mpos,want),mpos+=want,bytes-=want;if(bytes){for(i=0;i<bytes;i++)this.buffer[this.leftover+i]=m[mpos+i];this.leftover+=bytes}};function crypto_onetimeauth(out,outpos,m,mpos,n,k){var s=new poly1305(k);return s.update(m,mpos,n),s.finish(out,outpos),0}function crypto_onetimeauth_verify(h,hpos,m,mpos,n,k){var x=new Uint8Array(16);return crypto_onetimeauth(x,0,m,mpos,n,k),crypto_verify_16(h,hpos,x,0)}function crypto_secretbox(c,m,d,n,k){var i;if(d<32)return-1;crypto_stream_xor(c,0,m,0,d,n,k),crypto_onetimeauth(c,16,c,32,d-32,c);for(i=0;i<16;i++)c[i]=0;return 0}function crypto_secretbox_open(m,c,d,n,k){var i,x=new Uint8Array(32);if(d<32)return-1;if(crypto_stream(x,0,32,n,k),crypto_onetimeauth_verify(c,16,c,32,d-32,x)!==0)return-1;crypto_stream_xor(m,0,c,0,d,n,k);for(i=0;i<32;i++)m[i]=0;return 0}function set25519(r,a){var i;for(i=0;i<16;i++)r[i]=a[i]|0}function car25519(o){var i,v,c=1;for(i=0;i<16;i++)v=o[i]+c+65535,c=Math.floor(v/65536),o[i]=v-c*65536;o[0]+=c-1+37*(c-1)}function sel25519(p,q,b){var t,c=~(b-1);for(var i=0;i<16;i++)t=c&(p[i]^q[i]),p[i]^=t,q[i]^=t}function pack25519(o,n){var i,j,b,m=gf(),t=gf();for(i=0;i<16;i++)t[i]=n[i];car25519(t),car25519(t),car25519(t);for(j=0;j<2;j++){m[0]=t[0]-65517;for(i=1;i<15;i++)m[i]=t[i]-65535-(m[i-1]>>16&1),m[i-1]&=65535;m[15]=t[15]-32767-(m[14]>>16&1),b=m[15]>>16&1,m[14]&=65535,sel25519(t,m,1-b)}for(i=0;i<16;i++)o[2*i]=t[i]&255,o[2*i+1]=t[i]>>8}function neq25519(a,b){var c=new Uint8Array(32),d=new Uint8Array(32);return pack25519(c,a),pack25519(d,b),crypto_verify_32(c,0,d,0)}function par25519(a){var d=new Uint8Array(32);return pack25519(d,a),d[0]&1}function unpack25519(o,n){var i;for(i=0;i<16;i++)o[i]=n[2*i]+(n[2*i+1]<<8);o[15]&=32767}function A(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]+b[i]}function Z(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]-b[i]}function M(o,a,b){var v,c,t0=0,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,t9=0,t10=0,t11=0,t12=0,t13=0,t14=0,t15=0,t16=0,t17=0,t18=0,t19=0,t20=0,t21=0,t22=0,t23=0,t24=0,t25=0,t26=0,t27=0,t28=0,t29=0,t30=0,b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];v=a[0],t0+=v*b0,t1+=v*b1,t2+=v*b2,t3+=v*b3,t4+=v*b4,t5+=v*b5,t6+=v*b6,t7+=v*b7,t8+=v*b8,t9+=v*b9,t10+=v*b10,t11+=v*b11,t12+=v*b12,t13+=v*b13,t14+=v*b14,t15+=v*b15,v=a[1],t1+=v*b0,t2+=v*b1,t3+=v*b2,t4+=v*b3,t5+=v*b4,t6+=v*b5,t7+=v*b6,t8+=v*b7,t9+=v*b8,t10+=v*b9,t11+=v*b10,t12+=v*b11,t13+=v*b12,t14+=v*b13,t15+=v*b14,t16+=v*b15,v=a[2],t2+=v*b0,t3+=v*b1,t4+=v*b2,t5+=v*b3,t6+=v*b4,t7+=v*b5,t8+=v*b6,t9+=v*b7,t10+=v*b8,t11+=v*b9,t12+=v*b10,t13+=v*b11,t14+=v*b12,t15+=v*b13,t16+=v*b14,t17+=v*b15,v=a[3],t3+=v*b0,t4+=v*b1,t5+=v*b2,t6+=v*b3,t7+=v*b4,t8+=v*b5,t9+=v*b6,t10+=v*b7,t11+=v*b8,t12+=v*b9,t13+=v*b10,t14+=v*b11,t15+=v*b12,t16+=v*b13,t17+=v*b14,t18+=v*b15,v=a[4],t4+=v*b0,t5+=v*b1,t6+=v*b2,t7+=v*b3,t8+=v*b4,t9+=v*b5,t10+=v*b6,t11+=v*b7,t12+=v*b8,t13+=v*b9,t14+=v*b10,t15+=v*b11,t16+=v*b12,t17+=v*b13,t18+=v*b14,t19+=v*b15,v=a[5],t5+=v*b0,t6+=v*b1,t7+=v*b2,t8+=v*b3,t9+=v*b4,t10+=v*b5,t11+=v*b6,t12+=v*b7,t13+=v*b8,t14+=v*b9,t15+=v*b10,t16+=v*b11,t17+=v*b12,t18+=v*b13,t19+=v*b14,t20+=v*b15,v=a[6],t6+=v*b0,t7+=v*b1,t8+=v*b2,t9+=v*b3,t10+=v*b4,t11+=v*b5,t12+=v*b6,t13+=v*b7,t14+=v*b8,t15+=v*b9,t16+=v*b10,t17+=v*b11,t18+=v*b12,t19+=v*b13,t20+=v*b14,t21+=v*b15,v=a[7],t7+=v*b0,t8+=v*b1,t9+=v*b2,t10+=v*b3,t11+=v*b4,t12+=v*b5,t13+=v*b6,t14+=v*b7,t15+=v*b8,t16+=v*b9,t17+=v*b10,t18+=v*b11,t19+=v*b12,t20+=v*b13,t21+=v*b14,t22+=v*b15,v=a[8],t8+=v*b0,t9+=v*b1,t10+=v*b2,t11+=v*b3,t12+=v*b4,t13+=v*b5,t14+=v*b6,t15+=v*b7,t16+=v*b8,t17+=v*b9,t18+=v*b10,t19+=v*b11,t20+=v*b12,t21+=v*b13,t22+=v*b14,t23+=v*b15,v=a[9],t9+=v*b0,t10+=v*b1,t11+=v*b2,t12+=v*b3,t13+=v*b4,t14+=v*b5,t15+=v*b6,t16+=v*b7,t17+=v*b8,t18+=v*b9,t19+=v*b10,t20+=v*b11,t21+=v*b12,t22+=v*b13,t23+=v*b14,t24+=v*b15,v=a[10],t10+=v*b0,t11+=v*b1,t12+=v*b2,t13+=v*b3,t14+=v*b4,t15+=v*b5,t16+=v*b6,t17+=v*b7,t18+=v*b8,t19+=v*b9,t20+=v*b10,t21+=v*b11,t22+=v*b12,t23+=v*b13,t24+=v*b14,t25+=v*b15,v=a[11],t11+=v*b0,t12+=v*b1,t13+=v*b2,t14+=v*b3,t15+=v*b4,t16+=v*b5,t17+=v*b6,t18+=v*b7,t19+=v*b8,t20+=v*b9,t21+=v*b10,t22+=v*b11,t23+=v*b12,t24+=v*b13,t25+=v*b14,t26+=v*b15,v=a[12],t12+=v*b0,t13+=v*b1,t14+=v*b2,t15+=v*b3,t16+=v*b4,t17+=v*b5,t18+=v*b6,t19+=v*b7,t20+=v*b8,t21+=v*b9,t22+=v*b10,t23+=v*b11,t24+=v*b12,t25+=v*b13,t26+=v*b14,t27+=v*b15,v=a[13],t13+=v*b0,t14+=v*b1,t15+=v*b2,t16+=v*b3,t17+=v*b4,t18+=v*b5,t19+=v*b6,t20+=v*b7,t21+=v*b8,t22+=v*b9,t23+=v*b10,t24+=v*b11,t25+=v*b12,t26+=v*b13,t27+=v*b14,t28+=v*b15,v=a[14],t14+=v*b0,t15+=v*b1,t16+=v*b2,t17+=v*b3,t18+=v*b4,t19+=v*b5,t20+=v*b6,t21+=v*b7,t22+=v*b8,t23+=v*b9,t24+=v*b10,t25+=v*b11,t26+=v*b12,t27+=v*b13,t28+=v*b14,t29+=v*b15,v=a[15],t15+=v*b0,t16+=v*b1,t17+=v*b2,t18+=v*b3,t19+=v*b4,t20+=v*b5,t21+=v*b6,t22+=v*b7,t23+=v*b8,t24+=v*b9,t25+=v*b10,t26+=v*b11,t27+=v*b12,t28+=v*b13,t29+=v*b14,t30+=v*b15,t0+=38*t16,t1+=38*t17,t2+=38*t18,t3+=38*t19,t4+=38*t20,t5+=38*t21,t6+=38*t22,t7+=38*t23,t8+=38*t24,t9+=38*t25,t10+=38*t26,t11+=38*t27,t12+=38*t28,t13+=38*t29,t14+=38*t30,c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-c*65536,v=t1+c+65535,c=Math.floor(v/65536),t1=v-c*65536,v=t2+c+65535,c=Math.floor(v/65536),t2=v-c*65536,v=t3+c+65535,c=Math.floor(v/65536),t3=v-c*65536,v=t4+c+65535,c=Math.floor(v/65536),t4=v-c*65536,v=t5+c+65535,c=Math.floor(v/65536),t5=v-c*65536,v=t6+c+65535,c=Math.floor(v/65536),t6=v-c*65536,v=t7+c+65535,c=Math.floor(v/65536),t7=v-c*65536,v=t8+c+65535,c=Math.floor(v/65536),t8=v-c*65536,v=t9+c+65535,c=Math.floor(v/65536),t9=v-c*65536,v=t10+c+65535,c=Math.floor(v/65536),t10=v-c*65536,v=t11+c+65535,c=Math.floor(v/65536),t11=v-c*65536,v=t12+c+65535,c=Math.floor(v/65536),t12=v-c*65536,v=t13+c+65535,c=Math.floor(v/65536),t13=v-c*65536,v=t14+c+65535,c=Math.floor(v/65536),t14=v-c*65536,v=t15+c+65535,c=Math.floor(v/65536),t15=v-c*65536,t0+=c-1+37*(c-1),c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-c*65536,v=t1+c+65535,c=Math.floor(v/65536),t1=v-c*65536,v=t2+c+65535,c=Math.floor(v/65536),t2=v-c*65536,v=t3+c+65535,c=Math.floor(v/65536),t3=v-c*65536,v=t4+c+65535,c=Math.floor(v/65536),t4=v-c*65536,v=t5+c+65535,c=Math.floor(v/65536),t5=v-c*65536,v=t6+c+65535,c=Math.floor(v/65536),t6=v-c*65536,v=t7+c+65535,c=Math.floor(v/65536),t7=v-c*65536,v=t8+c+65535,c=Math.floor(v/65536),t8=v-c*65536,v=t9+c+65535,c=Math.floor(v/65536),t9=v-c*65536,v=t10+c+65535,c=Math.floor(v/65536),t10=v-c*65536,v=t11+c+65535,c=Math.floor(v/65536),t11=v-c*65536,v=t12+c+65535,c=Math.floor(v/65536),t12=v-c*65536,v=t13+c+65535,c=Math.floor(v/65536),t13=v-c*65536,v=t14+c+65535,c=Math.floor(v/65536),t14=v-c*65536,v=t15+c+65535,c=Math.floor(v/65536),t15=v-c*65536,t0+=c-1+37*(c-1),o[0]=t0,o[1]=t1,o[2]=t2,o[3]=t3,o[4]=t4,o[5]=t5,o[6]=t6,o[7]=t7,o[8]=t8,o[9]=t9,o[10]=t10,o[11]=t11,o[12]=t12,o[13]=t13,o[14]=t14,o[15]=t15}function S(o,a){M(o,a,a)}function inv25519(o,i){var c=gf(),a;for(a=0;a<16;a++)c[a]=i[a];for(a=253;a>=0;a--)if(S(c,c),a!==2&&a!==4)M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function pow2523(o,i){var c=gf(),a;for(a=0;a<16;a++)c[a]=i[a];for(a=250;a>=0;a--)if(S(c,c),a!==1)M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function crypto_scalarmult(q,n,p){var z=new Uint8Array(32),x=new Float64Array(80),r,i,a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf();for(i=0;i<31;i++)z[i]=n[i];z[31]=n[31]&127|64,z[0]&=248,unpack25519(x,p);for(i=0;i<16;i++)b[i]=x[i],d[i]=a[i]=c[i]=0;a[0]=d[0]=1;for(i=254;i>=0;--i)r=z[i>>>3]>>>(i&7)&1,sel25519(a,b,r),sel25519(c,d,r),A(e,a,c),Z(a,a,c),A(c,b,d),Z(b,b,d),S(d,e),S(f,a),M(a,c,a),M(c,b,e),A(e,a,c),Z(a,a,c),S(b,a),Z(c,d,f),M(a,c,_121665),A(a,a,d),M(c,c,a),M(a,d,f),M(d,b,x),S(b,e),sel25519(a,b,r),sel25519(c,d,r);for(i=0;i<16;i++)x[i+16]=a[i],x[i+32]=c[i],x[i+48]=b[i],x[i+64]=d[i];var x32=x.subarray(32),x16=x.subarray(16);return inv25519(x32,x32),M(x16,x16,x32),pack25519(q,x16),0}function crypto_scalarmult_base(q,n){return crypto_scalarmult(q,n,_9)}function crypto_box_keypair(y,x){return randombytes(x,32),crypto_scalarmult_base(y,x)}function crypto_box_beforenm(k,y,x){var s=new Uint8Array(32);return crypto_scalarmult(s,x,y),crypto_core_hsalsa20(k,_0,s,sigma)}var crypto_box_afternm=crypto_secretbox,crypto_box_open_afternm=crypto_secretbox_open;function crypto_box(c,m,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_afternm(c,m,d,n,k)}function crypto_box_open(m,c,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_open_afternm(m,c,d,n,k)}var K=[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];function crypto_hashblocks_hl(hh,hl,m,n){var wh=new Int32Array(16),wl=new Int32Array(16),bh0,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bl0,bl1,bl2,bl3,bl4,bl5,bl6,bl7,th,tl,i,j,h,l,a,b,c,d,ah0=hh[0],ah1=hh[1],ah2=hh[2],ah3=hh[3],ah4=hh[4],ah5=hh[5],ah6=hh[6],ah7=hh[7],al0=hl[0],al1=hl[1],al2=hl[2],al3=hl[3],al4=hl[4],al5=hl[5],al6=hl[6],al7=hl[7],pos=0;while(n>=128){for(i=0;i<16;i++)j=8*i+pos,wh[i]=m[j+0]<<24|m[j+1]<<16|m[j+2]<<8|m[j+3],wl[i]=m[j+4]<<24|m[j+5]<<16|m[j+6]<<8|m[j+7];for(i=0;i<80;i++)if(bh0=ah0,bh1=ah1,bh2=ah2,bh3=ah3,bh4=ah4,bh5=ah5,bh6=ah6,bh7=ah7,bl0=al0,bl1=al1,bl2=al2,bl3=al3,bl4=al4,bl5=al5,bl6=al6,bl7=al7,h=ah7,l=al7,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=(ah4>>>14|al4<<18)^(ah4>>>18|al4<<14)^(al4>>>9|ah4<<23),l=(al4>>>14|ah4<<18)^(al4>>>18|ah4<<14)^(ah4>>>9|al4<<23),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=ah4&ah5^~ah4&ah6,l=al4&al5^~al4&al6,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=K[i*2],l=K[i*2+1],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=wh[i%16],l=wl[i%16],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,th=c&65535|d<<16,tl=a&65535|b<<16,h=th,l=tl,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=(ah0>>>28|al0<<4)^(al0>>>2|ah0<<30)^(al0>>>7|ah0<<25),l=(al0>>>28|ah0<<4)^(ah0>>>2|al0<<30)^(ah0>>>7|al0<<25),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=ah0&ah1^ah0&ah2^ah1&ah2,l=al0&al1^al0&al2^al1&al2,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh7=c&65535|d<<16,bl7=a&65535|b<<16,h=bh3,l=bl3,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=th,l=tl,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh3=c&65535|d<<16,bl3=a&65535|b<<16,ah1=bh0,ah2=bh1,ah3=bh2,ah4=bh3,ah5=bh4,ah6=bh5,ah7=bh6,ah0=bh7,al1=bl0,al2=bl1,al3=bl2,al4=bl3,al5=bl4,al6=bl5,al7=bl6,al0=bl7,i%16===15)for(j=0;j<16;j++)h=wh[j],l=wl[j],a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=wh[(j+9)%16],l=wl[(j+9)%16],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,th=wh[(j+1)%16],tl=wl[(j+1)%16],h=(th>>>1|tl<<31)^(th>>>8|tl<<24)^th>>>7,l=(tl>>>1|th<<31)^(tl>>>8|th<<24)^(tl>>>7|th<<25),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,th=wh[(j+14)%16],tl=wl[(j+14)%16],h=(th>>>19|tl<<13)^(tl>>>29|th<<3)^th>>>6,l=(tl>>>19|th<<13)^(th>>>29|tl<<3)^(tl>>>6|th<<26),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,wh[j]=c&65535|d<<16,wl[j]=a&65535|b<<16;h=ah0,l=al0,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[0],l=hl[0],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[0]=ah0=c&65535|d<<16,hl[0]=al0=a&65535|b<<16,h=ah1,l=al1,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[1],l=hl[1],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[1]=ah1=c&65535|d<<16,hl[1]=al1=a&65535|b<<16,h=ah2,l=al2,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[2],l=hl[2],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[2]=ah2=c&65535|d<<16,hl[2]=al2=a&65535|b<<16,h=ah3,l=al3,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[3],l=hl[3],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[3]=ah3=c&65535|d<<16,hl[3]=al3=a&65535|b<<16,h=ah4,l=al4,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[4],l=hl[4],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[4]=ah4=c&65535|d<<16,hl[4]=al4=a&65535|b<<16,h=ah5,l=al5,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[5],l=hl[5],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[5]=ah5=c&65535|d<<16,hl[5]=al5=a&65535|b<<16,h=ah6,l=al6,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[6],l=hl[6],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[6]=ah6=c&65535|d<<16,hl[6]=al6=a&65535|b<<16,h=ah7,l=al7,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[7],l=hl[7],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[7]=ah7=c&65535|d<<16,hl[7]=al7=a&65535|b<<16,pos+=128,n-=128}return n}function crypto_hash(out,m,n){var hh=new Int32Array(8),hl=new Int32Array(8),x=new Uint8Array(256),i,b=n;hh[0]=1779033703,hh[1]=3144134277,hh[2]=1013904242,hh[3]=2773480762,hh[4]=1359893119,hh[5]=2600822924,hh[6]=528734635,hh[7]=1541459225,hl[0]=4089235720,hl[1]=2227873595,hl[2]=4271175723,hl[3]=1595750129,hl[4]=2917565137,hl[5]=725511199,hl[6]=4215389547,hl[7]=327033209,crypto_hashblocks_hl(hh,hl,m,n),n%=128;for(i=0;i<n;i++)x[i]=m[b-n+i];x[n]=128,n=256-128*(n<112?1:0),x[n-9]=0,ts64(x,n-8,b/536870912|0,b<<3),crypto_hashblocks_hl(hh,hl,x,n);for(i=0;i<8;i++)ts64(out,8*i,hh[i],hl[i]);return 0}function add(p,q){var a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf(),g=gf(),h=gf(),t=gf();Z(a,p[1],p[0]),Z(t,q[1],q[0]),M(a,a,t),A(b,p[0],p[1]),A(t,q[0],q[1]),M(b,b,t),M(c,p[3],q[3]),M(c,c,D2),M(d,p[2],q[2]),A(d,d,d),Z(e,b,a),Z(f,d,c),A(g,d,c),A(h,b,a),M(p[0],e,f),M(p[1],h,g),M(p[2],g,f),M(p[3],e,h)}function cswap(p,q,b){var i;for(i=0;i<4;i++)sel25519(p[i],q[i],b)}function pack(r,p){var tx=gf(),ty=gf(),zi=gf();inv25519(zi,p[2]),M(tx,p[0],zi),M(ty,p[1],zi),pack25519(r,ty),r[31]^=par25519(tx)<<7}function scalarmult(p,q,s){var b,i;set25519(p[0],gf0),set25519(p[1],gf1),set25519(p[2],gf1),set25519(p[3],gf0);for(i=255;i>=0;--i)b=s[i/8|0]>>(i&7)&1,cswap(p,q,b),add(q,p),add(p,p),cswap(p,q,b)}function scalarbase(p,s){var q=[gf(),gf(),gf(),gf()];set25519(q[0],X),set25519(q[1],Y),set25519(q[2],gf1),M(q[3],X,Y),scalarmult(p,q,s)}function crypto_sign_keypair(pk,sk,seeded){var d=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],i;if(!seeded)randombytes(sk,32);crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64,scalarbase(p,d),pack(pk,p);for(i=0;i<32;i++)sk[i+32]=pk[i];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function modL(r,x){var carry,i,j,k;for(i=63;i>=32;--i){carry=0;for(j=i-32,k=i-12;j<k;++j)x[j]+=carry-16*x[i]*L[j-(i-32)],carry=x[j]+128>>8,x[j]-=carry*256;x[j]+=carry,x[i]=0}carry=0;for(j=0;j<32;j++)x[j]+=carry-(x[31]>>4)*L[j],carry=x[j]>>8,x[j]&=255;for(j=0;j<32;j++)x[j]-=carry*L[j];for(i=0;i<32;i++)x[i+1]+=x[i]>>8,r[i]=x[i]&255}function reduce(r){var x=new Float64Array(64),i;for(i=0;i<64;i++)x[i]=r[i];for(i=0;i<64;i++)r[i]=0;modL(r,x)}function crypto_sign(sm,m,n,sk){var d=new Uint8Array(64),h=new Uint8Array(64),r=new Uint8Array(64),i,j,x=new Float64Array(64),p=[gf(),gf(),gf(),gf()];crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64;var smlen=n+64;for(i=0;i<n;i++)sm[64+i]=m[i];for(i=0;i<32;i++)sm[32+i]=d[32+i];crypto_hash(r,sm.subarray(32),n+32),reduce(r),scalarbase(p,r),pack(sm,p);for(i=32;i<64;i++)sm[i]=sk[i];crypto_hash(h,sm,n+64),reduce(h);for(i=0;i<64;i++)x[i]=0;for(i=0;i<32;i++)x[i]=r[i];for(i=0;i<32;i++)for(j=0;j<32;j++)x[i+j]+=h[i]*d[j];return modL(sm.subarray(32),x),smlen}function unpackneg(r,p){var t=gf(),chk=gf(),num=gf(),den=gf(),den2=gf(),den4=gf(),den6=gf();if(set25519(r[2],gf1),unpack25519(r[1],p),S(num,r[1]),M(den,num,D),Z(num,num,r[2]),A(den,r[2],den),S(den2,den),S(den4,den2),M(den6,den4,den2),M(t,den6,num),M(t,t,den),pow2523(t,t),M(t,t,num),M(t,t,den),M(t,t,den),M(r[0],t,den),S(chk,r[0]),M(chk,chk,den),neq25519(chk,num))M(r[0],r[0],I);if(S(chk,r[0]),M(chk,chk,den),neq25519(chk,num))return-1;if(par25519(r[0])===p[31]>>7)Z(r[0],gf0,r[0]);return M(r[3],r[0],r[1]),0}function crypto_sign_open(m,sm,n,pk){var i,mlen,t=new Uint8Array(32),h=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],q=[gf(),gf(),gf(),gf()];if(mlen=-1,n<64)return-1;if(unpackneg(q,pk))return-1;for(i=0;i<n;i++)m[i]=sm[i];for(i=0;i<32;i++)m[i+32]=pk[i];if(crypto_hash(h,m,n),reduce(h),scalarmult(p,q,h),scalarbase(q,sm.subarray(32)),add(p,q),pack(t,p),n-=64,crypto_verify_32(sm,0,t,0)){for(i=0;i<n;i++)m[i]=0;return-1}for(i=0;i<n;i++)m[i]=sm[i+64];return mlen=n,mlen}var crypto_secretbox_KEYBYTES=32,crypto_secretbox_NONCEBYTES=24,crypto_secretbox_ZEROBYTES=32,crypto_secretbox_BOXZEROBYTES=16,crypto_scalarmult_BYTES=32,crypto_scalarmult_SCALARBYTES=32,crypto_box_PUBLICKEYBYTES=32,crypto_box_SECRETKEYBYTES=32,crypto_box_BEFORENMBYTES=32,crypto_box_NONCEBYTES=crypto_secretbox_NONCEBYTES,crypto_box_ZEROBYTES=crypto_secretbox_ZEROBYTES,crypto_box_BOXZEROBYTES=crypto_secretbox_BOXZEROBYTES,crypto_sign_BYTES=64,crypto_sign_PUBLICKEYBYTES=32,crypto_sign_SECRETKEYBYTES=64,crypto_sign_SEEDBYTES=32,crypto_hash_BYTES=64;nacl.lowlevel={crypto_core_hsalsa20,crypto_stream_xor,crypto_stream,crypto_stream_salsa20_xor,crypto_stream_salsa20,crypto_onetimeauth,crypto_onetimeauth_verify,crypto_verify_16,crypto_verify_32,crypto_secretbox,crypto_secretbox_open,crypto_scalarmult,crypto_scalarmult_base,crypto_box_beforenm,crypto_box_afternm,crypto_box,crypto_box_open,crypto_box_keypair,crypto_hash,crypto_sign,crypto_sign_keypair,crypto_sign_open,crypto_secretbox_KEYBYTES,crypto_secretbox_NONCEBYTES,crypto_secretbox_ZEROBYTES,crypto_secretbox_BOXZEROBYTES,crypto_scalarmult_BYTES,crypto_scalarmult_SCALARBYTES,crypto_box_PUBLICKEYBYTES,crypto_box_SECRETKEYBYTES,crypto_box_BEFORENMBYTES,crypto_box_NONCEBYTES,crypto_box_ZEROBYTES,crypto_box_BOXZEROBYTES,crypto_sign_BYTES,crypto_sign_PUBLICKEYBYTES,crypto_sign_SECRETKEYBYTES,crypto_sign_SEEDBYTES,crypto_hash_BYTES};function checkLengths(k,n){if(k.length!==crypto_secretbox_KEYBYTES)throw Error("bad key size");if(n.length!==crypto_secretbox_NONCEBYTES)throw Error("bad nonce size")}function checkBoxLengths(pk,sk){if(pk.length!==crypto_box_PUBLICKEYBYTES)throw Error("bad public key size");if(sk.length!==crypto_box_SECRETKEYBYTES)throw Error("bad secret key size")}function checkArrayTypes(){var t,i;for(i=0;i<arguments.length;i++)if((t=Object.prototype.toString.call(arguments[i]))!=="[object Uint8Array]")throw TypeError("unexpected type "+t+", use Uint8Array")}function cleanup(arr){for(var i=0;i<arr.length;i++)arr[i]=0}if(!nacl.util)nacl.util={},nacl.util.decodeUTF8=nacl.util.encodeUTF8=nacl.util.encodeBase64=nacl.util.decodeBase64=function(){throw Error("nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js")};nacl.randomBytes=function(n){var b=new Uint8Array(n);return randombytes(b,n),b},nacl.secretbox=function(msg,nonce,key){checkArrayTypes(msg,nonce,key),checkLengths(key,nonce);var m=new Uint8Array(crypto_secretbox_ZEROBYTES+msg.length),c=new Uint8Array(m.length);for(var i=0;i<msg.length;i++)m[i+crypto_secretbox_ZEROBYTES]=msg[i];return crypto_secretbox(c,m,m.length,nonce,key),c.subarray(crypto_secretbox_BOXZEROBYTES)},nacl.secretbox.open=function(box,nonce,key){checkArrayTypes(box,nonce,key),checkLengths(key,nonce);var c=new Uint8Array(crypto_secretbox_BOXZEROBYTES+box.length),m=new Uint8Array(c.length);for(var i=0;i<box.length;i++)c[i+crypto_secretbox_BOXZEROBYTES]=box[i];if(c.length<32)return!1;if(crypto_secretbox_open(m,c,c.length,nonce,key)!==0)return!1;return m.subarray(crypto_secretbox_ZEROBYTES)},nacl.secretbox.keyLength=crypto_secretbox_KEYBYTES,nacl.secretbox.nonceLength=crypto_secretbox_NONCEBYTES,nacl.secretbox.overheadLength=crypto_secretbox_BOXZEROBYTES,nacl.scalarMult=function(n,p){if(checkArrayTypes(n,p),n.length!==crypto_scalarmult_SCALARBYTES)throw Error("bad n size");if(p.length!==crypto_scalarmult_BYTES)throw Error("bad p size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult(q,n,p),q},nacl.scalarMult.base=function(n){if(checkArrayTypes(n),n.length!==crypto_scalarmult_SCALARBYTES)throw Error("bad n size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult_base(q,n),q},nacl.scalarMult.scalarLength=crypto_scalarmult_SCALARBYTES,nacl.scalarMult.groupElementLength=crypto_scalarmult_BYTES,nacl.box=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox(msg,nonce,k)},nacl.box.before=function(publicKey,secretKey){checkArrayTypes(publicKey,secretKey),checkBoxLengths(publicKey,secretKey);var k=new Uint8Array(crypto_box_BEFORENMBYTES);return crypto_box_beforenm(k,publicKey,secretKey),k},nacl.box.after=nacl.secretbox,nacl.box.open=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox.open(msg,nonce,k)},nacl.box.open.after=nacl.secretbox.open,nacl.box.keyPair=function(){var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES),sk=new Uint8Array(crypto_box_SECRETKEYBYTES);return crypto_box_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.box.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),secretKey.length!==crypto_box_SECRETKEYBYTES)throw Error("bad secret key size");var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES);return crypto_scalarmult_base(pk,secretKey),{publicKey:pk,secretKey:new Uint8Array(secretKey)}},nacl.box.publicKeyLength=crypto_box_PUBLICKEYBYTES,nacl.box.secretKeyLength=crypto_box_SECRETKEYBYTES,nacl.box.sharedKeyLength=crypto_box_BEFORENMBYTES,nacl.box.nonceLength=crypto_box_NONCEBYTES,nacl.box.overheadLength=nacl.secretbox.overheadLength,nacl.sign=function(msg,secretKey){if(checkArrayTypes(msg,secretKey),secretKey.length!==crypto_sign_SECRETKEYBYTES)throw Error("bad secret key size");var signedMsg=new Uint8Array(crypto_sign_BYTES+msg.length);return crypto_sign(signedMsg,msg,msg.length,secretKey),signedMsg},nacl.sign.open=function(signedMsg,publicKey){if(arguments.length!==2)throw Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(checkArrayTypes(signedMsg,publicKey),publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw Error("bad public key size");var tmp=new Uint8Array(signedMsg.length),mlen=crypto_sign_open(tmp,signedMsg,signedMsg.length,publicKey);if(mlen<0)return null;var m=new Uint8Array(mlen);for(var i=0;i<m.length;i++)m[i]=tmp[i];return m},nacl.sign.detached=function(msg,secretKey){var signedMsg=nacl.sign(msg,secretKey),sig=new Uint8Array(crypto_sign_BYTES);for(var i=0;i<sig.length;i++)sig[i]=signedMsg[i];return sig},nacl.sign.detached.verify=function(msg,sig,publicKey){if(checkArrayTypes(msg,sig,publicKey),sig.length!==crypto_sign_BYTES)throw Error("bad signature size");if(publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw Error("bad public key size");var sm=new Uint8Array(crypto_sign_BYTES+msg.length),m=new Uint8Array(crypto_sign_BYTES+msg.length),i;for(i=0;i<crypto_sign_BYTES;i++)sm[i]=sig[i];for(i=0;i<msg.length;i++)sm[i+crypto_sign_BYTES]=msg[i];return crypto_sign_open(m,sm,sm.length,publicKey)>=0},nacl.sign.keyPair=function(){var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES),sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);return crypto_sign_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.sign.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),secretKey.length!==crypto_sign_SECRETKEYBYTES)throw Error("bad secret key size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES);for(var i=0;i<pk.length;i++)pk[i]=secretKey[32+i];return{publicKey:pk,secretKey:new Uint8Array(secretKey)}},nacl.sign.keyPair.fromSeed=function(seed){if(checkArrayTypes(seed),seed.length!==crypto_sign_SEEDBYTES)throw Error("bad seed size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES),sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);for(var i=0;i<32;i++)sk[i]=seed[i];return crypto_sign_keypair(pk,sk,!0),{publicKey:pk,secretKey:sk}},nacl.sign.publicKeyLength=crypto_sign_PUBLICKEYBYTES,nacl.sign.secretKeyLength=crypto_sign_SECRETKEYBYTES,nacl.sign.seedLength=crypto_sign_SEEDBYTES,nacl.sign.signatureLength=crypto_sign_BYTES,nacl.hash=function(msg){checkArrayTypes(msg);var h=new Uint8Array(crypto_hash_BYTES);return crypto_hash(h,msg,msg.length),h},nacl.hash.hashLength=crypto_hash_BYTES,nacl.verify=function(x,y){if(checkArrayTypes(x,y),x.length===0||y.length===0)return!1;if(x.length!==y.length)return!1;return vn(x,0,y,0,x.length)===0?!0:!1},nacl.setPRNG=function(fn){randombytes=fn},function(){var crypto=typeof self<"u"?self.crypto||self.msCrypto:null;if(crypto&&crypto.getRandomValues){var QUOTA=65536;nacl.setPRNG(function(x,n){var i,v=new Uint8Array(n);for(i=0;i<n;i+=QUOTA)crypto.getRandomValues(v.subarray(i,i+Math.min(n-i,QUOTA)));for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}else if(crypto=__require("crypto"),crypto&&crypto.randomBytes)nacl.setPRNG(function(x,n){var i,v=crypto.randomBytes(n);for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}()})(typeof module<"u"&&exports?exports:self.nacl=self.nacl||{})});var require_bcrypt_pbkdf=__commonJS((exports,module)=>{var crypto_hash_sha512=require_nacl_fast().lowlevel.crypto_hash,BLF_J=0,Blowfish=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,2909710000,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409000,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function F(S,x8,i){return(S[0][x8[i+3]]+S[1][x8[i+2]]^S[2][x8[i+1]])+S[3][x8[i]]}Blowfish.prototype.encipher=function(x,x8){if(x8===void 0){if(x8=new Uint8Array(x.buffer),x.byteOffset!==0)x8=x8.subarray(x.byteOffset)}x[0]^=this.P[0];for(var i=1;i<16;i+=2)x[1]^=F(this.S,x8,0)^this.P[i],x[0]^=F(this.S,x8,4)^this.P[i+1];var t=x[0];x[0]=x[1]^this.P[17],x[1]=t};Blowfish.prototype.decipher=function(x){var x8=new Uint8Array(x.buffer);if(x.byteOffset!==0)x8=x8.subarray(x.byteOffset);x[0]^=this.P[17];for(var i=16;i>0;i-=2)x[1]^=F(this.S,x8,0)^this.P[i],x[0]^=F(this.S,x8,4)^this.P[i-1];var t=x[0];x[0]=x[1]^this.P[0],x[1]=t};function stream2word(data,databytes){var i,temp=0;for(i=0;i<4;i++,BLF_J++){if(BLF_J>=databytes)BLF_J=0;temp=temp<<8|data[BLF_J]}return temp}Blowfish.prototype.expand0state=function(key,keybytes){var d=new Uint32Array(2),i,k,d8=new Uint8Array(d.buffer);for(i=0,BLF_J=0;i<18;i++)this.P[i]^=stream2word(key,keybytes);BLF_J=0;for(i=0;i<18;i+=2)this.encipher(d,d8),this.P[i]=d[0],this.P[i+1]=d[1];for(i=0;i<4;i++)for(k=0;k<256;k+=2)this.encipher(d,d8),this.S[i][k]=d[0],this.S[i][k+1]=d[1]};Blowfish.prototype.expandstate=function(data,databytes,key,keybytes){var d=new Uint32Array(2),i,k;for(i=0,BLF_J=0;i<18;i++)this.P[i]^=stream2word(key,keybytes);for(i=0,BLF_J=0;i<18;i+=2)d[0]^=stream2word(data,databytes),d[1]^=stream2word(data,databytes),this.encipher(d),this.P[i]=d[0],this.P[i+1]=d[1];for(i=0;i<4;i++)for(k=0;k<256;k+=2)d[0]^=stream2word(data,databytes),d[1]^=stream2word(data,databytes),this.encipher(d),this.S[i][k]=d[0],this.S[i][k+1]=d[1];BLF_J=0};Blowfish.prototype.enc=function(data,blocks){for(var i=0;i<blocks;i++)this.encipher(data.subarray(i*2))};Blowfish.prototype.dec=function(data,blocks){for(var i=0;i<blocks;i++)this.decipher(data.subarray(i*2))};var BCRYPT_BLOCKS=8,BCRYPT_HASHSIZE=32;function bcrypt_hash(sha2pass,sha2salt,out){var state=new Blowfish,cdata=new Uint32Array(BCRYPT_BLOCKS),i,ciphertext=new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,105,116,101]);state.expandstate(sha2salt,64,sha2pass,64);for(i=0;i<64;i++)state.expand0state(sha2salt,64),state.expand0state(sha2pass,64);for(i=0;i<BCRYPT_BLOCKS;i++)cdata[i]=stream2word(ciphertext,ciphertext.byteLength);for(i=0;i<64;i++)state.enc(cdata,cdata.byteLength/8);for(i=0;i<BCRYPT_BLOCKS;i++)out[4*i+3]=cdata[i]>>>24,out[4*i+2]=cdata[i]>>>16,out[4*i+1]=cdata[i]>>>8,out[4*i+0]=cdata[i]}function bcrypt_pbkdf(pass,passlen,salt,saltlen,key,keylen,rounds){var sha2pass=new Uint8Array(64),sha2salt=new Uint8Array(64),out=new Uint8Array(BCRYPT_HASHSIZE),tmpout=new Uint8Array(BCRYPT_HASHSIZE),countsalt=new Uint8Array(saltlen+4),i,j,amt,stride,dest,count,origkeylen=keylen;if(rounds<1)return-1;if(passlen===0||saltlen===0||keylen===0||keylen>out.byteLength*out.byteLength||saltlen>1048576)return-1;stride=Math.floor((keylen+out.byteLength-1)/out.byteLength),amt=Math.floor((keylen+stride-1)/stride);for(i=0;i<saltlen;i++)countsalt[i]=salt[i];crypto_hash_sha512(sha2pass,pass,passlen);for(count=1;keylen>0;count++){countsalt[saltlen+0]=count>>>24,countsalt[saltlen+1]=count>>>16,countsalt[saltlen+2]=count>>>8,countsalt[saltlen+3]=count,crypto_hash_sha512(sha2salt,countsalt,saltlen+4),bcrypt_hash(sha2pass,sha2salt,tmpout);for(i=out.byteLength;i--;)out[i]=tmpout[i];for(i=1;i<rounds;i++){crypto_hash_sha512(sha2salt,tmpout,tmpout.byteLength),bcrypt_hash(sha2pass,sha2salt,tmpout);for(j=0;j<out.byteLength;j++)out[j]^=tmpout[j]}amt=Math.min(amt,keylen);for(i=0;i<amt;i++){if(dest=i*stride+(count-1),dest>=origkeylen)break;key[dest]=out[i]}keylen-=i}return 0}module.exports={BLOCKS:BCRYPT_BLOCKS,HASHSIZE:BCRYPT_HASHSIZE,hash:bcrypt_hash,pbkdf:bcrypt_pbkdf}});var require_cpufeatures=__commonJS((exports,module)=>{module.exports=__require("./cpufeatures-35tjfzct.node")});var require_lib2=__commonJS((exports,module)=>{var binding=require_cpufeatures();module.exports=binding.getCPUInfo});var require_constants=__commonJS((exports,module)=>{var crypto=__require("crypto"),cpuInfo;try{cpuInfo=require_lib2()()}catch{}var{bindingAvailable,CIPHER_INFO,MAC_INFO}=require_crypto(),eddsaSupported=(()=>{if(typeof crypto.sign==="function"&&typeof crypto.verify==="function"){let key=`-----BEGIN PRIVATE KEY-----\r
2
+ var __create=Object.create;var{getPrototypeOf:__getProtoOf,defineProperty:__defProp,getOwnPropertyNames:__getOwnPropNames}=Object;var __hasOwnProp=Object.prototype.hasOwnProperty;function __accessProp(key){return this[key]}var __toESMCache_node,__toESMCache_esm,__toESM=(mod,isNodeMode,target)=>{var canCache=mod!=null&&typeof mod==="object";if(canCache){var cache=isNodeMode?__toESMCache_node??=new WeakMap:__toESMCache_esm??=new WeakMap,cached=cache.get(mod);if(cached)return cached}target=mod!=null?__create(__getProtoOf(mod)):{};let to=isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target;for(let key of __getOwnPropNames(mod))if(!__hasOwnProp.call(to,key))__defProp(to,key,{get:__accessProp.bind(mod,key),enumerable:!0});if(canCache)cache.set(mod,to);return to};var __commonJS=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports);var __returnValue=(v)=>v;function __exportSetter(name,newValue){this[name]=__returnValue.bind(null,newValue)}var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0,configurable:!0,set:__exportSetter.bind(all,name)})};var __esm=(fn,res)=>()=>(fn&&(res=fn(fn=0)),res);var __require=import.meta.require;var require_errors=__commonJS((exports,module)=>{module.exports={newInvalidAsn1Error:function(msg){var e=Error();return e.name="InvalidAsn1Error",e.message=msg||"",e}}});var require_types=__commonJS((exports,module)=>{module.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}});var require_safer=__commonJS((exports,module)=>{var buffer=__require("buffer"),Buffer2=buffer.Buffer,safer={},key;for(key in buffer){if(!buffer.hasOwnProperty(key))continue;if(key==="SlowBuffer"||key==="Buffer")continue;safer[key]=buffer[key]}var Safer=safer.Buffer={};for(key in Buffer2){if(!Buffer2.hasOwnProperty(key))continue;if(key==="allocUnsafe"||key==="allocUnsafeSlow")continue;Safer[key]=Buffer2[key]}safer.Buffer.prototype=Buffer2.prototype;if(!Safer.from||Safer.from===Uint8Array.from)Safer.from=function(value,encodingOrOffset,length){if(typeof value==="number")throw TypeError('The "value" argument must not be of type number. Received type '+typeof value);if(value&&typeof value.length>"u")throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof value);return Buffer2(value,encodingOrOffset,length)};if(!Safer.alloc)Safer.alloc=function(size,fill,encoding){if(typeof size!=="number")throw TypeError('The "size" argument must be of type number. Received type '+typeof size);if(size<0||size>=2147483648)throw RangeError('The value "'+size+'" is invalid for option "size"');var buf=Buffer2(size);if(!fill||fill.length===0)buf.fill(0);else if(typeof encoding==="string")buf.fill(fill,encoding);else buf.fill(fill);return buf};if(!safer.kStringMaxLength)try{safer.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(e){}if(!safer.constants){if(safer.constants={MAX_LENGTH:safer.kMaxLength},safer.kStringMaxLength)safer.constants.MAX_STRING_LENGTH=safer.kStringMaxLength}module.exports=safer});var require_reader=__commonJS((exports,module)=>{var assert=__require("assert"),Buffer2=require_safer().Buffer,ASN1=require_types(),errors=require_errors(),newInvalidAsn1Error=errors.newInvalidAsn1Error;function Reader(data){if(!data||!Buffer2.isBuffer(data))throw TypeError("data must be a node Buffer");this._buf=data,this._size=data.length,this._len=0,this._offset=0}Object.defineProperty(Reader.prototype,"length",{enumerable:!0,get:function(){return this._len}});Object.defineProperty(Reader.prototype,"offset",{enumerable:!0,get:function(){return this._offset}});Object.defineProperty(Reader.prototype,"remain",{get:function(){return this._size-this._offset}});Object.defineProperty(Reader.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}});Reader.prototype.readByte=function(peek){if(this._size-this._offset<1)return null;var b=this._buf[this._offset]&255;if(!peek)this._offset+=1;return b};Reader.prototype.peek=function(){return this.readByte(!0)};Reader.prototype.readLength=function(offset){if(offset===void 0)offset=this._offset;if(offset>=this._size)return null;var lenB=this._buf[offset++]&255;if(lenB===null)return null;if((lenB&128)===128){if(lenB&=127,lenB===0)throw newInvalidAsn1Error("Indefinite length not supported");if(lenB>4)throw newInvalidAsn1Error("encoding too long");if(this._size-offset<lenB)return null;this._len=0;for(var i=0;i<lenB;i++)this._len=(this._len<<8)+(this._buf[offset++]&255)}else this._len=lenB;return offset};Reader.prototype.readSequence=function(tag){var seq=this.peek();if(seq===null)return null;if(tag!==void 0&&tag!==seq)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+seq.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;return this._offset=o,seq};Reader.prototype.readInt=function(){return this._readTag(ASN1.Integer)};Reader.prototype.readBoolean=function(){return this._readTag(ASN1.Boolean)===0?!1:!0};Reader.prototype.readEnumeration=function(){return this._readTag(ASN1.Enumeration)};Reader.prototype.readString=function(tag,retbuf){if(!tag)tag=ASN1.OctetString;var b=this.peek();if(b===null)return null;if(b!==tag)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+b.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;if(this.length>this._size-o)return null;if(this._offset=o,this.length===0)return retbuf?Buffer2.alloc(0):"";var str=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,retbuf?str:str.toString("utf8")};Reader.prototype.readOID=function(tag){if(!tag)tag=ASN1.OID;var b=this.readString(tag,!0);if(b===null)return null;var values=[],value=0;for(var i=0;i<b.length;i++){var byte=b[i]&255;if(value<<=7,value+=byte&127,(byte&128)===0)values.push(value),value=0}return value=values.shift(),values.unshift(value%40),values.unshift(value/40>>0),values.join(".")};Reader.prototype._readTag=function(tag){assert.ok(tag!==void 0);var b=this.peek();if(b===null)return null;if(b!==tag)throw newInvalidAsn1Error("Expected 0x"+tag.toString(16)+": got 0x"+b.toString(16));var o=this.readLength(this._offset+1);if(o===null)return null;if(this.length>4)throw newInvalidAsn1Error("Integer too long: "+this.length);if(this.length>this._size-o)return null;this._offset=o;var fb=this._buf[this._offset],value=0;for(var i=0;i<this.length;i++)value<<=8,value|=this._buf[this._offset++]&255;if((fb&128)===128&&i!==4)value-=1<<i*8;return value>>0};module.exports=Reader});var require_writer=__commonJS((exports,module)=>{var assert=__require("assert"),Buffer2=require_safer().Buffer,ASN1=require_types(),errors=require_errors(),newInvalidAsn1Error=errors.newInvalidAsn1Error,DEFAULT_OPTS={size:1024,growthFactor:8};function merge(from,to){assert.ok(from),assert.equal(typeof from,"object"),assert.ok(to),assert.equal(typeof to,"object");var keys=Object.getOwnPropertyNames(from);return keys.forEach(function(key){if(to[key])return;var value=Object.getOwnPropertyDescriptor(from,key);Object.defineProperty(to,key,value)}),to}function Writer(options){options=merge(DEFAULT_OPTS,options||{}),this._buf=Buffer2.alloc(options.size||1024),this._size=this._buf.length,this._offset=0,this._options=options,this._seq=[]}Object.defineProperty(Writer.prototype,"buffer",{get:function(){if(this._seq.length)throw newInvalidAsn1Error(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}});Writer.prototype.writeByte=function(b){if(typeof b!=="number")throw TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=b};Writer.prototype.writeInt=function(i,tag){if(typeof i!=="number")throw TypeError("argument must be a Number");if(typeof tag!=="number")tag=ASN1.Integer;var sz=4;while(((i&4286578688)===0||(i&4286578688)===-8388608)&&sz>1)sz--,i<<=8;if(sz>4)throw newInvalidAsn1Error("BER ints cannot be > 0xffffffff");this._ensure(2+sz),this._buf[this._offset++]=tag,this._buf[this._offset++]=sz;while(sz-- >0)this._buf[this._offset++]=(i&4278190080)>>>24,i<<=8};Writer.prototype.writeNull=function(){this.writeByte(ASN1.Null),this.writeByte(0)};Writer.prototype.writeEnumeration=function(i,tag){if(typeof i!=="number")throw TypeError("argument must be a Number");if(typeof tag!=="number")tag=ASN1.Enumeration;return this.writeInt(i,tag)};Writer.prototype.writeBoolean=function(b,tag){if(typeof b!=="boolean")throw TypeError("argument must be a Boolean");if(typeof tag!=="number")tag=ASN1.Boolean;this._ensure(3),this._buf[this._offset++]=tag,this._buf[this._offset++]=1,this._buf[this._offset++]=b?255:0};Writer.prototype.writeString=function(s,tag){if(typeof s!=="string")throw TypeError("argument must be a string (was: "+typeof s+")");if(typeof tag!=="number")tag=ASN1.OctetString;var len=Buffer2.byteLength(s);if(this.writeByte(tag),this.writeLength(len),len)this._ensure(len),this._buf.write(s,this._offset),this._offset+=len};Writer.prototype.writeBuffer=function(buf,tag){if(typeof tag!=="number")throw TypeError("tag must be a number");if(!Buffer2.isBuffer(buf))throw TypeError("argument must be a buffer");this.writeByte(tag),this.writeLength(buf.length),this._ensure(buf.length),buf.copy(this._buf,this._offset,0,buf.length),this._offset+=buf.length};Writer.prototype.writeStringArray=function(strings){if(!strings instanceof Array)throw TypeError("argument must be an Array[String]");var self2=this;strings.forEach(function(s){self2.writeString(s)})};Writer.prototype.writeOID=function(s,tag){if(typeof s!=="string")throw TypeError("argument must be a string");if(typeof tag!=="number")tag=ASN1.OID;if(!/^([0-9]+\.){3,}[0-9]+$/.test(s))throw Error("argument is not a valid OID string");function encodeOctet(bytes2,octet){if(octet<128)bytes2.push(octet);else if(octet<16384)bytes2.push(octet>>>7|128),bytes2.push(octet&127);else if(octet<2097152)bytes2.push(octet>>>14|128),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127);else if(octet<268435456)bytes2.push(octet>>>21|128),bytes2.push((octet>>>14|128)&255),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127);else bytes2.push((octet>>>28|128)&255),bytes2.push((octet>>>21|128)&255),bytes2.push((octet>>>14|128)&255),bytes2.push((octet>>>7|128)&255),bytes2.push(octet&127)}var tmp=s.split("."),bytes=[];bytes.push(parseInt(tmp[0],10)*40+parseInt(tmp[1],10)),tmp.slice(2).forEach(function(b){encodeOctet(bytes,parseInt(b,10))});var self2=this;this._ensure(2+bytes.length),this.writeByte(tag),this.writeLength(bytes.length),bytes.forEach(function(b){self2.writeByte(b)})};Writer.prototype.writeLength=function(len){if(typeof len!=="number")throw TypeError("argument must be a Number");if(this._ensure(4),len<=127)this._buf[this._offset++]=len;else if(len<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=len;else if(len<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=len>>8,this._buf[this._offset++]=len;else if(len<=16777215)this._buf[this._offset++]=131,this._buf[this._offset++]=len>>16,this._buf[this._offset++]=len>>8,this._buf[this._offset++]=len;else throw newInvalidAsn1Error("Length too long (> 4 bytes)")};Writer.prototype.startSequence=function(tag){if(typeof tag!=="number")tag=ASN1.Sequence|ASN1.Constructor;this.writeByte(tag),this._seq.push(this._offset),this._ensure(3),this._offset+=3};Writer.prototype.endSequence=function(){var seq=this._seq.pop(),start=seq+3,len=this._offset-start;if(len<=127)this._shift(start,len,-2),this._buf[seq]=len;else if(len<=255)this._shift(start,len,-1),this._buf[seq]=129,this._buf[seq+1]=len;else if(len<=65535)this._buf[seq]=130,this._buf[seq+1]=len>>8,this._buf[seq+2]=len;else if(len<=16777215)this._shift(start,len,1),this._buf[seq]=131,this._buf[seq+1]=len>>16,this._buf[seq+2]=len>>8,this._buf[seq+3]=len;else throw newInvalidAsn1Error("Sequence too long")};Writer.prototype._shift=function(start,len,shift){assert.ok(start!==void 0),assert.ok(len!==void 0),assert.ok(shift),this._buf.copy(this._buf,start+shift,start,start+len),this._offset+=shift};Writer.prototype._ensure=function(len){if(assert.ok(len),this._size-this._offset<len){var sz=this._size*this._options.growthFactor;if(sz-this._offset<len)sz+=len;var buf=Buffer2.alloc(sz);this._buf.copy(buf,0,0,this._offset),this._buf=buf,this._size=sz}};module.exports=Writer});var require_ber=__commonJS((exports,module)=>{var errors=require_errors(),types=require_types(),Reader=require_reader(),Writer=require_writer();module.exports={Reader,Writer};for(t in types)if(types.hasOwnProperty(t))module.exports[t]=types[t];var t;for(e in errors)if(errors.hasOwnProperty(e))module.exports[e]=errors[e];var e});var require_lib=__commonJS((exports,module)=>{var Ber=require_ber();module.exports={Ber,BerReader:Ber.Reader,BerWriter:Ber.Writer}});var require_nacl_fast=__commonJS((exports,module)=>{(function(nacl){var gf=function(init){var i,r=new Float64Array(16);if(init)for(i=0;i<init.length;i++)r[i]=init[i];return r},randombytes=function(){throw Error("no PRNG")},_0=new Uint8Array(16),_9=new Uint8Array(32);_9[0]=9;var gf0=gf(),gf1=gf([1]),_121665=gf([56129,1]),D=gf([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),D2=gf([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),X=gf([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Y=gf([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),I=gf([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function ts64(x,i,h,l){x[i]=h>>24&255,x[i+1]=h>>16&255,x[i+2]=h>>8&255,x[i+3]=h&255,x[i+4]=l>>24&255,x[i+5]=l>>16&255,x[i+6]=l>>8&255,x[i+7]=l&255}function vn(x,xi,y,yi,n){var i,d=0;for(i=0;i<n;i++)d|=x[xi+i]^y[yi+i];return(1&d-1>>>8)-1}function crypto_verify_16(x,xi,y,yi){return vn(x,xi,y,yi,16)}function crypto_verify_32(x,xi,y,yi){return vn(x,xi,y,yi,32)}function core_salsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;x0=x0+j0|0,x1=x1+j1|0,x2=x2+j2|0,x3=x3+j3|0,x4=x4+j4|0,x5=x5+j5|0,x6=x6+j6|0,x7=x7+j7|0,x8=x8+j8|0,x9=x9+j9|0,x10=x10+j10|0,x11=x11+j11|0,x12=x12+j12|0,x13=x13+j13|0,x14=x14+j14|0,x15=x15+j15|0,o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x1>>>0&255,o[5]=x1>>>8&255,o[6]=x1>>>16&255,o[7]=x1>>>24&255,o[8]=x2>>>0&255,o[9]=x2>>>8&255,o[10]=x2>>>16&255,o[11]=x2>>>24&255,o[12]=x3>>>0&255,o[13]=x3>>>8&255,o[14]=x3>>>16&255,o[15]=x3>>>24&255,o[16]=x4>>>0&255,o[17]=x4>>>8&255,o[18]=x4>>>16&255,o[19]=x4>>>24&255,o[20]=x5>>>0&255,o[21]=x5>>>8&255,o[22]=x5>>>16&255,o[23]=x5>>>24&255,o[24]=x6>>>0&255,o[25]=x6>>>8&255,o[26]=x6>>>16&255,o[27]=x6>>>24&255,o[28]=x7>>>0&255,o[29]=x7>>>8&255,o[30]=x7>>>16&255,o[31]=x7>>>24&255,o[32]=x8>>>0&255,o[33]=x8>>>8&255,o[34]=x8>>>16&255,o[35]=x8>>>24&255,o[36]=x9>>>0&255,o[37]=x9>>>8&255,o[38]=x9>>>16&255,o[39]=x9>>>24&255,o[40]=x10>>>0&255,o[41]=x10>>>8&255,o[42]=x10>>>16&255,o[43]=x10>>>24&255,o[44]=x11>>>0&255,o[45]=x11>>>8&255,o[46]=x11>>>16&255,o[47]=x11>>>24&255,o[48]=x12>>>0&255,o[49]=x12>>>8&255,o[50]=x12>>>16&255,o[51]=x12>>>24&255,o[52]=x13>>>0&255,o[53]=x13>>>8&255,o[54]=x13>>>16&255,o[55]=x13>>>24&255,o[56]=x14>>>0&255,o[57]=x14>>>8&255,o[58]=x14>>>16&255,o[59]=x14>>>24&255,o[60]=x15>>>0&255,o[61]=x15>>>8&255,o[62]=x15>>>16&255,o[63]=x15>>>24&255}function core_hsalsa20(o,p,k,c){var j0=c[0]&255|(c[1]&255)<<8|(c[2]&255)<<16|(c[3]&255)<<24,j1=k[0]&255|(k[1]&255)<<8|(k[2]&255)<<16|(k[3]&255)<<24,j2=k[4]&255|(k[5]&255)<<8|(k[6]&255)<<16|(k[7]&255)<<24,j3=k[8]&255|(k[9]&255)<<8|(k[10]&255)<<16|(k[11]&255)<<24,j4=k[12]&255|(k[13]&255)<<8|(k[14]&255)<<16|(k[15]&255)<<24,j5=c[4]&255|(c[5]&255)<<8|(c[6]&255)<<16|(c[7]&255)<<24,j6=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,j7=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,j8=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,j9=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,j10=c[8]&255|(c[9]&255)<<8|(c[10]&255)<<16|(c[11]&255)<<24,j11=k[16]&255|(k[17]&255)<<8|(k[18]&255)<<16|(k[19]&255)<<24,j12=k[20]&255|(k[21]&255)<<8|(k[22]&255)<<16|(k[23]&255)<<24,j13=k[24]&255|(k[25]&255)<<8|(k[26]&255)<<16|(k[27]&255)<<24,j14=k[28]&255|(k[29]&255)<<8|(k[30]&255)<<16|(k[31]&255)<<24,j15=c[12]&255|(c[13]&255)<<8|(c[14]&255)<<16|(c[15]&255)<<24,x0=j0,x1=j1,x2=j2,x3=j3,x4=j4,x5=j5,x6=j6,x7=j7,x8=j8,x9=j9,x10=j10,x11=j11,x12=j12,x13=j13,x14=j14,x15=j15,u;for(var i=0;i<20;i+=2)u=x0+x12|0,x4^=u<<7|u>>>25,u=x4+x0|0,x8^=u<<9|u>>>23,u=x8+x4|0,x12^=u<<13|u>>>19,u=x12+x8|0,x0^=u<<18|u>>>14,u=x5+x1|0,x9^=u<<7|u>>>25,u=x9+x5|0,x13^=u<<9|u>>>23,u=x13+x9|0,x1^=u<<13|u>>>19,u=x1+x13|0,x5^=u<<18|u>>>14,u=x10+x6|0,x14^=u<<7|u>>>25,u=x14+x10|0,x2^=u<<9|u>>>23,u=x2+x14|0,x6^=u<<13|u>>>19,u=x6+x2|0,x10^=u<<18|u>>>14,u=x15+x11|0,x3^=u<<7|u>>>25,u=x3+x15|0,x7^=u<<9|u>>>23,u=x7+x3|0,x11^=u<<13|u>>>19,u=x11+x7|0,x15^=u<<18|u>>>14,u=x0+x3|0,x1^=u<<7|u>>>25,u=x1+x0|0,x2^=u<<9|u>>>23,u=x2+x1|0,x3^=u<<13|u>>>19,u=x3+x2|0,x0^=u<<18|u>>>14,u=x5+x4|0,x6^=u<<7|u>>>25,u=x6+x5|0,x7^=u<<9|u>>>23,u=x7+x6|0,x4^=u<<13|u>>>19,u=x4+x7|0,x5^=u<<18|u>>>14,u=x10+x9|0,x11^=u<<7|u>>>25,u=x11+x10|0,x8^=u<<9|u>>>23,u=x8+x11|0,x9^=u<<13|u>>>19,u=x9+x8|0,x10^=u<<18|u>>>14,u=x15+x14|0,x12^=u<<7|u>>>25,u=x12+x15|0,x13^=u<<9|u>>>23,u=x13+x12|0,x14^=u<<13|u>>>19,u=x14+x13|0,x15^=u<<18|u>>>14;o[0]=x0>>>0&255,o[1]=x0>>>8&255,o[2]=x0>>>16&255,o[3]=x0>>>24&255,o[4]=x5>>>0&255,o[5]=x5>>>8&255,o[6]=x5>>>16&255,o[7]=x5>>>24&255,o[8]=x10>>>0&255,o[9]=x10>>>8&255,o[10]=x10>>>16&255,o[11]=x10>>>24&255,o[12]=x15>>>0&255,o[13]=x15>>>8&255,o[14]=x15>>>16&255,o[15]=x15>>>24&255,o[16]=x6>>>0&255,o[17]=x6>>>8&255,o[18]=x6>>>16&255,o[19]=x6>>>24&255,o[20]=x7>>>0&255,o[21]=x7>>>8&255,o[22]=x7>>>16&255,o[23]=x7>>>24&255,o[24]=x8>>>0&255,o[25]=x8>>>8&255,o[26]=x8>>>16&255,o[27]=x8>>>24&255,o[28]=x9>>>0&255,o[29]=x9>>>8&255,o[30]=x9>>>16&255,o[31]=x9>>>24&255}function crypto_core_salsa20(out,inp,k,c){core_salsa20(out,inp,k,c)}function crypto_core_hsalsa20(out,inp,k,c){core_hsalsa20(out,inp,k,c)}var sigma=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64),u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=m[mpos+i]^x[i];u=1;for(i=8;i<16;i++)u=u+(z[i]&255)|0,z[i]=u&255,u>>>=8;b-=64,cpos+=64,mpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=m[mpos+i]^x[i]}return 0}function crypto_stream_salsa20(c,cpos,b,n,k){var z=new Uint8Array(16),x=new Uint8Array(64),u,i;for(i=0;i<16;i++)z[i]=0;for(i=0;i<8;i++)z[i]=n[i];while(b>=64){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<64;i++)c[cpos+i]=x[i];u=1;for(i=8;i<16;i++)u=u+(z[i]&255)|0,z[i]=u&255,u>>>=8;b-=64,cpos+=64}if(b>0){crypto_core_salsa20(x,z,k,sigma);for(i=0;i<b;i++)c[cpos+i]=x[i]}return 0}function crypto_stream(c,cpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20(c,cpos,d,sn,s)}function crypto_stream_xor(c,cpos,m,mpos,d,n,k){var s=new Uint8Array(32);crypto_core_hsalsa20(s,n,k,sigma);var sn=new Uint8Array(8);for(var i=0;i<8;i++)sn[i]=n[i+16];return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s)}var poly1305=function(key){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var t0,t1,t2,t3,t4,t5,t6,t7;t0=key[0]&255|(key[1]&255)<<8,this.r[0]=t0&8191,t1=key[2]&255|(key[3]&255)<<8,this.r[1]=(t0>>>13|t1<<3)&8191,t2=key[4]&255|(key[5]&255)<<8,this.r[2]=(t1>>>10|t2<<6)&7939,t3=key[6]&255|(key[7]&255)<<8,this.r[3]=(t2>>>7|t3<<9)&8191,t4=key[8]&255|(key[9]&255)<<8,this.r[4]=(t3>>>4|t4<<12)&255,this.r[5]=t4>>>1&8190,t5=key[10]&255|(key[11]&255)<<8,this.r[6]=(t4>>>14|t5<<2)&8191,t6=key[12]&255|(key[13]&255)<<8,this.r[7]=(t5>>>11|t6<<5)&8065,t7=key[14]&255|(key[15]&255)<<8,this.r[8]=(t6>>>8|t7<<8)&8191,this.r[9]=t7>>>5&127,this.pad[0]=key[16]&255|(key[17]&255)<<8,this.pad[1]=key[18]&255|(key[19]&255)<<8,this.pad[2]=key[20]&255|(key[21]&255)<<8,this.pad[3]=key[22]&255|(key[23]&255)<<8,this.pad[4]=key[24]&255|(key[25]&255)<<8,this.pad[5]=key[26]&255|(key[27]&255)<<8,this.pad[6]=key[28]&255|(key[29]&255)<<8,this.pad[7]=key[30]&255|(key[31]&255)<<8};poly1305.prototype.blocks=function(m,mpos,bytes){var hibit=this.fin?0:2048,t0,t1,t2,t3,t4,t5,t6,t7,c,d0,d1,d2,d3,d4,d5,d6,d7,d8,d9,h0=this.h[0],h1=this.h[1],h2=this.h[2],h3=this.h[3],h4=this.h[4],h5=this.h[5],h6=this.h[6],h7=this.h[7],h8=this.h[8],h9=this.h[9],r0=this.r[0],r1=this.r[1],r2=this.r[2],r3=this.r[3],r4=this.r[4],r5=this.r[5],r6=this.r[6],r7=this.r[7],r8=this.r[8],r9=this.r[9];while(bytes>=16)t0=m[mpos+0]&255|(m[mpos+1]&255)<<8,h0+=t0&8191,t1=m[mpos+2]&255|(m[mpos+3]&255)<<8,h1+=(t0>>>13|t1<<3)&8191,t2=m[mpos+4]&255|(m[mpos+5]&255)<<8,h2+=(t1>>>10|t2<<6)&8191,t3=m[mpos+6]&255|(m[mpos+7]&255)<<8,h3+=(t2>>>7|t3<<9)&8191,t4=m[mpos+8]&255|(m[mpos+9]&255)<<8,h4+=(t3>>>4|t4<<12)&8191,h5+=t4>>>1&8191,t5=m[mpos+10]&255|(m[mpos+11]&255)<<8,h6+=(t4>>>14|t5<<2)&8191,t6=m[mpos+12]&255|(m[mpos+13]&255)<<8,h7+=(t5>>>11|t6<<5)&8191,t7=m[mpos+14]&255|(m[mpos+15]&255)<<8,h8+=(t6>>>8|t7<<8)&8191,h9+=t7>>>5|hibit,c=0,d0=c,d0+=h0*r0,d0+=h1*(5*r9),d0+=h2*(5*r8),d0+=h3*(5*r7),d0+=h4*(5*r6),c=d0>>>13,d0&=8191,d0+=h5*(5*r5),d0+=h6*(5*r4),d0+=h7*(5*r3),d0+=h8*(5*r2),d0+=h9*(5*r1),c+=d0>>>13,d0&=8191,d1=c,d1+=h0*r1,d1+=h1*r0,d1+=h2*(5*r9),d1+=h3*(5*r8),d1+=h4*(5*r7),c=d1>>>13,d1&=8191,d1+=h5*(5*r6),d1+=h6*(5*r5),d1+=h7*(5*r4),d1+=h8*(5*r3),d1+=h9*(5*r2),c+=d1>>>13,d1&=8191,d2=c,d2+=h0*r2,d2+=h1*r1,d2+=h2*r0,d2+=h3*(5*r9),d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8,d9+=h2*r7,d9+=h3*r6,d9+=h4*r5,c=d9>>>13,d9&=8191,d9+=h5*r4,d9+=h6*r3,d9+=h7*r2,d9+=h8*r1,d9+=h9*r0,c+=d9>>>13,d9&=8191,c=(c<<2)+c|0,c=c+d0|0,d0=c&8191,c=c>>>13,d1+=c,h0=d0,h1=d1,h2=d2,h3=d3,h4=d4,h5=d5,h6=d6,h7=d7,h8=d8,h9=d9,mpos+=16,bytes-=16;this.h[0]=h0,this.h[1]=h1,this.h[2]=h2,this.h[3]=h3,this.h[4]=h4,this.h[5]=h5,this.h[6]=h6,this.h[7]=h7,this.h[8]=h8,this.h[9]=h9},poly1305.prototype.finish=function(mac,macpos){var g=new Uint16Array(10),c,mask,f,i;if(this.leftover){i=this.leftover,this.buffer[i++]=1;for(;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}c=this.h[1]>>>13,this.h[1]&=8191;for(i=2;i<10;i++)this.h[i]+=c,c=this.h[i]>>>13,this.h[i]&=8191;this.h[0]+=c*5,c=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=c,c=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=c,g[0]=this.h[0]+5,c=g[0]>>>13,g[0]&=8191;for(i=1;i<10;i++)g[i]=this.h[i]+c,c=g[i]>>>13,g[i]&=8191;g[9]-=8192,mask=(c^1)-1;for(i=0;i<10;i++)g[i]&=mask;mask=~mask;for(i=0;i<10;i++)this.h[i]=this.h[i]&mask|g[i];this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,f=this.h[0]+this.pad[0],this.h[0]=f&65535;for(i=1;i<8;i++)f=(this.h[i]+this.pad[i]|0)+(f>>>16)|0,this.h[i]=f&65535;mac[macpos+0]=this.h[0]>>>0&255,mac[macpos+1]=this.h[0]>>>8&255,mac[macpos+2]=this.h[1]>>>0&255,mac[macpos+3]=this.h[1]>>>8&255,mac[macpos+4]=this.h[2]>>>0&255,mac[macpos+5]=this.h[2]>>>8&255,mac[macpos+6]=this.h[3]>>>0&255,mac[macpos+7]=this.h[3]>>>8&255,mac[macpos+8]=this.h[4]>>>0&255,mac[macpos+9]=this.h[4]>>>8&255,mac[macpos+10]=this.h[5]>>>0&255,mac[macpos+11]=this.h[5]>>>8&255,mac[macpos+12]=this.h[6]>>>0&255,mac[macpos+13]=this.h[6]>>>8&255,mac[macpos+14]=this.h[7]>>>0&255,mac[macpos+15]=this.h[7]>>>8&255},poly1305.prototype.update=function(m,mpos,bytes){var i,want;if(this.leftover){if(want=16-this.leftover,want>bytes)want=bytes;for(i=0;i<want;i++)this.buffer[this.leftover+i]=m[mpos+i];if(bytes-=want,mpos+=want,this.leftover+=want,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(bytes>=16)want=bytes-bytes%16,this.blocks(m,mpos,want),mpos+=want,bytes-=want;if(bytes){for(i=0;i<bytes;i++)this.buffer[this.leftover+i]=m[mpos+i];this.leftover+=bytes}};function crypto_onetimeauth(out,outpos,m,mpos,n,k){var s=new poly1305(k);return s.update(m,mpos,n),s.finish(out,outpos),0}function crypto_onetimeauth_verify(h,hpos,m,mpos,n,k){var x=new Uint8Array(16);return crypto_onetimeauth(x,0,m,mpos,n,k),crypto_verify_16(h,hpos,x,0)}function crypto_secretbox(c,m,d,n,k){var i;if(d<32)return-1;crypto_stream_xor(c,0,m,0,d,n,k),crypto_onetimeauth(c,16,c,32,d-32,c);for(i=0;i<16;i++)c[i]=0;return 0}function crypto_secretbox_open(m,c,d,n,k){var i,x=new Uint8Array(32);if(d<32)return-1;if(crypto_stream(x,0,32,n,k),crypto_onetimeauth_verify(c,16,c,32,d-32,x)!==0)return-1;crypto_stream_xor(m,0,c,0,d,n,k);for(i=0;i<32;i++)m[i]=0;return 0}function set25519(r,a){var i;for(i=0;i<16;i++)r[i]=a[i]|0}function car25519(o){var i,v,c=1;for(i=0;i<16;i++)v=o[i]+c+65535,c=Math.floor(v/65536),o[i]=v-c*65536;o[0]+=c-1+37*(c-1)}function sel25519(p,q,b){var t,c=~(b-1);for(var i=0;i<16;i++)t=c&(p[i]^q[i]),p[i]^=t,q[i]^=t}function pack25519(o,n){var i,j,b,m=gf(),t=gf();for(i=0;i<16;i++)t[i]=n[i];car25519(t),car25519(t),car25519(t);for(j=0;j<2;j++){m[0]=t[0]-65517;for(i=1;i<15;i++)m[i]=t[i]-65535-(m[i-1]>>16&1),m[i-1]&=65535;m[15]=t[15]-32767-(m[14]>>16&1),b=m[15]>>16&1,m[14]&=65535,sel25519(t,m,1-b)}for(i=0;i<16;i++)o[2*i]=t[i]&255,o[2*i+1]=t[i]>>8}function neq25519(a,b){var c=new Uint8Array(32),d=new Uint8Array(32);return pack25519(c,a),pack25519(d,b),crypto_verify_32(c,0,d,0)}function par25519(a){var d=new Uint8Array(32);return pack25519(d,a),d[0]&1}function unpack25519(o,n){var i;for(i=0;i<16;i++)o[i]=n[2*i]+(n[2*i+1]<<8);o[15]&=32767}function A(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]+b[i]}function Z(o,a,b){for(var i=0;i<16;i++)o[i]=a[i]-b[i]}function M(o,a,b){var v,c,t0=0,t1=0,t2=0,t3=0,t4=0,t5=0,t6=0,t7=0,t8=0,t9=0,t10=0,t11=0,t12=0,t13=0,t14=0,t15=0,t16=0,t17=0,t18=0,t19=0,t20=0,t21=0,t22=0,t23=0,t24=0,t25=0,t26=0,t27=0,t28=0,t29=0,t30=0,b0=b[0],b1=b[1],b2=b[2],b3=b[3],b4=b[4],b5=b[5],b6=b[6],b7=b[7],b8=b[8],b9=b[9],b10=b[10],b11=b[11],b12=b[12],b13=b[13],b14=b[14],b15=b[15];v=a[0],t0+=v*b0,t1+=v*b1,t2+=v*b2,t3+=v*b3,t4+=v*b4,t5+=v*b5,t6+=v*b6,t7+=v*b7,t8+=v*b8,t9+=v*b9,t10+=v*b10,t11+=v*b11,t12+=v*b12,t13+=v*b13,t14+=v*b14,t15+=v*b15,v=a[1],t1+=v*b0,t2+=v*b1,t3+=v*b2,t4+=v*b3,t5+=v*b4,t6+=v*b5,t7+=v*b6,t8+=v*b7,t9+=v*b8,t10+=v*b9,t11+=v*b10,t12+=v*b11,t13+=v*b12,t14+=v*b13,t15+=v*b14,t16+=v*b15,v=a[2],t2+=v*b0,t3+=v*b1,t4+=v*b2,t5+=v*b3,t6+=v*b4,t7+=v*b5,t8+=v*b6,t9+=v*b7,t10+=v*b8,t11+=v*b9,t12+=v*b10,t13+=v*b11,t14+=v*b12,t15+=v*b13,t16+=v*b14,t17+=v*b15,v=a[3],t3+=v*b0,t4+=v*b1,t5+=v*b2,t6+=v*b3,t7+=v*b4,t8+=v*b5,t9+=v*b6,t10+=v*b7,t11+=v*b8,t12+=v*b9,t13+=v*b10,t14+=v*b11,t15+=v*b12,t16+=v*b13,t17+=v*b14,t18+=v*b15,v=a[4],t4+=v*b0,t5+=v*b1,t6+=v*b2,t7+=v*b3,t8+=v*b4,t9+=v*b5,t10+=v*b6,t11+=v*b7,t12+=v*b8,t13+=v*b9,t14+=v*b10,t15+=v*b11,t16+=v*b12,t17+=v*b13,t18+=v*b14,t19+=v*b15,v=a[5],t5+=v*b0,t6+=v*b1,t7+=v*b2,t8+=v*b3,t9+=v*b4,t10+=v*b5,t11+=v*b6,t12+=v*b7,t13+=v*b8,t14+=v*b9,t15+=v*b10,t16+=v*b11,t17+=v*b12,t18+=v*b13,t19+=v*b14,t20+=v*b15,v=a[6],t6+=v*b0,t7+=v*b1,t8+=v*b2,t9+=v*b3,t10+=v*b4,t11+=v*b5,t12+=v*b6,t13+=v*b7,t14+=v*b8,t15+=v*b9,t16+=v*b10,t17+=v*b11,t18+=v*b12,t19+=v*b13,t20+=v*b14,t21+=v*b15,v=a[7],t7+=v*b0,t8+=v*b1,t9+=v*b2,t10+=v*b3,t11+=v*b4,t12+=v*b5,t13+=v*b6,t14+=v*b7,t15+=v*b8,t16+=v*b9,t17+=v*b10,t18+=v*b11,t19+=v*b12,t20+=v*b13,t21+=v*b14,t22+=v*b15,v=a[8],t8+=v*b0,t9+=v*b1,t10+=v*b2,t11+=v*b3,t12+=v*b4,t13+=v*b5,t14+=v*b6,t15+=v*b7,t16+=v*b8,t17+=v*b9,t18+=v*b10,t19+=v*b11,t20+=v*b12,t21+=v*b13,t22+=v*b14,t23+=v*b15,v=a[9],t9+=v*b0,t10+=v*b1,t11+=v*b2,t12+=v*b3,t13+=v*b4,t14+=v*b5,t15+=v*b6,t16+=v*b7,t17+=v*b8,t18+=v*b9,t19+=v*b10,t20+=v*b11,t21+=v*b12,t22+=v*b13,t23+=v*b14,t24+=v*b15,v=a[10],t10+=v*b0,t11+=v*b1,t12+=v*b2,t13+=v*b3,t14+=v*b4,t15+=v*b5,t16+=v*b6,t17+=v*b7,t18+=v*b8,t19+=v*b9,t20+=v*b10,t21+=v*b11,t22+=v*b12,t23+=v*b13,t24+=v*b14,t25+=v*b15,v=a[11],t11+=v*b0,t12+=v*b1,t13+=v*b2,t14+=v*b3,t15+=v*b4,t16+=v*b5,t17+=v*b6,t18+=v*b7,t19+=v*b8,t20+=v*b9,t21+=v*b10,t22+=v*b11,t23+=v*b12,t24+=v*b13,t25+=v*b14,t26+=v*b15,v=a[12],t12+=v*b0,t13+=v*b1,t14+=v*b2,t15+=v*b3,t16+=v*b4,t17+=v*b5,t18+=v*b6,t19+=v*b7,t20+=v*b8,t21+=v*b9,t22+=v*b10,t23+=v*b11,t24+=v*b12,t25+=v*b13,t26+=v*b14,t27+=v*b15,v=a[13],t13+=v*b0,t14+=v*b1,t15+=v*b2,t16+=v*b3,t17+=v*b4,t18+=v*b5,t19+=v*b6,t20+=v*b7,t21+=v*b8,t22+=v*b9,t23+=v*b10,t24+=v*b11,t25+=v*b12,t26+=v*b13,t27+=v*b14,t28+=v*b15,v=a[14],t14+=v*b0,t15+=v*b1,t16+=v*b2,t17+=v*b3,t18+=v*b4,t19+=v*b5,t20+=v*b6,t21+=v*b7,t22+=v*b8,t23+=v*b9,t24+=v*b10,t25+=v*b11,t26+=v*b12,t27+=v*b13,t28+=v*b14,t29+=v*b15,v=a[15],t15+=v*b0,t16+=v*b1,t17+=v*b2,t18+=v*b3,t19+=v*b4,t20+=v*b5,t21+=v*b6,t22+=v*b7,t23+=v*b8,t24+=v*b9,t25+=v*b10,t26+=v*b11,t27+=v*b12,t28+=v*b13,t29+=v*b14,t30+=v*b15,t0+=38*t16,t1+=38*t17,t2+=38*t18,t3+=38*t19,t4+=38*t20,t5+=38*t21,t6+=38*t22,t7+=38*t23,t8+=38*t24,t9+=38*t25,t10+=38*t26,t11+=38*t27,t12+=38*t28,t13+=38*t29,t14+=38*t30,c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-c*65536,v=t1+c+65535,c=Math.floor(v/65536),t1=v-c*65536,v=t2+c+65535,c=Math.floor(v/65536),t2=v-c*65536,v=t3+c+65535,c=Math.floor(v/65536),t3=v-c*65536,v=t4+c+65535,c=Math.floor(v/65536),t4=v-c*65536,v=t5+c+65535,c=Math.floor(v/65536),t5=v-c*65536,v=t6+c+65535,c=Math.floor(v/65536),t6=v-c*65536,v=t7+c+65535,c=Math.floor(v/65536),t7=v-c*65536,v=t8+c+65535,c=Math.floor(v/65536),t8=v-c*65536,v=t9+c+65535,c=Math.floor(v/65536),t9=v-c*65536,v=t10+c+65535,c=Math.floor(v/65536),t10=v-c*65536,v=t11+c+65535,c=Math.floor(v/65536),t11=v-c*65536,v=t12+c+65535,c=Math.floor(v/65536),t12=v-c*65536,v=t13+c+65535,c=Math.floor(v/65536),t13=v-c*65536,v=t14+c+65535,c=Math.floor(v/65536),t14=v-c*65536,v=t15+c+65535,c=Math.floor(v/65536),t15=v-c*65536,t0+=c-1+37*(c-1),c=1,v=t0+c+65535,c=Math.floor(v/65536),t0=v-c*65536,v=t1+c+65535,c=Math.floor(v/65536),t1=v-c*65536,v=t2+c+65535,c=Math.floor(v/65536),t2=v-c*65536,v=t3+c+65535,c=Math.floor(v/65536),t3=v-c*65536,v=t4+c+65535,c=Math.floor(v/65536),t4=v-c*65536,v=t5+c+65535,c=Math.floor(v/65536),t5=v-c*65536,v=t6+c+65535,c=Math.floor(v/65536),t6=v-c*65536,v=t7+c+65535,c=Math.floor(v/65536),t7=v-c*65536,v=t8+c+65535,c=Math.floor(v/65536),t8=v-c*65536,v=t9+c+65535,c=Math.floor(v/65536),t9=v-c*65536,v=t10+c+65535,c=Math.floor(v/65536),t10=v-c*65536,v=t11+c+65535,c=Math.floor(v/65536),t11=v-c*65536,v=t12+c+65535,c=Math.floor(v/65536),t12=v-c*65536,v=t13+c+65535,c=Math.floor(v/65536),t13=v-c*65536,v=t14+c+65535,c=Math.floor(v/65536),t14=v-c*65536,v=t15+c+65535,c=Math.floor(v/65536),t15=v-c*65536,t0+=c-1+37*(c-1),o[0]=t0,o[1]=t1,o[2]=t2,o[3]=t3,o[4]=t4,o[5]=t5,o[6]=t6,o[7]=t7,o[8]=t8,o[9]=t9,o[10]=t10,o[11]=t11,o[12]=t12,o[13]=t13,o[14]=t14,o[15]=t15}function S(o,a){M(o,a,a)}function inv25519(o,i){var c=gf(),a;for(a=0;a<16;a++)c[a]=i[a];for(a=253;a>=0;a--)if(S(c,c),a!==2&&a!==4)M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function pow2523(o,i){var c=gf(),a;for(a=0;a<16;a++)c[a]=i[a];for(a=250;a>=0;a--)if(S(c,c),a!==1)M(c,c,i);for(a=0;a<16;a++)o[a]=c[a]}function crypto_scalarmult(q,n,p){var z=new Uint8Array(32),x=new Float64Array(80),r,i,a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf();for(i=0;i<31;i++)z[i]=n[i];z[31]=n[31]&127|64,z[0]&=248,unpack25519(x,p);for(i=0;i<16;i++)b[i]=x[i],d[i]=a[i]=c[i]=0;a[0]=d[0]=1;for(i=254;i>=0;--i)r=z[i>>>3]>>>(i&7)&1,sel25519(a,b,r),sel25519(c,d,r),A(e,a,c),Z(a,a,c),A(c,b,d),Z(b,b,d),S(d,e),S(f,a),M(a,c,a),M(c,b,e),A(e,a,c),Z(a,a,c),S(b,a),Z(c,d,f),M(a,c,_121665),A(a,a,d),M(c,c,a),M(a,d,f),M(d,b,x),S(b,e),sel25519(a,b,r),sel25519(c,d,r);for(i=0;i<16;i++)x[i+16]=a[i],x[i+32]=c[i],x[i+48]=b[i],x[i+64]=d[i];var x32=x.subarray(32),x16=x.subarray(16);return inv25519(x32,x32),M(x16,x16,x32),pack25519(q,x16),0}function crypto_scalarmult_base(q,n){return crypto_scalarmult(q,n,_9)}function crypto_box_keypair(y,x){return randombytes(x,32),crypto_scalarmult_base(y,x)}function crypto_box_beforenm(k,y,x){var s=new Uint8Array(32);return crypto_scalarmult(s,x,y),crypto_core_hsalsa20(k,_0,s,sigma)}var crypto_box_afternm=crypto_secretbox,crypto_box_open_afternm=crypto_secretbox_open;function crypto_box(c,m,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_afternm(c,m,d,n,k)}function crypto_box_open(m,c,d,n,y,x){var k=new Uint8Array(32);return crypto_box_beforenm(k,y,x),crypto_box_open_afternm(m,c,d,n,k)}var K=[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];function crypto_hashblocks_hl(hh,hl,m,n){var wh=new Int32Array(16),wl=new Int32Array(16),bh0,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bl0,bl1,bl2,bl3,bl4,bl5,bl6,bl7,th,tl,i,j,h,l,a,b,c,d,ah0=hh[0],ah1=hh[1],ah2=hh[2],ah3=hh[3],ah4=hh[4],ah5=hh[5],ah6=hh[6],ah7=hh[7],al0=hl[0],al1=hl[1],al2=hl[2],al3=hl[3],al4=hl[4],al5=hl[5],al6=hl[6],al7=hl[7],pos=0;while(n>=128){for(i=0;i<16;i++)j=8*i+pos,wh[i]=m[j+0]<<24|m[j+1]<<16|m[j+2]<<8|m[j+3],wl[i]=m[j+4]<<24|m[j+5]<<16|m[j+6]<<8|m[j+7];for(i=0;i<80;i++)if(bh0=ah0,bh1=ah1,bh2=ah2,bh3=ah3,bh4=ah4,bh5=ah5,bh6=ah6,bh7=ah7,bl0=al0,bl1=al1,bl2=al2,bl3=al3,bl4=al4,bl5=al5,bl6=al6,bl7=al7,h=ah7,l=al7,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=(ah4>>>14|al4<<18)^(ah4>>>18|al4<<14)^(al4>>>9|ah4<<23),l=(al4>>>14|ah4<<18)^(al4>>>18|ah4<<14)^(ah4>>>9|al4<<23),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=ah4&ah5^~ah4&ah6,l=al4&al5^~al4&al6,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=K[i*2],l=K[i*2+1],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=wh[i%16],l=wl[i%16],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,th=c&65535|d<<16,tl=a&65535|b<<16,h=th,l=tl,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=(ah0>>>28|al0<<4)^(al0>>>2|ah0<<30)^(al0>>>7|ah0<<25),l=(al0>>>28|ah0<<4)^(ah0>>>2|al0<<30)^(ah0>>>7|al0<<25),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,h=ah0&ah1^ah0&ah2^ah1&ah2,l=al0&al1^al0&al2^al1&al2,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh7=c&65535|d<<16,bl7=a&65535|b<<16,h=bh3,l=bl3,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=th,l=tl,a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,bh3=c&65535|d<<16,bl3=a&65535|b<<16,ah1=bh0,ah2=bh1,ah3=bh2,ah4=bh3,ah5=bh4,ah6=bh5,ah7=bh6,ah0=bh7,al1=bl0,al2=bl1,al3=bl2,al4=bl3,al5=bl4,al6=bl5,al7=bl6,al0=bl7,i%16===15)for(j=0;j<16;j++)h=wh[j],l=wl[j],a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=wh[(j+9)%16],l=wl[(j+9)%16],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,th=wh[(j+1)%16],tl=wl[(j+1)%16],h=(th>>>1|tl<<31)^(th>>>8|tl<<24)^th>>>7,l=(tl>>>1|th<<31)^(tl>>>8|th<<24)^(tl>>>7|th<<25),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,th=wh[(j+14)%16],tl=wl[(j+14)%16],h=(th>>>19|tl<<13)^(tl>>>29|th<<3)^th>>>6,l=(tl>>>19|th<<13)^(th>>>29|tl<<3)^(tl>>>6|th<<26),a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,wh[j]=c&65535|d<<16,wl[j]=a&65535|b<<16;h=ah0,l=al0,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[0],l=hl[0],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[0]=ah0=c&65535|d<<16,hl[0]=al0=a&65535|b<<16,h=ah1,l=al1,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[1],l=hl[1],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[1]=ah1=c&65535|d<<16,hl[1]=al1=a&65535|b<<16,h=ah2,l=al2,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[2],l=hl[2],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[2]=ah2=c&65535|d<<16,hl[2]=al2=a&65535|b<<16,h=ah3,l=al3,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[3],l=hl[3],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[3]=ah3=c&65535|d<<16,hl[3]=al3=a&65535|b<<16,h=ah4,l=al4,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[4],l=hl[4],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[4]=ah4=c&65535|d<<16,hl[4]=al4=a&65535|b<<16,h=ah5,l=al5,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[5],l=hl[5],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[5]=ah5=c&65535|d<<16,hl[5]=al5=a&65535|b<<16,h=ah6,l=al6,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[6],l=hl[6],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[6]=ah6=c&65535|d<<16,hl[6]=al6=a&65535|b<<16,h=ah7,l=al7,a=l&65535,b=l>>>16,c=h&65535,d=h>>>16,h=hh[7],l=hl[7],a+=l&65535,b+=l>>>16,c+=h&65535,d+=h>>>16,b+=a>>>16,c+=b>>>16,d+=c>>>16,hh[7]=ah7=c&65535|d<<16,hl[7]=al7=a&65535|b<<16,pos+=128,n-=128}return n}function crypto_hash(out,m,n){var hh=new Int32Array(8),hl=new Int32Array(8),x=new Uint8Array(256),i,b=n;hh[0]=1779033703,hh[1]=3144134277,hh[2]=1013904242,hh[3]=2773480762,hh[4]=1359893119,hh[5]=2600822924,hh[6]=528734635,hh[7]=1541459225,hl[0]=4089235720,hl[1]=2227873595,hl[2]=4271175723,hl[3]=1595750129,hl[4]=2917565137,hl[5]=725511199,hl[6]=4215389547,hl[7]=327033209,crypto_hashblocks_hl(hh,hl,m,n),n%=128;for(i=0;i<n;i++)x[i]=m[b-n+i];x[n]=128,n=256-128*(n<112?1:0),x[n-9]=0,ts64(x,n-8,b/536870912|0,b<<3),crypto_hashblocks_hl(hh,hl,x,n);for(i=0;i<8;i++)ts64(out,8*i,hh[i],hl[i]);return 0}function add(p,q){var a=gf(),b=gf(),c=gf(),d=gf(),e=gf(),f=gf(),g=gf(),h=gf(),t=gf();Z(a,p[1],p[0]),Z(t,q[1],q[0]),M(a,a,t),A(b,p[0],p[1]),A(t,q[0],q[1]),M(b,b,t),M(c,p[3],q[3]),M(c,c,D2),M(d,p[2],q[2]),A(d,d,d),Z(e,b,a),Z(f,d,c),A(g,d,c),A(h,b,a),M(p[0],e,f),M(p[1],h,g),M(p[2],g,f),M(p[3],e,h)}function cswap(p,q,b){var i;for(i=0;i<4;i++)sel25519(p[i],q[i],b)}function pack(r,p){var tx=gf(),ty=gf(),zi=gf();inv25519(zi,p[2]),M(tx,p[0],zi),M(ty,p[1],zi),pack25519(r,ty),r[31]^=par25519(tx)<<7}function scalarmult(p,q,s){var b,i;set25519(p[0],gf0),set25519(p[1],gf1),set25519(p[2],gf1),set25519(p[3],gf0);for(i=255;i>=0;--i)b=s[i/8|0]>>(i&7)&1,cswap(p,q,b),add(q,p),add(p,p),cswap(p,q,b)}function scalarbase(p,s){var q=[gf(),gf(),gf(),gf()];set25519(q[0],X),set25519(q[1],Y),set25519(q[2],gf1),M(q[3],X,Y),scalarmult(p,q,s)}function crypto_sign_keypair(pk,sk,seeded){var d=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],i;if(!seeded)randombytes(sk,32);crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64,scalarbase(p,d),pack(pk,p);for(i=0;i<32;i++)sk[i+32]=pk[i];return 0}var L=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function modL(r,x){var carry,i,j,k;for(i=63;i>=32;--i){carry=0;for(j=i-32,k=i-12;j<k;++j)x[j]+=carry-16*x[i]*L[j-(i-32)],carry=x[j]+128>>8,x[j]-=carry*256;x[j]+=carry,x[i]=0}carry=0;for(j=0;j<32;j++)x[j]+=carry-(x[31]>>4)*L[j],carry=x[j]>>8,x[j]&=255;for(j=0;j<32;j++)x[j]-=carry*L[j];for(i=0;i<32;i++)x[i+1]+=x[i]>>8,r[i]=x[i]&255}function reduce(r){var x=new Float64Array(64),i;for(i=0;i<64;i++)x[i]=r[i];for(i=0;i<64;i++)r[i]=0;modL(r,x)}function crypto_sign(sm,m,n,sk){var d=new Uint8Array(64),h=new Uint8Array(64),r=new Uint8Array(64),i,j,x=new Float64Array(64),p=[gf(),gf(),gf(),gf()];crypto_hash(d,sk,32),d[0]&=248,d[31]&=127,d[31]|=64;var smlen=n+64;for(i=0;i<n;i++)sm[64+i]=m[i];for(i=0;i<32;i++)sm[32+i]=d[32+i];crypto_hash(r,sm.subarray(32),n+32),reduce(r),scalarbase(p,r),pack(sm,p);for(i=32;i<64;i++)sm[i]=sk[i];crypto_hash(h,sm,n+64),reduce(h);for(i=0;i<64;i++)x[i]=0;for(i=0;i<32;i++)x[i]=r[i];for(i=0;i<32;i++)for(j=0;j<32;j++)x[i+j]+=h[i]*d[j];return modL(sm.subarray(32),x),smlen}function unpackneg(r,p){var t=gf(),chk=gf(),num=gf(),den=gf(),den2=gf(),den4=gf(),den6=gf();if(set25519(r[2],gf1),unpack25519(r[1],p),S(num,r[1]),M(den,num,D),Z(num,num,r[2]),A(den,r[2],den),S(den2,den),S(den4,den2),M(den6,den4,den2),M(t,den6,num),M(t,t,den),pow2523(t,t),M(t,t,num),M(t,t,den),M(t,t,den),M(r[0],t,den),S(chk,r[0]),M(chk,chk,den),neq25519(chk,num))M(r[0],r[0],I);if(S(chk,r[0]),M(chk,chk,den),neq25519(chk,num))return-1;if(par25519(r[0])===p[31]>>7)Z(r[0],gf0,r[0]);return M(r[3],r[0],r[1]),0}function crypto_sign_open(m,sm,n,pk){var i,mlen,t=new Uint8Array(32),h=new Uint8Array(64),p=[gf(),gf(),gf(),gf()],q=[gf(),gf(),gf(),gf()];if(mlen=-1,n<64)return-1;if(unpackneg(q,pk))return-1;for(i=0;i<n;i++)m[i]=sm[i];for(i=0;i<32;i++)m[i+32]=pk[i];if(crypto_hash(h,m,n),reduce(h),scalarmult(p,q,h),scalarbase(q,sm.subarray(32)),add(p,q),pack(t,p),n-=64,crypto_verify_32(sm,0,t,0)){for(i=0;i<n;i++)m[i]=0;return-1}for(i=0;i<n;i++)m[i]=sm[i+64];return mlen=n,mlen}var crypto_secretbox_KEYBYTES=32,crypto_secretbox_NONCEBYTES=24,crypto_secretbox_ZEROBYTES=32,crypto_secretbox_BOXZEROBYTES=16,crypto_scalarmult_BYTES=32,crypto_scalarmult_SCALARBYTES=32,crypto_box_PUBLICKEYBYTES=32,crypto_box_SECRETKEYBYTES=32,crypto_box_BEFORENMBYTES=32,crypto_box_NONCEBYTES=crypto_secretbox_NONCEBYTES,crypto_box_ZEROBYTES=crypto_secretbox_ZEROBYTES,crypto_box_BOXZEROBYTES=crypto_secretbox_BOXZEROBYTES,crypto_sign_BYTES=64,crypto_sign_PUBLICKEYBYTES=32,crypto_sign_SECRETKEYBYTES=64,crypto_sign_SEEDBYTES=32,crypto_hash_BYTES=64;nacl.lowlevel={crypto_core_hsalsa20,crypto_stream_xor,crypto_stream,crypto_stream_salsa20_xor,crypto_stream_salsa20,crypto_onetimeauth,crypto_onetimeauth_verify,crypto_verify_16,crypto_verify_32,crypto_secretbox,crypto_secretbox_open,crypto_scalarmult,crypto_scalarmult_base,crypto_box_beforenm,crypto_box_afternm,crypto_box,crypto_box_open,crypto_box_keypair,crypto_hash,crypto_sign,crypto_sign_keypair,crypto_sign_open,crypto_secretbox_KEYBYTES,crypto_secretbox_NONCEBYTES,crypto_secretbox_ZEROBYTES,crypto_secretbox_BOXZEROBYTES,crypto_scalarmult_BYTES,crypto_scalarmult_SCALARBYTES,crypto_box_PUBLICKEYBYTES,crypto_box_SECRETKEYBYTES,crypto_box_BEFORENMBYTES,crypto_box_NONCEBYTES,crypto_box_ZEROBYTES,crypto_box_BOXZEROBYTES,crypto_sign_BYTES,crypto_sign_PUBLICKEYBYTES,crypto_sign_SECRETKEYBYTES,crypto_sign_SEEDBYTES,crypto_hash_BYTES};function checkLengths(k,n){if(k.length!==crypto_secretbox_KEYBYTES)throw Error("bad key size");if(n.length!==crypto_secretbox_NONCEBYTES)throw Error("bad nonce size")}function checkBoxLengths(pk,sk){if(pk.length!==crypto_box_PUBLICKEYBYTES)throw Error("bad public key size");if(sk.length!==crypto_box_SECRETKEYBYTES)throw Error("bad secret key size")}function checkArrayTypes(){var t,i;for(i=0;i<arguments.length;i++)if((t=Object.prototype.toString.call(arguments[i]))!=="[object Uint8Array]")throw TypeError("unexpected type "+t+", use Uint8Array")}function cleanup(arr){for(var i=0;i<arr.length;i++)arr[i]=0}if(!nacl.util)nacl.util={},nacl.util.decodeUTF8=nacl.util.encodeUTF8=nacl.util.encodeBase64=nacl.util.decodeBase64=function(){throw Error("nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js")};nacl.randomBytes=function(n){var b=new Uint8Array(n);return randombytes(b,n),b},nacl.secretbox=function(msg,nonce,key){checkArrayTypes(msg,nonce,key),checkLengths(key,nonce);var m=new Uint8Array(crypto_secretbox_ZEROBYTES+msg.length),c=new Uint8Array(m.length);for(var i=0;i<msg.length;i++)m[i+crypto_secretbox_ZEROBYTES]=msg[i];return crypto_secretbox(c,m,m.length,nonce,key),c.subarray(crypto_secretbox_BOXZEROBYTES)},nacl.secretbox.open=function(box,nonce,key){checkArrayTypes(box,nonce,key),checkLengths(key,nonce);var c=new Uint8Array(crypto_secretbox_BOXZEROBYTES+box.length),m=new Uint8Array(c.length);for(var i=0;i<box.length;i++)c[i+crypto_secretbox_BOXZEROBYTES]=box[i];if(c.length<32)return!1;if(crypto_secretbox_open(m,c,c.length,nonce,key)!==0)return!1;return m.subarray(crypto_secretbox_ZEROBYTES)},nacl.secretbox.keyLength=crypto_secretbox_KEYBYTES,nacl.secretbox.nonceLength=crypto_secretbox_NONCEBYTES,nacl.secretbox.overheadLength=crypto_secretbox_BOXZEROBYTES,nacl.scalarMult=function(n,p){if(checkArrayTypes(n,p),n.length!==crypto_scalarmult_SCALARBYTES)throw Error("bad n size");if(p.length!==crypto_scalarmult_BYTES)throw Error("bad p size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult(q,n,p),q},nacl.scalarMult.base=function(n){if(checkArrayTypes(n),n.length!==crypto_scalarmult_SCALARBYTES)throw Error("bad n size");var q=new Uint8Array(crypto_scalarmult_BYTES);return crypto_scalarmult_base(q,n),q},nacl.scalarMult.scalarLength=crypto_scalarmult_SCALARBYTES,nacl.scalarMult.groupElementLength=crypto_scalarmult_BYTES,nacl.box=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox(msg,nonce,k)},nacl.box.before=function(publicKey,secretKey){checkArrayTypes(publicKey,secretKey),checkBoxLengths(publicKey,secretKey);var k=new Uint8Array(crypto_box_BEFORENMBYTES);return crypto_box_beforenm(k,publicKey,secretKey),k},nacl.box.after=nacl.secretbox,nacl.box.open=function(msg,nonce,publicKey,secretKey){var k=nacl.box.before(publicKey,secretKey);return nacl.secretbox.open(msg,nonce,k)},nacl.box.open.after=nacl.secretbox.open,nacl.box.keyPair=function(){var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES),sk=new Uint8Array(crypto_box_SECRETKEYBYTES);return crypto_box_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.box.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),secretKey.length!==crypto_box_SECRETKEYBYTES)throw Error("bad secret key size");var pk=new Uint8Array(crypto_box_PUBLICKEYBYTES);return crypto_scalarmult_base(pk,secretKey),{publicKey:pk,secretKey:new Uint8Array(secretKey)}},nacl.box.publicKeyLength=crypto_box_PUBLICKEYBYTES,nacl.box.secretKeyLength=crypto_box_SECRETKEYBYTES,nacl.box.sharedKeyLength=crypto_box_BEFORENMBYTES,nacl.box.nonceLength=crypto_box_NONCEBYTES,nacl.box.overheadLength=nacl.secretbox.overheadLength,nacl.sign=function(msg,secretKey){if(checkArrayTypes(msg,secretKey),secretKey.length!==crypto_sign_SECRETKEYBYTES)throw Error("bad secret key size");var signedMsg=new Uint8Array(crypto_sign_BYTES+msg.length);return crypto_sign(signedMsg,msg,msg.length,secretKey),signedMsg},nacl.sign.open=function(signedMsg,publicKey){if(arguments.length!==2)throw Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(checkArrayTypes(signedMsg,publicKey),publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw Error("bad public key size");var tmp=new Uint8Array(signedMsg.length),mlen=crypto_sign_open(tmp,signedMsg,signedMsg.length,publicKey);if(mlen<0)return null;var m=new Uint8Array(mlen);for(var i=0;i<m.length;i++)m[i]=tmp[i];return m},nacl.sign.detached=function(msg,secretKey){var signedMsg=nacl.sign(msg,secretKey),sig=new Uint8Array(crypto_sign_BYTES);for(var i=0;i<sig.length;i++)sig[i]=signedMsg[i];return sig},nacl.sign.detached.verify=function(msg,sig,publicKey){if(checkArrayTypes(msg,sig,publicKey),sig.length!==crypto_sign_BYTES)throw Error("bad signature size");if(publicKey.length!==crypto_sign_PUBLICKEYBYTES)throw Error("bad public key size");var sm=new Uint8Array(crypto_sign_BYTES+msg.length),m=new Uint8Array(crypto_sign_BYTES+msg.length),i;for(i=0;i<crypto_sign_BYTES;i++)sm[i]=sig[i];for(i=0;i<msg.length;i++)sm[i+crypto_sign_BYTES]=msg[i];return crypto_sign_open(m,sm,sm.length,publicKey)>=0},nacl.sign.keyPair=function(){var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES),sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);return crypto_sign_keypair(pk,sk),{publicKey:pk,secretKey:sk}},nacl.sign.keyPair.fromSecretKey=function(secretKey){if(checkArrayTypes(secretKey),secretKey.length!==crypto_sign_SECRETKEYBYTES)throw Error("bad secret key size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES);for(var i=0;i<pk.length;i++)pk[i]=secretKey[32+i];return{publicKey:pk,secretKey:new Uint8Array(secretKey)}},nacl.sign.keyPair.fromSeed=function(seed){if(checkArrayTypes(seed),seed.length!==crypto_sign_SEEDBYTES)throw Error("bad seed size");var pk=new Uint8Array(crypto_sign_PUBLICKEYBYTES),sk=new Uint8Array(crypto_sign_SECRETKEYBYTES);for(var i=0;i<32;i++)sk[i]=seed[i];return crypto_sign_keypair(pk,sk,!0),{publicKey:pk,secretKey:sk}},nacl.sign.publicKeyLength=crypto_sign_PUBLICKEYBYTES,nacl.sign.secretKeyLength=crypto_sign_SECRETKEYBYTES,nacl.sign.seedLength=crypto_sign_SEEDBYTES,nacl.sign.signatureLength=crypto_sign_BYTES,nacl.hash=function(msg){checkArrayTypes(msg);var h=new Uint8Array(crypto_hash_BYTES);return crypto_hash(h,msg,msg.length),h},nacl.hash.hashLength=crypto_hash_BYTES,nacl.verify=function(x,y){if(checkArrayTypes(x,y),x.length===0||y.length===0)return!1;if(x.length!==y.length)return!1;return vn(x,0,y,0,x.length)===0?!0:!1},nacl.setPRNG=function(fn){randombytes=fn},function(){var crypto=typeof self<"u"?self.crypto||self.msCrypto:null;if(crypto&&crypto.getRandomValues){var QUOTA=65536;nacl.setPRNG(function(x,n){var i,v=new Uint8Array(n);for(i=0;i<n;i+=QUOTA)crypto.getRandomValues(v.subarray(i,i+Math.min(n-i,QUOTA)));for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}else if(crypto=__require("crypto"),crypto&&crypto.randomBytes)nacl.setPRNG(function(x,n){var i,v=crypto.randomBytes(n);for(i=0;i<n;i++)x[i]=v[i];cleanup(v)})}()})(typeof module<"u"&&exports?exports:self.nacl=self.nacl||{})});var require_bcrypt_pbkdf=__commonJS((exports,module)=>{var crypto_hash_sha512=require_nacl_fast().lowlevel.crypto_hash,BLF_J=0,Blowfish=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,2909710000,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409000,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function F(S,x8,i){return(S[0][x8[i+3]]+S[1][x8[i+2]]^S[2][x8[i+1]])+S[3][x8[i]]}Blowfish.prototype.encipher=function(x,x8){if(x8===void 0){if(x8=new Uint8Array(x.buffer),x.byteOffset!==0)x8=x8.subarray(x.byteOffset)}x[0]^=this.P[0];for(var i=1;i<16;i+=2)x[1]^=F(this.S,x8,0)^this.P[i],x[0]^=F(this.S,x8,4)^this.P[i+1];var t=x[0];x[0]=x[1]^this.P[17],x[1]=t};Blowfish.prototype.decipher=function(x){var x8=new Uint8Array(x.buffer);if(x.byteOffset!==0)x8=x8.subarray(x.byteOffset);x[0]^=this.P[17];for(var i=16;i>0;i-=2)x[1]^=F(this.S,x8,0)^this.P[i],x[0]^=F(this.S,x8,4)^this.P[i-1];var t=x[0];x[0]=x[1]^this.P[0],x[1]=t};function stream2word(data,databytes){var i,temp=0;for(i=0;i<4;i++,BLF_J++){if(BLF_J>=databytes)BLF_J=0;temp=temp<<8|data[BLF_J]}return temp}Blowfish.prototype.expand0state=function(key,keybytes){var d=new Uint32Array(2),i,k,d8=new Uint8Array(d.buffer);for(i=0,BLF_J=0;i<18;i++)this.P[i]^=stream2word(key,keybytes);BLF_J=0;for(i=0;i<18;i+=2)this.encipher(d,d8),this.P[i]=d[0],this.P[i+1]=d[1];for(i=0;i<4;i++)for(k=0;k<256;k+=2)this.encipher(d,d8),this.S[i][k]=d[0],this.S[i][k+1]=d[1]};Blowfish.prototype.expandstate=function(data,databytes,key,keybytes){var d=new Uint32Array(2),i,k;for(i=0,BLF_J=0;i<18;i++)this.P[i]^=stream2word(key,keybytes);for(i=0,BLF_J=0;i<18;i+=2)d[0]^=stream2word(data,databytes),d[1]^=stream2word(data,databytes),this.encipher(d),this.P[i]=d[0],this.P[i+1]=d[1];for(i=0;i<4;i++)for(k=0;k<256;k+=2)d[0]^=stream2word(data,databytes),d[1]^=stream2word(data,databytes),this.encipher(d),this.S[i][k]=d[0],this.S[i][k+1]=d[1];BLF_J=0};Blowfish.prototype.enc=function(data,blocks){for(var i=0;i<blocks;i++)this.encipher(data.subarray(i*2))};Blowfish.prototype.dec=function(data,blocks){for(var i=0;i<blocks;i++)this.decipher(data.subarray(i*2))};var BCRYPT_BLOCKS=8,BCRYPT_HASHSIZE=32;function bcrypt_hash(sha2pass,sha2salt,out){var state=new Blowfish,cdata=new Uint32Array(BCRYPT_BLOCKS),i,ciphertext=new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,105,116,101]);state.expandstate(sha2salt,64,sha2pass,64);for(i=0;i<64;i++)state.expand0state(sha2salt,64),state.expand0state(sha2pass,64);for(i=0;i<BCRYPT_BLOCKS;i++)cdata[i]=stream2word(ciphertext,ciphertext.byteLength);for(i=0;i<64;i++)state.enc(cdata,cdata.byteLength/8);for(i=0;i<BCRYPT_BLOCKS;i++)out[4*i+3]=cdata[i]>>>24,out[4*i+2]=cdata[i]>>>16,out[4*i+1]=cdata[i]>>>8,out[4*i+0]=cdata[i]}function bcrypt_pbkdf(pass,passlen,salt,saltlen,key,keylen,rounds){var sha2pass=new Uint8Array(64),sha2salt=new Uint8Array(64),out=new Uint8Array(BCRYPT_HASHSIZE),tmpout=new Uint8Array(BCRYPT_HASHSIZE),countsalt=new Uint8Array(saltlen+4),i,j,amt,stride,dest,count,origkeylen=keylen;if(rounds<1)return-1;if(passlen===0||saltlen===0||keylen===0||keylen>out.byteLength*out.byteLength||saltlen>1048576)return-1;stride=Math.floor((keylen+out.byteLength-1)/out.byteLength),amt=Math.floor((keylen+stride-1)/stride);for(i=0;i<saltlen;i++)countsalt[i]=salt[i];crypto_hash_sha512(sha2pass,pass,passlen);for(count=1;keylen>0;count++){countsalt[saltlen+0]=count>>>24,countsalt[saltlen+1]=count>>>16,countsalt[saltlen+2]=count>>>8,countsalt[saltlen+3]=count,crypto_hash_sha512(sha2salt,countsalt,saltlen+4),bcrypt_hash(sha2pass,sha2salt,tmpout);for(i=out.byteLength;i--;)out[i]=tmpout[i];for(i=1;i<rounds;i++){crypto_hash_sha512(sha2salt,tmpout,tmpout.byteLength),bcrypt_hash(sha2pass,sha2salt,tmpout);for(j=0;j<out.byteLength;j++)out[j]^=tmpout[j]}amt=Math.min(amt,keylen);for(i=0;i<amt;i++){if(dest=i*stride+(count-1),dest>=origkeylen)break;key[dest]=out[i]}keylen-=i}return 0}module.exports={BLOCKS:BCRYPT_BLOCKS,HASHSIZE:BCRYPT_HASHSIZE,hash:bcrypt_hash,pbkdf:bcrypt_pbkdf}});var require_cpufeatures=__commonJS((exports,module)=>{module.exports=__require("./cpufeatures-86axn7bp.node")});var require_lib2=__commonJS((exports,module)=>{var binding=require_cpufeatures();module.exports=binding.getCPUInfo});var require_constants=__commonJS((exports,module)=>{var crypto=__require("crypto"),cpuInfo;try{cpuInfo=require_lib2()()}catch{}var{bindingAvailable,CIPHER_INFO,MAC_INFO}=require_crypto(),eddsaSupported=(()=>{if(typeof crypto.sign==="function"&&typeof crypto.verify==="function"){let key=`-----BEGIN PRIVATE KEY-----\r
3
3
  MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
4
- -----END PRIVATE KEY-----`,data=Buffer.from("a"),sig,verified;try{sig=crypto.sign(null,data,key),verified=crypto.verify(null,data,key,sig)}catch{}return Buffer.isBuffer(sig)&&sig.length===64&&verified===!0}return!1})(),curve25519Supported=typeof crypto.diffieHellman==="function"&&typeof crypto.generateKeyPairSync==="function"&&typeof crypto.createPublicKey==="function",DEFAULT_KEX=["ecdh-sha2-nistp256","ecdh-sha2-nistp384","ecdh-sha2-nistp521","diffie-hellman-group-exchange-sha256","diffie-hellman-group14-sha256","diffie-hellman-group15-sha512","diffie-hellman-group16-sha512","diffie-hellman-group17-sha512","diffie-hellman-group18-sha512"];if(curve25519Supported)DEFAULT_KEX.unshift("curve25519-sha256"),DEFAULT_KEX.unshift("curve25519-sha256@libssh.org");var SUPPORTED_KEX=DEFAULT_KEX.concat(["diffie-hellman-group-exchange-sha1","diffie-hellman-group14-sha1","diffie-hellman-group1-sha1"]),DEFAULT_SERVER_HOST_KEY=["ecdsa-sha2-nistp256","ecdsa-sha2-nistp384","ecdsa-sha2-nistp521","rsa-sha2-512","rsa-sha2-256","ssh-rsa"];if(eddsaSupported)DEFAULT_SERVER_HOST_KEY.unshift("ssh-ed25519");var SUPPORTED_SERVER_HOST_KEY=DEFAULT_SERVER_HOST_KEY.concat(["ssh-dss"]),canUseCipher=(()=>{let ciphers=crypto.getCiphers();return(name)=>ciphers.includes(CIPHER_INFO[name].sslName)})(),DEFAULT_CIPHER=["aes128-gcm@openssh.com","aes256-gcm@openssh.com","aes128-ctr","aes192-ctr","aes256-ctr"];if(cpuInfo&&cpuInfo.flags&&!cpuInfo.flags.aes)if(bindingAvailable)DEFAULT_CIPHER.unshift("chacha20-poly1305@openssh.com");else DEFAULT_CIPHER.push("chacha20-poly1305@openssh.com");else if(bindingAvailable&&cpuInfo&&cpuInfo.arch==="x86")DEFAULT_CIPHER.splice(4,0,"chacha20-poly1305@openssh.com");else DEFAULT_CIPHER.push("chacha20-poly1305@openssh.com");DEFAULT_CIPHER=DEFAULT_CIPHER.filter(canUseCipher);var SUPPORTED_CIPHER=DEFAULT_CIPHER.concat(["aes256-cbc","aes192-cbc","aes128-cbc","blowfish-cbc","3des-cbc","aes128-gcm","aes256-gcm","arcfour256","arcfour128","cast128-cbc","arcfour"].filter(canUseCipher)),canUseMAC=(()=>{let hashes=crypto.getHashes();return(name)=>hashes.includes(MAC_INFO[name].sslName)})(),DEFAULT_MAC=["hmac-sha2-256-etm@openssh.com","hmac-sha2-512-etm@openssh.com","hmac-sha1-etm@openssh.com","hmac-sha2-256","hmac-sha2-512","hmac-sha1"].filter(canUseMAC),SUPPORTED_MAC=DEFAULT_MAC.concat(["hmac-md5","hmac-sha2-256-96","hmac-sha2-512-96","hmac-ripemd160","hmac-sha1-96","hmac-md5-96"].filter(canUseMAC)),DEFAULT_COMPRESSION=["none","zlib@openssh.com","zlib"],SUPPORTED_COMPRESSION=DEFAULT_COMPRESSION.concat([]),COMPAT={BAD_DHGEX:1,OLD_EXIT:2,DYN_RPORT_BUG:4,BUG_DHGEX_LARGE:8,IMPLY_RSA_SHA2_SIGALGS:16};module.exports={MESSAGE:{DISCONNECT:1,IGNORE:2,UNIMPLEMENTED:3,DEBUG:4,SERVICE_REQUEST:5,SERVICE_ACCEPT:6,EXT_INFO:7,KEXINIT:20,NEWKEYS:21,KEXDH_INIT:30,KEXDH_REPLY:31,KEXDH_GEX_GROUP:31,KEXDH_GEX_INIT:32,KEXDH_GEX_REPLY:33,KEXDH_GEX_REQUEST:34,KEXECDH_INIT:30,KEXECDH_REPLY:31,USERAUTH_REQUEST:50,USERAUTH_FAILURE:51,USERAUTH_SUCCESS:52,USERAUTH_BANNER:53,USERAUTH_PASSWD_CHANGEREQ:60,USERAUTH_PK_OK:60,USERAUTH_INFO_REQUEST:60,USERAUTH_INFO_RESPONSE:61,GLOBAL_REQUEST:80,REQUEST_SUCCESS:81,REQUEST_FAILURE:82,CHANNEL_OPEN:90,CHANNEL_OPEN_CONFIRMATION:91,CHANNEL_OPEN_FAILURE:92,CHANNEL_WINDOW_ADJUST:93,CHANNEL_DATA:94,CHANNEL_EXTENDED_DATA:95,CHANNEL_EOF:96,CHANNEL_CLOSE:97,CHANNEL_REQUEST:98,CHANNEL_SUCCESS:99,CHANNEL_FAILURE:100},DISCONNECT_REASON:{HOST_NOT_ALLOWED_TO_CONNECT:1,PROTOCOL_ERROR:2,KEY_EXCHANGE_FAILED:3,RESERVED:4,MAC_ERROR:5,COMPRESSION_ERROR:6,SERVICE_NOT_AVAILABLE:7,PROTOCOL_VERSION_NOT_SUPPORTED:8,HOST_KEY_NOT_VERIFIABLE:9,CONNECTION_LOST:10,BY_APPLICATION:11,TOO_MANY_CONNECTIONS:12,AUTH_CANCELED_BY_USER:13,NO_MORE_AUTH_METHODS_AVAILABLE:14,ILLEGAL_USER_NAME:15},DISCONNECT_REASON_STR:void 0,CHANNEL_OPEN_FAILURE:{ADMINISTRATIVELY_PROHIBITED:1,CONNECT_FAILED:2,UNKNOWN_CHANNEL_TYPE:3,RESOURCE_SHORTAGE:4},TERMINAL_MODE:{TTY_OP_END:0,VINTR:1,VQUIT:2,VERASE:3,VKILL:4,VEOF:5,VEOL:6,VEOL2:7,VSTART:8,VSTOP:9,VSUSP:10,VDSUSP:11,VREPRINT:12,VWERASE:13,VLNEXT:14,VFLUSH:15,VSWTCH:16,VSTATUS:17,VDISCARD:18,IGNPAR:30,PARMRK:31,INPCK:32,ISTRIP:33,INLCR:34,IGNCR:35,ICRNL:36,IUCLC:37,IXON:38,IXANY:39,IXOFF:40,IMAXBEL:41,ISIG:50,ICANON:51,XCASE:52,ECHO:53,ECHOE:54,ECHOK:55,ECHONL:56,NOFLSH:57,TOSTOP:58,IEXTEN:59,ECHOCTL:60,ECHOKE:61,PENDIN:62,OPOST:70,OLCUC:71,ONLCR:72,OCRNL:73,ONOCR:74,ONLRET:75,CS7:90,CS8:91,PARENB:92,PARODD:93,TTY_OP_ISPEED:128,TTY_OP_OSPEED:129},CHANNEL_EXTENDED_DATATYPE:{STDERR:1},SIGNALS:["ABRT","ALRM","FPE","HUP","ILL","INT","QUIT","SEGV","TERM","USR1","USR2","KILL","PIPE"].reduce((cur,val)=>({...cur,[val]:1}),{}),COMPAT,COMPAT_CHECKS:[["Cisco-1.25",COMPAT.BAD_DHGEX],[/^Cisco-1[.]/,COMPAT.BUG_DHGEX_LARGE],[/^[0-9.]+$/,COMPAT.OLD_EXIT],[/^OpenSSH_5[.][0-9]+/,COMPAT.DYN_RPORT_BUG],[/^OpenSSH_7[.]4/,COMPAT.IMPLY_RSA_SHA2_SIGALGS]],DEFAULT_KEX,SUPPORTED_KEX,DEFAULT_SERVER_HOST_KEY,SUPPORTED_SERVER_HOST_KEY,DEFAULT_CIPHER,SUPPORTED_CIPHER,DEFAULT_MAC,SUPPORTED_MAC,DEFAULT_COMPRESSION,SUPPORTED_COMPRESSION,curve25519Supported,eddsaSupported};module.exports.DISCONNECT_REASON_BY_VALUE=Array.from(Object.entries(module.exports.DISCONNECT_REASON)).reduce((obj,[key,value])=>({...obj,[value]:key}),{})});var require_utils=__commonJS((exports,module)=>{var Ber=require_lib().Ber,DISCONNECT_REASON,FastBuffer=Buffer[Symbol.species],TypedArrayFill=Object.getPrototypeOf(Uint8Array.prototype).fill;function readUInt32BE(buf,offset){return buf[offset++]*16777216+buf[offset++]*65536+buf[offset++]*256+buf[offset]}function bufferCopy(src,dest,srcStart,srcEnd,destStart){if(!destStart)destStart=0;if(srcEnd>src.length)srcEnd=src.length;let nb=srcEnd-srcStart,destLeft=dest.length-destStart;if(nb>destLeft)nb=destLeft;return dest.set(new Uint8Array(src.buffer,src.byteOffset+srcStart,nb),destStart),nb}function bufferSlice(buf,start,end){if(end===void 0)end=buf.length;return new FastBuffer(buf.buffer,buf.byteOffset+start,end-start)}function makeBufferParser(){let pos=0,buffer,self2={init:(buf,start)=>{buffer=buf,pos=typeof start==="number"?start:0},pos:()=>pos,length:()=>buffer?buffer.length:0,avail:()=>buffer&&pos<buffer.length?buffer.length-pos:0,clear:()=>{buffer=void 0},readUInt32BE:()=>{if(!buffer||pos+3>=buffer.length)return;return buffer[pos++]*16777216+buffer[pos++]*65536+buffer[pos++]*256+buffer[pos++]},readUInt64BE:(behavior)=>{if(!buffer||pos+7>=buffer.length)return;switch(behavior){case"always":return BigInt(`0x${buffer.hexSlice(pos,pos+=8)}`);case"maybe":if(buffer[pos]>31)return BigInt(`0x${buffer.hexSlice(pos,pos+=8)}`);default:return buffer[pos++]*72057594037927940+buffer[pos++]*281474976710656+buffer[pos++]*1099511627776+buffer[pos++]*4294967296+buffer[pos++]*16777216+buffer[pos++]*65536+buffer[pos++]*256+buffer[pos++]}},skip:(n)=>{if(buffer&&n>0)pos+=n},skipString:()=>{let len=self2.readUInt32BE();if(len===void 0)return;return pos+=len,pos<=buffer.length?len:void 0},readByte:()=>{if(buffer&&pos<buffer.length)return buffer[pos++]},readBool:()=>{if(buffer&&pos<buffer.length)return!!buffer[pos++]},readList:()=>{let list=self2.readString(!0);if(list===void 0)return;return list?list.split(","):[]},readString:(dest,maxLen)=>{if(typeof dest==="number")maxLen=dest,dest=void 0;let len=self2.readUInt32BE();if(len===void 0)return;if(buffer.length-pos<len||typeof maxLen==="number"&&len>maxLen)return;if(dest){if(Buffer.isBuffer(dest))return bufferCopy(buffer,dest,pos,pos+=len);return buffer.utf8Slice(pos,pos+=len)}return bufferSlice(buffer,pos,pos+=len)},readRaw:(len)=>{if(!buffer)return;if(typeof len!=="number")return bufferSlice(buffer,pos,pos+=buffer.length-pos);if(buffer.length-pos>=len)return bufferSlice(buffer,pos,pos+=len)}};return self2}function makeError(msg,level,fatal){let err=Error(msg);if(typeof level==="boolean")fatal=level,err.level="protocol";else err.level=level||"protocol";return err.fatal=!!fatal,err}function writeUInt32BE(buf,value,offset){return buf[offset++]=value>>>24,buf[offset++]=value>>>16,buf[offset++]=value>>>8,buf[offset++]=value,offset}var utilBufferParser=makeBufferParser();module.exports={bufferCopy,bufferSlice,FastBuffer,bufferFill:(buf,value,start,end)=>{return TypedArrayFill.call(buf,value,start,end)},makeError,doFatalError:(protocol,msg,level,reason)=>{let err;if(DISCONNECT_REASON===void 0)({DISCONNECT_REASON}=require_constants());if(msg instanceof Error)if(err=msg,typeof level!=="number")reason=DISCONNECT_REASON.PROTOCOL_ERROR;else reason=level;else err=makeError(msg,level,!0);if(typeof reason!=="number")reason=DISCONNECT_REASON.PROTOCOL_ERROR;return protocol.disconnect(reason),protocol._destruct(),protocol._onError(err),1/0},readUInt32BE,writeUInt32BE,writeUInt32LE:(buf,value,offset)=>{return buf[offset++]=value,buf[offset++]=value>>>8,buf[offset++]=value>>>16,buf[offset++]=value>>>24,offset},makeBufferParser,bufferParser:makeBufferParser(),readString:(buffer,start,dest,maxLen)=>{if(typeof dest==="number")maxLen=dest,dest=void 0;if(start===void 0)start=0;let left=buffer.length-start;if(start<0||start>=buffer.length||left<4)return;let len=readUInt32BE(buffer,start);if(left<4+len||typeof maxLen==="number"&&len>maxLen)return;start+=4;let end=start+len;if(buffer._pos=end,dest){if(Buffer.isBuffer(dest))return bufferCopy(buffer,dest,start,end);return buffer.utf8Slice(start,end)}return bufferSlice(buffer,start,end)},sigSSHToASN1:(sig,type)=>{switch(type){case"ssh-dss":{if(sig.length>40)return sig;let asnWriter=new Ber.Writer;asnWriter.startSequence();let r=sig.slice(0,20),s=sig.slice(20);if(r[0]&128){let rNew=Buffer.allocUnsafe(21);rNew[0]=0,r.copy(rNew,1),r=rNew}else if(r[0]===0&&!(r[1]&128))r=r.slice(1);if(s[0]&128){let sNew=Buffer.allocUnsafe(21);sNew[0]=0,s.copy(sNew,1),s=sNew}else if(s[0]===0&&!(s[1]&128))s=s.slice(1);return asnWriter.writeBuffer(r,Ber.Integer),asnWriter.writeBuffer(s,Ber.Integer),asnWriter.endSequence(),asnWriter.buffer}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{utilBufferParser.init(sig,0);let r=utilBufferParser.readString(),s=utilBufferParser.readString();if(utilBufferParser.clear(),r===void 0||s===void 0)return;let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeBuffer(r,Ber.Integer),asnWriter.writeBuffer(s,Ber.Integer),asnWriter.endSequence(),asnWriter.buffer}default:return sig}},convertSignature:(signature,keyType)=>{switch(keyType){case"ssh-dss":{if(signature.length<=40)return signature;let asnReader=new Ber.Reader(signature);asnReader.readSequence();let r=asnReader.readString(Ber.Integer,!0),s=asnReader.readString(Ber.Integer,!0),rOffset=0,sOffset=0;if(r.length<20){let rNew=Buffer.allocUnsafe(20);rNew.set(r,1),r=rNew,r[0]=0}if(s.length<20){let sNew=Buffer.allocUnsafe(20);sNew.set(s,1),s=sNew,s[0]=0}if(r.length>20&&r[0]===0)rOffset=1;if(s.length>20&&s[0]===0)sOffset=1;let newSig=Buffer.allocUnsafe(r.length-rOffset+(s.length-sOffset));return bufferCopy(r,newSig,rOffset,r.length,0),bufferCopy(s,newSig,sOffset,s.length,r.length-rOffset),newSig}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{if(signature[0]===0)return signature;let asnReader=new Ber.Reader(signature);asnReader.readSequence();let r=asnReader.readString(Ber.Integer,!0),s=asnReader.readString(Ber.Integer,!0);if(r===null||s===null)return;let newSig=Buffer.allocUnsafe(4+r.length+4+s.length);return writeUInt32BE(newSig,r.length,0),newSig.set(r,4),writeUInt32BE(newSig,s.length,4+r.length),newSig.set(s,8+r.length),newSig}}return signature},sendPacket:(proto,packet,bypass)=>{if(!bypass&&proto._kexinit!==void 0){if(proto._queue===void 0)proto._queue=[];return proto._queue.push(packet),proto._debug&&proto._debug("Outbound: ... packet queued"),!1}return proto._cipher.encrypt(packet),!0}}});var require_sshcrypto=__commonJS((exports,module)=>{module.exports=__require("./sshcrypto-3xszjg3c.node")});var require_poly1305=__commonJS((exports,module)=>{var __dirname="/home/runner/work/vibe-plugin-tool-ssh/vibe-plugin-tool-ssh/node_modules/ssh2/lib/protocol/crypto",__filename="/home/runner/work/vibe-plugin-tool-ssh/vibe-plugin-tool-ssh/node_modules/ssh2/lib/protocol/crypto/poly1305.js",createPoly1305=function(){var _scriptDir=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;if(typeof __filename<"u")_scriptDir=_scriptDir||__filename;return function(createPoly13052){createPoly13052=createPoly13052||{};var b;b||(b=typeof createPoly13052<"u"?createPoly13052:{});var q,r;b.ready=new Promise(function(a,c){q=a,r=c});var u={},w;for(w in b)b.hasOwnProperty(w)&&(u[w]=b[w]);var x=typeof window==="object",y=typeof importScripts==="function",z=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string",B="",C,D,E,F,G;if(z)B=y?__require("path").dirname(B)+"/":__dirname+"/",C=function(a,c){var d=H(a);if(d)return c?d:d.toString();return F||(F=__require("fs")),G||(G=__require("path")),a=G.normalize(a),F.readFileSync(a,c?null:"utf8")},E=function(a){return a=C(a,!0),a.buffer||(a=new Uint8Array(a)),assert(a.buffer),a},D=function(a,c,d){var e=H(a);e&&c(e),F||(F=__require("fs")),G||(G=__require("path")),a=G.normalize(a),F.readFile(a,function(f,l){f?d(f):c(l.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),b.inspect=function(){return"[Emscripten Module object]"};else if(x||y)y?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),_scriptDir&&(B=_scriptDir),B.indexOf("blob:")!==0?B=B.substr(0,B.lastIndexOf("/")+1):B="",C=function(a){try{var c=new XMLHttpRequest;return c.open("GET",a,!1),c.send(null),c.responseText}catch(f){if(a=H(a)){c=[];for(var d=0;d<a.length;d++){var e=a[d];255<e&&(ba&&assert(!1,"Character code "+e+" ("+String.fromCharCode(e)+") at offset "+d+" not in 0x00-0xFF."),e&=255),c.push(String.fromCharCode(e))}return c.join("")}throw f}},y&&(E=function(a){try{var c=new XMLHttpRequest;return c.open("GET",a,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}catch(d){if(a=H(a))return a;throw d}}),D=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0),e.responseType="arraybuffer",e.onload=function(){if(e.status==200||e.status==0&&e.response)c(e.response);else{var f=H(a);f?c(f.buffer):d()}},e.onerror=d,e.send(null)};b.print||console.log.bind(console);var I=b.printErr||console.warn.bind(console);for(w in u)u.hasOwnProperty(w)&&(b[w]=u[w]);u=null;var J;b.wasmBinary&&(J=b.wasmBinary);var noExitRuntime=b.noExitRuntime||!0;typeof WebAssembly!=="object"&&K("no native wasm support detected");var L,M=!1;function assert(a,c){a||K("Assertion failed: "+c)}function N(a){var c=b["_"+a];return assert(c,"Cannot call unknown function "+a+", make sure it is exported"),c}function ca(a,c,d,e){var f={string:function(g){var p=0;if(g!==null&&g!==void 0&&g!==0){var n=(g.length<<2)+1;p=O(n);var k=p,h=P;if(0<n){n=k+n-1;for(var v=0;v<g.length;++v){var m=g.charCodeAt(v);if(55296<=m&&57343>=m){var oa=g.charCodeAt(++v);m=65536+((m&1023)<<10)|oa&1023}if(127>=m){if(k>=n)break;h[k++]=m}else{if(2047>=m){if(k+1>=n)break;h[k++]=192|m>>6}else{if(65535>=m){if(k+2>=n)break;h[k++]=224|m>>12}else{if(k+3>=n)break;h[k++]=240|m>>18,h[k++]=128|m>>12&63}h[k++]=128|m>>6&63}h[k++]=128|m&63}}h[k]=0}}return p},array:function(g){var p=O(g.length);return Q.set(g,p),p}},l=N(a),A=[];if(a=0,e)for(var t=0;t<e.length;t++){var aa=f[d[t]];aa?(a===0&&(a=da()),A[t]=aa(e[t])):A[t]=e[t]}return d=l.apply(null,A),d=function(g){if(c==="string")if(g){for(var p=P,n=g+NaN,k=g;p[k]&&!(k>=n);)++k;if(16<k-g&&p.subarray&&ea)g=ea.decode(p.subarray(g,k));else{for(n="";g<k;){var h=p[g++];if(h&128){var v=p[g++]&63;if((h&224)==192)n+=String.fromCharCode((h&31)<<6|v);else{var m=p[g++]&63;h=(h&240)==224?(h&15)<<12|v<<6|m:(h&7)<<18|v<<12|m<<6|p[g++]&63,65536>h?n+=String.fromCharCode(h):(h-=65536,n+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else n+=String.fromCharCode(h)}g=n}}else g="";else g=c==="boolean"?!!g:g;return g}(d),a!==0&&fa(a),d}var ea=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ha,Q,P;function ia(){var a=L.buffer;ha=a,b.HEAP8=Q=new Int8Array(a),b.HEAP16=new Int16Array(a),b.HEAP32=new Int32Array(a),b.HEAPU8=P=new Uint8Array(a),b.HEAPU16=new Uint16Array(a),b.HEAPU32=new Uint32Array(a),b.HEAPF32=new Float32Array(a),b.HEAPF64=new Float64Array(a)}var R,ja=[],ka=[],la=[];function ma(){var a=b.preRun.shift();ja.unshift(a)}var S=0,T=null,U=null;b.preloadedImages={},b.preloadedAudios={};function K(a){if(b.onAbort)b.onAbort(a);throw I(a),M=!0,a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info."),r(a),a}var V="data:application/octet-stream;base64,",W;if(W="data:application/octet-stream;base64,AGFzbQEAAAABIAZgAX8Bf2ADf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AbNgIACwsLCQEAQYEICwIGUA==",!W.startsWith(V)){var na=W;W=b.locateFile?b.locateFile(na,B):B+na}function pa(){var a=W;try{if(a==W&&J)return new Uint8Array(J);var c=H(a);if(c)return c;if(E)return E(a);throw"both async and sync fetching of the wasm failed"}catch(d){K(d)}}function qa(){if(!J&&(x||y)){if(typeof fetch==="function"&&!W.startsWith("file://"))return fetch(W,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+W+"'";return a.arrayBuffer()}).catch(function(){return pa()});if(D)return new Promise(function(a,c){D(W,function(d){a(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return pa()})}function X(a){for(;0<a.length;){var c=a.shift();if(typeof c=="function")c(b);else{var d=c.m;typeof d==="number"?c.l===void 0?R.get(d)():R.get(d)(c.l):d(c.l===void 0?null:c.l)}}}var ba=!1,ra=typeof atob==="function"?atob:function(a){var c="",d=0;a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));e=e<<2|f>>4,f=(f&15)<<4|l>>2;var t=(l&3)<<6|A;c+=String.fromCharCode(e),l!==64&&(c+=String.fromCharCode(f)),A!==64&&(c+=String.fromCharCode(t))}while(d<a.length);return c};function H(a){if(a.startsWith(V)){if(a=a.slice(V.length),typeof z==="boolean"&&z){var c=Buffer.from(a,"base64");c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}else try{var d=ra(a),e=new Uint8Array(d.length);for(a=0;a<d.length;++a)e[a]=d.charCodeAt(a);c=e}catch(f){throw Error("Converting base64 string to bytes failed.")}return c}}var sa={a:function(a){var c=P.length;if(a>>>=0,2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+0.2/d);e=Math.min(e,a+100663296),e=Math.max(a,e),0<e%65536&&(e+=65536-e%65536);a:{try{L.grow(Math.min(2147483648,e)-ha.byteLength+65535>>>16),ia();var f=1;break a}catch(l){}f=void 0}if(f)return!0}return!1}};(function(){function a(f){b.asm=f.exports,L=b.asm.b,ia(),R=b.asm.j,ka.unshift(b.asm.c),S--,b.monitorRunDependencies&&b.monitorRunDependencies(S),S==0&&(T!==null&&(clearInterval(T),T=null),U&&(f=U,U=null,f()))}function c(f){a(f.instance)}function d(f){return qa().then(function(l){return WebAssembly.instantiate(l,e)}).then(f,function(l){I("failed to asynchronously prepare wasm: "+l),K(l)})}var e={a:sa};if(S++,b.monitorRunDependencies&&b.monitorRunDependencies(S),b.instantiateWasm)try{return b.instantiateWasm(e,a)}catch(f){return I("Module.instantiateWasm callback failed with error: "+f),!1}return function(){return J||typeof WebAssembly.instantiateStreaming!=="function"||W.startsWith(V)||W.startsWith("file://")||typeof fetch!=="function"?d(c):fetch(W,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(l){return I("wasm streaming compile failed: "+l),I("falling back to ArrayBuffer instantiation"),d(c)})})}().catch(r),{}})(),b.___wasm_call_ctors=function(){return(b.___wasm_call_ctors=b.asm.c).apply(null,arguments)},b._poly1305_auth=function(){return(b._poly1305_auth=b.asm.d).apply(null,arguments)};var da=b.stackSave=function(){return(da=b.stackSave=b.asm.e).apply(null,arguments)},fa=b.stackRestore=function(){return(fa=b.stackRestore=b.asm.f).apply(null,arguments)},O=b.stackAlloc=function(){return(O=b.stackAlloc=b.asm.g).apply(null,arguments)};b._malloc=function(){return(b._malloc=b.asm.h).apply(null,arguments)},b._free=function(){return(b._free=b.asm.i).apply(null,arguments)},b.cwrap=function(a,c,d,e){d=d||[];var f=d.every(function(l){return l==="number"});return c!=="string"&&f&&!e?N(a):function(){return ca(a,c,d,arguments)}};var Y;U=function ta(){Y||Z(),Y||(U=ta)};function Z(){function a(){if(!Y&&(Y=!0,b.calledRun=!0,!M)){if(X(ka),q(b),b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for(typeof b.postRun=="function"&&(b.postRun=[b.postRun]);b.postRun.length;){var c=b.postRun.shift();la.unshift(c)}X(la)}}if(!(0<S)){if(b.preRun)for(typeof b.preRun=="function"&&(b.preRun=[b.preRun]);b.preRun.length;)ma();X(ja),0<S||(b.setStatus?(b.setStatus("Running..."),setTimeout(function(){setTimeout(function(){b.setStatus("")},1),a()},1)):a())}}if(b.run=Z,b.preInit)for(typeof b.preInit=="function"&&(b.preInit=[b.preInit]);0<b.preInit.length;)b.preInit.pop()();return Z(),createPoly13052.ready}}();if(typeof exports==="object"&&typeof module==="object")module.exports=createPoly1305;else if(typeof define==="function"&&define.amd)define([],function(){return createPoly1305});else if(typeof exports==="object")exports.createPoly1305=createPoly1305});var require_crypto=__commonJS((exports,module)=>{var{createCipheriv,createDecipheriv,createHmac,randomFillSync,timingSafeEqual}=__require("crypto"),{readUInt32BE,writeUInt32BE}=require_utils(),FastBuffer=Buffer[Symbol.species],EMPTY_BUFFER=Buffer.alloc(0),BUF_INT=Buffer.alloc(4),DISCARD_CACHE=new Map,binding,AESGCMCipher,ChaChaPolyCipher,GenericCipher,AESGCMDecipher,ChaChaPolyDecipher,GenericDecipher;try{binding=require_sshcrypto(),{AESGCMCipher,ChaChaPolyCipher,GenericCipher,AESGCMDecipher,ChaChaPolyDecipher,GenericDecipher}=binding}catch{}var CIPHER_STREAM=1,CIPHER_INFO=(()=>{function info(sslName,blockLen,keyLen,ivLen,authLen,discardLen,flags){return{sslName,blockLen,keyLen,ivLen:ivLen!==0||flags&CIPHER_STREAM?ivLen:blockLen,authLen,discardLen,stream:!!(flags&CIPHER_STREAM)}}return{"chacha20-poly1305@openssh.com":info("chacha20",8,64,0,16,0,CIPHER_STREAM),"aes128-gcm":info("aes-128-gcm",16,16,12,16,0,CIPHER_STREAM),"aes256-gcm":info("aes-256-gcm",16,32,12,16,0,CIPHER_STREAM),"aes128-gcm@openssh.com":info("aes-128-gcm",16,16,12,16,0,CIPHER_STREAM),"aes256-gcm@openssh.com":info("aes-256-gcm",16,32,12,16,0,CIPHER_STREAM),"aes128-cbc":info("aes-128-cbc",16,16,0,0,0,0),"aes192-cbc":info("aes-192-cbc",16,24,0,0,0,0),"aes256-cbc":info("aes-256-cbc",16,32,0,0,0,0),"rijndael-cbc@lysator.liu.se":info("aes-256-cbc",16,32,0,0,0,0),"3des-cbc":info("des-ede3-cbc",8,24,0,0,0,0),"blowfish-cbc":info("bf-cbc",8,16,0,0,0,0),"idea-cbc":info("idea-cbc",8,16,0,0,0,0),"cast128-cbc":info("cast-cbc",8,16,0,0,0,0),"aes128-ctr":info("aes-128-ctr",16,16,16,0,0,CIPHER_STREAM),"aes192-ctr":info("aes-192-ctr",16,24,16,0,0,CIPHER_STREAM),"aes256-ctr":info("aes-256-ctr",16,32,16,0,0,CIPHER_STREAM),"3des-ctr":info("des-ede3",8,24,8,0,0,CIPHER_STREAM),"blowfish-ctr":info("bf-ecb",8,16,8,0,0,CIPHER_STREAM),"cast128-ctr":info("cast5-ecb",8,16,8,0,0,CIPHER_STREAM),arcfour:info("rc4",8,16,0,0,1536,CIPHER_STREAM),arcfour128:info("rc4",8,16,0,0,1536,CIPHER_STREAM),arcfour256:info("rc4",8,32,0,0,1536,CIPHER_STREAM),arcfour512:info("rc4",8,64,0,0,1536,CIPHER_STREAM)}})(),MAC_INFO=(()=>{function info(sslName,len,actualLen,isETM){return{sslName,len,actualLen,isETM}}return{"hmac-md5":info("md5",16,16,!1),"hmac-md5-96":info("md5",16,12,!1),"hmac-ripemd160":info("ripemd160",20,20,!1),"hmac-sha1":info("sha1",20,20,!1),"hmac-sha1-etm@openssh.com":info("sha1",20,20,!0),"hmac-sha1-96":info("sha1",20,12,!1),"hmac-sha2-256":info("sha256",32,32,!1),"hmac-sha2-256-etm@openssh.com":info("sha256",32,32,!0),"hmac-sha2-256-96":info("sha256",32,12,!1),"hmac-sha2-512":info("sha512",64,64,!1),"hmac-sha2-512-etm@openssh.com":info("sha512",64,64,!0),"hmac-sha2-512-96":info("sha512",64,12,!1)}})();class NullCipher{constructor(seqno,onWrite){this.outSeqno=seqno,this._onWrite=onWrite,this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}var POLY1305_ZEROS=Buffer.alloc(32),POLY1305_OUT_COMPUTE=Buffer.alloc(16),POLY1305_WASM_MODULE,POLY1305_RESULT_MALLOC,poly1305_auth;class ChaChaPolyCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encKeyMain=enc.cipherKey.slice(0,32),this._encKeyPktLen=enc.cipherKey.slice(32),this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen-4&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.outSeqno,12);let polyKey=createCipheriv("chacha20",this._encKeyMain,POLY1305_OUT_COMPUTE).update(POLY1305_ZEROS),pktLenEnc=createCipheriv("chacha20",this._encKeyPktLen,POLY1305_OUT_COMPUTE).update(packet.slice(0,4));this._onWrite(pktLenEnc),POLY1305_OUT_COMPUTE[0]=1;let payloadEnc=createCipheriv("chacha20",this._encKeyMain,POLY1305_OUT_COMPUTE).update(packet.slice(4));this._onWrite(payloadEnc),poly1305_auth(POLY1305_RESULT_MALLOC,pktLenEnc,pktLenEnc.length,payloadEnc,payloadEnc.length,polyKey);let mac=Buffer.allocUnsafe(16);mac.set(new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer,POLY1305_RESULT_MALLOC,16),0),this._onWrite(mac),this.outSeqno=this.outSeqno+1>>>0}}class ChaChaPolyCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._instance=new ChaChaPolyCipher(enc.cipherKey),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen-4&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+16);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._instance.encrypt(packet,this.outSeqno),this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class AESGCMCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encSSLName=enc.cipherInfo.sslName,this._encKey=enc.cipherKey,this._encIV=enc.cipherIV,this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=16-(pktLen-4&15);if(padLen<4)padLen+=16;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;let cipher=createCipheriv(this._encSSLName,this._encKey,this._encIV);cipher.setAutoPadding(!1);let lenData=packet.slice(0,4);cipher.setAAD(lenData),this._onWrite(lenData);let encrypted=cipher.update(packet.slice(4));this._onWrite(encrypted);let final=cipher.final();if(final.length)this._onWrite(final);let tag=cipher.getAuthTag();this._onWrite(tag),ivIncrement(this._encIV),this.outSeqno=this.outSeqno+1>>>0}}class AESGCMCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._instance=new AESGCMCipher(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=16-(pktLen-4&15);if(padLen<4)padLen+=16;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+16);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._instance.encrypt(packet),this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class GenericCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encBlockLen=enc.cipherInfo.blockLen,this._cipherInstance=createCipheriv(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV),this._macSSLName=enc.macInfo.sslName,this._macKey=enc.macKey,this._macActualLen=enc.macInfo.actualLen,this._macETM=enc.macInfo.isETM,this._aadLen=this._macETM?4:0,this._dead=!1;let discardLen=enc.cipherInfo.discardLen;if(discardLen){let discard=DISCARD_CACHE.get(discardLen);if(discard===void 0)discard=Buffer.alloc(discardLen),DISCARD_CACHE.set(discardLen,discard);this._cipherInstance.update(discard)}}free(){this._dead=!0}allocPacket(payloadLen){let blockLen=this._encBlockLen,pktLen=5+payloadLen,padLen=blockLen-(pktLen-this._aadLen&blockLen-1);if(padLen<4)padLen+=blockLen;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;let mac;if(this._macETM){let lenBytes=new Uint8Array(packet.buffer,packet.byteOffset,4),encrypted=this._cipherInstance.update(new Uint8Array(packet.buffer,packet.byteOffset+4,packet.length-4));this._onWrite(lenBytes),this._onWrite(encrypted),mac=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.outSeqno,0),mac.update(BUF_INT),mac.update(lenBytes),mac.update(encrypted)}else{let encrypted=this._cipherInstance.update(packet);this._onWrite(encrypted),mac=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.outSeqno,0),mac.update(BUF_INT),mac.update(packet)}let digest=mac.digest();if(digest.length>this._macActualLen)digest=digest.slice(0,this._macActualLen);this._onWrite(digest),this.outSeqno=this.outSeqno+1>>>0}}class GenericCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encBlockLen=enc.cipherInfo.blockLen,this._macLen=enc.macInfo.len,this._macActualLen=enc.macInfo.actualLen,this._aadLen=enc.macInfo.isETM?4:0,this._instance=new GenericCipher(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV,enc.macInfo.sslName,enc.macKey,enc.macInfo.isETM),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let blockLen=this._encBlockLen,pktLen=5+payloadLen,padLen=blockLen-(pktLen-this._aadLen&blockLen-1);if(padLen<4)padLen+=blockLen;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+this._macLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;if(this._instance.encrypt(packet,this.outSeqno),this._macActualLen<this._macLen)packet=new FastBuffer(packet.buffer,packet.byteOffset,packet.length-(this._macLen-this._macActualLen));this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class NullDecipher{constructor(seqno,onPayload){this.inSeqno=seqno,this._onPayload=onPayload,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len>35000||this._len<8||(4+this._len&7)!==0)throw Error("Bad packet length");if(p>=dataLen)return}if(this._packetPos<this._len){let nb=Math.min(this._len-this._packetPos,dataLen-p),chunk;if(p!==0||nb!==dataLen)chunk=new Uint8Array(data.buffer,data.byteOffset+p,nb);else chunk=data;if(nb===this._len)this._packet=chunk;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(chunk,this._packetPos)}if(p+=nb,this._packetPos+=nb,this._packetPos<this._len)return}let payload=!this._packet?EMPTY_BUFFER:new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class ChaChaPolyDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decKeyMain=dec.decipherKey.slice(0,32),this._decKeyPktLen=dec.decipherKey.slice(32),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._calcMac=Buffer.allocUnsafe(16),this._macPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenPos<4){let nb=Math.min(4-this._lenPos,dataLen-p);while(nb--)this._lenBuf[this._lenPos++]=data[p++];if(this._lenPos<4)return;POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.inSeqno,12);let decLenBytes=createDecipheriv("chacha20",this._decKeyPktLen,POLY1305_OUT_COMPUTE).update(this._lenBuf);if(this._len=readUInt32BE(decLenBytes,0),this._len>35000||this._len<8||(this._len&7)!==0)throw Error("Bad packet length")}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<16)return}POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.inSeqno,12);let polyKey=createCipheriv("chacha20",this._decKeyMain,POLY1305_OUT_COMPUTE).update(POLY1305_ZEROS);if(poly1305_auth(POLY1305_RESULT_MALLOC,this._lenBuf,4,this._packet,this._packet.length,polyKey),this._calcMac.set(new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer,POLY1305_RESULT_MALLOC,16),0),!timingSafeEqual(this._calcMac,this._mac))throw Error("Invalid MAC");POLY1305_OUT_COMPUTE[0]=1;let packet=createDecipheriv("chacha20",this._decKeyMain,POLY1305_OUT_COMPUTE).update(this._packet),payload=new FastBuffer(packet.buffer,packet.byteOffset+1,packet.length-packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class ChaChaPolyDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new ChaChaPolyDecipher(dec.decipherKey),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._macPos=0}free(){this._instance.free()}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenPos<4){let nb=Math.min(4-this._lenPos,dataLen-p);while(nb--)this._lenBuf[this._lenPos++]=data[p++];if(this._lenPos<4)return;if(this._len=this._instance.decryptLen(this._lenBuf,this.inSeqno),this._len>35000||this._len<8||(this._len&7)!==0)throw Error("Bad packet length");if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<16)return}this._instance.decrypt(this._packet,this._mac,this.inSeqno);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class AESGCMDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decipherInstance=null,this._decipherSSLName=dec.decipherInfo.sslName,this._decipherKey=dec.decipherKey,this._decipherIV=dec.decipherIV,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw Error("Bad packet length");this._decipherInstance=createDecipheriv(this._decipherSSLName,this._decipherKey,this._decipherIV),this._decipherInstance.setAutoPadding(!1),this._decipherInstance.setAAD(intToBytes(this._len))}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),decrypted;if(p!==0||nb!==dataLen)decrypted=this._decipherInstance.update(new Uint8Array(data.buffer,data.byteOffset+p,nb));else decrypted=this._decipherInstance.update(data);if(decrypted.length){if(nb===this._len)this._packet=decrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(decrypted,this._packetPos)}this._packetPos+=decrypted.length}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._tagPos,dataLen-p);if(p!==0||nb!==dataLen)this._tag.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._tagPos);else this._tag.set(data,this._tagPos);if(p+=nb,this._tagPos+=nb,this._tagPos<16)return}{this._decipherInstance.setAuthTag(this._tag);let decrypted=this._decipherInstance.final();if(decrypted.length)if(this._packet)this._packet.set(decrypted,this._packetPos);else this._packet=decrypted}let payload=!this._packet?EMPTY_BUFFER:new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,ivIncrement(this._decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tagPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class AESGCMDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new AESGCMDecipher(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw Error(`Bad packet length: ${this._len}`)}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._tagPos,dataLen-p);if(p!==0||nb!==dataLen)this._tag.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._tagPos);else this._tag.set(data,this._tagPos);if(p+=nb,this._tagPos+=nb,this._tagPos<16)return}this._instance.decrypt(this._packet,this._len,this._tag);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tagPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class GenericDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decipherInstance=createDecipheriv(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV),this._decipherInstance.setAutoPadding(!1),this._block=Buffer.allocUnsafe(dec.macInfo.isETM?4:dec.decipherInfo.blockLen),this._blockSize=dec.decipherInfo.blockLen,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._mac=Buffer.allocUnsafe(dec.macInfo.actualLen),this._macPos=0,this._macSSLName=dec.macInfo.sslName,this._macKey=dec.macKey,this._macActualLen=dec.macInfo.actualLen,this._macETM=dec.macInfo.isETM,this._macInstance=null;let discardLen=dec.decipherInfo.discardLen;if(discardLen){let discard=DISCARD_CACHE.get(discardLen);if(discard===void 0)discard=Buffer.alloc(discardLen),DISCARD_CACHE.set(discardLen,discard);this._decipherInstance.update(discard)}}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._blockPos<this._block.length){let nb=Math.min(this._block.length-this._blockPos,dataLen-p);if(p!==0||nb!==dataLen||nb<data.length)this._block.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._blockPos);else this._block.set(data,this._blockPos);if(p+=nb,this._blockPos+=nb,this._blockPos<this._block.length)return;let decrypted,need;if(this._macETM)this._len=need=readUInt32BE(this._block,0);else decrypted=this._decipherInstance.update(this._block),this._len=readUInt32BE(decrypted,0),need=4+this._len-this._blockSize;if(this._len>35000||this._len<5||(need&this._blockSize-1)!==0)throw Error("Bad packet length");if(this._macInstance=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.inSeqno,0),this._macInstance.update(BUF_INT),this._macETM)this._macInstance.update(this._block);else this._macInstance.update(new Uint8Array(decrypted.buffer,decrypted.byteOffset,4)),this._pktLen=decrypted.length-4,this._packetPos=this._pktLen,this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(decrypted.buffer,decrypted.byteOffset+4,this._packetPos),0);if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(this._macETM)this._macInstance.update(encrypted);let decrypted=this._decipherInstance.update(encrypted);if(decrypted.length){if(nb===this._len)this._packet=decrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(decrypted,this._packetPos)}this._packetPos+=decrypted.length}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(this._macActualLen-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<this._macActualLen)return}if(!this._macETM)this._macInstance.update(this._packet);let calculated=this._macInstance.digest();if(this._macActualLen<calculated.length)calculated=new Uint8Array(calculated.buffer,calculated.byteOffset,this._macActualLen);if(!timingSafeEquals(calculated,this._mac))throw Error("Invalid MAC");let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._macPos=0,this._macInstance=null;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class GenericDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new GenericDecipher(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV,dec.macInfo.sslName,dec.macKey,dec.macInfo.isETM,dec.macInfo.actualLen),this._block=Buffer.allocUnsafe(dec.macInfo.isETM||dec.decipherInfo.stream?4:dec.decipherInfo.blockLen),this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(dec.macInfo.actualLen),this._macPos=0,this._macActualLen=dec.macInfo.actualLen,this._macETM=dec.macInfo.isETM}free(){this._instance.free()}decrypt(data,p,dataLen){while(p<dataLen){if(this._blockPos<this._block.length){let nb=Math.min(this._block.length-this._blockPos,dataLen-p);if(p!==0||nb!==dataLen||nb<data.length)this._block.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._blockPos);else this._block.set(data,this._blockPos);if(p+=nb,this._blockPos+=nb,this._blockPos<this._block.length)return;let need;if(this._macETM)this._len=need=readUInt32BE(this._block,0);else this._instance.decryptBlock(this._block),this._len=readUInt32BE(this._block,0),need=4+this._len-this._block.length;if(this._len>35000||this._len<5||(need&this._block.length-1)!==0)throw Error("Bad packet length");if(!this._macETM){if(this._pktLen=this._block.length-4,this._pktLen)this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(this._block.buffer,this._block.byteOffset+4,this._pktLen),0)}if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(this._macActualLen-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<this._macActualLen)return}this._instance.decrypt(this._packet,this.inSeqno,this._block,this._mac);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._macPos=0,this._macInstance=null;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}function ivIncrement(iv){++iv[11]>>>8&&++iv[10]>>>8&&++iv[9]>>>8&&++iv[8]>>>8&&++iv[7]>>>8&&++iv[6]>>>8&&++iv[5]>>>8&&++iv[4]>>>8}var intToBytes=(()=>{let ret=Buffer.alloc(4);return(n)=>{return ret[0]=n>>>24,ret[1]=n>>>16,ret[2]=n>>>8,ret[3]=n,ret}})();function timingSafeEquals(a,b){if(a.length!==b.length)return timingSafeEqual(a,a),!1;return timingSafeEqual(a,b)}function createCipher(config){if(typeof config!=="object"||config===null)throw Error("Invalid config");if(typeof config.outbound!=="object"||config.outbound===null)throw Error("Invalid outbound");let outbound=config.outbound;if(typeof outbound.onWrite!=="function")throw Error("Invalid outbound.onWrite");if(typeof outbound.cipherInfo!=="object"||outbound.cipherInfo===null)throw Error("Invalid outbound.cipherInfo");if(!Buffer.isBuffer(outbound.cipherKey)||outbound.cipherKey.length!==outbound.cipherInfo.keyLen)throw Error("Invalid outbound.cipherKey");if(outbound.cipherInfo.ivLen&&(!Buffer.isBuffer(outbound.cipherIV)||outbound.cipherIV.length!==outbound.cipherInfo.ivLen))throw Error("Invalid outbound.cipherIV");if(typeof outbound.seqno!=="number"||outbound.seqno<0||outbound.seqno>4294967295)throw Error("Invalid outbound.seqno");let forceNative=!!outbound.forceNative;switch(outbound.cipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return AESGCMCipher&&!forceNative?new AESGCMCipherBinding(config):new AESGCMCipherNative(config);case"chacha20":return ChaChaPolyCipher&&!forceNative?new ChaChaPolyCipherBinding(config):new ChaChaPolyCipherNative(config);default:{if(typeof outbound.macInfo!=="object"||outbound.macInfo===null)throw Error("Invalid outbound.macInfo");if(!Buffer.isBuffer(outbound.macKey)||outbound.macKey.length!==outbound.macInfo.len)throw Error("Invalid outbound.macKey");return GenericCipher&&!forceNative?new GenericCipherBinding(config):new GenericCipherNative(config)}}}function createDecipher(config){if(typeof config!=="object"||config===null)throw Error("Invalid config");if(typeof config.inbound!=="object"||config.inbound===null)throw Error("Invalid inbound");let inbound=config.inbound;if(typeof inbound.onPayload!=="function")throw Error("Invalid inbound.onPayload");if(typeof inbound.decipherInfo!=="object"||inbound.decipherInfo===null)throw Error("Invalid inbound.decipherInfo");if(!Buffer.isBuffer(inbound.decipherKey)||inbound.decipherKey.length!==inbound.decipherInfo.keyLen)throw Error("Invalid inbound.decipherKey");if(inbound.decipherInfo.ivLen&&(!Buffer.isBuffer(inbound.decipherIV)||inbound.decipherIV.length!==inbound.decipherInfo.ivLen))throw Error("Invalid inbound.decipherIV");if(typeof inbound.seqno!=="number"||inbound.seqno<0||inbound.seqno>4294967295)throw Error("Invalid inbound.seqno");let forceNative=!!inbound.forceNative;switch(inbound.decipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return AESGCMDecipher&&!forceNative?new AESGCMDecipherBinding(config):new AESGCMDecipherNative(config);case"chacha20":return ChaChaPolyDecipher&&!forceNative?new ChaChaPolyDecipherBinding(config):new ChaChaPolyDecipherNative(config);default:{if(typeof inbound.macInfo!=="object"||inbound.macInfo===null)throw Error("Invalid inbound.macInfo");if(!Buffer.isBuffer(inbound.macKey)||inbound.macKey.length!==inbound.macInfo.len)throw Error("Invalid inbound.macKey");return GenericDecipher&&!forceNative?new GenericDecipherBinding(config):new GenericDecipherNative(config)}}}module.exports={CIPHER_INFO,MAC_INFO,bindingAvailable:!!binding,init:(()=>{return new Promise(async(resolve,reject)=>{try{POLY1305_WASM_MODULE=await require_poly1305()(),POLY1305_RESULT_MALLOC=POLY1305_WASM_MODULE._malloc(16),poly1305_auth=POLY1305_WASM_MODULE.cwrap("poly1305_auth",null,["number","array","number","array","number","array"])}catch(ex){return reject(ex)}resolve()})})(),NullCipher,createCipher,NullDecipher,createDecipher}});var require_keyParser=__commonJS((exports,module)=>{var{createDecipheriv,createECDH,createHash,createHmac,createSign,createVerify,getCiphers,sign:sign_,verify:verify_}=__require("crypto"),supportedOpenSSLCiphers=getCiphers(),{Ber}=require_lib(),bcrypt_pbkdf=require_bcrypt_pbkdf().pbkdf,{CIPHER_INFO}=require_crypto(),{eddsaSupported,SUPPORTED_CIPHER}=require_constants(),{bufferSlice,makeBufferParser,readString,readUInt32BE,writeUInt32BE}=require_utils(),SYM_HASH_ALGO=Symbol("Hash Algorithm"),SYM_PRIV_PEM=Symbol("Private key PEM"),SYM_PUB_PEM=Symbol("Public key PEM"),SYM_PUB_SSH=Symbol("Public key SSH"),SYM_DECRYPTED=Symbol("Decrypted Key"),CIPHER_INFO_OPENSSL=Object.create(null);{let keys=Object.keys(CIPHER_INFO);for(let i=0;i<keys.length;++i){let cipherName=CIPHER_INFO[keys[i]].sslName;if(!cipherName||CIPHER_INFO_OPENSSL[cipherName])continue;CIPHER_INFO_OPENSSL[cipherName]=CIPHER_INFO[keys[i]]}}var binaryKeyParser=makeBufferParser();function makePEM(type,data){data=data.base64Slice(0,data.length);let formatted=data.replace(/.{64}/g,`$&
4
+ -----END PRIVATE KEY-----`,data=Buffer.from("a"),sig,verified;try{sig=crypto.sign(null,data,key),verified=crypto.verify(null,data,key,sig)}catch{}return Buffer.isBuffer(sig)&&sig.length===64&&verified===!0}return!1})(),curve25519Supported=typeof crypto.diffieHellman==="function"&&typeof crypto.generateKeyPairSync==="function"&&typeof crypto.createPublicKey==="function",DEFAULT_KEX=["ecdh-sha2-nistp256","ecdh-sha2-nistp384","ecdh-sha2-nistp521","diffie-hellman-group-exchange-sha256","diffie-hellman-group14-sha256","diffie-hellman-group15-sha512","diffie-hellman-group16-sha512","diffie-hellman-group17-sha512","diffie-hellman-group18-sha512"];if(curve25519Supported)DEFAULT_KEX.unshift("curve25519-sha256"),DEFAULT_KEX.unshift("curve25519-sha256@libssh.org");var SUPPORTED_KEX=DEFAULT_KEX.concat(["diffie-hellman-group-exchange-sha1","diffie-hellman-group14-sha1","diffie-hellman-group1-sha1"]),DEFAULT_SERVER_HOST_KEY=["ecdsa-sha2-nistp256","ecdsa-sha2-nistp384","ecdsa-sha2-nistp521","rsa-sha2-512","rsa-sha2-256","ssh-rsa"];if(eddsaSupported)DEFAULT_SERVER_HOST_KEY.unshift("ssh-ed25519");var SUPPORTED_SERVER_HOST_KEY=DEFAULT_SERVER_HOST_KEY.concat(["ssh-dss"]),canUseCipher=(()=>{let ciphers=crypto.getCiphers();return(name)=>ciphers.includes(CIPHER_INFO[name].sslName)})(),DEFAULT_CIPHER=["aes128-gcm@openssh.com","aes256-gcm@openssh.com","aes128-ctr","aes192-ctr","aes256-ctr"];if(cpuInfo&&cpuInfo.flags&&!cpuInfo.flags.aes)if(bindingAvailable)DEFAULT_CIPHER.unshift("chacha20-poly1305@openssh.com");else DEFAULT_CIPHER.push("chacha20-poly1305@openssh.com");else if(bindingAvailable&&cpuInfo&&cpuInfo.arch==="x86")DEFAULT_CIPHER.splice(4,0,"chacha20-poly1305@openssh.com");else DEFAULT_CIPHER.push("chacha20-poly1305@openssh.com");DEFAULT_CIPHER=DEFAULT_CIPHER.filter(canUseCipher);var SUPPORTED_CIPHER=DEFAULT_CIPHER.concat(["aes256-cbc","aes192-cbc","aes128-cbc","blowfish-cbc","3des-cbc","aes128-gcm","aes256-gcm","arcfour256","arcfour128","cast128-cbc","arcfour"].filter(canUseCipher)),canUseMAC=(()=>{let hashes=crypto.getHashes();return(name)=>hashes.includes(MAC_INFO[name].sslName)})(),DEFAULT_MAC=["hmac-sha2-256-etm@openssh.com","hmac-sha2-512-etm@openssh.com","hmac-sha1-etm@openssh.com","hmac-sha2-256","hmac-sha2-512","hmac-sha1"].filter(canUseMAC),SUPPORTED_MAC=DEFAULT_MAC.concat(["hmac-md5","hmac-sha2-256-96","hmac-sha2-512-96","hmac-ripemd160","hmac-sha1-96","hmac-md5-96"].filter(canUseMAC)),DEFAULT_COMPRESSION=["none","zlib@openssh.com","zlib"],SUPPORTED_COMPRESSION=DEFAULT_COMPRESSION.concat([]),COMPAT={BAD_DHGEX:1,OLD_EXIT:2,DYN_RPORT_BUG:4,BUG_DHGEX_LARGE:8,IMPLY_RSA_SHA2_SIGALGS:16};module.exports={MESSAGE:{DISCONNECT:1,IGNORE:2,UNIMPLEMENTED:3,DEBUG:4,SERVICE_REQUEST:5,SERVICE_ACCEPT:6,EXT_INFO:7,KEXINIT:20,NEWKEYS:21,KEXDH_INIT:30,KEXDH_REPLY:31,KEXDH_GEX_GROUP:31,KEXDH_GEX_INIT:32,KEXDH_GEX_REPLY:33,KEXDH_GEX_REQUEST:34,KEXECDH_INIT:30,KEXECDH_REPLY:31,USERAUTH_REQUEST:50,USERAUTH_FAILURE:51,USERAUTH_SUCCESS:52,USERAUTH_BANNER:53,USERAUTH_PASSWD_CHANGEREQ:60,USERAUTH_PK_OK:60,USERAUTH_INFO_REQUEST:60,USERAUTH_INFO_RESPONSE:61,GLOBAL_REQUEST:80,REQUEST_SUCCESS:81,REQUEST_FAILURE:82,CHANNEL_OPEN:90,CHANNEL_OPEN_CONFIRMATION:91,CHANNEL_OPEN_FAILURE:92,CHANNEL_WINDOW_ADJUST:93,CHANNEL_DATA:94,CHANNEL_EXTENDED_DATA:95,CHANNEL_EOF:96,CHANNEL_CLOSE:97,CHANNEL_REQUEST:98,CHANNEL_SUCCESS:99,CHANNEL_FAILURE:100},DISCONNECT_REASON:{HOST_NOT_ALLOWED_TO_CONNECT:1,PROTOCOL_ERROR:2,KEY_EXCHANGE_FAILED:3,RESERVED:4,MAC_ERROR:5,COMPRESSION_ERROR:6,SERVICE_NOT_AVAILABLE:7,PROTOCOL_VERSION_NOT_SUPPORTED:8,HOST_KEY_NOT_VERIFIABLE:9,CONNECTION_LOST:10,BY_APPLICATION:11,TOO_MANY_CONNECTIONS:12,AUTH_CANCELED_BY_USER:13,NO_MORE_AUTH_METHODS_AVAILABLE:14,ILLEGAL_USER_NAME:15},DISCONNECT_REASON_STR:void 0,CHANNEL_OPEN_FAILURE:{ADMINISTRATIVELY_PROHIBITED:1,CONNECT_FAILED:2,UNKNOWN_CHANNEL_TYPE:3,RESOURCE_SHORTAGE:4},TERMINAL_MODE:{TTY_OP_END:0,VINTR:1,VQUIT:2,VERASE:3,VKILL:4,VEOF:5,VEOL:6,VEOL2:7,VSTART:8,VSTOP:9,VSUSP:10,VDSUSP:11,VREPRINT:12,VWERASE:13,VLNEXT:14,VFLUSH:15,VSWTCH:16,VSTATUS:17,VDISCARD:18,IGNPAR:30,PARMRK:31,INPCK:32,ISTRIP:33,INLCR:34,IGNCR:35,ICRNL:36,IUCLC:37,IXON:38,IXANY:39,IXOFF:40,IMAXBEL:41,ISIG:50,ICANON:51,XCASE:52,ECHO:53,ECHOE:54,ECHOK:55,ECHONL:56,NOFLSH:57,TOSTOP:58,IEXTEN:59,ECHOCTL:60,ECHOKE:61,PENDIN:62,OPOST:70,OLCUC:71,ONLCR:72,OCRNL:73,ONOCR:74,ONLRET:75,CS7:90,CS8:91,PARENB:92,PARODD:93,TTY_OP_ISPEED:128,TTY_OP_OSPEED:129},CHANNEL_EXTENDED_DATATYPE:{STDERR:1},SIGNALS:["ABRT","ALRM","FPE","HUP","ILL","INT","QUIT","SEGV","TERM","USR1","USR2","KILL","PIPE"].reduce((cur,val)=>({...cur,[val]:1}),{}),COMPAT,COMPAT_CHECKS:[["Cisco-1.25",COMPAT.BAD_DHGEX],[/^Cisco-1[.]/,COMPAT.BUG_DHGEX_LARGE],[/^[0-9.]+$/,COMPAT.OLD_EXIT],[/^OpenSSH_5[.][0-9]+/,COMPAT.DYN_RPORT_BUG],[/^OpenSSH_7[.]4/,COMPAT.IMPLY_RSA_SHA2_SIGALGS]],DEFAULT_KEX,SUPPORTED_KEX,DEFAULT_SERVER_HOST_KEY,SUPPORTED_SERVER_HOST_KEY,DEFAULT_CIPHER,SUPPORTED_CIPHER,DEFAULT_MAC,SUPPORTED_MAC,DEFAULT_COMPRESSION,SUPPORTED_COMPRESSION,curve25519Supported,eddsaSupported};module.exports.DISCONNECT_REASON_BY_VALUE=Array.from(Object.entries(module.exports.DISCONNECT_REASON)).reduce((obj,[key,value])=>({...obj,[value]:key}),{})});var require_utils=__commonJS((exports,module)=>{var Ber=require_lib().Ber,DISCONNECT_REASON,FastBuffer=Buffer[Symbol.species],TypedArrayFill=Object.getPrototypeOf(Uint8Array.prototype).fill;function readUInt32BE(buf,offset){return buf[offset++]*16777216+buf[offset++]*65536+buf[offset++]*256+buf[offset]}function bufferCopy(src,dest,srcStart,srcEnd,destStart){if(!destStart)destStart=0;if(srcEnd>src.length)srcEnd=src.length;let nb=srcEnd-srcStart,destLeft=dest.length-destStart;if(nb>destLeft)nb=destLeft;return dest.set(new Uint8Array(src.buffer,src.byteOffset+srcStart,nb),destStart),nb}function bufferSlice(buf,start,end){if(end===void 0)end=buf.length;return new FastBuffer(buf.buffer,buf.byteOffset+start,end-start)}function makeBufferParser(){let pos=0,buffer,self2={init:(buf,start)=>{buffer=buf,pos=typeof start==="number"?start:0},pos:()=>pos,length:()=>buffer?buffer.length:0,avail:()=>buffer&&pos<buffer.length?buffer.length-pos:0,clear:()=>{buffer=void 0},readUInt32BE:()=>{if(!buffer||pos+3>=buffer.length)return;return buffer[pos++]*16777216+buffer[pos++]*65536+buffer[pos++]*256+buffer[pos++]},readUInt64BE:(behavior)=>{if(!buffer||pos+7>=buffer.length)return;switch(behavior){case"always":return BigInt(`0x${buffer.hexSlice(pos,pos+=8)}`);case"maybe":if(buffer[pos]>31)return BigInt(`0x${buffer.hexSlice(pos,pos+=8)}`);default:return buffer[pos++]*72057594037927940+buffer[pos++]*281474976710656+buffer[pos++]*1099511627776+buffer[pos++]*4294967296+buffer[pos++]*16777216+buffer[pos++]*65536+buffer[pos++]*256+buffer[pos++]}},skip:(n)=>{if(buffer&&n>0)pos+=n},skipString:()=>{let len=self2.readUInt32BE();if(len===void 0)return;return pos+=len,pos<=buffer.length?len:void 0},readByte:()=>{if(buffer&&pos<buffer.length)return buffer[pos++]},readBool:()=>{if(buffer&&pos<buffer.length)return!!buffer[pos++]},readList:()=>{let list=self2.readString(!0);if(list===void 0)return;return list?list.split(","):[]},readString:(dest,maxLen)=>{if(typeof dest==="number")maxLen=dest,dest=void 0;let len=self2.readUInt32BE();if(len===void 0)return;if(buffer.length-pos<len||typeof maxLen==="number"&&len>maxLen)return;if(dest){if(Buffer.isBuffer(dest))return bufferCopy(buffer,dest,pos,pos+=len);return buffer.utf8Slice(pos,pos+=len)}return bufferSlice(buffer,pos,pos+=len)},readRaw:(len)=>{if(!buffer)return;if(typeof len!=="number")return bufferSlice(buffer,pos,pos+=buffer.length-pos);if(buffer.length-pos>=len)return bufferSlice(buffer,pos,pos+=len)}};return self2}function makeError(msg,level,fatal){let err=Error(msg);if(typeof level==="boolean")fatal=level,err.level="protocol";else err.level=level||"protocol";return err.fatal=!!fatal,err}function writeUInt32BE(buf,value,offset){return buf[offset++]=value>>>24,buf[offset++]=value>>>16,buf[offset++]=value>>>8,buf[offset++]=value,offset}var utilBufferParser=makeBufferParser();module.exports={bufferCopy,bufferSlice,FastBuffer,bufferFill:(buf,value,start,end)=>{return TypedArrayFill.call(buf,value,start,end)},makeError,doFatalError:(protocol,msg,level,reason)=>{let err;if(DISCONNECT_REASON===void 0)({DISCONNECT_REASON}=require_constants());if(msg instanceof Error)if(err=msg,typeof level!=="number")reason=DISCONNECT_REASON.PROTOCOL_ERROR;else reason=level;else err=makeError(msg,level,!0);if(typeof reason!=="number")reason=DISCONNECT_REASON.PROTOCOL_ERROR;return protocol.disconnect(reason),protocol._destruct(),protocol._onError(err),1/0},readUInt32BE,writeUInt32BE,writeUInt32LE:(buf,value,offset)=>{return buf[offset++]=value,buf[offset++]=value>>>8,buf[offset++]=value>>>16,buf[offset++]=value>>>24,offset},makeBufferParser,bufferParser:makeBufferParser(),readString:(buffer,start,dest,maxLen)=>{if(typeof dest==="number")maxLen=dest,dest=void 0;if(start===void 0)start=0;let left=buffer.length-start;if(start<0||start>=buffer.length||left<4)return;let len=readUInt32BE(buffer,start);if(left<4+len||typeof maxLen==="number"&&len>maxLen)return;start+=4;let end=start+len;if(buffer._pos=end,dest){if(Buffer.isBuffer(dest))return bufferCopy(buffer,dest,start,end);return buffer.utf8Slice(start,end)}return bufferSlice(buffer,start,end)},sigSSHToASN1:(sig,type)=>{switch(type){case"ssh-dss":{if(sig.length>40)return sig;let asnWriter=new Ber.Writer;asnWriter.startSequence();let r=sig.slice(0,20),s=sig.slice(20);if(r[0]&128){let rNew=Buffer.allocUnsafe(21);rNew[0]=0,r.copy(rNew,1),r=rNew}else if(r[0]===0&&!(r[1]&128))r=r.slice(1);if(s[0]&128){let sNew=Buffer.allocUnsafe(21);sNew[0]=0,s.copy(sNew,1),s=sNew}else if(s[0]===0&&!(s[1]&128))s=s.slice(1);return asnWriter.writeBuffer(r,Ber.Integer),asnWriter.writeBuffer(s,Ber.Integer),asnWriter.endSequence(),asnWriter.buffer}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{utilBufferParser.init(sig,0);let r=utilBufferParser.readString(),s=utilBufferParser.readString();if(utilBufferParser.clear(),r===void 0||s===void 0)return;let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeBuffer(r,Ber.Integer),asnWriter.writeBuffer(s,Ber.Integer),asnWriter.endSequence(),asnWriter.buffer}default:return sig}},convertSignature:(signature,keyType)=>{switch(keyType){case"ssh-dss":{if(signature.length<=40)return signature;let asnReader=new Ber.Reader(signature);asnReader.readSequence();let r=asnReader.readString(Ber.Integer,!0),s=asnReader.readString(Ber.Integer,!0),rOffset=0,sOffset=0;if(r.length<20){let rNew=Buffer.allocUnsafe(20);rNew.set(r,1),r=rNew,r[0]=0}if(s.length<20){let sNew=Buffer.allocUnsafe(20);sNew.set(s,1),s=sNew,s[0]=0}if(r.length>20&&r[0]===0)rOffset=1;if(s.length>20&&s[0]===0)sOffset=1;let newSig=Buffer.allocUnsafe(r.length-rOffset+(s.length-sOffset));return bufferCopy(r,newSig,rOffset,r.length,0),bufferCopy(s,newSig,sOffset,s.length,r.length-rOffset),newSig}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{if(signature[0]===0)return signature;let asnReader=new Ber.Reader(signature);asnReader.readSequence();let r=asnReader.readString(Ber.Integer,!0),s=asnReader.readString(Ber.Integer,!0);if(r===null||s===null)return;let newSig=Buffer.allocUnsafe(4+r.length+4+s.length);return writeUInt32BE(newSig,r.length,0),newSig.set(r,4),writeUInt32BE(newSig,s.length,4+r.length),newSig.set(s,8+r.length),newSig}}return signature},sendPacket:(proto,packet,bypass)=>{if(!bypass&&proto._kexinit!==void 0){if(proto._queue===void 0)proto._queue=[];return proto._queue.push(packet),proto._debug&&proto._debug("Outbound: ... packet queued"),!1}return proto._cipher.encrypt(packet),!0}}});var require_sshcrypto=__commonJS((exports,module)=>{module.exports=__require("./sshcrypto-bbzvgpaq.node")});var require_poly1305=__commonJS((exports,module)=>{var __dirname="/home/runner/work/vibe-plugin-tool-ssh/vibe-plugin-tool-ssh/node_modules/ssh2/lib/protocol/crypto",__filename="/home/runner/work/vibe-plugin-tool-ssh/vibe-plugin-tool-ssh/node_modules/ssh2/lib/protocol/crypto/poly1305.js",createPoly1305=function(){var _scriptDir=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;if(typeof __filename<"u")_scriptDir=_scriptDir||__filename;return function(createPoly13052){createPoly13052=createPoly13052||{};var b;b||(b=typeof createPoly13052<"u"?createPoly13052:{});var q,r;b.ready=new Promise(function(a,c){q=a,r=c});var u={},w;for(w in b)b.hasOwnProperty(w)&&(u[w]=b[w]);var x=typeof window==="object",y=typeof importScripts==="function",z=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string",B="",C,D,E,F,G;if(z)B=y?__require("path").dirname(B)+"/":__dirname+"/",C=function(a,c){var d=H(a);if(d)return c?d:d.toString();return F||(F=__require("fs")),G||(G=__require("path")),a=G.normalize(a),F.readFileSync(a,c?null:"utf8")},E=function(a){return a=C(a,!0),a.buffer||(a=new Uint8Array(a)),assert(a.buffer),a},D=function(a,c,d){var e=H(a);e&&c(e),F||(F=__require("fs")),G||(G=__require("path")),a=G.normalize(a),F.readFile(a,function(f,l){f?d(f):c(l.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),b.inspect=function(){return"[Emscripten Module object]"};else if(x||y)y?B=self.location.href:typeof document<"u"&&document.currentScript&&(B=document.currentScript.src),_scriptDir&&(B=_scriptDir),B.indexOf("blob:")!==0?B=B.substr(0,B.lastIndexOf("/")+1):B="",C=function(a){try{var c=new XMLHttpRequest;return c.open("GET",a,!1),c.send(null),c.responseText}catch(f){if(a=H(a)){c=[];for(var d=0;d<a.length;d++){var e=a[d];255<e&&(ba&&assert(!1,"Character code "+e+" ("+String.fromCharCode(e)+") at offset "+d+" not in 0x00-0xFF."),e&=255),c.push(String.fromCharCode(e))}return c.join("")}throw f}},y&&(E=function(a){try{var c=new XMLHttpRequest;return c.open("GET",a,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}catch(d){if(a=H(a))return a;throw d}}),D=function(a,c,d){var e=new XMLHttpRequest;e.open("GET",a,!0),e.responseType="arraybuffer",e.onload=function(){if(e.status==200||e.status==0&&e.response)c(e.response);else{var f=H(a);f?c(f.buffer):d()}},e.onerror=d,e.send(null)};b.print||console.log.bind(console);var I=b.printErr||console.warn.bind(console);for(w in u)u.hasOwnProperty(w)&&(b[w]=u[w]);u=null;var J;b.wasmBinary&&(J=b.wasmBinary);var noExitRuntime=b.noExitRuntime||!0;typeof WebAssembly!=="object"&&K("no native wasm support detected");var L,M=!1;function assert(a,c){a||K("Assertion failed: "+c)}function N(a){var c=b["_"+a];return assert(c,"Cannot call unknown function "+a+", make sure it is exported"),c}function ca(a,c,d,e){var f={string:function(g){var p=0;if(g!==null&&g!==void 0&&g!==0){var n=(g.length<<2)+1;p=O(n);var k=p,h=P;if(0<n){n=k+n-1;for(var v=0;v<g.length;++v){var m=g.charCodeAt(v);if(55296<=m&&57343>=m){var oa=g.charCodeAt(++v);m=65536+((m&1023)<<10)|oa&1023}if(127>=m){if(k>=n)break;h[k++]=m}else{if(2047>=m){if(k+1>=n)break;h[k++]=192|m>>6}else{if(65535>=m){if(k+2>=n)break;h[k++]=224|m>>12}else{if(k+3>=n)break;h[k++]=240|m>>18,h[k++]=128|m>>12&63}h[k++]=128|m>>6&63}h[k++]=128|m&63}}h[k]=0}}return p},array:function(g){var p=O(g.length);return Q.set(g,p),p}},l=N(a),A=[];if(a=0,e)for(var t=0;t<e.length;t++){var aa=f[d[t]];aa?(a===0&&(a=da()),A[t]=aa(e[t])):A[t]=e[t]}return d=l.apply(null,A),d=function(g){if(c==="string")if(g){for(var p=P,n=g+NaN,k=g;p[k]&&!(k>=n);)++k;if(16<k-g&&p.subarray&&ea)g=ea.decode(p.subarray(g,k));else{for(n="";g<k;){var h=p[g++];if(h&128){var v=p[g++]&63;if((h&224)==192)n+=String.fromCharCode((h&31)<<6|v);else{var m=p[g++]&63;h=(h&240)==224?(h&15)<<12|v<<6|m:(h&7)<<18|v<<12|m<<6|p[g++]&63,65536>h?n+=String.fromCharCode(h):(h-=65536,n+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else n+=String.fromCharCode(h)}g=n}}else g="";else g=c==="boolean"?!!g:g;return g}(d),a!==0&&fa(a),d}var ea=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,ha,Q,P;function ia(){var a=L.buffer;ha=a,b.HEAP8=Q=new Int8Array(a),b.HEAP16=new Int16Array(a),b.HEAP32=new Int32Array(a),b.HEAPU8=P=new Uint8Array(a),b.HEAPU16=new Uint16Array(a),b.HEAPU32=new Uint32Array(a),b.HEAPF32=new Float32Array(a),b.HEAPF64=new Float64Array(a)}var R,ja=[],ka=[],la=[];function ma(){var a=b.preRun.shift();ja.unshift(a)}var S=0,T=null,U=null;b.preloadedImages={},b.preloadedAudios={};function K(a){if(b.onAbort)b.onAbort(a);throw I(a),M=!0,a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info."),r(a),a}var V="data:application/octet-stream;base64,",W;if(W="data:application/octet-stream;base64,AGFzbQEAAAABIAZgAX8Bf2ADf39/AGABfwBgAABgAAF/YAZ/f39/f38AAgcBAWEBYQAAAwsKAAEDAQAAAgQFAgQFAXABAQEFBwEBgAKAgAIGCQF/AUGAjMACCwclCQFiAgABYwADAWQACQFlAAgBZgAHAWcABgFoAAUBaQAKAWoBAAqGTQpPAQJ/QYAIKAIAIgEgAEEDakF8cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAEUNAQtBgAggADYCACABDwtBhAhBMDYCAEF/C4wFAg5+Cn8gACgCJCEUIAAoAiAhFSAAKAIcIREgACgCGCESIAAoAhQhEyACQRBPBEAgAC0ATEVBGHQhFyAAKAIEIhZBBWytIQ8gACgCCCIYQQVsrSENIAAoAgwiGUEFbK0hCyAAKAIQIhpBBWytIQkgADUCACEIIBqtIRAgGa0hDiAYrSEMIBatIQoDQCASIAEtAAMiEiABLQAEQQh0ciABLQAFQRB0ciABLQAGIhZBGHRyQQJ2Qf///x9xaq0iAyAOfiABLwAAIAEtAAJBEHR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QcQLQcQLKAIAQQRyNgIACyACQf7///8HSw0BIAIQASEBQQAQASEAIAFBf0YNASAAQX9GDQEgACABTQ0BIAAgAWsiBSAIQShqTQ0BC0G4C0G4CygCACAFaiIANgIAQbwLKAIAIABJBEBBvAsgADYCAAsCQAJAAkBBoAgoAgAiBwRAQcgLIQADQCABIAAoAgAiAyAAKAIEIgJqRg0CIAAoAggiAA0ACwwCC0GYCCgCACIAQQAgACABTRtFBEBBmAggATYCAAtBACEAQcwLIAU2AgBByAsgATYCAEGoCEF/NgIAQawIQeALKAIANgIAQdQLQQA2AgADQCAAQQN0IgNBuAhqIANBsAhqIgI2AgAgA0G8CGogAjYCACAAQQFqIgBBIEcNAAtBlAggBUEoayIDQXggAWtBB3FBACABQQhqQQdxGyIAayICNgIAQaAIIAAgAWoiADYCACAAIAJBAXI2AgQgASADakEoNgIEQaQIQfALKAIANgIADAILIAAtAAxBCHENACADIAdLDQAgASAHTQ0AIAAgAiAFajYCBEGgCCAHQXggB2tBB3FBACAHQQhqQQdxGyIAaiICNgIAQZQIQZQIKAIAIAVqIgEgAGsiADYCACACIABBAXI2AgQgASAHakEoNgIEQaQIQfALKAIANgIADAELQZgIKAIAIAFLBEBBmAggATYCAAsgASAFaiECQcgLIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQcgLIQADQCAHIAAoAgAiAk8EQCACIAAoAgRqIgQgB0sNAwsgACgCCCEADAALAAsgACABNgIAIAAgACgCBCAFajYCBCABQXggAWtBB3FBACABQQhqQQdxG2oiCSAIQQNyNgIEIAJBeCACa0EHcUEAIAJBCGpBB3EbaiIFIAggCWoiBmshAiAFIAdGBEBBoAggBjYCAEGUCEGUCCgCACACaiIANgIAIAYgAEEBcjYCBAwDCyAFQZwIKAIARgRAQZwIIAY2AgBBkAhBkAgoAgAgAmoiADYCACAGIABBAXI2AgQgACAGaiAANgIADAMLIAUoAgQiAEEDcUEBRgRAIABBeHEhBwJAIABB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ICCgCACICQQEgAXQiAXFFBEBBiAggASACcjYCACAADAELIAAoAggLIQIgACADNgIIIAIgAzYCDCADIAA2AgwgAyACNgIIDwtBHyECIANCADcCECAAQf///wdNBEAgAEEIdiIBIAFBgP4/akEQdkEIcSIBdCICIAJBgOAfakEQdkEEcSICdCIEIARBgIAPakEQdkECcSIEdEEPdiABIAJyIARyayIBQQF0IAAgAUEVanZBAXFyQRxqIQILIAMgAjYCHCACQQJ0QbgKaiEBAkACQAJAQYwIKAIAIgRBASACdCIHcUUEQEGMCCAEIAdyNgIAIAEgAzYCACADIAE2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgASgCACEBA0AgASIEKAIEQXhxIABGDQIgAkEddiEBIAJBAXQhAiAEIAFBBHFqIgdBEGooAgAiAQ0ACyAHIAM2AhAgAyAENgIYCyADIAM2AgwgAyADNgIIDAELIAQoAggiACADNgIMIAQgAzYCCCADQQA2AhggAyAENgIMIAMgADYCCAtBqAhBqAgoAgBBAWsiAEF/IAAbNgIACwsLCQEAQYEICwIGUA==",!W.startsWith(V)){var na=W;W=b.locateFile?b.locateFile(na,B):B+na}function pa(){var a=W;try{if(a==W&&J)return new Uint8Array(J);var c=H(a);if(c)return c;if(E)return E(a);throw"both async and sync fetching of the wasm failed"}catch(d){K(d)}}function qa(){if(!J&&(x||y)){if(typeof fetch==="function"&&!W.startsWith("file://"))return fetch(W,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+W+"'";return a.arrayBuffer()}).catch(function(){return pa()});if(D)return new Promise(function(a,c){D(W,function(d){a(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return pa()})}function X(a){for(;0<a.length;){var c=a.shift();if(typeof c=="function")c(b);else{var d=c.m;typeof d==="number"?c.l===void 0?R.get(d)():R.get(d)(c.l):d(c.l===void 0?null:c.l)}}}var ba=!1,ra=typeof atob==="function"?atob:function(a){var c="",d=0;a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++)),A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a.charAt(d++));e=e<<2|f>>4,f=(f&15)<<4|l>>2;var t=(l&3)<<6|A;c+=String.fromCharCode(e),l!==64&&(c+=String.fromCharCode(f)),A!==64&&(c+=String.fromCharCode(t))}while(d<a.length);return c};function H(a){if(a.startsWith(V)){if(a=a.slice(V.length),typeof z==="boolean"&&z){var c=Buffer.from(a,"base64");c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}else try{var d=ra(a),e=new Uint8Array(d.length);for(a=0;a<d.length;++a)e[a]=d.charCodeAt(a);c=e}catch(f){throw Error("Converting base64 string to bytes failed.")}return c}}var sa={a:function(a){var c=P.length;if(a>>>=0,2147483648<a)return!1;for(var d=1;4>=d;d*=2){var e=c*(1+0.2/d);e=Math.min(e,a+100663296),e=Math.max(a,e),0<e%65536&&(e+=65536-e%65536);a:{try{L.grow(Math.min(2147483648,e)-ha.byteLength+65535>>>16),ia();var f=1;break a}catch(l){}f=void 0}if(f)return!0}return!1}};(function(){function a(f){b.asm=f.exports,L=b.asm.b,ia(),R=b.asm.j,ka.unshift(b.asm.c),S--,b.monitorRunDependencies&&b.monitorRunDependencies(S),S==0&&(T!==null&&(clearInterval(T),T=null),U&&(f=U,U=null,f()))}function c(f){a(f.instance)}function d(f){return qa().then(function(l){return WebAssembly.instantiate(l,e)}).then(f,function(l){I("failed to asynchronously prepare wasm: "+l),K(l)})}var e={a:sa};if(S++,b.monitorRunDependencies&&b.monitorRunDependencies(S),b.instantiateWasm)try{return b.instantiateWasm(e,a)}catch(f){return I("Module.instantiateWasm callback failed with error: "+f),!1}return function(){return J||typeof WebAssembly.instantiateStreaming!=="function"||W.startsWith(V)||W.startsWith("file://")||typeof fetch!=="function"?d(c):fetch(W,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(l){return I("wasm streaming compile failed: "+l),I("falling back to ArrayBuffer instantiation"),d(c)})})}().catch(r),{}})(),b.___wasm_call_ctors=function(){return(b.___wasm_call_ctors=b.asm.c).apply(null,arguments)},b._poly1305_auth=function(){return(b._poly1305_auth=b.asm.d).apply(null,arguments)};var da=b.stackSave=function(){return(da=b.stackSave=b.asm.e).apply(null,arguments)},fa=b.stackRestore=function(){return(fa=b.stackRestore=b.asm.f).apply(null,arguments)},O=b.stackAlloc=function(){return(O=b.stackAlloc=b.asm.g).apply(null,arguments)};b._malloc=function(){return(b._malloc=b.asm.h).apply(null,arguments)},b._free=function(){return(b._free=b.asm.i).apply(null,arguments)},b.cwrap=function(a,c,d,e){d=d||[];var f=d.every(function(l){return l==="number"});return c!=="string"&&f&&!e?N(a):function(){return ca(a,c,d,arguments)}};var Y;U=function ta(){Y||Z(),Y||(U=ta)};function Z(){function a(){if(!Y&&(Y=!0,b.calledRun=!0,!M)){if(X(ka),q(b),b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for(typeof b.postRun=="function"&&(b.postRun=[b.postRun]);b.postRun.length;){var c=b.postRun.shift();la.unshift(c)}X(la)}}if(!(0<S)){if(b.preRun)for(typeof b.preRun=="function"&&(b.preRun=[b.preRun]);b.preRun.length;)ma();X(ja),0<S||(b.setStatus?(b.setStatus("Running..."),setTimeout(function(){setTimeout(function(){b.setStatus("")},1),a()},1)):a())}}if(b.run=Z,b.preInit)for(typeof b.preInit=="function"&&(b.preInit=[b.preInit]);0<b.preInit.length;)b.preInit.pop()();return Z(),createPoly13052.ready}}();if(typeof exports==="object"&&typeof module==="object")module.exports=createPoly1305;else if(typeof define==="function"&&define.amd)define([],function(){return createPoly1305});else if(typeof exports==="object")exports.createPoly1305=createPoly1305});var require_crypto=__commonJS((exports,module)=>{var{createCipheriv,createDecipheriv,createHmac,randomFillSync,timingSafeEqual}=__require("crypto"),{readUInt32BE,writeUInt32BE}=require_utils(),FastBuffer=Buffer[Symbol.species],EMPTY_BUFFER=Buffer.alloc(0),BUF_INT=Buffer.alloc(4),DISCARD_CACHE=new Map,binding,AESGCMCipher,ChaChaPolyCipher,GenericCipher,AESGCMDecipher,ChaChaPolyDecipher,GenericDecipher;try{binding=require_sshcrypto(),{AESGCMCipher,ChaChaPolyCipher,GenericCipher,AESGCMDecipher,ChaChaPolyDecipher,GenericDecipher}=binding}catch{}var CIPHER_STREAM=1,CIPHER_INFO=(()=>{function info(sslName,blockLen,keyLen,ivLen,authLen,discardLen,flags){return{sslName,blockLen,keyLen,ivLen:ivLen!==0||flags&CIPHER_STREAM?ivLen:blockLen,authLen,discardLen,stream:!!(flags&CIPHER_STREAM)}}return{"chacha20-poly1305@openssh.com":info("chacha20",8,64,0,16,0,CIPHER_STREAM),"aes128-gcm":info("aes-128-gcm",16,16,12,16,0,CIPHER_STREAM),"aes256-gcm":info("aes-256-gcm",16,32,12,16,0,CIPHER_STREAM),"aes128-gcm@openssh.com":info("aes-128-gcm",16,16,12,16,0,CIPHER_STREAM),"aes256-gcm@openssh.com":info("aes-256-gcm",16,32,12,16,0,CIPHER_STREAM),"aes128-cbc":info("aes-128-cbc",16,16,0,0,0,0),"aes192-cbc":info("aes-192-cbc",16,24,0,0,0,0),"aes256-cbc":info("aes-256-cbc",16,32,0,0,0,0),"rijndael-cbc@lysator.liu.se":info("aes-256-cbc",16,32,0,0,0,0),"3des-cbc":info("des-ede3-cbc",8,24,0,0,0,0),"blowfish-cbc":info("bf-cbc",8,16,0,0,0,0),"idea-cbc":info("idea-cbc",8,16,0,0,0,0),"cast128-cbc":info("cast-cbc",8,16,0,0,0,0),"aes128-ctr":info("aes-128-ctr",16,16,16,0,0,CIPHER_STREAM),"aes192-ctr":info("aes-192-ctr",16,24,16,0,0,CIPHER_STREAM),"aes256-ctr":info("aes-256-ctr",16,32,16,0,0,CIPHER_STREAM),"3des-ctr":info("des-ede3",8,24,8,0,0,CIPHER_STREAM),"blowfish-ctr":info("bf-ecb",8,16,8,0,0,CIPHER_STREAM),"cast128-ctr":info("cast5-ecb",8,16,8,0,0,CIPHER_STREAM),arcfour:info("rc4",8,16,0,0,1536,CIPHER_STREAM),arcfour128:info("rc4",8,16,0,0,1536,CIPHER_STREAM),arcfour256:info("rc4",8,32,0,0,1536,CIPHER_STREAM),arcfour512:info("rc4",8,64,0,0,1536,CIPHER_STREAM)}})(),MAC_INFO=(()=>{function info(sslName,len,actualLen,isETM){return{sslName,len,actualLen,isETM}}return{"hmac-md5":info("md5",16,16,!1),"hmac-md5-96":info("md5",16,12,!1),"hmac-ripemd160":info("ripemd160",20,20,!1),"hmac-sha1":info("sha1",20,20,!1),"hmac-sha1-etm@openssh.com":info("sha1",20,20,!0),"hmac-sha1-96":info("sha1",20,12,!1),"hmac-sha2-256":info("sha256",32,32,!1),"hmac-sha2-256-etm@openssh.com":info("sha256",32,32,!0),"hmac-sha2-256-96":info("sha256",32,12,!1),"hmac-sha2-512":info("sha512",64,64,!1),"hmac-sha2-512-etm@openssh.com":info("sha512",64,64,!0),"hmac-sha2-512-96":info("sha512",64,12,!1)}})();class NullCipher{constructor(seqno,onWrite){this.outSeqno=seqno,this._onWrite=onWrite,this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}var POLY1305_ZEROS=Buffer.alloc(32),POLY1305_OUT_COMPUTE=Buffer.alloc(16),POLY1305_WASM_MODULE,POLY1305_RESULT_MALLOC,poly1305_auth;class ChaChaPolyCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encKeyMain=enc.cipherKey.slice(0,32),this._encKeyPktLen=enc.cipherKey.slice(32),this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen-4&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.outSeqno,12);let polyKey=createCipheriv("chacha20",this._encKeyMain,POLY1305_OUT_COMPUTE).update(POLY1305_ZEROS),pktLenEnc=createCipheriv("chacha20",this._encKeyPktLen,POLY1305_OUT_COMPUTE).update(packet.slice(0,4));this._onWrite(pktLenEnc),POLY1305_OUT_COMPUTE[0]=1;let payloadEnc=createCipheriv("chacha20",this._encKeyMain,POLY1305_OUT_COMPUTE).update(packet.slice(4));this._onWrite(payloadEnc),poly1305_auth(POLY1305_RESULT_MALLOC,pktLenEnc,pktLenEnc.length,payloadEnc,payloadEnc.length,polyKey);let mac=Buffer.allocUnsafe(16);mac.set(new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer,POLY1305_RESULT_MALLOC,16),0),this._onWrite(mac),this.outSeqno=this.outSeqno+1>>>0}}class ChaChaPolyCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._instance=new ChaChaPolyCipher(enc.cipherKey),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=8-(pktLen-4&7);if(padLen<4)padLen+=8;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+16);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._instance.encrypt(packet,this.outSeqno),this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class AESGCMCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encSSLName=enc.cipherInfo.sslName,this._encKey=enc.cipherKey,this._encIV=enc.cipherIV,this._dead=!1}free(){this._dead=!0}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=16-(pktLen-4&15);if(padLen<4)padLen+=16;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;let cipher=createCipheriv(this._encSSLName,this._encKey,this._encIV);cipher.setAutoPadding(!1);let lenData=packet.slice(0,4);cipher.setAAD(lenData),this._onWrite(lenData);let encrypted=cipher.update(packet.slice(4));this._onWrite(encrypted);let final=cipher.final();if(final.length)this._onWrite(final);let tag=cipher.getAuthTag();this._onWrite(tag),ivIncrement(this._encIV),this.outSeqno=this.outSeqno+1>>>0}}class AESGCMCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._instance=new AESGCMCipher(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let pktLen=5+payloadLen,padLen=16-(pktLen-4&15);if(padLen<4)padLen+=16;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+16);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;this._instance.encrypt(packet),this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class GenericCipherNative{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encBlockLen=enc.cipherInfo.blockLen,this._cipherInstance=createCipheriv(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV),this._macSSLName=enc.macInfo.sslName,this._macKey=enc.macKey,this._macActualLen=enc.macInfo.actualLen,this._macETM=enc.macInfo.isETM,this._aadLen=this._macETM?4:0,this._dead=!1;let discardLen=enc.cipherInfo.discardLen;if(discardLen){let discard=DISCARD_CACHE.get(discardLen);if(discard===void 0)discard=Buffer.alloc(discardLen),DISCARD_CACHE.set(discardLen,discard);this._cipherInstance.update(discard)}}free(){this._dead=!0}allocPacket(payloadLen){let blockLen=this._encBlockLen,pktLen=5+payloadLen,padLen=blockLen-(pktLen-this._aadLen&blockLen-1);if(padLen<4)padLen+=blockLen;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;let mac;if(this._macETM){let lenBytes=new Uint8Array(packet.buffer,packet.byteOffset,4),encrypted=this._cipherInstance.update(new Uint8Array(packet.buffer,packet.byteOffset+4,packet.length-4));this._onWrite(lenBytes),this._onWrite(encrypted),mac=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.outSeqno,0),mac.update(BUF_INT),mac.update(lenBytes),mac.update(encrypted)}else{let encrypted=this._cipherInstance.update(packet);this._onWrite(encrypted),mac=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.outSeqno,0),mac.update(BUF_INT),mac.update(packet)}let digest=mac.digest();if(digest.length>this._macActualLen)digest=digest.slice(0,this._macActualLen);this._onWrite(digest),this.outSeqno=this.outSeqno+1>>>0}}class GenericCipherBinding{constructor(config){let enc=config.outbound;this.outSeqno=enc.seqno,this._onWrite=enc.onWrite,this._encBlockLen=enc.cipherInfo.blockLen,this._macLen=enc.macInfo.len,this._macActualLen=enc.macInfo.actualLen,this._aadLen=enc.macInfo.isETM?4:0,this._instance=new GenericCipher(enc.cipherInfo.sslName,enc.cipherKey,enc.cipherIV,enc.macInfo.sslName,enc.macKey,enc.macInfo.isETM),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(payloadLen){let blockLen=this._encBlockLen,pktLen=5+payloadLen,padLen=blockLen-(pktLen-this._aadLen&blockLen-1);if(padLen<4)padLen+=blockLen;pktLen+=padLen;let packet=Buffer.allocUnsafe(pktLen+this._macLen);return writeUInt32BE(packet,pktLen-4,0),packet[4]=padLen,randomFillSync(packet,5+payloadLen,padLen),packet}encrypt(packet){if(this._dead)return;if(this._instance.encrypt(packet,this.outSeqno),this._macActualLen<this._macLen)packet=new FastBuffer(packet.buffer,packet.byteOffset,packet.length-(this._macLen-this._macActualLen));this._onWrite(packet),this.outSeqno=this.outSeqno+1>>>0}}class NullDecipher{constructor(seqno,onPayload){this.inSeqno=seqno,this._onPayload=onPayload,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len>35000||this._len<8||(4+this._len&7)!==0)throw Error("Bad packet length");if(p>=dataLen)return}if(this._packetPos<this._len){let nb=Math.min(this._len-this._packetPos,dataLen-p),chunk;if(p!==0||nb!==dataLen)chunk=new Uint8Array(data.buffer,data.byteOffset+p,nb);else chunk=data;if(nb===this._len)this._packet=chunk;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(chunk,this._packetPos)}if(p+=nb,this._packetPos+=nb,this._packetPos<this._len)return}let payload=!this._packet?EMPTY_BUFFER:new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class ChaChaPolyDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decKeyMain=dec.decipherKey.slice(0,32),this._decKeyPktLen=dec.decipherKey.slice(32),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._calcMac=Buffer.allocUnsafe(16),this._macPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenPos<4){let nb=Math.min(4-this._lenPos,dataLen-p);while(nb--)this._lenBuf[this._lenPos++]=data[p++];if(this._lenPos<4)return;POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.inSeqno,12);let decLenBytes=createDecipheriv("chacha20",this._decKeyPktLen,POLY1305_OUT_COMPUTE).update(this._lenBuf);if(this._len=readUInt32BE(decLenBytes,0),this._len>35000||this._len<8||(this._len&7)!==0)throw Error("Bad packet length")}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<16)return}POLY1305_OUT_COMPUTE[0]=0,writeUInt32BE(POLY1305_OUT_COMPUTE,this.inSeqno,12);let polyKey=createCipheriv("chacha20",this._decKeyMain,POLY1305_OUT_COMPUTE).update(POLY1305_ZEROS);if(poly1305_auth(POLY1305_RESULT_MALLOC,this._lenBuf,4,this._packet,this._packet.length,polyKey),this._calcMac.set(new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer,POLY1305_RESULT_MALLOC,16),0),!timingSafeEqual(this._calcMac,this._mac))throw Error("Invalid MAC");POLY1305_OUT_COMPUTE[0]=1;let packet=createDecipheriv("chacha20",this._decKeyMain,POLY1305_OUT_COMPUTE).update(this._packet),payload=new FastBuffer(packet.buffer,packet.byteOffset+1,packet.length-packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class ChaChaPolyDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new ChaChaPolyDecipher(dec.decipherKey),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._macPos=0}free(){this._instance.free()}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenPos<4){let nb=Math.min(4-this._lenPos,dataLen-p);while(nb--)this._lenBuf[this._lenPos++]=data[p++];if(this._lenPos<4)return;if(this._len=this._instance.decryptLen(this._lenBuf,this.inSeqno),this._len>35000||this._len<8||(this._len&7)!==0)throw Error("Bad packet length");if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<16)return}this._instance.decrypt(this._packet,this._mac,this.inSeqno);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class AESGCMDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decipherInstance=null,this._decipherSSLName=dec.decipherInfo.sslName,this._decipherKey=dec.decipherKey,this._decipherIV=dec.decipherIV,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw Error("Bad packet length");this._decipherInstance=createDecipheriv(this._decipherSSLName,this._decipherKey,this._decipherIV),this._decipherInstance.setAutoPadding(!1),this._decipherInstance.setAAD(intToBytes(this._len))}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),decrypted;if(p!==0||nb!==dataLen)decrypted=this._decipherInstance.update(new Uint8Array(data.buffer,data.byteOffset+p,nb));else decrypted=this._decipherInstance.update(data);if(decrypted.length){if(nb===this._len)this._packet=decrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(decrypted,this._packetPos)}this._packetPos+=decrypted.length}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._tagPos,dataLen-p);if(p!==0||nb!==dataLen)this._tag.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._tagPos);else this._tag.set(data,this._tagPos);if(p+=nb,this._tagPos+=nb,this._tagPos<16)return}{this._decipherInstance.setAuthTag(this._tag);let decrypted=this._decipherInstance.final();if(decrypted.length)if(this._packet)this._packet.set(decrypted,this._packetPos);else this._packet=decrypted}let payload=!this._packet?EMPTY_BUFFER:new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,ivIncrement(this._decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tagPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class AESGCMDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new AESGCMDecipher(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._lenBytes<4){let nb=Math.min(4-this._lenBytes,dataLen-p);this._lenBytes+=nb;while(nb--)this._len=(this._len<<8)+data[p++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw Error(`Bad packet length: ${this._len}`)}if(this._pktLen<this._len){if(p>=dataLen)return;let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(16-this._tagPos,dataLen-p);if(p!==0||nb!==dataLen)this._tag.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._tagPos);else this._tag.set(data,this._tagPos);if(p+=nb,this._tagPos+=nb,this._tagPos<16)return}this._instance.decrypt(this._packet,this._len,this._tag);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tagPos=0;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class GenericDecipherNative{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._decipherInstance=createDecipheriv(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV),this._decipherInstance.setAutoPadding(!1),this._block=Buffer.allocUnsafe(dec.macInfo.isETM?4:dec.decipherInfo.blockLen),this._blockSize=dec.decipherInfo.blockLen,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._mac=Buffer.allocUnsafe(dec.macInfo.actualLen),this._macPos=0,this._macSSLName=dec.macInfo.sslName,this._macKey=dec.macKey,this._macActualLen=dec.macInfo.actualLen,this._macETM=dec.macInfo.isETM,this._macInstance=null;let discardLen=dec.decipherInfo.discardLen;if(discardLen){let discard=DISCARD_CACHE.get(discardLen);if(discard===void 0)discard=Buffer.alloc(discardLen),DISCARD_CACHE.set(discardLen,discard);this._decipherInstance.update(discard)}}free(){}decrypt(data,p,dataLen){while(p<dataLen){if(this._blockPos<this._block.length){let nb=Math.min(this._block.length-this._blockPos,dataLen-p);if(p!==0||nb!==dataLen||nb<data.length)this._block.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._blockPos);else this._block.set(data,this._blockPos);if(p+=nb,this._blockPos+=nb,this._blockPos<this._block.length)return;let decrypted,need;if(this._macETM)this._len=need=readUInt32BE(this._block,0);else decrypted=this._decipherInstance.update(this._block),this._len=readUInt32BE(decrypted,0),need=4+this._len-this._blockSize;if(this._len>35000||this._len<5||(need&this._blockSize-1)!==0)throw Error("Bad packet length");if(this._macInstance=createHmac(this._macSSLName,this._macKey),writeUInt32BE(BUF_INT,this.inSeqno,0),this._macInstance.update(BUF_INT),this._macETM)this._macInstance.update(this._block);else this._macInstance.update(new Uint8Array(decrypted.buffer,decrypted.byteOffset,4)),this._pktLen=decrypted.length-4,this._packetPos=this._pktLen,this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(decrypted.buffer,decrypted.byteOffset+4,this._packetPos),0);if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(this._macETM)this._macInstance.update(encrypted);let decrypted=this._decipherInstance.update(encrypted);if(decrypted.length){if(nb===this._len)this._packet=decrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(decrypted,this._packetPos)}this._packetPos+=decrypted.length}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(this._macActualLen-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<this._macActualLen)return}if(!this._macETM)this._macInstance.update(this._packet);let calculated=this._macInstance.digest();if(this._macActualLen<calculated.length)calculated=new Uint8Array(calculated.buffer,calculated.byteOffset,this._macActualLen);if(!timingSafeEquals(calculated,this._mac))throw Error("Invalid MAC");let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._macPos=0,this._macInstance=null;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}class GenericDecipherBinding{constructor(config){let dec=config.inbound;this.inSeqno=dec.seqno,this._onPayload=dec.onPayload,this._instance=new GenericDecipher(dec.decipherInfo.sslName,dec.decipherKey,dec.decipherIV,dec.macInfo.sslName,dec.macKey,dec.macInfo.isETM,dec.macInfo.actualLen),this._block=Buffer.allocUnsafe(dec.macInfo.isETM||dec.decipherInfo.stream?4:dec.decipherInfo.blockLen),this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(dec.macInfo.actualLen),this._macPos=0,this._macActualLen=dec.macInfo.actualLen,this._macETM=dec.macInfo.isETM}free(){this._instance.free()}decrypt(data,p,dataLen){while(p<dataLen){if(this._blockPos<this._block.length){let nb=Math.min(this._block.length-this._blockPos,dataLen-p);if(p!==0||nb!==dataLen||nb<data.length)this._block.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._blockPos);else this._block.set(data,this._blockPos);if(p+=nb,this._blockPos+=nb,this._blockPos<this._block.length)return;let need;if(this._macETM)this._len=need=readUInt32BE(this._block,0);else this._instance.decryptBlock(this._block),this._len=readUInt32BE(this._block,0),need=4+this._len-this._block.length;if(this._len>35000||this._len<5||(need&this._block.length-1)!==0)throw Error("Bad packet length");if(!this._macETM){if(this._pktLen=this._block.length-4,this._pktLen)this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(this._block.buffer,this._block.byteOffset+4,this._pktLen),0)}if(p>=dataLen)return}if(this._pktLen<this._len){let nb=Math.min(this._len-this._pktLen,dataLen-p),encrypted;if(p!==0||nb!==dataLen)encrypted=new Uint8Array(data.buffer,data.byteOffset+p,nb);else encrypted=data;if(nb===this._len)this._packet=encrypted;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(encrypted,this._pktLen)}if(p+=nb,this._pktLen+=nb,this._pktLen<this._len||p>=dataLen)return}{let nb=Math.min(this._macActualLen-this._macPos,dataLen-p);if(p!==0||nb!==dataLen)this._mac.set(new Uint8Array(data.buffer,data.byteOffset+p,nb),this._macPos);else this._mac.set(data,this._macPos);if(p+=nb,this._macPos+=nb,this._macPos<this._macActualLen)return}this._instance.decrypt(this._packet,this.inSeqno,this._block,this._mac);let payload=new FastBuffer(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._macPos=0,this._macInstance=null;{let ret=this._onPayload(payload);if(ret!==void 0)return ret===!1?p:ret}}}}function ivIncrement(iv){++iv[11]>>>8&&++iv[10]>>>8&&++iv[9]>>>8&&++iv[8]>>>8&&++iv[7]>>>8&&++iv[6]>>>8&&++iv[5]>>>8&&++iv[4]>>>8}var intToBytes=(()=>{let ret=Buffer.alloc(4);return(n)=>{return ret[0]=n>>>24,ret[1]=n>>>16,ret[2]=n>>>8,ret[3]=n,ret}})();function timingSafeEquals(a,b){if(a.length!==b.length)return timingSafeEqual(a,a),!1;return timingSafeEqual(a,b)}function createCipher(config){if(typeof config!=="object"||config===null)throw Error("Invalid config");if(typeof config.outbound!=="object"||config.outbound===null)throw Error("Invalid outbound");let outbound=config.outbound;if(typeof outbound.onWrite!=="function")throw Error("Invalid outbound.onWrite");if(typeof outbound.cipherInfo!=="object"||outbound.cipherInfo===null)throw Error("Invalid outbound.cipherInfo");if(!Buffer.isBuffer(outbound.cipherKey)||outbound.cipherKey.length!==outbound.cipherInfo.keyLen)throw Error("Invalid outbound.cipherKey");if(outbound.cipherInfo.ivLen&&(!Buffer.isBuffer(outbound.cipherIV)||outbound.cipherIV.length!==outbound.cipherInfo.ivLen))throw Error("Invalid outbound.cipherIV");if(typeof outbound.seqno!=="number"||outbound.seqno<0||outbound.seqno>4294967295)throw Error("Invalid outbound.seqno");let forceNative=!!outbound.forceNative;switch(outbound.cipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return AESGCMCipher&&!forceNative?new AESGCMCipherBinding(config):new AESGCMCipherNative(config);case"chacha20":return ChaChaPolyCipher&&!forceNative?new ChaChaPolyCipherBinding(config):new ChaChaPolyCipherNative(config);default:{if(typeof outbound.macInfo!=="object"||outbound.macInfo===null)throw Error("Invalid outbound.macInfo");if(!Buffer.isBuffer(outbound.macKey)||outbound.macKey.length!==outbound.macInfo.len)throw Error("Invalid outbound.macKey");return GenericCipher&&!forceNative?new GenericCipherBinding(config):new GenericCipherNative(config)}}}function createDecipher(config){if(typeof config!=="object"||config===null)throw Error("Invalid config");if(typeof config.inbound!=="object"||config.inbound===null)throw Error("Invalid inbound");let inbound=config.inbound;if(typeof inbound.onPayload!=="function")throw Error("Invalid inbound.onPayload");if(typeof inbound.decipherInfo!=="object"||inbound.decipherInfo===null)throw Error("Invalid inbound.decipherInfo");if(!Buffer.isBuffer(inbound.decipherKey)||inbound.decipherKey.length!==inbound.decipherInfo.keyLen)throw Error("Invalid inbound.decipherKey");if(inbound.decipherInfo.ivLen&&(!Buffer.isBuffer(inbound.decipherIV)||inbound.decipherIV.length!==inbound.decipherInfo.ivLen))throw Error("Invalid inbound.decipherIV");if(typeof inbound.seqno!=="number"||inbound.seqno<0||inbound.seqno>4294967295)throw Error("Invalid inbound.seqno");let forceNative=!!inbound.forceNative;switch(inbound.decipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return AESGCMDecipher&&!forceNative?new AESGCMDecipherBinding(config):new AESGCMDecipherNative(config);case"chacha20":return ChaChaPolyDecipher&&!forceNative?new ChaChaPolyDecipherBinding(config):new ChaChaPolyDecipherNative(config);default:{if(typeof inbound.macInfo!=="object"||inbound.macInfo===null)throw Error("Invalid inbound.macInfo");if(!Buffer.isBuffer(inbound.macKey)||inbound.macKey.length!==inbound.macInfo.len)throw Error("Invalid inbound.macKey");return GenericDecipher&&!forceNative?new GenericDecipherBinding(config):new GenericDecipherNative(config)}}}module.exports={CIPHER_INFO,MAC_INFO,bindingAvailable:!!binding,init:(()=>{return new Promise(async(resolve,reject)=>{try{POLY1305_WASM_MODULE=await require_poly1305()(),POLY1305_RESULT_MALLOC=POLY1305_WASM_MODULE._malloc(16),poly1305_auth=POLY1305_WASM_MODULE.cwrap("poly1305_auth",null,["number","array","number","array","number","array"])}catch(ex){return reject(ex)}resolve()})})(),NullCipher,createCipher,NullDecipher,createDecipher}});var require_keyParser=__commonJS((exports,module)=>{var{createDecipheriv,createECDH,createHash,createHmac,createSign,createVerify,getCiphers,sign:sign_,verify:verify_}=__require("crypto"),supportedOpenSSLCiphers=getCiphers(),{Ber}=require_lib(),bcrypt_pbkdf=require_bcrypt_pbkdf().pbkdf,{CIPHER_INFO}=require_crypto(),{eddsaSupported,SUPPORTED_CIPHER}=require_constants(),{bufferSlice,makeBufferParser,readString,readUInt32BE,writeUInt32BE}=require_utils(),SYM_HASH_ALGO=Symbol("Hash Algorithm"),SYM_PRIV_PEM=Symbol("Private key PEM"),SYM_PUB_PEM=Symbol("Public key PEM"),SYM_PUB_SSH=Symbol("Public key SSH"),SYM_DECRYPTED=Symbol("Decrypted Key"),CIPHER_INFO_OPENSSL=Object.create(null);{let keys=Object.keys(CIPHER_INFO);for(let i=0;i<keys.length;++i){let cipherName=CIPHER_INFO[keys[i]].sslName;if(!cipherName||CIPHER_INFO_OPENSSL[cipherName])continue;CIPHER_INFO_OPENSSL[cipherName]=CIPHER_INFO[keys[i]]}}var binaryKeyParser=makeBufferParser();function makePEM(type,data){data=data.base64Slice(0,data.length);let formatted=data.replace(/.{64}/g,`$&
5
5
  `);if(data.length&63)formatted+=`
6
6
  `;return`-----BEGIN ${type} KEY-----
7
7
  ${formatted}-----END ${type} KEY-----`}function combineBuffers(buf1,buf2){let result=Buffer.allocUnsafe(buf1.length+buf2.length);return result.set(buf1,0),result.set(buf2,buf1.length),result}function skipFields(buf,nfields){let bufLen=buf.length,pos=buf._pos||0;for(let i=0;i<nfields;++i){let left=bufLen-pos;if(pos>=bufLen||left<4)return!1;let len=readUInt32BE(buf,pos);if(left<4+len)return!1;pos+=4+len}return buf._pos=pos,!0}function genOpenSSLRSAPub(n,e){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.startSequence(),asnWriter.writeOID("1.2.840.113549.1.1.1"),asnWriter.writeNull(),asnWriter.endSequence(),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter.startSequence(),asnWriter.writeBuffer(n,Ber.Integer),asnWriter.writeBuffer(e,Ber.Integer),asnWriter.endSequence(),asnWriter.endSequence(),asnWriter.endSequence(),makePEM("PUBLIC",asnWriter.buffer)}function genOpenSSHRSAPub(n,e){let publicKey=Buffer.allocUnsafe(15+e.length+4+n.length);writeUInt32BE(publicKey,7,0),publicKey.utf8Write("ssh-rsa",4,7);let i=11;return writeUInt32BE(publicKey,e.length,i),publicKey.set(e,i+=4),writeUInt32BE(publicKey,n.length,i+=e.length),publicKey.set(n,i+4),publicKey}var genOpenSSLRSAPriv=(()=>{function genRSAASN1Buf(n,e,d,p,q,dmp1,dmq1,iqmp){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeInt(0,Ber.Integer),asnWriter.writeBuffer(n,Ber.Integer),asnWriter.writeBuffer(e,Ber.Integer),asnWriter.writeBuffer(d,Ber.Integer),asnWriter.writeBuffer(p,Ber.Integer),asnWriter.writeBuffer(q,Ber.Integer),asnWriter.writeBuffer(dmp1,Ber.Integer),asnWriter.writeBuffer(dmq1,Ber.Integer),asnWriter.writeBuffer(iqmp,Ber.Integer),asnWriter.endSequence(),asnWriter.buffer}function bigIntFromBuffer(buf){return BigInt(`0x${buf.hexSlice(0,buf.length)}`)}function bigIntToBuffer(bn){let hex=bn.toString(16);if((hex.length&1)!==0)hex=`0${hex}`;else{let sigbit=hex.charCodeAt(0);if(sigbit===56||sigbit===57||sigbit>=97&&sigbit<=102)hex=`00${hex}`}return Buffer.from(hex,"hex")}return function(n,e,d,iqmp,p,q){let bn_d=bigIntFromBuffer(d),dmp1=bigIntToBuffer(bn_d%(bigIntFromBuffer(p)-1n)),dmq1=bigIntToBuffer(bn_d%(bigIntFromBuffer(q)-1n));return makePEM("RSA PRIVATE",genRSAASN1Buf(n,e,d,p,q,dmp1,dmq1,iqmp))}})();function genOpenSSLDSAPub(p,q,g,y){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.startSequence(),asnWriter.writeOID("1.2.840.10040.4.1"),asnWriter.startSequence(),asnWriter.writeBuffer(p,Ber.Integer),asnWriter.writeBuffer(q,Ber.Integer),asnWriter.writeBuffer(g,Ber.Integer),asnWriter.endSequence(),asnWriter.endSequence(),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter.writeBuffer(y,Ber.Integer),asnWriter.endSequence(),asnWriter.endSequence(),makePEM("PUBLIC",asnWriter.buffer)}function genOpenSSHDSAPub(p,q,g,y){let publicKey=Buffer.allocUnsafe(15+p.length+4+q.length+4+g.length+4+y.length);writeUInt32BE(publicKey,7,0),publicKey.utf8Write("ssh-dss",4,7);let i=11;return writeUInt32BE(publicKey,p.length,i),publicKey.set(p,i+=4),writeUInt32BE(publicKey,q.length,i+=p.length),publicKey.set(q,i+=4),writeUInt32BE(publicKey,g.length,i+=q.length),publicKey.set(g,i+=4),writeUInt32BE(publicKey,y.length,i+=g.length),publicKey.set(y,i+4),publicKey}function genOpenSSLDSAPriv(p,q,g,y,x){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeInt(0,Ber.Integer),asnWriter.writeBuffer(p,Ber.Integer),asnWriter.writeBuffer(q,Ber.Integer),asnWriter.writeBuffer(g,Ber.Integer),asnWriter.writeBuffer(y,Ber.Integer),asnWriter.writeBuffer(x,Ber.Integer),asnWriter.endSequence(),makePEM("DSA PRIVATE",asnWriter.buffer)}function genOpenSSLEdPub(pub){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.startSequence(),asnWriter.writeOID("1.3.101.112"),asnWriter.endSequence(),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter._ensure(pub.length),asnWriter._buf.set(pub,asnWriter._offset),asnWriter._offset+=pub.length,asnWriter.endSequence(),asnWriter.endSequence(),makePEM("PUBLIC",asnWriter.buffer)}function genOpenSSHEdPub(pub){let publicKey=Buffer.allocUnsafe(19+pub.length);return writeUInt32BE(publicKey,11,0),publicKey.utf8Write("ssh-ed25519",4,11),writeUInt32BE(publicKey,pub.length,15),publicKey.set(pub,19),publicKey}function genOpenSSLEdPriv(priv){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeInt(0,Ber.Integer),asnWriter.startSequence(),asnWriter.writeOID("1.3.101.112"),asnWriter.endSequence(),asnWriter.startSequence(Ber.OctetString),asnWriter.writeBuffer(priv,Ber.OctetString),asnWriter.endSequence(),asnWriter.endSequence(),makePEM("PRIVATE",asnWriter.buffer)}function genOpenSSLECDSAPub(oid,Q){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.startSequence(),asnWriter.writeOID("1.2.840.10045.2.1"),asnWriter.writeOID(oid),asnWriter.endSequence(),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter._ensure(Q.length),asnWriter._buf.set(Q,asnWriter._offset),asnWriter._offset+=Q.length,asnWriter.endSequence(),asnWriter.endSequence(),makePEM("PUBLIC",asnWriter.buffer)}function genOpenSSHECDSAPub(oid,Q){let curveName;switch(oid){case"1.2.840.10045.3.1.7":curveName="nistp256";break;case"1.3.132.0.34":curveName="nistp384";break;case"1.3.132.0.35":curveName="nistp521";break;default:return}let publicKey=Buffer.allocUnsafe(39+Q.length);return writeUInt32BE(publicKey,19,0),publicKey.utf8Write(`ecdsa-sha2-${curveName}`,4,19),writeUInt32BE(publicKey,8,23),publicKey.utf8Write(curveName,27,8),writeUInt32BE(publicKey,Q.length,35),publicKey.set(Q,39),publicKey}function genOpenSSLECDSAPriv(oid,pub,priv){let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.writeInt(1,Ber.Integer),asnWriter.writeBuffer(priv,Ber.OctetString),asnWriter.startSequence(160),asnWriter.writeOID(oid),asnWriter.endSequence(),asnWriter.startSequence(161),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter._ensure(pub.length),asnWriter._buf.set(pub,asnWriter._offset),asnWriter._offset+=pub.length,asnWriter.endSequence(),asnWriter.endSequence(),asnWriter.endSequence(),makePEM("EC PRIVATE",asnWriter.buffer)}function genOpenSSLECDSAPubFromPriv(curveName,priv){let tempECDH=createECDH(curveName);return tempECDH.setPrivateKey(priv),tempECDH.getPublicKey()}var BaseKey={sign:(()=>{if(typeof sign_==="function")return function(data,algo){let pem=this[SYM_PRIV_PEM];if(pem===null)return Error("No private key available");if(!algo||typeof algo!=="string")algo=this[SYM_HASH_ALGO];try{return sign_(algo,data,pem)}catch(ex){return ex}};return function(data,algo){let pem=this[SYM_PRIV_PEM];if(pem===null)return Error("No private key available");if(!algo||typeof algo!=="string")algo=this[SYM_HASH_ALGO];let signature=createSign(algo);signature.update(data);try{return signature.sign(pem)}catch(ex){return ex}}})(),verify:(()=>{if(typeof verify_==="function")return function(data,signature,algo){let pem=this[SYM_PUB_PEM];if(pem===null)return Error("No public key available");if(!algo||typeof algo!=="string")algo=this[SYM_HASH_ALGO];try{return verify_(algo,data,pem,signature)}catch(ex){return ex}};return function(data,signature,algo){let pem=this[SYM_PUB_PEM];if(pem===null)return Error("No public key available");if(!algo||typeof algo!=="string")algo=this[SYM_HASH_ALGO];let verifier=createVerify(algo);verifier.update(data);try{return verifier.verify(pem,signature)}catch(ex){return ex}}})(),isPrivateKey:function(){return this[SYM_PRIV_PEM]!==null},getPrivatePEM:function(){return this[SYM_PRIV_PEM]},getPublicPEM:function(){return this[SYM_PUB_PEM]},getPublicSSH:function(){return this[SYM_PUB_SSH]},equals:function(key){let parsed=parseKey(key);if(parsed instanceof Error)return!1;return this.type===parsed.type&&this[SYM_PRIV_PEM]===parsed[SYM_PRIV_PEM]&&this[SYM_PUB_PEM]===parsed[SYM_PUB_PEM]&&this[SYM_PUB_SSH].equals(parsed[SYM_PUB_SSH])}};function OpenSSH_Private(type,comment,privPEM,pubPEM,pubSSH,algo,decrypted){this.type=type,this.comment=comment,this[SYM_PRIV_PEM]=privPEM,this[SYM_PUB_PEM]=pubPEM,this[SYM_PUB_SSH]=pubSSH,this[SYM_HASH_ALGO]=algo,this[SYM_DECRYPTED]=decrypted}OpenSSH_Private.prototype=BaseKey;{let parseOpenSSHPrivKeys=function(data,nkeys,decrypted){let keys=[];if(data.length<8)return Error("Malformed OpenSSH private key");let check1=readUInt32BE(data,0),check2=readUInt32BE(data,4);if(check1!==check2){if(decrypted)return Error("OpenSSH key integrity check failed -- bad passphrase?");return Error("OpenSSH key integrity check failed")}data._pos=8;let i,oid;for(i=0;i<nkeys;++i){let algo,privPEM,pubPEM,pubSSH,type=readString(data,data._pos,!0);if(type===void 0)return Error("Malformed OpenSSH private key");switch(type){case"ssh-rsa":{let n=readString(data,data._pos);if(n===void 0)return Error("Malformed OpenSSH private key");let e=readString(data,data._pos);if(e===void 0)return Error("Malformed OpenSSH private key");let d=readString(data,data._pos);if(d===void 0)return Error("Malformed OpenSSH private key");let iqmp=readString(data,data._pos);if(iqmp===void 0)return Error("Malformed OpenSSH private key");let p=readString(data,data._pos);if(p===void 0)return Error("Malformed OpenSSH private key");let q=readString(data,data._pos);if(q===void 0)return Error("Malformed OpenSSH private key");pubPEM=genOpenSSLRSAPub(n,e),pubSSH=genOpenSSHRSAPub(n,e),privPEM=genOpenSSLRSAPriv(n,e,d,iqmp,p,q),algo="sha1";break}case"ssh-dss":{let p=readString(data,data._pos);if(p===void 0)return Error("Malformed OpenSSH private key");let q=readString(data,data._pos);if(q===void 0)return Error("Malformed OpenSSH private key");let g=readString(data,data._pos);if(g===void 0)return Error("Malformed OpenSSH private key");let y=readString(data,data._pos);if(y===void 0)return Error("Malformed OpenSSH private key");let x=readString(data,data._pos);if(x===void 0)return Error("Malformed OpenSSH private key");pubPEM=genOpenSSLDSAPub(p,q,g,y),pubSSH=genOpenSSHDSAPub(p,q,g,y),privPEM=genOpenSSLDSAPriv(p,q,g,y,x),algo="sha1";break}case"ssh-ed25519":{if(!eddsaSupported)return Error(`Unsupported OpenSSH private key type: ${type}`);let edpub=readString(data,data._pos);if(edpub===void 0||edpub.length!==32)return Error("Malformed OpenSSH private key");let edpriv=readString(data,data._pos);if(edpriv===void 0||edpriv.length!==64)return Error("Malformed OpenSSH private key");pubPEM=genOpenSSLEdPub(edpub),pubSSH=genOpenSSHEdPub(edpub),privPEM=genOpenSSLEdPriv(bufferSlice(edpriv,0,32)),algo=null;break}case"ecdsa-sha2-nistp256":algo="sha256",oid="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":if(algo===void 0)algo="sha384",oid="1.3.132.0.34";case"ecdsa-sha2-nistp521":{if(algo===void 0)algo="sha512",oid="1.3.132.0.35";if(!skipFields(data,1))return Error("Malformed OpenSSH private key");let ecpub=readString(data,data._pos);if(ecpub===void 0)return Error("Malformed OpenSSH private key");let ecpriv=readString(data,data._pos);if(ecpriv===void 0)return Error("Malformed OpenSSH private key");pubPEM=genOpenSSLECDSAPub(oid,ecpub),pubSSH=genOpenSSHECDSAPub(oid,ecpub),privPEM=genOpenSSLECDSAPriv(oid,ecpub,ecpriv);break}default:return Error(`Unsupported OpenSSH private key type: ${type}`)}let privComment=readString(data,data._pos,!0);if(privComment===void 0)return Error("Malformed OpenSSH private key");keys.push(new OpenSSH_Private(type,privComment,privPEM,pubPEM,pubSSH,algo,decrypted))}let cnt=0;for(i=data._pos;i<data.length;++i)if(data[i]!==++cnt%255)return Error("Malformed OpenSSH private key");return keys},regexp=/^-----BEGIN OPENSSH PRIVATE KEY-----(?:\r\n|\n)([\s\S]+)(?:\r\n|\n)-----END OPENSSH PRIVATE KEY-----$/;OpenSSH_Private.parse=(str,passphrase)=>{let m=regexp.exec(str);if(m===null)return null;let ret,data=Buffer.from(m[1],"base64");if(data.length<31)return Error("Malformed OpenSSH private key");let magic=data.utf8Slice(0,15);if(magic!=="openssh-key-v1\x00")return Error(`Unsupported OpenSSH key magic: ${magic}`);let cipherName=readString(data,15,!0);if(cipherName===void 0)return Error("Malformed OpenSSH private key");if(cipherName!=="none"&&SUPPORTED_CIPHER.indexOf(cipherName)===-1)return Error(`Unsupported cipher for OpenSSH key: ${cipherName}`);let kdfName=readString(data,data._pos,!0);if(kdfName===void 0)return Error("Malformed OpenSSH private key");if(kdfName!=="none"){if(cipherName==="none")return Error("Malformed OpenSSH private key");if(kdfName!=="bcrypt")return Error(`Unsupported kdf name for OpenSSH key: ${kdfName}`);if(!passphrase)return Error("Encrypted private OpenSSH key detected, but no passphrase given")}else if(cipherName!=="none")return Error("Malformed OpenSSH private key");let encInfo,cipherKey,cipherIV;if(cipherName!=="none")encInfo=CIPHER_INFO[cipherName];let kdfOptions=readString(data,data._pos);if(kdfOptions===void 0)return Error("Malformed OpenSSH private key");if(kdfOptions.length)switch(kdfName){case"none":return Error("Malformed OpenSSH private key");case"bcrypt":{let salt=readString(kdfOptions,0);if(salt===void 0||kdfOptions._pos+4>kdfOptions.length)return Error("Malformed OpenSSH private key");let rounds=readUInt32BE(kdfOptions,kdfOptions._pos),gen=Buffer.allocUnsafe(encInfo.keyLen+encInfo.ivLen);if(bcrypt_pbkdf(passphrase,passphrase.length,salt,salt.length,gen,gen.length,rounds)!==0)return Error("Failed to generate information to decrypt key");cipherKey=bufferSlice(gen,0,encInfo.keyLen),cipherIV=bufferSlice(gen,encInfo.keyLen,gen.length);break}}else if(kdfName!=="none")return Error("Malformed OpenSSH private key");if(data._pos+3>=data.length)return Error("Malformed OpenSSH private key");let keyCount=readUInt32BE(data,data._pos);if(data._pos+=4,keyCount>0){for(let i=0;i<keyCount;++i){let pubData=readString(data,data._pos);if(pubData===void 0)return Error("Malformed OpenSSH private key");if(readString(pubData,0,!0)===void 0)return Error("Malformed OpenSSH private key")}let privBlob=readString(data,data._pos);if(privBlob===void 0)return Error("Malformed OpenSSH private key");if(cipherKey!==void 0){if(privBlob.length<encInfo.blockLen||privBlob.length%encInfo.blockLen!==0)return Error("Malformed OpenSSH private key");try{let options={authTagLength:encInfo.authLen},decipher=createDecipheriv(encInfo.sslName,cipherKey,cipherIV,options);if(decipher.setAutoPadding(!1),encInfo.authLen>0){if(data.length-data._pos<encInfo.authLen)return Error("Malformed OpenSSH private key");decipher.setAuthTag(bufferSlice(data,data._pos,data._pos+=encInfo.authLen))}privBlob=combineBuffers(decipher.update(privBlob),decipher.final())}catch(ex){return ex}}if(data._pos!==data.length)return Error("Malformed OpenSSH private key");ret=parseOpenSSHPrivKeys(privBlob,keyCount,cipherKey!==void 0)}else ret=[];if(ret instanceof Error)return ret;return ret[0]}}function OpenSSH_Old_Private(type,comment,privPEM,pubPEM,pubSSH,algo,decrypted){this.type=type,this.comment=comment,this[SYM_PRIV_PEM]=privPEM,this[SYM_PUB_PEM]=pubPEM,this[SYM_PUB_SSH]=pubSSH,this[SYM_HASH_ALGO]=algo,this[SYM_DECRYPTED]=decrypted}OpenSSH_Old_Private.prototype=BaseKey;{let regexp=/^-----BEGIN (RSA|DSA|EC) PRIVATE KEY-----(?:\r\n|\n)((?:[^:]+:\s*[\S].*(?:\r\n|\n))*)([\s\S]+)(?:\r\n|\n)-----END (RSA|DSA|EC) PRIVATE KEY-----$/;OpenSSH_Old_Private.parse=(str,passphrase)=>{let m=regexp.exec(str);if(m===null)return null;let privBlob=Buffer.from(m[3],"base64"),headers=m[2],decrypted=!1;if(headers!==void 0){headers=headers.split(/\r\n|\n/g);for(let i=0;i<headers.length;++i){let header=headers[i],sepIdx=header.indexOf(":");if(header.slice(0,sepIdx)==="DEK-Info"){let val=header.slice(sepIdx+2);if(sepIdx=val.indexOf(","),sepIdx===-1)continue;let cipherName=val.slice(0,sepIdx).toLowerCase();if(supportedOpenSSLCiphers.indexOf(cipherName)===-1)return Error(`Cipher (${cipherName}) not supported for encrypted OpenSSH private key`);let encInfo=CIPHER_INFO_OPENSSL[cipherName];if(!encInfo)return Error(`Cipher (${cipherName}) not supported for encrypted OpenSSH private key`);let cipherIV=Buffer.from(val.slice(sepIdx+1),"hex");if(cipherIV.length!==encInfo.ivLen)return Error("Malformed encrypted OpenSSH private key");if(!passphrase)return Error("Encrypted OpenSSH private key detected, but no passphrase given");let ivSlice=bufferSlice(cipherIV,0,8),cipherKey=createHash("md5").update(passphrase).update(ivSlice).digest();while(cipherKey.length<encInfo.keyLen)cipherKey=combineBuffers(cipherKey,createHash("md5").update(cipherKey).update(passphrase).update(ivSlice).digest());if(cipherKey.length>encInfo.keyLen)cipherKey=bufferSlice(cipherKey,0,encInfo.keyLen);try{let decipher=createDecipheriv(cipherName,cipherKey,cipherIV);decipher.setAutoPadding(!1),privBlob=combineBuffers(decipher.update(privBlob),decipher.final()),decrypted=!0}catch(ex){return ex}}}}let type,privPEM,pubPEM,pubSSH,algo,reader,errMsg="Malformed OpenSSH private key";if(decrypted)errMsg+=". Bad passphrase?";switch(m[1]){case"RSA":type="ssh-rsa",privPEM=makePEM("RSA PRIVATE",privBlob);try{reader=new Ber.Reader(privBlob),reader.readSequence(),reader.readInt();let n=reader.readString(Ber.Integer,!0);if(n===null)return Error(errMsg);let e=reader.readString(Ber.Integer,!0);if(e===null)return Error(errMsg);pubPEM=genOpenSSLRSAPub(n,e),pubSSH=genOpenSSHRSAPub(n,e)}catch{return Error(errMsg)}algo="sha1";break;case"DSA":type="ssh-dss",privPEM=makePEM("DSA PRIVATE",privBlob);try{reader=new Ber.Reader(privBlob),reader.readSequence(),reader.readInt();let p=reader.readString(Ber.Integer,!0);if(p===null)return Error(errMsg);let q=reader.readString(Ber.Integer,!0);if(q===null)return Error(errMsg);let g=reader.readString(Ber.Integer,!0);if(g===null)return Error(errMsg);let y=reader.readString(Ber.Integer,!0);if(y===null)return Error(errMsg);pubPEM=genOpenSSLDSAPub(p,q,g,y),pubSSH=genOpenSSHDSAPub(p,q,g,y)}catch{return Error(errMsg)}algo="sha1";break;case"EC":{let ecSSLName,ecPriv,ecOID;try{reader=new Ber.Reader(privBlob),reader.readSequence(),reader.readInt(),ecPriv=reader.readString(Ber.OctetString,!0),reader.readByte();let offset=reader.readLength();if(offset!==null){if(reader._offset=offset,ecOID=reader.readOID(),ecOID===null)return Error(errMsg);switch(ecOID){case"1.2.840.10045.3.1.7":ecSSLName="prime256v1",type="ecdsa-sha2-nistp256",algo="sha256";break;case"1.3.132.0.34":ecSSLName="secp384r1",type="ecdsa-sha2-nistp384",algo="sha384";break;case"1.3.132.0.35":ecSSLName="secp521r1",type="ecdsa-sha2-nistp521",algo="sha512";break;default:return Error(`Unsupported private key EC OID: ${ecOID}`)}}else return Error(errMsg)}catch{return Error(errMsg)}privPEM=makePEM("EC PRIVATE",privBlob);let pubBlob=genOpenSSLECDSAPubFromPriv(ecSSLName,ecPriv);pubPEM=genOpenSSLECDSAPub(ecOID,pubBlob),pubSSH=genOpenSSHECDSAPub(ecOID,pubBlob);break}}return new OpenSSH_Old_Private(type,"",privPEM,pubPEM,pubSSH,algo,decrypted)}}function PPK_Private(type,comment,privPEM,pubPEM,pubSSH,algo,decrypted){this.type=type,this.comment=comment,this[SYM_PRIV_PEM]=privPEM,this[SYM_PUB_PEM]=pubPEM,this[SYM_PUB_SSH]=pubSSH,this[SYM_HASH_ALGO]=algo,this[SYM_DECRYPTED]=decrypted}PPK_Private.prototype=BaseKey;{let EMPTY_PASSPHRASE=Buffer.alloc(0),PPK_IV=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),PPK_PP1=Buffer.from([0,0,0,0]),PPK_PP2=Buffer.from([0,0,0,1]),regexp=/^PuTTY-User-Key-File-2: (ssh-(?:rsa|dss))\r?\nEncryption: (aes256-cbc|none)\r?\nComment: ([^\r\n]*)\r?\nPublic-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-MAC: ([^\r\n]+)/;PPK_Private.parse=(str,passphrase)=>{let m=regexp.exec(str);if(m===null)return null;let cipherName=m[2],encrypted=cipherName!=="none";if(encrypted&&!passphrase)return Error("Encrypted PPK private key detected, but no passphrase given");let privBlob=Buffer.from(m[5],"base64");if(encrypted){let encInfo=CIPHER_INFO[cipherName],cipherKey=combineBuffers(createHash("sha1").update(PPK_PP1).update(passphrase).digest(),createHash("sha1").update(PPK_PP2).update(passphrase).digest());if(cipherKey.length>encInfo.keyLen)cipherKey=bufferSlice(cipherKey,0,encInfo.keyLen);try{let decipher=createDecipheriv(encInfo.sslName,cipherKey,PPK_IV);decipher.setAutoPadding(!1),privBlob=combineBuffers(decipher.update(privBlob),decipher.final())}catch(ex){return ex}}let type=m[1],comment=m[3],pubBlob=Buffer.from(m[4],"base64"),mac=m[6],typeLen=type.length,cipherNameLen=cipherName.length,commentLen=Buffer.byteLength(comment),pubLen=pubBlob.length,privLen=privBlob.length,macData=Buffer.allocUnsafe(4+typeLen+4+cipherNameLen+4+commentLen+4+pubLen+4+privLen),p=0;if(writeUInt32BE(macData,typeLen,p),macData.utf8Write(type,p+=4,typeLen),writeUInt32BE(macData,cipherNameLen,p+=typeLen),macData.utf8Write(cipherName,p+=4,cipherNameLen),writeUInt32BE(macData,commentLen,p+=cipherNameLen),macData.utf8Write(comment,p+=4,commentLen),writeUInt32BE(macData,pubLen,p+=commentLen),macData.set(pubBlob,p+=4),writeUInt32BE(macData,privLen,p+=pubLen),macData.set(privBlob,p+4),!passphrase)passphrase=EMPTY_PASSPHRASE;if(createHmac("sha1",createHash("sha1").update("putty-private-key-file-mac-key").update(passphrase).digest()).update(macData).digest("hex")!==mac){if(encrypted)return Error("PPK private key integrity check failed -- bad passphrase?");return Error("PPK private key integrity check failed")}let pubPEM,pubSSH,privPEM;switch(pubBlob._pos=0,skipFields(pubBlob,1),type){case"ssh-rsa":{let e=readString(pubBlob,pubBlob._pos);if(e===void 0)return Error("Malformed PPK public key");let n=readString(pubBlob,pubBlob._pos);if(n===void 0)return Error("Malformed PPK public key");let d=readString(privBlob,0);if(d===void 0)return Error("Malformed PPK private key");let p2=readString(privBlob,privBlob._pos);if(p2===void 0)return Error("Malformed PPK private key");let q=readString(privBlob,privBlob._pos);if(q===void 0)return Error("Malformed PPK private key");let iqmp=readString(privBlob,privBlob._pos);if(iqmp===void 0)return Error("Malformed PPK private key");pubPEM=genOpenSSLRSAPub(n,e),pubSSH=genOpenSSHRSAPub(n,e),privPEM=genOpenSSLRSAPriv(n,e,d,iqmp,p2,q);break}case"ssh-dss":{let p2=readString(pubBlob,pubBlob._pos);if(p2===void 0)return Error("Malformed PPK public key");let q=readString(pubBlob,pubBlob._pos);if(q===void 0)return Error("Malformed PPK public key");let g=readString(pubBlob,pubBlob._pos);if(g===void 0)return Error("Malformed PPK public key");let y=readString(pubBlob,pubBlob._pos);if(y===void 0)return Error("Malformed PPK public key");let x=readString(privBlob,0);if(x===void 0)return Error("Malformed PPK private key");pubPEM=genOpenSSLDSAPub(p2,q,g,y),pubSSH=genOpenSSHDSAPub(p2,q,g,y),privPEM=genOpenSSLDSAPriv(p2,q,g,y,x);break}}return new PPK_Private(type,comment,privPEM,pubPEM,pubSSH,"sha1",encrypted)}}function OpenSSH_Public(type,comment,pubPEM,pubSSH,algo){this.type=type,this.comment=comment,this[SYM_PRIV_PEM]=null,this[SYM_PUB_PEM]=pubPEM,this[SYM_PUB_SSH]=pubSSH,this[SYM_HASH_ALGO]=algo,this[SYM_DECRYPTED]=!1}OpenSSH_Public.prototype=BaseKey;{let regexp;if(eddsaSupported)regexp=/^(((?:ssh-(?:rsa|dss|ed25519))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/;else regexp=/^(((?:ssh-(?:rsa|dss))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/;OpenSSH_Public.parse=(str)=>{let m=regexp.exec(str);if(m===null)return null;let fullType=m[1],baseType=m[2],data=Buffer.from(m[3],"base64"),comment=m[4]||"",type=readString(data,data._pos,!0);if(type===void 0||type.indexOf(baseType)!==0)return Error("Malformed OpenSSH public key");return parseDER(data,baseType,comment,fullType)}}function RFC4716_Public(type,comment,pubPEM,pubSSH,algo){this.type=type,this.comment=comment,this[SYM_PRIV_PEM]=null,this[SYM_PUB_PEM]=pubPEM,this[SYM_PUB_SSH]=pubSSH,this[SYM_HASH_ALGO]=algo,this[SYM_DECRYPTED]=!1}RFC4716_Public.prototype=BaseKey;{let regexp=/^---- BEGIN SSH2 PUBLIC KEY ----(?:\r?\n)((?:.{0,72}\r?\n)+)---- END SSH2 PUBLIC KEY ----$/,RE_DATA=/^[A-Z0-9a-z/+=\r\n]+$/,RE_HEADER=/^([\x21-\x39\x3B-\x7E]{1,64}): ((?:[^\\]*\\\r?\n)*[^\r\n]+)\r?\n/gm,RE_HEADER_ENDS=/\\\r?\n/g;RFC4716_Public.parse=(str)=>{let m=regexp.exec(str);if(m===null)return null;let body=m[1],dataStart=0,comment="";while(m=RE_HEADER.exec(body)){let headerName=m[1],headerValue=m[2].replace(RE_HEADER_ENDS,"");if(headerValue.length>1024)return RE_HEADER.lastIndex=0,Error("Malformed RFC4716 public key");if(dataStart=RE_HEADER.lastIndex,headerName.toLowerCase()==="comment"){if(comment=headerValue,comment.length>1&&comment.charCodeAt(0)===34&&comment.charCodeAt(comment.length-1)===34)comment=comment.slice(1,-1)}}let data=body.slice(dataStart);if(!RE_DATA.test(data))return Error("Malformed RFC4716 public key");data=Buffer.from(data,"base64");let type=readString(data,0,!0);if(type===void 0)return Error("Malformed RFC4716 public key");let pubPEM=null,pubSSH=null;switch(type){case"ssh-rsa":{let e=readString(data,data._pos);if(e===void 0)return Error("Malformed RFC4716 public key");let n=readString(data,data._pos);if(n===void 0)return Error("Malformed RFC4716 public key");pubPEM=genOpenSSLRSAPub(n,e),pubSSH=genOpenSSHRSAPub(n,e);break}case"ssh-dss":{let p=readString(data,data._pos);if(p===void 0)return Error("Malformed RFC4716 public key");let q=readString(data,data._pos);if(q===void 0)return Error("Malformed RFC4716 public key");let g=readString(data,data._pos);if(g===void 0)return Error("Malformed RFC4716 public key");let y=readString(data,data._pos);if(y===void 0)return Error("Malformed RFC4716 public key");pubPEM=genOpenSSLDSAPub(p,q,g,y),pubSSH=genOpenSSHDSAPub(p,q,g,y);break}default:return Error("Malformed RFC4716 public key")}return new RFC4716_Public(type,comment,pubPEM,pubSSH,"sha1")}}function parseDER(data,baseType,comment,fullType){if(!isSupportedKeyType(baseType))return Error(`Unsupported OpenSSH public key type: ${baseType}`);let algo,oid,pubPEM=null,pubSSH=null;switch(baseType){case"ssh-rsa":{let e=readString(data,data._pos||0);if(e===void 0)return Error("Malformed OpenSSH public key");let n=readString(data,data._pos);if(n===void 0)return Error("Malformed OpenSSH public key");pubPEM=genOpenSSLRSAPub(n,e),pubSSH=genOpenSSHRSAPub(n,e),algo="sha1";break}case"ssh-dss":{let p=readString(data,data._pos||0);if(p===void 0)return Error("Malformed OpenSSH public key");let q=readString(data,data._pos);if(q===void 0)return Error("Malformed OpenSSH public key");let g=readString(data,data._pos);if(g===void 0)return Error("Malformed OpenSSH public key");let y=readString(data,data._pos);if(y===void 0)return Error("Malformed OpenSSH public key");pubPEM=genOpenSSLDSAPub(p,q,g,y),pubSSH=genOpenSSHDSAPub(p,q,g,y),algo="sha1";break}case"ssh-ed25519":{let edpub=readString(data,data._pos||0);if(edpub===void 0||edpub.length!==32)return Error("Malformed OpenSSH public key");pubPEM=genOpenSSLEdPub(edpub),pubSSH=genOpenSSHEdPub(edpub),algo=null;break}case"ecdsa-sha2-nistp256":algo="sha256",oid="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":if(algo===void 0)algo="sha384",oid="1.3.132.0.34";case"ecdsa-sha2-nistp521":{if(algo===void 0)algo="sha512",oid="1.3.132.0.35";if(!skipFields(data,1))return Error("Malformed OpenSSH public key");let ecpub=readString(data,data._pos||0);if(ecpub===void 0)return Error("Malformed OpenSSH public key");pubPEM=genOpenSSLECDSAPub(oid,ecpub),pubSSH=genOpenSSHECDSAPub(oid,ecpub);break}default:return Error(`Unsupported OpenSSH public key type: ${baseType}`)}return new OpenSSH_Public(fullType,comment,pubPEM,pubSSH,algo)}function isSupportedKeyType(type){switch(type){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return!0;case"ssh-ed25519":if(eddsaSupported)return!0;default:return!1}}function isParsedKey(val){if(!val)return!1;return typeof val[SYM_DECRYPTED]==="boolean"}function parseKey(data,passphrase){if(isParsedKey(data))return data;let origBuffer;if(Buffer.isBuffer(data))origBuffer=data,data=data.utf8Slice(0,data.length).trim();else if(typeof data==="string")data=data.trim();else return Error("Key data must be a Buffer or string");if(passphrase!=null){if(typeof passphrase==="string")passphrase=Buffer.from(passphrase);else if(!Buffer.isBuffer(passphrase))return Error("Passphrase must be a string or Buffer when supplied")}let ret;if((ret=OpenSSH_Private.parse(data,passphrase))!==null)return ret;if((ret=OpenSSH_Old_Private.parse(data,passphrase))!==null)return ret;if((ret=PPK_Private.parse(data,passphrase))!==null)return ret;if((ret=OpenSSH_Public.parse(data))!==null)return ret;if((ret=RFC4716_Public.parse(data))!==null)return ret;if(origBuffer){binaryKeyParser.init(origBuffer,0);let type=binaryKeyParser.readString(!0);if(type!==void 0){if(data=binaryKeyParser.readRaw(),data!==void 0){if(ret=parseDER(data,type,"",type),ret instanceof Error)ret=null}}binaryKeyParser.clear()}if(ret)return ret;return Error("Unsupported key format")}module.exports={isParsedKey,isSupportedKeyType,parseDERKey:(data,type)=>parseDER(data,type,"",type),parseKey}});var require_agent=__commonJS((exports,module)=>{var __dirname="/home/runner/work/vibe-plugin-tool-ssh/vibe-plugin-tool-ssh/node_modules/ssh2/lib",{Socket}=__require("net"),{Duplex}=__require("stream"),{resolve}=__require("path"),{readFile}=__require("fs"),{execFile,spawn}=__require("child_process"),{isParsedKey,parseKey}=require_keyParser(),{makeBufferParser,readUInt32BE,writeUInt32BE,writeUInt32LE}=require_utils();function once(cb){let called=!1;return(...args)=>{if(called)return;called=!0,cb(...args)}}function concat(buf1,buf2){let combined=Buffer.allocUnsafe(buf1.length+buf2.length);return buf1.copy(combined,0),buf2.copy(combined,buf1.length),combined}function noop(){}var EMPTY_BUF=Buffer.alloc(0),binaryParser=makeBufferParser();class BaseAgent{getIdentities(cb){cb(Error("Missing getIdentities() implementation"))}sign(pubKey,data,options,cb){if(typeof options==="function")cb=options;cb(Error("Missing sign() implementation"))}}class OpenSSHAgent extends BaseAgent{constructor(socketPath){super();this.socketPath=socketPath}getStream(cb){cb=once(cb);let sock=new Socket;sock.on("connect",()=>{cb(null,sock)}),sock.on("close",onFail).on("end",onFail).on("error",onFail),sock.connect(this.socketPath);function onFail(){try{sock.destroy()}catch{}cb(Error("Failed to connect to agent"))}}getIdentities(cb){cb=once(cb),this.getStream((err,stream)=>{function onFail(err2){if(stream)try{stream.destroy()}catch{}if(!err2)err2=Error("Failed to retrieve identities from agent");cb(err2)}if(err)return onFail(err);let protocol=new AgentProtocol(!0);protocol.on("error",onFail),protocol.pipe(stream).pipe(protocol),stream.on("close",onFail).on("end",onFail).on("error",onFail),protocol.getIdentities((err2,keys)=>{if(err2)return onFail(err2);try{stream.destroy()}catch{}cb(null,keys)})})}sign(pubKey,data,options,cb){if(typeof options==="function")cb=options,options=void 0;else if(typeof options!=="object"||options===null)options=void 0;cb=once(cb),this.getStream((err,stream)=>{function onFail(err2){if(stream)try{stream.destroy()}catch{}if(!err2)err2=Error("Failed to sign data with agent");cb(err2)}if(err)return onFail(err);let protocol=new AgentProtocol(!0);protocol.on("error",onFail),protocol.pipe(stream).pipe(protocol),stream.on("close",onFail).on("end",onFail).on("error",onFail),protocol.sign(pubKey,data,options,(err2,sig)=>{if(err2)return onFail(err2);try{stream.destroy()}catch{}cb(null,sig)})})}}var PageantAgent=(()=>{let EXEPATH=resolve(__dirname,"..","util/pagent.exe"),ERROR={[10]:Error("Invalid pagent.exe arguments"),[11]:Error("Pageant is not running"),[12]:Error("pagent.exe could not create an mmap"),[13]:Error("pagent.exe could not set mode for stdin"),[14]:Error("pagent.exe could not set mode for stdout"),[15]:Error("pagent.exe did not get expected input payload")};function destroy(stream){if(stream.buffer=null,stream.proc)stream.proc.kill(),stream.proc=void 0}class PageantSocket extends Duplex{constructor(){super();this.proc=void 0,this.buffer=null}_read(n){}_write(data,encoding,cb){if(this.buffer===null)this.buffer=data;else{let newBuffer=Buffer.allocUnsafe(this.buffer.length+data.length);this.buffer.copy(newBuffer,0),data.copy(newBuffer,this.buffer.length),this.buffer=newBuffer}if(this.buffer.length<4)return cb();let len=readUInt32BE(this.buffer,0);if(this.buffer.length-4<len)return cb();if(data=this.buffer.slice(0,4+len),this.buffer.length>4+len)return cb(Error("Unexpected multiple agent requests"));this.buffer=null;let error,proc=this.proc=spawn(EXEPATH,[data.length]);proc.stdout.on("data",(data2)=>{this.push(data2)}),proc.on("error",(err)=>{error=err,cb(error)}),proc.on("close",(code)=>{if(this.proc=void 0,!error){if(error=ERROR[code])return cb(error);cb()}}),proc.stdin.end(data)}_final(cb){destroy(this),cb()}_destroy(err,cb){destroy(this),cb()}}return class extends OpenSSHAgent{getStream(cb){cb(null,new PageantSocket)}}})(),CygwinAgent=(()=>{let RE_CYGWIN_SOCK=/^!<socket >(\d+) s ([A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})/;return class extends OpenSSHAgent{getStream(cb){cb=once(cb);let socketPath=this.socketPath,triedCygpath=!1;readFile(socketPath,function readCygsocket(err,data){if(err){if(triedCygpath)return cb(Error("Invalid cygwin unix socket path"));execFile("cygpath",["-w",socketPath],(err2,stdout,stderr)=>{if(err2||stdout.length===0)return cb(Error("Invalid cygwin unix socket path"));triedCygpath=!0,socketPath=stdout.toString().replace(/[\r\n]/g,""),readFile(socketPath,readCygsocket)});return}let m=RE_CYGWIN_SOCK.exec(data.toString("ascii"));if(!m)return cb(Error("Malformed cygwin unix socket file"));let state,bc=0,isRetrying=!1,inBuf=[],sock,credsBuf=Buffer.alloc(12),port=parseInt(m[1],10),secret=m[2].replace(/-/g,""),secretBuf=Buffer.allocUnsafe(16);for(let i=0,j=0;j<32;++i,j+=2)secretBuf[i]=parseInt(secret.substring(j,j+2),16);for(let i=0;i<16;i+=4)writeUInt32LE(secretBuf,readUInt32BE(secretBuf,i),i);tryConnect();function _onconnect(){bc=0,state="secret",sock.write(secretBuf)}function _ondata(data2){if(bc+=data2.length,state==="secret"){if(bc===16)bc=0,state="creds",sock.write(credsBuf);return}if(state==="creds"){if(!isRetrying)inBuf.push(data2);if(bc===12){if(sock.removeListener("connect",_onconnect),sock.removeListener("data",_ondata),sock.removeListener("error",onFail),sock.removeListener("end",onFail),sock.removeListener("close",onFail),isRetrying)return cb(null,sock);isRetrying=!0,credsBuf=Buffer.concat(inBuf),writeUInt32LE(credsBuf,process.pid,0),sock.on("error",()=>{}),sock.destroy(),tryConnect()}}}function onFail(){cb(Error("Problem negotiating cygwin unix socket security"))}function tryConnect(){sock=new Socket,sock.on("connect",_onconnect),sock.on("data",_ondata),sock.on("error",onFail),sock.on("end",onFail),sock.on("close",onFail),sock.connect(port)}})}}})(),WINDOWS_PIPE_REGEX=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;function createAgent(path){if(process.platform==="win32"&&!WINDOWS_PIPE_REGEX.test(path))return path==="pageant"?new PageantAgent:new CygwinAgent(path);return new OpenSSHAgent(path)}var AgentProtocol=(()=>{function processResponses(protocol){let ret;while(protocol[SYM_REQS].length){let nextResponse=protocol[SYM_REQS][0][SYM_RESP];if(nextResponse===void 0)break;protocol[SYM_REQS].shift(),ret=protocol.push(nextResponse)}return ret}let SYM_TYPE=Symbol("Inbound Request Type"),SYM_RESP=Symbol("Inbound Request Response"),SYM_CTX=Symbol("Inbound Request Context");class AgentInboundRequest{constructor(type,ctx){this[SYM_TYPE]=type,this[SYM_RESP]=void 0,this[SYM_CTX]=ctx}hasResponded(){return this[SYM_RESP]!==void 0}getType(){return this[SYM_TYPE]}getContext(){return this[SYM_CTX]}}function respond(protocol,req,data){return req[SYM_RESP]=data,processResponses(protocol)}function cleanup(protocol){if(protocol[SYM_BUFFER]=null,protocol[SYM_MODE]===0){let reqs=protocol[SYM_REQS];if(reqs&&reqs.length){protocol[SYM_REQS]=[];for(let req of reqs)req.cb(Error("No reply from server"))}}try{protocol.end()}catch{}setImmediate(()=>{if(!protocol[SYM_ENDED])protocol.emit("end");if(!protocol[SYM_CLOSED])protocol.emit("close")})}function onClose(){this[SYM_CLOSED]=!0}function onEnd(){this[SYM_ENDED]=!0}let SYM_REQS=Symbol("Requests"),SYM_MODE=Symbol("Agent Protocol Role"),SYM_BUFFER=Symbol("Agent Protocol Buffer"),SYM_MSGLEN=Symbol("Agent Protocol Current Message Length"),SYM_CLOSED=Symbol("Agent Protocol Closed"),SYM_ENDED=Symbol("Agent Protocol Ended");return class extends Duplex{constructor(isClient){super({autoDestroy:!0,emitClose:!1});this[SYM_MODE]=isClient?0:1,this[SYM_REQS]=[],this[SYM_BUFFER]=null,this[SYM_MSGLEN]=-1,this.once("end",onEnd),this.once("close",onClose)}_read(n){}_write(data,encoding,cb){if(this[SYM_BUFFER]===null)this[SYM_BUFFER]=data;else this[SYM_BUFFER]=concat(this[SYM_BUFFER],data);let buffer=this[SYM_BUFFER],bufferLen=buffer.length,p=0;while(p<bufferLen){if(bufferLen<5)break;if(this[SYM_MSGLEN]===-1)this[SYM_MSGLEN]=readUInt32BE(buffer,p);if(bufferLen<4+this[SYM_MSGLEN])break;let msgType=buffer[p+=4];if(++p,this[SYM_MODE]===0){if(this[SYM_REQS].length===0)return cb(Error("Received unexpected message from server"));let req=this[SYM_REQS].shift();switch(msgType){case 5:req.cb(Error("Agent responded with failure"));break;case 12:{if(req.type!==11)return cb(Error("Agent responded with wrong message type"));binaryParser.init(buffer,p);let numKeys=binaryParser.readUInt32BE();if(numKeys===void 0)return binaryParser.clear(),cb(Error("Malformed agent response"));let keys=[];for(let i=0;i<numKeys;++i){let pubKey=binaryParser.readString();if(pubKey===void 0)return binaryParser.clear(),cb(Error("Malformed agent response"));let comment=binaryParser.readString(!0);if(comment===void 0)return binaryParser.clear(),cb(Error("Malformed agent response"));if(pubKey=parseKey(pubKey),pubKey instanceof Error)continue;pubKey.comment=pubKey.comment||comment,keys.push(pubKey)}p=binaryParser.pos(),binaryParser.clear(),req.cb(null,keys);break}case 14:{if(req.type!==13)return cb(Error("Agent responded with wrong message type"));binaryParser.init(buffer,p);let signature=binaryParser.readString();if(p=binaryParser.pos(),binaryParser.clear(),signature===void 0)return cb(Error("Malformed agent response"));if(binaryParser.init(signature,0),binaryParser.readString(!0),signature=binaryParser.readString(),binaryParser.clear(),signature===void 0)return cb(Error("Malformed OpenSSH signature format"));req.cb(null,signature);break}default:return cb(Error("Agent responded with unsupported message type"))}}else switch(msgType){case 11:{let req=new AgentInboundRequest(msgType);this[SYM_REQS].push(req),this.emit("identities",req);break}case 13:{binaryParser.init(buffer,p);let pubKey=binaryParser.readString(),data2=binaryParser.readString(),flagsVal=binaryParser.readUInt32BE();if(p=binaryParser.pos(),binaryParser.clear(),flagsVal===void 0){let req2=new AgentInboundRequest(msgType);return this[SYM_REQS].push(req2),this.failureReply(req2)}if(pubKey=parseKey(pubKey),pubKey instanceof Error){let req2=new AgentInboundRequest(msgType);return this[SYM_REQS].push(req2),this.failureReply(req2)}let flags={hash:void 0},ctx;if(pubKey.type==="ssh-rsa"){if(flagsVal&2)ctx="rsa-sha2-256",flags.hash="sha256";else if(flagsVal&4)ctx="rsa-sha2-512",flags.hash="sha512"}if(ctx===void 0)ctx=pubKey.type;let req=new AgentInboundRequest(msgType,ctx);this[SYM_REQS].push(req),this.emit("sign",req,pubKey,data2,flags);break}default:{let req=new AgentInboundRequest(msgType);this[SYM_REQS].push(req),this.failureReply(req)}}if(this[SYM_MSGLEN]=-1,p===bufferLen){this[SYM_BUFFER]=null;break}else this[SYM_BUFFER]=buffer=buffer.slice(p),bufferLen=buffer.length,p=0}cb()}_destroy(err,cb){cleanup(this),cb()}_final(cb){cleanup(this),cb()}sign(pubKey,data,options,cb){if(this[SYM_MODE]!==0)throw Error("Client-only method called with server role");if(typeof options==="function")cb=options,options=void 0;else if(typeof options!=="object"||options===null)options=void 0;let flags=0;if(pubKey=parseKey(pubKey),pubKey instanceof Error)throw Error("Invalid public key argument");if(pubKey.type==="ssh-rsa"&&options)switch(options.hash){case"sha256":flags=2;break;case"sha512":flags=4;break}pubKey=pubKey.getPublicSSH();let type=13,keyLen=pubKey.length,dataLen=data.length,p=0,buf=Buffer.allocUnsafe(9+keyLen+4+dataLen+4);if(writeUInt32BE(buf,buf.length-4,p),buf[p+=4]=type,writeUInt32BE(buf,keyLen,++p),pubKey.copy(buf,p+=4),writeUInt32BE(buf,dataLen,p+=keyLen),data.copy(buf,p+=4),writeUInt32BE(buf,flags,p+=dataLen),typeof cb!=="function")cb=noop;return this[SYM_REQS].push({type,cb}),this.push(buf)}getIdentities(cb){if(this[SYM_MODE]!==0)throw Error("Client-only method called with server role");let type=11,p=0,buf=Buffer.allocUnsafe(5);if(writeUInt32BE(buf,buf.length-4,p),buf[p+=4]=type,typeof cb!=="function")cb=noop;return this[SYM_REQS].push({type,cb}),this.push(buf)}failureReply(req){if(this[SYM_MODE]!==1)throw Error("Server-only method called with client role");if(!(req instanceof AgentInboundRequest))throw Error("Wrong request argument");if(req.hasResponded())return!0;let p=0,buf=Buffer.allocUnsafe(5);return writeUInt32BE(buf,buf.length-4,p),buf[p+=4]=5,respond(this,req,buf)}getIdentitiesReply(req,keys){if(this[SYM_MODE]!==1)throw Error("Server-only method called with client role");if(!(req instanceof AgentInboundRequest))throw Error("Wrong request argument");if(req.hasResponded())return!0;if(req.getType()!==11)throw Error("Invalid response to request");if(!Array.isArray(keys))throw Error("Keys argument must be an array");let totalKeysLen=4,newKeys=[];for(let i=0;i<keys.length;++i){let entry=keys[i];if(typeof entry!=="object"||entry===null)throw Error(`Invalid key entry: ${entry}`);let pubKey,comment;if(isParsedKey(entry))pubKey=entry;else if(isParsedKey(entry.pubKey))pubKey=entry.pubKey;else{if(typeof entry.pubKey!=="object"||entry.pubKey===null)continue;if({pubKey,comment}=entry.pubKey,pubKey=parseKey(pubKey),pubKey instanceof Error)continue}if(comment=pubKey.comment||comment,pubKey=pubKey.getPublicSSH(),totalKeysLen+=4+pubKey.length,comment&&typeof comment==="string")comment=Buffer.from(comment);else if(!Buffer.isBuffer(comment))comment=EMPTY_BUF;totalKeysLen+=4+comment.length,newKeys.push({pubKey,comment})}let p=0,buf=Buffer.allocUnsafe(5+totalKeysLen);writeUInt32BE(buf,buf.length-4,p),buf[p+=4]=12,writeUInt32BE(buf,newKeys.length,++p),p+=4;for(let i=0;i<newKeys.length;++i){let{pubKey,comment}=newKeys[i];if(writeUInt32BE(buf,pubKey.length,p),pubKey.copy(buf,p+=4),writeUInt32BE(buf,comment.length,p+=pubKey.length),p+=4,comment.length)comment.copy(buf,p),p+=comment.length}return respond(this,req,buf)}signReply(req,signature){if(this[SYM_MODE]!==1)throw Error("Server-only method called with client role");if(!(req instanceof AgentInboundRequest))throw Error("Wrong request argument");if(req.hasResponded())return!0;if(req.getType()!==13)throw Error("Invalid response to request");if(!Buffer.isBuffer(signature))throw Error("Signature argument must be a Buffer");if(signature.length===0)throw Error("Signature argument must be non-empty");let p=0,sigFormat=req.getContext(),sigFormatLen=Buffer.byteLength(sigFormat),buf=Buffer.allocUnsafe(13+sigFormatLen+4+signature.length);return writeUInt32BE(buf,buf.length-4,p),buf[p+=4]=14,writeUInt32BE(buf,4+sigFormatLen+4+signature.length,++p),writeUInt32BE(buf,sigFormatLen,p+=4),buf.utf8Write(sigFormat,p+=4,sigFormatLen),writeUInt32BE(buf,signature.length,p+=sigFormatLen),signature.copy(buf,p+=4),respond(this,req,buf)}}})(),SYM_AGENT=Symbol("Agent"),SYM_AGENT_KEYS=Symbol("Agent Keys"),SYM_AGENT_KEYS_IDX=Symbol("Agent Keys Index"),SYM_AGENT_CBS=Symbol("Agent Init Callbacks");class AgentContext{constructor(agent){if(typeof agent==="string")agent=createAgent(agent);else if(!isAgent(agent))throw Error("Invalid agent argument");this[SYM_AGENT]=agent,this[SYM_AGENT_KEYS]=null,this[SYM_AGENT_KEYS_IDX]=-1,this[SYM_AGENT_CBS]=null}init(cb){if(typeof cb!=="function")cb=noop;if(this[SYM_AGENT_KEYS]===null)if(this[SYM_AGENT_CBS]===null){this[SYM_AGENT_CBS]=[cb];let doCbs=(...args)=>{process.nextTick(()=>{let cbs=this[SYM_AGENT_CBS];this[SYM_AGENT_CBS]=null;for(let cb2 of cbs)cb2(...args)})};this[SYM_AGENT].getIdentities(once((err,keys)=>{if(err)return doCbs(err);if(!Array.isArray(keys))return doCbs(Error("Agent implementation failed to provide keys"));let newKeys=[];for(let key of keys){if(key=parseKey(key),key instanceof Error)continue;newKeys.push(key)}this[SYM_AGENT_KEYS]=newKeys,this[SYM_AGENT_KEYS_IDX]=-1,doCbs()}))}else this[SYM_AGENT_CBS].push(cb);else process.nextTick(cb)}nextKey(){if(this[SYM_AGENT_KEYS]===null||++this[SYM_AGENT_KEYS_IDX]>=this[SYM_AGENT_KEYS].length)return!1;return this[SYM_AGENT_KEYS][this[SYM_AGENT_KEYS_IDX]]}currentKey(){if(this[SYM_AGENT_KEYS]===null||this[SYM_AGENT_KEYS_IDX]>=this[SYM_AGENT_KEYS].length)return null;return this[SYM_AGENT_KEYS][this[SYM_AGENT_KEYS_IDX]]}pos(){if(this[SYM_AGENT_KEYS]===null||this[SYM_AGENT_KEYS_IDX]>=this[SYM_AGENT_KEYS].length)return-1;return this[SYM_AGENT_KEYS_IDX]}reset(){this[SYM_AGENT_KEYS_IDX]=-1}sign(...args){this[SYM_AGENT].sign(...args)}}function isAgent(val){return val instanceof BaseAgent}module.exports={AgentContext,AgentProtocol,BaseAgent,createAgent,CygwinAgent,isAgent,OpenSSHAgent,PageantAgent}});var require_zlib=__commonJS((exports,module)=>{var{kMaxLength}=__require("buffer"),{createInflate,constants:{DEFLATE,INFLATE,Z_DEFAULT_CHUNK,Z_DEFAULT_COMPRESSION,Z_DEFAULT_MEMLEVEL,Z_DEFAULT_STRATEGY,Z_DEFAULT_WINDOWBITS,Z_PARTIAL_FLUSH}}=__require("zlib"),ZlibHandle=createInflate()._handle.constructor;function processCallback(){throw Error("Should not get here")}function zlibOnError(message,errno,code){let self2=this._owner,error=Error(message);error.errno=errno,error.code=code,self2._err=error}function _close(engine){if(!engine._handle)return;engine._handle.close(),engine._handle=null}class Zlib{constructor(mode){let windowBits=Z_DEFAULT_WINDOWBITS,level=Z_DEFAULT_COMPRESSION,memLevel=Z_DEFAULT_MEMLEVEL,strategy=Z_DEFAULT_STRATEGY,dictionary=void 0;this._err=void 0,this._writeState=new Uint32Array(2),this._chunkSize=Z_DEFAULT_CHUNK,this._maxOutputLength=kMaxLength,this._outBuffer=Buffer.allocUnsafe(this._chunkSize),this._outOffset=0,this._handle=new ZlibHandle(mode),this._handle._owner=this,this._handle.onerror=zlibOnError,this._handle.init(windowBits,level,memLevel,strategy,this._writeState,processCallback,void 0)}writeSync(chunk,retChunks){let handle=this._handle;if(!handle)throw Error("Invalid Zlib instance");let availInBefore=chunk.length,availOutBefore=this._chunkSize-this._outOffset,inOff=0,availOutAfter,availInAfter,buffers,nread=0,state=this._writeState,buffer=this._outBuffer,offset=this._outOffset,chunkSize=this._chunkSize;while(!0){if(handle.writeSync(Z_PARTIAL_FLUSH,chunk,inOff,availInBefore,buffer,offset,availOutBefore),this._err)throw this._err;availOutAfter=state[0],availInAfter=state[1];let inDelta=availInBefore-availInAfter,have=availOutBefore-availOutAfter;if(have>0){let out=offset===0&&have===buffer.length?buffer:buffer.slice(offset,offset+have);if(offset+=have,!buffers)buffers=out;else if(buffers.push===void 0)buffers=[buffers,out];else buffers.push(out);if(nread+=out.byteLength,nread>this._maxOutputLength)throw _close(this),Error(`Output length exceeded maximum of ${this._maxOutputLength}`)}else if(have!==0)throw Error("have should not go down");if(availOutAfter===0||offset>=chunkSize)availOutBefore=chunkSize,offset=0,buffer=Buffer.allocUnsafe(chunkSize);if(availOutAfter===0)inOff+=inDelta,availInBefore=availInAfter;else break}if(this._outBuffer=buffer,this._outOffset=offset,nread===0)buffers=Buffer.alloc(0);if(retChunks)return buffers.totalLen=nread,buffers;if(buffers.push===void 0)return buffers;let output=Buffer.allocUnsafe(nread);for(let i=0,p=0;i<buffers.length;++i){let buf=buffers[i];output.set(buf,p),p+=buf.length}return output}}class ZlibPacketWriter{constructor(protocol){this.allocStart=0,this.allocStartKEX=0,this._protocol=protocol,this._zlib=new Zlib(DEFLATE)}cleanup(){if(this._zlib)_close(this._zlib)}alloc(payloadSize,force){return Buffer.allocUnsafe(payloadSize)}finalize(payload,force){if(this._protocol._kexinit===void 0||force){let output=this._zlib.writeSync(payload,!0),packet=this._protocol._cipher.allocPacket(output.totalLen);if(output.push===void 0)packet.set(output,5);else for(let i=0,p=5;i<output.length;++i){let chunk=output[i];packet.set(chunk,p),p+=chunk.length}return packet}return payload}}class PacketWriter{constructor(protocol){this.allocStart=5,this.allocStartKEX=5,this._protocol=protocol}cleanup(){}alloc(payloadSize,force){if(this._protocol._kexinit===void 0||force)return this._protocol._cipher.allocPacket(payloadSize);return Buffer.allocUnsafe(payloadSize)}finalize(packet,force){return packet}}class ZlibPacketReader{constructor(){this._zlib=new Zlib(INFLATE)}cleanup(){if(this._zlib)_close(this._zlib)}read(data){return this._zlib.writeSync(data,!1)}}class PacketReader{cleanup(){}read(data){return data}}module.exports={PacketReader,PacketWriter,ZlibPacketReader,ZlibPacketWriter}});var require_handlers_misc=__commonJS((exports,module)=>{var{bufferSlice,bufferParser,doFatalError,sigSSHToASN1,writeUInt32BE}=require_utils(),{CHANNEL_OPEN_FAILURE,COMPAT,MESSAGE,TERMINAL_MODE}=require_constants(),{parseKey}=require_keyParser(),TERMINAL_MODE_BY_VALUE=Array.from(Object.entries(TERMINAL_MODE)).reduce((obj,[key,value])=>({...obj,[key]:value}),{});module.exports={[MESSAGE.DISCONNECT]:(self2,payload)=>{bufferParser.init(payload,1);let reason=bufferParser.readUInt32BE(),desc=bufferParser.readString(!0),lang=bufferParser.readString();if(bufferParser.clear(),lang===void 0)return doFatalError(self2,"Inbound: Malformed DISCONNECT packet");self2._debug&&self2._debug(`Inbound: Received DISCONNECT (${reason}, "${desc}")`);let handler=self2._handlers.DISCONNECT;handler&&handler(self2,reason,desc)},[MESSAGE.IGNORE]:(self2,payload)=>{self2._debug&&self2._debug("Inbound: Received IGNORE")},[MESSAGE.UNIMPLEMENTED]:(self2,payload)=>{bufferParser.init(payload,1);let seqno=bufferParser.readUInt32BE();if(bufferParser.clear(),seqno===void 0)return doFatalError(self2,"Inbound: Malformed UNIMPLEMENTED packet");self2._debug&&self2._debug(`Inbound: Received UNIMPLEMENTED (seqno ${seqno})`)},[MESSAGE.DEBUG]:(self2,payload)=>{bufferParser.init(payload,1);let display=bufferParser.readBool(),msg=bufferParser.readString(!0),lang=bufferParser.readString();if(bufferParser.clear(),lang===void 0)return doFatalError(self2,"Inbound: Malformed DEBUG packet");self2._debug&&self2._debug("Inbound: Received DEBUG");let handler=self2._handlers.DEBUG;handler&&handler(self2,display,msg)},[MESSAGE.SERVICE_REQUEST]:(self2,payload)=>{bufferParser.init(payload,1);let name=bufferParser.readString(!0);if(bufferParser.clear(),name===void 0)return doFatalError(self2,"Inbound: Malformed SERVICE_REQUEST packet");self2._debug&&self2._debug(`Inbound: Received SERVICE_REQUEST (${name})`);let handler=self2._handlers.SERVICE_REQUEST;handler&&handler(self2,name)},[MESSAGE.SERVICE_ACCEPT]:(self2,payload)=>{bufferParser.init(payload,1);let name=bufferParser.readString(!0);if(bufferParser.clear(),name===void 0)return doFatalError(self2,"Inbound: Malformed SERVICE_ACCEPT packet");self2._debug&&self2._debug(`Inbound: Received SERVICE_ACCEPT (${name})`);let handler=self2._handlers.SERVICE_ACCEPT;handler&&handler(self2,name)},[MESSAGE.EXT_INFO]:(self2,payload)=>{bufferParser.init(payload,1);let numExts=bufferParser.readUInt32BE(),exts;if(numExts!==void 0){exts=[];for(let i=0;i<numExts;++i){let name=bufferParser.readString(!0),data=bufferParser.readString();if(data!==void 0)switch(name){case"server-sig-algs":{let algs=data.latin1Slice(0,data.length).split(",");exts.push({name,algs});continue}default:continue}exts=void 0;break}}if(bufferParser.clear(),exts===void 0)return doFatalError(self2,"Inbound: Malformed EXT_INFO packet");self2._debug&&self2._debug("Inbound: Received EXT_INFO");let handler=self2._handlers.EXT_INFO;handler&&handler(self2,exts)},[MESSAGE.USERAUTH_REQUEST]:(self2,payload)=>{bufferParser.init(payload,1);let user=bufferParser.readString(!0),service=bufferParser.readString(!0),method=bufferParser.readString(!0),methodData,methodDesc;switch(method){case"none":methodData=null;break;case"password":{let isChange=bufferParser.readBool();if(isChange!==void 0){if(methodData=bufferParser.readString(!0),methodData!==void 0&&isChange){let newPassword=bufferParser.readString(!0);if(newPassword!==void 0)methodData={oldPassword:methodData,newPassword};else methodData=void 0}}break}case"publickey":{let hasSig=bufferParser.readBool();if(hasSig!==void 0){let keyAlgo=bufferParser.readString(!0),realKeyAlgo=keyAlgo,key=bufferParser.readString(),hashAlgo;switch(keyAlgo){case"rsa-sha2-256":realKeyAlgo="ssh-rsa",hashAlgo="sha256";break;case"rsa-sha2-512":realKeyAlgo="ssh-rsa",hashAlgo="sha512";break}if(hasSig){let blobEnd=bufferParser.pos(),signature=bufferParser.readString();if(signature!==void 0){if(signature.length>4+keyAlgo.length+4&&signature.utf8Slice(4,4+keyAlgo.length)===keyAlgo)signature=bufferSlice(signature,4+keyAlgo.length+4);if(signature=sigSSHToASN1(signature,realKeyAlgo),signature){let sessionID=self2._kex.sessionID,blob=Buffer.allocUnsafe(4+sessionID.length+blobEnd);writeUInt32BE(blob,sessionID.length,0),blob.set(sessionID,4),blob.set(new Uint8Array(payload.buffer,payload.byteOffset,blobEnd),4+sessionID.length),methodData={keyAlgo:realKeyAlgo,key,signature,blob,hashAlgo}}}}else methodData={keyAlgo:realKeyAlgo,key,hashAlgo},methodDesc="publickey -- check"}break}case"hostbased":{let keyAlgo=bufferParser.readString(!0),realKeyAlgo=keyAlgo,key=bufferParser.readString(),localHostname=bufferParser.readString(!0),localUsername=bufferParser.readString(!0),hashAlgo;switch(keyAlgo){case"rsa-sha2-256":realKeyAlgo="ssh-rsa",hashAlgo="sha256";break;case"rsa-sha2-512":realKeyAlgo="ssh-rsa",hashAlgo="sha512";break}let blobEnd=bufferParser.pos(),signature=bufferParser.readString();if(signature!==void 0){if(signature.length>4+keyAlgo.length+4&&signature.utf8Slice(4,4+keyAlgo.length)===keyAlgo)signature=bufferSlice(signature,4+keyAlgo.length+4);if(signature=sigSSHToASN1(signature,realKeyAlgo),signature!==void 0){let sessionID=self2._kex.sessionID,blob=Buffer.allocUnsafe(4+sessionID.length+blobEnd);writeUInt32BE(blob,sessionID.length,0),blob.set(sessionID,4),blob.set(new Uint8Array(payload.buffer,payload.byteOffset,blobEnd),4+sessionID.length),methodData={keyAlgo:realKeyAlgo,key,signature,blob,localHostname,localUsername,hashAlgo}}}break}case"keyboard-interactive":bufferParser.skipString(),methodData=bufferParser.readList();break;default:if(method!==void 0)methodData=bufferParser.readRaw()}if(bufferParser.clear(),methodData===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_REQUEST packet");if(methodDesc===void 0)methodDesc=method;self2._authsQueue.push(method),self2._debug&&self2._debug(`Inbound: Received USERAUTH_REQUEST (${methodDesc})`);let handler=self2._handlers.USERAUTH_REQUEST;handler&&handler(self2,user,service,method,methodData)},[MESSAGE.USERAUTH_FAILURE]:(self2,payload)=>{bufferParser.init(payload,1);let authMethods=bufferParser.readList(),partialSuccess=bufferParser.readBool();if(bufferParser.clear(),partialSuccess===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_FAILURE packet");self2._debug&&self2._debug(`Inbound: Received USERAUTH_FAILURE (${authMethods})`),self2._authsQueue.shift();let handler=self2._handlers.USERAUTH_FAILURE;handler&&handler(self2,authMethods,partialSuccess)},[MESSAGE.USERAUTH_SUCCESS]:(self2,payload)=>{self2._debug&&self2._debug("Inbound: Received USERAUTH_SUCCESS"),self2._authsQueue.shift();let handler=self2._handlers.USERAUTH_SUCCESS;handler&&handler(self2)},[MESSAGE.USERAUTH_BANNER]:(self2,payload)=>{bufferParser.init(payload,1);let msg=bufferParser.readString(!0),lang=bufferParser.readString();if(bufferParser.clear(),lang===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_BANNER packet");self2._debug&&self2._debug("Inbound: Received USERAUTH_BANNER");let handler=self2._handlers.USERAUTH_BANNER;handler&&handler(self2,msg)},60:(self2,payload)=>{if(!self2._authsQueue.length){self2._debug&&self2._debug("Inbound: Received payload type 60 without auth");return}switch(self2._authsQueue[0]){case"password":{bufferParser.init(payload,1);let prompt=bufferParser.readString(!0),lang=bufferParser.readString();if(bufferParser.clear(),lang===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_PASSWD_CHANGEREQ packet");self2._debug&&self2._debug("Inbound: Received USERAUTH_PASSWD_CHANGEREQ");let handler=self2._handlers.USERAUTH_PASSWD_CHANGEREQ;handler&&handler(self2,prompt);break}case"publickey":{bufferParser.init(payload,1);let keyAlgo=bufferParser.readString(!0),key=bufferParser.readString();if(bufferParser.clear(),key===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_PK_OK packet");self2._debug&&self2._debug("Inbound: Received USERAUTH_PK_OK"),self2._authsQueue.shift();let handler=self2._handlers.USERAUTH_PK_OK;handler&&handler(self2,keyAlgo,key);break}case"keyboard-interactive":{bufferParser.init(payload,1);let name=bufferParser.readString(!0),instructions=bufferParser.readString(!0);bufferParser.readString();let numPrompts=bufferParser.readUInt32BE(),prompts;if(numPrompts!==void 0){prompts=Array(numPrompts);let i;for(i=0;i<numPrompts;++i){let prompt=bufferParser.readString(!0),echo=bufferParser.readBool();if(echo===void 0)break;prompts[i]={prompt,echo}}if(i!==numPrompts)prompts=void 0}if(bufferParser.clear(),prompts===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_INFO_REQUEST packet");self2._debug&&self2._debug("Inbound: Received USERAUTH_INFO_REQUEST");let handler=self2._handlers.USERAUTH_INFO_REQUEST;handler&&handler(self2,name,instructions,prompts);break}default:self2._debug&&self2._debug("Inbound: Received unexpected payload type 60")}},61:(self2,payload)=>{if(!self2._authsQueue.length){self2._debug&&self2._debug("Inbound: Received payload type 61 without auth");return}if(self2._authsQueue[0]!=="keyboard-interactive")return doFatalError(self2,"Inbound: Received unexpected payload type 61");bufferParser.init(payload,1);let numResponses=bufferParser.readUInt32BE(),responses;if(numResponses!==void 0){responses=Array(numResponses);let i;for(i=0;i<numResponses;++i){let response=bufferParser.readString(!0);if(response===void 0)break;responses[i]=response}if(i!==numResponses)responses=void 0}if(bufferParser.clear(),responses===void 0)return doFatalError(self2,"Inbound: Malformed USERAUTH_INFO_RESPONSE packet");self2._debug&&self2._debug("Inbound: Received USERAUTH_INFO_RESPONSE");let handler=self2._handlers.USERAUTH_INFO_RESPONSE;handler&&handler(self2,responses)},[MESSAGE.GLOBAL_REQUEST]:(self2,payload)=>{bufferParser.init(payload,1);let name=bufferParser.readString(!0),wantReply=bufferParser.readBool(),data;if(wantReply!==void 0)switch(name){case"tcpip-forward":case"cancel-tcpip-forward":{let bindAddr=bufferParser.readString(!0),bindPort=bufferParser.readUInt32BE();if(bindPort!==void 0)data={bindAddr,bindPort};break}case"streamlocal-forward@openssh.com":case"cancel-streamlocal-forward@openssh.com":{let socketPath=bufferParser.readString(!0);if(socketPath!==void 0)data={socketPath};break}case"no-more-sessions@openssh.com":data=null;break;case"hostkeys-00@openssh.com":{data=[];while(bufferParser.avail()>0){let keyRaw=bufferParser.readString();if(keyRaw===void 0){data=void 0;break}let key=parseKey(keyRaw);if(!(key instanceof Error))data.push(key)}break}default:data=bufferParser.readRaw()}if(bufferParser.clear(),data===void 0)return doFatalError(self2,"Inbound: Malformed GLOBAL_REQUEST packet");self2._debug&&self2._debug(`Inbound: GLOBAL_REQUEST (${name})`);let handler=self2._handlers.GLOBAL_REQUEST;if(handler)handler(self2,name,wantReply,data);else self2.requestFailure()},[MESSAGE.REQUEST_SUCCESS]:(self2,payload)=>{let data=payload.length>1?bufferSlice(payload,1):null;self2._debug&&self2._debug("Inbound: REQUEST_SUCCESS");let handler=self2._handlers.REQUEST_SUCCESS;handler&&handler(self2,data)},[MESSAGE.REQUEST_FAILURE]:(self2,payload)=>{self2._debug&&self2._debug("Inbound: Received REQUEST_FAILURE");let handler=self2._handlers.REQUEST_FAILURE;handler&&handler(self2)},[MESSAGE.CHANNEL_OPEN]:(self2,payload)=>{bufferParser.init(payload,1);let type=bufferParser.readString(!0),sender=bufferParser.readUInt32BE(),window2=bufferParser.readUInt32BE(),packetSize=bufferParser.readUInt32BE(),channelInfo;switch(type){case"forwarded-tcpip":case"direct-tcpip":{let destIP=bufferParser.readString(!0),destPort=bufferParser.readUInt32BE(),srcIP=bufferParser.readString(!0),srcPort=bufferParser.readUInt32BE();if(srcPort!==void 0)channelInfo={type,sender,window:window2,packetSize,data:{destIP,destPort,srcIP,srcPort}};break}case"forwarded-streamlocal@openssh.com":case"direct-streamlocal@openssh.com":{let socketPath=bufferParser.readString(!0);if(socketPath!==void 0)channelInfo={type,sender,window:window2,packetSize,data:{socketPath}};break}case"x11":{let srcIP=bufferParser.readString(!0),srcPort=bufferParser.readUInt32BE();if(srcPort!==void 0)channelInfo={type,sender,window:window2,packetSize,data:{srcIP,srcPort}};break}default:channelInfo={type,sender,window:window2,packetSize,data:{}}}if(bufferParser.clear(),channelInfo===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_OPEN packet");self2._debug&&self2._debug(`Inbound: CHANNEL_OPEN (s:${sender}, ${type})`);let handler=self2._handlers.CHANNEL_OPEN;if(handler)handler(self2,channelInfo);else self2.channelOpenFail(channelInfo.sender,CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,"","")},[MESSAGE.CHANNEL_OPEN_CONFIRMATION]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),sender=bufferParser.readUInt32BE(),window2=bufferParser.readUInt32BE(),packetSize=bufferParser.readUInt32BE(),data=bufferParser.avail()?bufferParser.readRaw():void 0;if(bufferParser.clear(),packetSize===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_OPEN_CONFIRMATION packet");self2._debug&&self2._debug(`Inbound: CHANNEL_OPEN_CONFIRMATION (r:${recipient}, s:${sender})`);let handler=self2._handlers.CHANNEL_OPEN_CONFIRMATION;if(handler)handler(self2,{recipient,sender,window:window2,packetSize,data})},[MESSAGE.CHANNEL_OPEN_FAILURE]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),reason=bufferParser.readUInt32BE(),description=bufferParser.readString(!0),lang=bufferParser.readString();if(bufferParser.clear(),lang===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_OPEN_FAILURE packet");self2._debug&&self2._debug(`Inbound: CHANNEL_OPEN_FAILURE (r:${recipient})`);let handler=self2._handlers.CHANNEL_OPEN_FAILURE;handler&&handler(self2,recipient,reason,description)},[MESSAGE.CHANNEL_WINDOW_ADJUST]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),bytesToAdd=bufferParser.readUInt32BE();if(bufferParser.clear(),bytesToAdd===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_WINDOW_ADJUST packet");self2._debug&&self2._debug(`Inbound: CHANNEL_WINDOW_ADJUST (r:${recipient}, ${bytesToAdd})`);let handler=self2._handlers.CHANNEL_WINDOW_ADJUST;handler&&handler(self2,recipient,bytesToAdd)},[MESSAGE.CHANNEL_DATA]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),data=bufferParser.readString();if(bufferParser.clear(),data===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_DATA packet");self2._debug&&self2._debug(`Inbound: CHANNEL_DATA (r:${recipient}, ${data.length})`);let handler=self2._handlers.CHANNEL_DATA;handler&&handler(self2,recipient,data)},[MESSAGE.CHANNEL_EXTENDED_DATA]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),type=bufferParser.readUInt32BE(),data=bufferParser.readString();if(bufferParser.clear(),data===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_EXTENDED_DATA packet");self2._debug&&self2._debug(`Inbound: CHANNEL_EXTENDED_DATA (r:${recipient}, ${data.length})`);let handler=self2._handlers.CHANNEL_EXTENDED_DATA;handler&&handler(self2,recipient,data,type)},[MESSAGE.CHANNEL_EOF]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE();if(bufferParser.clear(),recipient===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_EOF packet");self2._debug&&self2._debug(`Inbound: CHANNEL_EOF (r:${recipient})`);let handler=self2._handlers.CHANNEL_EOF;handler&&handler(self2,recipient)},[MESSAGE.CHANNEL_CLOSE]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE();if(bufferParser.clear(),recipient===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_CLOSE packet");self2._debug&&self2._debug(`Inbound: CHANNEL_CLOSE (r:${recipient})`);let handler=self2._handlers.CHANNEL_CLOSE;handler&&handler(self2,recipient)},[MESSAGE.CHANNEL_REQUEST]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE(),type=bufferParser.readString(!0),wantReply=bufferParser.readBool(),data;if(wantReply!==void 0)switch(type){case"exit-status":data=bufferParser.readUInt32BE(),self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})`);break;case"exit-signal":{let signal,coreDumped;if(self2._compatFlags&COMPAT.OLD_EXIT){let num=bufferParser.readUInt32BE();switch(num){case 1:signal="HUP";break;case 2:signal="INT";break;case 3:signal="QUIT";break;case 6:signal="ABRT";break;case 9:signal="KILL";break;case 14:signal="ALRM";break;case 15:signal="TERM";break;default:if(num!==void 0)signal=`UNKNOWN (${num})`}coreDumped=!1}else if(signal=bufferParser.readString(!0),coreDumped=bufferParser.readBool(),coreDumped===void 0)signal=void 0;let errorMessage=bufferParser.readString(!0);if(bufferParser.skipString()!==void 0)data={signal,coreDumped,errorMessage};self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${signal})`);break}case"pty-req":{let term=bufferParser.readString(!0),cols=bufferParser.readUInt32BE(),rows=bufferParser.readUInt32BE(),width=bufferParser.readUInt32BE(),height=bufferParser.readUInt32BE(),modesBinary=bufferParser.readString();if(modesBinary!==void 0){bufferParser.init(modesBinary,1);let modes={};while(bufferParser.avail()){let opcode=bufferParser.readByte();if(opcode===TERMINAL_MODE.TTY_OP_END)break;let name=TERMINAL_MODE_BY_VALUE[opcode],value=bufferParser.readUInt32BE();if(opcode===void 0||name===void 0||value===void 0){modes=void 0;break}modes[name]=value}if(modes!==void 0)data={term,cols,rows,width,height,modes}}self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`);break}case"window-change":{let cols=bufferParser.readUInt32BE(),rows=bufferParser.readUInt32BE(),width=bufferParser.readUInt32BE(),height=bufferParser.readUInt32BE();if(height!==void 0)data={cols,rows,width,height};self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`);break}case"x11-req":{let single=bufferParser.readBool(),protocol=bufferParser.readString(!0),cookie=bufferParser.readString(),screen=bufferParser.readUInt32BE();if(screen!==void 0)data={single,protocol,cookie,screen};self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`);break}case"env":{let name=bufferParser.readString(!0),value=bufferParser.readString(!0);if(value!==void 0)data={name,value};if(self2._debug)self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${name}=${value})`);break}case"shell":data=null,self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`);break;case"exec":data=bufferParser.readString(!0),self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})`);break;case"subsystem":data=bufferParser.readString(!0),self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})`);break;case"signal":data=bufferParser.readString(!0),self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})`);break;case"xon-xoff":data=bufferParser.readBool(),self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})`);break;case"auth-agent-req@openssh.com":data=null,self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`);break;default:data=bufferParser.avail()?bufferParser.readRaw():null,self2._debug&&self2._debug(`Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})`)}if(bufferParser.clear(),data===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_REQUEST packet");let handler=self2._handlers.CHANNEL_REQUEST;handler&&handler(self2,recipient,type,wantReply,data)},[MESSAGE.CHANNEL_SUCCESS]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE();if(bufferParser.clear(),recipient===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_SUCCESS packet");self2._debug&&self2._debug(`Inbound: CHANNEL_SUCCESS (r:${recipient})`);let handler=self2._handlers.CHANNEL_SUCCESS;handler&&handler(self2,recipient)},[MESSAGE.CHANNEL_FAILURE]:(self2,payload)=>{bufferParser.init(payload,1);let recipient=bufferParser.readUInt32BE();if(bufferParser.clear(),recipient===void 0)return doFatalError(self2,"Inbound: Malformed CHANNEL_FAILURE packet");self2._debug&&self2._debug(`Inbound: CHANNEL_FAILURE (r:${recipient})`);let handler=self2._handlers.CHANNEL_FAILURE;handler&&handler(self2,recipient)}}});var require_handlers=__commonJS((exports,module)=>{var MESSAGE_HANDLERS=Array(256);[require_kex().HANDLERS,require_handlers_misc()].forEach((handlers)=>{for(let[type,handler]of Object.entries(handlers))if(type=+type,isFinite(type)&&type>=0&&type<MESSAGE_HANDLERS.length)MESSAGE_HANDLERS[type]=handler});module.exports=MESSAGE_HANDLERS});var require_kex=__commonJS((exports,module)=>{var{createDiffieHellman,createDiffieHellmanGroup,createECDH,createHash,createPublicKey,diffieHellman,generateKeyPairSync,randomFillSync}=__require("crypto"),{Ber}=require_lib(),{COMPAT,curve25519Supported,DEFAULT_KEX,DEFAULT_SERVER_HOST_KEY,DEFAULT_CIPHER,DEFAULT_MAC,DEFAULT_COMPRESSION,DISCONNECT_REASON,MESSAGE}=require_constants(),{CIPHER_INFO,createCipher,createDecipher,MAC_INFO}=require_crypto(),{parseDERKey}=require_keyParser(),{bufferFill,bufferParser,convertSignature,doFatalError,FastBuffer,sigSSHToASN1,writeUInt32BE}=require_utils(),{PacketReader,PacketWriter,ZlibPacketReader,ZlibPacketWriter}=require_zlib(),MESSAGE_HANDLERS,EMPTY_BUFFER=Buffer.alloc(0);function kexinit(self2){let payload;if(self2._compatFlags&COMPAT.BAD_DHGEX){let entry=self2._offer.lists.kex,kex=entry.array,found=!1;for(let i=0;i<kex.length;++i)if(kex[i].includes("group-exchange")){if(!found)found=!0,kex=kex.slice();kex.splice(i--,1)}if(found){let len=17+self2._offer.totalSize+1+4,newKexBuf=Buffer.from(kex.join(","));len-=entry.buffer.length-newKexBuf.length;let all=self2._offer.lists.all,rest=new Uint8Array(all.buffer,all.byteOffset+4+entry.buffer.length,all.length-(4+entry.buffer.length));payload=Buffer.allocUnsafe(len),writeUInt32BE(payload,newKexBuf.length,17),payload.set(newKexBuf,21),payload.set(rest,21+newKexBuf.length)}}if(payload===void 0)payload=Buffer.allocUnsafe(17+self2._offer.totalSize+1+4),self2._offer.copyAllTo(payload,17);self2._debug&&self2._debug("Outbound: Sending KEXINIT"),payload[0]=MESSAGE.KEXINIT,randomFillSync(payload,1,16),bufferFill(payload,0,payload.length-5),self2._kexinit=payload,self2._packetRW.write.allocStart=0;{let p=self2._packetRW.write.allocStartKEX,packet=self2._packetRW.write.alloc(payload.length,!0);packet.set(payload,p),self2._cipher.encrypt(self2._packetRW.write.finalize(packet,!0))}}function handleKexInit(self2,payload){let init={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0}};if(bufferParser.init(payload,17),(init.kex=bufferParser.readList())===void 0||(init.serverHostKey=bufferParser.readList())===void 0||(init.cs.cipher=bufferParser.readList())===void 0||(init.sc.cipher=bufferParser.readList())===void 0||(init.cs.mac=bufferParser.readList())===void 0||(init.sc.mac=bufferParser.readList())===void 0||(init.cs.compress=bufferParser.readList())===void 0||(init.sc.compress=bufferParser.readList())===void 0||(init.cs.lang=bufferParser.readList())===void 0||(init.sc.lang=bufferParser.readList())===void 0)return bufferParser.clear(),doFatalError(self2,"Received malformed KEXINIT","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);let pos=bufferParser.pos(),firstFollows=pos<payload.length&&payload[pos]===1;bufferParser.clear();let local=self2._offer,remote=init,localKex=local.lists.kex.array;if(self2._compatFlags&COMPAT.BAD_DHGEX){let found=!1;for(let i2=0;i2<localKex.length;++i2)if(localKex[i2].indexOf("group-exchange")!==-1){if(!found)found=!0,localKex=localKex.slice();localKex.splice(i2--,1)}}let clientList,serverList,i,debug=self2._debug;debug&&debug("Inbound: Handshake in progress"),debug&&debug(`Handshake: (local) KEX method: ${localKex}`),debug&&debug(`Handshake: (remote) KEX method: ${remote.kex}`);let remoteExtInfoEnabled;if(self2._server)serverList=localKex,clientList=remote.kex,remoteExtInfoEnabled=clientList.indexOf("ext-info-c")!==-1;else serverList=remote.kex,clientList=localKex,remoteExtInfoEnabled=serverList.indexOf("ext-info-s")!==-1;if(self2._strictMode===void 0){if(self2._server)self2._strictMode=clientList.indexOf("kex-strict-c-v00@openssh.com")!==-1;else self2._strictMode=serverList.indexOf("kex-strict-s-v00@openssh.com")!==-1;if(self2._strictMode){if(debug&&debug("Handshake: strict KEX mode enabled"),self2._decipher.inSeqno!==1){if(debug)debug("Handshake: KEXINIT not first packet in strict KEX mode");return doFatalError(self2,"Handshake failed: KEXINIT not first packet in strict KEX mode","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}}}for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: no matching key exchange algorithm"),doFatalError(self2,"Handshake failed: no matching key exchange algorithm","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(init.kex=clientList[i],debug&&debug(`Handshake: KEX algorithm: ${clientList[i]}`),firstFollows&&(!remote.kex.length||clientList[i]!==remote.kex[0]))self2._skipNextInboundPacket=!0;let localSrvHostKey=local.lists.serverHostKey.array;if(debug&&debug(`Handshake: (local) Host key format: ${localSrvHostKey}`),debug&&debug(`Handshake: (remote) Host key format: ${remote.serverHostKey}`),self2._server)serverList=localSrvHostKey,clientList=remote.serverHostKey;else serverList=remote.serverHostKey,clientList=localSrvHostKey;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching host key format"),doFatalError(self2,"Handshake failed: no matching host key format","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.serverHostKey=clientList[i],debug&&debug(`Handshake: Host key format: ${clientList[i]}`);let localCSCipher=local.lists.cs.cipher.array;if(debug&&debug(`Handshake: (local) C->S cipher: ${localCSCipher}`),debug&&debug(`Handshake: (remote) C->S cipher: ${remote.cs.cipher}`),self2._server)serverList=localCSCipher,clientList=remote.cs.cipher;else serverList=remote.cs.cipher,clientList=localCSCipher;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching C->S cipher"),doFatalError(self2,"Handshake failed: no matching C->S cipher","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.cs.cipher=clientList[i],debug&&debug(`Handshake: C->S Cipher: ${clientList[i]}`);let localSCCipher=local.lists.sc.cipher.array;if(debug&&debug(`Handshake: (local) S->C cipher: ${localSCCipher}`),debug&&debug(`Handshake: (remote) S->C cipher: ${remote.sc.cipher}`),self2._server)serverList=localSCCipher,clientList=remote.sc.cipher;else serverList=remote.sc.cipher,clientList=localSCCipher;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching S->C cipher"),doFatalError(self2,"Handshake failed: no matching S->C cipher","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.sc.cipher=clientList[i],debug&&debug(`Handshake: S->C cipher: ${clientList[i]}`);let localCSMAC=local.lists.cs.mac.array;if(debug&&debug(`Handshake: (local) C->S MAC: ${localCSMAC}`),debug&&debug(`Handshake: (remote) C->S MAC: ${remote.cs.mac}`),CIPHER_INFO[init.cs.cipher].authLen>0)init.cs.mac="",debug&&debug("Handshake: C->S MAC: <implicit>");else{if(self2._server)serverList=localCSMAC,clientList=remote.cs.mac;else serverList=remote.cs.mac,clientList=localCSMAC;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching C->S MAC"),doFatalError(self2,"Handshake failed: no matching C->S MAC","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.cs.mac=clientList[i],debug&&debug(`Handshake: C->S MAC: ${clientList[i]}`)}let localSCMAC=local.lists.sc.mac.array;if(debug&&debug(`Handshake: (local) S->C MAC: ${localSCMAC}`),debug&&debug(`Handshake: (remote) S->C MAC: ${remote.sc.mac}`),CIPHER_INFO[init.sc.cipher].authLen>0)init.sc.mac="",debug&&debug("Handshake: S->C MAC: <implicit>");else{if(self2._server)serverList=localSCMAC,clientList=remote.sc.mac;else serverList=remote.sc.mac,clientList=localSCMAC;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching S->C MAC"),doFatalError(self2,"Handshake failed: no matching S->C MAC","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.sc.mac=clientList[i],debug&&debug(`Handshake: S->C MAC: ${clientList[i]}`)}let localCSCompress=local.lists.cs.compress.array;if(debug&&debug(`Handshake: (local) C->S compression: ${localCSCompress}`),debug&&debug(`Handshake: (remote) C->S compression: ${remote.cs.compress}`),self2._server)serverList=localCSCompress,clientList=remote.cs.compress;else serverList=remote.cs.compress,clientList=localCSCompress;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching C->S compression"),doFatalError(self2,"Handshake failed: no matching C->S compression","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);init.cs.compress=clientList[i],debug&&debug(`Handshake: C->S compression: ${clientList[i]}`);let localSCCompress=local.lists.sc.compress.array;if(debug&&debug(`Handshake: (local) S->C compression: ${localSCCompress}`),debug&&debug(`Handshake: (remote) S->C compression: ${remote.sc.compress}`),self2._server)serverList=localSCCompress,clientList=remote.sc.compress;else serverList=remote.sc.compress,clientList=localSCCompress;for(i=0;i<clientList.length&&serverList.indexOf(clientList[i])===-1;++i);if(i===clientList.length)return debug&&debug("Handshake: No matching S->C compression"),doFatalError(self2,"Handshake failed: no matching S->C compression","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(init.sc.compress=clientList[i],debug&&debug(`Handshake: S->C compression: ${clientList[i]}`),init.cs.lang="",init.sc.lang="",self2._kex){if(!self2._kexinit)kexinit(self2);self2._decipher._onPayload=onKEXPayload.bind(self2,{firstPacket:!1})}self2._kex=createKeyExchange(init,self2,payload),self2._kex.remoteExtInfoEnabled=remoteExtInfoEnabled,self2._kex.start()}var createKeyExchange=(()=>{function convertToMpint(buf){let idx=0,length=buf.length;while(buf[idx]===0)++idx,--length;let newBuf;if(buf[idx]&128)newBuf=Buffer.allocUnsafe(1+length),newBuf[0]=0,buf.copy(newBuf,1,idx),buf=newBuf;else if(length!==buf.length)newBuf=Buffer.allocUnsafe(length),buf.copy(newBuf,0,idx),buf=newBuf;return buf}class KeyExchange{constructor(negotiated,protocol,remoteKexinit){this._protocol=protocol,this.sessionID=protocol._kex?protocol._kex.sessionID:void 0,this.negotiated=negotiated,this.remoteExtInfoEnabled=!1,this._step=1,this._public=null,this._dh=null,this._sentNEWKEYS=!1,this._receivedNEWKEYS=!1,this._finished=!1,this._hostVerified=!1,this._kexinit=protocol._kexinit,this._remoteKexinit=remoteKexinit,this._identRaw=protocol._identRaw,this._remoteIdentRaw=protocol._remoteIdentRaw,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0}finish(scOnly){if(this._finished)return!1;this._finished=!0;let isServer=this._protocol._server,negotiated=this.negotiated,pubKey=this.convertPublicKey(this._dhData),secret=this.computeSecret(this._dhData);if(secret instanceof Error)return secret.message=`Error while computing DH secret (${this.type}): ${secret.message}`,secret.level="handshake",doFatalError(this._protocol,secret,DISCONNECT_REASON.KEY_EXCHANGE_FAILED);let hash=createHash(this.hashName);hashString(hash,isServer?this._remoteIdentRaw:this._identRaw),hashString(hash,isServer?this._identRaw:this._remoteIdentRaw),hashString(hash,isServer?this._remoteKexinit:this._kexinit),hashString(hash,isServer?this._kexinit:this._remoteKexinit);let serverPublicHostKey=isServer?this._hostKey.getPublicSSH():this._hostKey;if(hashString(hash,serverPublicHostKey),this.type==="groupex"){let params=this.getDHParams(),num=Buffer.allocUnsafe(4);writeUInt32BE(num,this._minBits,0),hash.update(num),writeUInt32BE(num,this._prefBits,0),hash.update(num),writeUInt32BE(num,this._maxBits,0),hash.update(num),hashString(hash,params.prime),hashString(hash,params.generator)}hashString(hash,isServer?pubKey:this.getPublicKey());let serverPublicKey=isServer?this.getPublicKey():pubKey;hashString(hash,serverPublicKey),hashString(hash,secret);let exchangeHash=hash.digest();if(!isServer){bufferParser.init(this._sig,0);let sigType=bufferParser.readString(!0);if(!sigType)return doFatalError(this._protocol,"Malformed packet while reading signature","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(sigType!==negotiated.serverHostKey)return doFatalError(this._protocol,`Wrong signature type: ${sigType}, expected: ${negotiated.serverHostKey}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);let sigValue=bufferParser.readString();if(bufferParser.clear(),sigValue===void 0)return doFatalError(this._protocol,"Malformed packet while reading signature","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(!(sigValue=sigSSHToASN1(sigValue,sigType)))return doFatalError(this._protocol,"Malformed signature","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);let parsedHostKey;{bufferParser.init(this._hostKey,0);let name=bufferParser.readString(!0),hostKey=this._hostKey.slice(bufferParser.pos());if(bufferParser.clear(),parsedHostKey=parseDERKey(hostKey,name),parsedHostKey instanceof Error)return parsedHostKey.level="handshake",doFatalError(this._protocol,parsedHostKey,DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}let hashAlgo;switch(this.negotiated.serverHostKey){case"rsa-sha2-256":hashAlgo="sha256";break;case"rsa-sha2-512":hashAlgo="sha512";break}this._protocol._debug&&this._protocol._debug("Verifying signature ...");let verified=parsedHostKey.verify(exchangeHash,sigValue,hashAlgo);if(verified!==!0){if(verified instanceof Error)this._protocol._debug&&this._protocol._debug(`Signature verification failed: ${verified.stack}`);else this._protocol._debug&&this._protocol._debug("Signature verification failed");return doFatalError(this._protocol,"Handshake failed: signature verification failed","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}this._protocol._debug&&this._protocol._debug("Verified signature")}else{let hashAlgo;switch(this.negotiated.serverHostKey){case"rsa-sha2-256":hashAlgo="sha256";break;case"rsa-sha2-512":hashAlgo="sha512";break}this._protocol._debug&&this._protocol._debug("Generating signature ...");let signature=this._hostKey.sign(exchangeHash,hashAlgo);if(signature instanceof Error)return doFatalError(this._protocol,`Handshake failed: signature generation failed for ${this._hostKey.type} host key: ${signature.message}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(signature=convertSignature(signature,this._hostKey.type),signature===!1)return doFatalError(this._protocol,`Handshake failed: signature conversion failed for ${this._hostKey.type} host key`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);let sigType=this.negotiated.serverHostKey,sigTypeLen=Buffer.byteLength(sigType),sigLen=4+sigTypeLen+4+signature.length,p=this._protocol._packetRW.write.allocStartKEX,packet=this._protocol._packetRW.write.alloc(5+serverPublicHostKey.length+4+serverPublicKey.length+4+sigLen,!0);if(packet[p]=MESSAGE.KEXDH_REPLY,writeUInt32BE(packet,serverPublicHostKey.length,++p),packet.set(serverPublicHostKey,p+=4),writeUInt32BE(packet,serverPublicKey.length,p+=serverPublicHostKey.length),packet.set(serverPublicKey,p+=4),writeUInt32BE(packet,sigLen,p+=serverPublicKey.length),writeUInt32BE(packet,sigTypeLen,p+=4),packet.utf8Write(sigType,p+=4,sigTypeLen),writeUInt32BE(packet,signature.length,p+=sigTypeLen),packet.set(signature,p+=4),this._protocol._debug){let type;switch(this.type){case"group":type="KEXDH_REPLY";break;case"groupex":type="KEXDH_GEX_REPLY";break;default:type="KEXECDH_REPLY"}this._protocol._debug(`Outbound: Sending ${type}`)}this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(packet,!0))}if(isServer||!scOnly)trySendNEWKEYS(this);let hsCipherConfig,hsWrite,completeHandshake=(partial)=>{if(hsCipherConfig)return trySendNEWKEYS(this),hsCipherConfig.outbound.seqno=this._protocol._cipher.outSeqno,this._protocol._cipher.free(),this._protocol._cipher=createCipher(hsCipherConfig),this._protocol._packetRW.write=hsWrite,hsCipherConfig=void 0,hsWrite=void 0,this._protocol._onHandshakeComplete(negotiated),!1;if(!this.sessionID)this.sessionID=exchangeHash;{let newSecret=Buffer.allocUnsafe(4+secret.length);writeUInt32BE(newSecret,secret.length,0),newSecret.set(secret,4),secret=newSecret}let csCipherInfo=CIPHER_INFO[negotiated.cs.cipher],scCipherInfo=CIPHER_INFO[negotiated.sc.cipher],csIV=generateKEXVal(csCipherInfo.ivLen,this.hashName,secret,exchangeHash,this.sessionID,"A"),scIV=generateKEXVal(scCipherInfo.ivLen,this.hashName,secret,exchangeHash,this.sessionID,"B"),csKey=generateKEXVal(csCipherInfo.keyLen,this.hashName,secret,exchangeHash,this.sessionID,"C"),scKey=generateKEXVal(scCipherInfo.keyLen,this.hashName,secret,exchangeHash,this.sessionID,"D"),csMacInfo,csMacKey;if(!csCipherInfo.authLen)csMacInfo=MAC_INFO[negotiated.cs.mac],csMacKey=generateKEXVal(csMacInfo.len,this.hashName,secret,exchangeHash,this.sessionID,"E");let scMacInfo,scMacKey;if(!scCipherInfo.authLen)scMacInfo=MAC_INFO[negotiated.sc.mac],scMacKey=generateKEXVal(scMacInfo.len,this.hashName,secret,exchangeHash,this.sessionID,"F");let config={inbound:{onPayload:this._protocol._onPayload,seqno:this._protocol._decipher.inSeqno,decipherInfo:!isServer?scCipherInfo:csCipherInfo,decipherIV:!isServer?scIV:csIV,decipherKey:!isServer?scKey:csKey,macInfo:!isServer?scMacInfo:csMacInfo,macKey:!isServer?scMacKey:csMacKey},outbound:{onWrite:this._protocol._onWrite,seqno:this._protocol._cipher.outSeqno,cipherInfo:isServer?scCipherInfo:csCipherInfo,cipherIV:isServer?scIV:csIV,cipherKey:isServer?scKey:csKey,macInfo:isServer?scMacInfo:csMacInfo,macKey:isServer?scMacKey:csMacKey}};this._protocol._decipher.free(),hsCipherConfig=config,this._protocol._decipher=createDecipher(config);let rw={read:void 0,write:void 0};switch(negotiated.cs.compress){case"zlib":if(isServer)rw.read=new ZlibPacketReader;else rw.write=new ZlibPacketWriter(this._protocol);break;case"zlib@openssh.com":if(this._protocol._authenticated){if(isServer)rw.read=new ZlibPacketReader;else rw.write=new ZlibPacketWriter(this._protocol);break}default:if(isServer)rw.read=new PacketReader;else rw.write=new PacketWriter(this._protocol)}switch(negotiated.sc.compress){case"zlib":if(isServer)rw.write=new ZlibPacketWriter(this._protocol);else rw.read=new ZlibPacketReader;break;case"zlib@openssh.com":if(this._protocol._authenticated){if(isServer)rw.write=new ZlibPacketWriter(this._protocol);else rw.read=new ZlibPacketReader;break}default:if(isServer)rw.write=new PacketWriter(this._protocol);else rw.read=new PacketReader}if(this._protocol._packetRW.read.cleanup(),this._protocol._packetRW.write.cleanup(),this._protocol._packetRW.read=rw.read,hsWrite=rw.write,this._public=null,this._dh=null,this._kexinit=this._protocol._kexinit=void 0,this._remoteKexinit=void 0,this._identRaw=void 0,this._remoteIdentRaw=void 0,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0,!partial)return completeHandshake();return!1};if(isServer||scOnly)this.finish=completeHandshake;if(!isServer)return completeHandshake(scOnly)}start(){if(!this._protocol._server){if(this._protocol._debug){let type;switch(this.type){case"group":type="KEXDH_INIT";break;default:type="KEXECDH_INIT"}this._protocol._debug(`Outbound: Sending ${type}`)}let pubKey=this.getPublicKey(),p=this._protocol._packetRW.write.allocStartKEX,packet=this._protocol._packetRW.write.alloc(5+pubKey.length,!0);packet[p]=MESSAGE.KEXDH_INIT,writeUInt32BE(packet,pubKey.length,++p),packet.set(pubKey,p+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(packet,!0))}}getPublicKey(){this.generateKeys();let key=this._public;if(key)return this.convertPublicKey(key)}convertPublicKey(key){let newKey,idx=0,len=key.length;while(key[idx]===0)++idx,--len;if(key[idx]&128)return newKey=Buffer.allocUnsafe(1+len),newKey[0]=0,key.copy(newKey,1,idx),newKey;if(len!==key.length)newKey=Buffer.allocUnsafe(len),key.copy(newKey,0,idx),key=newKey;return key}computeSecret(otherPublicKey){this.generateKeys();try{return convertToMpint(this._dh.computeSecret(otherPublicKey))}catch(ex){return ex}}parse(payload){let type=payload[0];switch(this._step){case 1:if(this._protocol._server){if(type!==MESSAGE.KEXDH_INIT)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.KEXDH_INIT}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH Init"),bufferParser.init(payload,1);let dhData=bufferParser.readString();if(bufferParser.clear(),dhData===void 0)return doFatalError(this._protocol,"Received malformed KEX*_INIT","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._dhData=dhData;let hostKey=this._protocol._hostKeys[this.negotiated.serverHostKey];if(Array.isArray(hostKey))hostKey=hostKey[0];this._hostKey=hostKey,this.finish()}else{if(type!==MESSAGE.KEXDH_REPLY)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.KEXDH_REPLY}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH Reply"),bufferParser.init(payload,1);let hostPubKey,dhData,sig;if((hostPubKey=bufferParser.readString())===void 0||(dhData=bufferParser.readString())===void 0||(sig=bufferParser.readString())===void 0)return bufferParser.clear(),doFatalError(this._protocol,"Received malformed KEX*_REPLY","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);bufferParser.clear(),bufferParser.init(hostPubKey,0);let hostPubKeyType=bufferParser.readString(!0);if(bufferParser.clear(),hostPubKeyType===void 0)return doFatalError(this._protocol,"Received malformed host public key","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(hostPubKeyType!==this.negotiated.serverHostKey)switch(this.negotiated.serverHostKey){case"rsa-sha2-256":case"rsa-sha2-512":if(hostPubKeyType==="ssh-rsa")break;default:return doFatalError(this._protocol,"Host key does not match negotiated type","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}this._hostKey=hostPubKey,this._dhData=dhData,this._sig=sig;let checked=!1,ret;if(this._protocol._hostVerifier===void 0)ret=!0,this._protocol._debug&&this._protocol._debug("Host accepted by default (no verification)");else ret=this._protocol._hostVerifier(hostPubKey,(permitted)=>{if(checked)return;if(checked=!0,permitted===!1)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),doFatalError(this._protocol,"Host denied (verification failed)","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,this._receivedNEWKEYS)this.finish();else trySendNEWKEYS(this)});if(ret===void 0){++this._step;return}if(checked=!0,ret===!1)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),doFatalError(this._protocol,"Host denied (verification failed)","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,trySendNEWKEYS(this)}++this._step;break;case 2:if(type!==MESSAGE.NEWKEYS)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.NEWKEYS}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);if(this._protocol._debug&&this._protocol._debug("Inbound: NEWKEYS"),this._receivedNEWKEYS=!0,this._protocol._strictMode)this._protocol._decipher.inSeqno=0;return++this._step,this.finish(!this._protocol._server&&!this._hostVerified);default:return doFatalError(this._protocol,`Received unexpected packet ${type} after NEWKEYS`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}}}class Curve25519Exchange extends KeyExchange{constructor(hashName,...args){super(...args);this.type="25519",this.hashName=hashName,this._keys=null}generateKeys(){if(!this._keys)this._keys=generateKeyPairSync("x25519")}getPublicKey(){return this.generateKeys(),this._keys.publicKey.export({type:"spki",format:"der"}).slice(-32)}convertPublicKey(key){let newKey,idx=0,len=key.length;while(key[idx]===0)++idx,--len;if(key.length===32)return key;if(len!==key.length)newKey=Buffer.allocUnsafe(len),key.copy(newKey,0,idx),key=newKey;return key}computeSecret(otherPublicKey){this.generateKeys();try{let asnWriter=new Ber.Writer;return asnWriter.startSequence(),asnWriter.startSequence(),asnWriter.writeOID("1.3.101.110"),asnWriter.endSequence(),asnWriter.startSequence(Ber.BitString),asnWriter.writeByte(0),asnWriter._ensure(otherPublicKey.length),otherPublicKey.copy(asnWriter._buf,asnWriter._offset,0,otherPublicKey.length),asnWriter._offset+=otherPublicKey.length,asnWriter.endSequence(),asnWriter.endSequence(),convertToMpint(diffieHellman({privateKey:this._keys.privateKey,publicKey:createPublicKey({key:asnWriter.buffer,type:"spki",format:"der"})}))}catch(ex){return ex}}}class ECDHExchange extends KeyExchange{constructor(curveName,hashName,...args){super(...args);this.type="ecdh",this.curveName=curveName,this.hashName=hashName}generateKeys(){if(!this._dh)this._dh=createECDH(this.curveName),this._public=this._dh.generateKeys()}}class DHGroupExchange extends KeyExchange{constructor(hashName,...args){super(...args);if(this.type="groupex",this.hashName=hashName,this._prime=null,this._generator=null,this._minBits=2048,this._prefBits=dhEstimate(this.negotiated),this._protocol._compatFlags&COMPAT.BUG_DHGEX_LARGE)this._prefBits=Math.min(this._prefBits,4096);this._maxBits=8192}start(){if(this._protocol._server)return;this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_REQUEST");let p=this._protocol._packetRW.write.allocStartKEX,packet=this._protocol._packetRW.write.alloc(13,!0);packet[p]=MESSAGE.KEXDH_GEX_REQUEST,writeUInt32BE(packet,this._minBits,++p),writeUInt32BE(packet,this._prefBits,p+=4),writeUInt32BE(packet,this._maxBits,p+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(packet,!0))}generateKeys(){if(!this._dh&&this._prime&&this._generator)this._dh=createDiffieHellman(this._prime,this._generator),this._public=this._dh.generateKeys()}setDHParams(prime,generator){if(!Buffer.isBuffer(prime))throw Error("Invalid prime value");if(!Buffer.isBuffer(generator))throw Error("Invalid generator value");this._prime=prime,this._generator=generator}getDHParams(){if(this._dh)return{prime:convertToMpint(this._dh.getPrime()),generator:convertToMpint(this._dh.getGenerator())}}parse(payload){let type=payload[0];switch(this._step){case 1:{if(this._protocol._server){if(type!==MESSAGE.KEXDH_GEX_REQUEST)return doFatalError(this._protocol,`Received packet ${type} instead of `+MESSAGE.KEXDH_GEX_REQUEST,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);return doFatalError(this._protocol,"Group exchange not implemented for server","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}if(type!==MESSAGE.KEXDH_GEX_GROUP)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_GROUP}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH GEX Group"),bufferParser.init(payload,1);let prime,gen;if((prime=bufferParser.readString())===void 0||(gen=bufferParser.readString())===void 0)return bufferParser.clear(),doFatalError(this._protocol,"Received malformed KEXDH_GEX_GROUP","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);bufferParser.clear(),this.setDHParams(prime,gen),this.generateKeys();let pubkey=this.getPublicKey();this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_INIT");let p=this._protocol._packetRW.write.allocStartKEX,packet=this._protocol._packetRW.write.alloc(5+pubkey.length,!0);packet[p]=MESSAGE.KEXDH_GEX_INIT,writeUInt32BE(packet,pubkey.length,++p),packet.set(pubkey,p+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(packet,!0)),++this._step;break}case 2:if(this._protocol._server){if(type!==MESSAGE.KEXDH_GEX_INIT)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_INIT}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);return this._protocol._debug&&this._protocol._debug("Received DH GEX Init"),doFatalError(this._protocol,"Group exchange not implemented for server","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}else if(type!==MESSAGE.KEXDH_GEX_REPLY)return doFatalError(this._protocol,`Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_REPLY}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH GEX Reply"),this._step=1,payload[0]=MESSAGE.KEXDH_REPLY,this.parse=KeyExchange.prototype.parse,this.parse(payload)}}}class DHExchange extends KeyExchange{constructor(groupName,hashName,...args){super(...args);this.type="group",this.groupName=groupName,this.hashName=hashName}start(){if(!this._protocol._server){this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_INIT");let pubKey=this.getPublicKey(),p=this._protocol._packetRW.write.allocStartKEX,packet=this._protocol._packetRW.write.alloc(5+pubKey.length,!0);packet[p]=MESSAGE.KEXDH_INIT,writeUInt32BE(packet,pubKey.length,++p),packet.set(pubKey,p+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(packet,!0))}}generateKeys(){if(!this._dh)this._dh=createDiffieHellmanGroup(this.groupName),this._public=this._dh.generateKeys()}getDHParams(){if(this._dh)return{prime:convertToMpint(this._dh.getPrime()),generator:convertToMpint(this._dh.getGenerator())}}}return(negotiated,...args)=>{if(typeof negotiated!=="object"||negotiated===null)throw Error("Invalid negotiated argument");let kexType=negotiated.kex;if(typeof kexType==="string"){switch(args=[negotiated,...args],kexType){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!curve25519Supported)break;return new Curve25519Exchange("sha256",...args);case"ecdh-sha2-nistp256":return new ECDHExchange("prime256v1","sha256",...args);case"ecdh-sha2-nistp384":return new ECDHExchange("secp384r1","sha384",...args);case"ecdh-sha2-nistp521":return new ECDHExchange("secp521r1","sha512",...args);case"diffie-hellman-group1-sha1":return new DHExchange("modp2","sha1",...args);case"diffie-hellman-group14-sha1":return new DHExchange("modp14","sha1",...args);case"diffie-hellman-group14-sha256":return new DHExchange("modp14","sha256",...args);case"diffie-hellman-group15-sha512":return new DHExchange("modp15","sha512",...args);case"diffie-hellman-group16-sha512":return new DHExchange("modp16","sha512",...args);case"diffie-hellman-group17-sha512":return new DHExchange("modp17","sha512",...args);case"diffie-hellman-group18-sha512":return new DHExchange("modp18","sha512",...args);case"diffie-hellman-group-exchange-sha1":return new DHGroupExchange("sha1",...args);case"diffie-hellman-group-exchange-sha256":return new DHGroupExchange("sha256",...args)}throw Error(`Unsupported key exchange algorithm: ${kexType}`)}throw Error(`Invalid key exchange type: ${kexType}`)}})(),KexInit=(()=>{let KEX_PROPERTY_NAMES=["kex","serverHostKey",["cs","cipher"],["sc","cipher"],["cs","mac"],["sc","mac"],["cs","compress"],["sc","compress"],["cs","lang"],["sc","lang"]];return class{constructor(obj){if(typeof obj!=="object"||obj===null)throw TypeError("Argument must be an object");let lists={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},all:void 0},totalSize=0;for(let prop of KEX_PROPERTY_NAMES){let base,val,desc,key;if(typeof prop==="string")base=lists,val=obj[prop],desc=key=prop;else{let parent=prop[0];base=lists[parent],key=prop[1],val=obj[parent][key],desc=`${parent}.${key}`}let entry={array:void 0,buffer:void 0};if(Buffer.isBuffer(val))entry.array=(""+val).split(","),entry.buffer=val,totalSize+=4+val.length;else{if(typeof val==="string")val=val.split(",");if(Array.isArray(val))entry.array=val,entry.buffer=Buffer.from(val.join(","));else throw TypeError(`Invalid \`${desc}\` type: ${typeof val}`);totalSize+=4+entry.buffer.length}base[key]=entry}let all=Buffer.allocUnsafe(totalSize);lists.all=all;let allPos=0;for(let prop of KEX_PROPERTY_NAMES){let data;if(typeof prop==="string")data=lists[prop].buffer;else data=lists[prop[0]][prop[1]].buffer;allPos=writeUInt32BE(all,data.length,allPos),all.set(data,allPos),allPos+=data.length}this.totalSize=totalSize,this.lists=lists}copyAllTo(buf,offset){let src=this.lists.all;if(typeof offset!=="number")throw TypeError(`Invalid offset value: ${typeof offset}`);if(buf.length-offset<src.length)throw Error("Insufficient space to copy list");return buf.set(src,offset),src.length}}})(),hashString=(()=>{let LEN=Buffer.allocUnsafe(4);return(hash,buf)=>{writeUInt32BE(LEN,buf.length,0),hash.update(LEN),hash.update(buf)}})();function generateKEXVal(len,hashName,secret,exchangeHash,sessionID,char){let ret;if(len){let digest=createHash(hashName).update(secret).update(exchangeHash).update(char).update(sessionID).digest();while(digest.length<len){let chunk=createHash(hashName).update(secret).update(exchangeHash).update(digest).digest(),extended=Buffer.allocUnsafe(digest.length+chunk.length);extended.set(digest,0),extended.set(chunk,digest.length),digest=extended}if(digest.length===len)ret=digest;else ret=new FastBuffer(digest.buffer,digest.byteOffset,len)}else ret=EMPTY_BUFFER;return ret}function onKEXPayload(state,payload){if(payload.length===0){this._debug&&this._debug("Inbound: Skipping empty packet payload");return}if(this._skipNextInboundPacket){this._skipNextInboundPacket=!1;return}payload=this._packetRW.read.read(payload);let type=payload[0];if(!this._strictMode)switch(type){case MESSAGE.IGNORE:case MESSAGE.UNIMPLEMENTED:case MESSAGE.DEBUG:if(!MESSAGE_HANDLERS)MESSAGE_HANDLERS=require_handlers();return MESSAGE_HANDLERS[type](this,payload)}switch(type){case MESSAGE.DISCONNECT:if(!MESSAGE_HANDLERS)MESSAGE_HANDLERS=require_handlers();return MESSAGE_HANDLERS[type](this,payload);case MESSAGE.KEXINIT:if(!state.firstPacket)return doFatalError(this,"Received extra KEXINIT during handshake","handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED);return state.firstPacket=!1,handleKexInit(this,payload);default:if(type<20||type>49)return doFatalError(this,`Received unexpected packet type ${type}`,"handshake",DISCONNECT_REASON.KEY_EXCHANGE_FAILED)}return this._kex.parse(payload)}function dhEstimate(neg){let csCipher=CIPHER_INFO[neg.cs.cipher],scCipher=CIPHER_INFO[neg.sc.cipher],bits=Math.max(0,csCipher.sslName==="des-ede3-cbc"?14:csCipher.keyLen,csCipher.blockLen,csCipher.ivLen,scCipher.sslName==="des-ede3-cbc"?14:scCipher.keyLen,scCipher.blockLen,scCipher.ivLen)*8;if(bits<=112)return 2048;if(bits<=128)return 3072;if(bits<=192)return 7680;return 8192}function trySendNEWKEYS(kex){if(!kex._sentNEWKEYS){kex._protocol._debug&&kex._protocol._debug("Outbound: Sending NEWKEYS");let p=kex._protocol._packetRW.write.allocStartKEX,packet=kex._protocol._packetRW.write.alloc(1,!0);if(packet[p]=MESSAGE.NEWKEYS,kex._protocol._cipher.encrypt(kex._protocol._packetRW.write.finalize(packet,!0)),kex._sentNEWKEYS=!0,kex._protocol._strictMode)kex._protocol._cipher.outSeqno=0}}module.exports={KexInit,kexinit,onKEXPayload,DEFAULT_KEXINIT_CLIENT:new KexInit({kex:DEFAULT_KEX.concat(["ext-info-c","kex-strict-c-v00@openssh.com"]),serverHostKey:DEFAULT_SERVER_HOST_KEY,cs:{cipher:DEFAULT_CIPHER,mac:DEFAULT_MAC,compress:DEFAULT_COMPRESSION,lang:[]},sc:{cipher:DEFAULT_CIPHER,mac:DEFAULT_MAC,compress:DEFAULT_COMPRESSION,lang:[]}}),DEFAULT_KEXINIT_SERVER:new KexInit({kex:DEFAULT_KEX.concat(["kex-strict-s-v00@openssh.com"]),serverHostKey:DEFAULT_SERVER_HOST_KEY,cs:{cipher:DEFAULT_CIPHER,mac:DEFAULT_MAC,compress:DEFAULT_COMPRESSION,lang:[]},sc:{cipher:DEFAULT_CIPHER,mac:DEFAULT_MAC,compress:DEFAULT_COMPRESSION,lang:[]}}),HANDLERS:{[MESSAGE.KEXINIT]:handleKexInit}}});var require_package=__commonJS((exports,module)=>{module.exports={name:"ssh2",version:"1.17.0",author:"Brian White <mscdex@mscdex.net>",description:"SSH2 client and server modules written in pure JavaScript for node.js",main:"./lib/index.js",engines:{node:">=10.16.0"},dependencies:{asn1:"^0.2.6","bcrypt-pbkdf":"^1.0.2"},devDependencies:{"@mscdex/eslint-config":"^1.1.0",eslint:"^7.32.0"},optionalDependencies:{"cpu-features":"~0.0.10",nan:"^2.23.0"},scripts:{install:"node install.js",rebuild:"node install.js",test:"node test/test.js",lint:"eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js examples lib test","lint:fix":"npm run lint -- --fix"},keywords:["ssh","ssh2","sftp","secure","shell","exec","remote","client"],licenses:[{type:"MIT",url:"http://github.com/mscdex/ssh2/raw/master/LICENSE"}],repository:{type:"git",url:"http://github.com/mscdex/ssh2.git"}}});var require_Protocol=__commonJS((exports,module)=>{var{inspect}=__require("util"),{bindingAvailable,NullCipher,NullDecipher}=require_crypto(),{COMPAT_CHECKS,DISCONNECT_REASON,eddsaSupported,MESSAGE,SIGNALS,TERMINAL_MODE}=require_constants(),{DEFAULT_KEXINIT_CLIENT,DEFAULT_KEXINIT_SERVER,KexInit,kexinit,onKEXPayload}=require_kex(),{parseKey}=require_keyParser(),MESSAGE_HANDLERS=require_handlers(),{bufferCopy,bufferFill,bufferSlice,convertSignature,sendPacket,writeUInt32BE}=require_utils(),{PacketReader,PacketWriter,ZlibPacketReader,ZlibPacketWriter}=require_zlib(),MODULE_VER=require_package().version,VALID_DISCONNECT_REASONS=new Map(Object.values(DISCONNECT_REASON).map((n)=>[n,1])),IDENT_RAW=Buffer.from(`SSH-2.0-ssh2js${MODULE_VER}`),IDENT=Buffer.from(`${IDENT_RAW}\r
Binary file
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@vibecontrols/vibe-plugin-tool-ssh",
3
- "version": "2026.518.1",
3
+ "version": "2026.525.1",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "engines": {
7
- "bun": ">=1.3.0"
7
+ "bun": ">=1.3.14"
8
8
  },
9
9
  "scripts": {
10
10
  "build": "bun build ./src/index.ts --outdir ./dist --target bun --minify-syntax --minify-whitespace --external elysia --external @opentui/core && tsc --emitDeclarationOnly --declaration --outDir ./dist",
Binary file
Binary file