varqy=Object.create;varso=Object.defineProperty;varLy=Object.getOwnPropertyDescriptor;varNy=Object.getOwnPropertyNames;varUy=Object.getPrototypeOf,zy=Object.prototype.hasOwnProperty;varDy=(t,e,i)=>eint?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;varv=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var$y=(t,e,i,n)=>{if(e&&typeofe=="object"||typeofe=="function")for(letrofNy(e))!zy.call(t,r)&&r!==i&&so(t,r,{get:()=>e[r],enumerable:!(n=Ly(e,r))||n.enumerable});returnt};varV=(t,e,i)=>(i=t!=null?qy(Uy(t)):{},$y(e||!t||!t.__esModule?so(i,"default",{value:t,enumerable:!0}):i,t));varP=(t,e,i)=>(Dy(t,typeofe!="symbol"?e+"":e,i),i),co=(t,e,i)=>{if(!e.has(t))throwTypeError("Cannot "+i)};varf=(t,e,i)=>(co(t,e,"read from private field"),i?i.call(t):e.get(t)),F=(t,e,i)=>{if(e.has(t))throwTypeError("Cannot add the same private member more than once");einstanceofWeakSet?e.add(t):e.set(t,i)},C=(t,e,i,n)=>(co(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),_n=(t,e,i,n)=>({set_(r){C(t,e,r,i)},get_(){returnf(t,e,n)}}),T=(t,e,i)=>(co(t,e,"access private method"),i);varFc=v((DR,jc)=>{varBc=require("stream").Stream,Eg=require("util");jc.exports=je;functionje(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}Eg.inherits(je,Bc);je.create=function(t,e){vari=newthis;e=e||{};for(varnine)i[n]=e[n];i.source=t;varr=t.emit;returnt.emit=function(){returni._handleEmit(arguments),r.apply(t,arguments)},t.on("error",function(){}),i.pauseStream&&t.pause(),i};Object.defineProperty(je.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){returnthis.source.readable}});je.prototype.setEncoding=function(){returnthis.source.setEncoding.apply(this.source,arguments)};je.prototype.resume=function(){this._released||this.release(),this.source.resume()};je.prototype.pause=function(){this.source.pause()};je.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(t){this.emit.apply(this,t)}.bind(this)),this._bufferedEvents=[]};je.prototype.pipe=function(){vart=Bc.prototype.pipe.apply(this,arguments);returnthis.resume(),t};je.prototype._handleEmit=function(t){if(this._released){this.emit.apply(this,t);return}t[0]==="data"&&(this.dataSize+=t[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(t)};je.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;vart="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",newError(t))}}});varLc=v(($R,qc)=>{varAg=require("util"),Ic=require("stream").Stream,Pc=Fc();qc.exports=Y;functionY(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}Ag.inherits(Y,Ic);Y.create=function(t){vare=newthis;t=t||{};for(variint)e[i]=t[i];returne};Y.isStreamLike=function(t){returntypeoft!="function"&&typeoft!="string"&&typeoft!="boolean"&&typeoft!="number"&&!Buffer.isBuffer(t)};Y.prototype.append=function(t){vare=Y.isStreamLike(t);if(e){if(!(tinstanceofPc)){vari=Pc.create(t,{maxDataSize:1/0,pauseStream:this.pauseStreams});t.on("data",this._checkDataSize.bind(this)),t=i}this._handleErrors(t),this.pauseStreams&&t.pause()}returnthis._streams.push(t),this};Y.prototype.pipe=function(t,e){returnIc.prototype.pipe.call(this,t,e),this.resume(),t};Y.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{dothis._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};Y.prototype._realGetNext=function(){vart=this._streams.shift();if(typeoft>"u"){this.end();return}if(typeoft!="function"){this._pipeNext(t);return}vare=t;e(function(i){varn=Y.isStreamLike(i);n&&(i.on("data",this._checkDataSize.bind(this)),this._handleErrors(i)),
`;z.DEFAULT_CONTENT_TYPE="application/octet-stream";z.prototype.append=function(t,e,i){i=i||{},typeof i=="string"&&(i={filename:i});var n=So.prototype.append.bind(this);if(typeof e=="number"&&(e=""+e),ll.isArray(e)){this._error(new Error("Arrays are not supported."));return}var r=this._multiPartHeader(t,e,i),o=this._multiPartFooter();n(r),n(e),n(o),this._trackLength(r,e,i)};z.prototype._trackLength=function(t,e,i){var n=0;i.knownLength!=null?n+=+i.knownLength:Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(t)+z.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof nv))&&(i.knownLength||this._valuesToMeasure.push(e))};z.prototype._lengthRetriever=function(t,e){t.hasOwnProperty("fd")?t.end!=null&&t.end!=1/0&&t.start!=null?e(null,t.end+1-(t.start?t.start:0)):iv.stat(t.path,function(i,n){var r;if(i){e(i);return}r=n.size-(t.start?t.start:0),e(null,r)}):t.hasOwnProperty("httpVersion")?e(null,+t.headers["content-length"]):t.hasOwnProperty("httpModule")?(t.on("response",function(i){t.pause(),e(null,+i.headers["content-length"])}),t.resume()):e("Unknown stream")};z.prototype._multiPartHeader=function(t,e,i){if(typeof i.header=="string")return i.header;var n=this._getContentDisposition(e,i),r=this._getContentType(e,i),o="",a={"Content-Disposition":["form-data",'name="'+t+'"'].concat(n||[]),"Content-Type":[].concat(r||[])};typeof i.header=="object"&&wo(a,i.header);var s;for(var c in a)a.hasOwnProperty(c)&&(s=a[c],s!=null&&(Array.isArray(s)||(s=[s]),s.length&&(o+=c+": "+s.join("; ")+z.LINE_BREAK)));return"--"+this.getBoundary()+z.LINE_BREAK+o+z.LINE_BREAK};z.prototype._getContentDisposition=function(t,e){var i,n;return typeof e.filepath=="string"?i=vo.normalize(e.filepath).replace(/\\/g,"/"):e.filename||t.name||t.path?i=vo.basename(e.filename||t.name||t.path):t.readable&&t.hasOwnProperty("httpVersion")&&(i=vo.basename(t.client._httpMessage.path||"")),i&&(n='filename="'+i+'"'),n};z.prototype._getContentType=function(t,e){var i=e.contentType;return!i&&t.name&&(i=bo.lookup(t.name)),!i&&t.path&&(i=bo.lookup(t.path)),!i&&t.readable&&t.hasOwnProperty("httpVersion")&&(i=t.headers["content-type"]),!i&&(e.filepath||e.filename)&&(i=bo.lookup(e.filepath||e.filename)),!i&&typeof t=="object"&&(i=z.DEFAULT_CONTENT_TYPE),i};z.prototype._multiPartFooter=function(){return function(t){var e=z.LINE_BREAK,i=this._streams.length===0;i&&(e+=this._lastBoundary()),t(e)}.bind(this)};z.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+z.LINE_BREAK};z.prototype.getHeaders=function(t){var e,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in t)t.hasOwnProperty(e)&&(i[e.toLowerCase()]=t[e]);return i};z.prototype.setBoundary=function(t){this._boundary=t};z.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};z.prototype.getBuffer=function(){for(var t=new Buffer.alloc(0),e=this.getBoundary(),i=0,n=this._streams.length;i<n;i++)typeof this._streams[i]!="function"&&(Buffer.isBuffer(this._streams[i])?t=Buffer.concat([t,this._streams[i]]):t=Buffer.concat([t,Buffer.from(this._streams[i])]),(typeof this._streams[i]!="string"||this._streams[i].substring(2,e.length+2)!==e)&&(t=Buffer.concat([t,Buffer.from(z.LINE_BREAK)])));return Buffer.concat([t,Buffer.from(this._lastBoundary())])};z.prototype._generateBoundary=function(){for(var t="--------------------------",e=0;e<24;e++)t+=Math.floor(Math.random()*10).toString(16);this._boundary=t};z.prototype.getLengthSync=function(){var t=this._overheadLength+this._valueLength;return this._streams.length&&(t+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),t};z.prototype.hasKnownLength=function(){var t=!0;return this._valuesToMeasure.length&&(t=!1),t};z.prototype.getLength=function(t){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(t
`).map(e=>e.trim()).join(" ")};Tl.O=function(t){return this.inspectOpts.colors=this.useColors,Un.inspect(t,this.inspectOpts)}});var Bl=v((aT,jo)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?jo.exports=Cl():jo.exports=kl()});var Fl=v((sT,jl)=>{var Vi;jl.exports=function(){if(!Vi){try{Vi=Bl()("follow-redirects")}catch{}typeof Vi!="function"&&(Vi=function(){})}Vi.apply(null,arguments)}});var Dl=v((cT,Lo)=>{var Ft=require("url"),Fo=Ft.URL,Hv=require("http"),Wv=require("https"),ql=require("stream").Writable,Ll=require("assert"),Nl=Fl(),Io=["abort","aborted","connect","error","socket","timeout"],qo=Object.create(null);Io.forEach(function(t){qo[t]=function(e,i,n){this._redirectable.emit(t,e,i,n)}});var Vv=Ki("ERR_INVALID_URL","Invalid URL",TypeError),Pl=Ki("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Gv=Ki("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),Kv=Ki("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Jv=Ki("ERR_STREAM_WRITE_AFTER_END","write after end");function we(t,e){ql.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 i=this;this._onNativeResponse=function(n){i._processResponse(n)},this._performRequest()}we.prototype=Object.create(ql.prototype);we.prototype.abort=function(){zl(this._currentRequest),this.emit("abort")};we.prototype.write=function(t,e,i){if(this._ending)throw new Jv;if(!Pt(t)&&!Qv(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Gi(e)&&(i=e,e=null),t.length===0){i&&i();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,i)):(this.emit("error",new Kv),this.abort())};we.prototype.end=function(t,e,i){if(Gi(t)?(i=t,t=e=null):Gi(e)&&(i=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,i);else{var n=this,r=this._currentRequest;this.write(t,e,function(){n._ended=!0,r.end(null,null,i)}),this._ending=!0}};we.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};we.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};we.prototype.setTimeout=function(t,e){var i=this;function n(a){a.setTimeout(t),a.removeListener("timeout",a.destroy),a.addListener("timeout",a.destroy)}function r(a){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout(function(){i.emit("timeout"),o()},t),n(a)}function o(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",o),i.removeListener("error",o),i.removeListener("response",o),e&&i.removeListener("timeout",e),i.socket||i._currentRequest.removeListener("socket",r)}return e&&this.on("timeout",e),this.socket?r(this.socket):this._currentRequest.once("socket",r),this.on("socket",n),this.on("abort",o),this.on("error",o),this.on("response",o),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){we.prototype[t]=function(e,i){return this._currentRequest[t](e,i)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(we.prototype,t,{get:function(){return this._currentRequest[t]}})});we.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))}};we.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 i=t.slice(0,-1);this._options.agent=this._options.agents[i]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var r of Io)n.on(r,qo[r]);if(this._currentUrl=/^\//.test(this._options.path
`).forEach(function(a){r=a.indexOf(":"),i=a.substring(0,r).trim().toLowerCase(),n=a.substring(r+1).trim(),!(!i||e[i]&&mv[i])&&(i==="set-cookie"?e[i]?e[i].push(n):e[i]=[n]:e[i]=e[i]?e[i]+", "+n:n)}),e};var wl=Symbol("internals");function Mi(t){return t&&String(t).trim().toLowerCase()}function qn(t){return t===!1||t==null?t:y.isArray(t)?t.map(qn):String(t)}function hv(t){let e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=i.exec(t);)e[n[1]]=n[2];return e}var xv=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());functionCo(t,e,i,n,r){if(y.isFunction(n))returnn.call(this,e,i);if(r&&(e=i),!!y.isString(e)){if(y.isString(n))returne.indexOf(n)!==-1;if(y.isRegExp(n))returnn.test(e)}}functionyv(t){returnt.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,i,n)=>i.toUpperCase()+n)}functiongv(t,e){leti=y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+i,{value:function(r,o,a){returnthis[n].call(this,e,r,o,a)},configurable:!0})})}varri=class{constructor(e){e&&this.set(e)}set(e,i,n){letr=this;functiono(s,c,l){letp=Mi(c);if(!p)thrownewError("header name must be a non-empty string");letu=y.findKey(r,p);(!u||r[u]===void0||l===!0||l===void0&&r[u]!==!1)&&(r[u||c]=qn(s))}leta=(s,c)=>y.forEach(s,(l,p)=>o(l,p,c));returny.isPlainObject(e)||einstanceofthis.constructor?a(e,i):y.isString(e)&&(e=e.trim())&&!xv(e)?a(bl(e),i):e!=null&&o(i,e,n),this}get(e,i){if(e=Mi(e),e){letn=y.findKey(this,e);if(n){letr=this[n];if(!i)returnr;if(i===!0)returnhv(r);if(y.isFunction(i))returni.call(this,r,n);if(y.isRegExp(i))returni.exec(r);thrownewTypeError("parser must be boolean|regexp|function")}}}has(e,i){if(e=Mi(e),e){letn=y.findKey(this,e);return!!(n&&this[n]!==void0&&(!i||Co(this,this[n],n,i)))}return!1}delete(e,i){letn=this,r=!1;functiono(a){if(a=Mi(a),a){lets=y.findKey(n,a);s&&(!i||Co(n,n[s],s,i))&&(deleten[s],r=!0)}}returny.isArray(e)?e.forEach(o):o(e),r}clear(e){leti=Object.keys(this),n=i.length,r=!1;for(;n--;){leto=i[n];(!e||Co(this,this[o],o,e,!0))&&(deletethis[o],r=!0)}returnr}normalize(e){leti=this,n={};returny.forEach(this,(r,o)=>{leta=y.findKey(n,o);if(a){i[a]=qn(r),deletei[o];return}lets=e?yv(o):String(o).trim();s!==o&&deletei[o],i[s]=qn(r),n[s]=!0}),this}concat(...e){returnthis.constructor.concat(this,...e)}toJSON(e){leti=Object.create(null);returny.forEach(this,(n,r)=>{n!=null&&n!==!1&&(i[r]=e&&y.isArray(n)?n.join(", "):n)}),i}[Symbol.iterator](){returnObject.entries(this.toJSON())[Symbol.iterator]()}toString(){returnObject.entries(this.toJSON()).map(([e,i])=>e+": "+i).join(`
`,rb=Yi.encode(mt),ob=2,Do=class{constructor(e,i){let{escapeName:n}=this.constructor,r=y.isString(i),o=`Content-Disposition:form-data;name="${n(e)}"${!r&&i.name?`; filename="${n(i.name)}"`:""}${mt}`;r?i=Yi.encode(String(i).replace(/\r?\n|\r\n?/g,mt)):o+=`Content-Type:${i.type||"application/octet-stream"}${mt}`,this.headers=Yi.encode(o+mt),this.contentLength=r?i.byteLength:i.size,this.size=this.headers.byteLength+this.contentLength+ob,this.name=e,this.value=i}async*encode(){yield this.headers;let{value:e}=this;y.isTypedArray(e)?yield e:yield*Mn(e),yield rb}static escapeName(e){return String(e).replace(/[\r\n"]/g,i=>({"\r":"%0D","\n":"%0A",'"':"%22"})[i])}},ab=(t,e,i)=>{let{tag:n="form-data-boundary",size:r=25,boundary:o=n+"-"+y.generateString(r,nb)}=i||{};if(!y.isFormData(t))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");let a=Yi.encode("--"+o+mt),s=Yi.encode("--"+o+"--"+mt+mt),c=s.byteLength,l=Array.from(t.entries()).map(([u,h])=>{let d=new Do(u,h);return c+=d.size,d});c+=a.byteLength*l.length,c=y.toFiniteNumber(c);let p={"Content-Type":`multipart/form-data;boundary=${o}`};return Number.isFinite(c)&&(p["Content-Length"]=c),e&&e(p),Vl.Readable.from(async function*(){for(let u of l)yield a,yield*u.encode();yield s}())},Gl=ab;var Kl=V(require("stream"),1),$o=class extends Kl.default.Transform{__transform(e,i,n){this.push(e),n()}_transform(e,i,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let r=Buffer.alloc(2);r[0]=120,r[1]=156,this.push(r,i)}this.__transform(e,i,n)}},Jl=$o;var sb=(t,e)=>y.isAsyncFn(t)?function(...i){let n=i.pop();t.apply(this,i).then(r=>{try{e?n(null,...e(r)):n(null,r)}catch(o){n(o)}},n)}:t,Yl=sb;var Xl={flush:rt.default.constants.Z_SYNC_FLUSH,finishFlush:rt.default.constants.Z_SYNC_FLUSH},cb={flush:rt.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:rt.default.constants.BROTLI_OPERATION_FLUSH},Ql=y.isFunction(rt.default.createBrotliDecompress),{http:lb,https:pb}=rp.default,ub=/https:?/,Zl=X.protocols.map(t=>t+":");function fb(t){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t)}function ap(t,e,i){let n=e;if(!n&&n!==!1){let r=(0,ep.getProxyForUrl)(i);r&&(n=new URL(r))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let o=Buffer.from(n.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+o}t.headers.host=t.hostname+(t.port?":"+t.port:"");let r=n.hostname||n.host;t.hostname=r,t.host=r,t.port=n.port,t.path=i,n.protocol&&(t.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}t.beforeRedirects.proxy=function(o){ap(o,e,o.href)}}var db=typeof process<"u"&&y.kindOf(process)==="process",mb=t=>new Promise((e,i)=>{let n,r,o=(c,l)=>{r||(r=!0,n&&n(c,l))},a=c=>{o(c),e(c)},s=c=>{o(c,!0),i(c)};t(a,s,c=>n=c).catch(s)}),sp=db&&function(e){return mb(async function(n,r,o){let{data:a,lookup:s,family:c}=e,{responseType:l,responseEncoding:p}=e,u=e.method.toUpperCase(),h,d=!1,m;s&&y.isAsyncFn(s)&&(s=Yl(s,j=>{if(y.isString(j))j=[j,j.indexOf(".")<0?6:4];else if(!y.isArray(j))throw new TypeError("lookup async function must return an array [ip: string, family: number]]");return j}));let x=new op.default,w=()=>{e.cancelToken&&e.cancelToken.unsubscribe(S),e.signal&&e.signal.removeEventListener("abort",S),x.removeAllListeners()};o((j,L)=>{h=!0,L&&(d=!0,w())});function S(j){x.emit("abort",!j||j.type?new Fe(null,e,m):j)}x.once("abort",r),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(S),e.signal&&(e.signal.aborted?S():e.signal.addEventListener("abort",S)));let b=Bt(e.baseURL,e.url),A=new URL(b,"http://localhost"),O=A.protocol||Zl[0];if(O==="data:"){let j;if(u!=="GET")return dt(n,r,{status:405,statusText:"method not allowed",headers:{},config:e});try{j=No(e.url,l==="blob",{Blob:e.env&&e.env.Blob})}catch(L){throw R.from(L,R.ERR_BAD_REQUEST,e)}return l==="text"?(j=j.toString(p),(!p||p==="utf8")&&(j=y.stripBOM(
`),i]}catch(c){if(c.code!=="ENOENT")throw c}for(let c of s)if(c)try{let l=await this.fsStat(c);l.isFile()?a.push({name:c,size:l.size,time:l.ctime.getTime()}):this.emit("warning",new Error(`File'${c}'containedinhistoryisnotaregularfile`))}catch(l){if(l.code!=="ENOENT")throw l}if(a.sort((c,l)=>c.time-l.time),r)for(;a.length>r;){let c=a.shift();await this.unlink(c.name),this.emit("removed",c.name,!0)}if(o)for(;a.reduce((c,l)=>c+l.size,0)>o;){let c=a.shift();await this.unlink(c.name),this.emit("removed",c.name,!1)}await(0,Q.writeFile)(n,a.map(c=>c.name).join(`
`)+`
`,"utf-8"),this.emit("history")}async immutate(i){let{size:n}=this.options,r=this.now();for(let o=1;o<1e3;++o){let a=0,s;this.filename=this.options.path+this.generator(r,o);try{s=await this.fsStat(this.filename)}catch(c){if(c.code!=="ENOENT")throw c}if(s){if(a=s.size,!s.isFile())throw new Error(`Can't write on: '${this.filename}' (it is not a file)`);if(n&&a>=n)continue}if(i)return this.last=this.filename,this.reopen(a);await this.rotated(this.last),this.last=this.filename;return}throw new Nr}async unlink(i){try{await this.fsUnlink(i)}catch(n){if(n.code!=="ENOENT")throw n;this.emit("warning",n)}}};function ah(t){return(e,i,n)=>{let r=parseInt(n,10);if(e!=="number"||r!==n||r<=0)throw new Error(`'${t}' option must be a positive integer number`)}}function Os(t,e){return(i,n,r)=>{if(i!=="string")throw new Error(`Don'tknowhowtohandle'options.${t}'type:${i}`);n[t]=e(r)}}function dh(t,e,i){let n={};if(n.num=parseInt(t,10),isNaN(n.num))throw new Error(`Unknown'options.${e}'format:${t}`);if(n.num<=0)throw new Error(`Apositiveintegernumberisexpectedfor'options.${e}'`);if(n.unit=t.replace(/^[ 0]*/g,"").substr((n.num+"").length,1),n.unit.length===0)throw new Error(`Missingunitfor'options.${e}'`);if(!i[n.unit])throw new Error(`Unknown'options.${e}'unit:${n.unit}`);return n}var sA={M:!0,d:!0,h:!0,m:!0,s:!0};function _s(t,e,i){if(parseInt(i/t.num,10)*t.num!==i)throw new Error(`Anintegerdividerof${i}isexpectedas${e}for'options.interval'`)}function cA(t){let e=dh(t,"interval",sA);switch(e.unit){case"h":_s(e,"hours",24);break;case"m":_s(e,"minutes",60);break;case"s":_s(e,"seconds",60);break}return e}var lA={B:!0,G:!0,K:!0,M:!0};function sh(t){let e=dh(t,"size",lA);return e.unit==="K"?e.num*1024:e.unit==="M"?e.num*1048576:e.unit==="G"?e.num*1073741824:e.num}var ch={encoding:(t,e,i)=>new fh.TextDecoder(i),immutable:()=>{},initialRotation:()=>{},interval:Os("interval",cA),intervalBoundary:()=>{},maxFiles:ah("maxFiles"),maxSize:Os("maxSize",sh),mode:()=>{},omitExtension:()=>{},rotate:ah("rotate"),size:Os("size",sh),teeToStdout:()=>{},compress:(t,e,i)=>{if(!i)throw new Error("A value for 'options.compress' must be specified");if(t==="boolean")return e.compress=(n,r)=>`cat${n}|gzip-c9>${r}`;if(t!=="function"){if(t!=="string")throw new Error(`Don't know how to handle 'options.compress' type: ${t}`);if(i!=="gzip")throw new Error(`Don'tknowhowtohandlecompressionmethod:${i}`)}},history:t=>{if(t!=="string")throw new Error(`Don't know how to handle 'options.history' type: ${t}`)},path:(t,e,i)=>{if(t!=="string")throw new Error(`Don'tknowhowtohandle'options.path'type:${t}`);i[i.length-1]!==Sn.sep&&(e.path=i+Sn.sep)}};function pA(t){let e={};for(let i in t){let n=t[i],r=typeof n;if(!(i in ch))throw new Error(`Unknownoption:${i}`);e[i]=t[i],ch[i](r,e,n)}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 uA(t,e,i){return n=>n?`${t}.${n}${e&&!i?".gz":""}`:t}function fA(t,e,i){let n=r=>(r>9?"":"0")+r;return(r,o)=>{if(!r)return t;let a=r.getFullYear()+""+n(r.getMonth()+1),s=n(r.getDate()),c=n(r.getHours()),l=n(r.getMinutes());return a+s+"-"+c+l+"-"+n(o)+"-"+t+(e&&!i?".gz":"")}}function mh(t,e){if(typeof e>"u")e={};else if(typeof e!="object")throw new Error(`The"options"argumentmustbeoftypeobject.Receivedtype${typeofe}`);let i=pA(e),{compress:n,omitExtension:r}=i,o;if(typeof t=="string")o=e.rotate?uA(t,n!==void 0,r):fA(t,n!==void 0,r);else if(typeof t=="function")o=t;else throw new Error(`The"filename"argumentmustbeoneoftypestringorfunction.Receivedtype${typeoft}`);return new Rs(o,i)}var vc=V(Ey()),Ay=Ry.isBrowser?null:mh("tabby-agent.log",{path:_y.default.join(Oy.default.homedir(),".tabby","agent-logs"),size:"10M",interval:"1d"}),Tt=Ay?(0,vc.default)(Ay):(0,vc.default)(),to=[Tt];Tt.onChild=t=>{to.push(t)};var io=class{construct
`)?this.buffer="":this.buffer=n.pop();for(let r of n){let o=null;try{o=JSON.parse(r)}catch(a){this.logger.error({error:a},`Failedtoparserequest:${r}`);continue}this.logger.debug({request:o},"Received request"),this.handleRequest(o).then(a=>{this.sendResponse(a),this.logger.debug({response:a},"Sent response")})}}}async handleRequest(e){let i=[0,null];try{if(!this.agent)throw new Error(`Agentnotbound.
`)}bind(e){this.agent=e;for(let i of Fy)this.agent.on(i,n=>{this.sendResponse([0,n])})}listen(){this.inStream.on("data",this.handleInput.bind(this))}};var PR=new no,Py=new ro;Py.bind(PR);Py.listen();