stacktape 1.0.0-alpha.94 → 1.0.0-alpha.95

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 CHANGED
@@ -87,7 +87,7 @@ ${r}`}},"ERR_INTERNAL_ASSERTION");var YDs=Math.pow(2,32),XTr=function(){try{retu
87
87
  `)),typeof e.banner=="string"&&e.banner.length&&(e.banner.slice(-2)===`\r
88
88
  `?this.banner=e.banner:this.banner=e.banner+`\r
89
89
  `)),this.debug("DEBUG: Local ident: "+dRr(this.config.ident)),this.push(this.config.ident+`\r
90
- `),this._state.incoming.expectedPacket="KEXINIT"}a(jc,"SSH2Stream");gTs(jc,eve);jc.prototype.__read=eve.prototype._read;jc.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};jc.prototype.__push=eve.prototype.push;jc.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};jc.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};jc.prototype._transform=function(e,t,r,n){var i=!1,s=!1,o=this._state,c=o.incoming,l=o.outgoing,d=c.expect,f=c.decrypt,p=c.decompress,h=e.length,w=0,b=this.debug,E=this,A=0,T=A,R,B,I,q;for(this.bytesReceived+=h;;){if(d.type!==void 0){if(A>=h)break;if(d.type===fz){w=h-A;var re=d.buf.length-d.ptr;re<=w?(e.copy(d.buf,d.ptr,A,A+re),A+=re,B=d.buf,d.buf=void 0,d.ptr=0,d.type=void 0):(e.copy(d.buf,d.ptr,A),d.ptr+=w,A+=w);continue}else if(d.type===wRr){if(A+=c.search.push(e),d.type!==void 0)continue}else if(d.type===bRr){if(++d.ptr+4>255)return this.reset(),b("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[A]===10)d.type=void 0,T<A&&(d.buf===void 0?d.buf=e.toString("ascii",T,A):d.buf+=e.toString("ascii",T,A)),B=d.buf,d.buf=void 0,++A;else{++A===h&&T<A&&(d.buf===void 0?d.buf=e.toString("ascii",T,A):d.buf+=e.toString("ascii",T,A));continue}}}if(c.status===dz){if(!this.readable)return r();if(this.server)if(!B)b("DEBUG: Parser: IN_INIT (waiting for identification begin)"),GL(this,fz,4);else if(B[0]===83&&B[1]===83&&B[2]===72&&B[3]===45)c.status=pct,b("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),b("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{b("DEBUG: Parser: IN_INIT");var K=c.search=new _Ts(kTs);K.on("info",a(function H(ke,se,Y,fe){se&&(c.greeting===void 0?c.greeting=se.toString("binary",Y,fe):c.greeting+=se.toString("binary",Y,fe)),ke&&(d.type=void 0,c.search.removeListener("info",H))},"onInfo")),K.maxMatches=1,GL(this,wRr),c.status=pct}}else if(c.status===pct)b("DEBUG: Parser: IN_GREETING"),c.search=void 0,T=A,GL(this,bRr),c.status=yRr;else if(c.status===yRr){b("DEBUG: Parser: IN_HEADER"),B.charCodeAt(B.length-1)===13&&(B=B.slice(0,-1));var Z=B.indexOf("-"),ie=B.indexOf(" "),V={greeting:c.greeting,identRaw:"SSH-"+B,versions:{protocol:B.substr(0,Z),software:ie===-1?B.substring(Z+1):B.substring(Z+1,ie)},comments:ie>-1?B.substring(ie+1):void 0};if(c.greeting=void 0,V.versions.protocol!=="1.99"&&V.versions.protocol!=="2.0")return this.reset(),b("DEBUG: Parser: protocol version not supported: "+V.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",V),c.status===dz)return;var O=V.identRaw,ne=V.versions.software;this.debug("DEBUG: Remote ident: "+dRr(O));for(var $=0,U;$<CTs;++$)U=hRr[$],typeof U[0]=="string"?ne===U[0]&&(this.remoteBugs|=U[1]):U[0].test(ne)&&(this.remoteBugs|=U[1]);c.identRaw=O,this.bytesReceived-=h-A,Ect(this,function(){A===h?r():E._transform(e.slice(A),t,r)}),c.status=rve;return}else if(c.status===rve)R=f.instance?f.info.blockLen:8,b("DEBUG: Parser: IN_PACKETBEFORE (expecting "+R+")"),GL(this,fz,R,f.buf),c.status=gct;else if(c.status===gct){if(b("DEBUG: Parser: IN_PACKET"),f.instance?(s=f.info.authLen>0,s||(B=PRr(this,B)),R=f.info.blockLen):(s=!1,R=8),q=ad(B,0,this,r),q===!1)return;var D=c.hmac.info,G;D?G=D.actualLen:G=0;var z=q+4+G,L=this.maxPacketSize;if(p.instance&&(L+=(this.maxPacketSize/16384+1)*5+6),q>L||z<16+G||(q+(s?0:4))%R!=0)return this.disconnect(km.PROTOCOL_ERROR),b("DEBUG: Parser: Bad packet length ("+z+")"),r(new Error("Bad packet length"));c.pktLen=q;var N=c.pktLen+4-R;if(s?(f.instance.setAAD(B.slice(0,4)),b("DEBUG: Parser: pktLen:"+c.pktLen+",remainLen:"+N)):(c.padLen=B[4],b("DEBUG: Parser: pktLen:"+c.pktLen+",padLen:"+c.padLen+",remainLen:"+N)),N>0)s?c.pktExtra=B.slice(4):c.pktExtra=B.slice(5),GL(this,fz,N),c.status=_ct;else if(N<0)c.status=rve;else{i=!0,c.status=_ct;continue}}else if(c.status===_ct){b("DEBUG: Parser: IN_PACKETDATA"),f.instance?(s=f.info.authLen>0,i?i=!1:s||(B=PRr(this,B))):(s=!1,i=!1);var W=c.pktLen-c.padLen-1;if(c.pktExtra?(I=Buffer.allocUnsafe(c.pktExtra.length+B.length),c.pktExtra.copy(I),B.copy(I,c.pktExtra.length),c.payload=I.slice(0,W)):(s?I=B.slice(4):I=B.slice(5),c.payload=B.slice(5,5+W)),c.hmac.info!==void 0){var F=f.info.authLen||c.hmac.info.actualLen;b("DEBUG: Parser: HMAC size:"+F),GL(this,fz,F,c.hmac.buf),c.status=vRr,c.packet=I}else c.status=hct;c.pktExtra=void 0,I=void 0}else if(c.status===vRr)if(b("DEBUG: Parser: IN_PACKETDATAVERIFY"),GTs(this,B))b("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),c.status=hct,c.packet=void 0;else return this.reset(),b("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(c.status===hct){if(p.instance)if(n)n=!1;else{b("DEBUG: Parser: Decompressing"),p.instance.write(c.payload);var Q=[],ee=0;p.instance.on("readable",function(){for(var H;H=this.read();)Q.push(H),ee+=H.length}).flush(wct,function(){p.instance.removeAllListeners("readable"),Q.length===1?c.payload=Q[0]:c.payload=Buffer.concat(Q,ee),Q=null;var H;A===h?H=bct:H=e.slice(A),E._transform(H,t,r,!0)});return}this.emit("packet");var X=c.payload[0];if(b!==SRr){var ae="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",ye=o.authsQueue[0],ue=null;if(l.status===XR&&!(X<=4||X>=20&&X<=49)&&(ae+="(enqueued) "),X===Ja.KEXDH_INIT)switch(o.kex.type){case"group":ue="KEXDH_INIT";break;case"groupex":ue="KEXDH_GEX_REQUEST";break;default:ue="KEXECDH_INIT"}else if(X===Ja.KEXDH_REPLY)switch(o.kex.type){case"group":ue="KEXDH_REPLY";break;case"groupex":ue="KEXDH_GEX_GROUP";break;default:ue="KEXECDH_REPLY"}else X===Ja.KEXDH_GEX_GROUP?ue="KEXDH_GEX_GROUP":X===Ja.KEXDH_GEX_REPLY?ue="KEXDH_GEX_REPLY":X===60?ye==="password"?ue="USERAUTH_PASSWD_CHANGEREQ":ye==="keyboard-interactive"?ue="USERAUTH_INFO_REQUEST":ye==="publickey"?ue="USERAUTH_PK_OK":ue="UNKNOWN PACKET 60":X===61&&(ye==="keyboard-interactive"?ue="USERAUTH_INFO_RESPONSE":ue="UNKNOWN PACKET 61");ue===null&&(ue=Ja[X]),X!==Ja.CHANNEL_OPEN&&X!==Ja.CHANNEL_REQUEST&&X!==Ja.CHANNEL_SUCCESS&&X!==Ja.CHANNEL_FAILURE&&X!==Ja.CHANNEL_EOF&&X!==Ja.CHANNEL_CLOSE&&X!==Ja.CHANNEL_DATA&&X!==Ja.CHANNEL_EXTENDED_DATA&&X!==Ja.CHANNEL_WINDOW_ADJUST&&X!==Ja.DISCONNECT&&X!==Ja.USERAUTH_REQUEST&&X!==Ja.GLOBAL_REQUEST&&b(ae+ue)}if(l.status===WR||X<=4||X>=20&&X<=49){if(ARr(this,r)===!1||c.status===dz)return}else if(l.status===XR){if(c.rekeyQueue.length===xTs)return b("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(km.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var de=c.seqno;++c.seqno>vct&&(c.seqno=0),c.rekeyQueue.push([de,c.payload])}c.status=rve,c.payload=void 0}B!==void 0&&(B=void 0)}r()};jc.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=dz,t.outgoing.status=yct}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:dz,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:yct,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)};jc.prototype.disconnect=function(e){var t=Buffer.alloc(1+4+4+4);return t[0]=Ja.DISCONNECT,km[e]===void 0&&(e=km.BY_APPLICATION),ii(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+km[e]+")"),Ac(this,t),this.reset(),!1};jc.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),Ac(this,DTs)};jc.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===XR)throw new Error("A re-key is already in progress");if(e!==WR)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),Ect(this)};jc.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=Ja.REQUEST_SUCCESS,e.copy(t,1)):t=RTs,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),Ac(this,t)};jc.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),Ac(this,ITs)};jc.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_SUCCESS,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),Ac(this,t)};jc.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_FAILURE,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),Ac(this,t)};jc.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_EOF,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),Ac(this,t)};jc.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_CLOSE,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),Ac(this,t)};jc.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(1+4+4);return r[0]=Ja.CHANNEL_WINDOW_ADJUST,ii(r,e,1),ii(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),Ac(this,r)};jc.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]=Ja.CHANNEL_DATA,ii(i,e,1),ii(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),Ac(this,i)};jc.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]=Ja.CHANNEL_EXTENDED_DATA,ii(s,e,1),ii(s,r,5),ii(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),Ac(this,s)};jc.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(1+4+4+4+4);return i[0]=Ja.CHANNEL_OPEN_CONFIRMATION,ii(i,e,1),ii(i,t,5),ii(i,r,9),ii(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),Ac(this,i)};jc.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,c=Buffer.allocUnsafe(1+4+4+4+i+4+s);return c[0]=Ja.CHANNEL_OPEN_FAILURE,ii(c,e,1),ii(c,t,5),ii(c,i,o),o+=4,i&&(c.write(r,o,i,"utf8"),o+=i),ii(c,s,o),s&&c.write(n,o+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),Ac(this,c)};jc.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]=Ja.SERVICE_REQUEST,ii(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),Ac(this,r)};jc.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]=Ja.GLOBAL_REQUEST,ii(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,ii(i,n,19),i.write(e,23,n,"ascii"),ii(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),Ac(this,i)};jc.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]=Ja.GLOBAL_REQUEST,ii(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,ii(i,n,26),i.write(e,30,n,"ascii"),ii(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),Ac(this,i)};jc.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]=Ja.GLOBAL_REQUEST,ii(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,ii(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),Ac(this,n)};jc.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]=Ja.GLOBAL_REQUEST,ii(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,ii(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),Ac(this,n)};jc.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,c=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return c[0]=Ja.CHANNEL_OPEN,ii(c,12,1),c.write("direct-tcpip",5,12,"ascii"),ii(c,e,17),ii(c,t,21),ii(c,r,25),ii(c,s,o),c.write(n.dstIP,o+=4,s,"ascii"),ii(c,n.dstPort,o+=s),ii(c,i,o+=4),c.write(n.srcIP,o+=4,i,"ascii"),ii(c,n.srcPort,o+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),Ac(this,c)};jc.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]=Ja.CHANNEL_OPEN,ii(o,30,1),o.write("direct-streamlocal@openssh.com",5,30,"ascii"),ii(o,e,35),ii(o,t,39),ii(o,r,43),ii(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)"),Ac(this,o)};jc.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]=Ja.GLOBAL_REQUEST,ii(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)"),Ac(this,t)};jc.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]=Ja.CHANNEL_OPEN,ii(n,7,1),n.write("session",5,7,"ascii"),ii(n,e,12),ii(n,t,16),ii(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),Ac(this,n)};jc.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]=Ja.CHANNEL_REQUEST,ii(s,e,1),ii(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,ii(s,r,23),ii(s,t,27),ii(s,i,31),ii(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),Ac(this,s)};jc.prototype.pty=function(e,t,r,n,i,s,o,c){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=HTs(o)),(!o||!o.length)&&(o=NTs);var l=s.length,d=o.length,f=21,p=Buffer.allocUnsafe(1+4+4+7+1+4+l+4+4+4+4+4+d);if(p[0]=Ja.CHANNEL_REQUEST,ii(p,e,1),ii(p,7,5),p.write("pty-req",9,7,"ascii"),p[16]=c===void 0||c===!0?1:0,ii(p,l,17),p.write(s,21,l,"utf8"),ii(p,r,f+=l),ii(p,t,f+=4),ii(p,i,f+=4),ii(p,n,f+=4),ii(p,d,f+=4),f+=4,Array.isArray(o))for(var h=0;h<d;++h)p[f++]=o[h];else Buffer.isBuffer(o)&&o.copy(p,f);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),Ac(this,p)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(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)"),Ac(this,r)};jc.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]=Ja.CHANNEL_REQUEST,ii(i,e,1),ii(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,ii(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)"),Ac(this,i)};jc.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)),bTs.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]=Ja.CHANNEL_REQUEST,ii(n,e,1),ii(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,ii(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),Ac(this,n)};jc.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]=Ja.CHANNEL_REQUEST,ii(o,e,1),ii(o,3,5),o.write("env",9,3,"ascii"),o[12]=n===void 0||n===!0?1:0,ii(o,i,13),o.write(t,17,i,"ascii"),ii(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)"),Ac(this,o)};jc.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]=Ja.CHANNEL_REQUEST,ii(s,e,1),ii(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,ii(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,ii(s,i,o),o+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,o):s.write(t.cookie,o,i,"binary"),o+=i,ii(s,t.screen||0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),Ac(this,s)};jc.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]=Ja.CHANNEL_REQUEST,ii(i,e,1),ii(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,ii(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),Ac(this,i)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(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)"),Ac(this,r)};jc.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]=Ja.USERAUTH_REQUEST,ii(s,r,++i),s.write(e,i+=4,r,"utf8"),ii(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),ii(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,ii(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),Ac(this,s)};jc.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+mct(t,0));var o=Buffer.byteLength(e),c=Buffer.byteLength(s),l=t.length,d=i.sessionId.length,f=0,p=Buffer.allocUnsafe((r?4+d:0)+1+4+o+4+14+4+9+1+4+c+4+l);return r?(ii(p,d,f),i.sessionId.copy(p,f+=4),p[f+=d]=Ja.USERAUTH_REQUEST):p[f]=Ja.USERAUTH_REQUEST,ii(p,o,++f),p.write(e,f+=4,o,"utf8"),ii(p,14,f+=o),p.write("ssh-connection",f+=4,14,"ascii"),ii(p,9,f+=14),p.write("publickey",f+=4,9,"ascii"),p[f+=9]=r?1:0,ii(p,c,++f),p.write(s,f+=4,c,"ascii"),ii(p,l,f+=c),t.copy(p,f+=4),r?(r(p,function(h){if(h=Act(h,s),h===!1)throw new Error("Error while converting handshake signature");var w=h.length,b=Buffer.allocUnsafe(1+4+o+4+14+4+9+1+4+c+4+l+4+4+c+4+w);return f=0,b[f]=Ja.USERAUTH_REQUEST,ii(b,o,++f),b.write(e,f+=4,o,"utf8"),ii(b,14,f+=o),b.write("ssh-connection",f+=4,14,"ascii"),ii(b,9,f+=14),b.write("publickey",f+=4,9,"ascii"),b[f+=9]=1,ii(b,c,++f),b.write(s,f+=4,c,"ascii"),ii(b,l,f+=c),t.copy(b,f+=4),ii(b,4+c+4+w,f+=l),ii(b,c,f+=4),b.write(s,f+=4,c,"ascii"),ii(b,w,f+=c),h.copy(b,f+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),Ac(n,b)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),Ac(this,p))};jc.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,c;typeof t.getPublicSSH=="function"?(c=t.type,t=t.getPublicSSH()):c=t.toString("ascii",4,4+mct(t,0));var l=Buffer.byteLength(e),d=Buffer.byteLength(c),f=t.length,p=o.sessionId.length,h=Buffer.byteLength(r),w=Buffer.byteLength(n),b=0,E=Buffer.allocUnsafe(4+p+1+4+l+4+14+4+9+4+d+4+f+4+h+4+w);return ii(E,p,b),o.sessionId.copy(E,b+=4),E[b+=p]=Ja.USERAUTH_REQUEST,ii(E,l,++b),E.write(e,b+=4,l,"utf8"),ii(E,14,b+=l),E.write("ssh-connection",b+=4,14,"ascii"),ii(E,9,b+=14),E.write("hostbased",b+=4,9,"ascii"),ii(E,d,b+=9),E.write(c,b+=4,d,"ascii"),ii(E,f,b+=d),t.copy(E,b+=4),ii(E,h,b+=f),E.write(r,b+=4,h,"ascii"),ii(E,w,b+=h),E.write(n,b+=4,w,"utf8"),i(E,function(A){if(A=Act(A,c),A===!1)throw new Error("Error while converting handshake signature");var T=A.length,R=Buffer.allocUnsafe(E.length-p+T);return E.copy(R,0,4+p),ii(R,T,R.length-T-4),A.copy(R,R.length-T),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),Ac(s,R)}),!0};jc.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]=Ja.USERAUTH_REQUEST,ii(n,t,++r),n.write(e,r+=4,t,"utf8"),ii(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),ii(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),ii(n,0,r+=20),ii(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),Ac(this,n)};jc.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]=Ja.USERAUTH_REQUEST,ii(n,t,++r),n.write(e,r+=4,t,"utf8"),ii(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),ii(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),Ac(this,n)};jc.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++]=Ja.USERAUTH_INFO_RESPONSE,ii(o,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),ii(o,n,r),r+=4,n&&(o.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),Ac(this,o)};jc.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]=Ja.SERVICE_ACCEPT,ii(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),Ac(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]=Ja.USERAUTH_BANNER,ii(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),Ac(this,s),this.banner=void 0}};jc.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,c=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return c[0]=Ja.CHANNEL_OPEN,ii(c,15,1),c.write("forwarded-tcpip",5,15,"ascii"),ii(c,e,20),ii(c,t,24),ii(c,r,28),ii(c,i,32),c.write(n.boundAddr,36,i,"ascii"),ii(c,n.boundPort,o),ii(c,s,o+=4),c.write(n.remoteAddr,o+=4,s,"ascii"),ii(c,n.remotePort,o+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),Ac(this,c)};jc.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]=Ja.CHANNEL_OPEN,ii(o,3,1),o.write("x11",5,3,"ascii"),ii(o,e,8),ii(o,t,12),ii(o,r,16),ii(o,i,20),o.write(n.originAddr,24,i,"ascii"),ii(o,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),Ac(this,o)};jc.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]=Ja.CHANNEL_OPEN,ii(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),ii(n,e,27),ii(n,t,31),ii(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),Ac(this,n)};jc.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]=Ja.CHANNEL_OPEN,ii(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),ii(s,e,38),ii(s,t,42),ii(s,r,46),ii(s,i,50),s.write(n.socketPath,54,i,"utf8"),ii(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),Ac(this,s)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,ii(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),Ac(this,r)};jc.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,c=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return c[0]=Ja.CHANNEL_REQUEST,ii(c,e,1),ii(c,11,5),c.write("exit-signal",9,11,"ascii"),c[20]=0,ii(c,i,21),c.write(t,25,i,"utf8"),c[o++]=r?1:0,ii(c,s,o),o+=4,s&&(c.write(n,o,s,"utf8"),o+=s),ii(c,0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),Ac(this,c)};jc.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,c=Buffer.allocUnsafe(1+4+o+1);return c[0]=Ja.USERAUTH_FAILURE,ii(c,o,1),c.write(n,5,o,"ascii"),c[5+o]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),Ac(this,c)};jc.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=Ac(this,TTs);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=UL.createDeflate(mz),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=UL.createInflate(mz)),i};jc.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]=Ja.USERAUTH_PK_OK,ii(s,n,1),s.write(e,5,n,"ascii"),ii(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),Ac(this,s)};jc.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]=Ja.USERAUTH_PASSWD_CHANGEREQ,ii(s,r,++i),s.write(e,i+=4,r,"utf8"),ii(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),Ac(this,s)};jc.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,c,l,d,f;for(f=0,d=r.length;f<d;++f)n+=4+Buffer.byteLength(r[f].prompt)+1;var p=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(p[o++]=Ja.USERAUTH_INFO_REQUEST,ii(p,i,o),o+=4,e&&(p.write(e,o,i,"utf8"),o+=i),ii(p,s,o),o+=4,t&&(p.write(t,o,s,"utf8"),o+=s),ii(p,0,o),o+=4,ii(p,r.length,o),o+=4,f=0,d=r.length;f<d;++f)l=r[f],c=Buffer.byteLength(l.prompt),ii(p,c,o),o+=4,c&&(p.write(l.prompt,o,c,"utf8"),o+=c),p[o++]=l.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),Ac(this,p)};function LTs(e,t,r,n,i){if(r!==km.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}a(LTs,"onDISCONNECT");function qTs(e,t,r){var n=e._state,i=n.outgoing;i.status===WR?(e.debug("DEBUG: Received re-key request"),i.status=XR,i.kexinit=void 0,Ect(e,s)):s();function s(){OTs(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?WTs(e):kRr(e))}a(s,"check")}a(qTs,"onKEXINIT");function OTs(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,c,l,d,f,p;o("DEBUG: Comparing KEXINITs ...");var h=e.config.algorithms,w=h.kex;if(e.remoteBugs&tve.BAD_DHGEX)for(var b=!1,E=w.length-1;E>=0;--E)w[E].indexOf("group-exchange")!==-1&&(b||(w=w.slice(),b=!0),w.splice(E,1));for(o("DEBUG: (local) KEX algorithms: "+w),o("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(c=w,l=t.algorithms.kex):(c=t.algorithms.kex,l=w),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}var T=l[p];for(o("DEBUG: KEX algorithm: "+T),r&&(!t.algorithms.kex.length||T!==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?(c=h.serverHostKey,l=t.algorithms.srvHostKey):(c=t.algorithms.srvHostKey,l=h.serverHostKey),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=l[p],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?(c=h.cipher,l=t.algorithms.cs.encrypt):(c=t.algorithms.cs.encrypt,l=h.cipher),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decrypt.type=l[p]:d=s.encrypt.type=l[p],o("DEBUG: Client->Server Cipher: "+d),o("DEBUG: (local) Server->Client ciphers: "+h.cipher),o("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(c=h.cipher,l=t.algorithms.sc.encrypt):(c=t.algorithms.sc.encrypt,l=h.cipher),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.encrypt.type=l[p]:d=i.decrypt.type=l[p],o("DEBUG: Server->Client Cipher: "+d),o("DEBUG: (local) Client->Server HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(c=h.hmac,l=t.algorithms.cs.mac):(c=t.algorithms.cs.mac,l=h.hmac),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.hmac.type=l[p]:d=s.hmac.type=l[p],o("DEBUG: Client->Server HMAC algorithm: "+d),o("DEBUG: (local) Server->Client HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(c=h.hmac,l=t.algorithms.sc.mac):(c=t.algorithms.sc.mac,l=h.hmac),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.hmac.type=l[p]:d=i.hmac.type=l[p],o("DEBUG: Server->Client HMAC algorithm: "+d),o("DEBUG: (local) Client->Server compression algorithms: "+h.compress),o("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(c=h.compress,l=t.algorithms.cs.compress):(c=t.algorithms.cs.compress,l=h.compress),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decompress.type=l[p]:d=s.compress.type=l[p],o("DEBUG: Client->Server compression algorithm: "+d),o("DEBUG: (local) Server->Client compression algorithms: "+h.compress),o("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(c=h.compress,l=t.algorithms.sc.compress):(c=t.algorithms.sc.compress,l=h.compress),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}return e.server?d=s.compress.type=l[p]:d=i.decompress.type=l[p],o("DEBUG: Server->Client compression algorithm: "+d),n.kex=new $L(T),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}a(OTs,"check_KEXINIT");function MTs(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),kRr(e)}a(MTs,"onKEXDH_GEX_GROUP");function FTs(e,t){VTs(e,t)}a(FTs,"onKEXDH_INIT");function CRr(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,c,l;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,o("DEBUG: Checking host key format");var d=wc(t.hostkey,0,"ascii",e);if(d===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==d){o("DEBUG: Host key format mismatch"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: host key format mismatch");return f.level="handshake",e.emit("error",f),!1}o("DEBUG: Checking signature format");var p=wc(t.sig,0,"ascii",e);if(p===!1)return!1;if(t.sig_format!==p){o("DEBUG: Signature format mismatch"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: signature format mismatch");return f.level="handshake",e.emit("error",f),!1}}if(s.status===yct){if(r===void 0){o("DEBUG: Verifying host fingerprint");var h=!0,w=e.emit("fingerprint",t.hostkey,function(z){r===void 0&&(r=!!z,h||CRr(e,t,r))});if(h=!1,w&&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(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: host fingerprint verification failed");return f.level="handshake",e.emit("error",f),!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(km.KEY_EXCHANGE_FAILED),!1;var b=Xd.createHash(n.kex.hash),E=Buffer.byteLength(e.config.ident),A=Buffer.byteLength(i.identRaw),T=s.kexinit.length,R=i.kexinit.length,B=t.hostkey.length,I=s.pubkey.length,q=t.pubkey.length,re=t.secret.length,K=E+A+T+R+B+I+q+re+4*8,Z,ie,V,O,ne=n.kex.getDHParams();ne&&(V=ne.prime,O=ne.generator,Z=V.length,ie=O.length,K+=4*3,K+=4*2,K+=Z,K+=ie);var $=0,U=Buffer.allocUnsafe(K);ii(U,E,$),$+=4,U.write(e.config.ident,$,"utf8"),$+=E,ii(U,A,$),$+=4,U.write(i.identRaw,$,"utf8"),$+=A,ii(U,T,$),$+=4,s.kexinit.copy(U,$),$+=T,s.kexinit=void 0,ii(U,R,$),$+=4,i.kexinit.copy(U,$),$+=R,i.kexinit=void 0,ii(U,B,$),$+=4,t.hostkey.copy(U,$),$+=B,ne&&(Cct.slice(1).copy(U,$),$+=4*3,ii(U,Z,$),$+=4,V.copy(U,$),$+=Z,ii(U,ie,$),$+=4,O.copy(U,$),$+=ie),ii(U,I,$),$+=4,s.pubkey.copy(U,$),$+=I,ii(U,q,$),$+=4,t.pubkey.copy(U,$),$+=q,ii(U,re,$),$+=4,t.secret.copy(U,$),s.exchangeHash=b.update(U).digest();var D=wc(t.sig,t.sig._pos,e);if(D===!1||!(D=pRr(D,t.sig_format,e)))return!1;var G=vTs(t.hostkey,t.sig_format);if(G instanceof Error)return!1;if(o("DEBUG: Verifying signature"),G.verify(s.exchangeHash,D)!==!0){o("DEBUG: Signature verification failed"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: signature verification failed");return f.level="handshake",e.emit("error",f),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,o("DEBUG: Outgoing: Writing NEWKEYS"),s.status===XR?Ac(e,Sct,void 0,!0):Ac(e,Sct),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&ERr(e)}a(CRr,"onKEXDH_REPLY");function ERr(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=gRr[r.encrypt.type],o=0,c=t.kex.hash,l=Buffer.allocUnsafe(4+i),d,f;if(t.authsQueue=[],ii(l,i,o),o+=4,r.kexsecret.copy(l,o),r.kexsecret=void 0,s.stream)d=bct;else{for(d=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();d.length<s.ivLen;)d=Buffer.concat([d,Xd.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>s.ivLen&&(d=d.slice(0,s.ivLen))}for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();f.length<s.keyLen;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);if(f.length>s.keyLen&&(f=f.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=d,r.encrypt.key=f,r.encrypt.instance=!0;else{var p=lz[r.encrypt.type];r.encrypt.instance=Xd.createCipheriv(p,f,d),r.encrypt.instance.setAutoPadding(!1)}var h=n.decrypt.info=gRr[n.decrypt.type];if(h.stream)d=bct;else{for(d=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();d.length<h.ivLen;)d=Buffer.concat([d,Xd.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>h.ivLen&&(d=d.slice(0,h.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(h.blockLen),f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();f.length<h.keyLen;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>h.keyLen&&(f=f.slice(0,h.keyLen));var w=lz[n.decrypt.type];n.decrypt.instance=Xd.createDecipheriv(w,f,d),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=d,n.decrypt.key=f;var b;s.discardLen>0&&(b=Buffer.alloc(s.discardLen),r.encrypt.instance.update(b)),h.discardLen>0&&((!b||b.length!==h.discardLen)&&(b=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(b));var E=r.hmac.info=_Rr[r.hmac.type],A=n.hmac.info=_Rr[n.hmac.type];if(s.authLen===0){for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();f.length<E.len;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>E.len&&(f=f.slice(0,E.len)),r.hmac.key=f}else r.hmac.key=void 0;if(h.authLen===0){for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();f.length<A.len;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>A.len&&(f=f.slice(0,A.len)),n.hmac.key=f}else n.hmac.key=void 0;var T=h.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==T)&&(n.hmac.buf=Buffer.allocUnsafe(T)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=UL.createDeflate(mz),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=UL.createInflate(mz):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===XR){r.status=WR;var R=r.rekeyQueue,B=R.length,I=0;for(r.rekeyQueue=[];I<B;++I)Buffer.isBuffer(R[I])?Ac(e,R[I]):Ac(e,R[I][0],R[I][1]);R=n.rekeyQueue,B=R.length,I=0,n.rekeyQueue=[];for(var q=n.seqno;I<B;++I)if(n.seqno=R[I][0],n.payload=R[I][1],ARr(e)===!1||n.status===dz)return;n.seqno=q}else r.status=WR,n.status===gct&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+h.blockLen+")"),GL(e,fz,h.blockLen,n.decrypt.buf)),e.emit("ready")}}a(ERr,"onNEWKEYS");function ive(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 Ja[t]}a(ive,"getPacketType");function ARr(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,o,c,l,d,f,p,h,w,b,E,A,T,R,B;if(++r.seqno>vct&&(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!==WR&&ive(e,I)!==r.expectedPacket&&I<1&&I>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+ive(e,I)),e.disconnect(km.PROTOCOL_ERROR);var q=new Error("Received unexpected packet");return q.level="protocol",e.emit("error",q),!1}if(I===Ja.CHANNEL_DATA){if(f=ad(i,1,e,t),f===!1||(p=wc(i,5,e,t,32768),p===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+f+")"),e.emit("CHANNEL_DATA:"+f,p)}else if(I===Ja.CHANNEL_EXTENDED_DATA){if(f=ad(i,1,e,t),f===!1)return!1;var re=ad(i,5,e,t);if(re===!1||(p=wc(i,9,e,t),p===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+f+")"),e.emit("CHANNEL_EXTENDED_DATA:"+f,re,p)}else if(I===Ja.CHANNEL_WINDOW_ADJUST){if(f=ad(i,1,e,t),f===!1)return!1;var K=ad(i,5,e,t);if(K===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+f+", "+K+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+f,K)}else if(I===Ja.CHANNEL_SUCCESS){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+f+")"),e.emit("CHANNEL_SUCCESS:"+f)}else if(I===Ja.CHANNEL_FAILURE){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+f+")"),e.emit("CHANNEL_FAILURE:"+f)}else if(I===Ja.CHANNEL_EOF){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+f+")"),e.emit("CHANNEL_EOF:"+f)}else if(I===Ja.CHANNEL_OPEN){var Z=wc(i,1,"ascii",e,t);if(Z===!1||(b=ad(i,i._pos,e,t),b===!1)||(E=ad(i,i._pos+=4,e,t),E===!1)||(A=ad(i,i._pos+=4,e,t),A===!1))return!1;var ie;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+b+", "+Z+")"),Z==="forwarded-tcpip"||Z==="direct-tcpip"){var V=wc(i,i._pos+=4,"ascii",e,t);if(V===!1)return!1;var O=ad(i,i._pos,e,t);if(O===!1||(h=wc(i,i._pos+=4,"ascii",e,t),h===!1)||(w=ad(i,i._pos,e,t),w===!1))return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{destIP:V,destPort:O,srcIP:h,srcPort:w}}}else if(Z==="forwarded-streamlocal@openssh.com"||Z==="direct-streamlocal@openssh.com"){if(B=wc(i,i._pos+=4,"utf8",e,t),B===!1)return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{socketPath:B}}}else if(Z==="x11"){if(h=wc(i,i._pos+=4,"ascii",e,t),h===!1||(w=ad(i,i._pos,e,t),w===!1))return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{srcIP:h,srcPort:w}}}else ie={type:Z,sender:b,window:E,packetSize:A,data:{}};e.emit("CHANNEL_OPEN",ie)}else if(I===Ja.CHANNEL_OPEN_CONFIRMATION){if(T=ad(i,1,e,t),T===!1||(b=ad(i,5,e,t),b===!1)||(E=ad(i,9,e,t),E===!1)||(A=ad(i,13,e,t),A===!1))return!1;d={recipient:T,sender:b,window:E,packetSize:A},i.length>17&&(d.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+d.recipient,d)}else if(I===Ja.CHANNEL_OPEN_FAILURE){if(T=ad(i,1,e,t),T===!1)return!1;var ne=ad(i,5,e,t);if(ne===!1||(R=wc(i,9,"utf8",e,t),R===!1)||(c=wc(i,i._pos,"utf8",e,t),c===!1))return!1;i._pos=9,d={recipient:T,reasonCode:ne,reason:wTs[ne],description:R,lang:c},e.emit("CHANNEL_OPEN_FAILURE:"+d.recipient,d)}else if(I===Ja.CHANNEL_CLOSE){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+f+")"),e.emit("CHANNEL_CLOSE:"+f)}else if(I!==Ja.IGNORE){if(I===Ja.DISCONNECT){var $=ad(i,1,e,t);if($===!1)return!1;var U=km[$];if(R=wc(i,5,"utf8",e,t),R===!1)return!1;i._pos<i.length&&(c=wc(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+U+")"),e.emit("DISCONNECT",U,$,R,c)}else if(I===Ja.DEBUG){if(l=wc(i,2,"utf8",e,t),l===!1||(c=wc(i,i._pos,"ascii",e,t),c===!1))return!1;e.emit("DEBUG",l,c)}else if(I===Ja.NEWKEYS)e.emit("NEWKEYS");else if(I===Ja.SERVICE_REQUEST){if(o=wc(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_REQUEST",o)}else if(I===Ja.SERVICE_ACCEPT){if(o=wc(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_ACCEPT",o)}else if(I===Ja.USERAUTH_REQUEST){var D=wc(i,1,"utf8",e,t);if(D===!1)return!1;var G=wc(i,i._pos,"ascii",e,t);if(G===!1)return!1;var z=wc(i,i._pos,"ascii",e,t);if(z===!1)return!1;var L,N;if(z==="password"){if(L=wc(i,i._pos+1,"utf8",e,t),L===!1)return!1}else if(z==="publickey"||z==="hostbased"){var W,F,Q,ee,X,ae,ye;if(z==="publickey"){if(W=i[i._pos++],W===void 0)return!1;W=W!==0}if(F=wc(i,i._pos,"ascii",e,t),F===!1||(Q=wc(i,i._pos,e,t),Q===!1))return!1;if(W||z==="hostbased"){if(z==="hostbased"&&(ae=wc(i,i._pos,"ascii",e,t),ae===!1||(ye=wc(i,i._pos,"utf8",e,t),ye===!1)))return!1;var ue=i._pos;if(ee=wc(i,ue,e,t),ee===!1||(ee.length>4+F.length+4&&ee.toString("ascii",4,4+F.length)===F&&(ee=ee.slice(4+F.length+4)),ee=pRr(ee,F,e,t),ee===!1))return!1;X=Buffer.allocUnsafe(4+n.sessionId.length+ue),ii(X,n.sessionId.length,0),n.sessionId.copy(X,4),i.copy(X,4+n.sessionId.length,0,ue)}else N="publickey -- check";L={keyAlgo:F,key:Q,signature:ee,blob:X,localHostname:ae,localUsername:ye}}else if(z==="keyboard-interactive"){var de=ad(i,i._pos,e,t);if(de===!1||(L=wc(i,i._pos+4+de,"utf8",e,t),L===!1))return!1}else z!=="none"&&(L=i.slice(i._pos));N===void 0&&(N=z),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+N+")"),e._state.authsQueue.push(z),e.emit("USERAUTH_REQUEST",D,G,z,L)}else if(I===Ja.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=UL.createDeflate(mz),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=UL.createInflate(mz)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(I===Ja.USERAUTH_FAILURE){var H=wc(i,1,"ascii",e,t);if(H===!1)return!1;var ke=i[i._pos];if(ke===void 0)return!1;ke=ke!==0,H=H.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",H,ke)}else if(I===Ja.USERAUTH_BANNER){if(l=wc(i,1,"utf8",e,t),l===!1||(c=wc(i,i._pos,"utf8",e,t),c===!1))return!1;e.emit("USERAUTH_BANNER",l,c)}else if(I===Ja.GLOBAL_REQUEST){var se=wc(i,1,"ascii",e,t);if(se===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+se+")");var Y=i[i._pos++];if(Y===void 0)return!1;Y=Y!==0;var fe;if(se==="tcpip-forward"||se==="cancel-tcpip-forward"){var ge=wc(i,i._pos,"ascii",e,t);if(ge===!1)return!1;var be=ad(i,i._pos,e,t);if(be===!1)return!1;fe={bindAddr:ge,bindPort:be}}else if(se==="streamlocal-forward@openssh.com"||se==="cancel-streamlocal-forward@openssh.com"){if(B=wc(i,i._pos,"utf8",e,t),B===!1)return!1;fe={socketPath:B}}else se==="no-more-sessions@openssh.com"||(fe=i.slice(i._pos));e.emit("GLOBAL_REQUEST",se,Y,fe)}else if(I===Ja.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(I===Ja.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(I!==Ja.UNIMPLEMENTED){if(I===Ja.KEXINIT)return zTs(e,t);if(I===Ja.CHANNEL_REQUEST)return UTs(e,t);if(I>=30&&I<=49)return jTs(e,I,t);if(I>=60&&I<=70)return BTs(e,I,t);var Oe=Buffer.allocUnsafe(1+4);Oe[0]=Ja.UNIMPLEMENTED,ii(Oe,s,1),Ac(e,Oe)}}}a(ARr,"parsePacket");function zTs(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=sx(n,17,e,t),s===!1||(i.algorithms.kex=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=sx(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=sx(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(zTs,"parse_KEXINIT");function jTs(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===WR||ive(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+ive(e,t)),e.disconnect(km.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(km.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===Ja.KEXDH_GEX_GROUP){var c=wc(s,1,e,r);if(c===!1)return!1;var l=wc(s,s._pos,e,r);if(l===!1)return!1;e.emit("KEXDH_GEX_GROUP",c,l)}else if(t===Ja.KEXDH_GEX_REPLY)return xRr(e,r)}else if(t===Ja.KEXDH_INIT){var d=wc(s,1,e,r);if(d===!1)return!1;e.emit("KEXDH_INIT",d)}else if(t===Ja.KEXDH_REPLY)return xRr(e,r)}a(jTs,"parse_KEX");function xRr(e,t){var r=e._state.incoming.payload,n=wc(r,1,e,t);if(n===!1)return!1;var i=wc(r,r._pos,e,t);if(i===!1)return!1;var s=wc(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},c=wc(n,0,"ascii",e,t);if(c===!1)return!1;o.hostkey_format=c;var l=wc(s,0,"ascii",e,t);if(l===!1)return!1;o.sig_format=l,e.emit("KEXDH_REPLY",o)}a(xRr,"parse_KEXDH_REPLY");function BTs(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,o,c,l;if(i==="password"){if(t===Ja.USERAUTH_PASSWD_CHANGEREQ){if(o=wc(s,1,"utf8",e,r),o===!1||(c=wc(s,s._pos,"utf8",e,r),c===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",o,c)}}else if(i==="keyboard-interactive"){if(t===Ja.USERAUTH_INFO_REQUEST){var d,f,p;if(d=wc(s,1,"utf8",e,r),d===!1||(f=wc(s,s._pos,"utf8",e,r),f===!1)||(c=wc(s,s._pos,"utf8",e,r),c===!1)||(p=ad(s,s._pos,e,r),p===!1))return!1;s._pos+=4;for(var h=[],w=0;w<p;++w){if(l=wc(s,s._pos,"utf8",e,r),l===!1)return!1;var b=s[s._pos++];if(b===void 0)return!1;b=b!==0,h.push({prompt:l,echo:b})}e.emit("USERAUTH_INFO_REQUEST",d,f,c,h)}else if(t===Ja.USERAUTH_INFO_RESPONSE){var E=ad(s,1,e,r);if(E===!1)return!1;s._pos=5;for(var A=[],T=0;T<E;++T){if(l=wc(s,s._pos,"utf8",e,r),l===!1)return!1;A.push(l)}e.emit("USERAUTH_INFO_RESPONSE",A)}}else if(i==="publickey"){if(t===Ja.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(km.PROTOCOL_ERROR);var B=new Error("Invalid authentication method: "+i);B.level="protocol",e.emit("error",B)}}a(BTs,"parse_USERAUTH");function UTs(e,t){var r=e._state.incoming.payload,n,i,s,o,c,l,d,f=ad(r,1,e,t);if(f===!1)return!1;var p=wc(r,5,"ascii",e,t);if(p===!1)return!1;if(p==="exit-status"){var h=ad(r,++r._pos,e,t);if(h===!1)return!1;n={recipient:f,request:p,wantReply:!1,code:h}}else if(p==="exit-signal"){var w;if(e.remoteBugs&tve.OLD_EXIT){if(d=ad(r,++r._pos,e,t),d===!1)return!1;switch(d){case 1:d="HUP";break;case 2:d="INT";break;case 3:d="QUIT";break;case 6:d="ABRT";break;case 9:d="KILL";break;case 14:d="ALRM";break;case 15:d="TERM";break;default:d="UNKNOWN ("+d+")"}w=!1}else{if(d=wc(r,++r._pos,"ascii",e,t),d===!1||(w=r[r._pos++],w===void 0))return!1;w=w!==0}var b=wc(r,r._pos,"utf8",e,t);if(b===!1)return!1;var E=wc(r,r._pos,"utf8",e,t);if(E===!1)return!1;n={recipient:f,request:p,wantReply:!1,signal:d,coredump:w,description:b,lang:E}}else if(p==="pty-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var A=wc(r,r._pos,"ascii",e,t);if(A===!1||(i=ad(r,r._pos,e,t),i===!1)||(s=ad(r,r._pos+=4,e,t),s===!1)||(o=ad(r,r._pos+=4,e,t),o===!1)||(c=ad(r,r._pos+=4,e,t),c===!1))return!1;var T=wc(r,r._pos+=4,e,t);if(T===!1)return!1;T=$Ts(T),n={recipient:f,request:p,wantReply:l,term:A,cols:i,rows:s,width:o,height:c,modes:T}}else if(p==="window-change"){if(i=ad(r,++r._pos,e,t),i===!1||(s=ad(r,r._pos+=4,e,t),s===!1)||(o=ad(r,r._pos+=4,e,t),o===!1)||(c=ad(r,r._pos+=4,e,t),c===!1))return!1;n={recipient:f,request:p,wantReply:!1,cols:i,rows:s,width:o,height:c}}else if(p==="x11-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var R=r[r._pos++];if(R===void 0)return!1;R=R!==0;var B=wc(r,r._pos,"ascii",e,t);if(B===!1)return!1;var I=wc(r,r._pos,"binary",e,t);if(I===!1)return!1;var q=ad(r,r._pos,e,t);if(q===!1)return!1;n={recipient:f,request:p,wantReply:l,single:R,protocol:B,cookie:I,screen:q}}else if(p==="env"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var re=wc(r,r._pos,"utf8",e,t);if(re===!1)return!1;var K=wc(r,r._pos,"utf8",e,t);if(K===!1)return!1;n={recipient:f,request:p,wantReply:l,key:re,val:K}}else if(p==="shell"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}else if(p==="exec"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var Z=wc(r,r._pos,"utf8",e,t);if(Z===!1)return!1;n={recipient:f,request:p,wantReply:l,command:Z}}else if(p==="subsystem"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var ie=wc(r,r._pos,"utf8",e,t);if(ie===!1)return!1;n={recipient:f,request:p,wantReply:l,subsystem:ie}}else if(p==="signal"){if(d=wc(r,++r._pos,"ascii",e,t),d===!1)return!1;n={recipient:f,request:p,wantReply:!1,signal:"SIG"+d}}else if(p==="xon-xoff"){var V=r[++r._pos];if(V===void 0)return!1;V=V!==0,n={recipient:f,request:p,wantReply:!1,clientControl:V}}else if(p==="auth-agent-req@openssh.com"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}else{if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+f+", "+p+")"),e.emit("CHANNEL_REQUEST:"+f,n)}a(UTs,"parse_CHANNEL_REQUEST");function GTs(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]),mRr(i.iv),i.instance=Xd.createDecipheriv(lz[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var c=Xd.createHmac(lz[n.type],n.key);ii(nve,r.seqno,0),ii(nve,r.pktLen,4),nve[8]=r.padLen,c.update(nve),c.update(r.packet);var l=c.digest();return l.length>r.hmac.info.actualLen&&(l=l.slice(0,r.hmac.info.actualLen)),QTs(l,t)}}a(GTs,"hmacVerify");function PRr(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}a(PRr,"decryptData");function GL(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(GL,"expectData");function sx(e,t,r,n){var i=wc(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}a(sx,"readList");function $Ts(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===uz.TTY_OP_END||uz[i]===void 0||r+5>n));r+=5)t[uz[i]]=mct(e,r+1);return t}a($Ts,"bytesToModes");function HTs(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,o=r.length,c,l,d;s<o;++s)c=r[s],l=uz[c],l&&!t.test(c)&&typeof e[c]=="number"&&c!=="TTY_OP_END"&&(d=e[c],i[n++]=l,i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=d&255);return i[n]=uz.TTY_OP_END,i}a(HTs,"modesToBytes");function Ect(e,t){return JTs(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&tve.BAD_DHGEX){for(var s=!1,o=n.kex,c=o.length-1;c>=0;--c)o[c].indexOf("group-exchange")!==-1&&(s||(o=o.slice(),s=!0),o.splice(c,1));s&&(i=Buffer.from(o.join(",")))}var l=n.serverHostKeyBuf,d=1+16+4+i.length+4+l.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,f=Buffer.allocUnsafe(d),p=17;f[0]=Ja.KEXINIT,r!==!1&&r.copy(f,1),ii(f,i.length,p),p+=4,i.copy(f,p),p+=i.length,ii(f,l.length,p),p+=4,l.copy(f,p),p+=l.length,ii(f,n.cipherBuf.length,p),p+=4,n.cipherBuf.copy(f,p),p+=n.cipherBuf.length,ii(f,n.cipherBuf.length,p),p+=4,n.cipherBuf.copy(f,p),p+=n.cipherBuf.length,ii(f,n.hmacBuf.length,p),p+=4,n.hmacBuf.copy(f,p),p+=n.hmacBuf.length,ii(f,n.hmacBuf.length,p),p+=4,n.hmacBuf.copy(f,p),p+=n.hmacBuf.length,ii(f,n.compressBuf.length,p),p+=4,n.compressBuf.copy(f,p),p+=n.compressBuf.length,ii(f,n.compressBuf.length,p),p+=4,n.compressBuf.copy(f,p),p+=n.compressBuf.length,f.fill(0,f.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var h=e._state.outgoing;h.kexinit=f,h.status===WR&&(h.status=XR),Ac(e,f,t,!0)}),!0}a(Ect,"KEXINIT");function kRr(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]=Ja.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=Ja.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),ii(n,r.pubkey.length,1),r.pubkey.copy(n,5),Ac(e,n,void 0,!0)}a(kRr,"KEXDH_INIT");function VTs(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(),c=s.type;t=r.kex.convertPublicKey(t);var l=r.kex.computeSecret(t);if(l instanceof Error)return l.message="Error while computing DH secret ("+r.kex.type+"): "+l.message,l.level="handshake",e.emit("error",l),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;var d=Xd.createHash(r.kex.hash),f=Buffer.byteLength(i.identRaw),p=Buffer.byteLength(e.config.ident),h=i.kexinit.length,w=n.kexinit.length,b=o.length,E=t.length,A=n.pubkey.length,T=l.length,R=f+p+h+w+b+E+A+T+4*8,B,I,q,re,K=r.kex.getDHParams();K&&(q=K.prime,re=K.generator,B=q.length,I=re.length,R+=4*3,R+=4*2,R+=B,R+=I);var Z=0,ie=Buffer.allocUnsafe(R);ii(ie,f,Z),Z+=4,ie.write(i.identRaw,Z,"utf8"),Z+=f,ii(ie,p,Z),Z+=4,ie.write(e.config.ident,Z,"utf8"),Z+=p,ii(ie,h,Z),Z+=4,i.kexinit.copy(ie,Z),Z+=h,i.kexinit=void 0,ii(ie,w,Z),Z+=4,n.kexinit.copy(ie,Z),Z+=w,n.kexinit=void 0,ii(ie,b,Z),Z+=4,o.copy(ie,Z),Z+=b,K&&(Cct.slice(1).copy(ie,Z),Z+=4*3,ii(ie,B,Z),Z+=4,q.copy(ie,Z),Z+=B,ii(ie,I,Z),Z+=4,re.copy(ie,Z),Z+=I),ii(ie,E,Z),Z+=4,t.copy(ie,Z),Z+=E,ii(ie,A,Z),Z+=4,n.pubkey.copy(ie,Z),Z+=A,ii(ie,T,Z),Z+=4,l.copy(ie,Z),n.exchangeHash=d.update(ie).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=l;var V=s.sign(n.exchangeHash);if(V instanceof Error)return V.message="Error while signing data with host key ("+c+"): "+V.message,V.level="handshake",e.emit("error",V),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;if(V=Act(V,c),V===!1)return V.message="Error while converting handshake signature",V.level="handshake",e.emit("error",V),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;var O=4+c.length+4+V.length,ne=Buffer.allocUnsafe(1+4+b+4+A+4+O);return Z=0,ne[Z]=Ja[r.kex.pktReply],++Z,ii(ne,b,Z),Z+=4,o.copy(ne,Z),Z+=b,ii(ne,A,Z),Z+=4,n.pubkey.copy(ne,Z),Z+=A,ii(ne,O,Z),Z+=4,ii(ne,c.length,Z),Z+=4,ne.write(c,Z,c.length,"ascii"),Z+=c.length,ii(ne,V.length,Z),Z+=4,V.copy(ne,Z),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),Ac(e,ne,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),Ac(e,Sct,void 0,!0)}a(VTs,"KEXDH_REPLY");function WTs(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),Ac(e,Cct,void 0,!0)}a(WTs,"KEXDH_GEX_REQ");function DRr(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(wct,XTs.bind(e,r))}a(DRr,"compressPayload");function XTs(e){if(!(this._readableState.ended||this._writableState.ended)){TRr(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&DRr(this,t[0][0],t[0][1])}}a(XTs,"compressFlushCb");function Ac(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===XR&&!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&&DRr(e,o[0][0],o[0][1]),!0}else return TRr(e,t,r)}a(Ac,"send");function TRr(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,o=i.hmac,c,l,d,f,p;if(c=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var h=1+t.length+4;h%s.info.blockLen!=0;)++h;l=h-1-t.length,c=4+h}else{var w=s.info.blockLen;c+=(w-1)*c%w,l=c-t.length-5}else c+=7*c%8,l=c-t.length-5;d=Buffer.allocUnsafe(c),ii(d,c-4,0),d[4]=l,t.copy(d,5),KTs(d,5+t.length,l),o.type!==!1&&o.key&&(f=Xd.createHmac(lz[o.type],o.key),ii(i.bufSeqno,i.seqno,0),f.update(i.bufSeqno),f.update(d),f=f.digest(),f.length>o.info.actualLen&&(f=f.slice(0,o.info.actualLen)));var b=0,E;if(s.instance!==!1)if(s.info.authLen>0){var A=Xd.createCipheriv(lz[s.type],s.key,s.iv);A.setAutoPadding(!1);var T=d.slice(0,4);A.setAAD(T),e.push(T),b+=T,E=A.update(d.slice(4)),e.push(E),b+=E.length;var R=A.final();R.length&&(e.push(R),b+=R.length);var B=A.getAuthTag();p=e.push(B),b+=B.length,mRr(s.iv)}else E=s.instance.update(d),e.push(E),b+=E.length,p=e.push(f),b+=f.length;else p=e.push(d),b=d.length;return e.bytesSent+=b,++i.seqno>vct&&(i.seqno=0),r&&r(),p}a(TRr,"send_");var KTs=function(){return typeof Xd.randomFillSync=="function"?Xd.randomFillSync:a(function(t,r,n){var i=Xd.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function JTs(e,t){Xd.randomBytes(e,a(function r(n,i){if(n)return Xd.randomBytes(e,r);t&&t(i)},"retry"))}a(JTs,"randBytes");function Act(e,t){switch(t){case"ssh-dss":return hTs(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return yTs(e)}return e}a(Act,"convertSignature");var QTs=function(){return typeof Xd.timingSafeEqual=="function"?a(function(t,r){return t.length!==r.length?(Xd.timingSafeEqual(t,t),!1):Xd.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 $L(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!STs)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($L,"KeyExchange");$L.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}};$L.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:ave(this._kex.getPrime()),generator:ave(this._kex.getGenerator())}};$L.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=Xd.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=Xd.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=Xd.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=Xd.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};$L.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)};$L.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};$L.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new fRr.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(fRr.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(),ave(Xd.diffieHellman({privateKey:this._keys.privateKey,publicKey:Xd.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return ave(this._kex.computeSecret(e))}catch(r){return r}}};function ave(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(ave,"convertToMpint");xct.exports=jc;xct.exports._send=Ac});var sve=x((Dkc,IRr)=>{IRr.exports={SFTPStream:sRr(),SSH2Stream:RRr(),utils:rx(),constants:zye()}});var qRr=x(LRr=>{var NRr=require("http").Agent,YTs=require("https").Agent,ZTs=require("util").inherits,Pct;[NRr,YTs].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"),ZTs(t,e),t.prototype.createConnection=eRs,LRr[e===NRr?"SSHTTPAgent":"SSHTTPSAgent"]=t});function eRs(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;Pct===void 0&&(Pct=kct().Client);var o=new Pct,c=!1;o.on("ready",()=>{o.forwardOut(r,n,i,s,(l,d)=>{if(c=!0,l)return o.end(),t(l);d.once("close",()=>{o.end()}),t(null,tRs(d))})}).on("error",t).on("close",()=>{c||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}a(eRs,"createConnection");function sG(){}a(sG,"noop");function tRs(e){return e.setKeepAlive=sG,e.setNoDelay=sG,e.setTimeout=sG,e.ref=sG,e.unref=sG,e.destroySoon=e.destroy,e}a(tRs,"decorateStream")});var Tct=x((Rkc,jRr)=>{var ORr=require("util").inherits,MRr=require("stream").Duplex,rRs=require("stream").Readable,FRr=require("stream").Writable,nRs=sve().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,iRs=32*1024,oG=2*1024*1024,ove=oG/2,zRr=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],aRs=zRr.length;function _C(e,t,r){var n={highWaterMark:oG,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,MRr.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,c=o.id,l=this.outgoing=e.outgoing,d=this._callbacks=[],f,p,h,w,b;this._client=t,this._hasX11=!1;var E=t._channels,A=t._sshstream;function T(){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(T,"ondrain"),t._sock.on("drain",T),A.once("CHANNEL_EOF:"+c,function(){o.state==="open"&&(o.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+c,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),(l.state==="open"||l.state==="eof")&&i.close(),l.state==="closing"&&(l.state="closed"),delete E[c];var I=i._writableState;t._sock.removeListener("drain",T),!I.ending&&!I.finished&&i.end(),i._callbacks=[];for(var q=0;q<d.length;++q)d[q](!0);d=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){f===null?i.emit("close",f,p,h,w,b):i.emit("close",f)}):f===null?i.emit("close",f,p,h,w,b):i.emit("close",f),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var q=0;q<aRs;++q)A.removeAllListeners(zRr[q]+":"+c)}}).on("CHANNEL_DATA:"+c,function(I){if(o.window!==0){if(o.window-=I.length,!i.push(I)){i._waitChanDrain=!0;return}o.window<=ove&&cve(i)}}).on("CHANNEL_WINDOW_ADJUST:"+c,function(I){l.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:"+c,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),d.length&&d.shift()(!1)}).on("CHANNEL_FAILURE:"+c,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),d.length&&d.shift()(!0)}).on("CHANNEL_REQUEST:"+c,function(I){if(!s){if(I.request==="exit-status"){i.emit("exit",f=I.code);return}else if(I.request==="exit-signal"){i.emit("exit",f=null,p="SIG"+I.signal,h=I.coredump,w=I.description,b=I.lang);return}}I.wantReply&&A.channelFailure(l.id)}),this.stdin=this.stdout=this,s?this.stderr=new Dct(this):(this.stderr=new rRs(n),this.stderr._read=function(I){i._waitChanDrain&&(i._waitChanDrain=!1,o.window<=ove&&cve(i))},A.on("CHANNEL_EXTENDED_DATA:"+c,function(I,q){if(o.window!==0){if(o.window-=q.length,!i.stderr.push(q)){i._waitChanDrain=!0;return}o.window<=ove&&cve(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 B(){i.readable=!1}a(B,"onEnd"),this.on("end",B).on("close",B)}a(_C,"Channel");ORr(_C,MRr);_C.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};_C.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};_C.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=ove&&cve(this))};_C.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,o=i.id,c=i.window,l=e.length,d=0,f,p,h;if(i.state==="open"){for(;l-d>0&&c>0;)if(h=l-d,h>c&&(h=c),h>s&&(h=s),f=n.channelData(o,e.slice(d,d+h)),d+=h,c-=h,!f){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=c,l-d>0){c===0&&(this._waitWindow=!0),d>0?(p=Buffer.allocUnsafe(l-d),e.copy(p,0,d),this._chunk=p):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};_C.prototype.destroy=function(){this.end()};_C.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};_C.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};_C.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};_C.MAX_WINDOW=oG;_C.PACKET_SIZE=iRs;function cve(e){if(e.outgoing.state==="closed")return!0;var t=oG-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}a(cve,"windowAdjust");function Dct(e){FRr.call(this,{highWaterMark:oG}),this._channel=e}a(Dct,"ServerStderr");ORr(Dct,FRr);Dct.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,o=s.packetSize,c=s.id,l=s.window,d=e.length,f=0,p,h,w;if(n.outgoing.state==="open"){for(;d-f>0&&l>0;)if(w=d-f,w>l&&(w=l),w>o&&(w=o),p=i.channelExtData(c,e.slice(f,f+w),nRs),f+=w,l-=w,!p){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=l,d-f>0){l===0&&(n._waitWindow=!0),f>0?(h=Buffer.allocUnsafe(d-f),e.copy(h,0,f),n._chunkErr=h):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};jRr.exports=_C});var pz=x((Ikc,BRr)=>{BRr.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 tIr=x((Nkc,eIr)=>{var URr=require("net").Socket,sRs=require("events").EventEmitter,oRs=require("util").inherits,cRs=require("path"),GRr=require("fs"),$Rr=require("child_process"),HRr=pz().readUInt32BE,lve=pz().writeUInt32BE,VRr=pz().writeUInt32LE,lRs=11,uRs=12,dRs=13,fRs=14,mRs=5,pRs=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,gRs=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;eIr.exports=function(e,t,r,n,i){var s,o,c,l,d=0,f=Buffer.isBuffer(t),p,h=0,w=0,b=0,E,A=0,T=!1,R,B;typeof t=="function"&&typeof r=="function"?(R=t,B=r):f?(d=t.length,l=n.length):(i=t,t=void 0);function I(){var V;if(f){var O=9;V=Buffer.allocUnsafe(4+1+4+d+4+l+4),lve(V,V.length-4,0),V[4]=dRs,lve(V,d,5),t.copy(V,O),lve(V,l,O+=d),n.copy(V,O+=4),lve(V,0,O+=l),s.write(V)}else s.write(Buffer.from([0,0,0,1,lRs]))}a(I,"onconnect");function q(V){for(var O=0,ne=V.length;O<ne;++O)if(p===void 0)++h==5&&(p=V[O],h=0);else if(p===fRs){if(!c)w<<=8,w+=V[O],++h==4&&(c=Buffer.allocUnsafe(w),h=0);else if(c[h]=V[O],++h===w)return s.removeAllListeners("data"),s.destroy()}else if(p===uRs)if(E===void 0){if(b<<=8,b+=V[O],++h==4&&(E=new Array(b),h=0,b===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)d<<=8,d+=V[O],++h==4&&(t=Buffer.allocUnsafe(d),h=0);else if(T===!1){if(t[h]=V[O],++h===d&&(E[b-1]=t,d=0,h=0,T=!0,--b==0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else T===!0?(A<<=8,A+=V[O],++h==4&&(h=0,A>0?T=A:(t=void 0,T=!1),A=0)):++h===T&&(T=!1,h=0,t=void 0);else if(p===mRs)return f?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(q,"ondata");function re(V){o=V}a(re,"onerror");function K(){o?i(o):f&&!c||!f&&!E?i(new Error("Unexpected disconnection from agent")):f&&c?i(void 0,c):!f&&E&&i(void 0,E)}if(a(K,"onclose"),process.platform==="win32"&&!gRs.test(e))if(e==="pageant")s=new _Rs;else{var Z=!1;GRr.readFile(e,a(function V(O,ne){if(O){if(Z)return i(new Error("Invalid cygwin unix socket path"));$Rr.exec('cygpath -w "'+e+'"',function(de,H,ke){if(de||H.length===0)return i(new Error("Invalid cygwin unix socket path"));Z=!0,e=H.toString().replace(/[\r\n]/g,""),GRr.readFile(e,V)});return}var $;if($=pRs.exec(ne.toString("ascii"))){let de=function(){L=0,z="secret",s.write(G)},H=function(Y){L+=Y.length,z==="secret"?L===16&&(L=0,z="creds",s.write(F)):z==="creds"&&(N||W.push(Y),L===12&&(s.removeListener("connect",de),s.removeListener("data",H),s.removeListener("close",ke),N?(ie(),s.emit("connect")):(N=!0,F=Buffer.concat(W),VRr(F,process.pid,0),s.destroy(),se())))},ke=function(){i(new Error("Problem negotiating cygwin unix socket security"))},se=function(){s=new URr,s.once("connect",de),s.on("data",H),s.once("close",ke),s.connect(U)};var ye=de,X=H,ue=ke,ae=se;a(de,"_onconnect"),a(H,"_ondata"),a(ke,"_onclose"),a(se,"tryConnect");var U,D,G,z,L=0,N=!1,W=[],F=Buffer.allocUnsafe(12),Q,ee;for(F.fill(0),U=parseInt($[1],10),D=$[2].replace(/\-/g,""),G=Buffer.allocUnsafe(16),Q=0,ee=0;ee<32;++Q,ee+=2)G[Q]=parseInt(D.substring(ee,ee+2),16);for(Q=0;Q<16;Q+=4)VRr(G,HRr(G,Q),Q);se()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new URr;function ie(){if(!R&&!B)s.once("connect",I),s.on("data",q),s.once("error",re),s.once("close",K);else{var V;s.once("connect",function(){V=R();var O=!1;function ne(){O||(s.destroy(),O=!0)}a(ne,"onDone"),V.once("end",ne).once("close",ne).on("data",function($){s.write($)}),s.on("data",function($){V.write($)})}),s.once("close",function(){V||B()})}}a(ie,"addSockListeners"),ie(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};_Rs=e,a(e,"PageantSock"),WRr=10,XRr=11,KRr=12,JRr=13,QRr=14,YRr=15,Hk={},ZRr=cRs.resolve(__dirname,"..","util/pagent.exe"),Hk[WRr]=new Error("Invalid pagent.exe arguments"),Hk[XRr]=new Error("Pageant is not running"),Hk[KRr]=new Error("pagent.exe could not create an mmap"),Hk[JRr]=new Error("pagent.exe could not set mode for stdin"),Hk[QRr]=new Error("pagent.exe could not set mode for stdout"),Hk[YRr]=new Error("pagent.exe did not get expected input payload"),oRs(e,sRs),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=HRr(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=$Rr.spawn(ZRr,[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,Hk[o]&&!s&&(s=!0,n.emit("error",Hk[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 WRr,XRr,KRr,JRr,QRr,YRr,Hk,ZRr,_Rs});var iIr=x((Lkc,nIr)=>{var hRs=require("util").inherits,rIr=require("events").EventEmitter;function Ku(e){var t=this;rIr.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(Ku,"SFTPWrapper");hRs(Ku,rIr);Ku.prototype.end=function(){return this._stream.end()};Ku.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};Ku.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};Ku.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};Ku.prototype.close=function(e,t){return this._stream.close(e,t)};Ku.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};Ku.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};Ku.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};Ku.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};Ku.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};Ku.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};Ku.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};Ku.prototype.exists=function(e,t){return this._stream.exists(e,t)};Ku.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};Ku.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};Ku.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};Ku.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};Ku.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};Ku.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};Ku.prototype.stat=function(e,t){return this._stream.stat(e,t)};Ku.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};Ku.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};Ku.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};Ku.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};Ku.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};Ku.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};Ku.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};Ku.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};Ku.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};Ku.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};Ku.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};Ku.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};Ku.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};Ku.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};Ku.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};Ku.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};Ku.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};Ku.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};nIr.exports=Ku});var oIr=x((qkc,sIr)=>{function aIr(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(aIr,"spliceOne");function cG(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,c,l;s<o;++s)if(c=n[s],l=c._kalast,l&&i-l>=t)if(++c._kacnt>r){var d=new Error("Keepalive timeout");d.level="client-timeout",c.emit("error",d),c.disconnect(),aIr(n,s),--s,o=n.length}else c._kalast=i,c.ping()}}a(cG,"Manager");cG.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};cG.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};cG.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")};cG.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&aIr(t,r),t.length||this.stop()};sIr.exports=cG});var pIr=x((Okc,qct)=>{var yRs=require("net"),KR=require("events").EventEmitter,iy=KR.listenerCount,JR=require("util").inherits,uve=sve(),cIr=uve.utils.parseKey,vRs=uve.SSH2Stream,wRs=uve.SFTPStream,Rct=uve.constants,lG=Rct.DISCONNECT_REASON,Ict=Rct.CHANNEL_OPEN_FAILURE,uG=Rct.ALGORITHMS,e_=Tct(),bRs=oIr(),SRs=pz().writeUInt32BE,lIr=Math.pow(2,32)-1,CRs=10,dve;function bg(e,t){if(!(this instanceof bg))return new bg(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=cIr(n[i]):s=cIr(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 c,l;if(l=e.algorithms.kex,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_KEX,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported key exchange algorithm: "+l[i]);o.kex=l}if(l=e.algorithms.cipher,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_CIPHER,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported cipher algorithm: "+l[i]);o.cipher=l}l=e.algorithms.serverHostKey;var d=!1;if(Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_SERVER_HOST_KEY,i=l.length-1;i>=0;--i){if(c.indexOf(l[i])===-1)throw new Error("Unsupported server host key algorithm: "+l[i]);r[l[i]]||(d||(l=l.slice(),d=!0),l.splice(i,1))}l.length>0&&(o.serverHostKey=l)}if(l=e.algorithms.hmac,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_HMAC,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported HMAC algorithm: "+l[i]);o.hmac=l}if(l=e.algorithms.compress,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_COMPRESS,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported compression algorithm: "+l[i]);o.compress=l}}if(o.serverHostKey===void 0){var f=Object.keys(r);for(i=f.length-1;i>=0;--i)r[f[i]]||f.splice(i,1);o.serverHostKey=f}!dve&&bg.KEEPALIVE_INTERVAL>0&&bg.KEEPALIVE_CLIENT_INTERVAL>0&&bg.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(dve=new bRs(bg.KEEPALIVE_INTERVAL,bg.KEEPALIVE_CLIENT_INTERVAL,bg.KEEPALIVE_CLIENT_COUNT_MAX));var p=this;KR.call(this),typeof t=="function"&&p.on("connection",t);var h={algorithms:o,hostKeys:r,server:!0},w,b;for(i=0,w=Object.keys(e),b=w.length;i<b;++i){var E=w[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,T=Object.keys(h);this._srv=new yRs.Server(function(R){if(p._connections>=p.maxConnections){R.destroy();return}++p._connections,R.once("close",function(V){--p._connections,K.read()}).on("error",function(V){K.reset(),K.emit("error",V)});var B=h;if(A){B={};for(var I=0,q;I<T.length;++I)q=T[I],B[q]=h[q];var re="["+process.hrtime().join(".")+"] ";B.debug=function(V){A(re+V)}}var K=new vRs(B),Z=new QR(K,R);R.pipe(K).pipe(R);function ie(V){}a(ie,"onClientPreHeaderError"),Z.on("error",ie),K.once("header",function(V){if(!K._readableState.ended){if(!iy(p,"connection"))return K.disconnect(lG.BY_APPLICATION);Z.removeListener("error",ie),p.emit("connection",Z,{ip:R.remoteAddress,family:R.remoteFamily,port:R.remotePort,header:V})}})}).on("error",function(R){p.emit("error",R)}).on("listening",function(){p.emit("listening")}).on("close",function(){p.emit("close")}),this._connections=0,this.maxConnections=1/0}a(bg,"Server");JR(bg,KR);bg.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};bg.prototype.address=function(){return this._srv.address()};bg.prototype.getConnections=function(e){this._srv.getConnections(e)};bg.prototype.close=function(e){return this._srv.close(e),this};bg.prototype.ref=function(){this._srv.ref()};bg.prototype.unref=function(){this._srv.unref()};function QR(e,t){KR.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=[],c;e.on("SERVICE_REQUEST",function(h){if(i===0||s||r.authenticated||h!=="ssh-userauth")return e.disconnect(lG.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(h)}).on("USERAUTH_REQUEST",l);function l(h,w,b,E){if(i===0||c&&(c.username!==h||c.service!==w)||b!=="password"&&b!=="publickey"&&b!=="hostbased"&&b!=="keyboard-interactive"&&b!=="none"||o.length===CRs)return e.disconnect(lG.PROTOCOL_ERROR);if(w!=="ssh-connection")return e.disconnect(lG.SERVICE_NOT_AVAILABLE);e._state.authMethod=b;var A;if(b==="keyboard-interactive"?A=new fve(e,h,w,b,E,d):b==="publickey"?A=new Nct(e,h,w,b,E,d):b==="hostbased"?A=new dIr(e,h,w,b,E,d):b==="password"?A=new fIr(e,h,w,b,E,d):b==="none"&&(A=new Eb(e,h,w,b,d)),c)if(c._initialResponse)c._multistep&&!this._finalResponse&&(c._cleanup&&c._cleanup(),c.emit("abort"));else return o.push(A);c=A,iy(r,"authentication")?r.emit("authentication",c):c.reject()}a(l,"onUSERAUTH_REQUEST");function d(h,w,b,E){c===h&&!r.authenticated&&(w?(e.removeListener("USERAUTH_REQUEST",l),c=void 0,r.authenticated=!0,e.authSuccess(),o=[],r.emit("ready")):(e.authFailure(b,E),o.length&&(c=o.pop(),iy(r,"authentication")?r.emit("authentication",c):c.reject())))}a(d,"onAuthDecide");var f=[];function p(){for(var h;f.length>0&&f[0].type;)h=f.shift(),h.type==="SUCCESS"&&e.requestSuccess(h.buf),h.type==="FAILURE"&&e.requestFailure()}a(p,"sendReplies"),e.on("GLOBAL_REQUEST",function(h,w,b){var E={type:null,buf:null};function A(I,q){E.type=I,E.buf=q,p()}if(a(A,"setReply"),w&&f.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")&&iy(r,"request")&&r.authenticated){var T,R;if(w){var B=!1;T=a(function(I){if(!B){B=!0;var q;h==="tcpip-forward"&&b.bindPort===0&&typeof I=="number"&&(q=Buffer.allocUnsafe(4),SRs(q,I,0)),A("SUCCESS",q)}},"accept"),R=a(function(){B||(B=!0,A("FAILURE"))},"reject")}if(h==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,T&&T();return}r.emit("request",T,R,h,b)}else w&&A("FAILURE")}),e.on("CHANNEL_OPEN",function(h){if(h.type==="session"&&r.noMoreSessions||!r.authenticated){var w=Ict.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,w)}var b=mIr(r),E,A,T=!1;if(b===!1)return e.channelOpenFail(h.sender,Ict.RESOURCE_SHORTAGE);switch(n[b]=!0,A=a(function(){if(!T){T=!0,delete n[b];var R=Ict.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,R)}},"reject"),h.type){case"session":iy(r,"session")?(E=a(function(){if(!T)return T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE),new uIr(r,h,b)},"accept"),r.emit("session",E,A)):A();break;case"direct-tcpip":iy(r,"tcpip")?(E=a(function(){if(!T){T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE);var R={type:void 0,incoming:{id:b,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new e_(R,r)}},"accept"),r.emit("tcpip",E,A,h.data)):A();break;case"direct-streamlocal@openssh.com":iy(r,"openssh.streamlocal")?(E=a(function(){if(!T){T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE);var R={type:void 0,incoming:{id:b,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new e_(R,r)}},"accept"),r.emit("openssh.streamlocal",E,A,h.data)):A();break;default:A()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),dve&&this.once("ready",function(){dve.add(e)})}a(QR,"Client");JR(QR,KR);QR.prototype.end=function(){return this._sshstream.disconnect(lG.BY_APPLICATION)};QR.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return Lct(this,"x11",n,r)};QR.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return Lct(this,"forwarded-tcpip",s,i)};QR.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return Lct(this,"forwarded-streamlocal@openssh.com",r,t)};QR.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 uIr(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,o,c={type:"session",incoming:{id:r,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function l(p){var h=!1,w,b;if(p.wantReply&&(p.request!=="shell"&&p.request!=="exec"&&p.request!=="subsystem"&&(w=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelSuccess(s)},"accept")),b=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelFailure(s)},"reject")),n){b&&b();return}switch(p.request){case"env":iy(i,"env")?i.emit("env",w,b,{key:p.key,val:p.val}):b&&b();break;case"pty-req":iy(i,"pty")?i.emit("pty",w,b,{cols:p.cols,rows:p.rows,width:p.width,height:p.height,term:p.term,modes:p.modes}):b&&b();break;case"window-change":iy(i,"window-change")?i.emit("window-change",w,b,{cols:p.cols,rows:p.rows,width:p.width,height:p.height}):b&&b();break;case"x11-req":iy(i,"x11")?i.emit("x11",w,b,{single:p.single,protocol:p.protocol,cookie:p.cookie,screen:p.screen}):b&&b();break;case"signal":iy(i,"signal")?i.emit("signal",w,b,{name:p.signal}):b&&b();break;case"auth-agent-req@openssh.com":iy(i,"auth-agent")?i.emit("auth-agent",w,b):b&&b();break;case"shell":iy(i,"shell")?(w=a(function(){if(!(h||n||o))return h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request,o},"accept"),i.emit("shell",w,b)):b&&b();break;case"exec":iy(i,"exec")?(w=a(function(){if(!(h||n||o))return h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request,o},"accept"),i.emit("exec",w,b,{command:p.command})):b&&b();break;case"subsystem":w=a(function(){if(!(h||n||o))if(h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request+":"+p.subsystem,p.subsystem==="sftp"){var E=new wRs({server:!0,debug:e._sshstream.debug});return o.pipe(E).pipe(o),E}else return o},"accept"),p.subsystem==="sftp"&&iy(i,"sftp")?i.emit("sftp",w,b):p.subsystem!=="sftp"&&iy(i,"subsystem")?i.emit("subsystem",w,b,{name:p.subsystem}):b&&b();break;default:b&&b()}}a(l,"onREQUEST");function d(){n=!0,i.emit("eof"),i.emit("end")}a(d,"onEOF");function f(){n=!0,i.emit("close")}a(f,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,l).once("CHANNEL_EOF:"+r,d).once("CHANNEL_CLOSE:"+r,f)}a(uIr,"Session");JR(uIr,KR);function Eb(e,t,r,n,i){KR.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,c,l){s._finalResponse||(s._finalResponse=!0,i(s,o,c,l))},this._stream=e}a(Eb,"AuthContext");JR(Eb,KR);Eb.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};Eb.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var ERs=/[ \t\r\n]*,[ \t\r\n]*/g;function fve(e,t,r,n,i,s){Eb.call(this,e,t,r,n,s),this._multistep=!0;var o=this;this._cb=void 0,this._onInfoResponse=function(c){if(o._cb){var l=o._cb;o._cb=void 0,l(c)}},this.submethods=i.split(ERs),this.on("abort",function(){o._cb&&o._cb(new Error("Authentication request aborted"))})}a(fve,"KeyboardAuthContext");JR(fve,Eb);fve.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};fve.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 Nct(e,t,r,n,i,s){Eb.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(Nct,"PKAuthContext");JR(Nct,Eb);Nct.prototype.accept=function(){this.signature?Eb.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function dIr(e,t,r,n,i,s){Eb.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(dIr,"HostbasedAuthContext");JR(dIr,Eb);function fIr(e,t,r,n,i,s){Eb.call(this,e,t,r,n,s),this.password=i}a(fIr,"PwdAuthContext");JR(fIr,Eb);function Lct(e,t,r,n){var i=mIr(e),s=e_.MAX_WINDOW,o=e_.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var f={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:d.sender,window:d.window,packetSize:d.packetSize,state:"open"}};n(void 0,new e_(f,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var f=new Error("(SSH) Channel open failure: "+d.description);f.reason=d.reason,f.lang=d.lang,n(f)}),t==="forwarded-tcpip"?c=l.forwardedTcpip(i,s,o,r):t==="x11"?c=l.x11(i,s,o,r):t==="forwarded-streamlocal@openssh.com"&&(c=l.openssh_forwardedStreamLocal(i,s,o,r)),c}a(Lct,"openChannel");function mIr(e){if(e._curChan<lIr)return++e._curChan;for(var t=0,r=e._channels;t<lIr;++t)if(!r[t])return t;return!1}a(mIr,"nextChannel");bg.createServer=function(e,t){return new bg(e,t)};bg.KEEPALIVE_INTERVAL=1e3;bg.KEEPALIVE_CLIENT_INTERVAL=15e3;bg.KEEPALIVE_CLIENT_COUNT_MAX=3;qct.exports=bg;qct.exports.IncomingClient=QR});var kct=x((Mkc,AIr)=>{var dG=require("crypto"),ARs=require("net").Socket,xRs=require("dns").lookup,gIr=require("events").EventEmitter,PRs=require("util").inherits,kRs=dG.getHashes(),fG=sve(),DRs=fG.SSH2Stream,Oct=fG.SFTPStream,HL=fG.constants,TRs=HL.BUGS,mG=HL.ALGORITHMS,RRs=HL.EDDSA_SUPPORTED,IRs=fG.utils.parseKey,_Ir=qRr(),YR=Tct(),Mct=tIr(),NRs=iIr(),Fct=pz().readUInt32BE,hIr=Math.pow(2,32)-1,mve=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,yIr=a(function(e){},"DEBUG_NOOP");function Nm(){if(!(this instanceof Nm))return new Nm;gIr.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(Nm,"Client");PRs(Nm,gIr);Nm.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=mG.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=mG.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=mG.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=mG.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=mG.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 c=this.config.debug=typeof e.debug=="function"?e.debug:yIr;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var l=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var d;if(this.config.privateKey){if(d=IRs(this.config.privateKey,e.passphrase),d instanceof Error)throw new Error("Cannot parse privateKey: "+d.message);if(Array.isArray(d)&&(d=d[0]),d.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var f=this._sshstream=new DRs({algorithms:r,debug:c===yIr?void 0:c}),p=this._sock=e.sock||new ARs;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var h=this.config.keepaliveInterval,w=this.config.keepaliveCountMax,b=0,E;function A(){if(++b>w){if(clearInterval(E),p.readable){var ee=new Error("Keepalive timeout");ee.level="client-timeout",t.emit("error",ee),p.destroy()}return}p.writable?(l.push(T),f.ping()):clearInterval(E)}a(A,"sendKA");function T(){h>0&&(b=0,clearInterval(E),p.writable&&(E=setInterval(A,h)))}if(a(T,"resetKA"),this._resetKA=T,f.on("USERAUTH_BANNER",function(ee){t.emit("banner",ee)}),p.on("connect",function(){c("DEBUG: Client: Connected"),t.emit("connect"),e.sock||f.pipe(p).pipe(f)}).on("timeout",function(){t.emit("timeout")}).on("error",function(ee){clearTimeout(t._readyTimeout),ee.level="client-socket",t.emit("error",ee)}).on("end",function(){f.unpipe(p),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("end")}).on("close",function(){f.unpipe(p),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("close");var ee=l,X=new Error("No response from server");for(l=t._callbacks=[],n=0;n<ee.length;++n)ee[n](X);var ae=t._channels,ye=Object.keys(ae);for(t._channels={},n=0;n<ye.length;++n){var ue=f.emit("CHANNEL_OPEN_FAILURE:"+ye[n],X),de=f.emit("CHANNEL_CLOSE:"+ye[n]),H;!ue&&!de&&(H=ae[ye[n]])&&typeof H=="function"&&H(X)}}),f.on("drain",function(){t.emit("drain")}).once("header",function(ee){t._remoteVer=ee.versions.software,ee.greeting&&t.emit("greeting",ee.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(ee){ee.level===void 0?ee.level="protocol":ee.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",ee)}).on("end",function(){p.resume()}),typeof e.hostVerifier=="function"){if(kRs.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var R=e.hostVerifier,B=dG.createHash(e.hostHash);f.once("fingerprint",function(ee,X){B.update(ee);var ae=R(B.digest("hex"),X);ae!==void 0&&X(ae)})}var I,q=null,re=null,K,Z=0,ie=["none"];if(this.config.password!==void 0&&ie.push("password"),d!==void 0&&ie.push("publickey"),this.config.agent!==void 0&&ie.push("agent"),this.config.tryKeyboard&&ie.push("keyboard-interactive"),d!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&ie.push("hostbased"),o===void 0){var V=0;o=a(function(X,ae,ye){return V===ie.length?!1:ie[V++]},"authHandler")}var O=!1;function ne(ee){if(O=!0,ee===!1){f.removeListener("USERAUTH_FAILURE",z),f.removeListener("USERAUTH_PK_OK",G);var X=new Error("All configured authentication methods failed");X.level="client-authentication",t.emit("error",X),f.writable&&t.end();return}if(ie.indexOf(ee)===-1)throw new Error("Authentication method not allowed: "+ee);switch(I=ee,I){case"password":f.authPassword(t.config.username,t.config.password);break;case"publickey":f.authPK(t.config.username,d),f.once("USERAUTH_PK_OK",G);break;case"hostbased":let ye=function(ue,de){var H=d.sign(ue);if(H instanceof Error)return H.message="Error while signing data with privateKey: "+H.message,H.level="client-authentication",t.emit("error",H),$();de(H)};var ae=ye;a(ye,"hostbasedCb"),f.authHostbased(t.config.username,d,t.config.localHostname,t.config.localUsername,ye);break;case"agent":Mct(t.config.agent,function(ue,de){if(ue)return ue.level="agent",t.emit("error",ue),K=void 0,$();if(de.length===0)return c("DEBUG: Agent: No keys stored in agent"),K=void 0,$();K=de,Z=0,f.authPK(t.config.username,de[0]),f.once("USERAUTH_PK_OK",G)});break;case"keyboard-interactive":f.authKeyboard(t.config.username),f.on("USERAUTH_INFO_REQUEST",D);break;case"none":f.authNone(t.config.username);break}}a(ne,"doNextAuth");function $(){O=!1;var ee=o(re,q,ne);O||ee===void 0||ne(ee)}a($,"tryNextAuth");function U(){if(I==="agent"){if(Z>=K.length)return;++Z>=K.length?(c("DEBUG: Agent: No more keys left to try"),c("DEBUG: Client: agent auth failed"),K=void 0,$()):(c("DEBUG: Agent: Trying key #"+(Z+1)),f.authPK(t.config.username,K[Z]),f.once("USERAUTH_PK_OK",G))}}a(U,"tryNextAgentKey");function D(ee,X,ae,ye){var ue=Array.isArray(ye)?ye.length:0;if(ue===0)return c("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),f.authInfoRes();t.emit("keyboard-interactive",ee,X,ae,ye,function(de){f.authInfoRes(de)})}a(D,"onUSERAUTH_INFO_REQUEST");function G(){if(I==="agent"){var ee=K[Z],X=Fct(ee,0),ae=ee.toString("ascii",4,4+X),ye=ae.slice(4);switch(ae){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(RRs&&ae==="ssh-ed25519")break;return c("DEBUG: Agent: Skipping unsupported key type: "+ae),U()}f.authPK(t.config.username,ee,function(ue,de){Mct(t.config.agent,ee,ye,ue,function(H,ke){if(H)H.level="agent",t.emit("error",H);else{var se=Fct(ke,0);if(4+se+4<ke.length){var Y=ke.toString("ascii",4,4+se);if(Y!==ae)H=new Error("Agent key/signature type mismatch"),H.level="agent",t.emit("error",H);else return de(ke.slice(4+se+4))}}U()})})}else I==="publickey"&&f.authPK(t.config.username,d,function(ue,de){var H=d.sign(ue);if(H instanceof Error)return H.message="Error while signing data with privateKey: "+H.message,H.level="client-authentication",t.emit("error",H),$();de(H)})}a(G,"onUSERAUTH_PK_OK");function z(ee,X){if(f.removeListener("USERAUTH_PK_OK",G),f.removeListener("USERAUTH_INFO_REQUEST",D),I==="agent")return c("DEBUG: Client: Agent key #"+(Z+1)+" failed"),U();c("DEBUG: Client: "+I+" auth failed"),q=X,re=ee,$()}if(a(z,"onUSERAUTH_FAILURE"),f.once("USERAUTH_SUCCESS",function(){f.removeListener("USERAUTH_FAILURE",z),f.removeListener("USERAUTH_INFO_REQUEST",D),T(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",z),f.once("ready",function(){f.service("ssh-userauth"),f.once("SERVICE_ACCEPT",function(ee){ee==="ssh-userauth"&&$()})}),f.on("CHANNEL_OPEN",function(ee){ORs(t,ee)}),f.on("REQUEST_SUCCESS",function(ee){l.length&&l.shift()(!1,ee)}).on("REQUEST_FAILURE",function(){l.length&&l.shift()(!0)}),f.on("GLOBAL_REQUEST",function(ee,X,ae){X&&f.requestFailure()}),e.sock)F(),f.pipe(p).pipe(f);else{let ee=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 Q=ee;a(ee,"doConnect");var L=this.config.host,N=this.config.forceIPv4,W=this.config.forceIPv6;c("DEBUG: Client: Trying "+L+" on port "+this.config.port+" ..."),!N&&!W||N&&W?ee():xRs(L,N?4:6,function(X,ae,ye){if(X){var ue=new Error("Error while looking up "+(N?"IPv4":"IPv6")+" address for host "+L+": "+X);clearTimeout(t._readyTimeout),ue.level="client-dns",t.emit("error",ue),t.emit("close");return}L=ae,ee()})}function F(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var ee=new Error("Timed out while waiting for handshake");ee.level="client-timeout",t.emit("error",ee),p.destroy()},t.config.readyTimeout))}a(F,"startTimeout")};Nm.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};Nm.prototype.destroy=function(){this._sock&&this._sock.destroy()};Nm.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 gz(this,"session",i,function(s,o){if(s)return r(s);var c=[];function l(d){if(d)return o.close(),r(d);c.length&&c.shift()()}a(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&c.push(function(){SIr(o,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&CIr(o,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&c.push(function(){bIr(o,t.pty,l)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&c.push(function(){wIr(o,t.x11,l)})),c.push(function(){qRs(o,e,t,r)}),c.shift()()})};Nm.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),gz(this,"session",function(i,s){if(i)return r(i);var o=[];function c(l){if(l)return s.close(),r(l);o.length&&o.shift()()}a(c,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&o.push(function(){SIr(s,c)}),e!==!1&&o.push(function(){bIr(s,e,c)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&CIr(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&o.push(function(){wIr(s,t.x11,c)})),o.push(function(){LRs(s,r)}),o.shift()()})};Nm.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return gz(this,"session",function(r,n){if(r)return t(r);EIr(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};Nm.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return gz(this,"session",function(r,n){if(r)return e(r);EIr(n,"sftp",function(i,s){if(i)return e(i);var o=t._sshstream._state.incoming.identRaw,c={debug:t.config.debug},l=new Oct(c,o);function d(h){l.removeListener("ready",f),s.removeListener("exit",p),e(h)}a(d,"onError");function f(){l.removeListener("error",d),s.removeListener("exit",p),e(void 0,new NRs(l))}a(f,"onReady");function p(h,w){l.removeListener("ready",f),l.removeListener("error",d);var b;typeof h=="number"?b="Received exit code "+h+" while establishing SFTP session":b="Received signal "+w+" while establishing SFTP session";var E=new Error(b);E.code=h,E.signal=w,e(E)}a(p,"onExit"),l.once("error",d).once("ready",f).once("close",function(){s.end()}),s.once("exit",p),l.pipe(s).pipe(l)})})};Nm.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 c=t;t===0&&o&&o.length>=4&&(c=Fct(o,0),n._sshstream.remoteBugs&TRs.DYN_RPORT_BUG||(t=c)),n._forwarding[e+":"+t]=c,r(void 0,c)}),this._sshstream.tcpipForward(e,t,i)};Nm.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)};Nm.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 gz(this,"direct-tcpip",s,i)};Nm.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&&mve.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)};Nm.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&&mve.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)};Nm.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&&mve.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)};Nm.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&&mve.test(this._remoteVer)){var r={socketPath:e};return gz(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 gz(e,t,r,n){var i=vIr(e),s=YR.MAX_WINDOW,o=YR.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,d).once("CHANNEL_OPEN_FAILURE:"+i,f).once("CHANNEL_CLOSE:"+i,f),t==="session"?c=l.session(i,s,o):t==="direct-tcpip"?c=l.directTcpip(i,s,o,r):t==="direct-streamlocal@openssh.com"&&(c=l.openssh_directStreamLocal(i,s,o,r)),c;function d(p){l.removeListener("CHANNEL_OPEN_FAILURE:"+i,f),l.removeListener("CHANNEL_CLOSE:"+i,f);var h={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:p.sender,window:p.window,packetSize:p.packetSize,state:"open"}};n(void 0,new YR(h,e))}a(d,"onSuccess");function f(p){l.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,d),l.removeListener("CHANNEL_OPEN_FAILURE:"+i,f),l.removeListener("CHANNEL_CLOSE:"+i,f),delete e._channels[i];var h;p instanceof Error?h=p:typeof p=="object"&&p!==null?(h=new Error("(SSH) Channel open failure: "+p.description),h.reason=p.reason,h.lang=p.lang):(h=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),h.reason=h.lang=""),n(h)}a(f,"onFailure")}a(gz,"openChannel");function vIr(e){if(e._curChan<hIr)return++e._curChan;for(var t=0,r=e._channels;t<hIr;++t)if(!r[t])return t;return!1}a(vIr,"nextChannel");function wIr(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=MRs());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(wIr,"reqX11");function bIr(e,t,r){var n=24,i=80,s=640,o=480,c="vt100",l=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"&&(c=t.term),typeof t.modes=="object"&&(l=t.modes));var d=typeof r=="function";return e.outgoing.state!=="open"?(d&&r(new Error("Channel is not open")),!0):(d&&e._callbacks.push(function(f){if(f)return r(f!==!0?f:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,o,s,c,l,d))}a(bIr,"reqPty");function SIr(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(SIr,"reqAgentFwd");function LRs(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(LRs,"reqShell");function qRs(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(qRs,"reqExec");function CIr(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,o=0,c=n.length;o<c;++o)i=n[o],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}a(CIr,"reqEnv");function EIr(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(EIr,"reqSubsystem");function ORs(e,t){var r=!1,n;function i(){var c={type:t.type,incoming:{id:r,window:YR.MAX_WINDOW,packetSize:YR.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},l=new YR(c,e);return e._sshstream.channelOpenConfirm(t.sender,r,YR.MAX_WINDOW,YR.PACKET_SIZE),l}a(i,"accept");function s(){n===void 0&&(r===!1?n=HL.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=HL.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=HL.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=vIr(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):Mct(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=HL.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}a(ORs,"onCHANNEL_OPEN");var MRs=function(){if(typeof dG.randomFillSync=="function"){var e=Buffer.alloc(16);return a(function(){return dG.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return a(function(){return dG.randomBytes(16).toString("hex")},"randomCookie")}();Nm.Client=Nm;Nm.Server=pIr();Nm.utils=fG.utils;Nm.SFTP_STATUS_CODE=Oct.STATUS_CODE;Nm.SFTP_OPEN_MODE=Oct.OPEN_MODE;Nm.HTTPAgent=_Ir.SSHTTPAgent;Nm.HTTPSAgent=_Ir.SSHTTPSAgent;AIr.exports=Nm});var PIr=x((Fkc,xIr)=>{var FRs=kct().Client,zRs=require("http");xIr.exports=function(e){var t=new FRs,r=new zRs.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 zct=x((zkc,kIr)=>{kIr.exports=require("stream")});var IIr=x((jkc,RIr)=>{"use strict";function DIr(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(DIr,"ownKeys");function jRs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DIr(Object(r),!0).forEach(function(n){BRs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DIr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(jRs,"_objectSpread");function BRs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(BRs,"_defineProperty");function URs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a(URs,"_classCallCheck");function TIr(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(TIr,"_defineProperties");function GRs(e,t,r){return t&&TIr(e.prototype,t),r&&TIr(e,r),e}a(GRs,"_createClass");var $Rs=require("buffer"),pve=$Rs.Buffer,HRs=require("util"),jct=HRs.inspect,VRs=jct&&jct.custom||"inspect";function WRs(e,t,r){pve.prototype.copy.call(e,t,r)}a(WRs,"copyBuffer");RIr.exports=function(){function e(){URs(this,e),this.head=null,this.tail=null,this.length=0}return a(e,"BufferList"),GRs(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 pve.alloc(0);for(var n=pve.allocUnsafe(r>>>0),i=this.head,s=0;i;)WRs(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,c=r>o.length?o.length:r;if(c===o.length?s+=o:s+=o.slice(0,r),r-=c,r===0){c===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(c));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:a(function(r){var n=pve.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,c=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,c),r-=c,r===0){c===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(c));break}++s}return this.length-=s,n},"_getBuffer")},{key:VRs,value:a(function(r,n){return jct(this,jRs({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var Uct=x((Bkc,LIr)=>{"use strict";function XRs(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(Bct,this,e)):process.nextTick(Bct,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(gve,r):(r._writableState.errorEmitted=!0,process.nextTick(NIr,r,s)):process.nextTick(NIr,r,s):t?(process.nextTick(gve,r),t(s)):process.nextTick(gve,r)}),this)}a(XRs,"destroy");function NIr(e,t){Bct(e,t),gve(e)}a(NIr,"emitErrorAndCloseNT");function gve(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}a(gve,"emitCloseNT");function KRs(){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(KRs,"undestroy");function Bct(e,t){e.emit("error",t)}a(Bct,"emitErrorNT");function JRs(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}a(JRs,"errorOrDestroy");LIr.exports={destroy:XRs,undestroy:KRs,errorOrDestroy:JRs}});var ZR=x((Ukc,MIr)=>{"use strict";var qIr={};function hC(e,t,r){r||(r=Error);function n(s,o,c){return typeof t=="string"?t:t(s,o,c)}a(n,"getMessage");class i extends r{constructor(o,c,l){super(n(o,c,l))}}a(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,qIr[e]=i}a(hC,"createErrorType");function OIr(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(OIr,"oneOf");function QRs(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}a(QRs,"startsWith");function YRs(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}a(YRs,"endsWith");function ZRs(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}a(ZRs,"includes");hC("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);hC("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&QRs(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(YRs(e," argument"))i=`The ${e} ${n} ${OIr(t,"type")}`;else{let s=ZRs(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${OIr(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);hC("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");hC("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});hC("ERR_STREAM_PREMATURE_CLOSE","Premature close");hC("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});hC("ERR_MULTIPLE_CALLBACK","Callback called multiple times");hC("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");hC("ERR_STREAM_WRITE_AFTER_END","write after end");hC("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);hC("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);hC("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");MIr.exports.codes=qIr});var Gct=x((Gkc,FIr)=>{"use strict";var eIs=ZR().codes.ERR_INVALID_OPT_VALUE;function tIs(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}a(tIs,"highWaterMarkFrom");function rIs(e,t,r,n){var i=tIs(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new eIs(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}a(rIs,"getHighWaterMark");FIr.exports={getHighWaterMark:rIs}});var _ve=x(($kc,zIr)=>{zIr.exports=require("util").deprecate});var Vct=x((Hkc,HIr)=>{"use strict";HIr.exports=$p;function jIr(e){var t=this;this.next=null,this.entry=null,this.finish=function(){DIs(t,e)}}a(jIr,"CorkedRequest");var _z;$p.WritableState=pG;var nIs={deprecate:_ve()},BIr=zct(),hve=require("buffer").Buffer,iIs=global.Uint8Array||function(){};function aIs(e){return hve.from(e)}a(aIs,"_uint8ArrayToBuffer");function sIs(e){return hve.isBuffer(e)||e instanceof iIs}a(sIs,"_isUint8Array");var $ct=Uct(),oIs=Gct(),cIs=oIs.getHighWaterMark,eI=ZR().codes,lIs=eI.ERR_INVALID_ARG_TYPE,uIs=eI.ERR_METHOD_NOT_IMPLEMENTED,dIs=eI.ERR_MULTIPLE_CALLBACK,fIs=eI.ERR_STREAM_CANNOT_PIPE,mIs=eI.ERR_STREAM_DESTROYED,pIs=eI.ERR_STREAM_NULL_VALUES,gIs=eI.ERR_STREAM_WRITE_AFTER_END,_Is=eI.ERR_UNKNOWN_ENCODING,hz=$ct.errorOrDestroy;Wg()($p,BIr);function hIs(){}a(hIs,"nop");function pG(e,t,r){_z=_z||VL(),e=e||{},typeof r!="boolean"&&(r=t instanceof _z),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=cIs(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){EIs(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 jIr(this)}a(pG,"WritableState");pG.prototype.getBuffer=a(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(pG.prototype,"buffer",{get:nIs.deprecate(a(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var yve;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(yve=Function.prototype[Symbol.hasInstance],Object.defineProperty($p,Symbol.hasInstance,{value:a(function(t){return yve.call(this,t)?!0:this!==$p?!1:t&&t._writableState instanceof pG},"value")})):yve=a(function(t){return t instanceof this},"realHasInstance");function $p(e){_z=_z||VL();var t=this instanceof _z;if(!t&&!yve.call($p,this))return new $p(e);this._writableState=new pG(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)),BIr.call(this)}a($p,"Writable");$p.prototype.pipe=function(){hz(this,new fIs)};function yIs(e,t){var r=new gIs;hz(e,r),process.nextTick(t,r)}a(yIs,"writeAfterEnd");function vIs(e,t,r,n){var i;return r===null?i=new pIs:typeof r!="string"&&!t.objectMode&&(i=new lIs("chunk",["string","Buffer"],r)),i?(hz(e,i),process.nextTick(n,i),!1):!0}a(vIs,"validChunk");$p.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&sIs(e);return s&&!hve.isBuffer(e)&&(e=aIs(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=hIs),n.ending?yIs(this,r):(s||vIs(this,n,e,r))&&(n.pendingcb++,i=bIs(this,n,s,e,t,r)),i};$p.prototype.cork=function(){this._writableState.corked++};$p.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&GIr(this,e))};$p.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 _Is(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty($p.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function wIs(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=hve.from(t,r)),t}a(wIs,"decodeChunk");Object.defineProperty($p.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});function bIs(e,t,r,n,i,s){if(!r){var o=wIs(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var c=t.objectMode?1:n.length;t.length+=c;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Hct(e,t,!1,c,n,i,s);return l}a(bIs,"writeOrBuffer");function Hct(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new mIs("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}a(Hct,"doWrite");function SIs(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(gG,e,t),e._writableState.errorEmitted=!0,hz(e,n)):(i(n),e._writableState.errorEmitted=!0,hz(e,n),gG(e,t))}a(SIs,"onwriteError");function CIs(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}a(CIs,"onwriteStateUpdate");function EIs(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new dIs;if(CIs(r),t)SIs(e,r,n,t,i);else{var s=$Ir(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&GIr(e,r),n?process.nextTick(UIr,e,r,s,i):UIr(e,r,s,i)}}a(EIs,"onwrite");function UIr(e,t,r,n){r||AIs(e,t),t.pendingcb--,n(),gG(e,t)}a(UIr,"afterWrite");function AIs(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}a(AIs,"onwriteDrain");function GIr(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,c=!0;r;)i[o]=r,r.isBuf||(c=!1),r=r.next,o+=1;i.allBuffers=c,Hct(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 jIr(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,d=r.encoding,f=r.callback,p=t.objectMode?1:l.length;if(Hct(e,t,!1,p,l,d,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}a(GIr,"clearBuffer");$p.prototype._write=function(e,t,r){r(new uIs("_write()"))};$p.prototype._writev=null;$p.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||kIs(this,n,r),this};Object.defineProperty($p.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function $Ir(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}a($Ir,"needFinish");function xIs(e,t){e._final(function(r){t.pendingcb--,r&&hz(e,r),t.prefinished=!0,e.emit("prefinish"),gG(e,t)})}a(xIs,"callFinal");function PIs(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(xIs,e,t)):(t.prefinished=!0,e.emit("prefinish")))}a(PIs,"prefinish");function gG(e,t){var r=$Ir(t);if(r&&(PIs(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(gG,"finishMaybe");function kIs(e,t,r){t.ending=!0,gG(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}a(kIs,"endWritable");function DIs(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(DIs,"onCorkedFinish");Object.defineProperty($p.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")});$p.prototype.destroy=$ct.destroy;$p.prototype._undestroy=$ct.undestroy;$p.prototype._destroy=function(e,t){t(e)}});var VL=x((Vkc,WIr)=>{"use strict";var TIs=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};WIr.exports=ox;var VIr=Kct(),Wct=Vct();Wg()(ox,VIr);for(Xct=TIs(Wct.prototype),vve=0;vve<Xct.length;vve++)wve=Xct[vve],ox.prototype[wve]||(ox.prototype[wve]=Wct.prototype[wve]);var Xct,wve,vve;function ox(e){if(!(this instanceof ox))return new ox(e);VIr.call(this,e),Wct.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",RIs)))}a(ox,"Duplex");Object.defineProperty(ox.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ox.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ox.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function RIs(){this._writableState.ended||process.nextTick(IIs,this)}a(RIs,"onend");function IIs(e){e.end()}a(IIs,"onEndNT");Object.defineProperty(ox.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 bve=x((Wkc,JIr)=>{"use strict";var XIr=ZR().codes.ERR_STREAM_PREMATURE_CLOSE;function NIs(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(NIs,"once");function LIs(){}a(LIs,"noop");function qIs(e){return e.setHeader&&typeof e.abort=="function"}a(qIs,"isRequest");function KIr(e,t,r){if(typeof t=="function")return KIr(e,null,t);t||(t={}),r=NIs(r||LIs);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=a(function(){e.writable||c()},"onlegacyfinish"),o=e._writableState&&e._writableState.finished,c=a(function(){i=!1,o=!0,n||r.call(e)},"onfinish"),l=e._readableState&&e._readableState.endEmitted,d=a(function(){n=!1,l=!0,i||r.call(e)},"onend"),f=a(function(b){r.call(e,b)},"onerror"),p=a(function(){var b;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(b=new XIr),r.call(e,b);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(b=new XIr),r.call(e,b)},"onclose"),h=a(function(){e.req.on("finish",c)},"onrequest");return qIs(e)?(e.on("complete",c),e.on("abort",p),e.req?h():e.on("request",h)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",d),e.on("finish",c),t.error!==!1&&e.on("error",f),e.on("close",p),function(){e.removeListener("complete",c),e.removeListener("abort",p),e.removeListener("request",h),e.req&&e.req.removeListener("finish",c),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",f),e.removeListener("close",p)}}a(KIr,"eos");JIr.exports=KIr});var YIr=x((Xkc,QIr)=>{"use strict";var Sve;function tI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(tI,"_defineProperty");var OIs=bve(),rI=Symbol("lastResolve"),WL=Symbol("lastReject"),_G=Symbol("error"),Cve=Symbol("ended"),XL=Symbol("lastPromise"),Jct=Symbol("handlePromise"),KL=Symbol("stream");function nI(e,t){return{value:e,done:t}}a(nI,"createIterResult");function MIs(e){var t=e[rI];if(t!==null){var r=e[KL].read();r!==null&&(e[XL]=null,e[rI]=null,e[WL]=null,t(nI(r,!1)))}}a(MIs,"readAndResolve");function FIs(e){process.nextTick(MIs,e)}a(FIs,"onReadable");function zIs(e,t){return function(r,n){e.then(function(){if(t[Cve]){r(nI(void 0,!0));return}t[Jct](r,n)},n)}}a(zIs,"wrapForNext");var jIs=Object.getPrototypeOf(function(){}),BIs=Object.setPrototypeOf((Sve={get stream(){return this[KL]},next:a(function(){var t=this,r=this[_G];if(r!==null)return Promise.reject(r);if(this[Cve])return Promise.resolve(nI(void 0,!0));if(this[KL].destroyed)return new Promise(function(o,c){process.nextTick(function(){t[_G]?c(t[_G]):o(nI(void 0,!0))})});var n=this[XL],i;if(n)i=new Promise(zIs(n,this));else{var s=this[KL].read();if(s!==null)return Promise.resolve(nI(s,!1));i=new Promise(this[Jct])}return this[XL]=i,i},"next")},tI(Sve,Symbol.asyncIterator,function(){return this}),tI(Sve,"return",a(function(){var t=this;return new Promise(function(r,n){t[KL].destroy(null,function(i){if(i){n(i);return}r(nI(void 0,!0))})})},"_return")),Sve),jIs),UIs=a(function(t){var r,n=Object.create(BIs,(r={},tI(r,KL,{value:t,writable:!0}),tI(r,rI,{value:null,writable:!0}),tI(r,WL,{value:null,writable:!0}),tI(r,_G,{value:null,writable:!0}),tI(r,Cve,{value:t._readableState.endEmitted,writable:!0}),tI(r,Jct,{value:a(function(s,o){var c=n[KL].read();c?(n[XL]=null,n[rI]=null,n[WL]=null,s(nI(c,!1))):(n[rI]=s,n[WL]=o)},"value"),writable:!0}),r));return n[XL]=null,OIs(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[WL];s!==null&&(n[XL]=null,n[rI]=null,n[WL]=null,s(i)),n[_G]=i;return}var o=n[rI];o!==null&&(n[XL]=null,n[rI]=null,n[WL]=null,o(nI(void 0,!0))),n[Cve]=!0}),t.on("readable",FIs.bind(null,n)),n},"createReadableStreamAsyncIterator");QIr.exports=UIs});var r2r=x((Kkc,t2r)=>{"use strict";function ZIr(e,t,r,n,i,s,o){try{var c=e[s](o),l=c.value}catch(d){r(d);return}c.done?t(l):Promise.resolve(l).then(n,i)}a(ZIr,"asyncGeneratorStep");function GIs(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function o(l){ZIr(s,n,i,o,c,"next",l)}a(o,"_next");function c(l){ZIr(s,n,i,o,c,"throw",l)}a(c,"_throw"),o(void 0)})}}a(GIs,"_asyncToGenerator");function e2r(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(e2r,"ownKeys");function $Is(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?e2r(Object(r),!0).forEach(function(n){HIs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e2r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a($Is,"_objectSpread");function HIs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(HIs,"_defineProperty");var VIs=ZR().codes.ERR_INVALID_ARG_TYPE;function WIs(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 VIs("iterable",["Iterable"],t);var i=new e($Is({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,o())};function o(){return c.apply(this,arguments)}a(o,"next");function c(){return c=GIs(function*(){try{var l=yield n.next(),d=l.value,f=l.done;f?i.push(null):i.push(yield d)?o():s=!1}catch(p){i.destroy(p)}}),c.apply(this,arguments)}return a(c,"_next2"),i}a(WIs,"from");t2r.exports=WIs});var Kct=x((Qkc,f2r)=>{"use strict";f2r.exports=ef;var yz;ef.ReadableState=i2r;var Jkc=require("events").EventEmitter,n2r=a(function(t,r){return t.listeners(r).length},"EElistenerCount"),hG=zct(),Eve=require("buffer").Buffer,XIs=global.Uint8Array||function(){};function KIs(e){return Eve.from(e)}a(KIs,"_uint8ArrayToBuffer");function JIs(e){return Eve.isBuffer(e)||e instanceof XIs}a(JIs,"_isUint8Array");var Qct=require("util"),fd;Qct&&Qct.debuglog?fd=Qct.debuglog("stream"):fd=a(function(){},"debug");var QIs=IIr(),Yct=Uct(),YIs=Gct(),ZIs=YIs.getHighWaterMark,Ave=ZR().codes,e2s=Ave.ERR_INVALID_ARG_TYPE,t2s=Ave.ERR_STREAM_PUSH_AFTER_EOF,r2s=Ave.ERR_METHOD_NOT_IMPLEMENTED,n2s=Ave.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,vz,Zct,elt;Wg()(ef,hG);var yG=Yct.errorOrDestroy,tlt=["error","close","destroy","pause","resume"];function i2s(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(i2s,"prependListener");function i2r(e,t,r){yz=yz||VL(),e=e||{},typeof r!="boolean"&&(r=t instanceof yz),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=ZIs(this,e,"readableHighWaterMark",r),this.buffer=new QIs,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&&(vz||(vz=require("string_decoder/").StringDecoder),this.decoder=new vz(e.encoding),this.encoding=e.encoding)}a(i2r,"ReadableState");function ef(e){if(yz=yz||VL(),!(this instanceof ef))return new ef(e);var t=this instanceof yz;this._readableState=new i2r(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),hG.call(this)}a(ef,"Readable");Object.defineProperty(ef.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")});ef.prototype.destroy=Yct.destroy;ef.prototype._undestroy=Yct.undestroy;ef.prototype._destroy=function(e,t){t(e)};ef.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=Eve.from(e,t),t=""),n=!0),a2r(this,e,t,!1,n)};ef.prototype.unshift=function(e){return a2r(this,e,null,!0,!1)};function a2r(e,t,r,n,i){fd("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,o2s(e,s);else{var o;if(i||(o=a2s(s,t)),o)yG(e,o);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==Eve.prototype&&(t=KIs(t)),n)s.endEmitted?yG(e,new n2s):rlt(e,s,t,!0);else if(s.ended)yG(e,new t2s);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?rlt(e,s,t,!1):nlt(e,s)):rlt(e,s,t,!1)}else n||(s.reading=!1,nlt(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}a(a2r,"readableAddChunk");function rlt(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&&xve(e)),nlt(e,t)}a(rlt,"addChunk");function a2s(e,t){var r;return!JIs(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new e2s("chunk",["string","Buffer","Uint8Array"],t)),r}a(a2s,"chunkInvalid");ef.prototype.isPaused=function(){return this._readableState.flowing===!1};ef.prototype.setEncoding=function(e){vz||(vz=require("string_decoder/").StringDecoder);var t=new vz(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 s2r=1073741824;function s2s(e){return e>=s2r?e=s2r:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}a(s2s,"computeNewHighWaterMark");function o2r(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=s2s(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}a(o2r,"howMuchToRead");ef.prototype.read=function(e){fd("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 fd("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?alt(this):xve(this),null;if(e=o2r(e,t),e===0&&t.ended)return t.length===0&&alt(this),null;var n=t.needReadable;fd("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,fd("length less than watermark",n)),t.ended||t.reading?(n=!1,fd("reading or ended",n)):n&&(fd("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=o2r(r,t)));var i;return e>0?i=u2r(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&&alt(this)),i!==null&&this.emit("data",i),i};function o2s(e,t){if(fd("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?xve(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,c2r(e)))}}a(o2s,"onEofChunk");function xve(e){var t=e._readableState;fd("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(fd("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(c2r,e))}a(xve,"emitReadable");function c2r(e){var t=e._readableState;fd("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,ilt(e)}a(c2r,"emitReadable_");function nlt(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(c2s,e,t))}a(nlt,"maybeReadMore");function c2s(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(fd("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}a(c2s,"maybeReadMore_");ef.prototype._read=function(e){yG(this,new r2s("_read()"))};ef.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,fd("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?c:E;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",o);function o(A,T){fd("onunpipe"),A===r&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,f())}a(o,"onunpipe");function c(){fd("onend"),e.end()}a(c,"onend");var l=l2s(r);e.on("drain",l);var d=!1;function f(){fd("cleanup"),e.removeListener("close",w),e.removeListener("finish",b),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",c),r.removeListener("end",E),r.removeListener("data",p),d=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}a(f,"cleanup"),r.on("data",p);function p(A){fd("ondata");var T=e.write(A);fd("dest.write",T),T===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&d2r(n.pipes,e)!==-1)&&!d&&(fd("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}a(p,"ondata");function h(A){fd("onerror",A),E(),e.removeListener("error",h),n2r(e,"error")===0&&yG(e,A)}a(h,"onerror"),i2s(e,"error",h);function w(){e.removeListener("finish",b),E()}a(w,"onclose"),e.once("close",w);function b(){fd("onfinish"),e.removeListener("close",w),E()}a(b,"onfinish"),e.once("finish",b);function E(){fd("unpipe"),r.unpipe(e)}return a(E,"unpipe"),e.emit("pipe",r),n.flowing||(fd("pipe resume"),r.resume()),e};function l2s(e){return a(function(){var r=e._readableState;fd("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&n2r(e,"data")&&(r.flowing=!0,ilt(e))},"pipeOnDrainFunctionResult")}a(l2s,"pipeOnDrain");ef.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=d2r(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)};ef.prototype.on=function(e,t){var r=hG.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,fd("on readable",n.length,n.reading),n.length?xve(this):n.reading||process.nextTick(u2s,this)),r};ef.prototype.addListener=ef.prototype.on;ef.prototype.removeListener=function(e,t){var r=hG.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(l2r,this),r};ef.prototype.removeAllListeners=function(e){var t=hG.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(l2r,this),t};function l2r(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(l2r,"updateReadableListening");function u2s(e){fd("readable nexttick read 0"),e.read(0)}a(u2s,"nReadingNextTick");ef.prototype.resume=function(){var e=this._readableState;return e.flowing||(fd("resume"),e.flowing=!e.readableListening,d2s(this,e)),e.paused=!1,this};function d2s(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(f2s,e,t))}a(d2s,"resume");function f2s(e,t){fd("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ilt(e),t.flowing&&!t.reading&&e.read(0)}a(f2s,"resume_");ef.prototype.pause=function(){return fd("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(fd("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ilt(e){var t=e._readableState;for(fd("flow",t.flowing);t.flowing&&e.read()!==null;);}a(ilt,"flow");ef.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(fd("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(fd("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var c=t.push(o);c||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=a(function(c){return a(function(){return e[c].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<tlt.length;s++)e.on(tlt[s],this.emit.bind(this,tlt[s]));return this._read=function(o){fd("wrapped _read",o),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(ef.prototype[Symbol.asyncIterator]=function(){return Zct===void 0&&(Zct=YIr()),Zct(this)});Object.defineProperty(ef.prototype,"readableHighWaterMark",{enumerable:!1,get:a(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(ef.prototype,"readableBuffer",{enumerable:!1,get:a(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(ef.prototype,"readableFlowing",{enumerable:!1,get:a(function(){return this._readableState.flowing},"get"),set:a(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});ef._fromList=u2r;Object.defineProperty(ef.prototype,"readableLength",{enumerable:!1,get:a(function(){return this._readableState.length},"get")});function u2r(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(u2r,"fromList");function alt(e){var t=e._readableState;fd("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(m2s,t,e))}a(alt,"endReadable");function m2s(e,t){if(fd("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(m2s,"endReadableNT");typeof Symbol=="function"&&(ef.from=function(e,t){return elt===void 0&&(elt=r2r()),elt(ef,e,t)});function d2r(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}a(d2r,"indexOf")});var slt=x((Ykc,p2r)=>{"use strict";p2r.exports=Vk;var Pve=ZR().codes,p2s=Pve.ERR_METHOD_NOT_IMPLEMENTED,g2s=Pve.ERR_MULTIPLE_CALLBACK,_2s=Pve.ERR_TRANSFORM_ALREADY_TRANSFORMING,h2s=Pve.ERR_TRANSFORM_WITH_LENGTH_0,kve=VL();Wg()(Vk,kve);function y2s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new g2s);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(y2s,"afterTransform");function Vk(e){if(!(this instanceof Vk))return new Vk(e);kve.call(this,e),this._transformState={afterTransform:y2s.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",v2s)}a(Vk,"Transform");function v2s(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){m2r(e,t,r)}):m2r(this,null,null)}a(v2s,"prefinish");Vk.prototype.push=function(e,t){return this._transformState.needTransform=!1,kve.prototype.push.call(this,e,t)};Vk.prototype._transform=function(e,t,r){r(new p2s("_transform()"))};Vk.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)}};Vk.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};Vk.prototype._destroy=function(e,t){kve.prototype._destroy.call(this,e,function(r){t(r)})};function m2r(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new h2s;if(e._transformState.transforming)throw new _2s;return e.push(null)}a(m2r,"done")});var h2r=x((Zkc,_2r)=>{"use strict";_2r.exports=vG;var g2r=slt();Wg()(vG,g2r);function vG(e){if(!(this instanceof vG))return new vG(e);g2r.call(this,e)}a(vG,"PassThrough");vG.prototype._transform=function(e,t,r){r(null,e)}});var S2r=x((eDc,b2r)=>{"use strict";var olt;function w2s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}a(w2s,"once");var y2r=ZR().codes,b2s=y2r.ERR_MISSING_ARGS,S2s=y2r.ERR_STREAM_DESTROYED;function v2r(e){if(e)throw e}a(v2r,"noop");function C2s(e){return e.setHeader&&typeof e.abort=="function"}a(C2s,"isRequest");function E2s(e,t,r,n){n=w2s(n);var i=!1;e.on("close",function(){i=!0}),olt===void 0&&(olt=bve()),olt(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,C2s(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new S2s("pipe"))}}}a(E2s,"destroyer");function w2r(e){e()}a(w2r,"call");function A2s(e,t){return e.pipe(t)}a(A2s,"pipe");function x2s(e){return!e.length||typeof e[e.length-1]!="function"?v2r:e.pop()}a(x2s,"popCallback");function P2s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=x2s(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new b2s("streams");var i,s=t.map(function(o,c){var l=c<t.length-1,d=c>0;return E2s(o,l,d,function(f){i||(i=f),f&&s.forEach(w2r),!l&&(s.forEach(w2r),n(i))})});return t.reduce(A2s)}a(P2s,"pipeline");b2r.exports=P2s});var vC=x((yC,bG)=>{var wG=require("stream");process.env.READABLE_STREAM==="disable"&&wG?(bG.exports=wG.Readable,Object.assign(bG.exports,wG),bG.exports.Stream=wG):(yC=bG.exports=Kct(),yC.Stream=wG||yC,yC.Readable=yC,yC.Writable=Vct(),yC.Duplex=VL(),yC.Transform=slt(),yC.PassThrough=h2r(),yC.finished=bve(),yC.pipeline=S2r())});var A2r=x((tDc,E2r)=>{E2r.exports=Wk;var k2s=require("util"),C2r=vC();k2s.inherits(Wk,C2r.Duplex);function Wk(e,t,r){var n=this;if(!(n instanceof Wk))return new Wk(e,t,r);C2r.Duplex.call(n,r),n._output=null,n.connect(e,t)}a(Wk,"HttpDuplex");Wk.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)})};Wk.prototype._read=function(e){this._output&&this._output.resume()};Wk.prototype._write=function(e,t,r){this.req.write(e,t),r()};Wk.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};Wk.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var P2r=x((rDc,x2r)=>{var wz=1e3,bz=wz*60,Sz=bz*60,JL=Sz*24,D2s=JL*7,T2s=JL*365.25;x2r.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return R2s(e);if(r==="number"&&isFinite(e))return t.long?N2s(e):I2s(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function R2s(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*T2s;case"weeks":case"week":case"w":return r*D2s;case"days":case"day":case"d":return r*JL;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Sz;case"minutes":case"minute":case"mins":case"min":case"m":return r*bz;case"seconds":case"second":case"secs":case"sec":case"s":return r*wz;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}a(R2s,"parse");function I2s(e){var t=Math.abs(e);return t>=JL?Math.round(e/JL)+"d":t>=Sz?Math.round(e/Sz)+"h":t>=bz?Math.round(e/bz)+"m":t>=wz?Math.round(e/wz)+"s":e+"ms"}a(I2s,"fmtShort");function N2s(e){var t=Math.abs(e);return t>=JL?Dve(e,t,JL,"day"):t>=Sz?Dve(e,t,Sz,"hour"):t>=bz?Dve(e,t,bz,"minute"):t>=wz?Dve(e,t,wz,"second"):e+" ms"}a(N2s,"fmtLong");function Dve(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}a(Dve,"plural")});var clt=x((nDc,k2r)=>{function L2s(e){r.debug=r,r.default=r,r.coerce=d,r.disable=o,r.enable=s,r.enabled=c,r.humanize=P2r(),Object.keys(e).forEach(f=>{r[f]=e[f]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(f){let p=0;for(let h=0;h<f.length;h++)p=(p<<5)-p+f.charCodeAt(h),p|=0;return r.colors[Math.abs(p)%r.colors.length]}a(t,"selectColor"),r.selectColor=t;function r(f){let p;function h(...w){if(!h.enabled)return;let b=h,E=Number(new Date),A=E-(p||E);b.diff=A,b.prev=p,b.curr=E,p=E,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let T=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(B,I)=>{if(B==="%%")return B;T++;let q=r.formatters[I];if(typeof q=="function"){let re=w[T];B=q.call(b,re),w.splice(T,1),T--}return B}),r.formatArgs.call(b,w),(b.log||r.log).apply(b,w)}return a(h,"debug"),h.namespace=f,h.enabled=r.enabled(f),h.useColors=r.useColors(),h.color=t(f),h.destroy=n,h.extend=i,typeof r.init=="function"&&r.init(h),r.instances.push(h),h}a(r,"createDebug");function n(){let f=r.instances.indexOf(this);return f!==-1?(r.instances.splice(f,1),!0):!1}a(n,"destroy");function i(f,p){let h=r(this.namespace+(typeof p=="undefined"?":":p)+f);return h.log=this.log,h}a(i,"extend");function s(f){r.save(f),r.names=[],r.skips=[];let p,h=(typeof f=="string"?f:"").split(/[\s,]+/),w=h.length;for(p=0;p<w;p++)!h[p]||(f=h[p].replace(/\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.substr(1)+"$")):r.names.push(new RegExp("^"+f+"$")));for(p=0;p<r.instances.length;p++){let b=r.instances[p];b.enabled=r.enabled(b.namespace)}}a(s,"enable");function o(){let f=[...r.names.map(l),...r.skips.map(l).map(p=>"-"+p)].join(",");return r.enable(""),f}a(o,"disable");function c(f){if(f[f.length-1]==="*")return!0;let p,h;for(p=0,h=r.skips.length;p<h;p++)if(r.skips[p].test(f))return!1;for(p=0,h=r.names.length;p<h;p++)if(r.names[p].test(f))return!0;return!1}a(c,"enabled");function l(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}a(l,"toNamespace");function d(f){return f instanceof Error?f.stack||f.message:f}return a(d,"coerce"),r.enable(r.load()),r}a(L2s,"setup");k2r.exports=L2s});var D2r=x((wC,Tve)=>{wC.log=M2s;wC.formatArgs=O2s;wC.save=F2s;wC.load=z2s;wC.useColors=q2s;wC.storage=j2s();wC.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 q2s(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}a(q2s,"useColors");function O2s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Tve.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(O2s,"formatArgs");function M2s(...e){return typeof console=="object"&&console.log&&console.log(...e)}a(M2s,"log");function F2s(e){try{e?wC.storage.setItem("debug",e):wC.storage.removeItem("debug")}catch(t){}}a(F2s,"save");function z2s(){let e;try{e=wC.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}a(z2s,"load");function j2s(){try{return localStorage}catch(e){}}a(j2s,"localstorage");Tve.exports=clt()(wC);var{formatters:B2s}=Tve.exports;B2s.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var R2r=x((ev,Rve)=>{var U2s=require("tty"),llt=require("util");ev.init=K2s;ev.log=V2s;ev.formatArgs=$2s;ev.save=W2s;ev.load=X2s;ev.useColors=G2s;ev.colors=[6,2,3,4,5,1];try{let e=W6();e&&(e.stderr||e).level>=2&&(ev.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(e){}ev.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 G2s(){return"colors"in ev.inspectOpts?Boolean(ev.inspectOpts.colors):U2s.isatty(process.stderr.fd)}a(G2s,"useColors");function $2s(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} `;e[0]=s+e[0].split(`
90
+ `),this._state.incoming.expectedPacket="KEXINIT"}a(jc,"SSH2Stream");gTs(jc,eve);jc.prototype.__read=eve.prototype._read;jc.prototype._read=function(e){return this._needContinue&&(this._needContinue=!1,this.emit("continue")),this.__read(e)};jc.prototype.__push=eve.prototype.push;jc.prototype.push=function(e,t){var r=this.__push(e,t);return this._needContinue=r===!1,r};jc.prototype._cleanup=function(e){this.reset(),this.debug("DEBUG: Parser: Malformed packet"),e&&e(new Error("Malformed packet"))};jc.prototype._transform=function(e,t,r,n){var i=!1,s=!1,o=this._state,c=o.incoming,l=o.outgoing,d=c.expect,f=c.decrypt,p=c.decompress,h=e.length,w=0,b=this.debug,E=this,A=0,T=A,R,B,I,q;for(this.bytesReceived+=h;;){if(d.type!==void 0){if(A>=h)break;if(d.type===fz){w=h-A;var re=d.buf.length-d.ptr;re<=w?(e.copy(d.buf,d.ptr,A,A+re),A+=re,B=d.buf,d.buf=void 0,d.ptr=0,d.type=void 0):(e.copy(d.buf,d.ptr,A),d.ptr+=w,A+=w);continue}else if(d.type===wRr){if(A+=c.search.push(e),d.type!==void 0)continue}else if(d.type===bRr){if(++d.ptr+4>255)return this.reset(),b("DEBUG: Parser: Identification string exceeded 255 characters"),r(new Error("Max identification string size exceeded"));if(e[A]===10)d.type=void 0,T<A&&(d.buf===void 0?d.buf=e.toString("ascii",T,A):d.buf+=e.toString("ascii",T,A)),B=d.buf,d.buf=void 0,++A;else{++A===h&&T<A&&(d.buf===void 0?d.buf=e.toString("ascii",T,A):d.buf+=e.toString("ascii",T,A));continue}}}if(c.status===dz){if(!this.readable)return r();if(this.server)if(!B)b("DEBUG: Parser: IN_INIT (waiting for identification begin)"),GL(this,fz,4);else if(B[0]===83&&B[1]===83&&B[2]===72&&B[3]===45)c.status=pct,b("DEBUG: Parser: IN_INIT (waiting for rest of identification)");else return this.reset(),b("DEBUG: Parser: Bad identification start"),r(new Error("Bad identification start"));else{b("DEBUG: Parser: IN_INIT");var K=c.search=new _Ts(kTs);K.on("info",a(function H(ke,se,Y,fe){se&&(c.greeting===void 0?c.greeting=se.toString("binary",Y,fe):c.greeting+=se.toString("binary",Y,fe)),ke&&(d.type=void 0,c.search.removeListener("info",H))},"onInfo")),K.maxMatches=1,GL(this,wRr),c.status=pct}}else if(c.status===pct)b("DEBUG: Parser: IN_GREETING"),c.search=void 0,T=A,GL(this,bRr),c.status=yRr;else if(c.status===yRr){b("DEBUG: Parser: IN_HEADER"),B.charCodeAt(B.length-1)===13&&(B=B.slice(0,-1));var Z=B.indexOf("-"),ie=B.indexOf(" "),V={greeting:c.greeting,identRaw:"SSH-"+B,versions:{protocol:B.substr(0,Z),software:ie===-1?B.substring(Z+1):B.substring(Z+1,ie)},comments:ie>-1?B.substring(ie+1):void 0};if(c.greeting=void 0,V.versions.protocol!=="1.99"&&V.versions.protocol!=="2.0")return this.reset(),b("DEBUG: Parser: protocol version not supported: "+V.versions.protocol),r(new Error("Protocol version not supported"));if(this.emit("header",V),c.status===dz)return;var O=V.identRaw,ne=V.versions.software;this.debug("DEBUG: Remote ident: "+dRr(O));for(var $=0,U;$<CTs;++$)U=hRr[$],typeof U[0]=="string"?ne===U[0]&&(this.remoteBugs|=U[1]):U[0].test(ne)&&(this.remoteBugs|=U[1]);c.identRaw=O,this.bytesReceived-=h-A,Ect(this,function(){A===h?r():E._transform(e.slice(A),t,r)}),c.status=rve;return}else if(c.status===rve)R=f.instance?f.info.blockLen:8,b("DEBUG: Parser: IN_PACKETBEFORE (expecting "+R+")"),GL(this,fz,R,f.buf),c.status=gct;else if(c.status===gct){if(b("DEBUG: Parser: IN_PACKET"),f.instance?(s=f.info.authLen>0,s||(B=PRr(this,B)),R=f.info.blockLen):(s=!1,R=8),q=ad(B,0,this,r),q===!1)return;var D=c.hmac.info,G;D?G=D.actualLen:G=0;var z=q+4+G,L=this.maxPacketSize;if(p.instance&&(L+=(this.maxPacketSize/16384+1)*5+6),q>L||z<16+G||(q+(s?0:4))%R!=0)return this.disconnect(km.PROTOCOL_ERROR),b("DEBUG: Parser: Bad packet length ("+z+")"),r(new Error("Bad packet length"));c.pktLen=q;var N=c.pktLen+4-R;if(s?(f.instance.setAAD(B.slice(0,4)),b("DEBUG: Parser: pktLen:"+c.pktLen+",remainLen:"+N)):(c.padLen=B[4],b("DEBUG: Parser: pktLen:"+c.pktLen+",padLen:"+c.padLen+",remainLen:"+N)),N>0)s?c.pktExtra=B.slice(4):c.pktExtra=B.slice(5),GL(this,fz,N),c.status=_ct;else if(N<0)c.status=rve;else{i=!0,c.status=_ct;continue}}else if(c.status===_ct){b("DEBUG: Parser: IN_PACKETDATA"),f.instance?(s=f.info.authLen>0,i?i=!1:s||(B=PRr(this,B))):(s=!1,i=!1);var W=c.pktLen-c.padLen-1;if(c.pktExtra?(I=Buffer.allocUnsafe(c.pktExtra.length+B.length),c.pktExtra.copy(I),B.copy(I,c.pktExtra.length),c.payload=I.slice(0,W)):(s?I=B.slice(4):I=B.slice(5),c.payload=B.slice(5,5+W)),c.hmac.info!==void 0){var F=f.info.authLen||c.hmac.info.actualLen;b("DEBUG: Parser: HMAC size:"+F),GL(this,fz,F,c.hmac.buf),c.status=vRr,c.packet=I}else c.status=hct;c.pktExtra=void 0,I=void 0}else if(c.status===vRr)if(b("DEBUG: Parser: IN_PACKETDATAVERIFY"),GTs(this,B))b("DEBUG: Parser: IN_PACKETDATAVERIFY (Valid HMAC)"),c.status=hct,c.packet=void 0;else return this.reset(),b("DEBUG: Parser: IN_PACKETDATAVERIFY (Invalid HMAC)"),r(new Error("Invalid HMAC"));else if(c.status===hct){if(p.instance)if(n)n=!1;else{b("DEBUG: Parser: Decompressing"),p.instance.write(c.payload);var Q=[],ee=0;p.instance.on("readable",function(){for(var H;H=this.read();)Q.push(H),ee+=H.length}).flush(wct,function(){p.instance.removeAllListeners("readable"),Q.length===1?c.payload=Q[0]:c.payload=Buffer.concat(Q,ee),Q=null;var H;A===h?H=bct:H=e.slice(A),E._transform(H,t,r,!0)});return}this.emit("packet");var X=c.payload[0];if(b!==SRr){var ae="DEBUG: Parser: IN_PACKETDATAAFTER, packet: ",ye=o.authsQueue[0],ue=null;if(l.status===XR&&!(X<=4||X>=20&&X<=49)&&(ae+="(enqueued) "),X===Ja.KEXDH_INIT)switch(o.kex.type){case"group":ue="KEXDH_INIT";break;case"groupex":ue="KEXDH_GEX_REQUEST";break;default:ue="KEXECDH_INIT"}else if(X===Ja.KEXDH_REPLY)switch(o.kex.type){case"group":ue="KEXDH_REPLY";break;case"groupex":ue="KEXDH_GEX_GROUP";break;default:ue="KEXECDH_REPLY"}else X===Ja.KEXDH_GEX_GROUP?ue="KEXDH_GEX_GROUP":X===Ja.KEXDH_GEX_REPLY?ue="KEXDH_GEX_REPLY":X===60?ye==="password"?ue="USERAUTH_PASSWD_CHANGEREQ":ye==="keyboard-interactive"?ue="USERAUTH_INFO_REQUEST":ye==="publickey"?ue="USERAUTH_PK_OK":ue="UNKNOWN PACKET 60":X===61&&(ye==="keyboard-interactive"?ue="USERAUTH_INFO_RESPONSE":ue="UNKNOWN PACKET 61");ue===null&&(ue=Ja[X]),X!==Ja.CHANNEL_OPEN&&X!==Ja.CHANNEL_REQUEST&&X!==Ja.CHANNEL_SUCCESS&&X!==Ja.CHANNEL_FAILURE&&X!==Ja.CHANNEL_EOF&&X!==Ja.CHANNEL_CLOSE&&X!==Ja.CHANNEL_DATA&&X!==Ja.CHANNEL_EXTENDED_DATA&&X!==Ja.CHANNEL_WINDOW_ADJUST&&X!==Ja.DISCONNECT&&X!==Ja.USERAUTH_REQUEST&&X!==Ja.GLOBAL_REQUEST&&b(ae+ue)}if(l.status===WR||X<=4||X>=20&&X<=49){if(ARr(this,r)===!1||c.status===dz)return}else if(l.status===XR){if(c.rekeyQueue.length===xTs)return b("DEBUG: Parser: Max incoming re-key queue length reached"),this.disconnect(km.PROTOCOL_ERROR),r(new Error("Incoming re-key queue length limit reached"));var de=c.seqno;++c.seqno>vct&&(c.seqno=0),c.rekeyQueue.push([de,c.payload])}c.status=rve,c.payload=void 0}B!==void 0&&(B=void 0)}r()};jc.prototype.reset=function(e){if(this._state){var t=this._state;t.incoming.status=dz,t.outgoing.status=yct}else this._state={authsQueue:[],hostkeyFormat:void 0,kex:void 0,incoming:{status:dz,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:yct,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)};jc.prototype.disconnect=function(e){var t=Buffer.alloc(1+4+4+4);return t[0]=Ja.DISCONNECT,km[e]===void 0&&(e=km.BY_APPLICATION),ii(t,e,1),this.debug("DEBUG: Outgoing: Writing DISCONNECT ("+km[e]+")"),Ac(this,t),this.reset(),!1};jc.prototype.ping=function(){return this.debug("DEBUG: Outgoing: Writing ping (GLOBAL_REQUEST: keepalive@openssh.com)"),Ac(this,DTs)};jc.prototype.rekey=function(){var e=this._state.outgoing.status;if(e===XR)throw new Error("A re-key is already in progress");if(e!==WR)throw new Error("Cannot re-key yet");return this.debug("DEBUG: Outgoing: Starting re-key"),Ect(this)};jc.prototype.requestSuccess=function(e){var t;return Buffer.isBuffer(e)?(t=Buffer.allocUnsafe(1+e.length),t[0]=Ja.REQUEST_SUCCESS,e.copy(t,1)):t=RTs,this.debug("DEBUG: Outgoing: Writing REQUEST_SUCCESS"),Ac(this,t)};jc.prototype.requestFailure=function(){return this.debug("DEBUG: Outgoing: Writing REQUEST_FAILURE"),Ac(this,ITs)};jc.prototype.channelSuccess=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_SUCCESS,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_SUCCESS ("+e+")"),Ac(this,t)};jc.prototype.channelFailure=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_FAILURE,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_FAILURE ("+e+")"),Ac(this,t)};jc.prototype.channelEOF=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_EOF,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_EOF ("+e+")"),Ac(this,t)};jc.prototype.channelClose=function(e){var t=Buffer.allocUnsafe(1+4);return t[0]=Ja.CHANNEL_CLOSE,ii(t,e,1),this.debug("DEBUG: Outgoing: Writing CHANNEL_CLOSE ("+e+")"),Ac(this,t)};jc.prototype.channelWindowAdjust=function(e,t){var r=Buffer.allocUnsafe(1+4+4);return r[0]=Ja.CHANNEL_WINDOW_ADJUST,ii(r,e,1),ii(r,t,5),this.debug("DEBUG: Outgoing: Writing CHANNEL_WINDOW_ADJUST ("+e+", "+t+")"),Ac(this,r)};jc.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]=Ja.CHANNEL_DATA,ii(i,e,1),ii(i,n,5),r?t.copy(i,9):i.write(t,9,n,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_DATA ("+e+")"),Ac(this,i)};jc.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]=Ja.CHANNEL_EXTENDED_DATA,ii(s,e,1),ii(s,r,5),ii(s,i,9),n?t.copy(s,13):s.write(t,13,i,"utf8"),this.debug("DEBUG: Outgoing: Writing CHANNEL_EXTENDED_DATA ("+e+")"),Ac(this,s)};jc.prototype.channelOpenConfirm=function(e,t,r,n){var i=Buffer.allocUnsafe(1+4+4+4+4);return i[0]=Ja.CHANNEL_OPEN_CONFIRMATION,ii(i,e,1),ii(i,t,5),ii(i,r,9),ii(i,n,13),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_CONFIRMATION (r:"+e+", l:"+t+")"),Ac(this,i)};jc.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,c=Buffer.allocUnsafe(1+4+4+4+i+4+s);return c[0]=Ja.CHANNEL_OPEN_FAILURE,ii(c,e,1),ii(c,t,5),ii(c,i,o),o+=4,i&&(c.write(r,o,i,"utf8"),o+=i),ii(c,s,o),s&&c.write(n,o+=4,s,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN_FAILURE ("+e+")"),Ac(this,c)};jc.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]=Ja.SERVICE_REQUEST,ii(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_REQUEST ("+e+")"),Ac(this,r)};jc.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]=Ja.GLOBAL_REQUEST,ii(i,13,1),i.write("tcpip-forward",5,13,"ascii"),i[18]=r===void 0||r===!0?1:0,ii(i,n,19),i.write(e,23,n,"ascii"),ii(i,t,23+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (tcpip-forward)"),Ac(this,i)};jc.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]=Ja.GLOBAL_REQUEST,ii(i,20,1),i.write("cancel-tcpip-forward",5,20,"ascii"),i[25]=r===void 0||r===!0?1:0,ii(i,n,26),i.write(e,30,n,"ascii"),ii(i,t,30+n),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-tcpip-forward)"),Ac(this,i)};jc.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]=Ja.GLOBAL_REQUEST,ii(n,31,1),n.write("streamlocal-forward@openssh.com",5,31,"ascii"),n[36]=t===void 0||t===!0?1:0,ii(n,r,37),n.write(e,41,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (streamlocal-forward@openssh.com)"),Ac(this,n)};jc.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]=Ja.GLOBAL_REQUEST,ii(n,38,1),n.write("cancel-streamlocal-forward@openssh.com",5,38,"ascii"),n[43]=t===void 0||t===!0?1:0,ii(n,r,44),n.write(e,48,r,"utf8"),this.debug("DEBUG: Outgoing: Writing GLOBAL_REQUEST (cancel-streamlocal-forward@openssh.com)"),Ac(this,n)};jc.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,c=Buffer.allocUnsafe(1+4+12+4+4+4+4+i+4+4+s+4);return c[0]=Ja.CHANNEL_OPEN,ii(c,12,1),c.write("direct-tcpip",5,12,"ascii"),ii(c,e,17),ii(c,t,21),ii(c,r,25),ii(c,s,o),c.write(n.dstIP,o+=4,s,"ascii"),ii(c,n.dstPort,o+=s),ii(c,i,o+=4),c.write(n.srcIP,o+=4,i,"ascii"),ii(c,n.srcPort,o+=i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", direct-tcpip)"),Ac(this,c)};jc.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]=Ja.CHANNEL_OPEN,ii(o,30,1),o.write("direct-streamlocal@openssh.com",5,30,"ascii"),ii(o,e,35),ii(o,t,39),ii(o,r,43),ii(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)"),Ac(this,o)};jc.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]=Ja.GLOBAL_REQUEST,ii(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)"),Ac(this,t)};jc.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]=Ja.CHANNEL_OPEN,ii(n,7,1),n.write("session",5,7,"ascii"),ii(n,e,12),ii(n,t,16),ii(n,r,20),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", session)"),Ac(this,n)};jc.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]=Ja.CHANNEL_REQUEST,ii(s,e,1),ii(s,13,5),s.write("window-change",9,13,"ascii"),s[22]=0,ii(s,r,23),ii(s,t,27),ii(s,i,31),ii(s,n,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", window-change)"),Ac(this,s)};jc.prototype.pty=function(e,t,r,n,i,s,o,c){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=HTs(o)),(!o||!o.length)&&(o=NTs);var l=s.length,d=o.length,f=21,p=Buffer.allocUnsafe(1+4+4+7+1+4+l+4+4+4+4+4+d);if(p[0]=Ja.CHANNEL_REQUEST,ii(p,e,1),ii(p,7,5),p.write("pty-req",9,7,"ascii"),p[16]=c===void 0||c===!0?1:0,ii(p,l,17),p.write(s,21,l,"utf8"),ii(p,r,f+=l),ii(p,t,f+=4),ii(p,i,f+=4),ii(p,n,f+=4),ii(p,d,f+=4),f+=4,Array.isArray(o))for(var h=0;h<d;++h)p[f++]=o[h];else Buffer.isBuffer(o)&&o.copy(p,f);return this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", pty-req)"),Ac(this,p)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(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)"),Ac(this,r)};jc.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]=Ja.CHANNEL_REQUEST,ii(i,e,1),ii(i,4,5),i.write("exec",9,4,"ascii"),i[13]=r===void 0||r===!0?1:0,ii(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)"),Ac(this,i)};jc.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)),bTs.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]=Ja.CHANNEL_REQUEST,ii(n,e,1),ii(n,6,5),n.write("signal",9,6,"ascii"),n[15]=0,ii(n,r,16),n.write(t,20,r,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", signal)"),Ac(this,n)};jc.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]=Ja.CHANNEL_REQUEST,ii(o,e,1),ii(o,3,5),o.write("env",9,3,"ascii"),o[12]=n===void 0||n===!0?1:0,ii(o,i,13),o.write(t,17,i,"ascii"),ii(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)"),Ac(this,o)};jc.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]=Ja.CHANNEL_REQUEST,ii(s,e,1),ii(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,ii(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,ii(s,i,o),o+=4,Buffer.isBuffer(t.cookie)?t.cookie.copy(s,o):s.write(t.cookie,o,i,"binary"),o+=i,ii(s,t.screen||0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", x11-req)"),Ac(this,s)};jc.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]=Ja.CHANNEL_REQUEST,ii(i,e,1),ii(i,9,5),i.write("subsystem",9,9,"ascii"),i[18]=r===void 0||r===!0?1:0,ii(i,n,19),i.write(t,23,n,"ascii"),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", subsystem: "+t+")"),Ac(this,i)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(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)"),Ac(this,r)};jc.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]=Ja.USERAUTH_REQUEST,ii(s,r,++i),s.write(e,i+=4,r,"utf8"),ii(s,14,i+=r),s.write("ssh-connection",i+=4,14,"ascii"),ii(s,8,i+=14),s.write("password",i+=4,8,"ascii"),s[i+=8]=0,ii(s,n,++i),s.write(t,i+=4,n,"utf8"),this._state.authsQueue.push("password"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (password)"),Ac(this,s)};jc.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+mct(t,0));var o=Buffer.byteLength(e),c=Buffer.byteLength(s),l=t.length,d=i.sessionId.length,f=0,p=Buffer.allocUnsafe((r?4+d:0)+1+4+o+4+14+4+9+1+4+c+4+l);return r?(ii(p,d,f),i.sessionId.copy(p,f+=4),p[f+=d]=Ja.USERAUTH_REQUEST):p[f]=Ja.USERAUTH_REQUEST,ii(p,o,++f),p.write(e,f+=4,o,"utf8"),ii(p,14,f+=o),p.write("ssh-connection",f+=4,14,"ascii"),ii(p,9,f+=14),p.write("publickey",f+=4,9,"ascii"),p[f+=9]=r?1:0,ii(p,c,++f),p.write(s,f+=4,c,"ascii"),ii(p,l,f+=c),t.copy(p,f+=4),r?(r(p,function(h){if(h=Act(h,s),h===!1)throw new Error("Error while converting handshake signature");var w=h.length,b=Buffer.allocUnsafe(1+4+o+4+14+4+9+1+4+c+4+l+4+4+c+4+w);return f=0,b[f]=Ja.USERAUTH_REQUEST,ii(b,o,++f),b.write(e,f+=4,o,"utf8"),ii(b,14,f+=o),b.write("ssh-connection",f+=4,14,"ascii"),ii(b,9,f+=14),b.write("publickey",f+=4,9,"ascii"),b[f+=9]=1,ii(b,c,++f),b.write(s,f+=4,c,"ascii"),ii(b,l,f+=c),t.copy(b,f+=4),ii(b,4+c+4+w,f+=l),ii(b,c,f+=4),b.write(s,f+=4,c,"ascii"),ii(b,w,f+=c),h.copy(b,f+=4),n._state.authsQueue.push("publickey"),n.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey)"),Ac(n,b)}),!0):(this._state.authsQueue.push("publickey"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (publickey -- check)"),Ac(this,p))};jc.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,c;typeof t.getPublicSSH=="function"?(c=t.type,t=t.getPublicSSH()):c=t.toString("ascii",4,4+mct(t,0));var l=Buffer.byteLength(e),d=Buffer.byteLength(c),f=t.length,p=o.sessionId.length,h=Buffer.byteLength(r),w=Buffer.byteLength(n),b=0,E=Buffer.allocUnsafe(4+p+1+4+l+4+14+4+9+4+d+4+f+4+h+4+w);return ii(E,p,b),o.sessionId.copy(E,b+=4),E[b+=p]=Ja.USERAUTH_REQUEST,ii(E,l,++b),E.write(e,b+=4,l,"utf8"),ii(E,14,b+=l),E.write("ssh-connection",b+=4,14,"ascii"),ii(E,9,b+=14),E.write("hostbased",b+=4,9,"ascii"),ii(E,d,b+=9),E.write(c,b+=4,d,"ascii"),ii(E,f,b+=d),t.copy(E,b+=4),ii(E,h,b+=f),E.write(r,b+=4,h,"ascii"),ii(E,w,b+=h),E.write(n,b+=4,w,"utf8"),i(E,function(A){if(A=Act(A,c),A===!1)throw new Error("Error while converting handshake signature");var T=A.length,R=Buffer.allocUnsafe(E.length-p+T);return E.copy(R,0,4+p),ii(R,T,R.length-T-4),A.copy(R,R.length-T),s._state.authsQueue.push("hostbased"),s.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (hostbased)"),Ac(s,R)}),!0};jc.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]=Ja.USERAUTH_REQUEST,ii(n,t,++r),n.write(e,r+=4,t,"utf8"),ii(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),ii(n,20,r+=14),n.write("keyboard-interactive",r+=4,20,"ascii"),ii(n,0,r+=20),ii(n,0,r+=4),this._state.authsQueue.push("keyboard-interactive"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (keyboard-interactive)"),Ac(this,n)};jc.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]=Ja.USERAUTH_REQUEST,ii(n,t,++r),n.write(e,r+=4,t,"utf8"),ii(n,14,r+=t),n.write("ssh-connection",r+=4,14,"ascii"),ii(n,4,r+=14),n.write("none",r+=4,4,"ascii"),this._state.authsQueue.push("none"),this.debug("DEBUG: Outgoing: Writing USERAUTH_REQUEST (none)"),Ac(this,n)};jc.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++]=Ja.USERAUTH_INFO_RESPONSE,ii(o,e?e.length:0,r),e)for(r+=4,s=0,i=e.length;s<i;++s)n=Buffer.byteLength(e[s]),ii(o,n,r),r+=4,n&&(o.write(e[s],r,n,"utf8"),r+=n);return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_RESPONSE"),Ac(this,o)};jc.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]=Ja.SERVICE_ACCEPT,ii(r,t,1),r.write(e,5,t,"ascii"),this.debug("DEBUG: Outgoing: Writing SERVICE_ACCEPT ("+e+")"),Ac(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]=Ja.USERAUTH_BANNER,ii(s,n,1),s.write(this.banner,5,n,"utf8"),s.fill(0,i-4),this.debug("DEBUG: Outgoing: Writing USERAUTH_BANNER"),Ac(this,s),this.banner=void 0}};jc.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,c=Buffer.allocUnsafe(1+4+15+4+4+4+4+i+4+4+s+4);return c[0]=Ja.CHANNEL_OPEN,ii(c,15,1),c.write("forwarded-tcpip",5,15,"ascii"),ii(c,e,20),ii(c,t,24),ii(c,r,28),ii(c,i,32),c.write(n.boundAddr,36,i,"ascii"),ii(c,n.boundPort,o),ii(c,s,o+=4),c.write(n.remoteAddr,o+=4,s,"ascii"),ii(c,n.remotePort,o+=s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-tcpip)"),Ac(this,c)};jc.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]=Ja.CHANNEL_OPEN,ii(o,3,1),o.write("x11",5,3,"ascii"),ii(o,e,8),ii(o,t,12),ii(o,r,16),ii(o,i,20),o.write(n.originAddr,24,i,"ascii"),ii(o,n.originPort,s),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", x11)"),Ac(this,o)};jc.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]=Ja.CHANNEL_OPEN,ii(n,22,1),n.write("auth-agent@openssh.com",5,22,"ascii"),ii(n,e,27),ii(n,t,31),ii(n,r,35),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", auth-agent@openssh.com)"),Ac(this,n)};jc.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]=Ja.CHANNEL_OPEN,ii(s,33,1),s.write("forwarded-streamlocal@openssh.com",5,33,"ascii"),ii(s,e,38),ii(s,t,42),ii(s,r,46),ii(s,i,50),s.write(n.socketPath,54,i,"utf8"),ii(s,0,54+i),this.debug("DEBUG: Outgoing: Writing CHANNEL_OPEN ("+e+", forwarded-streamlocal@openssh.com)"),Ac(this,s)};jc.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]=Ja.CHANNEL_REQUEST,ii(r,e,1),ii(r,11,5),r.write("exit-status",9,11,"ascii"),r[20]=0,ii(r,t,21),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-status)"),Ac(this,r)};jc.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,c=Buffer.allocUnsafe(1+4+4+11+1+4+i+1+4+s+4);return c[0]=Ja.CHANNEL_REQUEST,ii(c,e,1),ii(c,11,5),c.write("exit-signal",9,11,"ascii"),c[20]=0,ii(c,i,21),c.write(t,25,i,"utf8"),c[o++]=r?1:0,ii(c,s,o),o+=4,s&&(c.write(n,o,s,"utf8"),o+=s),ii(c,0,o),this.debug("DEBUG: Outgoing: Writing CHANNEL_REQUEST ("+e+", exit-signal)"),Ac(this,c)};jc.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,c=Buffer.allocUnsafe(1+4+o+1);return c[0]=Ja.USERAUTH_FAILURE,ii(c,o,1),c.write(n,5,o,"ascii"),c[5+o]=t===!0?1:0,this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_FAILURE"),Ac(this,c)};jc.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=Ac(this,TTs);return r.compress.type==="zlib@openssh.com"&&(r.compress.instance=UL.createDeflate(mz),r.compress.queue=[]),n.decompress.type==="zlib@openssh.com"&&(n.decompress.instance=UL.createInflate(mz)),i};jc.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]=Ja.USERAUTH_PK_OK,ii(s,n,1),s.write(e,5,n,"ascii"),ii(s,i,5+n),t.copy(s,5+n+4),this._state.authsQueue.shift(),this.debug("DEBUG: Outgoing: Writing USERAUTH_PK_OK"),Ac(this,s)};jc.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]=Ja.USERAUTH_PASSWD_CHANGEREQ,ii(s,r,++i),s.write(e,i+=4,r,"utf8"),ii(s,n,i+=r),n&&s.write(t,i+=4,n,"ascii"),this.debug("DEBUG: Outgoing: Writing USERAUTH_PASSWD_CHANGEREQ"),Ac(this,s)};jc.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,c,l,d,f;for(f=0,d=r.length;f<d;++f)n+=4+Buffer.byteLength(r[f].prompt)+1;var p=Buffer.allocUnsafe(1+4+i+4+s+4+4+n);for(p[o++]=Ja.USERAUTH_INFO_REQUEST,ii(p,i,o),o+=4,e&&(p.write(e,o,i,"utf8"),o+=i),ii(p,s,o),o+=4,t&&(p.write(t,o,s,"utf8"),o+=s),ii(p,0,o),o+=4,ii(p,r.length,o),o+=4,f=0,d=r.length;f<d;++f)l=r[f],c=Buffer.byteLength(l.prompt),ii(p,c,o),o+=4,c&&(p.write(l.prompt,o,c,"utf8"),o+=c),p[o++]=l.echo?1:0;return this.debug("DEBUG: Outgoing: Writing USERAUTH_INFO_REQUEST"),Ac(this,p)};function LTs(e,t,r,n,i){if(r!==km.BY_APPLICATION){var s=new Error(n||t);s.code=r,e.emit("error",s)}e.reset()}a(LTs,"onDISCONNECT");function qTs(e,t,r){var n=e._state,i=n.outgoing;i.status===WR?(e.debug("DEBUG: Received re-key request"),i.status=XR,i.kexinit=void 0,Ect(e,s)):s();function s(){OTs(e,t,r)===!0&&(e.server?n.incoming.expectedPacket=n.kex.pktInit:n.kex.type==="groupex"?WTs(e):kRr(e))}a(s,"check")}a(qTs,"onKEXINIT");function OTs(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,c,l,d,f,p;o("DEBUG: Comparing KEXINITs ...");var h=e.config.algorithms,w=h.kex;if(e.remoteBugs&tve.BAD_DHGEX)for(var b=!1,E=w.length-1;E>=0;--E)w[E].indexOf("group-exchange")!==-1&&(b||(w=w.slice(),b=!0),w.splice(E,1));for(o("DEBUG: (local) KEX algorithms: "+w),o("DEBUG: (remote) KEX algorithms: "+t.algorithms.kex),e.server?(c=w,l=t.algorithms.kex):(c=t.algorithms.kex,l=w),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}var T=l[p];for(o("DEBUG: KEX algorithm: "+T),r&&(!t.algorithms.kex.length||T!==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?(c=h.serverHostKey,l=t.algorithms.srvHostKey):(c=t.algorithms.srvHostKey,l=h.serverHostKey),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(n.hostkeyFormat=l[p],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?(c=h.cipher,l=t.algorithms.cs.encrypt):(c=t.algorithms.cs.encrypt,l=h.cipher),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decrypt.type=l[p]:d=s.encrypt.type=l[p],o("DEBUG: Client->Server Cipher: "+d),o("DEBUG: (local) Server->Client ciphers: "+h.cipher),o("DEBUG: (remote) Server->Client ciphers: "+t.algorithms.sc.encrypt),e.server?(c=h.cipher,l=t.algorithms.sc.encrypt):(c=t.algorithms.sc.encrypt,l=h.cipher),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.encrypt.type=l[p]:d=i.decrypt.type=l[p],o("DEBUG: Server->Client Cipher: "+d),o("DEBUG: (local) Client->Server HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Client->Server HMAC algorithms: "+t.algorithms.cs.mac),e.server?(c=h.hmac,l=t.algorithms.cs.mac):(c=t.algorithms.cs.mac,l=h.hmac),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.hmac.type=l[p]:d=s.hmac.type=l[p],o("DEBUG: Client->Server HMAC algorithm: "+d),o("DEBUG: (local) Server->Client HMAC algorithms: "+h.hmac),o("DEBUG: (remote) Server->Client HMAC algorithms: "+t.algorithms.sc.mac),e.server?(c=h.hmac,l=t.algorithms.sc.mac):(c=t.algorithms.sc.mac,l=h.hmac),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=s.hmac.type=l[p]:d=i.hmac.type=l[p],o("DEBUG: Server->Client HMAC algorithm: "+d),o("DEBUG: (local) Client->Server compression algorithms: "+h.compress),o("DEBUG: (remote) Client->Server compression algorithms: "+t.algorithms.cs.compress),e.server?(c=h.compress,l=t.algorithms.cs.compress):(c=t.algorithms.cs.compress,l=h.compress),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}for(e.server?d=i.decompress.type=l[p]:d=s.compress.type=l[p],o("DEBUG: Client->Server compression algorithm: "+d),o("DEBUG: (local) Server->Client compression algorithms: "+h.compress),o("DEBUG: (remote) Server->Client compression algorithms: "+t.algorithms.sc.compress),e.server?(c=h.compress,l=t.algorithms.sc.compress):(c=t.algorithms.sc.compress,l=h.compress),p=0,f=l.length;p<f&&c.indexOf(l[p])===-1;++p);if(p===f){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(km.KEY_EXCHANGE_FAILED),!1}return e.server?d=s.compress.type=l[p]:d=i.decompress.type=l[p],o("DEBUG: Server->Client compression algorithm: "+d),n.kex=new $L(T),n.kex.generateKeys(),s.pubkey=n.kex.getPublicKey(),!0}a(OTs,"check_KEXINIT");function MTs(e,t,r){var n=e._state,i=n.outgoing;n.kex.setDHParams(t,r),n.kex.generateKeys(),i.pubkey=n.kex.getPublicKey(),kRr(e)}a(MTs,"onKEXDH_GEX_GROUP");function FTs(e,t){VTs(e,t)}a(FTs,"onKEXDH_INIT");function CRr(e,t,r){var n=e._state,i=n.incoming,s=n.outgoing,o=e.debug,c,l;if(r===void 0){i.expectedPacket="NEWKEYS",s.sentNEWKEYS=!1,o("DEBUG: Checking host key format");var d=wc(t.hostkey,0,"ascii",e);if(d===!1)return!1;if(t.hostkey_format!==n.hostkeyFormat||t.hostkey_format!==d){o("DEBUG: Host key format mismatch"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: host key format mismatch");return f.level="handshake",e.emit("error",f),!1}o("DEBUG: Checking signature format");var p=wc(t.sig,0,"ascii",e);if(p===!1)return!1;if(t.sig_format!==p){o("DEBUG: Signature format mismatch"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: signature format mismatch");return f.level="handshake",e.emit("error",f),!1}}if(s.status===yct){if(r===void 0){o("DEBUG: Verifying host fingerprint");var h=!0,w=e.emit("fingerprint",t.hostkey,function(z){r===void 0&&(r=!!z,h||CRr(e,t,r))});if(h=!1,w&&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(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: host fingerprint verification failed");return f.level="handshake",e.emit("error",f),!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(km.KEY_EXCHANGE_FAILED),!1;var b=Xd.createHash(n.kex.hash),E=Buffer.byteLength(e.config.ident),A=Buffer.byteLength(i.identRaw),T=s.kexinit.length,R=i.kexinit.length,B=t.hostkey.length,I=s.pubkey.length,q=t.pubkey.length,re=t.secret.length,K=E+A+T+R+B+I+q+re+4*8,Z,ie,V,O,ne=n.kex.getDHParams();ne&&(V=ne.prime,O=ne.generator,Z=V.length,ie=O.length,K+=4*3,K+=4*2,K+=Z,K+=ie);var $=0,U=Buffer.allocUnsafe(K);ii(U,E,$),$+=4,U.write(e.config.ident,$,"utf8"),$+=E,ii(U,A,$),$+=4,U.write(i.identRaw,$,"utf8"),$+=A,ii(U,T,$),$+=4,s.kexinit.copy(U,$),$+=T,s.kexinit=void 0,ii(U,R,$),$+=4,i.kexinit.copy(U,$),$+=R,i.kexinit=void 0,ii(U,B,$),$+=4,t.hostkey.copy(U,$),$+=B,ne&&(Cct.slice(1).copy(U,$),$+=4*3,ii(U,Z,$),$+=4,V.copy(U,$),$+=Z,ii(U,ie,$),$+=4,O.copy(U,$),$+=ie),ii(U,I,$),$+=4,s.pubkey.copy(U,$),$+=I,ii(U,q,$),$+=4,t.pubkey.copy(U,$),$+=q,ii(U,re,$),$+=4,t.secret.copy(U,$),s.exchangeHash=b.update(U).digest();var D=wc(t.sig,t.sig._pos,e);if(D===!1||!(D=pRr(D,t.sig_format,e)))return!1;var G=vTs(t.hostkey,t.sig_format);if(G instanceof Error)return!1;if(o("DEBUG: Verifying signature"),G.verify(s.exchangeHash,D)!==!0){o("DEBUG: Signature verification failed"),e.disconnect(km.KEY_EXCHANGE_FAILED),e.reset();var f=new Error("Handshake failed: signature verification failed");return f.level="handshake",e.emit("error",f),!1}s.sessionId===void 0&&(s.sessionId=s.exchangeHash),s.kexsecret=t.secret,o("DEBUG: Outgoing: Writing NEWKEYS"),s.status===XR?Ac(e,Sct,void 0,!0):Ac(e,Sct),s.sentNEWKEYS=!0,r!==void 0&&i.expectedPacket===void 0&&ERr(e)}a(CRr,"onKEXDH_REPLY");function ERr(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=gRr[r.encrypt.type],o=0,c=t.kex.hash,l=Buffer.allocUnsafe(4+i),d,f;if(t.authsQueue=[],ii(l,i,o),o+=4,r.kexsecret.copy(l,o),r.kexsecret=void 0,s.stream)d=bct;else{for(d=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"B":"A","ascii").update(r.sessionId).digest();d.length<s.ivLen;)d=Buffer.concat([d,Xd.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>s.ivLen&&(d=d.slice(0,s.ivLen))}for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"D":"C","ascii").update(r.sessionId).digest();f.length<s.keyLen;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);if(f.length>s.keyLen&&(f=f.slice(0,s.keyLen)),s.authLen>0)r.encrypt.iv=d,r.encrypt.key=f,r.encrypt.instance=!0;else{var p=lz[r.encrypt.type];r.encrypt.instance=Xd.createCipheriv(p,f,d),r.encrypt.instance.setAutoPadding(!1)}var h=n.decrypt.info=gRr[n.decrypt.type];if(h.stream)d=bct;else{for(d=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"A":"B","ascii").update(r.sessionId).digest();d.length<h.ivLen;)d=Buffer.concat([d,Xd.createHash(c).update(l).update(r.exchangeHash).update(d).digest()]);d.length>h.ivLen&&(d=d.slice(0,h.ivLen))}for(n.decrypt.buf=Buffer.allocUnsafe(h.blockLen),f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"C":"D","ascii").update(r.sessionId).digest();f.length<h.keyLen;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>h.keyLen&&(f=f.slice(0,h.keyLen));var w=lz[n.decrypt.type];n.decrypt.instance=Xd.createDecipheriv(w,f,d),n.decrypt.instance.setAutoPadding(!1),n.decrypt.iv=d,n.decrypt.key=f;var b;s.discardLen>0&&(b=Buffer.alloc(s.discardLen),r.encrypt.instance.update(b)),h.discardLen>0&&((!b||b.length!==h.discardLen)&&(b=Buffer.alloc(s.discardLen)),n.decrypt.instance.update(b));var E=r.hmac.info=_Rr[r.hmac.type],A=n.hmac.info=_Rr[n.hmac.type];if(s.authLen===0){for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"F":"E","ascii").update(r.sessionId).digest();f.length<E.len;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>E.len&&(f=f.slice(0,E.len)),r.hmac.key=f}else r.hmac.key=void 0;if(h.authLen===0){for(f=Xd.createHash(c).update(l).update(r.exchangeHash).update(e.server?"E":"F","ascii").update(r.sessionId).digest();f.length<A.len;)f=Buffer.concat([f,Xd.createHash(c).update(l).update(r.exchangeHash).update(f).digest()]);f.length>A.len&&(f=f.slice(0,A.len)),n.hmac.key=f}else n.hmac.key=void 0;var T=h.authLen||n.hmac.info.actualLen;if((!n.hmac.buf||n.hmac.buf.length!==T)&&(n.hmac.buf=Buffer.allocUnsafe(T)),r.exchangeHash=void 0,r.compress.type==="zlib"?(r.compress.instance=UL.createDeflate(mz),r.compress.queue=[]):r.compress.type==="none"&&(r.compress.instance=!1,r.compress.queue=null),n.decompress.type==="zlib"?n.decompress.instance=UL.createInflate(mz):n.decompress.type==="none"&&(n.decompress.instance=!1),e.bytesSent=e.bytesReceived=0,r.status===XR){r.status=WR;var R=r.rekeyQueue,B=R.length,I=0;for(r.rekeyQueue=[];I<B;++I)Buffer.isBuffer(R[I])?Ac(e,R[I]):Ac(e,R[I][0],R[I][1]);R=n.rekeyQueue,B=R.length,I=0,n.rekeyQueue=[];for(var q=n.seqno;I<B;++I)if(n.seqno=R[I][0],n.payload=R[I][1],ARr(e)===!1||n.status===dz)return;n.seqno=q}else r.status=WR,n.status===gct&&(e.debug("DEBUG: Parser: IN_PACKETBEFORE (update) (expecting "+h.blockLen+")"),GL(e,fz,h.blockLen,n.decrypt.buf)),e.emit("ready")}}a(ERr,"onNEWKEYS");function ive(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 Ja[t]}a(ive,"getPacketType");function ARr(e,t){var r=e._state.incoming,n=e._state.outgoing,i=r.payload,s=r.seqno,o,c,l,d,f,p,h,w,b,E,A,T,R,B;if(++r.seqno>vct&&(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!==WR&&ive(e,I)!==r.expectedPacket&&I<1&&I>4){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+r.expectedPacket+" but got: "+ive(e,I)),e.disconnect(km.PROTOCOL_ERROR);var q=new Error("Received unexpected packet");return q.level="protocol",e.emit("error",q),!1}if(I===Ja.CHANNEL_DATA){if(f=ad(i,1,e,t),f===!1||(p=wc(i,5,e,t,32768),p===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_DATA ("+f+")"),e.emit("CHANNEL_DATA:"+f,p)}else if(I===Ja.CHANNEL_EXTENDED_DATA){if(f=ad(i,1,e,t),f===!1)return!1;var re=ad(i,5,e,t);if(re===!1||(p=wc(i,9,e,t),p===!1))return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EXTENDED_DATA ("+f+")"),e.emit("CHANNEL_EXTENDED_DATA:"+f,re,p)}else if(I===Ja.CHANNEL_WINDOW_ADJUST){if(f=ad(i,1,e,t),f===!1)return!1;var K=ad(i,5,e,t);if(K===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_WINDOW_ADJUST ("+f+", "+K+")"),e.emit("CHANNEL_WINDOW_ADJUST:"+f,K)}else if(I===Ja.CHANNEL_SUCCESS){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_SUCCESS ("+f+")"),e.emit("CHANNEL_SUCCESS:"+f)}else if(I===Ja.CHANNEL_FAILURE){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_FAILURE ("+f+")"),e.emit("CHANNEL_FAILURE:"+f)}else if(I===Ja.CHANNEL_EOF){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_EOF ("+f+")"),e.emit("CHANNEL_EOF:"+f)}else if(I===Ja.CHANNEL_OPEN){var Z=wc(i,1,"ascii",e,t);if(Z===!1||(b=ad(i,i._pos,e,t),b===!1)||(E=ad(i,i._pos+=4,e,t),E===!1)||(A=ad(i,i._pos+=4,e,t),A===!1))return!1;var ie;if(e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_OPEN ("+b+", "+Z+")"),Z==="forwarded-tcpip"||Z==="direct-tcpip"){var V=wc(i,i._pos+=4,"ascii",e,t);if(V===!1)return!1;var O=ad(i,i._pos,e,t);if(O===!1||(h=wc(i,i._pos+=4,"ascii",e,t),h===!1)||(w=ad(i,i._pos,e,t),w===!1))return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{destIP:V,destPort:O,srcIP:h,srcPort:w}}}else if(Z==="forwarded-streamlocal@openssh.com"||Z==="direct-streamlocal@openssh.com"){if(B=wc(i,i._pos+=4,"utf8",e,t),B===!1)return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{socketPath:B}}}else if(Z==="x11"){if(h=wc(i,i._pos+=4,"ascii",e,t),h===!1||(w=ad(i,i._pos,e,t),w===!1))return!1;ie={type:Z,sender:b,window:E,packetSize:A,data:{srcIP:h,srcPort:w}}}else ie={type:Z,sender:b,window:E,packetSize:A,data:{}};e.emit("CHANNEL_OPEN",ie)}else if(I===Ja.CHANNEL_OPEN_CONFIRMATION){if(T=ad(i,1,e,t),T===!1||(b=ad(i,5,e,t),b===!1)||(E=ad(i,9,e,t),E===!1)||(A=ad(i,13,e,t),A===!1))return!1;d={recipient:T,sender:b,window:E,packetSize:A},i.length>17&&(d.data=i.slice(17)),e.emit("CHANNEL_OPEN_CONFIRMATION:"+d.recipient,d)}else if(I===Ja.CHANNEL_OPEN_FAILURE){if(T=ad(i,1,e,t),T===!1)return!1;var ne=ad(i,5,e,t);if(ne===!1||(R=wc(i,9,"utf8",e,t),R===!1)||(c=wc(i,i._pos,"utf8",e,t),c===!1))return!1;i._pos=9,d={recipient:T,reasonCode:ne,reason:wTs[ne],description:R,lang:c},e.emit("CHANNEL_OPEN_FAILURE:"+d.recipient,d)}else if(I===Ja.CHANNEL_CLOSE){if(f=ad(i,1,e,t),f===!1)return!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_CLOSE ("+f+")"),e.emit("CHANNEL_CLOSE:"+f)}else if(I!==Ja.IGNORE){if(I===Ja.DISCONNECT){var $=ad(i,1,e,t);if($===!1)return!1;var U=km[$];if(R=wc(i,5,"utf8",e,t),R===!1)return!1;i._pos<i.length&&(c=wc(i,i._pos,"ascii",e,t)),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: DISCONNECT ("+U+")"),e.emit("DISCONNECT",U,$,R,c)}else if(I===Ja.DEBUG){if(l=wc(i,2,"utf8",e,t),l===!1||(c=wc(i,i._pos,"ascii",e,t),c===!1))return!1;e.emit("DEBUG",l,c)}else if(I===Ja.NEWKEYS)e.emit("NEWKEYS");else if(I===Ja.SERVICE_REQUEST){if(o=wc(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_REQUEST",o)}else if(I===Ja.SERVICE_ACCEPT){if(o=wc(i,1,"ascii",e,t),o===!1)return!1;e.emit("SERVICE_ACCEPT",o)}else if(I===Ja.USERAUTH_REQUEST){var D=wc(i,1,"utf8",e,t);if(D===!1)return!1;var G=wc(i,i._pos,"ascii",e,t);if(G===!1)return!1;var z=wc(i,i._pos,"ascii",e,t);if(z===!1)return!1;var L,N;if(z==="password"){if(L=wc(i,i._pos+1,"utf8",e,t),L===!1)return!1}else if(z==="publickey"||z==="hostbased"){var W,F,Q,ee,X,ae,ye;if(z==="publickey"){if(W=i[i._pos++],W===void 0)return!1;W=W!==0}if(F=wc(i,i._pos,"ascii",e,t),F===!1||(Q=wc(i,i._pos,e,t),Q===!1))return!1;if(W||z==="hostbased"){if(z==="hostbased"&&(ae=wc(i,i._pos,"ascii",e,t),ae===!1||(ye=wc(i,i._pos,"utf8",e,t),ye===!1)))return!1;var ue=i._pos;if(ee=wc(i,ue,e,t),ee===!1||(ee.length>4+F.length+4&&ee.toString("ascii",4,4+F.length)===F&&(ee=ee.slice(4+F.length+4)),ee=pRr(ee,F,e,t),ee===!1))return!1;X=Buffer.allocUnsafe(4+n.sessionId.length+ue),ii(X,n.sessionId.length,0),n.sessionId.copy(X,4),i.copy(X,4+n.sessionId.length,0,ue)}else N="publickey -- check";L={keyAlgo:F,key:Q,signature:ee,blob:X,localHostname:ae,localUsername:ye}}else if(z==="keyboard-interactive"){var de=ad(i,i._pos,e,t);if(de===!1||(L=wc(i,i._pos+4+de,"utf8",e,t),L===!1))return!1}else z!=="none"&&(L=i.slice(i._pos));N===void 0&&(N=z),e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: USERAUTH_REQUEST ("+N+")"),e._state.authsQueue.push(z),e.emit("USERAUTH_REQUEST",D,G,z,L)}else if(I===Ja.USERAUTH_SUCCESS)n.compress.type==="zlib@openssh.com"&&(n.compress.instance=UL.createDeflate(mz),n.compress.queue=[]),r.decompress.type==="zlib@openssh.com"&&(r.decompress.instance=UL.createInflate(mz)),e._state.authsQueue.shift(),e.emit("USERAUTH_SUCCESS");else if(I===Ja.USERAUTH_FAILURE){var H=wc(i,1,"ascii",e,t);if(H===!1)return!1;var ke=i[i._pos];if(ke===void 0)return!1;ke=ke!==0,H=H.split(","),e._state.authsQueue.shift(),e.emit("USERAUTH_FAILURE",H,ke)}else if(I===Ja.USERAUTH_BANNER){if(l=wc(i,1,"utf8",e,t),l===!1||(c=wc(i,i._pos,"utf8",e,t),c===!1))return!1;e.emit("USERAUTH_BANNER",l,c)}else if(I===Ja.GLOBAL_REQUEST){var se=wc(i,1,"ascii",e,t);if(se===!1)return e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST"),!1;e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: GLOBAL_REQUEST ("+se+")");var Y=i[i._pos++];if(Y===void 0)return!1;Y=Y!==0;var fe;if(se==="tcpip-forward"||se==="cancel-tcpip-forward"){var ge=wc(i,i._pos,"ascii",e,t);if(ge===!1)return!1;var be=ad(i,i._pos,e,t);if(be===!1)return!1;fe={bindAddr:ge,bindPort:be}}else if(se==="streamlocal-forward@openssh.com"||se==="cancel-streamlocal-forward@openssh.com"){if(B=wc(i,i._pos,"utf8",e,t),B===!1)return!1;fe={socketPath:B}}else se==="no-more-sessions@openssh.com"||(fe=i.slice(i._pos));e.emit("GLOBAL_REQUEST",se,Y,fe)}else if(I===Ja.REQUEST_SUCCESS)i.length>1?e.emit("REQUEST_SUCCESS",i.slice(1)):e.emit("REQUEST_SUCCESS");else if(I===Ja.REQUEST_FAILURE)e.emit("REQUEST_FAILURE");else if(I!==Ja.UNIMPLEMENTED){if(I===Ja.KEXINIT)return zTs(e,t);if(I===Ja.CHANNEL_REQUEST)return UTs(e,t);if(I>=30&&I<=49)return jTs(e,I,t);if(I>=60&&I<=70)return BTs(e,I,t);var Oe=Buffer.allocUnsafe(1+4);Oe[0]=Ja.UNIMPLEMENTED,ii(Oe,s,1),Ac(e,Oe)}}}a(ARr,"parsePacket");function zTs(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=sx(n,17,e,t),s===!1||(i.algorithms.kex=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.srvHostKey=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.encrypt=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.encrypt=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.mac=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.mac=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.cs.compress=s,s=sx(n,n._pos,e,t),s===!1)||(i.algorithms.sc.compress=s,s=sx(n,n._pos,e,t),s===!1)||(i.languages.cs=s,s=sx(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(zTs,"parse_KEXINIT");function jTs(e,t,r){var n=e._state,i=n.incoming,s=i.payload;if(n.outgoing.status===WR||ive(e,t)!==i.expectedPacket){e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, expected: "+i.expectedPacket+" but got: "+ive(e,t)),e.disconnect(km.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(km.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===Ja.KEXDH_GEX_GROUP){var c=wc(s,1,e,r);if(c===!1)return!1;var l=wc(s,s._pos,e,r);if(l===!1)return!1;e.emit("KEXDH_GEX_GROUP",c,l)}else if(t===Ja.KEXDH_GEX_REPLY)return xRr(e,r)}else if(t===Ja.KEXDH_INIT){var d=wc(s,1,e,r);if(d===!1)return!1;e.emit("KEXDH_INIT",d)}else if(t===Ja.KEXDH_REPLY)return xRr(e,r)}a(jTs,"parse_KEX");function xRr(e,t){var r=e._state.incoming.payload,n=wc(r,1,e,t);if(n===!1)return!1;var i=wc(r,r._pos,e,t);if(i===!1)return!1;var s=wc(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},c=wc(n,0,"ascii",e,t);if(c===!1)return!1;o.hostkey_format=c;var l=wc(s,0,"ascii",e,t);if(l===!1)return!1;o.sig_format=l,e.emit("KEXDH_REPLY",o)}a(xRr,"parse_KEXDH_REPLY");function BTs(e,t,r){var n=e._state,i=n.authsQueue[0],s=n.incoming.payload,o,c,l;if(i==="password"){if(t===Ja.USERAUTH_PASSWD_CHANGEREQ){if(o=wc(s,1,"utf8",e,r),o===!1||(c=wc(s,s._pos,"utf8",e,r),c===!1))return!1;e.emit("USERAUTH_PASSWD_CHANGEREQ",o,c)}}else if(i==="keyboard-interactive"){if(t===Ja.USERAUTH_INFO_REQUEST){var d,f,p;if(d=wc(s,1,"utf8",e,r),d===!1||(f=wc(s,s._pos,"utf8",e,r),f===!1)||(c=wc(s,s._pos,"utf8",e,r),c===!1)||(p=ad(s,s._pos,e,r),p===!1))return!1;s._pos+=4;for(var h=[],w=0;w<p;++w){if(l=wc(s,s._pos,"utf8",e,r),l===!1)return!1;var b=s[s._pos++];if(b===void 0)return!1;b=b!==0,h.push({prompt:l,echo:b})}e.emit("USERAUTH_INFO_REQUEST",d,f,c,h)}else if(t===Ja.USERAUTH_INFO_RESPONSE){var E=ad(s,1,e,r);if(E===!1)return!1;s._pos=5;for(var A=[],T=0;T<E;++T){if(l=wc(s,s._pos,"utf8",e,r),l===!1)return!1;A.push(l)}e.emit("USERAUTH_INFO_RESPONSE",A)}}else if(i==="publickey"){if(t===Ja.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(km.PROTOCOL_ERROR);var B=new Error("Invalid authentication method: "+i);B.level="protocol",e.emit("error",B)}}a(BTs,"parse_USERAUTH");function UTs(e,t){var r=e._state.incoming.payload,n,i,s,o,c,l,d,f=ad(r,1,e,t);if(f===!1)return!1;var p=wc(r,5,"ascii",e,t);if(p===!1)return!1;if(p==="exit-status"){var h=ad(r,++r._pos,e,t);if(h===!1)return!1;n={recipient:f,request:p,wantReply:!1,code:h}}else if(p==="exit-signal"){var w;if(e.remoteBugs&tve.OLD_EXIT){if(d=ad(r,++r._pos,e,t),d===!1)return!1;switch(d){case 1:d="HUP";break;case 2:d="INT";break;case 3:d="QUIT";break;case 6:d="ABRT";break;case 9:d="KILL";break;case 14:d="ALRM";break;case 15:d="TERM";break;default:d="UNKNOWN ("+d+")"}w=!1}else{if(d=wc(r,++r._pos,"ascii",e,t),d===!1||(w=r[r._pos++],w===void 0))return!1;w=w!==0}var b=wc(r,r._pos,"utf8",e,t);if(b===!1)return!1;var E=wc(r,r._pos,"utf8",e,t);if(E===!1)return!1;n={recipient:f,request:p,wantReply:!1,signal:d,coredump:w,description:b,lang:E}}else if(p==="pty-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var A=wc(r,r._pos,"ascii",e,t);if(A===!1||(i=ad(r,r._pos,e,t),i===!1)||(s=ad(r,r._pos+=4,e,t),s===!1)||(o=ad(r,r._pos+=4,e,t),o===!1)||(c=ad(r,r._pos+=4,e,t),c===!1))return!1;var T=wc(r,r._pos+=4,e,t);if(T===!1)return!1;T=$Ts(T),n={recipient:f,request:p,wantReply:l,term:A,cols:i,rows:s,width:o,height:c,modes:T}}else if(p==="window-change"){if(i=ad(r,++r._pos,e,t),i===!1||(s=ad(r,r._pos+=4,e,t),s===!1)||(o=ad(r,r._pos+=4,e,t),o===!1)||(c=ad(r,r._pos+=4,e,t),c===!1))return!1;n={recipient:f,request:p,wantReply:!1,cols:i,rows:s,width:o,height:c}}else if(p==="x11-req"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var R=r[r._pos++];if(R===void 0)return!1;R=R!==0;var B=wc(r,r._pos,"ascii",e,t);if(B===!1)return!1;var I=wc(r,r._pos,"binary",e,t);if(I===!1)return!1;var q=ad(r,r._pos,e,t);if(q===!1)return!1;n={recipient:f,request:p,wantReply:l,single:R,protocol:B,cookie:I,screen:q}}else if(p==="env"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var re=wc(r,r._pos,"utf8",e,t);if(re===!1)return!1;var K=wc(r,r._pos,"utf8",e,t);if(K===!1)return!1;n={recipient:f,request:p,wantReply:l,key:re,val:K}}else if(p==="shell"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}else if(p==="exec"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var Z=wc(r,r._pos,"utf8",e,t);if(Z===!1)return!1;n={recipient:f,request:p,wantReply:l,command:Z}}else if(p==="subsystem"){if(l=r[r._pos++],l===void 0)return!1;l=l!==0;var ie=wc(r,r._pos,"utf8",e,t);if(ie===!1)return!1;n={recipient:f,request:p,wantReply:l,subsystem:ie}}else if(p==="signal"){if(d=wc(r,++r._pos,"ascii",e,t),d===!1)return!1;n={recipient:f,request:p,wantReply:!1,signal:"SIG"+d}}else if(p==="xon-xoff"){var V=r[++r._pos];if(V===void 0)return!1;V=V!==0,n={recipient:f,request:p,wantReply:!1,clientControl:V}}else if(p==="auth-agent-req@openssh.com"){if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}else{if(l=r[r._pos],l===void 0)return!1;l=l!==0,n={recipient:f,request:p,wantReply:l}}e.debug("DEBUG: Parser: IN_PACKETDATAAFTER, packet: CHANNEL_REQUEST ("+f+", "+p+")"),e.emit("CHANNEL_REQUEST:"+f,n)}a(UTs,"parse_CHANNEL_REQUEST");function GTs(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]),mRr(i.iv),i.instance=Xd.createDecipheriv(lz[i.type],i.key,i.iv),i.instance.setAutoPadding(!1),!0}else{var c=Xd.createHmac(lz[n.type],n.key);ii(nve,r.seqno,0),ii(nve,r.pktLen,4),nve[8]=r.padLen,c.update(nve),c.update(r.packet);var l=c.digest();return l.length>r.hmac.info.actualLen&&(l=l.slice(0,r.hmac.info.actualLen)),QTs(l,t)}}a(GTs,"hmacVerify");function PRr(e,t){var r=e._state.incoming.decrypt.instance;return e.debug("DEBUG: Parser: Decrypting"),r.update(t)}a(PRr,"decryptData");function GL(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(GL,"expectData");function sx(e,t,r,n){var i=wc(e,t,"ascii",r,n);return i!==!1?i.length?i.split(","):[]:!1}a(sx,"readList");function $Ts(e){for(var t={},r=0,n=e.length,i;r<n&&(i=e[r],!(i===uz.TTY_OP_END||uz[i]===void 0||r+5>n));r+=5)t[uz[i]]=mct(e,r+1);return t}a($Ts,"bytesToModes");function HTs(e){for(var t=/^\d+$/,r=Object.keys(e),n=0,i=[],s=0,o=r.length,c,l,d;s<o;++s)c=r[s],l=uz[c],l&&!t.test(c)&&typeof e[c]=="number"&&c!=="TTY_OP_END"&&(d=e[c],i[n++]=l,i[n++]=d>>>24&255,i[n++]=d>>>16&255,i[n++]=d>>>8&255,i[n++]=d&255);return i[n]=uz.TTY_OP_END,i}a(HTs,"modesToBytes");function Ect(e,t){return JTs(16,function(r){var n=e.config.algorithms,i=n.kexBuf;if(e.remoteBugs&tve.BAD_DHGEX){for(var s=!1,o=n.kex,c=o.length-1;c>=0;--c)o[c].indexOf("group-exchange")!==-1&&(s||(o=o.slice(),s=!0),o.splice(c,1));s&&(i=Buffer.from(o.join(",")))}var l=n.serverHostKeyBuf,d=1+16+4+i.length+4+l.length+2*(4+n.cipherBuf.length)+2*(4+n.hmacBuf.length)+2*(4+n.compressBuf.length)+2*4+1+4,f=Buffer.allocUnsafe(d),p=17;f[0]=Ja.KEXINIT,r!==!1&&r.copy(f,1),ii(f,i.length,p),p+=4,i.copy(f,p),p+=i.length,ii(f,l.length,p),p+=4,l.copy(f,p),p+=l.length,ii(f,n.cipherBuf.length,p),p+=4,n.cipherBuf.copy(f,p),p+=n.cipherBuf.length,ii(f,n.cipherBuf.length,p),p+=4,n.cipherBuf.copy(f,p),p+=n.cipherBuf.length,ii(f,n.hmacBuf.length,p),p+=4,n.hmacBuf.copy(f,p),p+=n.hmacBuf.length,ii(f,n.hmacBuf.length,p),p+=4,n.hmacBuf.copy(f,p),p+=n.hmacBuf.length,ii(f,n.compressBuf.length,p),p+=4,n.compressBuf.copy(f,p),p+=n.compressBuf.length,ii(f,n.compressBuf.length,p),p+=4,n.compressBuf.copy(f,p),p+=n.compressBuf.length,f.fill(0,f.length-13),e.debug("DEBUG: Outgoing: Writing KEXINIT"),e._state.incoming.expectedPacket="KEXINIT";var h=e._state.outgoing;h.kexinit=f,h.status===WR&&(h.status=XR),Ac(e,f,t,!0)}),!0}a(Ect,"KEXINIT");function kRr(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]=Ja.KEXDH_GEX_INIT,e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_INIT")):(n[0]=Ja.KEXDH_INIT,t.kex.type==="group"?e.debug("DEBUG: Outgoing: Writing KEXDH_INIT"):e.debug("DEBUG: Outgoing: Writing KEXECDH_INIT")),ii(n,r.pubkey.length,1),r.pubkey.copy(n,5),Ac(e,n,void 0,!0)}a(kRr,"KEXDH_INIT");function VTs(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(),c=s.type;t=r.kex.convertPublicKey(t);var l=r.kex.computeSecret(t);if(l instanceof Error)return l.message="Error while computing DH secret ("+r.kex.type+"): "+l.message,l.level="handshake",e.emit("error",l),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;var d=Xd.createHash(r.kex.hash),f=Buffer.byteLength(i.identRaw),p=Buffer.byteLength(e.config.ident),h=i.kexinit.length,w=n.kexinit.length,b=o.length,E=t.length,A=n.pubkey.length,T=l.length,R=f+p+h+w+b+E+A+T+4*8,B,I,q,re,K=r.kex.getDHParams();K&&(q=K.prime,re=K.generator,B=q.length,I=re.length,R+=4*3,R+=4*2,R+=B,R+=I);var Z=0,ie=Buffer.allocUnsafe(R);ii(ie,f,Z),Z+=4,ie.write(i.identRaw,Z,"utf8"),Z+=f,ii(ie,p,Z),Z+=4,ie.write(e.config.ident,Z,"utf8"),Z+=p,ii(ie,h,Z),Z+=4,i.kexinit.copy(ie,Z),Z+=h,i.kexinit=void 0,ii(ie,w,Z),Z+=4,n.kexinit.copy(ie,Z),Z+=w,n.kexinit=void 0,ii(ie,b,Z),Z+=4,o.copy(ie,Z),Z+=b,K&&(Cct.slice(1).copy(ie,Z),Z+=4*3,ii(ie,B,Z),Z+=4,q.copy(ie,Z),Z+=B,ii(ie,I,Z),Z+=4,re.copy(ie,Z),Z+=I),ii(ie,E,Z),Z+=4,t.copy(ie,Z),Z+=E,ii(ie,A,Z),Z+=4,n.pubkey.copy(ie,Z),Z+=A,ii(ie,T,Z),Z+=4,l.copy(ie,Z),n.exchangeHash=d.update(ie).digest(),n.sessionId===void 0&&(n.sessionId=n.exchangeHash),n.kexsecret=l;var V=s.sign(n.exchangeHash);if(V instanceof Error)return V.message="Error while signing data with host key ("+c+"): "+V.message,V.level="handshake",e.emit("error",V),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;if(V=Act(V,c),V===!1)return V.message="Error while converting handshake signature",V.level="handshake",e.emit("error",V),e.disconnect(km.KEY_EXCHANGE_FAILED),!1;var O=4+c.length+4+V.length,ne=Buffer.allocUnsafe(1+4+b+4+A+4+O);return Z=0,ne[Z]=Ja[r.kex.pktReply],++Z,ii(ne,b,Z),Z+=4,o.copy(ne,Z),Z+=b,ii(ne,A,Z),Z+=4,n.pubkey.copy(ne,Z),Z+=A,ii(ne,O,Z),Z+=4,ii(ne,c.length,Z),Z+=4,ne.write(c,Z,c.length,"ascii"),Z+=c.length,ii(ne,V.length,Z),Z+=4,V.copy(ne,Z),r.incoming.expectedPacket="NEWKEYS",e.debug("DEBUG: Outgoing: Writing "+r.kex.pktReply),Ac(e,ne,void 0,!0),n.sentNEWKEYS=!0,e.debug("DEBUG: Outgoing: Writing NEWKEYS"),Ac(e,Sct,void 0,!0)}a(VTs,"KEXDH_REPLY");function WTs(e){return e._state.incoming.expectedPacket="KEXDH_GEX_GROUP",e.debug("DEBUG: Outgoing: Writing KEXDH_GEX_REQUEST"),Ac(e,Cct,void 0,!0)}a(WTs,"KEXDH_GEX_REQ");function DRr(e,t,r){var n=e._state.outgoing.compress.instance;n.write(t),n.flush(wct,XTs.bind(e,r))}a(DRr,"compressPayload");function XTs(e){if(!(this._readableState.ended||this._writableState.ended)){TRr(this,this._state.outgoing.compress.instance.read(),e);var t=this._state.outgoing.compress.queue;t.shift(),t.length>0&&DRr(this,t[0][0],t[0][1])}}a(XTs,"compressFlushCb");function Ac(e,t,r,n){var i=e._state;if(!i)return!1;var s=i.outgoing;if(s.status===XR&&!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&&DRr(e,o[0][0],o[0][1]),!0}else return TRr(e,t,r)}a(Ac,"send");function TRr(e,t,r){var n=e._state,i=n.outgoing,s=i.encrypt,o=i.hmac,c,l,d,f,p;if(c=t.length+9,s.instance!==!1)if(s.info.authLen>0){for(var h=1+t.length+4;h%s.info.blockLen!=0;)++h;l=h-1-t.length,c=4+h}else{var w=s.info.blockLen;c+=(w-1)*c%w,l=c-t.length-5}else c+=7*c%8,l=c-t.length-5;d=Buffer.allocUnsafe(c),ii(d,c-4,0),d[4]=l,t.copy(d,5),KTs(d,5+t.length,l),o.type!==!1&&o.key&&(f=Xd.createHmac(lz[o.type],o.key),ii(i.bufSeqno,i.seqno,0),f.update(i.bufSeqno),f.update(d),f=f.digest(),f.length>o.info.actualLen&&(f=f.slice(0,o.info.actualLen)));var b=0,E;if(s.instance!==!1)if(s.info.authLen>0){var A=Xd.createCipheriv(lz[s.type],s.key,s.iv);A.setAutoPadding(!1);var T=d.slice(0,4);A.setAAD(T),e.push(T),b+=T,E=A.update(d.slice(4)),e.push(E),b+=E.length;var R=A.final();R.length&&(e.push(R),b+=R.length);var B=A.getAuthTag();p=e.push(B),b+=B.length,mRr(s.iv)}else E=s.instance.update(d),e.push(E),b+=E.length,p=e.push(f),b+=f.length;else p=e.push(d),b=d.length;return e.bytesSent+=b,++i.seqno>vct&&(i.seqno=0),r&&r(),p}a(TRr,"send_");var KTs=function(){return typeof Xd.randomFillSync=="function"?Xd.randomFillSync:a(function(t,r,n){var i=Xd.randomBytes(n);i.copy(t,r)},"copyRandPadBytes")}();function JTs(e,t){Xd.randomBytes(e,a(function r(n,i){if(n)return Xd.randomBytes(e,r);t&&t(i)},"retry"))}a(JTs,"randBytes");function Act(e,t){switch(t){case"ssh-dss":return hTs(e);case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return yTs(e)}return e}a(Act,"convertSignature");var QTs=function(){return typeof Xd.timingSafeEqual=="function"?a(function(t,r){return t.length!==r.length?(Xd.timingSafeEqual(t,t),!1):Xd.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 $L(e,t){switch(e){case"curve25519-sha256":case"curve25519-sha256@libssh.org":if(!STs)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($L,"KeyExchange");$L.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}};$L.prototype.getDHParams=function(){if(this.type==="groupex"&&this._kex)return{prime:ave(this._kex.getPrime()),generator:ave(this._kex.getGenerator())}};$L.prototype.generateKeys=function(){switch(this.type){case"25519":this._keys||(this._keys=Xd.generateKeyPairSync("x25519"));break;case"ecdh":this._kex||(this._kex=Xd.createECDH(this.name),this._public=this._kex.generateKeys());break;case"group":case"groupex":this._kex||(this.name?this._kex=Xd.createDiffieHellmanGroup(this.name):this._prime&&this._generator&&(this._kex=Xd.createDiffieHellman(this._prime,this._generator)),this._kex&&(this._public=this._kex.generateKeys()));break}};$L.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)};$L.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};$L.prototype.computeSecret=function(e){switch(this.generateKeys(),this.type){case"25519":try{var t=new fRr.Writer;return t.startSequence(),t.startSequence(),t.writeOID("1.3.101.110"),t.endSequence(),t.startSequence(fRr.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(),ave(Xd.diffieHellman({privateKey:this._keys.privateKey,publicKey:Xd.createPublicKey({key:t.buffer,type:"spki",format:"der"})}))}catch(r){return r}break;case"ecdh":case"group":case"groupex":try{return ave(this._kex.computeSecret(e))}catch(r){return r}}};function ave(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(ave,"convertToMpint");xct.exports=jc;xct.exports._send=Ac});var sve=x((Dkc,IRr)=>{IRr.exports={SFTPStream:sRr(),SSH2Stream:RRr(),utils:rx(),constants:zye()}});var qRr=x(LRr=>{var NRr=require("http").Agent,YTs=require("https").Agent,ZTs=require("util").inherits,Pct;[NRr,YTs].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"),ZTs(t,e),t.prototype.createConnection=eRs,LRr[e===NRr?"SSHTTPAgent":"SSHTTPSAgent"]=t});function eRs(e,t){var r=e&&e.localAddress||this._defaultSrcIP,n=e&&e.localPort||0,i=e.host,s=e.port;Pct===void 0&&(Pct=kct().Client);var o=new Pct,c=!1;o.on("ready",()=>{o.forwardOut(r,n,i,s,(l,d)=>{if(c=!0,l)return o.end(),t(l);d.once("close",()=>{o.end()}),t(null,tRs(d))})}).on("error",t).on("close",()=>{c||t(new Error("Unexpected connection loss"))}).connect(this._connectCfg)}a(eRs,"createConnection");function sG(){}a(sG,"noop");function tRs(e){return e.setKeepAlive=sG,e.setNoDelay=sG,e.setTimeout=sG,e.ref=sG,e.unref=sG,e.destroySoon=e.destroy,e}a(tRs,"decorateStream")});var Tct=x((Rkc,jRr)=>{var ORr=require("util").inherits,MRr=require("stream").Duplex,rRs=require("stream").Readable,FRr=require("stream").Writable,nRs=sve().constants.CHANNEL_EXTENDED_DATATYPE.STDERR,iRs=32*1024,oG=2*1024*1024,ove=oG/2,zRr=["CHANNEL_EOF","CHANNEL_CLOSE","CHANNEL_DATA","CHANNEL_EXTENDED_DATA","CHANNEL_WINDOW_ADJUST","CHANNEL_SUCCESS","CHANNEL_FAILURE","CHANNEL_REQUEST"],aRs=zRr.length;function _C(e,t,r){var n={highWaterMark:oG,allowHalfOpen:!r||r&&r.allowHalfOpen!==!1};this.allowHalfOpen=n.allowHalfOpen,MRr.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,c=o.id,l=this.outgoing=e.outgoing,d=this._callbacks=[],f,p,h,w,b;this._client=t,this._hasX11=!1;var E=t._channels,A=t._sshstream;function T(){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(T,"ondrain"),t._sock.on("drain",T),A.once("CHANNEL_EOF:"+c,function(){o.state==="open"&&(o.state="eof",i.readable&&i.push(null),!s&&i.stderr.readable&&i.stderr.push(null))}).once("CHANNEL_CLOSE:"+c,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),(l.state==="open"||l.state==="eof")&&i.close(),l.state==="closing"&&(l.state="closed"),delete E[c];var I=i._writableState;t._sock.removeListener("drain",T),!I.ending&&!I.finished&&i.end(),i._callbacks=[];for(var q=0;q<d.length;++q)d[q](!0);d=i._callbacks,s?i.readable?i.once("end",function(){i.emit("close")}):i.emit("close"):(i.readable?i.once("end",function(){f===null?i.emit("close",f,p,h,w,b):i.emit("close",f)}):f===null?i.emit("close",f,p,h,w,b):i.emit("close",f),i.stderr.readable?i.stderr.once("end",function(){i.stderr.emit("close")}):i.stderr.emit("close"));for(var q=0;q<aRs;++q)A.removeAllListeners(zRr[q]+":"+c)}}).on("CHANNEL_DATA:"+c,function(I){if(o.window!==0){if(o.window-=I.length,!i.push(I)){i._waitChanDrain=!0;return}o.window<=ove&&cve(i)}}).on("CHANNEL_WINDOW_ADJUST:"+c,function(I){l.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:"+c,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),d.length&&d.shift()(!1)}).on("CHANNEL_FAILURE:"+c,function(){s?(A._kalast=Date.now(),A._kacnt=0):t._resetKA(),d.length&&d.shift()(!0)}).on("CHANNEL_REQUEST:"+c,function(I){if(!s){if(I.request==="exit-status"){i.emit("exit",f=I.code);return}else if(I.request==="exit-signal"){i.emit("exit",f=null,p="SIG"+I.signal,h=I.coredump,w=I.description,b=I.lang);return}}I.wantReply&&A.channelFailure(l.id)}),this.stdin=this.stdout=this,s?this.stderr=new Dct(this):(this.stderr=new rRs(n),this.stderr._read=function(I){i._waitChanDrain&&(i._waitChanDrain=!1,o.window<=ove&&cve(i))},A.on("CHANNEL_EXTENDED_DATA:"+c,function(I,q){if(o.window!==0){if(o.window-=q.length,!i.stderr.push(q)){i._waitChanDrain=!0;return}o.window<=ove&&cve(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 B(){i.readable=!1}a(B,"onEnd"),this.on("end",B).on("close",B)}a(_C,"Channel");ORr(_C,MRr);_C.prototype.eof=function(){var e=!0,t=this.outgoing;return t.state==="open"&&(t.state="eof",e=this._client._sshstream.channelEOF(t.id)),e};_C.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};_C.prototype._read=function(e){this._waitChanDrain&&(this._waitChanDrain=!1,this.incoming.window<=ove&&cve(this))};_C.prototype._write=function(e,t,r){var n=this._client._sshstream,i=this.outgoing,s=i.packetSize,o=i.id,c=i.window,l=e.length,d=0,f,p,h;if(i.state==="open"){for(;l-d>0&&c>0;)if(h=l-d,h>c&&(h=c),h>s&&(h=s),f=n.channelData(o,e.slice(d,d+h)),d+=h,c-=h,!f){this._waitClientDrain=!0,this._chunk=void 0,this._chunkcb=r;break}if(i.window=c,l-d>0){c===0&&(this._waitWindow=!0),d>0?(p=Buffer.allocUnsafe(l-d),e.copy(p,0,d),this._chunk=p):this._chunk=e,this._chunkcb=r;return}this._waitClientDrain||r()}};_C.prototype.destroy=function(){this.end()};_C.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};_C.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};_C.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};_C.MAX_WINDOW=oG;_C.PACKET_SIZE=iRs;function cve(e){if(e.outgoing.state==="closed")return!0;var t=oG-e.incoming.window;return t<=0?!0:(e.incoming.window+=t,e._client._sshstream.channelWindowAdjust(e.outgoing.id,t))}a(cve,"windowAdjust");function Dct(e){FRr.call(this,{highWaterMark:oG}),this._channel=e}a(Dct,"ServerStderr");ORr(Dct,FRr);Dct.prototype._write=function(e,t,r){var n=this._channel,i=n._client._sshstream,s=n.outgoing,o=s.packetSize,c=s.id,l=s.window,d=e.length,f=0,p,h,w;if(n.outgoing.state==="open"){for(;d-f>0&&l>0;)if(w=d-f,w>l&&(w=l),w>o&&(w=o),p=i.channelExtData(c,e.slice(f,f+w),nRs),f+=w,l-=w,!p){n._waitClientDrain=!0,n._chunkErr=void 0,n._chunkcbErr=r;break}if(s.window=l,d-f>0){l===0&&(n._waitWindow=!0),f>0?(h=Buffer.allocUnsafe(d-f),e.copy(h,0,f),n._chunkErr=h):n._chunkErr=e,n._chunkcbErr=r;return}n._waitClientDrain||r()}};jRr.exports=_C});var pz=x((Ikc,BRr)=>{BRr.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 tIr=x((Nkc,eIr)=>{var URr=require("net").Socket,sRs=require("events").EventEmitter,oRs=require("util").inherits,cRs=require("path"),GRr=require("fs"),$Rr=require("child_process"),HRr=pz().readUInt32BE,lve=pz().writeUInt32BE,VRr=pz().writeUInt32LE,lRs=11,uRs=12,dRs=13,fRs=14,mRs=5,pRs=/^\!<socket >(\d+) s ([A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8}\-[A-Z0-9]{8})/,gRs=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;eIr.exports=function(e,t,r,n,i){var s,o,c,l,d=0,f=Buffer.isBuffer(t),p,h=0,w=0,b=0,E,A=0,T=!1,R,B;typeof t=="function"&&typeof r=="function"?(R=t,B=r):f?(d=t.length,l=n.length):(i=t,t=void 0);function I(){var V;if(f){var O=9;V=Buffer.allocUnsafe(4+1+4+d+4+l+4),lve(V,V.length-4,0),V[4]=dRs,lve(V,d,5),t.copy(V,O),lve(V,l,O+=d),n.copy(V,O+=4),lve(V,0,O+=l),s.write(V)}else s.write(Buffer.from([0,0,0,1,lRs]))}a(I,"onconnect");function q(V){for(var O=0,ne=V.length;O<ne;++O)if(p===void 0)++h==5&&(p=V[O],h=0);else if(p===fRs){if(!c)w<<=8,w+=V[O],++h==4&&(c=Buffer.allocUnsafe(w),h=0);else if(c[h]=V[O],++h===w)return s.removeAllListeners("data"),s.destroy()}else if(p===uRs)if(E===void 0){if(b<<=8,b+=V[O],++h==4&&(E=new Array(b),h=0,b===0))return s.removeAllListeners("data"),s.destroy()}else if(!t)d<<=8,d+=V[O],++h==4&&(t=Buffer.allocUnsafe(d),h=0);else if(T===!1){if(t[h]=V[O],++h===d&&(E[b-1]=t,d=0,h=0,T=!0,--b==0))return t=void 0,s.removeAllListeners("data"),s.destroy()}else T===!0?(A<<=8,A+=V[O],++h==4&&(h=0,A>0?T=A:(t=void 0,T=!1),A=0)):++h===T&&(T=!1,h=0,t=void 0);else if(p===mRs)return f?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(q,"ondata");function re(V){o=V}a(re,"onerror");function K(){o?i(o):f&&!c||!f&&!E?i(new Error("Unexpected disconnection from agent")):f&&c?i(void 0,c):!f&&E&&i(void 0,E)}if(a(K,"onclose"),process.platform==="win32"&&!gRs.test(e))if(e==="pageant")s=new _Rs;else{var Z=!1;GRr.readFile(e,a(function V(O,ne){if(O){if(Z)return i(new Error("Invalid cygwin unix socket path"));$Rr.exec('cygpath -w "'+e+'"',function(de,H,ke){if(de||H.length===0)return i(new Error("Invalid cygwin unix socket path"));Z=!0,e=H.toString().replace(/[\r\n]/g,""),GRr.readFile(e,V)});return}var $;if($=pRs.exec(ne.toString("ascii"))){let de=function(){L=0,z="secret",s.write(G)},H=function(Y){L+=Y.length,z==="secret"?L===16&&(L=0,z="creds",s.write(F)):z==="creds"&&(N||W.push(Y),L===12&&(s.removeListener("connect",de),s.removeListener("data",H),s.removeListener("close",ke),N?(ie(),s.emit("connect")):(N=!0,F=Buffer.concat(W),VRr(F,process.pid,0),s.destroy(),se())))},ke=function(){i(new Error("Problem negotiating cygwin unix socket security"))},se=function(){s=new URr,s.once("connect",de),s.on("data",H),s.once("close",ke),s.connect(U)};var ae=de,ye=H,X=ke,ue=se;a(de,"_onconnect"),a(H,"_ondata"),a(ke,"_onclose"),a(se,"tryConnect");var U,D,G,z,L=0,N=!1,W=[],F=Buffer.allocUnsafe(12),Q,ee;for(F.fill(0),U=parseInt($[1],10),D=$[2].replace(/\-/g,""),G=Buffer.allocUnsafe(16),Q=0,ee=0;ee<32;++Q,ee+=2)G[Q]=parseInt(D.substring(ee,ee+2),16);for(Q=0;Q<16;Q+=4)VRr(G,HRr(G,Q),Q);se()}else i(new Error("Malformed cygwin unix socket file"))},"readCygsocket"));return}else s=new URr;function ie(){if(!R&&!B)s.once("connect",I),s.on("data",q),s.once("error",re),s.once("close",K);else{var V;s.once("connect",function(){V=R();var O=!1;function ne(){O||(s.destroy(),O=!0)}a(ne,"onDone"),V.once("end",ne).once("close",ne).on("data",function($){s.write($)}),s.on("data",function($){V.write($)})}),s.once("close",function(){V||B()})}}a(ie,"addSockListeners"),ie(),s.connect(e)};if(process.platform==="win32"){let e=function(){this.proc=void 0,this.buffer=null};_Rs=e,a(e,"PageantSock"),WRr=10,XRr=11,KRr=12,JRr=13,QRr=14,YRr=15,Hk={},ZRr=cRs.resolve(__dirname,"..","util/pagent.exe"),Hk[WRr]=new Error("Invalid pagent.exe arguments"),Hk[XRr]=new Error("Pageant is not running"),Hk[KRr]=new Error("pagent.exe could not create an mmap"),Hk[JRr]=new Error("pagent.exe could not set mode for stdin"),Hk[QRr]=new Error("pagent.exe could not set mode for stdout"),Hk[YRr]=new Error("pagent.exe did not get expected input payload"),oRs(e,sRs),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=HRr(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=$Rr.spawn(ZRr,[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,Hk[o]&&!s&&(s=!0,n.emit("error",Hk[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 WRr,XRr,KRr,JRr,QRr,YRr,Hk,ZRr,_Rs});var iIr=x((Lkc,nIr)=>{var hRs=require("util").inherits,rIr=require("events").EventEmitter;function Ku(e){var t=this;rIr.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(Ku,"SFTPWrapper");hRs(Ku,rIr);Ku.prototype.end=function(){return this._stream.end()};Ku.prototype.createReadStream=function(e,t){return this._stream.createReadStream(e,t)};Ku.prototype.createWriteStream=function(e,t){return this._stream.createWriteStream(e,t)};Ku.prototype.open=function(e,t,r,n){return this._stream.open(e,t,r,n)};Ku.prototype.close=function(e,t){return this._stream.close(e,t)};Ku.prototype.read=function(e,t,r,n,i,s){return this._stream.readData(e,t,r,n,i,s)};Ku.prototype.write=function(e,t,r,n,i,s){return this._stream.writeData(e,t,r,n,i,s)};Ku.prototype.fastGet=function(e,t,r,n){return this._stream.fastGet(e,t,r,n)};Ku.prototype.fastPut=function(e,t,r,n){return this._stream.fastPut(e,t,r,n)};Ku.prototype.readFile=function(e,t,r){return this._stream.readFile(e,t,r)};Ku.prototype.writeFile=function(e,t,r,n){return this._stream.writeFile(e,t,r,n)};Ku.prototype.appendFile=function(e,t,r,n){return this._stream.appendFile(e,t,r,n)};Ku.prototype.exists=function(e,t){return this._stream.exists(e,t)};Ku.prototype.unlink=function(e,t){return this._stream.unlink(e,t)};Ku.prototype.rename=function(e,t,r){return this._stream.rename(e,t,r)};Ku.prototype.mkdir=function(e,t,r){return this._stream.mkdir(e,t,r)};Ku.prototype.rmdir=function(e,t){return this._stream.rmdir(e,t)};Ku.prototype.readdir=function(e,t,r){return this._stream.readdir(e,t,r)};Ku.prototype.fstat=function(e,t){return this._stream.fstat(e,t)};Ku.prototype.stat=function(e,t){return this._stream.stat(e,t)};Ku.prototype.lstat=function(e,t){return this._stream.lstat(e,t)};Ku.prototype.opendir=function(e,t){return this._stream.opendir(e,t)};Ku.prototype.setstat=function(e,t,r){return this._stream.setstat(e,t,r)};Ku.prototype.fsetstat=function(e,t,r){return this._stream.fsetstat(e,t,r)};Ku.prototype.futimes=function(e,t,r,n){return this._stream.futimes(e,t,r,n)};Ku.prototype.utimes=function(e,t,r,n){return this._stream.utimes(e,t,r,n)};Ku.prototype.fchown=function(e,t,r,n){return this._stream.fchown(e,t,r,n)};Ku.prototype.chown=function(e,t,r,n){return this._stream.chown(e,t,r,n)};Ku.prototype.fchmod=function(e,t,r){return this._stream.fchmod(e,t,r)};Ku.prototype.chmod=function(e,t,r){return this._stream.chmod(e,t,r)};Ku.prototype.readlink=function(e,t){return this._stream.readlink(e,t)};Ku.prototype.symlink=function(e,t,r){return this._stream.symlink(e,t,r)};Ku.prototype.realpath=function(e,t){return this._stream.realpath(e,t)};Ku.prototype.ext_openssh_rename=function(e,t,r){return this._stream.ext_openssh_rename(e,t,r)};Ku.prototype.ext_openssh_statvfs=function(e,t){return this._stream.ext_openssh_statvfs(e,t)};Ku.prototype.ext_openssh_fstatvfs=function(e,t){return this._stream.ext_openssh_fstatvfs(e,t)};Ku.prototype.ext_openssh_hardlink=function(e,t,r){return this._stream.ext_openssh_hardlink(e,t,r)};Ku.prototype.ext_openssh_fsync=function(e,t){return this._stream.ext_openssh_fsync(e,t)};nIr.exports=Ku});var oIr=x((qkc,sIr)=>{function aIr(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(aIr,"spliceOne");function cG(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,c,l;s<o;++s)if(c=n[s],l=c._kalast,l&&i-l>=t)if(++c._kacnt>r){var d=new Error("Keepalive timeout");d.level="client-timeout",c.emit("error",d),c.disconnect(),aIr(n,s),--s,o=n.length}else c._kalast=i,c.ping()}}a(cG,"Manager");cG.prototype.start=function(){this._timer&&this.stop(),this._timer=setInterval(this._timerfn,this._timerInterval)};cG.prototype.stop=function(){this._timer&&(clearInterval(this._timer),this._timer=void 0)};cG.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")};cG.prototype.remove=function(e){var t=this._streams,r=t.indexOf(e);r>-1&&aIr(t,r),t.length||this.stop()};sIr.exports=cG});var pIr=x((Okc,qct)=>{var yRs=require("net"),KR=require("events").EventEmitter,iy=KR.listenerCount,JR=require("util").inherits,uve=sve(),cIr=uve.utils.parseKey,vRs=uve.SSH2Stream,wRs=uve.SFTPStream,Rct=uve.constants,lG=Rct.DISCONNECT_REASON,Ict=Rct.CHANNEL_OPEN_FAILURE,uG=Rct.ALGORITHMS,e_=Tct(),bRs=oIr(),SRs=pz().writeUInt32BE,lIr=Math.pow(2,32)-1,CRs=10,dve;function bg(e,t){if(!(this instanceof bg))return new bg(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=cIr(n[i]):s=cIr(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 c,l;if(l=e.algorithms.kex,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_KEX,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported key exchange algorithm: "+l[i]);o.kex=l}if(l=e.algorithms.cipher,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_CIPHER,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported cipher algorithm: "+l[i]);o.cipher=l}l=e.algorithms.serverHostKey;var d=!1;if(Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_SERVER_HOST_KEY,i=l.length-1;i>=0;--i){if(c.indexOf(l[i])===-1)throw new Error("Unsupported server host key algorithm: "+l[i]);r[l[i]]||(d||(l=l.slice(),d=!0),l.splice(i,1))}l.length>0&&(o.serverHostKey=l)}if(l=e.algorithms.hmac,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_HMAC,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported HMAC algorithm: "+l[i]);o.hmac=l}if(l=e.algorithms.compress,Array.isArray(l)&&l.length>0){for(c=uG.SUPPORTED_COMPRESS,i=0;i<l.length;++i)if(c.indexOf(l[i])===-1)throw new Error("Unsupported compression algorithm: "+l[i]);o.compress=l}}if(o.serverHostKey===void 0){var f=Object.keys(r);for(i=f.length-1;i>=0;--i)r[f[i]]||f.splice(i,1);o.serverHostKey=f}!dve&&bg.KEEPALIVE_INTERVAL>0&&bg.KEEPALIVE_CLIENT_INTERVAL>0&&bg.KEEPALIVE_CLIENT_COUNT_MAX>=0&&(dve=new bRs(bg.KEEPALIVE_INTERVAL,bg.KEEPALIVE_CLIENT_INTERVAL,bg.KEEPALIVE_CLIENT_COUNT_MAX));var p=this;KR.call(this),typeof t=="function"&&p.on("connection",t);var h={algorithms:o,hostKeys:r,server:!0},w,b;for(i=0,w=Object.keys(e),b=w.length;i<b;++i){var E=w[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,T=Object.keys(h);this._srv=new yRs.Server(function(R){if(p._connections>=p.maxConnections){R.destroy();return}++p._connections,R.once("close",function(V){--p._connections,K.read()}).on("error",function(V){K.reset(),K.emit("error",V)});var B=h;if(A){B={};for(var I=0,q;I<T.length;++I)q=T[I],B[q]=h[q];var re="["+process.hrtime().join(".")+"] ";B.debug=function(V){A(re+V)}}var K=new vRs(B),Z=new QR(K,R);R.pipe(K).pipe(R);function ie(V){}a(ie,"onClientPreHeaderError"),Z.on("error",ie),K.once("header",function(V){if(!K._readableState.ended){if(!iy(p,"connection"))return K.disconnect(lG.BY_APPLICATION);Z.removeListener("error",ie),p.emit("connection",Z,{ip:R.remoteAddress,family:R.remoteFamily,port:R.remotePort,header:V})}})}).on("error",function(R){p.emit("error",R)}).on("listening",function(){p.emit("listening")}).on("close",function(){p.emit("close")}),this._connections=0,this.maxConnections=1/0}a(bg,"Server");JR(bg,KR);bg.prototype.listen=function(){return this._srv.listen.apply(this._srv,arguments),this};bg.prototype.address=function(){return this._srv.address()};bg.prototype.getConnections=function(e){this._srv.getConnections(e)};bg.prototype.close=function(e){return this._srv.close(e),this};bg.prototype.ref=function(){this._srv.ref()};bg.prototype.unref=function(){this._srv.unref()};function QR(e,t){KR.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=[],c;e.on("SERVICE_REQUEST",function(h){if(i===0||s||r.authenticated||h!=="ssh-userauth")return e.disconnect(lG.SERVICE_NOT_AVAILABLE);s=!0,e.serviceAccept(h)}).on("USERAUTH_REQUEST",l);function l(h,w,b,E){if(i===0||c&&(c.username!==h||c.service!==w)||b!=="password"&&b!=="publickey"&&b!=="hostbased"&&b!=="keyboard-interactive"&&b!=="none"||o.length===CRs)return e.disconnect(lG.PROTOCOL_ERROR);if(w!=="ssh-connection")return e.disconnect(lG.SERVICE_NOT_AVAILABLE);e._state.authMethod=b;var A;if(b==="keyboard-interactive"?A=new fve(e,h,w,b,E,d):b==="publickey"?A=new Nct(e,h,w,b,E,d):b==="hostbased"?A=new dIr(e,h,w,b,E,d):b==="password"?A=new fIr(e,h,w,b,E,d):b==="none"&&(A=new Eb(e,h,w,b,d)),c)if(c._initialResponse)c._multistep&&!this._finalResponse&&(c._cleanup&&c._cleanup(),c.emit("abort"));else return o.push(A);c=A,iy(r,"authentication")?r.emit("authentication",c):c.reject()}a(l,"onUSERAUTH_REQUEST");function d(h,w,b,E){c===h&&!r.authenticated&&(w?(e.removeListener("USERAUTH_REQUEST",l),c=void 0,r.authenticated=!0,e.authSuccess(),o=[],r.emit("ready")):(e.authFailure(b,E),o.length&&(c=o.pop(),iy(r,"authentication")?r.emit("authentication",c):c.reject())))}a(d,"onAuthDecide");var f=[];function p(){for(var h;f.length>0&&f[0].type;)h=f.shift(),h.type==="SUCCESS"&&e.requestSuccess(h.buf),h.type==="FAILURE"&&e.requestFailure()}a(p,"sendReplies"),e.on("GLOBAL_REQUEST",function(h,w,b){var E={type:null,buf:null};function A(I,q){E.type=I,E.buf=q,p()}if(a(A,"setReply"),w&&f.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")&&iy(r,"request")&&r.authenticated){var T,R;if(w){var B=!1;T=a(function(I){if(!B){B=!0;var q;h==="tcpip-forward"&&b.bindPort===0&&typeof I=="number"&&(q=Buffer.allocUnsafe(4),SRs(q,I,0)),A("SUCCESS",q)}},"accept"),R=a(function(){B||(B=!0,A("FAILURE"))},"reject")}if(h==="no-more-sessions@openssh.com"){r.noMoreSessions=!0,T&&T();return}r.emit("request",T,R,h,b)}else w&&A("FAILURE")}),e.on("CHANNEL_OPEN",function(h){if(h.type==="session"&&r.noMoreSessions||!r.authenticated){var w=Ict.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,w)}var b=mIr(r),E,A,T=!1;if(b===!1)return e.channelOpenFail(h.sender,Ict.RESOURCE_SHORTAGE);switch(n[b]=!0,A=a(function(){if(!T){T=!0,delete n[b];var R=Ict.ADMINISTRATIVELY_PROHIBITED;return e.channelOpenFail(h.sender,R)}},"reject"),h.type){case"session":iy(r,"session")?(E=a(function(){if(!T)return T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE),new uIr(r,h,b)},"accept"),r.emit("session",E,A)):A();break;case"direct-tcpip":iy(r,"tcpip")?(E=a(function(){if(!T){T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE);var R={type:void 0,incoming:{id:b,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new e_(R,r)}},"accept"),r.emit("tcpip",E,A,h.data)):A();break;case"direct-streamlocal@openssh.com":iy(r,"openssh.streamlocal")?(E=a(function(){if(!T){T=!0,e.channelOpenConfirm(h.sender,b,e_.MAX_WINDOW,e_.PACKET_SIZE);var R={type:void 0,incoming:{id:b,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:h.sender,window:h.window,packetSize:h.packetSize,state:"open"}};return new e_(R,r)}},"accept"),r.emit("openssh.streamlocal",E,A,h.data)):A();break;default:A()}}),e.on("NEWKEYS",function(){++i>1&&r.emit("rekey")}),dve&&this.once("ready",function(){dve.add(e)})}a(QR,"Client");JR(QR,KR);QR.prototype.end=function(){return this._sshstream.disconnect(lG.BY_APPLICATION)};QR.prototype.x11=function(e,t,r){var n={originAddr:e,originPort:t};return Lct(this,"x11",n,r)};QR.prototype.forwardOut=function(e,t,r,n,i){var s={boundAddr:e,boundPort:t,remoteAddr:r,remotePort:n};return Lct(this,"forwarded-tcpip",s,i)};QR.prototype.openssh_forwardOutStreamLocal=function(e,t){var r={socketPath:e};return Lct(this,"forwarded-streamlocal@openssh.com",r,t)};QR.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 uIr(e,t,r){this.subtype=void 0;var n=!1,i=this,s=t.sender,o,c={type:"session",incoming:{id:r,window:e_.MAX_WINDOW,packetSize:e_.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}};function l(p){var h=!1,w,b;if(p.wantReply&&(p.request!=="shell"&&p.request!=="exec"&&p.request!=="subsystem"&&(w=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelSuccess(s)},"accept")),b=a(function(){if(!(h||n||o))return h=!0,e._sshstream.channelFailure(s)},"reject")),n){b&&b();return}switch(p.request){case"env":iy(i,"env")?i.emit("env",w,b,{key:p.key,val:p.val}):b&&b();break;case"pty-req":iy(i,"pty")?i.emit("pty",w,b,{cols:p.cols,rows:p.rows,width:p.width,height:p.height,term:p.term,modes:p.modes}):b&&b();break;case"window-change":iy(i,"window-change")?i.emit("window-change",w,b,{cols:p.cols,rows:p.rows,width:p.width,height:p.height}):b&&b();break;case"x11-req":iy(i,"x11")?i.emit("x11",w,b,{single:p.single,protocol:p.protocol,cookie:p.cookie,screen:p.screen}):b&&b();break;case"signal":iy(i,"signal")?i.emit("signal",w,b,{name:p.signal}):b&&b();break;case"auth-agent-req@openssh.com":iy(i,"auth-agent")?i.emit("auth-agent",w,b):b&&b();break;case"shell":iy(i,"shell")?(w=a(function(){if(!(h||n||o))return h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request,o},"accept"),i.emit("shell",w,b)):b&&b();break;case"exec":iy(i,"exec")?(w=a(function(){if(!(h||n||o))return h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request,o},"accept"),i.emit("exec",w,b,{command:p.command})):b&&b();break;case"subsystem":w=a(function(){if(!(h||n||o))if(h=!0,p.wantReply&&e._sshstream.channelSuccess(s),o=new e_(c,e,{server:!0}),o.subtype=i.subtype=p.request+":"+p.subsystem,p.subsystem==="sftp"){var E=new wRs({server:!0,debug:e._sshstream.debug});return o.pipe(E).pipe(o),E}else return o},"accept"),p.subsystem==="sftp"&&iy(i,"sftp")?i.emit("sftp",w,b):p.subsystem!=="sftp"&&iy(i,"subsystem")?i.emit("subsystem",w,b,{name:p.subsystem}):b&&b();break;default:b&&b()}}a(l,"onREQUEST");function d(){n=!0,i.emit("eof"),i.emit("end")}a(d,"onEOF");function f(){n=!0,i.emit("close")}a(f,"onCLOSE"),e._sshstream.on("CHANNEL_REQUEST:"+r,l).once("CHANNEL_EOF:"+r,d).once("CHANNEL_CLOSE:"+r,f)}a(uIr,"Session");JR(uIr,KR);function Eb(e,t,r,n,i){KR.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,c,l){s._finalResponse||(s._finalResponse=!0,i(s,o,c,l))},this._stream=e}a(Eb,"AuthContext");JR(Eb,KR);Eb.prototype.accept=function(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)};Eb.prototype.reject=function(e,t){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,e,t)};var ERs=/[ \t\r\n]*,[ \t\r\n]*/g;function fve(e,t,r,n,i,s){Eb.call(this,e,t,r,n,s),this._multistep=!0;var o=this;this._cb=void 0,this._onInfoResponse=function(c){if(o._cb){var l=o._cb;o._cb=void 0,l(c)}},this.submethods=i.split(ERs),this.on("abort",function(){o._cb&&o._cb(new Error("Authentication request aborted"))})}a(fve,"KeyboardAuthContext");JR(fve,Eb);fve.prototype._cleanup=function(){this._stream.removeListener("USERAUTH_INFO_RESPONSE",this._onInfoResponse)};fve.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 Nct(e,t,r,n,i,s){Eb.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(Nct,"PKAuthContext");JR(Nct,Eb);Nct.prototype.accept=function(){this.signature?Eb.prototype.accept.call(this):(this._initialResponse=!0,this._stream.authPKOK(this.key.algo,this.key.data))};function dIr(e,t,r,n,i,s){Eb.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(dIr,"HostbasedAuthContext");JR(dIr,Eb);function fIr(e,t,r,n,i,s){Eb.call(this,e,t,r,n,s),this.password=i}a(fIr,"PwdAuthContext");JR(fIr,Eb);function Lct(e,t,r,n){var i=mIr(e),s=e_.MAX_WINDOW,o=e_.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=!0;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_FAILURE:"+i);var f={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:d.sender,window:d.window,packetSize:d.packetSize,state:"open"}};n(void 0,new e_(f,e,{server:!0}))}).once("CHANNEL_OPEN_FAILURE:"+i,function(d){l.removeAllListeners("CHANNEL_OPEN_CONFIRMATION:"+i),delete e._channels[i];var f=new Error("(SSH) Channel open failure: "+d.description);f.reason=d.reason,f.lang=d.lang,n(f)}),t==="forwarded-tcpip"?c=l.forwardedTcpip(i,s,o,r):t==="x11"?c=l.x11(i,s,o,r):t==="forwarded-streamlocal@openssh.com"&&(c=l.openssh_forwardedStreamLocal(i,s,o,r)),c}a(Lct,"openChannel");function mIr(e){if(e._curChan<lIr)return++e._curChan;for(var t=0,r=e._channels;t<lIr;++t)if(!r[t])return t;return!1}a(mIr,"nextChannel");bg.createServer=function(e,t){return new bg(e,t)};bg.KEEPALIVE_INTERVAL=1e3;bg.KEEPALIVE_CLIENT_INTERVAL=15e3;bg.KEEPALIVE_CLIENT_COUNT_MAX=3;qct.exports=bg;qct.exports.IncomingClient=QR});var kct=x((Mkc,AIr)=>{var dG=require("crypto"),ARs=require("net").Socket,xRs=require("dns").lookup,gIr=require("events").EventEmitter,PRs=require("util").inherits,kRs=dG.getHashes(),fG=sve(),DRs=fG.SSH2Stream,Oct=fG.SFTPStream,HL=fG.constants,TRs=HL.BUGS,mG=HL.ALGORITHMS,RRs=HL.EDDSA_SUPPORTED,IRs=fG.utils.parseKey,_Ir=qRr(),YR=Tct(),Mct=tIr(),NRs=iIr(),Fct=pz().readUInt32BE,hIr=Math.pow(2,32)-1,mve=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,yIr=a(function(e){},"DEBUG_NOOP");function Nm(){if(!(this instanceof Nm))return new Nm;gIr.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(Nm,"Client");PRs(Nm,gIr);Nm.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=mG.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=mG.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=mG.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=mG.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=mG.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 c=this.config.debug=typeof e.debug=="function"?e.debug:yIr;if(e.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");var l=this._callbacks=[];this._channels={},this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._curChan=-1,this._remoteVer=void 0;var d;if(this.config.privateKey){if(d=IRs(this.config.privateKey,e.passphrase),d instanceof Error)throw new Error("Cannot parse privateKey: "+d.message);if(Array.isArray(d)&&(d=d[0]),d.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}var f=this._sshstream=new DRs({algorithms:r,debug:c===yIr?void 0:c}),p=this._sock=e.sock||new ARs;this._sock.stderr&&typeof this._sock.stderr.resume=="function"&&this._sock.stderr.resume();var h=this.config.keepaliveInterval,w=this.config.keepaliveCountMax,b=0,E;function A(){if(++b>w){if(clearInterval(E),p.readable){var ee=new Error("Keepalive timeout");ee.level="client-timeout",t.emit("error",ee),p.destroy()}return}p.writable?(l.push(T),f.ping()):clearInterval(E)}a(A,"sendKA");function T(){h>0&&(b=0,clearInterval(E),p.writable&&(E=setInterval(A,h)))}if(a(T,"resetKA"),this._resetKA=T,f.on("USERAUTH_BANNER",function(ee){t.emit("banner",ee)}),p.on("connect",function(){c("DEBUG: Client: Connected"),t.emit("connect"),e.sock||f.pipe(p).pipe(f)}).on("timeout",function(){t.emit("timeout")}).on("error",function(ee){clearTimeout(t._readyTimeout),ee.level="client-socket",t.emit("error",ee)}).on("end",function(){f.unpipe(p),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("end")}).on("close",function(){f.unpipe(p),clearTimeout(t._readyTimeout),clearInterval(E),t.emit("close");var ee=l,X=new Error("No response from server");for(l=t._callbacks=[],n=0;n<ee.length;++n)ee[n](X);var ae=t._channels,ye=Object.keys(ae);for(t._channels={},n=0;n<ye.length;++n){var ue=f.emit("CHANNEL_OPEN_FAILURE:"+ye[n],X),de=f.emit("CHANNEL_CLOSE:"+ye[n]),H;!ue&&!de&&(H=ae[ye[n]])&&typeof H=="function"&&H(X)}}),f.on("drain",function(){t.emit("drain")}).once("header",function(ee){t._remoteVer=ee.versions.software,ee.greeting&&t.emit("greeting",ee.greeting)}).on("continue",function(){t.emit("continue")}).on("error",function(ee){ee.level===void 0?ee.level="protocol":ee.level==="handshake"&&clearTimeout(t._readyTimeout),t.emit("error",ee)}).on("end",function(){p.resume()}),typeof e.hostVerifier=="function"){if(kRs.indexOf(e.hostHash)===-1)throw new Error("Invalid host hash algorithm: "+e.hostHash);var R=e.hostVerifier,B=dG.createHash(e.hostHash);f.once("fingerprint",function(ee,X){B.update(ee);var ae=R(B.digest("hex"),X);ae!==void 0&&X(ae)})}var I,q=null,re=null,K,Z=0,ie=["none"];if(this.config.password!==void 0&&ie.push("password"),d!==void 0&&ie.push("publickey"),this.config.agent!==void 0&&ie.push("agent"),this.config.tryKeyboard&&ie.push("keyboard-interactive"),d!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0&&ie.push("hostbased"),o===void 0){var V=0;o=a(function(X,ae,ye){return V===ie.length?!1:ie[V++]},"authHandler")}var O=!1;function ne(ee){if(O=!0,ee===!1){f.removeListener("USERAUTH_FAILURE",z),f.removeListener("USERAUTH_PK_OK",G);var X=new Error("All configured authentication methods failed");X.level="client-authentication",t.emit("error",X),f.writable&&t.end();return}if(ie.indexOf(ee)===-1)throw new Error("Authentication method not allowed: "+ee);switch(I=ee,I){case"password":f.authPassword(t.config.username,t.config.password);break;case"publickey":f.authPK(t.config.username,d),f.once("USERAUTH_PK_OK",G);break;case"hostbased":let ye=function(ue,de){var H=d.sign(ue);if(H instanceof Error)return H.message="Error while signing data with privateKey: "+H.message,H.level="client-authentication",t.emit("error",H),$();de(H)};var ae=ye;a(ye,"hostbasedCb"),f.authHostbased(t.config.username,d,t.config.localHostname,t.config.localUsername,ye);break;case"agent":Mct(t.config.agent,function(ue,de){if(ue)return ue.level="agent",t.emit("error",ue),K=void 0,$();if(de.length===0)return c("DEBUG: Agent: No keys stored in agent"),K=void 0,$();K=de,Z=0,f.authPK(t.config.username,de[0]),f.once("USERAUTH_PK_OK",G)});break;case"keyboard-interactive":f.authKeyboard(t.config.username),f.on("USERAUTH_INFO_REQUEST",D);break;case"none":f.authNone(t.config.username);break}}a(ne,"doNextAuth");function $(){O=!1;var ee=o(re,q,ne);O||ee===void 0||ne(ee)}a($,"tryNextAuth");function U(){if(I==="agent"){if(Z>=K.length)return;++Z>=K.length?(c("DEBUG: Agent: No more keys left to try"),c("DEBUG: Client: agent auth failed"),K=void 0,$()):(c("DEBUG: Agent: Trying key #"+(Z+1)),f.authPK(t.config.username,K[Z]),f.once("USERAUTH_PK_OK",G))}}a(U,"tryNextAgentKey");function D(ee,X,ae,ye){var ue=Array.isArray(ye)?ye.length:0;if(ue===0)return c("DEBUG: Client: Sending automatic USERAUTH_INFO_RESPONSE"),f.authInfoRes();t.emit("keyboard-interactive",ee,X,ae,ye,function(de){f.authInfoRes(de)})}a(D,"onUSERAUTH_INFO_REQUEST");function G(){if(I==="agent"){var ee=K[Z],X=Fct(ee,0),ae=ee.toString("ascii",4,4+X),ye=ae.slice(4);switch(ae){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":break;default:if(RRs&&ae==="ssh-ed25519")break;return c("DEBUG: Agent: Skipping unsupported key type: "+ae),U()}f.authPK(t.config.username,ee,function(ue,de){Mct(t.config.agent,ee,ye,ue,function(H,ke){if(H)H.level="agent",t.emit("error",H);else{var se=Fct(ke,0);if(4+se+4<ke.length){var Y=ke.toString("ascii",4,4+se);if(Y!==ae)H=new Error("Agent key/signature type mismatch"),H.level="agent",t.emit("error",H);else return de(ke.slice(4+se+4))}}U()})})}else I==="publickey"&&f.authPK(t.config.username,d,function(ue,de){var H=d.sign(ue);if(H instanceof Error)return H.message="Error while signing data with privateKey: "+H.message,H.level="client-authentication",t.emit("error",H),$();de(H)})}a(G,"onUSERAUTH_PK_OK");function z(ee,X){if(f.removeListener("USERAUTH_PK_OK",G),f.removeListener("USERAUTH_INFO_REQUEST",D),I==="agent")return c("DEBUG: Client: Agent key #"+(Z+1)+" failed"),U();c("DEBUG: Client: "+I+" auth failed"),q=X,re=ee,$()}if(a(z,"onUSERAUTH_FAILURE"),f.once("USERAUTH_SUCCESS",function(){f.removeListener("USERAUTH_FAILURE",z),f.removeListener("USERAUTH_INFO_REQUEST",D),T(),clearTimeout(t._readyTimeout),t.emit("ready")}).on("USERAUTH_FAILURE",z),f.once("ready",function(){f.service("ssh-userauth"),f.once("SERVICE_ACCEPT",function(ee){ee==="ssh-userauth"&&$()})}),f.on("CHANNEL_OPEN",function(ee){ORs(t,ee)}),f.on("REQUEST_SUCCESS",function(ee){l.length&&l.shift()(!1,ee)}).on("REQUEST_FAILURE",function(){l.length&&l.shift()(!0)}),f.on("GLOBAL_REQUEST",function(ee,X,ae){X&&f.requestFailure()}),e.sock)F(),f.pipe(p).pipe(f);else{let ee=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 Q=ee;a(ee,"doConnect");var L=this.config.host,N=this.config.forceIPv4,W=this.config.forceIPv6;c("DEBUG: Client: Trying "+L+" on port "+this.config.port+" ..."),!N&&!W||N&&W?ee():xRs(L,N?4:6,function(X,ae,ye){if(X){var ue=new Error("Error while looking up "+(N?"IPv4":"IPv6")+" address for host "+L+": "+X);clearTimeout(t._readyTimeout),ue.level="client-dns",t.emit("error",ue),t.emit("close");return}L=ae,ee()})}function F(){t.config.readyTimeout>0&&(t._readyTimeout=setTimeout(function(){var ee=new Error("Timed out while waiting for handshake");ee.level="client-timeout",t.emit("error",ee),p.destroy()},t.config.readyTimeout))}a(F,"startTimeout")};Nm.prototype.end=function(){return this._sock&&this._sock.writable&&this._sshstream&&this._sshstream.writable?this._sshstream.disconnect():!1};Nm.prototype.destroy=function(){this._sock&&this._sock.destroy()};Nm.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 gz(this,"session",i,function(s,o){if(s)return r(s);var c=[];function l(d){if(d)return o.close(),r(d);c.length&&c.shift()()}a(l,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&c.push(function(){SIr(o,l)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&CIr(o,t.env),(typeof t.pty=="object"&&t.pty!==null||t.pty===!0)&&c.push(function(){bIr(o,t.pty,l)}),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&c.push(function(){wIr(o,t.x11,l)})),c.push(function(){qRs(o,e,t,r)}),c.shift()()})};Nm.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),gz(this,"session",function(i,s){if(i)return r(i);var o=[];function c(l){if(l)return s.close(),r(l);o.length&&o.shift()()}a(c,"reqCb"),(n.config.allowAgentFwd===!0||t&&t.agentForward===!0&&n.config.agent!==void 0)&&o.push(function(){SIr(s,c)}),e!==!1&&o.push(function(){bIr(s,e,c)}),typeof t=="object"&&t!==null&&(typeof t.env=="object"&&t.env!==null&&CIr(s,t.env),(typeof t.x11=="object"&&t.x11!==null||t.x11==="number"||t.x11===!0)&&o.push(function(){wIr(s,t.x11,c)})),o.push(function(){LRs(s,r)}),o.shift()()})};Nm.prototype.subsys=function(e,t){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");return gz(this,"session",function(r,n){if(r)return t(r);EIr(n,e,function(i,s){if(i)return t(i);t(void 0,s)})})};Nm.prototype.sftp=function(e){if(!this._sock||!this._sock.writable||!this._sshstream||!this._sshstream.writable)throw new Error("Not connected");var t=this;return gz(this,"session",function(r,n){if(r)return e(r);EIr(n,"sftp",function(i,s){if(i)return e(i);var o=t._sshstream._state.incoming.identRaw,c={debug:t.config.debug},l=new Oct(c,o);function d(h){l.removeListener("ready",f),s.removeListener("exit",p),e(h)}a(d,"onError");function f(){l.removeListener("error",d),s.removeListener("exit",p),e(void 0,new NRs(l))}a(f,"onReady");function p(h,w){l.removeListener("ready",f),l.removeListener("error",d);var b;typeof h=="number"?b="Received exit code "+h+" while establishing SFTP session":b="Received signal "+w+" while establishing SFTP session";var E=new Error(b);E.code=h,E.signal=w,e(E)}a(p,"onExit"),l.once("error",d).once("ready",f).once("close",function(){s.end()}),s.once("exit",p),l.pipe(s).pipe(l)})})};Nm.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 c=t;t===0&&o&&o.length>=4&&(c=Fct(o,0),n._sshstream.remoteBugs&TRs.DYN_RPORT_BUG||(t=c)),n._forwarding[e+":"+t]=c,r(void 0,c)}),this._sshstream.tcpipForward(e,t,i)};Nm.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)};Nm.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 gz(this,"direct-tcpip",s,i)};Nm.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&&mve.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)};Nm.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&&mve.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)};Nm.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&&mve.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)};Nm.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&&mve.test(this._remoteVer)){var r={socketPath:e};return gz(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 gz(e,t,r,n){var i=vIr(e),s=YR.MAX_WINDOW,o=YR.PACKET_SIZE,c=!0;if(i===!1)return n(new Error("No free channels available"));typeof r=="function"&&(n=r,r={}),e._channels[i]=n;var l=e._sshstream;return l.once("CHANNEL_OPEN_CONFIRMATION:"+i,d).once("CHANNEL_OPEN_FAILURE:"+i,f).once("CHANNEL_CLOSE:"+i,f),t==="session"?c=l.session(i,s,o):t==="direct-tcpip"?c=l.directTcpip(i,s,o,r):t==="direct-streamlocal@openssh.com"&&(c=l.openssh_directStreamLocal(i,s,o,r)),c;function d(p){l.removeListener("CHANNEL_OPEN_FAILURE:"+i,f),l.removeListener("CHANNEL_CLOSE:"+i,f);var h={type:t,incoming:{id:i,window:s,packetSize:o,state:"open"},outgoing:{id:p.sender,window:p.window,packetSize:p.packetSize,state:"open"}};n(void 0,new YR(h,e))}a(d,"onSuccess");function f(p){l.removeListener("CHANNEL_OPEN_CONFIRMATION:"+i,d),l.removeListener("CHANNEL_OPEN_FAILURE:"+i,f),l.removeListener("CHANNEL_CLOSE:"+i,f),delete e._channels[i];var h;p instanceof Error?h=p:typeof p=="object"&&p!==null?(h=new Error("(SSH) Channel open failure: "+p.description),h.reason=p.reason,h.lang=p.lang):(h=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),h.reason=h.lang=""),n(h)}a(f,"onFailure")}a(gz,"openChannel");function vIr(e){if(e._curChan<hIr)return++e._curChan;for(var t=0,r=e._channels;t<hIr;++t)if(!r[t])return t;return!1}a(vIr,"nextChannel");function wIr(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=MRs());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(wIr,"reqX11");function bIr(e,t,r){var n=24,i=80,s=640,o=480,c="vt100",l=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"&&(c=t.term),typeof t.modes=="object"&&(l=t.modes));var d=typeof r=="function";return e.outgoing.state!=="open"?(d&&r(new Error("Channel is not open")),!0):(d&&e._callbacks.push(function(f){if(f)return r(f!==!0?f:new Error("Unable to request a pseudo-terminal"));r()}),e._client._sshstream.pty(e.outgoing.id,n,i,o,s,c,l,d))}a(bIr,"reqPty");function SIr(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(SIr,"reqAgentFwd");function LRs(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(LRs,"reqShell");function qRs(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(qRs,"reqExec");function CIr(e,t){if(e.outgoing.state!=="open")return!0;for(var r=!0,n=Object.keys(t||{}),i,s,o=0,c=n.length;o<c;++o)i=n[o],s=t[i],r=e._client._sshstream.env(e.outgoing.id,i,s,!1);return r}a(CIr,"reqEnv");function EIr(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(EIr,"reqSubsystem");function ORs(e,t){var r=!1,n;function i(){var c={type:t.type,incoming:{id:r,window:YR.MAX_WINDOW,packetSize:YR.PACKET_SIZE,state:"open"},outgoing:{id:t.sender,window:t.window,packetSize:t.packetSize,state:"open"}},l=new YR(c,e);return e._sshstream.channelOpenConfirm(t.sender,r,YR.MAX_WINDOW,YR.PACKET_SIZE),l}a(i,"accept");function s(){n===void 0&&(r===!1?n=HL.CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE:n=HL.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=HL.CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED,e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unexpected channel open for: "+t.type)):(r=vIr(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):Mct(e.config.agent,i,s))}else e.config.debug("DEBUG: Client: Automatic rejection of incoming channel open: unsupported type: "+t.type),n=HL.CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE,s()}a(ORs,"onCHANNEL_OPEN");var MRs=function(){if(typeof dG.randomFillSync=="function"){var e=Buffer.alloc(16);return a(function(){return dG.randomFillSync(e,0,16),e.toString("hex")},"randomCookie")}else return a(function(){return dG.randomBytes(16).toString("hex")},"randomCookie")}();Nm.Client=Nm;Nm.Server=pIr();Nm.utils=fG.utils;Nm.SFTP_STATUS_CODE=Oct.STATUS_CODE;Nm.SFTP_OPEN_MODE=Oct.OPEN_MODE;Nm.HTTPAgent=_Ir.SSHTTPAgent;Nm.HTTPSAgent=_Ir.SSHTTPSAgent;AIr.exports=Nm});var PIr=x((Fkc,xIr)=>{var FRs=kct().Client,zRs=require("http");xIr.exports=function(e){var t=new FRs,r=new zRs.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 zct=x((zkc,kIr)=>{kIr.exports=require("stream")});var IIr=x((jkc,RIr)=>{"use strict";function DIr(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(DIr,"ownKeys");function jRs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?DIr(Object(r),!0).forEach(function(n){BRs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DIr(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a(jRs,"_objectSpread");function BRs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(BRs,"_defineProperty");function URs(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}a(URs,"_classCallCheck");function TIr(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(TIr,"_defineProperties");function GRs(e,t,r){return t&&TIr(e.prototype,t),r&&TIr(e,r),e}a(GRs,"_createClass");var $Rs=require("buffer"),pve=$Rs.Buffer,HRs=require("util"),jct=HRs.inspect,VRs=jct&&jct.custom||"inspect";function WRs(e,t,r){pve.prototype.copy.call(e,t,r)}a(WRs,"copyBuffer");RIr.exports=function(){function e(){URs(this,e),this.head=null,this.tail=null,this.length=0}return a(e,"BufferList"),GRs(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 pve.alloc(0);for(var n=pve.allocUnsafe(r>>>0),i=this.head,s=0;i;)WRs(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,c=r>o.length?o.length:r;if(c===o.length?s+=o:s+=o.slice(0,r),r-=c,r===0){c===o.length?(++i,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(c));break}++i}return this.length-=i,s},"_getString")},{key:"_getBuffer",value:a(function(r){var n=pve.allocUnsafe(r),i=this.head,s=1;for(i.data.copy(n),r-=i.data.length;i=i.next;){var o=i.data,c=r>o.length?o.length:r;if(o.copy(n,n.length-r,0,c),r-=c,r===0){c===o.length?(++s,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(c));break}++s}return this.length-=s,n},"_getBuffer")},{key:VRs,value:a(function(r,n){return jct(this,jRs({},n,{depth:0,customInspect:!1}))},"value")}]),e}()});var Uct=x((Bkc,LIr)=>{"use strict";function XRs(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(Bct,this,e)):process.nextTick(Bct,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(gve,r):(r._writableState.errorEmitted=!0,process.nextTick(NIr,r,s)):process.nextTick(NIr,r,s):t?(process.nextTick(gve,r),t(s)):process.nextTick(gve,r)}),this)}a(XRs,"destroy");function NIr(e,t){Bct(e,t),gve(e)}a(NIr,"emitErrorAndCloseNT");function gve(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}a(gve,"emitCloseNT");function KRs(){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(KRs,"undestroy");function Bct(e,t){e.emit("error",t)}a(Bct,"emitErrorNT");function JRs(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}a(JRs,"errorOrDestroy");LIr.exports={destroy:XRs,undestroy:KRs,errorOrDestroy:JRs}});var ZR=x((Ukc,MIr)=>{"use strict";var qIr={};function hC(e,t,r){r||(r=Error);function n(s,o,c){return typeof t=="string"?t:t(s,o,c)}a(n,"getMessage");class i extends r{constructor(o,c,l){super(n(o,c,l))}}a(i,"NodeError"),i.prototype.name=r.name,i.prototype.code=e,qIr[e]=i}a(hC,"createErrorType");function OIr(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(OIr,"oneOf");function QRs(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}a(QRs,"startsWith");function YRs(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}a(YRs,"endsWith");function ZRs(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}a(ZRs,"includes");hC("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);hC("ERR_INVALID_ARG_TYPE",function(e,t,r){let n;typeof t=="string"&&QRs(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";let i;if(YRs(e," argument"))i=`The ${e} ${n} ${OIr(t,"type")}`;else{let s=ZRs(e,".")?"property":"argument";i=`The "${e}" ${s} ${n} ${OIr(t,"type")}`}return i+=`. Received type ${typeof r}`,i},TypeError);hC("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");hC("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});hC("ERR_STREAM_PREMATURE_CLOSE","Premature close");hC("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});hC("ERR_MULTIPLE_CALLBACK","Callback called multiple times");hC("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");hC("ERR_STREAM_WRITE_AFTER_END","write after end");hC("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);hC("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);hC("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");MIr.exports.codes=qIr});var Gct=x((Gkc,FIr)=>{"use strict";var eIs=ZR().codes.ERR_INVALID_OPT_VALUE;function tIs(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}a(tIs,"highWaterMarkFrom");function rIs(e,t,r,n){var i=tIs(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new eIs(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}a(rIs,"getHighWaterMark");FIr.exports={getHighWaterMark:rIs}});var _ve=x(($kc,zIr)=>{zIr.exports=require("util").deprecate});var Vct=x((Hkc,HIr)=>{"use strict";HIr.exports=$p;function jIr(e){var t=this;this.next=null,this.entry=null,this.finish=function(){DIs(t,e)}}a(jIr,"CorkedRequest");var _z;$p.WritableState=pG;var nIs={deprecate:_ve()},BIr=zct(),hve=require("buffer").Buffer,iIs=global.Uint8Array||function(){};function aIs(e){return hve.from(e)}a(aIs,"_uint8ArrayToBuffer");function sIs(e){return hve.isBuffer(e)||e instanceof iIs}a(sIs,"_isUint8Array");var $ct=Uct(),oIs=Gct(),cIs=oIs.getHighWaterMark,eI=ZR().codes,lIs=eI.ERR_INVALID_ARG_TYPE,uIs=eI.ERR_METHOD_NOT_IMPLEMENTED,dIs=eI.ERR_MULTIPLE_CALLBACK,fIs=eI.ERR_STREAM_CANNOT_PIPE,mIs=eI.ERR_STREAM_DESTROYED,pIs=eI.ERR_STREAM_NULL_VALUES,gIs=eI.ERR_STREAM_WRITE_AFTER_END,_Is=eI.ERR_UNKNOWN_ENCODING,hz=$ct.errorOrDestroy;Wg()($p,BIr);function hIs(){}a(hIs,"nop");function pG(e,t,r){_z=_z||VL(),e=e||{},typeof r!="boolean"&&(r=t instanceof _z),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=cIs(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){EIs(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 jIr(this)}a(pG,"WritableState");pG.prototype.getBuffer=a(function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r},"getBuffer");(function(){try{Object.defineProperty(pG.prototype,"buffer",{get:nIs.deprecate(a(function(){return this.getBuffer()},"writableStateBufferGetter"),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}})();var yve;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(yve=Function.prototype[Symbol.hasInstance],Object.defineProperty($p,Symbol.hasInstance,{value:a(function(t){return yve.call(this,t)?!0:this!==$p?!1:t&&t._writableState instanceof pG},"value")})):yve=a(function(t){return t instanceof this},"realHasInstance");function $p(e){_z=_z||VL();var t=this instanceof _z;if(!t&&!yve.call($p,this))return new $p(e);this._writableState=new pG(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)),BIr.call(this)}a($p,"Writable");$p.prototype.pipe=function(){hz(this,new fIs)};function yIs(e,t){var r=new gIs;hz(e,r),process.nextTick(t,r)}a(yIs,"writeAfterEnd");function vIs(e,t,r,n){var i;return r===null?i=new pIs:typeof r!="string"&&!t.objectMode&&(i=new lIs("chunk",["string","Buffer"],r)),i?(hz(e,i),process.nextTick(n,i),!1):!0}a(vIs,"validChunk");$p.prototype.write=function(e,t,r){var n=this._writableState,i=!1,s=!n.objectMode&&sIs(e);return s&&!hve.isBuffer(e)&&(e=aIs(e)),typeof t=="function"&&(r=t,t=null),s?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=hIs),n.ending?yIs(this,r):(s||vIs(this,n,e,r))&&(n.pendingcb++,i=bIs(this,n,s,e,t,r)),i};$p.prototype.cork=function(){this._writableState.corked++};$p.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&GIr(this,e))};$p.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 _Is(t);return this._writableState.defaultEncoding=t,this},"setDefaultEncoding");Object.defineProperty($p.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});function wIs(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=hve.from(t,r)),t}a(wIs,"decodeChunk");Object.defineProperty($p.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});function bIs(e,t,r,n,i,s){if(!r){var o=wIs(t,n,i);n!==o&&(r=!0,i="buffer",n=o)}var c=t.objectMode?1:n.length;t.length+=c;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var d=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:s,next:null},d?d.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Hct(e,t,!1,c,n,i,s);return l}a(bIs,"writeOrBuffer");function Hct(e,t,r,n,i,s,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new mIs("write")):r?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}a(Hct,"doWrite");function SIs(e,t,r,n,i){--t.pendingcb,r?(process.nextTick(i,n),process.nextTick(gG,e,t),e._writableState.errorEmitted=!0,hz(e,n)):(i(n),e._writableState.errorEmitted=!0,hz(e,n),gG(e,t))}a(SIs,"onwriteError");function CIs(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}a(CIs,"onwriteStateUpdate");function EIs(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(typeof i!="function")throw new dIs;if(CIs(r),t)SIs(e,r,n,t,i);else{var s=$Ir(r)||e.destroyed;!s&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&GIr(e,r),n?process.nextTick(UIr,e,r,s,i):UIr(e,r,s,i)}}a(EIs,"onwrite");function UIr(e,t,r,n){r||AIs(e,t),t.pendingcb--,n(),gG(e,t)}a(UIr,"afterWrite");function AIs(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}a(AIs,"onwriteDrain");function GIr(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,c=!0;r;)i[o]=r,r.isBuf||(c=!1),r=r.next,o+=1;i.allBuffers=c,Hct(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 jIr(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,d=r.encoding,f=r.callback,p=t.objectMode?1:l.length;if(Hct(e,t,!1,p,l,d,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}a(GIr,"clearBuffer");$p.prototype._write=function(e,t,r){r(new uIs("_write()"))};$p.prototype._writev=null;$p.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||kIs(this,n,r),this};Object.defineProperty($p.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function $Ir(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}a($Ir,"needFinish");function xIs(e,t){e._final(function(r){t.pendingcb--,r&&hz(e,r),t.prefinished=!0,e.emit("prefinish"),gG(e,t)})}a(xIs,"callFinal");function PIs(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,process.nextTick(xIs,e,t)):(t.prefinished=!0,e.emit("prefinish")))}a(PIs,"prefinish");function gG(e,t){var r=$Ir(t);if(r&&(PIs(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(gG,"finishMaybe");function kIs(e,t,r){t.ending=!0,gG(e,t),r&&(t.finished?process.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}a(kIs,"endWritable");function DIs(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(DIs,"onCorkedFinish");Object.defineProperty($p.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")});$p.prototype.destroy=$ct.destroy;$p.prototype._undestroy=$ct.undestroy;$p.prototype._destroy=function(e,t){t(e)}});var VL=x((Vkc,WIr)=>{"use strict";var TIs=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};WIr.exports=ox;var VIr=Kct(),Wct=Vct();Wg()(ox,VIr);for(Xct=TIs(Wct.prototype),vve=0;vve<Xct.length;vve++)wve=Xct[vve],ox.prototype[wve]||(ox.prototype[wve]=Wct.prototype[wve]);var Xct,wve,vve;function ox(e){if(!(this instanceof ox))return new ox(e);VIr.call(this,e),Wct.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",RIs)))}a(ox,"Duplex");Object.defineProperty(ox.prototype,"writableHighWaterMark",{enumerable:!1,get:a(function(){return this._writableState.highWaterMark},"get")});Object.defineProperty(ox.prototype,"writableBuffer",{enumerable:!1,get:a(function(){return this._writableState&&this._writableState.getBuffer()},"get")});Object.defineProperty(ox.prototype,"writableLength",{enumerable:!1,get:a(function(){return this._writableState.length},"get")});function RIs(){this._writableState.ended||process.nextTick(IIs,this)}a(RIs,"onend");function IIs(e){e.end()}a(IIs,"onEndNT");Object.defineProperty(ox.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 bve=x((Wkc,JIr)=>{"use strict";var XIr=ZR().codes.ERR_STREAM_PREMATURE_CLOSE;function NIs(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(NIs,"once");function LIs(){}a(LIs,"noop");function qIs(e){return e.setHeader&&typeof e.abort=="function"}a(qIs,"isRequest");function KIr(e,t,r){if(typeof t=="function")return KIr(e,null,t);t||(t={}),r=NIs(r||LIs);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=a(function(){e.writable||c()},"onlegacyfinish"),o=e._writableState&&e._writableState.finished,c=a(function(){i=!1,o=!0,n||r.call(e)},"onfinish"),l=e._readableState&&e._readableState.endEmitted,d=a(function(){n=!1,l=!0,i||r.call(e)},"onend"),f=a(function(b){r.call(e,b)},"onerror"),p=a(function(){var b;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(b=new XIr),r.call(e,b);if(i&&!o)return(!e._writableState||!e._writableState.ended)&&(b=new XIr),r.call(e,b)},"onclose"),h=a(function(){e.req.on("finish",c)},"onrequest");return qIs(e)?(e.on("complete",c),e.on("abort",p),e.req?h():e.on("request",h)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",d),e.on("finish",c),t.error!==!1&&e.on("error",f),e.on("close",p),function(){e.removeListener("complete",c),e.removeListener("abort",p),e.removeListener("request",h),e.req&&e.req.removeListener("finish",c),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",c),e.removeListener("end",d),e.removeListener("error",f),e.removeListener("close",p)}}a(KIr,"eos");JIr.exports=KIr});var YIr=x((Xkc,QIr)=>{"use strict";var Sve;function tI(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(tI,"_defineProperty");var OIs=bve(),rI=Symbol("lastResolve"),WL=Symbol("lastReject"),_G=Symbol("error"),Cve=Symbol("ended"),XL=Symbol("lastPromise"),Jct=Symbol("handlePromise"),KL=Symbol("stream");function nI(e,t){return{value:e,done:t}}a(nI,"createIterResult");function MIs(e){var t=e[rI];if(t!==null){var r=e[KL].read();r!==null&&(e[XL]=null,e[rI]=null,e[WL]=null,t(nI(r,!1)))}}a(MIs,"readAndResolve");function FIs(e){process.nextTick(MIs,e)}a(FIs,"onReadable");function zIs(e,t){return function(r,n){e.then(function(){if(t[Cve]){r(nI(void 0,!0));return}t[Jct](r,n)},n)}}a(zIs,"wrapForNext");var jIs=Object.getPrototypeOf(function(){}),BIs=Object.setPrototypeOf((Sve={get stream(){return this[KL]},next:a(function(){var t=this,r=this[_G];if(r!==null)return Promise.reject(r);if(this[Cve])return Promise.resolve(nI(void 0,!0));if(this[KL].destroyed)return new Promise(function(o,c){process.nextTick(function(){t[_G]?c(t[_G]):o(nI(void 0,!0))})});var n=this[XL],i;if(n)i=new Promise(zIs(n,this));else{var s=this[KL].read();if(s!==null)return Promise.resolve(nI(s,!1));i=new Promise(this[Jct])}return this[XL]=i,i},"next")},tI(Sve,Symbol.asyncIterator,function(){return this}),tI(Sve,"return",a(function(){var t=this;return new Promise(function(r,n){t[KL].destroy(null,function(i){if(i){n(i);return}r(nI(void 0,!0))})})},"_return")),Sve),jIs),UIs=a(function(t){var r,n=Object.create(BIs,(r={},tI(r,KL,{value:t,writable:!0}),tI(r,rI,{value:null,writable:!0}),tI(r,WL,{value:null,writable:!0}),tI(r,_G,{value:null,writable:!0}),tI(r,Cve,{value:t._readableState.endEmitted,writable:!0}),tI(r,Jct,{value:a(function(s,o){var c=n[KL].read();c?(n[XL]=null,n[rI]=null,n[WL]=null,s(nI(c,!1))):(n[rI]=s,n[WL]=o)},"value"),writable:!0}),r));return n[XL]=null,OIs(t,function(i){if(i&&i.code!=="ERR_STREAM_PREMATURE_CLOSE"){var s=n[WL];s!==null&&(n[XL]=null,n[rI]=null,n[WL]=null,s(i)),n[_G]=i;return}var o=n[rI];o!==null&&(n[XL]=null,n[rI]=null,n[WL]=null,o(nI(void 0,!0))),n[Cve]=!0}),t.on("readable",FIs.bind(null,n)),n},"createReadableStreamAsyncIterator");QIr.exports=UIs});var r2r=x((Kkc,t2r)=>{"use strict";function ZIr(e,t,r,n,i,s,o){try{var c=e[s](o),l=c.value}catch(d){r(d);return}c.done?t(l):Promise.resolve(l).then(n,i)}a(ZIr,"asyncGeneratorStep");function GIs(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function o(l){ZIr(s,n,i,o,c,"next",l)}a(o,"_next");function c(l){ZIr(s,n,i,o,c,"throw",l)}a(c,"_throw"),o(void 0)})}}a(GIs,"_asyncToGenerator");function e2r(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(e2r,"ownKeys");function $Is(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?e2r(Object(r),!0).forEach(function(n){HIs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e2r(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}a($Is,"_objectSpread");function HIs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}a(HIs,"_defineProperty");var VIs=ZR().codes.ERR_INVALID_ARG_TYPE;function WIs(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 VIs("iterable",["Iterable"],t);var i=new e($Is({objectMode:!0},r)),s=!1;i._read=function(){s||(s=!0,o())};function o(){return c.apply(this,arguments)}a(o,"next");function c(){return c=GIs(function*(){try{var l=yield n.next(),d=l.value,f=l.done;f?i.push(null):i.push(yield d)?o():s=!1}catch(p){i.destroy(p)}}),c.apply(this,arguments)}return a(c,"_next2"),i}a(WIs,"from");t2r.exports=WIs});var Kct=x((Qkc,f2r)=>{"use strict";f2r.exports=ef;var yz;ef.ReadableState=i2r;var Jkc=require("events").EventEmitter,n2r=a(function(t,r){return t.listeners(r).length},"EElistenerCount"),hG=zct(),Eve=require("buffer").Buffer,XIs=global.Uint8Array||function(){};function KIs(e){return Eve.from(e)}a(KIs,"_uint8ArrayToBuffer");function JIs(e){return Eve.isBuffer(e)||e instanceof XIs}a(JIs,"_isUint8Array");var Qct=require("util"),fd;Qct&&Qct.debuglog?fd=Qct.debuglog("stream"):fd=a(function(){},"debug");var QIs=IIr(),Yct=Uct(),YIs=Gct(),ZIs=YIs.getHighWaterMark,Ave=ZR().codes,e2s=Ave.ERR_INVALID_ARG_TYPE,t2s=Ave.ERR_STREAM_PUSH_AFTER_EOF,r2s=Ave.ERR_METHOD_NOT_IMPLEMENTED,n2s=Ave.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,vz,Zct,elt;Wg()(ef,hG);var yG=Yct.errorOrDestroy,tlt=["error","close","destroy","pause","resume"];function i2s(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(i2s,"prependListener");function i2r(e,t,r){yz=yz||VL(),e=e||{},typeof r!="boolean"&&(r=t instanceof yz),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=ZIs(this,e,"readableHighWaterMark",r),this.buffer=new QIs,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&&(vz||(vz=require("string_decoder/").StringDecoder),this.decoder=new vz(e.encoding),this.encoding=e.encoding)}a(i2r,"ReadableState");function ef(e){if(yz=yz||VL(),!(this instanceof ef))return new ef(e);var t=this instanceof yz;this._readableState=new i2r(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),hG.call(this)}a(ef,"Readable");Object.defineProperty(ef.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")});ef.prototype.destroy=Yct.destroy;ef.prototype._undestroy=Yct.undestroy;ef.prototype._destroy=function(e,t){t(e)};ef.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=Eve.from(e,t),t=""),n=!0),a2r(this,e,t,!1,n)};ef.prototype.unshift=function(e){return a2r(this,e,null,!0,!1)};function a2r(e,t,r,n,i){fd("readableAddChunk",t);var s=e._readableState;if(t===null)s.reading=!1,o2s(e,s);else{var o;if(i||(o=a2s(s,t)),o)yG(e,o);else if(s.objectMode||t&&t.length>0)if(typeof t!="string"&&!s.objectMode&&Object.getPrototypeOf(t)!==Eve.prototype&&(t=KIs(t)),n)s.endEmitted?yG(e,new n2s):rlt(e,s,t,!0);else if(s.ended)yG(e,new t2s);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(t=s.decoder.write(t),s.objectMode||t.length!==0?rlt(e,s,t,!1):nlt(e,s)):rlt(e,s,t,!1)}else n||(s.reading=!1,nlt(e,s))}return!s.ended&&(s.length<s.highWaterMark||s.length===0)}a(a2r,"readableAddChunk");function rlt(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&&xve(e)),nlt(e,t)}a(rlt,"addChunk");function a2s(e,t){var r;return!JIs(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new e2s("chunk",["string","Buffer","Uint8Array"],t)),r}a(a2s,"chunkInvalid");ef.prototype.isPaused=function(){return this._readableState.flowing===!1};ef.prototype.setEncoding=function(e){vz||(vz=require("string_decoder/").StringDecoder);var t=new vz(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 s2r=1073741824;function s2s(e){return e>=s2r?e=s2r:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}a(s2s,"computeNewHighWaterMark");function o2r(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=s2s(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}a(o2r,"howMuchToRead");ef.prototype.read=function(e){fd("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 fd("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?alt(this):xve(this),null;if(e=o2r(e,t),e===0&&t.ended)return t.length===0&&alt(this),null;var n=t.needReadable;fd("need readable",n),(t.length===0||t.length-e<t.highWaterMark)&&(n=!0,fd("length less than watermark",n)),t.ended||t.reading?(n=!1,fd("reading or ended",n)):n&&(fd("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=o2r(r,t)));var i;return e>0?i=u2r(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&&alt(this)),i!==null&&this.emit("data",i),i};function o2s(e,t){if(fd("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?xve(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,c2r(e)))}}a(o2s,"onEofChunk");function xve(e){var t=e._readableState;fd("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(fd("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(c2r,e))}a(xve,"emitReadable");function c2r(e){var t=e._readableState;fd("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,ilt(e)}a(c2r,"emitReadable_");function nlt(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(c2s,e,t))}a(nlt,"maybeReadMore");function c2s(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(fd("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}a(c2s,"maybeReadMore_");ef.prototype._read=function(e){yG(this,new r2s("_read()"))};ef.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,fd("pipe count=%d opts=%j",n.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,s=i?c:E;n.endEmitted?process.nextTick(s):r.once("end",s),e.on("unpipe",o);function o(A,T){fd("onunpipe"),A===r&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,f())}a(o,"onunpipe");function c(){fd("onend"),e.end()}a(c,"onend");var l=l2s(r);e.on("drain",l);var d=!1;function f(){fd("cleanup"),e.removeListener("close",w),e.removeListener("finish",b),e.removeListener("drain",l),e.removeListener("error",h),e.removeListener("unpipe",o),r.removeListener("end",c),r.removeListener("end",E),r.removeListener("data",p),d=!0,n.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&l()}a(f,"cleanup"),r.on("data",p);function p(A){fd("ondata");var T=e.write(A);fd("dest.write",T),T===!1&&((n.pipesCount===1&&n.pipes===e||n.pipesCount>1&&d2r(n.pipes,e)!==-1)&&!d&&(fd("false write response, pause",n.awaitDrain),n.awaitDrain++),r.pause())}a(p,"ondata");function h(A){fd("onerror",A),E(),e.removeListener("error",h),n2r(e,"error")===0&&yG(e,A)}a(h,"onerror"),i2s(e,"error",h);function w(){e.removeListener("finish",b),E()}a(w,"onclose"),e.once("close",w);function b(){fd("onfinish"),e.removeListener("close",w),E()}a(b,"onfinish"),e.once("finish",b);function E(){fd("unpipe"),r.unpipe(e)}return a(E,"unpipe"),e.emit("pipe",r),n.flowing||(fd("pipe resume"),r.resume()),e};function l2s(e){return a(function(){var r=e._readableState;fd("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&n2r(e,"data")&&(r.flowing=!0,ilt(e))},"pipeOnDrainFunctionResult")}a(l2s,"pipeOnDrain");ef.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=d2r(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)};ef.prototype.on=function(e,t){var r=hG.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,fd("on readable",n.length,n.reading),n.length?xve(this):n.reading||process.nextTick(u2s,this)),r};ef.prototype.addListener=ef.prototype.on;ef.prototype.removeListener=function(e,t){var r=hG.prototype.removeListener.call(this,e,t);return e==="readable"&&process.nextTick(l2r,this),r};ef.prototype.removeAllListeners=function(e){var t=hG.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&process.nextTick(l2r,this),t};function l2r(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(l2r,"updateReadableListening");function u2s(e){fd("readable nexttick read 0"),e.read(0)}a(u2s,"nReadingNextTick");ef.prototype.resume=function(){var e=this._readableState;return e.flowing||(fd("resume"),e.flowing=!e.readableListening,d2s(this,e)),e.paused=!1,this};function d2s(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(f2s,e,t))}a(d2s,"resume");function f2s(e,t){fd("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ilt(e),t.flowing&&!t.reading&&e.read(0)}a(f2s,"resume_");ef.prototype.pause=function(){return fd("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(fd("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function ilt(e){var t=e._readableState;for(fd("flow",t.flowing);t.flowing&&e.read()!==null;);}a(ilt,"flow");ef.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;e.on("end",function(){if(fd("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(fd("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var c=t.push(o);c||(n=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=a(function(c){return a(function(){return e[c].apply(e,arguments)},"methodWrapReturnFunction")},"methodWrap")(i));for(var s=0;s<tlt.length;s++)e.on(tlt[s],this.emit.bind(this,tlt[s]));return this._read=function(o){fd("wrapped _read",o),n&&(n=!1,e.resume())},this};typeof Symbol=="function"&&(ef.prototype[Symbol.asyncIterator]=function(){return Zct===void 0&&(Zct=YIr()),Zct(this)});Object.defineProperty(ef.prototype,"readableHighWaterMark",{enumerable:!1,get:a(function(){return this._readableState.highWaterMark},"get")});Object.defineProperty(ef.prototype,"readableBuffer",{enumerable:!1,get:a(function(){return this._readableState&&this._readableState.buffer},"get")});Object.defineProperty(ef.prototype,"readableFlowing",{enumerable:!1,get:a(function(){return this._readableState.flowing},"get"),set:a(function(t){this._readableState&&(this._readableState.flowing=t)},"set")});ef._fromList=u2r;Object.defineProperty(ef.prototype,"readableLength",{enumerable:!1,get:a(function(){return this._readableState.length},"get")});function u2r(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(u2r,"fromList");function alt(e){var t=e._readableState;fd("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(m2s,t,e))}a(alt,"endReadable");function m2s(e,t){if(fd("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(m2s,"endReadableNT");typeof Symbol=="function"&&(ef.from=function(e,t){return elt===void 0&&(elt=r2r()),elt(ef,e,t)});function d2r(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}a(d2r,"indexOf")});var slt=x((Ykc,p2r)=>{"use strict";p2r.exports=Vk;var Pve=ZR().codes,p2s=Pve.ERR_METHOD_NOT_IMPLEMENTED,g2s=Pve.ERR_MULTIPLE_CALLBACK,_2s=Pve.ERR_TRANSFORM_ALREADY_TRANSFORMING,h2s=Pve.ERR_TRANSFORM_WITH_LENGTH_0,kve=VL();Wg()(Vk,kve);function y2s(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new g2s);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(y2s,"afterTransform");function Vk(e){if(!(this instanceof Vk))return new Vk(e);kve.call(this,e),this._transformState={afterTransform:y2s.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",v2s)}a(Vk,"Transform");function v2s(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){m2r(e,t,r)}):m2r(this,null,null)}a(v2s,"prefinish");Vk.prototype.push=function(e,t){return this._transformState.needTransform=!1,kve.prototype.push.call(this,e,t)};Vk.prototype._transform=function(e,t,r){r(new p2s("_transform()"))};Vk.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)}};Vk.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};Vk.prototype._destroy=function(e,t){kve.prototype._destroy.call(this,e,function(r){t(r)})};function m2r(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new h2s;if(e._transformState.transforming)throw new _2s;return e.push(null)}a(m2r,"done")});var h2r=x((Zkc,_2r)=>{"use strict";_2r.exports=vG;var g2r=slt();Wg()(vG,g2r);function vG(e){if(!(this instanceof vG))return new vG(e);g2r.call(this,e)}a(vG,"PassThrough");vG.prototype._transform=function(e,t,r){r(null,e)}});var S2r=x((eDc,b2r)=>{"use strict";var olt;function w2s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}a(w2s,"once");var y2r=ZR().codes,b2s=y2r.ERR_MISSING_ARGS,S2s=y2r.ERR_STREAM_DESTROYED;function v2r(e){if(e)throw e}a(v2r,"noop");function C2s(e){return e.setHeader&&typeof e.abort=="function"}a(C2s,"isRequest");function E2s(e,t,r,n){n=w2s(n);var i=!1;e.on("close",function(){i=!0}),olt===void 0&&(olt=bve()),olt(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,C2s(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(o||new S2s("pipe"))}}}a(E2s,"destroyer");function w2r(e){e()}a(w2r,"call");function A2s(e,t){return e.pipe(t)}a(A2s,"pipe");function x2s(e){return!e.length||typeof e[e.length-1]!="function"?v2r:e.pop()}a(x2s,"popCallback");function P2s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=x2s(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new b2s("streams");var i,s=t.map(function(o,c){var l=c<t.length-1,d=c>0;return E2s(o,l,d,function(f){i||(i=f),f&&s.forEach(w2r),!l&&(s.forEach(w2r),n(i))})});return t.reduce(A2s)}a(P2s,"pipeline");b2r.exports=P2s});var vC=x((yC,bG)=>{var wG=require("stream");process.env.READABLE_STREAM==="disable"&&wG?(bG.exports=wG.Readable,Object.assign(bG.exports,wG),bG.exports.Stream=wG):(yC=bG.exports=Kct(),yC.Stream=wG||yC,yC.Readable=yC,yC.Writable=Vct(),yC.Duplex=VL(),yC.Transform=slt(),yC.PassThrough=h2r(),yC.finished=bve(),yC.pipeline=S2r())});var A2r=x((tDc,E2r)=>{E2r.exports=Wk;var k2s=require("util"),C2r=vC();k2s.inherits(Wk,C2r.Duplex);function Wk(e,t,r){var n=this;if(!(n instanceof Wk))return new Wk(e,t,r);C2r.Duplex.call(n,r),n._output=null,n.connect(e,t)}a(Wk,"HttpDuplex");Wk.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)})};Wk.prototype._read=function(e){this._output&&this._output.resume()};Wk.prototype._write=function(e,t,r){this.req.write(e,t),r()};Wk.prototype.end=function(e,t,r){return this._output.socket.destroy(),this.req.end(e,t,r)};Wk.prototype.destroy=function(){this.req.destroy(),this._output.socket.destroy()}});var P2r=x((rDc,x2r)=>{var wz=1e3,bz=wz*60,Sz=bz*60,JL=Sz*24,D2s=JL*7,T2s=JL*365.25;x2r.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return R2s(e);if(r==="number"&&isFinite(e))return t.long?N2s(e):I2s(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function R2s(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!!t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*T2s;case"weeks":case"week":case"w":return r*D2s;case"days":case"day":case"d":return r*JL;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Sz;case"minutes":case"minute":case"mins":case"min":case"m":return r*bz;case"seconds":case"second":case"secs":case"sec":case"s":return r*wz;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}a(R2s,"parse");function I2s(e){var t=Math.abs(e);return t>=JL?Math.round(e/JL)+"d":t>=Sz?Math.round(e/Sz)+"h":t>=bz?Math.round(e/bz)+"m":t>=wz?Math.round(e/wz)+"s":e+"ms"}a(I2s,"fmtShort");function N2s(e){var t=Math.abs(e);return t>=JL?Dve(e,t,JL,"day"):t>=Sz?Dve(e,t,Sz,"hour"):t>=bz?Dve(e,t,bz,"minute"):t>=wz?Dve(e,t,wz,"second"):e+" ms"}a(N2s,"fmtLong");function Dve(e,t,r,n){var i=t>=r*1.5;return Math.round(e/r)+" "+n+(i?"s":"")}a(Dve,"plural")});var clt=x((nDc,k2r)=>{function L2s(e){r.debug=r,r.default=r,r.coerce=d,r.disable=o,r.enable=s,r.enabled=c,r.humanize=P2r(),Object.keys(e).forEach(f=>{r[f]=e[f]}),r.instances=[],r.names=[],r.skips=[],r.formatters={};function t(f){let p=0;for(let h=0;h<f.length;h++)p=(p<<5)-p+f.charCodeAt(h),p|=0;return r.colors[Math.abs(p)%r.colors.length]}a(t,"selectColor"),r.selectColor=t;function r(f){let p;function h(...w){if(!h.enabled)return;let b=h,E=Number(new Date),A=E-(p||E);b.diff=A,b.prev=p,b.curr=E,p=E,w[0]=r.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let T=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(B,I)=>{if(B==="%%")return B;T++;let q=r.formatters[I];if(typeof q=="function"){let re=w[T];B=q.call(b,re),w.splice(T,1),T--}return B}),r.formatArgs.call(b,w),(b.log||r.log).apply(b,w)}return a(h,"debug"),h.namespace=f,h.enabled=r.enabled(f),h.useColors=r.useColors(),h.color=t(f),h.destroy=n,h.extend=i,typeof r.init=="function"&&r.init(h),r.instances.push(h),h}a(r,"createDebug");function n(){let f=r.instances.indexOf(this);return f!==-1?(r.instances.splice(f,1),!0):!1}a(n,"destroy");function i(f,p){let h=r(this.namespace+(typeof p=="undefined"?":":p)+f);return h.log=this.log,h}a(i,"extend");function s(f){r.save(f),r.names=[],r.skips=[];let p,h=(typeof f=="string"?f:"").split(/[\s,]+/),w=h.length;for(p=0;p<w;p++)!h[p]||(f=h[p].replace(/\*/g,".*?"),f[0]==="-"?r.skips.push(new RegExp("^"+f.substr(1)+"$")):r.names.push(new RegExp("^"+f+"$")));for(p=0;p<r.instances.length;p++){let b=r.instances[p];b.enabled=r.enabled(b.namespace)}}a(s,"enable");function o(){let f=[...r.names.map(l),...r.skips.map(l).map(p=>"-"+p)].join(",");return r.enable(""),f}a(o,"disable");function c(f){if(f[f.length-1]==="*")return!0;let p,h;for(p=0,h=r.skips.length;p<h;p++)if(r.skips[p].test(f))return!1;for(p=0,h=r.names.length;p<h;p++)if(r.names[p].test(f))return!0;return!1}a(c,"enabled");function l(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}a(l,"toNamespace");function d(f){return f instanceof Error?f.stack||f.message:f}return a(d,"coerce"),r.enable(r.load()),r}a(L2s,"setup");k2r.exports=L2s});var D2r=x((wC,Tve)=>{wC.log=M2s;wC.formatArgs=O2s;wC.save=F2s;wC.load=z2s;wC.useColors=q2s;wC.storage=j2s();wC.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 q2s(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}a(q2s,"useColors");function O2s(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+Tve.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(O2s,"formatArgs");function M2s(...e){return typeof console=="object"&&console.log&&console.log(...e)}a(M2s,"log");function F2s(e){try{e?wC.storage.setItem("debug",e):wC.storage.removeItem("debug")}catch(t){}}a(F2s,"save");function z2s(){let e;try{e=wC.storage.getItem("debug")}catch(t){}return!e&&typeof process!="undefined"&&"env"in process&&(e=process.env.DEBUG),e}a(z2s,"load");function j2s(){try{return localStorage}catch(e){}}a(j2s,"localstorage");Tve.exports=clt()(wC);var{formatters:B2s}=Tve.exports;B2s.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var R2r=x((ev,Rve)=>{var U2s=require("tty"),llt=require("util");ev.init=K2s;ev.log=V2s;ev.formatArgs=$2s;ev.save=W2s;ev.load=X2s;ev.useColors=G2s;ev.colors=[6,2,3,4,5,1];try{let e=W6();e&&(e.stderr||e).level>=2&&(ev.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(e){}ev.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 G2s(){return"colors"in ev.inspectOpts?Boolean(ev.inspectOpts.colors):U2s.isatty(process.stderr.fd)}a(G2s,"useColors");function $2s(e){let{namespace:t,useColors:r}=this;if(r){let n=this.color,i="[3"+(n<8?n:"8;5;"+n),s=` ${i};1m${t} `;e[0]=s+e[0].split(`
91
91
  `).join(`
92
92
  `+s),e.push(i+"m+"+Rve.exports.humanize(this.diff)+"")}else e[0]=H2s()+t+" "+e[0]}a($2s,"formatArgs");function H2s(){return ev.inspectOpts.hideDate?"":new Date().toISOString()+" "}a(H2s,"getDate");function V2s(...e){return process.stderr.write(llt.format(...e)+`
93
93
  `)}a(V2s,"log");function W2s(e){e?process.env.DEBUG=e:delete process.env.DEBUG}a(W2s,"save");function X2s(){return process.env.DEBUG}a(X2s,"load");function K2s(e){e.inspectOpts={};let t=Object.keys(ev.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=ev.inspectOpts[t[r]]}a(K2s,"init");Rve.exports=clt()(ev);var{formatters:T2r}=Rve.exports;T2r.o=function(e){return this.inspectOpts.colors=this.useColors,llt.inspect(e,this.inspectOpts).replace(/\s*\n\s*/g," ")};T2r.O=function(e){return this.inspectOpts.colors=this.useColors,llt.inspect(e,this.inspectOpts)}});var SG=x((iDc,ult)=>{typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?ult.exports=D2r():ult.exports=R2r()});var N2r=x((aDc,I2r)=>{var J2s=require("fs");I2r.exports=function(e,t,r){t=typeof t!="undefined"?t:`
@@ -3543,7 +3543,7 @@ Url: `+this._getEventFilterUrl(t)),!0)},e.prototype._isSentryError=function(t,r)
3543
3543
  `)),E=+b.split(" ")[1];iV("got proxy server response: %o",b),t({statusCode:E,buffered:h})}a(f,"ondata"),e.on("error",d),e.on("close",c),e.on("end",l),s()})}a(jto,"parseProxyResponse");aV.default=jto});var iZr=x(yO=>{"use strict";var Bto=yO&&yO.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function c(f){try{d(n.next(f))}catch(p){o(p)}}a(c,"fulfilled");function l(f){try{d(n.throw(f))}catch(p){o(p)}}a(l,"rejected");function d(f){f.done?s(f.value):i(f.value).then(c,l)}a(d,"step"),d((n=n.apply(e,t||[])).next())})},Ej=yO&&yO.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yO,"__esModule",{value:!0});var rZr=Ej(require("net")),nZr=Ej(require("tls")),Uto=Ej(require("url")),Gto=Ej(require("assert")),$to=Ej(SG()),Hto=eZr(),Vto=Ej(tZr()),sV=$to.default("https-proxy-agent:agent"),nSt=class extends Hto.Agent{constructor(t){let r;if(typeof t=="string"?r=Uto.default.parse(t):r=t,!r)throw new Error("an HTTP(S) proxy server `host` and `port` must be specified!");sV("creating new HttpsProxyAgent instance: %o",r);super(r);let n=Object.assign({},r);this.secureProxy=r.secureProxy||Kto(n.protocol),n.host=n.hostname||n.host,typeof n.port=="string"&&(n.port=parseInt(n.port,10)),!n.port&&n.host&&(n.port=this.secureProxy?443:80),this.secureProxy&&!("ALPNProtocols"in n)&&(n.ALPNProtocols=["http 1.1"]),n.host&&n.path&&(delete n.path,delete n.pathname),this.proxy=n}callback(t,r){return Bto(this,void 0,void 0,function*(){let{proxy:n,secureProxy:i}=this,s;i?(sV("Creating `tls.Socket`: %o",n),s=nZr.default.connect(n)):(sV("Creating `net.Socket`: %o",n),s=rZr.default.connect(n));let o=Object.assign({},n.headers),l=`CONNECT ${`${r.host}:${r.port}`} HTTP/1.1\r
3544
3544
  `;n.auth&&(o["Proxy-Authorization"]=`Basic ${Buffer.from(n.auth).toString("base64")}`);let{host:d,port:f,secureEndpoint:p}=r;Xto(f,p)||(d+=`:${f}`),o.Host=d,o.Connection="close";for(let A of Object.keys(o))l+=`${A}: ${o[A]}\r
3545
3545
  `;let h=Vto.default(s);s.write(`${l}\r
3546
- `);let{statusCode:w,buffered:b}=yield h;if(w===200){if(t.once("socket",Wto),r.secureEndpoint){let A=r.servername||r.host;if(!A)throw new Error('Could not determine "servername"');return sV("Upgrading socket connection to TLS"),nZr.default.connect(Object.assign(Object.assign({},Jto(r,"host","hostname","path","port")),{socket:s,servername:A}))}return s}s.destroy();let E=new rZr.default.Socket;return E.readable=!0,t.once("socket",A=>{sV("replaying proxy buffer for failed request"),Gto.default(A.listenerCount("data")>0),A.push(b),A.push(null)}),E})}};a(nSt,"HttpsProxyAgent");yO.default=nSt;function Wto(e){e.resume()}a(Wto,"resume");function Xto(e,t){return Boolean(!t&&e===80||t&&e===443)}a(Xto,"isDefaultPort");function Kto(e){return typeof e=="string"?/^https:?$/i.test(e):!1}a(Kto,"isHTTPS");function Jto(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}a(Jto,"omit")});var oSt=x((sSt,aZr)=>{"use strict";var Qto=sSt&&sSt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},iSt=Qto(iZr());function aSt(e){return new iSt.default(e)}a(aSt,"createHttpsProxyAgent");(function(e){e.HttpsProxyAgent=iSt.default,e.prototype=iSt.default.prototype})(aSt||(aSt={}));aZr.exports=aSt});var cZr=x(cSt=>{Object.defineProperty(cSt,"__esModule",{value:!0});var Yto=nw(),sZr=fy(),oZr=require("http"),Zto=gEe(),ero=function(e){Yto.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("http");return n.module=oZr,n.client=i?new(oSt())(i):new oZr.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return a(t,"HTTPTransport"),t.prototype.sendEvent=function(r){return this._send(sZr.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(sZr.sessionToSentryRequest(r,this._api),r)},t}(Zto.BaseTransport);cSt.HTTPTransport=ero});var dZr=x(lSt=>{Object.defineProperty(lSt,"__esModule",{value:!0});var tro=nw(),lZr=fy(),uZr=require("https"),rro=gEe(),nro=function(e){tro.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("https");return n.module=uZr,n.client=i?new(oSt())(i):new uZr.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return a(t,"HTTPSTransport"),t.prototype.sendEvent=function(r){return this._send(lZr.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(lZr.sessionToSentryRequest(r,this._api),r)},t}(rro.BaseTransport);lSt.HTTPSTransport=nro});var uSt=x(oV=>{Object.defineProperty(oV,"__esModule",{value:!0});var iro=gEe();oV.BaseTransport=iro.BaseTransport;var aro=cZr();oV.HTTPTransport=aro.HTTPTransport;var sro=dZr();oV.HTTPSTransport=sro.HTTPSTransport});var fSt=x(dSt=>{Object.defineProperty(dSt,"__esModule",{value:!0});var HI=nw(),fZr=fy(),oro=dy(),LD=Al(),hEe=Kbt(),mZr=uSt(),cro=function(e){HI.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return a(t,"NodeBackend"),t.prototype.eventFromException=function(r,n){var i=this,s=r,o=n&&n.data&&n.data.mechanism,c=o||{handled:!0,type:"generic"};if(!LD.isError(r)){if(LD.isPlainObject(r)){var l="Non-Error exception captured with keys: "+LD.extractExceptionKeysForMessage(r);fZr.getCurrentHub().configureScope(function(d){d.setExtra("__serialized__",LD.normalizeToSize(r))}),s=n&&n.syntheticException||new Error(l),s.message=l}else s=n&&n.syntheticException||new Error(r),s.message=r;c.synthetic=!0}return new LD.SyncPromise(function(d,f){return hEe.parseError(s,i._options).then(function(p){LD.addExceptionTypeValue(p,void 0,void 0),LD.addExceptionMechanism(p,c),d(HI.__assign(HI.__assign({},p),{event_id:n&&n.event_id}))}).then(null,f)})},t.prototype.eventFromMessage=function(r,n,i){var s=this;n===void 0&&(n=oro.Severity.Info);var o={event_id:i&&i.event_id,level:n,message:r};return new LD.SyncPromise(function(c){if(s._options.attachStacktrace&&i&&i.syntheticException){var l=i.syntheticException?hEe.extractStackFromError(i.syntheticException):[];hEe.parseStack(l,s._options).then(function(d){o.stacktrace={frames:hEe.prepareFramesForEvent(d)},c(o)}).then(null,function(){c(o)})}else c(o)})},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var r=new LD.Dsn(this._options.dsn),n=HI.__assign(HI.__assign(HI.__assign(HI.__assign(HI.__assign({},this._options.transportOptions),this._options.httpProxy&&{httpProxy:this._options.httpProxy}),this._options.httpsProxy&&{httpsProxy:this._options.httpsProxy}),this._options.caCerts&&{caCerts:this._options.caCerts}),{dsn:this._options.dsn,tunnel:this._options.tunnel,_metadata:this._options._metadata});return this._options.transport?new this._options.transport(n):r.protocol==="http"?new mZr.HTTPTransport(n):new mZr.HTTPSTransport(n)},t}(fZr.BaseBackend);dSt.NodeBackend=cro});var gSt=x(pSt=>{Object.defineProperty(pSt,"__esModule",{value:!0});var lro=nw(),mSt=fy(),uro=jb(),yEe=dy(),pZr=Al(),dro=fSt(),fro=function(e){lro.__extends(t,e);function t(r){var n=this;return r._metadata=r._metadata||{},r._metadata.sdk=r._metadata.sdk||{name:"sentry.javascript.node",packages:[{name:"npm:@sentry/node",version:mSt.SDK_VERSION}],version:mSt.SDK_VERSION},n=e.call(this,dro.NodeBackend,r)||this,n}return a(t,"NodeClient"),t.prototype.captureException=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=i.getRequestSession();s&&s.status===yEe.RequestSessionStatus.Ok&&(s.status=yEe.RequestSessionStatus.Errored)}return e.prototype.captureException.call(this,r,n,i)},t.prototype.captureEvent=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=r.type||"exception",o=s==="exception"&&r.exception&&r.exception.values&&r.exception.values.length>0;if(o){var c=i.getRequestSession();c&&c.status===yEe.RequestSessionStatus.Ok&&(c.status=yEe.RequestSessionStatus.Errored)}}return e.prototype.captureEvent.call(this,r,n,i)},t.prototype.close=function(r){var n;return(n=this._sessionFlusher)===null||n===void 0||n.close(),e.prototype.close.call(this,r)},t.prototype.initSessionFlusher=function(){var r=this._options,n=r.release,i=r.environment;n?this._sessionFlusher=new uro.SessionFlusher(this.getTransport(),{release:n,environment:i}):pZr.logger.warn("Cannot initialise an instance of SessionFlusher if no release is provided!")},t.prototype._prepareEvent=function(r,n,i){return r.platform=r.platform||"node",this.getOptions().serverName&&(r.server_name=this.getOptions().serverName),e.prototype._prepareEvent.call(this,r,n,i)},t.prototype._captureRequestSession=function(){this._sessionFlusher?this._sessionFlusher.incrementSessionStatusCount():pZr.logger.warn("Discarded request mode session because autoSessionTracking option was disabled")},t}(mSt.BaseClient);pSt.NodeClient=fro});var yZr=x(_St=>{Object.defineProperty(_St,"__esModule",{value:!0});var gZr=nw(),_Zr=fy(),cV=dy(),mro=Al(),pro=require("util"),hZr=function(){function e(){this.name=e.id}return a(e,"Console"),e.prototype.setupOnce=function(){var t,r;try{for(var n=gZr.__values(["debug","info","warn","error","log"]),i=n.next();!i.done;i=n.next()){var s=i.value;mro.fill(console,s,gro(s))}}catch(o){t={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.id="Console",e}();_St.Console=hZr;function gro(e){return a(function(r){var n;switch(e){case"debug":n=cV.Severity.Debug;break;case"error":n=cV.Severity.Error;break;case"info":n=cV.Severity.Info;break;case"warn":n=cV.Severity.Warning;break;default:n=cV.Severity.Log}return function(){_Zr.getCurrentHub().getIntegration(hZr)&&_Zr.getCurrentHub().addBreadcrumb({category:"console",level:n,message:pro.format.apply(void 0,arguments)},{input:gZr.__spread(arguments),level:e}),r.apply(this,arguments)}},"consoleWrapper")}a(gro,"createConsoleWrapper")});var bZr=x(vO=>{Object.defineProperty(vO,"__esModule",{value:!0});var hSt=nw(),_ro=fy(),vZr=require("url");function hro(e){var t,r=(t=_ro.getCurrentHub().getClient())===null||t===void 0?void 0:t.getDsn();return r?e.includes(r.host):!1}a(hro,"isSentryRequest");vO.isSentryRequest=hro;function wZr(e){var t=e.protocol||"",r=e.hostname||e.host||"",n=!e.port||e.port===80||e.port===443?"":":"+e.port,i=e.path?e.path:"/";return t+"//"+r+n+i}a(wZr,"extractUrl");vO.extractUrl=wZr;function yro(e,t,r){var n,i,s;if(!e)return e;var o=hSt.__read(e.split(" "),2),c=o[0],l=o[1];return t.host&&!t.protocol&&(t.protocol=(i=(n=r)===null||n===void 0?void 0:n.agent)===null||i===void 0?void 0:i.protocol,l=wZr(t)),((s=l)===null||s===void 0?void 0:s.startsWith("///"))&&(l=l.slice(2)),c+" "+l}a(yro,"cleanSpanDescription");vO.cleanSpanDescription=yro;function ySt(e){var t={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:""+(e.pathname||"")+(e.search||""),href:e.href};return e.port!==""&&(t.port=Number(e.port)),(e.username||e.password)&&(t.auth=e.username+":"+e.password),t}a(ySt,"urlToOptions");vO.urlToOptions=ySt;function vro(e,t){var r,n,i,s,o;return typeof t[t.length-1]=="function"&&(s=t.pop()),typeof t[0]=="string"?o=ySt(new vZr.URL(t[0])):t[0]instanceof vZr.URL?o=ySt(t[0]):o=t[0],t.length===2&&(o=hSt.__assign(hSt.__assign({},o),t[1])),o.protocol===void 0&&(o.protocol=((r=o.agent)===null||r===void 0?void 0:r.protocol)||((n=o._defaultAgent)===null||n===void 0?void 0:n.protocol)||((i=e.globalAgent)===null||i===void 0?void 0:i.protocol)),s?[o,s]:[o]}a(vro,"normalizeRequestArgs");vO.normalizeRequestArgs=vro});var xZr=x(wSt=>{Object.defineProperty(wSt,"__esModule",{value:!0});var SZr=nw(),vSt=fy(),Aj=Al(),lV=bZr(),CZr=Aj.parseSemver(process.versions.node),EZr=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._breadcrumbs=typeof t.breadcrumbs=="undefined"?!0:t.breadcrumbs,this._tracing=typeof t.tracing=="undefined"?!1:t.tracing}return a(e,"Http"),e.prototype.setupOnce=function(){if(!(!this._breadcrumbs&&!this._tracing)){var t=wro(this._breadcrumbs,this._tracing),r=require("http");if(Aj.fill(r,"get",t),Aj.fill(r,"request",t),CZr.major&&CZr.major>8){var n=require("https");Aj.fill(n,"get",t),Aj.fill(n,"request",t)}}},e.id="Http",e}();wSt.Http=EZr;function wro(e,t){return a(function(n){return a(function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var c=this,l=lV.normalizeRequestArgs(this,s),d=l[0],f=lV.extractUrl(d);if(lV.isSentryRequest(f))return n.apply(c,l);var p,h,w=vSt.getCurrentHub().getScope();if(w&&t&&(h=w.getSpan(),h)){p=h.startChild({description:(d.method||"GET")+" "+f,op:"request"});var b=p.toTraceparent();Aj.logger.log("[Tracing] Adding sentry-trace header "+b+" to outgoing request to "+f+": "),d.headers=SZr.__assign(SZr.__assign({},d.headers),{"sentry-trace":b})}return n.apply(c,l).once("response",function(E){var A=this;e&&AZr("response",f,A,E),t&&p&&(E.statusCode&&p.setHttpStatus(E.statusCode),p.description=lV.cleanSpanDescription(p.description,d,A),p.finish())}).once("error",function(){var E=this;e&&AZr("error",f,E),t&&p&&(p.setHttpStatus(500),p.description=lV.cleanSpanDescription(p.description,d,E),p.finish())})},"wrappedMethod")},"wrappedRequestMethodFactory")}a(wro,"_createWrappedRequestMethodFactory");function AZr(e,t,r,n){!vSt.getCurrentHub().getIntegration(EZr)||vSt.getCurrentHub().addBreadcrumb({category:"http",data:{method:r.method,status_code:n&&n.statusCode,url:t},type:"http"},{event:e,request:r,response:n})}a(AZr,"addRequestBreadcrumb")});var CSt=x(SSt=>{Object.defineProperty(SSt,"__esModule",{value:!0});var bro=fy(),bSt=Al(),Sro=2e3;function Cro(e){console.error(e&&e.stack?e.stack:e);var t=bro.getCurrentHub().getClient();if(t===void 0){bSt.logger.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}var r=t.getOptions(),n=r&&r.shutdownTimeout&&r.shutdownTimeout>0&&r.shutdownTimeout||Sro;bSt.forget(t.close(n).then(function(i){i||bSt.logger.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)}))}a(Cro,"logAndExitProcess");SSt.logAndExitProcess=Cro});var DZr=x(ESt=>{Object.defineProperty(ESt,"__esModule",{value:!0});var PZr=fy(),Ero=dy(),Aro=Al(),kZr=CSt(),xro=function(){function e(t){t===void 0&&(t={}),this._options=t,this.name=e.id,this.handler=this._makeErrorHandler()}return a(e,"OnUncaughtException"),e.prototype.setupOnce=function(){global.process.on("uncaughtException",this.handler.bind(this))},e.prototype._makeErrorHandler=function(){var t=this,r=2e3,n=!1,i=!1,s=!1,o;return function(c){var l=kZr.logAndExitProcess,d=PZr.getCurrentHub().getClient();if(t._options.onFatalError?l=t._options.onFatalError:d&&d.getOptions().onFatalError&&(l=d.getOptions().onFatalError),n)s?(Aro.logger.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),kZr.logAndExitProcess(c)):i||(i=!0,setTimeout(function(){s||(s=!0,l(o,c))},r));else{var f=PZr.getCurrentHub();o=c,n=!0,f.getIntegration(e)?f.withScope(function(p){p.setLevel(Ero.Severity.Fatal),f.captureException(c,{originalException:c,data:{mechanism:{handled:!1,type:"onuncaughtexception"}}}),s||(s=!0,l(c))}):s||(s=!0,l(c))}}},e.id="OnUncaughtException",e}();ESt.OnUncaughtException=xro});var RZr=x(ASt=>{Object.defineProperty(ASt,"__esModule",{value:!0});var Pro=fy(),TZr=Al(),kro=CSt(),Dro=function(){function e(t){t===void 0&&(t={mode:"warn"}),this._options=t,this.name=e.id}return a(e,"OnUnhandledRejection"),e.prototype.setupOnce=function(){global.process.on("unhandledRejection",this.sendUnhandledPromise.bind(this))},e.prototype.sendUnhandledPromise=function(t,r){var n=Pro.getCurrentHub();if(!n.getIntegration(e)){this._handleRejection(t);return}var i=r.domain&&r.domain.sentryContext||{};n.withScope(function(s){s.setExtra("unhandledPromiseRejection",!0),i.user&&s.setUser(i.user),i.tags&&s.setTags(i.tags),i.extra&&s.setExtras(i.extra),n.captureException(t,{originalException:r,data:{mechanism:{handled:!1,type:"onunhandledrejection"}}})}),this._handleRejection(t)},e.prototype._handleRejection=function(t){var r="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";this._options.mode==="warn"?TZr.consoleSandbox(function(){console.warn(r),console.error(t&&t.stack?t.stack:t)}):this._options.mode==="strict"&&(TZr.consoleSandbox(function(){console.warn(r)}),kro.logAndExitProcess(t))},e.id="OnUnhandledRejection",e}();ASt.OnUnhandledRejection=Dro});var LZr=x(xSt=>{Object.defineProperty(xSt,"__esModule",{value:!0});var IZr=nw(),NZr=fy(),xj=Al(),Tro=Kbt(),Rro="cause",Iro=5,Nro=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._key=t.key||Rro,this._limit=t.limit||Iro}return a(e,"LinkedErrors"),e.prototype.setupOnce=function(){NZr.addGlobalEventProcessor(function(t,r){var n=NZr.getCurrentHub().getIntegration(e);if(n){var i=n._handler&&n._handler.bind(n);return typeof i=="function"?i(t,r):t}return t})},e.prototype._handler=function(t,r){var n=this;return!t.exception||!t.exception.values||!r||!xj.isInstanceOf(r.originalException,Error)?xj.SyncPromise.resolve(t):new xj.SyncPromise(function(i){n._walkErrorTree(r.originalException,n._key).then(function(s){t&&t.exception&&t.exception.values&&(t.exception.values=IZr.__spread(s,t.exception.values)),i(t)}).then(null,function(){i(t)})})},e.prototype._walkErrorTree=function(t,r,n){var i=this;return n===void 0&&(n=[]),!xj.isInstanceOf(t[r],Error)||n.length+1>=this._limit?xj.SyncPromise.resolve(n):new xj.SyncPromise(function(s,o){Tro.getExceptionFromError(t[r]).then(function(c){i._walkErrorTree(t[r],r,IZr.__spread([c],n)).then(s).then(null,function(){o()})}).then(null,function(){o()})})},e.id="LinkedErrors",e}();xSt.LinkedErrors=Nro});var FZr=x(kSt=>{Object.defineProperty(kSt,"__esModule",{value:!0});var qZr=nw(),OZr=require("fs"),MZr=require("path"),PSt;function Lro(){try{return require.cache?Object.keys(require.cache):[]}catch(e){return[]}}a(Lro,"getPaths");function qro(){var e=require.main&&require.main.paths||[],t=Lro(),r={},n={};return t.forEach(function(i){var s=i,o=a(function(){var c=s;if(s=MZr.dirname(c),!(!s||c===s||n[c])){if(e.indexOf(s)<0)return o();var l=MZr.join(c,"package.json");if(n[c]=!0,!OZr.existsSync(l))return o();try{var d=JSON.parse(OZr.readFileSync(l,"utf8"));r[d.name]=d.version}catch(f){}}},"updir");o()}),r}a(qro,"collectModules");var Oro=function(){function e(){this.name=e.id}return a(e,"Modules"),e.prototype.setupOnce=function(t,r){var n=this;t(function(i){return r().getIntegration(e)?qZr.__assign(qZr.__assign({},i),{modules:n._getModules()}):i})},e.prototype._getModules=function(){return PSt||(PSt=qro()),PSt},e.id="Modules",e}();kSt.Modules=Oro});var DSt=x(VI=>{Object.defineProperty(VI,"__esModule",{value:!0});var Mro=yZr();VI.Console=Mro.Console;var Fro=xZr();VI.Http=Fro.Http;var zro=DZr();VI.OnUncaughtException=zro.OnUncaughtException;var jro=RZr();VI.OnUnhandledRejection=jro.OnUnhandledRejection;var Bro=LZr();VI.LinkedErrors=Bro.LinkedErrors;var Uro=FZr();VI.Modules=Uro.Modules});var RSt=x(Mx=>{Object.defineProperty(Mx,"__esModule",{value:!0});var uV=nw(),WI=fy(),zZr=jb(),jZr=dy(),TSt=Al(),Gro=require("domain"),$ro=gSt(),dV=DSt();Mx.defaultIntegrations=[new WI.Integrations.InboundFilters,new WI.Integrations.FunctionToString,new dV.Console,new dV.Http,new dV.OnUncaughtException,new dV.OnUnhandledRejection,new dV.LinkedErrors];function Hro(e){e===void 0&&(e={});var t,r=zZr.getMainCarrier(),n=((t=r.__SENTRY__)===null||t===void 0?void 0:t.integrations)||[];if(e.defaultIntegrations=e.defaultIntegrations===!1?[]:uV.__spread(Array.isArray(e.defaultIntegrations)?e.defaultIntegrations:Mx.defaultIntegrations,n),e.dsn===void 0&&process.env.SENTRY_DSN&&(e.dsn=process.env.SENTRY_DSN),e.tracesSampleRate===void 0&&process.env.SENTRY_TRACES_SAMPLE_RATE){var i=parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE);isFinite(i)&&(e.tracesSampleRate=i)}if(e.release===void 0){var s=BZr();s!==void 0?e.release=s:e.autoSessionTracking=!1}e.environment===void 0&&process.env.SENTRY_ENVIRONMENT&&(e.environment=process.env.SENTRY_ENVIRONMENT),e.autoSessionTracking===void 0&&e.dsn!==void 0&&(e.autoSessionTracking=!0),Gro.active&&zZr.setHubOnCarrier(r,WI.getCurrentHub()),WI.initAndBind($ro.NodeClient,e),e.autoSessionTracking&&Jro()}a(Hro,"init");Mx.init=Hro;function Vro(){return WI.getCurrentHub().lastEventId()}a(Vro,"lastEventId");Mx.lastEventId=Vro;function Wro(e){return uV.__awaiter(this,void 0,void 0,function(){var t;return uV.__generator(this,function(r){return t=WI.getCurrentHub().getClient(),t?[2,t.flush(e)]:(TSt.logger.warn("Cannot flush events. No client defined."),[2,Promise.resolve(!1)])})})}a(Wro,"flush");Mx.flush=Wro;function Xro(e){return uV.__awaiter(this,void 0,void 0,function(){var t;return uV.__generator(this,function(r){return t=WI.getCurrentHub().getClient(),t?[2,t.close(e)]:(TSt.logger.warn("Cannot flush events and disable SDK. No client defined."),[2,Promise.resolve(!1)])})})}a(Xro,"close");Mx.close=Xro;function Kro(e){if(e===void 0)return!1;var t=e&&e.getOptions();return t&&t.autoSessionTracking!==void 0?t.autoSessionTracking:!1}a(Kro,"isAutoSessionTrackingEnabled");Mx.isAutoSessionTrackingEnabled=Kro;function BZr(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;var t=TSt.getGlobalObject();return t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id?t.SENTRY_RELEASE.id:process.env.GITHUB_SHA||process.env.COMMIT_REF||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA||e}a(BZr,"getSentryRelease");Mx.getSentryRelease=BZr;function Jro(){var e=WI.getCurrentHub();e.startSession(),process.on("beforeExit",function(){var t,r=(t=e.getScope())===null||t===void 0?void 0:t.getSession(),n=[jZr.SessionStatus.Exited,jZr.SessionStatus.Crashed];r&&!n.includes(r.status)&&e.endSession()})}a(Jro,"startSessionTracking")});var GZr=x(NSt=>{Object.defineProperty(NSt,"__esModule",{value:!0});var UZr=nw(),vEe=require("fs"),ISt=require("path");function Qro(e){var t=ISt.resolve(e);if(!vEe.existsSync(t))throw new Error("Cannot read contents of "+t+". Directory does not exist.");if(!vEe.statSync(t).isDirectory())throw new Error("Cannot read contents of "+t+", because it is not a directory.");var r=a(function(n){return vEe.readdirSync(n).reduce(function(i,s){var o=ISt.join(n,s);return vEe.statSync(o).isDirectory()?UZr.__spread(i,r(o)):UZr.__spread(i,[o])},[])},"deepReadCurrentDir");return r(t).map(function(n){return ISt.relative(t,n)})}a(Qro,"deepReadDirSync");NSt.deepReadDirSync=Qro});var p1=x((lJc,bEe)=>{var $Zr,HZr,VZr,WZr,XZr,KZr,JZr,QZr,YZr,wEe,LSt,ZZr,een,Pj,ten,ren,nen,ien,aen,sen,oen,cen,len;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof bEe=="object"&&typeof bEe.exports=="object"?e(r(t,r(bEe.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}a(r,"createExporter")})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])};$Zr=a(function(r,n){t(r,n);function i(){this.constructor=r}a(i,"__"),r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},"__extends"),HZr=Object.assign||function(r){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},VZr=a(function(r,n){var i={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&n.indexOf(s)<0&&(i[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(r);o<s.length;o++)n.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(r,s[o])&&(i[s[o]]=r[s[o]]);return i},"__rest"),WZr=a(function(r,n,i,s){var o=arguments.length,c=o<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,n,i,s);else for(var d=r.length-1;d>=0;d--)(l=r[d])&&(c=(o<3?l(c):o>3?l(n,i,c):l(n,i))||c);return o>3&&c&&Object.defineProperty(n,i,c),c},"__decorate"),XZr=a(function(r,n){return function(i,s){n(i,s,r)}},"__param"),KZr=a(function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},"__metadata"),JZr=a(function(r,n,i,s){function o(c){return c instanceof i?c:new i(function(l){l(c)})}return a(o,"adopt"),new(i||(i=Promise))(function(c,l){function d(h){try{p(s.next(h))}catch(w){l(w)}}a(d,"fulfilled");function f(h){try{p(s.throw(h))}catch(w){l(w)}}a(f,"rejected");function p(h){h.done?c(h.value):o(h.value).then(d,f)}a(p,"step"),p((s=s.apply(r,n||[])).next())})},"__awaiter"),QZr=a(function(r,n){var i={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},s,o,c,l;return l={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function d(p){return function(h){return f([p,h])}}function f(p){if(s)throw new TypeError("Generator is already executing.");for(;i;)try{if(s=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,o=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(c=i.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){i.label=p[1];break}if(p[0]===6&&i.label<c[1]){i.label=c[1],c=p;break}if(c&&i.label<c[2]){i.label=c[2],i.ops.push(p);break}c[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(h){p=[6,h],o=0}finally{s=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},"__generator"),len=a(function(r,n,i,s){s===void 0&&(s=i),r[s]=n[i]},"__createBinding"),YZr=a(function(r,n){for(var i in r)i!=="default"&&!n.hasOwnProperty(i)&&(n[i]=r[i])},"__exportStar"),wEe=a(function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],s=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&s>=r.length&&(r=void 0),{value:r&&r[s++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},"__values"),LSt=a(function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var s=i.call(r),o,c=[],l;try{for(;(n===void 0||n-- >0)&&!(o=s.next()).done;)c.push(o.value)}catch(d){l={error:d}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(l)throw l.error}}return c},"__read"),ZZr=a(function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(LSt(arguments[n]));return r},"__spread"),een=a(function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var s=Array(r),o=0,n=0;n<i;n++)for(var c=arguments[n],l=0,d=c.length;l<d;l++,o++)s[o]=c[l];return s},"__spreadArrays"),Pj=a(function(r){return this instanceof Pj?(this.v=r,this):new Pj(r)},"__await"),ten=a(function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=i.apply(r,n||[]),o,c=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(b){s[b]&&(o[b]=function(E){return new Promise(function(A,T){c.push([b,E,A,T])>1||d(b,E)})})}function d(b,E){try{f(s[b](E))}catch(A){w(c[0][3],A)}}function f(b){b.value instanceof Pj?Promise.resolve(b.value.v).then(p,h):w(c[0][2],b)}function p(b){d("next",b)}function h(b){d("throw",b)}function w(b,E){b(E),c.shift(),c.length&&d(c[0][0],c[0][1])}},"__asyncGenerator"),ren=a(function(r){var n,i;return n={},s("next"),s("throw",function(o){throw o}),s("return"),n[Symbol.iterator]=function(){return this},n;function s(o,c){n[o]=r[o]?function(l){return(i=!i)?{value:Pj(r[o](l)),done:o==="return"}:c?c(l):l}:c}},"__asyncDelegator"),nen=a(function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof wEe=="function"?wEe(r):r[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(c){i[c]=r[c]&&function(l){return new Promise(function(d,f){l=r[c](l),o(d,f,l.done,l.value)})}}function o(c,l,d,f){Promise.resolve(f).then(function(p){c({value:p,done:d})},l)}},"__asyncValues"),ien=a(function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r},"__makeTemplateObject"),aen=a(function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)Object.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n.default=r,n},"__importStar"),sen=a(function(r){return r&&r.__esModule?r:{default:r}},"__importDefault"),oen=a(function(r,n){if(!n.has(r))throw new TypeError("attempted to get private field on non-instance");return n.get(r)},"__classPrivateFieldGet"),cen=a(function(r,n,i){if(!n.has(r))throw new TypeError("attempted to set private field on non-instance");return n.set(r,i),i},"__classPrivateFieldSet"),e("__extends",$Zr),e("__assign",HZr),e("__rest",VZr),e("__decorate",WZr),e("__param",XZr),e("__metadata",KZr),e("__awaiter",JZr),e("__generator",QZr),e("__exportStar",YZr),e("__createBinding",len),e("__values",wEe),e("__read",LSt),e("__spread",ZZr),e("__spreadArrays",een),e("__await",Pj),e("__asyncGenerator",ten),e("__asyncDelegator",ren),e("__asyncValues",nen),e("__makeTemplateObject",ien),e("__importStar",aen),e("__importDefault",sen),e("__classPrivateFieldGet",oen),e("__classPrivateFieldSet",cen)})});var XI=x(kj=>{Object.defineProperty(kj,"__esModule",{value:!0});var uen;(function(e){e.Ok="ok",e.DeadlineExceeded="deadline_exceeded",e.Unauthenticated="unauthenticated",e.PermissionDenied="permission_denied",e.NotFound="not_found",e.ResourceExhausted="resource_exhausted",e.InvalidArgument="invalid_argument",e.Unimplemented="unimplemented",e.Unavailable="unavailable",e.InternalError="internal_error",e.UnknownError="unknown_error",e.Cancelled="cancelled",e.AlreadyExists="already_exists",e.FailedPrecondition="failed_precondition",e.Aborted="aborted",e.OutOfRange="out_of_range",e.DataLoss="data_loss"})(uen=kj.SpanStatus||(kj.SpanStatus={}));(function(e){function t(r){if(r<400)return e.Ok;if(r>=400&&r<500)switch(r){case 401:return e.Unauthenticated;case 403:return e.PermissionDenied;case 404:return e.NotFound;case 409:return e.AlreadyExists;case 413:return e.FailedPrecondition;case 429:return e.ResourceExhausted;default:return e.InvalidArgument}if(r>=500&&r<600)switch(r){case 501:return e.Unimplemented;case 503:return e.Unavailable;case 504:return e.DeadlineExceeded;default:return e.InternalError}return e.UnknownError}a(t,"fromHttpCode"),e.fromHttpCode=t})(uen=kj.SpanStatus||(kj.SpanStatus={}))});var KI=x(Fx=>{Object.defineProperty(Fx,"__esModule",{value:!0});var den=jb();Fx.TRACEPARENT_REGEXP=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Yro(e){e===void 0&&(e=(t=den.getCurrentHub().getClient())===null||t===void 0?void 0:t.getOptions());var t;return e?"tracesSampleRate"in e||"tracesSampler"in e:!1}a(Yro,"hasTracingEnabled");Fx.hasTracingEnabled=Yro;function Zro(e){var t=e.match(Fx.TRACEPARENT_REGEXP);if(t){var r=void 0;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}}a(Zro,"extractTraceparentData");Fx.extractTraceparentData=Zro;function eno(e){e===void 0&&(e=den.getCurrentHub());var t,r;return(r=(t=e)===null||t===void 0?void 0:t.getScope())===null||r===void 0?void 0:r.getTransaction()}a(eno,"getActiveTransaction");Fx.getActiveTransaction=eno;function tno(e){return e/1e3}a(tno,"msToSec");Fx.msToSec=tno;function rno(e){return e*1e3}a(rno,"secToMs");Fx.secToMs=rno;var nno=Al();Fx.stripUrlQueryAndFragment=nno.stripUrlQueryAndFragment});var pen=x(OSt=>{Object.defineProperty(OSt,"__esModule",{value:!0});var qSt=Al(),fen=XI(),ino=KI();function ano(){qSt.addInstrumentationHandler({callback:men,type:"error"}),qSt.addInstrumentationHandler({callback:men,type:"unhandledrejection"})}a(ano,"registerErrorInstrumentation");OSt.registerErrorInstrumentation=ano;function men(){var e=ino.getActiveTransaction();e&&(qSt.logger.log("[Tracing] Transaction: "+fen.SpanStatus.InternalError+" -> Global error occured"),e.setStatus(fen.SpanStatus.InternalError))}a(men,"errorCallback")});var CEe=x(SEe=>{Object.defineProperty(SEe,"__esModule",{value:!0});var Dj=p1(),wO=Al(),MSt=XI(),sno=function(){function e(t){t===void 0&&(t=1e3),this.spans=[],this._maxlen=t}return a(e,"SpanRecorder"),e.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},e}();SEe.SpanRecorder=sno;var ono=function(){function e(t){if(this.traceId=wO.uuid4(),this.spanId=wO.uuid4().substring(16),this.startTimestamp=wO.timestampWithMs(),this.tags={},this.data={},!t)return this;t.traceId&&(this.traceId=t.traceId),t.spanId&&(this.spanId=t.spanId),t.parentSpanId&&(this.parentSpanId=t.parentSpanId),"sampled"in t&&(this.sampled=t.sampled),t.op&&(this.op=t.op),t.description&&(this.description=t.description),t.data&&(this.data=t.data),t.tags&&(this.tags=t.tags),t.status&&(this.status=t.status),t.startTimestamp&&(this.startTimestamp=t.startTimestamp),t.endTimestamp&&(this.endTimestamp=t.endTimestamp)}return a(e,"Span"),e.prototype.child=function(t){return this.startChild(t)},e.prototype.startChild=function(t){var r=new e(Dj.__assign(Dj.__assign({},t),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}));return r.spanRecorder=this.spanRecorder,r.spanRecorder&&r.spanRecorder.add(r),r.transaction=this.transaction,r},e.prototype.setTag=function(t,r){var n;return this.tags=Dj.__assign(Dj.__assign({},this.tags),(n={},n[t]=r,n)),this},e.prototype.setData=function(t,r){var n;return this.data=Dj.__assign(Dj.__assign({},this.data),(n={},n[t]=r,n)),this},e.prototype.setStatus=function(t){return this.status=t,this},e.prototype.setHttpStatus=function(t){this.setTag("http.status_code",String(t));var r=MSt.SpanStatus.fromHttpCode(t);return r!==MSt.SpanStatus.UnknownError&&this.setStatus(r),this},e.prototype.isSuccess=function(){return this.status===MSt.SpanStatus.Ok},e.prototype.finish=function(t){this.endTimestamp=typeof t=="number"?t:wO.timestampWithMs()},e.prototype.toTraceparent=function(){var t="";return this.sampled!==void 0&&(t=this.sampled?"-1":"-0"),this.traceId+"-"+this.spanId+t},e.prototype.toContext=function(){return wO.dropUndefinedKeys({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})},e.prototype.updateWithContext=function(t){var r,n,i,s,o;return this.data=(r=t.data,r!=null?r:{}),this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=(n=t.spanId,n!=null?n:this.spanId),this.startTimestamp=(i=t.startTimestamp,i!=null?i:this.startTimestamp),this.status=t.status,this.tags=(s=t.tags,s!=null?s:{}),this.traceId=(o=t.traceId,o!=null?o:this.traceId),this},e.prototype.getTraceContext=function(){return wO.dropUndefinedKeys({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},e.prototype.toJSON=function(){return wO.dropUndefinedKeys({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},e}();SEe.Span=ono});var EEe=x(FSt=>{Object.defineProperty(FSt,"__esModule",{value:!0});var Tj=p1(),gen=jb(),cno=dy(),Rj=Al(),_en=CEe(),lno=function(e){Tj.__extends(t,e);function t(r,n){var i=e.call(this,r)||this;return i._measurements={},i._hub=gen.getCurrentHub(),Rj.isInstanceOf(n,gen.Hub)&&(i._hub=n),i.name=r.name||"",i.metadata=r.metadata||{},i._trimEnd=r.trimEnd,i.transaction=i,i}return a(t,"Transaction"),t.prototype.setName=function(r){this.name=r},t.prototype.initSpanRecorder=function(r){r===void 0&&(r=1e3),this.spanRecorder||(this.spanRecorder=new _en.SpanRecorder(r)),this.spanRecorder.add(this)},t.prototype.setMeasurements=function(r){this._measurements=Tj.__assign({},r)},t.prototype.setMetadata=function(r){this.metadata=Tj.__assign(Tj.__assign({},this.metadata),r)},t.prototype.finish=function(r){var n=this,i,s,o;if(this.endTimestamp===void 0){if(this.name||(Rj.logger.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),e.prototype.finish.call(this,r),this.sampled!==!0){Rj.logger.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),(o=(i=this._hub.getClient())===null||i===void 0?void 0:(s=i.getTransport()).recordLostEvent)===null||o===void 0||o.call(s,cno.Outcome.SampleRate,"transaction");return}var c=this.spanRecorder?this.spanRecorder.spans.filter(function(f){return f!==n&&f.endTimestamp}):[];this._trimEnd&&c.length>0&&(this.endTimestamp=c.reduce(function(f,p){return f.endTimestamp&&p.endTimestamp?f.endTimestamp>p.endTimestamp?f:p:f}).endTimestamp);var l={contexts:{trace:this.getTraceContext()},spans:c,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",debug_meta:this.metadata},d=Object.keys(this._measurements).length>0;return d&&(Rj.logger.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),l.measurements=this._measurements),Rj.logger.log("[Tracing] Finishing "+this.op+" transaction: "+this.name+"."),this._hub.captureEvent(l)}},t.prototype.toContext=function(){var r=e.prototype.toContext.call(this);return Rj.dropUndefinedKeys(Tj.__assign(Tj.__assign({},r),{name:this.name,trimEnd:this._trimEnd}))},t.prototype.updateWithContext=function(r){var n;return e.prototype.updateWithContext.call(this,r),this.name=(n=r.name,n!=null?n:""),this._trimEnd=r.trimEnd,this},t}(_en.Span);FSt.Transaction=lno});var AEe=x(JI=>{Object.defineProperty(JI,"__esModule",{value:!0});var zSt=p1(),ov=Al(),uno=CEe(),hen=XI(),dno=EEe();JI.DEFAULT_IDLE_TIMEOUT=1e3;JI.HEARTBEAT_INTERVAL=5e3;var yen=function(e){zSt.__extends(t,e);function t(r,n,i,s){i===void 0&&(i="");var o=e.call(this,s)||this;return o._pushActivity=r,o._popActivity=n,o.transactionSpanId=i,o}return a(t,"IdleTransactionSpanRecorder"),t.prototype.add=function(r){var n=this;r.spanId!==this.transactionSpanId&&(r.finish=function(i){r.endTimestamp=typeof i=="number"?i:ov.timestampWithMs(),n._popActivity(r.spanId)},r.endTimestamp===void 0&&this._pushActivity(r.spanId)),e.prototype.add.call(this,r)},t}(uno.SpanRecorder);JI.IdleTransactionSpanRecorder=yen;var fno=function(e){zSt.__extends(t,e);function t(r,n,i,s){i===void 0&&(i=JI.DEFAULT_IDLE_TIMEOUT),s===void 0&&(s=!1);var o=e.call(this,r,n)||this;return o._idleHub=n,o._idleTimeout=i,o._onScope=s,o.activities={},o._heartbeatCounter=0,o._finished=!1,o._beforeFinishCallbacks=[],n&&s&&(ven(n),ov.logger.log("Setting idle transaction on scope. Span ID: "+o.spanId),n.configureScope(function(c){return c.setSpan(o)})),o._initTimeout=setTimeout(function(){o._finished||o.finish()},o._idleTimeout),o}return a(t,"IdleTransaction"),t.prototype.finish=function(r){var n,i,s=this;if(r===void 0&&(r=ov.timestampWithMs()),this._finished=!0,this.activities={},this.spanRecorder){ov.logger.log("[Tracing] finishing IdleTransaction",new Date(r*1e3).toISOString(),this.op);try{for(var o=zSt.__values(this._beforeFinishCallbacks),c=o.next();!c.done;c=o.next()){var l=c.value;l(this,r)}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.spanRecorder.spans=this.spanRecorder.spans.filter(function(d){if(d.spanId===s.spanId)return!0;d.endTimestamp||(d.endTimestamp=r,d.setStatus(hen.SpanStatus.Cancelled),ov.logger.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(d,void 0,2)));var f=d.startTimestamp<r;return f||ov.logger.log("[Tracing] discarding Span since it happened after Transaction was finished",JSON.stringify(d,void 0,2)),f}),ov.logger.log("[Tracing] flushing IdleTransaction")}else ov.logger.log("[Tracing] No active IdleTransaction");return this._onScope&&ven(this._idleHub),e.prototype.finish.call(this,r)},t.prototype.registerBeforeFinishCallback=function(r){this._beforeFinishCallbacks.push(r)},t.prototype.initSpanRecorder=function(r){var n=this;if(!this.spanRecorder){var i=a(function(o){n._finished||n._pushActivity(o)},"pushActivity"),s=a(function(o){n._finished||n._popActivity(o)},"popActivity");this.spanRecorder=new yen(i,s,this.spanId,r),ov.logger.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)},t.prototype._pushActivity=function(r){this._initTimeout&&(clearTimeout(this._initTimeout),this._initTimeout=void 0),ov.logger.log("[Tracing] pushActivity: "+r),this.activities[r]=!0,ov.logger.log("[Tracing] new activities count",Object.keys(this.activities).length)},t.prototype._popActivity=function(r){var n=this;if(this.activities[r]&&(ov.logger.log("[Tracing] popActivity "+r),delete this.activities[r],ov.logger.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){var i=this._idleTimeout,s=ov.timestampWithMs()+i/1e3;setTimeout(function(){n._finished||n.finish(s)},i)}},t.prototype._beat=function(){if(!this._finished){var r=Object.keys(this.activities).join("");r===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=r,this._heartbeatCounter>=3?(ov.logger.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus(hen.SpanStatus.DeadlineExceeded),this.setTag("heartbeat","failed"),this.finish()):this._pingHeartbeat()}},t.prototype._pingHeartbeat=function(){var r=this;ov.logger.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),setTimeout(function(){r._beat()},JI.HEARTBEAT_INTERVAL)},t}(dno.Transaction);JI.IdleTransaction=fno;function ven(e){if(e){var t=e.getScope();if(t){var r=t.getTransaction();r&&t.setSpan(void 0)}}}a(ven,"clearActiveTransaction")});var PEe=x((fV,mV)=>{Object.defineProperty(fV,"__esModule",{value:!0});var jSt=p1(),wen=jb(),xEe=dy(),LC=Al(),mno=pen(),pno=AEe(),gno=EEe(),_no=KI();function hno(){var e=this.getScope();if(e){var t=e.getSpan();if(t)return{"sentry-trace":t.toTraceparent()}}return{}}a(hno,"traceHeaders");function ben(e,t,r){if(!_no.hasTracingEnabled())return e.sampled=!1,e;if(e.sampled!==void 0)return e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Explicit}}),e;var n;return typeof t.tracesSampler=="function"?(n=t.tracesSampler(r),e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Sampler,rate:Number(n)}})):r.parentSampled!==void 0?(n=r.parentSampled,e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Inheritance}})):(n=t.tracesSampleRate,e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Rate,rate:Number(n)}})),yno(n)?n?(e.sampled=Math.random()<n,e.sampled?(LC.logger.log("[Tracing] starting "+e.op+" transaction - "+e.name),e):(LC.logger.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = "+Number(n)+")"),e)):(LC.logger.log("[Tracing] Discarding transaction because "+(typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),e.sampled=!1,e):(LC.logger.warn("[Tracing] Discarding transaction because of invalid sample rate."),e.sampled=!1,e)}a(ben,"sample");function yno(e){return isNaN(e)||!(typeof e=="number"||typeof e=="boolean")?(LC.logger.warn("[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got "+JSON.stringify(e)+" of type "+JSON.stringify(typeof e)+"."),!1):e<0||e>1?(LC.logger.warn("[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got "+e+"."),!1):!0}a(yno,"isValidSampleRate");function vno(e,t){var r,n,i=((r=this.getClient())===null||r===void 0?void 0:r.getOptions())||{},s=new gno.Transaction(e,this);return s=ben(s,i,jSt.__assign({parentSampled:e.parentSampled,transactionContext:e},t)),s.sampled&&s.initSpanRecorder((n=i._experiments)===null||n===void 0?void 0:n.maxSpans),s}a(vno,"_startTransaction");function wno(e,t,r,n,i){var s,o,c=((s=e.getClient())===null||s===void 0?void 0:s.getOptions())||{},l=new pno.IdleTransaction(t,e,r,n);return l=ben(l,c,jSt.__assign({parentSampled:t.parentSampled,transactionContext:t},i)),l.sampled&&l.initSpanRecorder((o=c._experiments)===null||o===void 0?void 0:o.maxSpans),l}a(wno,"startIdleTransaction");fV.startIdleTransaction=wno;function Sen(){var e=wen.getMainCarrier();!e.__SENTRY__||(e.__SENTRY__.extensions=e.__SENTRY__.extensions||{},e.__SENTRY__.extensions.startTransaction||(e.__SENTRY__.extensions.startTransaction=vno),e.__SENTRY__.extensions.traceHeaders||(e.__SENTRY__.extensions.traceHeaders=hno))}a(Sen,"_addTracingExtensions");fV._addTracingExtensions=Sen;function bno(){var e=wen.getMainCarrier();if(!!e.__SENTRY__){var t={mongodb:function(){var n=LC.dynamicRequire(mV,"./integrations/mongo");return new n.Mongo},mongoose:function(){var n=LC.dynamicRequire(mV,"./integrations/mongo");return new n.Mongo({mongoose:!0})},mysql:function(){var n=LC.dynamicRequire(mV,"./integrations/mysql");return new n.Mysql},pg:function(){var n=LC.dynamicRequire(mV,"./integrations/postgres");return new n.Postgres}},r=Object.keys(t).filter(function(n){return!!LC.loadModule(n)}).map(function(n){try{return t[n]()}catch(i){return}}).filter(function(n){return n});r.length>0&&(e.__SENTRY__.integrations=jSt.__spread(e.__SENTRY__.integrations||[],r))}}a(bno,"_autoloadDatabaseIntegrations");function Sno(){Sen(),LC.isNodeEnv()&&bno(),mno.registerErrorInstrumentation()}a(Sno,"addExtensionMethods");fV.addExtensionMethods=Sno});var Een=x(USt=>{Object.defineProperty(USt,"__esModule",{value:!0});var BSt=Al(),Cen=XI(),Cno=KI(),kEe=BSt.getGlobalObject();function Eno(){kEe&&kEe.document?kEe.document.addEventListener("visibilitychange",function(){var e=Cno.getActiveTransaction();kEe.document.hidden&&e&&(BSt.logger.log("[Tracing] Transaction: "+Cen.SpanStatus.Cancelled+" -> since tab moved to the background, op: "+e.op),e.status||e.setStatus(Cen.SpanStatus.Cancelled),e.setTag("visibilitychange","document.hidden"),e.finish())}):BSt.logger.warn("[Tracing] Could not set up background tab detection due to lack of global document")}a(Eno,"registerBackgroundTabDetection");USt.registerBackgroundTabDetection=Eno});var DEe=x(GSt=>{Object.defineProperty(GSt,"__esModule",{value:!0});GSt.bindReporter=function(e,t,r){var n;return function(i){t.value>=0&&(i||r)&&(t.delta=t.value-(n||0),(t.delta||n===void 0)&&(n=t.value,e(t)))}}});var Aen=x($St=>{Object.defineProperty($St,"__esModule",{value:!0});$St.generateUniqueID=function(){return"v2-"+Date.now()+"-"+(Math.floor(Math.random()*(9e12-1))+1e12)}});var TEe=x(HSt=>{Object.defineProperty(HSt,"__esModule",{value:!0});var Ano=Aen();HSt.initMetric=function(e,t){return{name:e,value:t!=null?t:-1,delta:0,entries:[],id:Ano.generateUniqueID()}}});var REe=x(VSt=>{Object.defineProperty(VSt,"__esModule",{value:!0});VSt.observe=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(e==="first-input"&&!("PerformanceEventTiming"in self))return;var r=new PerformanceObserver(function(n){return n.getEntries().map(t)});return r.observe({type:e,buffered:!0}),r}}catch(n){}}});var pV=x(WSt=>{Object.defineProperty(WSt,"__esModule",{value:!0});var xno=Al();WSt.onHidden=function(e,t){var r=a(function(n){(n.type==="pagehide"||xno.getGlobalObject().document.visibilityState==="hidden")&&(e(n),t&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))},"onHiddenOrPageHide");addEventListener("visibilitychange",r,!0),addEventListener("pagehide",r,!0)}});var xen=x(XSt=>{Object.defineProperty(XSt,"__esModule",{value:!0});var Pno=DEe(),kno=TEe(),Dno=REe(),Tno=pV();XSt.getCLS=function(e,t){var r=kno.initMetric("CLS",0),n,i=0,s=[],o=a(function(l){if(l&&!l.hadRecentInput){var d=s[0],f=s[s.length-1];i&&s.length!==0&&l.startTime-f.startTime<1e3&&l.startTime-d.startTime<5e3?(i+=l.value,s.push(l)):(i=l.value,s=[l]),i>r.value&&(r.value=i,r.entries=s,n&&n())}},"entryHandler"),c=Dno.observe("layout-shift",o);c&&(n=Pno.bindReporter(e,r,t),Tno.onHidden(function(){c.takeRecords().map(o),n(!0)}))}});var NEe=x(KSt=>{Object.defineProperty(KSt,"__esModule",{value:!0});var Rno=Al(),Ino=pV(),IEe=-1,Nno=a(function(){return Rno.getGlobalObject().document.visibilityState==="hidden"?0:1/0},"initHiddenTime"),Lno=a(function(){Ino.onHidden(function(e){var t=e.timeStamp;IEe=t},!0)},"trackChanges");KSt.getVisibilityWatcher=function(){return IEe<0&&(IEe=Nno(),Lno()),{get firstHiddenTime(){return IEe}}}});var Pen=x(JSt=>{Object.defineProperty(JSt,"__esModule",{value:!0});var qno=DEe(),Ono=NEe(),Mno=TEe(),Fno=REe(),zno=pV();JSt.getFID=function(e,t){var r=Ono.getVisibilityWatcher(),n=Mno.initMetric("FID"),i,s=a(function(c){i&&c.startTime<r.firstHiddenTime&&(n.value=c.processingStart-c.startTime,n.entries.push(c),i(!0))},"entryHandler"),o=Fno.observe("first-input",s);o&&(i=qno.bindReporter(e,n,t),zno.onHidden(function(){o.takeRecords().map(s),o.disconnect()},!0))}});var Den=x(QSt=>{Object.defineProperty(QSt,"__esModule",{value:!0});var jno=DEe(),Bno=NEe(),Uno=TEe(),Gno=REe(),$no=pV(),ken={};QSt.getLCP=function(e,t){var r=Bno.getVisibilityWatcher(),n=Uno.initMetric("LCP"),i,s=a(function(l){var d=l.startTime;d<r.firstHiddenTime&&(n.value=d,n.entries.push(l)),i&&i()},"entryHandler"),o=Gno.observe("largest-contentful-paint",s);if(o){i=jno.bindReporter(e,n,t);var c=a(function(){ken[n.id]||(o.takeRecords().map(s),o.disconnect(),ken[n.id]=!0,i(!0))},"stopListening_1");["keydown","click"].forEach(function(l){addEventListener(l,c,{once:!0,capture:!0})}),$no.onHidden(c,!0)}}});var Ien=x(Ij=>{Object.defineProperty(Ij,"__esModule",{value:!0});var Ten=p1(),O_=Al(),bh=KI(),Hno=xen(),Vno=Pen(),Wno=Den(),Xno=NEe(),aw=O_.getGlobalObject();Ij.DEFAULT_METRICS_INSTR_OPTIONS={_reportAllChanges:!1};var Kno=function(){function e(t){var r,n;this._measurements={},this._performanceCursor=0,!O_.isNodeEnv()&&((r=aw)===null||r===void 0?void 0:r.performance)&&((n=aw)===null||n===void 0?void 0:n.document)&&(aw.performance.mark&&aw.performance.mark("sentry-tracing-init"),this._trackCLS(),this._trackLCP(t._reportAllChanges),this._trackFID())}return a(e,"MetricsInstrumentation"),e.prototype.addPerformanceEntries=function(t){var r=this;if(!(!aw||!aw.performance||!aw.performance.getEntries||!O_.browserPerformanceTimeOrigin)){O_.logger.log("[Tracing] Adding & adjusting spans using Performance API");var n=bh.msToSec(O_.browserPerformanceTimeOrigin),i;if(aw.document&&aw.document.scripts){for(var s=0;s<aw.document.scripts.length;s++)if(aw.document.scripts[s].dataset.entry==="true"){i=aw.document.scripts[s].src;break}}var o,c,l,d;if(aw.performance.getEntries().slice(this._performanceCursor).forEach(function(p){var h=bh.msToSec(p.startTime),w=bh.msToSec(p.duration);if(!(t.op==="navigation"&&n+h<t.startTimestamp))switch(p.entryType){case"navigation":{Jno(t,p,n),l=n+bh.msToSec(p.responseStart),d=n+bh.msToSec(p.requestStart);break}case"mark":case"paint":case"measure":{var b=Qno(t,p,h,w,n);c===void 0&&p.name==="sentry-tracing-init"&&(c=b);var E=Xno.getVisibilityWatcher(),A=p.startTime<E.firstHiddenTime;p.name==="first-paint"&&A&&(O_.logger.log("[Measurements] Adding FP"),r._measurements.fp={value:p.startTime},r._measurements["mark.fp"]={value:b}),p.name==="first-contentful-paint"&&A&&(O_.logger.log("[Measurements] Adding FCP"),r._measurements.fcp={value:p.startTime},r._measurements["mark.fcp"]={value:b});break}case"resource":{var T=p.name.replace(aw.location.origin,""),R=Ren(t,p,T,h,w,n);o===void 0&&(i||"").indexOf(T)>-1&&(o=R);break}default:}}),o!==void 0&&c!==void 0&&YI(t,{description:"evaluation",endTimestamp:c,op:"script",startTimestamp:o}),this._performanceCursor=Math.max(performance.getEntries().length-1,0),this._trackNavigator(t),t.op==="pageload"){var f=bh.msToSec(O_.browserPerformanceTimeOrigin);typeof l=="number"&&(O_.logger.log("[Measurements] Adding TTFB"),this._measurements.ttfb={value:(l-t.startTimestamp)*1e3},typeof d=="number"&&d<=l&&(this._measurements["ttfb.requestTime"]={value:(l-d)*1e3})),["fcp","fp","lcp"].forEach(function(p){if(!(!r._measurements[p]||f>=t.startTimestamp)){var h=r._measurements[p].value,w=f+bh.msToSec(h),b=Math.abs((w-t.startTimestamp)*1e3),E=b-h;O_.logger.log("[Measurements] Normalized "+p+" from "+h+" to "+b+" ("+E+")"),r._measurements[p].value=b}}),this._measurements["mark.fid"]&&this._measurements.fid&&YI(t,{description:"first input delay",endTimestamp:this._measurements["mark.fid"].value+bh.msToSec(this._measurements.fid.value),op:"web.vitals",startTimestamp:this._measurements["mark.fid"].value}),"fcp"in this._measurements||delete this._measurements.cls,t.setMeasurements(this._measurements),this._tagMetricInfo(t)}}},e.prototype._tagMetricInfo=function(t){this._lcpEntry&&(O_.logger.log("[Measurements] Adding LCP Data"),this._lcpEntry.element&&t.setTag("lcp.element",O_.htmlTreeAsString(this._lcpEntry.element)),this._lcpEntry.id&&t.setTag("lcp.id",this._lcpEntry.id),this._lcpEntry.url&&t.setTag("lcp.url",this._lcpEntry.url.trim().slice(0,200)),t.setTag("lcp.size",this._lcpEntry.size)),this._clsEntry&&this._clsEntry.sources&&(O_.logger.log("[Measurements] Adding CLS Data"),this._clsEntry.sources.forEach(function(r,n){return t.setTag("cls.source."+(n+1),O_.htmlTreeAsString(r.node))}))},e.prototype._trackCLS=function(){var t=this;Hno.getCLS(function(r){var n=r.entries.pop();!n||(O_.logger.log("[Measurements] Adding CLS"),t._measurements.cls={value:r.value},t._clsEntry=n)})},e.prototype._trackNavigator=function(t){var r=aw.navigator;if(!!r){var n=r.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),LEe(n.rtt)&&(this._measurements["connection.rtt"]={value:n.rtt}),LEe(n.downlink)&&(this._measurements["connection.downlink"]={value:n.downlink})),LEe(r.deviceMemory)&&t.setTag("deviceMemory",String(r.deviceMemory)),LEe(r.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(r.hardwareConcurrency))}},e.prototype._trackLCP=function(t){var r=this;Wno.getLCP(function(n){var i=n.entries.pop();if(!!i){var s=bh.msToSec(O_.browserPerformanceTimeOrigin),o=bh.msToSec(i.startTime);O_.logger.log("[Measurements] Adding LCP"),r._measurements.lcp={value:n.value},r._measurements["mark.lcp"]={value:s+o},r._lcpEntry=i}},t)},e.prototype._trackFID=function(){var t=this;Vno.getFID(function(r){var n=r.entries.pop();if(!!n){var i=bh.msToSec(O_.browserPerformanceTimeOrigin),s=bh.msToSec(n.startTime);O_.logger.log("[Measurements] Adding FID"),t._measurements.fid={value:r.value},t._measurements["mark.fid"]={value:i+s}}})},e}();Ij.MetricsInstrumentation=Kno;function Jno(e,t,r){QI({transaction:e,entry:t,event:"unloadEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"redirect",timeOrigin:r}),QI({transaction:e,entry:t,event:"domContentLoadedEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"loadEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"connect",timeOrigin:r}),QI({transaction:e,entry:t,event:"secureConnection",timeOrigin:r,eventEnd:"connectEnd",description:"TLS/SSL"}),QI({transaction:e,entry:t,event:"fetch",timeOrigin:r,eventEnd:"domainLookupStart",description:"cache"}),QI({transaction:e,entry:t,event:"domainLookup",timeOrigin:r,description:"DNS"}),Yno(e,t,r)}a(Jno,"addNavigationSpans");function Qno(e,t,r,n,i){var s=i+r,o=s+n;return YI(e,{description:t.name,endTimestamp:o,op:t.entryType,startTimestamp:s}),s}a(Qno,"addMeasureSpans");function Ren(e,t,r,n,i,s){if(!(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")){var o={};"transferSize"in t&&(o["Transfer Size"]=t.transferSize),"encodedBodySize"in t&&(o["Encoded Body Size"]=t.encodedBodySize),"decodedBodySize"in t&&(o["Decoded Body Size"]=t.decodedBodySize);var c=s+n,l=c+i;return YI(e,{description:r,endTimestamp:l,op:t.initiatorType?"resource."+t.initiatorType:"resource",startTimestamp:c,data:o}),l}}a(Ren,"addResourceSpans");Ij.addResourceSpans=Ren;function QI(e){var t=e.transaction,r=e.entry,n=e.event,i=e.timeOrigin,s=e.eventEnd,o=e.description,c=s?r[s]:r[n+"End"],l=r[n+"Start"];!l||!c||YI(t,{op:"browser",description:o!=null?o:n,startTimestamp:i+bh.msToSec(l),endTimestamp:i+bh.msToSec(c)})}a(QI,"addPerformanceNavigationTiming");function Yno(e,t,r){YI(e,{op:"browser",description:"request",startTimestamp:r+bh.msToSec(t.requestStart),endTimestamp:r+bh.msToSec(t.responseEnd)}),YI(e,{op:"browser",description:"response",startTimestamp:r+bh.msToSec(t.responseStart),endTimestamp:r+bh.msToSec(t.responseEnd)})}a(Yno,"addRequest");function YI(e,t){var r=t.startTimestamp,n=Ten.__rest(t,["startTimestamp"]);return r&&e.startTimestamp>r&&(e.startTimestamp=r),e.startChild(Ten.__assign({startTimestamp:r},n))}a(YI,"_startChild");Ij._startChild=YI;function LEe(e){return typeof e=="number"&&isFinite(e)}a(LEe,"isMeasurementValue")});var YSt=x(OD=>{Object.defineProperty(OD,"__esModule",{value:!0});var qD=p1(),gV=Al(),Zno=XI(),qEe=KI();OD.DEFAULT_TRACING_ORIGINS=["localhost",/^\//];OD.defaultRequestInstrumentationOptions={traceFetch:!0,traceXHR:!0,tracingOrigins:OD.DEFAULT_TRACING_ORIGINS};function eio(e){var t=qD.__assign(qD.__assign({},OD.defaultRequestInstrumentationOptions),e),r=t.traceFetch,n=t.traceXHR,i=t.tracingOrigins,s=t.shouldCreateSpanForRequest,o={},c=a(function(f){if(o[f])return o[f];var p=i;return o[f]=p.some(function(h){return gV.isMatchingPattern(f,h)})&&!gV.isMatchingPattern(f,"sentry_key"),o[f]},"defaultShouldCreateSpan"),l=c;typeof s=="function"&&(l=a(function(f){return c(f)&&s(f)},"shouldCreateSpan"));var d={};r&&gV.addInstrumentationHandler({callback:function(f){Nen(f,l,d)},type:"fetch"}),n&&gV.addInstrumentationHandler({callback:function(f){Len(f,l,d)},type:"xhr"})}a(eio,"instrumentOutgoingRequests");OD.instrumentOutgoingRequests=eio;function Nen(e,t,r){if(!(!qEe.hasTracingEnabled()||!(e.fetchData&&t(e.fetchData.url)))){if(e.endTimestamp&&e.fetchData.__span){var n=r[e.fetchData.__span];n&&(e.response?n.setHttpStatus(e.response.status):e.error&&n.setStatus(Zno.SpanStatus.InternalError),n.finish(),delete r[e.fetchData.__span]);return}var i=qEe.getActiveTransaction();if(i){var n=i.startChild({data:qD.__assign(qD.__assign({},e.fetchData),{type:"fetch"}),description:e.fetchData.method+" "+e.fetchData.url,op:"http.client"});e.fetchData.__span=n.spanId,r[n.spanId]=n;var s=e.args[0]=e.args[0],o=e.args[1]=e.args[1]||{},c=o.headers;gV.isInstanceOf(s,Request)&&(c=s.headers),c?typeof c.append=="function"?c.append("sentry-trace",n.toTraceparent()):Array.isArray(c)?c=qD.__spread(c,[["sentry-trace",n.toTraceparent()]]):c=qD.__assign(qD.__assign({},c),{"sentry-trace":n.toTraceparent()}):c={"sentry-trace":n.toTraceparent()},o.headers=c}}}a(Nen,"fetchCallback");OD.fetchCallback=Nen;function Len(e,t,r){var n,i;if(!(!qEe.hasTracingEnabled()||((n=e.xhr)===null||n===void 0?void 0:n.__sentry_own_request__)||!(((i=e.xhr)===null||i===void 0?void 0:i.__sentry_xhr__)&&t(e.xhr.__sentry_xhr__.url)))){var s=e.xhr.__sentry_xhr__;if(e.endTimestamp&&e.xhr.__sentry_xhr_span_id__){var o=r[e.xhr.__sentry_xhr_span_id__];o&&(o.setHttpStatus(s.status_code),o.finish(),delete r[e.xhr.__sentry_xhr_span_id__]);return}var c=qEe.getActiveTransaction();if(c){var o=c.startChild({data:qD.__assign(qD.__assign({},s.data),{type:"xhr",method:s.method,url:s.url}),description:s.method+" "+s.url,op:"http.client"});if(e.xhr.__sentry_xhr_span_id__=o.spanId,r[e.xhr.__sentry_xhr_span_id__]=o,e.xhr.setRequestHeader)try{e.xhr.setRequestHeader("sentry-trace",o.toTraceparent())}catch(d){}}}}a(Len,"xhrCallback");OD.xhrCallback=Len});var qen=x(ZSt=>{Object.defineProperty(ZSt,"__esModule",{value:!0});var OEe=Al(),_V=OEe.getGlobalObject();function tio(e,t,r){if(t===void 0&&(t=!0),r===void 0&&(r=!0),!_V||!_V.location){OEe.logger.warn("Could not initialize routing instrumentation due to invalid location");return}var n=_V.location.href,i;t&&(i=e({name:_V.location.pathname,op:"pageload"})),r&&OEe.addInstrumentationHandler({callback:function(s){var o=s.to,c=s.from;if(c===void 0&&n&&n.indexOf(o)!==-1){n=void 0;return}c!==o&&(n=void 0,i&&(OEe.logger.log("[Tracing] Finishing current transaction with op: "+i.op),i.finish()),i=e({name:_V.location.pathname,op:"navigation"}))},type:"history"})}a(tio,"instrumentRoutingWithDefaults");ZSt.instrumentRoutingWithDefaults=tio});var jen=x(SO=>{Object.defineProperty(SO,"__esModule",{value:!0});var g1=p1(),bO=Al(),rio=PEe(),nio=AEe(),iio=XI(),Oen=KI(),aio=Een(),Men=Ien(),MEe=YSt(),sio=qen();SO.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS=600;var oio=g1.__assign({idleTimeout:nio.DEFAULT_IDLE_TIMEOUT,markBackgroundTransactions:!0,maxTransactionDuration:SO.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS,routingInstrumentation:sio.instrumentRoutingWithDefaults,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0},MEe.defaultRequestInstrumentationOptions),cio=function(){function e(t){this.name=e.id,this._emitOptionsWarning=!1;var r=MEe.defaultRequestInstrumentationOptions.tracingOrigins;t&&t.tracingOrigins&&Array.isArray(t.tracingOrigins)&&t.tracingOrigins.length!==0?r=t.tracingOrigins:this._emitOptionsWarning=!0,this.options=g1.__assign(g1.__assign(g1.__assign({},oio),t),{tracingOrigins:r}),this._metrics=new Men.MetricsInstrumentation(g1.__assign(g1.__assign({},Men.DEFAULT_METRICS_INSTR_OPTIONS),this.options._metricOptions))}return a(e,"BrowserTracing"),e.prototype.setupOnce=function(t,r){var n=this;this._getCurrentHub=r,this._emitOptionsWarning&&(bO.logger.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),bO.logger.warn("[Tracing] We added a reasonable default for you: "+MEe.defaultRequestInstrumentationOptions.tracingOrigins));var i=this.options,s=i.routingInstrumentation,o=i.startTransactionOnLocationChange,c=i.startTransactionOnPageLoad,l=i.markBackgroundTransactions,d=i.traceFetch,f=i.traceXHR,p=i.tracingOrigins,h=i.shouldCreateSpanForRequest;s(function(w){return n._createRouteTransaction(w)},c,o),l&&aio.registerBackgroundTabDetection(),MEe.instrumentOutgoingRequests({traceFetch:d,traceXHR:f,tracingOrigins:p,shouldCreateSpanForRequest:h})},e.prototype._createRouteTransaction=function(t){var r=this;if(!this._getCurrentHub){bO.logger.warn("[Tracing] Did not create "+t.op+" transaction because _getCurrentHub is invalid.");return}var n=this.options,i=n.beforeNavigate,s=n.idleTimeout,o=n.maxTransactionDuration,c=t.op==="pageload"?Fen():void 0,l=g1.__assign(g1.__assign(g1.__assign({},t),c),{trimEnd:!0}),d=typeof i=="function"?i(l):l,f=d===void 0?g1.__assign(g1.__assign({},l),{sampled:!1}):d;f.sampled===!1&&bO.logger.log("[Tracing] Will not send "+f.op+" transaction because of beforeNavigate."),bO.logger.log("[Tracing] Starting "+f.op+" transaction on scope");var p=this._getCurrentHub(),h=bO.getGlobalObject().location,w=rio.startIdleTransaction(p,f,s,!0,{location:h});return w.registerBeforeFinishCallback(function(b,E){r._metrics.addPerformanceEntries(b),lio(Oen.secToMs(o),b,E)}),w},e.id="BrowserTracing",e}();SO.BrowserTracing=cio;function Fen(){var e=zen("sentry-trace");if(e)return Oen.extractTraceparentData(e)}a(Fen,"getHeaderContext");SO.getHeaderContext=Fen;function zen(e){var t=bO.getGlobalObject().document.querySelector("meta[name="+e+"]");return t?t.getAttribute("content"):null}a(zen,"getMetaContent");SO.getMetaContent=zen;function lio(e,t,r){var n=r-t.startTimestamp,i=r&&(n>e||n<0);i&&(t.setStatus(iio.SpanStatus.DeadlineExceeded),t.setTag("maxTransactionDurationExceeded","true"))}a(lio,"adjustTransactionDuration")});var eCt=x(hV=>{Object.defineProperty(hV,"__esModule",{value:!0});var uio=jen();hV.BrowserTracing=uio.BrowserTracing;var Ben=YSt();hV.instrumentOutgoingRequests=Ben.instrumentOutgoingRequests;hV.defaultRequestInstrumentationOptions=Ben.defaultRequestInstrumentationOptions});var Gen=x(rCt=>{Object.defineProperty(rCt,"__esModule",{value:!0});var tCt=p1(),dio=Al(),fio=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._router=t.router||t.app,this._methods=(Array.isArray(t.methods)?t.methods:[]).concat("use")}return a(e,"Express"),e.prototype.setupOnce=function(){if(!this._router){dio.logger.error("ExpressIntegration is missing an Express instance");return}gio(this._router,this._methods)},e.id="Express",e}();rCt.Express=fio;function Uen(e,t){var r=e.length;switch(r){case 2:return function(n,i){var s=i.__sentry_transaction;if(s){var o=s.startChild({description:e.name,op:"middleware."+t});i.once("finish",function(){o.finish()})}return e.call(this,n,i)};case 3:return function(n,i,s){var o,c=i.__sentry_transaction,l=(o=c)===null||o===void 0?void 0:o.startChild({description:e.name,op:"middleware."+t});e.call(this,n,i,function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var p;(p=l)===null||p===void 0||p.finish(),s.call.apply(s,tCt.__spread([this],d))})};case 4:return function(n,i,s,o){var c,l=s.__sentry_transaction,d=(c=l)===null||c===void 0?void 0:c.startChild({description:e.name,op:"middleware."+t});e.call(this,n,i,s,function(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];var h;(h=d)===null||h===void 0||h.finish(),o.call.apply(o,tCt.__spread([this],f))})};default:throw new Error("Express middleware takes 2-4 arguments. Got: "+r)}}a(Uen,"wrap");function mio(e,t){return e.map(function(r){return typeof r=="function"?Uen(r,t):Array.isArray(r)?r.map(function(n){return typeof n=="function"?Uen(n,t):n}):r})}a(mio,"wrapMiddlewareArgs");function pio(e,t){var r=e[t];return e[t]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return r.call.apply(r,tCt.__spread([this],mio(n,t)))},e}a(pio,"patchMiddleware");function gio(e,t){t===void 0&&(t=[]),t.forEach(function(r){return pio(e,r)})}a(gio,"instrumentMiddlewares")});var $en=x(nCt=>{Object.defineProperty(nCt,"__esModule",{value:!0});var yV=Al(),_io=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._usePgNative=!!t.usePgNative}return a(e,"Postgres"),e.prototype.setupOnce=function(t,r){var n,i=yV.loadModule("pg");if(!i){yV.logger.error("Postgres Integration was unable to require `pg` package.");return}if(this._usePgNative&&!((n=i.native)===null||n===void 0?void 0:n.Client)){yV.logger.error("Postgres Integration was unable to access 'pg-native' bindings.");return}var s=(this._usePgNative?i.native:i).Client;yV.fill(s.prototype,"query",function(o){return function(c,l,d){var f,p,h,w=r().getScope(),b=(f=w)===null||f===void 0?void 0:f.getSpan(),E=(p=b)===null||p===void 0?void 0:p.startChild({description:typeof c=="string"?c:c.text,op:"db"});if(typeof d=="function")return o.call(this,c,l,function(T,R){var B;(B=E)===null||B===void 0||B.finish(),d(T,R)});if(typeof l=="function")return o.call(this,c,function(T,R){var B;(B=E)===null||B===void 0||B.finish(),l(T,R)});var A=typeof l!="undefined"?o.call(this,c,l):o.call(this,c);return yV.isThenable(A)?A.then(function(T){var R;return(R=E)===null||R===void 0||R.finish(),T}):((h=E)===null||h===void 0||h.finish(),A)}})},e.id="Postgres",e}();nCt.Postgres=_io});var Hen=x(aCt=>{Object.defineProperty(aCt,"__esModule",{value:!0});var iCt=Al(),hio=function(){function e(){this.name=e.id}return a(e,"Mysql"),e.prototype.setupOnce=function(t,r){var n=iCt.loadModule("mysql/lib/Connection.js");if(!n){iCt.logger.error("Mysql Integration was unable to require `mysql` package.");return}iCt.fill(n,"createQuery",function(i){return function(s,o,c){var l,d,f=r().getScope(),p=(l=f)===null||l===void 0?void 0:l.getSpan(),h=(d=p)===null||d===void 0?void 0:d.startChild({description:typeof s=="string"?s:s.sql,op:"db"});return typeof c=="function"?i.call(this,s,o,function(w,b,E){var A;(A=h)===null||A===void 0||A.finish(),c(w,b,E)}):typeof o=="function"?i.call(this,s,function(w,b,E){var A;(A=h)===null||A===void 0||A.finish(),o(w,b,E)}):i.call(this,s,o,c)}})},e.id="Mysql",e}();aCt.Mysql=hio});var Ven=x(oCt=>{Object.defineProperty(oCt,"__esModule",{value:!0});var sCt=p1(),FEe=Al(),yio=["aggregate","bulkWrite","countDocuments","createIndex","createIndexes","deleteMany","deleteOne","distinct","drop","dropIndex","dropIndexes","estimatedDocumentCount","find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate","indexes","indexExists","indexInformation","initializeOrderedBulkOp","insertMany","insertOne","isCapped","mapReduce","options","parallelCollectionScan","rename","replaceOne","stats","updateMany","updateOne"],vio={bulkWrite:["operations"],countDocuments:["query"],createIndex:["fieldOrSpec"],createIndexes:["indexSpecs"],deleteMany:["filter"],deleteOne:["filter"],distinct:["key","query"],dropIndex:["indexName"],find:["query"],findOne:["query"],findOneAndDelete:["filter"],findOneAndReplace:["filter","replacement"],findOneAndUpdate:["filter","update"],indexExists:["indexes"],insertMany:["docs"],insertOne:["doc"],mapReduce:["map","reduce"],rename:["newName"],replaceOne:["filter","doc"],updateMany:["filter","update"],updateOne:["filter","update"]},wio=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._operations=Array.isArray(t.operations)?t.operations:yio,this._describeOperations="describeOperations"in t?t.describeOperations:!0,this._useMongoose=!!t.useMongoose}return a(e,"Mongo"),e.prototype.setupOnce=function(t,r){var n=this._useMongoose?"mongoose":"mongodb",i=FEe.loadModule(n);if(!i){FEe.logger.error("Mongo Integration was unable to require `"+n+"` package.");return}this._instrumentOperations(i.Collection,this._operations,r)},e.prototype._instrumentOperations=function(t,r,n){var i=this;r.forEach(function(s){return i._patchOperation(t,s,n)})},e.prototype._patchOperation=function(t,r,n){if(r in t.prototype){var i=this._getSpanContextFromOperationArguments.bind(this);FEe.fill(t.prototype,r,function(s){return function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];var l,d,f,p,h=o[o.length-1],w=n().getScope(),b=(l=w)===null||l===void 0?void 0:l.getSpan();if(typeof h!="function"||r==="mapReduce"&&o.length===2){var E=(d=b)===null||d===void 0?void 0:d.startChild(i(this,r,o)),A=s.call.apply(s,sCt.__spread([this],o));return FEe.isThenable(A)?A.then(function(R){var B;return(B=E)===null||B===void 0||B.finish(),R}):((f=E)===null||f===void 0||f.finish(),A)}var T=(p=b)===null||p===void 0?void 0:p.startChild(i(this,r,o.slice(0,-1)));return s.call.apply(s,sCt.__spread([this],o.slice(0,-1),[function(R,B){var I;(I=T)===null||I===void 0||I.finish(),h(R,B)}]))}})}},e.prototype._getSpanContextFromOperationArguments=function(t,r,n){var i={collectionName:t.collectionName,dbName:t.dbName,namespace:t.namespace},s={op:"db",description:r,data:i},o=vio[r],c=Array.isArray(this._describeOperations)?this._describeOperations.includes(r):this._describeOperations;if(!o||!c)return s;try{if(r==="mapReduce"){var l=sCt.__read(n,2),d=l[0],f=l[1];i[o[0]]=typeof d=="string"?d:d.name||"<anonymous>",i[o[1]]=typeof f=="string"?f:f.name||"<anonymous>"}else for(var p=0;p<o.length;p++)i[o[p]]=JSON.stringify(n[p])}catch(h){}return s},e.id="Mongo",e}();oCt.Mongo=wio});var Wen=x(Nj=>{Object.defineProperty(Nj,"__esModule",{value:!0});var bio=Gen();Nj.Express=bio.Express;var Sio=$en();Nj.Postgres=Sio.Postgres;var Cio=Hen();Nj.Mysql=Cio.Mysql;var Eio=Ven();Nj.Mongo=Eio.Mongo});var Qen=x(cv=>{Object.defineProperty(cv,"__esModule",{value:!0});var Xen=p1(),Aio=eCt(),Ken=PEe();cv.addExtensionMethods=Ken.addExtensionMethods;var xio=Wen(),Pio=Xen.__assign(Xen.__assign({},xio),{BrowserTracing:Aio.BrowserTracing});cv.Integrations=Pio;var kio=CEe();cv.Span=kio.Span;var Dio=EEe();cv.Transaction=Dio.Transaction;var Jen=eCt();cv.registerRequestInstrumentation=Jen.instrumentOutgoingRequests;cv.defaultRequestInstrumentationOptions=Jen.defaultRequestInstrumentationOptions;var Tio=XI();cv.SpanStatus=Tio.SpanStatus;var Rio=AEe();cv.IdleTransaction=Rio.IdleTransaction;var Iio=PEe();cv.startIdleTransaction=Iio.startIdleTransaction;Ken.addExtensionMethods();var vV=KI();cv.extractTraceparentData=vV.extractTraceparentData;cv.getActiveTransaction=vV.getActiveTransaction;cv.hasTracingEnabled=vV.hasTracingEnabled;cv.stripUrlQueryAndFragment=vV.stripUrlQueryAndFragment;cv.TRACEPARENT_REGEXP=vV.TRACEPARENT_REGEXP});var jEe=x(cCt=>{"use strict";cCt.parse=Oio;cCt.serialize=Mio;var Nio=decodeURIComponent,Lio=encodeURIComponent,qio=/; */,zEe=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function Oio(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var r={},n=t||{},i=e.split(qio),s=n.decode||Nio,o=0;o<i.length;o++){var c=i[o],l=c.indexOf("=");if(!(l<0)){var d=c.substr(0,l).trim(),f=c.substr(++l,c.length).trim();f[0]=='"'&&(f=f.slice(1,-1)),r[d]==null&&(r[d]=Fio(f,s))}}return r}a(Oio,"parse");function Mio(e,t,r){var n=r||{},i=n.encode||Lio;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!zEe.test(e))throw new TypeError("argument name is invalid");var s=i(t);if(s&&!zEe.test(s))throw new TypeError("argument val is invalid");var o=e+"="+s;if(n.maxAge!=null){var c=n.maxAge-0;if(isNaN(c)||!isFinite(c))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(c)}if(n.domain){if(!zEe.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!zEe.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var l=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}a(Mio,"serialize");function Fio(e,t){try{return t(e)}catch(r){return e}}a(Fio,"tryDecode")});var etn=x(EO=>{Object.defineProperty(EO,"__esModule",{value:!0});var zx=nw(),CO=fy(),zio=Qen(),Yen=dy(),Lj=Al(),jio=jEe(),Bio=require("domain"),Uio=require("os"),Gio=require("url"),wV=RSt();function $io(){return a(function(t,r,n){var i;t.headers&&Lj.isString(t.headers["sentry-trace"])&&(i=zio.extractTraceparentData(t.headers["sentry-trace"]));var s=CO.startTransaction(zx.__assign({name:BEe(t,{path:!0,method:!0}),op:"http.server"},i),{request:UEe(t)});CO.getCurrentHub().configureScope(function(o){o.setSpan(s)}),r.__sentry_transaction=s,r.once("finish",function(){setImmediate(function(){Hio(s,t),s.setHttpStatus(r.statusCode),s.finish()})}),n()},"sentryTracingMiddleware")}a($io,"tracingHandler");EO.tracingHandler=$io;function Hio(e,t){!e||(e.name=BEe(t,{path:!0,method:!0}),e.setData("url",t.originalUrl),e.setData("baseUrl",t.baseUrl),e.setData("query",t.query))}a(Hio,"addExpressReqToTransaction");function BEe(e,t){t===void 0&&(t={});var r,n=(r=e.method)===null||r===void 0?void 0:r.toUpperCase(),i="";e.route?i=""+(e.baseUrl||"")+e.route.path:(e.originalUrl||e.url)&&(i=Lj.stripUrlQueryAndFragment(e.originalUrl||e.url||""));var s="";return t.method&&n&&(s+=n),t.method&&t.path&&(s+=" "),t.path&&i&&(s+=i),s}a(BEe,"extractExpressTransactionName");function Vio(e,t){var r;switch(t){case"path":return BEe(e,{path:!0});case"handler":return((r=e.route)===null||r===void 0?void 0:r.stack[0].name)||"<anonymous>";case"methodPath":default:return BEe(e,{path:!0,method:!0})}}a(Vio,"extractTransaction");var Wio=["id","username","email"];function Xio(e,t){var r={},n=Array.isArray(t)?t:Wio;return n.forEach(function(i){e&&i in e&&(r[i]=e[i])}),r}a(Xio,"extractUserData");var Kio=["cookies","data","headers","method","query_string","url"];function UEe(e,t){t===void 0&&(t=Kio);var r={},n=e.headers||e.header||{},i=e.method,s=e.hostname||e.host||n.host||"<no host>",o=e.protocol==="https"||e.secure||(e.socket||{}).encrypted?"https":"http",c=e.originalUrl||e.url||"",l=o+"://"+s+c;return t.forEach(function(d){switch(d){case"headers":r.headers=n;break;case"method":r.method=i;break;case"url":r.url=l;break;case"cookies":r.cookies=e.cookies||jio.parse(n.cookie||"");break;case"query_string":r.query_string=e.query||Gio.parse(c||"",!1).query;break;case"data":if(i==="GET"||i==="HEAD")break;e.body!==void 0&&(r.data=Lj.isString(e.body)?e.body:JSON.stringify(Lj.normalize(e.body)));break;default:({}).hasOwnProperty.call(e,d)&&(r[d]=e[d])}}),r}a(UEe,"extractRequestData");EO.extractRequestData=UEe;function Zen(e,t,r){if(r=zx.__assign({ip:!1,request:!0,serverName:!0,transaction:!0,user:!0,version:!0},r),r.version&&(e.contexts=zx.__assign(zx.__assign({},e.contexts),{runtime:{name:"node",version:global.process.version}})),r.request){var n=Array.isArray(r.request)?UEe(t,r.request):UEe(t);e.request=zx.__assign(zx.__assign({},e.request),n)}if(r.serverName&&!e.server_name&&(e.server_name=global.process.env.SENTRY_NAME||Uio.hostname()),r.user){var i=t.user&&Lj.isPlainObject(t.user)?Xio(t.user,r.user):{};Object.keys(i)&&(e.user=zx.__assign(zx.__assign({},e.user),i))}if(r.ip){var s=t.ip||t.connection&&t.connection.remoteAddress;s&&(e.user=zx.__assign(zx.__assign({},e.user),{ip_address:s}))}return r.transaction&&!e.transaction&&(e.transaction=Vio(t,r.transaction)),e}a(Zen,"parseRequest");EO.parseRequest=Zen;function Jio(e){var t=CO.getCurrentHub(),r=t.getClient();if(r&&wV.isAutoSessionTrackingEnabled(r)){r.initSessionFlusher();var n=t.getScope();n&&n.getSession()&&n.setSession()}return a(function(s,o,c){if(e&&e.flushTimeout&&e.flushTimeout>0){var l=o.end;o.end=function(f,p,h){var w=this;wV.flush(e.flushTimeout).then(function(){l.call(w,f,p,h)}).then(null,function(b){Lj.logger.error(b)})}}var d=Bio.create();d.add(s),d.add(o),d.on("error",c),d.run(function(){var f=CO.getCurrentHub();f.configureScope(function(p){p.addEventProcessor(function(b){return Zen(b,s,e)});var h=f.getClient();if(wV.isAutoSessionTrackingEnabled(h)){var w=f.getScope();w&&w.setRequestSession({status:Yen.RequestSessionStatus.Ok})}}),o.once("finish",function(){var p=f.getClient();wV.isAutoSessionTrackingEnabled(p)&&setImmediate(function(){p&&p._captureRequestSession&&p._captureRequestSession()})}),c()})},"sentryRequestMiddleware")}a(Jio,"requestHandler");EO.requestHandler=Jio;function Qio(e){var t=e.status||e.statusCode||e.status_code||e.output&&e.output.statusCode;return t?parseInt(t,10):500}a(Qio,"getStatusCodeFromResponse");function Yio(e){var t=Qio(e);return t>=500}a(Yio,"defaultShouldHandleError");function Zio(e){return a(function(r,n,i,s){var o=e&&e.shouldHandleError||Yio;if(o(r)){CO.withScope(function(c){var l=i.__sentry_transaction;l&&c.getSpan()===void 0&&c.setSpan(l);var d=CO.getCurrentHub().getClient();if(d&&wV.isAutoSessionTrackingEnabled(d)){var f=d._sessionFlusher!==void 0;if(f){var p=c.getRequestSession();p&&p.status!==void 0&&(p.status=Yen.RequestSessionStatus.Crashed)}}var h=CO.captureException(r);i.sentry=h,s(r)});return}s(r)},"sentryErrorMiddleware")}a(Zio,"errorHandler");EO.errorHandler=Zio});var ntn=x(Ed=>{Object.defineProperty(Ed,"__esModule",{value:!0});var ttn=nw(),rtn=dy();Ed.Severity=rtn.Severity;Ed.Status=rtn.Status;var c_=fy();Ed.addGlobalEventProcessor=c_.addGlobalEventProcessor;Ed.addBreadcrumb=c_.addBreadcrumb;Ed.captureException=c_.captureException;Ed.captureEvent=c_.captureEvent;Ed.captureMessage=c_.captureMessage;Ed.configureScope=c_.configureScope;Ed.getHubFromCarrier=c_.getHubFromCarrier;Ed.getCurrentHub=c_.getCurrentHub;Ed.Hub=c_.Hub;Ed.makeMain=c_.makeMain;Ed.Scope=c_.Scope;Ed.startTransaction=c_.startTransaction;Ed.SDK_VERSION=c_.SDK_VERSION;Ed.setContext=c_.setContext;Ed.setExtra=c_.setExtra;Ed.setExtras=c_.setExtras;Ed.setTag=c_.setTag;Ed.setTags=c_.setTags;Ed.setUser=c_.setUser;Ed.withScope=c_.withScope;var eao=fSt();Ed.NodeBackend=eao.NodeBackend;var tao=gSt();Ed.NodeClient=tao.NodeClient;var qj=RSt();Ed.defaultIntegrations=qj.defaultIntegrations;Ed.init=qj.init;Ed.lastEventId=qj.lastEventId;Ed.flush=qj.flush;Ed.close=qj.close;Ed.getSentryRelease=qj.getSentryRelease;var rao=GZr();Ed.deepReadDirSync=rao.deepReadDirSync;var nao=Qbt();Ed.SDK_NAME=nao.SDK_NAME;var iao=fy(),aao=jb(),sao=require("domain"),oao=etn();Ed.Handlers=oao;var cao=DSt(),lao=uSt();Ed.Transports=lao;var uao=ttn.__assign(ttn.__assign({},iao.Integrations),cao);Ed.Integrations=uao;var bV=aao.getMainCarrier();bV.__SENTRY__&&(bV.__SENTRY__.extensions=bV.__SENTRY__.extensions||{},bV.__SENTRY__.extensions.domain=bV.__SENTRY__.extensions.domain||sao)});var itn,Oj,atn,stn,otn,ctn,lCt=An(()=>{itn=ji(BJr());Tf();Oj=ji(ntn());au();atn=ji(zR());V9();stn=a(()=>{Uy||(0,Oj.init)({dsn:p3t,integrations:[new itn.RewriteFrames({root:global.__rootdir__})],release:Y6(),beforeSend:e=>(console.log(e),e.message=(0,atn.default)(e.message),e)})},"initializeSentry"),otn=a(({invocationId:e,command:t})=>{(0,Oj.setTags)({invocationId:e,command:t})},"setSentryTags"),ctn=a(async e=>{let t=(0,Oj.captureException)(e);return await Lv(d3t),t},"reportErrorToSentry")});var vCt=x((Bx,ytn)=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:!0});function SV(e){return e&&typeof e=="object"&&"default"in e?e.default:e}a(SV,"_interopDefault");var _1=SV(require("stream")),ltn=SV(require("http")),uCt=SV(require("url")),dao=SV(require("https")),AO=SV(require("zlib")),fao=_1.Readable,MD=Symbol("buffer"),dCt=Symbol("type"),ZI=class{constructor(){this[dCt]="";let t=arguments[0],r=arguments[1],n=[],i=0;if(t){let o=t,c=Number(o.length);for(let l=0;l<c;l++){let d=o[l],f;d instanceof Buffer?f=d:ArrayBuffer.isView(d)?f=Buffer.from(d.buffer,d.byteOffset,d.byteLength):d instanceof ArrayBuffer?f=Buffer.from(d):d instanceof ZI?f=d[MD]:f=Buffer.from(typeof d=="string"?d:String(d)),i+=f.length,n.push(f)}}this[MD]=Buffer.concat(n);let s=r&&r.type!==void 0&&String(r.type).toLowerCase();s&&!/[^\u0020-\u007E]/.test(s)&&(this[dCt]=s)}get size(){return this[MD].length}get type(){return this[dCt]}text(){return Promise.resolve(this[MD].toString())}arrayBuffer(){let t=this[MD],r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(r)}stream(){let t=new fao;return t._read=function(){},t.push(this[MD]),t.push(null),t}toString(){return"[object Blob]"}slice(){let t=this.size,r=arguments[0],n=arguments[1],i,s;r===void 0?i=0:r<0?i=Math.max(t+r,0):i=Math.min(r,t),n===void 0?s=t:n<0?s=Math.max(t+n,0):s=Math.min(n,t);let o=Math.max(s-i,0),l=this[MD].slice(i,i+o),d=new ZI([],{type:arguments[2]});return d[MD]=l,d}};a(ZI,"Blob");Object.defineProperties(ZI.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Object.defineProperty(ZI.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0});function lv(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}a(lv,"FetchError");lv.prototype=Object.create(Error.prototype);lv.prototype.constructor=lv;lv.prototype.name="FetchError";var fCt;try{fCt=require("encoding").convert}catch(e){}var FD=Symbol("Body internals"),utn=_1.PassThrough;function Sh(e){var t=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.size;let i=n===void 0?0:n;var s=r.timeout;let o=s===void 0?0:s;e==null?e=null:dtn(e)?e=Buffer.from(e.toString()):CV(e)||Buffer.isBuffer(e)||(Object.prototype.toString.call(e)==="[object ArrayBuffer]"?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof _1||(e=Buffer.from(String(e)))),this[FD]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=o,e instanceof _1&&e.on("error",function(c){let l=c.name==="AbortError"?c:new lv(`Invalid response body while trying to fetch ${t.url}: ${c.message}`,"system",c);t[FD].error=l})}a(Sh,"Body");Sh.prototype={get body(){return this[FD].body},get bodyUsed(){return this[FD].disturbed},arrayBuffer(){return Mj.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return Mj.call(this).then(function(t){return Object.assign(new ZI([],{type:e.toLowerCase()}),{[MD]:t})})},json(){var e=this;return Mj.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(r){return Sh.Promise.reject(new lv(`invalid json response body at ${e.url} reason: ${r.message}`,"invalid-json"))}})},text(){return Mj.call(this).then(function(e){return e.toString()})},buffer(){return Mj.call(this)},textConverted(){var e=this;return Mj.call(this).then(function(t){return mao(t,e.headers)})}};Object.defineProperties(Sh.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});Sh.mixIn=function(e){for(let t of Object.getOwnPropertyNames(Sh.prototype))if(!(t in e)){let r=Object.getOwnPropertyDescriptor(Sh.prototype,t);Object.defineProperty(e,t,r)}};function Mj(){var e=this;if(this[FD].disturbed)return Sh.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[FD].disturbed=!0,this[FD].error)return Sh.Promise.reject(this[FD].error);let t=this.body;if(t===null)return Sh.Promise.resolve(Buffer.alloc(0));if(CV(t)&&(t=t.stream()),Buffer.isBuffer(t))return Sh.Promise.resolve(t);if(!(t instanceof _1))return Sh.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new Sh.Promise(function(s,o){let c;e.timeout&&(c=setTimeout(function(){i=!0,o(new lv(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),t.on("error",function(l){l.name==="AbortError"?(i=!0,o(l)):o(new lv(`Invalid response body while trying to fetch ${e.url}: ${l.message}`,"system",l))}),t.on("data",function(l){if(!(i||l===null)){if(e.size&&n+l.length>e.size){i=!0,o(new lv(`content size at ${e.url} over limit: ${e.size}`,"max-size"));return}n+=l.length,r.push(l)}}),t.on("end",function(){if(!i){clearTimeout(c);try{s(Buffer.concat(r,n))}catch(l){o(new lv(`Could not create Buffer from response body for ${e.url}: ${l.message}`,"system",l))}}})})}a(Mj,"consumeBody");function mao(e,t){if(typeof fCt!="function")throw new Error("The package `encoding` must be installed to use the textConverted() function");let r=t.get("content-type"),n="utf-8",i,s;return r&&(i=/charset=([^;]*)/i.exec(r)),s=e.slice(0,1024).toString(),!i&&s&&(i=/<meta.+?charset=(['"])(.+?)\1/i.exec(s)),!i&&s&&(i=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(s),i||(i=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(s),i&&i.pop()),i&&(i=/charset=(.*)/i.exec(i.pop()))),!i&&s&&(i=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(s)),i&&(n=i.pop(),(n==="gb2312"||n==="gbk")&&(n="gb18030")),fCt(e,"UTF-8",n).toString()}a(mao,"convertBody");function dtn(e){return typeof e!="object"||typeof e.append!="function"||typeof e.delete!="function"||typeof e.get!="function"||typeof e.getAll!="function"||typeof e.has!="function"||typeof e.set!="function"?!1:e.constructor.name==="URLSearchParams"||Object.prototype.toString.call(e)==="[object URLSearchParams]"||typeof e.sort=="function"}a(dtn,"isURLSearchParams");function CV(e){return typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.constructor=="function"&&typeof e.constructor.name=="string"&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}a(CV,"isBlob");function ftn(e){let t,r,n=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof _1&&typeof n.getBoundary!="function"&&(t=new utn,r=new utn,n.pipe(t),n.pipe(r),e[FD].body=t,n=r),n}a(ftn,"clone");function mtn(e){return e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":dtn(e)?"application/x-www-form-urlencoded;charset=UTF-8":CV(e)?e.type||null:Buffer.isBuffer(e)||Object.prototype.toString.call(e)==="[object ArrayBuffer]"||ArrayBuffer.isView(e)?null:typeof e.getBoundary=="function"?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof _1?null:"text/plain;charset=UTF-8"}a(mtn,"extractContentType");function ptn(e){let t=e.body;return t===null?0:CV(t)?t.size:Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync=="function"&&(t._lengthRetrievers&&t._lengthRetrievers.length==0||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}a(ptn,"getTotalBytes");function pao(e,t){let r=t.body;r===null?e.end():CV(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}a(pao,"writeToStream");Sh.Promise=global.Promise;var gtn=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,mCt=/[^\t\x20-\x7e\x80-\xff]/;function EV(e){if(e=`${e}`,gtn.test(e)||e==="")throw new TypeError(`${e} is not a legal HTTP header name`)}a(EV,"validateName");function _tn(e){if(e=`${e}`,mCt.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}a(_tn,"validateValue");function Fj(e,t){t=t.toLowerCase();for(let r in e)if(r.toLowerCase()===t)return r}a(Fj,"find");var Eg=Symbol("map"),m0=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;if(this[Eg]=Object.create(null),t instanceof m0){let r=t.raw(),n=Object.keys(r);for(let i of n)for(let s of r[i])this.append(i,s);return}if(t!=null)if(typeof t=="object"){let r=t[Symbol.iterator];if(r!=null){if(typeof r!="function")throw new TypeError("Header pairs must be iterable");let n=[];for(let i of t){if(typeof i!="object"||typeof i[Symbol.iterator]!="function")throw new TypeError("Each header pair must be iterable");n.push(Array.from(i))}for(let i of n){if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");this.append(i[0],i[1])}}else for(let n of Object.keys(t)){let i=t[n];this.append(n,i)}}else throw new TypeError("Provided initializer must be an object")}get(t){t=`${t}`,EV(t);let r=Fj(this[Eg],t);return r===void 0?null:this[Eg][r].join(", ")}forEach(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=pCt(this),i=0;for(;i<n.length;){var s=n[i];let o=s[0],c=s[1];t.call(r,c,o,this),n=pCt(this),i++}}set(t,r){t=`${t}`,r=`${r}`,EV(t),_tn(r);let n=Fj(this[Eg],t);this[Eg][n!==void 0?n:t]=[r]}append(t,r){t=`${t}`,r=`${r}`,EV(t),_tn(r);let n=Fj(this[Eg],t);n!==void 0?this[Eg][n].push(r):this[Eg][t]=[r]}has(t){return t=`${t}`,EV(t),Fj(this[Eg],t)!==void 0}delete(t){t=`${t}`,EV(t);let r=Fj(this[Eg],t);r!==void 0&&delete this[Eg][r]}raw(){return this[Eg]}keys(){return _Ct(this,"key")}values(){return _Ct(this,"value")}[Symbol.iterator](){return _Ct(this,"key+value")}};a(m0,"Headers");m0.prototype.entries=m0.prototype[Symbol.iterator];Object.defineProperty(m0.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(m0.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});function pCt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key+value";return Object.keys(e[Eg]).sort().map(t==="key"?function(n){return n.toLowerCase()}:t==="value"?function(n){return e[Eg][n].join(", ")}:function(n){return[n.toLowerCase(),e[Eg][n].join(", ")]})}a(pCt,"getHeaders");var gCt=Symbol("internal");function _Ct(e,t){let r=Object.create(hCt);return r[gCt]={target:e,kind:t,index:0},r}a(_Ct,"createHeadersIterator");var hCt=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==hCt)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[gCt];let t=e.target,r=e.kind,n=e.index,i=pCt(t,r),s=i.length;return n>=s?{value:void 0,done:!0}:(this[gCt].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(hCt,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});function gao(e){let t=Object.assign({__proto__:null},e[Eg]),r=Fj(e[Eg],"Host");return r!==void 0&&(t[r]=t[r][0]),t}a(gao,"exportNodeCompatibleHeaders");function _ao(e){let t=new m0;for(let r of Object.keys(e))if(!gtn.test(r))if(Array.isArray(e[r]))for(let n of e[r])mCt.test(n)||(t[Eg][r]===void 0?t[Eg][r]=[n]:t[Eg][r].push(n));else mCt.test(e[r])||(t[Eg][r]=[e[r]]);return t}a(_ao,"createHeadersLenient");var e2=Symbol("Response internals"),hao=ltn.STATUS_CODES,Gb=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sh.call(this,t,r);let n=r.status||200,i=new m0(r.headers);if(t!=null&&!i.has("Content-Type")){let s=mtn(t);s&&i.append("Content-Type",s)}this[e2]={url:r.url,status:n,statusText:r.statusText||hao[n],headers:i,counter:r.counter}}get url(){return this[e2].url||""}get status(){return this[e2].status}get ok(){return this[e2].status>=200&&this[e2].status<300}get redirected(){return this[e2].counter>0}get statusText(){return this[e2].statusText}get headers(){return this[e2].headers}clone(){return new Gb(ftn(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}};a(Gb,"Response");Sh.mixIn(Gb.prototype);Object.defineProperties(Gb.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});Object.defineProperty(Gb.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var zD=Symbol("Request internals"),yCt=uCt.parse,yao=uCt.format,vao="destroy"in _1.Readable.prototype;function GEe(e){return typeof e=="object"&&typeof e[zD]=="object"}a(GEe,"isRequest");function wao(e){let t=e&&typeof e=="object"&&Object.getPrototypeOf(e);return!!(t&&t.constructor.name==="AbortSignal")}a(wao,"isAbortSignal");var jx=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n;GEe(t)?n=yCt(t.url):(t&&t.href?n=yCt(t.href):n=yCt(`${t}`),t={});let i=r.method||t.method||"GET";if(i=i.toUpperCase(),(r.body!=null||GEe(t)&&t.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=r.body!=null?r.body:GEe(t)&&t.body!==null?ftn(t):null;Sh.call(this,s,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});let o=new m0(r.headers||t.headers||{});if(s!=null&&!o.has("Content-Type")){let l=mtn(s);l&&o.append("Content-Type",l)}let c=GEe(t)?t.signal:null;if("signal"in r&&(c=r.signal),c!=null&&!wao(c))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[zD]={method:i,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:n,signal:c},this.follow=r.follow!==void 0?r.follow:t.follow!==void 0?t.follow:20,this.compress=r.compress!==void 0?r.compress:t.compress!==void 0?t.compress:!0,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[zD].method}get url(){return yao(this[zD].parsedURL)}get headers(){return this[zD].headers}get redirect(){return this[zD].redirect}get signal(){return this[zD].signal}clone(){return new jx(this)}};a(jx,"Request");Sh.mixIn(jx.prototype);Object.defineProperty(jx.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(jx.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});function bao(e){let t=e[zD].parsedURL,r=new m0(e[zD].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof _1.Readable&&!vao)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(e.body==null&&/^(POST|PUT)$/i.test(e.method)&&(n="0"),e.body!=null){let s=ptn(e);typeof s=="number"&&(n=String(s))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return typeof i=="function"&&(i=i(t)),!r.has("Connection")&&!i&&r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:gao(r),agent:i})}a(bao,"getNodeRequestOptions");function AV(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}a(AV,"AbortError");AV.prototype=Object.create(Error.prototype);AV.prototype.constructor=AV;AV.prototype.name="AbortError";var htn=_1.PassThrough,Sao=uCt.resolve;function t2(e,t){if(!t2.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Sh.Promise=t2.Promise,new t2.Promise(function(r,n){let i=new jx(e,t),s=bao(i),o=(s.protocol==="https:"?dao:ltn).request,c=i.signal,l=null,d=a(function(){let E=new AV("The user aborted a request.");n(E),i.body&&i.body instanceof _1.Readable&&i.body.destroy(E),!(!l||!l.body)&&l.body.emit("error",E)},"abort");if(c&&c.aborted){d();return}let f=a(function(){d(),w()},"abortAndFinalize"),p=o(s),h;c&&c.addEventListener("abort",f);function w(){p.abort(),c&&c.removeEventListener("abort",f),clearTimeout(h)}a(w,"finalize"),i.timeout&&p.once("socket",function(b){h=setTimeout(function(){n(new lv(`network timeout at: ${i.url}`,"request-timeout")),w()},i.timeout)}),p.on("error",function(b){n(new lv(`request to ${i.url} failed, reason: ${b.message}`,"system",b)),w()}),p.on("response",function(b){clearTimeout(h);let E=_ao(b.headers);if(t2.isRedirect(b.statusCode)){let I=E.get("Location"),q=I===null?null:Sao(i.url,I);switch(i.redirect){case"error":n(new lv(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,"no-redirect")),w();return;case"manual":if(q!==null)try{E.set("Location",q)}catch(K){n(K)}break;case"follow":if(q===null)break;if(i.counter>=i.follow){n(new lv(`maximum redirect reached at: ${i.url}`,"max-redirect")),w();return}let re={headers:new m0(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};if(b.statusCode!==303&&i.body&&ptn(i)===null){n(new lv("Cannot follow redirect with body being a readable stream","unsupported-redirect")),w();return}(b.statusCode===303||(b.statusCode===301||b.statusCode===302)&&i.method==="POST")&&(re.method="GET",re.body=void 0,re.headers.delete("content-length")),r(t2(new jx(q,re))),w();return}}b.once("end",function(){c&&c.removeEventListener("abort",f)});let A=b.pipe(new htn),T={url:i.url,status:b.statusCode,statusText:b.statusMessage,headers:E,size:i.size,timeout:i.timeout,counter:i.counter},R=E.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||R===null||b.statusCode===204||b.statusCode===304){l=new Gb(A,T),r(l);return}let B={flush:AO.Z_SYNC_FLUSH,finishFlush:AO.Z_SYNC_FLUSH};if(R=="gzip"||R=="x-gzip"){A=A.pipe(AO.createGunzip(B)),l=new Gb(A,T),r(l);return}if(R=="deflate"||R=="x-deflate"){b.pipe(new htn).once("data",function(q){(q[0]&15)==8?A=A.pipe(AO.createInflate()):A=A.pipe(AO.createInflateRaw()),l=new Gb(A,T),r(l)});return}if(R=="br"&&typeof AO.createBrotliDecompress=="function"){A=A.pipe(AO.createBrotliDecompress()),l=new Gb(A,T),r(l);return}l=new Gb(A,T),r(l)}),pao(p,i)})}a(t2,"fetch");t2.isRedirect=function(e){return e===301||e===302||e===303||e===307||e===308};t2.Promise=global.Promise;ytn.exports=Bx=t2;Object.defineProperty(Bx,"__esModule",{value:!0});Bx.default=Bx;Bx.Headers=m0;Bx.Request=jx;Bx.Response=Gb;Bx.FetchError=lv});var vtn,wtn,btn=An(()=>{vtn=ji(vCt()),wtn=a((e,t)=>{let{method:r="GET",headers:n={},body:i}=t;return(0,vtn.default)(e,y(m({method:r},i&&{body:JSON.stringify(i)}),{headers:m({"Content-Type":"application/json"},n)})).then(s=>s.json()).then(s=>s)},"jsonFetch")});var Stn,Ctn=An(()=>{Tf();au();V9();btn();Stn=a(async({outcome:e,args:t,systemId:r,command:n,invokedFrom:i,invocationId:s})=>{let o={systemId:r,command:n||null,cliArgs:t?Object.keys(t):null,duration:_7t(),outcome:e,timestamp:Date.now(),locale:Intl.DateTimeFormat().resolvedOptions().locale,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,nodeVersion:process.versions.node,version:Y6(),platform:process.platform,invokedFrom:i,invocationId:s};wtn(u3t,{method:"POST",body:o}).catch(()=>{})},"reportTelemetryEvent")});var Dtn=x((JJc,ktn)=>{"use strict";var Etn=require("child_process"),Atn=Etn.spawn,Cao=Etn.exec;ktn.exports=function(e,t,r){if(typeof t=="function"&&r===void 0&&(r=t,t=void 0),e=parseInt(e),Number.isNaN(e)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[e]=[],i[e]=1,process.platform){case"win32":Cao("taskkill /pid "+e+" /T /F",r);break;case"darwin":wCt(e,n,i,function(s){return Atn("pgrep",["-P",s])},function(){xtn(n,t,r)});break;default:wCt(e,n,i,function(s){return Atn("ps",["-o","pid","--no-headers","--ppid",s])},function(){xtn(n,t,r)});break}};function xtn(e,t,r){var n={};try{Object.keys(e).forEach(function(i){e[i].forEach(function(s){n[s]||(Ptn(s,t),n[s]=1)}),n[i]||(Ptn(i,t),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}a(xtn,"killAll");function Ptn(e,t){try{process.kill(parseInt(e,10),t)}catch(r){if(r.code!=="ESRCH")throw r}}a(Ptn,"killPid");function wCt(e,t,r,n,i){var s=n(e),o="";s.stdout.on("data",function(l){var l=l.toString("ascii");o+=l});var c=a(function(l){if(delete r[e],l!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(d){d=parseInt(d,10),t[e].push(d),t[d]=[],r[d]=1,wCt(d,t,r,n,i)})},"onClose");s.on("close",c)}a(wCt,"buildProcessTree")});var Ttn,bCt,uR,c4e=An(()=>{pc();w$();lCt();Ctn();$u();Ttn=ji(Dtn());au();Qo();Tf();bCt=class{constructor(){this.cleanUpHooks=[];this.isInitialized=!1;this.pendingCancellablePromises={};this.init=async()=>{this.isInitialized||(process.env.NODE_NO_WARNINGS="1",this.registerProcessListeners(),this.isInitialized=!0),this.isErrored=!1};this.registerCleanUpHook=t=>{this.cleanUpHooks.push(t)};this.cleanUpAfterSuccess=async()=>{this.reportTelemetryEvent({outcome:"SUCCESS"}),await this.cleanUp()};this.handleError=async t=>{let r;if(t.isExpected?r=new jn(t.type,t.message,t.hint,t.stack):r=t.details?t:new s_({error:t}),ha.stopAllSpinners(),this.cancelPendingPromises(r),this.reportTelemetryEvent({outcome:r.details.errorType}),!r.isExpected){let n=await ctn(r);r.details.sentryEventId=n}return ha.error(r),await this.cleanUp().catch(()=>{}),{handledError:TXr(r)}};this.reportTelemetryEvent=({outcome:t})=>{Stn({outcome:t,invokedFrom:tk(yn,"invokedFrom"),args:tk(yn,"args"),command:tk(yn,"command"),systemId:tk(yn,"systemId"),invocationId:tk(yn,"invocationId")})};this.cleanUp=async()=>{let t=!1;setTimeout(()=>{t||ha.info("Cleaning up after error...")},100);let{command:r,args:n,relativeConfigPath:i}=yn,s=!n.preserveTempFiles&&!(r==="invoke-local"&&n.watch)&&r!=="package-workloads"&&i;await Promise.all([this.cleanUpHooks.map(o=>o()),s&&u0e()]),t=!0};this.cancelPendingPromises=t=>{Object.values(this.pendingCancellablePromises).forEach(({rejectFn:r})=>{r(t)})};this.handleUnhandledError=({err:t,type:r})=>{this.isErrored||(Uy&&ha.warn(`[shown-only-in-dev-mode] ${r}`),this.isErrored=!0,this.cancelPendingPromises(t))};this.cleanExitProcess=t=>async()=>(yn.invokedFrom==="cli"&&this.reportTelemetryEvent({outcome:t}),await this.cleanUp(),(0,Ttn.default)(process.pid,()=>process.exit(0)));this.registerProcessListeners=()=>{process.removeAllListeners("uncaughtException"),process.removeAllListeners("unhandledRejection"),process.on("uncaughtException",t=>{this.handleUnhandledError({err:t,type:"UNCAUGHT EXCEPTION"})}),process.on("unhandledRejection",t=>{this.handleUnhandledError({err:t instanceof Error?t:new Error(`Unknown error: ${JSON.stringify(t)}`),type:"UNHANDLED PROMISE REJECTION"})}),process.on("SIGINT",this.cleanExitProcess("SIGINT")),process.on("SIGTERM",this.cleanExitProcess("SIGTERM")),process.on("SIGQUIT",this.cleanExitProcess("SIGQUIT"))}}};a(bCt,"ApplicationManager");uR=new bCt});var CCt=x($Ee=>{"use strict";Object.defineProperty($Ee,"__esModule",{value:!0});$Ee.Dequeue=void 0;var SCt=class{constructor(){this._length=0,this.head=void 0,this.tail=void 0}get length(){return this._length}clear(){this.head=this.tail=void 0,this._length=0}push(t){let r={value:t,prev:this.tail,next:void 0};this._length?(this.tail.next=r,this.tail=r):this.head=this.tail=r,this._length++}pop(){if(!this._length)return;let t=this.tail;return this.tail=this.tail.prev,this._length--,this._length||(this.head=this.tail=void 0),t.value}unshift(t){let r={value:t,prev:void 0,next:this.head};this._length?(this.head.prev=r,this.head=r):this.head=this.tail=r,this._length++}shift(){if(!this._length)return;let t=this.head;return this.head=this.head.next,this._length--,this._length||(this.head=this.tail=void 0),t.value}peekFront(){if(this._length)return this.head.value}peekBack(){if(this._length)return this.tail.value}};a(SCt,"Dequeue");$Ee.Dequeue=SCt});var VEe=x(HEe=>{"use strict";Object.defineProperty(HEe,"__esModule",{value:!0});HEe.QuotaManager=void 0;var Eao=CCt(),ECt=class{constructor(t){if(this._quota=t,this._activeCount=0,this.history=new Eao.Dequeue,typeof t!="object"&&(console.warn("[p-ratelimit QuotaManager] A QuotaManager was created with no quota."),this._quota={}),"interval"in this._quota&&!("rate"in this._quota)||"rate"in this._quota&&!("interval"in this._quota)){let r="[p-ratelimit QuotaManager] Invalid Quota: for a rate-limit quota, both interval and rate must be specified.";throw new Error(r)}}get quota(){return Object.assign({},this._quota)}get activeCount(){return this._activeCount}get maxDelay(){return this._quota.maxDelay||0}start(){if(this._activeCount>=this._quota.concurrency)return!1;if(this._quota.interval!==void 0&&this._quota.rate!==void 0){if(this.removeExpiredHistory(),this.history.length>=this._quota.rate)return!1;this.history.push(Date.now())}return this._activeCount++,!0}end(){this._activeCount--}removeExpiredHistory(){let t=Date.now()-this._quota.interval;for(;this.history.length&&this.history.peekFront()<t;)this.history.shift()}};a(ECt,"QuotaManager");HEe.QuotaManager=ECt});var xCt=x(WEe=>{"use strict";Object.defineProperty(WEe,"__esModule",{value:!0});WEe.RateLimitTimeoutError=void 0;var ACt=class extends Error{};a(ACt,"RateLimitTimeoutError");WEe.RateLimitTimeoutError=ACt});var Ntn=x(XEe=>{"use strict";Object.defineProperty(XEe,"__esModule",{value:!0});XEe.pRateLimit=void 0;var Aao=CCt(),Rtn=VEe(),xao=xCt();function Itn(e){if(!(e instanceof Rtn.QuotaManager))return Itn(new Rtn.QuotaManager(e));let t=new Aao.Dequeue,r=null,n=a(()=>{for(;t.length&&e.start();)t.shift()();t.length&&!e.activeCount&&!r&&(r=setTimeout(()=>{r=null,n()},100))},"next");return i=>new Promise((s,o)=>{let c=null;e.maxDelay&&(c=setTimeout(()=>{c=null,o(new xao.RateLimitTimeoutError("queue maxDelay timeout exceeded")),n()},e.maxDelay));let l=a(()=>{if(e.maxDelay)if(c)clearTimeout(c);else return;i().then(d=>{e.end(),s(d)}).catch(d=>{e.end(),o(d)}).then(()=>{n()})},"run");t.push(l),n()})}a(Itn,"pRateLimit");XEe.pRateLimit=Itn});var Ltn=x(r2=>{"use strict";Object.defineProperty(r2,"__esModule",{value:!0});r2.promisify=r2.sleep=r2.uniqueId=void 0;var Pao=require("crypto");function kao(){return Pao.randomBytes(16).toString("hex")}a(kao,"uniqueId");r2.uniqueId=kao;function Dao(e){return new Promise(t=>setTimeout(t,e))}a(Dao,"sleep");r2.sleep=Dao;function Tao(e){return function(...t){return new Promise((r,n)=>{e.apply(null,t.concat((i,...s)=>{i?n(i):r.apply(null,s)}))})}}a(Tao,"promisify");r2.promisify=Tao});var qtn=x(zj=>{"use strict";var Rao=zj&&zj.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function c(f){try{d(n.next(f))}catch(p){o(p)}}a(c,"fulfilled");function l(f){try{d(n.throw(f))}catch(p){o(p)}}a(l,"rejected");function d(f){f.done?s(f.value):i(f.value).then(c,l)}a(d,"step"),d((n=n.apply(e,t||[])).next())})};Object.defineProperty(zj,"__esModule",{value:!0});zj.RedisQuotaManager=void 0;var PCt=Ltn(),Iao=VEe(),kCt=class extends Iao.QuotaManager{constructor(t,r,n,i=3e4){super(Object.assign({},t,{concurrency:t.fastStart?t.concurrency:0}));this.channelQuota=t,this.heartbeatInterval=i,this.uniqueId=PCt.uniqueId(),this.pingsReceived=new Map,this.heartbeatTimer=null,this._ready=Boolean(t.fastStart),this.channelName=`ratelimit-${r}`;let s=Array.isArray(n)?n:[n];if(s.length===1){if(this.client=s[0],typeof this.client.duplicate!="function"){let o="[p-ratelimit RedisQuotaManager] Your Redis client does not support the client.duplicate() function. Please provide an array of two clients instead.";throw new Error(o)}this.pubSubClient=this.client.duplicate()}else this.client=s[0],this.pubSubClient=s[1];this.register()}get ready(){return this._ready}register(){return Rao(this,void 0,void 0,function*(){this.pingsReceived.set(this.uniqueId,Date.now()),this.pubSubClient.on("message",(t,r)=>this.message(t,r)),yield PCt.promisify(this.pubSubClient.subscribe.bind(this.pubSubClient))(this.channelName),this.ping(),this.channelQuota.fastStart||(yield PCt.sleep(3e3)),yield this.updateQuota(),this._ready=!0,this.heartbeatTimer=setInterval(()=>this.heartbeat(),this.heartbeatInterval)})}ping(){this.client.publish(this.channelName,JSON.stringify(this.uniqueId))}message(t,r){if(t!==this.channelName)return;let n;try{n=JSON.parse(r)}catch(s){console.error(`invalid JSON on Redis pub/sub channel ${t}: ${r}`);return}let i=!this.pingsReceived.has(n);this.pingsReceived.set(n,Date.now()),i&&(this.ping(),this.ready&&this.updateQuota())}removeOutdatedClients(){let t=Date.now()-this.heartbeatInterval*3;[...this.pingsReceived].filter(([n,i])=>i<=t).forEach(([n,i])=>this.pingsReceived.delete(n))}updateQuota(){if(this.removeOutdatedClients(),!this.pingsReceived.size)return;let t=Object.assign({},this.channelQuota);t.rate=Math.floor(t.rate/this.pingsReceived.size),t.concurrency&&(t.concurrency=Math.floor(t.concurrency/this.pingsReceived.size)),this._quota=t}heartbeat(){this.ping(),this.ready&&this.updateQuota()}};a(kCt,"RedisQuotaManager");zj.RedisQuotaManager=kCt});var Otn=x(Ux=>{"use strict";Object.defineProperty(Ux,"__esModule",{value:!0});Ux.RateLimitTimeoutError=Ux.RedisQuotaManager=Ux.QuotaManager=Ux.pRateLimit=void 0;var Nao=Ntn();Object.defineProperty(Ux,"pRateLimit",{enumerable:!0,get:function(){return Nao.pRateLimit}});var Lao=VEe();Object.defineProperty(Ux,"QuotaManager",{enumerable:!0,get:function(){return Lao.QuotaManager}});var qao=qtn();Object.defineProperty(Ux,"RedisQuotaManager",{enumerable:!0,get:function(){return qao.RedisQuotaManager}});var Oao=xCt();Object.defineProperty(Ux,"RateLimitTimeoutError",{enumerable:!0,get:function(){return Oao.RateLimitTimeoutError}})});var Mtn,Ftn,ztn,DCt,n2,KEe=An(()=>{wb();pc();Mtn=ji(r9());au();Gv();Sot();pg();mb();Qo();Dq();Ftn=ji(Otn()),ztn=ji(yx());Tf();DCt=class{constructor(){this.cloudformationPrivateTypesInfo={availableCloudformationPrivateTypesFiles:{atlasMongo:{}},registeredCloudformationPrivateTypes:{}};this.init=async()=>{};this.loadPrivateTypesAndPackages=async()=>{this.stacktapeInfrastructureModuleTypes.forEach(t=>{this.checkCloudformationPrivateTypesController({infrastructureModuleType:t})}),await Promise.all([this.loadAvailableCloudformationPrivateTypePackages(),this.loadRegisteredCloudformationPrivateTypes()]),this.stacktapeInfrastructureModuleTypes.forEach(t=>{this.determineModulePrivateTypesStatus({infrastructureModuleType:t})})};this.loadAvailableCloudformationPrivateTypePackages=async()=>{let t=await bo.listAllObjectsInBucket(yn.cloudformationRegistryBucketName,this.privateTypePackagesS3Client),{availableCloudformationPrivateTypesFiles:r}=this.cloudformationPrivateTypesInfo;t.forEach(({Key:n})=>{let[i,s,o,c]=n.split("/");if(!c||o.length!==7||!/^\d+$/.test(o)||Number.isNaN(o))return;r[i]||(r[i]={});let l=r[i];l[s]||(l[s]={}),l[s][o]||(l[s][o]=[]),l[s][o].push({fileName:c})})};this.checkCloudformationPrivateTypesController=({infrastructureModuleType:t})=>{let{privateTypesMajorVersionUsed:r,privateTypesMinimalRequiredSubversion:n,privateTypesSpecs:i,type:s}=Ww[t];if(n.length!==7||Number.isNaN(Number(n)))throw new s_({customMessage:`Static check of privateTypesMinimalRequiredSubversion of module ${s} failed. "${n}" is not a valid value.`});let o=Object.keys(i).find(c=>!c.split("::")[1].endsWith(r));if(o)throw new s_({customMessage:`Static check of private type "${o}" in module ${s} failed. Private type name service name should end in privateTypesMajorVersionUsed (${r})`})};this.loadRegisteredCloudformationPrivateTypes=async()=>{this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes=await bo.listAllPrivateCloudformationResourceTypesWithVersions()};this.areMinimalRequirementsForModulePrivateTypesMet=({infrastructureModuleType:t})=>Object.entries(this.stacktapeInfrastructureModulesStatus[t].currentlyUsedPrivateCloudformationTypes).every(([r,{version:n}])=>!Number.isNaN(Number(n))&&Number(n)>=Number(Ww[t].privateTypesMinimalRequiredSubversion));this.isUpdateForModulePrivateTypesAvailable=({infrastructureModuleType:t})=>Object.entries(this.stacktapeInfrastructureModulesStatus[t].currentlyUsedPrivateCloudformationTypes).some(([r,{version:n}])=>Number(n)!==Number(this.stacktapeInfrastructureModulesStatus[t].newestCompatibleCloudformationPrivateTypeVersion));this.registerLatestCfPrivateTypes=async t=>{await this.loadPrivateTypesAndPackages(),t.map(n=>!this.areMinimalRequirementsForModulePrivateTypesMet({infrastructureModuleType:n})).some(Boolean)&&(await Ic.startEvent({eventType:"REGISTER_CF_PRIVATE_TYPES",description:"Registering new cloudformation private types"}),await Promise.all([t.map(n=>this.registerNewestAvailablePrivateTypes({infrastructureModuleType:n}))]),await Ic.finishEvent({eventType:"REGISTER_CF_PRIVATE_TYPES"}))};this.resolveRoleForPrivateType=async({infrastructureModuleType:t,privateTypeName:r,region:n})=>{let i=await bo.getFromBucket({bucketName:yn.cloudformationRegistryBucketName,injectedS3Client:this.privateTypePackagesS3Client,s3Key:this.buildNewestAvailableFileBucketKeyForPrivateType({infrastructureModuleType:t,privateTypeName:r,fileType:"roleDefinition"})}),s=h4(i).Resources.ExecutionRole.Properties,o=this.buildRoleNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix,region:n}),c=await bo.checkIfRoleExists({roleName:o});return c||(c=await bo.createIamRole({roleName:o,assumeRolePolicyDocument:s.AssumeRolePolicyDocument,description:`Role generated by Stacktape to be assumed by private CF type ${r}`,maxSessionDuration:s.MaxSessionDuration})),await bo.modifyInlinePoliciesForIamRole({roleName:o,desiredPolicies:s.Policies}),{roleArn:c.Arn}};this.buildNewestAvailableFileBucketKeyForPrivateType=({infrastructureModuleType:t,privateTypeName:r,fileType:n})=>{let i=n==="zipPackage"?this.buildZipPackageNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix}):this.buildRoleDefinitionFileNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix});return[t,Ww[t].privateTypesMajorVersionUsed,this.stacktapeInfrastructureModulesStatus[t].newestCompatibleCloudformationPrivateTypeVersion,i].join("/")};this.buildRoleNameFromPackagePrefix=({packagePrefix:t,region:r})=>`stp-${t}-${r}`;this.buildZipPackageNameFromPackagePrefix=({packagePrefix:t})=>`${t}.zip`;this.buildRoleDefinitionFileNameFromPackagePrefix=({packagePrefix:t})=>`${t}-role.yml`;this.determineModulePrivateTypesStatus=({infrastructureModuleType:t})=>{var h;let r={currentlyUsedPrivateCloudformationTypes:{},newestCompatibleCloudformationPrivateTypeVersion:JY,newestPrivateTypesSpecs:{}},{registeredCloudformationPrivateTypes:n,availableCloudformationPrivateTypesFiles:i}=this.cloudformationPrivateTypesInfo,{privateTypesMajorVersionUsed:s,privateTypesMinimalRequiredSubversion:o,privateTypesSpecs:c,type:l}=Ww[t],d=Object.keys(((h=i[l])==null?void 0:h[s])||{}).sort((w,b)=>Number(b)-Number(w)),f=Object.keys(c);f.forEach(w=>{r.currentlyUsedPrivateCloudformationTypes[w]={version:JY}}),Object.keys(n).filter(w=>f.includes(w)).forEach(w=>{let b=n[w].find(({IsDefaultVersion:E})=>E);r.currentlyUsedPrivateCloudformationTypes[w].version=(b==null?void 0:b.Description)||JY});let p=d.find(w=>{if(Number(w)<Number(o))throw new s_({customMessage:`No valid infrastructure private types for module ${l} ${s} satisfying minimal required subversion (${o}) that can be used with this Stacktape version could were found.`});let b=!0;return Object.values(c).forEach(({packagePrefix:E})=>{var A,T,R;((R=(T=(A=i[l])==null?void 0:A[s])==null?void 0:T[w])==null?void 0:R.some(({fileName:B})=>B===this.buildZipPackageNameFromPackagePrefix({packagePrefix:E})))||(b=!1)}),b});if(!p)throw new s_({customMessage:`No valid infrastructure private types for module ${l} ${s} satisfying minimal required subversion (${o}) that can be used with this Stacktape version were found.`});r.newestCompatibleCloudformationPrivateTypeVersion=p,Object.entries(c).forEach(([w,{packagePrefix:b}])=>{var E,A,T;r.newestPrivateTypesSpecs[w]={},((T=(A=(E=i[l])==null?void 0:E[s])==null?void 0:A[p])==null?void 0:T.some(({fileName:R})=>R===this.buildRoleDefinitionFileNameFromPackagePrefix({packagePrefix:b})))&&(r.newestPrivateTypesSpecs[w].hasRoleFileAvailable=!0)}),this.stacktapeInfrastructureModulesStatus=y(m({},this.stacktapeInfrastructureModulesStatus||{}),{[l]:r})};this.registerNewestAvailablePrivateTypes=async({infrastructureModuleType:t})=>{let r=(0,Ftn.pRateLimit)({interval:2e3,rate:1,concurrency:2,maxDelay:6e4});return Promise.all(Object.keys(Ww[t].privateTypesSpecs).map(async n=>{let i=yn.region,s;this.stacktapeInfrastructureModulesStatus[t].newestPrivateTypesSpecs[n].hasRoleFileAvailable&&({roleArn:s}=await this.resolveRoleForPrivateType({infrastructureModuleType:t,privateTypeName:n,region:i})),await Lv(Math.random()*500);let o=await bo.registerPrivateCloudformationResourceType({schemaHandlerPackageS3Url:`s3://${yn.cloudformationRegistryBucketName}/${this.buildNewestAvailableFileBucketKeyForPrivateType({infrastructureModuleType:t,privateTypeName:n,fileType:"zipPackage"})}`,typeName:n,executionRoleArn:s,rateLimiter:r});await bo.setPrivateCloudformationResourceTypeAsDefault({typeVersionArn:o,rateLimiter:r}),await Lv(300),this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes[n]&&await Promise.all(this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes[n].map(async({Arn:c})=>bo.deregisterPrivateCloudformationType({typeVersionArn:c,rateLimiter:r})))}))}}get privateTypePackagesS3Client(){let t=new Mtn.S3Client({region:yn.cloudformationRegistryBucketRegion,credentials:yn.credentials});return t.middlewareStack.use(Yy),t.middlewareStack.use(Bv),t}get stacktapeInfrastructureModuleTypes(){return Object.keys(Ww)}};a(DCt,"CloudformationRegistryManager");n2=(0,ztn.default)(sh,oh)(new DCt)});var jtn,xV,TCt,JEe,RCt=An(()=>{wb();xc();dl();Gv();mb();kH();jtn=ji(yx()),TCt=class{constructor(){this.init=async()=>{};this.invalidateCaches=async()=>{await Ic.startEvent({eventType:"INVALIDATE_CACHE",description:"Invalidating CDN caches"});let t=await bo.getStackResources(qn.stackName),r=await Promise.all(qn.allResourcesWithCdnsToInvalidate.map(n=>{var i;if(!((i=n.cdn.domainNames)==null?void 0:i.length)){let s=t.find(({LogicalResourceId:o})=>o===nr.cloudfrontDistribution(n.name,0)).PhysicalResourceId;return[Vw(this,xV).call(this,{distributionId:s,paths:["/*"]})]}return Object.values(MI(n)).map((s,o)=>{let c=t.find(({LogicalResourceId:l})=>l===nr.cloudfrontDistribution(n.name,o)).PhysicalResourceId;return Vw(this,xV).call(this,{distributionId:c,paths:["/*"]})})}).flat());await Ic.finishEvent({eventType:"INVALIDATE_CACHE",data:{invalidatedDistributionIds:r}})};MT(this,xV,a(async({distributionId:t,paths:r})=>bo.invalidateCloudfront({distributionId:t,invalidatePaths:r}),"#invalidateCache"))}};a(TCt,"CloudfrontManager"),xV=new WeakMap;JEe=(0,jtn.default)(sh,oh)(new TCt)});var Gx,jj=An(()=>{KEe();RCt();xc();xC();_D();hq();yh();Lf();gu();Gx=a(async({commandModifiesStack:e,commandRequiresDeployedStack:t})=>(await qn.init(),await rs.init({stackName:qn.stackName,commandModifiesStack:e,commandRequiresDeployedStack:t}),Promise.all([_n.init(),tu.init(),Cg.init({domains:qn.allUsedDomainsInConfig}),JEe.init(),sd.init({accountId:rs.accountId,globallyUniqueStackHash:rs.globallyUniqueStackHash,stackActionType:rs.stackActionType}),a0.init(),n2.init()])),"initializeAllStackServices")});var Utn={};Hf(Utn,{executor:()=>Mao});var Btn,Mao,Gtn=An(()=>{jj();pc();gu();Dq();Btn=ji(Op()),Mao=a(async()=>{await Gx({}),await _n.resolveAllResources();let e=yn.args.templatePath||"compiled-template.yaml";await Btn.default.writeFile(e,ZE(_n.getTemplate()))},"executor")});var Htn=x((HQc,$tn)=>{"use strict";var Fao=a((e,t,r)=>{let n=e.indexOf(t);if(n===-1)return e;let i=t.length,s=0,o="";do o+=e.substr(s,n-s)+t+r,s=n+i,n=e.indexOf(t,s);while(n!==-1);return o+=e.substr(s),o},"stringReplaceAll"),zao=a((e,t,r,n)=>{let i=0,s="";do{let o=e[n-1]==="\r";s+=e.substr(i,(o?n-1:n)-i)+t+(o?`\r
3546
+ `);let{statusCode:w,buffered:b}=yield h;if(w===200){if(t.once("socket",Wto),r.secureEndpoint){let A=r.servername||r.host;if(!A)throw new Error('Could not determine "servername"');return sV("Upgrading socket connection to TLS"),nZr.default.connect(Object.assign(Object.assign({},Jto(r,"host","hostname","path","port")),{socket:s,servername:A}))}return s}s.destroy();let E=new rZr.default.Socket;return E.readable=!0,t.once("socket",A=>{sV("replaying proxy buffer for failed request"),Gto.default(A.listenerCount("data")>0),A.push(b),A.push(null)}),E})}};a(nSt,"HttpsProxyAgent");yO.default=nSt;function Wto(e){e.resume()}a(Wto,"resume");function Xto(e,t){return Boolean(!t&&e===80||t&&e===443)}a(Xto,"isDefaultPort");function Kto(e){return typeof e=="string"?/^https:?$/i.test(e):!1}a(Kto,"isHTTPS");function Jto(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}a(Jto,"omit")});var oSt=x((sSt,aZr)=>{"use strict";var Qto=sSt&&sSt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},iSt=Qto(iZr());function aSt(e){return new iSt.default(e)}a(aSt,"createHttpsProxyAgent");(function(e){e.HttpsProxyAgent=iSt.default,e.prototype=iSt.default.prototype})(aSt||(aSt={}));aZr.exports=aSt});var cZr=x(cSt=>{Object.defineProperty(cSt,"__esModule",{value:!0});var Yto=nw(),sZr=fy(),oZr=require("http"),Zto=gEe(),ero=function(e){Yto.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("http");return n.module=oZr,n.client=i?new(oSt())(i):new oZr.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return a(t,"HTTPTransport"),t.prototype.sendEvent=function(r){return this._send(sZr.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(sZr.sessionToSentryRequest(r,this._api),r)},t}(Zto.BaseTransport);cSt.HTTPTransport=ero});var dZr=x(lSt=>{Object.defineProperty(lSt,"__esModule",{value:!0});var tro=nw(),lZr=fy(),uZr=require("https"),rro=gEe(),nro=function(e){tro.__extends(t,e);function t(r){var n=e.call(this,r)||this;n.options=r;var i=n._getProxy("https");return n.module=uZr,n.client=i?new(oSt())(i):new uZr.Agent({keepAlive:!1,maxSockets:30,timeout:2e3}),n}return a(t,"HTTPSTransport"),t.prototype.sendEvent=function(r){return this._send(lZr.eventToSentryRequest(r,this._api),r)},t.prototype.sendSession=function(r){return this._send(lZr.sessionToSentryRequest(r,this._api),r)},t}(rro.BaseTransport);lSt.HTTPSTransport=nro});var uSt=x(oV=>{Object.defineProperty(oV,"__esModule",{value:!0});var iro=gEe();oV.BaseTransport=iro.BaseTransport;var aro=cZr();oV.HTTPTransport=aro.HTTPTransport;var sro=dZr();oV.HTTPSTransport=sro.HTTPSTransport});var fSt=x(dSt=>{Object.defineProperty(dSt,"__esModule",{value:!0});var HI=nw(),fZr=fy(),oro=dy(),LD=Al(),hEe=Kbt(),mZr=uSt(),cro=function(e){HI.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return a(t,"NodeBackend"),t.prototype.eventFromException=function(r,n){var i=this,s=r,o=n&&n.data&&n.data.mechanism,c=o||{handled:!0,type:"generic"};if(!LD.isError(r)){if(LD.isPlainObject(r)){var l="Non-Error exception captured with keys: "+LD.extractExceptionKeysForMessage(r);fZr.getCurrentHub().configureScope(function(d){d.setExtra("__serialized__",LD.normalizeToSize(r))}),s=n&&n.syntheticException||new Error(l),s.message=l}else s=n&&n.syntheticException||new Error(r),s.message=r;c.synthetic=!0}return new LD.SyncPromise(function(d,f){return hEe.parseError(s,i._options).then(function(p){LD.addExceptionTypeValue(p,void 0,void 0),LD.addExceptionMechanism(p,c),d(HI.__assign(HI.__assign({},p),{event_id:n&&n.event_id}))}).then(null,f)})},t.prototype.eventFromMessage=function(r,n,i){var s=this;n===void 0&&(n=oro.Severity.Info);var o={event_id:i&&i.event_id,level:n,message:r};return new LD.SyncPromise(function(c){if(s._options.attachStacktrace&&i&&i.syntheticException){var l=i.syntheticException?hEe.extractStackFromError(i.syntheticException):[];hEe.parseStack(l,s._options).then(function(d){o.stacktrace={frames:hEe.prepareFramesForEvent(d)},c(o)}).then(null,function(){c(o)})}else c(o)})},t.prototype._setupTransport=function(){if(!this._options.dsn)return e.prototype._setupTransport.call(this);var r=new LD.Dsn(this._options.dsn),n=HI.__assign(HI.__assign(HI.__assign(HI.__assign(HI.__assign({},this._options.transportOptions),this._options.httpProxy&&{httpProxy:this._options.httpProxy}),this._options.httpsProxy&&{httpsProxy:this._options.httpsProxy}),this._options.caCerts&&{caCerts:this._options.caCerts}),{dsn:this._options.dsn,tunnel:this._options.tunnel,_metadata:this._options._metadata});return this._options.transport?new this._options.transport(n):r.protocol==="http"?new mZr.HTTPTransport(n):new mZr.HTTPSTransport(n)},t}(fZr.BaseBackend);dSt.NodeBackend=cro});var gSt=x(pSt=>{Object.defineProperty(pSt,"__esModule",{value:!0});var lro=nw(),mSt=fy(),uro=jb(),yEe=dy(),pZr=Al(),dro=fSt(),fro=function(e){lro.__extends(t,e);function t(r){var n=this;return r._metadata=r._metadata||{},r._metadata.sdk=r._metadata.sdk||{name:"sentry.javascript.node",packages:[{name:"npm:@sentry/node",version:mSt.SDK_VERSION}],version:mSt.SDK_VERSION},n=e.call(this,dro.NodeBackend,r)||this,n}return a(t,"NodeClient"),t.prototype.captureException=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=i.getRequestSession();s&&s.status===yEe.RequestSessionStatus.Ok&&(s.status=yEe.RequestSessionStatus.Errored)}return e.prototype.captureException.call(this,r,n,i)},t.prototype.captureEvent=function(r,n,i){if(this._options.autoSessionTracking&&this._sessionFlusher&&i){var s=r.type||"exception",o=s==="exception"&&r.exception&&r.exception.values&&r.exception.values.length>0;if(o){var c=i.getRequestSession();c&&c.status===yEe.RequestSessionStatus.Ok&&(c.status=yEe.RequestSessionStatus.Errored)}}return e.prototype.captureEvent.call(this,r,n,i)},t.prototype.close=function(r){var n;return(n=this._sessionFlusher)===null||n===void 0||n.close(),e.prototype.close.call(this,r)},t.prototype.initSessionFlusher=function(){var r=this._options,n=r.release,i=r.environment;n?this._sessionFlusher=new uro.SessionFlusher(this.getTransport(),{release:n,environment:i}):pZr.logger.warn("Cannot initialise an instance of SessionFlusher if no release is provided!")},t.prototype._prepareEvent=function(r,n,i){return r.platform=r.platform||"node",this.getOptions().serverName&&(r.server_name=this.getOptions().serverName),e.prototype._prepareEvent.call(this,r,n,i)},t.prototype._captureRequestSession=function(){this._sessionFlusher?this._sessionFlusher.incrementSessionStatusCount():pZr.logger.warn("Discarded request mode session because autoSessionTracking option was disabled")},t}(mSt.BaseClient);pSt.NodeClient=fro});var yZr=x(_St=>{Object.defineProperty(_St,"__esModule",{value:!0});var gZr=nw(),_Zr=fy(),cV=dy(),mro=Al(),pro=require("util"),hZr=function(){function e(){this.name=e.id}return a(e,"Console"),e.prototype.setupOnce=function(){var t,r;try{for(var n=gZr.__values(["debug","info","warn","error","log"]),i=n.next();!i.done;i=n.next()){var s=i.value;mro.fill(console,s,gro(s))}}catch(o){t={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.id="Console",e}();_St.Console=hZr;function gro(e){return a(function(r){var n;switch(e){case"debug":n=cV.Severity.Debug;break;case"error":n=cV.Severity.Error;break;case"info":n=cV.Severity.Info;break;case"warn":n=cV.Severity.Warning;break;default:n=cV.Severity.Log}return function(){_Zr.getCurrentHub().getIntegration(hZr)&&_Zr.getCurrentHub().addBreadcrumb({category:"console",level:n,message:pro.format.apply(void 0,arguments)},{input:gZr.__spread(arguments),level:e}),r.apply(this,arguments)}},"consoleWrapper")}a(gro,"createConsoleWrapper")});var bZr=x(vO=>{Object.defineProperty(vO,"__esModule",{value:!0});var hSt=nw(),_ro=fy(),vZr=require("url");function hro(e){var t,r=(t=_ro.getCurrentHub().getClient())===null||t===void 0?void 0:t.getDsn();return r?e.includes(r.host):!1}a(hro,"isSentryRequest");vO.isSentryRequest=hro;function wZr(e){var t=e.protocol||"",r=e.hostname||e.host||"",n=!e.port||e.port===80||e.port===443?"":":"+e.port,i=e.path?e.path:"/";return t+"//"+r+n+i}a(wZr,"extractUrl");vO.extractUrl=wZr;function yro(e,t,r){var n,i,s;if(!e)return e;var o=hSt.__read(e.split(" "),2),c=o[0],l=o[1];return t.host&&!t.protocol&&(t.protocol=(i=(n=r)===null||n===void 0?void 0:n.agent)===null||i===void 0?void 0:i.protocol,l=wZr(t)),((s=l)===null||s===void 0?void 0:s.startsWith("///"))&&(l=l.slice(2)),c+" "+l}a(yro,"cleanSpanDescription");vO.cleanSpanDescription=yro;function ySt(e){var t={protocol:e.protocol,hostname:typeof e.hostname=="string"&&e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:""+(e.pathname||"")+(e.search||""),href:e.href};return e.port!==""&&(t.port=Number(e.port)),(e.username||e.password)&&(t.auth=e.username+":"+e.password),t}a(ySt,"urlToOptions");vO.urlToOptions=ySt;function vro(e,t){var r,n,i,s,o;return typeof t[t.length-1]=="function"&&(s=t.pop()),typeof t[0]=="string"?o=ySt(new vZr.URL(t[0])):t[0]instanceof vZr.URL?o=ySt(t[0]):o=t[0],t.length===2&&(o=hSt.__assign(hSt.__assign({},o),t[1])),o.protocol===void 0&&(o.protocol=((r=o.agent)===null||r===void 0?void 0:r.protocol)||((n=o._defaultAgent)===null||n===void 0?void 0:n.protocol)||((i=e.globalAgent)===null||i===void 0?void 0:i.protocol)),s?[o,s]:[o]}a(vro,"normalizeRequestArgs");vO.normalizeRequestArgs=vro});var xZr=x(wSt=>{Object.defineProperty(wSt,"__esModule",{value:!0});var SZr=nw(),vSt=fy(),Aj=Al(),lV=bZr(),CZr=Aj.parseSemver(process.versions.node),EZr=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._breadcrumbs=typeof t.breadcrumbs=="undefined"?!0:t.breadcrumbs,this._tracing=typeof t.tracing=="undefined"?!1:t.tracing}return a(e,"Http"),e.prototype.setupOnce=function(){if(!(!this._breadcrumbs&&!this._tracing)){var t=wro(this._breadcrumbs,this._tracing),r=require("http");if(Aj.fill(r,"get",t),Aj.fill(r,"request",t),CZr.major&&CZr.major>8){var n=require("https");Aj.fill(n,"get",t),Aj.fill(n,"request",t)}}},e.id="Http",e}();wSt.Http=EZr;function wro(e,t){return a(function(n){return a(function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var c=this,l=lV.normalizeRequestArgs(this,s),d=l[0],f=lV.extractUrl(d);if(lV.isSentryRequest(f))return n.apply(c,l);var p,h,w=vSt.getCurrentHub().getScope();if(w&&t&&(h=w.getSpan(),h)){p=h.startChild({description:(d.method||"GET")+" "+f,op:"request"});var b=p.toTraceparent();Aj.logger.log("[Tracing] Adding sentry-trace header "+b+" to outgoing request to "+f+": "),d.headers=SZr.__assign(SZr.__assign({},d.headers),{"sentry-trace":b})}return n.apply(c,l).once("response",function(E){var A=this;e&&AZr("response",f,A,E),t&&p&&(E.statusCode&&p.setHttpStatus(E.statusCode),p.description=lV.cleanSpanDescription(p.description,d,A),p.finish())}).once("error",function(){var E=this;e&&AZr("error",f,E),t&&p&&(p.setHttpStatus(500),p.description=lV.cleanSpanDescription(p.description,d,E),p.finish())})},"wrappedMethod")},"wrappedRequestMethodFactory")}a(wro,"_createWrappedRequestMethodFactory");function AZr(e,t,r,n){!vSt.getCurrentHub().getIntegration(EZr)||vSt.getCurrentHub().addBreadcrumb({category:"http",data:{method:r.method,status_code:n&&n.statusCode,url:t},type:"http"},{event:e,request:r,response:n})}a(AZr,"addRequestBreadcrumb")});var CSt=x(SSt=>{Object.defineProperty(SSt,"__esModule",{value:!0});var bro=fy(),bSt=Al(),Sro=2e3;function Cro(e){console.error(e&&e.stack?e.stack:e);var t=bro.getCurrentHub().getClient();if(t===void 0){bSt.logger.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}var r=t.getOptions(),n=r&&r.shutdownTimeout&&r.shutdownTimeout>0&&r.shutdownTimeout||Sro;bSt.forget(t.close(n).then(function(i){i||bSt.logger.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)}))}a(Cro,"logAndExitProcess");SSt.logAndExitProcess=Cro});var DZr=x(ESt=>{Object.defineProperty(ESt,"__esModule",{value:!0});var PZr=fy(),Ero=dy(),Aro=Al(),kZr=CSt(),xro=function(){function e(t){t===void 0&&(t={}),this._options=t,this.name=e.id,this.handler=this._makeErrorHandler()}return a(e,"OnUncaughtException"),e.prototype.setupOnce=function(){global.process.on("uncaughtException",this.handler.bind(this))},e.prototype._makeErrorHandler=function(){var t=this,r=2e3,n=!1,i=!1,s=!1,o;return function(c){var l=kZr.logAndExitProcess,d=PZr.getCurrentHub().getClient();if(t._options.onFatalError?l=t._options.onFatalError:d&&d.getOptions().onFatalError&&(l=d.getOptions().onFatalError),n)s?(Aro.logger.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),kZr.logAndExitProcess(c)):i||(i=!0,setTimeout(function(){s||(s=!0,l(o,c))},r));else{var f=PZr.getCurrentHub();o=c,n=!0,f.getIntegration(e)?f.withScope(function(p){p.setLevel(Ero.Severity.Fatal),f.captureException(c,{originalException:c,data:{mechanism:{handled:!1,type:"onuncaughtexception"}}}),s||(s=!0,l(c))}):s||(s=!0,l(c))}}},e.id="OnUncaughtException",e}();ESt.OnUncaughtException=xro});var RZr=x(ASt=>{Object.defineProperty(ASt,"__esModule",{value:!0});var Pro=fy(),TZr=Al(),kro=CSt(),Dro=function(){function e(t){t===void 0&&(t={mode:"warn"}),this._options=t,this.name=e.id}return a(e,"OnUnhandledRejection"),e.prototype.setupOnce=function(){global.process.on("unhandledRejection",this.sendUnhandledPromise.bind(this))},e.prototype.sendUnhandledPromise=function(t,r){var n=Pro.getCurrentHub();if(!n.getIntegration(e)){this._handleRejection(t);return}var i=r.domain&&r.domain.sentryContext||{};n.withScope(function(s){s.setExtra("unhandledPromiseRejection",!0),i.user&&s.setUser(i.user),i.tags&&s.setTags(i.tags),i.extra&&s.setExtras(i.extra),n.captureException(t,{originalException:r,data:{mechanism:{handled:!1,type:"onunhandledrejection"}}})}),this._handleRejection(t)},e.prototype._handleRejection=function(t){var r="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";this._options.mode==="warn"?TZr.consoleSandbox(function(){console.warn(r),console.error(t&&t.stack?t.stack:t)}):this._options.mode==="strict"&&(TZr.consoleSandbox(function(){console.warn(r)}),kro.logAndExitProcess(t))},e.id="OnUnhandledRejection",e}();ASt.OnUnhandledRejection=Dro});var LZr=x(xSt=>{Object.defineProperty(xSt,"__esModule",{value:!0});var IZr=nw(),NZr=fy(),xj=Al(),Tro=Kbt(),Rro="cause",Iro=5,Nro=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._key=t.key||Rro,this._limit=t.limit||Iro}return a(e,"LinkedErrors"),e.prototype.setupOnce=function(){NZr.addGlobalEventProcessor(function(t,r){var n=NZr.getCurrentHub().getIntegration(e);if(n){var i=n._handler&&n._handler.bind(n);return typeof i=="function"?i(t,r):t}return t})},e.prototype._handler=function(t,r){var n=this;return!t.exception||!t.exception.values||!r||!xj.isInstanceOf(r.originalException,Error)?xj.SyncPromise.resolve(t):new xj.SyncPromise(function(i){n._walkErrorTree(r.originalException,n._key).then(function(s){t&&t.exception&&t.exception.values&&(t.exception.values=IZr.__spread(s,t.exception.values)),i(t)}).then(null,function(){i(t)})})},e.prototype._walkErrorTree=function(t,r,n){var i=this;return n===void 0&&(n=[]),!xj.isInstanceOf(t[r],Error)||n.length+1>=this._limit?xj.SyncPromise.resolve(n):new xj.SyncPromise(function(s,o){Tro.getExceptionFromError(t[r]).then(function(c){i._walkErrorTree(t[r],r,IZr.__spread([c],n)).then(s).then(null,function(){o()})}).then(null,function(){o()})})},e.id="LinkedErrors",e}();xSt.LinkedErrors=Nro});var FZr=x(kSt=>{Object.defineProperty(kSt,"__esModule",{value:!0});var qZr=nw(),OZr=require("fs"),MZr=require("path"),PSt;function Lro(){try{return require.cache?Object.keys(require.cache):[]}catch(e){return[]}}a(Lro,"getPaths");function qro(){var e=require.main&&require.main.paths||[],t=Lro(),r={},n={};return t.forEach(function(i){var s=i,o=a(function(){var c=s;if(s=MZr.dirname(c),!(!s||c===s||n[c])){if(e.indexOf(s)<0)return o();var l=MZr.join(c,"package.json");if(n[c]=!0,!OZr.existsSync(l))return o();try{var d=JSON.parse(OZr.readFileSync(l,"utf8"));r[d.name]=d.version}catch(f){}}},"updir");o()}),r}a(qro,"collectModules");var Oro=function(){function e(){this.name=e.id}return a(e,"Modules"),e.prototype.setupOnce=function(t,r){var n=this;t(function(i){return r().getIntegration(e)?qZr.__assign(qZr.__assign({},i),{modules:n._getModules()}):i})},e.prototype._getModules=function(){return PSt||(PSt=qro()),PSt},e.id="Modules",e}();kSt.Modules=Oro});var DSt=x(VI=>{Object.defineProperty(VI,"__esModule",{value:!0});var Mro=yZr();VI.Console=Mro.Console;var Fro=xZr();VI.Http=Fro.Http;var zro=DZr();VI.OnUncaughtException=zro.OnUncaughtException;var jro=RZr();VI.OnUnhandledRejection=jro.OnUnhandledRejection;var Bro=LZr();VI.LinkedErrors=Bro.LinkedErrors;var Uro=FZr();VI.Modules=Uro.Modules});var RSt=x(Mx=>{Object.defineProperty(Mx,"__esModule",{value:!0});var uV=nw(),WI=fy(),zZr=jb(),jZr=dy(),TSt=Al(),Gro=require("domain"),$ro=gSt(),dV=DSt();Mx.defaultIntegrations=[new WI.Integrations.InboundFilters,new WI.Integrations.FunctionToString,new dV.Console,new dV.Http,new dV.OnUncaughtException,new dV.OnUnhandledRejection,new dV.LinkedErrors];function Hro(e){e===void 0&&(e={});var t,r=zZr.getMainCarrier(),n=((t=r.__SENTRY__)===null||t===void 0?void 0:t.integrations)||[];if(e.defaultIntegrations=e.defaultIntegrations===!1?[]:uV.__spread(Array.isArray(e.defaultIntegrations)?e.defaultIntegrations:Mx.defaultIntegrations,n),e.dsn===void 0&&process.env.SENTRY_DSN&&(e.dsn=process.env.SENTRY_DSN),e.tracesSampleRate===void 0&&process.env.SENTRY_TRACES_SAMPLE_RATE){var i=parseFloat(process.env.SENTRY_TRACES_SAMPLE_RATE);isFinite(i)&&(e.tracesSampleRate=i)}if(e.release===void 0){var s=BZr();s!==void 0?e.release=s:e.autoSessionTracking=!1}e.environment===void 0&&process.env.SENTRY_ENVIRONMENT&&(e.environment=process.env.SENTRY_ENVIRONMENT),e.autoSessionTracking===void 0&&e.dsn!==void 0&&(e.autoSessionTracking=!0),Gro.active&&zZr.setHubOnCarrier(r,WI.getCurrentHub()),WI.initAndBind($ro.NodeClient,e),e.autoSessionTracking&&Jro()}a(Hro,"init");Mx.init=Hro;function Vro(){return WI.getCurrentHub().lastEventId()}a(Vro,"lastEventId");Mx.lastEventId=Vro;function Wro(e){return uV.__awaiter(this,void 0,void 0,function(){var t;return uV.__generator(this,function(r){return t=WI.getCurrentHub().getClient(),t?[2,t.flush(e)]:(TSt.logger.warn("Cannot flush events. No client defined."),[2,Promise.resolve(!1)])})})}a(Wro,"flush");Mx.flush=Wro;function Xro(e){return uV.__awaiter(this,void 0,void 0,function(){var t;return uV.__generator(this,function(r){return t=WI.getCurrentHub().getClient(),t?[2,t.close(e)]:(TSt.logger.warn("Cannot flush events and disable SDK. No client defined."),[2,Promise.resolve(!1)])})})}a(Xro,"close");Mx.close=Xro;function Kro(e){if(e===void 0)return!1;var t=e&&e.getOptions();return t&&t.autoSessionTracking!==void 0?t.autoSessionTracking:!1}a(Kro,"isAutoSessionTrackingEnabled");Mx.isAutoSessionTrackingEnabled=Kro;function BZr(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;var t=TSt.getGlobalObject();return t.SENTRY_RELEASE&&t.SENTRY_RELEASE.id?t.SENTRY_RELEASE.id:process.env.GITHUB_SHA||process.env.COMMIT_REF||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA||e}a(BZr,"getSentryRelease");Mx.getSentryRelease=BZr;function Jro(){var e=WI.getCurrentHub();e.startSession(),process.on("beforeExit",function(){var t,r=(t=e.getScope())===null||t===void 0?void 0:t.getSession(),n=[jZr.SessionStatus.Exited,jZr.SessionStatus.Crashed];r&&!n.includes(r.status)&&e.endSession()})}a(Jro,"startSessionTracking")});var GZr=x(NSt=>{Object.defineProperty(NSt,"__esModule",{value:!0});var UZr=nw(),vEe=require("fs"),ISt=require("path");function Qro(e){var t=ISt.resolve(e);if(!vEe.existsSync(t))throw new Error("Cannot read contents of "+t+". Directory does not exist.");if(!vEe.statSync(t).isDirectory())throw new Error("Cannot read contents of "+t+", because it is not a directory.");var r=a(function(n){return vEe.readdirSync(n).reduce(function(i,s){var o=ISt.join(n,s);return vEe.statSync(o).isDirectory()?UZr.__spread(i,r(o)):UZr.__spread(i,[o])},[])},"deepReadCurrentDir");return r(t).map(function(n){return ISt.relative(t,n)})}a(Qro,"deepReadDirSync");NSt.deepReadDirSync=Qro});var p1=x((lJc,bEe)=>{var $Zr,HZr,VZr,WZr,XZr,KZr,JZr,QZr,YZr,wEe,LSt,ZZr,een,Pj,ten,ren,nen,ien,aen,sen,oen,cen,len;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){e(r(t,r(n)))}):typeof bEe=="object"&&typeof bEe.exports=="object"?e(r(t,r(bEe.exports))):e(r(t));function r(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}a(r,"createExporter")})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])};$Zr=a(function(r,n){t(r,n);function i(){this.constructor=r}a(i,"__"),r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},"__extends"),HZr=Object.assign||function(r){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])}return r},VZr=a(function(r,n){var i={};for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&n.indexOf(s)<0&&(i[s]=r[s]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(r);o<s.length;o++)n.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(r,s[o])&&(i[s[o]]=r[s[o]]);return i},"__rest"),WZr=a(function(r,n,i,s){var o=arguments.length,c=o<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,i):s,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,n,i,s);else for(var d=r.length-1;d>=0;d--)(l=r[d])&&(c=(o<3?l(c):o>3?l(n,i,c):l(n,i))||c);return o>3&&c&&Object.defineProperty(n,i,c),c},"__decorate"),XZr=a(function(r,n){return function(i,s){n(i,s,r)}},"__param"),KZr=a(function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},"__metadata"),JZr=a(function(r,n,i,s){function o(c){return c instanceof i?c:new i(function(l){l(c)})}return a(o,"adopt"),new(i||(i=Promise))(function(c,l){function d(h){try{p(s.next(h))}catch(w){l(w)}}a(d,"fulfilled");function f(h){try{p(s.throw(h))}catch(w){l(w)}}a(f,"rejected");function p(h){h.done?c(h.value):o(h.value).then(d,f)}a(p,"step"),p((s=s.apply(r,n||[])).next())})},"__awaiter"),QZr=a(function(r,n){var i={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},s,o,c,l;return l={next:d(0),throw:d(1),return:d(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function d(p){return function(h){return f([p,h])}}function f(p){if(s)throw new TypeError("Generator is already executing.");for(;i;)try{if(s=1,o&&(c=p[0]&2?o.return:p[0]?o.throw||((c=o.return)&&c.call(o),0):o.next)&&!(c=c.call(o,p[1])).done)return c;switch(o=0,c&&(p=[p[0]&2,c.value]),p[0]){case 0:case 1:c=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,o=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(c=i.trys,!(c=c.length>0&&c[c.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!c||p[1]>c[0]&&p[1]<c[3])){i.label=p[1];break}if(p[0]===6&&i.label<c[1]){i.label=c[1],c=p;break}if(c&&i.label<c[2]){i.label=c[2],i.ops.push(p);break}c[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(h){p=[6,h],o=0}finally{s=c=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},"__generator"),len=a(function(r,n,i,s){s===void 0&&(s=i),r[s]=n[i]},"__createBinding"),YZr=a(function(r,n){for(var i in r)i!=="default"&&!n.hasOwnProperty(i)&&(n[i]=r[i])},"__exportStar"),wEe=a(function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],s=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&s>=r.length&&(r=void 0),{value:r&&r[s++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},"__values"),LSt=a(function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var s=i.call(r),o,c=[],l;try{for(;(n===void 0||n-- >0)&&!(o=s.next()).done;)c.push(o.value)}catch(d){l={error:d}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(l)throw l.error}}return c},"__read"),ZZr=a(function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(LSt(arguments[n]));return r},"__spread"),een=a(function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var s=Array(r),o=0,n=0;n<i;n++)for(var c=arguments[n],l=0,d=c.length;l<d;l++,o++)s[o]=c[l];return s},"__spreadArrays"),Pj=a(function(r){return this instanceof Pj?(this.v=r,this):new Pj(r)},"__await"),ten=a(function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=i.apply(r,n||[]),o,c=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(b){s[b]&&(o[b]=function(E){return new Promise(function(A,T){c.push([b,E,A,T])>1||d(b,E)})})}function d(b,E){try{f(s[b](E))}catch(A){w(c[0][3],A)}}function f(b){b.value instanceof Pj?Promise.resolve(b.value.v).then(p,h):w(c[0][2],b)}function p(b){d("next",b)}function h(b){d("throw",b)}function w(b,E){b(E),c.shift(),c.length&&d(c[0][0],c[0][1])}},"__asyncGenerator"),ren=a(function(r){var n,i;return n={},s("next"),s("throw",function(o){throw o}),s("return"),n[Symbol.iterator]=function(){return this},n;function s(o,c){n[o]=r[o]?function(l){return(i=!i)?{value:Pj(r[o](l)),done:o==="return"}:c?c(l):l}:c}},"__asyncDelegator"),nen=a(function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof wEe=="function"?wEe(r):r[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(c){i[c]=r[c]&&function(l){return new Promise(function(d,f){l=r[c](l),o(d,f,l.done,l.value)})}}function o(c,l,d,f){Promise.resolve(f).then(function(p){c({value:p,done:d})},l)}},"__asyncValues"),ien=a(function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r},"__makeTemplateObject"),aen=a(function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)Object.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n.default=r,n},"__importStar"),sen=a(function(r){return r&&r.__esModule?r:{default:r}},"__importDefault"),oen=a(function(r,n){if(!n.has(r))throw new TypeError("attempted to get private field on non-instance");return n.get(r)},"__classPrivateFieldGet"),cen=a(function(r,n,i){if(!n.has(r))throw new TypeError("attempted to set private field on non-instance");return n.set(r,i),i},"__classPrivateFieldSet"),e("__extends",$Zr),e("__assign",HZr),e("__rest",VZr),e("__decorate",WZr),e("__param",XZr),e("__metadata",KZr),e("__awaiter",JZr),e("__generator",QZr),e("__exportStar",YZr),e("__createBinding",len),e("__values",wEe),e("__read",LSt),e("__spread",ZZr),e("__spreadArrays",een),e("__await",Pj),e("__asyncGenerator",ten),e("__asyncDelegator",ren),e("__asyncValues",nen),e("__makeTemplateObject",ien),e("__importStar",aen),e("__importDefault",sen),e("__classPrivateFieldGet",oen),e("__classPrivateFieldSet",cen)})});var XI=x(kj=>{Object.defineProperty(kj,"__esModule",{value:!0});var uen;(function(e){e.Ok="ok",e.DeadlineExceeded="deadline_exceeded",e.Unauthenticated="unauthenticated",e.PermissionDenied="permission_denied",e.NotFound="not_found",e.ResourceExhausted="resource_exhausted",e.InvalidArgument="invalid_argument",e.Unimplemented="unimplemented",e.Unavailable="unavailable",e.InternalError="internal_error",e.UnknownError="unknown_error",e.Cancelled="cancelled",e.AlreadyExists="already_exists",e.FailedPrecondition="failed_precondition",e.Aborted="aborted",e.OutOfRange="out_of_range",e.DataLoss="data_loss"})(uen=kj.SpanStatus||(kj.SpanStatus={}));(function(e){function t(r){if(r<400)return e.Ok;if(r>=400&&r<500)switch(r){case 401:return e.Unauthenticated;case 403:return e.PermissionDenied;case 404:return e.NotFound;case 409:return e.AlreadyExists;case 413:return e.FailedPrecondition;case 429:return e.ResourceExhausted;default:return e.InvalidArgument}if(r>=500&&r<600)switch(r){case 501:return e.Unimplemented;case 503:return e.Unavailable;case 504:return e.DeadlineExceeded;default:return e.InternalError}return e.UnknownError}a(t,"fromHttpCode"),e.fromHttpCode=t})(uen=kj.SpanStatus||(kj.SpanStatus={}))});var KI=x(Fx=>{Object.defineProperty(Fx,"__esModule",{value:!0});var den=jb();Fx.TRACEPARENT_REGEXP=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Yro(e){e===void 0&&(e=(t=den.getCurrentHub().getClient())===null||t===void 0?void 0:t.getOptions());var t;return e?"tracesSampleRate"in e||"tracesSampler"in e:!1}a(Yro,"hasTracingEnabled");Fx.hasTracingEnabled=Yro;function Zro(e){var t=e.match(Fx.TRACEPARENT_REGEXP);if(t){var r=void 0;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}}a(Zro,"extractTraceparentData");Fx.extractTraceparentData=Zro;function eno(e){e===void 0&&(e=den.getCurrentHub());var t,r;return(r=(t=e)===null||t===void 0?void 0:t.getScope())===null||r===void 0?void 0:r.getTransaction()}a(eno,"getActiveTransaction");Fx.getActiveTransaction=eno;function tno(e){return e/1e3}a(tno,"msToSec");Fx.msToSec=tno;function rno(e){return e*1e3}a(rno,"secToMs");Fx.secToMs=rno;var nno=Al();Fx.stripUrlQueryAndFragment=nno.stripUrlQueryAndFragment});var pen=x(OSt=>{Object.defineProperty(OSt,"__esModule",{value:!0});var qSt=Al(),fen=XI(),ino=KI();function ano(){qSt.addInstrumentationHandler({callback:men,type:"error"}),qSt.addInstrumentationHandler({callback:men,type:"unhandledrejection"})}a(ano,"registerErrorInstrumentation");OSt.registerErrorInstrumentation=ano;function men(){var e=ino.getActiveTransaction();e&&(qSt.logger.log("[Tracing] Transaction: "+fen.SpanStatus.InternalError+" -> Global error occured"),e.setStatus(fen.SpanStatus.InternalError))}a(men,"errorCallback")});var CEe=x(SEe=>{Object.defineProperty(SEe,"__esModule",{value:!0});var Dj=p1(),wO=Al(),MSt=XI(),sno=function(){function e(t){t===void 0&&(t=1e3),this.spans=[],this._maxlen=t}return a(e,"SpanRecorder"),e.prototype.add=function(t){this.spans.length>this._maxlen?t.spanRecorder=void 0:this.spans.push(t)},e}();SEe.SpanRecorder=sno;var ono=function(){function e(t){if(this.traceId=wO.uuid4(),this.spanId=wO.uuid4().substring(16),this.startTimestamp=wO.timestampWithMs(),this.tags={},this.data={},!t)return this;t.traceId&&(this.traceId=t.traceId),t.spanId&&(this.spanId=t.spanId),t.parentSpanId&&(this.parentSpanId=t.parentSpanId),"sampled"in t&&(this.sampled=t.sampled),t.op&&(this.op=t.op),t.description&&(this.description=t.description),t.data&&(this.data=t.data),t.tags&&(this.tags=t.tags),t.status&&(this.status=t.status),t.startTimestamp&&(this.startTimestamp=t.startTimestamp),t.endTimestamp&&(this.endTimestamp=t.endTimestamp)}return a(e,"Span"),e.prototype.child=function(t){return this.startChild(t)},e.prototype.startChild=function(t){var r=new e(Dj.__assign(Dj.__assign({},t),{parentSpanId:this.spanId,sampled:this.sampled,traceId:this.traceId}));return r.spanRecorder=this.spanRecorder,r.spanRecorder&&r.spanRecorder.add(r),r.transaction=this.transaction,r},e.prototype.setTag=function(t,r){var n;return this.tags=Dj.__assign(Dj.__assign({},this.tags),(n={},n[t]=r,n)),this},e.prototype.setData=function(t,r){var n;return this.data=Dj.__assign(Dj.__assign({},this.data),(n={},n[t]=r,n)),this},e.prototype.setStatus=function(t){return this.status=t,this},e.prototype.setHttpStatus=function(t){this.setTag("http.status_code",String(t));var r=MSt.SpanStatus.fromHttpCode(t);return r!==MSt.SpanStatus.UnknownError&&this.setStatus(r),this},e.prototype.isSuccess=function(){return this.status===MSt.SpanStatus.Ok},e.prototype.finish=function(t){this.endTimestamp=typeof t=="number"?t:wO.timestampWithMs()},e.prototype.toTraceparent=function(){var t="";return this.sampled!==void 0&&(t=this.sampled?"-1":"-0"),this.traceId+"-"+this.spanId+t},e.prototype.toContext=function(){return wO.dropUndefinedKeys({data:this.data,description:this.description,endTimestamp:this.endTimestamp,op:this.op,parentSpanId:this.parentSpanId,sampled:this.sampled,spanId:this.spanId,startTimestamp:this.startTimestamp,status:this.status,tags:this.tags,traceId:this.traceId})},e.prototype.updateWithContext=function(t){var r,n,i,s,o;return this.data=(r=t.data,r!=null?r:{}),this.description=t.description,this.endTimestamp=t.endTimestamp,this.op=t.op,this.parentSpanId=t.parentSpanId,this.sampled=t.sampled,this.spanId=(n=t.spanId,n!=null?n:this.spanId),this.startTimestamp=(i=t.startTimestamp,i!=null?i:this.startTimestamp),this.status=t.status,this.tags=(s=t.tags,s!=null?s:{}),this.traceId=(o=t.traceId,o!=null?o:this.traceId),this},e.prototype.getTraceContext=function(){return wO.dropUndefinedKeys({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,trace_id:this.traceId})},e.prototype.toJSON=function(){return wO.dropUndefinedKeys({data:Object.keys(this.data).length>0?this.data:void 0,description:this.description,op:this.op,parent_span_id:this.parentSpanId,span_id:this.spanId,start_timestamp:this.startTimestamp,status:this.status,tags:Object.keys(this.tags).length>0?this.tags:void 0,timestamp:this.endTimestamp,trace_id:this.traceId})},e}();SEe.Span=ono});var EEe=x(FSt=>{Object.defineProperty(FSt,"__esModule",{value:!0});var Tj=p1(),gen=jb(),cno=dy(),Rj=Al(),_en=CEe(),lno=function(e){Tj.__extends(t,e);function t(r,n){var i=e.call(this,r)||this;return i._measurements={},i._hub=gen.getCurrentHub(),Rj.isInstanceOf(n,gen.Hub)&&(i._hub=n),i.name=r.name||"",i.metadata=r.metadata||{},i._trimEnd=r.trimEnd,i.transaction=i,i}return a(t,"Transaction"),t.prototype.setName=function(r){this.name=r},t.prototype.initSpanRecorder=function(r){r===void 0&&(r=1e3),this.spanRecorder||(this.spanRecorder=new _en.SpanRecorder(r)),this.spanRecorder.add(this)},t.prototype.setMeasurements=function(r){this._measurements=Tj.__assign({},r)},t.prototype.setMetadata=function(r){this.metadata=Tj.__assign(Tj.__assign({},this.metadata),r)},t.prototype.finish=function(r){var n=this,i,s,o;if(this.endTimestamp===void 0){if(this.name||(Rj.logger.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this.name="<unlabeled transaction>"),e.prototype.finish.call(this,r),this.sampled!==!0){Rj.logger.log("[Tracing] Discarding transaction because its trace was not chosen to be sampled."),(o=(i=this._hub.getClient())===null||i===void 0?void 0:(s=i.getTransport()).recordLostEvent)===null||o===void 0||o.call(s,cno.Outcome.SampleRate,"transaction");return}var c=this.spanRecorder?this.spanRecorder.spans.filter(function(f){return f!==n&&f.endTimestamp}):[];this._trimEnd&&c.length>0&&(this.endTimestamp=c.reduce(function(f,p){return f.endTimestamp&&p.endTimestamp?f.endTimestamp>p.endTimestamp?f:p:f}).endTimestamp);var l={contexts:{trace:this.getTraceContext()},spans:c,start_timestamp:this.startTimestamp,tags:this.tags,timestamp:this.endTimestamp,transaction:this.name,type:"transaction",debug_meta:this.metadata},d=Object.keys(this._measurements).length>0;return d&&(Rj.logger.log("[Measurements] Adding measurements to transaction",JSON.stringify(this._measurements,void 0,2)),l.measurements=this._measurements),Rj.logger.log("[Tracing] Finishing "+this.op+" transaction: "+this.name+"."),this._hub.captureEvent(l)}},t.prototype.toContext=function(){var r=e.prototype.toContext.call(this);return Rj.dropUndefinedKeys(Tj.__assign(Tj.__assign({},r),{name:this.name,trimEnd:this._trimEnd}))},t.prototype.updateWithContext=function(r){var n;return e.prototype.updateWithContext.call(this,r),this.name=(n=r.name,n!=null?n:""),this._trimEnd=r.trimEnd,this},t}(_en.Span);FSt.Transaction=lno});var AEe=x(JI=>{Object.defineProperty(JI,"__esModule",{value:!0});var zSt=p1(),ov=Al(),uno=CEe(),hen=XI(),dno=EEe();JI.DEFAULT_IDLE_TIMEOUT=1e3;JI.HEARTBEAT_INTERVAL=5e3;var yen=function(e){zSt.__extends(t,e);function t(r,n,i,s){i===void 0&&(i="");var o=e.call(this,s)||this;return o._pushActivity=r,o._popActivity=n,o.transactionSpanId=i,o}return a(t,"IdleTransactionSpanRecorder"),t.prototype.add=function(r){var n=this;r.spanId!==this.transactionSpanId&&(r.finish=function(i){r.endTimestamp=typeof i=="number"?i:ov.timestampWithMs(),n._popActivity(r.spanId)},r.endTimestamp===void 0&&this._pushActivity(r.spanId)),e.prototype.add.call(this,r)},t}(uno.SpanRecorder);JI.IdleTransactionSpanRecorder=yen;var fno=function(e){zSt.__extends(t,e);function t(r,n,i,s){i===void 0&&(i=JI.DEFAULT_IDLE_TIMEOUT),s===void 0&&(s=!1);var o=e.call(this,r,n)||this;return o._idleHub=n,o._idleTimeout=i,o._onScope=s,o.activities={},o._heartbeatCounter=0,o._finished=!1,o._beforeFinishCallbacks=[],n&&s&&(ven(n),ov.logger.log("Setting idle transaction on scope. Span ID: "+o.spanId),n.configureScope(function(c){return c.setSpan(o)})),o._initTimeout=setTimeout(function(){o._finished||o.finish()},o._idleTimeout),o}return a(t,"IdleTransaction"),t.prototype.finish=function(r){var n,i,s=this;if(r===void 0&&(r=ov.timestampWithMs()),this._finished=!0,this.activities={},this.spanRecorder){ov.logger.log("[Tracing] finishing IdleTransaction",new Date(r*1e3).toISOString(),this.op);try{for(var o=zSt.__values(this._beforeFinishCallbacks),c=o.next();!c.done;c=o.next()){var l=c.value;l(this,r)}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.spanRecorder.spans=this.spanRecorder.spans.filter(function(d){if(d.spanId===s.spanId)return!0;d.endTimestamp||(d.endTimestamp=r,d.setStatus(hen.SpanStatus.Cancelled),ov.logger.log("[Tracing] cancelling span since transaction ended early",JSON.stringify(d,void 0,2)));var f=d.startTimestamp<r;return f||ov.logger.log("[Tracing] discarding Span since it happened after Transaction was finished",JSON.stringify(d,void 0,2)),f}),ov.logger.log("[Tracing] flushing IdleTransaction")}else ov.logger.log("[Tracing] No active IdleTransaction");return this._onScope&&ven(this._idleHub),e.prototype.finish.call(this,r)},t.prototype.registerBeforeFinishCallback=function(r){this._beforeFinishCallbacks.push(r)},t.prototype.initSpanRecorder=function(r){var n=this;if(!this.spanRecorder){var i=a(function(o){n._finished||n._pushActivity(o)},"pushActivity"),s=a(function(o){n._finished||n._popActivity(o)},"popActivity");this.spanRecorder=new yen(i,s,this.spanId,r),ov.logger.log("Starting heartbeat"),this._pingHeartbeat()}this.spanRecorder.add(this)},t.prototype._pushActivity=function(r){this._initTimeout&&(clearTimeout(this._initTimeout),this._initTimeout=void 0),ov.logger.log("[Tracing] pushActivity: "+r),this.activities[r]=!0,ov.logger.log("[Tracing] new activities count",Object.keys(this.activities).length)},t.prototype._popActivity=function(r){var n=this;if(this.activities[r]&&(ov.logger.log("[Tracing] popActivity "+r),delete this.activities[r],ov.logger.log("[Tracing] new activities count",Object.keys(this.activities).length)),Object.keys(this.activities).length===0){var i=this._idleTimeout,s=ov.timestampWithMs()+i/1e3;setTimeout(function(){n._finished||n.finish(s)},i)}},t.prototype._beat=function(){if(!this._finished){var r=Object.keys(this.activities).join("");r===this._prevHeartbeatString?this._heartbeatCounter+=1:this._heartbeatCounter=1,this._prevHeartbeatString=r,this._heartbeatCounter>=3?(ov.logger.log("[Tracing] Transaction finished because of no change for 3 heart beats"),this.setStatus(hen.SpanStatus.DeadlineExceeded),this.setTag("heartbeat","failed"),this.finish()):this._pingHeartbeat()}},t.prototype._pingHeartbeat=function(){var r=this;ov.logger.log("pinging Heartbeat -> current counter: "+this._heartbeatCounter),setTimeout(function(){r._beat()},JI.HEARTBEAT_INTERVAL)},t}(dno.Transaction);JI.IdleTransaction=fno;function ven(e){if(e){var t=e.getScope();if(t){var r=t.getTransaction();r&&t.setSpan(void 0)}}}a(ven,"clearActiveTransaction")});var PEe=x((fV,mV)=>{Object.defineProperty(fV,"__esModule",{value:!0});var jSt=p1(),wen=jb(),xEe=dy(),LC=Al(),mno=pen(),pno=AEe(),gno=EEe(),_no=KI();function hno(){var e=this.getScope();if(e){var t=e.getSpan();if(t)return{"sentry-trace":t.toTraceparent()}}return{}}a(hno,"traceHeaders");function ben(e,t,r){if(!_no.hasTracingEnabled())return e.sampled=!1,e;if(e.sampled!==void 0)return e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Explicit}}),e;var n;return typeof t.tracesSampler=="function"?(n=t.tracesSampler(r),e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Sampler,rate:Number(n)}})):r.parentSampled!==void 0?(n=r.parentSampled,e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Inheritance}})):(n=t.tracesSampleRate,e.setMetadata({transactionSampling:{method:xEe.TransactionSamplingMethod.Rate,rate:Number(n)}})),yno(n)?n?(e.sampled=Math.random()<n,e.sampled?(LC.logger.log("[Tracing] starting "+e.op+" transaction - "+e.name),e):(LC.logger.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = "+Number(n)+")"),e)):(LC.logger.log("[Tracing] Discarding transaction because "+(typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0")),e.sampled=!1,e):(LC.logger.warn("[Tracing] Discarding transaction because of invalid sample rate."),e.sampled=!1,e)}a(ben,"sample");function yno(e){return isNaN(e)||!(typeof e=="number"||typeof e=="boolean")?(LC.logger.warn("[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got "+JSON.stringify(e)+" of type "+JSON.stringify(typeof e)+"."),!1):e<0||e>1?(LC.logger.warn("[Tracing] Given sample rate is invalid. Sample rate must be between 0 and 1. Got "+e+"."),!1):!0}a(yno,"isValidSampleRate");function vno(e,t){var r,n,i=((r=this.getClient())===null||r===void 0?void 0:r.getOptions())||{},s=new gno.Transaction(e,this);return s=ben(s,i,jSt.__assign({parentSampled:e.parentSampled,transactionContext:e},t)),s.sampled&&s.initSpanRecorder((n=i._experiments)===null||n===void 0?void 0:n.maxSpans),s}a(vno,"_startTransaction");function wno(e,t,r,n,i){var s,o,c=((s=e.getClient())===null||s===void 0?void 0:s.getOptions())||{},l=new pno.IdleTransaction(t,e,r,n);return l=ben(l,c,jSt.__assign({parentSampled:t.parentSampled,transactionContext:t},i)),l.sampled&&l.initSpanRecorder((o=c._experiments)===null||o===void 0?void 0:o.maxSpans),l}a(wno,"startIdleTransaction");fV.startIdleTransaction=wno;function Sen(){var e=wen.getMainCarrier();!e.__SENTRY__||(e.__SENTRY__.extensions=e.__SENTRY__.extensions||{},e.__SENTRY__.extensions.startTransaction||(e.__SENTRY__.extensions.startTransaction=vno),e.__SENTRY__.extensions.traceHeaders||(e.__SENTRY__.extensions.traceHeaders=hno))}a(Sen,"_addTracingExtensions");fV._addTracingExtensions=Sen;function bno(){var e=wen.getMainCarrier();if(!!e.__SENTRY__){var t={mongodb:function(){var n=LC.dynamicRequire(mV,"./integrations/mongo");return new n.Mongo},mongoose:function(){var n=LC.dynamicRequire(mV,"./integrations/mongo");return new n.Mongo({mongoose:!0})},mysql:function(){var n=LC.dynamicRequire(mV,"./integrations/mysql");return new n.Mysql},pg:function(){var n=LC.dynamicRequire(mV,"./integrations/postgres");return new n.Postgres}},r=Object.keys(t).filter(function(n){return!!LC.loadModule(n)}).map(function(n){try{return t[n]()}catch(i){return}}).filter(function(n){return n});r.length>0&&(e.__SENTRY__.integrations=jSt.__spread(e.__SENTRY__.integrations||[],r))}}a(bno,"_autoloadDatabaseIntegrations");function Sno(){Sen(),LC.isNodeEnv()&&bno(),mno.registerErrorInstrumentation()}a(Sno,"addExtensionMethods");fV.addExtensionMethods=Sno});var Een=x(USt=>{Object.defineProperty(USt,"__esModule",{value:!0});var BSt=Al(),Cen=XI(),Cno=KI(),kEe=BSt.getGlobalObject();function Eno(){kEe&&kEe.document?kEe.document.addEventListener("visibilitychange",function(){var e=Cno.getActiveTransaction();kEe.document.hidden&&e&&(BSt.logger.log("[Tracing] Transaction: "+Cen.SpanStatus.Cancelled+" -> since tab moved to the background, op: "+e.op),e.status||e.setStatus(Cen.SpanStatus.Cancelled),e.setTag("visibilitychange","document.hidden"),e.finish())}):BSt.logger.warn("[Tracing] Could not set up background tab detection due to lack of global document")}a(Eno,"registerBackgroundTabDetection");USt.registerBackgroundTabDetection=Eno});var DEe=x(GSt=>{Object.defineProperty(GSt,"__esModule",{value:!0});GSt.bindReporter=function(e,t,r){var n;return function(i){t.value>=0&&(i||r)&&(t.delta=t.value-(n||0),(t.delta||n===void 0)&&(n=t.value,e(t)))}}});var Aen=x($St=>{Object.defineProperty($St,"__esModule",{value:!0});$St.generateUniqueID=function(){return"v2-"+Date.now()+"-"+(Math.floor(Math.random()*(9e12-1))+1e12)}});var TEe=x(HSt=>{Object.defineProperty(HSt,"__esModule",{value:!0});var Ano=Aen();HSt.initMetric=function(e,t){return{name:e,value:t!=null?t:-1,delta:0,entries:[],id:Ano.generateUniqueID()}}});var REe=x(VSt=>{Object.defineProperty(VSt,"__esModule",{value:!0});VSt.observe=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if(e==="first-input"&&!("PerformanceEventTiming"in self))return;var r=new PerformanceObserver(function(n){return n.getEntries().map(t)});return r.observe({type:e,buffered:!0}),r}}catch(n){}}});var pV=x(WSt=>{Object.defineProperty(WSt,"__esModule",{value:!0});var xno=Al();WSt.onHidden=function(e,t){var r=a(function(n){(n.type==="pagehide"||xno.getGlobalObject().document.visibilityState==="hidden")&&(e(n),t&&(removeEventListener("visibilitychange",r,!0),removeEventListener("pagehide",r,!0)))},"onHiddenOrPageHide");addEventListener("visibilitychange",r,!0),addEventListener("pagehide",r,!0)}});var xen=x(XSt=>{Object.defineProperty(XSt,"__esModule",{value:!0});var Pno=DEe(),kno=TEe(),Dno=REe(),Tno=pV();XSt.getCLS=function(e,t){var r=kno.initMetric("CLS",0),n,i=0,s=[],o=a(function(l){if(l&&!l.hadRecentInput){var d=s[0],f=s[s.length-1];i&&s.length!==0&&l.startTime-f.startTime<1e3&&l.startTime-d.startTime<5e3?(i+=l.value,s.push(l)):(i=l.value,s=[l]),i>r.value&&(r.value=i,r.entries=s,n&&n())}},"entryHandler"),c=Dno.observe("layout-shift",o);c&&(n=Pno.bindReporter(e,r,t),Tno.onHidden(function(){c.takeRecords().map(o),n(!0)}))}});var NEe=x(KSt=>{Object.defineProperty(KSt,"__esModule",{value:!0});var Rno=Al(),Ino=pV(),IEe=-1,Nno=a(function(){return Rno.getGlobalObject().document.visibilityState==="hidden"?0:1/0},"initHiddenTime"),Lno=a(function(){Ino.onHidden(function(e){var t=e.timeStamp;IEe=t},!0)},"trackChanges");KSt.getVisibilityWatcher=function(){return IEe<0&&(IEe=Nno(),Lno()),{get firstHiddenTime(){return IEe}}}});var Pen=x(JSt=>{Object.defineProperty(JSt,"__esModule",{value:!0});var qno=DEe(),Ono=NEe(),Mno=TEe(),Fno=REe(),zno=pV();JSt.getFID=function(e,t){var r=Ono.getVisibilityWatcher(),n=Mno.initMetric("FID"),i,s=a(function(c){i&&c.startTime<r.firstHiddenTime&&(n.value=c.processingStart-c.startTime,n.entries.push(c),i(!0))},"entryHandler"),o=Fno.observe("first-input",s);o&&(i=qno.bindReporter(e,n,t),zno.onHidden(function(){o.takeRecords().map(s),o.disconnect()},!0))}});var Den=x(QSt=>{Object.defineProperty(QSt,"__esModule",{value:!0});var jno=DEe(),Bno=NEe(),Uno=TEe(),Gno=REe(),$no=pV(),ken={};QSt.getLCP=function(e,t){var r=Bno.getVisibilityWatcher(),n=Uno.initMetric("LCP"),i,s=a(function(l){var d=l.startTime;d<r.firstHiddenTime&&(n.value=d,n.entries.push(l)),i&&i()},"entryHandler"),o=Gno.observe("largest-contentful-paint",s);if(o){i=jno.bindReporter(e,n,t);var c=a(function(){ken[n.id]||(o.takeRecords().map(s),o.disconnect(),ken[n.id]=!0,i(!0))},"stopListening_1");["keydown","click"].forEach(function(l){addEventListener(l,c,{once:!0,capture:!0})}),$no.onHidden(c,!0)}}});var Ien=x(Ij=>{Object.defineProperty(Ij,"__esModule",{value:!0});var Ten=p1(),O_=Al(),bh=KI(),Hno=xen(),Vno=Pen(),Wno=Den(),Xno=NEe(),aw=O_.getGlobalObject();Ij.DEFAULT_METRICS_INSTR_OPTIONS={_reportAllChanges:!1};var Kno=function(){function e(t){var r,n;this._measurements={},this._performanceCursor=0,!O_.isNodeEnv()&&((r=aw)===null||r===void 0?void 0:r.performance)&&((n=aw)===null||n===void 0?void 0:n.document)&&(aw.performance.mark&&aw.performance.mark("sentry-tracing-init"),this._trackCLS(),this._trackLCP(t._reportAllChanges),this._trackFID())}return a(e,"MetricsInstrumentation"),e.prototype.addPerformanceEntries=function(t){var r=this;if(!(!aw||!aw.performance||!aw.performance.getEntries||!O_.browserPerformanceTimeOrigin)){O_.logger.log("[Tracing] Adding & adjusting spans using Performance API");var n=bh.msToSec(O_.browserPerformanceTimeOrigin),i;if(aw.document&&aw.document.scripts){for(var s=0;s<aw.document.scripts.length;s++)if(aw.document.scripts[s].dataset.entry==="true"){i=aw.document.scripts[s].src;break}}var o,c,l,d;if(aw.performance.getEntries().slice(this._performanceCursor).forEach(function(p){var h=bh.msToSec(p.startTime),w=bh.msToSec(p.duration);if(!(t.op==="navigation"&&n+h<t.startTimestamp))switch(p.entryType){case"navigation":{Jno(t,p,n),l=n+bh.msToSec(p.responseStart),d=n+bh.msToSec(p.requestStart);break}case"mark":case"paint":case"measure":{var b=Qno(t,p,h,w,n);c===void 0&&p.name==="sentry-tracing-init"&&(c=b);var E=Xno.getVisibilityWatcher(),A=p.startTime<E.firstHiddenTime;p.name==="first-paint"&&A&&(O_.logger.log("[Measurements] Adding FP"),r._measurements.fp={value:p.startTime},r._measurements["mark.fp"]={value:b}),p.name==="first-contentful-paint"&&A&&(O_.logger.log("[Measurements] Adding FCP"),r._measurements.fcp={value:p.startTime},r._measurements["mark.fcp"]={value:b});break}case"resource":{var T=p.name.replace(aw.location.origin,""),R=Ren(t,p,T,h,w,n);o===void 0&&(i||"").indexOf(T)>-1&&(o=R);break}default:}}),o!==void 0&&c!==void 0&&YI(t,{description:"evaluation",endTimestamp:c,op:"script",startTimestamp:o}),this._performanceCursor=Math.max(performance.getEntries().length-1,0),this._trackNavigator(t),t.op==="pageload"){var f=bh.msToSec(O_.browserPerformanceTimeOrigin);typeof l=="number"&&(O_.logger.log("[Measurements] Adding TTFB"),this._measurements.ttfb={value:(l-t.startTimestamp)*1e3},typeof d=="number"&&d<=l&&(this._measurements["ttfb.requestTime"]={value:(l-d)*1e3})),["fcp","fp","lcp"].forEach(function(p){if(!(!r._measurements[p]||f>=t.startTimestamp)){var h=r._measurements[p].value,w=f+bh.msToSec(h),b=Math.abs((w-t.startTimestamp)*1e3),E=b-h;O_.logger.log("[Measurements] Normalized "+p+" from "+h+" to "+b+" ("+E+")"),r._measurements[p].value=b}}),this._measurements["mark.fid"]&&this._measurements.fid&&YI(t,{description:"first input delay",endTimestamp:this._measurements["mark.fid"].value+bh.msToSec(this._measurements.fid.value),op:"web.vitals",startTimestamp:this._measurements["mark.fid"].value}),"fcp"in this._measurements||delete this._measurements.cls,t.setMeasurements(this._measurements),this._tagMetricInfo(t)}}},e.prototype._tagMetricInfo=function(t){this._lcpEntry&&(O_.logger.log("[Measurements] Adding LCP Data"),this._lcpEntry.element&&t.setTag("lcp.element",O_.htmlTreeAsString(this._lcpEntry.element)),this._lcpEntry.id&&t.setTag("lcp.id",this._lcpEntry.id),this._lcpEntry.url&&t.setTag("lcp.url",this._lcpEntry.url.trim().slice(0,200)),t.setTag("lcp.size",this._lcpEntry.size)),this._clsEntry&&this._clsEntry.sources&&(O_.logger.log("[Measurements] Adding CLS Data"),this._clsEntry.sources.forEach(function(r,n){return t.setTag("cls.source."+(n+1),O_.htmlTreeAsString(r.node))}))},e.prototype._trackCLS=function(){var t=this;Hno.getCLS(function(r){var n=r.entries.pop();!n||(O_.logger.log("[Measurements] Adding CLS"),t._measurements.cls={value:r.value},t._clsEntry=n)})},e.prototype._trackNavigator=function(t){var r=aw.navigator;if(!!r){var n=r.connection;n&&(n.effectiveType&&t.setTag("effectiveConnectionType",n.effectiveType),n.type&&t.setTag("connectionType",n.type),LEe(n.rtt)&&(this._measurements["connection.rtt"]={value:n.rtt}),LEe(n.downlink)&&(this._measurements["connection.downlink"]={value:n.downlink})),LEe(r.deviceMemory)&&t.setTag("deviceMemory",String(r.deviceMemory)),LEe(r.hardwareConcurrency)&&t.setTag("hardwareConcurrency",String(r.hardwareConcurrency))}},e.prototype._trackLCP=function(t){var r=this;Wno.getLCP(function(n){var i=n.entries.pop();if(!!i){var s=bh.msToSec(O_.browserPerformanceTimeOrigin),o=bh.msToSec(i.startTime);O_.logger.log("[Measurements] Adding LCP"),r._measurements.lcp={value:n.value},r._measurements["mark.lcp"]={value:s+o},r._lcpEntry=i}},t)},e.prototype._trackFID=function(){var t=this;Vno.getFID(function(r){var n=r.entries.pop();if(!!n){var i=bh.msToSec(O_.browserPerformanceTimeOrigin),s=bh.msToSec(n.startTime);O_.logger.log("[Measurements] Adding FID"),t._measurements.fid={value:r.value},t._measurements["mark.fid"]={value:i+s}}})},e}();Ij.MetricsInstrumentation=Kno;function Jno(e,t,r){QI({transaction:e,entry:t,event:"unloadEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"redirect",timeOrigin:r}),QI({transaction:e,entry:t,event:"domContentLoadedEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"loadEvent",timeOrigin:r}),QI({transaction:e,entry:t,event:"connect",timeOrigin:r}),QI({transaction:e,entry:t,event:"secureConnection",timeOrigin:r,eventEnd:"connectEnd",description:"TLS/SSL"}),QI({transaction:e,entry:t,event:"fetch",timeOrigin:r,eventEnd:"domainLookupStart",description:"cache"}),QI({transaction:e,entry:t,event:"domainLookup",timeOrigin:r,description:"DNS"}),Yno(e,t,r)}a(Jno,"addNavigationSpans");function Qno(e,t,r,n,i){var s=i+r,o=s+n;return YI(e,{description:t.name,endTimestamp:o,op:t.entryType,startTimestamp:s}),s}a(Qno,"addMeasureSpans");function Ren(e,t,r,n,i,s){if(!(t.initiatorType==="xmlhttprequest"||t.initiatorType==="fetch")){var o={};"transferSize"in t&&(o["Transfer Size"]=t.transferSize),"encodedBodySize"in t&&(o["Encoded Body Size"]=t.encodedBodySize),"decodedBodySize"in t&&(o["Decoded Body Size"]=t.decodedBodySize);var c=s+n,l=c+i;return YI(e,{description:r,endTimestamp:l,op:t.initiatorType?"resource."+t.initiatorType:"resource",startTimestamp:c,data:o}),l}}a(Ren,"addResourceSpans");Ij.addResourceSpans=Ren;function QI(e){var t=e.transaction,r=e.entry,n=e.event,i=e.timeOrigin,s=e.eventEnd,o=e.description,c=s?r[s]:r[n+"End"],l=r[n+"Start"];!l||!c||YI(t,{op:"browser",description:o!=null?o:n,startTimestamp:i+bh.msToSec(l),endTimestamp:i+bh.msToSec(c)})}a(QI,"addPerformanceNavigationTiming");function Yno(e,t,r){YI(e,{op:"browser",description:"request",startTimestamp:r+bh.msToSec(t.requestStart),endTimestamp:r+bh.msToSec(t.responseEnd)}),YI(e,{op:"browser",description:"response",startTimestamp:r+bh.msToSec(t.responseStart),endTimestamp:r+bh.msToSec(t.responseEnd)})}a(Yno,"addRequest");function YI(e,t){var r=t.startTimestamp,n=Ten.__rest(t,["startTimestamp"]);return r&&e.startTimestamp>r&&(e.startTimestamp=r),e.startChild(Ten.__assign({startTimestamp:r},n))}a(YI,"_startChild");Ij._startChild=YI;function LEe(e){return typeof e=="number"&&isFinite(e)}a(LEe,"isMeasurementValue")});var YSt=x(OD=>{Object.defineProperty(OD,"__esModule",{value:!0});var qD=p1(),gV=Al(),Zno=XI(),qEe=KI();OD.DEFAULT_TRACING_ORIGINS=["localhost",/^\//];OD.defaultRequestInstrumentationOptions={traceFetch:!0,traceXHR:!0,tracingOrigins:OD.DEFAULT_TRACING_ORIGINS};function eio(e){var t=qD.__assign(qD.__assign({},OD.defaultRequestInstrumentationOptions),e),r=t.traceFetch,n=t.traceXHR,i=t.tracingOrigins,s=t.shouldCreateSpanForRequest,o={},c=a(function(f){if(o[f])return o[f];var p=i;return o[f]=p.some(function(h){return gV.isMatchingPattern(f,h)})&&!gV.isMatchingPattern(f,"sentry_key"),o[f]},"defaultShouldCreateSpan"),l=c;typeof s=="function"&&(l=a(function(f){return c(f)&&s(f)},"shouldCreateSpan"));var d={};r&&gV.addInstrumentationHandler({callback:function(f){Nen(f,l,d)},type:"fetch"}),n&&gV.addInstrumentationHandler({callback:function(f){Len(f,l,d)},type:"xhr"})}a(eio,"instrumentOutgoingRequests");OD.instrumentOutgoingRequests=eio;function Nen(e,t,r){if(!(!qEe.hasTracingEnabled()||!(e.fetchData&&t(e.fetchData.url)))){if(e.endTimestamp&&e.fetchData.__span){var n=r[e.fetchData.__span];n&&(e.response?n.setHttpStatus(e.response.status):e.error&&n.setStatus(Zno.SpanStatus.InternalError),n.finish(),delete r[e.fetchData.__span]);return}var i=qEe.getActiveTransaction();if(i){var n=i.startChild({data:qD.__assign(qD.__assign({},e.fetchData),{type:"fetch"}),description:e.fetchData.method+" "+e.fetchData.url,op:"http.client"});e.fetchData.__span=n.spanId,r[n.spanId]=n;var s=e.args[0]=e.args[0],o=e.args[1]=e.args[1]||{},c=o.headers;gV.isInstanceOf(s,Request)&&(c=s.headers),c?typeof c.append=="function"?c.append("sentry-trace",n.toTraceparent()):Array.isArray(c)?c=qD.__spread(c,[["sentry-trace",n.toTraceparent()]]):c=qD.__assign(qD.__assign({},c),{"sentry-trace":n.toTraceparent()}):c={"sentry-trace":n.toTraceparent()},o.headers=c}}}a(Nen,"fetchCallback");OD.fetchCallback=Nen;function Len(e,t,r){var n,i;if(!(!qEe.hasTracingEnabled()||((n=e.xhr)===null||n===void 0?void 0:n.__sentry_own_request__)||!(((i=e.xhr)===null||i===void 0?void 0:i.__sentry_xhr__)&&t(e.xhr.__sentry_xhr__.url)))){var s=e.xhr.__sentry_xhr__;if(e.endTimestamp&&e.xhr.__sentry_xhr_span_id__){var o=r[e.xhr.__sentry_xhr_span_id__];o&&(o.setHttpStatus(s.status_code),o.finish(),delete r[e.xhr.__sentry_xhr_span_id__]);return}var c=qEe.getActiveTransaction();if(c){var o=c.startChild({data:qD.__assign(qD.__assign({},s.data),{type:"xhr",method:s.method,url:s.url}),description:s.method+" "+s.url,op:"http.client"});if(e.xhr.__sentry_xhr_span_id__=o.spanId,r[e.xhr.__sentry_xhr_span_id__]=o,e.xhr.setRequestHeader)try{e.xhr.setRequestHeader("sentry-trace",o.toTraceparent())}catch(d){}}}}a(Len,"xhrCallback");OD.xhrCallback=Len});var qen=x(ZSt=>{Object.defineProperty(ZSt,"__esModule",{value:!0});var OEe=Al(),_V=OEe.getGlobalObject();function tio(e,t,r){if(t===void 0&&(t=!0),r===void 0&&(r=!0),!_V||!_V.location){OEe.logger.warn("Could not initialize routing instrumentation due to invalid location");return}var n=_V.location.href,i;t&&(i=e({name:_V.location.pathname,op:"pageload"})),r&&OEe.addInstrumentationHandler({callback:function(s){var o=s.to,c=s.from;if(c===void 0&&n&&n.indexOf(o)!==-1){n=void 0;return}c!==o&&(n=void 0,i&&(OEe.logger.log("[Tracing] Finishing current transaction with op: "+i.op),i.finish()),i=e({name:_V.location.pathname,op:"navigation"}))},type:"history"})}a(tio,"instrumentRoutingWithDefaults");ZSt.instrumentRoutingWithDefaults=tio});var jen=x(SO=>{Object.defineProperty(SO,"__esModule",{value:!0});var g1=p1(),bO=Al(),rio=PEe(),nio=AEe(),iio=XI(),Oen=KI(),aio=Een(),Men=Ien(),MEe=YSt(),sio=qen();SO.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS=600;var oio=g1.__assign({idleTimeout:nio.DEFAULT_IDLE_TIMEOUT,markBackgroundTransactions:!0,maxTransactionDuration:SO.DEFAULT_MAX_TRANSACTION_DURATION_SECONDS,routingInstrumentation:sio.instrumentRoutingWithDefaults,startTransactionOnLocationChange:!0,startTransactionOnPageLoad:!0},MEe.defaultRequestInstrumentationOptions),cio=function(){function e(t){this.name=e.id,this._emitOptionsWarning=!1;var r=MEe.defaultRequestInstrumentationOptions.tracingOrigins;t&&t.tracingOrigins&&Array.isArray(t.tracingOrigins)&&t.tracingOrigins.length!==0?r=t.tracingOrigins:this._emitOptionsWarning=!0,this.options=g1.__assign(g1.__assign(g1.__assign({},oio),t),{tracingOrigins:r}),this._metrics=new Men.MetricsInstrumentation(g1.__assign(g1.__assign({},Men.DEFAULT_METRICS_INSTR_OPTIONS),this.options._metricOptions))}return a(e,"BrowserTracing"),e.prototype.setupOnce=function(t,r){var n=this;this._getCurrentHub=r,this._emitOptionsWarning&&(bO.logger.warn("[Tracing] You need to define `tracingOrigins` in the options. Set an array of urls or patterns to trace."),bO.logger.warn("[Tracing] We added a reasonable default for you: "+MEe.defaultRequestInstrumentationOptions.tracingOrigins));var i=this.options,s=i.routingInstrumentation,o=i.startTransactionOnLocationChange,c=i.startTransactionOnPageLoad,l=i.markBackgroundTransactions,d=i.traceFetch,f=i.traceXHR,p=i.tracingOrigins,h=i.shouldCreateSpanForRequest;s(function(w){return n._createRouteTransaction(w)},c,o),l&&aio.registerBackgroundTabDetection(),MEe.instrumentOutgoingRequests({traceFetch:d,traceXHR:f,tracingOrigins:p,shouldCreateSpanForRequest:h})},e.prototype._createRouteTransaction=function(t){var r=this;if(!this._getCurrentHub){bO.logger.warn("[Tracing] Did not create "+t.op+" transaction because _getCurrentHub is invalid.");return}var n=this.options,i=n.beforeNavigate,s=n.idleTimeout,o=n.maxTransactionDuration,c=t.op==="pageload"?Fen():void 0,l=g1.__assign(g1.__assign(g1.__assign({},t),c),{trimEnd:!0}),d=typeof i=="function"?i(l):l,f=d===void 0?g1.__assign(g1.__assign({},l),{sampled:!1}):d;f.sampled===!1&&bO.logger.log("[Tracing] Will not send "+f.op+" transaction because of beforeNavigate."),bO.logger.log("[Tracing] Starting "+f.op+" transaction on scope");var p=this._getCurrentHub(),h=bO.getGlobalObject().location,w=rio.startIdleTransaction(p,f,s,!0,{location:h});return w.registerBeforeFinishCallback(function(b,E){r._metrics.addPerformanceEntries(b),lio(Oen.secToMs(o),b,E)}),w},e.id="BrowserTracing",e}();SO.BrowserTracing=cio;function Fen(){var e=zen("sentry-trace");if(e)return Oen.extractTraceparentData(e)}a(Fen,"getHeaderContext");SO.getHeaderContext=Fen;function zen(e){var t=bO.getGlobalObject().document.querySelector("meta[name="+e+"]");return t?t.getAttribute("content"):null}a(zen,"getMetaContent");SO.getMetaContent=zen;function lio(e,t,r){var n=r-t.startTimestamp,i=r&&(n>e||n<0);i&&(t.setStatus(iio.SpanStatus.DeadlineExceeded),t.setTag("maxTransactionDurationExceeded","true"))}a(lio,"adjustTransactionDuration")});var eCt=x(hV=>{Object.defineProperty(hV,"__esModule",{value:!0});var uio=jen();hV.BrowserTracing=uio.BrowserTracing;var Ben=YSt();hV.instrumentOutgoingRequests=Ben.instrumentOutgoingRequests;hV.defaultRequestInstrumentationOptions=Ben.defaultRequestInstrumentationOptions});var Gen=x(rCt=>{Object.defineProperty(rCt,"__esModule",{value:!0});var tCt=p1(),dio=Al(),fio=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._router=t.router||t.app,this._methods=(Array.isArray(t.methods)?t.methods:[]).concat("use")}return a(e,"Express"),e.prototype.setupOnce=function(){if(!this._router){dio.logger.error("ExpressIntegration is missing an Express instance");return}gio(this._router,this._methods)},e.id="Express",e}();rCt.Express=fio;function Uen(e,t){var r=e.length;switch(r){case 2:return function(n,i){var s=i.__sentry_transaction;if(s){var o=s.startChild({description:e.name,op:"middleware."+t});i.once("finish",function(){o.finish()})}return e.call(this,n,i)};case 3:return function(n,i,s){var o,c=i.__sentry_transaction,l=(o=c)===null||o===void 0?void 0:o.startChild({description:e.name,op:"middleware."+t});e.call(this,n,i,function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var p;(p=l)===null||p===void 0||p.finish(),s.call.apply(s,tCt.__spread([this],d))})};case 4:return function(n,i,s,o){var c,l=s.__sentry_transaction,d=(c=l)===null||c===void 0?void 0:c.startChild({description:e.name,op:"middleware."+t});e.call(this,n,i,s,function(){for(var f=[],p=0;p<arguments.length;p++)f[p]=arguments[p];var h;(h=d)===null||h===void 0||h.finish(),o.call.apply(o,tCt.__spread([this],f))})};default:throw new Error("Express middleware takes 2-4 arguments. Got: "+r)}}a(Uen,"wrap");function mio(e,t){return e.map(function(r){return typeof r=="function"?Uen(r,t):Array.isArray(r)?r.map(function(n){return typeof n=="function"?Uen(n,t):n}):r})}a(mio,"wrapMiddlewareArgs");function pio(e,t){var r=e[t];return e[t]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return r.call.apply(r,tCt.__spread([this],mio(n,t)))},e}a(pio,"patchMiddleware");function gio(e,t){t===void 0&&(t=[]),t.forEach(function(r){return pio(e,r)})}a(gio,"instrumentMiddlewares")});var $en=x(nCt=>{Object.defineProperty(nCt,"__esModule",{value:!0});var yV=Al(),_io=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._usePgNative=!!t.usePgNative}return a(e,"Postgres"),e.prototype.setupOnce=function(t,r){var n,i=yV.loadModule("pg");if(!i){yV.logger.error("Postgres Integration was unable to require `pg` package.");return}if(this._usePgNative&&!((n=i.native)===null||n===void 0?void 0:n.Client)){yV.logger.error("Postgres Integration was unable to access 'pg-native' bindings.");return}var s=(this._usePgNative?i.native:i).Client;yV.fill(s.prototype,"query",function(o){return function(c,l,d){var f,p,h,w=r().getScope(),b=(f=w)===null||f===void 0?void 0:f.getSpan(),E=(p=b)===null||p===void 0?void 0:p.startChild({description:typeof c=="string"?c:c.text,op:"db"});if(typeof d=="function")return o.call(this,c,l,function(T,R){var B;(B=E)===null||B===void 0||B.finish(),d(T,R)});if(typeof l=="function")return o.call(this,c,function(T,R){var B;(B=E)===null||B===void 0||B.finish(),l(T,R)});var A=typeof l!="undefined"?o.call(this,c,l):o.call(this,c);return yV.isThenable(A)?A.then(function(T){var R;return(R=E)===null||R===void 0||R.finish(),T}):((h=E)===null||h===void 0||h.finish(),A)}})},e.id="Postgres",e}();nCt.Postgres=_io});var Hen=x(aCt=>{Object.defineProperty(aCt,"__esModule",{value:!0});var iCt=Al(),hio=function(){function e(){this.name=e.id}return a(e,"Mysql"),e.prototype.setupOnce=function(t,r){var n=iCt.loadModule("mysql/lib/Connection.js");if(!n){iCt.logger.error("Mysql Integration was unable to require `mysql` package.");return}iCt.fill(n,"createQuery",function(i){return function(s,o,c){var l,d,f=r().getScope(),p=(l=f)===null||l===void 0?void 0:l.getSpan(),h=(d=p)===null||d===void 0?void 0:d.startChild({description:typeof s=="string"?s:s.sql,op:"db"});return typeof c=="function"?i.call(this,s,o,function(w,b,E){var A;(A=h)===null||A===void 0||A.finish(),c(w,b,E)}):typeof o=="function"?i.call(this,s,function(w,b,E){var A;(A=h)===null||A===void 0||A.finish(),o(w,b,E)}):i.call(this,s,o,c)}})},e.id="Mysql",e}();aCt.Mysql=hio});var Ven=x(oCt=>{Object.defineProperty(oCt,"__esModule",{value:!0});var sCt=p1(),FEe=Al(),yio=["aggregate","bulkWrite","countDocuments","createIndex","createIndexes","deleteMany","deleteOne","distinct","drop","dropIndex","dropIndexes","estimatedDocumentCount","find","findOne","findOneAndDelete","findOneAndReplace","findOneAndUpdate","indexes","indexExists","indexInformation","initializeOrderedBulkOp","insertMany","insertOne","isCapped","mapReduce","options","parallelCollectionScan","rename","replaceOne","stats","updateMany","updateOne"],vio={bulkWrite:["operations"],countDocuments:["query"],createIndex:["fieldOrSpec"],createIndexes:["indexSpecs"],deleteMany:["filter"],deleteOne:["filter"],distinct:["key","query"],dropIndex:["indexName"],find:["query"],findOne:["query"],findOneAndDelete:["filter"],findOneAndReplace:["filter","replacement"],findOneAndUpdate:["filter","update"],indexExists:["indexes"],insertMany:["docs"],insertOne:["doc"],mapReduce:["map","reduce"],rename:["newName"],replaceOne:["filter","doc"],updateMany:["filter","update"],updateOne:["filter","update"]},wio=function(){function e(t){t===void 0&&(t={}),this.name=e.id,this._operations=Array.isArray(t.operations)?t.operations:yio,this._describeOperations="describeOperations"in t?t.describeOperations:!0,this._useMongoose=!!t.useMongoose}return a(e,"Mongo"),e.prototype.setupOnce=function(t,r){var n=this._useMongoose?"mongoose":"mongodb",i=FEe.loadModule(n);if(!i){FEe.logger.error("Mongo Integration was unable to require `"+n+"` package.");return}this._instrumentOperations(i.Collection,this._operations,r)},e.prototype._instrumentOperations=function(t,r,n){var i=this;r.forEach(function(s){return i._patchOperation(t,s,n)})},e.prototype._patchOperation=function(t,r,n){if(r in t.prototype){var i=this._getSpanContextFromOperationArguments.bind(this);FEe.fill(t.prototype,r,function(s){return function(){for(var o=[],c=0;c<arguments.length;c++)o[c]=arguments[c];var l,d,f,p,h=o[o.length-1],w=n().getScope(),b=(l=w)===null||l===void 0?void 0:l.getSpan();if(typeof h!="function"||r==="mapReduce"&&o.length===2){var E=(d=b)===null||d===void 0?void 0:d.startChild(i(this,r,o)),A=s.call.apply(s,sCt.__spread([this],o));return FEe.isThenable(A)?A.then(function(R){var B;return(B=E)===null||B===void 0||B.finish(),R}):((f=E)===null||f===void 0||f.finish(),A)}var T=(p=b)===null||p===void 0?void 0:p.startChild(i(this,r,o.slice(0,-1)));return s.call.apply(s,sCt.__spread([this],o.slice(0,-1),[function(R,B){var I;(I=T)===null||I===void 0||I.finish(),h(R,B)}]))}})}},e.prototype._getSpanContextFromOperationArguments=function(t,r,n){var i={collectionName:t.collectionName,dbName:t.dbName,namespace:t.namespace},s={op:"db",description:r,data:i},o=vio[r],c=Array.isArray(this._describeOperations)?this._describeOperations.includes(r):this._describeOperations;if(!o||!c)return s;try{if(r==="mapReduce"){var l=sCt.__read(n,2),d=l[0],f=l[1];i[o[0]]=typeof d=="string"?d:d.name||"<anonymous>",i[o[1]]=typeof f=="string"?f:f.name||"<anonymous>"}else for(var p=0;p<o.length;p++)i[o[p]]=JSON.stringify(n[p])}catch(h){}return s},e.id="Mongo",e}();oCt.Mongo=wio});var Wen=x(Nj=>{Object.defineProperty(Nj,"__esModule",{value:!0});var bio=Gen();Nj.Express=bio.Express;var Sio=$en();Nj.Postgres=Sio.Postgres;var Cio=Hen();Nj.Mysql=Cio.Mysql;var Eio=Ven();Nj.Mongo=Eio.Mongo});var Qen=x(cv=>{Object.defineProperty(cv,"__esModule",{value:!0});var Xen=p1(),Aio=eCt(),Ken=PEe();cv.addExtensionMethods=Ken.addExtensionMethods;var xio=Wen(),Pio=Xen.__assign(Xen.__assign({},xio),{BrowserTracing:Aio.BrowserTracing});cv.Integrations=Pio;var kio=CEe();cv.Span=kio.Span;var Dio=EEe();cv.Transaction=Dio.Transaction;var Jen=eCt();cv.registerRequestInstrumentation=Jen.instrumentOutgoingRequests;cv.defaultRequestInstrumentationOptions=Jen.defaultRequestInstrumentationOptions;var Tio=XI();cv.SpanStatus=Tio.SpanStatus;var Rio=AEe();cv.IdleTransaction=Rio.IdleTransaction;var Iio=PEe();cv.startIdleTransaction=Iio.startIdleTransaction;Ken.addExtensionMethods();var vV=KI();cv.extractTraceparentData=vV.extractTraceparentData;cv.getActiveTransaction=vV.getActiveTransaction;cv.hasTracingEnabled=vV.hasTracingEnabled;cv.stripUrlQueryAndFragment=vV.stripUrlQueryAndFragment;cv.TRACEPARENT_REGEXP=vV.TRACEPARENT_REGEXP});var jEe=x(cCt=>{"use strict";cCt.parse=Oio;cCt.serialize=Mio;var Nio=decodeURIComponent,Lio=encodeURIComponent,qio=/; */,zEe=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function Oio(e,t){if(typeof e!="string")throw new TypeError("argument str must be a string");for(var r={},n=t||{},i=e.split(qio),s=n.decode||Nio,o=0;o<i.length;o++){var c=i[o],l=c.indexOf("=");if(!(l<0)){var d=c.substr(0,l).trim(),f=c.substr(++l,c.length).trim();f[0]=='"'&&(f=f.slice(1,-1)),r[d]==null&&(r[d]=Fio(f,s))}}return r}a(Oio,"parse");function Mio(e,t,r){var n=r||{},i=n.encode||Lio;if(typeof i!="function")throw new TypeError("option encode is invalid");if(!zEe.test(e))throw new TypeError("argument name is invalid");var s=i(t);if(s&&!zEe.test(s))throw new TypeError("argument val is invalid");var o=e+"="+s;if(n.maxAge!=null){var c=n.maxAge-0;if(isNaN(c)||!isFinite(c))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+Math.floor(c)}if(n.domain){if(!zEe.test(n.domain))throw new TypeError("option domain is invalid");o+="; Domain="+n.domain}if(n.path){if(!zEe.test(n.path))throw new TypeError("option path is invalid");o+="; Path="+n.path}if(n.expires){if(typeof n.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(o+="; HttpOnly"),n.secure&&(o+="; Secure"),n.sameSite){var l=typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}a(Mio,"serialize");function Fio(e,t){try{return t(e)}catch(r){return e}}a(Fio,"tryDecode")});var etn=x(EO=>{Object.defineProperty(EO,"__esModule",{value:!0});var zx=nw(),CO=fy(),zio=Qen(),Yen=dy(),Lj=Al(),jio=jEe(),Bio=require("domain"),Uio=require("os"),Gio=require("url"),wV=RSt();function $io(){return a(function(t,r,n){var i;t.headers&&Lj.isString(t.headers["sentry-trace"])&&(i=zio.extractTraceparentData(t.headers["sentry-trace"]));var s=CO.startTransaction(zx.__assign({name:BEe(t,{path:!0,method:!0}),op:"http.server"},i),{request:UEe(t)});CO.getCurrentHub().configureScope(function(o){o.setSpan(s)}),r.__sentry_transaction=s,r.once("finish",function(){setImmediate(function(){Hio(s,t),s.setHttpStatus(r.statusCode),s.finish()})}),n()},"sentryTracingMiddleware")}a($io,"tracingHandler");EO.tracingHandler=$io;function Hio(e,t){!e||(e.name=BEe(t,{path:!0,method:!0}),e.setData("url",t.originalUrl),e.setData("baseUrl",t.baseUrl),e.setData("query",t.query))}a(Hio,"addExpressReqToTransaction");function BEe(e,t){t===void 0&&(t={});var r,n=(r=e.method)===null||r===void 0?void 0:r.toUpperCase(),i="";e.route?i=""+(e.baseUrl||"")+e.route.path:(e.originalUrl||e.url)&&(i=Lj.stripUrlQueryAndFragment(e.originalUrl||e.url||""));var s="";return t.method&&n&&(s+=n),t.method&&t.path&&(s+=" "),t.path&&i&&(s+=i),s}a(BEe,"extractExpressTransactionName");function Vio(e,t){var r;switch(t){case"path":return BEe(e,{path:!0});case"handler":return((r=e.route)===null||r===void 0?void 0:r.stack[0].name)||"<anonymous>";case"methodPath":default:return BEe(e,{path:!0,method:!0})}}a(Vio,"extractTransaction");var Wio=["id","username","email"];function Xio(e,t){var r={},n=Array.isArray(t)?t:Wio;return n.forEach(function(i){e&&i in e&&(r[i]=e[i])}),r}a(Xio,"extractUserData");var Kio=["cookies","data","headers","method","query_string","url"];function UEe(e,t){t===void 0&&(t=Kio);var r={},n=e.headers||e.header||{},i=e.method,s=e.hostname||e.host||n.host||"<no host>",o=e.protocol==="https"||e.secure||(e.socket||{}).encrypted?"https":"http",c=e.originalUrl||e.url||"",l=o+"://"+s+c;return t.forEach(function(d){switch(d){case"headers":r.headers=n;break;case"method":r.method=i;break;case"url":r.url=l;break;case"cookies":r.cookies=e.cookies||jio.parse(n.cookie||"");break;case"query_string":r.query_string=e.query||Gio.parse(c||"",!1).query;break;case"data":if(i==="GET"||i==="HEAD")break;e.body!==void 0&&(r.data=Lj.isString(e.body)?e.body:JSON.stringify(Lj.normalize(e.body)));break;default:({}).hasOwnProperty.call(e,d)&&(r[d]=e[d])}}),r}a(UEe,"extractRequestData");EO.extractRequestData=UEe;function Zen(e,t,r){if(r=zx.__assign({ip:!1,request:!0,serverName:!0,transaction:!0,user:!0,version:!0},r),r.version&&(e.contexts=zx.__assign(zx.__assign({},e.contexts),{runtime:{name:"node",version:global.process.version}})),r.request){var n=Array.isArray(r.request)?UEe(t,r.request):UEe(t);e.request=zx.__assign(zx.__assign({},e.request),n)}if(r.serverName&&!e.server_name&&(e.server_name=global.process.env.SENTRY_NAME||Uio.hostname()),r.user){var i=t.user&&Lj.isPlainObject(t.user)?Xio(t.user,r.user):{};Object.keys(i)&&(e.user=zx.__assign(zx.__assign({},e.user),i))}if(r.ip){var s=t.ip||t.connection&&t.connection.remoteAddress;s&&(e.user=zx.__assign(zx.__assign({},e.user),{ip_address:s}))}return r.transaction&&!e.transaction&&(e.transaction=Vio(t,r.transaction)),e}a(Zen,"parseRequest");EO.parseRequest=Zen;function Jio(e){var t=CO.getCurrentHub(),r=t.getClient();if(r&&wV.isAutoSessionTrackingEnabled(r)){r.initSessionFlusher();var n=t.getScope();n&&n.getSession()&&n.setSession()}return a(function(s,o,c){if(e&&e.flushTimeout&&e.flushTimeout>0){var l=o.end;o.end=function(f,p,h){var w=this;wV.flush(e.flushTimeout).then(function(){l.call(w,f,p,h)}).then(null,function(b){Lj.logger.error(b)})}}var d=Bio.create();d.add(s),d.add(o),d.on("error",c),d.run(function(){var f=CO.getCurrentHub();f.configureScope(function(p){p.addEventProcessor(function(b){return Zen(b,s,e)});var h=f.getClient();if(wV.isAutoSessionTrackingEnabled(h)){var w=f.getScope();w&&w.setRequestSession({status:Yen.RequestSessionStatus.Ok})}}),o.once("finish",function(){var p=f.getClient();wV.isAutoSessionTrackingEnabled(p)&&setImmediate(function(){p&&p._captureRequestSession&&p._captureRequestSession()})}),c()})},"sentryRequestMiddleware")}a(Jio,"requestHandler");EO.requestHandler=Jio;function Qio(e){var t=e.status||e.statusCode||e.status_code||e.output&&e.output.statusCode;return t?parseInt(t,10):500}a(Qio,"getStatusCodeFromResponse");function Yio(e){var t=Qio(e);return t>=500}a(Yio,"defaultShouldHandleError");function Zio(e){return a(function(r,n,i,s){var o=e&&e.shouldHandleError||Yio;if(o(r)){CO.withScope(function(c){var l=i.__sentry_transaction;l&&c.getSpan()===void 0&&c.setSpan(l);var d=CO.getCurrentHub().getClient();if(d&&wV.isAutoSessionTrackingEnabled(d)){var f=d._sessionFlusher!==void 0;if(f){var p=c.getRequestSession();p&&p.status!==void 0&&(p.status=Yen.RequestSessionStatus.Crashed)}}var h=CO.captureException(r);i.sentry=h,s(r)});return}s(r)},"sentryErrorMiddleware")}a(Zio,"errorHandler");EO.errorHandler=Zio});var ntn=x(Ed=>{Object.defineProperty(Ed,"__esModule",{value:!0});var ttn=nw(),rtn=dy();Ed.Severity=rtn.Severity;Ed.Status=rtn.Status;var c_=fy();Ed.addGlobalEventProcessor=c_.addGlobalEventProcessor;Ed.addBreadcrumb=c_.addBreadcrumb;Ed.captureException=c_.captureException;Ed.captureEvent=c_.captureEvent;Ed.captureMessage=c_.captureMessage;Ed.configureScope=c_.configureScope;Ed.getHubFromCarrier=c_.getHubFromCarrier;Ed.getCurrentHub=c_.getCurrentHub;Ed.Hub=c_.Hub;Ed.makeMain=c_.makeMain;Ed.Scope=c_.Scope;Ed.startTransaction=c_.startTransaction;Ed.SDK_VERSION=c_.SDK_VERSION;Ed.setContext=c_.setContext;Ed.setExtra=c_.setExtra;Ed.setExtras=c_.setExtras;Ed.setTag=c_.setTag;Ed.setTags=c_.setTags;Ed.setUser=c_.setUser;Ed.withScope=c_.withScope;var eao=fSt();Ed.NodeBackend=eao.NodeBackend;var tao=gSt();Ed.NodeClient=tao.NodeClient;var qj=RSt();Ed.defaultIntegrations=qj.defaultIntegrations;Ed.init=qj.init;Ed.lastEventId=qj.lastEventId;Ed.flush=qj.flush;Ed.close=qj.close;Ed.getSentryRelease=qj.getSentryRelease;var rao=GZr();Ed.deepReadDirSync=rao.deepReadDirSync;var nao=Qbt();Ed.SDK_NAME=nao.SDK_NAME;var iao=fy(),aao=jb(),sao=require("domain"),oao=etn();Ed.Handlers=oao;var cao=DSt(),lao=uSt();Ed.Transports=lao;var uao=ttn.__assign(ttn.__assign({},iao.Integrations),cao);Ed.Integrations=uao;var bV=aao.getMainCarrier();bV.__SENTRY__&&(bV.__SENTRY__.extensions=bV.__SENTRY__.extensions||{},bV.__SENTRY__.extensions.domain=bV.__SENTRY__.extensions.domain||sao)});var itn,Oj,atn,stn,otn,ctn,lCt=An(()=>{itn=ji(BJr());Tf();Oj=ji(ntn());au();atn=ji(zR());V9();stn=a(()=>{Uy||(0,Oj.init)({dsn:p3t,integrations:[new itn.RewriteFrames({root:global.__rootdir__})],release:Y6(),beforeSend:e=>(console.log(e.exception.values),e.message=(0,atn.default)(e.message),e)})},"initializeSentry"),otn=a(({invocationId:e,command:t})=>{(0,Oj.setTags)({invocationId:e,command:t,osPlatform:process.platform})},"setSentryTags"),ctn=a(async e=>{let t=(0,Oj.captureException)(e);return await Lv(d3t),t},"reportErrorToSentry")});var vCt=x((Bx,ytn)=>{"use strict";Object.defineProperty(Bx,"__esModule",{value:!0});function SV(e){return e&&typeof e=="object"&&"default"in e?e.default:e}a(SV,"_interopDefault");var _1=SV(require("stream")),ltn=SV(require("http")),uCt=SV(require("url")),dao=SV(require("https")),AO=SV(require("zlib")),fao=_1.Readable,MD=Symbol("buffer"),dCt=Symbol("type"),ZI=class{constructor(){this[dCt]="";let t=arguments[0],r=arguments[1],n=[],i=0;if(t){let o=t,c=Number(o.length);for(let l=0;l<c;l++){let d=o[l],f;d instanceof Buffer?f=d:ArrayBuffer.isView(d)?f=Buffer.from(d.buffer,d.byteOffset,d.byteLength):d instanceof ArrayBuffer?f=Buffer.from(d):d instanceof ZI?f=d[MD]:f=Buffer.from(typeof d=="string"?d:String(d)),i+=f.length,n.push(f)}}this[MD]=Buffer.concat(n);let s=r&&r.type!==void 0&&String(r.type).toLowerCase();s&&!/[^\u0020-\u007E]/.test(s)&&(this[dCt]=s)}get size(){return this[MD].length}get type(){return this[dCt]}text(){return Promise.resolve(this[MD].toString())}arrayBuffer(){let t=this[MD],r=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return Promise.resolve(r)}stream(){let t=new fao;return t._read=function(){},t.push(this[MD]),t.push(null),t}toString(){return"[object Blob]"}slice(){let t=this.size,r=arguments[0],n=arguments[1],i,s;r===void 0?i=0:r<0?i=Math.max(t+r,0):i=Math.min(r,t),n===void 0?s=t:n<0?s=Math.max(t+n,0):s=Math.min(n,t);let o=Math.max(s-i,0),l=this[MD].slice(i,i+o),d=new ZI([],{type:arguments[2]});return d[MD]=l,d}};a(ZI,"Blob");Object.defineProperties(ZI.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});Object.defineProperty(ZI.prototype,Symbol.toStringTag,{value:"Blob",writable:!1,enumerable:!1,configurable:!0});function lv(e,t,r){Error.call(this,e),this.message=e,this.type=t,r&&(this.code=this.errno=r.code),Error.captureStackTrace(this,this.constructor)}a(lv,"FetchError");lv.prototype=Object.create(Error.prototype);lv.prototype.constructor=lv;lv.prototype.name="FetchError";var fCt;try{fCt=require("encoding").convert}catch(e){}var FD=Symbol("Body internals"),utn=_1.PassThrough;function Sh(e){var t=this,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.size;let i=n===void 0?0:n;var s=r.timeout;let o=s===void 0?0:s;e==null?e=null:dtn(e)?e=Buffer.from(e.toString()):CV(e)||Buffer.isBuffer(e)||(Object.prototype.toString.call(e)==="[object ArrayBuffer]"?e=Buffer.from(e):ArrayBuffer.isView(e)?e=Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof _1||(e=Buffer.from(String(e)))),this[FD]={body:e,disturbed:!1,error:null},this.size=i,this.timeout=o,e instanceof _1&&e.on("error",function(c){let l=c.name==="AbortError"?c:new lv(`Invalid response body while trying to fetch ${t.url}: ${c.message}`,"system",c);t[FD].error=l})}a(Sh,"Body");Sh.prototype={get body(){return this[FD].body},get bodyUsed(){return this[FD].disturbed},arrayBuffer(){return Mj.call(this).then(function(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)})},blob(){let e=this.headers&&this.headers.get("content-type")||"";return Mj.call(this).then(function(t){return Object.assign(new ZI([],{type:e.toLowerCase()}),{[MD]:t})})},json(){var e=this;return Mj.call(this).then(function(t){try{return JSON.parse(t.toString())}catch(r){return Sh.Promise.reject(new lv(`invalid json response body at ${e.url} reason: ${r.message}`,"invalid-json"))}})},text(){return Mj.call(this).then(function(e){return e.toString()})},buffer(){return Mj.call(this)},textConverted(){var e=this;return Mj.call(this).then(function(t){return mao(t,e.headers)})}};Object.defineProperties(Sh.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0}});Sh.mixIn=function(e){for(let t of Object.getOwnPropertyNames(Sh.prototype))if(!(t in e)){let r=Object.getOwnPropertyDescriptor(Sh.prototype,t);Object.defineProperty(e,t,r)}};function Mj(){var e=this;if(this[FD].disturbed)return Sh.Promise.reject(new TypeError(`body used already for: ${this.url}`));if(this[FD].disturbed=!0,this[FD].error)return Sh.Promise.reject(this[FD].error);let t=this.body;if(t===null)return Sh.Promise.resolve(Buffer.alloc(0));if(CV(t)&&(t=t.stream()),Buffer.isBuffer(t))return Sh.Promise.resolve(t);if(!(t instanceof _1))return Sh.Promise.resolve(Buffer.alloc(0));let r=[],n=0,i=!1;return new Sh.Promise(function(s,o){let c;e.timeout&&(c=setTimeout(function(){i=!0,o(new lv(`Response timeout while trying to fetch ${e.url} (over ${e.timeout}ms)`,"body-timeout"))},e.timeout)),t.on("error",function(l){l.name==="AbortError"?(i=!0,o(l)):o(new lv(`Invalid response body while trying to fetch ${e.url}: ${l.message}`,"system",l))}),t.on("data",function(l){if(!(i||l===null)){if(e.size&&n+l.length>e.size){i=!0,o(new lv(`content size at ${e.url} over limit: ${e.size}`,"max-size"));return}n+=l.length,r.push(l)}}),t.on("end",function(){if(!i){clearTimeout(c);try{s(Buffer.concat(r,n))}catch(l){o(new lv(`Could not create Buffer from response body for ${e.url}: ${l.message}`,"system",l))}}})})}a(Mj,"consumeBody");function mao(e,t){if(typeof fCt!="function")throw new Error("The package `encoding` must be installed to use the textConverted() function");let r=t.get("content-type"),n="utf-8",i,s;return r&&(i=/charset=([^;]*)/i.exec(r)),s=e.slice(0,1024).toString(),!i&&s&&(i=/<meta.+?charset=(['"])(.+?)\1/i.exec(s)),!i&&s&&(i=/<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(s),i||(i=/<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(s),i&&i.pop()),i&&(i=/charset=(.*)/i.exec(i.pop()))),!i&&s&&(i=/<\?xml.+?encoding=(['"])(.+?)\1/i.exec(s)),i&&(n=i.pop(),(n==="gb2312"||n==="gbk")&&(n="gb18030")),fCt(e,"UTF-8",n).toString()}a(mao,"convertBody");function dtn(e){return typeof e!="object"||typeof e.append!="function"||typeof e.delete!="function"||typeof e.get!="function"||typeof e.getAll!="function"||typeof e.has!="function"||typeof e.set!="function"?!1:e.constructor.name==="URLSearchParams"||Object.prototype.toString.call(e)==="[object URLSearchParams]"||typeof e.sort=="function"}a(dtn,"isURLSearchParams");function CV(e){return typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&typeof e.constructor=="function"&&typeof e.constructor.name=="string"&&/^(Blob|File)$/.test(e.constructor.name)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}a(CV,"isBlob");function ftn(e){let t,r,n=e.body;if(e.bodyUsed)throw new Error("cannot clone body after it is used");return n instanceof _1&&typeof n.getBoundary!="function"&&(t=new utn,r=new utn,n.pipe(t),n.pipe(r),e[FD].body=t,n=r),n}a(ftn,"clone");function mtn(e){return e===null?null:typeof e=="string"?"text/plain;charset=UTF-8":dtn(e)?"application/x-www-form-urlencoded;charset=UTF-8":CV(e)?e.type||null:Buffer.isBuffer(e)||Object.prototype.toString.call(e)==="[object ArrayBuffer]"||ArrayBuffer.isView(e)?null:typeof e.getBoundary=="function"?`multipart/form-data;boundary=${e.getBoundary()}`:e instanceof _1?null:"text/plain;charset=UTF-8"}a(mtn,"extractContentType");function ptn(e){let t=e.body;return t===null?0:CV(t)?t.size:Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync=="function"&&(t._lengthRetrievers&&t._lengthRetrievers.length==0||t.hasKnownLength&&t.hasKnownLength())?t.getLengthSync():null}a(ptn,"getTotalBytes");function pao(e,t){let r=t.body;r===null?e.end():CV(r)?r.stream().pipe(e):Buffer.isBuffer(r)?(e.write(r),e.end()):r.pipe(e)}a(pao,"writeToStream");Sh.Promise=global.Promise;var gtn=/[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/,mCt=/[^\t\x20-\x7e\x80-\xff]/;function EV(e){if(e=`${e}`,gtn.test(e)||e==="")throw new TypeError(`${e} is not a legal HTTP header name`)}a(EV,"validateName");function _tn(e){if(e=`${e}`,mCt.test(e))throw new TypeError(`${e} is not a legal HTTP header value`)}a(_tn,"validateValue");function Fj(e,t){t=t.toLowerCase();for(let r in e)if(r.toLowerCase()===t)return r}a(Fj,"find");var Eg=Symbol("map"),m0=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0;if(this[Eg]=Object.create(null),t instanceof m0){let r=t.raw(),n=Object.keys(r);for(let i of n)for(let s of r[i])this.append(i,s);return}if(t!=null)if(typeof t=="object"){let r=t[Symbol.iterator];if(r!=null){if(typeof r!="function")throw new TypeError("Header pairs must be iterable");let n=[];for(let i of t){if(typeof i!="object"||typeof i[Symbol.iterator]!="function")throw new TypeError("Each header pair must be iterable");n.push(Array.from(i))}for(let i of n){if(i.length!==2)throw new TypeError("Each header pair must be a name/value tuple");this.append(i[0],i[1])}}else for(let n of Object.keys(t)){let i=t[n];this.append(n,i)}}else throw new TypeError("Provided initializer must be an object")}get(t){t=`${t}`,EV(t);let r=Fj(this[Eg],t);return r===void 0?null:this[Eg][r].join(", ")}forEach(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=pCt(this),i=0;for(;i<n.length;){var s=n[i];let o=s[0],c=s[1];t.call(r,c,o,this),n=pCt(this),i++}}set(t,r){t=`${t}`,r=`${r}`,EV(t),_tn(r);let n=Fj(this[Eg],t);this[Eg][n!==void 0?n:t]=[r]}append(t,r){t=`${t}`,r=`${r}`,EV(t),_tn(r);let n=Fj(this[Eg],t);n!==void 0?this[Eg][n].push(r):this[Eg][t]=[r]}has(t){return t=`${t}`,EV(t),Fj(this[Eg],t)!==void 0}delete(t){t=`${t}`,EV(t);let r=Fj(this[Eg],t);r!==void 0&&delete this[Eg][r]}raw(){return this[Eg]}keys(){return _Ct(this,"key")}values(){return _Ct(this,"value")}[Symbol.iterator](){return _Ct(this,"key+value")}};a(m0,"Headers");m0.prototype.entries=m0.prototype[Symbol.iterator];Object.defineProperty(m0.prototype,Symbol.toStringTag,{value:"Headers",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(m0.prototype,{get:{enumerable:!0},forEach:{enumerable:!0},set:{enumerable:!0},append:{enumerable:!0},has:{enumerable:!0},delete:{enumerable:!0},keys:{enumerable:!0},values:{enumerable:!0},entries:{enumerable:!0}});function pCt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"key+value";return Object.keys(e[Eg]).sort().map(t==="key"?function(n){return n.toLowerCase()}:t==="value"?function(n){return e[Eg][n].join(", ")}:function(n){return[n.toLowerCase(),e[Eg][n].join(", ")]})}a(pCt,"getHeaders");var gCt=Symbol("internal");function _Ct(e,t){let r=Object.create(hCt);return r[gCt]={target:e,kind:t,index:0},r}a(_Ct,"createHeadersIterator");var hCt=Object.setPrototypeOf({next(){if(!this||Object.getPrototypeOf(this)!==hCt)throw new TypeError("Value of `this` is not a HeadersIterator");var e=this[gCt];let t=e.target,r=e.kind,n=e.index,i=pCt(t,r),s=i.length;return n>=s?{value:void 0,done:!0}:(this[gCt].index=n+1,{value:i[n],done:!1})}},Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())));Object.defineProperty(hCt,Symbol.toStringTag,{value:"HeadersIterator",writable:!1,enumerable:!1,configurable:!0});function gao(e){let t=Object.assign({__proto__:null},e[Eg]),r=Fj(e[Eg],"Host");return r!==void 0&&(t[r]=t[r][0]),t}a(gao,"exportNodeCompatibleHeaders");function _ao(e){let t=new m0;for(let r of Object.keys(e))if(!gtn.test(r))if(Array.isArray(e[r]))for(let n of e[r])mCt.test(n)||(t[Eg][r]===void 0?t[Eg][r]=[n]:t[Eg][r].push(n));else mCt.test(e[r])||(t[Eg][r]=[e[r]]);return t}a(_ao,"createHeadersLenient");var e2=Symbol("Response internals"),hao=ltn.STATUS_CODES,Gb=class{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Sh.call(this,t,r);let n=r.status||200,i=new m0(r.headers);if(t!=null&&!i.has("Content-Type")){let s=mtn(t);s&&i.append("Content-Type",s)}this[e2]={url:r.url,status:n,statusText:r.statusText||hao[n],headers:i,counter:r.counter}}get url(){return this[e2].url||""}get status(){return this[e2].status}get ok(){return this[e2].status>=200&&this[e2].status<300}get redirected(){return this[e2].counter>0}get statusText(){return this[e2].statusText}get headers(){return this[e2].headers}clone(){return new Gb(ftn(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected})}};a(Gb,"Response");Sh.mixIn(Gb.prototype);Object.defineProperties(Gb.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});Object.defineProperty(Gb.prototype,Symbol.toStringTag,{value:"Response",writable:!1,enumerable:!1,configurable:!0});var zD=Symbol("Request internals"),yCt=uCt.parse,yao=uCt.format,vao="destroy"in _1.Readable.prototype;function GEe(e){return typeof e=="object"&&typeof e[zD]=="object"}a(GEe,"isRequest");function wao(e){let t=e&&typeof e=="object"&&Object.getPrototypeOf(e);return!!(t&&t.constructor.name==="AbortSignal")}a(wao,"isAbortSignal");var jx=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n;GEe(t)?n=yCt(t.url):(t&&t.href?n=yCt(t.href):n=yCt(`${t}`),t={});let i=r.method||t.method||"GET";if(i=i.toUpperCase(),(r.body!=null||GEe(t)&&t.body!==null)&&(i==="GET"||i==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=r.body!=null?r.body:GEe(t)&&t.body!==null?ftn(t):null;Sh.call(this,s,{timeout:r.timeout||t.timeout||0,size:r.size||t.size||0});let o=new m0(r.headers||t.headers||{});if(s!=null&&!o.has("Content-Type")){let l=mtn(s);l&&o.append("Content-Type",l)}let c=GEe(t)?t.signal:null;if("signal"in r&&(c=r.signal),c!=null&&!wao(c))throw new TypeError("Expected signal to be an instanceof AbortSignal");this[zD]={method:i,redirect:r.redirect||t.redirect||"follow",headers:o,parsedURL:n,signal:c},this.follow=r.follow!==void 0?r.follow:t.follow!==void 0?t.follow:20,this.compress=r.compress!==void 0?r.compress:t.compress!==void 0?t.compress:!0,this.counter=r.counter||t.counter||0,this.agent=r.agent||t.agent}get method(){return this[zD].method}get url(){return yao(this[zD].parsedURL)}get headers(){return this[zD].headers}get redirect(){return this[zD].redirect}get signal(){return this[zD].signal}clone(){return new jx(this)}};a(jx,"Request");Sh.mixIn(jx.prototype);Object.defineProperty(jx.prototype,Symbol.toStringTag,{value:"Request",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(jx.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});function bao(e){let t=e[zD].parsedURL,r=new m0(e[zD].headers);if(r.has("Accept")||r.set("Accept","*/*"),!t.protocol||!t.hostname)throw new TypeError("Only absolute URLs are supported");if(!/^https?:$/.test(t.protocol))throw new TypeError("Only HTTP(S) protocols are supported");if(e.signal&&e.body instanceof _1.Readable&&!vao)throw new Error("Cancellation of streamed requests with AbortSignal is not supported in node < 8");let n=null;if(e.body==null&&/^(POST|PUT)$/i.test(e.method)&&(n="0"),e.body!=null){let s=ptn(e);typeof s=="number"&&(n=String(s))}n&&r.set("Content-Length",n),r.has("User-Agent")||r.set("User-Agent","node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate");let i=e.agent;return typeof i=="function"&&(i=i(t)),!r.has("Connection")&&!i&&r.set("Connection","close"),Object.assign({},t,{method:e.method,headers:gao(r),agent:i})}a(bao,"getNodeRequestOptions");function AV(e){Error.call(this,e),this.type="aborted",this.message=e,Error.captureStackTrace(this,this.constructor)}a(AV,"AbortError");AV.prototype=Object.create(Error.prototype);AV.prototype.constructor=AV;AV.prototype.name="AbortError";var htn=_1.PassThrough,Sao=uCt.resolve;function t2(e,t){if(!t2.Promise)throw new Error("native promise missing, set fetch.Promise to your favorite alternative");return Sh.Promise=t2.Promise,new t2.Promise(function(r,n){let i=new jx(e,t),s=bao(i),o=(s.protocol==="https:"?dao:ltn).request,c=i.signal,l=null,d=a(function(){let E=new AV("The user aborted a request.");n(E),i.body&&i.body instanceof _1.Readable&&i.body.destroy(E),!(!l||!l.body)&&l.body.emit("error",E)},"abort");if(c&&c.aborted){d();return}let f=a(function(){d(),w()},"abortAndFinalize"),p=o(s),h;c&&c.addEventListener("abort",f);function w(){p.abort(),c&&c.removeEventListener("abort",f),clearTimeout(h)}a(w,"finalize"),i.timeout&&p.once("socket",function(b){h=setTimeout(function(){n(new lv(`network timeout at: ${i.url}`,"request-timeout")),w()},i.timeout)}),p.on("error",function(b){n(new lv(`request to ${i.url} failed, reason: ${b.message}`,"system",b)),w()}),p.on("response",function(b){clearTimeout(h);let E=_ao(b.headers);if(t2.isRedirect(b.statusCode)){let I=E.get("Location"),q=I===null?null:Sao(i.url,I);switch(i.redirect){case"error":n(new lv(`uri requested responds with a redirect, redirect mode is set to error: ${i.url}`,"no-redirect")),w();return;case"manual":if(q!==null)try{E.set("Location",q)}catch(K){n(K)}break;case"follow":if(q===null)break;if(i.counter>=i.follow){n(new lv(`maximum redirect reached at: ${i.url}`,"max-redirect")),w();return}let re={headers:new m0(i.headers),follow:i.follow,counter:i.counter+1,agent:i.agent,compress:i.compress,method:i.method,body:i.body,signal:i.signal,timeout:i.timeout,size:i.size};if(b.statusCode!==303&&i.body&&ptn(i)===null){n(new lv("Cannot follow redirect with body being a readable stream","unsupported-redirect")),w();return}(b.statusCode===303||(b.statusCode===301||b.statusCode===302)&&i.method==="POST")&&(re.method="GET",re.body=void 0,re.headers.delete("content-length")),r(t2(new jx(q,re))),w();return}}b.once("end",function(){c&&c.removeEventListener("abort",f)});let A=b.pipe(new htn),T={url:i.url,status:b.statusCode,statusText:b.statusMessage,headers:E,size:i.size,timeout:i.timeout,counter:i.counter},R=E.get("Content-Encoding");if(!i.compress||i.method==="HEAD"||R===null||b.statusCode===204||b.statusCode===304){l=new Gb(A,T),r(l);return}let B={flush:AO.Z_SYNC_FLUSH,finishFlush:AO.Z_SYNC_FLUSH};if(R=="gzip"||R=="x-gzip"){A=A.pipe(AO.createGunzip(B)),l=new Gb(A,T),r(l);return}if(R=="deflate"||R=="x-deflate"){b.pipe(new htn).once("data",function(q){(q[0]&15)==8?A=A.pipe(AO.createInflate()):A=A.pipe(AO.createInflateRaw()),l=new Gb(A,T),r(l)});return}if(R=="br"&&typeof AO.createBrotliDecompress=="function"){A=A.pipe(AO.createBrotliDecompress()),l=new Gb(A,T),r(l);return}l=new Gb(A,T),r(l)}),pao(p,i)})}a(t2,"fetch");t2.isRedirect=function(e){return e===301||e===302||e===303||e===307||e===308};t2.Promise=global.Promise;ytn.exports=Bx=t2;Object.defineProperty(Bx,"__esModule",{value:!0});Bx.default=Bx;Bx.Headers=m0;Bx.Request=jx;Bx.Response=Gb;Bx.FetchError=lv});var vtn,wtn,btn=An(()=>{vtn=ji(vCt()),wtn=a((e,t)=>{let{method:r="GET",headers:n={},body:i}=t;return(0,vtn.default)(e,y(m({method:r},i&&{body:JSON.stringify(i)}),{headers:m({"Content-Type":"application/json"},n)})).then(s=>s.json()).then(s=>s)},"jsonFetch")});var Stn,Ctn=An(()=>{Tf();au();V9();btn();Stn=a(async({outcome:e,args:t,systemId:r,command:n,invokedFrom:i,invocationId:s})=>{let o={systemId:r,command:n||null,cliArgs:t?Object.keys(t):null,duration:_7t(),outcome:e,timestamp:Date.now(),locale:Intl.DateTimeFormat().resolvedOptions().locale,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,nodeVersion:process.versions.node,version:Y6(),platform:process.platform,invokedFrom:i,invocationId:s};wtn(u3t,{method:"POST",body:o}).catch(()=>{})},"reportTelemetryEvent")});var Dtn=x((JJc,ktn)=>{"use strict";var Etn=require("child_process"),Atn=Etn.spawn,Cao=Etn.exec;ktn.exports=function(e,t,r){if(typeof t=="function"&&r===void 0&&(r=t,t=void 0),e=parseInt(e),Number.isNaN(e)){if(r)return r(new Error("pid must be a number"));throw new Error("pid must be a number")}var n={},i={};switch(n[e]=[],i[e]=1,process.platform){case"win32":Cao("taskkill /pid "+e+" /T /F",r);break;case"darwin":wCt(e,n,i,function(s){return Atn("pgrep",["-P",s])},function(){xtn(n,t,r)});break;default:wCt(e,n,i,function(s){return Atn("ps",["-o","pid","--no-headers","--ppid",s])},function(){xtn(n,t,r)});break}};function xtn(e,t,r){var n={};try{Object.keys(e).forEach(function(i){e[i].forEach(function(s){n[s]||(Ptn(s,t),n[s]=1)}),n[i]||(Ptn(i,t),n[i]=1)})}catch(i){if(r)return r(i);throw i}if(r)return r()}a(xtn,"killAll");function Ptn(e,t){try{process.kill(parseInt(e,10),t)}catch(r){if(r.code!=="ESRCH")throw r}}a(Ptn,"killPid");function wCt(e,t,r,n,i){var s=n(e),o="";s.stdout.on("data",function(l){var l=l.toString("ascii");o+=l});var c=a(function(l){if(delete r[e],l!=0){Object.keys(r).length==0&&i();return}o.match(/\d+/g).forEach(function(d){d=parseInt(d,10),t[e].push(d),t[d]=[],r[d]=1,wCt(d,t,r,n,i)})},"onClose");s.on("close",c)}a(wCt,"buildProcessTree")});var Ttn,bCt,uR,c4e=An(()=>{pc();w$();lCt();Ctn();$u();Ttn=ji(Dtn());au();Qo();Tf();bCt=class{constructor(){this.cleanUpHooks=[];this.isInitialized=!1;this.pendingCancellablePromises={};this.init=async()=>{this.isInitialized||(process.env.NODE_NO_WARNINGS="1",this.registerProcessListeners(),this.isInitialized=!0),this.isErrored=!1};this.registerCleanUpHook=t=>{this.cleanUpHooks.push(t)};this.cleanUpAfterSuccess=async()=>{this.reportTelemetryEvent({outcome:"SUCCESS"}),await this.cleanUp()};this.handleError=async t=>{let r;if(t.isExpected?r=new jn(t.type,t.message,t.hint,t.stack):r=t.details?t:new s_({error:t}),ha.stopAllSpinners(),this.cancelPendingPromises(r),this.reportTelemetryEvent({outcome:r.details.errorType}),!r.isExpected){let n=await ctn(r);r.details.sentryEventId=n}return ha.error(r),await this.cleanUp().catch(()=>{}),{handledError:TXr(r)}};this.reportTelemetryEvent=({outcome:t})=>{Stn({outcome:t,invokedFrom:tk(yn,"invokedFrom"),args:tk(yn,"args"),command:tk(yn,"command"),systemId:tk(yn,"systemId"),invocationId:tk(yn,"invocationId")})};this.cleanUp=async()=>{let t=!1;setTimeout(()=>{t||ha.info("Cleaning up after error...")},100);let{command:r,args:n,relativeConfigPath:i}=yn,s=!n.preserveTempFiles&&!(r==="invoke-local"&&n.watch)&&r!=="package-workloads"&&i;await Promise.all([this.cleanUpHooks.map(o=>o()),s&&u0e()]),t=!0};this.cancelPendingPromises=t=>{Object.values(this.pendingCancellablePromises).forEach(({rejectFn:r})=>{r(t)})};this.handleUnhandledError=({err:t,type:r})=>{this.isErrored||(Uy&&ha.warn(`[shown-only-in-dev-mode] ${r}`),this.isErrored=!0,this.cancelPendingPromises(t))};this.cleanExitProcess=t=>async()=>(yn.invokedFrom==="cli"&&this.reportTelemetryEvent({outcome:t}),await this.cleanUp(),(0,Ttn.default)(process.pid,()=>process.exit(0)));this.registerProcessListeners=()=>{process.removeAllListeners("uncaughtException"),process.removeAllListeners("unhandledRejection"),process.on("uncaughtException",t=>{this.handleUnhandledError({err:t,type:"UNCAUGHT EXCEPTION"})}),process.on("unhandledRejection",t=>{this.handleUnhandledError({err:t instanceof Error?t:new Error(`Unknown error: ${JSON.stringify(t)}`),type:"UNHANDLED PROMISE REJECTION"})}),process.on("SIGINT",this.cleanExitProcess("SIGINT")),process.on("SIGTERM",this.cleanExitProcess("SIGTERM")),process.on("SIGQUIT",this.cleanExitProcess("SIGQUIT"))}}};a(bCt,"ApplicationManager");uR=new bCt});var CCt=x($Ee=>{"use strict";Object.defineProperty($Ee,"__esModule",{value:!0});$Ee.Dequeue=void 0;var SCt=class{constructor(){this._length=0,this.head=void 0,this.tail=void 0}get length(){return this._length}clear(){this.head=this.tail=void 0,this._length=0}push(t){let r={value:t,prev:this.tail,next:void 0};this._length?(this.tail.next=r,this.tail=r):this.head=this.tail=r,this._length++}pop(){if(!this._length)return;let t=this.tail;return this.tail=this.tail.prev,this._length--,this._length||(this.head=this.tail=void 0),t.value}unshift(t){let r={value:t,prev:void 0,next:this.head};this._length?(this.head.prev=r,this.head=r):this.head=this.tail=r,this._length++}shift(){if(!this._length)return;let t=this.head;return this.head=this.head.next,this._length--,this._length||(this.head=this.tail=void 0),t.value}peekFront(){if(this._length)return this.head.value}peekBack(){if(this._length)return this.tail.value}};a(SCt,"Dequeue");$Ee.Dequeue=SCt});var VEe=x(HEe=>{"use strict";Object.defineProperty(HEe,"__esModule",{value:!0});HEe.QuotaManager=void 0;var Eao=CCt(),ECt=class{constructor(t){if(this._quota=t,this._activeCount=0,this.history=new Eao.Dequeue,typeof t!="object"&&(console.warn("[p-ratelimit QuotaManager] A QuotaManager was created with no quota."),this._quota={}),"interval"in this._quota&&!("rate"in this._quota)||"rate"in this._quota&&!("interval"in this._quota)){let r="[p-ratelimit QuotaManager] Invalid Quota: for a rate-limit quota, both interval and rate must be specified.";throw new Error(r)}}get quota(){return Object.assign({},this._quota)}get activeCount(){return this._activeCount}get maxDelay(){return this._quota.maxDelay||0}start(){if(this._activeCount>=this._quota.concurrency)return!1;if(this._quota.interval!==void 0&&this._quota.rate!==void 0){if(this.removeExpiredHistory(),this.history.length>=this._quota.rate)return!1;this.history.push(Date.now())}return this._activeCount++,!0}end(){this._activeCount--}removeExpiredHistory(){let t=Date.now()-this._quota.interval;for(;this.history.length&&this.history.peekFront()<t;)this.history.shift()}};a(ECt,"QuotaManager");HEe.QuotaManager=ECt});var xCt=x(WEe=>{"use strict";Object.defineProperty(WEe,"__esModule",{value:!0});WEe.RateLimitTimeoutError=void 0;var ACt=class extends Error{};a(ACt,"RateLimitTimeoutError");WEe.RateLimitTimeoutError=ACt});var Ntn=x(XEe=>{"use strict";Object.defineProperty(XEe,"__esModule",{value:!0});XEe.pRateLimit=void 0;var Aao=CCt(),Rtn=VEe(),xao=xCt();function Itn(e){if(!(e instanceof Rtn.QuotaManager))return Itn(new Rtn.QuotaManager(e));let t=new Aao.Dequeue,r=null,n=a(()=>{for(;t.length&&e.start();)t.shift()();t.length&&!e.activeCount&&!r&&(r=setTimeout(()=>{r=null,n()},100))},"next");return i=>new Promise((s,o)=>{let c=null;e.maxDelay&&(c=setTimeout(()=>{c=null,o(new xao.RateLimitTimeoutError("queue maxDelay timeout exceeded")),n()},e.maxDelay));let l=a(()=>{if(e.maxDelay)if(c)clearTimeout(c);else return;i().then(d=>{e.end(),s(d)}).catch(d=>{e.end(),o(d)}).then(()=>{n()})},"run");t.push(l),n()})}a(Itn,"pRateLimit");XEe.pRateLimit=Itn});var Ltn=x(r2=>{"use strict";Object.defineProperty(r2,"__esModule",{value:!0});r2.promisify=r2.sleep=r2.uniqueId=void 0;var Pao=require("crypto");function kao(){return Pao.randomBytes(16).toString("hex")}a(kao,"uniqueId");r2.uniqueId=kao;function Dao(e){return new Promise(t=>setTimeout(t,e))}a(Dao,"sleep");r2.sleep=Dao;function Tao(e){return function(...t){return new Promise((r,n)=>{e.apply(null,t.concat((i,...s)=>{i?n(i):r.apply(null,s)}))})}}a(Tao,"promisify");r2.promisify=Tao});var qtn=x(zj=>{"use strict";var Rao=zj&&zj.__awaiter||function(e,t,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return a(i,"adopt"),new(r||(r=Promise))(function(s,o){function c(f){try{d(n.next(f))}catch(p){o(p)}}a(c,"fulfilled");function l(f){try{d(n.throw(f))}catch(p){o(p)}}a(l,"rejected");function d(f){f.done?s(f.value):i(f.value).then(c,l)}a(d,"step"),d((n=n.apply(e,t||[])).next())})};Object.defineProperty(zj,"__esModule",{value:!0});zj.RedisQuotaManager=void 0;var PCt=Ltn(),Iao=VEe(),kCt=class extends Iao.QuotaManager{constructor(t,r,n,i=3e4){super(Object.assign({},t,{concurrency:t.fastStart?t.concurrency:0}));this.channelQuota=t,this.heartbeatInterval=i,this.uniqueId=PCt.uniqueId(),this.pingsReceived=new Map,this.heartbeatTimer=null,this._ready=Boolean(t.fastStart),this.channelName=`ratelimit-${r}`;let s=Array.isArray(n)?n:[n];if(s.length===1){if(this.client=s[0],typeof this.client.duplicate!="function"){let o="[p-ratelimit RedisQuotaManager] Your Redis client does not support the client.duplicate() function. Please provide an array of two clients instead.";throw new Error(o)}this.pubSubClient=this.client.duplicate()}else this.client=s[0],this.pubSubClient=s[1];this.register()}get ready(){return this._ready}register(){return Rao(this,void 0,void 0,function*(){this.pingsReceived.set(this.uniqueId,Date.now()),this.pubSubClient.on("message",(t,r)=>this.message(t,r)),yield PCt.promisify(this.pubSubClient.subscribe.bind(this.pubSubClient))(this.channelName),this.ping(),this.channelQuota.fastStart||(yield PCt.sleep(3e3)),yield this.updateQuota(),this._ready=!0,this.heartbeatTimer=setInterval(()=>this.heartbeat(),this.heartbeatInterval)})}ping(){this.client.publish(this.channelName,JSON.stringify(this.uniqueId))}message(t,r){if(t!==this.channelName)return;let n;try{n=JSON.parse(r)}catch(s){console.error(`invalid JSON on Redis pub/sub channel ${t}: ${r}`);return}let i=!this.pingsReceived.has(n);this.pingsReceived.set(n,Date.now()),i&&(this.ping(),this.ready&&this.updateQuota())}removeOutdatedClients(){let t=Date.now()-this.heartbeatInterval*3;[...this.pingsReceived].filter(([n,i])=>i<=t).forEach(([n,i])=>this.pingsReceived.delete(n))}updateQuota(){if(this.removeOutdatedClients(),!this.pingsReceived.size)return;let t=Object.assign({},this.channelQuota);t.rate=Math.floor(t.rate/this.pingsReceived.size),t.concurrency&&(t.concurrency=Math.floor(t.concurrency/this.pingsReceived.size)),this._quota=t}heartbeat(){this.ping(),this.ready&&this.updateQuota()}};a(kCt,"RedisQuotaManager");zj.RedisQuotaManager=kCt});var Otn=x(Ux=>{"use strict";Object.defineProperty(Ux,"__esModule",{value:!0});Ux.RateLimitTimeoutError=Ux.RedisQuotaManager=Ux.QuotaManager=Ux.pRateLimit=void 0;var Nao=Ntn();Object.defineProperty(Ux,"pRateLimit",{enumerable:!0,get:function(){return Nao.pRateLimit}});var Lao=VEe();Object.defineProperty(Ux,"QuotaManager",{enumerable:!0,get:function(){return Lao.QuotaManager}});var qao=qtn();Object.defineProperty(Ux,"RedisQuotaManager",{enumerable:!0,get:function(){return qao.RedisQuotaManager}});var Oao=xCt();Object.defineProperty(Ux,"RateLimitTimeoutError",{enumerable:!0,get:function(){return Oao.RateLimitTimeoutError}})});var Mtn,Ftn,ztn,DCt,n2,KEe=An(()=>{wb();pc();Mtn=ji(r9());au();Gv();Sot();pg();mb();Qo();Dq();Ftn=ji(Otn()),ztn=ji(yx());Tf();DCt=class{constructor(){this.cloudformationPrivateTypesInfo={availableCloudformationPrivateTypesFiles:{atlasMongo:{}},registeredCloudformationPrivateTypes:{}};this.init=async()=>{};this.loadPrivateTypesAndPackages=async()=>{this.stacktapeInfrastructureModuleTypes.forEach(t=>{this.checkCloudformationPrivateTypesController({infrastructureModuleType:t})}),await Promise.all([this.loadAvailableCloudformationPrivateTypePackages(),this.loadRegisteredCloudformationPrivateTypes()]),this.stacktapeInfrastructureModuleTypes.forEach(t=>{this.determineModulePrivateTypesStatus({infrastructureModuleType:t})})};this.loadAvailableCloudformationPrivateTypePackages=async()=>{let t=await bo.listAllObjectsInBucket(yn.cloudformationRegistryBucketName,this.privateTypePackagesS3Client),{availableCloudformationPrivateTypesFiles:r}=this.cloudformationPrivateTypesInfo;t.forEach(({Key:n})=>{let[i,s,o,c]=n.split("/");if(!c||o.length!==7||!/^\d+$/.test(o)||Number.isNaN(o))return;r[i]||(r[i]={});let l=r[i];l[s]||(l[s]={}),l[s][o]||(l[s][o]=[]),l[s][o].push({fileName:c})})};this.checkCloudformationPrivateTypesController=({infrastructureModuleType:t})=>{let{privateTypesMajorVersionUsed:r,privateTypesMinimalRequiredSubversion:n,privateTypesSpecs:i,type:s}=Ww[t];if(n.length!==7||Number.isNaN(Number(n)))throw new s_({customMessage:`Static check of privateTypesMinimalRequiredSubversion of module ${s} failed. "${n}" is not a valid value.`});let o=Object.keys(i).find(c=>!c.split("::")[1].endsWith(r));if(o)throw new s_({customMessage:`Static check of private type "${o}" in module ${s} failed. Private type name service name should end in privateTypesMajorVersionUsed (${r})`})};this.loadRegisteredCloudformationPrivateTypes=async()=>{this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes=await bo.listAllPrivateCloudformationResourceTypesWithVersions()};this.areMinimalRequirementsForModulePrivateTypesMet=({infrastructureModuleType:t})=>Object.entries(this.stacktapeInfrastructureModulesStatus[t].currentlyUsedPrivateCloudformationTypes).every(([r,{version:n}])=>!Number.isNaN(Number(n))&&Number(n)>=Number(Ww[t].privateTypesMinimalRequiredSubversion));this.isUpdateForModulePrivateTypesAvailable=({infrastructureModuleType:t})=>Object.entries(this.stacktapeInfrastructureModulesStatus[t].currentlyUsedPrivateCloudformationTypes).some(([r,{version:n}])=>Number(n)!==Number(this.stacktapeInfrastructureModulesStatus[t].newestCompatibleCloudformationPrivateTypeVersion));this.registerLatestCfPrivateTypes=async t=>{await this.loadPrivateTypesAndPackages(),t.map(n=>!this.areMinimalRequirementsForModulePrivateTypesMet({infrastructureModuleType:n})).some(Boolean)&&(await Ic.startEvent({eventType:"REGISTER_CF_PRIVATE_TYPES",description:"Registering new cloudformation private types"}),await Promise.all([t.map(n=>this.registerNewestAvailablePrivateTypes({infrastructureModuleType:n}))]),await Ic.finishEvent({eventType:"REGISTER_CF_PRIVATE_TYPES"}))};this.resolveRoleForPrivateType=async({infrastructureModuleType:t,privateTypeName:r,region:n})=>{let i=await bo.getFromBucket({bucketName:yn.cloudformationRegistryBucketName,injectedS3Client:this.privateTypePackagesS3Client,s3Key:this.buildNewestAvailableFileBucketKeyForPrivateType({infrastructureModuleType:t,privateTypeName:r,fileType:"roleDefinition"})}),s=h4(i).Resources.ExecutionRole.Properties,o=this.buildRoleNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix,region:n}),c=await bo.checkIfRoleExists({roleName:o});return c||(c=await bo.createIamRole({roleName:o,assumeRolePolicyDocument:s.AssumeRolePolicyDocument,description:`Role generated by Stacktape to be assumed by private CF type ${r}`,maxSessionDuration:s.MaxSessionDuration})),await bo.modifyInlinePoliciesForIamRole({roleName:o,desiredPolicies:s.Policies}),{roleArn:c.Arn}};this.buildNewestAvailableFileBucketKeyForPrivateType=({infrastructureModuleType:t,privateTypeName:r,fileType:n})=>{let i=n==="zipPackage"?this.buildZipPackageNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix}):this.buildRoleDefinitionFileNameFromPackagePrefix({packagePrefix:Ww[t].privateTypesSpecs[r].packagePrefix});return[t,Ww[t].privateTypesMajorVersionUsed,this.stacktapeInfrastructureModulesStatus[t].newestCompatibleCloudformationPrivateTypeVersion,i].join("/")};this.buildRoleNameFromPackagePrefix=({packagePrefix:t,region:r})=>`stp-${t}-${r}`;this.buildZipPackageNameFromPackagePrefix=({packagePrefix:t})=>`${t}.zip`;this.buildRoleDefinitionFileNameFromPackagePrefix=({packagePrefix:t})=>`${t}-role.yml`;this.determineModulePrivateTypesStatus=({infrastructureModuleType:t})=>{var h;let r={currentlyUsedPrivateCloudformationTypes:{},newestCompatibleCloudformationPrivateTypeVersion:JY,newestPrivateTypesSpecs:{}},{registeredCloudformationPrivateTypes:n,availableCloudformationPrivateTypesFiles:i}=this.cloudformationPrivateTypesInfo,{privateTypesMajorVersionUsed:s,privateTypesMinimalRequiredSubversion:o,privateTypesSpecs:c,type:l}=Ww[t],d=Object.keys(((h=i[l])==null?void 0:h[s])||{}).sort((w,b)=>Number(b)-Number(w)),f=Object.keys(c);f.forEach(w=>{r.currentlyUsedPrivateCloudformationTypes[w]={version:JY}}),Object.keys(n).filter(w=>f.includes(w)).forEach(w=>{let b=n[w].find(({IsDefaultVersion:E})=>E);r.currentlyUsedPrivateCloudformationTypes[w].version=(b==null?void 0:b.Description)||JY});let p=d.find(w=>{if(Number(w)<Number(o))throw new s_({customMessage:`No valid infrastructure private types for module ${l} ${s} satisfying minimal required subversion (${o}) that can be used with this Stacktape version could were found.`});let b=!0;return Object.values(c).forEach(({packagePrefix:E})=>{var A,T,R;((R=(T=(A=i[l])==null?void 0:A[s])==null?void 0:T[w])==null?void 0:R.some(({fileName:B})=>B===this.buildZipPackageNameFromPackagePrefix({packagePrefix:E})))||(b=!1)}),b});if(!p)throw new s_({customMessage:`No valid infrastructure private types for module ${l} ${s} satisfying minimal required subversion (${o}) that can be used with this Stacktape version were found.`});r.newestCompatibleCloudformationPrivateTypeVersion=p,Object.entries(c).forEach(([w,{packagePrefix:b}])=>{var E,A,T;r.newestPrivateTypesSpecs[w]={},((T=(A=(E=i[l])==null?void 0:E[s])==null?void 0:A[p])==null?void 0:T.some(({fileName:R})=>R===this.buildRoleDefinitionFileNameFromPackagePrefix({packagePrefix:b})))&&(r.newestPrivateTypesSpecs[w].hasRoleFileAvailable=!0)}),this.stacktapeInfrastructureModulesStatus=y(m({},this.stacktapeInfrastructureModulesStatus||{}),{[l]:r})};this.registerNewestAvailablePrivateTypes=async({infrastructureModuleType:t})=>{let r=(0,Ftn.pRateLimit)({interval:2e3,rate:1,concurrency:2,maxDelay:6e4});return Promise.all(Object.keys(Ww[t].privateTypesSpecs).map(async n=>{let i=yn.region,s;this.stacktapeInfrastructureModulesStatus[t].newestPrivateTypesSpecs[n].hasRoleFileAvailable&&({roleArn:s}=await this.resolveRoleForPrivateType({infrastructureModuleType:t,privateTypeName:n,region:i})),await Lv(Math.random()*500);let o=await bo.registerPrivateCloudformationResourceType({schemaHandlerPackageS3Url:`s3://${yn.cloudformationRegistryBucketName}/${this.buildNewestAvailableFileBucketKeyForPrivateType({infrastructureModuleType:t,privateTypeName:n,fileType:"zipPackage"})}`,typeName:n,executionRoleArn:s,rateLimiter:r});await bo.setPrivateCloudformationResourceTypeAsDefault({typeVersionArn:o,rateLimiter:r}),await Lv(300),this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes[n]&&await Promise.all(this.cloudformationPrivateTypesInfo.registeredCloudformationPrivateTypes[n].map(async({Arn:c})=>bo.deregisterPrivateCloudformationType({typeVersionArn:c,rateLimiter:r})))}))}}get privateTypePackagesS3Client(){let t=new Mtn.S3Client({region:yn.cloudformationRegistryBucketRegion,credentials:yn.credentials});return t.middlewareStack.use(Yy),t.middlewareStack.use(Bv),t}get stacktapeInfrastructureModuleTypes(){return Object.keys(Ww)}};a(DCt,"CloudformationRegistryManager");n2=(0,ztn.default)(sh,oh)(new DCt)});var jtn,xV,TCt,JEe,RCt=An(()=>{wb();xc();dl();Gv();mb();kH();jtn=ji(yx()),TCt=class{constructor(){this.init=async()=>{};this.invalidateCaches=async()=>{await Ic.startEvent({eventType:"INVALIDATE_CACHE",description:"Invalidating CDN caches"});let t=await bo.getStackResources(qn.stackName),r=await Promise.all(qn.allResourcesWithCdnsToInvalidate.map(n=>{var i;if(!((i=n.cdn.domainNames)==null?void 0:i.length)){let s=t.find(({LogicalResourceId:o})=>o===nr.cloudfrontDistribution(n.name,0)).PhysicalResourceId;return[Vw(this,xV).call(this,{distributionId:s,paths:["/*"]})]}return Object.values(MI(n)).map((s,o)=>{let c=t.find(({LogicalResourceId:l})=>l===nr.cloudfrontDistribution(n.name,o)).PhysicalResourceId;return Vw(this,xV).call(this,{distributionId:c,paths:["/*"]})})}).flat());await Ic.finishEvent({eventType:"INVALIDATE_CACHE",data:{invalidatedDistributionIds:r}})};MT(this,xV,a(async({distributionId:t,paths:r})=>bo.invalidateCloudfront({distributionId:t,invalidatePaths:r}),"#invalidateCache"))}};a(TCt,"CloudfrontManager"),xV=new WeakMap;JEe=(0,jtn.default)(sh,oh)(new TCt)});var Gx,jj=An(()=>{KEe();RCt();xc();xC();_D();hq();yh();Lf();gu();Gx=a(async({commandModifiesStack:e,commandRequiresDeployedStack:t})=>(await qn.init(),await rs.init({stackName:qn.stackName,commandModifiesStack:e,commandRequiresDeployedStack:t}),Promise.all([_n.init(),tu.init(),Cg.init({domains:qn.allUsedDomainsInConfig}),JEe.init(),sd.init({accountId:rs.accountId,globallyUniqueStackHash:rs.globallyUniqueStackHash,stackActionType:rs.stackActionType}),a0.init(),n2.init()])),"initializeAllStackServices")});var Utn={};Hf(Utn,{executor:()=>Mao});var Btn,Mao,Gtn=An(()=>{jj();pc();gu();Dq();Btn=ji(Op()),Mao=a(async()=>{await Gx({}),await _n.resolveAllResources();let e=yn.args.templatePath||"compiled-template.yaml";await Btn.default.writeFile(e,ZE(_n.getTemplate()))},"executor")});var Htn=x((HQc,$tn)=>{"use strict";var Fao=a((e,t,r)=>{let n=e.indexOf(t);if(n===-1)return e;let i=t.length,s=0,o="";do o+=e.substr(s,n-s)+t+r,s=n+i,n=e.indexOf(t,s);while(n!==-1);return o+=e.substr(s),o},"stringReplaceAll"),zao=a((e,t,r,n)=>{let i=0,s="";do{let o=e[n-1]==="\r";s+=e.substr(i,(o?n-1:n)-i)+t+(o?`\r
3547
3547
  `:`
3548
3548
  `)+r,i=n+1,n=e.indexOf(`
3549
3549
  `,i)}while(n!==-1);return s+=e.substr(i),s},"stringEncaseCRLFWithFirstIndex");$tn.exports={stringReplaceAll:Fao,stringEncaseCRLFWithFirstIndex:zao}});var Jtn=x((VQc,Ktn)=>{"use strict";var jao=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,Vtn=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Bao=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Uao=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Gao=new Map([["n",`