stacktape 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/helper-lambdas/batchJobTriggerLambda-beee8a1b15a6c09be6b3c96435478ecd04d748a6.zip +0 -0
- package/helper-lambdas/cdnOriginRequestLambda-f3f6e394fda27d5f14c6dd6161305ed7a1cd3d81.zip +0 -0
- package/helper-lambdas/cdnOriginResponseLambda-88888aca5ae55375744f5282c33952a60aa36ec8.zip +0 -0
- package/helper-lambdas/stacktapeServiceLambda-314cc4fd819901c71917d6e1f4b1bf71294e2c95.zip +0 -0
- package/package.json +1 -1
- package/server.js +1 -1
package/cli.js
CHANGED
|
@@ -240,7 +240,7 @@ ${r}`}},"ERR_INTERNAL_ASSERTION");var T$d=Math.pow(2,32),xhi=function(){try{retu
|
|
|
240
240
|
`)),typeof e.banner=="string"&&e.banner.length&&(e.banner.slice(-2)===`\r
|
|
241
241
|
`?this.banner=e.banner:this.banner=e.banner+`\r
|
|
242
242
|
`)),this.debug("DEBUG: Local ident: "+Zhi(this.config.ident)),this.push(this.config.ident+`\r
|
|
243
|
-
`),this._state.incoming.expectedPacket="KEXINIT"}a(Nd,"SSH2Stream");V$d(Nd,OWe);Nd.prototype.__read=OWe.prototype._read;Nd.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};Nd.prototype.__push=OWe.prototype.push;Nd.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};Nd.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};Nd.prototype._transform=function(e,t,r,n){var i=!1,s=!1,o=this._state,l=o.incoming,d=o.outgoing,u=l.expect,m=l.decrypt,g=l.decompress,h=e.length,v=0,S=this.debug,E=this,A=0,P=A,R,j,I,N;for(this.bytesReceived+=h;;){if(u.type!==void 0){if(A>=h)break;if(u.type===NJ){v=h-A;var Z=u.buf.length-u.ptr;Z<=v?(e.copy(u.buf,u.ptr,A,A+Z),A+=Z,j=u.buf,u.buf=void 0,u.ptr=0,u.type=void 0):(e.copy(u.buf,u.ptr,A),u.ptr+=v,A+=v);continue}else if(u.type===Xhi){if(A+=l.search.push(e),u.type!==void 0)continue}else if(u.type===Jhi){if(++u.ptr+4>255)return this.reset(),S("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[A]===10)u.type=void 0,P<A&&(u.buf===void 0?u.buf=e.toString("ascii",P,A):u.buf+=e.toString("ascii",P,A)),j=u.buf,u.buf=void 0,++A;else{++A===h&&P<A&&(u.buf===void 0?u.buf=e.toString("ascii",P,A):u.buf+=e.toString("ascii",P,A));continue}}}if(l.status===qJ){if(!this.readable)return r();if(this.server)if(!j)S("DEBUG: Parser: IN_INIT (waiting for identification begin)"),w5(this,NJ,4);else if(j[0]===83&&j[1]===83&&j[2]===72&&j[3]===45)l.status=Bur,S("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),S("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{S("DEBUG: Parser: IN_INIT");var Y=l.search=new H$d(i8d);Y.on("info",a(function U(xe,W,X,ae){W&&(l.greeting===void 0?l.greeting=W.toString("binary",X,ae):l.greeting+=W.toString("binary",X,ae)),xe&&(u.type=void 0,l.search.removeListener("info",U))},"onInfo")),Y.maxMatches=1,w5(this,Xhi),l.status=Bur}}else if(l.status===Bur)S("DEBUG: Parser: IN_GREETING"),l.search=void 0,P=A,w5(this,Jhi),l.status=Whi;else if(l.status===Whi){S("DEBUG: Parser: IN_HEADER"),j.charCodeAt(j.length-1)===13&&(j=j.slice(0,-1));var J=j.indexOf("-"),ee=j.indexOf(" "),V={greeting:l.greeting,identRaw:"SSH-"+j,versions:{protocol:j.substr(0,J),software:ee===-1?j.substring(J+1):j.substring(J+1,ee)},comments:ee>-1?j.substring(ee+1):void 0};if(l.greeting=void 0,V.versions.protocol!=="1.99"&&V.versions.protocol!=="2.0")return this.reset(),S("DEBUG: Parser: protocol version not supported: "+V.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",V),l.status===qJ)return;var M=V.identRaw,re=V.versions.software;this.debug("DEBUG: Remote ident: "+Zhi(M));for(var K=0,G;K<Z$d;++K)G=ryi[K],typeof G[0]=="string"?re===G[0]&&(this.remoteBugs|=G[1]):G[0].test(re)&&(this.remoteBugs|=G[1]);l.identRaw=M,this.bytesReceived-=h-A,Zur(this,function(){A===h?r():E._transform(e.slice(A),t,r)}),l.status=LWe;return}else if(l.status===LWe)R=m.instance?m.info.blockLen:8,S("DEBUG: Parser: IN_PACKETBEFORE (expecting "+R+")"),w5(this,NJ,R,m.buf),l.status=Vur;else if(l.status===Vur){if(S("DEBUG: Parser: IN_PACKET"),m.instance?(s=m.info.authLen>0,s||(j=Yhi(this,j)),R=m.info.blockLen):(s=!1,R=8),N=Rf(j,0,this,r),N===!1)return;var D=l.hmac.info,$;D?$=D.actualLen:$=0;var O=N+4+$,L=this.maxPacketSize;if(g.instance&&(L+=(this.maxPacketSize/16384+1)*5+6),N>L||O<16+$||(N+(s?0:4))%R!==0)return this.disconnect(wh.PROTOCOL_ERROR),S("DEBUG: Parser: Bad packet length ("+O+")"),r(new Error("Bad packet length"));l.pktLen=N;var z=l.pktLen+4-R;if(s?(m.instance.setAAD(j.slice(0,4)),S("DEBUG: Parser: pktLen:"+l.pktLen+",remainLen:"+z)):(l.padLen=j[4],S("DEBUG: Parser: pktLen:"+l.pktLen+",padLen:"+l.padLen+",remainLen:"+z)),z>0)s?l.pktExtra=j.slice(4):l.pktExtra=j.slice(5),w5(this,NJ,z),l.status=$ur;else if(z<0)l.status=LWe;else{i=!0,l.status=$ur;continue}}else if(l.status===$ur){S("DEBUG: Parser: IN_PACKETDATA"),m.instance?(s=m.info.authLen>0,i?i=!1:s||(j=Yhi(this,j))):(s=!1,i=!1);var te=l.pktLen-l.padLen-1;if(l.pktExtra?(I=Buffer.allocUnsafe(l.pktExtra.length+j.length),l.pktExtra.copy(I),j.copy(I,l.pktExtra.length),l.payload=I.slice(0,te)):(s?I=j.slice(4):I=j.slice(5),l.payload=j.slice(5,5+te)),l.hmac.info!==void 0){var F=m.info.authLen||l.hmac.info.actualLen;S("DEBUG: Parser: HMAC size:"+F),w5(this,NJ,F,l.hmac.buf),l.status=Khi,l.packet=I}else l.status=Gur;l.pktExtra=void 0,I=void 0}else if(l.status===Khi)if(S("DEBUG: Parser: IN_PACKETDATAVERIFY"),v8d(this,j))S("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),l.status=Gur,l.packet=void 0;else return this.reset(),S("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(l.status===Gur){if(g.instance)if(n)n=!1;else{S("DEBUG: Parser: Decompressing"),g.instance.write(l.payload);var ie=[],se=0;g.instance.on("readable",function(){for(var U;U=this.read();)ie.push(U),se+=U.length}).flush(Qur,function(){g.instance.removeAllListeners("readable"),ie.length===1?l.payload=ie[0]:l.payload=Buffer.concat(ie,se),ie=null;var U;A===h?U=Wur:U=e.slice(A),E._transform(U,t,r,!0)});return}this.emit("packet");var fe=l.payload[0];if(S!==nyi){var H="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",ge=o.authsQueue[0],Pe=null;if(d.status===E6&&!(fe<=4||fe>=20&&fe<=49)&&(H+="(enqueued) "),fe===Ws.KEXDH_INIT)switch(o.kex.type){case"group":Pe="KEXDH_INIT";break;case"groupex":Pe="KEXDH_GEX_REQUEST";break;default:Pe="KEXECDH_INIT"}else if(fe===Ws.KEXDH_REPLY)switch(o.kex.type){case"group":Pe="KEXDH_REPLY";break;case"groupex":Pe="KEXDH_GEX_GROUP";break;default:Pe="KEXECDH_REPLY"}else fe===Ws.KEXDH_GEX_GROUP?Pe="KEXDH_GEX_GROUP":fe===Ws.KEXDH_GEX_REPLY?Pe="KEXDH_GEX_REPLY":fe===60?ge==="password"?Pe="USERAUTH_PASSWD_CHANGEREQ":ge==="keyboard-interactive"?Pe="USERAUTH_INFO_REQUEST":ge==="publickey"?Pe="USERAUTH_PK_OK":Pe="UNKNOWN PACKET 60":fe===61&&(ge==="keyboard-interactive"?Pe="USERAUTH_INFO_RESPONSE":Pe="UNKNOWN PACKET 61");Pe===null&&(Pe=Ws[fe]),fe!==Ws.CHANNEL_OPEN&&fe!==Ws.CHANNEL_REQUEST&&fe!==Ws.CHANNEL_SUCCESS&&fe!==Ws.CHANNEL_FAILURE&&fe!==Ws.CHANNEL_EOF&&fe!==Ws.CHANNEL_CLOSE&&fe!==Ws.CHANNEL_DATA&&fe!==Ws.CHANNEL_EXTENDED_DATA&&fe!==Ws.CHANNEL_WINDOW_ADJUST&&fe!==Ws.DISCONNECT&&fe!==Ws.USERAUTH_REQUEST&&fe!==Ws.GLOBAL_REQUEST&&S(H+Pe)}if(d.status===C6||fe<=4||fe>=20&&fe<=49){if(syi(this,r)===!1||l.status===qJ)return}else if(d.status===E6){if(l.rekeyQueue.length===r8d)return S("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(wh.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var ue=l.seqno;++l.seqno>Jur&&(l.seqno=0),l.rekeyQueue.push([ue,l.payload])}l.status=LWe,l.payload=void 0}j!==void 0&&(j=void 0)}r()};Nd.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=qJ,t.outgoing.status=Hur}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:qJ,expectedPacket:void 0,search:void 0,greeting:void 0,seqno:0,pktLen:void 0,padLen:void 0,pktExtra:void 0,payload:void 0,packet:void 0,kexinit:void 0,identRaw:void 0,rekeyQueue:[],ignoreNext:!1,expect:{amount:void 0,type:void 0,ptr:0,buf:void 0},decrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,buf:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},decompress:{instance:!1,type:!1}},outgoing:{status:Hur,seqno:0,bufSeqno:Buffer.allocUnsafe(4),rekeyQueue:[],kexinit:void 0,kexsecret:void 0,pubkey:void 0,exchangeHash:void 0,sessionId:void 0,sentNEWKEYS:!1,encrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},compress:{instance:!1,type:!1,queue:null}}};e||this.readable&&this.push(null)};Nd.prototype.disconnect=function(e){var t=Buffer.alloc(13);return t[0]=Ws.DISCONNECT,wh[e]===void 0&&(e=wh.BY_APPLICATION),qi(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+wh[e]+")"),ld(this,t),this.reset(),!1};Nd.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),ld(this,a8d)};Nd.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===E6)throw new Error("A re-key is already in progress");if(e!==C6)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),Zur(this)};Nd.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=Ws.REQUEST_SUCCESS,e.copy(t,1)):t=o8d,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),ld(this,t)};Nd.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),ld(this,c8d)};Nd.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_SUCCESS,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),ld(this,t)};Nd.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_FAILURE,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),ld(this,t)};Nd.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_EOF,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),ld(this,t)};Nd.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_CLOSE,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),ld(this,t)};Nd.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(9);return r[0]=Ws.CHANNEL_WINDOW_ADJUST,qi(r,e,1),qi(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),ld(this,r)};Nd.prototype.channelData=function(e,t){var r=Buffer.isBuffer(t),n=r?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+n);return i[0]=Ws.CHANNEL_DATA,qi(i,e,1),qi(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),ld(this,i)};Nd.prototype.channelExtData=function(e,t,r){var n=Buffer.isBuffer(t),i=n?t.length:Buffer.byteLength(t),s=Buffer.allocUnsafe(1+4+4+4+i);return s[0]=Ws.CHANNEL_EXTENDED_DATA,qi(s,e,1),qi(s,r,5),qi(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),ld(this,s)};Nd.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(17);return i[0]=Ws.CHANNEL_OPEN_CONFIRMATION,qi(i,e,1),qi(i,t,5),qi(i,r,9),qi(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),ld(this,i)};Nd.prototype.channelOpenFail=function(e,t,r,n){typeof r!="string"&&(r=""),typeof n!="string"&&(n="");var i=Buffer.byteLength(r),s=Buffer.byteLength(n),o=9,l=Buffer.allocUnsafe(1+4+4+4+i+4+s);return l[0]=Ws.CHANNEL_OPEN_FAILURE,qi(l,e,1),qi(l,t,5),qi(l,i,o),o+=4,i&&(l.write(r,o,i,"utf8"),o+=i),qi(l,s,o),s&&l.write(n,o+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),ld(this,l)};Nd.prototype.service=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=Buffer.allocUnsafe(1+4+t);return r[0]=Ws.SERVICE_REQUEST,qi(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),ld(this,r)};Nd.prototype.tcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+13+1+4+n+4);return i[0]=Ws.GLOBAL_REQUEST,qi(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,qi(i,n,19),i.write(e,23,n,"ascii"),qi(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),ld(this,i)};Nd.prototype.cancelTcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+20+1+4+n+4);return i[0]=Ws.GLOBAL_REQUEST,qi(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,qi(i,n,26),i.write(e,30,n,"ascii"),qi(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),ld(this,i)};Nd.prototype.openssh_streamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+31+1+4+r);return n[0]=Ws.GLOBAL_REQUEST,qi(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,qi(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),ld(this,n)};Nd.prototype.openssh_cancelStreamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+38+1+4+r);return n[0]=Ws.GLOBAL_REQUEST,qi(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,qi(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),ld(this,n)};Nd.prototype.directTcpip=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.srcIP),s=Buffer.byteLength(n.dstIP),o=29,l=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return l[0]=Ws.CHANNEL_OPEN,qi(l,12,1),l.write("direct-tcpip",5,12,"ascii"),qi(l,e,17),qi(l,t,21),qi(l,r,25),qi(l,s,o),l.write(n.dstIP,o+=4,s,"ascii"),qi(l,n.dstPort,o+=s),qi(l,i,o+=4),l.write(n.srcIP,o+=4,i,"ascii"),qi(l,n.srcPort,o+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),ld(this,l)};Nd.prototype.openssh_directStreamLocal=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.socketPath),s=47,o=Buffer.allocUnsafe(1+4+30+4+4+4+4+i+4+4);return o[0]=Ws.CHANNEL_OPEN,qi(o,30,1),o.write("direct-streamlocal@openssh.com",5,30,"ascii"),qi(o,e,35),qi(o,t,39),qi(o,r,43),qi(o,i,s),o.write(n.socketPath,s+=4,i,"utf8"),o.fill(0,o.length-8),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-streamlocal@openssh.com)"),ld(this,o)};Nd.prototype.openssh_noMoreSessions=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.allocUnsafe(1+4+28+1);return t[0]=Ws.GLOBAL_REQUEST,qi(t,28,1),t.write("no-more-sessions@openssh.com",5,28,"ascii"),t[33]=e===void 0||e===!0?1:0,this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (no-more-sessions@openssh.com)"),ld(this,t)};Nd.prototype.session=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.allocUnsafe(1+4+7+4+4+4);return n[0]=Ws.CHANNEL_OPEN,qi(n,7,1),n.write("session",5,7,"ascii"),qi(n,e,12),qi(n,t,16),qi(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),ld(this,n)};Nd.prototype.windowChange=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=Buffer.allocUnsafe(1+4+4+13+1+4+4+4+4);return s[0]=Ws.CHANNEL_REQUEST,qi(s,e,1),qi(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,qi(s,r,23),qi(s,t,27),qi(s,i,31),qi(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),ld(this,s)};Nd.prototype.pty=function(e,t,r,n,i,s,o,l){if(this.server)throw new Error("Client-only method called in server mode");(!s||!s.length)&&(s="vt100"),o&&!Buffer.isBuffer(o)&&!Array.isArray(o)&&typeof o=="object"&&(o=S8d(o)),(!o||!o.length)&&(o=l8d);var d=s.length,u=o.length,m=21,g=Buffer.allocUnsafe(1+4+4+7+1+4+d+4+4+4+4+4+u);if(g[0]=Ws.CHANNEL_REQUEST,qi(g,e,1),qi(g,7,5),g.write("pty-req",9,7,"ascii"),g[16]=l===void 0||l===!0?1:0,qi(g,d,17),g.write(s,21,d,"utf8"),qi(g,r,m+=d),qi(g,t,m+=4),qi(g,i,m+=4),qi(g,n,m+=4),qi(g,u,m+=4),m+=4,Array.isArray(o))for(var h=0;h<u;++h)g[m++]=o[h];else Buffer.isBuffer(o)&&o.copy(g,m);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),ld(this,g)};Nd.prototype.shell=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+5+1);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,5,5),r.write("shell",9,5,"ascii"),r[14]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", shell)"),ld(this,r)};Nd.prototype.exec=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.isBuffer(t)?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+4+1+4+n);return i[0]=Ws.CHANNEL_REQUEST,qi(i,e,1),qi(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,qi(i,n,14),Buffer.isBuffer(t)?t.copy(i,18):i.write(t,18,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exec)"),ld(this,i)};Nd.prototype.signal=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(t=t.toUpperCase(),t.slice(0,3)==="SIG"&&(t=t.substring(3)),Q$d.indexOf(t)===-1)throw new Error("Invalid signal: "+t);var r=t.length,n=Buffer.allocUnsafe(1+4+4+6+1+4+r);return n[0]=Ws.CHANNEL_REQUEST,qi(n,e,1),qi(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,qi(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),ld(this,n)};Nd.prototype.env=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(t),s=Buffer.isBuffer(r)?r.length:Buffer.byteLength(r),o=Buffer.allocUnsafe(1+4+4+3+1+4+i+4+s);return o[0]=Ws.CHANNEL_REQUEST,qi(o,e,1),qi(o,3,5),o.write("env",9,3,"ascii"),o[12]=n===void 0||n===!0?1:0,qi(o,i,13),o.write(t,17,i,"ascii"),qi(o,s,17+i),Buffer.isBuffer(r)?r.copy(o,17+i+4):o.write(r,17+i+4,s,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", env)"),ld(this,o)};Nd.prototype.x11Forward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t.protocol),i=Buffer.byteLength(t.cookie),s=Buffer.allocUnsafe(1+4+4+7+1+1+4+n+4+i+4);s[0]=Ws.CHANNEL_REQUEST,qi(s,e,1),qi(s,7,5),s.write("x11-req",9,7,"ascii"),s[16]=r===void 0||r===!0?1:0,s[17]=t.single?1:0,qi(s,n,18);var o=22;return Buffer.isBuffer(t.protocol)?t.protocol.copy(s,o):s.write(t.protocol,o,n,"utf8"),o+=n,qi(s,i,o),o+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,o):s.write(t.cookie,o,i,"binary"),o+=i,qi(s,t.screen||0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),ld(this,s)};Nd.prototype.subsystem=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+9+1+4+n);return i[0]=Ws.CHANNEL_REQUEST,qi(i,e,1),qi(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,qi(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),ld(this,i)};Nd.prototype.openssh_agentForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+26+1);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,26,5),r.write("auth-agent-req@openssh.com",9,26,"ascii"),r[35]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", auth-agent-req@openssh.com)"),ld(this,r)};Nd.prototype.authPassword=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.byteLength(t),i=0,s=Buffer.allocUnsafe(1+4+r+4+14+4+8+1+4+n);return s[i]=Ws.USERAUTH_REQUEST,qi(s,r,++i),s.write(e,i+=4,r,"utf8"),qi(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),qi(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,qi(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),ld(this,s)};Nd.prototype.authPK=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=this,i=this._state.outgoing,s;typeof t.getPublicSSH=="function"?(s=t.type,t=t.getPublicSSH()):s=t.toString("ascii",4,4+Xur(t,0));var o=Buffer.byteLength(e),l=Buffer.byteLength(s),d=t.length,u=i.sessionId.length,m=0,g=Buffer.allocUnsafe((r?4+u:0)+1+4+o+4+14+4+9+1+4+l+4+d);return r?(qi(g,u,m),i.sessionId.copy(g,m+=4),g[m+=u]=Ws.USERAUTH_REQUEST):g[m]=Ws.USERAUTH_REQUEST,qi(g,o,++m),g.write(e,m+=4,o,"utf8"),qi(g,14,m+=o),g.write("ssh-connection",m+=4,14,"ascii"),qi(g,9,m+=14),g.write("publickey",m+=4,9,"ascii"),g[m+=9]=r?1:0,qi(g,l,++m),g.write(s,m+=4,l,"ascii"),qi(g,d,m+=l),t.copy(g,m+=4),r?(r(g,function(h){if(h=emr(h,s),h===!1)throw new Error("Error while converting handshake signature");var v=h.length,S=Buffer.allocUnsafe(1+4+o+4+14+4+9+1+4+l+4+d+4+4+l+4+v);return m=0,S[m]=Ws.USERAUTH_REQUEST,qi(S,o,++m),S.write(e,m+=4,o,"utf8"),qi(S,14,m+=o),S.write("ssh-connection",m+=4,14,"ascii"),qi(S,9,m+=14),S.write("publickey",m+=4,9,"ascii"),S[m+=9]=1,qi(S,l,++m),S.write(s,m+=4,l,"ascii"),qi(S,d,m+=l),t.copy(S,m+=4),qi(S,4+l+4+v,m+=d),qi(S,l,m+=4),S.write(s,m+=4,l,"ascii"),qi(S,v,m+=l),h.copy(S,m+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),ld(n,S)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),ld(this,g))};Nd.prototype.authHostbased=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=this,o=this._state.outgoing,l;typeof t.getPublicSSH=="function"?(l=t.type,t=t.getPublicSSH()):l=t.toString("ascii",4,4+Xur(t,0));var d=Buffer.byteLength(e),u=Buffer.byteLength(l),m=t.length,g=o.sessionId.length,h=Buffer.byteLength(r),v=Buffer.byteLength(n),S=0,E=Buffer.allocUnsafe(4+g+1+4+d+4+14+4+9+4+u+4+m+4+h+4+v);return qi(E,g,S),o.sessionId.copy(E,S+=4),E[S+=g]=Ws.USERAUTH_REQUEST,qi(E,d,++S),E.write(e,S+=4,d,"utf8"),qi(E,14,S+=d),E.write("ssh-connection",S+=4,14,"ascii"),qi(E,9,S+=14),E.write("hostbased",S+=4,9,"ascii"),qi(E,u,S+=9),E.write(l,S+=4,u,"ascii"),qi(E,m,S+=u),t.copy(E,S+=4),qi(E,h,S+=m),E.write(r,S+=4,h,"ascii"),qi(E,v,S+=h),E.write(n,S+=4,v,"utf8"),i(E,function(A){if(A=emr(A,l),A===!1)throw new Error("Error while converting handshake signature");var P=A.length,R=Buffer.allocUnsafe(E.length-g+P);return E.copy(R,0,4+g),qi(R,P,R.length-P-4),A.copy(R,R.length-P),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),ld(s,R)}),!0};Nd.prototype.authKeyboard=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+20+4+4);return n[r]=Ws.USERAUTH_REQUEST,qi(n,t,++r),n.write(e,r+=4,t,"utf8"),qi(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),qi(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),qi(n,0,r+=20),qi(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),ld(this,n)};Nd.prototype.authNone=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+4);return n[r]=Ws.USERAUTH_REQUEST,qi(n,t,++r),n.write(e,r+=4,t,"utf8"),qi(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),qi(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),ld(this,n)};Nd.prototype.authInfoRes=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=0,r=0,n,i,s;if(e)for(s=0,i=e.length;s<i;++s)t+=4+Buffer.byteLength(e[s]);var o=Buffer.allocUnsafe(1+4+t);if(o[r++]=Ws.USERAUTH_INFO_RESPONSE,qi(o,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),qi(o,n,r),r+=4,n&&(o.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),ld(this,o)};Nd.prototype.serviceAccept=function(e){if(!this.server)throw new Error("Server-only method called in client mode");var t=e.length,r=Buffer.allocUnsafe(1+4+t);if(r[0]=Ws.SERVICE_ACCEPT,qi(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),ld(this,r),this.server&&this.banner&&e==="ssh-userauth"){var n=Buffer.byteLength(this.banner),i=1+4+n+4,s=Buffer.allocUnsafe(i);s[0]=Ws.USERAUTH_BANNER,qi(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),ld(this,s),this.banner=void 0}};Nd.prototype.forwardedTcpip=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.boundAddr),s=Buffer.byteLength(n.remoteAddr),o=36+i,l=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return l[0]=Ws.CHANNEL_OPEN,qi(l,15,1),l.write("forwarded-tcpip",5,15,"ascii"),qi(l,e,20),qi(l,t,24),qi(l,r,28),qi(l,i,32),l.write(n.boundAddr,36,i,"ascii"),qi(l,n.boundPort,o),qi(l,s,o+=4),l.write(n.remoteAddr,o+=4,s,"ascii"),qi(l,n.remotePort,o+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),ld(this,l)};Nd.prototype.x11=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.originAddr),s=24+i,o=Buffer.allocUnsafe(1+4+3+4+4+4+4+i+4);return o[0]=Ws.CHANNEL_OPEN,qi(o,3,1),o.write("x11",5,3,"ascii"),qi(o,e,8),qi(o,t,12),qi(o,r,16),qi(o,i,20),o.write(n.originAddr,24,i,"ascii"),qi(o,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),ld(this,o)};Nd.prototype.openssh_authAgent=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=Buffer.allocUnsafe(1+4+22+4+4+4);return n[0]=Ws.CHANNEL_OPEN,qi(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),qi(n,e,27),qi(n,t,31),qi(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),ld(this,n)};Nd.prototype.openssh_forwardedStreamLocal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.socketPath),s=Buffer.allocUnsafe(1+4+33+4+4+4+4+i+4);return s[0]=Ws.CHANNEL_OPEN,qi(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),qi(s,e,38),qi(s,t,42),qi(s,r,46),qi(s,i,50),s.write(n.socketPath,54,i,"utf8"),qi(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),ld(this,s)};Nd.prototype.exitStatus=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.allocUnsafe(1+4+4+11+1+4);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,qi(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),ld(this,r)};Nd.prototype.exitSignal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(t),s=n?Buffer.byteLength(n):0,o=25+i,l=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return l[0]=Ws.CHANNEL_REQUEST,qi(l,e,1),qi(l,11,5),l.write("exit-signal",9,11,"ascii"),l[20]=0,qi(l,i,21),l.write(t,25,i,"utf8"),l[o++]=r?1:0,qi(l,s,o),o+=4,s&&(l.write(n,o,s,"utf8"),o+=s),qi(l,0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),ld(this,l)};Nd.prototype.authFailure=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length)throw new Error("No auth in progress");var n;if(typeof e=="boolean"&&(t=e,e=void 0),e){n=[];for(var i=0,s=e.length;i<s;++i)e[i].toLowerCase()!=="none"&&n.push(e[i]);n=n.join(",")}else n="";var o=n.length,l=Buffer.allocUnsafe(1+4+o+1);return l[0]=Ws.USERAUTH_FAILURE,qi(l,o,1),l.write(n,5,o,"ascii"),l[5+o]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),ld(this,l)};Nd.prototype.authSuccess=function(){if(!this.server)throw new Error("Server-only method called in client mode");var e=this._state.authsQueue;if(!e.length)throw new Error("No auth in progress");var t=this._state,r=t.outgoing,n=t.incoming;t.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_SUCCESS");var i=ld(this,s8d);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=S5.createDeflate(MJ),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=S5.createInflate(MJ)),i};Nd.prototype.authPKOK=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length||r[0]!=="publickey")throw new Error('"publickey" auth not in progress');var n=e.length,i=t.length,s=Buffer.allocUnsafe(1+4+n+4+i);return s[0]=Ws.USERAUTH_PK_OK,qi(s,n,1),s.write(e,5,n,"ascii"),qi(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),ld(this,s)};Nd.prototype.authPasswdChg=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.byteLength(e),n=t?t.length:0,i=0,s=Buffer.allocUnsafe(1+4+r+4+n);return s[i]=Ws.USERAUTH_PASSWD_CHANGEREQ,qi(s,r,++i),s.write(e,i+=4,r,"utf8"),qi(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),ld(this,s)};Nd.prototype.authInfoReq=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=0,i=e?Buffer.byteLength(e):0,s=t?Buffer.byteLength(t):0,o=0,l,d,u,m;for(m=0,u=r.length;m<u;++m)n+=4+Buffer.byteLength(r[m].prompt)+1;var g=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(g[o++]=Ws.USERAUTH_INFO_REQUEST,qi(g,i,o),o+=4,e&&(g.write(e,o,i,"utf8"),o+=i),qi(g,s,o),o+=4,t&&(g.write(t,o,s,"utf8"),o+=s),qi(g,0,o),o+=4,qi(g,r.length,o),o+=4,m=0,u=r.length;m<u;++m)d=r[m],l=Buffer.byteLength(d.prompt),qi(g,l,o),o+=4,l&&(g.write(d.prompt,o,l,"utf8"),o+=l),g[o++]=d.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),ld(this,g)};function d8d(e,t,r,n,i){if(r!==wh.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}a(d8d,"onDISCONNECT");function u8d(e,t,r){var n=e._state,i=n.outgoing;i.status===C6?(e.debug("DEBUG: Received re-key request"),i.status=E6,i.kexinit=void 0,Zur(e,s)):s();function s(){m8d(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?C8d(e):oyi(e))}a(s,"check")}a(u8d,"onKEXINIT");function m8d(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,l,d,u,m,g;o("DEBUG: Comparing KEXINITs ...");var h=e.config.algorithms,v=h.kex;if(e.remoteBugs&jWe.BAD_DHGEX)for(var S=!1,E=v.length-1;E>=0;--E)v[E].indexOf("group-exchange")!==-1&&(S||(v=v.slice(),S=!0),v.splice(E,1));for(o("DEBUG: (local) KEX algorithms: "+v),o("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(l=v,d=t.algorithms.kex):(l=t.algorithms.kex,d=v),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching key exchange algorithm");var A=new Error("Handshake failed: no matching key exchange algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}var P=d[g];for(o("DEBUG: KEX algorithm: "+P),r&&(!t.algorithms.kex.length||P!==t.algorithms.kex[0])&&(i.ignoreNext=!0),o("DEBUG: (local) Host key formats: "+h.serverHostKey),o("DEBUG: (remote) Host key formats: "+t.algorithms.srvHostKey),e.server?(l=h.serverHostKey,d=t.algorithms.srvHostKey):(l=t.algorithms.srvHostKey,d=h.serverHostKey),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching host key format");var A=new Error("Handshake failed: no matching host key format");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=d[g],o("DEBUG: Host key format: "+n.hostkeyFormat),o("DEBUG: (local) Client->Server ciphers: "+h.cipher),o("DEBUG: (remote) Client->Server ciphers: "+t.algorithms.cs.encrypt),e.server?(l=h.cipher,d=t.algorithms.cs.encrypt):(l=t.algorithms.cs.encrypt,d=h.cipher),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server cipher");var A=new Error("Handshake failed: no matching client->server cipher");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.decrypt.type=d[g]:u=s.encrypt.type=d[g],o("DEBUG: Client->Server Cipher: "+u),o("DEBUG: (local) Server->Client ciphers: "+h.cipher),o("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(l=h.cipher,d=t.algorithms.sc.encrypt):(l=t.algorithms.sc.encrypt,d=h.cipher),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client cipher");var A=new Error("Handshake failed: no matching server->client cipher");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=s.encrypt.type=d[g]:u=i.decrypt.type=d[g],o("DEBUG: Server->Client Cipher: "+u),o("DEBUG: (local) Client->Server HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(l=h.hmac,d=t.algorithms.cs.mac):(l=t.algorithms.cs.mac,d=h.hmac),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server HMAC algorithm");var A=new Error("Handshake failed: no matching client->server HMAC");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.hmac.type=d[g]:u=s.hmac.type=d[g],o("DEBUG: Client->Server HMAC algorithm: "+u),o("DEBUG: (local) Server->Client HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(l=h.hmac,d=t.algorithms.sc.mac):(l=t.algorithms.sc.mac,d=h.hmac),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client HMAC algorithm");var A=new Error("Handshake failed: no matching server->client HMAC");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=s.hmac.type=d[g]:u=i.hmac.type=d[g],o("DEBUG: Server->Client HMAC algorithm: "+u),o("DEBUG: (local) Client->Server compression algorithms: "+h.compress),o("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(l=h.compress,d=t.algorithms.cs.compress):(l=t.algorithms.cs.compress,d=h.compress),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server compression algorithm");var A=new Error("Handshake failed: no matching client->server compression algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.decompress.type=d[g]:u=s.compress.type=d[g],o("DEBUG: Client->Server compression algorithm: "+u),o("DEBUG: (local) Server->Client compression algorithms: "+h.compress),o("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(l=h.compress,d=t.algorithms.sc.compress):(l=t.algorithms.sc.compress,d=h.compress),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client compression algorithm");var A=new Error("Handshake failed: no matching server->client compression algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}return e.server?u=s.compress.type=d[g]:u=i.decompress.type=d[g],o("DEBUG: Server->Client compression algorithm: "+u),n.kex=new b5(P),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}a(m8d,"check_KEXINIT");function f8d(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),oyi(e)}a(f8d,"onKEXDH_GEX_GROUP");function p8d(e,t){b8d(e,t)}a(p8d,"onKEXDH_INIT");function iyi(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,l,d;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,o("DEBUG: Checking host key format");var u=Zl(t.hostkey,0,"ascii",e);if(u===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==u){o("DEBUG: Host key format mismatch"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host key format mismatch");return m.level="handshake",e.emit("error",m),!1}o("DEBUG: Checking signature format");var g=Zl(t.sig,0,"ascii",e);if(g===!1)return!1;if(t.sig_format!==g){o("DEBUG: Signature format mismatch"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature format mismatch");return m.level="handshake",e.emit("error",m),!1}}if(s.status===Hur){if(r===void 0){o("DEBUG: Verifying host fingerprint");var h=!0,v=e.emit("fingerprint",t.hostkey,function(O){r===void 0&&(r=!!O,h||iyi(e,t,r))});if(h=!1,v&&r===void 0)return}if(r===void 0)o("DEBUG: Host accepted by default (no verification)");else if(r===!0)o("DEBUG: Host accepted (verified)");else{o("DEBUG: Host denied via fingerprint verification"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host fingerprint verification failed");return m.level="handshake",e.emit("error",m),!1}}if(t.pubkey=n.kex.convertPublicKey(t.pubkey),t.secret=n.kex.computeSecret(t.pubkey),t.secret instanceof Error)return t.secret.message="Error while computing DH secret ("+n.kex.type+"): "+t.secret.message,t.secret.level="handshake",e.emit("error",t.secret),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var S=wp.createHash(n.kex.hash),E=Buffer.byteLength(e.config.ident),A=Buffer.byteLength(i.identRaw),P=s.kexinit.length,R=i.kexinit.length,j=t.hostkey.length,I=s.pubkey.length,N=t.pubkey.length,Z=t.secret.length,Y=E+A+P+R+j+I+N+Z+4*8,J,ee,V,M,re=n.kex.getDHParams();re&&(V=re.prime,M=re.generator,J=V.length,ee=M.length,Y+=4*3,Y+=4*2,Y+=J,Y+=ee);var K=0,G=Buffer.allocUnsafe(Y);qi(G,E,K),K+=4,G.write(e.config.ident,K,"utf8"),K+=E,qi(G,A,K),K+=4,G.write(i.identRaw,K,"utf8"),K+=A,qi(G,P,K),K+=4,s.kexinit.copy(G,K),K+=P,s.kexinit=void 0,qi(G,R,K),K+=4,i.kexinit.copy(G,K),K+=R,i.kexinit=void 0,qi(G,j,K),K+=4,t.hostkey.copy(G,K),K+=j,re&&(Yur.slice(1).copy(G,K),K+=4*3,qi(G,J,K),K+=4,V.copy(G,K),K+=J,qi(G,ee,K),K+=4,M.copy(G,K),K+=ee),qi(G,I,K),K+=4,s.pubkey.copy(G,K),K+=I,qi(G,N,K),K+=4,t.pubkey.copy(G,K),K+=N,qi(G,Z,K),K+=4,t.secret.copy(G,K),s.exchangeHash=S.update(G).digest();var D=Zl(t.sig,t.sig._pos,e);if(D===!1||!(D=tyi(D,t.sig_format,e)))return!1;var $=X$d(t.hostkey,t.sig_format);if($ instanceof Error)return!1;if(o("DEBUG: Verifying signature"),$.verify(s.exchangeHash,D)!==!0){o("DEBUG: Signature verification failed"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature verification failed");return m.level="handshake",e.emit("error",m),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,o("DEBUG: Outgoing: Writing NEWKEYS"),s.status===E6?ld(e,Kur,void 0,!0):ld(e,Kur),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&ayi(e)}a(iyi,"onKEXDH_REPLY");function ayi(e){var t=e._state,r=t.outgoing,n=t.incoming;if(n.expectedPacket=void 0,!!r.sentNEWKEYS){var i=r.kexsecret.length,s=r.encrypt.info=Vhi[r.encrypt.type],o=0,l=t.kex.hash,d=Buffer.allocUnsafe(4+i),u,m;if(t.authsQueue=[],qi(d,i,o),o+=4,r.kexsecret.copy(d,o),r.kexsecret=void 0,s.stream)u=Wur;else{for(u=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();u.length<s.ivLen;)u=Buffer.concat([u,wp.createHash(l).update(d).update(r.exchangeHash).update(u).digest()]);u.length>s.ivLen&&(u=u.slice(0,s.ivLen))}for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();m.length<s.keyLen;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);if(m.length>s.keyLen&&(m=m.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=u,r.encrypt.key=m,r.encrypt.instance=!0;else{var g=zJ[r.encrypt.type];r.encrypt.instance=wp.createCipheriv(g,m,u),r.encrypt.instance.setAutoPadding(!1)}var h=n.decrypt.info=Vhi[n.decrypt.type];if(h.stream)u=Wur;else{for(u=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();u.length<h.ivLen;)u=Buffer.concat([u,wp.createHash(l).update(d).update(r.exchangeHash).update(u).digest()]);u.length>h.ivLen&&(u=u.slice(0,h.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(h.blockLen),m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();m.length<h.keyLen;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>h.keyLen&&(m=m.slice(0,h.keyLen));var v=zJ[n.decrypt.type];n.decrypt.instance=wp.createDecipheriv(v,m,u),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=u,n.decrypt.key=m;var S;s.discardLen>0&&(S=Buffer.alloc(s.discardLen),r.encrypt.instance.update(S)),h.discardLen>0&&((!S||S.length!==h.discardLen)&&(S=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(S));var E=r.hmac.info=Hhi[r.hmac.type],A=n.hmac.info=Hhi[n.hmac.type];if(s.authLen===0){for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();m.length<E.len;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>E.len&&(m=m.slice(0,E.len)),r.hmac.key=m}else r.hmac.key=void 0;if(h.authLen===0){for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();m.length<A.len;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>A.len&&(m=m.slice(0,A.len)),n.hmac.key=m}else n.hmac.key=void 0;var P=h.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==P)&&(n.hmac.buf=Buffer.allocUnsafe(P)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=S5.createDeflate(MJ),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=S5.createInflate(MJ):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===E6){r.status=C6;var R=r.rekeyQueue,j=R.length,I=0;for(r.rekeyQueue=[];I<j;++I)Buffer.isBuffer(R[I])?ld(e,R[I]):ld(e,R[I][0],R[I][1]);R=n.rekeyQueue,j=R.length,I=0,n.rekeyQueue=[];for(var N=n.seqno;I<j;++I)if(n.seqno=R[I][0],n.payload=R[I][1],syi(e)===!1||n.status===qJ)return;n.seqno=N}else r.status=C6,n.status===Vur&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+h.blockLen+")"),w5(e,NJ,h.blockLen,n.decrypt.buf)),e.emit("ready")}}a(ayi,"onNEWKEYS");function zWe(e,t){var r=e._state.kex;if(r)switch(t){case 30:return r.pktInit;case 31:switch(r.type){case"group":return"KEXDH_REPLY";case"groupex":return"KEXDH_GEX_GROUP";default:return"KEXECDH_REPLY"}break;case 33:if(r.type==="groupex")return"KEXDH_GEX_REPLY"}return Ws[t]}a(zWe,"getPacketType");function syi(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,o,l,d,u,m,g,h,v,S,E,A,P,R,j;if(++r.seqno>Jur&&(r.seqno=0),r.ignoreNext){e.debug("DEBUG: Parser: Packet ignored"),r.ignoreNext=!1;return}var I=i[0];if(I===void 0)return!1;if(n.status!==C6&&zWe(e,I)!==r.expectedPacket&&I<1&&I>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+zWe(e,I)),e.disconnect(wh.PROTOCOL_ERROR);var N=new Error("Received unexpected packet");return N.level="protocol",e.emit("error",N),!1}if(I===Ws.CHANNEL_DATA){if(m=Rf(i,1,e,t),m===!1||(g=Zl(i,5,e,t,32768),g===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+m+")"),e.emit("CHANNEL_DATA:"+m,g)}else if(I===Ws.CHANNEL_EXTENDED_DATA){if(m=Rf(i,1,e,t),m===!1)return!1;var Z=Rf(i,5,e,t);if(Z===!1||(g=Zl(i,9,e,t),g===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+m+")"),e.emit("CHANNEL_EXTENDED_DATA:"+m,Z,g)}else if(I===Ws.CHANNEL_WINDOW_ADJUST){if(m=Rf(i,1,e,t),m===!1)return!1;var Y=Rf(i,5,e,t);if(Y===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+m+", "+Y+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+m,Y)}else if(I===Ws.CHANNEL_SUCCESS){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+m+")"),e.emit("CHANNEL_SUCCESS:"+m)}else if(I===Ws.CHANNEL_FAILURE){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+m+")"),e.emit("CHANNEL_FAILURE:"+m)}else if(I===Ws.CHANNEL_EOF){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+m+")"),e.emit("CHANNEL_EOF:"+m)}else if(I===Ws.CHANNEL_OPEN){var J=Zl(i,1,"ascii",e,t);if(J===!1||(S=Rf(i,i._pos,e,t),S===!1)||(E=Rf(i,i._pos+=4,e,t),E===!1)||(A=Rf(i,i._pos+=4,e,t),A===!1))return!1;var ee;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+S+", "+J+")"),J==="forwarded-tcpip"||J==="direct-tcpip"){var V=Zl(i,i._pos+=4,"ascii",e,t);if(V===!1)return!1;var M=Rf(i,i._pos,e,t);if(M===!1||(h=Zl(i,i._pos+=4,"ascii",e,t),h===!1)||(v=Rf(i,i._pos,e,t),v===!1))return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{destIP:V,destPort:M,srcIP:h,srcPort:v}}}else if(J==="forwarded-streamlocal@openssh.com"||J==="direct-streamlocal@openssh.com"){if(j=Zl(i,i._pos+=4,"utf8",e,t),j===!1)return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{socketPath:j}}}else if(J==="x11"){if(h=Zl(i,i._pos+=4,"ascii",e,t),h===!1||(v=Rf(i,i._pos,e,t),v===!1))return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{srcIP:h,srcPort:v}}}else ee={type:J,sender:S,window:E,packetSize:A,data:{}};e.emit("CHANNEL_OPEN",ee)}else if(I===Ws.CHANNEL_OPEN_CONFIRMATION){if(P=Rf(i,1,e,t),P===!1||(S=Rf(i,5,e,t),S===!1)||(E=Rf(i,9,e,t),E===!1)||(A=Rf(i,13,e,t),A===!1))return!1;u={recipient:P,sender:S,window:E,packetSize:A},i.length>17&&(u.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+u.recipient,u)}else if(I===Ws.CHANNEL_OPEN_FAILURE){if(P=Rf(i,1,e,t),P===!1)return!1;var re=Rf(i,5,e,t);if(re===!1||(R=Zl(i,9,"utf8",e,t),R===!1)||(l=Zl(i,i._pos,"utf8",e,t),l===!1))return!1;i._pos=9,u={recipient:P,reasonCode:re,reason:J$d[re],description:R,lang:l},e.emit("CHANNEL_OPEN_FAILURE:"+u.recipient,u)}else if(I===Ws.CHANNEL_CLOSE){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+m+")"),e.emit("CHANNEL_CLOSE:"+m)}else if(I!==Ws.IGNORE){if(I===Ws.DISCONNECT){var K=Rf(i,1,e,t);if(K===!1)return!1;var G=wh[K];if(R=Zl(i,5,"utf8",e,t),R===!1)return!1;i._pos<i.length&&(l=Zl(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+G+")"),e.emit("DISCONNECT",G,K,R,l)}else if(I===Ws.DEBUG){if(d=Zl(i,2,"utf8",e,t),d===!1||(l=Zl(i,i._pos,"ascii",e,t),l===!1))return!1;e.emit("DEBUG",d,l)}else if(I===Ws.NEWKEYS)e.emit("NEWKEYS");else if(I===Ws.SERVICE_REQUEST){if(o=Zl(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_REQUEST",o)}else if(I===Ws.SERVICE_ACCEPT){if(o=Zl(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_ACCEPT",o)}else if(I===Ws.USERAUTH_REQUEST){var D=Zl(i,1,"utf8",e,t);if(D===!1)return!1;var $=Zl(i,i._pos,"ascii",e,t);if($===!1)return!1;var O=Zl(i,i._pos,"ascii",e,t);if(O===!1)return!1;var L,z;if(O==="password"){if(L=Zl(i,i._pos+1,"utf8",e,t),L===!1)return!1}else if(O==="publickey"||O==="hostbased"){var te,F,ie,se,fe,H,ge;if(O==="publickey"){if(te=i[i._pos++],te===void 0)return!1;te=te!==0}if(F=Zl(i,i._pos,"ascii",e,t),F===!1||(ie=Zl(i,i._pos,e,t),ie===!1))return!1;if(te||O==="hostbased"){if(O==="hostbased"&&(H=Zl(i,i._pos,"ascii",e,t),H===!1||(ge=Zl(i,i._pos,"utf8",e,t),ge===!1)))return!1;var Pe=i._pos;if(se=Zl(i,Pe,e,t),se===!1||(se.length>4+F.length+4&&se.toString("ascii",4,4+F.length)===F&&(se=se.slice(4+F.length+4)),se=tyi(se,F,e,t),se===!1))return!1;fe=Buffer.allocUnsafe(4+n.sessionId.length+Pe),qi(fe,n.sessionId.length,0),n.sessionId.copy(fe,4),i.copy(fe,4+n.sessionId.length,0,Pe)}else z="publickey -- check";L={keyAlgo:F,key:ie,signature:se,blob:fe,localHostname:H,localUsername:ge}}else if(O==="keyboard-interactive"){var ue=Rf(i,i._pos,e,t);if(ue===!1||(L=Zl(i,i._pos+4+ue,"utf8",e,t),L===!1))return!1}else O!=="none"&&(L=i.slice(i._pos));z===void 0&&(z=O),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+z+")"),e._state.authsQueue.push(O),e.emit("USERAUTH_REQUEST",D,$,O,L)}else if(I===Ws.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=S5.createDeflate(MJ),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=S5.createInflate(MJ)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(I===Ws.USERAUTH_FAILURE){var U=Zl(i,1,"ascii",e,t);if(U===!1)return!1;var xe=i[i._pos];if(xe===void 0)return!1;xe=xe!==0,U=U.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",U,xe)}else if(I===Ws.USERAUTH_BANNER){if(d=Zl(i,1,"utf8",e,t),d===!1||(l=Zl(i,i._pos,"utf8",e,t),l===!1))return!1;e.emit("USERAUTH_BANNER",d,l)}else if(I===Ws.GLOBAL_REQUEST){var W=Zl(i,1,"ascii",e,t);if(W===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+W+")");var X=i[i._pos++];if(X===void 0)return!1;X=X!==0;var ae;if(W==="tcpip-forward"||W==="cancel-tcpip-forward"){var pe=Zl(i,i._pos,"ascii",e,t);if(pe===!1)return!1;var Re=Rf(i,i._pos,e,t);if(Re===!1)return!1;ae={bindAddr:pe,bindPort:Re}}else if(W==="streamlocal-forward@openssh.com"||W==="cancel-streamlocal-forward@openssh.com"){if(j=Zl(i,i._pos,"utf8",e,t),j===!1)return!1;ae={socketPath:j}}else W==="no-more-sessions@openssh.com"||(ae=i.slice(i._pos));e.emit("GLOBAL_REQUEST",W,X,ae)}else if(I===Ws.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(I===Ws.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(I!==Ws.UNIMPLEMENTED){if(I===Ws.KEXINIT)return g8d(e,t);if(I===Ws.CHANNEL_REQUEST)return _8d(e,t);if(I>=30&&I<=49)return h8d(e,I,t);if(I>=60&&I<=70)return y8d(e,I,t);var He=Buffer.allocUnsafe(5);He[0]=Ws.UNIMPLEMENTED,qi(He,s,1),ld(e,He)}}}a(syi,"parsePacket");function g8d(e,t){var r=e._state.incoming,n=r.payload,i={algorithms:{kex:void 0,srvHostKey:void 0,cs:{encrypt:void 0,mac:void 0,compress:void 0},sc:{encrypt:void 0,mac:void 0,compress:void 0}},languages:{cs:void 0,sc:void 0}},s;if(s=Wq(n,17,e,t),s===!1||(i.algorithms.kex=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=Wq(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=Wq(n,n._pos,e,t),s===!1))return!1;i.languages.sc=s;var o=n._pos<n.length&&n[n._pos]===1;r.kexinit=n,e.emit("KEXINIT",i,o)}a(g8d,"parse_KEXINIT");function h8d(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===C6||zWe(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+zWe(e,t)),e.disconnect(wh.PROTOCOL_ERROR);var o=new Error("Received unexpected packet");return o.level="protocol",e.emit("error",o),!1}if(n.kex.type==="groupex"){if(e.server){e.disconnect(wh.PROTOCOL_ERROR);var o=new Error("DH group exchange not supported by server");return o.level="handshake",e.emit("error",o),!1}else if(t===Ws.KEXDH_GEX_GROUP){var l=Zl(s,1,e,r);if(l===!1)return!1;var d=Zl(s,s._pos,e,r);if(d===!1)return!1;e.emit("KEXDH_GEX_GROUP",l,d)}else if(t===Ws.KEXDH_GEX_REPLY)return Qhi(e,r)}else if(t===Ws.KEXDH_INIT){var u=Zl(s,1,e,r);if(u===!1)return!1;e.emit("KEXDH_INIT",u)}else if(t===Ws.KEXDH_REPLY)return Qhi(e,r)}a(h8d,"parse_KEX");function Qhi(e,t){var r=e._state.incoming.payload,n=Zl(r,1,e,t);if(n===!1)return!1;var i=Zl(r,r._pos,e,t);if(i===!1)return!1;var s=Zl(r,r._pos,e,t);if(s===!1)return!1;var o={hostkey:n,hostkey_format:void 0,pubkey:i,sig:s,sig_format:void 0},l=Zl(n,0,"ascii",e,t);if(l===!1)return!1;o.hostkey_format=l;var d=Zl(s,0,"ascii",e,t);if(d===!1)return!1;o.sig_format=d,e.emit("KEXDH_REPLY",o)}a(Qhi,"parse_KEXDH_REPLY");function y8d(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,o,l,d;if(i==="password"){if(t===Ws.USERAUTH_PASSWD_CHANGEREQ){if(o=Zl(s,1,"utf8",e,r),o===!1||(l=Zl(s,s._pos,"utf8",e,r),l===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",o,l)}}else if(i==="keyboard-interactive"){if(t===Ws.USERAUTH_INFO_REQUEST){var u,m,g;if(u=Zl(s,1,"utf8",e,r),u===!1||(m=Zl(s,s._pos,"utf8",e,r),m===!1)||(l=Zl(s,s._pos,"utf8",e,r),l===!1)||(g=Rf(s,s._pos,e,r),g===!1))return!1;s._pos+=4;for(var h=[],v=0;v<g;++v){if(d=Zl(s,s._pos,"utf8",e,r),d===!1)return!1;var S=s[s._pos++];if(S===void 0)return!1;S=S!==0,h.push({prompt:d,echo:S})}e.emit("USERAUTH_INFO_REQUEST",u,m,l,h)}else if(t===Ws.USERAUTH_INFO_RESPONSE){var E=Rf(s,1,e,r);if(E===!1)return!1;s._pos=5;for(var A=[],P=0;P<E;++P){if(d=Zl(s,s._pos,"utf8",e,r),d===!1)return!1;A.push(d)}e.emit("USERAUTH_INFO_RESPONSE",A)}}else if(i==="publickey"){if(t===Ws.USERAUTH_PK_OK){var R=e._state.authsQueue;if(!R.length||R[0]!=="publickey")return;R.shift(),e.emit("USERAUTH_PK_OK")}}else if(i!==void 0){e.disconnect(wh.PROTOCOL_ERROR);var j=new Error("Invalid authentication method: "+i);j.level="protocol",e.emit("error",j)}}a(y8d,"parse_USERAUTH");function _8d(e,t){var r=e._state.incoming.payload,n,i,s,o,l,d,u,m=Rf(r,1,e,t);if(m===!1)return!1;var g=Zl(r,5,"ascii",e,t);if(g===!1)return!1;if(g==="exit-status"){var h=Rf(r,++r._pos,e,t);if(h===!1)return!1;n={recipient:m,request:g,wantReply:!1,code:h}}else if(g==="exit-signal"){var v;if(e.remoteBugs&jWe.OLD_EXIT){if(u=Rf(r,++r._pos,e,t),u===!1)return!1;switch(u){case 1:u="HUP";break;case 2:u="INT";break;case 3:u="QUIT";break;case 6:u="ABRT";break;case 9:u="KILL";break;case 14:u="ALRM";break;case 15:u="TERM";break;default:u="UNKNOWN ("+u+")"}v=!1}else{if(u=Zl(r,++r._pos,"ascii",e,t),u===!1||(v=r[r._pos++],v===void 0))return!1;v=v!==0}var S=Zl(r,r._pos,"utf8",e,t);if(S===!1)return!1;var E=Zl(r,r._pos,"utf8",e,t);if(E===!1)return!1;n={recipient:m,request:g,wantReply:!1,signal:u,coredump:v,description:S,lang:E}}else if(g==="pty-req"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var A=Zl(r,r._pos,"ascii",e,t);if(A===!1||(i=Rf(r,r._pos,e,t),i===!1)||(s=Rf(r,r._pos+=4,e,t),s===!1)||(o=Rf(r,r._pos+=4,e,t),o===!1)||(l=Rf(r,r._pos+=4,e,t),l===!1))return!1;var P=Zl(r,r._pos+=4,e,t);if(P===!1)return!1;P=w8d(P),n={recipient:m,request:g,wantReply:d,term:A,cols:i,rows:s,width:o,height:l,modes:P}}else if(g==="window-change"){if(i=Rf(r,++r._pos,e,t),i===!1||(s=Rf(r,r._pos+=4,e,t),s===!1)||(o=Rf(r,r._pos+=4,e,t),o===!1)||(l=Rf(r,r._pos+=4,e,t),l===!1))return!1;n={recipient:m,request:g,wantReply:!1,cols:i,rows:s,width:o,height:l}}else if(g==="x11-req"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var R=r[r._pos++];if(R===void 0)return!1;R=R!==0;var j=Zl(r,r._pos,"ascii",e,t);if(j===!1)return!1;var I=Zl(r,r._pos,"binary",e,t);if(I===!1)return!1;var N=Rf(r,r._pos,e,t);if(N===!1)return!1;n={recipient:m,request:g,wantReply:d,single:R,protocol:j,cookie:I,screen:N}}else if(g==="env"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var Z=Zl(r,r._pos,"utf8",e,t);if(Z===!1)return!1;var Y=Zl(r,r._pos,"utf8",e,t);if(Y===!1)return!1;n={recipient:m,request:g,wantReply:d,key:Z,val:Y}}else if(g==="shell"){if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}else if(g==="exec"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var J=Zl(r,r._pos,"utf8",e,t);if(J===!1)return!1;n={recipient:m,request:g,wantReply:d,command:J}}else if(g==="subsystem"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var ee=Zl(r,r._pos,"utf8",e,t);if(ee===!1)return!1;n={recipient:m,request:g,wantReply:d,subsystem:ee}}else if(g==="signal"){if(u=Zl(r,++r._pos,"ascii",e,t),u===!1)return!1;n={recipient:m,request:g,wantReply:!1,signal:"SIG"+u}}else if(g==="xon-xoff"){var V=r[++r._pos];if(V===void 0)return!1;V=V!==0,n={recipient:m,request:g,wantReply:!1,clientControl:V}}else if(g==="auth-agent-req@openssh.com"){if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}else{if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+m+", "+g+")"),e.emit("CHANNEL_REQUEST:"+m,n)}a(_8d,"parse_CHANNEL_REQUEST");function v8d(e,t){var r=e._state.incoming,n=r.hmac;if(e.debug("DEBUG: Parser: Verifying MAC"),r.decrypt.info.authLen>0){var i=r.decrypt,s=i.instance;s.setAuthTag(t);var o=s.update(r.packet);return r.payload=o.slice(1,r.packet.length-o[0]),eyi(i.iv),i.instance=wp.createDecipheriv(zJ[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var l=wp.createHmac(zJ[n.type],n.key);qi(qWe,r.seqno,0),qi(qWe,r.pktLen,4),qWe[8]=r.padLen,l.update(qWe),l.update(r.packet);var d=l.digest();return d.length>r.hmac.info.actualLen&&(d=d.slice(0,r.hmac.info.actualLen)),P8d(d,t)}}a(v8d,"hmacVerify");function Yhi(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}a(Yhi,"decryptData");function w5(e,t,r,n){var i=e._state.incoming.expect;i.amount=r,i.type=t,i.ptr=0,n?i.buf=n:r&&(i.buf=Buffer.allocUnsafe(r))}a(w5,"expectData");function Wq(e,t,r,n){var i=Zl(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}a(Wq,"readList");function w8d(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===LJ.TTY_OP_END||LJ[i]===void 0||r+5>n));r+=5)t[LJ[i]]=Xur(e,r+1);return t}a(w8d,"bytesToModes");function S8d(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,o=r.length,l,d,u;s<o;++s)l=r[s],d=LJ[l],d&&!t.test(l)&&typeof e[l]=="number"&&l!=="TTY_OP_END"&&(u=e[l],i[n++]=d,i[n++]=u>>>24&255,i[n++]=u>>>16&255,i[n++]=u>>>8&255,i[n++]=u&255);return i[n]=LJ.TTY_OP_END,i}a(S8d,"modesToBytes");function Zur(e,t){return x8d(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&jWe.BAD_DHGEX){for(var s=!1,o=n.kex,l=o.length-1;l>=0;--l)o[l].indexOf("group-exchange")!==-1&&(s||(o=o.slice(),s=!0),o.splice(l,1));s&&(i=Buffer.from(o.join(",")))}var d=n.serverHostKeyBuf,u=1+16+4+i.length+4+d.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,m=Buffer.allocUnsafe(u),g=17;m[0]=Ws.KEXINIT,r!==!1&&r.copy(m,1),qi(m,i.length,g),g+=4,i.copy(m,g),g+=i.length,qi(m,d.length,g),g+=4,d.copy(m,g),g+=d.length,qi(m,n.cipherBuf.length,g),g+=4,n.cipherBuf.copy(m,g),g+=n.cipherBuf.length,qi(m,n.cipherBuf.length,g),g+=4,n.cipherBuf.copy(m,g),g+=n.cipherBuf.length,qi(m,n.hmacBuf.length,g),g+=4,n.hmacBuf.copy(m,g),g+=n.hmacBuf.length,qi(m,n.hmacBuf.length,g),g+=4,n.hmacBuf.copy(m,g),g+=n.hmacBuf.length,qi(m,n.compressBuf.length,g),g+=4,n.compressBuf.copy(m,g),g+=n.compressBuf.length,qi(m,n.compressBuf.length,g),g+=4,n.compressBuf.copy(m,g),g+=n.compressBuf.length,m.fill(0,m.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var h=e._state.outgoing;h.kexinit=m,h.status===C6&&(h.status=E6),ld(e,m,t,!0)}),!0}a(Zur,"KEXINIT");function oyi(e){var t=e._state,r=t.outgoing,n=Buffer.allocUnsafe(1+4+r.pubkey.length);return t.incoming.expectedPacket=t.kex.pktReply,t.kex.type==="groupex"?(n[0]=Ws.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=Ws.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),qi(n,r.pubkey.length,1),r.pubkey.copy(n,5),ld(e,n,void 0,!0)}a(oyi,"KEXDH_INIT");function b8d(e,t){var r=e._state,n=r.outgoing,i=r.incoming,s=e.config.hostKeys[r.hostkeyFormat];Array.isArray(s)&&(s=s[0]);var o=s.getPublicSSH(),l=s.type;t=r.kex.convertPublicKey(t);var d=r.kex.computeSecret(t);if(d instanceof Error)return d.message="Error while computing DH secret ("+r.kex.type+"): "+d.message,d.level="handshake",e.emit("error",d),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var u=wp.createHash(r.kex.hash),m=Buffer.byteLength(i.identRaw),g=Buffer.byteLength(e.config.ident),h=i.kexinit.length,v=n.kexinit.length,S=o.length,E=t.length,A=n.pubkey.length,P=d.length,R=m+g+h+v+S+E+A+P+4*8,j,I,N,Z,Y=r.kex.getDHParams();Y&&(N=Y.prime,Z=Y.generator,j=N.length,I=Z.length,R+=4*3,R+=4*2,R+=j,R+=I);var J=0,ee=Buffer.allocUnsafe(R);qi(ee,m,J),J+=4,ee.write(i.identRaw,J,"utf8"),J+=m,qi(ee,g,J),J+=4,ee.write(e.config.ident,J,"utf8"),J+=g,qi(ee,h,J),J+=4,i.kexinit.copy(ee,J),J+=h,i.kexinit=void 0,qi(ee,v,J),J+=4,n.kexinit.copy(ee,J),J+=v,n.kexinit=void 0,qi(ee,S,J),J+=4,o.copy(ee,J),J+=S,Y&&(Yur.slice(1).copy(ee,J),J+=4*3,qi(ee,j,J),J+=4,N.copy(ee,J),J+=j,qi(ee,I,J),J+=4,Z.copy(ee,J),J+=I),qi(ee,E,J),J+=4,t.copy(ee,J),J+=E,qi(ee,A,J),J+=4,n.pubkey.copy(ee,J),J+=A,qi(ee,P,J),J+=4,d.copy(ee,J),n.exchangeHash=u.update(ee).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=d;var V=s.sign(n.exchangeHash);if(V instanceof Error)return V.message="Error while signing data with host key ("+l+"): "+V.message,V.level="handshake",e.emit("error",V),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;if(V=emr(V,l),V===!1)return V.message="Error while converting handshake signature",V.level="handshake",e.emit("error",V),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var M=4+l.length+4+V.length,re=Buffer.allocUnsafe(1+4+S+4+A+4+M);return J=0,re[J]=Ws[r.kex.pktReply],++J,qi(re,S,J),J+=4,o.copy(re,J),J+=S,qi(re,A,J),J+=4,n.pubkey.copy(re,J),J+=A,qi(re,M,J),J+=4,qi(re,l.length,J),J+=4,re.write(l,J,l.length,"ascii"),J+=l.length,qi(re,V.length,J),J+=4,V.copy(re,J),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),ld(e,re,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),ld(e,Kur,void 0,!0)}a(b8d,"KEXDH_REPLY");function C8d(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),ld(e,Yur,void 0,!0)}a(C8d,"KEXDH_GEX_REQ");function cyi(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(Qur,E8d.bind(e,r))}a(cyi,"compressPayload");function E8d(e){if(!(this._readableState.ended||this._writableState.ended)){lyi(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&cyi(this,t[0][0],t[0][1])}}a(E8d,"compressFlushCb");function ld(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===E6&&!n)return typeof r=="function"?s.rekeyQueue.push([t,r]):s.rekeyQueue.push(t),!1;if(e._readableState.ended||e._writableState.ended)return!1;if(s.compress.instance){var o=s.compress.queue;return o.push([t,r]),o.length===1&&cyi(e,o[0][0],o[0][1]),!0}else return lyi(e,t,r)}a(ld,"send");function lyi(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,o=i.hmac,l,d,u,m,g;if(l=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var h=1+t.length+4;h%s.info.blockLen!==0;)++h;d=h-1-t.length,l=4+h}else{var v=s.info.blockLen;l+=(v-1)*l%v,d=l-t.length-5}else l+=7*l%8,d=l-t.length-5;u=Buffer.allocUnsafe(l),qi(u,l-4,0),u[4]=d,t.copy(u,5),A8d(u,5+t.length,d),o.type!==!1&&o.key&&(m=wp.createHmac(zJ[o.type],o.key),qi(i.bufSeqno,i.seqno,0),m.update(i.bufSeqno),m.update(u),m=m.digest(),m.length>o.info.actualLen&&(m=m.slice(0,o.info.actualLen)));var S=0,E;if(s.instance!==!1)if(s.info.authLen>0){var A=wp.createCipheriv(zJ[s.type],s.key,s.iv);A.setAutoPadding(!1);var P=u.slice(0,4);A.setAAD(P),e.push(P),S+=P,E=A.update(u.slice(4)),e.push(E),S+=E.length;var R=A.final();R.length&&(e.push(R),S+=R.length);var j=A.getAuthTag();g=e.push(j),S+=j.length,eyi(s.iv)}else E=s.instance.update(u),e.push(E),S+=E.length,g=e.push(m),S+=m.length;else g=e.push(u),S=u.length;return e.bytesSent+=S,++i.seqno>Jur&&(i.seqno=0),r&&r(),g}a(lyi,"send_");var A8d=function(){return typeof wp.randomFillSync=="function"?wp.randomFillSync:a(function(t,r,n){var i=wp.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function x8d(e,t){wp.randomBytes(e,a(function r(n,i){if(n)return wp.randomBytes(e,r);t&&t(i)},"retry"))}a(x8d,"randBytes");function emr(e,t){switch(t){case"ssh-dss":return W$d(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return K$d(e)}return e}a(emr,"convertSignature");var P8d=function(){return typeof wp.timingSafeEqual=="function"?a(function(t,r){return t.length!==r.length?(wp.timingSafeEqual(t,t),!1):wp.timingSafeEqual(t,r)},"timingSafeEquals"):a(function(t,r){var n;t.length===r.length?n=0:(n=1,r=t);for(var i=0,s=t.length;i<s;++i)n|=t[i]^r[i];return n===0},"timingSafeEquals")}();function b5(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!Y$d)break;this.type="25519",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp256":this.type="ecdh",this.name="prime256v1",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp384":this.type="ecdh",this.name="secp384r1",this.hash="sha384",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp521":this.type="ecdh",this.name="secp521r1",this.hash="sha512",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"diffie-hellman-group1-sha1":this.type="group",this.name="modp2",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha1":this.type="group",this.name="modp14",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha256":this.type="group",this.name="modp14",this.hash="sha256",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group16-sha512":this.type="group",this.name="modp16",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group18-sha512":this.type="group",this.name="modp18",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group-exchange-sha1":this.type="groupex",this.hash="sha1",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return;case"diffie-hellman-group-exchange-sha256":this.type="groupex",this.hash="sha256",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return}throw new Error("Unsupported key exchange algorithm: "+e)}a(b5,"KeyExchange");b5.prototype.setDHParams=function(e,t){if(this.type==="groupex"){if(!Buffer.isBuffer(e))throw new Error("Invalid prime value");if(!Buffer.isBuffer(t))throw new Error("Invalid generator value");this._prime=e,this._generator=t}};b5.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:MWe(this._kex.getPrime()),generator:MWe(this._kex.getGenerator())}};b5.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=wp.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=wp.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=wp.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=wp.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};b5.prototype.getPublicKey=function(){this.generateKeys();var e;switch(this.type){case"25519":return e=this._keys.publicKey.export({type:"spki",format:"der"}),e.slice(-32);case"ecdh":case"group":case"groupex":e=this._public;break}if(e)return this.convertPublicKey(e)};b5.prototype.convertPublicKey=function(e){for(var t,r=0,n=e.length;e[r]===0;)++r,--n;switch(this.type){case"25519":if(e.length===32)return e;break;default:if(e[r]&128)return t=Buffer.allocUnsafe(1+n),t[0]=0,e.copy(t,1,r),t}return n!==e.length&&(t=Buffer.allocUnsafe(n),e.copy(t,0,r),e=t),e};b5.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new Ghi.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(Ghi.BitString),t.writeByte(0),t._ensure(e.length),e.copy(t._buf,t._offset,0,e.length),t._offset+=e.length,t.endSequence(),t.endSequence(),MWe(wp.diffieHellman({privateKey:this._keys.privateKey,publicKey:wp.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return MWe(this._kex.computeSecret(e))}catch(r){return r}}};function MWe(e){for(var t=0,r=e.length;e[t]===0;)++t,--r;var n;return e[t]&128?(n=Buffer.allocUnsafe(1+r),n[0]=0,e.copy(n,1,t),e=n):r!==e.length&&(n=Buffer.allocUnsafe(r),e.copy(n,0,t),e=n),e}a(MWe,"convertToMpint");tmr.exports=Nd;tmr.exports._send=ld});var FWe=w((oRf,uyi)=>{uyi.exports={SFTPStream:jhi(),SSH2Stream:dyi(),utils:$q(),constants:vWe()}});var pyi=w(fyi=>{var myi=require("http").Agent,T8d=require("https").Agent,R8d=require("util").inherits,rmr;[myi,T8d].forEach(e=>{function t(r,n){if(!(this instanceof t))return new t(r,n);e.call(this,n),this._connectCfg=r,this._defaultSrcIP=n&&n.srcIP||"localhost"}a(t,"SSHAgent"),R8d(t,e),t.prototype.createConnection=D8d,fyi[e===myi?"SSHTTPAgent":"SSHTTPSAgent"]=t});function D8d(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;rmr===void 0&&(rmr=nmr().Client);var o=new rmr,l=!1;o.on("ready",()=>{o.forwardOut(r,n,i,s,(d,u)=>{if(l=!0,d)return o.end(),t(d);u.once("close",()=>{o.end()}),t(null,k8d(u))})}).on("error",t).on("close",()=>{l||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}a(D8d,"createConnection");function Fce(){}a(Fce,"noop");function k8d(e){return e.setKeepAlive=Fce,e.setNoDelay=Fce,e.setTimeout=Fce,e.ref=Fce,e.unref=Fce,e.destroySoon=e.destroy,e}a(k8d,"decorateStream")});var amr=w((lRf,vyi)=>{var gyi=require("util").inherits,hyi=require("stream").Duplex,I8d=require("stream").Readable,yyi=require("stream").Writable,N8d=FWe().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,L8d=32*1024,Uce=2*1024*1024,UWe=Uce/2,_yi=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],q8d=_yi.length;function MR(e,t,r){var n={highWaterMark:Uce,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,hyi.call(this,n);var i=this,s=r&&r.server;this.server=s,this.type=e.type,this.subtype=void 0;var o=this.incoming=e.incoming,l=o.id,d=this.outgoing=e.outgoing,u=this._callbacks=[],m,g,h,v,S;this._client=t,this._hasX11=!1;var E=t._channels,A=t._sshstream;function P(){i._waitClientDrain&&(i._waitClientDrain=!1,i._waitWindow||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}a(P,"ondrain"),t._sock.on("drain",P),A.once("CHANNEL_EOF:"+l,function(){o.state==="open"&&(o.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+l,function(){if(o.state!=="closed"){o.state="closed",i.readable&&i.push(null),s&&i.stderr.writable?i.stderr.end():!s&&i.stderr.readable&&i.stderr.push(null),(d.state==="open"||d.state==="eof")&&i.close(),d.state==="closing"&&(d.state="closed"),delete E[l];var I=i._writableState;t._sock.removeListener("drain",P),!I.ending&&!I.finished&&i.end(),i._callbacks=[];for(var N=0;N<u.length;++N)u[N](!0);u=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){m===null?i.emit("close",m,g,h,v,S):i.emit("close",m)}):m===null?i.emit("close",m,g,h,v,S):i.emit("close",m),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var N=0;N<q8d;++N)A.removeAllListeners(_yi[N]+":"+l)}}).on("CHANNEL_DATA:"+l,function(I){if(o.window!==0){if(o.window-=I.length,!i.push(I)){i._waitChanDrain=!0;return}o.window<=UWe&&BWe(i)}}).on("CHANNEL_WINDOW_ADJUST:"+l,function(I){d.window+=I,i._waitWindow&&(i._waitWindow=!1,i._waitClientDrain||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}).on("CHANNEL_SUCCESS:"+l,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),u.length&&u.shift()(!1)}).on("CHANNEL_FAILURE:"+l,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),u.length&&u.shift()(!0)}).on("CHANNEL_REQUEST:"+l,function(I){if(!s){if(I.request==="exit-status"){i.emit("exit",m=I.code);return}else if(I.request==="exit-signal"){i.emit("exit",m=null,g="SIG"+I.signal,h=I.coredump,v=I.description,S=I.lang);return}}I.wantReply&&A.channelFailure(d.id)}),this.stdin=this.stdout=this,s?this.stderr=new imr(this):(this.stderr=new I8d(n),this.stderr._read=function(I){i._waitChanDrain&&(i._waitChanDrain=!1,o.window<=UWe&&BWe(i))},A.on("CHANNEL_EXTENDED_DATA:"+l,function(I,N){if(o.window!==0){if(o.window-=N.length,!i.stderr.push(N)){i._waitChanDrain=!0;return}o.window<=UWe&&BWe(i)}})),this._waitClientDrain=!1,this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0;function R(){i.eof(),(s||!s&&!i.allowHalfOpen)&&i.close(),i.writable=!1}a(R,"onFinish"),this.on("finish",R).on("prefinish",R);function j(){i.readable=!1}a(j,"onEnd"),this.on("end",j).on("close",j)}a(MR,"Channel");gyi(MR,hyi);MR.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};MR.prototype.close=function(){var e=!0,t=this.outgoing;return(t.state==="open"||t.state==="eof")&&(t.state="closing",e=this._client._sshstream.channelClose(t.id)),e};MR.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=UWe&&BWe(this))};MR.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,o=i.id,l=i.window,d=e.length,u=0,m,g,h;if(i.state==="open"){for(;d-u>0&&l>0;)if(h=d-u,h>l&&(h=l),h>s&&(h=s),m=n.channelData(o,e.slice(u,u+h)),u+=h,l-=h,!m){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=l,d-u>0){l===0&&(this._waitWindow=!0),u>0?(g=Buffer.allocUnsafe(d-u),e.copy(g,0,u),this._chunk=g):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};MR.prototype.destroy=function(){this.end()};MR.prototype.setWindow=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&(this.subtype==="shell"||this.subtype==="exec")&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.windowChange(this.outgoing.id,e,t,r,n):!0};MR.prototype.signal=function(e){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.signal(this.outgoing.id,e):!0};MR.prototype.exit=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?typeof e=="number"?this._client._sshstream.exitStatus(this.outgoing.id,e):this._client._sshstream.exitSignal(this.outgoing.id,e,t,r):!0};MR.MAX_WINDOW=Uce;MR.PACKET_SIZE=L8d;function BWe(e){if(e.outgoing.state==="closed")return!0;var t=Uce-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}a(BWe,"windowAdjust");function imr(e){yyi.call(this,{highWaterMark:Uce}),this._channel=e}a(imr,"ServerStderr");gyi(imr,yyi);imr.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,o=s.packetSize,l=s.id,d=s.window,u=e.length,m=0,g,h,v;if(n.outgoing.state==="open"){for(;u-m>0&&d>0;)if(v=u-m,v>d&&(v=d),v>o&&(v=o),g=i.channelExtData(l,e.slice(m,m+v),N8d),m+=v,d-=v,!g){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=d,u-m>0){d===0&&(n._waitWindow=!0),m>0?(h=Buffer.allocUnsafe(u-m),e.copy(h,0,m),n._chunkErr=h):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};vyi.exports=MR});var jJ=w((dRf,wyi)=>{wyi.exports={readUInt32BE:a(function(t,r){return t[r++]*16777216+t[r++]*65536+t[r++]*256+t[r]},"readUInt32BE"),writeUInt32BE:a(function(t,r,n){return t[n++]=r>>>24,t[n++]=r>>>16,t[n++]=r>>>8,t[n++]=r,n},"writeUInt32BE"),writeUInt32LE:a(function(t,r,n){return t[n++]=r,t[n++]=r>>>8,t[n++]=r>>>16,t[n++]=r>>>24,n},"writeUInt32LE")}});var Lyi=w((uRf,Nyi)=>{var Syi=require("net").Socket,z8d=require("events").EventEmitter,M8d=require("util").inherits,O8d=require("path"),byi=require("fs"),kyi=require("child_process"),Iyi=jJ().readUInt32BE,$We=jJ().writeUInt32BE,Cyi=jJ().writeUInt32LE,j8d=11,F8d=12,U8d=13,B8d=14,$8d=5,G8d=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,V8d=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;Nyi.exports=function(e,t,r,n,i){var s,o,l,d,u=0,m=Buffer.isBuffer(t),g,h=0,v=0,S=0,E,A=0,P=!1,R,j;typeof t=="function"&&typeof r=="function"?(R=t,j=r):m?(u=t.length,d=n.length):(i=t,t=void 0);function I(){var V;if(m){var M=9;V=Buffer.allocUnsafe(4+1+4+u+4+d+4),$We(V,V.length-4,0),V[4]=U8d,$We(V,u,5),t.copy(V,M),$We(V,d,M+=u),n.copy(V,M+=4),$We(V,0,M+=d),s.write(V)}else s.write(Buffer.from([0,0,0,1,j8d]))}a(I,"onconnect");function N(V){for(var M=0,re=V.length;M<re;++M)if(g===void 0)++h===5&&(g=V[M],h=0);else if(g===B8d){if(!l)v<<=8,v+=V[M],++h===4&&(l=Buffer.allocUnsafe(v),h=0);else if(l[h]=V[M],++h===v)return s.removeAllListeners("data"),s.destroy()}else if(g===F8d)if(E===void 0){if(S<<=8,S+=V[M],++h===4&&(E=new Array(S),h=0,S===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)u<<=8,u+=V[M],++h===4&&(t=Buffer.allocUnsafe(u),h=0);else if(P===!1){if(t[h]=V[M],++h===u&&(E[S-1]=t,u=0,h=0,P=!0,--S===0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else P===!0?(A<<=8,A+=V[M],++h===4&&(h=0,A>0?P=A:(t=void 0,P=!1),A=0)):++h===P&&(P=!1,h=0,t=void 0);else if(g===$8d)return m?o=new Error("Agent unable to sign data"):o=new Error("Unable to retrieve list of keys from agent"),s.removeAllListeners("data"),s.destroy()}a(N,"ondata");function Z(V){o=V}a(Z,"onerror");function Y(){o?i(o):m&&!l||!m&&!E?i(new Error("Unexpected disconnection from agent")):m&&l?i(void 0,l):!m&&E&&i(void 0,E)}if(a(Y,"onclose"),process.platform==="win32"&&!V8d.test(e))if(e==="pageant")s=new H8d;else{var J=!1;byi.readFile(e,a(function V(M,re){if(M){if(J)return i(new Error("Invalid cygwin unix socket path"));kyi.exec('cygpath -w "'+e+'"',function(ue,U,xe){if(ue||U.length===0)return i(new Error("Invalid cygwin unix socket path"));J=!0,e=U.toString().replace(/[\r\n]/g,""),byi.readFile(e,V)});return}var K;if(K=G8d.exec(re.toString("ascii"))){let ue=function(){L=0,O="secret",s.write($)},U=function(X){L+=X.length,O==="secret"?L===16&&(L=0,O="creds",s.write(F)):O==="creds"&&(z||te.push(X),L===12&&(s.removeListener("connect",ue),s.removeListener("data",U),s.removeListener("close",xe),z?(ee(),s.emit("connect")):(z=!0,F=Buffer.concat(te),Cyi(F,process.pid,0),s.destroy(),W())))},xe=function(){i(new Error("Problem negotiating cygwin unix socket security"))},W=function(){s=new Syi,s.once("connect",ue),s.on("data",U),s.once("close",xe),s.connect(G)};var fe=ue,H=U,ge=xe,Pe=W;a(ue,"_onconnect"),a(U,"_ondata"),a(xe,"_onclose"),a(W,"tryConnect");var G,D,$,O,L=0,z=!1,te=[],F=Buffer.allocUnsafe(12),ie,se;for(F.fill(0),G=parseInt(K[1],10),D=K[2].replace(/\-/g,""),$=Buffer.allocUnsafe(16),ie=0,se=0;se<32;++ie,se+=2)$[ie]=parseInt(D.substring(se,se+2),16);for(ie=0;ie<16;ie+=4)Cyi($,Iyi($,ie),ie);W()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new Syi;function ee(){if(!R&&!j)s.once("connect",I),s.on("data",N),s.once("error",Z),s.once("close",Y);else{var V;s.once("connect",function(){V=R();var M=!1;function re(){M||(s.destroy(),M=!0)}a(re,"onDone"),V.once("end",re).once("close",re).on("data",function(K){s.write(K)}),s.on("data",function(K){V.write(K)})}),s.once("close",function(){V||j()})}}a(ee,"addSockListeners"),ee(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};H8d=e,a(e,"PageantSock"),Eyi=10,Ayi=11,xyi=12,Pyi=13,Tyi=14,Ryi=15,nj={},Dyi=O8d.resolve(__dirname,"..","util/pagent.exe"),nj[Eyi]=new Error("Invalid pagent.exe arguments"),nj[Ayi]=new Error("Pageant is not running"),nj[xyi]=new Error("pagent.exe could not create an mmap"),nj[Pyi]=new Error("pagent.exe could not set mode for stdin"),nj[Tyi]=new Error("pagent.exe could not set mode for stdout"),nj[Ryi]=new Error("pagent.exe did not get expected input payload"),M8d(e,z8d),e.prototype.write=function(t){if(this.buffer===null?this.buffer=t:this.buffer=Buffer.concat([this.buffer,t],this.buffer.length+t.length),!(this.buffer.length<4)){var r=Iyi(this.buffer,0);if(!(this.buffer.length-4<r)){t=this.buffer.slice(0,4+r),this.buffer.length>4+r?this.buffer=this.buffer.slice(4+r):this.buffer=null;var n=this,i,s=!1;i=this.proc=kyi.spawn(Dyi,[t.length]),i.stdout.on("data",function(o){n.emit("data",o)}),i.once("error",function(o){s||(s=!0,n.emit("error",o))}),i.once("close",function(o){n.proc=void 0,nj[o]&&!s&&(s=!0,n.emit("error",nj[o])),n.emit("close",s)}),i.stdin.end(t)}}},e.prototype.end=e.prototype.destroy=function(){this.buffer=null,this.proc&&(this.proc.kill(),this.proc=void 0)},e.prototype.connect=function(){this.emit("connect")}}var Eyi,Ayi,xyi,Pyi,Tyi,Ryi,nj,Dyi,H8d});var Myi=w((mRf,zyi)=>{var W8d=require("util").inherits,qyi=require("events").EventEmitter;function _f(e){var t=this;qyi.call(this),this._stream=e,e.on("error",function(r){t.emit("error",r)}).on("end",function(){t.emit("end")}).on("close",function(){t.emit("close")}).on("continue",function(){t.emit("continue")})}a(_f,"SFTPWrapper");W8d(_f,qyi);_f.prototype.end=function(){return this._stream.end()};_f.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};_f.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};_f.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};_f.prototype.close=function(e,t){return this._stream.close(e,t)};_f.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};_f.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};_f.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};_f.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};_f.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};_f.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};_f.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};_f.prototype.exists=function(e,t){return this._stream.exists(e,t)};_f.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};_f.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};_f.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};_f.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};_f.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};_f.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};_f.prototype.stat=function(e,t){return this._stream.stat(e,t)};_f.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};_f.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};_f.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};_f.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};_f.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};_f.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};_f.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};_f.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};_f.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};_f.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};_f.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};_f.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};_f.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};_f.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};_f.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};_f.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};_f.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};_f.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};zyi.exports=_f});var Fyi=w((fRf,jyi)=>{function Oyi(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}a(Oyi,"spliceOne");function Bce(e,t,r){var n=this._streams=[];this._timer=void 0,this._timerInterval=e,this._timerfn=function(){for(var i=Date.now(),s=0,o=n.length,l,d;s<o;++s)if(l=n[s],d=l._kalast,d&&i-d>=t)if(++l._kacnt>r){var u=new Error("Keepalive timeout");u.level="client-timeout",l.emit("error",u),l.disconnect(),Oyi(n,s),--s,o=n.length}else l._kalast=i,l.ping()}}a(Bce,"Manager");Bce.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};Bce.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};Bce.prototype.add=function(e){var t=this._streams,r=this;e.once("end",function(){r.remove(e)}).on("packet",n),t[t.length]=e,n(),this._timer||this.start();function n(){e._kalast=Date.now(),e._kacnt=0}a(n,"resetKA")};Bce.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&Oyi(t,r),t.length||this.stop()};jyi.exports=Bce});var Wyi=w((pRf,dmr)=>{var K8d=require("net"),A6=require("events").EventEmitter,hC=A6.listenerCount,x6=require("util").inherits,VWe=FWe(),Uyi=VWe.utils.parseKey,X8d=VWe.SSH2Stream,J8d=VWe.SFTPStream,omr=VWe.constants,Gce=omr.DISCONNECT_REASON,smr=omr.CHANNEL_OPEN_FAILURE,$ce=omr.ALGORITHMS,kw=amr(),Q8d=Fyi(),Y8d=jJ().writeUInt32BE,Byi=Math.pow(2,32)-1,Z8d=10,GWe;function kv(e,t){if(!(this instanceof kv))return new kv(e,t);var r={"ssh-rsa":null,"ssh-dss":null,"ssh-ed25519":null,"ecdsa-sha2-nistp256":null,"ecdsa-sha2-nistp384":null,"ecdsa-sha2-nistp521":null},n=e.hostKeys;if(!Array.isArray(n))throw new Error("hostKeys must be an array");var i;for(i=0;i<n.length;++i){var s;if(Buffer.isBuffer(n[i])||typeof n[i]=="string"?s=Uyi(n[i]):s=Uyi(n[i].key,n[i].passphrase),s instanceof Error)throw new Error("Cannot parse privateKey: "+s.message);if(Array.isArray(s)&&(s=s[0]),s.getPrivatePEM()===null)throw new Error("privateKey value contains an invalid private key");r[s.type]||(r[s.type]=s)}var o={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0};if(typeof e.algorithms=="object"&&e.algorithms!==null){var l,d;if(d=e.algorithms.kex,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_KEX,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported key exchange algorithm: "+d[i]);o.kex=d}if(d=e.algorithms.cipher,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_CIPHER,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported cipher algorithm: "+d[i]);o.cipher=d}d=e.algorithms.serverHostKey;var u=!1;if(Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_SERVER_HOST_KEY,i=d.length-1;i>=0;--i){if(l.indexOf(d[i])===-1)throw new Error("Unsupported server host key algorithm: "+d[i]);r[d[i]]||(u||(d=d.slice(),u=!0),d.splice(i,1))}d.length>0&&(o.serverHostKey=d)}if(d=e.algorithms.hmac,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_HMAC,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported HMAC algorithm: "+d[i]);o.hmac=d}if(d=e.algorithms.compress,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_COMPRESS,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported compression algorithm: "+d[i]);o.compress=d}}if(o.serverHostKey===void 0){var m=Object.keys(r);for(i=m.length-1;i>=0;--i)r[m[i]]||m.splice(i,1);o.serverHostKey=m}!GWe&&kv.KEEPALIVE_INTERVAL>0&&kv.KEEPALIVE_CLIENT_INTERVAL>0&&kv.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(GWe=new Q8d(kv.KEEPALIVE_INTERVAL,kv.KEEPALIVE_CLIENT_INTERVAL,kv.KEEPALIVE_CLIENT_COUNT_MAX));var g=this;A6.call(this),typeof t=="function"&&g.on("connection",t);var h={algorithms:o,hostKeys:r,server:!0},v,S;for(i=0,v=Object.keys(e),S=v.length;i<S;++i){var E=v[i];E==="privateKey"||E==="publicKey"||E==="passphrase"||E==="algorithms"||E==="hostKeys"||E==="server"||(h[E]=e[E])}if(typeof h.debug=="function")var A=h.debug,P=Object.keys(h);this._srv=new K8d.Server(function(R){if(g._connections>=g.maxConnections){R.destroy();return}++g._connections,R.once("close",function(V){--g._connections,Y.read()}).on("error",function(V){Y.reset(),Y.emit("error",V)});var j=h;if(A){j={};for(var I=0,N;I<P.length;++I)N=P[I],j[N]=h[N];var Z="["+process.hrtime().join(".")+"] ";j.debug=function(V){A(Z+V)}}var Y=new X8d(j),J=new P6(Y,R);R.pipe(Y).pipe(R);function ee(V){}a(ee,"onClientPreHeaderError"),J.on("error",ee),Y.once("header",function(V){if(!Y._readableState.ended){if(!hC(g,"connection"))return Y.disconnect(Gce.BY_APPLICATION);J.removeListener("error",ee),g.emit("connection",J,{ip:R.remoteAddress,family:R.remoteFamily,port:R.remotePort,header:V})}})}).on("error",function(R){g.emit("error",R)}).on("listening",function(){g.emit("listening")}).on("close",function(){g.emit("close")}),this._connections=0,this.maxConnections=1/0}a(kv,"Server");x6(kv,A6);kv.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};kv.prototype.address=function(){return this._srv.address()};kv.prototype.getConnections=function(e){this._srv.getConnections(e)};kv.prototype.close=function(e){return this._srv.close(e),this};kv.prototype.ref=function(){this._srv.ref()};kv.prototype.unref=function(){this._srv.unref()};function P6(e,t){A6.call(this);var r=this;this._sshstream=e;var n=this._channels={};this._curChan=-1,this._sock=t,this.noMoreSessions=!1,this.authenticated=!1,e.on("end",function(){t.resume(),r.emit("end")}).on("close",function(h){r.emit("close",h)}).on("error",function(h){r.emit("error",h)}).on("drain",function(){r.emit("drain")}).on("continue",function(){r.emit("continue")});var i=0,s=!1,o=[],l;e.on("SERVICE_REQUEST",function(h){if(i===0||s||r.authenticated||h!=="ssh-userauth")return e.disconnect(Gce.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(h)}).on("USERAUTH_REQUEST",d);function d(h,v,S,E){if(i===0||l&&(l.username!==h||l.service!==v)||S!=="password"&&S!=="publickey"&&S!=="hostbased"&&S!=="keyboard-interactive"&&S!=="none"||o.length===Z8d)return e.disconnect(Gce.PROTOCOL_ERROR);if(v!=="ssh-connection")return e.disconnect(Gce.SERVICE_NOT_AVAILABLE);e._state.authMethod=S;var A;if(S==="keyboard-interactive"?A=new HWe(e,h,v,S,E,u):S==="publickey"?A=new cmr(e,h,v,S,E,u):S==="hostbased"?A=new Gyi(e,h,v,S,E,u):S==="password"?A=new Vyi(e,h,v,S,E,u):S==="none"&&(A=new AP(e,h,v,S,u)),l)if(l._initialResponse)l._multistep&&!this._finalResponse&&(l._cleanup&&l._cleanup(),l.emit("abort"));else return o.push(A);l=A,hC(r,"authentication")?r.emit("authentication",l):l.reject()}a(d,"onUSERAUTH_REQUEST");function u(h,v,S,E){l===h&&!r.authenticated&&(v?(e.removeListener("USERAUTH_REQUEST",d),l=void 0,r.authenticated=!0,e.authSuccess(),o=[],r.emit("ready")):(e.authFailure(S,E),o.length&&(l=o.pop(),hC(r,"authentication")?r.emit("authentication",l):l.reject())))}a(u,"onAuthDecide");var m=[];function g(){for(var h;m.length>0&&m[0].type;)h=m.shift(),h.type==="SUCCESS"&&e.requestSuccess(h.buf),h.type==="FAILURE"&&e.requestFailure()}a(g,"sendReplies"),e.on("GLOBAL_REQUEST",function(h,v,S){var E={type:null,buf:null};function A(I,N){E.type=I,E.buf=N,g()}if(a(A,"setReply"),v&&m.push(E),(h==="tcpip-forward"||h==="cancel-tcpip-forward"||h==="no-more-sessions@openssh.com"||h==="streamlocal-forward@openssh.com"||h==="cancel-streamlocal-forward@openssh.com")&&hC(r,"request")&&r.authenticated){var P,R;if(v){var j=!1;P=a(function(I){if(!j){j=!0;var N;h==="tcpip-forward"&&S.bindPort===0&&typeof I=="number"&&(N=Buffer.allocUnsafe(4),Y8d(N,I,0)),A("SUCCESS",N)}},"accept"),R=a(function(){j||(j=!0,A("FAILURE"))},"reject")}if(h==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,P&&P();return}r.emit("request",P,R,h,S)}else v&&A("FAILURE")}),e.on("CHANNEL_OPEN",function(h){if(h.type==="session"&&r.noMoreSessions||!r.authenticated){var v=smr.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,v)}var S=Hyi(r),E,A,P=!1;if(S===!1)return e.channelOpenFail(h.sender,smr.RESOURCE_SHORTAGE);switch(n[S]=!0,A=a(function(){if(!P){P=!0,delete n[S];var R=smr.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,R)}},"reject"),h.type){case"session":hC(r,"session")?(E=a(function(){if(!P)return P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE),new $yi(r,h,S)},"accept"),r.emit("session",E,A)):A();break;case"direct-tcpip":hC(r,"tcpip")?(E=a(function(){if(!P){P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE);var R={type:void 0,incoming:{id:S,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new kw(R,r)}},"accept"),r.emit("tcpip",E,A,h.data)):A();break;case"direct-streamlocal@openssh.com":hC(r,"openssh.streamlocal")?(E=a(function(){if(!P){P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE);var R={type:void 0,incoming:{id:S,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new kw(R,r)}},"accept"),r.emit("openssh.streamlocal",E,A,h.data)):A();break;default:A()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),GWe&&this.once("ready",function(){GWe.add(e)})}a(P6,"Client");x6(P6,A6);P6.prototype.end=function(){return this._sshstream.disconnect(Gce.BY_APPLICATION)};P6.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return lmr(this,"x11",n,r)};P6.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return lmr(this,"forwarded-tcpip",s,i)};P6.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return lmr(this,"forwarded-streamlocal@openssh.com",r,t)};P6.prototype.rekey=function(e){var t=this._sshstream,r=!0,n;try{r=t.rekey()}catch(i){n=i}return typeof e=="function"&&(n?process.nextTick(function(){e(n)}):this.once("rekey",e)),r};function $yi(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,o,l={type:"session",incoming:{id:r,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function d(g){var h=!1,v,S;if(g.wantReply&&(g.request!=="shell"&&g.request!=="exec"&&g.request!=="subsystem"&&(v=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelSuccess(s)},"accept")),S=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelFailure(s)},"reject")),n){S&&S();return}switch(g.request){case"env":hC(i,"env")?i.emit("env",v,S,{key:g.key,val:g.val}):S&&S();break;case"pty-req":hC(i,"pty")?i.emit("pty",v,S,{cols:g.cols,rows:g.rows,width:g.width,height:g.height,term:g.term,modes:g.modes}):S&&S();break;case"window-change":hC(i,"window-change")?i.emit("window-change",v,S,{cols:g.cols,rows:g.rows,width:g.width,height:g.height}):S&&S();break;case"x11-req":hC(i,"x11")?i.emit("x11",v,S,{single:g.single,protocol:g.protocol,cookie:g.cookie,screen:g.screen}):S&&S();break;case"signal":hC(i,"signal")?i.emit("signal",v,S,{name:g.signal}):S&&S();break;case"auth-agent-req@openssh.com":hC(i,"auth-agent")?i.emit("auth-agent",v,S):S&&S();break;case"shell":hC(i,"shell")?(v=a(function(){if(!(h||n||o))return h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request,o},"accept"),i.emit("shell",v,S)):S&&S();break;case"exec":hC(i,"exec")?(v=a(function(){if(!(h||n||o))return h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request,o},"accept"),i.emit("exec",v,S,{command:g.command})):S&&S();break;case"subsystem":v=a(function(){if(!(h||n||o))if(h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request+":"+g.subsystem,g.subsystem==="sftp"){var E=new J8d({server:!0,debug:e._sshstream.debug});return o.pipe(E).pipe(o),E}else return o},"accept"),g.subsystem==="sftp"&&hC(i,"sftp")?i.emit("sftp",v,S):g.subsystem!=="sftp"&&hC(i,"subsystem")?i.emit("subsystem",v,S,{name:g.subsystem}):S&&S();break;default:S&&S()}}a(d,"onREQUEST");function u(){n=!0,i.emit("eof"),i.emit("end")}a(u,"onEOF");function m(){n=!0,i.emit("close")}a(m,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,d).once("CHANNEL_EOF:"+r,u).once("CHANNEL_CLOSE:"+r,m)}a($yi,"Session");x6($yi,A6);function AP(e,t,r,n,i){A6.call(this);var s=this;this.username=this.user=t,this.service=r,this.method=n,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=function(o,l,d){s._finalResponse||(s._finalResponse=!0,i(s,o,l,d))},this._stream=e}a(AP,"AuthContext");x6(AP,A6);AP.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};AP.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var e5d=/[ \t\r\n]*,[ \t\r\n]*/g;function HWe(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this._multistep=!0;var o=this;this._cb=void 0,this._onInfoResponse=function(l){if(o._cb){var d=o._cb;o._cb=void 0,d(l)}},this.submethods=i.split(e5d),this.on("abort",function(){o._cb&&o._cb(new Error("Authentication request aborted"))})}a(HWe,"KeyboardAuthContext");x6(HWe,AP);HWe.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};HWe.prototype.prompt=function(e,t,r,n){Array.isArray(e)||(e=[e]),typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0);for(var i=0;i<e.length;++i)typeof e[i]=="string"&&(e[i]={prompt:e[i],echo:!0});return this._cb=n,this._initialResponse=!0,this._stream.once("USERAUTH_INFO_RESPONSE",this._onInfoResponse),this._stream.authInfoReq(t,r,e)};function cmr(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var o;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":o="sha1";break;case"ssh-ed25519":o=null;break;case"ecdsa-sha2-nistp256":o="sha256";break;case"ecdsa-sha2-nistp384":o="sha384";break;case"ecdsa-sha2-nistp521":o="sha512";break}this.sigAlgo=o,this.blob=i.blob}a(cmr,"PKAuthContext");x6(cmr,AP);cmr.prototype.accept=function(){this.signature?AP.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function Gyi(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var o;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":o="sha1";break;case"ssh-ed25519":o=null;break;case"ecdsa-sha2-nistp256":o="sha256";break;case"ecdsa-sha2-nistp384":o="sha384";break;case"ecdsa-sha2-nistp521":o="sha512";break}this.sigAlgo=o,this.blob=i.blob,this.localHostname=i.localHostname,this.localUsername=i.localUsername}a(Gyi,"HostbasedAuthContext");x6(Gyi,AP);function Vyi(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.password=i}a(Vyi,"PwdAuthContext");x6(Vyi,AP);function lmr(e,t,r,n){var i=Hyi(e),s=kw.MAX_WINDOW,o=kw.PACKET_SIZE,l=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var d=e._sshstream;return d.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(u){d.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var m={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:u.sender,window:u.window,packetSize:u.packetSize,state:"open"}};n(void 0,new kw(m,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(u){d.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var m=new Error("(SSH) Channel open failure: "+u.description);m.reason=u.reason,m.lang=u.lang,n(m)}),t==="forwarded-tcpip"?l=d.forwardedTcpip(i,s,o,r):t==="x11"?l=d.x11(i,s,o,r):t==="forwarded-streamlocal@openssh.com"&&(l=d.openssh_forwardedStreamLocal(i,s,o,r)),l}a(lmr,"openChannel");function Hyi(e){if(e._curChan<Byi)return++e._curChan;for(var t=0,r=e._channels;t<Byi;++t)if(!r[t])return t;return!1}a(Hyi,"nextChannel");kv.createServer=function(e,t){return new kv(e,t)};kv.KEEPALIVE_INTERVAL=1e3;kv.KEEPALIVE_CLIENT_INTERVAL=15e3;kv.KEEPALIVE_CLIENT_COUNT_MAX=3;dmr.exports=kv;dmr.exports.IncomingClient=P6});var nmr=w((gRf,i_i)=>{var Hce=require("crypto"),t5d=require("net").Socket,r5d=require("dns").lookup,Jyi=require("events").EventEmitter,n5d=require("util").inherits,i5d=Hce.getHashes(),Wce=FWe(),a5d=Wce.SSH2Stream,fmr=Wce.SFTPStream,C5=Wce.constants,s5d=C5.BUGS,Vce=C5.ALGORITHMS,o5d=C5.EDDSA_SUPPORTED,c5d=Wce.utils.parseKey,Qyi=pyi(),T6=amr(),umr=Lyi(),l5d=Myi(),mmr=jJ().readUInt32BE,Kyi=Math.pow(2,32)-1,WWe=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,Xyi=a(function(e){},"DEBUG_NOOP");function Mh(){if(!(this instanceof Mh))return new Mh;Jyi.call(this),this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._readyTimeout=void 0,this._channels=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._curChan=void 0,this._remoteVer=void 0,this._sshstream=void 0,this._sock=void 0,this._resetKA=void 0}a(Mh,"Client");n5d(Mh,Jyi);Mh.prototype.connect=function(e){var t=this;if(this._sock&&this._sock.writable){this.once("close",function(){t.connect(e)}),this.end();return}this.config.host=e.hostname||e.host||"localhost",this.config.port=e.port||22,this.config.localAddress=typeof e.localAddress=="string"?e.localAddress:void 0,this.config.localPort=typeof e.localPort=="string"||typeof e.localPort=="number"?e.localPort:void 0,this.config.forceIPv4=e.forceIPv4||!1,this.config.forceIPv6=e.forceIPv6||!1,this.config.keepaliveCountMax=typeof e.keepaliveCountMax=="number"&&e.keepaliveCountMax>=0?e.keepaliveCountMax:3,this.config.keepaliveInterval=typeof e.keepaliveInterval=="number"&&e.keepaliveInterval>0?e.keepaliveInterval:0,this.config.readyTimeout=typeof e.readyTimeout=="number"&&e.readyTimeout>=0?e.readyTimeout:2e4;var r={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0},n;if(typeof e.algorithms=="object"&&e.algorithms!==null){var i,s;if(s=e.algorithms.kex,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_KEX,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported key exchange algorithm: "+s[n]);r.kex=s}if(s=e.algorithms.cipher,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_CIPHER,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported cipher algorithm: "+s[n]);r.cipher=s}if(s=e.algorithms.serverHostKey,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_SERVER_HOST_KEY,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported server host key algorithm: "+s[n]);r.serverHostKey=s}if(s=e.algorithms.hmac,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_HMAC,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported HMAC algorithm: "+s[n]);r.hmac=s}if(s=e.algorithms.compress,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_COMPRESS,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported compression algorithm: "+s[n]);r.compress=s}}if(r.compress===void 0&&(e.compress?(r.compress=["zlib@openssh.com","zlib"],e.compress!=="force"&&r.compress.push("none")):e.compress===!1&&(r.compress=["none"])),typeof e.username=="string")this.config.username=e.username;else if(typeof e.user=="string")this.config.username=e.user;else throw new Error("Invalid username");this.config.password=typeof e.password=="string"?e.password:void 0,this.config.privateKey=typeof e.privateKey=="string"||Buffer.isBuffer(e.privateKey)?e.privateKey:void 0,this.config.localHostname=typeof e.localHostname=="string"&&e.localHostname.length?e.localHostname:void 0,this.config.localUsername=typeof e.localUsername=="string"&&e.localUsername.length?e.localUsername:void 0,this.config.tryKeyboard=e.tryKeyboard===!0,this.config.agent=typeof e.agent=="string"&&e.agent.length?e.agent:void 0,this.config.allowAgentFwd=e.agentForward===!0&&this.config.agent!==void 0;var o=this.config.authHandler=typeof e.authHandler=="function"?e.authHandler:void 0;this.config.strictVendor=typeof e.strictVendor=="boolean"?e.strictVendor:!0;var l=this.config.debug=typeof e.debug=="function"?e.debug:Xyi;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var d=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var u;if(this.config.privateKey){if(u=c5d(this.config.privateKey,e.passphrase),u instanceof Error)throw new Error("Cannot parse privateKey: "+u.message);if(Array.isArray(u)&&(u=u[0]),u.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var m=this._sshstream=new a5d({algorithms:r,debug:l===Xyi?void 0:l}),g=this._sock=e.sock||new t5d;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var h=this.config.keepaliveInterval,v=this.config.keepaliveCountMax,S=0,E;function A(){if(++S>v){if(clearInterval(E),g.readable){var se=new Error("Keepalive timeout");se.level="client-timeout",t.emit("error",se),g.destroy()}return}g.writable?(d.push(P),m.ping()):clearInterval(E)}a(A,"sendKA");function P(){h>0&&(S=0,clearInterval(E),g.writable&&(E=setInterval(A,h)))}if(a(P,"resetKA"),this._resetKA=P,m.on("USERAUTH_BANNER",function(se){t.emit("banner",se)}),g.on("connect",function(){l("DEBUG: Client: Connected"),t.emit("connect"),e.sock||m.pipe(g).pipe(m)}).on("timeout",function(){t.emit("timeout")}).on("error",function(se){clearTimeout(t._readyTimeout),se.level="client-socket",t.emit("error",se)}).on("end",function(){m.unpipe(g),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("end")}).on("close",function(){m.unpipe(g),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("close");var se=d,fe=new Error("No response from server");for(d=t._callbacks=[],n=0;n<se.length;++n)se[n](fe);var H=t._channels,ge=Object.keys(H);for(t._channels={},n=0;n<ge.length;++n){var Pe=m.emit("CHANNEL_OPEN_FAILURE:"+ge[n],fe),ue=m.emit("CHANNEL_CLOSE:"+ge[n]),U;!Pe&&!ue&&(U=H[ge[n]])&&typeof U=="function"&&U(fe)}}),m.on("drain",function(){t.emit("drain")}).once("header",function(se){t._remoteVer=se.versions.software,se.greeting&&t.emit("greeting",se.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(se){se.level===void 0?se.level="protocol":se.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",se)}).on("end",function(){g.resume()}),typeof e.hostVerifier=="function"){if(i5d.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var R=e.hostVerifier,j=Hce.createHash(e.hostHash);m.once("fingerprint",function(se,fe){j.update(se);var H=R(j.digest("hex"),fe);H!==void 0&&fe(H)})}var I,N=null,Z=null,Y,J=0,ee=["none"];if(this.config.password!==void 0&&ee.push("password"),u!==void 0&&ee.push("publickey"),this.config.agent!==void 0&&ee.push("agent"),this.config.tryKeyboard&&ee.push("keyboard-interactive"),u!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&ee.push("hostbased"),o===void 0){var V=0;o=a(function(fe,H,ge){return V===ee.length?!1:ee[V++]},"authHandler")}var M=!1;function re(se){if(M=!0,se===!1){m.removeListener("USERAUTH_FAILURE",O),m.removeListener("USERAUTH_PK_OK",$);var fe=new Error("All configured authentication methods failed");fe.level="client-authentication",t.emit("error",fe),m.writable&&t.end();return}if(ee.indexOf(se)===-1)throw new Error("Authentication method not allowed: "+se);switch(I=se,I){case"password":m.authPassword(t.config.username,t.config.password);break;case"publickey":m.authPK(t.config.username,u),m.once("USERAUTH_PK_OK",$);break;case"hostbased":let ge=function(Pe,ue){var U=u.sign(Pe);if(U instanceof Error)return U.message="Error while signing data with privateKey: "+U.message,U.level="client-authentication",t.emit("error",U),K();ue(U)};var H=ge;a(ge,"hostbasedCb"),m.authHostbased(t.config.username,u,t.config.localHostname,t.config.localUsername,ge);break;case"agent":umr(t.config.agent,function(Pe,ue){if(Pe)return Pe.level="agent",t.emit("error",Pe),Y=void 0,K();if(ue.length===0)return l("DEBUG: Agent: No keys stored in agent"),Y=void 0,K();Y=ue,J=0,m.authPK(t.config.username,ue[0]),m.once("USERAUTH_PK_OK",$)});break;case"keyboard-interactive":m.authKeyboard(t.config.username),m.on("USERAUTH_INFO_REQUEST",D);break;case"none":m.authNone(t.config.username);break}}a(re,"doNextAuth");function K(){M=!1;var se=o(Z,N,re);M||se===void 0||re(se)}a(K,"tryNextAuth");function G(){if(I==="agent"){if(J>=Y.length)return;++J>=Y.length?(l("DEBUG: Agent: No more keys left to try"),l("DEBUG: Client: agent auth failed"),Y=void 0,K()):(l("DEBUG: Agent: Trying key #"+(J+1)),m.authPK(t.config.username,Y[J]),m.once("USERAUTH_PK_OK",$))}}a(G,"tryNextAgentKey");function D(se,fe,H,ge){var Pe=Array.isArray(ge)?ge.length:0;if(Pe===0)return l("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),m.authInfoRes();t.emit("keyboard-interactive",se,fe,H,ge,function(ue){m.authInfoRes(ue)})}a(D,"onUSERAUTH_INFO_REQUEST");function $(){if(I==="agent"){var se=Y[J],fe=mmr(se,0),H=se.toString("ascii",4,4+fe),ge=H.slice(4);switch(H){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(o5d&&H==="ssh-ed25519")break;return l("DEBUG: Agent: Skipping unsupported key type: "+H),G()}m.authPK(t.config.username,se,function(Pe,ue){umr(t.config.agent,se,ge,Pe,function(U,xe){if(U)U.level="agent",t.emit("error",U);else{var W=mmr(xe,0);if(4+W+4<xe.length){var X=xe.toString("ascii",4,4+W);if(X!==H)U=new Error("Agent key/signature type mismatch"),U.level="agent",t.emit("error",U);else return ue(xe.slice(4+W+4))}}G()})})}else I==="publickey"&&m.authPK(t.config.username,u,function(Pe,ue){var U=u.sign(Pe);if(U instanceof Error)return U.message="Error while signing data with privateKey: "+U.message,U.level="client-authentication",t.emit("error",U),K();ue(U)})}a($,"onUSERAUTH_PK_OK");function O(se,fe){if(m.removeListener("USERAUTH_PK_OK",$),m.removeListener("USERAUTH_INFO_REQUEST",D),I==="agent")return l("DEBUG: Client: Agent key #"+(J+1)+" failed"),G();l("DEBUG: Client: "+I+" auth failed"),N=fe,Z=se,K()}if(a(O,"onUSERAUTH_FAILURE"),m.once("USERAUTH_SUCCESS",function(){m.removeListener("USERAUTH_FAILURE",O),m.removeListener("USERAUTH_INFO_REQUEST",D),P(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",O),m.once("ready",function(){m.service("ssh-userauth"),m.once("SERVICE_ACCEPT",function(se){se==="ssh-userauth"&&K()})}),m.on("CHANNEL_OPEN",function(se){m5d(t,se)}),m.on("REQUEST_SUCCESS",function(se){d.length&&d.shift()(!1,se)}).on("REQUEST_FAILURE",function(){d.length&&d.shift()(!0)}),m.on("GLOBAL_REQUEST",function(se,fe,H){fe&&m.requestFailure()}),e.sock)F(),m.pipe(g).pipe(m);else{let se=function(){F(),t._sock.connect({host:L,port:t.config.port,localAddress:t.config.localAddress,localPort:t.config.localPort}),t._sock.setNoDelay(!0),t._sock.setMaxListeners(0),t._sock.setTimeout(typeof e.timeout=="number"?e.timeout:0)};var ie=se;a(se,"doConnect");var L=this.config.host,z=this.config.forceIPv4,te=this.config.forceIPv6;l("DEBUG: Client: Trying "+L+" on port "+this.config.port+" ..."),!z&&!te||z&&te?se():r5d(L,z?4:6,function(fe,H,ge){if(fe){var Pe=new Error("Error while looking up "+(z?"IPv4":"IPv6")+" address for host "+L+": "+fe);clearTimeout(t._readyTimeout),Pe.level="client-dns",t.emit("error",Pe),t.emit("close");return}L=H,se()})}function F(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var se=new Error("Timed out while waiting for handshake");se.level="client-timeout",t.emit("error",se),g.destroy()},t.config.readyTimeout))}a(F,"startTimeout")};Mh.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};Mh.prototype.destroy=function(){this._sock&&this._sock.destroy()};Mh.prototype.exec=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");typeof t=="function"&&(r=t,t={});var n=this,i={allowHalfOpen:t.allowHalfOpen!==!1};return FJ(this,"session",i,function(s,o){if(s)return r(s);var l=[];function d(u){if(u)return o.close(),r(u);l.length&&l.shift()()}a(d,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&l.push(function(){t_i(o,d)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&r_i(o,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&l.push(function(){e_i(o,t.pty,d)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&l.push(function(){Zyi(o,t.x11,d)})),l.push(function(){u5d(o,e,t,r)}),l.shift()()})};Mh.prototype.shell=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this;return typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),e&&(e.x11!==void 0||e.env!==void 0)&&(t=e,e=void 0),FJ(this,"session",function(i,s){if(i)return r(i);var o=[];function l(d){if(d)return s.close(),r(d);o.length&&o.shift()()}a(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&o.push(function(){t_i(s,l)}),e!==!1&&o.push(function(){e_i(s,e,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&r_i(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&o.push(function(){Zyi(s,t.x11,l)})),o.push(function(){d5d(s,r)}),o.shift()()})};Mh.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return FJ(this,"session",function(r,n){if(r)return t(r);n_i(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};Mh.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return FJ(this,"session",function(r,n){if(r)return e(r);n_i(n,"sftp",function(i,s){if(i)return e(i);var o=t._sshstream._state.incoming.identRaw,l={debug:t.config.debug},d=new fmr(l,o);function u(h){d.removeListener("ready",m),s.removeListener("exit",g),e(h)}a(u,"onError");function m(){d.removeListener("error",u),s.removeListener("exit",g),e(void 0,new l5d(d))}a(m,"onReady");function g(h,v){d.removeListener("ready",m),d.removeListener("error",u);var S;typeof h=="number"?S="Received exit code "+h+" while establishing SFTP session":S="Received signal "+v+" while establishing SFTP session";var E=new Error(S);E.code=h,E.signal=v,e(E)}a(g,"onExit"),d.once("error",u).once("ready",m).once("close",function(){s.end()}),s.once("exit",g),d.pipe(s).pipe(d)})})};Mh.prototype.forwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s,o){if(s)return r(s!==!0?s:new Error("Unable to bind to "+e+":"+t));var l=t;t===0&&o&&o.length>=4&&(l=mmr(o,0),n._sshstream.remoteBugs&s5d.DYN_RPORT_BUG||(t=l)),n._forwarding[e+":"+t]=l,r(void 0,l)}),this._sshstream.tcpipForward(e,t,i)};Mh.prototype.unforwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to unbind from "+e+":"+t));delete n._forwarding[e+":"+t],r()}),this._sshstream.cancelTcpipForward(e,t,i)};Mh.prototype.forwardOut=function(e,t,r,n,i){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var s={srcIP:e,srcPort:t,dstIP:r,dstPort:n};return FJ(this,"direct-tcpip",s,i)};Mh.prototype.openssh_noMoreSessions=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=typeof e=="function";return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(t&&this._callbacks.push(function(r){if(r)return e(r!==!0?r:new Error("Unable to disable future sessions"));e()}),this._sshstream.openssh_noMoreSessions(t)):(t&&process.nextTick(function(){e(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_forwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to bind to "+e));n._forwardingUnix[e]=!0,t()}),this._sshstream.openssh_streamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_unforwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to unbind on "+e));delete n._forwardingUnix[e],t()}),this._sshstream.openssh_cancelStreamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_forwardOutStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");if(!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)){var r={socketPath:e};return FJ(this,"direct-streamlocal@openssh.com",r,t)}else process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))});return!0};function FJ(e,t,r,n){var i=Yyi(e),s=T6.MAX_WINDOW,o=T6.PACKET_SIZE,l=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var d=e._sshstream;return d.once("CHANNEL_OPEN_CONFIRMATION:"+i,u).once("CHANNEL_OPEN_FAILURE:"+i,m).once("CHANNEL_CLOSE:"+i,m),t==="session"?l=d.session(i,s,o):t==="direct-tcpip"?l=d.directTcpip(i,s,o,r):t==="direct-streamlocal@openssh.com"&&(l=d.openssh_directStreamLocal(i,s,o,r)),l;function u(g){d.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),d.removeListener("CHANNEL_CLOSE:"+i,m);var h={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};n(void 0,new T6(h,e))}a(u,"onSuccess");function m(g){d.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,u),d.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),d.removeListener("CHANNEL_CLOSE:"+i,m),delete e._channels[i];var h;g instanceof Error?h=g:typeof g=="object"&&g!==null?(h=new Error("(SSH) Channel open failure: "+g.description),h.reason=g.reason,h.lang=g.lang):(h=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),h.reason=h.lang=""),n(h)}a(m,"onFailure")}a(FJ,"openChannel");function Yyi(e){if(e._curChan<Kyi)return++e._curChan;for(var t=0,r=e._channels;t<Kyi;++t)if(!r[t])return t;return!1}a(Yyi,"nextChannel");function Zyi(e,t,r){var n={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.single=="boolean"&&(n.single=t.single),typeof t.screen=="number"&&(n.screen=t.screen),typeof t.protocol=="string"&&(n.protocol=t.protocol),typeof t.cookie=="string"?n.cookie=t.cookie:Buffer.isBuffer(t.cookie)&&(n.cookie=t.cookie.toString("hex"))),n.cookie===void 0&&(n.cookie=f5d());var i=typeof r=="function";return e.outgoing.state!=="open"?(i&&r(new Error("Channel is not open")),!0):(i&&e._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to request X11"));e._hasX11=!0,++e._client._acceptX11,e.once("close",function(){e._client._acceptX11&&--e._client._acceptX11}),r()}),e._client._sshstream.x11Forward(e.outgoing.id,n,i))}a(Zyi,"reqX11");function e_i(e,t,r){var n=24,i=80,s=640,o=480,l="vt100",d=null;typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.rows=="number"&&(n=t.rows),typeof t.cols=="number"&&(i=t.cols),typeof t.width=="number"&&(s=t.width),typeof t.height=="number"&&(o=t.height),typeof t.term=="string"&&(l=t.term),typeof t.modes=="object"&&(d=t.modes));var u=typeof r=="function";return e.outgoing.state!=="open"?(u&&r(new Error("Channel is not open")),!0):(u&&e._callbacks.push(function(m){if(m)return r(m!==!0?m:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,o,s,l,d,u))}a(e_i,"reqPty");function t_i(e,t){var r=typeof t=="function";return e.outgoing.state!=="open"?(r&&t(new Error("Channel is not open")),!0):e._client._agentFwdEnabled?(r&&t(!1),!0):(e._client._agentFwdEnabled=!0,e._callbacks.push(function(n){if(n){e._client._agentFwdEnabled=!1,r&&t(n!==!0?n:new Error("Unable to request agent forwarding"));return}r&&t()}),e._client._sshstream.openssh_agentForward(e.outgoing.id,!0))}a(t_i,"reqAgentFwd");function d5d(e,t){return e.outgoing.state!=="open"?(t(new Error("Channel is not open")),!0):(e._callbacks.push(function(r){if(r)return t(r!==!0?r:new Error("Unable to open shell"));e.subtype="shell",t(void 0,e)}),e._client._sshstream.shell(e.outgoing.id,!0))}a(d5d,"reqShell");function u5d(e,t,r,n){return e.outgoing.state!=="open"?(n(new Error("Channel is not open")),!0):(e._callbacks.push(function(i){if(i)return n(i!==!0?i:new Error("Unable to exec"));e.subtype="exec",e.allowHalfOpen=r.allowHalfOpen!==!1,n(void 0,e)}),e._client._sshstream.exec(e.outgoing.id,t,!0))}a(u5d,"reqExec");function r_i(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,o=0,l=n.length;o<l;++o)i=n[o],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}a(r_i,"reqEnv");function n_i(e,t,r){return e.outgoing.state!=="open"?(r(new Error("Channel is not open")),!0):(e._callbacks.push(function(n){if(n)return r(n!==!0?n:new Error("Unable to start subsystem: "+t));e.subtype="subsystem",r(void 0,e)}),e._client._sshstream.subsystem(e.outgoing.id,t,!0))}a(n_i,"reqSubsystem");function m5d(e,t){var r=!1,n;function i(){var l={type:t.type,incoming:{id:r,window:T6.MAX_WINDOW,packetSize:T6.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},d=new T6(l,e);return e._sshstream.channelOpenConfirm(t.sender,r,T6.MAX_WINDOW,T6.PACKET_SIZE),d}a(i,"accept");function s(){n===void 0&&(r===!1?n=C5.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=C5.CHANNEL_OPEN_FAILURE.CONNECT_FAILED),e._sshstream.channelOpenFail(t.sender,n,"","")}if(a(s,"reject"),t.type==="forwarded-tcpip"||t.type==="x11"||t.type==="auth-agent@openssh.com"||t.type==="forwarded-streamlocal@openssh.com"){var o=t.type==="forwarded-tcpip"&&e._forwarding[t.data.destIP+":"+t.data.destPort]===void 0||t.type==="forwarded-streamlocal@openssh.com"&&e._forwardingUnix[t.data.socketPath]===void 0||t.type==="x11"&&e._acceptX11===0||t.type==="auth-agent@openssh.com"&&!e._agentFwdEnabled;o?(n=C5.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=Yyi(e),r===!1?(e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: no channels available"),o=!0):e._channels[r]=!0),o&&s(),r!==!1&&(t.type==="forwarded-tcpip"?(t.data.destPort===0&&(t.data.destPort=e._forwarding[t.data.destIP+":"+t.data.destPort]),e.emit("tcp connection",t.data,i,s)):t.type==="x11"?e.emit("x11",t.data,i,s):t.type==="forwarded-streamlocal@openssh.com"?e.emit("unix connection",t.data,i,s):umr(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=C5.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}a(m5d,"onCHANNEL_OPEN");var f5d=function(){if(typeof Hce.randomFillSync=="function"){var e=Buffer.alloc(16);return a(function(){return Hce.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return a(function(){return Hce.randomBytes(16).toString("hex")},"randomCookie")}();Mh.Client=Mh;Mh.Server=Wyi();Mh.utils=Wce.utils;Mh.SFTP_STATUS_CODE=fmr.STATUS_CODE;Mh.SFTP_OPEN_MODE=fmr.OPEN_MODE;Mh.HTTPAgent=Qyi.SSHTTPAgent;Mh.HTTPSAgent=Qyi.SSHTTPSAgent;i_i.exports=Mh});var s_i=w((hRf,a_i)=>{var p5d=nmr().Client,g5d=require("http");a_i.exports=function(e){var t=new p5d,r=new g5d.Agent;return r.createConnection=function(n,i){t.once("ready",function(){t.exec("docker system dial-stdio",function(s,o){if(s){t.end(),r.destroy();return}i(null,o),o.once("close",()=>{t.end(),r.destroy()})})}).connect(e),t.once("end",()=>r.destroy())},r}});var pmr=w((yRf,o_i)=>{o_i.exports=require("stream")});var u_i=w((_Rf,d_i)=>{"use strict";function c_i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}a(c_i,"ownKeys");function h5d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?c_i(Object(r),!0).forEach(function(n){y5d(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c_i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(h5d,"_objectSpread");function y5d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(y5d,"_defineProperty");function _5d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a(_5d,"_classCallCheck");function l_i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}a(l_i,"_defineProperties");function v5d(e,t,r){return t&&l_i(e.prototype,t),r&&l_i(e,r),e}a(v5d,"_createClass");var w5d=require("buffer"),KWe=w5d.Buffer,S5d=require("util"),gmr=S5d.inspect,b5d=gmr&&gmr.custom||"inspect";function C5d(e,t,r){KWe.prototype.copy.call(e,t,r)}a(C5d,"copyBuffer");d_i.exports=function(){function e(){_5d(this,e),this.head=null,this.tail=null,this.length=0}return a(e,"BufferList"),v5d(e,[{key:"push",value:a(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push")},{key:"unshift",value:a(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift")},{key:"shift",value:a(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:a(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:a(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join")},{key:"concat",value:a(function(r){if(this.length===0)return KWe.alloc(0);for(var n=KWe.allocUnsafe(r>>>0),i=this.head,s=0;i;)C5d(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat")},{key:"consume",value:a(function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i},"consume")},{key:"first",value:a(function(){return this.head.data},"first")},{key:"_getString",value:a(function(r){var n=this.head,i=1,s=n.data;for(r-=s.length;n=n.next;){var o=n.data,l=r>o.length?o.length:r;if(l===o.length?s+=o:s+=o.slice(0,r),r-=l,r===0){l===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(l));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:a(function(r){var n=KWe.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,l=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,l),r-=l,r===0){l===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(l));break}++s}return this.length-=s,n},"_getBuffer")},{key:b5d,value:a(function(r,n){return gmr(this,h5d({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var ymr=w((vRf,f_i)=>{"use strict";function E5d(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(hmr,this,e)):process.nextTick(hmr,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(XWe,r):(r._writableState.errorEmitted=!0,process.nextTick(m_i,r,s)):process.nextTick(m_i,r,s):t?(process.nextTick(XWe,r),t(s)):process.nextTick(XWe,r)}),this)}a(E5d,"destroy");function m_i(e,t){hmr(e,t),XWe(e)}a(m_i,"emitErrorAndCloseNT");function XWe(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}a(XWe,"emitCloseNT");function A5d(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}a(A5d,"undestroy");function hmr(e,t){e.emit("error",t)}a(hmr,"emitErrorNT");function x5d(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}a(x5d,"errorOrDestroy");f_i.exports={destroy:E5d,undestroy:A5d,errorOrDestroy:x5d}});var R6=w((wRf,h_i)=>{"use strict";var g_i={};function OR(e,t,r){r||(r=Error);function n(s,o,l){return typeof t=="string"?t:t(s,o,l)}a(n,"getMessage");class i extends r{constructor(o,l,d){super(n(o,l,d))}}a(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,g_i[e]=i}a(OR,"createErrorType");function p_i(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(n=>String(n)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}a(p_i,"oneOf");function P5d(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}a(P5d,"startsWith");function T5d(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}a(T5d,"endsWith");function R5d(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}a(R5d,"includes");OR("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);OR("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&P5d(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(T5d(e," argument"))i=`The ${e} ${n} ${p_i(t,"type")}`;else{let s=R5d(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${p_i(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);OR("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");OR("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});OR("ERR_STREAM_PREMATURE_CLOSE","Premature close");OR("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});OR("ERR_MULTIPLE_CALLBACK","Callback called multiple times");OR("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");OR("ERR_STREAM_WRITE_AFTER_END","write after end");OR("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);OR("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);OR("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");h_i.exports.codes=g_i});var _mr=w((SRf,y_i)=>{"use strict";var D5d=R6().codes.ERR_INVALID_OPT_VALUE;function k5d(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}a(k5d,"highWaterMarkFrom");function I5d(e,t,r,n){var i=k5d(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new D5d(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}a(I5d,"getHighWaterMark");y_i.exports={getHighWaterMark:I5d}});var JWe=w((bRf,__i)=>{__i.exports=require("util").deprecate});var Smr=w((CRf,E_i)=>{"use strict";E_i.exports=B_;function w_i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){aGd(t,e)}}a(w_i,"CorkedRequest");var UJ;B_.WritableState=Xce;var N5d={deprecate:JWe()},S_i=pmr(),YWe=require("buffer").Buffer,L5d=global.Uint8Array||function(){};function q5d(e){return YWe.from(e)}a(q5d,"_uint8ArrayToBuffer");function z5d(e){return YWe.isBuffer(e)||e instanceof L5d}a(z5d,"_isUint8Array");var wmr=ymr(),M5d=_mr(),O5d=M5d.getHighWaterMark,D6=R6().codes,j5d=D6.ERR_INVALID_ARG_TYPE,F5d=D6.ERR_METHOD_NOT_IMPLEMENTED,U5d=D6.ERR_MULTIPLE_CALLBACK,B5d=D6.ERR_STREAM_CANNOT_PIPE,$5d=D6.ERR_STREAM_DESTROYED,G5d=D6.ERR_STREAM_NULL_VALUES,V5d=D6.ERR_STREAM_WRITE_AFTER_END,H5d=D6.ERR_UNKNOWN_ENCODING,BJ=wmr.errorOrDestroy;lw()(B_,S_i);function W5d(){}a(W5d,"nop");function Xce(e,t,r){UJ=UJ||E5(),e=e||{},typeof r!="boolean"&&(r=t instanceof UJ),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=O5d(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){eGd(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new w_i(this)}a(Xce,"WritableState");Xce.prototype.getBuffer=a(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(Xce.prototype,"buffer",{get:N5d.deprecate(a(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var QWe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(QWe=Function.prototype[Symbol.hasInstance],Object.defineProperty(B_,Symbol.hasInstance,{value:a(function(t){return QWe.call(this,t)?!0:this!==B_?!1:t&&t._writableState instanceof Xce},"value")})):QWe=a(function(t){return t instanceof this},"realHasInstance");function B_(e){UJ=UJ||E5();var t=this instanceof UJ;if(!t&&!QWe.call(B_,this))return new B_(e);this._writableState=new Xce(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),S_i.call(this)}a(B_,"Writable");B_.prototype.pipe=function(){BJ(this,new B5d)};function K5d(e,t){var r=new V5d;BJ(e,r),process.nextTick(t,r)}a(K5d,"writeAfterEnd");function X5d(e,t,r,n){var i;return r===null?i=new G5d:typeof r!="string"&&!t.objectMode&&(i=new j5d("chunk",["string","Buffer"],r)),i?(BJ(e,i),process.nextTick(n,i),!1):!0}a(X5d,"validChunk");B_.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&z5d(e);return s&&!YWe.isBuffer(e)&&(e=q5d(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=W5d),n.ending?K5d(this,r):(s||X5d(this,n,e,r))&&(n.pendingcb++,i=Q5d(this,n,s,e,t,r)),i};B_.prototype.cork=function(){this._writableState.corked++};B_.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&b_i(this,e))};B_.prototype.setDefaultEncoding=a(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new H5d(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(B_.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function J5d(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=YWe.from(t,r)),t}a(J5d,"decodeChunk");Object.defineProperty(B_.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});function Q5d(e,t,r,n,i,s){if(!r){var o=J5d(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var l=t.objectMode?1:n.length;t.length+=l;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else vmr(e,t,!1,l,n,i,s);return d}a(Q5d,"writeOrBuffer");function vmr(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new $5d("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}a(vmr,"doWrite");function Y5d(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(Kce,e,t),e._writableState.errorEmitted=!0,BJ(e,n)):(i(n),e._writableState.errorEmitted=!0,BJ(e,n),Kce(e,t))}a(Y5d,"onwriteError");function Z5d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}a(Z5d,"onwriteStateUpdate");function eGd(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new U5d;if(Z5d(r),t)Y5d(e,r,n,t,i);else{var s=C_i(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&b_i(e,r),n?process.nextTick(v_i,e,r,s,i):v_i(e,r,s,i)}}a(eGd,"onwrite");function v_i(e,t,r,n){r||tGd(e,t),t.pendingcb--,n(),Kce(e,t)}a(v_i,"afterWrite");function tGd(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}a(tGd,"onwriteDrain");function b_i(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var o=0,l=!0;r;)i[o]=r,r.isBuf||(l=!1),r=r.next,o+=1;i.allBuffers=l,vmr(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new w_i(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,m=r.callback,g=t.objectMode?1:d.length;if(vmr(e,t,!1,g,d,u,m),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}a(b_i,"clearBuffer");B_.prototype._write=function(e,t,r){r(new F5d("_write()"))};B_.prototype._writev=null;B_.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||iGd(this,n,r),this};Object.defineProperty(B_.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function C_i(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}a(C_i,"needFinish");function rGd(e,t){e._final(function(r){t.pendingcb--,r&&BJ(e,r),t.prefinished=!0,e.emit("prefinish"),Kce(e,t)})}a(rGd,"callFinal");function nGd(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(rGd,e,t)):(t.prefinished=!0,e.emit("prefinish")))}a(nGd,"prefinish");function Kce(e,t){var r=C_i(t);if(r&&(nGd(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}a(Kce,"finishMaybe");function iGd(e,t,r){t.ending=!0,Kce(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}a(iGd,"endWritable");function aGd(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}a(aGd,"onCorkedFinish");Object.defineProperty(B_.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:a(function(t){!this._writableState||(this._writableState.destroyed=t)},"set")});B_.prototype.destroy=wmr.destroy;B_.prototype._undestroy=wmr.undestroy;B_.prototype._destroy=function(e,t){t(e)}});var E5=w((ERf,x_i)=>{"use strict";var sGd=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};x_i.exports=Kq;var A_i=Emr(),Cmr=Smr();lw()(Kq,A_i);for(bmr=sGd(Cmr.prototype),ZWe=0;ZWe<bmr.length;ZWe++)eKe=bmr[ZWe],Kq.prototype[eKe]||(Kq.prototype[eKe]=Cmr.prototype[eKe]);var bmr,eKe,ZWe;function Kq(e){if(!(this instanceof Kq))return new Kq(e);A_i.call(this,e),Cmr.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",oGd)))}a(Kq,"Duplex");Object.defineProperty(Kq.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(Kq.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(Kq.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function oGd(){this._writableState.ended||process.nextTick(cGd,this)}a(oGd,"onend");function cGd(e){e.end()}a(cGd,"onEndNT");Object.defineProperty(Kq.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:a(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var R_i=w((Amr,T_i)=>{var tKe=require("buffer"),Xq=tKe.Buffer;function P_i(e,t){for(var r in e)t[r]=e[r]}a(P_i,"copyProps");Xq.from&&Xq.alloc&&Xq.allocUnsafe&&Xq.allocUnsafeSlow?T_i.exports=tKe:(P_i(tKe,Amr),Amr.Buffer=A5);function A5(e,t,r){return Xq(e,t,r)}a(A5,"SafeBuffer");A5.prototype=Object.create(Xq.prototype);P_i(Xq,A5);A5.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Xq(e,t,r)};A5.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Xq(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};A5.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xq(e)};A5.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return tKe.SlowBuffer(e)}});var Tmr=w(k_i=>{"use strict";var Pmr=R_i().Buffer,D_i=Pmr.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function lGd(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}a(lGd,"_normalizeEncoding");function dGd(e){var t=lGd(e);if(typeof t!="string"&&(Pmr.isEncoding===D_i||!D_i(e)))throw new Error("Unknown encoding: "+e);return t||e}a(dGd,"normalizeEncoding");k_i.StringDecoder=Jce;function Jce(e){this.encoding=dGd(e);var t;switch(this.encoding){case"utf16le":this.text=hGd,this.end=yGd,t=4;break;case"utf8":this.fillLast=fGd,t=4;break;case"base64":this.text=_Gd,this.end=vGd,t=3;break;default:this.write=wGd,this.end=SGd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Pmr.allocUnsafe(t)}a(Jce,"StringDecoder");Jce.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Jce.prototype.end=gGd;Jce.prototype.text=pGd;Jce.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function xmr(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}a(xmr,"utf8CheckByte");function uGd(e,t,r){var n=t.length-1;if(n<r)return 0;var i=xmr(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=xmr(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=xmr(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}a(uGd,"utf8CheckIncomplete");function mGd(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}a(mGd,"utf8CheckExtraBytes");function fGd(e){var t=this.lastTotal-this.lastNeed,r=mGd(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}a(fGd,"utf8FillLast");function pGd(e,t){var r=uGd(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}a(pGd,"utf8Text");function gGd(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}a(gGd,"utf8End");function hGd(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}a(hGd,"utf16Text");function yGd(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}a(yGd,"utf16End");function _Gd(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}a(_Gd,"base64Text");function vGd(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}a(vGd,"base64End");function wGd(e){return e.toString(this.encoding)}a(wGd,"simpleWrite");function SGd(e){return e&&e.length?this.write(e):""}a(SGd,"simpleEnd")});var rKe=w((xRf,L_i)=>{"use strict";var I_i=R6().codes.ERR_STREAM_PREMATURE_CLOSE;function bGd(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}a(bGd,"once");function CGd(){}a(CGd,"noop");function EGd(e){return e.setHeader&&typeof e.abort=="function"}a(EGd,"isRequest");function N_i(e,t,r){if(typeof t=="function")return N_i(e,null,t);t||(t={}),r=bGd(r||CGd);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=a(function(){e.writable||l()},"onlegacyfinish"),o=e._writableState&&e._writableState.finished,l=a(function(){i=!1,o=!0,n||r.call(e)},"onfinish"),d=e._readableState&&e._readableState.endEmitted,u=a(function(){n=!1,d=!0,i||r.call(e)},"onend"),m=a(function(S){r.call(e,S)},"onerror"),g=a(function(){var S;if(n&&!d)return(!e._readableState||!e._readableState.ended)&&(S=new I_i),r.call(e,S);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(S=new I_i),r.call(e,S)},"onclose"),h=a(function(){e.req.on("finish",l)},"onrequest");return EGd(e)?(e.on("complete",l),e.on("abort",g),e.req?h():e.on("request",h)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",u),e.on("finish",l),t.error!==!1&&e.on("error",m),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",h),e.req&&e.req.removeListener("finish",l),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",l),e.removeListener("end",u),e.removeListener("error",m),e.removeListener("close",g)}}a(N_i,"eos");L_i.exports=N_i});var z_i=w((PRf,q_i)=>{"use strict";var nKe;function k6(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(k6,"_defineProperty");var AGd=rKe(),I6=Symbol("lastResolve"),x5=Symbol("lastReject"),Qce=Symbol("error"),iKe=Symbol("ended"),P5=Symbol("lastPromise"),Rmr=Symbol("handlePromise"),T5=Symbol("stream");function N6(e,t){return{value:e,done:t}}a(N6,"createIterResult");function xGd(e){var t=e[I6];if(t!==null){var r=e[T5].read();r!==null&&(e[P5]=null,e[I6]=null,e[x5]=null,t(N6(r,!1)))}}a(xGd,"readAndResolve");function PGd(e){process.nextTick(xGd,e)}a(PGd,"onReadable");function TGd(e,t){return function(r,n){e.then(function(){if(t[iKe]){r(N6(void 0,!0));return}t[Rmr](r,n)},n)}}a(TGd,"wrapForNext");var RGd=Object.getPrototypeOf(function(){}),DGd=Object.setPrototypeOf((nKe={get stream(){return this[T5]},next:a(function(){var t=this,r=this[Qce];if(r!==null)return Promise.reject(r);if(this[iKe])return Promise.resolve(N6(void 0,!0));if(this[T5].destroyed)return new Promise(function(o,l){process.nextTick(function(){t[Qce]?l(t[Qce]):o(N6(void 0,!0))})});var n=this[P5],i;if(n)i=new Promise(TGd(n,this));else{var s=this[T5].read();if(s!==null)return Promise.resolve(N6(s,!1));i=new Promise(this[Rmr])}return this[P5]=i,i},"next")},k6(nKe,Symbol.asyncIterator,function(){return this}),k6(nKe,"return",a(function(){var t=this;return new Promise(function(r,n){t[T5].destroy(null,function(i){if(i){n(i);return}r(N6(void 0,!0))})})},"_return")),nKe),RGd),kGd=a(function(t){var r,n=Object.create(DGd,(r={},k6(r,T5,{value:t,writable:!0}),k6(r,I6,{value:null,writable:!0}),k6(r,x5,{value:null,writable:!0}),k6(r,Qce,{value:null,writable:!0}),k6(r,iKe,{value:t._readableState.endEmitted,writable:!0}),k6(r,Rmr,{value:a(function(s,o){var l=n[T5].read();l?(n[P5]=null,n[I6]=null,n[x5]=null,s(N6(l,!1))):(n[I6]=s,n[x5]=o)},"value"),writable:!0}),r));return n[P5]=null,AGd(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[x5];s!==null&&(n[P5]=null,n[I6]=null,n[x5]=null,s(i)),n[Qce]=i;return}var o=n[I6];o!==null&&(n[P5]=null,n[I6]=null,n[x5]=null,o(N6(void 0,!0))),n[iKe]=!0}),t.on("readable",PGd.bind(null,n)),n},"createReadableStreamAsyncIterator");q_i.exports=kGd});var F_i=w((TRf,j_i)=>{"use strict";function M_i(e,t,r,n,i,s,o){try{var l=e[s](o),d=l.value}catch(u){r(u);return}l.done?t(d):Promise.resolve(d).then(n,i)}a(M_i,"asyncGeneratorStep");function IGd(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function o(d){M_i(s,n,i,o,l,"next",d)}a(o,"_next");function l(d){M_i(s,n,i,o,l,"throw",d)}a(l,"_throw"),o(void 0)})}}a(IGd,"_asyncToGenerator");function O_i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}a(O_i,"ownKeys");function NGd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?O_i(Object(r),!0).forEach(function(n){LGd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O_i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(NGd,"_objectSpread");function LGd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(LGd,"_defineProperty");var qGd=R6().codes.ERR_INVALID_ARG_TYPE;function zGd(e,t,r){var n;if(t&&typeof t.next=="function")n=t;else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new qGd("iterable",["Iterable"],t);var i=new e(NGd({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,o())};function o(){return l.apply(this,arguments)}a(o,"next");function l(){return l=IGd(function*(){try{var d=yield n.next(),u=d.value,m=d.done;m?i.push(null):i.push(yield u)?o():s=!1}catch(g){i.destroy(g)}}),l.apply(this,arguments)}return a(l,"_next2"),i}a(zGd,"from");j_i.exports=zGd});var Emr=w((DRf,J_i)=>{"use strict";J_i.exports=kp;var $J;kp.ReadableState=G_i;var RRf=require("events").EventEmitter,$_i=a(function(t,r){return t.listeners(r).length},"EElistenerCount"),Zce=pmr(),aKe=require("buffer").Buffer,MGd=global.Uint8Array||function(){};function OGd(e){return aKe.from(e)}a(OGd,"_uint8ArrayToBuffer");function jGd(e){return aKe.isBuffer(e)||e instanceof MGd}a(jGd,"_isUint8Array");var Dmr=require("util"),Of;Dmr&&Dmr.debuglog?Of=Dmr.debuglog("stream"):Of=a(function(){},"debug");var FGd=u_i(),Mmr=ymr(),UGd=_mr(),BGd=UGd.getHighWaterMark,sKe=R6().codes,$Gd=sKe.ERR_INVALID_ARG_TYPE,GGd=sKe.ERR_STREAM_PUSH_AFTER_EOF,VGd=sKe.ERR_METHOD_NOT_IMPLEMENTED,HGd=sKe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,GJ,kmr,Imr;lw()(kp,Zce);var Yce=Mmr.errorOrDestroy,Nmr=["error","close","destroy","pause","resume"];function WGd(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}a(WGd,"prependListener");function G_i(e,t,r){$J=$J||E5(),e=e||{},typeof r!="boolean"&&(r=t instanceof $J),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=BGd(this,e,"readableHighWaterMark",r),this.buffer=new FGd,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(GJ||(GJ=Tmr().StringDecoder),this.decoder=new GJ(e.encoding),this.encoding=e.encoding)}a(G_i,"ReadableState");function kp(e){if($J=$J||E5(),!(this instanceof kp))return new kp(e);var t=this instanceof $J;this._readableState=new G_i(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),Zce.call(this)}a(kp,"Readable");Object.defineProperty(kp.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:a(function(t){!this._readableState||(this._readableState.destroyed=t)},"set")});kp.prototype.destroy=Mmr.destroy;kp.prototype._undestroy=Mmr.undestroy;kp.prototype._destroy=function(e,t){t(e)};kp.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=aKe.from(e,t),t=""),n=!0),V_i(this,e,t,!1,n)};kp.prototype.unshift=function(e){return V_i(this,e,null,!0,!1)};function V_i(e,t,r,n,i){Of("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,JGd(e,s);else{var o;if(i||(o=KGd(s,t)),o)Yce(e,o);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==aKe.prototype&&(t=OGd(t)),n)s.endEmitted?Yce(e,new HGd):Lmr(e,s,t,!0);else if(s.ended)Yce(e,new GGd);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?Lmr(e,s,t,!1):zmr(e,s)):Lmr(e,s,t,!1)}else n||(s.reading=!1,zmr(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}a(V_i,"readableAddChunk");function Lmr(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&oKe(e)),zmr(e,t)}a(Lmr,"addChunk");function KGd(e,t){var r;return!jGd(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new $Gd("chunk",["string","Buffer","Uint8Array"],t)),r}a(KGd,"chunkInvalid");kp.prototype.isPaused=function(){return this._readableState.flowing===!1};kp.prototype.setEncoding=function(e){GJ||(GJ=Tmr().StringDecoder);var t=new GJ(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var U_i=1073741824;function XGd(e){return e>=U_i?e=U_i:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}a(XGd,"computeNewHighWaterMark");function B_i(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=XGd(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}a(B_i,"howMuchToRead");kp.prototype.read=function(e){Of("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return Of("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?qmr(this):oKe(this),null;if(e=B_i(e,t),e===0&&t.ended)return t.length===0&&qmr(this),null;var n=t.needReadable;Of("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,Of("length less than watermark",n)),t.ended||t.reading?(n=!1,Of("reading or ended",n)):n&&(Of("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=B_i(r,t)));var i;return e>0?i=K_i(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&qmr(this)),i!==null&&this.emit("data",i),i};function JGd(e,t){if(Of("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?oKe(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,H_i(e)))}}a(JGd,"onEofChunk");function oKe(e){var t=e._readableState;Of("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Of("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(H_i,e))}a(oKe,"emitReadable");function H_i(e){var t=e._readableState;Of("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Omr(e)}a(H_i,"emitReadable_");function zmr(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(QGd,e,t))}a(zmr,"maybeReadMore");function QGd(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(Of("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}a(QGd,"maybeReadMore_");kp.prototype._read=function(e){Yce(this,new VGd("_read()"))};kp.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,Of("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?l:E;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",o);function o(A,P){Of("onunpipe"),A===r&&P&&P.hasUnpiped===!1&&(P.hasUnpiped=!0,m())}a(o,"onunpipe");function l(){Of("onend"),e.end()}a(l,"onend");var d=YGd(r);e.on("drain",d);var u=!1;function m(){Of("cleanup"),e.removeListener("close",v),e.removeListener("finish",S),e.removeListener("drain",d),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",l),r.removeListener("end",E),r.removeListener("data",g),u=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}a(m,"cleanup"),r.on("data",g);function g(A){Of("ondata");var P=e.write(A);Of("dest.write",P),P===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&X_i(n.pipes,e)!==-1)&&!u&&(Of("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}a(g,"ondata");function h(A){Of("onerror",A),E(),e.removeListener("error",h),$_i(e,"error")===0&&Yce(e,A)}a(h,"onerror"),WGd(e,"error",h);function v(){e.removeListener("finish",S),E()}a(v,"onclose"),e.once("close",v);function S(){Of("onfinish"),e.removeListener("close",v),E()}a(S,"onfinish"),e.once("finish",S);function E(){Of("unpipe"),r.unpipe(e)}return a(E,"unpipe"),e.emit("pipe",r),n.flowing||(Of("pipe resume"),r.resume()),e};function YGd(e){return a(function(){var r=e._readableState;Of("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&$_i(e,"data")&&(r.flowing=!0,Omr(e))},"pipeOnDrainFunctionResult")}a(YGd,"pipeOnDrain");kp.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=X_i(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};kp.prototype.on=function(e,t){var r=Zce.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Of("on readable",n.length,n.reading),n.length?oKe(this):n.reading||process.nextTick(ZGd,this)),r};kp.prototype.addListener=kp.prototype.on;kp.prototype.removeListener=function(e,t){var r=Zce.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(W_i,this),r};kp.prototype.removeAllListeners=function(e){var t=Zce.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(W_i,this),t};function W_i(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}a(W_i,"updateReadableListening");function ZGd(e){Of("readable nexttick read 0"),e.read(0)}a(ZGd,"nReadingNextTick");kp.prototype.resume=function(){var e=this._readableState;return e.flowing||(Of("resume"),e.flowing=!e.readableListening,e7d(this,e)),e.paused=!1,this};function e7d(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(t7d,e,t))}a(e7d,"resume");function t7d(e,t){Of("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Omr(e),t.flowing&&!t.reading&&e.read(0)}a(t7d,"resume_");kp.prototype.pause=function(){return Of("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Of("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Omr(e){var t=e._readableState;for(Of("flow",t.flowing);t.flowing&&e.read()!==null;);}a(Omr,"flow");kp.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(Of("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Of("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var l=t.push(o);l||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=a(function(l){return a(function(){return e[l].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<Nmr.length;s++)e.on(Nmr[s],this.emit.bind(this,Nmr[s]));return this._read=function(o){Of("wrapped _read",o),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(kp.prototype[Symbol.asyncIterator]=function(){return kmr===void 0&&(kmr=z_i()),kmr(this)});Object.defineProperty(kp.prototype,"readableHighWaterMark",{enumerable:!1,get:a(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(kp.prototype,"readableBuffer",{enumerable:!1,get:a(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(kp.prototype,"readableFlowing",{enumerable:!1,get:a(function(){return this._readableState.flowing},"get"),set:a(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});kp._fromList=K_i;Object.defineProperty(kp.prototype,"readableLength",{enumerable:!1,get:a(function(){return this._readableState.length},"get")});function K_i(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}a(K_i,"fromList");function qmr(e){var t=e._readableState;Of("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(r7d,t,e))}a(qmr,"endReadable");function r7d(e,t){if(Of("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}a(r7d,"endReadableNT");typeof Symbol=="function"&&(kp.from=function(e,t){return Imr===void 0&&(Imr=F_i()),Imr(kp,e,t)});function X_i(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}a(X_i,"indexOf")});var jmr=w((kRf,Y_i)=>{"use strict";Y_i.exports=ij;var cKe=R6().codes,n7d=cKe.ERR_METHOD_NOT_IMPLEMENTED,i7d=cKe.ERR_MULTIPLE_CALLBACK,a7d=cKe.ERR_TRANSFORM_ALREADY_TRANSFORMING,s7d=cKe.ERR_TRANSFORM_WITH_LENGTH_0,lKe=E5();lw()(ij,lKe);function o7d(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new i7d);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}a(o7d,"afterTransform");function ij(e){if(!(this instanceof ij))return new ij(e);lKe.call(this,e),this._transformState={afterTransform:o7d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",c7d)}a(ij,"Transform");function c7d(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Q_i(e,t,r)}):Q_i(this,null,null)}a(c7d,"prefinish");ij.prototype.push=function(e,t){return this._transformState.needTransform=!1,lKe.prototype.push.call(this,e,t)};ij.prototype._transform=function(e,t,r){r(new n7d("_transform()"))};ij.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};ij.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};ij.prototype._destroy=function(e,t){lKe.prototype._destroy.call(this,e,function(r){t(r)})};function Q_i(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new s7d;if(e._transformState.transforming)throw new a7d;return e.push(null)}a(Q_i,"done")});var tvi=w((IRf,evi)=>{"use strict";evi.exports=ele;var Z_i=jmr();lw()(ele,Z_i);function ele(e){if(!(this instanceof ele))return new ele(e);Z_i.call(this,e)}a(ele,"PassThrough");ele.prototype._transform=function(e,t,r){r(null,e)}});var svi=w((NRf,avi)=>{"use strict";var Fmr;function l7d(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}a(l7d,"once");var ivi=R6().codes,d7d=ivi.ERR_MISSING_ARGS,u7d=ivi.ERR_STREAM_DESTROYED;function rvi(e){if(e)throw e}a(rvi,"noop");function m7d(e){return e.setHeader&&typeof e.abort=="function"}a(m7d,"isRequest");function f7d(e,t,r,n){n=l7d(n);var i=!1;e.on("close",function(){i=!0}),Fmr===void 0&&(Fmr=rKe()),Fmr(e,{readable:t,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,m7d(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new u7d("pipe"))}}}a(f7d,"destroyer");function nvi(e){e()}a(nvi,"call");function p7d(e,t){return e.pipe(t)}a(p7d,"pipe");function g7d(e){return!e.length||typeof e[e.length-1]!="function"?rvi:e.pop()}a(g7d,"popCallback");function h7d(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=g7d(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new d7d("streams");var i,s=t.map(function(o,l){var d=l<t.length-1,u=l>0;return f7d(o,d,u,function(m){i||(i=m),m&&s.forEach(nvi),!d&&(s.forEach(nvi),n(i))})});return t.reduce(p7d)}a(h7d,"pipeline");avi.exports=h7d});var FR=w((jR,rle)=>{var tle=require("stream");process.env.READABLE_STREAM==="disable"&&tle?(rle.exports=tle.Readable,Object.assign(rle.exports,tle),rle.exports.Stream=tle):(jR=rle.exports=Emr(),jR.Stream=tle||jR,jR.Readable=jR,jR.Writable=Smr(),jR.Duplex=E5(),jR.Transform=jmr(),jR.PassThrough=tvi(),jR.finished=rKe(),jR.pipeline=svi())});var lvi=w((LRf,cvi)=>{cvi.exports=aj;var y7d=require("util"),ovi=FR();y7d.inherits(aj,ovi.Duplex);function aj(e,t,r){var n=this;if(!(n instanceof aj))return new aj(e,t,r);ovi.Duplex.call(n,r),n._output=null,n.connect(e,t)}a(aj,"HttpDuplex");aj.prototype.connect=function(e,t){var r=this;r.req=e,r._output=t,r.emit("response",t),t.on("data",function(n){r.push(n)||r._output.pause()}),t.on("end",function(){r.push(null)})};aj.prototype._read=function(e){this._output&&this._output.resume()};aj.prototype._write=function(e,t,r){this.req.write(e,t),r()};aj.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};aj.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var Umr=w((qRf,dvi)=>{function _7d(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=s,r.enabled=l,r.humanize=dH(),Object.keys(e).forEach(m=>{r[m]=e[m]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(m){let g=0;for(let h=0;h<m.length;h++)g=(g<<5)-g+m.charCodeAt(h),g|=0;return r.colors[Math.abs(g)%r.colors.length]}a(t,"selectColor"),r.selectColor=t;function r(m){let g;function h(...v){if(!h.enabled)return;let S=h,E=Number(new Date),A=E-(g||E);S.diff=A,S.prev=g,S.curr=E,g=E,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let P=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(j,I)=>{if(j==="%%")return j;P++;let N=r.formatters[I];if(typeof N=="function"){let Z=v[P];j=N.call(S,Z),v.splice(P,1),P--}return j}),r.formatArgs.call(S,v),(S.log||r.log).apply(S,v)}return a(h,"debug"),h.namespace=m,h.enabled=r.enabled(m),h.useColors=r.useColors(),h.color=t(m),h.destroy=n,h.extend=i,typeof r.init=="function"&&r.init(h),r.instances.push(h),h}a(r,"createDebug");function n(){let m=r.instances.indexOf(this);return m!==-1?(r.instances.splice(m,1),!0):!1}a(n,"destroy");function i(m,g){let h=r(this.namespace+(typeof g>"u"?":":g)+m);return h.log=this.log,h}a(i,"extend");function s(m){r.save(m),r.names=[],r.skips=[];let g,h=(typeof m=="string"?m:"").split(/[\s,]+/),v=h.length;for(g=0;g<v;g++)!h[g]||(m=h[g].replace(/\*/g,".*?"),m[0]==="-"?r.skips.push(new RegExp("^"+m.substr(1)+"$")):r.names.push(new RegExp("^"+m+"$")));for(g=0;g<r.instances.length;g++){let S=r.instances[g];S.enabled=r.enabled(S.namespace)}}a(s,"enable");function o(){let m=[...r.names.map(d),...r.skips.map(d).map(g=>"-"+g)].join(",");return r.enable(""),m}a(o,"disable");function l(m){if(m[m.length-1]==="*")return!0;let g,h;for(g=0,h=r.skips.length;g<h;g++)if(r.skips[g].test(m))return!1;for(g=0,h=r.names.length;g<h;g++)if(r.names[g].test(m))return!0;return!1}a(l,"enabled");function d(m){return m.toString().substring(2,m.toString().length-2).replace(/\.\*\?$/,"*")}a(d,"toNamespace");function u(m){return m instanceof Error?m.stack||m.message:m}return a(u,"coerce"),r.enable(r.load()),r}a(_7d,"setup");dvi.exports=_7d});var uvi=w((UR,dKe)=>{UR.log=S7d;UR.formatArgs=w7d;UR.save=b7d;UR.load=C7d;UR.useColors=v7d;UR.storage=E7d();UR.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function v7d(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}a(v7d,"useColors");function w7d(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+dKe.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}a(w7d,"formatArgs");function S7d(...e){return typeof console=="object"&&console.log&&console.log(...e)}a(S7d,"log");function b7d(e){try{e?UR.storage.setItem("debug",e):UR.storage.removeItem("debug")}catch{}}a(b7d,"save");function C7d(){let e;try{e=UR.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}a(C7d,"load");function E7d(){try{return localStorage}catch{}}a(E7d,"localstorage");dKe.exports=Umr()(UR);var{formatters:A7d}=dKe.exports;A7d.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var fvi=w((b1,uKe)=>{var x7d=require("tty"),Bmr=require("util");b1.init=N7d;b1.log=D7d;b1.formatArgs=T7d;b1.save=k7d;b1.load=I7d;b1.useColors=P7d;b1.colors=[6,2,3,4,5,1];try{let e=jM();e&&(e.stderr||e).level>=2&&(b1.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}b1.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function P7d(){return"colors"in b1.inspectOpts?Boolean(b1.inspectOpts.colors):x7d.isatty(process.stderr.fd)}a(P7d,"useColors");function T7d(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} \x1B[0m`;e[0]=s+e[0].split(`
|
|
243
|
+
`),this._state.incoming.expectedPacket="KEXINIT"}a(Nd,"SSH2Stream");V$d(Nd,OWe);Nd.prototype.__read=OWe.prototype._read;Nd.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};Nd.prototype.__push=OWe.prototype.push;Nd.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};Nd.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};Nd.prototype._transform=function(e,t,r,n){var i=!1,s=!1,o=this._state,l=o.incoming,d=o.outgoing,u=l.expect,m=l.decrypt,g=l.decompress,h=e.length,v=0,S=this.debug,E=this,A=0,P=A,R,j,I,N;for(this.bytesReceived+=h;;){if(u.type!==void 0){if(A>=h)break;if(u.type===NJ){v=h-A;var Z=u.buf.length-u.ptr;Z<=v?(e.copy(u.buf,u.ptr,A,A+Z),A+=Z,j=u.buf,u.buf=void 0,u.ptr=0,u.type=void 0):(e.copy(u.buf,u.ptr,A),u.ptr+=v,A+=v);continue}else if(u.type===Xhi){if(A+=l.search.push(e),u.type!==void 0)continue}else if(u.type===Jhi){if(++u.ptr+4>255)return this.reset(),S("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[A]===10)u.type=void 0,P<A&&(u.buf===void 0?u.buf=e.toString("ascii",P,A):u.buf+=e.toString("ascii",P,A)),j=u.buf,u.buf=void 0,++A;else{++A===h&&P<A&&(u.buf===void 0?u.buf=e.toString("ascii",P,A):u.buf+=e.toString("ascii",P,A));continue}}}if(l.status===qJ){if(!this.readable)return r();if(this.server)if(!j)S("DEBUG: Parser: IN_INIT (waiting for identification begin)"),w5(this,NJ,4);else if(j[0]===83&&j[1]===83&&j[2]===72&&j[3]===45)l.status=Bur,S("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),S("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{S("DEBUG: Parser: IN_INIT");var Y=l.search=new H$d(i8d);Y.on("info",a(function U(xe,W,X,ae){W&&(l.greeting===void 0?l.greeting=W.toString("binary",X,ae):l.greeting+=W.toString("binary",X,ae)),xe&&(u.type=void 0,l.search.removeListener("info",U))},"onInfo")),Y.maxMatches=1,w5(this,Xhi),l.status=Bur}}else if(l.status===Bur)S("DEBUG: Parser: IN_GREETING"),l.search=void 0,P=A,w5(this,Jhi),l.status=Whi;else if(l.status===Whi){S("DEBUG: Parser: IN_HEADER"),j.charCodeAt(j.length-1)===13&&(j=j.slice(0,-1));var J=j.indexOf("-"),ee=j.indexOf(" "),V={greeting:l.greeting,identRaw:"SSH-"+j,versions:{protocol:j.substr(0,J),software:ee===-1?j.substring(J+1):j.substring(J+1,ee)},comments:ee>-1?j.substring(ee+1):void 0};if(l.greeting=void 0,V.versions.protocol!=="1.99"&&V.versions.protocol!=="2.0")return this.reset(),S("DEBUG: Parser: protocol version not supported: "+V.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",V),l.status===qJ)return;var M=V.identRaw,re=V.versions.software;this.debug("DEBUG: Remote ident: "+Zhi(M));for(var K=0,G;K<Z$d;++K)G=ryi[K],typeof G[0]=="string"?re===G[0]&&(this.remoteBugs|=G[1]):G[0].test(re)&&(this.remoteBugs|=G[1]);l.identRaw=M,this.bytesReceived-=h-A,Zur(this,function(){A===h?r():E._transform(e.slice(A),t,r)}),l.status=LWe;return}else if(l.status===LWe)R=m.instance?m.info.blockLen:8,S("DEBUG: Parser: IN_PACKETBEFORE (expecting "+R+")"),w5(this,NJ,R,m.buf),l.status=Vur;else if(l.status===Vur){if(S("DEBUG: Parser: IN_PACKET"),m.instance?(s=m.info.authLen>0,s||(j=Yhi(this,j)),R=m.info.blockLen):(s=!1,R=8),N=Rf(j,0,this,r),N===!1)return;var D=l.hmac.info,$;D?$=D.actualLen:$=0;var O=N+4+$,L=this.maxPacketSize;if(g.instance&&(L+=(this.maxPacketSize/16384+1)*5+6),N>L||O<16+$||(N+(s?0:4))%R!==0)return this.disconnect(wh.PROTOCOL_ERROR),S("DEBUG: Parser: Bad packet length ("+O+")"),r(new Error("Bad packet length"));l.pktLen=N;var z=l.pktLen+4-R;if(s?(m.instance.setAAD(j.slice(0,4)),S("DEBUG: Parser: pktLen:"+l.pktLen+",remainLen:"+z)):(l.padLen=j[4],S("DEBUG: Parser: pktLen:"+l.pktLen+",padLen:"+l.padLen+",remainLen:"+z)),z>0)s?l.pktExtra=j.slice(4):l.pktExtra=j.slice(5),w5(this,NJ,z),l.status=$ur;else if(z<0)l.status=LWe;else{i=!0,l.status=$ur;continue}}else if(l.status===$ur){S("DEBUG: Parser: IN_PACKETDATA"),m.instance?(s=m.info.authLen>0,i?i=!1:s||(j=Yhi(this,j))):(s=!1,i=!1);var te=l.pktLen-l.padLen-1;if(l.pktExtra?(I=Buffer.allocUnsafe(l.pktExtra.length+j.length),l.pktExtra.copy(I),j.copy(I,l.pktExtra.length),l.payload=I.slice(0,te)):(s?I=j.slice(4):I=j.slice(5),l.payload=j.slice(5,5+te)),l.hmac.info!==void 0){var F=m.info.authLen||l.hmac.info.actualLen;S("DEBUG: Parser: HMAC size:"+F),w5(this,NJ,F,l.hmac.buf),l.status=Khi,l.packet=I}else l.status=Gur;l.pktExtra=void 0,I=void 0}else if(l.status===Khi)if(S("DEBUG: Parser: IN_PACKETDATAVERIFY"),v8d(this,j))S("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),l.status=Gur,l.packet=void 0;else return this.reset(),S("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(l.status===Gur){if(g.instance)if(n)n=!1;else{S("DEBUG: Parser: Decompressing"),g.instance.write(l.payload);var ie=[],se=0;g.instance.on("readable",function(){for(var U;U=this.read();)ie.push(U),se+=U.length}).flush(Qur,function(){g.instance.removeAllListeners("readable"),ie.length===1?l.payload=ie[0]:l.payload=Buffer.concat(ie,se),ie=null;var U;A===h?U=Wur:U=e.slice(A),E._transform(U,t,r,!0)});return}this.emit("packet");var fe=l.payload[0];if(S!==nyi){var H="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",ge=o.authsQueue[0],Pe=null;if(d.status===E6&&!(fe<=4||fe>=20&&fe<=49)&&(H+="(enqueued) "),fe===Ws.KEXDH_INIT)switch(o.kex.type){case"group":Pe="KEXDH_INIT";break;case"groupex":Pe="KEXDH_GEX_REQUEST";break;default:Pe="KEXECDH_INIT"}else if(fe===Ws.KEXDH_REPLY)switch(o.kex.type){case"group":Pe="KEXDH_REPLY";break;case"groupex":Pe="KEXDH_GEX_GROUP";break;default:Pe="KEXECDH_REPLY"}else fe===Ws.KEXDH_GEX_GROUP?Pe="KEXDH_GEX_GROUP":fe===Ws.KEXDH_GEX_REPLY?Pe="KEXDH_GEX_REPLY":fe===60?ge==="password"?Pe="USERAUTH_PASSWD_CHANGEREQ":ge==="keyboard-interactive"?Pe="USERAUTH_INFO_REQUEST":ge==="publickey"?Pe="USERAUTH_PK_OK":Pe="UNKNOWN PACKET 60":fe===61&&(ge==="keyboard-interactive"?Pe="USERAUTH_INFO_RESPONSE":Pe="UNKNOWN PACKET 61");Pe===null&&(Pe=Ws[fe]),fe!==Ws.CHANNEL_OPEN&&fe!==Ws.CHANNEL_REQUEST&&fe!==Ws.CHANNEL_SUCCESS&&fe!==Ws.CHANNEL_FAILURE&&fe!==Ws.CHANNEL_EOF&&fe!==Ws.CHANNEL_CLOSE&&fe!==Ws.CHANNEL_DATA&&fe!==Ws.CHANNEL_EXTENDED_DATA&&fe!==Ws.CHANNEL_WINDOW_ADJUST&&fe!==Ws.DISCONNECT&&fe!==Ws.USERAUTH_REQUEST&&fe!==Ws.GLOBAL_REQUEST&&S(H+Pe)}if(d.status===C6||fe<=4||fe>=20&&fe<=49){if(syi(this,r)===!1||l.status===qJ)return}else if(d.status===E6){if(l.rekeyQueue.length===r8d)return S("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(wh.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var ue=l.seqno;++l.seqno>Jur&&(l.seqno=0),l.rekeyQueue.push([ue,l.payload])}l.status=LWe,l.payload=void 0}j!==void 0&&(j=void 0)}r()};Nd.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=qJ,t.outgoing.status=Hur}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:qJ,expectedPacket:void 0,search:void 0,greeting:void 0,seqno:0,pktLen:void 0,padLen:void 0,pktExtra:void 0,payload:void 0,packet:void 0,kexinit:void 0,identRaw:void 0,rekeyQueue:[],ignoreNext:!1,expect:{amount:void 0,type:void 0,ptr:0,buf:void 0},decrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,buf:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},decompress:{instance:!1,type:!1}},outgoing:{status:Hur,seqno:0,bufSeqno:Buffer.allocUnsafe(4),rekeyQueue:[],kexinit:void 0,kexsecret:void 0,pubkey:void 0,exchangeHash:void 0,sessionId:void 0,sentNEWKEYS:!1,encrypt:{instance:!1,info:void 0,iv:void 0,key:void 0,type:void 0},hmac:{info:void 0,key:void 0,buf:void 0,type:!1},compress:{instance:!1,type:!1,queue:null}}};e||this.readable&&this.push(null)};Nd.prototype.disconnect=function(e){var t=Buffer.alloc(13);return t[0]=Ws.DISCONNECT,wh[e]===void 0&&(e=wh.BY_APPLICATION),qi(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+wh[e]+")"),ld(this,t),this.reset(),!1};Nd.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),ld(this,a8d)};Nd.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===E6)throw new Error("A re-key is already in progress");if(e!==C6)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),Zur(this)};Nd.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=Ws.REQUEST_SUCCESS,e.copy(t,1)):t=o8d,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),ld(this,t)};Nd.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),ld(this,c8d)};Nd.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_SUCCESS,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),ld(this,t)};Nd.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_FAILURE,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),ld(this,t)};Nd.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_EOF,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),ld(this,t)};Nd.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(5);return t[0]=Ws.CHANNEL_CLOSE,qi(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),ld(this,t)};Nd.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(9);return r[0]=Ws.CHANNEL_WINDOW_ADJUST,qi(r,e,1),qi(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),ld(this,r)};Nd.prototype.channelData=function(e,t){var r=Buffer.isBuffer(t),n=r?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+n);return i[0]=Ws.CHANNEL_DATA,qi(i,e,1),qi(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),ld(this,i)};Nd.prototype.channelExtData=function(e,t,r){var n=Buffer.isBuffer(t),i=n?t.length:Buffer.byteLength(t),s=Buffer.allocUnsafe(1+4+4+4+i);return s[0]=Ws.CHANNEL_EXTENDED_DATA,qi(s,e,1),qi(s,r,5),qi(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),ld(this,s)};Nd.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(17);return i[0]=Ws.CHANNEL_OPEN_CONFIRMATION,qi(i,e,1),qi(i,t,5),qi(i,r,9),qi(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),ld(this,i)};Nd.prototype.channelOpenFail=function(e,t,r,n){typeof r!="string"&&(r=""),typeof n!="string"&&(n="");var i=Buffer.byteLength(r),s=Buffer.byteLength(n),o=9,l=Buffer.allocUnsafe(1+4+4+4+i+4+s);return l[0]=Ws.CHANNEL_OPEN_FAILURE,qi(l,e,1),qi(l,t,5),qi(l,i,o),o+=4,i&&(l.write(r,o,i,"utf8"),o+=i),qi(l,s,o),s&&l.write(n,o+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),ld(this,l)};Nd.prototype.service=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=Buffer.allocUnsafe(1+4+t);return r[0]=Ws.SERVICE_REQUEST,qi(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),ld(this,r)};Nd.prototype.tcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+13+1+4+n+4);return i[0]=Ws.GLOBAL_REQUEST,qi(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,qi(i,n,19),i.write(e,23,n,"ascii"),qi(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),ld(this,i)};Nd.prototype.cancelTcpipForward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(e),i=Buffer.allocUnsafe(1+4+20+1+4+n+4);return i[0]=Ws.GLOBAL_REQUEST,qi(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,qi(i,n,26),i.write(e,30,n,"ascii"),qi(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),ld(this,i)};Nd.prototype.openssh_streamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+31+1+4+r);return n[0]=Ws.GLOBAL_REQUEST,qi(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,qi(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),ld(this,n)};Nd.prototype.openssh_cancelStreamLocalForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.allocUnsafe(1+4+38+1+4+r);return n[0]=Ws.GLOBAL_REQUEST,qi(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,qi(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),ld(this,n)};Nd.prototype.directTcpip=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.srcIP),s=Buffer.byteLength(n.dstIP),o=29,l=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return l[0]=Ws.CHANNEL_OPEN,qi(l,12,1),l.write("direct-tcpip",5,12,"ascii"),qi(l,e,17),qi(l,t,21),qi(l,r,25),qi(l,s,o),l.write(n.dstIP,o+=4,s,"ascii"),qi(l,n.dstPort,o+=s),qi(l,i,o+=4),l.write(n.srcIP,o+=4,i,"ascii"),qi(l,n.srcPort,o+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),ld(this,l)};Nd.prototype.openssh_directStreamLocal=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(n.socketPath),s=47,o=Buffer.allocUnsafe(1+4+30+4+4+4+4+i+4+4);return o[0]=Ws.CHANNEL_OPEN,qi(o,30,1),o.write("direct-streamlocal@openssh.com",5,30,"ascii"),qi(o,e,35),qi(o,t,39),qi(o,r,43),qi(o,i,s),o.write(n.socketPath,s+=4,i,"utf8"),o.fill(0,o.length-8),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-streamlocal@openssh.com)"),ld(this,o)};Nd.prototype.openssh_noMoreSessions=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.allocUnsafe(1+4+28+1);return t[0]=Ws.GLOBAL_REQUEST,qi(t,28,1),t.write("no-more-sessions@openssh.com",5,28,"ascii"),t[33]=e===void 0||e===!0?1:0,this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (no-more-sessions@openssh.com)"),ld(this,t)};Nd.prototype.session=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.allocUnsafe(1+4+7+4+4+4);return n[0]=Ws.CHANNEL_OPEN,qi(n,7,1),n.write("session",5,7,"ascii"),qi(n,e,12),qi(n,t,16),qi(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),ld(this,n)};Nd.prototype.windowChange=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=Buffer.allocUnsafe(1+4+4+13+1+4+4+4+4);return s[0]=Ws.CHANNEL_REQUEST,qi(s,e,1),qi(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,qi(s,r,23),qi(s,t,27),qi(s,i,31),qi(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),ld(this,s)};Nd.prototype.pty=function(e,t,r,n,i,s,o,l){if(this.server)throw new Error("Client-only method called in server mode");(!s||!s.length)&&(s="vt100"),o&&!Buffer.isBuffer(o)&&!Array.isArray(o)&&typeof o=="object"&&(o=S8d(o)),(!o||!o.length)&&(o=l8d);var d=s.length,u=o.length,m=21,g=Buffer.allocUnsafe(1+4+4+7+1+4+d+4+4+4+4+4+u);if(g[0]=Ws.CHANNEL_REQUEST,qi(g,e,1),qi(g,7,5),g.write("pty-req",9,7,"ascii"),g[16]=l===void 0||l===!0?1:0,qi(g,d,17),g.write(s,21,d,"utf8"),qi(g,r,m+=d),qi(g,t,m+=4),qi(g,i,m+=4),qi(g,n,m+=4),qi(g,u,m+=4),m+=4,Array.isArray(o))for(var h=0;h<u;++h)g[m++]=o[h];else Buffer.isBuffer(o)&&o.copy(g,m);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),ld(this,g)};Nd.prototype.shell=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+5+1);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,5,5),r.write("shell",9,5,"ascii"),r[14]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", shell)"),ld(this,r)};Nd.prototype.exec=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.isBuffer(t)?t.length:Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+4+1+4+n);return i[0]=Ws.CHANNEL_REQUEST,qi(i,e,1),qi(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,qi(i,n,14),Buffer.isBuffer(t)?t.copy(i,18):i.write(t,18,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exec)"),ld(this,i)};Nd.prototype.signal=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");if(t=t.toUpperCase(),t.slice(0,3)==="SIG"&&(t=t.substring(3)),Q$d.indexOf(t)===-1)throw new Error("Invalid signal: "+t);var r=t.length,n=Buffer.allocUnsafe(1+4+4+6+1+4+r);return n[0]=Ws.CHANNEL_REQUEST,qi(n,e,1),qi(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,qi(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),ld(this,n)};Nd.prototype.env=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");var i=Buffer.byteLength(t),s=Buffer.isBuffer(r)?r.length:Buffer.byteLength(r),o=Buffer.allocUnsafe(1+4+4+3+1+4+i+4+s);return o[0]=Ws.CHANNEL_REQUEST,qi(o,e,1),qi(o,3,5),o.write("env",9,3,"ascii"),o[12]=n===void 0||n===!0?1:0,qi(o,i,13),o.write(t,17,i,"ascii"),qi(o,s,17+i),Buffer.isBuffer(r)?r.copy(o,17+i+4):o.write(r,17+i+4,s,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", env)"),ld(this,o)};Nd.prototype.x11Forward=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t.protocol),i=Buffer.byteLength(t.cookie),s=Buffer.allocUnsafe(1+4+4+7+1+1+4+n+4+i+4);s[0]=Ws.CHANNEL_REQUEST,qi(s,e,1),qi(s,7,5),s.write("x11-req",9,7,"ascii"),s[16]=r===void 0||r===!0?1:0,s[17]=t.single?1:0,qi(s,n,18);var o=22;return Buffer.isBuffer(t.protocol)?t.protocol.copy(s,o):s.write(t.protocol,o,n,"utf8"),o+=n,qi(s,i,o),o+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,o):s.write(t.cookie,o,i,"binary"),o+=i,qi(s,t.screen||0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),ld(this,s)};Nd.prototype.subsystem=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=Buffer.byteLength(t),i=Buffer.allocUnsafe(1+4+4+9+1+4+n);return i[0]=Ws.CHANNEL_REQUEST,qi(i,e,1),qi(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,qi(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),ld(this,i)};Nd.prototype.openssh_agentForward=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.allocUnsafe(1+4+4+26+1);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,26,5),r.write("auth-agent-req@openssh.com",9,26,"ascii"),r[35]=t===void 0||t===!0?1:0,this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", auth-agent-req@openssh.com)"),ld(this,r)};Nd.prototype.authPassword=function(e,t){if(this.server)throw new Error("Client-only method called in server mode");var r=Buffer.byteLength(e),n=Buffer.byteLength(t),i=0,s=Buffer.allocUnsafe(1+4+r+4+14+4+8+1+4+n);return s[i]=Ws.USERAUTH_REQUEST,qi(s,r,++i),s.write(e,i+=4,r,"utf8"),qi(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),qi(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,qi(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),ld(this,s)};Nd.prototype.authPK=function(e,t,r){if(this.server)throw new Error("Client-only method called in server mode");var n=this,i=this._state.outgoing,s;typeof t.getPublicSSH=="function"?(s=t.type,t=t.getPublicSSH()):s=t.toString("ascii",4,4+Xur(t,0));var o=Buffer.byteLength(e),l=Buffer.byteLength(s),d=t.length,u=i.sessionId.length,m=0,g=Buffer.allocUnsafe((r?4+u:0)+1+4+o+4+14+4+9+1+4+l+4+d);return r?(qi(g,u,m),i.sessionId.copy(g,m+=4),g[m+=u]=Ws.USERAUTH_REQUEST):g[m]=Ws.USERAUTH_REQUEST,qi(g,o,++m),g.write(e,m+=4,o,"utf8"),qi(g,14,m+=o),g.write("ssh-connection",m+=4,14,"ascii"),qi(g,9,m+=14),g.write("publickey",m+=4,9,"ascii"),g[m+=9]=r?1:0,qi(g,l,++m),g.write(s,m+=4,l,"ascii"),qi(g,d,m+=l),t.copy(g,m+=4),r?(r(g,function(h){if(h=emr(h,s),h===!1)throw new Error("Error while converting handshake signature");var v=h.length,S=Buffer.allocUnsafe(1+4+o+4+14+4+9+1+4+l+4+d+4+4+l+4+v);return m=0,S[m]=Ws.USERAUTH_REQUEST,qi(S,o,++m),S.write(e,m+=4,o,"utf8"),qi(S,14,m+=o),S.write("ssh-connection",m+=4,14,"ascii"),qi(S,9,m+=14),S.write("publickey",m+=4,9,"ascii"),S[m+=9]=1,qi(S,l,++m),S.write(s,m+=4,l,"ascii"),qi(S,d,m+=l),t.copy(S,m+=4),qi(S,4+l+4+v,m+=d),qi(S,l,m+=4),S.write(s,m+=4,l,"ascii"),qi(S,v,m+=l),h.copy(S,m+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),ld(n,S)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),ld(this,g))};Nd.prototype.authHostbased=function(e,t,r,n,i){if(this.server)throw new Error("Client-only method called in server mode");var s=this,o=this._state.outgoing,l;typeof t.getPublicSSH=="function"?(l=t.type,t=t.getPublicSSH()):l=t.toString("ascii",4,4+Xur(t,0));var d=Buffer.byteLength(e),u=Buffer.byteLength(l),m=t.length,g=o.sessionId.length,h=Buffer.byteLength(r),v=Buffer.byteLength(n),S=0,E=Buffer.allocUnsafe(4+g+1+4+d+4+14+4+9+4+u+4+m+4+h+4+v);return qi(E,g,S),o.sessionId.copy(E,S+=4),E[S+=g]=Ws.USERAUTH_REQUEST,qi(E,d,++S),E.write(e,S+=4,d,"utf8"),qi(E,14,S+=d),E.write("ssh-connection",S+=4,14,"ascii"),qi(E,9,S+=14),E.write("hostbased",S+=4,9,"ascii"),qi(E,u,S+=9),E.write(l,S+=4,u,"ascii"),qi(E,m,S+=u),t.copy(E,S+=4),qi(E,h,S+=m),E.write(r,S+=4,h,"ascii"),qi(E,v,S+=h),E.write(n,S+=4,v,"utf8"),i(E,function(A){if(A=emr(A,l),A===!1)throw new Error("Error while converting handshake signature");var P=A.length,R=Buffer.allocUnsafe(E.length-g+P);return E.copy(R,0,4+g),qi(R,P,R.length-P-4),A.copy(R,R.length-P),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),ld(s,R)}),!0};Nd.prototype.authKeyboard=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+20+4+4);return n[r]=Ws.USERAUTH_REQUEST,qi(n,t,++r),n.write(e,r+=4,t,"utf8"),qi(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),qi(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),qi(n,0,r+=20),qi(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),ld(this,n)};Nd.prototype.authNone=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=Buffer.byteLength(e),r=0,n=Buffer.allocUnsafe(1+4+t+4+14+4+4);return n[r]=Ws.USERAUTH_REQUEST,qi(n,t,++r),n.write(e,r+=4,t,"utf8"),qi(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),qi(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),ld(this,n)};Nd.prototype.authInfoRes=function(e){if(this.server)throw new Error("Client-only method called in server mode");var t=0,r=0,n,i,s;if(e)for(s=0,i=e.length;s<i;++s)t+=4+Buffer.byteLength(e[s]);var o=Buffer.allocUnsafe(1+4+t);if(o[r++]=Ws.USERAUTH_INFO_RESPONSE,qi(o,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),qi(o,n,r),r+=4,n&&(o.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),ld(this,o)};Nd.prototype.serviceAccept=function(e){if(!this.server)throw new Error("Server-only method called in client mode");var t=e.length,r=Buffer.allocUnsafe(1+4+t);if(r[0]=Ws.SERVICE_ACCEPT,qi(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),ld(this,r),this.server&&this.banner&&e==="ssh-userauth"){var n=Buffer.byteLength(this.banner),i=1+4+n+4,s=Buffer.allocUnsafe(i);s[0]=Ws.USERAUTH_BANNER,qi(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),ld(this,s),this.banner=void 0}};Nd.prototype.forwardedTcpip=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.boundAddr),s=Buffer.byteLength(n.remoteAddr),o=36+i,l=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return l[0]=Ws.CHANNEL_OPEN,qi(l,15,1),l.write("forwarded-tcpip",5,15,"ascii"),qi(l,e,20),qi(l,t,24),qi(l,r,28),qi(l,i,32),l.write(n.boundAddr,36,i,"ascii"),qi(l,n.boundPort,o),qi(l,s,o+=4),l.write(n.remoteAddr,o+=4,s,"ascii"),qi(l,n.remotePort,o+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),ld(this,l)};Nd.prototype.x11=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.originAddr),s=24+i,o=Buffer.allocUnsafe(1+4+3+4+4+4+4+i+4);return o[0]=Ws.CHANNEL_OPEN,qi(o,3,1),o.write("x11",5,3,"ascii"),qi(o,e,8),qi(o,t,12),qi(o,r,16),qi(o,i,20),o.write(n.originAddr,24,i,"ascii"),qi(o,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),ld(this,o)};Nd.prototype.openssh_authAgent=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=Buffer.allocUnsafe(1+4+22+4+4+4);return n[0]=Ws.CHANNEL_OPEN,qi(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),qi(n,e,27),qi(n,t,31),qi(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),ld(this,n)};Nd.prototype.openssh_forwardedStreamLocal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(n.socketPath),s=Buffer.allocUnsafe(1+4+33+4+4+4+4+i+4);return s[0]=Ws.CHANNEL_OPEN,qi(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),qi(s,e,38),qi(s,t,42),qi(s,r,46),qi(s,i,50),s.write(n.socketPath,54,i,"utf8"),qi(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),ld(this,s)};Nd.prototype.exitStatus=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.allocUnsafe(1+4+4+11+1+4);return r[0]=Ws.CHANNEL_REQUEST,qi(r,e,1),qi(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,qi(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),ld(this,r)};Nd.prototype.exitSignal=function(e,t,r,n){if(!this.server)throw new Error("Server-only method called in client mode");var i=Buffer.byteLength(t),s=n?Buffer.byteLength(n):0,o=25+i,l=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return l[0]=Ws.CHANNEL_REQUEST,qi(l,e,1),qi(l,11,5),l.write("exit-signal",9,11,"ascii"),l[20]=0,qi(l,i,21),l.write(t,25,i,"utf8"),l[o++]=r?1:0,qi(l,s,o),o+=4,s&&(l.write(n,o,s,"utf8"),o+=s),qi(l,0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),ld(this,l)};Nd.prototype.authFailure=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length)throw new Error("No auth in progress");var n;if(typeof e=="boolean"&&(t=e,e=void 0),e){n=[];for(var i=0,s=e.length;i<s;++i)e[i].toLowerCase()!=="none"&&n.push(e[i]);n=n.join(",")}else n="";var o=n.length,l=Buffer.allocUnsafe(1+4+o+1);return l[0]=Ws.USERAUTH_FAILURE,qi(l,o,1),l.write(n,5,o,"ascii"),l[5+o]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),ld(this,l)};Nd.prototype.authSuccess=function(){if(!this.server)throw new Error("Server-only method called in client mode");var e=this._state.authsQueue;if(!e.length)throw new Error("No auth in progress");var t=this._state,r=t.outgoing,n=t.incoming;t.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_SUCCESS");var i=ld(this,s8d);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=S5.createDeflate(MJ),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=S5.createInflate(MJ)),i};Nd.prototype.authPKOK=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=this._state.authsQueue;if(!r.length||r[0]!=="publickey")throw new Error('"publickey" auth not in progress');var n=e.length,i=t.length,s=Buffer.allocUnsafe(1+4+n+4+i);return s[0]=Ws.USERAUTH_PK_OK,qi(s,n,1),s.write(e,5,n,"ascii"),qi(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),ld(this,s)};Nd.prototype.authPasswdChg=function(e,t){if(!this.server)throw new Error("Server-only method called in client mode");var r=Buffer.byteLength(e),n=t?t.length:0,i=0,s=Buffer.allocUnsafe(1+4+r+4+n);return s[i]=Ws.USERAUTH_PASSWD_CHANGEREQ,qi(s,r,++i),s.write(e,i+=4,r,"utf8"),qi(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),ld(this,s)};Nd.prototype.authInfoReq=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");var n=0,i=e?Buffer.byteLength(e):0,s=t?Buffer.byteLength(t):0,o=0,l,d,u,m;for(m=0,u=r.length;m<u;++m)n+=4+Buffer.byteLength(r[m].prompt)+1;var g=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(g[o++]=Ws.USERAUTH_INFO_REQUEST,qi(g,i,o),o+=4,e&&(g.write(e,o,i,"utf8"),o+=i),qi(g,s,o),o+=4,t&&(g.write(t,o,s,"utf8"),o+=s),qi(g,0,o),o+=4,qi(g,r.length,o),o+=4,m=0,u=r.length;m<u;++m)d=r[m],l=Buffer.byteLength(d.prompt),qi(g,l,o),o+=4,l&&(g.write(d.prompt,o,l,"utf8"),o+=l),g[o++]=d.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),ld(this,g)};function d8d(e,t,r,n,i){if(r!==wh.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}a(d8d,"onDISCONNECT");function u8d(e,t,r){var n=e._state,i=n.outgoing;i.status===C6?(e.debug("DEBUG: Received re-key request"),i.status=E6,i.kexinit=void 0,Zur(e,s)):s();function s(){m8d(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?C8d(e):oyi(e))}a(s,"check")}a(u8d,"onKEXINIT");function m8d(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,l,d,u,m,g;o("DEBUG: Comparing KEXINITs ...");var h=e.config.algorithms,v=h.kex;if(e.remoteBugs&jWe.BAD_DHGEX)for(var S=!1,E=v.length-1;E>=0;--E)v[E].indexOf("group-exchange")!==-1&&(S||(v=v.slice(),S=!0),v.splice(E,1));for(o("DEBUG: (local) KEX algorithms: "+v),o("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(l=v,d=t.algorithms.kex):(l=t.algorithms.kex,d=v),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching key exchange algorithm");var A=new Error("Handshake failed: no matching key exchange algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}var P=d[g];for(o("DEBUG: KEX algorithm: "+P),r&&(!t.algorithms.kex.length||P!==t.algorithms.kex[0])&&(i.ignoreNext=!0),o("DEBUG: (local) Host key formats: "+h.serverHostKey),o("DEBUG: (remote) Host key formats: "+t.algorithms.srvHostKey),e.server?(l=h.serverHostKey,d=t.algorithms.srvHostKey):(l=t.algorithms.srvHostKey,d=h.serverHostKey),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching host key format");var A=new Error("Handshake failed: no matching host key format");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=d[g],o("DEBUG: Host key format: "+n.hostkeyFormat),o("DEBUG: (local) Client->Server ciphers: "+h.cipher),o("DEBUG: (remote) Client->Server ciphers: "+t.algorithms.cs.encrypt),e.server?(l=h.cipher,d=t.algorithms.cs.encrypt):(l=t.algorithms.cs.encrypt,d=h.cipher),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server cipher");var A=new Error("Handshake failed: no matching client->server cipher");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.decrypt.type=d[g]:u=s.encrypt.type=d[g],o("DEBUG: Client->Server Cipher: "+u),o("DEBUG: (local) Server->Client ciphers: "+h.cipher),o("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(l=h.cipher,d=t.algorithms.sc.encrypt):(l=t.algorithms.sc.encrypt,d=h.cipher),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client cipher");var A=new Error("Handshake failed: no matching server->client cipher");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=s.encrypt.type=d[g]:u=i.decrypt.type=d[g],o("DEBUG: Server->Client Cipher: "+u),o("DEBUG: (local) Client->Server HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(l=h.hmac,d=t.algorithms.cs.mac):(l=t.algorithms.cs.mac,d=h.hmac),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server HMAC algorithm");var A=new Error("Handshake failed: no matching client->server HMAC");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.hmac.type=d[g]:u=s.hmac.type=d[g],o("DEBUG: Client->Server HMAC algorithm: "+u),o("DEBUG: (local) Server->Client HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(l=h.hmac,d=t.algorithms.sc.mac):(l=t.algorithms.sc.mac,d=h.hmac),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client HMAC algorithm");var A=new Error("Handshake failed: no matching server->client HMAC");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=s.hmac.type=d[g]:u=i.hmac.type=d[g],o("DEBUG: Server->Client HMAC algorithm: "+u),o("DEBUG: (local) Client->Server compression algorithms: "+h.compress),o("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(l=h.compress,d=t.algorithms.cs.compress):(l=t.algorithms.cs.compress,d=h.compress),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Client->Server compression algorithm");var A=new Error("Handshake failed: no matching client->server compression algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}for(e.server?u=i.decompress.type=d[g]:u=s.compress.type=d[g],o("DEBUG: Client->Server compression algorithm: "+u),o("DEBUG: (local) Server->Client compression algorithms: "+h.compress),o("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(l=h.compress,d=t.algorithms.sc.compress):(l=t.algorithms.sc.compress,d=h.compress),g=0,m=d.length;g<m&&l.indexOf(d[g])===-1;++g);if(g===m){o("DEBUG: No matching Server->Client compression algorithm");var A=new Error("Handshake failed: no matching server->client compression algorithm");return A.level="handshake",e.emit("error",A),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1}return e.server?u=s.compress.type=d[g]:u=i.decompress.type=d[g],o("DEBUG: Server->Client compression algorithm: "+u),n.kex=new b5(P),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}a(m8d,"check_KEXINIT");function f8d(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),oyi(e)}a(f8d,"onKEXDH_GEX_GROUP");function p8d(e,t){b8d(e,t)}a(p8d,"onKEXDH_INIT");function iyi(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,l,d;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,o("DEBUG: Checking host key format");var u=Zl(t.hostkey,0,"ascii",e);if(u===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==u){o("DEBUG: Host key format mismatch"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host key format mismatch");return m.level="handshake",e.emit("error",m),!1}o("DEBUG: Checking signature format");var g=Zl(t.sig,0,"ascii",e);if(g===!1)return!1;if(t.sig_format!==g){o("DEBUG: Signature format mismatch"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature format mismatch");return m.level="handshake",e.emit("error",m),!1}}if(s.status===Hur){if(r===void 0){o("DEBUG: Verifying host fingerprint");var h=!0,v=e.emit("fingerprint",t.hostkey,function(O){r===void 0&&(r=!!O,h||iyi(e,t,r))});if(h=!1,v&&r===void 0)return}if(r===void 0)o("DEBUG: Host accepted by default (no verification)");else if(r===!0)o("DEBUG: Host accepted (verified)");else{o("DEBUG: Host denied via fingerprint verification"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: host fingerprint verification failed");return m.level="handshake",e.emit("error",m),!1}}if(t.pubkey=n.kex.convertPublicKey(t.pubkey),t.secret=n.kex.computeSecret(t.pubkey),t.secret instanceof Error)return t.secret.message="Error while computing DH secret ("+n.kex.type+"): "+t.secret.message,t.secret.level="handshake",e.emit("error",t.secret),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var S=wp.createHash(n.kex.hash),E=Buffer.byteLength(e.config.ident),A=Buffer.byteLength(i.identRaw),P=s.kexinit.length,R=i.kexinit.length,j=t.hostkey.length,I=s.pubkey.length,N=t.pubkey.length,Z=t.secret.length,Y=E+A+P+R+j+I+N+Z+4*8,J,ee,V,M,re=n.kex.getDHParams();re&&(V=re.prime,M=re.generator,J=V.length,ee=M.length,Y+=4*3,Y+=4*2,Y+=J,Y+=ee);var K=0,G=Buffer.allocUnsafe(Y);qi(G,E,K),K+=4,G.write(e.config.ident,K,"utf8"),K+=E,qi(G,A,K),K+=4,G.write(i.identRaw,K,"utf8"),K+=A,qi(G,P,K),K+=4,s.kexinit.copy(G,K),K+=P,s.kexinit=void 0,qi(G,R,K),K+=4,i.kexinit.copy(G,K),K+=R,i.kexinit=void 0,qi(G,j,K),K+=4,t.hostkey.copy(G,K),K+=j,re&&(Yur.slice(1).copy(G,K),K+=4*3,qi(G,J,K),K+=4,V.copy(G,K),K+=J,qi(G,ee,K),K+=4,M.copy(G,K),K+=ee),qi(G,I,K),K+=4,s.pubkey.copy(G,K),K+=I,qi(G,N,K),K+=4,t.pubkey.copy(G,K),K+=N,qi(G,Z,K),K+=4,t.secret.copy(G,K),s.exchangeHash=S.update(G).digest();var D=Zl(t.sig,t.sig._pos,e);if(D===!1||!(D=tyi(D,t.sig_format,e)))return!1;var $=X$d(t.hostkey,t.sig_format);if($ instanceof Error)return!1;if(o("DEBUG: Verifying signature"),$.verify(s.exchangeHash,D)!==!0){o("DEBUG: Signature verification failed"),e.disconnect(wh.KEY_EXCHANGE_FAILED),e.reset();var m=new Error("Handshake failed: signature verification failed");return m.level="handshake",e.emit("error",m),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,o("DEBUG: Outgoing: Writing NEWKEYS"),s.status===E6?ld(e,Kur,void 0,!0):ld(e,Kur),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&ayi(e)}a(iyi,"onKEXDH_REPLY");function ayi(e){var t=e._state,r=t.outgoing,n=t.incoming;if(n.expectedPacket=void 0,!!r.sentNEWKEYS){var i=r.kexsecret.length,s=r.encrypt.info=Vhi[r.encrypt.type],o=0,l=t.kex.hash,d=Buffer.allocUnsafe(4+i),u,m;if(t.authsQueue=[],qi(d,i,o),o+=4,r.kexsecret.copy(d,o),r.kexsecret=void 0,s.stream)u=Wur;else{for(u=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();u.length<s.ivLen;)u=Buffer.concat([u,wp.createHash(l).update(d).update(r.exchangeHash).update(u).digest()]);u.length>s.ivLen&&(u=u.slice(0,s.ivLen))}for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();m.length<s.keyLen;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);if(m.length>s.keyLen&&(m=m.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=u,r.encrypt.key=m,r.encrypt.instance=!0;else{var g=zJ[r.encrypt.type];r.encrypt.instance=wp.createCipheriv(g,m,u),r.encrypt.instance.setAutoPadding(!1)}var h=n.decrypt.info=Vhi[n.decrypt.type];if(h.stream)u=Wur;else{for(u=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();u.length<h.ivLen;)u=Buffer.concat([u,wp.createHash(l).update(d).update(r.exchangeHash).update(u).digest()]);u.length>h.ivLen&&(u=u.slice(0,h.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(h.blockLen),m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();m.length<h.keyLen;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>h.keyLen&&(m=m.slice(0,h.keyLen));var v=zJ[n.decrypt.type];n.decrypt.instance=wp.createDecipheriv(v,m,u),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=u,n.decrypt.key=m;var S;s.discardLen>0&&(S=Buffer.alloc(s.discardLen),r.encrypt.instance.update(S)),h.discardLen>0&&((!S||S.length!==h.discardLen)&&(S=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(S));var E=r.hmac.info=Hhi[r.hmac.type],A=n.hmac.info=Hhi[n.hmac.type];if(s.authLen===0){for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();m.length<E.len;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>E.len&&(m=m.slice(0,E.len)),r.hmac.key=m}else r.hmac.key=void 0;if(h.authLen===0){for(m=wp.createHash(l).update(d).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();m.length<A.len;)m=Buffer.concat([m,wp.createHash(l).update(d).update(r.exchangeHash).update(m).digest()]);m.length>A.len&&(m=m.slice(0,A.len)),n.hmac.key=m}else n.hmac.key=void 0;var P=h.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==P)&&(n.hmac.buf=Buffer.allocUnsafe(P)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=S5.createDeflate(MJ),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=S5.createInflate(MJ):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===E6){r.status=C6;var R=r.rekeyQueue,j=R.length,I=0;for(r.rekeyQueue=[];I<j;++I)Buffer.isBuffer(R[I])?ld(e,R[I]):ld(e,R[I][0],R[I][1]);R=n.rekeyQueue,j=R.length,I=0,n.rekeyQueue=[];for(var N=n.seqno;I<j;++I)if(n.seqno=R[I][0],n.payload=R[I][1],syi(e)===!1||n.status===qJ)return;n.seqno=N}else r.status=C6,n.status===Vur&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+h.blockLen+")"),w5(e,NJ,h.blockLen,n.decrypt.buf)),e.emit("ready")}}a(ayi,"onNEWKEYS");function zWe(e,t){var r=e._state.kex;if(r)switch(t){case 30:return r.pktInit;case 31:switch(r.type){case"group":return"KEXDH_REPLY";case"groupex":return"KEXDH_GEX_GROUP";default:return"KEXECDH_REPLY"}break;case 33:if(r.type==="groupex")return"KEXDH_GEX_REPLY"}return Ws[t]}a(zWe,"getPacketType");function syi(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,o,l,d,u,m,g,h,v,S,E,A,P,R,j;if(++r.seqno>Jur&&(r.seqno=0),r.ignoreNext){e.debug("DEBUG: Parser: Packet ignored"),r.ignoreNext=!1;return}var I=i[0];if(I===void 0)return!1;if(n.status!==C6&&zWe(e,I)!==r.expectedPacket&&I<1&&I>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+zWe(e,I)),e.disconnect(wh.PROTOCOL_ERROR);var N=new Error("Received unexpected packet");return N.level="protocol",e.emit("error",N),!1}if(I===Ws.CHANNEL_DATA){if(m=Rf(i,1,e,t),m===!1||(g=Zl(i,5,e,t,32768),g===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+m+")"),e.emit("CHANNEL_DATA:"+m,g)}else if(I===Ws.CHANNEL_EXTENDED_DATA){if(m=Rf(i,1,e,t),m===!1)return!1;var Z=Rf(i,5,e,t);if(Z===!1||(g=Zl(i,9,e,t),g===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+m+")"),e.emit("CHANNEL_EXTENDED_DATA:"+m,Z,g)}else if(I===Ws.CHANNEL_WINDOW_ADJUST){if(m=Rf(i,1,e,t),m===!1)return!1;var Y=Rf(i,5,e,t);if(Y===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+m+", "+Y+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+m,Y)}else if(I===Ws.CHANNEL_SUCCESS){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+m+")"),e.emit("CHANNEL_SUCCESS:"+m)}else if(I===Ws.CHANNEL_FAILURE){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+m+")"),e.emit("CHANNEL_FAILURE:"+m)}else if(I===Ws.CHANNEL_EOF){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+m+")"),e.emit("CHANNEL_EOF:"+m)}else if(I===Ws.CHANNEL_OPEN){var J=Zl(i,1,"ascii",e,t);if(J===!1||(S=Rf(i,i._pos,e,t),S===!1)||(E=Rf(i,i._pos+=4,e,t),E===!1)||(A=Rf(i,i._pos+=4,e,t),A===!1))return!1;var ee;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+S+", "+J+")"),J==="forwarded-tcpip"||J==="direct-tcpip"){var V=Zl(i,i._pos+=4,"ascii",e,t);if(V===!1)return!1;var M=Rf(i,i._pos,e,t);if(M===!1||(h=Zl(i,i._pos+=4,"ascii",e,t),h===!1)||(v=Rf(i,i._pos,e,t),v===!1))return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{destIP:V,destPort:M,srcIP:h,srcPort:v}}}else if(J==="forwarded-streamlocal@openssh.com"||J==="direct-streamlocal@openssh.com"){if(j=Zl(i,i._pos+=4,"utf8",e,t),j===!1)return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{socketPath:j}}}else if(J==="x11"){if(h=Zl(i,i._pos+=4,"ascii",e,t),h===!1||(v=Rf(i,i._pos,e,t),v===!1))return!1;ee={type:J,sender:S,window:E,packetSize:A,data:{srcIP:h,srcPort:v}}}else ee={type:J,sender:S,window:E,packetSize:A,data:{}};e.emit("CHANNEL_OPEN",ee)}else if(I===Ws.CHANNEL_OPEN_CONFIRMATION){if(P=Rf(i,1,e,t),P===!1||(S=Rf(i,5,e,t),S===!1)||(E=Rf(i,9,e,t),E===!1)||(A=Rf(i,13,e,t),A===!1))return!1;u={recipient:P,sender:S,window:E,packetSize:A},i.length>17&&(u.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+u.recipient,u)}else if(I===Ws.CHANNEL_OPEN_FAILURE){if(P=Rf(i,1,e,t),P===!1)return!1;var re=Rf(i,5,e,t);if(re===!1||(R=Zl(i,9,"utf8",e,t),R===!1)||(l=Zl(i,i._pos,"utf8",e,t),l===!1))return!1;i._pos=9,u={recipient:P,reasonCode:re,reason:J$d[re],description:R,lang:l},e.emit("CHANNEL_OPEN_FAILURE:"+u.recipient,u)}else if(I===Ws.CHANNEL_CLOSE){if(m=Rf(i,1,e,t),m===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+m+")"),e.emit("CHANNEL_CLOSE:"+m)}else if(I!==Ws.IGNORE){if(I===Ws.DISCONNECT){var K=Rf(i,1,e,t);if(K===!1)return!1;var G=wh[K];if(R=Zl(i,5,"utf8",e,t),R===!1)return!1;i._pos<i.length&&(l=Zl(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+G+")"),e.emit("DISCONNECT",G,K,R,l)}else if(I===Ws.DEBUG){if(d=Zl(i,2,"utf8",e,t),d===!1||(l=Zl(i,i._pos,"ascii",e,t),l===!1))return!1;e.emit("DEBUG",d,l)}else if(I===Ws.NEWKEYS)e.emit("NEWKEYS");else if(I===Ws.SERVICE_REQUEST){if(o=Zl(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_REQUEST",o)}else if(I===Ws.SERVICE_ACCEPT){if(o=Zl(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_ACCEPT",o)}else if(I===Ws.USERAUTH_REQUEST){var D=Zl(i,1,"utf8",e,t);if(D===!1)return!1;var $=Zl(i,i._pos,"ascii",e,t);if($===!1)return!1;var O=Zl(i,i._pos,"ascii",e,t);if(O===!1)return!1;var L,z;if(O==="password"){if(L=Zl(i,i._pos+1,"utf8",e,t),L===!1)return!1}else if(O==="publickey"||O==="hostbased"){var te,F,ie,se,fe,H,ge;if(O==="publickey"){if(te=i[i._pos++],te===void 0)return!1;te=te!==0}if(F=Zl(i,i._pos,"ascii",e,t),F===!1||(ie=Zl(i,i._pos,e,t),ie===!1))return!1;if(te||O==="hostbased"){if(O==="hostbased"&&(H=Zl(i,i._pos,"ascii",e,t),H===!1||(ge=Zl(i,i._pos,"utf8",e,t),ge===!1)))return!1;var Pe=i._pos;if(se=Zl(i,Pe,e,t),se===!1||(se.length>4+F.length+4&&se.toString("ascii",4,4+F.length)===F&&(se=se.slice(4+F.length+4)),se=tyi(se,F,e,t),se===!1))return!1;fe=Buffer.allocUnsafe(4+n.sessionId.length+Pe),qi(fe,n.sessionId.length,0),n.sessionId.copy(fe,4),i.copy(fe,4+n.sessionId.length,0,Pe)}else z="publickey -- check";L={keyAlgo:F,key:ie,signature:se,blob:fe,localHostname:H,localUsername:ge}}else if(O==="keyboard-interactive"){var ue=Rf(i,i._pos,e,t);if(ue===!1||(L=Zl(i,i._pos+4+ue,"utf8",e,t),L===!1))return!1}else O!=="none"&&(L=i.slice(i._pos));z===void 0&&(z=O),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+z+")"),e._state.authsQueue.push(O),e.emit("USERAUTH_REQUEST",D,$,O,L)}else if(I===Ws.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=S5.createDeflate(MJ),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=S5.createInflate(MJ)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(I===Ws.USERAUTH_FAILURE){var U=Zl(i,1,"ascii",e,t);if(U===!1)return!1;var xe=i[i._pos];if(xe===void 0)return!1;xe=xe!==0,U=U.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",U,xe)}else if(I===Ws.USERAUTH_BANNER){if(d=Zl(i,1,"utf8",e,t),d===!1||(l=Zl(i,i._pos,"utf8",e,t),l===!1))return!1;e.emit("USERAUTH_BANNER",d,l)}else if(I===Ws.GLOBAL_REQUEST){var W=Zl(i,1,"ascii",e,t);if(W===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+W+")");var X=i[i._pos++];if(X===void 0)return!1;X=X!==0;var ae;if(W==="tcpip-forward"||W==="cancel-tcpip-forward"){var pe=Zl(i,i._pos,"ascii",e,t);if(pe===!1)return!1;var Re=Rf(i,i._pos,e,t);if(Re===!1)return!1;ae={bindAddr:pe,bindPort:Re}}else if(W==="streamlocal-forward@openssh.com"||W==="cancel-streamlocal-forward@openssh.com"){if(j=Zl(i,i._pos,"utf8",e,t),j===!1)return!1;ae={socketPath:j}}else W==="no-more-sessions@openssh.com"||(ae=i.slice(i._pos));e.emit("GLOBAL_REQUEST",W,X,ae)}else if(I===Ws.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(I===Ws.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(I!==Ws.UNIMPLEMENTED){if(I===Ws.KEXINIT)return g8d(e,t);if(I===Ws.CHANNEL_REQUEST)return _8d(e,t);if(I>=30&&I<=49)return h8d(e,I,t);if(I>=60&&I<=70)return y8d(e,I,t);var He=Buffer.allocUnsafe(5);He[0]=Ws.UNIMPLEMENTED,qi(He,s,1),ld(e,He)}}}a(syi,"parsePacket");function g8d(e,t){var r=e._state.incoming,n=r.payload,i={algorithms:{kex:void 0,srvHostKey:void 0,cs:{encrypt:void 0,mac:void 0,compress:void 0},sc:{encrypt:void 0,mac:void 0,compress:void 0}},languages:{cs:void 0,sc:void 0}},s;if(s=Wq(n,17,e,t),s===!1||(i.algorithms.kex=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=Wq(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=Wq(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=Wq(n,n._pos,e,t),s===!1))return!1;i.languages.sc=s;var o=n._pos<n.length&&n[n._pos]===1;r.kexinit=n,e.emit("KEXINIT",i,o)}a(g8d,"parse_KEXINIT");function h8d(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===C6||zWe(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+zWe(e,t)),e.disconnect(wh.PROTOCOL_ERROR);var o=new Error("Received unexpected packet");return o.level="protocol",e.emit("error",o),!1}if(n.kex.type==="groupex"){if(e.server){e.disconnect(wh.PROTOCOL_ERROR);var o=new Error("DH group exchange not supported by server");return o.level="handshake",e.emit("error",o),!1}else if(t===Ws.KEXDH_GEX_GROUP){var l=Zl(s,1,e,r);if(l===!1)return!1;var d=Zl(s,s._pos,e,r);if(d===!1)return!1;e.emit("KEXDH_GEX_GROUP",l,d)}else if(t===Ws.KEXDH_GEX_REPLY)return Qhi(e,r)}else if(t===Ws.KEXDH_INIT){var u=Zl(s,1,e,r);if(u===!1)return!1;e.emit("KEXDH_INIT",u)}else if(t===Ws.KEXDH_REPLY)return Qhi(e,r)}a(h8d,"parse_KEX");function Qhi(e,t){var r=e._state.incoming.payload,n=Zl(r,1,e,t);if(n===!1)return!1;var i=Zl(r,r._pos,e,t);if(i===!1)return!1;var s=Zl(r,r._pos,e,t);if(s===!1)return!1;var o={hostkey:n,hostkey_format:void 0,pubkey:i,sig:s,sig_format:void 0},l=Zl(n,0,"ascii",e,t);if(l===!1)return!1;o.hostkey_format=l;var d=Zl(s,0,"ascii",e,t);if(d===!1)return!1;o.sig_format=d,e.emit("KEXDH_REPLY",o)}a(Qhi,"parse_KEXDH_REPLY");function y8d(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,o,l,d;if(i==="password"){if(t===Ws.USERAUTH_PASSWD_CHANGEREQ){if(o=Zl(s,1,"utf8",e,r),o===!1||(l=Zl(s,s._pos,"utf8",e,r),l===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",o,l)}}else if(i==="keyboard-interactive"){if(t===Ws.USERAUTH_INFO_REQUEST){var u,m,g;if(u=Zl(s,1,"utf8",e,r),u===!1||(m=Zl(s,s._pos,"utf8",e,r),m===!1)||(l=Zl(s,s._pos,"utf8",e,r),l===!1)||(g=Rf(s,s._pos,e,r),g===!1))return!1;s._pos+=4;for(var h=[],v=0;v<g;++v){if(d=Zl(s,s._pos,"utf8",e,r),d===!1)return!1;var S=s[s._pos++];if(S===void 0)return!1;S=S!==0,h.push({prompt:d,echo:S})}e.emit("USERAUTH_INFO_REQUEST",u,m,l,h)}else if(t===Ws.USERAUTH_INFO_RESPONSE){var E=Rf(s,1,e,r);if(E===!1)return!1;s._pos=5;for(var A=[],P=0;P<E;++P){if(d=Zl(s,s._pos,"utf8",e,r),d===!1)return!1;A.push(d)}e.emit("USERAUTH_INFO_RESPONSE",A)}}else if(i==="publickey"){if(t===Ws.USERAUTH_PK_OK){var R=e._state.authsQueue;if(!R.length||R[0]!=="publickey")return;R.shift(),e.emit("USERAUTH_PK_OK")}}else if(i!==void 0){e.disconnect(wh.PROTOCOL_ERROR);var j=new Error("Invalid authentication method: "+i);j.level="protocol",e.emit("error",j)}}a(y8d,"parse_USERAUTH");function _8d(e,t){var r=e._state.incoming.payload,n,i,s,o,l,d,u,m=Rf(r,1,e,t);if(m===!1)return!1;var g=Zl(r,5,"ascii",e,t);if(g===!1)return!1;if(g==="exit-status"){var h=Rf(r,++r._pos,e,t);if(h===!1)return!1;n={recipient:m,request:g,wantReply:!1,code:h}}else if(g==="exit-signal"){var v;if(e.remoteBugs&jWe.OLD_EXIT){if(u=Rf(r,++r._pos,e,t),u===!1)return!1;switch(u){case 1:u="HUP";break;case 2:u="INT";break;case 3:u="QUIT";break;case 6:u="ABRT";break;case 9:u="KILL";break;case 14:u="ALRM";break;case 15:u="TERM";break;default:u="UNKNOWN ("+u+")"}v=!1}else{if(u=Zl(r,++r._pos,"ascii",e,t),u===!1||(v=r[r._pos++],v===void 0))return!1;v=v!==0}var S=Zl(r,r._pos,"utf8",e,t);if(S===!1)return!1;var E=Zl(r,r._pos,"utf8",e,t);if(E===!1)return!1;n={recipient:m,request:g,wantReply:!1,signal:u,coredump:v,description:S,lang:E}}else if(g==="pty-req"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var A=Zl(r,r._pos,"ascii",e,t);if(A===!1||(i=Rf(r,r._pos,e,t),i===!1)||(s=Rf(r,r._pos+=4,e,t),s===!1)||(o=Rf(r,r._pos+=4,e,t),o===!1)||(l=Rf(r,r._pos+=4,e,t),l===!1))return!1;var P=Zl(r,r._pos+=4,e,t);if(P===!1)return!1;P=w8d(P),n={recipient:m,request:g,wantReply:d,term:A,cols:i,rows:s,width:o,height:l,modes:P}}else if(g==="window-change"){if(i=Rf(r,++r._pos,e,t),i===!1||(s=Rf(r,r._pos+=4,e,t),s===!1)||(o=Rf(r,r._pos+=4,e,t),o===!1)||(l=Rf(r,r._pos+=4,e,t),l===!1))return!1;n={recipient:m,request:g,wantReply:!1,cols:i,rows:s,width:o,height:l}}else if(g==="x11-req"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var R=r[r._pos++];if(R===void 0)return!1;R=R!==0;var j=Zl(r,r._pos,"ascii",e,t);if(j===!1)return!1;var I=Zl(r,r._pos,"binary",e,t);if(I===!1)return!1;var N=Rf(r,r._pos,e,t);if(N===!1)return!1;n={recipient:m,request:g,wantReply:d,single:R,protocol:j,cookie:I,screen:N}}else if(g==="env"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var Z=Zl(r,r._pos,"utf8",e,t);if(Z===!1)return!1;var Y=Zl(r,r._pos,"utf8",e,t);if(Y===!1)return!1;n={recipient:m,request:g,wantReply:d,key:Z,val:Y}}else if(g==="shell"){if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}else if(g==="exec"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var J=Zl(r,r._pos,"utf8",e,t);if(J===!1)return!1;n={recipient:m,request:g,wantReply:d,command:J}}else if(g==="subsystem"){if(d=r[r._pos++],d===void 0)return!1;d=d!==0;var ee=Zl(r,r._pos,"utf8",e,t);if(ee===!1)return!1;n={recipient:m,request:g,wantReply:d,subsystem:ee}}else if(g==="signal"){if(u=Zl(r,++r._pos,"ascii",e,t),u===!1)return!1;n={recipient:m,request:g,wantReply:!1,signal:"SIG"+u}}else if(g==="xon-xoff"){var V=r[++r._pos];if(V===void 0)return!1;V=V!==0,n={recipient:m,request:g,wantReply:!1,clientControl:V}}else if(g==="auth-agent-req@openssh.com"){if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}else{if(d=r[r._pos],d===void 0)return!1;d=d!==0,n={recipient:m,request:g,wantReply:d}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+m+", "+g+")"),e.emit("CHANNEL_REQUEST:"+m,n)}a(_8d,"parse_CHANNEL_REQUEST");function v8d(e,t){var r=e._state.incoming,n=r.hmac;if(e.debug("DEBUG: Parser: Verifying MAC"),r.decrypt.info.authLen>0){var i=r.decrypt,s=i.instance;s.setAuthTag(t);var o=s.update(r.packet);return r.payload=o.slice(1,r.packet.length-o[0]),eyi(i.iv),i.instance=wp.createDecipheriv(zJ[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var l=wp.createHmac(zJ[n.type],n.key);qi(qWe,r.seqno,0),qi(qWe,r.pktLen,4),qWe[8]=r.padLen,l.update(qWe),l.update(r.packet);var d=l.digest();return d.length>r.hmac.info.actualLen&&(d=d.slice(0,r.hmac.info.actualLen)),P8d(d,t)}}a(v8d,"hmacVerify");function Yhi(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}a(Yhi,"decryptData");function w5(e,t,r,n){var i=e._state.incoming.expect;i.amount=r,i.type=t,i.ptr=0,n?i.buf=n:r&&(i.buf=Buffer.allocUnsafe(r))}a(w5,"expectData");function Wq(e,t,r,n){var i=Zl(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}a(Wq,"readList");function w8d(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===LJ.TTY_OP_END||LJ[i]===void 0||r+5>n));r+=5)t[LJ[i]]=Xur(e,r+1);return t}a(w8d,"bytesToModes");function S8d(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,o=r.length,l,d,u;s<o;++s)l=r[s],d=LJ[l],d&&!t.test(l)&&typeof e[l]=="number"&&l!=="TTY_OP_END"&&(u=e[l],i[n++]=d,i[n++]=u>>>24&255,i[n++]=u>>>16&255,i[n++]=u>>>8&255,i[n++]=u&255);return i[n]=LJ.TTY_OP_END,i}a(S8d,"modesToBytes");function Zur(e,t){return x8d(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&jWe.BAD_DHGEX){for(var s=!1,o=n.kex,l=o.length-1;l>=0;--l)o[l].indexOf("group-exchange")!==-1&&(s||(o=o.slice(),s=!0),o.splice(l,1));s&&(i=Buffer.from(o.join(",")))}var d=n.serverHostKeyBuf,u=1+16+4+i.length+4+d.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,m=Buffer.allocUnsafe(u),g=17;m[0]=Ws.KEXINIT,r!==!1&&r.copy(m,1),qi(m,i.length,g),g+=4,i.copy(m,g),g+=i.length,qi(m,d.length,g),g+=4,d.copy(m,g),g+=d.length,qi(m,n.cipherBuf.length,g),g+=4,n.cipherBuf.copy(m,g),g+=n.cipherBuf.length,qi(m,n.cipherBuf.length,g),g+=4,n.cipherBuf.copy(m,g),g+=n.cipherBuf.length,qi(m,n.hmacBuf.length,g),g+=4,n.hmacBuf.copy(m,g),g+=n.hmacBuf.length,qi(m,n.hmacBuf.length,g),g+=4,n.hmacBuf.copy(m,g),g+=n.hmacBuf.length,qi(m,n.compressBuf.length,g),g+=4,n.compressBuf.copy(m,g),g+=n.compressBuf.length,qi(m,n.compressBuf.length,g),g+=4,n.compressBuf.copy(m,g),g+=n.compressBuf.length,m.fill(0,m.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var h=e._state.outgoing;h.kexinit=m,h.status===C6&&(h.status=E6),ld(e,m,t,!0)}),!0}a(Zur,"KEXINIT");function oyi(e){var t=e._state,r=t.outgoing,n=Buffer.allocUnsafe(1+4+r.pubkey.length);return t.incoming.expectedPacket=t.kex.pktReply,t.kex.type==="groupex"?(n[0]=Ws.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=Ws.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),qi(n,r.pubkey.length,1),r.pubkey.copy(n,5),ld(e,n,void 0,!0)}a(oyi,"KEXDH_INIT");function b8d(e,t){var r=e._state,n=r.outgoing,i=r.incoming,s=e.config.hostKeys[r.hostkeyFormat];Array.isArray(s)&&(s=s[0]);var o=s.getPublicSSH(),l=s.type;t=r.kex.convertPublicKey(t);var d=r.kex.computeSecret(t);if(d instanceof Error)return d.message="Error while computing DH secret ("+r.kex.type+"): "+d.message,d.level="handshake",e.emit("error",d),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var u=wp.createHash(r.kex.hash),m=Buffer.byteLength(i.identRaw),g=Buffer.byteLength(e.config.ident),h=i.kexinit.length,v=n.kexinit.length,S=o.length,E=t.length,A=n.pubkey.length,P=d.length,R=m+g+h+v+S+E+A+P+4*8,j,I,N,Z,Y=r.kex.getDHParams();Y&&(N=Y.prime,Z=Y.generator,j=N.length,I=Z.length,R+=4*3,R+=4*2,R+=j,R+=I);var J=0,ee=Buffer.allocUnsafe(R);qi(ee,m,J),J+=4,ee.write(i.identRaw,J,"utf8"),J+=m,qi(ee,g,J),J+=4,ee.write(e.config.ident,J,"utf8"),J+=g,qi(ee,h,J),J+=4,i.kexinit.copy(ee,J),J+=h,i.kexinit=void 0,qi(ee,v,J),J+=4,n.kexinit.copy(ee,J),J+=v,n.kexinit=void 0,qi(ee,S,J),J+=4,o.copy(ee,J),J+=S,Y&&(Yur.slice(1).copy(ee,J),J+=4*3,qi(ee,j,J),J+=4,N.copy(ee,J),J+=j,qi(ee,I,J),J+=4,Z.copy(ee,J),J+=I),qi(ee,E,J),J+=4,t.copy(ee,J),J+=E,qi(ee,A,J),J+=4,n.pubkey.copy(ee,J),J+=A,qi(ee,P,J),J+=4,d.copy(ee,J),n.exchangeHash=u.update(ee).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=d;var V=s.sign(n.exchangeHash);if(V instanceof Error)return V.message="Error while signing data with host key ("+l+"): "+V.message,V.level="handshake",e.emit("error",V),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;if(V=emr(V,l),V===!1)return V.message="Error while converting handshake signature",V.level="handshake",e.emit("error",V),e.disconnect(wh.KEY_EXCHANGE_FAILED),!1;var M=4+l.length+4+V.length,re=Buffer.allocUnsafe(1+4+S+4+A+4+M);return J=0,re[J]=Ws[r.kex.pktReply],++J,qi(re,S,J),J+=4,o.copy(re,J),J+=S,qi(re,A,J),J+=4,n.pubkey.copy(re,J),J+=A,qi(re,M,J),J+=4,qi(re,l.length,J),J+=4,re.write(l,J,l.length,"ascii"),J+=l.length,qi(re,V.length,J),J+=4,V.copy(re,J),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),ld(e,re,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),ld(e,Kur,void 0,!0)}a(b8d,"KEXDH_REPLY");function C8d(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),ld(e,Yur,void 0,!0)}a(C8d,"KEXDH_GEX_REQ");function cyi(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(Qur,E8d.bind(e,r))}a(cyi,"compressPayload");function E8d(e){if(!(this._readableState.ended||this._writableState.ended)){lyi(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&cyi(this,t[0][0],t[0][1])}}a(E8d,"compressFlushCb");function ld(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===E6&&!n)return typeof r=="function"?s.rekeyQueue.push([t,r]):s.rekeyQueue.push(t),!1;if(e._readableState.ended||e._writableState.ended)return!1;if(s.compress.instance){var o=s.compress.queue;return o.push([t,r]),o.length===1&&cyi(e,o[0][0],o[0][1]),!0}else return lyi(e,t,r)}a(ld,"send");function lyi(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,o=i.hmac,l,d,u,m,g;if(l=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var h=1+t.length+4;h%s.info.blockLen!==0;)++h;d=h-1-t.length,l=4+h}else{var v=s.info.blockLen;l+=(v-1)*l%v,d=l-t.length-5}else l+=7*l%8,d=l-t.length-5;u=Buffer.allocUnsafe(l),qi(u,l-4,0),u[4]=d,t.copy(u,5),A8d(u,5+t.length,d),o.type!==!1&&o.key&&(m=wp.createHmac(zJ[o.type],o.key),qi(i.bufSeqno,i.seqno,0),m.update(i.bufSeqno),m.update(u),m=m.digest(),m.length>o.info.actualLen&&(m=m.slice(0,o.info.actualLen)));var S=0,E;if(s.instance!==!1)if(s.info.authLen>0){var A=wp.createCipheriv(zJ[s.type],s.key,s.iv);A.setAutoPadding(!1);var P=u.slice(0,4);A.setAAD(P),e.push(P),S+=P,E=A.update(u.slice(4)),e.push(E),S+=E.length;var R=A.final();R.length&&(e.push(R),S+=R.length);var j=A.getAuthTag();g=e.push(j),S+=j.length,eyi(s.iv)}else E=s.instance.update(u),e.push(E),S+=E.length,g=e.push(m),S+=m.length;else g=e.push(u),S=u.length;return e.bytesSent+=S,++i.seqno>Jur&&(i.seqno=0),r&&r(),g}a(lyi,"send_");var A8d=function(){return typeof wp.randomFillSync=="function"?wp.randomFillSync:a(function(t,r,n){var i=wp.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function x8d(e,t){wp.randomBytes(e,a(function r(n,i){if(n)return wp.randomBytes(e,r);t&&t(i)},"retry"))}a(x8d,"randBytes");function emr(e,t){switch(t){case"ssh-dss":return W$d(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return K$d(e)}return e}a(emr,"convertSignature");var P8d=function(){return typeof wp.timingSafeEqual=="function"?a(function(t,r){return t.length!==r.length?(wp.timingSafeEqual(t,t),!1):wp.timingSafeEqual(t,r)},"timingSafeEquals"):a(function(t,r){var n;t.length===r.length?n=0:(n=1,r=t);for(var i=0,s=t.length;i<s;++i)n|=t[i]^r[i];return n===0},"timingSafeEquals")}();function b5(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!Y$d)break;this.type="25519",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp256":this.type="ecdh",this.name="prime256v1",this.hash="sha256",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp384":this.type="ecdh",this.name="secp384r1",this.hash="sha384",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"ecdh-sha2-nistp521":this.type="ecdh",this.name="secp521r1",this.hash="sha512",this.pktInit="KEXECDH_INIT",this.pktReply="KEXECDH_REPLY";return;case"diffie-hellman-group1-sha1":this.type="group",this.name="modp2",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha1":this.type="group",this.name="modp14",this.hash="sha1",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group14-sha256":this.type="group",this.name="modp14",this.hash="sha256",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group16-sha512":this.type="group",this.name="modp16",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group18-sha512":this.type="group",this.name="modp18",this.hash="sha512",this.pktInit="KEXDH_INIT",this.pktReply="KEXDH_REPLY";return;case"diffie-hellman-group-exchange-sha1":this.type="groupex",this.hash="sha1",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return;case"diffie-hellman-group-exchange-sha256":this.type="groupex",this.hash="sha256",this.pktInit="KEXDH_GEX_REQ",this.pktReply="KEXDH_GEX_REPLY",this._prime=null,this._generator=null;return}throw new Error("Unsupported key exchange algorithm: "+e)}a(b5,"KeyExchange");b5.prototype.setDHParams=function(e,t){if(this.type==="groupex"){if(!Buffer.isBuffer(e))throw new Error("Invalid prime value");if(!Buffer.isBuffer(t))throw new Error("Invalid generator value");this._prime=e,this._generator=t}};b5.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:MWe(this._kex.getPrime()),generator:MWe(this._kex.getGenerator())}};b5.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=wp.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=wp.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=wp.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=wp.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};b5.prototype.getPublicKey=function(){this.generateKeys();var e;switch(this.type){case"25519":return e=this._keys.publicKey.export({type:"spki",format:"der"}),e.slice(-32);case"ecdh":case"group":case"groupex":e=this._public;break}if(e)return this.convertPublicKey(e)};b5.prototype.convertPublicKey=function(e){for(var t,r=0,n=e.length;e[r]===0;)++r,--n;switch(this.type){case"25519":if(e.length===32)return e;break;default:if(e[r]&128)return t=Buffer.allocUnsafe(1+n),t[0]=0,e.copy(t,1,r),t}return n!==e.length&&(t=Buffer.allocUnsafe(n),e.copy(t,0,r),e=t),e};b5.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new Ghi.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(Ghi.BitString),t.writeByte(0),t._ensure(e.length),e.copy(t._buf,t._offset,0,e.length),t._offset+=e.length,t.endSequence(),t.endSequence(),MWe(wp.diffieHellman({privateKey:this._keys.privateKey,publicKey:wp.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return MWe(this._kex.computeSecret(e))}catch(r){return r}}};function MWe(e){for(var t=0,r=e.length;e[t]===0;)++t,--r;var n;return e[t]&128?(n=Buffer.allocUnsafe(1+r),n[0]=0,e.copy(n,1,t),e=n):r!==e.length&&(n=Buffer.allocUnsafe(r),e.copy(n,0,t),e=n),e}a(MWe,"convertToMpint");tmr.exports=Nd;tmr.exports._send=ld});var FWe=w((oRf,uyi)=>{uyi.exports={SFTPStream:jhi(),SSH2Stream:dyi(),utils:$q(),constants:vWe()}});var pyi=w(fyi=>{var myi=require("http").Agent,T8d=require("https").Agent,R8d=require("util").inherits,rmr;[myi,T8d].forEach(e=>{function t(r,n){if(!(this instanceof t))return new t(r,n);e.call(this,n),this._connectCfg=r,this._defaultSrcIP=n&&n.srcIP||"localhost"}a(t,"SSHAgent"),R8d(t,e),t.prototype.createConnection=D8d,fyi[e===myi?"SSHTTPAgent":"SSHTTPSAgent"]=t});function D8d(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;rmr===void 0&&(rmr=nmr().Client);var o=new rmr,l=!1;o.on("ready",()=>{o.forwardOut(r,n,i,s,(d,u)=>{if(l=!0,d)return o.end(),t(d);u.once("close",()=>{o.end()}),t(null,k8d(u))})}).on("error",t).on("close",()=>{l||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}a(D8d,"createConnection");function Fce(){}a(Fce,"noop");function k8d(e){return e.setKeepAlive=Fce,e.setNoDelay=Fce,e.setTimeout=Fce,e.ref=Fce,e.unref=Fce,e.destroySoon=e.destroy,e}a(k8d,"decorateStream")});var amr=w((lRf,vyi)=>{var gyi=require("util").inherits,hyi=require("stream").Duplex,I8d=require("stream").Readable,yyi=require("stream").Writable,N8d=FWe().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,L8d=32*1024,Uce=2*1024*1024,UWe=Uce/2,_yi=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],q8d=_yi.length;function MR(e,t,r){var n={highWaterMark:Uce,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,hyi.call(this,n);var i=this,s=r&&r.server;this.server=s,this.type=e.type,this.subtype=void 0;var o=this.incoming=e.incoming,l=o.id,d=this.outgoing=e.outgoing,u=this._callbacks=[],m,g,h,v,S;this._client=t,this._hasX11=!1;var E=t._channels,A=t._sshstream;function P(){i._waitClientDrain&&(i._waitClientDrain=!1,i._waitWindow||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}a(P,"ondrain"),t._sock.on("drain",P),A.once("CHANNEL_EOF:"+l,function(){o.state==="open"&&(o.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+l,function(){if(o.state!=="closed"){o.state="closed",i.readable&&i.push(null),s&&i.stderr.writable?i.stderr.end():!s&&i.stderr.readable&&i.stderr.push(null),(d.state==="open"||d.state==="eof")&&i.close(),d.state==="closing"&&(d.state="closed"),delete E[l];var I=i._writableState;t._sock.removeListener("drain",P),!I.ending&&!I.finished&&i.end(),i._callbacks=[];for(var N=0;N<u.length;++N)u[N](!0);u=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){m===null?i.emit("close",m,g,h,v,S):i.emit("close",m)}):m===null?i.emit("close",m,g,h,v,S):i.emit("close",m),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var N=0;N<q8d;++N)A.removeAllListeners(_yi[N]+":"+l)}}).on("CHANNEL_DATA:"+l,function(I){if(o.window!==0){if(o.window-=I.length,!i.push(I)){i._waitChanDrain=!0;return}o.window<=UWe&&BWe(i)}}).on("CHANNEL_WINDOW_ADJUST:"+l,function(I){d.window+=I,i._waitWindow&&(i._waitWindow=!1,i._waitClientDrain||(i._chunk?i._write(i._chunk,null,i._chunkcb):i._chunkcb?i._chunkcb():i._chunkErr?i.stderr._write(i._chunkErr,null,i._chunkcbErr):i._chunkcbErr&&i._chunkcbErr()))}).on("CHANNEL_SUCCESS:"+l,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),u.length&&u.shift()(!1)}).on("CHANNEL_FAILURE:"+l,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),u.length&&u.shift()(!0)}).on("CHANNEL_REQUEST:"+l,function(I){if(!s){if(I.request==="exit-status"){i.emit("exit",m=I.code);return}else if(I.request==="exit-signal"){i.emit("exit",m=null,g="SIG"+I.signal,h=I.coredump,v=I.description,S=I.lang);return}}I.wantReply&&A.channelFailure(d.id)}),this.stdin=this.stdout=this,s?this.stderr=new imr(this):(this.stderr=new I8d(n),this.stderr._read=function(I){i._waitChanDrain&&(i._waitChanDrain=!1,o.window<=UWe&&BWe(i))},A.on("CHANNEL_EXTENDED_DATA:"+l,function(I,N){if(o.window!==0){if(o.window-=N.length,!i.stderr.push(N)){i._waitChanDrain=!0;return}o.window<=UWe&&BWe(i)}})),this._waitClientDrain=!1,this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0;function R(){i.eof(),(s||!s&&!i.allowHalfOpen)&&i.close(),i.writable=!1}a(R,"onFinish"),this.on("finish",R).on("prefinish",R);function j(){i.readable=!1}a(j,"onEnd"),this.on("end",j).on("close",j)}a(MR,"Channel");gyi(MR,hyi);MR.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};MR.prototype.close=function(){var e=!0,t=this.outgoing;return(t.state==="open"||t.state==="eof")&&(t.state="closing",e=this._client._sshstream.channelClose(t.id)),e};MR.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=UWe&&BWe(this))};MR.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,o=i.id,l=i.window,d=e.length,u=0,m,g,h;if(i.state==="open"){for(;d-u>0&&l>0;)if(h=d-u,h>l&&(h=l),h>s&&(h=s),m=n.channelData(o,e.slice(u,u+h)),u+=h,l-=h,!m){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=l,d-u>0){l===0&&(this._waitWindow=!0),u>0?(g=Buffer.allocUnsafe(d-u),e.copy(g,0,u),this._chunk=g):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};MR.prototype.destroy=function(){this.end()};MR.prototype.setWindow=function(e,t,r,n){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&(this.subtype==="shell"||this.subtype==="exec")&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.windowChange(this.outgoing.id,e,t,r,n):!0};MR.prototype.signal=function(e){if(this.server)throw new Error("Client-only method called in server mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?this._client._sshstream.signal(this.outgoing.id,e):!0};MR.prototype.exit=function(e,t,r){if(!this.server)throw new Error("Server-only method called in client mode");return this.type==="session"&&this.writable&&this.outgoing.state==="open"?typeof e=="number"?this._client._sshstream.exitStatus(this.outgoing.id,e):this._client._sshstream.exitSignal(this.outgoing.id,e,t,r):!0};MR.MAX_WINDOW=Uce;MR.PACKET_SIZE=L8d;function BWe(e){if(e.outgoing.state==="closed")return!0;var t=Uce-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}a(BWe,"windowAdjust");function imr(e){yyi.call(this,{highWaterMark:Uce}),this._channel=e}a(imr,"ServerStderr");gyi(imr,yyi);imr.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,o=s.packetSize,l=s.id,d=s.window,u=e.length,m=0,g,h,v;if(n.outgoing.state==="open"){for(;u-m>0&&d>0;)if(v=u-m,v>d&&(v=d),v>o&&(v=o),g=i.channelExtData(l,e.slice(m,m+v),N8d),m+=v,d-=v,!g){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=d,u-m>0){d===0&&(n._waitWindow=!0),m>0?(h=Buffer.allocUnsafe(u-m),e.copy(h,0,m),n._chunkErr=h):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};vyi.exports=MR});var jJ=w((dRf,wyi)=>{wyi.exports={readUInt32BE:a(function(t,r){return t[r++]*16777216+t[r++]*65536+t[r++]*256+t[r]},"readUInt32BE"),writeUInt32BE:a(function(t,r,n){return t[n++]=r>>>24,t[n++]=r>>>16,t[n++]=r>>>8,t[n++]=r,n},"writeUInt32BE"),writeUInt32LE:a(function(t,r,n){return t[n++]=r,t[n++]=r>>>8,t[n++]=r>>>16,t[n++]=r>>>24,n},"writeUInt32LE")}});var Lyi=w((uRf,Nyi)=>{var Syi=require("net").Socket,z8d=require("events").EventEmitter,M8d=require("util").inherits,O8d=require("path"),byi=require("fs"),kyi=require("child_process"),Iyi=jJ().readUInt32BE,$We=jJ().writeUInt32BE,Cyi=jJ().writeUInt32LE,j8d=11,F8d=12,U8d=13,B8d=14,$8d=5,G8d=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,V8d=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;Nyi.exports=function(e,t,r,n,i){var s,o,l,d,u=0,m=Buffer.isBuffer(t),g,h=0,v=0,S=0,E,A=0,P=!1,R,j;typeof t=="function"&&typeof r=="function"?(R=t,j=r):m?(u=t.length,d=n.length):(i=t,t=void 0);function I(){var V;if(m){var M=9;V=Buffer.allocUnsafe(4+1+4+u+4+d+4),$We(V,V.length-4,0),V[4]=U8d,$We(V,u,5),t.copy(V,M),$We(V,d,M+=u),n.copy(V,M+=4),$We(V,0,M+=d),s.write(V)}else s.write(Buffer.from([0,0,0,1,j8d]))}a(I,"onconnect");function N(V){for(var M=0,re=V.length;M<re;++M)if(g===void 0)++h===5&&(g=V[M],h=0);else if(g===B8d){if(!l)v<<=8,v+=V[M],++h===4&&(l=Buffer.allocUnsafe(v),h=0);else if(l[h]=V[M],++h===v)return s.removeAllListeners("data"),s.destroy()}else if(g===F8d)if(E===void 0){if(S<<=8,S+=V[M],++h===4&&(E=new Array(S),h=0,S===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)u<<=8,u+=V[M],++h===4&&(t=Buffer.allocUnsafe(u),h=0);else if(P===!1){if(t[h]=V[M],++h===u&&(E[S-1]=t,u=0,h=0,P=!0,--S===0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else P===!0?(A<<=8,A+=V[M],++h===4&&(h=0,A>0?P=A:(t=void 0,P=!1),A=0)):++h===P&&(P=!1,h=0,t=void 0);else if(g===$8d)return m?o=new Error("Agent unable to sign data"):o=new Error("Unable to retrieve list of keys from agent"),s.removeAllListeners("data"),s.destroy()}a(N,"ondata");function Z(V){o=V}a(Z,"onerror");function Y(){o?i(o):m&&!l||!m&&!E?i(new Error("Unexpected disconnection from agent")):m&&l?i(void 0,l):!m&&E&&i(void 0,E)}if(a(Y,"onclose"),process.platform==="win32"&&!V8d.test(e))if(e==="pageant")s=new H8d;else{var J=!1;byi.readFile(e,a(function V(M,re){if(M){if(J)return i(new Error("Invalid cygwin unix socket path"));kyi.exec('cygpath -w "'+e+'"',function(ue,U,xe){if(ue||U.length===0)return i(new Error("Invalid cygwin unix socket path"));J=!0,e=U.toString().replace(/[\r\n]/g,""),byi.readFile(e,V)});return}var K;if(K=G8d.exec(re.toString("ascii"))){let ue=function(){L=0,O="secret",s.write($)},U=function(X){L+=X.length,O==="secret"?L===16&&(L=0,O="creds",s.write(F)):O==="creds"&&(z||te.push(X),L===12&&(s.removeListener("connect",ue),s.removeListener("data",U),s.removeListener("close",xe),z?(ee(),s.emit("connect")):(z=!0,F=Buffer.concat(te),Cyi(F,process.pid,0),s.destroy(),W())))},xe=function(){i(new Error("Problem negotiating cygwin unix socket security"))},W=function(){s=new Syi,s.once("connect",ue),s.on("data",U),s.once("close",xe),s.connect(G)};var Pe=ue,ge=U,fe=xe,H=W;a(ue,"_onconnect"),a(U,"_ondata"),a(xe,"_onclose"),a(W,"tryConnect");var G,D,$,O,L=0,z=!1,te=[],F=Buffer.allocUnsafe(12),ie,se;for(F.fill(0),G=parseInt(K[1],10),D=K[2].replace(/\-/g,""),$=Buffer.allocUnsafe(16),ie=0,se=0;se<32;++ie,se+=2)$[ie]=parseInt(D.substring(se,se+2),16);for(ie=0;ie<16;ie+=4)Cyi($,Iyi($,ie),ie);W()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new Syi;function ee(){if(!R&&!j)s.once("connect",I),s.on("data",N),s.once("error",Z),s.once("close",Y);else{var V;s.once("connect",function(){V=R();var M=!1;function re(){M||(s.destroy(),M=!0)}a(re,"onDone"),V.once("end",re).once("close",re).on("data",function(K){s.write(K)}),s.on("data",function(K){V.write(K)})}),s.once("close",function(){V||j()})}}a(ee,"addSockListeners"),ee(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};H8d=e,a(e,"PageantSock"),Eyi=10,Ayi=11,xyi=12,Pyi=13,Tyi=14,Ryi=15,nj={},Dyi=O8d.resolve(__dirname,"..","util/pagent.exe"),nj[Eyi]=new Error("Invalid pagent.exe arguments"),nj[Ayi]=new Error("Pageant is not running"),nj[xyi]=new Error("pagent.exe could not create an mmap"),nj[Pyi]=new Error("pagent.exe could not set mode for stdin"),nj[Tyi]=new Error("pagent.exe could not set mode for stdout"),nj[Ryi]=new Error("pagent.exe did not get expected input payload"),M8d(e,z8d),e.prototype.write=function(t){if(this.buffer===null?this.buffer=t:this.buffer=Buffer.concat([this.buffer,t],this.buffer.length+t.length),!(this.buffer.length<4)){var r=Iyi(this.buffer,0);if(!(this.buffer.length-4<r)){t=this.buffer.slice(0,4+r),this.buffer.length>4+r?this.buffer=this.buffer.slice(4+r):this.buffer=null;var n=this,i,s=!1;i=this.proc=kyi.spawn(Dyi,[t.length]),i.stdout.on("data",function(o){n.emit("data",o)}),i.once("error",function(o){s||(s=!0,n.emit("error",o))}),i.once("close",function(o){n.proc=void 0,nj[o]&&!s&&(s=!0,n.emit("error",nj[o])),n.emit("close",s)}),i.stdin.end(t)}}},e.prototype.end=e.prototype.destroy=function(){this.buffer=null,this.proc&&(this.proc.kill(),this.proc=void 0)},e.prototype.connect=function(){this.emit("connect")}}var Eyi,Ayi,xyi,Pyi,Tyi,Ryi,nj,Dyi,H8d});var Myi=w((mRf,zyi)=>{var W8d=require("util").inherits,qyi=require("events").EventEmitter;function _f(e){var t=this;qyi.call(this),this._stream=e,e.on("error",function(r){t.emit("error",r)}).on("end",function(){t.emit("end")}).on("close",function(){t.emit("close")}).on("continue",function(){t.emit("continue")})}a(_f,"SFTPWrapper");W8d(_f,qyi);_f.prototype.end=function(){return this._stream.end()};_f.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};_f.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};_f.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};_f.prototype.close=function(e,t){return this._stream.close(e,t)};_f.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};_f.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};_f.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};_f.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};_f.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};_f.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};_f.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};_f.prototype.exists=function(e,t){return this._stream.exists(e,t)};_f.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};_f.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};_f.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};_f.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};_f.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};_f.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};_f.prototype.stat=function(e,t){return this._stream.stat(e,t)};_f.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};_f.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};_f.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};_f.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};_f.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};_f.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};_f.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};_f.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};_f.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};_f.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};_f.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};_f.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};_f.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};_f.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};_f.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};_f.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};_f.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};_f.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};zyi.exports=_f});var Fyi=w((fRf,jyi)=>{function Oyi(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}a(Oyi,"spliceOne");function Bce(e,t,r){var n=this._streams=[];this._timer=void 0,this._timerInterval=e,this._timerfn=function(){for(var i=Date.now(),s=0,o=n.length,l,d;s<o;++s)if(l=n[s],d=l._kalast,d&&i-d>=t)if(++l._kacnt>r){var u=new Error("Keepalive timeout");u.level="client-timeout",l.emit("error",u),l.disconnect(),Oyi(n,s),--s,o=n.length}else l._kalast=i,l.ping()}}a(Bce,"Manager");Bce.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};Bce.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};Bce.prototype.add=function(e){var t=this._streams,r=this;e.once("end",function(){r.remove(e)}).on("packet",n),t[t.length]=e,n(),this._timer||this.start();function n(){e._kalast=Date.now(),e._kacnt=0}a(n,"resetKA")};Bce.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&Oyi(t,r),t.length||this.stop()};jyi.exports=Bce});var Wyi=w((pRf,dmr)=>{var K8d=require("net"),A6=require("events").EventEmitter,hC=A6.listenerCount,x6=require("util").inherits,VWe=FWe(),Uyi=VWe.utils.parseKey,X8d=VWe.SSH2Stream,J8d=VWe.SFTPStream,omr=VWe.constants,Gce=omr.DISCONNECT_REASON,smr=omr.CHANNEL_OPEN_FAILURE,$ce=omr.ALGORITHMS,kw=amr(),Q8d=Fyi(),Y8d=jJ().writeUInt32BE,Byi=Math.pow(2,32)-1,Z8d=10,GWe;function kv(e,t){if(!(this instanceof kv))return new kv(e,t);var r={"ssh-rsa":null,"ssh-dss":null,"ssh-ed25519":null,"ecdsa-sha2-nistp256":null,"ecdsa-sha2-nistp384":null,"ecdsa-sha2-nistp521":null},n=e.hostKeys;if(!Array.isArray(n))throw new Error("hostKeys must be an array");var i;for(i=0;i<n.length;++i){var s;if(Buffer.isBuffer(n[i])||typeof n[i]=="string"?s=Uyi(n[i]):s=Uyi(n[i].key,n[i].passphrase),s instanceof Error)throw new Error("Cannot parse privateKey: "+s.message);if(Array.isArray(s)&&(s=s[0]),s.getPrivatePEM()===null)throw new Error("privateKey value contains an invalid private key");r[s.type]||(r[s.type]=s)}var o={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0};if(typeof e.algorithms=="object"&&e.algorithms!==null){var l,d;if(d=e.algorithms.kex,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_KEX,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported key exchange algorithm: "+d[i]);o.kex=d}if(d=e.algorithms.cipher,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_CIPHER,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported cipher algorithm: "+d[i]);o.cipher=d}d=e.algorithms.serverHostKey;var u=!1;if(Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_SERVER_HOST_KEY,i=d.length-1;i>=0;--i){if(l.indexOf(d[i])===-1)throw new Error("Unsupported server host key algorithm: "+d[i]);r[d[i]]||(u||(d=d.slice(),u=!0),d.splice(i,1))}d.length>0&&(o.serverHostKey=d)}if(d=e.algorithms.hmac,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_HMAC,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported HMAC algorithm: "+d[i]);o.hmac=d}if(d=e.algorithms.compress,Array.isArray(d)&&d.length>0){for(l=$ce.SUPPORTED_COMPRESS,i=0;i<d.length;++i)if(l.indexOf(d[i])===-1)throw new Error("Unsupported compression algorithm: "+d[i]);o.compress=d}}if(o.serverHostKey===void 0){var m=Object.keys(r);for(i=m.length-1;i>=0;--i)r[m[i]]||m.splice(i,1);o.serverHostKey=m}!GWe&&kv.KEEPALIVE_INTERVAL>0&&kv.KEEPALIVE_CLIENT_INTERVAL>0&&kv.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(GWe=new Q8d(kv.KEEPALIVE_INTERVAL,kv.KEEPALIVE_CLIENT_INTERVAL,kv.KEEPALIVE_CLIENT_COUNT_MAX));var g=this;A6.call(this),typeof t=="function"&&g.on("connection",t);var h={algorithms:o,hostKeys:r,server:!0},v,S;for(i=0,v=Object.keys(e),S=v.length;i<S;++i){var E=v[i];E==="privateKey"||E==="publicKey"||E==="passphrase"||E==="algorithms"||E==="hostKeys"||E==="server"||(h[E]=e[E])}if(typeof h.debug=="function")var A=h.debug,P=Object.keys(h);this._srv=new K8d.Server(function(R){if(g._connections>=g.maxConnections){R.destroy();return}++g._connections,R.once("close",function(V){--g._connections,Y.read()}).on("error",function(V){Y.reset(),Y.emit("error",V)});var j=h;if(A){j={};for(var I=0,N;I<P.length;++I)N=P[I],j[N]=h[N];var Z="["+process.hrtime().join(".")+"] ";j.debug=function(V){A(Z+V)}}var Y=new X8d(j),J=new P6(Y,R);R.pipe(Y).pipe(R);function ee(V){}a(ee,"onClientPreHeaderError"),J.on("error",ee),Y.once("header",function(V){if(!Y._readableState.ended){if(!hC(g,"connection"))return Y.disconnect(Gce.BY_APPLICATION);J.removeListener("error",ee),g.emit("connection",J,{ip:R.remoteAddress,family:R.remoteFamily,port:R.remotePort,header:V})}})}).on("error",function(R){g.emit("error",R)}).on("listening",function(){g.emit("listening")}).on("close",function(){g.emit("close")}),this._connections=0,this.maxConnections=1/0}a(kv,"Server");x6(kv,A6);kv.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};kv.prototype.address=function(){return this._srv.address()};kv.prototype.getConnections=function(e){this._srv.getConnections(e)};kv.prototype.close=function(e){return this._srv.close(e),this};kv.prototype.ref=function(){this._srv.ref()};kv.prototype.unref=function(){this._srv.unref()};function P6(e,t){A6.call(this);var r=this;this._sshstream=e;var n=this._channels={};this._curChan=-1,this._sock=t,this.noMoreSessions=!1,this.authenticated=!1,e.on("end",function(){t.resume(),r.emit("end")}).on("close",function(h){r.emit("close",h)}).on("error",function(h){r.emit("error",h)}).on("drain",function(){r.emit("drain")}).on("continue",function(){r.emit("continue")});var i=0,s=!1,o=[],l;e.on("SERVICE_REQUEST",function(h){if(i===0||s||r.authenticated||h!=="ssh-userauth")return e.disconnect(Gce.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(h)}).on("USERAUTH_REQUEST",d);function d(h,v,S,E){if(i===0||l&&(l.username!==h||l.service!==v)||S!=="password"&&S!=="publickey"&&S!=="hostbased"&&S!=="keyboard-interactive"&&S!=="none"||o.length===Z8d)return e.disconnect(Gce.PROTOCOL_ERROR);if(v!=="ssh-connection")return e.disconnect(Gce.SERVICE_NOT_AVAILABLE);e._state.authMethod=S;var A;if(S==="keyboard-interactive"?A=new HWe(e,h,v,S,E,u):S==="publickey"?A=new cmr(e,h,v,S,E,u):S==="hostbased"?A=new Gyi(e,h,v,S,E,u):S==="password"?A=new Vyi(e,h,v,S,E,u):S==="none"&&(A=new AP(e,h,v,S,u)),l)if(l._initialResponse)l._multistep&&!this._finalResponse&&(l._cleanup&&l._cleanup(),l.emit("abort"));else return o.push(A);l=A,hC(r,"authentication")?r.emit("authentication",l):l.reject()}a(d,"onUSERAUTH_REQUEST");function u(h,v,S,E){l===h&&!r.authenticated&&(v?(e.removeListener("USERAUTH_REQUEST",d),l=void 0,r.authenticated=!0,e.authSuccess(),o=[],r.emit("ready")):(e.authFailure(S,E),o.length&&(l=o.pop(),hC(r,"authentication")?r.emit("authentication",l):l.reject())))}a(u,"onAuthDecide");var m=[];function g(){for(var h;m.length>0&&m[0].type;)h=m.shift(),h.type==="SUCCESS"&&e.requestSuccess(h.buf),h.type==="FAILURE"&&e.requestFailure()}a(g,"sendReplies"),e.on("GLOBAL_REQUEST",function(h,v,S){var E={type:null,buf:null};function A(I,N){E.type=I,E.buf=N,g()}if(a(A,"setReply"),v&&m.push(E),(h==="tcpip-forward"||h==="cancel-tcpip-forward"||h==="no-more-sessions@openssh.com"||h==="streamlocal-forward@openssh.com"||h==="cancel-streamlocal-forward@openssh.com")&&hC(r,"request")&&r.authenticated){var P,R;if(v){var j=!1;P=a(function(I){if(!j){j=!0;var N;h==="tcpip-forward"&&S.bindPort===0&&typeof I=="number"&&(N=Buffer.allocUnsafe(4),Y8d(N,I,0)),A("SUCCESS",N)}},"accept"),R=a(function(){j||(j=!0,A("FAILURE"))},"reject")}if(h==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,P&&P();return}r.emit("request",P,R,h,S)}else v&&A("FAILURE")}),e.on("CHANNEL_OPEN",function(h){if(h.type==="session"&&r.noMoreSessions||!r.authenticated){var v=smr.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,v)}var S=Hyi(r),E,A,P=!1;if(S===!1)return e.channelOpenFail(h.sender,smr.RESOURCE_SHORTAGE);switch(n[S]=!0,A=a(function(){if(!P){P=!0,delete n[S];var R=smr.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,R)}},"reject"),h.type){case"session":hC(r,"session")?(E=a(function(){if(!P)return P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE),new $yi(r,h,S)},"accept"),r.emit("session",E,A)):A();break;case"direct-tcpip":hC(r,"tcpip")?(E=a(function(){if(!P){P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE);var R={type:void 0,incoming:{id:S,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new kw(R,r)}},"accept"),r.emit("tcpip",E,A,h.data)):A();break;case"direct-streamlocal@openssh.com":hC(r,"openssh.streamlocal")?(E=a(function(){if(!P){P=!0,e.channelOpenConfirm(h.sender,S,kw.MAX_WINDOW,kw.PACKET_SIZE);var R={type:void 0,incoming:{id:S,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new kw(R,r)}},"accept"),r.emit("openssh.streamlocal",E,A,h.data)):A();break;default:A()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),GWe&&this.once("ready",function(){GWe.add(e)})}a(P6,"Client");x6(P6,A6);P6.prototype.end=function(){return this._sshstream.disconnect(Gce.BY_APPLICATION)};P6.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return lmr(this,"x11",n,r)};P6.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return lmr(this,"forwarded-tcpip",s,i)};P6.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return lmr(this,"forwarded-streamlocal@openssh.com",r,t)};P6.prototype.rekey=function(e){var t=this._sshstream,r=!0,n;try{r=t.rekey()}catch(i){n=i}return typeof e=="function"&&(n?process.nextTick(function(){e(n)}):this.once("rekey",e)),r};function $yi(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,o,l={type:"session",incoming:{id:r,window:kw.MAX_WINDOW,packetSize:kw.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function d(g){var h=!1,v,S;if(g.wantReply&&(g.request!=="shell"&&g.request!=="exec"&&g.request!=="subsystem"&&(v=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelSuccess(s)},"accept")),S=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelFailure(s)},"reject")),n){S&&S();return}switch(g.request){case"env":hC(i,"env")?i.emit("env",v,S,{key:g.key,val:g.val}):S&&S();break;case"pty-req":hC(i,"pty")?i.emit("pty",v,S,{cols:g.cols,rows:g.rows,width:g.width,height:g.height,term:g.term,modes:g.modes}):S&&S();break;case"window-change":hC(i,"window-change")?i.emit("window-change",v,S,{cols:g.cols,rows:g.rows,width:g.width,height:g.height}):S&&S();break;case"x11-req":hC(i,"x11")?i.emit("x11",v,S,{single:g.single,protocol:g.protocol,cookie:g.cookie,screen:g.screen}):S&&S();break;case"signal":hC(i,"signal")?i.emit("signal",v,S,{name:g.signal}):S&&S();break;case"auth-agent-req@openssh.com":hC(i,"auth-agent")?i.emit("auth-agent",v,S):S&&S();break;case"shell":hC(i,"shell")?(v=a(function(){if(!(h||n||o))return h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request,o},"accept"),i.emit("shell",v,S)):S&&S();break;case"exec":hC(i,"exec")?(v=a(function(){if(!(h||n||o))return h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request,o},"accept"),i.emit("exec",v,S,{command:g.command})):S&&S();break;case"subsystem":v=a(function(){if(!(h||n||o))if(h=!0,g.wantReply&&e._sshstream.channelSuccess(s),o=new kw(l,e,{server:!0}),o.subtype=i.subtype=g.request+":"+g.subsystem,g.subsystem==="sftp"){var E=new J8d({server:!0,debug:e._sshstream.debug});return o.pipe(E).pipe(o),E}else return o},"accept"),g.subsystem==="sftp"&&hC(i,"sftp")?i.emit("sftp",v,S):g.subsystem!=="sftp"&&hC(i,"subsystem")?i.emit("subsystem",v,S,{name:g.subsystem}):S&&S();break;default:S&&S()}}a(d,"onREQUEST");function u(){n=!0,i.emit("eof"),i.emit("end")}a(u,"onEOF");function m(){n=!0,i.emit("close")}a(m,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,d).once("CHANNEL_EOF:"+r,u).once("CHANNEL_CLOSE:"+r,m)}a($yi,"Session");x6($yi,A6);function AP(e,t,r,n,i){A6.call(this);var s=this;this.username=this.user=t,this.service=r,this.method=n,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=function(o,l,d){s._finalResponse||(s._finalResponse=!0,i(s,o,l,d))},this._stream=e}a(AP,"AuthContext");x6(AP,A6);AP.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};AP.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var e5d=/[ \t\r\n]*,[ \t\r\n]*/g;function HWe(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this._multistep=!0;var o=this;this._cb=void 0,this._onInfoResponse=function(l){if(o._cb){var d=o._cb;o._cb=void 0,d(l)}},this.submethods=i.split(e5d),this.on("abort",function(){o._cb&&o._cb(new Error("Authentication request aborted"))})}a(HWe,"KeyboardAuthContext");x6(HWe,AP);HWe.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};HWe.prototype.prompt=function(e,t,r,n){Array.isArray(e)||(e=[e]),typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0);for(var i=0;i<e.length;++i)typeof e[i]=="string"&&(e[i]={prompt:e[i],echo:!0});return this._cb=n,this._initialResponse=!0,this._stream.once("USERAUTH_INFO_RESPONSE",this._onInfoResponse),this._stream.authInfoReq(t,r,e)};function cmr(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var o;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":o="sha1";break;case"ssh-ed25519":o=null;break;case"ecdsa-sha2-nistp256":o="sha256";break;case"ecdsa-sha2-nistp384":o="sha384";break;case"ecdsa-sha2-nistp521":o="sha512";break}this.sigAlgo=o,this.blob=i.blob}a(cmr,"PKAuthContext");x6(cmr,AP);cmr.prototype.accept=function(){this.signature?AP.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function Gyi(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.key={algo:i.keyAlgo,data:i.key},this.signature=i.signature;var o;if(this.signature)switch(i.keyAlgo){case"ssh-rsa":case"ssh-dss":o="sha1";break;case"ssh-ed25519":o=null;break;case"ecdsa-sha2-nistp256":o="sha256";break;case"ecdsa-sha2-nistp384":o="sha384";break;case"ecdsa-sha2-nistp521":o="sha512";break}this.sigAlgo=o,this.blob=i.blob,this.localHostname=i.localHostname,this.localUsername=i.localUsername}a(Gyi,"HostbasedAuthContext");x6(Gyi,AP);function Vyi(e,t,r,n,i,s){AP.call(this,e,t,r,n,s),this.password=i}a(Vyi,"PwdAuthContext");x6(Vyi,AP);function lmr(e,t,r,n){var i=Hyi(e),s=kw.MAX_WINDOW,o=kw.PACKET_SIZE,l=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var d=e._sshstream;return d.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(u){d.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var m={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:u.sender,window:u.window,packetSize:u.packetSize,state:"open"}};n(void 0,new kw(m,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(u){d.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var m=new Error("(SSH) Channel open failure: "+u.description);m.reason=u.reason,m.lang=u.lang,n(m)}),t==="forwarded-tcpip"?l=d.forwardedTcpip(i,s,o,r):t==="x11"?l=d.x11(i,s,o,r):t==="forwarded-streamlocal@openssh.com"&&(l=d.openssh_forwardedStreamLocal(i,s,o,r)),l}a(lmr,"openChannel");function Hyi(e){if(e._curChan<Byi)return++e._curChan;for(var t=0,r=e._channels;t<Byi;++t)if(!r[t])return t;return!1}a(Hyi,"nextChannel");kv.createServer=function(e,t){return new kv(e,t)};kv.KEEPALIVE_INTERVAL=1e3;kv.KEEPALIVE_CLIENT_INTERVAL=15e3;kv.KEEPALIVE_CLIENT_COUNT_MAX=3;dmr.exports=kv;dmr.exports.IncomingClient=P6});var nmr=w((gRf,i_i)=>{var Hce=require("crypto"),t5d=require("net").Socket,r5d=require("dns").lookup,Jyi=require("events").EventEmitter,n5d=require("util").inherits,i5d=Hce.getHashes(),Wce=FWe(),a5d=Wce.SSH2Stream,fmr=Wce.SFTPStream,C5=Wce.constants,s5d=C5.BUGS,Vce=C5.ALGORITHMS,o5d=C5.EDDSA_SUPPORTED,c5d=Wce.utils.parseKey,Qyi=pyi(),T6=amr(),umr=Lyi(),l5d=Myi(),mmr=jJ().readUInt32BE,Kyi=Math.pow(2,32)-1,WWe=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,Xyi=a(function(e){},"DEBUG_NOOP");function Mh(){if(!(this instanceof Mh))return new Mh;Jyi.call(this),this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._readyTimeout=void 0,this._channels=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._curChan=void 0,this._remoteVer=void 0,this._sshstream=void 0,this._sock=void 0,this._resetKA=void 0}a(Mh,"Client");n5d(Mh,Jyi);Mh.prototype.connect=function(e){var t=this;if(this._sock&&this._sock.writable){this.once("close",function(){t.connect(e)}),this.end();return}this.config.host=e.hostname||e.host||"localhost",this.config.port=e.port||22,this.config.localAddress=typeof e.localAddress=="string"?e.localAddress:void 0,this.config.localPort=typeof e.localPort=="string"||typeof e.localPort=="number"?e.localPort:void 0,this.config.forceIPv4=e.forceIPv4||!1,this.config.forceIPv6=e.forceIPv6||!1,this.config.keepaliveCountMax=typeof e.keepaliveCountMax=="number"&&e.keepaliveCountMax>=0?e.keepaliveCountMax:3,this.config.keepaliveInterval=typeof e.keepaliveInterval=="number"&&e.keepaliveInterval>0?e.keepaliveInterval:0,this.config.readyTimeout=typeof e.readyTimeout=="number"&&e.readyTimeout>=0?e.readyTimeout:2e4;var r={kex:void 0,kexBuf:void 0,cipher:void 0,cipherBuf:void 0,serverHostKey:void 0,serverHostKeyBuf:void 0,hmac:void 0,hmacBuf:void 0,compress:void 0,compressBuf:void 0},n;if(typeof e.algorithms=="object"&&e.algorithms!==null){var i,s;if(s=e.algorithms.kex,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_KEX,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported key exchange algorithm: "+s[n]);r.kex=s}if(s=e.algorithms.cipher,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_CIPHER,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported cipher algorithm: "+s[n]);r.cipher=s}if(s=e.algorithms.serverHostKey,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_SERVER_HOST_KEY,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported server host key algorithm: "+s[n]);r.serverHostKey=s}if(s=e.algorithms.hmac,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_HMAC,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported HMAC algorithm: "+s[n]);r.hmac=s}if(s=e.algorithms.compress,Array.isArray(s)&&s.length>0){for(i=Vce.SUPPORTED_COMPRESS,n=0;n<s.length;++n)if(i.indexOf(s[n])===-1)throw new Error("Unsupported compression algorithm: "+s[n]);r.compress=s}}if(r.compress===void 0&&(e.compress?(r.compress=["zlib@openssh.com","zlib"],e.compress!=="force"&&r.compress.push("none")):e.compress===!1&&(r.compress=["none"])),typeof e.username=="string")this.config.username=e.username;else if(typeof e.user=="string")this.config.username=e.user;else throw new Error("Invalid username");this.config.password=typeof e.password=="string"?e.password:void 0,this.config.privateKey=typeof e.privateKey=="string"||Buffer.isBuffer(e.privateKey)?e.privateKey:void 0,this.config.localHostname=typeof e.localHostname=="string"&&e.localHostname.length?e.localHostname:void 0,this.config.localUsername=typeof e.localUsername=="string"&&e.localUsername.length?e.localUsername:void 0,this.config.tryKeyboard=e.tryKeyboard===!0,this.config.agent=typeof e.agent=="string"&&e.agent.length?e.agent:void 0,this.config.allowAgentFwd=e.agentForward===!0&&this.config.agent!==void 0;var o=this.config.authHandler=typeof e.authHandler=="function"?e.authHandler:void 0;this.config.strictVendor=typeof e.strictVendor=="boolean"?e.strictVendor:!0;var l=this.config.debug=typeof e.debug=="function"?e.debug:Xyi;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var d=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var u;if(this.config.privateKey){if(u=c5d(this.config.privateKey,e.passphrase),u instanceof Error)throw new Error("Cannot parse privateKey: "+u.message);if(Array.isArray(u)&&(u=u[0]),u.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var m=this._sshstream=new a5d({algorithms:r,debug:l===Xyi?void 0:l}),g=this._sock=e.sock||new t5d;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var h=this.config.keepaliveInterval,v=this.config.keepaliveCountMax,S=0,E;function A(){if(++S>v){if(clearInterval(E),g.readable){var se=new Error("Keepalive timeout");se.level="client-timeout",t.emit("error",se),g.destroy()}return}g.writable?(d.push(P),m.ping()):clearInterval(E)}a(A,"sendKA");function P(){h>0&&(S=0,clearInterval(E),g.writable&&(E=setInterval(A,h)))}if(a(P,"resetKA"),this._resetKA=P,m.on("USERAUTH_BANNER",function(se){t.emit("banner",se)}),g.on("connect",function(){l("DEBUG: Client: Connected"),t.emit("connect"),e.sock||m.pipe(g).pipe(m)}).on("timeout",function(){t.emit("timeout")}).on("error",function(se){clearTimeout(t._readyTimeout),se.level="client-socket",t.emit("error",se)}).on("end",function(){m.unpipe(g),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("end")}).on("close",function(){m.unpipe(g),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("close");var se=d,fe=new Error("No response from server");for(d=t._callbacks=[],n=0;n<se.length;++n)se[n](fe);var H=t._channels,ge=Object.keys(H);for(t._channels={},n=0;n<ge.length;++n){var Pe=m.emit("CHANNEL_OPEN_FAILURE:"+ge[n],fe),ue=m.emit("CHANNEL_CLOSE:"+ge[n]),U;!Pe&&!ue&&(U=H[ge[n]])&&typeof U=="function"&&U(fe)}}),m.on("drain",function(){t.emit("drain")}).once("header",function(se){t._remoteVer=se.versions.software,se.greeting&&t.emit("greeting",se.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(se){se.level===void 0?se.level="protocol":se.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",se)}).on("end",function(){g.resume()}),typeof e.hostVerifier=="function"){if(i5d.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var R=e.hostVerifier,j=Hce.createHash(e.hostHash);m.once("fingerprint",function(se,fe){j.update(se);var H=R(j.digest("hex"),fe);H!==void 0&&fe(H)})}var I,N=null,Z=null,Y,J=0,ee=["none"];if(this.config.password!==void 0&&ee.push("password"),u!==void 0&&ee.push("publickey"),this.config.agent!==void 0&&ee.push("agent"),this.config.tryKeyboard&&ee.push("keyboard-interactive"),u!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&ee.push("hostbased"),o===void 0){var V=0;o=a(function(fe,H,ge){return V===ee.length?!1:ee[V++]},"authHandler")}var M=!1;function re(se){if(M=!0,se===!1){m.removeListener("USERAUTH_FAILURE",O),m.removeListener("USERAUTH_PK_OK",$);var fe=new Error("All configured authentication methods failed");fe.level="client-authentication",t.emit("error",fe),m.writable&&t.end();return}if(ee.indexOf(se)===-1)throw new Error("Authentication method not allowed: "+se);switch(I=se,I){case"password":m.authPassword(t.config.username,t.config.password);break;case"publickey":m.authPK(t.config.username,u),m.once("USERAUTH_PK_OK",$);break;case"hostbased":let ge=function(Pe,ue){var U=u.sign(Pe);if(U instanceof Error)return U.message="Error while signing data with privateKey: "+U.message,U.level="client-authentication",t.emit("error",U),K();ue(U)};var H=ge;a(ge,"hostbasedCb"),m.authHostbased(t.config.username,u,t.config.localHostname,t.config.localUsername,ge);break;case"agent":umr(t.config.agent,function(Pe,ue){if(Pe)return Pe.level="agent",t.emit("error",Pe),Y=void 0,K();if(ue.length===0)return l("DEBUG: Agent: No keys stored in agent"),Y=void 0,K();Y=ue,J=0,m.authPK(t.config.username,ue[0]),m.once("USERAUTH_PK_OK",$)});break;case"keyboard-interactive":m.authKeyboard(t.config.username),m.on("USERAUTH_INFO_REQUEST",D);break;case"none":m.authNone(t.config.username);break}}a(re,"doNextAuth");function K(){M=!1;var se=o(Z,N,re);M||se===void 0||re(se)}a(K,"tryNextAuth");function G(){if(I==="agent"){if(J>=Y.length)return;++J>=Y.length?(l("DEBUG: Agent: No more keys left to try"),l("DEBUG: Client: agent auth failed"),Y=void 0,K()):(l("DEBUG: Agent: Trying key #"+(J+1)),m.authPK(t.config.username,Y[J]),m.once("USERAUTH_PK_OK",$))}}a(G,"tryNextAgentKey");function D(se,fe,H,ge){var Pe=Array.isArray(ge)?ge.length:0;if(Pe===0)return l("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),m.authInfoRes();t.emit("keyboard-interactive",se,fe,H,ge,function(ue){m.authInfoRes(ue)})}a(D,"onUSERAUTH_INFO_REQUEST");function $(){if(I==="agent"){var se=Y[J],fe=mmr(se,0),H=se.toString("ascii",4,4+fe),ge=H.slice(4);switch(H){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(o5d&&H==="ssh-ed25519")break;return l("DEBUG: Agent: Skipping unsupported key type: "+H),G()}m.authPK(t.config.username,se,function(Pe,ue){umr(t.config.agent,se,ge,Pe,function(U,xe){if(U)U.level="agent",t.emit("error",U);else{var W=mmr(xe,0);if(4+W+4<xe.length){var X=xe.toString("ascii",4,4+W);if(X!==H)U=new Error("Agent key/signature type mismatch"),U.level="agent",t.emit("error",U);else return ue(xe.slice(4+W+4))}}G()})})}else I==="publickey"&&m.authPK(t.config.username,u,function(Pe,ue){var U=u.sign(Pe);if(U instanceof Error)return U.message="Error while signing data with privateKey: "+U.message,U.level="client-authentication",t.emit("error",U),K();ue(U)})}a($,"onUSERAUTH_PK_OK");function O(se,fe){if(m.removeListener("USERAUTH_PK_OK",$),m.removeListener("USERAUTH_INFO_REQUEST",D),I==="agent")return l("DEBUG: Client: Agent key #"+(J+1)+" failed"),G();l("DEBUG: Client: "+I+" auth failed"),N=fe,Z=se,K()}if(a(O,"onUSERAUTH_FAILURE"),m.once("USERAUTH_SUCCESS",function(){m.removeListener("USERAUTH_FAILURE",O),m.removeListener("USERAUTH_INFO_REQUEST",D),P(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",O),m.once("ready",function(){m.service("ssh-userauth"),m.once("SERVICE_ACCEPT",function(se){se==="ssh-userauth"&&K()})}),m.on("CHANNEL_OPEN",function(se){m5d(t,se)}),m.on("REQUEST_SUCCESS",function(se){d.length&&d.shift()(!1,se)}).on("REQUEST_FAILURE",function(){d.length&&d.shift()(!0)}),m.on("GLOBAL_REQUEST",function(se,fe,H){fe&&m.requestFailure()}),e.sock)F(),m.pipe(g).pipe(m);else{let se=function(){F(),t._sock.connect({host:L,port:t.config.port,localAddress:t.config.localAddress,localPort:t.config.localPort}),t._sock.setNoDelay(!0),t._sock.setMaxListeners(0),t._sock.setTimeout(typeof e.timeout=="number"?e.timeout:0)};var ie=se;a(se,"doConnect");var L=this.config.host,z=this.config.forceIPv4,te=this.config.forceIPv6;l("DEBUG: Client: Trying "+L+" on port "+this.config.port+" ..."),!z&&!te||z&&te?se():r5d(L,z?4:6,function(fe,H,ge){if(fe){var Pe=new Error("Error while looking up "+(z?"IPv4":"IPv6")+" address for host "+L+": "+fe);clearTimeout(t._readyTimeout),Pe.level="client-dns",t.emit("error",Pe),t.emit("close");return}L=H,se()})}function F(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var se=new Error("Timed out while waiting for handshake");se.level="client-timeout",t.emit("error",se),g.destroy()},t.config.readyTimeout))}a(F,"startTimeout")};Mh.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};Mh.prototype.destroy=function(){this._sock&&this._sock.destroy()};Mh.prototype.exec=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");typeof t=="function"&&(r=t,t={});var n=this,i={allowHalfOpen:t.allowHalfOpen!==!1};return FJ(this,"session",i,function(s,o){if(s)return r(s);var l=[];function d(u){if(u)return o.close(),r(u);l.length&&l.shift()()}a(d,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&l.push(function(){t_i(o,d)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&r_i(o,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&l.push(function(){e_i(o,t.pty,d)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&l.push(function(){Zyi(o,t.x11,d)})),l.push(function(){u5d(o,e,t,r)}),l.shift()()})};Mh.prototype.shell=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this;return typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),e&&(e.x11!==void 0||e.env!==void 0)&&(t=e,e=void 0),FJ(this,"session",function(i,s){if(i)return r(i);var o=[];function l(d){if(d)return s.close(),r(d);o.length&&o.shift()()}a(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&o.push(function(){t_i(s,l)}),e!==!1&&o.push(function(){e_i(s,e,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&r_i(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&o.push(function(){Zyi(s,t.x11,l)})),o.push(function(){d5d(s,r)}),o.shift()()})};Mh.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return FJ(this,"session",function(r,n){if(r)return t(r);n_i(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};Mh.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return FJ(this,"session",function(r,n){if(r)return e(r);n_i(n,"sftp",function(i,s){if(i)return e(i);var o=t._sshstream._state.incoming.identRaw,l={debug:t.config.debug},d=new fmr(l,o);function u(h){d.removeListener("ready",m),s.removeListener("exit",g),e(h)}a(u,"onError");function m(){d.removeListener("error",u),s.removeListener("exit",g),e(void 0,new l5d(d))}a(m,"onReady");function g(h,v){d.removeListener("ready",m),d.removeListener("error",u);var S;typeof h=="number"?S="Received exit code "+h+" while establishing SFTP session":S="Received signal "+v+" while establishing SFTP session";var E=new Error(S);E.code=h,E.signal=v,e(E)}a(g,"onExit"),d.once("error",u).once("ready",m).once("close",function(){s.end()}),s.once("exit",g),d.pipe(s).pipe(d)})})};Mh.prototype.forwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s,o){if(s)return r(s!==!0?s:new Error("Unable to bind to "+e+":"+t));var l=t;t===0&&o&&o.length>=4&&(l=mmr(o,0),n._sshstream.remoteBugs&s5d.DYN_RPORT_BUG||(t=l)),n._forwarding[e+":"+t]=l,r(void 0,l)}),this._sshstream.tcpipForward(e,t,i)};Mh.prototype.unforwardIn=function(e,t,r){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var n=this,i=typeof r=="function";return i&&this._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to unbind from "+e+":"+t));delete n._forwarding[e+":"+t],r()}),this._sshstream.cancelTcpipForward(e,t,i)};Mh.prototype.forwardOut=function(e,t,r,n,i){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var s={srcIP:e,srcPort:t,dstIP:r,dstPort:n};return FJ(this,"direct-tcpip",s,i)};Mh.prototype.openssh_noMoreSessions=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=typeof e=="function";return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(t&&this._callbacks.push(function(r){if(r)return e(r!==!0?r:new Error("Unable to disable future sessions"));e()}),this._sshstream.openssh_noMoreSessions(t)):(t&&process.nextTick(function(){e(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_forwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to bind to "+e));n._forwardingUnix[e]=!0,t()}),this._sshstream.openssh_streamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_unforwardInStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var r=typeof t=="function",n=this;return!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)?(r&&this._callbacks.push(function(i){if(i)return t(i!==!0?i:new Error("Unable to unbind on "+e));delete n._forwardingUnix[e],t()}),this._sshstream.openssh_cancelStreamLocalForward(e,r)):(r&&process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}),!0)};Mh.prototype.openssh_forwardOutStreamLocal=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");if(!this.config.strictVendor||this.config.strictVendor&&WWe.test(this._remoteVer)){var r={socketPath:e};return FJ(this,"direct-streamlocal@openssh.com",r,t)}else process.nextTick(function(){t(new Error("strictVendor enabled and server is not OpenSSH or compatible version"))});return!0};function FJ(e,t,r,n){var i=Yyi(e),s=T6.MAX_WINDOW,o=T6.PACKET_SIZE,l=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var d=e._sshstream;return d.once("CHANNEL_OPEN_CONFIRMATION:"+i,u).once("CHANNEL_OPEN_FAILURE:"+i,m).once("CHANNEL_CLOSE:"+i,m),t==="session"?l=d.session(i,s,o):t==="direct-tcpip"?l=d.directTcpip(i,s,o,r):t==="direct-streamlocal@openssh.com"&&(l=d.openssh_directStreamLocal(i,s,o,r)),l;function u(g){d.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),d.removeListener("CHANNEL_CLOSE:"+i,m);var h={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}};n(void 0,new T6(h,e))}a(u,"onSuccess");function m(g){d.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,u),d.removeListener("CHANNEL_OPEN_FAILURE:"+i,m),d.removeListener("CHANNEL_CLOSE:"+i,m),delete e._channels[i];var h;g instanceof Error?h=g:typeof g=="object"&&g!==null?(h=new Error("(SSH) Channel open failure: "+g.description),h.reason=g.reason,h.lang=g.lang):(h=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),h.reason=h.lang=""),n(h)}a(m,"onFailure")}a(FJ,"openChannel");function Yyi(e){if(e._curChan<Kyi)return++e._curChan;for(var t=0,r=e._channels;t<Kyi;++t)if(!r[t])return t;return!1}a(Yyi,"nextChannel");function Zyi(e,t,r){var n={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.single=="boolean"&&(n.single=t.single),typeof t.screen=="number"&&(n.screen=t.screen),typeof t.protocol=="string"&&(n.protocol=t.protocol),typeof t.cookie=="string"?n.cookie=t.cookie:Buffer.isBuffer(t.cookie)&&(n.cookie=t.cookie.toString("hex"))),n.cookie===void 0&&(n.cookie=f5d());var i=typeof r=="function";return e.outgoing.state!=="open"?(i&&r(new Error("Channel is not open")),!0):(i&&e._callbacks.push(function(s){if(s)return r(s!==!0?s:new Error("Unable to request X11"));e._hasX11=!0,++e._client._acceptX11,e.once("close",function(){e._client._acceptX11&&--e._client._acceptX11}),r()}),e._client._sshstream.x11Forward(e.outgoing.id,n,i))}a(Zyi,"reqX11");function e_i(e,t,r){var n=24,i=80,s=640,o=480,l="vt100",d=null;typeof t=="function"?r=t:typeof t=="object"&&t!==null&&(typeof t.rows=="number"&&(n=t.rows),typeof t.cols=="number"&&(i=t.cols),typeof t.width=="number"&&(s=t.width),typeof t.height=="number"&&(o=t.height),typeof t.term=="string"&&(l=t.term),typeof t.modes=="object"&&(d=t.modes));var u=typeof r=="function";return e.outgoing.state!=="open"?(u&&r(new Error("Channel is not open")),!0):(u&&e._callbacks.push(function(m){if(m)return r(m!==!0?m:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,o,s,l,d,u))}a(e_i,"reqPty");function t_i(e,t){var r=typeof t=="function";return e.outgoing.state!=="open"?(r&&t(new Error("Channel is not open")),!0):e._client._agentFwdEnabled?(r&&t(!1),!0):(e._client._agentFwdEnabled=!0,e._callbacks.push(function(n){if(n){e._client._agentFwdEnabled=!1,r&&t(n!==!0?n:new Error("Unable to request agent forwarding"));return}r&&t()}),e._client._sshstream.openssh_agentForward(e.outgoing.id,!0))}a(t_i,"reqAgentFwd");function d5d(e,t){return e.outgoing.state!=="open"?(t(new Error("Channel is not open")),!0):(e._callbacks.push(function(r){if(r)return t(r!==!0?r:new Error("Unable to open shell"));e.subtype="shell",t(void 0,e)}),e._client._sshstream.shell(e.outgoing.id,!0))}a(d5d,"reqShell");function u5d(e,t,r,n){return e.outgoing.state!=="open"?(n(new Error("Channel is not open")),!0):(e._callbacks.push(function(i){if(i)return n(i!==!0?i:new Error("Unable to exec"));e.subtype="exec",e.allowHalfOpen=r.allowHalfOpen!==!1,n(void 0,e)}),e._client._sshstream.exec(e.outgoing.id,t,!0))}a(u5d,"reqExec");function r_i(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,o=0,l=n.length;o<l;++o)i=n[o],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}a(r_i,"reqEnv");function n_i(e,t,r){return e.outgoing.state!=="open"?(r(new Error("Channel is not open")),!0):(e._callbacks.push(function(n){if(n)return r(n!==!0?n:new Error("Unable to start subsystem: "+t));e.subtype="subsystem",r(void 0,e)}),e._client._sshstream.subsystem(e.outgoing.id,t,!0))}a(n_i,"reqSubsystem");function m5d(e,t){var r=!1,n;function i(){var l={type:t.type,incoming:{id:r,window:T6.MAX_WINDOW,packetSize:T6.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},d=new T6(l,e);return e._sshstream.channelOpenConfirm(t.sender,r,T6.MAX_WINDOW,T6.PACKET_SIZE),d}a(i,"accept");function s(){n===void 0&&(r===!1?n=C5.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=C5.CHANNEL_OPEN_FAILURE.CONNECT_FAILED),e._sshstream.channelOpenFail(t.sender,n,"","")}if(a(s,"reject"),t.type==="forwarded-tcpip"||t.type==="x11"||t.type==="auth-agent@openssh.com"||t.type==="forwarded-streamlocal@openssh.com"){var o=t.type==="forwarded-tcpip"&&e._forwarding[t.data.destIP+":"+t.data.destPort]===void 0||t.type==="forwarded-streamlocal@openssh.com"&&e._forwardingUnix[t.data.socketPath]===void 0||t.type==="x11"&&e._acceptX11===0||t.type==="auth-agent@openssh.com"&&!e._agentFwdEnabled;o?(n=C5.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=Yyi(e),r===!1?(e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: no channels available"),o=!0):e._channels[r]=!0),o&&s(),r!==!1&&(t.type==="forwarded-tcpip"?(t.data.destPort===0&&(t.data.destPort=e._forwarding[t.data.destIP+":"+t.data.destPort]),e.emit("tcp connection",t.data,i,s)):t.type==="x11"?e.emit("x11",t.data,i,s):t.type==="forwarded-streamlocal@openssh.com"?e.emit("unix connection",t.data,i,s):umr(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=C5.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}a(m5d,"onCHANNEL_OPEN");var f5d=function(){if(typeof Hce.randomFillSync=="function"){var e=Buffer.alloc(16);return a(function(){return Hce.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return a(function(){return Hce.randomBytes(16).toString("hex")},"randomCookie")}();Mh.Client=Mh;Mh.Server=Wyi();Mh.utils=Wce.utils;Mh.SFTP_STATUS_CODE=fmr.STATUS_CODE;Mh.SFTP_OPEN_MODE=fmr.OPEN_MODE;Mh.HTTPAgent=Qyi.SSHTTPAgent;Mh.HTTPSAgent=Qyi.SSHTTPSAgent;i_i.exports=Mh});var s_i=w((hRf,a_i)=>{var p5d=nmr().Client,g5d=require("http");a_i.exports=function(e){var t=new p5d,r=new g5d.Agent;return r.createConnection=function(n,i){t.once("ready",function(){t.exec("docker system dial-stdio",function(s,o){if(s){t.end(),r.destroy();return}i(null,o),o.once("close",()=>{t.end(),r.destroy()})})}).connect(e),t.once("end",()=>r.destroy())},r}});var pmr=w((yRf,o_i)=>{o_i.exports=require("stream")});var u_i=w((_Rf,d_i)=>{"use strict";function c_i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}a(c_i,"ownKeys");function h5d(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?c_i(Object(r),!0).forEach(function(n){y5d(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c_i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(h5d,"_objectSpread");function y5d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(y5d,"_defineProperty");function _5d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a(_5d,"_classCallCheck");function l_i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}a(l_i,"_defineProperties");function v5d(e,t,r){return t&&l_i(e.prototype,t),r&&l_i(e,r),e}a(v5d,"_createClass");var w5d=require("buffer"),KWe=w5d.Buffer,S5d=require("util"),gmr=S5d.inspect,b5d=gmr&&gmr.custom||"inspect";function C5d(e,t,r){KWe.prototype.copy.call(e,t,r)}a(C5d,"copyBuffer");d_i.exports=function(){function e(){_5d(this,e),this.head=null,this.tail=null,this.length=0}return a(e,"BufferList"),v5d(e,[{key:"push",value:a(function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},"push")},{key:"unshift",value:a(function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},"unshift")},{key:"shift",value:a(function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},"shift")},{key:"clear",value:a(function(){this.head=this.tail=null,this.length=0},"clear")},{key:"join",value:a(function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},"join")},{key:"concat",value:a(function(r){if(this.length===0)return KWe.alloc(0);for(var n=KWe.allocUnsafe(r>>>0),i=this.head,s=0;i;)C5d(i.data,n,s),s+=i.data.length,i=i.next;return n},"concat")},{key:"consume",value:a(function(r,n){var i;return r<this.head.data.length?(i=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?i=this.shift():i=n?this._getString(r):this._getBuffer(r),i},"consume")},{key:"first",value:a(function(){return this.head.data},"first")},{key:"_getString",value:a(function(r){var n=this.head,i=1,s=n.data;for(r-=s.length;n=n.next;){var o=n.data,l=r>o.length?o.length:r;if(l===o.length?s+=o:s+=o.slice(0,r),r-=l,r===0){l===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(l));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:a(function(r){var n=KWe.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,l=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,l),r-=l,r===0){l===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(l));break}++s}return this.length-=s,n},"_getBuffer")},{key:b5d,value:a(function(r,n){return gmr(this,h5d({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var ymr=w((vRf,f_i)=>{"use strict";function E5d(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(hmr,this,e)):process.nextTick(hmr,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(XWe,r):(r._writableState.errorEmitted=!0,process.nextTick(m_i,r,s)):process.nextTick(m_i,r,s):t?(process.nextTick(XWe,r),t(s)):process.nextTick(XWe,r)}),this)}a(E5d,"destroy");function m_i(e,t){hmr(e,t),XWe(e)}a(m_i,"emitErrorAndCloseNT");function XWe(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}a(XWe,"emitCloseNT");function A5d(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}a(A5d,"undestroy");function hmr(e,t){e.emit("error",t)}a(hmr,"emitErrorNT");function x5d(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}a(x5d,"errorOrDestroy");f_i.exports={destroy:E5d,undestroy:A5d,errorOrDestroy:x5d}});var R6=w((wRf,h_i)=>{"use strict";var g_i={};function OR(e,t,r){r||(r=Error);function n(s,o,l){return typeof t=="string"?t:t(s,o,l)}a(n,"getMessage");class i extends r{constructor(o,l,d){super(n(o,l,d))}}a(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,g_i[e]=i}a(OR,"createErrorType");function p_i(e,t){if(Array.isArray(e)){let r=e.length;return e=e.map(n=>String(n)),r>2?`one of ${t} ${e.slice(0,r-1).join(", ")}, or `+e[r-1]:r===2?`one of ${t} ${e[0]} or ${e[1]}`:`of ${t} ${e[0]}`}else return`of ${t} ${String(e)}`}a(p_i,"oneOf");function P5d(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}a(P5d,"startsWith");function T5d(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}a(T5d,"endsWith");function R5d(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}a(R5d,"includes");OR("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);OR("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&P5d(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(T5d(e," argument"))i=`The ${e} ${n} ${p_i(t,"type")}`;else{let s=R5d(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${p_i(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);OR("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");OR("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});OR("ERR_STREAM_PREMATURE_CLOSE","Premature close");OR("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});OR("ERR_MULTIPLE_CALLBACK","Callback called multiple times");OR("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");OR("ERR_STREAM_WRITE_AFTER_END","write after end");OR("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);OR("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);OR("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");h_i.exports.codes=g_i});var _mr=w((SRf,y_i)=>{"use strict";var D5d=R6().codes.ERR_INVALID_OPT_VALUE;function k5d(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}a(k5d,"highWaterMarkFrom");function I5d(e,t,r,n){var i=k5d(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new D5d(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}a(I5d,"getHighWaterMark");y_i.exports={getHighWaterMark:I5d}});var JWe=w((bRf,__i)=>{__i.exports=require("util").deprecate});var Smr=w((CRf,E_i)=>{"use strict";E_i.exports=B_;function w_i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){aGd(t,e)}}a(w_i,"CorkedRequest");var UJ;B_.WritableState=Xce;var N5d={deprecate:JWe()},S_i=pmr(),YWe=require("buffer").Buffer,L5d=global.Uint8Array||function(){};function q5d(e){return YWe.from(e)}a(q5d,"_uint8ArrayToBuffer");function z5d(e){return YWe.isBuffer(e)||e instanceof L5d}a(z5d,"_isUint8Array");var wmr=ymr(),M5d=_mr(),O5d=M5d.getHighWaterMark,D6=R6().codes,j5d=D6.ERR_INVALID_ARG_TYPE,F5d=D6.ERR_METHOD_NOT_IMPLEMENTED,U5d=D6.ERR_MULTIPLE_CALLBACK,B5d=D6.ERR_STREAM_CANNOT_PIPE,$5d=D6.ERR_STREAM_DESTROYED,G5d=D6.ERR_STREAM_NULL_VALUES,V5d=D6.ERR_STREAM_WRITE_AFTER_END,H5d=D6.ERR_UNKNOWN_ENCODING,BJ=wmr.errorOrDestroy;lw()(B_,S_i);function W5d(){}a(W5d,"nop");function Xce(e,t,r){UJ=UJ||E5(),e=e||{},typeof r!="boolean"&&(r=t instanceof UJ),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=O5d(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var n=e.decodeStrings===!1;this.decodeStrings=!n,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(i){eGd(t,i)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new w_i(this)}a(Xce,"WritableState");Xce.prototype.getBuffer=a(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(Xce.prototype,"buffer",{get:N5d.deprecate(a(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var QWe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(QWe=Function.prototype[Symbol.hasInstance],Object.defineProperty(B_,Symbol.hasInstance,{value:a(function(t){return QWe.call(this,t)?!0:this!==B_?!1:t&&t._writableState instanceof Xce},"value")})):QWe=a(function(t){return t instanceof this},"realHasInstance");function B_(e){UJ=UJ||E5();var t=this instanceof UJ;if(!t&&!QWe.call(B_,this))return new B_(e);this._writableState=new Xce(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),S_i.call(this)}a(B_,"Writable");B_.prototype.pipe=function(){BJ(this,new B5d)};function K5d(e,t){var r=new V5d;BJ(e,r),process.nextTick(t,r)}a(K5d,"writeAfterEnd");function X5d(e,t,r,n){var i;return r===null?i=new G5d:typeof r!="string"&&!t.objectMode&&(i=new j5d("chunk",["string","Buffer"],r)),i?(BJ(e,i),process.nextTick(n,i),!1):!0}a(X5d,"validChunk");B_.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&z5d(e);return s&&!YWe.isBuffer(e)&&(e=q5d(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=W5d),n.ending?K5d(this,r):(s||X5d(this,n,e,r))&&(n.pendingcb++,i=Q5d(this,n,s,e,t,r)),i};B_.prototype.cork=function(){this._writableState.corked++};B_.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&b_i(this,e))};B_.prototype.setDefaultEncoding=a(function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new H5d(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty(B_.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function J5d(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=YWe.from(t,r)),t}a(J5d,"decodeChunk");Object.defineProperty(B_.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});function Q5d(e,t,r,n,i,s){if(!r){var o=J5d(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var l=t.objectMode?1:n.length;t.length+=l;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else vmr(e,t,!1,l,n,i,s);return d}a(Q5d,"writeOrBuffer");function vmr(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new $5d("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}a(vmr,"doWrite");function Y5d(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(Kce,e,t),e._writableState.errorEmitted=!0,BJ(e,n)):(i(n),e._writableState.errorEmitted=!0,BJ(e,n),Kce(e,t))}a(Y5d,"onwriteError");function Z5d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}a(Z5d,"onwriteStateUpdate");function eGd(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new U5d;if(Z5d(r),t)Y5d(e,r,n,t,i);else{var s=C_i(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&b_i(e,r),n?process.nextTick(v_i,e,r,s,i):v_i(e,r,s,i)}}a(eGd,"onwrite");function v_i(e,t,r,n){r||tGd(e,t),t.pendingcb--,n(),Kce(e,t)}a(v_i,"afterWrite");function tGd(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}a(tGd,"onwriteDrain");function b_i(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var o=0,l=!0;r;)i[o]=r,r.isBuf||(l=!1),r=r.next,o+=1;i.allBuffers=l,vmr(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new w_i(t),t.bufferedRequestCount=0}else{for(;r;){var d=r.chunk,u=r.encoding,m=r.callback,g=t.objectMode?1:d.length;if(vmr(e,t,!1,g,d,u,m),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}a(b_i,"clearBuffer");B_.prototype._write=function(e,t,r){r(new F5d("_write()"))};B_.prototype._writev=null;B_.prototype.end=function(e,t,r){var n=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||iGd(this,n,r),this};Object.defineProperty(B_.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function C_i(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}a(C_i,"needFinish");function rGd(e,t){e._final(function(r){t.pendingcb--,r&&BJ(e,r),t.prefinished=!0,e.emit("prefinish"),Kce(e,t)})}a(rGd,"callFinal");function nGd(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(rGd,e,t)):(t.prefinished=!0,e.emit("prefinish")))}a(nGd,"prefinish");function Kce(e,t){var r=C_i(t);if(r&&(nGd(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}a(Kce,"finishMaybe");function iGd(e,t,r){t.ending=!0,Kce(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}a(iGd,"endWritable");function aGd(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}a(aGd,"onCorkedFinish");Object.defineProperty(B_.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:a(function(t){!this._writableState||(this._writableState.destroyed=t)},"set")});B_.prototype.destroy=wmr.destroy;B_.prototype._undestroy=wmr.undestroy;B_.prototype._destroy=function(e,t){t(e)}});var E5=w((ERf,x_i)=>{"use strict";var sGd=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};x_i.exports=Kq;var A_i=Emr(),Cmr=Smr();lw()(Kq,A_i);for(bmr=sGd(Cmr.prototype),ZWe=0;ZWe<bmr.length;ZWe++)eKe=bmr[ZWe],Kq.prototype[eKe]||(Kq.prototype[eKe]=Cmr.prototype[eKe]);var bmr,eKe,ZWe;function Kq(e){if(!(this instanceof Kq))return new Kq(e);A_i.call(this,e),Cmr.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",oGd)))}a(Kq,"Duplex");Object.defineProperty(Kq.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(Kq.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(Kq.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function oGd(){this._writableState.ended||process.nextTick(cGd,this)}a(oGd,"onend");function cGd(e){e.end()}a(cGd,"onEndNT");Object.defineProperty(Kq.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:a(function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)},"set")})});var R_i=w((Amr,T_i)=>{var tKe=require("buffer"),Xq=tKe.Buffer;function P_i(e,t){for(var r in e)t[r]=e[r]}a(P_i,"copyProps");Xq.from&&Xq.alloc&&Xq.allocUnsafe&&Xq.allocUnsafeSlow?T_i.exports=tKe:(P_i(tKe,Amr),Amr.Buffer=A5);function A5(e,t,r){return Xq(e,t,r)}a(A5,"SafeBuffer");A5.prototype=Object.create(Xq.prototype);P_i(Xq,A5);A5.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Xq(e,t,r)};A5.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=Xq(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};A5.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xq(e)};A5.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return tKe.SlowBuffer(e)}});var Tmr=w(k_i=>{"use strict";var Pmr=R_i().Buffer,D_i=Pmr.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function lGd(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}a(lGd,"_normalizeEncoding");function dGd(e){var t=lGd(e);if(typeof t!="string"&&(Pmr.isEncoding===D_i||!D_i(e)))throw new Error("Unknown encoding: "+e);return t||e}a(dGd,"normalizeEncoding");k_i.StringDecoder=Jce;function Jce(e){this.encoding=dGd(e);var t;switch(this.encoding){case"utf16le":this.text=hGd,this.end=yGd,t=4;break;case"utf8":this.fillLast=fGd,t=4;break;case"base64":this.text=_Gd,this.end=vGd,t=3;break;default:this.write=wGd,this.end=SGd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Pmr.allocUnsafe(t)}a(Jce,"StringDecoder");Jce.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Jce.prototype.end=gGd;Jce.prototype.text=pGd;Jce.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function xmr(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}a(xmr,"utf8CheckByte");function uGd(e,t,r){var n=t.length-1;if(n<r)return 0;var i=xmr(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=xmr(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=xmr(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}a(uGd,"utf8CheckIncomplete");function mGd(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}a(mGd,"utf8CheckExtraBytes");function fGd(e){var t=this.lastTotal-this.lastNeed,r=mGd(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}a(fGd,"utf8FillLast");function pGd(e,t){var r=uGd(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}a(pGd,"utf8Text");function gGd(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}a(gGd,"utf8End");function hGd(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}a(hGd,"utf16Text");function yGd(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}a(yGd,"utf16End");function _Gd(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}a(_Gd,"base64Text");function vGd(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}a(vGd,"base64End");function wGd(e){return e.toString(this.encoding)}a(wGd,"simpleWrite");function SGd(e){return e&&e.length?this.write(e):""}a(SGd,"simpleEnd")});var rKe=w((xRf,L_i)=>{"use strict";var I_i=R6().codes.ERR_STREAM_PREMATURE_CLOSE;function bGd(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}a(bGd,"once");function CGd(){}a(CGd,"noop");function EGd(e){return e.setHeader&&typeof e.abort=="function"}a(EGd,"isRequest");function N_i(e,t,r){if(typeof t=="function")return N_i(e,null,t);t||(t={}),r=bGd(r||CGd);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=a(function(){e.writable||l()},"onlegacyfinish"),o=e._writableState&&e._writableState.finished,l=a(function(){i=!1,o=!0,n||r.call(e)},"onfinish"),d=e._readableState&&e._readableState.endEmitted,u=a(function(){n=!1,d=!0,i||r.call(e)},"onend"),m=a(function(S){r.call(e,S)},"onerror"),g=a(function(){var S;if(n&&!d)return(!e._readableState||!e._readableState.ended)&&(S=new I_i),r.call(e,S);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(S=new I_i),r.call(e,S)},"onclose"),h=a(function(){e.req.on("finish",l)},"onrequest");return EGd(e)?(e.on("complete",l),e.on("abort",g),e.req?h():e.on("request",h)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",u),e.on("finish",l),t.error!==!1&&e.on("error",m),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",h),e.req&&e.req.removeListener("finish",l),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",l),e.removeListener("end",u),e.removeListener("error",m),e.removeListener("close",g)}}a(N_i,"eos");L_i.exports=N_i});var z_i=w((PRf,q_i)=>{"use strict";var nKe;function k6(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(k6,"_defineProperty");var AGd=rKe(),I6=Symbol("lastResolve"),x5=Symbol("lastReject"),Qce=Symbol("error"),iKe=Symbol("ended"),P5=Symbol("lastPromise"),Rmr=Symbol("handlePromise"),T5=Symbol("stream");function N6(e,t){return{value:e,done:t}}a(N6,"createIterResult");function xGd(e){var t=e[I6];if(t!==null){var r=e[T5].read();r!==null&&(e[P5]=null,e[I6]=null,e[x5]=null,t(N6(r,!1)))}}a(xGd,"readAndResolve");function PGd(e){process.nextTick(xGd,e)}a(PGd,"onReadable");function TGd(e,t){return function(r,n){e.then(function(){if(t[iKe]){r(N6(void 0,!0));return}t[Rmr](r,n)},n)}}a(TGd,"wrapForNext");var RGd=Object.getPrototypeOf(function(){}),DGd=Object.setPrototypeOf((nKe={get stream(){return this[T5]},next:a(function(){var t=this,r=this[Qce];if(r!==null)return Promise.reject(r);if(this[iKe])return Promise.resolve(N6(void 0,!0));if(this[T5].destroyed)return new Promise(function(o,l){process.nextTick(function(){t[Qce]?l(t[Qce]):o(N6(void 0,!0))})});var n=this[P5],i;if(n)i=new Promise(TGd(n,this));else{var s=this[T5].read();if(s!==null)return Promise.resolve(N6(s,!1));i=new Promise(this[Rmr])}return this[P5]=i,i},"next")},k6(nKe,Symbol.asyncIterator,function(){return this}),k6(nKe,"return",a(function(){var t=this;return new Promise(function(r,n){t[T5].destroy(null,function(i){if(i){n(i);return}r(N6(void 0,!0))})})},"_return")),nKe),RGd),kGd=a(function(t){var r,n=Object.create(DGd,(r={},k6(r,T5,{value:t,writable:!0}),k6(r,I6,{value:null,writable:!0}),k6(r,x5,{value:null,writable:!0}),k6(r,Qce,{value:null,writable:!0}),k6(r,iKe,{value:t._readableState.endEmitted,writable:!0}),k6(r,Rmr,{value:a(function(s,o){var l=n[T5].read();l?(n[P5]=null,n[I6]=null,n[x5]=null,s(N6(l,!1))):(n[I6]=s,n[x5]=o)},"value"),writable:!0}),r));return n[P5]=null,AGd(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[x5];s!==null&&(n[P5]=null,n[I6]=null,n[x5]=null,s(i)),n[Qce]=i;return}var o=n[I6];o!==null&&(n[P5]=null,n[I6]=null,n[x5]=null,o(N6(void 0,!0))),n[iKe]=!0}),t.on("readable",PGd.bind(null,n)),n},"createReadableStreamAsyncIterator");q_i.exports=kGd});var F_i=w((TRf,j_i)=>{"use strict";function M_i(e,t,r,n,i,s,o){try{var l=e[s](o),d=l.value}catch(u){r(u);return}l.done?t(d):Promise.resolve(d).then(n,i)}a(M_i,"asyncGeneratorStep");function IGd(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function o(d){M_i(s,n,i,o,l,"next",d)}a(o,"_next");function l(d){M_i(s,n,i,o,l,"throw",d)}a(l,"_throw"),o(void 0)})}}a(IGd,"_asyncToGenerator");function O_i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}a(O_i,"ownKeys");function NGd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?O_i(Object(r),!0).forEach(function(n){LGd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O_i(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(NGd,"_objectSpread");function LGd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(LGd,"_defineProperty");var qGd=R6().codes.ERR_INVALID_ARG_TYPE;function zGd(e,t,r){var n;if(t&&typeof t.next=="function")n=t;else if(t&&t[Symbol.asyncIterator])n=t[Symbol.asyncIterator]();else if(t&&t[Symbol.iterator])n=t[Symbol.iterator]();else throw new qGd("iterable",["Iterable"],t);var i=new e(NGd({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,o())};function o(){return l.apply(this,arguments)}a(o,"next");function l(){return l=IGd(function*(){try{var d=yield n.next(),u=d.value,m=d.done;m?i.push(null):i.push(yield u)?o():s=!1}catch(g){i.destroy(g)}}),l.apply(this,arguments)}return a(l,"_next2"),i}a(zGd,"from");j_i.exports=zGd});var Emr=w((DRf,J_i)=>{"use strict";J_i.exports=kp;var $J;kp.ReadableState=G_i;var RRf=require("events").EventEmitter,$_i=a(function(t,r){return t.listeners(r).length},"EElistenerCount"),Zce=pmr(),aKe=require("buffer").Buffer,MGd=global.Uint8Array||function(){};function OGd(e){return aKe.from(e)}a(OGd,"_uint8ArrayToBuffer");function jGd(e){return aKe.isBuffer(e)||e instanceof MGd}a(jGd,"_isUint8Array");var Dmr=require("util"),Of;Dmr&&Dmr.debuglog?Of=Dmr.debuglog("stream"):Of=a(function(){},"debug");var FGd=u_i(),Mmr=ymr(),UGd=_mr(),BGd=UGd.getHighWaterMark,sKe=R6().codes,$Gd=sKe.ERR_INVALID_ARG_TYPE,GGd=sKe.ERR_STREAM_PUSH_AFTER_EOF,VGd=sKe.ERR_METHOD_NOT_IMPLEMENTED,HGd=sKe.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,GJ,kmr,Imr;lw()(kp,Zce);var Yce=Mmr.errorOrDestroy,Nmr=["error","close","destroy","pause","resume"];function WGd(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}a(WGd,"prependListener");function G_i(e,t,r){$J=$J||E5(),e=e||{},typeof r!="boolean"&&(r=t instanceof $J),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=BGd(this,e,"readableHighWaterMark",r),this.buffer=new FGd,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(GJ||(GJ=Tmr().StringDecoder),this.decoder=new GJ(e.encoding),this.encoding=e.encoding)}a(G_i,"ReadableState");function kp(e){if($J=$J||E5(),!(this instanceof kp))return new kp(e);var t=this instanceof $J;this._readableState=new G_i(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),Zce.call(this)}a(kp,"Readable");Object.defineProperty(kp.prototype,"destroyed",{enumerable:!1,get:a(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:a(function(t){!this._readableState||(this._readableState.destroyed=t)},"set")});kp.prototype.destroy=Mmr.destroy;kp.prototype._undestroy=Mmr.undestroy;kp.prototype._destroy=function(e,t){t(e)};kp.prototype.push=function(e,t){var r=this._readableState,n;return r.objectMode?n=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=aKe.from(e,t),t=""),n=!0),V_i(this,e,t,!1,n)};kp.prototype.unshift=function(e){return V_i(this,e,null,!0,!1)};function V_i(e,t,r,n,i){Of("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,JGd(e,s);else{var o;if(i||(o=KGd(s,t)),o)Yce(e,o);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==aKe.prototype&&(t=OGd(t)),n)s.endEmitted?Yce(e,new HGd):Lmr(e,s,t,!0);else if(s.ended)Yce(e,new GGd);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?Lmr(e,s,t,!1):zmr(e,s)):Lmr(e,s,t,!1)}else n||(s.reading=!1,zmr(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}a(V_i,"readableAddChunk");function Lmr(e,t,r,n){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&oKe(e)),zmr(e,t)}a(Lmr,"addChunk");function KGd(e,t){var r;return!jGd(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new $Gd("chunk",["string","Buffer","Uint8Array"],t)),r}a(KGd,"chunkInvalid");kp.prototype.isPaused=function(){return this._readableState.flowing===!1};kp.prototype.setEncoding=function(e){GJ||(GJ=Tmr().StringDecoder);var t=new GJ(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,n="";r!==null;)n+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),n!==""&&this._readableState.buffer.push(n),this._readableState.length=n.length,this};var U_i=1073741824;function XGd(e){return e>=U_i?e=U_i:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}a(XGd,"computeNewHighWaterMark");function B_i(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=XGd(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}a(B_i,"howMuchToRead");kp.prototype.read=function(e){Of("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return Of("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?qmr(this):oKe(this),null;if(e=B_i(e,t),e===0&&t.ended)return t.length===0&&qmr(this),null;var n=t.needReadable;Of("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,Of("length less than watermark",n)),t.ended||t.reading?(n=!1,Of("reading or ended",n)):n&&(Of("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=B_i(r,t)));var i;return e>0?i=K_i(e,t):i=null,i===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&qmr(this)),i!==null&&this.emit("data",i),i};function JGd(e,t){if(Of("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?oKe(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,H_i(e)))}}a(JGd,"onEofChunk");function oKe(e){var t=e._readableState;Of("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Of("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(H_i,e))}a(oKe,"emitReadable");function H_i(e){var t=e._readableState;Of("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Omr(e)}a(H_i,"emitReadable_");function zmr(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(QGd,e,t))}a(zmr,"maybeReadMore");function QGd(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(Of("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}a(QGd,"maybeReadMore_");kp.prototype._read=function(e){Yce(this,new VGd("_read()"))};kp.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e);break}n.pipesCount+=1,Of("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?l:E;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",o);function o(A,P){Of("onunpipe"),A===r&&P&&P.hasUnpiped===!1&&(P.hasUnpiped=!0,m())}a(o,"onunpipe");function l(){Of("onend"),e.end()}a(l,"onend");var d=YGd(r);e.on("drain",d);var u=!1;function m(){Of("cleanup"),e.removeListener("close",v),e.removeListener("finish",S),e.removeListener("drain",d),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",l),r.removeListener("end",E),r.removeListener("data",g),u=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&d()}a(m,"cleanup"),r.on("data",g);function g(A){Of("ondata");var P=e.write(A);Of("dest.write",P),P===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&X_i(n.pipes,e)!==-1)&&!u&&(Of("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}a(g,"ondata");function h(A){Of("onerror",A),E(),e.removeListener("error",h),$_i(e,"error")===0&&Yce(e,A)}a(h,"onerror"),WGd(e,"error",h);function v(){e.removeListener("finish",S),E()}a(v,"onclose"),e.once("close",v);function S(){Of("onfinish"),e.removeListener("close",v),E()}a(S,"onfinish"),e.once("finish",S);function E(){Of("unpipe"),r.unpipe(e)}return a(E,"unpipe"),e.emit("pipe",r),n.flowing||(Of("pipe resume"),r.resume()),e};function YGd(e){return a(function(){var r=e._readableState;Of("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&$_i(e,"data")&&(r.flowing=!0,Omr(e))},"pipeOnDrainFunctionResult")}a(YGd,"pipeOnDrain");kp.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<i;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=X_i(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};kp.prototype.on=function(e,t){var r=Zce.prototype.on.call(this,e,t),n=this._readableState;return e==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):e==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,Of("on readable",n.length,n.reading),n.length?oKe(this):n.reading||process.nextTick(ZGd,this)),r};kp.prototype.addListener=kp.prototype.on;kp.prototype.removeListener=function(e,t){var r=Zce.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(W_i,this),r};kp.prototype.removeAllListeners=function(e){var t=Zce.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(W_i,this),t};function W_i(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}a(W_i,"updateReadableListening");function ZGd(e){Of("readable nexttick read 0"),e.read(0)}a(ZGd,"nReadingNextTick");kp.prototype.resume=function(){var e=this._readableState;return e.flowing||(Of("resume"),e.flowing=!e.readableListening,e7d(this,e)),e.paused=!1,this};function e7d(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(t7d,e,t))}a(e7d,"resume");function t7d(e,t){Of("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),Omr(e),t.flowing&&!t.reading&&e.read(0)}a(t7d,"resume_");kp.prototype.pause=function(){return Of("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Of("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function Omr(e){var t=e._readableState;for(Of("flow",t.flowing);t.flowing&&e.read()!==null;);}a(Omr,"flow");kp.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(Of("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Of("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var l=t.push(o);l||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=a(function(l){return a(function(){return e[l].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<Nmr.length;s++)e.on(Nmr[s],this.emit.bind(this,Nmr[s]));return this._read=function(o){Of("wrapped _read",o),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(kp.prototype[Symbol.asyncIterator]=function(){return kmr===void 0&&(kmr=z_i()),kmr(this)});Object.defineProperty(kp.prototype,"readableHighWaterMark",{enumerable:!1,get:a(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(kp.prototype,"readableBuffer",{enumerable:!1,get:a(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(kp.prototype,"readableFlowing",{enumerable:!1,get:a(function(){return this._readableState.flowing},"get"),set:a(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});kp._fromList=K_i;Object.defineProperty(kp.prototype,"readableLength",{enumerable:!1,get:a(function(){return this._readableState.length},"get")});function K_i(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}a(K_i,"fromList");function qmr(e){var t=e._readableState;Of("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(r7d,t,e))}a(qmr,"endReadable");function r7d(e,t){if(Of("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}a(r7d,"endReadableNT");typeof Symbol=="function"&&(kp.from=function(e,t){return Imr===void 0&&(Imr=F_i()),Imr(kp,e,t)});function X_i(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}a(X_i,"indexOf")});var jmr=w((kRf,Y_i)=>{"use strict";Y_i.exports=ij;var cKe=R6().codes,n7d=cKe.ERR_METHOD_NOT_IMPLEMENTED,i7d=cKe.ERR_MULTIPLE_CALLBACK,a7d=cKe.ERR_TRANSFORM_ALREADY_TRANSFORMING,s7d=cKe.ERR_TRANSFORM_WITH_LENGTH_0,lKe=E5();lw()(ij,lKe);function o7d(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new i7d);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}a(o7d,"afterTransform");function ij(e){if(!(this instanceof ij))return new ij(e);lKe.call(this,e),this._transformState={afterTransform:o7d.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",c7d)}a(ij,"Transform");function c7d(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Q_i(e,t,r)}):Q_i(this,null,null)}a(c7d,"prefinish");ij.prototype.push=function(e,t){return this._transformState.needTransform=!1,lKe.prototype.push.call(this,e,t)};ij.prototype._transform=function(e,t,r){r(new n7d("_transform()"))};ij.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};ij.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};ij.prototype._destroy=function(e,t){lKe.prototype._destroy.call(this,e,function(r){t(r)})};function Q_i(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new s7d;if(e._transformState.transforming)throw new a7d;return e.push(null)}a(Q_i,"done")});var tvi=w((IRf,evi)=>{"use strict";evi.exports=ele;var Z_i=jmr();lw()(ele,Z_i);function ele(e){if(!(this instanceof ele))return new ele(e);Z_i.call(this,e)}a(ele,"PassThrough");ele.prototype._transform=function(e,t,r){r(null,e)}});var svi=w((NRf,avi)=>{"use strict";var Fmr;function l7d(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}a(l7d,"once");var ivi=R6().codes,d7d=ivi.ERR_MISSING_ARGS,u7d=ivi.ERR_STREAM_DESTROYED;function rvi(e){if(e)throw e}a(rvi,"noop");function m7d(e){return e.setHeader&&typeof e.abort=="function"}a(m7d,"isRequest");function f7d(e,t,r,n){n=l7d(n);var i=!1;e.on("close",function(){i=!0}),Fmr===void 0&&(Fmr=rKe()),Fmr(e,{readable:t,writable:r},function(o){if(o)return n(o);i=!0,n()});var s=!1;return function(o){if(!i&&!s){if(s=!0,m7d(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new u7d("pipe"))}}}a(f7d,"destroyer");function nvi(e){e()}a(nvi,"call");function p7d(e,t){return e.pipe(t)}a(p7d,"pipe");function g7d(e){return!e.length||typeof e[e.length-1]!="function"?rvi:e.pop()}a(g7d,"popCallback");function h7d(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=g7d(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new d7d("streams");var i,s=t.map(function(o,l){var d=l<t.length-1,u=l>0;return f7d(o,d,u,function(m){i||(i=m),m&&s.forEach(nvi),!d&&(s.forEach(nvi),n(i))})});return t.reduce(p7d)}a(h7d,"pipeline");avi.exports=h7d});var FR=w((jR,rle)=>{var tle=require("stream");process.env.READABLE_STREAM==="disable"&&tle?(rle.exports=tle.Readable,Object.assign(rle.exports,tle),rle.exports.Stream=tle):(jR=rle.exports=Emr(),jR.Stream=tle||jR,jR.Readable=jR,jR.Writable=Smr(),jR.Duplex=E5(),jR.Transform=jmr(),jR.PassThrough=tvi(),jR.finished=rKe(),jR.pipeline=svi())});var lvi=w((LRf,cvi)=>{cvi.exports=aj;var y7d=require("util"),ovi=FR();y7d.inherits(aj,ovi.Duplex);function aj(e,t,r){var n=this;if(!(n instanceof aj))return new aj(e,t,r);ovi.Duplex.call(n,r),n._output=null,n.connect(e,t)}a(aj,"HttpDuplex");aj.prototype.connect=function(e,t){var r=this;r.req=e,r._output=t,r.emit("response",t),t.on("data",function(n){r.push(n)||r._output.pause()}),t.on("end",function(){r.push(null)})};aj.prototype._read=function(e){this._output&&this._output.resume()};aj.prototype._write=function(e,t,r){this.req.write(e,t),r()};aj.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};aj.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var Umr=w((qRf,dvi)=>{function _7d(e){r.debug=r,r.default=r,r.coerce=u,r.disable=o,r.enable=s,r.enabled=l,r.humanize=dH(),Object.keys(e).forEach(m=>{r[m]=e[m]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(m){let g=0;for(let h=0;h<m.length;h++)g=(g<<5)-g+m.charCodeAt(h),g|=0;return r.colors[Math.abs(g)%r.colors.length]}a(t,"selectColor"),r.selectColor=t;function r(m){let g;function h(...v){if(!h.enabled)return;let S=h,E=Number(new Date),A=E-(g||E);S.diff=A,S.prev=g,S.curr=E,g=E,v[0]=r.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let P=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(j,I)=>{if(j==="%%")return j;P++;let N=r.formatters[I];if(typeof N=="function"){let Z=v[P];j=N.call(S,Z),v.splice(P,1),P--}return j}),r.formatArgs.call(S,v),(S.log||r.log).apply(S,v)}return a(h,"debug"),h.namespace=m,h.enabled=r.enabled(m),h.useColors=r.useColors(),h.color=t(m),h.destroy=n,h.extend=i,typeof r.init=="function"&&r.init(h),r.instances.push(h),h}a(r,"createDebug");function n(){let m=r.instances.indexOf(this);return m!==-1?(r.instances.splice(m,1),!0):!1}a(n,"destroy");function i(m,g){let h=r(this.namespace+(typeof g>"u"?":":g)+m);return h.log=this.log,h}a(i,"extend");function s(m){r.save(m),r.names=[],r.skips=[];let g,h=(typeof m=="string"?m:"").split(/[\s,]+/),v=h.length;for(g=0;g<v;g++)!h[g]||(m=h[g].replace(/\*/g,".*?"),m[0]==="-"?r.skips.push(new RegExp("^"+m.substr(1)+"$")):r.names.push(new RegExp("^"+m+"$")));for(g=0;g<r.instances.length;g++){let S=r.instances[g];S.enabled=r.enabled(S.namespace)}}a(s,"enable");function o(){let m=[...r.names.map(d),...r.skips.map(d).map(g=>"-"+g)].join(",");return r.enable(""),m}a(o,"disable");function l(m){if(m[m.length-1]==="*")return!0;let g,h;for(g=0,h=r.skips.length;g<h;g++)if(r.skips[g].test(m))return!1;for(g=0,h=r.names.length;g<h;g++)if(r.names[g].test(m))return!0;return!1}a(l,"enabled");function d(m){return m.toString().substring(2,m.toString().length-2).replace(/\.\*\?$/,"*")}a(d,"toNamespace");function u(m){return m instanceof Error?m.stack||m.message:m}return a(u,"coerce"),r.enable(r.load()),r}a(_7d,"setup");dvi.exports=_7d});var uvi=w((UR,dKe)=>{UR.log=S7d;UR.formatArgs=w7d;UR.save=b7d;UR.load=C7d;UR.useColors=v7d;UR.storage=E7d();UR.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function v7d(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}a(v7d,"useColors");function w7d(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+dKe.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let r=0,n=0;e[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(r++,i==="%c"&&(n=r))}),e.splice(n,0,t)}a(w7d,"formatArgs");function S7d(...e){return typeof console=="object"&&console.log&&console.log(...e)}a(S7d,"log");function b7d(e){try{e?UR.storage.setItem("debug",e):UR.storage.removeItem("debug")}catch{}}a(b7d,"save");function C7d(){let e;try{e=UR.storage.getItem("debug")}catch{}return!e&&typeof process<"u"&&"env"in process&&(e=process.env.DEBUG),e}a(C7d,"load");function E7d(){try{return localStorage}catch{}}a(E7d,"localstorage");dKe.exports=Umr()(UR);var{formatters:A7d}=dKe.exports;A7d.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var fvi=w((b1,uKe)=>{var x7d=require("tty"),Bmr=require("util");b1.init=N7d;b1.log=D7d;b1.formatArgs=T7d;b1.save=k7d;b1.load=I7d;b1.useColors=P7d;b1.colors=[6,2,3,4,5,1];try{let e=jM();e&&(e.stderr||e).level>=2&&(b1.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}b1.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(i,s)=>s.toUpperCase()),n=process.env[t];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),e[r]=n,e},{});function P7d(){return"colors"in b1.inspectOpts?Boolean(b1.inspectOpts.colors):x7d.isatty(process.stderr.fd)}a(P7d,"useColors");function T7d(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} \x1B[0m`;e[0]=s+e[0].split(`
|
|
244
244
|
`).join(`
|
|
245
245
|
`+s),e.push(i+"m+"+uKe.exports.humanize(this.diff)+"\x1B[0m")}else e[0]=R7d()+t+" "+e[0]}a(T7d,"formatArgs");function R7d(){return b1.inspectOpts.hideDate?"":new Date().toISOString()+" "}a(R7d,"getDate");function D7d(...e){return process.stderr.write(Bmr.format(...e)+`
|
|
246
246
|
`)}a(D7d,"log");function k7d(e){e?process.env.DEBUG=e:delete process.env.DEBUG}a(k7d,"save");function I7d(){return process.env.DEBUG}a(I7d,"load");function N7d(e){e.inspectOpts={};let t=Object.keys(b1.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=b1.inspectOpts[t[r]]}a(N7d,"init");uKe.exports=Umr()(b1);var{formatters:mvi}=uKe.exports;mvi.o=function(e){return this.inspectOpts.colors=this.useColors,Bmr.inspect(e,this.inspectOpts).replace(/\s*\n\s*/g," ")};mvi.O=function(e){return this.inspectOpts.colors=this.useColors,Bmr.inspect(e,this.inspectOpts)}});var pvi=w((zRf,$mr)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?$mr.exports=uvi():$mr.exports=fvi()});var hvi=w((MRf,gvi)=>{var L7d=require("fs");gvi.exports=function(e,t,r){t=typeof t<"u"?t:`
|