varGC=Object.create;varzr=Object.defineProperty;varVC=Object.getOwnPropertyDescriptor;varKC=Object.getOwnPropertyNames;varJC=Object.getPrototypeOf,YC=Object.prototype.hasOwnProperty;varXC=(t,e,n)=>eint?zr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;varH=(t=>typeofrequire<"u"?require:typeofProxy<"u"?newProxy(t,{get:(e,n)=>(typeofrequire<"u"?require:e)[n]}):t)(function(t){if(typeofrequire<"u")returnrequire.apply(this,arguments);throwError('Dynamic require of "'+t+'" is not supported')});vario=(t,e)=>()=>(t&&(e=t(t=0)),e);varR=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tc=(t,e)=>{for(varnine)zr(t,n,{get:e[n],enumerable:!0});},rm=(t,e,n,i)=>{if(e&&typeofe=="object"||typeofe=="function")for(letsofKC(e))!YC.call(t,s)&&s!==n&&zr(t,s,{get:()=>e[s],enumerable:!(i=VC(e,s))||i.enumerable});returnt};varvn=(t,e,n)=>(n=t!=null?GC(JC(t)):{},rm(e||!t||!t.__esModule?zr(n,"default",{value:t,enumerable:!0}):n,t)),Oc=t=>rm(zr({},"__esModule",{value:!0}),t);varle=(t,e,n)=>(XC(t,typeofe!="symbol"?e+"":e,n),n),kc=(t,e,n)=>{if(!e.has(t))throwTypeError("Cannot "+n)};varw=(t,e,n)=>(kc(t,e,"read from private field"),n?n.call(t):e.get(t)),ce=(t,e,n)=>{if(e.has(t))throwTypeError("Cannot add the same private member more than once");einstanceofWeakSet?e.add(t):e.set(t,n);},ie=(t,e,n,i)=>(kc(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n);varro=(t,e,n,i)=>({set_(s){ie(t,e,s,n);},get_(){returnw(t,e,i)}}),oe=(t,e,n)=>(kc(t,e,"access private method"),n);varFc=R((rz,am)=>{varom=Object.prototype.toString;am.exports=function(e){varn=om.call(e),i=n==="[object Arguments]";returni||(i=n!=="[object Array]"&&e!==null&&typeofe=="object"&&typeofe.length=="number"&&e.length>=0&&om.call(e.callee)==="[object Function]"),i};});vargm=R((sz,hm)=>{varmm;Object.keys||(Hr=Object.prototype.hasOwnProperty,Lc=Object.prototype.toString,cm=Fc(),qc=Object.prototype.propertyIsEnumerable,lm=!qc.call({toString:null},"toString"),um=qc.call(function(){},"prototype"),Wr=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ao=function(t){vare=t.constructor;returne&&e.prototype===t},pm={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},fm=function(){if(typeofwindow>"u")return!1;for(vartinwindow)try{if(!pm["$"+t]&&Hr.call(window,t)&&window[t]!==null&&typeofwindow[t]=="object")try{ao(window[t]);}catch{return!0}}catch{return!0}return!1}(),dm=function(t){if(typeofwindow>"u"||!fm)returnao(t);try{returnao(t)}catch{return!1}},mm=function(e){varn=e!==null&&typeofe=="object",i=Lc.call(e)==="[object Function]",s=cm(e),r=n&&Lc.call(e)==="[object String]",o=[];if(!n&&!i&&!s)thrownewTypeError("Object.keys called on a non-object");vara=um&&i;if(r&&e.length>0&&!Hr.call(e,0))for(varu=0;u<e.length;++u)o.push(String(u));if(s&&e.length>0)for(varf=0;f<e.length;++f)o.push(String(f));elsefor(varcine)!(a&&c==="prototype")&&Hr.call(e,c)&&o.push(String(c));if(lm)for(vard=dm(e),g=0;g<Wr.length;++g)!(d&&Wr[g]==="constructor")&&Hr.call(e,Wr[g])&&o.push(Wr[g]);returno});varHr,Lc,cm,qc,lm,um,Wr,ao,pm,fm,dm;hm.exports=mm;});varlo=R((oz,vm)=>{vart1=Array.prototype.slice,n1=Fc(),ym=Object.keys,co=ym?function(e){returnym(e)}:gm(),xm=Object.keys;co.shim=function(){if(Object.keys){vare=function(){varn=Object.keys(arguments);returnn&&n.length===arguments.length}(1,2);e||(Object.keys=function(i){returnn1(i)?xm(t1.call(i)):xm(i)});}elseObject.keys=co;returnObject.keys||co};vm.exports=co;});varuo=R((az,bm)=>{bm.exports=function(){if(typeofSymbol!="function"||typeofObject.getOwnPropertySymbols!="function")return!1;if(typeofSymbol.iterator=="symbol")return!0;vare={},n=Symbol("test"),i=Object(n);if(typeofn=="string"||Object.prototype.toStr
`).map(e=>e.trim()).join(" ")};vv.O=function(t){return this.inspectOpts.colors=this.useColors,Yo.inspect(t,this.inspectOpts)};});var wv=R((jH,fu)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?fu.exports=mv():fu.exports=bv();});var Ev=R((NH,Sv)=>{var os;Sv.exports=function(){if(!os){try{os=wv()("follow-redirects");}catch{}typeof os!="function"&&(os=function(){});}os.apply(null,arguments);};});var Pv=R((UH,yu)=>{var hi=H("url"),du=hi.URL,JI=H("http"),YI=H("https"),Rv=H("stream").Writable,Cv=H("assert"),Tv=Ev(),hu=["abort","aborted","connect","error","socket","timeout"],gu=Object.create(null);hu.forEach(function(t){gu[t]=function(e,n,i){this._redirectable.emit(t,e,n,i);};});var XI=cs("ERR_INVALID_URL","Invalid URL",TypeError),Av=cs("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),QI=cs("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),ZI=cs("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),eF=cs("ERR_STREAM_WRITE_AFTER_END","write after end");function Ct(t,e){Rv.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var n=this;this._onNativeResponse=function(i){n._processResponse(i);},this._performRequest();}Ct.prototype=Object.create(Rv.prototype);Ct.prototype.abort=function(){kv(this._currentRequest),this.emit("abort");};Ct.prototype.write=function(t,e,n){if(this._ending)throw new eF;if(!gi(t)&&!iF(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(as(e)&&(n=e,e=null),t.length===0){n&&n();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,n)):(this.emit("error",new ZI),this.abort());};Ct.prototype.end=function(t,e,n){if(as(t)?(n=t,t=e=null):as(e)&&(n=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,n);else {var i=this,s=this._currentRequest;this.write(t,e,function(){i._ended=!0,s.end(null,null,n);}),this._ending=!0;}};Ct.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e);};Ct.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t);};Ct.prototype.setTimeout=function(t,e){var n=this;function i(o){o.setTimeout(t),o.removeListener("timeout",o.destroy),o.addListener("timeout",o.destroy);}function s(o){n._timeout&&clearTimeout(n._timeout),n._timeout=setTimeout(function(){n.emit("timeout"),r();},t),i(o);}function r(){n._timeout&&(clearTimeout(n._timeout),n._timeout=null),n.removeListener("abort",r),n.removeListener("error",r),n.removeListener("response",r),e&&n.removeListener("timeout",e),n.socket||n._currentRequest.removeListener("socket",s);}return e&&this.on("timeout",e),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",i),this.on("abort",r),this.on("error",r),this.on("response",r),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){Ct.prototype[t]=function(e,n){return this._currentRequest[t](e,n)};});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(Ct.prototype,t,{get:function(){return this._currentRequest[t]}});});Ct.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e));}};Ct.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e){this.emit("error",new TypeError("Unsupported protocol "+t));return}if(this._options.agents){var n=t.slice(0,-1);this._options.agent=this._options.agents[n];}var i=this._currentRequest=e.request(this._options,this._onNativeResponse);i._redirectable=this;for(var s of hu)i.on(s,gu[s]);if(this._currentUrl=/^\//.test(this._options.path)?hi.
`),re=GB.bind(null,{[rE]:"",[sE]:o,[aE]:T,[oE]:Up,[Mp]:B,[cE]:$}),k="";d!==null&&(g===void 0?k=re(d):k=re(Object.assign({},d,{name:g})));let I=a instanceof Function?a:a?dE:fj,U=I().indexOf(":")+1;if(_&&!y)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(b&&typeof b!="function")throw Error(`Unknownmixintype"${typeof b}"-expected"function"`);if(W&&typeof W!="string")throw Error(`UnknownmsgPrefixtype"${typeof W}"-expected"string"`);MB(h,y,_);let z=fE(y,_);return Object.assign(e,{levels:z,[aj]:_,[ZB]:i,[XB]:I,[QB]:U,[oE]:Up,[Mp]:B,[aE]:T,[tj]:Z,[nj]:Y,[ij]:u,[rj]:f,[sj]:c,[lj]:c?`,${JSON.stringify(c)}:{`:"",[sE]:o,[oj]:b,[uj]:A,[rE]:k,[cE]:$,[cj]:C,silent:KB,onChild:J,[pj]:W}),Object.setPrototypeOf(e,NB()),zB(e),e[ej](h),e}jt.exports=zp;jt.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=iE(t.dest||process.stdout.fd),nE(t)):nE({dest:iE(t),minLength:0});jt.exports.transport=Cp();jt.exports.multistream=tE();jt.exports.levels=fE();jt.exports.stdSerializers=xj;jt.exports.stdTimeFunctions=Object.assign({},uE);jt.exports.symbols=pE;jt.exports.version=JB;jt.exports.default=zp;jt.exports.pino=zp;});var wE={};Tc(wE,{RotatingFileStream:()=>ja,RotatingFileStreamError:()=>Ts,createStream:()=>Dj});async function gE(t){return new Promise(e=>fs$1.access(t,fs$1.constants.F_OK,n=>e(!n)))}function yE(t){return (e,n,i)=>{let s=parseInt(i,10);if(e!=="number"||s!==i||s<=0)throw new Error(`'${t}'optionmustbeapositiveintegernumber`)}}function Wp(t,e){return (n,i,s)=>{if(n!=="string")throw new Error(`Don't know how to handle 'options.${t}' type: ${n}`);i[t]=e(s);}}function bE(t,e,n){let i={};if(i.num=parseInt(t,10),isNaN(i.num))throw new Error(`Unknown 'options.${e}' format: ${t}`);if(i.num<=0)throw new Error(`A positive integer number is expected for 'options.${e}'`);if(i.unit=t.replace(/^[ 0]*/g,"").substr((i.num+"").length,1),i.unit.length===0)throw new Error(`Missing unit for 'options.${e}'`);if(!n[i.unit])throw new Error(`Unknown 'options.${e}' unit: ${i.unit}`);return i}function Gp(t,e,n){if(parseInt(n/t.num,10)*t.num!==n)throw new Error(`An integer divider of ${n} is expected as ${e} for 'options.interval'`)}function Ij(t){let e=bE(t,"interval",Pj);switch(e.unit){case"h":Gp(e,"hours",24);break;case"m":Gp(e,"minutes",60);break;case"s":Gp(e,"seconds",60);break}return e}function xE(t){let e=bE(t,"size",Fj);return e.unit==="K"?e.num*1024:e.unit==="M"?e.num*1048576:e.unit==="G"?e.num*1073741824:e.num}function Lj(t){let e={};for(let n in t){let i=t[n],s=typeof i;if(!(n in vE))throw new Error(`Unknownoption:${n}`);e[n]=t[n],vE[n](s,e,i);}return e.path||(e.path=""),e.interval||(delete e.immutable,delete e.initialRotation,delete e.intervalBoundary),e.rotate&&(delete e.history,delete e.immutable,delete e.maxFiles,delete e.maxSize,delete e.intervalBoundary),e.immutable&&delete e.compress,e.intervalBoundary||delete e.initialRotation,e}function qj(t,e,n){return i=>i?`${t}.${i}${e&&!n?".gz":""}`:t}function $j(t,e,n){let i=s=>(s>9?"":"0")+s;return (s,r)=>{if(!s)return t;let o=s.getFullYear()+""+i(s.getMonth()+1),a=i(s.getDate()),u=i(s.getHours()),f=i(s.getMinutes());return o+a+"-"+u+f+"-"+i(r)+"-"+t+(e&&!n?".gz":"")}}function Dj(t,e){if(typeof e>"u")e={};else if(typeof e!="object")throw new Error(`The"options"argumentmustbeoftypeobject.Receivedtype${typeofe}`);let n=Lj(e),{compress:i,omitExtension:s}=n,r;if(typeof t=="string")r=e.rotate?qj(t,i!==void 0,s):$j(t,i!==void 0,s);else if(typeof t=="function")r=t;else throw new Error(`The"filename"argumentmustbeoneoftypestringorfunction.Receivedtype${typeoft}`);return new ja(r,n)}var Ts,ja,Pj,Fj,vE,SE=io(()=>{Ts=class extends Error{constructor(){super("Too many destination file attempts");le(this,"code","RFS-TOO-MANY");}},ja=class extends or.Writable{constructor(n,i){let{encoding:s,history:r,maxFiles:o,maxSize:a,path:u}=i;super({decodeStrings:!0,defaultEncoding:s});le(this,"createGzip");le(this,"exec");le(this,"file");le(this,"filename");le(this,"finished");le(this,"fsCreateReadStream");le(this,"fsCreateWriteStream");
`,"utf-8"),this.emit("history");}async immutate(n){let{size:i}=this.options,s=this.now();for(let r=1;r<1e3;++r){let o=0,a;this.filename=this.options.path+this.generator(s,r);try{a=await this.fsStat(this.filename);}catch(u){if(u.code!=="ENOENT")throw u}if(a){if(o=a.size,!a.isFile())throw new Error(`Can't write on: '${this.filename}' (it is not a file)`);if(i&&o>=i)continue}if(n)return this.last=this.filename,this.reopen(o);await this.rotated(this.last),this.last=this.filename;return}throw new Ts}async unlink(n){try{await this.fsUnlink(n);}catch(i){if(i.code!=="ENOENT")throw i;this.emit("warning",i);}}};Pj={M:!0,d:!0,h:!0,m:!0,s:!0};Fj={B:!0,G:!0,K:!0,M:!0};vE={encoding:(t,e,n)=>new vF.TextDecoder(n),immutable:()=>{},initialRotation:()=>{},interval:Wp("interval",Ij),intervalBoundary:()=>{},maxFiles:yE("maxFiles"),maxSize:Wp("maxSize",xE),mode:()=>{},omitExtension:()=>{},rotate:yE("rotate"),size:Wp("size",xE),teeToStdout:()=>{},compress:(t,e,n)=>{if(!n)throw new Error("A value for 'options.compress' must be specified");if(t==="boolean")return e.compress=(i,s)=>`cat ${i} | gzip -c9 > ${s}`;if(t!=="function"){if(t!=="string")throw new Error(`Don'tknowhowtohandle'options.compress'type:${t}`);if(n!=="gzip")throw new Error(`Don't know how to handle compression method: ${n}`)}},history:t=>{if(t!=="string")throw new Error(`Don'tknowhowtohandle'options.history'type:${t}`)},path:(t,e,n)=>{if(t!=="string")throw new Error(`Don't know how to handle 'options.path' type: ${t}`);n[n.length-1]!==path.sep&&(e.path=n+path.sep);}};});var _E={};Tc(_E,{allLoggers:()=>Os,rootLogger:()=>$e});var Vp,EE,$e,Os,pn=io(()=>{Vp=vn(mE());xs();EE=(SE(),Oc(wE)).createStream("tabby-agent.log",{path:H("path").join(H("os").homedir(),".tabby","agent","logs"),size:"10M",interval:"1d"}),$e=EE?(0, Vp.default)(EE):(0, Vp.default)();Os=[$e];$e.onChild=t=>{Os.push(t);};});var CE=R((kG,RE)=>{RE.exports=function(){function t(i,s){function r(){this.constructor=i;}r.prototype=s.prototype,i.prototype=new r;}function e(i,s,r,o,a,u){this.message=i,this.expected=s,this.found=r,this.offset=o,this.line=a,this.column=u,this.name="SyntaxError";}t(e,Error);function n(i){var s=arguments.length>1?arguments[1]:{},r={},o={start:Dd},a=Dd,f=function(){return nm},c=r,d="#",g={type:"literal",value:"#",description:'"#"'},h=void 0,y={type:"any",description:"any character"},b="[",A={type:"literal",value:"[",description:'"["'},_="]",S={type:"literal",value:"]",description:'"]"'},C=function(l){Rc(Qe("ObjectPath",l,Ye,Xe));},F=function(l){Rc(Qe("ArrayPath",l,Ye,Xe));},q=function(l,m){return l.concat(m)},J=function(l){return [l]},W=function(l){return l},B=".",$={type:"literal",value:".",description:'"."'},G="=",T={type:"literal",value:"=",description:'"="'},Y=function(l,m){Rc(Qe("Assign",m,Ye,Xe,l));},Z=function(l){return l.join("")},re=function(l){return l.value},k='"""',I={type:"literal",value:'"""',description:'"\\"\\"\\""'},U=null,z=function(l){return Qe("String",l.join(""),Ye,Xe)},ae='"',De={type:"literal",value:'"',description:'"\\""'},he="'''",St={type:"literal",value:"'''",description:`"'''"`},oi="'",at={type:"literal",value:"'",description:`"'"`},ke=function(l){return l},pe=function(l){return l},nn="\\",Be={type:"literal",value:"\\",description:'"\\\\"'},Q=function(){return ""},we="e",K={type:"literal",value:"e",description:'"e"'},de="E",Ee={type:"literal",value:"E",description:'"E"'},Je=function(l,m){return Qe("Float",parseFloat(l+"e"+m),Ye,Xe)},Pe=function(l){return Qe("Float",parseFloat(l),Ye,Xe)},ai="+",Fn={type:"literal",value:"+",description:'"+"'},md=function(l){return l.join("")},$r="-",Dr={type:"literal",value:"-",description:'"-"'},hd=function(l){return "-"+l.join("")},kR=function(l){return Qe("Integer",parseInt(l,10),Ye,Xe)},gd="true",PR={type:"literal",value:"true",description:'"true"'},IR=function(){return Qe("Boolean",!0,Ye,Xe)},yd="false",FR={type:"literal",value:"false",description:'"false"'},LR=function(){returnQe("Boolean",!1,Ye,Xe)},qR=function(){returnQe("Array",[],Ye,Xe)},$R=function(l){returnQe("Array",l?[l]:[],Ye,Xe)},DR=function(l){returnQe("
`},Id="\\f",bC={type:"literal",value:"\\f",description:'"\\\\f"'},wC=function(){return "\f"},Fd="\\r",SC={type:"literal",value:"\\r",description:'"\\\\r"'},EC=function(){return "\r"},Ld="\\U",AC={type:"literal",value:"\\U",description:'"\\\\U"'},qd=function(l){return HC(l.join(""))},$d="\\u",_C={type:"literal",value:"\\u",description:'"\\\\u"'},p=0,ee=0,Nr=0,bc={line:1,column:1,seenCR:!1},Qs=0,wc=[],N=0,M={},Zs;if("startRule"in s){if(!(s.startRule in o))throw new Error(`Can't start parsing from rule "`+s.startRule+'".');a=o[s.startRule];}functionYe(){returnSc(ee).line}functionXe(){returnSc(ee).column}functionSc(l){functionm(x,v,E){varP,D;for(P=v;P<E;P++)D=i.charAt(P),D===`
`)},_domwindow:function(){return i("domwindow")},_bigint:function(s){return i("bigint:"+s.toString())},_process:function(){return i("process")},_timer:function(){return i("timer")},_pipe:function(){return i("pipe")},_tcp:function(){return i("tcp")},_udp:function(){return i("udp")},_tty:function(){return i("tty")},_statwatcher:function(){return i("statwatcher")},_securecontext:function(){return i("securecontext")},_connection:function(){return i("connection")},_zlib:function(){return i("zlib")},_context:function(){return i("context")},_nodescript:function(){return i("nodescript")},_httpparser:function(){return i("httpparser")},_dataview:function(){return i("dataview")},_signal:function(){return i("signal")},_fsevent:function(){return i("fsevent")},_tlswrap:function(){return i("tlswrap")}}}function B_(){return {buf:"",write:function(t){this.buf+=t;},end:function(t){this.buf+=t;},read:function(){return this.buf}}}});var M_=R((m5,U_)=>{U_.exports={STRING:2,BOOLEAN:4,BYTES:4,NUMBER:8,Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};});var W_=R(pc=>{pc.byteLength=ZU;pc.toByteArray=tM;pc.fromByteArray=rM;var yn=[],Ut=[],QU=typeof Uint8Array<"u"?Uint8Array:Array,td="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($i=0,z_=td.length;$i<z_;++$i)yn[$i]=td[$i],Ut[td.charCodeAt($i)]=$i;var $i,z_;Ut["-".charCodeAt(0)]=62;Ut["_".charCodeAt(0)]=63;function H_(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var i=n===e?0:4-n%4;return [n,i]}function ZU(t){var e=H_(t),n=e[0],i=e[1];return (n+i)*3/4-i}function eM(t,e,n){return (e+n)*3/4-n}function tM(t){var e,n=H_(t),i=n[0],s=n[1],r=new QU(eM(t,i,s)),o=0,a=s>0?i-4:i,u;for(u=0;u<a;u+=4)e=Ut[t.charCodeAt(u)]<<18|Ut[t.charCodeAt(u+1)]<<12|Ut[t.charCodeAt(u+2)]<<6|Ut[t.charCodeAt(u+3)],r[o++]=e>>16&255,r[o++]=e>>8&255,r[o++]=e&255;return s===2&&(e=Ut[t.charCodeAt(u)]<<2|Ut[t.charCodeAt(u+1)]>>4,r[o++]=e&255),s===1&&(e=Ut[t.charCodeAt(u)]<<10|Ut[t.charCodeAt(u+1)]<<4|Ut[t.charCodeAt(u+2)]>>2,r[o++]=e>>8&255,r[o++]=e&255),r}function nM(t){return yn[t>>18&63]+yn[t>>12&63]+yn[t>>6&63]+yn[t&63]}function iM(t,e,n){for(var i,s=[],r=e;r<n;r+=3)i=(t[r]<<16&16711680)+(t[r+1]<<8&65280)+(t[r+2]&255),s.push(nM(i));return s.join("")}function rM(t){for(var e,n=t.length,i=n%3,s=[],r=16383,o=0,a=n-i;o<a;o+=r)s.push(iM(t,o,o+r>a?a:o+r));return i===1?(e=t[n-1],s.push(yn[e>>2]+yn[e<<4&63]+"==")):i===2&&(e=(t[n-2]<<8)+t[n-1],s.push(yn[e>>10]+yn[e>>4&63]+yn[e<<2&63]+"=")),s.join("")}});var G_=R(nd=>{nd.read=function(t,e,n,i,s){var r,o,a=s*8-i-1,u=(1<<a)-1,f=u>>1,c=-7,d=n?s-1:0,g=n?-1:1,h=t[e+d];for(d+=g,r=h&(1<<-c)-1,h>>=-c,c+=a;c>0;r=r*256+t[e+d],d+=g,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=o*256+t[e+d],d+=g,c-=8);if(r===0)r=1-f;else {if(r===u)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,i),r=r-f;}return (h?-1:1)*o*Math.pow(2,r-i)};nd.write=function(t,e,n,i,s,r){var o,a,u,f=r*8-s-1,c=(1<<f)-1,d=c>>1,g=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:r-1,y=i?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+d>=1?e+=g/u:e+=g*Math.pow(2,1-d),e*u>=2&&(o++,u/=2),o+d>=c?(a=0,o=c):o+d>=1?(a=(e*u-1)*Math.pow(2,s),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;t[n+h]=a&255,h+=y,a/=256,s-=8);for(o=o<<s|a,f+=s;f>0;t[n+h]=o&255,h+=y,o/=256,f-=8);t[n+h-y]|=b*128;};});var lR=R(qr=>{var id=W_(),Fr=G_(),V_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;qr.Buffer=L;qr.SlowBuffer=uM;qr.INSPECT_MAX_BYTES=50;var fc=2147483647;qr.kMaxLength=fc;L.TYPED_ARRAY_SUPPORT=sM();!L.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function sM(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.set
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),i=o.substring(s+1).trim(),!(!n||e[n]&&gI[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i);}),e};var av=Symbol("internals");function is(t){return t&&String(t).trim().toLowerCase()}function Vo(t){return t===!1||t==null?t:O.isArray(t)?t.map(Vo):String(t)}function yI(t){let e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}var xI=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());functionau(t,e,n,i,s){if(O.isFunction(i))returni.call(this,e,n);if(s&&(e=n),!!O.isString(e)){if(O.isString(i))returne.indexOf(i)!==-1;if(O.isRegExp(i))returni.test(e)}}functionvI(t){returnt.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}functionbI(t,e){letn=O.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(s,r,o){returnthis[i].call(this,e,s,r,o)},configurable:!0});});}varer=class{constructor(e){e&&this.set(e);}set(e,n,i){lets=this;functionr(a,u,f){letc=is(u);if(!c)thrownewError("header name must be a non-empty string");letd=O.findKey(s,c);(!d||s[d]===void0||f===!0||f===void0&&s[d]!==!1)&&(s[d||u]=Vo(a));}leto=(a,u)=>O.forEach(a,(f,c)=>r(f,c,u));returnO.isPlainObject(e)||einstanceofthis.constructor?o(e,n):O.isString(e)&&(e=e.trim())&&!xI(e)?o(ov(e),n):e!=null&&r(n,e,i),this}get(e,n){if(e=is(e),e){leti=O.findKey(this,e);if(i){lets=this[i];if(!n)returns;if(n===!0)returnyI(s);if(O.isFunction(n))returnn.call(this,s,i);if(O.isRegExp(n))returnn.exec(s);thrownewTypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=is(e),e){leti=O.findKey(this,e);return!!(i&&this[i]!==void0&&(!n||au(this,this[i],i,n)))}return!1}delete(e,n){leti=this,s=!1;functionr(o){if(o=is(o),o){leta=O.findKey(i,o);a&&(!n||au(i,i[a],a,n))&&(deletei[a],s=!0);}}returnO.isArray(e)?e.forEach(r):r(e),s}clear(e){letn=Object.keys(this),i=n.length,s=!1;for(;i--;){letr=n[i];(!e||au(this,this[r],r,e,!0))&&(deletethis[r],s=!0);}returns}normalize(e){letn=this,i={};returnO.forEach(this,(s,r)=>{leto=O.findKey(i,r);if(o){n[o]=Vo(s),deleten[r];return}leta=e?vI(r):String(r).trim();a!==r&&deleten[r],n[a]=Vo(s),i[a]=!0;}),this}concat(...e){returnthis.constructor.concat(this,...e)}toJSON(e){letn=Object.create(null);returnO.forEach(this,(i,s)=>{i!=null&&i!==!1&&(n[s]=e&&O.isArray(i)?i.join(", "):i);}),n}[Symbol.iterator](){returnObject.entries(this.toJSON())[Symbol.iterator]()}toString(){returnObject.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)?this.buffer="":this.buffer=i.pop();for(let s of i){let r=null;try{r=JSON.parse(s);}catch(o){this.logger.error({error:o},`Failedtoparserequest:${s}`);continue}this.logger.debug({request:r},"Received request"),this.handleRequest(r).then(o=>{this.sendResponse(o),this.logger.debug({response:o},"Sent response");});}}}async handleRequest(e){let n=[0,null];try{if(!this.agent)throw new Error(`Agentnotbound.
`);n[0]=e[0];let i=e[1].func;if(i==="cancelRequest")n[1]=this.cancelRequest(e);else {let s=this.agent[i];if(!s)throw new Error(`Unknownfunction:${i}`);let r=s.apply(this.agent,e[1].args);typeof r=="object"&&typeof r.then=="function"?(this.ongoingRequests[e[0]]=r,n[1]=await r,delete this.ongoingRequests[e[0]]):n[1]=r;}}catch(i){this.logger.error({error:i,request:e},"Failed to handle request");}finally{return n}}cancelRequest(e){let n=this.ongoingRequests[e[1].args[0]];return n?(n instanceof tt&&n.cancel(),delete this.ongoingRequests[e[1].args[0]],!0):!1}sendResponse(e){this.outStream.write(JSON.stringify(e)+`
`);}bind(e){this.agent=e;for(let n of TR)this.agent.on(n,i=>{this.sendResponse([0,i]);});}listen(){this.inStream.on("data",this.handleInput.bind(this));}};var OR=new vc;xc.create().then(t=>{OR.bind(t),OR.listen();});