@abacus-ai/cli 1.106.2805 → 1.106.21000

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as A4}from"node:module";var U4=Object.create;var{getPrototypeOf:O4,defineProperty:N_,getOwnPropertyNames:F9,getOwnPropertyDescriptor:j4}=Object,R9=Object.prototype.hasOwnProperty;var H6=(_,q,$)=>{$=_!=null?U4(O4(_)):{};let Q=q||!_||!_.__esModule?N_($,"default",{value:_,enumerable:!0}):$;for(let x of F9(_))if(!R9.call(Q,x))N_(Q,x,{get:()=>_[x],enumerable:!0});return Q},T9=new WeakMap,C4=(_)=>{var q=T9.get(_),$;if(q)return q;if(q=N_({},"__esModule",{value:!0}),_&&typeof _==="object"||typeof _==="function")F9(_).map((Q)=>!R9.call(q,Q)&&N_(q,Q,{get:()=>_[Q],enumerable:!($=j4(_,Q))||$.enumerable}));return T9.set(_,q),q},I=(_,q)=>()=>(q||_((q={exports:{}}).exports,q),q.exports);var B4=(_,q)=>{for(var $ in q)N_(_,$,{get:q[$],enumerable:!0,configurable:!0,set:(Q)=>q[$]=()=>Q})};var I4=(_,q)=>()=>(_&&(q=_(_=0)),q);var C=A4(import.meta.url);var R1=I((g9)=>{Object.defineProperty(g9,"__esModule",{value:!0}),g9.DownloaderHelper=g9.DH_STATES=void 0;var W6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},T4=function(){function _(q,$){for(var Q,x=0;x<$.length;x++)Q=$[x],Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(q,Q.key,Q)}return function(q,$,Q){return $&&_(q.prototype,$),Q&&_(q,Q),q}}(),F4=C("fs"),k=v6(F4),Z_=C("url"),R4=C("path"),c0=v6(R4),D4=C("http"),D9=v6(D4),S4=C("https"),S9=v6(S4),N4=C("events");function v6(_){if(_&&_.__esModule)return _;var q={};if(_!=null)for(var $ in _)Object.prototype.hasOwnProperty.call(_,$)&&(q[$]=_[$]);return q.default=_,q}function h4(_,q){if(!(_ instanceof q))throw TypeError("Cannot call a class as a function")}function N9(_,q){if(!_)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return q&&(typeof q=="object"||typeof q=="function")?q:_}function g4(_,q){if(typeof q!="function"&&q!==null)throw TypeError("Super expression must either be null or a function, not "+typeof q);_.prototype=Object.create(q&&q.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),q&&(Object.setPrototypeOf?Object.setPrototypeOf(_,q):_.__proto__=q)}var h9=g9.DH_STATES={IDLE:"IDLE",SKIPPED:"SKIPPED",STARTED:"STARTED",DOWNLOADING:"DOWNLOADING",RETRY:"RETRY",PAUSED:"PAUSED",RESUMED:"RESUMED",STOPPED:"STOPPED",FINISHED:"FINISHED",FAILED:"FAILED"},$Q=g9.DownloaderHelper=function(_){function q($,Q){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};h4(this,q);var X=N9(this,(q.__proto__||Object.getPrototypeOf(q)).call(this,{captureRejections:!0}));return X.__validate($,Q)?(X.url=X.requestURL=$.trim(),X.state=h9.IDLE,X.__defaultOpts={body:null,retry:!1,method:"GET",headers:{},fileName:"",timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1000,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},X.__opts=Object.assign({},X.__defaultOpts),X.__pipes=[],X.__total=0,X.__downloaded=0,X.__progress=0,X.__retryCount=0,X.__retryTimeout=null,X.__resumeRetryCount=0,X.__states=h9,X.__promise=null,X.__request=null,X.__response=null,X.__isAborted=!1,X.__isResumed=!1,X.__isResumable=!1,X.__isRedirected=!1,X.__destFolder=Q,X.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},X.__fileName="",X.__filePath="",X.updateOptions(x),X):N9(X)}return g4(q,_),T4(q,[{key:"start",value:function(){var Q=this,x=function(){return new Promise(function(X,V){Q.__promise={resolve:X,reject:V},Q.__start()})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(X){var{name:V,total:J}=X,K=Q.__opts.override;if(Q.__opts.override=!0,Q.__filePath=Q.__getFilePath(V),Q.__opts.override=K,Q.__filePath&&k.existsSync(Q.__filePath)){var G=Q.__getFilesizeInBytes(Q.__filePath);return G===J?x():Q.resumeFromFile(Q.__filePath,{total:J,fileName:V})}return x()}):x()}},{key:"pause",value:function(){var Q=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(x){return x.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return Q.__setState(Q.__states.PAUSED),Q.emit("pause"),!0}))}},{key:"resume",value:function(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range="bytes="+this.__downloaded+"-"),this.emit("resume",this.__isResumed),this.__start()):this.start()}},{key:"stop",value:function(){var Q=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var x=function(){return new Promise(function(X,V){k.access(Q.__filePath,function(J){return J?(Q.__emitStop(),X(!0)):void k.unlink(Q.__filePath,function(K){return K?(Q.__setState(Q.__states.FAILED),Q.emit("error",K),V(K)):(Q.__emitStop(),void X(!0))})})})};return this.__requestAbort(),this.__closeFileStream().then(function(){return Q.__opts.removeOnStop?x():(Q.__emitStop(),Promise.resolve(!0))})}},{key:"pipe",value:function(Q){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;return this.__pipes.push({stream:Q,options:x}),Q}},{key:"unpipe",value:function(){var Q=this,x=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,X=function(J){return Q.__response?Q.__response.unpipe(J):J.unpipe()};if(x){var V=this.__pipes.find(function(J){return J.stream===x});return void(V&&(X(x),this.__pipes=this.__pipes.filter(function(J){return J.stream!==x})))}this.__pipes.forEach(function(J){return X(J.stream)}),this.__pipes=[]}},{key:"getDownloadPath",value:function(){return this.__filePath}},{key:"isResumable",value:function(){return this.__isResumable}},{key:"updateOptions",value:function(Q){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";this.__opts=Object.assign({},this.__opts,Q),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),(typeof this.__opts.progressThrottle!="number"||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=x||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url)}},{key:"getOptions",value:function(){return this.__opts}},{key:"getMetadata",value:function(){return this.__opts.metadata}},{key:"getStats",value:function(){return{total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:"getTotalSize",value:function(){var Q=this;return new Promise(function(x,X){var V=function(Y){Q.__initProtocol(Y);var H=Object.assign({},Q.__headers);H.hasOwnProperty("range")&&delete H.range;var w=Q.__getReqOptions("HEAD",Y,H);return Object.assign({},Q.__reqOptions,w)},J=0,K=null,G=function(Y,H){if(!Q.__opts.retry||W6(Q.__opts.retry)!=="object")return Promise.reject(Y||Error("wrong retry options"));K&&(clearTimeout(K),K=null);var w=Q.__opts.retry,L=w.delay,z=L===void 0?0:L,M=w.maxRetries,u=M===void 0?999:M;return J>=u?Promise.reject(Y||Error("reached the maximum retries")):(J++,Q.__setState(Q.__states.RETRY),Q.emit("retry",J,Q.__opts.retry,Y),new Promise(function(f){K=setTimeout(function(){Q.__setState(Q.__states.IDLE),Z(H,V(H)),f()},z)}))},Z=function(Y,H){K&&(clearTimeout(K),K=null);var w=Q.__protocol.request(H,function(L){if(Q.__isRequireRedirect(L)){var z=/^https?:\/\//.test(L.headers.location)?L.headers.location:new Z_.URL(L.headers.location,Y).href;return Q.emit("redirected",z,Y),Z(z,V(z))}if(200>L.statusCode||400<=L.statusCode){var M=Error("Response status was "+L.statusCode);return Q.__opts.retry&&500<=L.statusCode&&600>L.statusCode?G(M,Y).catch(X):X(M)}x({name:Q.__getFileNameFromHeaders(L.headers,L),total:parseInt(L.headers["content-length"])||null})});w.on("error",function(L){return Q.__opts.retry?G(L,Y).catch(X):void X(L)}),w.on("timeout",function(){return Q.__opts.retry?G(Error("timeout"),Y).catch(X):void X(Error("timeout"))}),w.on("uncaughtException",function(L){return Q.__opts.retry?G(L,Y).catch(X):void X(L)}),w.end()};Z(Q.url,V(Q.url))})}},{key:"getResumeState",value:function(){return{downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:"resumeFromFile",value:function(Q){var x=this,X=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return this.__opts.override=!0,this.__filePath=Q,(X.total&&X.fileName?Promise.resolve({name:X.fileName,total:X.total}):this.getTotalSize()).then(function(V){var{name:J,total:K}=V;return x.__total=X.total||K,x.__fileName=X.fileName||J,x.__downloaded=X.downloaded||x.__getFilesizeInBytes(x.__filePath),x.__reqOptions.headers.range="bytes="+x.__downloaded+"-",x.__isResumed=!0,x.__isResumable=!0,x.__setState(x.__states.RESUMED),x.emit("resume",x.__isResumed),new Promise(function(G,Z){x.__promise={resolve:G,reject:Z},x.__start()})})}},{key:"__start",value:function(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit("start"),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on("error",this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on("timeout",this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on("uncaughtException",this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end()}},{key:"__resolvePending",value:function(){if(this.__promise){var Q=this.__promise.resolve;return this.__promise=null,Q(!0)}}},{key:"__downloadRequest",value:function(Q,x){var X=this;return this.__protocol.request(this.__reqOptions,function(V){if(X.__response=V,X.__isResumed||(X.__total=parseInt(V.headers["content-length"])||null,X.__resetStats()),X.__isRequireRedirect(V)){var J=/^https?:\/\//.test(V.headers.location)?V.headers.location:new Z_.URL(V.headers.location,X.url).href;return X.__isRedirected=!0,X.__initProtocol(J),X.emit("redirected",J,X.url),X.__start()}if(200>V.statusCode||400<=V.statusCode){var K=Error("Response status was "+V.statusCode);return(K.status=V.statusCode||0,K.body=V.body||"",500<=V.statusCode&&600>V.statusCode)?X.__onError(Q,x)(K):(X.__setState(X.__states.FAILED),X.emit("error",K),x(K))}X.__opts.forceResume?X.__isResumable=!0:V.headers.hasOwnProperty("accept-ranges")&&V.headers["accept-ranges"]!=="none"&&(X.__isResumable=!0),X.__startDownload(V,Q,x)})}},{key:"__startDownload",value:function(Q,x,X){var V=this,J=Q;if(!this.__isResumed){var K=this.__getFileNameFromHeaders(Q.headers);if(this.__filePath=this.__getFilePath(K),this.__fileName=this.__filePath.split(c0.sep).pop(),k.existsSync(this.__filePath)){var G=this.__getFilesizeInBytes(this.__filePath),Z=this.__total?this.__total:0;if(W6(this.__opts.override)==="object"&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||G>=Z))return this.emit("skip",{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:G}),this.__setState(this.__states.SKIPPED),x(!0)}this.__fileStream=k.createWriteStream(this.__filePath,{})}else this.__fileStream=k.createWriteStream(this.__filePath,{flags:"a"});this.emit("download",{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,J.on("data",function(Y){return V.__calculateStats(Y.length)}),this.__pipes.forEach(function(Y){J.pipe(Y.stream,Y.options),J=Y.stream}),J.pipe(this.__fileStream),J.on("error",this.__onError(x,X)),this.__fileStream.on("finish",this.__onFinished(x,X)),this.__fileStream.on("error",this.__onError(x,X))}},{key:"__hasFinished",value:function(){return!this.__isAborted&&[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)===-1}},{key:"__isRequireRedirect",value:function(Q){return 300<Q.statusCode&&400>Q.statusCode&&Q.headers.hasOwnProperty("location")&&Q.headers.location}},{key:"__onFinished",value:function(Q,x){var X=this;return function(){X.__fileStream.close(function(V){if(V)return x(V);if(X.__hasFinished()){var J=!!X.__total&&X.__downloaded!==X.__total;if(J&&X.__isResumable&&X.__opts.resumeOnIncomplete&&X.__resumeRetryCount<=X.__opts.resumeOnIncompleteMaxRetry)return X.__resumeRetryCount++,X.emit("warning",Error("uncomplete download, retrying")),X.resume();X.__setState(X.__states.FINISHED),X.__pipes=[],X.emit("end",{fileName:X.__fileName,filePath:X.__filePath,totalSize:X.__total,incomplete:J,onDiskSize:X.__getFilesizeInBytes(X.__filePath),downloadedSize:X.__downloaded})}return Q(X.__downloaded===X.__total)})}}},{key:"__closeFileStream",value:function(){var Q=this;return this.__fileStream?new Promise(function(x,X){Q.__fileStream.close(function(V){return V?X(V):x(!0)})}):Promise.resolve(!0)}},{key:"__onError",value:function(Q,x){var X=this,V=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return function(J){return X.__pipes=[],V&&X.__requestAbort(),X.state===X.__states.STOPPED||X.state===X.__states.FAILED?void 0:X.__opts.retry?X.__retry(J).catch(function(K){X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("error",K?K:J),x(K?K:J)})}):X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("error",J),x(J)})}}},{key:"__retry",value:function(){var Q=this,x=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null;if(!this.__opts.retry||W6(this.__opts.retry)!=="object")return Promise.reject(x||Error("wrong retry options"));var X=this.__opts.retry,V=X.delay,J=V===void 0?0:V,K=X.maxRetries,G=K===void 0?999:K;return this.__retryCount>=G?Promise.reject(x||Error("reached the maximum retries")):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit("retry",this.__retryCount,this.__opts.retry,x),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(Z){return Z.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(Z){return Q.__retryTimeout=setTimeout(function(){return Z(0<Q.__downloaded?Q.resume():Q.__start())},J)})}))}},{key:"__onTimeout",value:function(Q,x){var X=this;return function(){return X.__requestAbort(),X.__opts.retry?X.__retry(Error("timeout")).catch(function(V){X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),V?x(V):(X.emit("timeout"),x(Error("timeout")))})}):X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("timeout"),x(Error("timeout"))})}}},{key:"__resetStats",value:function(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0}}},{key:"__getFileNameFromHeaders",value:function(Q,x){var X="",V=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,J=/.*filename="(.*?)";?/i,K=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,G=Q.hasOwnProperty("content-disposition"),Z=G?Q["content-disposition"].match(V):null,Y=!G||Z?null:Q["content-disposition"].match(J),H=!G||Z||Y?null:Q["content-disposition"].match(K);return G&&(Z||Y||H)?(X=Q["content-disposition"],X=X.trim(),Z?X=Z[1]:Y?X=Y[1]:H&&(X=H[1]),X=X.replace(/[/\\]/g,"")):0<c0.basename(new Z_.URL(this.requestURL).pathname).length?X=c0.basename(new Z_.URL(this.requestURL).pathname):X=new Z_.URL(this.requestURL).hostname+".html",this.__opts.fileName?this.__getFileNameFromOpts(X,x):X.replace(/\.*$/,"")}},{key:"__getFilePath",value:function(Q){var x=c0.join(this.__destFolder,Q),X=x;return this.__opts.override||this.state===this.__states.RESUMED||(X=this.__uniqFileNameSync(X),x!==X&&this.emit("renamed",{path:X,fileName:X.split(c0.sep).pop(),prevPath:x,prevFileName:x.split(c0.sep).pop()})),X}},{key:"__getFileNameFromOpts",value:function(Q,x){if(!this.__opts.fileName)return Q;if(typeof this.__opts.fileName=="string")return this.__opts.fileName;if(typeof this.__opts.fileName=="function"){var X=c0.join(this.__destFolder,Q);return x&&x.headers||this.__response&&this.__response.headers?this.__opts.fileName(Q,X,(x?x:this.__response).headers["content-type"]):this.__opts.fileName(Q,X)}if(W6(this.__opts.fileName)==="object"){var V=this.__opts.fileName,J=V.name,K=!!V.hasOwnProperty("ext")&&V.ext;if(typeof K=="string")return J+"."+K;if(typeof K=="boolean"){if(K)return J;var G=Q.includes(".")?Q.split(".").pop():"";return G===""?J:J+"."+G}}return Q}},{key:"__calculateStats",value:function(Q){var x=new Date,X=x-this.__statsEstimate.time,V=x-this.__statsEstimate.throttleTime,J=this.__total||0;Q&&(this.__downloaded+=Q,this.__progress=J===0?0:100*(this.__downloaded/J),(this.__downloaded===J||1000<X)&&(this.__statsEstimate.time=x,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===J||V>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=x,this.emit("progress.throttled",this.getStats())),this.emit("progress",this.getStats()))}},{key:"__setState",value:function(Q){this.state=Q,this.emit("stateChanged",this.state)}},{key:"__getReqOptions",value:function(Q,x){var X=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},V=new Z_.URL(x),J={protocol:V.protocol,host:V.hostname,port:V.port,path:V.pathname+V.search,method:Q};return X&&(J.headers=X),J}},{key:"__getFilesizeInBytes",value:function(Q){try{var x=k.statSync(Q,{throwIfNoEntry:!1}),X=x.size||0;return X}catch(V){this.emit("warning",V)}return 0}},{key:"__validate",value:function(Q,x){if(typeof Q!="string")throw Error("URL should be an string");if(Q.trim()==="")throw Error("URL couldn't be empty");if(typeof x!="string")throw Error("Destination Folder should be an string");if(x.trim()==="")throw Error("Destination Folder couldn't be empty");if(!k.existsSync(x))throw Error("Destination Folder must exist");var X=k.statSync(x);if(!X.isDirectory())throw Error("Destination Folder must be a directory");try{k.accessSync(x,k.constants.W_OK)}catch(V){throw Error("Destination Folder must be writable")}return!0}},{key:"__initProtocol",value:function(Q){var x=this.__getReqOptions(this.__opts.method,Q,this.__headers);this.requestURL=Q,-1<Q.indexOf("https://")?(this.__protocol=S9,x.agent=new S9.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},x,this.__opts.httpsRequestOptions)):(this.__protocol=D9,x.agent=new D9.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},x,this.__opts.httpRequestOptions))}},{key:"__uniqFileNameSync",value:function(Q){if(typeof Q!="string"||Q==="")return Q;try{k.accessSync(Q,k.F_OK);var x=Q.match(/(.*)(\([0-9]+\))(\..*)$/),X=x?x[1].trim():Q,V=x?parseInt(x[2].replace(/\(|\)/,"")):0,J=Q.split(".").pop();return J!==Q&&0<J.length?(J="."+J,X=X.replace(J,"")):J="",this.__uniqFileNameSync(X+" ("+ ++V+")"+J)}catch(K){return Q}}},{key:"__removeFile",value:function(){var Q=this;return new Promise(function(x){return Q.__fileStream?void Q.__fileStream.close(function(X){return X&&Q.emit("warning",X),Q.__opts.removeOnFail?k.access(Q.__filePath,function(V){return V?x():void k.unlink(Q.__filePath,function(J){J&&Q.emit("warning",X),x()})}):void x()}):x()})}},{key:"__requestAbort",value:function(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort())}},{key:"__emitStop",value:function(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit("stop")}}]),q}(N4.EventEmitter)});var p3=I((dX,i3)=>{var I_=1000,A_=I_*60,T_=A_*60,x_=T_*24,I7=x_*7,A7=x_*365.25;i3.exports=function(_,q){q=q||{};var $=typeof _;if($==="string"&&_.length>0)return T7(_);else if($==="number"&&isFinite(_))return q.long?R7(_):F7(_);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function T7(_){if(_=String(_),_.length>100)return;var q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(!q)return;var $=parseFloat(q[1]),Q=(q[2]||"ms").toLowerCase();switch(Q){case"years":case"year":case"yrs":case"yr":case"y":return $*A7;case"weeks":case"week":case"w":return $*I7;case"days":case"day":case"d":return $*x_;case"hours":case"hour":case"hrs":case"hr":case"h":return $*T_;case"minutes":case"minute":case"mins":case"min":case"m":return $*A_;case"seconds":case"second":case"secs":case"sec":case"s":return $*I_;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return $;default:return}}function F7(_){var q=Math.abs(_);if(q>=x_)return Math.round(_/x_)+"d";if(q>=T_)return Math.round(_/T_)+"h";if(q>=A_)return Math.round(_/A_)+"m";if(q>=I_)return Math.round(_/I_)+"s";return _+"ms"}function R7(_){var q=Math.abs(_);if(q>=x_)return Q1(_,q,x_,"day");if(q>=T_)return Q1(_,q,T_,"hour");if(q>=A_)return Q1(_,q,A_,"minute");if(q>=I_)return Q1(_,q,I_,"second");return _+" ms"}function Q1(_,q,$,Q){var x=q>=$*1.5;return Math.round(_/$)+" "+Q+(x?"s":"")}});var o2=I((fX,s3)=>{function D7(_){$.debug=$,$.default=$,$.coerce=K,$.disable=V,$.enable=x,$.enabled=J,$.humanize=p3(),$.destroy=G,Object.keys(_).forEach((Z)=>{$[Z]=_[Z]}),$.names=[],$.skips=[],$.formatters={};function q(Z){let Y=0;for(let H=0;H<Z.length;H++)Y=(Y<<5)-Y+Z.charCodeAt(H),Y|=0;return $.colors[Math.abs(Y)%$.colors.length]}$.selectColor=q;function $(Z){let Y,H=null,w,L;function z(...M){if(!z.enabled)return;let u=z,f=Number(new Date),G6=f-(Y||f);if(u.diff=G6,u.prev=Y,u.curr=f,Y=f,M[0]=$.coerce(M[0]),typeof M[0]!=="string")M.unshift("%O");let K_=0;M[0]=M[0].replace(/%([a-zA-Z%])/g,(x0,Y6)=>{if(x0==="%%")return"%";K_++;let A9=$.formatters[Y6];if(typeof A9==="function"){let P4=M[K_];x0=A9.call(u,P4),M.splice(K_,1),K_--}return x0}),$.formatArgs.call(u,M),(u.log||$.log).apply(u,M)}if(z.namespace=Z,z.useColors=$.useColors(),z.color=$.selectColor(Z),z.extend=Q,z.destroy=$.destroy,Object.defineProperty(z,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(H!==null)return H;if(w!==$.namespaces)w=$.namespaces,L=$.enabled(Z);return L},set:(M)=>{H=M}}),typeof $.init==="function")$.init(z);return z}function Q(Z,Y){let H=$(this.namespace+(typeof Y>"u"?":":Y)+Z);return H.log=this.log,H}function x(Z){$.save(Z),$.namespaces=Z,$.names=[],$.skips=[];let Y=(typeof Z==="string"?Z:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let H of Y)if(H[0]==="-")$.skips.push(H.slice(1));else $.names.push(H)}function X(Z,Y){let H=0,w=0,L=-1,z=0;while(H<Z.length)if(w<Y.length&&(Y[w]===Z[H]||Y[w]==="*"))if(Y[w]==="*")L=w,z=H,w++;else H++,w++;else if(L!==-1)w=L+1,z++,H=z;else return!1;while(w<Y.length&&Y[w]==="*")w++;return w===Y.length}function V(){let Z=[...$.names,...$.skips.map((Y)=>"-"+Y)].join(",");return $.enable(""),Z}function J(Z){for(let Y of $.skips)if(X(Z,Y))return!1;for(let Y of $.names)if(X(Z,Y))return!0;return!1}function K(Z){if(Z instanceof Error)return Z.stack||Z.message;return Z}function G(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return $.enable($.load()),$}s3.exports=D7});var a3=I((n3,x1)=>{n3.formatArgs=N7;n3.save=h7;n3.load=g7;n3.useColors=S7;n3.storage=y7();n3.destroy=(()=>{let _=!1;return()=>{if(!_)_=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();n3.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 S7(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let _;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(_=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(_[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function N7(_){if(_[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+_[0]+(this.useColors?"%c ":" ")+"+"+x1.exports.humanize(this.diff),!this.useColors)return;let q="color: "+this.color;_.splice(1,0,q,"color: inherit");let $=0,Q=0;_[0].replace(/%[a-zA-Z%]/g,(x)=>{if(x==="%%")return;if($++,x==="%c")Q=$}),_.splice(Q,0,q)}n3.log=console.debug||console.log||(()=>{});function h7(_){try{if(_)n3.storage.setItem("debug",_);else n3.storage.removeItem("debug")}catch(q){}}function g7(){let _;try{_=n3.storage.getItem("debug")||n3.storage.getItem("DEBUG")}catch(q){}if(!_&&typeof process<"u"&&"env"in process)_=process.env.DEBUG;return _}function y7(){try{return localStorage}catch(_){}}x1.exports=o2()(n3);var{formatters:u7}=x1.exports;u7.j=function(_){try{return JSON.stringify(_)}catch(q){return"[UnexpectedJSONParseError]: "+q.message}}});var t3={};B4(t3,{default:()=>a7,createSupportsColor:()=>t2});import r2 from"node:process";import f7 from"node:os";import o3 from"node:tty";function o(_,q=globalThis.Deno?globalThis.Deno.args:r2.argv){let $=_.startsWith("-")?"":_.length===1?"-":"--",Q=q.indexOf($+_),x=q.indexOf("--");return Q!==-1&&(x===-1||Q<x)}function i7(){if("FORCE_COLOR"in T){if(T.FORCE_COLOR==="true")return 1;if(T.FORCE_COLOR==="false")return 0;return T.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(T.FORCE_COLOR,10),3)}}function p7(_){if(_===0)return!1;return{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function s7(_,{streamIsTTY:q,sniffFlags:$=!0}={}){let Q=i7();if(Q!==void 0)X1=Q;let x=$?X1:Q;if(x===0)return 0;if($){if(o("color=16m")||o("color=full")||o("color=truecolor"))return 3;if(o("color=256"))return 2}if("TF_BUILD"in T&&"AGENT_NAME"in T)return 1;if(_&&!q&&x===void 0)return 0;let X=x||0;if(T.TERM==="dumb")return X;if(r2.platform==="win32"){let V=f7.release().split(".");if(Number(V[0])>=10&&Number(V[2])>=10586)return Number(V[2])>=14931?3:2;return 1}if("CI"in T){if("GITHUB_ACTIONS"in T||"GITEA_ACTIONS"in T)return 3;if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((V)=>(V in T))||T.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in T)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(T.TEAMCITY_VERSION)?1:0;if(T.COLORTERM==="truecolor")return 3;if(T.TERM==="xterm-kitty")return 3;if("TERM_PROGRAM"in T){let V=Number.parseInt((T.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(T.TERM_PROGRAM){case"iTerm.app":return V>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(T.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(T.TERM))return 1;if("COLORTERM"in T)return 1;return X}function t2(_,q={}){let $=s7(_,{streamIsTTY:_&&_.isTTY,...q});return p7($)}var T,X1,n7,a7;var r3=I4(()=>{({env:T}=r2);if(o("no-color")||o("no-colors")||o("color=false")||o("color=never"))X1=0;else if(o("color")||o("colors")||o("color=true")||o("color=always"))X1=1;n7={stdout:t2({isTTY:o3.isatty(1)}),stderr:t2({isTTY:o3.isatty(2)})},a7=n7});var $8=I((_8,J1)=>{var o7=C("tty"),V1=C("util");_8.init=Qq;_8.log=_q;_8.formatArgs=r7;_8.save=qq;_8.load=$q;_8.useColors=t7;_8.destroy=V1.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");_8.colors=[6,2,3,4,5,1];try{let _=(r3(),C4(t3));if(_&&(_.stderr||_).level>=2)_8.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(_){}_8.inspectOpts=Object.keys(process.env).filter((_)=>{return/^debug_/i.test(_)}).reduce((_,q)=>{let $=q.substring(6).toLowerCase().replace(/_([a-z])/g,(x,X)=>{return X.toUpperCase()}),Q=process.env[q];if(/^(yes|on|true|enabled)$/i.test(Q))Q=!0;else if(/^(no|off|false|disabled)$/i.test(Q))Q=!1;else if(Q==="null")Q=null;else Q=Number(Q);return _[$]=Q,_},{});function t7(){return"colors"in _8.inspectOpts?Boolean(_8.inspectOpts.colors):o7.isatty(process.stderr.fd)}function r7(_){let{namespace:q,useColors:$}=this;if($){let Q=this.color,x="\x1B[3"+(Q<8?Q:"8;5;"+Q),X=` ${x};1m${q} \x1B[0m`;_[0]=X+_[0].split(`
2
+ import{createRequire as C4}from"node:module";var W4=Object.create;var{getPrototypeOf:w4,defineProperty:B9,getOwnPropertyNames:L4}=Object;var z4=Object.prototype.hasOwnProperty;function P4(_){return this[_]}var M4,U4,H6=(_,q,$)=>{var Q=_!=null&&typeof _==="object";if(Q){var x=q?M4??=new WeakMap:U4??=new WeakMap,X=x.get(_);if(X)return X}$=_!=null?W4(w4(_)):{};let V=q||!_||!_.__esModule?B9($,"default",{value:_,enumerable:!0}):$;for(let J of L4(_))if(!z4.call(V,J))B9(V,J,{get:P4.bind(_,J),enumerable:!0});if(Q)x.set(_,V);return V};var A=(_,q)=>()=>(q||_((q={exports:{}}).exports,q),q.exports);var j=C4(import.meta.url);var F1=A((R9)=>{Object.defineProperty(R9,"__esModule",{value:!0}),R9.DownloaderHelper=R9.DH_STATES=void 0;var v6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},O4=function(){function _(q,$){for(var Q,x=0;x<$.length;x++)Q=$[x],Q.enumerable=Q.enumerable||!1,Q.configurable=!0,"value"in Q&&(Q.writable=!0),Object.defineProperty(q,Q.key,Q)}return function(q,$,Q){return $&&_(q.prototype,$),Q&&_(q,Q),q}}(),j4=j("fs"),y=W6(j4),K_=j("url"),B4=j("path"),b0=W6(B4),I4=j("http"),I9=W6(I4),A4=j("https"),A9=W6(A4),T4=j("events");function W6(_){if(_&&_.__esModule)return _;var q={};if(_!=null)for(var $ in _)Object.prototype.hasOwnProperty.call(_,$)&&(q[$]=_[$]);return q.default=_,q}function F4(_,q){if(!(_ instanceof q))throw TypeError("Cannot call a class as a function")}function T9(_,q){if(!_)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return q&&(typeof q=="object"||typeof q=="function")?q:_}function R4(_,q){if(typeof q!="function"&&q!==null)throw TypeError("Super expression must either be null or a function, not "+typeof q);_.prototype=Object.create(q&&q.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}),q&&(Object.setPrototypeOf?Object.setPrototypeOf(_,q):_.__proto__=q)}var F9=R9.DH_STATES={IDLE:"IDLE",SKIPPED:"SKIPPED",STARTED:"STARTED",DOWNLOADING:"DOWNLOADING",RETRY:"RETRY",PAUSED:"PAUSED",RESUMED:"RESUMED",STOPPED:"STOPPED",FINISHED:"FINISHED",FAILED:"FAILED"},f$=R9.DownloaderHelper=function(_){function q($,Q){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{};F4(this,q);var X=T9(this,(q.__proto__||Object.getPrototypeOf(q)).call(this,{captureRejections:!0}));return X.__validate($,Q)?(X.url=X.requestURL=$.trim(),X.state=F9.IDLE,X.__defaultOpts={body:null,retry:!1,method:"GET",headers:{},fileName:"",timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1000,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},X.__opts=Object.assign({},X.__defaultOpts),X.__pipes=[],X.__total=0,X.__downloaded=0,X.__progress=0,X.__retryCount=0,X.__retryTimeout=null,X.__resumeRetryCount=0,X.__states=F9,X.__promise=null,X.__request=null,X.__response=null,X.__isAborted=!1,X.__isResumed=!1,X.__isResumable=!1,X.__isRedirected=!1,X.__destFolder=Q,X.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},X.__fileName="",X.__filePath="",X.updateOptions(x),X):T9(X)}return R4(q,_),O4(q,[{key:"start",value:function(){var Q=this,x=function(){return new Promise(function(X,V){Q.__promise={resolve:X,reject:V},Q.__start()})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(X){var{name:V,total:J}=X,K=Q.__opts.override;if(Q.__opts.override=!0,Q.__filePath=Q.__getFilePath(V),Q.__opts.override=K,Q.__filePath&&y.existsSync(Q.__filePath)){var G=Q.__getFilesizeInBytes(Q.__filePath);return G===J?x():Q.resumeFromFile(Q.__filePath,{total:J,fileName:V})}return x()}):x()}},{key:"pause",value:function(){var Q=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(x){return x.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return Q.__setState(Q.__states.PAUSED),Q.emit("pause"),!0}))}},{key:"resume",value:function(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range="bytes="+this.__downloaded+"-"),this.emit("resume",this.__isResumed),this.__start()):this.start()}},{key:"stop",value:function(){var Q=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var x=function(){return new Promise(function(X,V){y.access(Q.__filePath,function(J){return J?(Q.__emitStop(),X(!0)):void y.unlink(Q.__filePath,function(K){return K?(Q.__setState(Q.__states.FAILED),Q.emit("error",K),V(K)):(Q.__emitStop(),void X(!0))})})})};return this.__requestAbort(),this.__closeFileStream().then(function(){return Q.__opts.removeOnStop?x():(Q.__emitStop(),Promise.resolve(!0))})}},{key:"pipe",value:function(Q){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:null;return this.__pipes.push({stream:Q,options:x}),Q}},{key:"unpipe",value:function(){var Q=this,x=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null,X=function(J){return Q.__response?Q.__response.unpipe(J):J.unpipe()};if(x){var V=this.__pipes.find(function(J){return J.stream===x});return void(V&&(X(x),this.__pipes=this.__pipes.filter(function(J){return J.stream!==x})))}this.__pipes.forEach(function(J){return X(J.stream)}),this.__pipes=[]}},{key:"getDownloadPath",value:function(){return this.__filePath}},{key:"isResumable",value:function(){return this.__isResumable}},{key:"updateOptions",value:function(Q){var x=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";this.__opts=Object.assign({},this.__opts,Q),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),(typeof this.__opts.progressThrottle!="number"||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=x||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url)}},{key:"getOptions",value:function(){return this.__opts}},{key:"getMetadata",value:function(){return this.__opts.metadata}},{key:"getStats",value:function(){return{total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:"getTotalSize",value:function(){var Q=this;return new Promise(function(x,X){var V=function(Y){Q.__initProtocol(Y);var H=Object.assign({},Q.__headers);H.hasOwnProperty("range")&&delete H.range;var w=Q.__getReqOptions("HEAD",Y,H);return Object.assign({},Q.__reqOptions,w)},J=0,K=null,G=function(Y,H){if(!Q.__opts.retry||v6(Q.__opts.retry)!=="object")return Promise.reject(Y||Error("wrong retry options"));K&&(clearTimeout(K),K=null);var w=Q.__opts.retry,L=w.delay,z=L===void 0?0:L,P=w.maxRetries,u=P===void 0?999:P;return J>=u?Promise.reject(Y||Error("reached the maximum retries")):(J++,Q.__setState(Q.__states.RETRY),Q.emit("retry",J,Q.__opts.retry,Y),new Promise(function(d){K=setTimeout(function(){Q.__setState(Q.__states.IDLE),Z(H,V(H)),d()},z)}))},Z=function(Y,H){K&&(clearTimeout(K),K=null);var w=Q.__protocol.request(H,function(L){if(Q.__isRequireRedirect(L)){var z=/^https?:\/\//.test(L.headers.location)?L.headers.location:new K_.URL(L.headers.location,Y).href;return Q.emit("redirected",z,Y),Z(z,V(z))}if(200>L.statusCode||400<=L.statusCode){var P=Error("Response status was "+L.statusCode);return Q.__opts.retry&&500<=L.statusCode&&600>L.statusCode?G(P,Y).catch(X):X(P)}x({name:Q.__getFileNameFromHeaders(L.headers,L),total:parseInt(L.headers["content-length"])||null})});w.on("error",function(L){return Q.__opts.retry?G(L,Y).catch(X):void X(L)}),w.on("timeout",function(){return Q.__opts.retry?G(Error("timeout"),Y).catch(X):void X(Error("timeout"))}),w.on("uncaughtException",function(L){return Q.__opts.retry?G(L,Y).catch(X):void X(L)}),w.end()};Z(Q.url,V(Q.url))})}},{key:"getResumeState",value:function(){return{downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:"resumeFromFile",value:function(Q){var x=this,X=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return this.__opts.override=!0,this.__filePath=Q,(X.total&&X.fileName?Promise.resolve({name:X.fileName,total:X.total}):this.getTotalSize()).then(function(V){var{name:J,total:K}=V;return x.__total=X.total||K,x.__fileName=X.fileName||J,x.__downloaded=X.downloaded||x.__getFilesizeInBytes(x.__filePath),x.__reqOptions.headers.range="bytes="+x.__downloaded+"-",x.__isResumed=!0,x.__isResumable=!0,x.__setState(x.__states.RESUMED),x.emit("resume",x.__isResumed),new Promise(function(G,Z){x.__promise={resolve:G,reject:Z},x.__start()})})}},{key:"__start",value:function(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit("start"),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on("error",this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on("timeout",this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on("uncaughtException",this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end()}},{key:"__resolvePending",value:function(){if(this.__promise){var Q=this.__promise.resolve;return this.__promise=null,Q(!0)}}},{key:"__downloadRequest",value:function(Q,x){var X=this;return this.__protocol.request(this.__reqOptions,function(V){if(X.__response=V,X.__isResumed||(X.__total=parseInt(V.headers["content-length"])||null,X.__resetStats()),X.__isRequireRedirect(V)){var J=/^https?:\/\//.test(V.headers.location)?V.headers.location:new K_.URL(V.headers.location,X.url).href;return X.__isRedirected=!0,X.__initProtocol(J),X.emit("redirected",J,X.url),X.__start()}if(200>V.statusCode||400<=V.statusCode){var K=Error("Response status was "+V.statusCode);return(K.status=V.statusCode||0,K.body=V.body||"",500<=V.statusCode&&600>V.statusCode)?X.__onError(Q,x)(K):(X.__setState(X.__states.FAILED),X.emit("error",K),x(K))}X.__opts.forceResume?X.__isResumable=!0:V.headers.hasOwnProperty("accept-ranges")&&V.headers["accept-ranges"]!=="none"&&(X.__isResumable=!0),X.__startDownload(V,Q,x)})}},{key:"__startDownload",value:function(Q,x,X){var V=this,J=Q;if(!this.__isResumed){var K=this.__getFileNameFromHeaders(Q.headers);if(this.__filePath=this.__getFilePath(K),this.__fileName=this.__filePath.split(b0.sep).pop(),y.existsSync(this.__filePath)){var G=this.__getFilesizeInBytes(this.__filePath),Z=this.__total?this.__total:0;if(v6(this.__opts.override)==="object"&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||G>=Z))return this.emit("skip",{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:G}),this.__setState(this.__states.SKIPPED),x(!0)}this.__fileStream=y.createWriteStream(this.__filePath,{})}else this.__fileStream=y.createWriteStream(this.__filePath,{flags:"a"});this.emit("download",{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,J.on("data",function(Y){return V.__calculateStats(Y.length)}),this.__pipes.forEach(function(Y){J.pipe(Y.stream,Y.options),J=Y.stream}),J.pipe(this.__fileStream),J.on("error",this.__onError(x,X)),this.__fileStream.on("finish",this.__onFinished(x,X)),this.__fileStream.on("error",this.__onError(x,X))}},{key:"__hasFinished",value:function(){return!this.__isAborted&&[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)===-1}},{key:"__isRequireRedirect",value:function(Q){return 300<Q.statusCode&&400>Q.statusCode&&Q.headers.hasOwnProperty("location")&&Q.headers.location}},{key:"__onFinished",value:function(Q,x){var X=this;return function(){X.__fileStream.close(function(V){if(V)return x(V);if(X.__hasFinished()){var J=!!X.__total&&X.__downloaded!==X.__total;if(J&&X.__isResumable&&X.__opts.resumeOnIncomplete&&X.__resumeRetryCount<=X.__opts.resumeOnIncompleteMaxRetry)return X.__resumeRetryCount++,X.emit("warning",Error("uncomplete download, retrying")),X.resume();X.__setState(X.__states.FINISHED),X.__pipes=[],X.emit("end",{fileName:X.__fileName,filePath:X.__filePath,totalSize:X.__total,incomplete:J,onDiskSize:X.__getFilesizeInBytes(X.__filePath),downloadedSize:X.__downloaded})}return Q(X.__downloaded===X.__total)})}}},{key:"__closeFileStream",value:function(){var Q=this;return this.__fileStream?new Promise(function(x,X){Q.__fileStream.close(function(V){return V?X(V):x(!0)})}):Promise.resolve(!0)}},{key:"__onError",value:function(Q,x){var X=this,V=2<arguments.length&&arguments[2]!==void 0&&arguments[2];return function(J){return X.__pipes=[],V&&X.__requestAbort(),X.state===X.__states.STOPPED||X.state===X.__states.FAILED?void 0:X.__opts.retry?X.__retry(J).catch(function(K){X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("error",K?K:J),x(K?K:J)})}):X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("error",J),x(J)})}}},{key:"__retry",value:function(){var Q=this,x=0<arguments.length&&arguments[0]!==void 0?arguments[0]:null;if(!this.__opts.retry||v6(this.__opts.retry)!=="object")return Promise.reject(x||Error("wrong retry options"));var X=this.__opts.retry,V=X.delay,J=V===void 0?0:V,K=X.maxRetries,G=K===void 0?999:K;return this.__retryCount>=G?Promise.reject(x||Error("reached the maximum retries")):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit("retry",this.__retryCount,this.__opts.retry,x),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(Z){return Z.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(Z){return Q.__retryTimeout=setTimeout(function(){return Z(0<Q.__downloaded?Q.resume():Q.__start())},J)})}))}},{key:"__onTimeout",value:function(Q,x){var X=this;return function(){return X.__requestAbort(),X.__opts.retry?X.__retry(Error("timeout")).catch(function(V){X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),V?x(V):(X.emit("timeout"),x(Error("timeout")))})}):X.__removeFile().finally(function(){X.__setState(X.__states.FAILED),X.emit("timeout"),x(Error("timeout"))})}}},{key:"__resetStats",value:function(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0}}},{key:"__getFileNameFromHeaders",value:function(Q,x){var X="",V=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,J=/.*filename="(.*?)";?/i,K=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,G=Q.hasOwnProperty("content-disposition"),Z=G?Q["content-disposition"].match(V):null,Y=!G||Z?null:Q["content-disposition"].match(J),H=!G||Z||Y?null:Q["content-disposition"].match(K);return G&&(Z||Y||H)?(X=Q["content-disposition"],X=X.trim(),Z?X=Z[1]:Y?X=Y[1]:H&&(X=H[1]),X=X.replace(/[/\\]/g,"")):0<b0.basename(new K_.URL(this.requestURL).pathname).length?X=b0.basename(new K_.URL(this.requestURL).pathname):X=new K_.URL(this.requestURL).hostname+".html",this.__opts.fileName?this.__getFileNameFromOpts(X,x):X.replace(/\.*$/,"")}},{key:"__getFilePath",value:function(Q){var x=b0.join(this.__destFolder,Q),X=x;return this.__opts.override||this.state===this.__states.RESUMED||(X=this.__uniqFileNameSync(X),x!==X&&this.emit("renamed",{path:X,fileName:X.split(b0.sep).pop(),prevPath:x,prevFileName:x.split(b0.sep).pop()})),X}},{key:"__getFileNameFromOpts",value:function(Q,x){if(!this.__opts.fileName)return Q;if(typeof this.__opts.fileName=="string")return this.__opts.fileName;if(typeof this.__opts.fileName=="function"){var X=b0.join(this.__destFolder,Q);return x&&x.headers||this.__response&&this.__response.headers?this.__opts.fileName(Q,X,(x?x:this.__response).headers["content-type"]):this.__opts.fileName(Q,X)}if(v6(this.__opts.fileName)==="object"){var V=this.__opts.fileName,J=V.name,K=!!V.hasOwnProperty("ext")&&V.ext;if(typeof K=="string")return J+"."+K;if(typeof K=="boolean"){if(K)return J;var G=Q.includes(".")?Q.split(".").pop():"";return G===""?J:J+"."+G}}return Q}},{key:"__calculateStats",value:function(Q){var x=new Date,X=x-this.__statsEstimate.time,V=x-this.__statsEstimate.throttleTime,J=this.__total||0;Q&&(this.__downloaded+=Q,this.__progress=J===0?0:100*(this.__downloaded/J),(this.__downloaded===J||1000<X)&&(this.__statsEstimate.time=x,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===J||V>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=x,this.emit("progress.throttled",this.getStats())),this.emit("progress",this.getStats()))}},{key:"__setState",value:function(Q){this.state=Q,this.emit("stateChanged",this.state)}},{key:"__getReqOptions",value:function(Q,x){var X=2<arguments.length&&arguments[2]!==void 0?arguments[2]:{},V=new K_.URL(x),J={protocol:V.protocol,host:V.hostname,port:V.port,path:V.pathname+V.search,method:Q};return X&&(J.headers=X),J}},{key:"__getFilesizeInBytes",value:function(Q){try{var x=y.statSync(Q,{throwIfNoEntry:!1}),X=x.size||0;return X}catch(V){this.emit("warning",V)}return 0}},{key:"__validate",value:function(Q,x){if(typeof Q!="string")throw Error("URL should be an string");if(Q.trim()==="")throw Error("URL couldn't be empty");if(typeof x!="string")throw Error("Destination Folder should be an string");if(x.trim()==="")throw Error("Destination Folder couldn't be empty");if(!y.existsSync(x))throw Error("Destination Folder must exist");var X=y.statSync(x);if(!X.isDirectory())throw Error("Destination Folder must be a directory");try{y.accessSync(x,y.constants.W_OK)}catch(V){throw Error("Destination Folder must be writable")}return!0}},{key:"__initProtocol",value:function(Q){var x=this.__getReqOptions(this.__opts.method,Q,this.__headers);this.requestURL=Q,-1<Q.indexOf("https://")?(this.__protocol=A9,x.agent=new A9.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},x,this.__opts.httpsRequestOptions)):(this.__protocol=I9,x.agent=new I9.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},x,this.__opts.httpRequestOptions))}},{key:"__uniqFileNameSync",value:function(Q){if(typeof Q!="string"||Q==="")return Q;try{y.accessSync(Q,y.F_OK);var x=Q.match(/(.*)(\([0-9]+\))(\..*)$/),X=x?x[1].trim():Q,V=x?parseInt(x[2].replace(/\(|\)/,"")):0,J=Q.split(".").pop();return J!==Q&&0<J.length?(J="."+J,X=X.replace(J,"")):J="",this.__uniqFileNameSync(X+" ("+ ++V+")"+J)}catch(K){return Q}}},{key:"__removeFile",value:function(){var Q=this;return new Promise(function(x){return Q.__fileStream?void Q.__fileStream.close(function(X){return X&&Q.emit("warning",X),Q.__opts.removeOnFail?y.access(Q.__filePath,function(V){return V?x():void y.unlink(Q.__filePath,function(J){J&&Q.emit("warning",X),x()})}):void x()}):x()})}},{key:"__requestAbort",value:function(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort())}},{key:"__emitStop",value:function(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit("stop")}}]),q}(T4.EventEmitter)});var c3=A((DX,b3)=>{var B_=1000,I_=B_*60,A_=I_*60,Q_=A_*24,C7=Q_*7,O7=Q_*365.25;b3.exports=function(_,q){q=q||{};var $=typeof _;if($==="string"&&_.length>0)return j7(_);else if($==="number"&&isFinite(_))return q.long?I7(_):B7(_);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(_))};function j7(_){if(_=String(_),_.length>100)return;var q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(_);if(!q)return;var $=parseFloat(q[1]),Q=(q[2]||"ms").toLowerCase();switch(Q){case"years":case"year":case"yrs":case"yr":case"y":return $*O7;case"weeks":case"week":case"w":return $*C7;case"days":case"day":case"d":return $*Q_;case"hours":case"hour":case"hrs":case"hr":case"h":return $*A_;case"minutes":case"minute":case"mins":case"min":case"m":return $*I_;case"seconds":case"second":case"secs":case"sec":case"s":return $*B_;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return $;default:return}}function B7(_){var q=Math.abs(_);if(q>=Q_)return Math.round(_/Q_)+"d";if(q>=A_)return Math.round(_/A_)+"h";if(q>=I_)return Math.round(_/I_)+"m";if(q>=B_)return Math.round(_/B_)+"s";return _+"ms"}function I7(_){var q=Math.abs(_);if(q>=Q_)return Q1(_,q,Q_,"day");if(q>=A_)return Q1(_,q,A_,"hour");if(q>=I_)return Q1(_,q,I_,"minute");if(q>=B_)return Q1(_,q,B_,"second");return _+" ms"}function Q1(_,q,$,Q){var x=q>=$*1.5;return Math.round(_/$)+" "+Q+(x?"s":"")}});var n2=A((NX,l3)=>{function A7(_){$.debug=$,$.default=$,$.coerce=K,$.disable=V,$.enable=x,$.enabled=J,$.humanize=c3(),$.destroy=G,Object.keys(_).forEach((Z)=>{$[Z]=_[Z]}),$.names=[],$.skips=[],$.formatters={};function q(Z){let Y=0;for(let H=0;H<Z.length;H++)Y=(Y<<5)-Y+Z.charCodeAt(H),Y|=0;return $.colors[Math.abs(Y)%$.colors.length]}$.selectColor=q;function $(Z){let Y,H=null,w,L;function z(...P){if(!z.enabled)return;let u=z,d=Number(new Date),G6=d-(Y||d);if(u.diff=G6,u.prev=Y,u.curr=d,Y=d,P[0]=$.coerce(P[0]),typeof P[0]!=="string")P.unshift("%O");let J_=0;P[0]=P[0].replace(/%([a-zA-Z%])/g,($0,Y6)=>{if($0==="%%")return"%";J_++;let j9=$.formatters[Y6];if(typeof j9==="function"){let v4=P[J_];$0=j9.call(u,v4),P.splice(J_,1),J_--}return $0}),$.formatArgs.call(u,P),(u.log||$.log).apply(u,P)}if(z.namespace=Z,z.useColors=$.useColors(),z.color=$.selectColor(Z),z.extend=Q,z.destroy=$.destroy,Object.defineProperty(z,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(H!==null)return H;if(w!==$.namespaces)w=$.namespaces,L=$.enabled(Z);return L},set:(P)=>{H=P}}),typeof $.init==="function")$.init(z);return z}function Q(Z,Y){let H=$(this.namespace+(typeof Y>"u"?":":Y)+Z);return H.log=this.log,H}function x(Z){$.save(Z),$.namespaces=Z,$.names=[],$.skips=[];let Y=(typeof Z==="string"?Z:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let H of Y)if(H[0]==="-")$.skips.push(H.slice(1));else $.names.push(H)}function X(Z,Y){let H=0,w=0,L=-1,z=0;while(H<Z.length)if(w<Y.length&&(Y[w]===Z[H]||Y[w]==="*"))if(Y[w]==="*")L=w,z=H,w++;else H++,w++;else if(L!==-1)w=L+1,z++,H=z;else return!1;while(w<Y.length&&Y[w]==="*")w++;return w===Y.length}function V(){let Z=[...$.names,...$.skips.map((Y)=>"-"+Y)].join(",");return $.enable(""),Z}function J(Z){for(let Y of $.skips)if(X(Z,Y))return!1;for(let Y of $.names)if(X(Z,Y))return!0;return!1}function K(Z){if(Z instanceof Error)return Z.stack||Z.message;return Z}function G(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return $.enable($.load()),$}l3.exports=A7});var f3=A((d3,x1)=>{d3.formatArgs=F7;d3.save=R7;d3.load=S7;d3.useColors=T7;d3.storage=D7();d3.destroy=(()=>{let _=!1;return()=>{if(!_)_=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();d3.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 T7(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let _;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(_=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(_[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function F7(_){if(_[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+_[0]+(this.useColors?"%c ":" ")+"+"+x1.exports.humanize(this.diff),!this.useColors)return;let q="color: "+this.color;_.splice(1,0,q,"color: inherit");let $=0,Q=0;_[0].replace(/%[a-zA-Z%]/g,(x)=>{if(x==="%%")return;if($++,x==="%c")Q=$}),_.splice(Q,0,q)}d3.log=console.debug||console.log||(()=>{});function R7(_){try{if(_)d3.storage.setItem("debug",_);else d3.storage.removeItem("debug")}catch(q){}}function S7(){let _;try{_=d3.storage.getItem("debug")||d3.storage.getItem("DEBUG")}catch(q){}if(!_&&typeof process<"u"&&"env"in process)_=process.env.DEBUG;return _}function D7(){try{return localStorage}catch(_){}}x1.exports=n2()(d3);var{formatters:N7}=x1.exports;N7.j=function(_){try{return JSON.stringify(_)}catch(q){return"[UnexpectedJSONParseError]: "+q.message}}});var n3=A((p3,V1)=>{var b7=j("tty"),X1=j("util");p3.init=s7;p3.log=f7;p3.formatArgs=l7;p3.save=i7;p3.load=p7;p3.useColors=c7;p3.destroy=X1.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");p3.colors=[6,2,3,4,5,1];try{let _=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(_&&(_.stderr||_).level>=2)p3.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(_){}p3.inspectOpts=Object.keys(process.env).filter((_)=>{return/^debug_/i.test(_)}).reduce((_,q)=>{let $=q.substring(6).toLowerCase().replace(/_([a-z])/g,(x,X)=>{return X.toUpperCase()}),Q=process.env[q];if(/^(yes|on|true|enabled)$/i.test(Q))Q=!0;else if(/^(no|off|false|disabled)$/i.test(Q))Q=!1;else if(Q==="null")Q=null;else Q=Number(Q);return _[$]=Q,_},{});function c7(){return"colors"in p3.inspectOpts?Boolean(p3.inspectOpts.colors):b7.isatty(process.stderr.fd)}function l7(_){let{namespace:q,useColors:$}=this;if($){let Q=this.color,x="\x1B[3"+(Q<8?Q:"8;5;"+Q),X=` ${x};1m${q} \x1B[0m`;_[0]=X+_[0].split(`
3
3
  `).join(`
4
- `+X),_.push(x+"m+"+J1.exports.humanize(this.diff)+"\x1B[0m")}else _[0]=e7()+q+" "+_[0]}function e7(){if(_8.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function _q(..._){return process.stderr.write(V1.formatWithOptions(_8.inspectOpts,..._)+`
5
- `)}function qq(_){if(_)process.env.DEBUG=_;else delete process.env.DEBUG}function $q(){return process.env.DEBUG}function Qq(_){_.inspectOpts={};let q=Object.keys(_8.inspectOpts);for(let $=0;$<q.length;$++)_.inspectOpts[q[$]]=_8.inspectOpts[q[$]]}J1.exports=o2()(_8);var{formatters:e3}=J1.exports;e3.o=function(_){return this.inspectOpts.colors=this.useColors,V1.inspect(_,this.inspectOpts).split(`
6
- `).map((q)=>q.trim()).join(" ")};e3.O=function(_){return this.inspectOpts.colors=this.useColors,V1.inspect(_,this.inspectOpts)}});var Q8=I((oX,e2)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)e2.exports=a3();else e2.exports=$8()});var V8=I((tX,X8)=>{X8.exports=x8;function x8(_,q){if(_&&q)return x8(_)(q);if(typeof _!=="function")throw TypeError("need wrapper function");return Object.keys(_).forEach(function(Q){$[Q]=_[Q]}),$;function $(){var Q=Array(arguments.length);for(var x=0;x<Q.length;x++)Q[x]=arguments[x];var X=_.apply(this,Q),V=Q[Q.length-1];if(typeof X==="function"&&X!==V)Object.keys(V).forEach(function(J){X[J]=V[J]});return X}}});var q9=I((rX,_9)=>{var J8=V8();_9.exports=J8(K1);_9.exports.strict=J8(K8);K1.proto=K1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return K1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return K8(this)},configurable:!0})});function K1(_){var q=function(){if(q.called)return q.value;return q.called=!0,q.value=_.apply(this,arguments)};return q.called=!1,q}function K8(_){var q=function(){if(q.called)throw Error(q.onceError);return q.called=!0,q.value=_.apply(this,arguments)},$=_.name||"Function wrapped with `once`";return q.onceError=$+" shouldn't be called more than once",q.called=!1,q}});var Y8=I((eX,G8)=>{var Yq=q9(),Hq=function(){},Wq=global.Bare?queueMicrotask:process.nextTick.bind(process),vq=function(_){return _.setHeader&&typeof _.abort==="function"},wq=function(_){return _.stdio&&Array.isArray(_.stdio)&&_.stdio.length===3},Z8=function(_,q,$){if(typeof q==="function")return Z8(_,null,q);if(!q)q={};$=Yq($||Hq);var{_writableState:Q,_readableState:x}=_,X=q.readable||q.readable!==!1&&_.readable,V=q.writable||q.writable!==!1&&_.writable,J=!1,K=function(){if(!_.writable)G()},G=function(){if(V=!1,!X)$.call(_)},Z=function(){if(X=!1,!V)$.call(_)},Y=function(M){$.call(_,M?Error("exited with error code: "+M):null)},H=function(M){$.call(_,M)},w=function(){Wq(L)},L=function(){if(J)return;if(X&&!(x&&(x.ended&&!x.destroyed)))return $.call(_,Error("premature close"));if(V&&!(Q&&(Q.ended&&!Q.destroyed)))return $.call(_,Error("premature close"))},z=function(){_.req.on("finish",G)};if(vq(_))if(_.on("complete",G),_.on("abort",w),_.req)z();else _.on("request",z);else if(V&&!Q)_.on("end",K),_.on("close",K);if(wq(_))_.on("exit",Y);if(_.on("end",Z),_.on("finish",G),q.error!==!1)_.on("error",H);return _.on("close",w),function(){if(J=!0,_.removeListener("complete",G),_.removeListener("abort",w),_.removeListener("request",z),_.req)_.req.removeListener("finish",G);_.removeListener("end",K),_.removeListener("close",K),_.removeListener("finish",G),_.removeListener("exit",Y),_.removeListener("end",Z),_.removeListener("error",H),_.removeListener("close",w)}};G8.exports=Z8});var v8=I((_V,W8)=>{var Lq=q9(),zq=Y8(),Z1;try{Z1=C("fs")}catch(_){}var X6=function(){},Mq=typeof process>"u"?!1:/^v?\.0/.test(process.version),G1=function(_){return typeof _==="function"},Pq=function(_){if(!Mq)return!1;if(!Z1)return!1;return(_ instanceof(Z1.ReadStream||X6)||_ instanceof(Z1.WriteStream||X6))&&G1(_.close)},Uq=function(_){return _.setHeader&&G1(_.abort)},Oq=function(_,q,$,Q){Q=Lq(Q);var x=!1;_.on("close",function(){x=!0}),zq(_,{readable:q,writable:$},function(V){if(V)return Q(V);x=!0,Q()});var X=!1;return function(V){if(x)return;if(X)return;if(X=!0,Pq(_))return _.close(X6);if(Uq(_))return _.abort();if(G1(_.destroy))return _.destroy();Q(V||Error("stream was destroyed"))}},H8=function(_){_()},jq=function(_,q){return _.pipe(q)},Cq=function(){var _=Array.prototype.slice.call(arguments),q=G1(_[_.length-1]||X6)&&_.pop()||X6;if(Array.isArray(_[0]))_=_[0];if(_.length<2)throw Error("pump requires two streams per minimum");var $,Q=_.map(function(x,X){var V=X<_.length-1,J=X>0;return Oq(x,V,J,function(K){if(!$)$=K;if(K)Q.forEach(H8);if(V)return;Q.forEach(H8),q($)})});return _.reduce(jq)};W8.exports=Cq});var L8=I((qV,w8)=>{var{PassThrough:Bq}=C("stream");w8.exports=(_)=>{_={..._};let{array:q}=_,{encoding:$}=_,Q=$==="buffer",x=!1;if(q)x=!($||Q);else $=$||"utf8";if(Q)$=null;let X=new Bq({objectMode:x});if($)X.setEncoding($);let V=0,J=[];return X.on("data",(K)=>{if(J.push(K),x)V=J.length;else V+=K.length}),X.getBufferedValue=()=>{if(q)return J;return Q?Buffer.concat(J,V):J.join("")},X.getBufferedLength=()=>V,X}});var z8=I(($V,F_)=>{var{constants:Iq}=C("buffer"),Aq=v8(),Tq=L8();class $9 extends Error{constructor(){super("maxBuffer exceeded");this.name="MaxBufferError"}}async function Y1(_,q){if(!_)return Promise.reject(Error("Expected a stream"));q={maxBuffer:1/0,...q};let{maxBuffer:$}=q,Q;return await new Promise((x,X)=>{let V=(J)=>{if(J&&Q.getBufferedLength()<=Iq.MAX_LENGTH)J.bufferedData=Q.getBufferedValue();X(J)};Q=Aq(_,Tq(q),(J)=>{if(J){V(J);return}x()}),Q.on("data",()=>{if(Q.getBufferedLength()>$)V(new $9)})}),Q.getBufferedValue()}F_.exports=Y1;F_.exports.default=Y1;F_.exports.buffer=(_,q)=>Y1(_,{...q,encoding:"buffer"});F_.exports.array=(_,q)=>Y1(_,{...q,array:!0});F_.exports.MaxBufferError=$9});var O8=I((QV,U8)=>{U8.exports=H1;function H1(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}H1.prototype.go=function(_){if(this.pending<this.max)P8(this,_);else this.waiting.push(_)};H1.prototype.wait=function(_){if(this.pending===0)_(this.error);else this.listeners.push(_)};H1.prototype.hold=function(){return M8(this)};function M8(_){_.pending+=1;var q=!1;return $;function $(x){if(q)throw Error("callback called twice");if(q=!0,_.error=_.error||x,_.pending-=1,_.waiting.length>0&&_.pending<_.max)P8(_,_.waiting.shift());else if(_.pending===0){var X=_.listeners;_.listeners=[],X.forEach(Q)}}function Q(x){x(_.error)}}function P8(_,q){q(M8(_))}});var C8=I((Nq)=>{var V6=C("fs"),W1=C("util"),Q9=C("stream"),j8=Q9.Readable,x9=Q9.Writable,Fq=Q9.PassThrough,Rq=O8(),v1=C("events").EventEmitter;Nq.createFromBuffer=Dq;Nq.createFromFd=Sq;Nq.BufferSlicer=O0;Nq.FdSlicer=U0;W1.inherits(U0,v1);function U0(_,q){q=q||{},v1.call(this),this.fd=_,this.pend=new Rq,this.pend.max=1,this.refCount=0,this.autoClose=!!q.autoClose}U0.prototype.read=function(_,q,$,Q,x){var X=this;X.pend.go(function(V){V6.read(X.fd,_,q,$,Q,function(J,K,G){V(),x(J,K,G)})})};U0.prototype.write=function(_,q,$,Q,x){var X=this;X.pend.go(function(V){V6.write(X.fd,_,q,$,Q,function(J,K,G){V(),x(J,K,G)})})};U0.prototype.createReadStream=function(_){return new w1(this,_)};U0.prototype.createWriteStream=function(_){return new L1(this,_)};U0.prototype.ref=function(){this.refCount+=1};U0.prototype.unref=function(){var _=this;if(_.refCount-=1,_.refCount>0)return;if(_.refCount<0)throw Error("invalid unref");if(_.autoClose)V6.close(_.fd,q);function q($){if($)_.emit("error",$);else _.emit("close")}};W1.inherits(w1,j8);function w1(_,q){q=q||{},j8.call(this,q),this.context=_,this.context.ref(),this.start=q.start||0,this.endOffset=q.end,this.pos=this.start,this.destroyed=!1}w1.prototype._read=function(_){var q=this;if(q.destroyed)return;var $=Math.min(q._readableState.highWaterMark,_);if(q.endOffset!=null)$=Math.min($,q.endOffset-q.pos);if($<=0){q.destroyed=!0,q.push(null),q.context.unref();return}q.context.pend.go(function(Q){if(q.destroyed)return Q();var x=Buffer.allocUnsafe($);V6.read(q.context.fd,x,0,$,q.pos,function(X,V){if(X)q.destroy(X);else if(V===0)q.destroyed=!0,q.push(null),q.context.unref();else q.pos+=V,q.push(x.slice(0,V));Q()})})};w1.prototype.destroy=function(_){if(this.destroyed)return;_=_||Error("stream destroyed"),this.destroyed=!0,this.emit("error",_),this.context.unref()};W1.inherits(L1,x9);function L1(_,q){q=q||{},x9.call(this,q),this.context=_,this.context.ref(),this.start=q.start||0,this.endOffset=q.end==null?1/0:+q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}L1.prototype._write=function(_,q,$){var Q=this;if(Q.destroyed)return;if(Q.pos+_.length>Q.endOffset){var x=Error("maximum file length exceeded");x.code="ETOOBIG",Q.destroy(),$(x);return}Q.context.pend.go(function(X){if(Q.destroyed)return X();V6.write(Q.context.fd,_,0,_.length,Q.pos,function(V,J){if(V)Q.destroy(),X(),$(V);else Q.bytesWritten+=J,Q.pos+=J,Q.emit("progress"),X(),$()})})};L1.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};W1.inherits(O0,v1);function O0(_,q){v1.call(this),q=q||{},this.refCount=0,this.buffer=_,this.maxChunkSize=q.maxChunkSize||Number.MAX_SAFE_INTEGER}O0.prototype.read=function(_,q,$,Q,x){if(!(0<=q&&q<=_.length))throw RangeError("offset outside buffer: 0 <= "+q+" <= "+_.length);if(Q<0)throw RangeError("position is negative: "+Q);if(q+$>_.length)$=_.length-q;if(Q+$>this.buffer.length)$=this.buffer.length-Q;if($<=0){setImmediate(function(){x(null,0)});return}this.buffer.copy(_,q,Q,Q+$),setImmediate(function(){x(null,$)})};O0.prototype.write=function(_,q,$,Q,x){_.copy(this.buffer,Q,q,q+$),setImmediate(function(){x(null,$,_)})};O0.prototype.createReadStream=function(_){_=_||{};var q=new Fq(_);q.destroyed=!1,q.start=_.start||0,q.endOffset=_.end,q.pos=q.endOffset||this.buffer.length;var $=this.buffer.slice(q.start,q.pos),Q=0;while(!0){var x=Q+this.maxChunkSize;if(x>=$.length){if(Q<$.length)q.write($.slice(Q,$.length));break}q.write($.slice(Q,x)),Q=x}return q.end(),q.destroy=function(){q.destroyed=!0},q};O0.prototype.createWriteStream=function(_){var q=this;_=_||{};var $=new x9(_);return $.start=_.start||0,$.endOffset=_.end==null?this.buffer.length:+_.end,$.bytesWritten=0,$.pos=$.start,$.destroyed=!1,$._write=function(Q,x,X){if($.destroyed)return;var V=$.pos+Q.length;if(V>$.endOffset){var J=Error("maximum file length exceeded");J.code="ETOOBIG",$.destroyed=!0,X(J);return}Q.copy(q.buffer,$.pos,0,Q.length),$.bytesWritten+=Q.length,$.pos=V,$.emit("progress"),X()},$.destroy=function(){$.destroyed=!0},$};O0.prototype.ref=function(){this.refCount+=1};O0.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function Dq(_,q){return new O0(_,q)}function Sq(_,q){return new U0(_,q)}});var A8=I((XV,I8)=>{var E0=C("buffer").Buffer,X9=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")X9=new Int32Array(X9);function B8(_){if(E0.isBuffer(_))return _;var q=typeof E0.alloc==="function"&&typeof E0.from==="function";if(typeof _==="number")return q?E0.alloc(_):new E0(_);else if(typeof _==="string")return q?E0.from(_):new E0(_);else throw Error("input must be buffer, number, or string, received "+typeof _)}function kq(_){var q=B8(4);return q.writeInt32BE(_,0),q}function V9(_,q){if(_=B8(_),E0.isBuffer(q))q=q.readUInt32BE(0);var $=~~q^-1;for(var Q=0;Q<_.length;Q++)$=X9[($^_[Q])&255]^$>>>8;return $^-1}function J9(){return kq(V9.apply(null,arguments))}J9.signed=function(){return V9.apply(null,arguments)};J9.unsigned=function(){return V9.apply(null,arguments)>>>0};I8.exports=J9});var u8=I((fq)=>{var K9=C("fs"),mq=C("zlib"),T8=C8(),Eq=A8(),P1=C("util"),U1=C("events").EventEmitter,F8=C("stream").Transform,G9=C("stream").PassThrough,bq=C("stream").Writable;fq.open=cq;fq.fromFd=R8;fq.fromBuffer=lq;fq.fromRandomAccessReader=Y9;fq.dosDateTimeToDate=N8;fq.getFileNameLowLevel=h8;fq.validateFileName=g8;fq.parseExtraFields=y8;fq.ZipFile=H0;fq.Entry=J6;fq.LocalFileHeader=S8;fq.RandomAccessReader=b0;function cq(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose==null)q.autoClose=!0;if(q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;if($==null)$=M1;K9.open(_,"r",function(Q,x){if(Q)return $(Q);R8(x,q,function(X,V){if(X)K9.close(x,M1);$(X,V)})})}function R8(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose==null)q.autoClose=!1;if(q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;if($==null)$=M1;K9.fstat(_,function(Q,x){if(Q)return $(Q);var X=T8.createFromFd(_,{autoClose:!0});Y9(X,x.size,q,$)})}function lq(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose=!1,q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;var Q=T8.createFromBuffer(_,{maxChunkSize:65536});Y9(Q,_.length,q,$)}function Y9(_,q,$,Q){if(typeof $==="function")Q=$,$=null;if($==null)$={};if($.autoClose==null)$.autoClose=!0;if($.lazyEntries==null)$.lazyEntries=!1;if($.decodeStrings==null)$.decodeStrings=!0;var x=!!$.decodeStrings;if($.validateEntrySizes==null)$.validateEntrySizes=!0;if($.strictFileNames==null)$.strictFileNames=!1;if(Q==null)Q=M1;if(typeof q!=="number")throw Error("expected totalSize parameter to be a number");if(q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");_.ref();var X=22,V=20,J=65535,K=Math.min(V+X+J,q),G=j0(K),Z=q-G.length;D_(_,G,0,K,Z,function(Y){if(Y)return Q(Y);for(var H=K-X;H>=0;H-=1){if(G.readUInt32LE(H)!==101010256)continue;var w=G.subarray(H),L=w.readUInt16LE(4),z=w.readUInt16LE(10),M=w.readUInt32LE(16),u=w.readUInt16LE(20),f=w.length-X;if(u!==f)return Q(Error("Invalid comment length. Expected: "+f+". Found: "+u+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var G6=x?z1(w.subarray(22),!1):w.subarray(22);if(H-V>=0&&G.readUInt32LE(H-V)===117853008){var K_=G.subarray(H-V,H-V+V),I9=R_(K_,8),x0=j0(56);return D_(_,x0,0,x0.length,I9,function(Y6){if(Y6)return Q(Y6);if(x0.readUInt32LE(0)!==101075792)return Q(Error("invalid zip64 end of central directory record signature"));if(L=x0.readUInt32LE(16),L!==0)return Q(Error("multi-disk zip files are not supported: found disk number: "+L));return z=R_(x0,32),M=R_(x0,48),Q(null,new H0(_,M,q,z,G6,$.autoClose,$.lazyEntries,x,$.validateEntrySizes,$.strictFileNames))})}if(L!==0)return Q(Error("multi-disk zip files are not supported: found disk number: "+L));return Q(null,new H0(_,M,q,z,G6,$.autoClose,$.lazyEntries,x,$.validateEntrySizes,$.strictFileNames))}Q(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}P1.inherits(H0,U1);function H0(_,q,$,Q,x,X,V,J,K,G){var Z=this;if(U1.call(Z),Z.reader=_,Z.reader.on("error",function(Y){D8(Z,Y)}),Z.reader.once("close",function(){Z.emit("close")}),Z.readEntryCursor=q,Z.fileSize=$,Z.entryCount=Q,Z.comment=x,Z.entriesRead=0,Z.autoClose=!!X,Z.lazyEntries=!!V,Z.decodeStrings=!!J,Z.validateEntrySizes=!!K,Z.strictFileNames=!!G,Z.isOpen=!0,Z.emittedError=!1,!Z.lazyEntries)Z._readEntry()}H0.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function Y0(_,q){if(_.autoClose)_.close();D8(_,q)}function D8(_,q){if(_.emittedError)return;_.emittedError=!0,_.emit("error",q)}H0.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};H0.prototype._readEntry=function(){var _=this;if(_.entryCount===_.entriesRead){setImmediate(function(){if(_.autoClose)_.close();if(_.emittedError)return;_.emit("end")});return}if(_.emittedError)return;var q=j0(46);D_(_.reader,q,0,q.length,_.readEntryCursor,function($){if($)return Y0(_,$);if(_.emittedError)return;var Q=new J6,x=q.readUInt32LE(0);if(x!==33639248)return Y0(_,Error("invalid central directory file header signature: 0x"+x.toString(16)));if(Q.versionMadeBy=q.readUInt16LE(4),Q.versionNeededToExtract=q.readUInt16LE(6),Q.generalPurposeBitFlag=q.readUInt16LE(8),Q.compressionMethod=q.readUInt16LE(10),Q.lastModFileTime=q.readUInt16LE(12),Q.lastModFileDate=q.readUInt16LE(14),Q.crc32=q.readUInt32LE(16),Q.compressedSize=q.readUInt32LE(20),Q.uncompressedSize=q.readUInt32LE(24),Q.fileNameLength=q.readUInt16LE(28),Q.extraFieldLength=q.readUInt16LE(30),Q.fileCommentLength=q.readUInt16LE(32),Q.internalFileAttributes=q.readUInt16LE(36),Q.externalFileAttributes=q.readUInt32LE(38),Q.relativeOffsetOfLocalHeader=q.readUInt32LE(42),Q.generalPurposeBitFlag&64)return Y0(_,Error("strong encryption is not supported"));_.readEntryCursor+=46,q=j0(Q.fileNameLength+Q.extraFieldLength+Q.fileCommentLength),D_(_.reader,q,0,q.length,_.readEntryCursor,function(X){if(X)return Y0(_,X);if(_.emittedError)return;Q.fileNameRaw=q.subarray(0,Q.fileNameLength);var V=Q.fileNameLength+Q.extraFieldLength;Q.extraFieldRaw=q.subarray(Q.fileNameLength,V),Q.fileCommentRaw=q.subarray(V,V+Q.fileCommentLength);try{Q.extraFields=y8(Q.extraFieldRaw)}catch(z){return Y0(_,z)}if(_.decodeStrings){var J=(Q.generalPurposeBitFlag&2048)!==0;Q.fileComment=z1(Q.fileCommentRaw,J),Q.fileName=h8(Q.generalPurposeBitFlag,Q.fileNameRaw,Q.extraFields,_.strictFileNames);var K=g8(Q.fileName);if(K!=null)return Y0(_,Error(K))}else Q.fileComment=Q.fileCommentRaw,Q.fileName=Q.fileNameRaw;Q.comment=Q.fileComment,_.readEntryCursor+=q.length,_.entriesRead+=1;for(var G=0;G<Q.extraFields.length;G++){var Z=Q.extraFields[G];if(Z.id!==1)continue;var Y=Z.data,H=0;if(Q.uncompressedSize===4294967295){if(H+8>Y.length)return Y0(_,Error("zip64 extended information extra field does not include uncompressed size"));Q.uncompressedSize=R_(Y,H),H+=8}if(Q.compressedSize===4294967295){if(H+8>Y.length)return Y0(_,Error("zip64 extended information extra field does not include compressed size"));Q.compressedSize=R_(Y,H),H+=8}if(Q.relativeOffsetOfLocalHeader===4294967295){if(H+8>Y.length)return Y0(_,Error("zip64 extended information extra field does not include relative header offset"));Q.relativeOffsetOfLocalHeader=R_(Y,H),H+=8}break}if(_.validateEntrySizes&&Q.compressionMethod===0){var w=Q.uncompressedSize;if(Q.isEncrypted())w+=12;if(Q.compressedSize!==w){var L="compressed/uncompressed size mismatch for stored file: "+Q.compressedSize+" != "+Q.uncompressedSize;return Y0(_,Error(L))}}if(_.emit("entry",Q),!_.lazyEntries)_._readEntry()})})};H0.prototype.openReadStream=function(_,q,$){var Q=this,x=0,X=_.compressedSize;if($==null)$=q,q=null;if(q==null)q={};else{if(q.decrypt!=null){if(!_.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(q.decrypt!==!1)throw Error("invalid options.decrypt value: "+q.decrypt);if(_.isCompressed()){if(q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(q.decompress!=null){if(!_.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(q.decompress===!1||q.decompress===!0))throw Error("invalid options.decompress value: "+q.decompress)}if(q.start!=null||q.end!=null){if(_.isCompressed()&&q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(_.isEncrypted()&&q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(q.start!=null){if(x=q.start,x<0)throw Error("options.start < 0");if(x>_.compressedSize)throw Error("options.start > entry.compressedSize")}if(q.end!=null){if(X=q.end,X<0)throw Error("options.end < 0");if(X>_.compressedSize)throw Error("options.end > entry.compressedSize");if(X<x)throw Error("options.end < options.start")}}if(!Q.isOpen)return $(Error("closed"));if(_.isEncrypted()){if(q.decrypt!==!1)return $(Error("entry is encrypted, and options.decrypt !== false"))}var V;if(_.compressionMethod===0)V=!1;else if(_.compressionMethod===8)V=q.decompress!=null?q.decompress:!0;else return $(Error("unsupported compression method: "+_.compressionMethod));Q.readLocalFileHeader(_,{minimal:!0},function(J,K){if(J)return $(J);Q.openReadStreamLowLevel(K.fileDataStart,_.compressedSize,x,X,V,_.uncompressedSize,$)})};H0.prototype.openReadStreamLowLevel=function(_,q,$,Q,x,X,V){var J=this,K=_+q,G=J.reader.createReadStream({start:_+$,end:_+Q}),Z=G;if(x){var Y=!1,H=mq.createInflateRaw();if(G.on("error",function(w){setImmediate(function(){if(!Y)H.emit("error",w)})}),G.pipe(H),J.validateEntrySizes)Z=new K6(X),H.on("error",function(w){setImmediate(function(){if(!Y)Z.emit("error",w)})}),H.pipe(Z);else Z=H;Z9(Z,function(){if(Y=!0,H!==Z)H.unpipe(Z);G.unpipe(H),G.destroy()})}V(null,Z)};H0.prototype.readLocalFileHeader=function(_,q,$){var Q=this;if($==null)$=q,q=null;if(q==null)q={};Q.reader.ref();var x=j0(30);D_(Q.reader,x,0,x.length,_.relativeOffsetOfLocalHeader,function(X){try{if(X)return $(X);var V=x.readUInt32LE(0);if(V!==67324752)return $(Error("invalid local file header signature: 0x"+V.toString(16)));var J=x.readUInt16LE(26),K=x.readUInt16LE(28),G=_.relativeOffsetOfLocalHeader+30+J+K;if(G+_.compressedSize>Q.fileSize)return $(Error("file data overflows file bounds: "+G+" + "+_.compressedSize+" > "+Q.fileSize));if(q.minimal)return $(null,{fileDataStart:G});var Z=new S8;Z.fileDataStart=G,Z.versionNeededToExtract=x.readUInt16LE(4),Z.generalPurposeBitFlag=x.readUInt16LE(6),Z.compressionMethod=x.readUInt16LE(8),Z.lastModFileTime=x.readUInt16LE(10),Z.lastModFileDate=x.readUInt16LE(12),Z.crc32=x.readUInt32LE(14),Z.compressedSize=x.readUInt32LE(18),Z.uncompressedSize=x.readUInt32LE(22),Z.fileNameLength=J,Z.extraFieldLength=K,x=j0(J+K),Q.reader.ref(),D_(Q.reader,x,0,x.length,_.relativeOffsetOfLocalHeader+30,function(Y){try{if(Y)return $(Y);return Z.fileName=x.subarray(0,J),Z.extraField=x.subarray(J),$(null,Z)}finally{Q.reader.unref()}})}finally{Q.reader.unref()}})};function J6(){}J6.prototype.getLastModDate=function(_){if(_==null)_={};if(!_.forceDosFormat)for(var q=0;q<this.extraFields.length;q++){var $=this.extraFields[q];if($.id===21589){var Q=$.data;if(Q.length<5)continue;var x=Q[0],X=1;if(!(x&X))continue;var V=Q.readInt32LE(1);return new Date(V*1000)}else if($.id===10){var Q=$.data,J=4;while(J<Q.length+4){var K=Q.readUInt16LE(J);J+=2;var G=Q.readUInt16LE(J);if(J+=2,K!==1){J+=G;continue}if(G<8||J+G>Q.length)break;var Z=4294967296*Q.readInt32LE(J+4)+Q.readUInt32LE(J),Y=Z/1e4-11644473600000;return new Date(Y)}}}return N8(this.lastModFileDate,this.lastModFileTime,_.timezone)};J6.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};J6.prototype.isCompressed=function(){return this.compressionMethod===8};function S8(){}function N8(_,q,$){var Q=_&31,x=(_>>5&15)-1,X=(_>>9&127)+1980,V=0,J=(q&31)*2,K=q>>5&63,G=q>>11&31;if($==null||$==="local")return new Date(X,x,Q,G,K,J,V);else if($==="UTC")return new Date(Date.UTC(X,x,Q,G,K,J,V));else throw Error("unrecognized options.timezone: "+options.timezone)}function h8(_,q,$,Q){var x=null;for(var X=0;X<$.length;X++){var V=$[X];if(V.id===28789){if(V.data.length<6)continue;if(V.data.readUInt8(0)!==1)continue;var J=V.data.readUInt32LE(1);if(Eq.unsigned(q)!==J)continue;x=z1(V.data.subarray(5),!0);break}}if(x==null){var K=(_&2048)!==0;x=z1(q,K)}if(!Q)x=x.replace(/\\/g,"/");return x}function g8(_){if(_.indexOf("\\")!==-1)return"invalid characters in fileName: "+_;if(/^[a-zA-Z]:/.test(_)||/^\//.test(_))return"absolute path: "+_;if(_.split("/").indexOf("..")!==-1)return"invalid relative path: "+_;return null}function y8(_){var q=[],$=0;while($<_.length-3){var Q=_.readUInt16LE($+0),x=_.readUInt16LE($+2),X=$+4,V=X+x;if(V>_.length)throw Error("extra field length exceeds extra field buffer size");var J=_.subarray(X,V);q.push({id:Q,data:J}),$=V}return q}function D_(_,q,$,Q,x,X){if(Q===0)return setImmediate(function(){X(null,j0(0))});_.read(q,$,Q,x,function(V,J){if(V)return X(V);if(J<Q)return X(Error("unexpected EOF"));X()})}P1.inherits(K6,F8);function K6(_){F8.call(this),this.actualByteCount=0,this.expectedByteCount=_}K6.prototype._transform=function(_,q,$){if(this.actualByteCount+=_.length,this.actualByteCount>this.expectedByteCount){var Q="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return $(Error(Q))}$(null,_)};K6.prototype._flush=function(_){if(this.actualByteCount<this.expectedByteCount){var q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return _(Error(q))}_()};P1.inherits(b0,U1);function b0(){U1.call(this),this.refCount=0}b0.prototype.ref=function(){this.refCount+=1};b0.prototype.unref=function(){var _=this;if(_.refCount-=1,_.refCount>0)return;if(_.refCount<0)throw Error("invalid unref");_.close(q);function q($){if($)return _.emit("error",$);_.emit("close")}};b0.prototype.createReadStream=function(_){if(_==null)_={};var{start:q,end:$}=_;if(q===$){var Q=new G9;return setImmediate(function(){Q.end()}),Q}var x=this._readStreamForRange(q,$),X=!1,V=new O1(this);x.on("error",function(K){setImmediate(function(){if(!X)V.emit("error",K)})}),Z9(V,function(){x.unpipe(V),V.unref(),x.destroy()});var J=new K6($-q);return V.on("error",function(K){setImmediate(function(){if(!X)J.emit("error",K)})}),Z9(J,function(){X=!0,V.unpipe(J),V.destroy()}),x.pipe(V).pipe(J)};b0.prototype._readStreamForRange=function(_,q){throw Error("not implemented")};b0.prototype.read=function(_,q,$,Q,x){var X=this.createReadStream({start:Q,end:Q+$}),V=new bq,J=0;V._write=function(K,G,Z){K.copy(_,q+J,0,K.length),J+=K.length,Z()},V.on("finish",x),X.on("error",function(K){x(K)}),X.pipe(V)};b0.prototype.close=function(_){setImmediate(_)};P1.inherits(O1,G9);function O1(_){G9.call(this),this.context=_,this.context.ref(),this.unreffedYet=!1}O1.prototype._flush=function(_){this.unref(),_()};O1.prototype.unref=function(_){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var dq="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function z1(_,q){if(q)return _.toString("utf8");else{var $="";for(var Q=0;Q<_.length;Q++)$+=dq[_[Q]];return $}}function R_(_,q){var $=_.readUInt32LE(q),Q=_.readUInt32LE(q+4);return Q*4294967296+$}var j0;if(typeof Buffer.allocUnsafe==="function")j0=function(_){return Buffer.allocUnsafe(_)};else j0=function(_){return new Buffer(_)};function Z9(_,q){if(typeof _.destroy==="function")_._destroy=function($,Q){if(q(),Q!=null)Q($)};else _.destroy=q}function M1(_){if(_)throw _}});var E8=I((JV,m8)=>{var $0=Q8()("extract-zip"),{createWriteStream:Q$,promises:S_}=C("fs"),x$=z8(),V_=C("path"),{promisify:H9}=C("util"),X$=C("stream"),V$=u8(),J$=H9(V$.open),K$=H9(X$.pipeline);class k8{constructor(_,q){this.zipPath=_,this.opts=q}async extract(){return $0("opening",this.zipPath,"with opts",this.opts),this.zipfile=await J$(this.zipPath,{lazyEntries:!0}),this.canceled=!1,new Promise((_,q)=>{this.zipfile.on("error",($)=>{this.canceled=!0,q($)}),this.zipfile.readEntry(),this.zipfile.on("close",()=>{if(!this.canceled)$0("zip extraction complete"),_()}),this.zipfile.on("entry",async($)=>{if(this.canceled){$0("skipping entry",$.fileName,{cancelled:this.canceled});return}if($0("zipfile entry",$.fileName),$.fileName.startsWith("__MACOSX/")){this.zipfile.readEntry();return}let Q=V_.dirname(V_.join(this.opts.dir,$.fileName));try{await S_.mkdir(Q,{recursive:!0});let x=await S_.realpath(Q);if(V_.relative(this.opts.dir,x).split(V_.sep).includes(".."))throw Error(`Out of bound path "${x}" found while processing file ${$.fileName}`);await this.extractEntry($),$0("finished processing",$.fileName),this.zipfile.readEntry()}catch(x){this.canceled=!0,this.zipfile.close(),q(x)}})})}async extractEntry(_){if(this.canceled){$0("skipping entry extraction",_.fileName,{cancelled:this.canceled});return}if(this.opts.onEntry)this.opts.onEntry(_,this.zipfile);let q=V_.join(this.opts.dir,_.fileName),$=_.externalFileAttributes>>16&65535,Q=61440,x=16384,X=40960,V=($&Q)===X,J=($&Q)===x;if(!J&&_.fileName.endsWith("/"))J=!0;let K=_.versionMadeBy>>8;if(!J)J=K===0&&_.externalFileAttributes===16;$0("extracting entry",{filename:_.fileName,isDir:J,isSymlink:V});let G=this.getExtractedMode($,J)&511,Z=J?q:V_.dirname(q),Y={recursive:!0};if(J)Y.mode=G;if($0("mkdir",{dir:Z,...Y}),await S_.mkdir(Z,Y),J)return;$0("opening read stream",q);let H=await H9(this.zipfile.openReadStream.bind(this.zipfile))(_);if(V){let w=await x$(H);$0("creating symlink",w,q),await S_.symlink(w,q)}else await K$(H,Q$(q,{mode:G}))}getExtractedMode(_,q){let $=_;if($===0)if(q){if(this.opts.defaultDirMode)$=parseInt(this.opts.defaultDirMode,10);if(!$)$=493}else{if(this.opts.defaultFileMode)$=parseInt(this.opts.defaultFileMode,10);if(!$)$=420}return $}}m8.exports=async function(_,q){if($0("creating target directory",q.dir),!V_.isAbsolute(q.dir))throw Error("Target directory is expected to be absolute");return await S_.mkdir(q.dir,{recursive:!0}),q.dir=await S_.realpath(q.dir),new k8(_,q).extract()}});var W9=I((KV,b8)=>{var Z$=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(..._)=>console.error("SEMVER",..._):()=>{};b8.exports=Z$});var v9=I((ZV,c8)=>{var G$=Number.MAX_SAFE_INTEGER||9007199254740991,Y$=["major","premajor","minor","preminor","patch","prepatch","prerelease"];c8.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:G$,RELEASE_TYPES:Y$,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var d8=I((W0,l8)=>{var{MAX_SAFE_COMPONENT_LENGTH:w9,MAX_SAFE_BUILD_LENGTH:H$,MAX_LENGTH:W$}=v9(),v$=W9();W0=l8.exports={};var w$=W0.re=[],L$=W0.safeRe=[],W=W0.src=[],z$=W0.safeSrc=[],v=W0.t={},M$=0,L9="[a-zA-Z0-9-]",P$=[["\\s",1],["\\d",W$],[L9,H$]],U$=(_)=>{for(let[q,$]of P$)_=_.split(`${q}*`).join(`${q}{0,${$}}`).split(`${q}+`).join(`${q}{1,${$}}`);return _},P=(_,q,$)=>{let Q=U$(q),x=M$++;v$(_,x,q),v[_]=x,W[x]=q,z$[x]=Q,w$[x]=new RegExp(q,$?"g":void 0),L$[x]=new RegExp(Q,$?"g":void 0)};P("NUMERICIDENTIFIER","0|[1-9]\\d*");P("NUMERICIDENTIFIERLOOSE","\\d+");P("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${L9}*`);P("MAINVERSION",`(${W[v.NUMERICIDENTIFIER]})\\.(${W[v.NUMERICIDENTIFIER]})\\.(${W[v.NUMERICIDENTIFIER]})`);P("MAINVERSIONLOOSE",`(${W[v.NUMERICIDENTIFIERLOOSE]})\\.(${W[v.NUMERICIDENTIFIERLOOSE]})\\.(${W[v.NUMERICIDENTIFIERLOOSE]})`);P("PRERELEASEIDENTIFIER",`(?:${W[v.NONNUMERICIDENTIFIER]}|${W[v.NUMERICIDENTIFIER]})`);P("PRERELEASEIDENTIFIERLOOSE",`(?:${W[v.NONNUMERICIDENTIFIER]}|${W[v.NUMERICIDENTIFIERLOOSE]})`);P("PRERELEASE",`(?:-(${W[v.PRERELEASEIDENTIFIER]}(?:\\.${W[v.PRERELEASEIDENTIFIER]})*))`);P("PRERELEASELOOSE",`(?:-?(${W[v.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${W[v.PRERELEASEIDENTIFIERLOOSE]})*))`);P("BUILDIDENTIFIER",`${L9}+`);P("BUILD",`(?:\\+(${W[v.BUILDIDENTIFIER]}(?:\\.${W[v.BUILDIDENTIFIER]})*))`);P("FULLPLAIN",`v?${W[v.MAINVERSION]}${W[v.PRERELEASE]}?${W[v.BUILD]}?`);P("FULL",`^${W[v.FULLPLAIN]}$`);P("LOOSEPLAIN",`[v=\\s]*${W[v.MAINVERSIONLOOSE]}${W[v.PRERELEASELOOSE]}?${W[v.BUILD]}?`);P("LOOSE",`^${W[v.LOOSEPLAIN]}$`);P("GTLT","((?:<|>)?=?)");P("XRANGEIDENTIFIERLOOSE",`${W[v.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);P("XRANGEIDENTIFIER",`${W[v.NUMERICIDENTIFIER]}|x|X|\\*`);P("XRANGEPLAIN",`[v=\\s]*(${W[v.XRANGEIDENTIFIER]})(?:\\.(${W[v.XRANGEIDENTIFIER]})(?:\\.(${W[v.XRANGEIDENTIFIER]})(?:${W[v.PRERELEASE]})?${W[v.BUILD]}?)?)?`);P("XRANGEPLAINLOOSE",`[v=\\s]*(${W[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${W[v.XRANGEIDENTIFIERLOOSE]})(?:\\.(${W[v.XRANGEIDENTIFIERLOOSE]})(?:${W[v.PRERELEASELOOSE]})?${W[v.BUILD]}?)?)?`);P("XRANGE",`^${W[v.GTLT]}\\s*${W[v.XRANGEPLAIN]}$`);P("XRANGELOOSE",`^${W[v.GTLT]}\\s*${W[v.XRANGEPLAINLOOSE]}$`);P("COERCEPLAIN",`(^|[^\\d])(\\d{1,${w9}})(?:\\.(\\d{1,${w9}}))?(?:\\.(\\d{1,${w9}}))?`);P("COERCE",`${W[v.COERCEPLAIN]}(?:$|[^\\d])`);P("COERCEFULL",W[v.COERCEPLAIN]+`(?:${W[v.PRERELEASE]})?(?:${W[v.BUILD]})?(?:$|[^\\d])`);P("COERCERTL",W[v.COERCE],!0);P("COERCERTLFULL",W[v.COERCEFULL],!0);P("LONETILDE","(?:~>?)");P("TILDETRIM",`(\\s*)${W[v.LONETILDE]}\\s+`,!0);W0.tildeTrimReplace="$1~";P("TILDE",`^${W[v.LONETILDE]}${W[v.XRANGEPLAIN]}$`);P("TILDELOOSE",`^${W[v.LONETILDE]}${W[v.XRANGEPLAINLOOSE]}$`);P("LONECARET","(?:\\^)");P("CARETTRIM",`(\\s*)${W[v.LONECARET]}\\s+`,!0);W0.caretTrimReplace="$1^";P("CARET",`^${W[v.LONECARET]}${W[v.XRANGEPLAIN]}$`);P("CARETLOOSE",`^${W[v.LONECARET]}${W[v.XRANGEPLAINLOOSE]}$`);P("COMPARATORLOOSE",`^${W[v.GTLT]}\\s*(${W[v.LOOSEPLAIN]})$|^$`);P("COMPARATOR",`^${W[v.GTLT]}\\s*(${W[v.FULLPLAIN]})$|^$`);P("COMPARATORTRIM",`(\\s*)${W[v.GTLT]}\\s*(${W[v.LOOSEPLAIN]}|${W[v.XRANGEPLAIN]})`,!0);W0.comparatorTrimReplace="$1$2$3";P("HYPHENRANGE",`^\\s*(${W[v.XRANGEPLAIN]})\\s+-\\s+(${W[v.XRANGEPLAIN]})\\s*$`);P("HYPHENRANGELOOSE",`^\\s*(${W[v.XRANGEPLAINLOOSE]})\\s+-\\s+(${W[v.XRANGEPLAINLOOSE]})\\s*$`);P("STAR","(<|>)?=?\\s*\\*");P("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");P("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var i8=I((GV,f8)=>{var O$=Object.freeze({loose:!0}),j$=Object.freeze({}),C$=(_)=>{if(!_)return j$;if(typeof _!=="object")return O$;return _};f8.exports=C$});var a8=I((YV,n8)=>{var p8=/^[0-9]+$/,s8=(_,q)=>{if(typeof _==="number"&&typeof q==="number")return _===q?0:_<q?-1:1;let $=p8.test(_),Q=p8.test(q);if($&&Q)_=+_,q=+q;return _===q?0:$&&!Q?-1:Q&&!$?1:_<q?-1:1},B$=(_,q)=>s8(q,_);n8.exports={compareIdentifiers:s8,rcompareIdentifiers:B$}});var r8=I((HV,t8)=>{var j1=W9(),{MAX_LENGTH:o8,MAX_SAFE_INTEGER:C1}=v9(),{safeRe:B1,t:I1}=d8(),I$=i8(),{compareIdentifiers:z9}=a8();class Q0{constructor(_,q){if(q=I$(q),_ instanceof Q0)if(_.loose===!!q.loose&&_.includePrerelease===!!q.includePrerelease)return _;else _=_.version;else if(typeof _!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof _}".`);if(_.length>o8)throw TypeError(`version is longer than ${o8} characters`);j1("SemVer",_,q),this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.includePrerelease;let $=_.trim().match(q.loose?B1[I1.LOOSE]:B1[I1.FULL]);if(!$)throw TypeError(`Invalid Version: ${_}`);if(this.raw=_,this.major=+$[1],this.minor=+$[2],this.patch=+$[3],this.major>C1||this.major<0)throw TypeError("Invalid major version");if(this.minor>C1||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>C1||this.patch<0)throw TypeError("Invalid patch version");if(!$[4])this.prerelease=[];else this.prerelease=$[4].split(".").map((Q)=>{if(/^[0-9]+$/.test(Q)){let x=+Q;if(x>=0&&x<C1)return x}return Q});this.build=$[5]?$[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(_){if(j1("SemVer.compare",this.version,this.options,_),!(_ instanceof Q0)){if(typeof _==="string"&&_===this.version)return 0;_=new Q0(_,this.options)}if(_.version===this.version)return 0;return this.compareMain(_)||this.comparePre(_)}compareMain(_){if(!(_ instanceof Q0))_=new Q0(_,this.options);if(this.major<_.major)return-1;if(this.major>_.major)return 1;if(this.minor<_.minor)return-1;if(this.minor>_.minor)return 1;if(this.patch<_.patch)return-1;if(this.patch>_.patch)return 1;return 0}comparePre(_){if(!(_ instanceof Q0))_=new Q0(_,this.options);if(this.prerelease.length&&!_.prerelease.length)return-1;else if(!this.prerelease.length&&_.prerelease.length)return 1;else if(!this.prerelease.length&&!_.prerelease.length)return 0;let q=0;do{let $=this.prerelease[q],Q=_.prerelease[q];if(j1("prerelease compare",q,$,Q),$===void 0&&Q===void 0)return 0;else if(Q===void 0)return 1;else if($===void 0)return-1;else if($===Q)continue;else return z9($,Q)}while(++q)}compareBuild(_){if(!(_ instanceof Q0))_=new Q0(_,this.options);let q=0;do{let $=this.build[q],Q=_.build[q];if(j1("build compare",q,$,Q),$===void 0&&Q===void 0)return 0;else if(Q===void 0)return 1;else if($===void 0)return-1;else if($===Q)continue;else return z9($,Q)}while(++q)}inc(_,q,$){if(_.startsWith("pre")){if(!q&&$===!1)throw Error("invalid increment argument: identifier is empty");if(q){let Q=`-${q}`.match(this.options.loose?B1[I1.PRERELEASELOOSE]:B1[I1.PRERELEASE]);if(!Q||Q[1]!==q)throw Error(`invalid identifier: ${q}`)}}switch(_){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",q,$);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",q,$);break;case"prepatch":this.prerelease.length=0,this.inc("patch",q,$),this.inc("pre",q,$);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",q,$);this.inc("pre",q,$);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let Q=Number($)?1:0;if(this.prerelease.length===0)this.prerelease=[Q];else{let x=this.prerelease.length;while(--x>=0)if(typeof this.prerelease[x]==="number")this.prerelease[x]++,x=-2;if(x===-1){if(q===this.prerelease.join(".")&&$===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(Q)}}if(q){let x=[q,Q];if($===!1)x=[q];if(z9(this.prerelease[0],q)===0){if(isNaN(this.prerelease[1]))this.prerelease=x}else this.prerelease=x}break}default:throw Error(`invalid increment argument: ${_}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}t8.exports=Q0});var q4=I((WV,_4)=>{var e8=r8(),A$=(_,q,$)=>new e8(_,$).compare(new e8(q,$));_4.exports=A$});var Q4=I((vV,$4)=>{var T$=q4(),F$=(_,q,$)=>T$(_,q,$)<0;$4.exports=F$});import r$ from"os";import e$ from"child_process";var J4=H6(R1(),1);import g$ from"path";import y$ from"fs";import K4 from"fs/promises";import T1 from"os";import s4 from"events";import E from"fs";import{EventEmitter as y1}from"node:events";import E9 from"node:stream";import{StringDecoder as k4}from"node:string_decoder";var y9=typeof process==="object"&&process?process:{stdout:null,stderr:null},m4=(_)=>!!_&&typeof _==="object"&&(_ instanceof c||_ instanceof E9||E4(_)||b4(_)),E4=(_)=>!!_&&typeof _==="object"&&_ instanceof y1&&typeof _.pipe==="function"&&_.pipe!==E9.Writable.prototype.pipe,b4=(_)=>!!_&&typeof _==="object"&&_ instanceof y1&&typeof _.write==="function"&&typeof _.end==="function",v0=Symbol("EOF"),w0=Symbol("maybeEmitEnd"),C0=Symbol("emittedEnd"),w6=Symbol("emittingEnd"),h_=Symbol("emittedError"),L6=Symbol("closed"),u9=Symbol("read"),z6=Symbol("flush"),k9=Symbol("flushChunk"),t=Symbol("encoding"),G_=Symbol("decoder"),S=Symbol("flowing"),g_=Symbol("paused"),Y_=Symbol("resume"),N=Symbol("buffer"),m=Symbol("pipes"),h=Symbol("bufferLength"),D1=Symbol("bufferPush"),M6=Symbol("bufferShift"),g=Symbol("objectMode"),F=Symbol("destroyed"),S1=Symbol("error"),N1=Symbol("emitData"),m9=Symbol("emitEnd"),h1=Symbol("emitEnd2"),X0=Symbol("async"),g1=Symbol("abort"),P6=Symbol("aborted"),y_=Symbol("signal"),l0=Symbol("dataListeners"),b=Symbol("discarded"),u_=(_)=>Promise.resolve().then(_),c4=(_)=>_(),l4=(_)=>_==="end"||_==="finish"||_==="prefinish",d4=(_)=>_ instanceof ArrayBuffer||!!_&&typeof _==="object"&&_.constructor&&_.constructor.name==="ArrayBuffer"&&_.byteLength>=0,f4=(_)=>!Buffer.isBuffer(_)&&ArrayBuffer.isView(_);class u1{src;dest;opts;ondrain;constructor(_,q,$){this.src=_,this.dest=q,this.opts=$,this.ondrain=()=>_[Y_](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(_){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class b9 extends u1{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(_,q,$){super(_,q,$);this.proxyErrors=(Q)=>q.emit("error",Q),_.on("error",this.proxyErrors)}}var i4=(_)=>!!_.objectMode,p4=(_)=>!_.objectMode&&!!_.encoding&&_.encoding!=="buffer";class c extends y1{[S]=!1;[g_]=!1;[m]=[];[N]=[];[g];[t];[X0];[G_];[v0]=!1;[C0]=!1;[w6]=!1;[L6]=!1;[h_]=null;[h]=0;[F]=!1;[y_];[P6]=!1;[l0]=0;[b]=!1;writable=!0;readable=!0;constructor(..._){let q=_[0]||{};super();if(q.objectMode&&typeof q.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(i4(q))this[g]=!0,this[t]=null;else if(p4(q))this[t]=q.encoding,this[g]=!1;else this[g]=!1,this[t]=null;if(this[X0]=!!q.async,this[G_]=this[t]?new k4(this[t]):null,q&&q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[N]});if(q&&q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[m]});let{signal:$}=q;if($)if(this[y_]=$,$.aborted)this[g1]();else $.addEventListener("abort",()=>this[g1]())}get bufferLength(){return this[h]}get encoding(){return this[t]}set encoding(_){throw Error("Encoding must be set at instantiation time")}setEncoding(_){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[g]}set objectMode(_){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[X0]}set["async"](_){this[X0]=this[X0]||!!_}[g1](){this[P6]=!0,this.emit("abort",this[y_]?.reason),this.destroy(this[y_]?.reason)}get aborted(){return this[P6]}set aborted(_){}write(_,q,$){if(this[P6])return!1;if(this[v0])throw Error("write after end");if(this[F])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof q==="function")$=q,q="utf8";if(!q)q="utf8";let Q=this[X0]?u_:c4;if(!this[g]&&!Buffer.isBuffer(_)){if(f4(_))_=Buffer.from(_.buffer,_.byteOffset,_.byteLength);else if(d4(_))_=Buffer.from(_);else if(typeof _!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[g]){if(this[S]&&this[h]!==0)this[z6](!0);if(this[S])this.emit("data",_);else this[D1](_);if(this[h]!==0)this.emit("readable");if($)Q($);return this[S]}if(!_.length){if(this[h]!==0)this.emit("readable");if($)Q($);return this[S]}if(typeof _==="string"&&!(q===this[t]&&!this[G_]?.lastNeed))_=Buffer.from(_,q);if(Buffer.isBuffer(_)&&this[t])_=this[G_].write(_);if(this[S]&&this[h]!==0)this[z6](!0);if(this[S])this.emit("data",_);else this[D1](_);if(this[h]!==0)this.emit("readable");if($)Q($);return this[S]}read(_){if(this[F])return null;if(this[b]=!1,this[h]===0||_===0||_&&_>this[h])return this[w0](),null;if(this[g])_=null;if(this[N].length>1&&!this[g])this[N]=[this[t]?this[N].join(""):Buffer.concat(this[N],this[h])];let q=this[u9](_||null,this[N][0]);return this[w0](),q}[u9](_,q){if(this[g])this[M6]();else{let $=q;if(_===$.length||_===null)this[M6]();else if(typeof $==="string")this[N][0]=$.slice(_),q=$.slice(0,_),this[h]-=_;else this[N][0]=$.subarray(_),q=$.subarray(0,_),this[h]-=_}if(this.emit("data",q),!this[N].length&&!this[v0])this.emit("drain");return q}end(_,q,$){if(typeof _==="function")$=_,_=void 0;if(typeof q==="function")$=q,q="utf8";if(_!==void 0)this.write(_,q);if($)this.once("end",$);if(this[v0]=!0,this.writable=!1,this[S]||!this[g_])this[w0]();return this}[Y_](){if(this[F])return;if(!this[l0]&&!this[m].length)this[b]=!0;if(this[g_]=!1,this[S]=!0,this.emit("resume"),this[N].length)this[z6]();else if(this[v0])this[w0]();else this.emit("drain")}resume(){return this[Y_]()}pause(){this[S]=!1,this[g_]=!0,this[b]=!1}get destroyed(){return this[F]}get flowing(){return this[S]}get paused(){return this[g_]}[D1](_){if(this[g])this[h]+=1;else this[h]+=_.length;this[N].push(_)}[M6](){if(this[g])this[h]-=1;else this[h]-=this[N][0].length;return this[N].shift()}[z6](_=!1){do;while(this[k9](this[M6]())&&this[N].length);if(!_&&!this[N].length&&!this[v0])this.emit("drain")}[k9](_){return this.emit("data",_),this[S]}pipe(_,q){if(this[F])return _;this[b]=!1;let $=this[C0];if(q=q||{},_===y9.stdout||_===y9.stderr)q.end=!1;else q.end=q.end!==!1;if(q.proxyErrors=!!q.proxyErrors,$){if(q.end)_.end()}else if(this[m].push(!q.proxyErrors?new u1(this,_,q):new b9(this,_,q)),this[X0])u_(()=>this[Y_]());else this[Y_]();return _}unpipe(_){let q=this[m].find(($)=>$.dest===_);if(q){if(this[m].length===1){if(this[S]&&this[l0]===0)this[S]=!1;this[m]=[]}else this[m].splice(this[m].indexOf(q),1);q.unpipe()}}addListener(_,q){return this.on(_,q)}on(_,q){let $=super.on(_,q);if(_==="data"){if(this[b]=!1,this[l0]++,!this[m].length&&!this[S])this[Y_]()}else if(_==="readable"&&this[h]!==0)super.emit("readable");else if(l4(_)&&this[C0])super.emit(_),this.removeAllListeners(_);else if(_==="error"&&this[h_]){let Q=q;if(this[X0])u_(()=>Q.call(this,this[h_]));else Q.call(this,this[h_])}return $}removeListener(_,q){return this.off(_,q)}off(_,q){let $=super.off(_,q);if(_==="data"){if(this[l0]=this.listeners("data").length,this[l0]===0&&!this[b]&&!this[m].length)this[S]=!1}return $}removeAllListeners(_){let q=super.removeAllListeners(_);if(_==="data"||_===void 0){if(this[l0]=0,!this[b]&&!this[m].length)this[S]=!1}return q}get emittedEnd(){return this[C0]}[w0](){if(!this[w6]&&!this[C0]&&!this[F]&&this[N].length===0&&this[v0]){if(this[w6]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[L6])this.emit("close");this[w6]=!1}}emit(_,...q){let $=q[0];if(_!=="error"&&_!=="close"&&_!==F&&this[F])return!1;else if(_==="data")return!this[g]&&!$?!1:this[X0]?(u_(()=>this[N1]($)),!0):this[N1]($);else if(_==="end")return this[m9]();else if(_==="close"){if(this[L6]=!0,!this[C0]&&!this[F])return!1;let x=super.emit("close");return this.removeAllListeners("close"),x}else if(_==="error"){this[h_]=$,super.emit(S1,$);let x=!this[y_]||this.listeners("error").length?super.emit("error",$):!1;return this[w0](),x}else if(_==="resume"){let x=super.emit("resume");return this[w0](),x}else if(_==="finish"||_==="prefinish"){let x=super.emit(_);return this.removeAllListeners(_),x}let Q=super.emit(_,...q);return this[w0](),Q}[N1](_){for(let $ of this[m])if($.dest.write(_)===!1)this.pause();let q=this[b]?!1:super.emit("data",_);return this[w0](),q}[m9](){if(this[C0])return!1;return this[C0]=!0,this.readable=!1,this[X0]?(u_(()=>this[h1]()),!0):this[h1]()}[h1](){if(this[G_]){let q=this[G_].end();if(q){for(let $ of this[m])$.dest.write(q);if(!this[b])super.emit("data",q)}}for(let q of this[m])q.end();let _=super.emit("end");return this.removeAllListeners("end"),_}async collect(){let _=Object.assign([],{dataLength:0});if(!this[g])_.dataLength=0;let q=this.promise();return this.on("data",($)=>{if(_.push($),!this[g])_.dataLength+=$.length}),await q,_}async concat(){if(this[g])throw Error("cannot concat in objectMode");let _=await this.collect();return this[t]?_.join(""):Buffer.concat(_,_.dataLength)}async promise(){return new Promise((_,q)=>{this.on(F,()=>q(Error("stream destroyed"))),this.on("error",($)=>q($)),this.on("end",()=>_())})}[Symbol.asyncIterator](){this[b]=!1;let _=!1,q=async()=>{return this.pause(),_=!0,{value:void 0,done:!0}};return{next:()=>{if(_)return q();let Q=this.read();if(Q!==null)return Promise.resolve({done:!1,value:Q});if(this[v0])return q();let x,X,V=(Z)=>{this.off("data",J),this.off("end",K),this.off(F,G),q(),X(Z)},J=(Z)=>{this.off("error",V),this.off("end",K),this.off(F,G),this.pause(),x({value:Z,done:!!this[v0]})},K=()=>{this.off("error",V),this.off("data",J),this.off(F,G),q(),x({done:!0,value:void 0})},G=()=>V(Error("stream destroyed"));return new Promise((Z,Y)=>{X=Y,x=Z,this.once(F,G),this.once("error",V),this.once("end",K),this.once("data",J)})},throw:q,return:q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[b]=!1;let _=!1,q=()=>{return this.pause(),this.off(S1,q),this.off(F,q),this.off("end",q),_=!0,{done:!0,value:void 0}},$=()=>{if(_)return q();let Q=this.read();return Q===null?q():{done:!1,value:Q}};return this.once("end",q),this.once(S1,q),this.once(F,q),{next:$,throw:q,return:q,[Symbol.iterator](){return this}}}destroy(_){if(this[F]){if(_)this.emit("error",_);else this.emit(F);return this}this[F]=!0,this[b]=!0,this[N].length=0,this[h]=0;let q=this;if(typeof q.close==="function"&&!this[L6])q.close();if(_)this.emit("error",_);else this.emit(F);return this}static get isStream(){return m4}}var n4=E.writev,I0=Symbol("_autoClose"),e=Symbol("_close"),k_=Symbol("_ended"),j=Symbol("_fd"),k1=Symbol("_finished"),z0=Symbol("_flags"),m1=Symbol("_flush"),l1=Symbol("_handleChunk"),d1=Symbol("_makeBuf"),E_=Symbol("_mode"),U6=Symbol("_needDrain"),v_=Symbol("_onerror"),w_=Symbol("_onopen"),E1=Symbol("_onread"),H_=Symbol("_onwrite"),A0=Symbol("_open"),r=Symbol("_path"),B0=Symbol("_pos"),V0=Symbol("_queue"),W_=Symbol("_read"),b1=Symbol("_readSize"),L0=Symbol("_reading"),m_=Symbol("_remain"),c1=Symbol("_size"),O6=Symbol("_write"),d0=Symbol("_writing"),j6=Symbol("_defaultFlag"),f0=Symbol("_errored");class L_ extends c{[f0]=!1;[j];[r];[b1];[L0]=!1;[c1];[m_];[I0];constructor(_,q){q=q||{};super(q);if(this.readable=!0,this.writable=!1,typeof _!=="string")throw TypeError("path must be a string");if(this[f0]=!1,this[j]=typeof q.fd==="number"?q.fd:void 0,this[r]=_,this[b1]=q.readSize||16777216,this[L0]=!1,this[c1]=typeof q.size==="number"?q.size:1/0,this[m_]=this[c1],this[I0]=typeof q.autoClose==="boolean"?q.autoClose:!0,typeof this[j]==="number")this[W_]();else this[A0]()}get fd(){return this[j]}get path(){return this[r]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[A0](){E.open(this[r],"r",(_,q)=>this[w_](_,q))}[w_](_,q){if(_)this[v_](_);else this[j]=q,this.emit("open",q),this[W_]()}[d1](){return Buffer.allocUnsafe(Math.min(this[b1],this[m_]))}[W_](){if(!this[L0]){this[L0]=!0;let _=this[d1]();if(_.length===0)return process.nextTick(()=>this[E1](null,0,_));E.read(this[j],_,0,_.length,null,(q,$,Q)=>this[E1](q,$,Q))}}[E1](_,q,$){if(this[L0]=!1,_)this[v_](_);else if(this[l1](q,$))this[W_]()}[e](){if(this[I0]&&typeof this[j]==="number"){let _=this[j];this[j]=void 0,E.close(_,(q)=>q?this.emit("error",q):this.emit("close"))}}[v_](_){this[L0]=!0,this[e](),this.emit("error",_)}[l1](_,q){let $=!1;if(this[m_]-=_,_>0)$=super.write(_<q.length?q.subarray(0,_):q);if(_===0||this[m_]<=0)$=!1,this[e](),super.end();return $}emit(_,...q){switch(_){case"prefinish":case"finish":return!1;case"drain":if(typeof this[j]==="number")this[W_]();return!1;case"error":if(this[f0])return!1;return this[f0]=!0,super.emit(_,...q);default:return super.emit(_,...q)}}}class f1 extends L_{[A0](){let _=!0;try{this[w_](null,E.openSync(this[r],"r")),_=!1}finally{if(_)this[e]()}}[W_](){let _=!0;try{if(!this[L0]){this[L0]=!0;do{let q=this[d1](),$=q.length===0?0:E.readSync(this[j],q,0,q.length,null);if(!this[l1]($,q))break}while(!0);this[L0]=!1}_=!1}finally{if(_)this[e]()}}[e](){if(this[I0]&&typeof this[j]==="number"){let _=this[j];this[j]=void 0,E.closeSync(_),this.emit("close")}}}class T0 extends s4{readable=!1;writable=!0;[f0]=!1;[d0]=!1;[k_]=!1;[V0]=[];[U6]=!1;[r];[E_];[I0];[j];[j6];[z0];[k1]=!1;[B0];constructor(_,q){q=q||{};super(q);this[r]=_,this[j]=typeof q.fd==="number"?q.fd:void 0,this[E_]=q.mode===void 0?438:q.mode,this[B0]=typeof q.start==="number"?q.start:void 0,this[I0]=typeof q.autoClose==="boolean"?q.autoClose:!0;let $=this[B0]!==void 0?"r+":"w";if(this[j6]=q.flags===void 0,this[z0]=q.flags===void 0?$:q.flags,this[j]===void 0)this[A0]()}emit(_,...q){if(_==="error"){if(this[f0])return!1;this[f0]=!0}return super.emit(_,...q)}get fd(){return this[j]}get path(){return this[r]}[v_](_){this[e](),this[d0]=!0,this.emit("error",_)}[A0](){E.open(this[r],this[z0],this[E_],(_,q)=>this[w_](_,q))}[w_](_,q){if(this[j6]&&this[z0]==="r+"&&_&&_.code==="ENOENT")this[z0]="w",this[A0]();else if(_)this[v_](_);else if(this[j]=q,this.emit("open",q),!this[d0])this[m1]()}end(_,q){if(_)this.write(_,q);if(this[k_]=!0,!this[d0]&&!this[V0].length&&typeof this[j]==="number")this[H_](null,0);return this}write(_,q){if(typeof _==="string")_=Buffer.from(_,q);if(this[k_])return this.emit("error",Error("write() after end()")),!1;if(this[j]===void 0||this[d0]||this[V0].length)return this[V0].push(_),this[U6]=!0,!1;return this[d0]=!0,this[O6](_),!0}[O6](_){E.write(this[j],_,0,_.length,this[B0],(q,$)=>this[H_](q,$))}[H_](_,q){if(_)this[v_](_);else{if(this[B0]!==void 0&&typeof q==="number")this[B0]+=q;if(this[V0].length)this[m1]();else if(this[d0]=!1,this[k_]&&!this[k1])this[k1]=!0,this[e](),this.emit("finish");else if(this[U6])this[U6]=!1,this.emit("drain")}}[m1](){if(this[V0].length===0){if(this[k_])this[H_](null,0)}else if(this[V0].length===1)this[O6](this[V0].pop());else{let _=this[V0];this[V0]=[],n4(this[j],_,this[B0],(q,$)=>this[H_](q,$))}}[e](){if(this[I0]&&typeof this[j]==="number"){let _=this[j];this[j]=void 0,E.close(_,(q)=>q?this.emit("error",q):this.emit("close"))}}}class b_ extends T0{[A0](){let _;if(this[j6]&&this[z0]==="r+")try{_=E.openSync(this[r],this[z0],this[E_])}catch(q){if(q?.code==="ENOENT")return this[z0]="w",this[A0]();else throw q}else _=E.openSync(this[r],this[z0],this[E_]);this[w_](null,_)}[e](){if(this[I0]&&typeof this[j]==="number"){let _=this[j];this[j]=void 0,E.closeSync(_),this.emit("close")}}[O6](_){let q=!0;try{this[H_](null,E.writeSync(this[j],_,0,_.length,this[B0])),q=!1}finally{if(q)try{this[e]()}catch{}}}}import P3 from"node:path";import P_ from"node:fs";import{dirname as I5,parse as A5}from"path";var a4=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),c9=(_)=>!!_.sync&&!!_.file,l9=(_)=>!_.sync&&!!_.file,d9=(_)=>!!_.sync&&!_.file,f9=(_)=>!_.sync&&!_.file;var i9=(_)=>!!_.file;var o4=(_)=>{let q=a4.get(_);if(q)return q;return _},c_=(_={})=>{if(!_)return{};let q={};for(let[$,Q]of Object.entries(_)){let x=o4($);q[x]=Q}if(q.chmod===void 0&&q.noChmod===!1)q.chmod=!0;return delete q.noChmod,q};var J0=(_,q,$,Q,x)=>{return Object.assign((X=[],V,J)=>{if(Array.isArray(X))V=X,X={};if(typeof V==="function")J=V,V=void 0;if(!V)V=[];else V=Array.from(V);let K=c_(X);if(x?.(K,V),c9(K)){if(typeof J==="function")throw TypeError("callback not supported for sync tar functions");return _(K,V)}else if(l9(K)){let G=q(K,V),Z=J?J:void 0;return Z?G.then(()=>Z(),Z):G}else if(d9(K)){if(typeof J==="function")throw TypeError("callback not supported for sync tar functions");return $(K,V)}else if(f9(K)){if(typeof J==="function")throw TypeError("callback only supported with file option");return Q(K,V)}else throw Error("impossible options??")},{syncFile:_,asyncFile:q,syncNoFile:$,asyncNoFile:Q,validate:x})};import{EventEmitter as O5}from"events";import n1 from"assert";import{Buffer as i0}from"buffer";import*as p9 from"zlib";import t4 from"zlib";var r4=t4.constants||{ZLIB_VERNUM:4736},i=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},r4));var e4=i0.concat,s9=Object.getOwnPropertyDescriptor(i0,"concat"),_5=(_)=>_,p1=s9?.writable===!0||s9?.set!==void 0?(_)=>{i0.concat=_?_5:e4}:(_)=>{},p0=Symbol("_superWrite");class l_ extends Error{code;errno;constructor(_,q){super("zlib: "+_.message,{cause:_});if(this.code=_.code,this.errno=_.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+_.message,Error.captureStackTrace(this,q??this.constructor)}get name(){return"ZlibError"}}var s1=Symbol("flushFlag");class C6 extends c{#_=!1;#$=!1;#Q;#X;#x;#q;#V;get sawError(){return this.#_}get handle(){return this.#q}get flushFlag(){return this.#Q}constructor(_,q){if(!_||typeof _!=="object")throw TypeError("invalid options for ZlibBase constructor");super(_);if(this.#Q=_.flush??0,this.#X=_.finishFlush??0,this.#x=_.fullFlushFlag??0,typeof p9[q]!=="function")throw TypeError("Compression method not supported: "+q);try{this.#q=new p9[q](_)}catch($){throw new l_($,this.constructor)}this.#V=($)=>{if(this.#_)return;this.#_=!0,this.close(),this.emit("error",$)},this.#q?.on("error",($)=>this.#V(new l_($))),this.once("end",()=>this.close)}close(){if(this.#q)this.#q.close(),this.#q=void 0,this.emit("close")}reset(){if(!this.#_)return n1(this.#q,"zlib binding closed"),this.#q.reset?.()}flush(_){if(this.ended)return;if(typeof _!=="number")_=this.#x;this.write(Object.assign(i0.alloc(0),{[s1]:_}))}end(_,q,$){if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(_)if(q)this.write(_,q);else this.write(_);return this.flush(this.#X),this.#$=!0,super.end($)}get ended(){return this.#$}[p0](_){return super.write(_)}write(_,q,$){if(typeof q==="function")$=q,q="utf8";if(typeof _==="string")_=i0.from(_,q);if(this.#_)return;n1(this.#q,"zlib binding closed");let Q=this.#q._handle,x=Q.close;Q.close=()=>{};let X=this.#q.close;this.#q.close=()=>{},p1(!0);let V=void 0;try{let K=typeof _[s1]==="number"?_[s1]:this.#Q;V=this.#q._processChunk(_,K),p1(!1)}catch(K){p1(!1),this.#V(new l_(K,this.write))}finally{if(this.#q)this.#q._handle=Q,Q.close=x,this.#q.close=X,this.#q.removeAllListeners("error")}if(this.#q)this.#q.on("error",(K)=>this.#V(new l_(K,this.write)));let J;if(V)if(Array.isArray(V)&&V.length>0){let K=V[0];J=this[p0](i0.from(K));for(let G=1;G<V.length;G++)J=this[p0](V[G])}else J=this[p0](i0.from(V));if($)$();return J}}class a1 extends C6{#_;#$;constructor(_,q){_=_||{},_.flush=_.flush||i.Z_NO_FLUSH,_.finishFlush=_.finishFlush||i.Z_FINISH,_.fullFlushFlag=i.Z_FULL_FLUSH;super(_,q);this.#_=_.level,this.#$=_.strategy}params(_,q){if(this.sawError)return;if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#_!==_||this.#$!==q){this.flush(i.Z_SYNC_FLUSH),n1(this.handle,"zlib binding closed");let $=this.handle.flush;this.handle.flush=(Q,x)=>{if(typeof Q==="function")x=Q,Q=this.flushFlag;this.flush(Q),x?.()};try{this.handle.params(_,q)}finally{this.handle.flush=$}if(this.handle)this.#_=_,this.#$=q}}}class o1 extends a1{#_;constructor(_){super(_,"Gzip");this.#_=_&&!!_.portable}[p0](_){if(!this.#_)return super[p0](_);return this.#_=!1,_[9]=255,super[p0](_)}}class t1 extends a1{constructor(_){super(_,"Unzip")}}class r1 extends C6{constructor(_,q){_=_||{},_.flush=_.flush||i.BROTLI_OPERATION_PROCESS,_.finishFlush=_.finishFlush||i.BROTLI_OPERATION_FINISH,_.fullFlushFlag=i.BROTLI_OPERATION_FLUSH;super(_,q)}}class e1 extends r1{constructor(_){super(_,"BrotliCompress")}}class _2 extends r1{constructor(_){super(_,"BrotliDecompress")}}class q2 extends C6{constructor(_,q){_=_||{},_.flush=_.flush||i.ZSTD_e_continue,_.finishFlush=_.finishFlush||i.ZSTD_e_end,_.fullFlushFlag=i.ZSTD_e_flush;super(_,q)}}class $2 extends q2{constructor(_){super(_,"ZstdCompress")}}class Q2 extends q2{constructor(_){super(_,"ZstdDecompress")}}import{posix as z_}from"node:path";var n9=(_,q)=>{if(!Number.isSafeInteger(_))throw Error("cannot encode number outside of javascript safe integer range");else if(_<0)Q5(_,q);else $5(_,q);return q},$5=(_,q)=>{q[0]=128;for(var $=q.length;$>1;$--)q[$-1]=_&255,_=Math.floor(_/256)},Q5=(_,q)=>{q[0]=255;var $=!1;_=_*-1;for(var Q=q.length;Q>1;Q--){var x=_&255;if(_=Math.floor(_/256),$)q[Q-1]=o9(x);else if(x===0)q[Q-1]=0;else $=!0,q[Q-1]=t9(x)}},a9=(_)=>{let q=_[0],$=q===128?X5(_.subarray(1,_.length)):q===255?x5(_):null;if($===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger($))throw Error("parsed number outside of javascript safe integer range");return $},x5=(_)=>{var q=_.length,$=0,Q=!1;for(var x=q-1;x>-1;x--){var X=Number(_[x]),V;if(Q)V=o9(X);else if(X===0)V=X;else Q=!0,V=t9(X);if(V!==0)$-=V*Math.pow(256,q-x-1)}return $},X5=(_)=>{var q=_.length,$=0;for(var Q=q-1;Q>-1;Q--){var x=Number(_[Q]);if(x!==0)$+=x*Math.pow(256,q-Q-1)}return $},o9=(_)=>(255^_)&255,t9=(_)=>(255^_)+1&255;var B6=(_)=>I6.has(_);var I6=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),r9=new Map(Array.from(I6).map((_)=>[_[1],_[0]]));class p{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#_="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(_,q=0,$,Q){if(Buffer.isBuffer(_))this.decode(_,q||0,$,Q);else if(_)this.#$(_)}decode(_,q,$,Q){if(!q)q=0;if(!_||!(_.length>=q+512))throw Error("need 512 bytes for header");if(this.path=$?.path??s0(_,q,100),this.mode=$?.mode??Q?.mode??F0(_,q+100,8),this.uid=$?.uid??Q?.uid??F0(_,q+108,8),this.gid=$?.gid??Q?.gid??F0(_,q+116,8),this.size=$?.size??Q?.size??F0(_,q+124,12),this.mtime=$?.mtime??Q?.mtime??x2(_,q+136,12),this.cksum=F0(_,q+148,12),Q)this.#$(Q,!0);if($)this.#$($);let x=s0(_,q+156,1);if(B6(x))this.#_=x||"0";if(this.#_==="0"&&this.path.slice(-1)==="/")this.#_="5";if(this.#_==="5")this.size=0;if(this.linkpath=s0(_,q+157,100),_.subarray(q+257,q+265).toString()==="ustar\x0000")if(this.uname=$?.uname??Q?.uname??s0(_,q+265,32),this.gname=$?.gname??Q?.gname??s0(_,q+297,32),this.devmaj=$?.devmaj??Q?.devmaj??F0(_,q+329,8)??0,this.devmin=$?.devmin??Q?.devmin??F0(_,q+337,8)??0,_[q+475]!==0){let V=s0(_,q+345,155);this.path=V+"/"+this.path}else{let V=s0(_,q+345,130);if(V)this.path=V+"/"+this.path;this.atime=$?.atime??Q?.atime??x2(_,q+476,12),this.ctime=$?.ctime??Q?.ctime??x2(_,q+488,12)}let X=256;for(let V=q;V<q+148;V++)X+=_[V];for(let V=q+156;V<q+512;V++)X+=_[V];if(this.cksumValid=X===this.cksum,this.cksum===void 0&&X===256)this.nullBlock=!0}#$(_,q=!1){Object.assign(this,Object.fromEntries(Object.entries(_).filter(([$,Q])=>{return!(Q===null||Q===void 0||$==="path"&&q||$==="linkpath"&&q||$==="global")})))}encode(_,q=0){if(!_)_=this.block=Buffer.alloc(512);if(this.#_==="Unsupported")this.#_="0";if(!(_.length>=q+512))throw Error("need 512 bytes for header");let $=this.ctime||this.atime?130:155,Q=J5(this.path||"",$),x=Q[0],X=Q[1];if(this.needPax=!!Q[2],this.needPax=n0(_,q,100,x)||this.needPax,this.needPax=R0(_,q+100,8,this.mode)||this.needPax,this.needPax=R0(_,q+108,8,this.uid)||this.needPax,this.needPax=R0(_,q+116,8,this.gid)||this.needPax,this.needPax=R0(_,q+124,12,this.size)||this.needPax,this.needPax=X2(_,q+136,12,this.mtime)||this.needPax,_[q+156]=this.#_.charCodeAt(0),this.needPax=n0(_,q+157,100,this.linkpath)||this.needPax,_.write("ustar\x0000",q+257,8),this.needPax=n0(_,q+265,32,this.uname)||this.needPax,this.needPax=n0(_,q+297,32,this.gname)||this.needPax,this.needPax=R0(_,q+329,8,this.devmaj)||this.needPax,this.needPax=R0(_,q+337,8,this.devmin)||this.needPax,this.needPax=n0(_,q+345,$,X)||this.needPax,_[q+475]!==0)this.needPax=n0(_,q+345,155,X)||this.needPax;else this.needPax=n0(_,q+345,130,X)||this.needPax,this.needPax=X2(_,q+476,12,this.atime)||this.needPax,this.needPax=X2(_,q+488,12,this.ctime)||this.needPax;let V=256;for(let J=q;J<q+148;J++)V+=_[J];for(let J=q+156;J<q+512;J++)V+=_[J];return this.cksum=V,R0(_,q+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#_==="Unsupported"?this.#_:I6.get(this.#_)}get typeKey(){return this.#_}set type(_){let q=String(r9.get(_));if(B6(q)||q==="Unsupported")this.#_=q;else if(B6(_))this.#_=_;else throw TypeError("invalid entry type: "+_)}}var J5=(_,q)=>{let Q=_,x="",X=void 0,V=z_.parse(_).root||".";if(Buffer.byteLength(Q)<100)X=[Q,x,!1];else{x=z_.dirname(Q),Q=z_.basename(Q);do if(Buffer.byteLength(Q)<=100&&Buffer.byteLength(x)<=q)X=[Q,x,!1];else if(Buffer.byteLength(Q)>100&&Buffer.byteLength(x)<=q)X=[Q.slice(0,99),x,!0];else Q=z_.join(z_.basename(x),Q),x=z_.dirname(x);while(x!==V&&X===void 0);if(!X)X=[_.slice(0,99),"",!0]}return X},s0=(_,q,$)=>_.subarray(q,q+$).toString("utf8").replace(/\0.*/,""),x2=(_,q,$)=>K5(F0(_,q,$)),K5=(_)=>_===void 0?void 0:new Date(_*1000),F0=(_,q,$)=>Number(_[q])&128?a9(_.subarray(q,q+$)):G5(_,q,$),Z5=(_)=>isNaN(_)?void 0:_,G5=(_,q,$)=>Z5(parseInt(_.subarray(q,q+$).toString("utf8").replace(/\0.*$/,"").trim(),8)),Y5={12:8589934591,8:2097151},R0=(_,q,$,Q)=>Q===void 0?!1:Q>Y5[$]||Q<0?(n9(Q,_.subarray(q,q+$)),!0):(H5(_,q,$,Q),!1),H5=(_,q,$,Q)=>_.write(W5(Q,$),q,$,"ascii"),W5=(_,q)=>v5(Math.floor(_).toString(8),q),v5=(_,q)=>(_.length===q-1?_:Array(q-_.length-1).join("0")+_+" ")+"\x00",X2=(_,q,$,Q)=>Q===void 0?!1:R0(_,q,$,Q.getTime()/1000),w5=Array(156).join("\x00"),n0=(_,q,$,Q)=>Q===void 0?!1:(_.write(Q+w5,q,$,"utf8"),Q.length!==Buffer.byteLength(Q)||Q.length>$);import{basename as L5}from"node:path";class D0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(_,q=!1){this.atime=_.atime,this.charset=_.charset,this.comment=_.comment,this.ctime=_.ctime,this.dev=_.dev,this.gid=_.gid,this.global=q,this.gname=_.gname,this.ino=_.ino,this.linkpath=_.linkpath,this.mtime=_.mtime,this.nlink=_.nlink,this.path=_.path,this.size=_.size,this.uid=_.uid,this.uname=_.uname}encode(){let _=this.encodeBody();if(_==="")return Buffer.allocUnsafe(0);let q=Buffer.byteLength(_),$=512*Math.ceil(1+q/512),Q=Buffer.allocUnsafe($);for(let x=0;x<512;x++)Q[x]=0;new p({path:("PaxHeader/"+L5(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:q,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(Q),Q.write(_,512,q,"utf8");for(let x=q+512;x<Q.length;x++)Q[x]=0;return Q}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(_){if(this[_]===void 0)return"";let q=this[_],$=q instanceof Date?q.getTime()/1000:q,Q=" "+(_==="dev"||_==="ino"||_==="nlink"?"SCHILY.":"")+_+"="+$+`
7
- `,x=Buffer.byteLength(Q),X=Math.floor(Math.log(x)/Math.log(10))+1;if(x+X>=Math.pow(10,X))X+=1;return X+x+Q}static parse(_,q,$=!1){return new D0(z5(M5(_),q),$)}}var z5=(_,q)=>q?Object.assign({},q,_):_,M5=(_)=>_.replace(/\n$/,"").split(`
8
- `).reduce(P5,Object.create(null)),P5=(_,q)=>{let $=parseInt(q,10);if($!==Buffer.byteLength(q)+1)return _;q=q.slice(($+" ").length);let Q=q.split("="),x=Q.shift();if(!x)return _;let X=x.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),V=Q.join("=");return _[X]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(X)?new Date(Number(V)*1000):/^[0-9]+$/.test(V)?+V:V,_};var U5=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,U=U5!=="win32"?(_)=>_:(_)=>_&&_.replace(/\\/g,"/");class d_ extends c{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(_,q,$){super({});switch(this.pause(),this.extended=q,this.globalExtended=$,this.header=_,this.remain=_.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=_.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!_.path)throw Error("no path provided for tar.ReadEntry");if(this.path=U(_.path),this.mode=_.mode,this.mode)this.mode=this.mode&4095;if(this.uid=_.uid,this.gid=_.gid,this.uname=_.uname,this.gname=_.gname,this.size=this.remain,this.mtime=_.mtime,this.atime=_.atime,this.ctime=_.ctime,this.linkpath=_.linkpath?U(_.linkpath):void 0,this.uname=_.uname,this.gname=_.gname,q)this.#_(q);if($)this.#_($,!0)}write(_){let q=_.length;if(q>this.blockRemain)throw Error("writing more to entry than is appropriate");let $=this.remain,Q=this.blockRemain;if(this.remain=Math.max(0,$-q),this.blockRemain=Math.max(0,Q-q),this.ignore)return!0;if($>=q)return super.write(_);return super.write(_.subarray(0,$))}#_(_,q=!1){if(_.path)_.path=U(_.path);if(_.linkpath)_.linkpath=U(_.linkpath);Object.assign(this,Object.fromEntries(Object.entries(_).filter(([$,Q])=>{return!(Q===null||Q===void 0||$==="path"&&q)})))}}var a0=(_,q,$,Q={})=>{if(_.file)Q.file=_.file;if(_.cwd)Q.cwd=_.cwd;if(Q.code=$ instanceof Error&&$.code||q,Q.tarCode=q,!_.strict&&Q.recoverable!==!1){if($ instanceof Error)Q=Object.assign($,Q),$=$.message;_.emit("warn",q,$,Q)}else if($ instanceof Error)_.emit("error",Object.assign($,Q));else _.emit("error",Object.assign(Error(`${q}: ${$}`),Q))};var j5=1048576,G2=Buffer.from([31,139]),Y2=Buffer.from([40,181,47,253]),C5=Math.max(G2.length,Y2.length),s=Symbol("state"),o0=Symbol("writeEntry"),M0=Symbol("readEntry"),V2=Symbol("nextEntry"),_3=Symbol("processEntry"),K0=Symbol("extendedHeader"),f_=Symbol("globalExtendedHeader"),S0=Symbol("meta"),q3=Symbol("emitMeta"),B=Symbol("buffer"),P0=Symbol("queue"),N0=Symbol("ended"),J2=Symbol("emittedEnd"),t0=Symbol("emit"),R=Symbol("unzip"),A6=Symbol("consumeChunk"),T6=Symbol("consumeChunkSub"),K2=Symbol("consumeBody"),$3=Symbol("consumeMeta"),Q3=Symbol("consumeHeader"),i_=Symbol("consuming"),Z2=Symbol("bufferConcat"),F6=Symbol("maybeEnd"),M_=Symbol("writing"),h0=Symbol("aborted"),R6=Symbol("onDone"),r0=Symbol("sawValidEntry"),D6=Symbol("sawNullBlock"),S6=Symbol("sawEOF"),x3=Symbol("closeStream"),B5=()=>!0;class g0 extends O5{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[P0]=[];[B];[M0];[o0];[s]="begin";[S0]="";[K0];[f_];[N0]=!1;[R];[h0]=!1;[r0];[D6]=!1;[S6]=!1;[M_]=!1;[i_]=!1;[J2]=!1;constructor(_={}){super();if(this.file=_.file||"",this.on(R6,()=>{if(this[s]==="begin"||this[r0]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),_.ondone)this.on(R6,_.ondone);else this.on(R6,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!_.strict,this.maxMetaEntrySize=_.maxMetaEntrySize||j5,this.filter=typeof _.filter==="function"?_.filter:B5;let q=_.file&&(_.file.endsWith(".tar.br")||_.file.endsWith(".tbr"));this.brotli=!(_.gzip||_.zstd)&&_.brotli!==void 0?_.brotli:q?void 0:!1;let $=_.file&&(_.file.endsWith(".tar.zst")||_.file.endsWith(".tzst"));if(this.zstd=!(_.gzip||_.brotli)&&_.zstd!==void 0?_.zstd:$?!0:void 0,this.on("end",()=>this[x3]()),typeof _.onwarn==="function")this.on("warn",_.onwarn);if(typeof _.onReadEntry==="function")this.on("entry",_.onReadEntry)}warn(_,q,$={}){a0(this,_,q,$)}[Q3](_,q){if(this[r0]===void 0)this[r0]=!1;let $;try{$=new p(_,q,this[K0],this[f_])}catch(Q){return this.warn("TAR_ENTRY_INVALID",Q)}if($.nullBlock)if(this[D6]){if(this[S6]=!0,this[s]==="begin")this[s]="header";this[t0]("eof")}else this[D6]=!0,this[t0]("nullBlock");else if(this[D6]=!1,!$.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:$});else if(!$.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:$});else{let Q=$.type;if(/^(Symbolic)?Link$/.test(Q)&&!$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:$});else if(!/^(Symbolic)?Link$/.test(Q)&&!/^(Global)?ExtendedHeader$/.test(Q)&&$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:$});else{let x=this[o0]=new d_($,this[K0],this[f_]);if(!this[r0])if(x.remain){let X=()=>{if(!x.invalid)this[r0]=!0};x.on("end",X)}else this[r0]=!0;if(x.meta){if(x.size>this.maxMetaEntrySize)x.ignore=!0,this[t0]("ignoredEntry",x),this[s]="ignore",x.resume();else if(x.size>0)this[S0]="",x.on("data",(X)=>this[S0]+=X),this[s]="meta"}else if(this[K0]=void 0,x.ignore=x.ignore||!this.filter(x.path,x),x.ignore)this[t0]("ignoredEntry",x),this[s]=x.remain?"ignore":"header",x.resume();else{if(x.remain)this[s]="body";else this[s]="header",x.end();if(!this[M0])this[P0].push(x),this[V2]();else this[P0].push(x)}}}}[x3](){queueMicrotask(()=>this.emit("close"))}[_3](_){let q=!0;if(!_)this[M0]=void 0,q=!1;else if(Array.isArray(_)){let[$,...Q]=_;this.emit($,...Q)}else if(this[M0]=_,this.emit("entry",_),!_.emittedEnd)_.on("end",()=>this[V2]()),q=!1;return q}[V2](){do;while(this[_3](this[P0].shift()));if(!this[P0].length){let _=this[M0];if(!_||_.flowing||_.size===_.remain){if(!this[M_])this.emit("drain")}else _.once("drain",()=>this.emit("drain"))}}[K2](_,q){let $=this[o0];if(!$)throw Error("attempt to consume body without entry??");let Q=$.blockRemain??0,x=Q>=_.length&&q===0?_:_.subarray(q,q+Q);if($.write(x),!$.blockRemain)this[s]="header",this[o0]=void 0,$.end();return x.length}[$3](_,q){let $=this[o0],Q=this[K2](_,q);if(!this[o0]&&$)this[q3]($);return Q}[t0](_,q,$){if(!this[P0].length&&!this[M0])this.emit(_,q,$);else this[P0].push([_,q,$])}[q3](_){switch(this[t0]("meta",this[S0]),_.type){case"ExtendedHeader":case"OldExtendedHeader":this[K0]=D0.parse(this[S0],this[K0],!1);break;case"GlobalExtendedHeader":this[f_]=D0.parse(this[S0],this[f_],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let q=this[K0]??Object.create(null);this[K0]=q,q.path=this[S0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let q=this[K0]||Object.create(null);this[K0]=q,q.linkpath=this[S0].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+_.type)}}abort(_){this[h0]=!0,this.emit("abort",_),this.warn("TAR_ABORT",_,{recoverable:!1})}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");if(this[h0])return $?.(),!1;if((this[R]===void 0||this.brotli===void 0&&this[R]===!1)&&_){if(this[B])_=Buffer.concat([this[B],_]),this[B]=void 0;if(_.length<C5)return this[B]=_,$?.(),!0;for(let J=0;this[R]===void 0&&J<G2.length;J++)if(_[J]!==G2[J])this[R]=!1;let X=!1;if(this[R]===!1&&this.zstd!==!1){X=!0;for(let J=0;J<Y2.length;J++)if(_[J]!==Y2[J]){X=!1;break}}let V=this.brotli===void 0&&!X;if(this[R]===!1&&V)if(_.length<512)if(this[N0])this.brotli=!0;else return this[B]=_,$?.(),!0;else try{new p(_.subarray(0,512)),this.brotli=!1}catch(J){this.brotli=!0}if(this[R]===void 0||this[R]===!1&&(this.brotli||X)){let J=this[N0];this[N0]=!1,this[R]=this[R]===void 0?new t1({}):X?new Q2({}):new _2({}),this[R].on("data",(G)=>this[A6](G)),this[R].on("error",(G)=>this.abort(G)),this[R].on("end",()=>{this[N0]=!0,this[A6]()}),this[M_]=!0;let K=!!this[R][J?"end":"write"](_);return this[M_]=!1,$?.(),K}}if(this[M_]=!0,this[R])this[R].write(_);else this[A6](_);this[M_]=!1;let x=this[P0].length?!1:this[M0]?this[M0].flowing:!0;if(!x&&!this[P0].length)this[M0]?.once("drain",()=>this.emit("drain"));return $?.(),x}[Z2](_){if(_&&!this[h0])this[B]=this[B]?Buffer.concat([this[B],_]):_}[F6](){if(this[N0]&&!this[J2]&&!this[h0]&&!this[i_]){this[J2]=!0;let _=this[o0];if(_&&_.blockRemain){let q=this[B]?this[B].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${_.blockRemain} more bytes, only ${q} available)`,{entry:_}),this[B])_.write(this[B]);_.end()}this[t0](R6)}}[A6](_){if(this[i_]&&_)this[Z2](_);else if(!_&&!this[B])this[F6]();else if(_){if(this[i_]=!0,this[B]){this[Z2](_);let q=this[B];this[B]=void 0,this[T6](q)}else this[T6](_);while(this[B]&&this[B]?.length>=512&&!this[h0]&&!this[S6]){let q=this[B];this[B]=void 0,this[T6](q)}this[i_]=!1}if(!this[B]||this[N0])this[F6]()}[T6](_){let q=0,$=_.length;while(q+512<=$&&!this[h0]&&!this[S6])switch(this[s]){case"begin":case"header":this[Q3](_,q),q+=512;break;case"ignore":case"body":q+=this[K2](_,q);break;case"meta":q+=this[$3](_,q);break;default:throw Error("invalid state: "+this[s])}if(q<$)if(this[B])this[B]=Buffer.concat([_.subarray(q),this[B]]);else this[B]=_.subarray(q)}end(_,q,$){if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,q);if($)this.once("finish",$);if(!this[h0])if(this[R]){if(_)this[R].write(_);this[R].end()}else{if(this[N0]=!0,this.brotli===void 0||this.zstd===void 0)_=_||Buffer.alloc(0);if(_)this.write(_);this[F6]()}return this}}var y0=(_)=>{let q=_.length-1,$=-1;while(q>-1&&_.charAt(q)==="/")$=q,q--;return $===-1?_:_.slice(0,$)};var T5=(_)=>{let q=_.onReadEntry;_.onReadEntry=q?($)=>{q($),$.resume()}:($)=>$.resume()},H2=(_,q)=>{let $=new Map(q.map((X)=>[y0(X),!0])),Q=_.filter,x=(X,V="")=>{let J=V||A5(X).root||".",K;if(X===J)K=!1;else{let G=$.get(X);if(G!==void 0)K=G;else K=x(I5(X),J)}return $.set(X,K),K};_.filter=Q?(X,V)=>Q(X,V)&&x(y0(X)):(X)=>x(y0(X))},F5=(_)=>{let q=new g0(_),$=_.file,Q;try{Q=P_.openSync($,"r");let x=P_.fstatSync(Q),X=_.maxReadSize||16777216;if(x.size<X){let V=Buffer.allocUnsafe(x.size),J=P_.readSync(Q,V,0,x.size,0);q.end(J===V.byteLength?V:V.subarray(0,J))}else{let V=0,J=Buffer.allocUnsafe(X);while(V<x.size){let K=P_.readSync(Q,J,0,X,V);if(K===0)break;V+=K,q.write(J.subarray(0,K))}q.end()}}finally{if(typeof Q==="number")try{P_.closeSync(Q)}catch(x){}}},R5=(_,q)=>{let $=new g0(_),Q=_.maxReadSize||16777216,x=_.file;return new Promise((V,J)=>{$.on("error",J),$.on("end",V),P_.stat(x,(K,G)=>{if(K)J(K);else{let Z=new L_(x,{readSize:Q,size:G.size});Z.on("error",J),Z.pipe($)}})})},e0=J0(F5,R5,(_)=>new g0(_),(_)=>new g0(_),(_,q)=>{if(q?.length)H2(_,q);if(!_.noResume)T5(_)});import d6 from"fs";import Z0 from"fs";import K3 from"path";var W2=(_,q,$)=>{if(_&=4095,$)_=(_|384)&-19;if(q){if(_&256)_|=64;if(_&32)_|=8;if(_&4)_|=1}return _};import{win32 as D5}from"node:path";var{isAbsolute:S5,parse:X3}=D5,p_=(_)=>{let q="",$=X3(_);while(S5(_)||$.root){let Q=_.charAt(0)==="/"&&_.slice(0,4)!=="//?/"?"/":$.root;_=_.slice(Q.length),q+=Q,$=X3(_)}return[q,_]};var N6=["|","<",">","?",":"],v2=N6.map((_)=>String.fromCharCode(61440+_.charCodeAt(0))),N5=new Map(N6.map((_,q)=>[_,v2[q]])),h5=new Map(v2.map((_,q)=>[_,N6[q]])),w2=(_)=>N6.reduce((q,$)=>q.split($).join(N5.get($)),_),V3=(_)=>v2.reduce((q,$)=>q.split($).join(h5.get($)),_);var W3=(_,q)=>{if(!q)return U(_);return _=U(_).replace(/^\.(\/|$)/,""),y0(q)+"/"+_},g5=16777216,Z3=Symbol("process"),G3=Symbol("file"),Y3=Symbol("directory"),z2=Symbol("symlink"),H3=Symbol("hardlink"),s_=Symbol("header"),h6=Symbol("read"),M2=Symbol("lstat"),g6=Symbol("onlstat"),P2=Symbol("onread"),U2=Symbol("onreadlink"),O2=Symbol("openfile"),j2=Symbol("onopenfile"),u0=Symbol("close"),y6=Symbol("mode"),C2=Symbol("awaitDrain"),L2=Symbol("ondrain"),G0=Symbol("prefix");class u6 extends c{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#_=!1;constructor(_,q={}){let $=c_(q);super();if(this.path=U(_),this.portable=!!$.portable,this.maxReadSize=$.maxReadSize||g5,this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.preservePaths=!!$.preservePaths,this.cwd=U($.cwd||process.cwd()),this.strict=!!$.strict,this.noPax=!!$.noPax,this.noMtime=!!$.noMtime,this.mtime=$.mtime,this.prefix=$.prefix?U($.prefix):void 0,this.onWriteEntry=$.onWriteEntry,typeof $.onwarn==="function")this.on("warn",$.onwarn);let Q=!1;if(!this.preservePaths){let[X,V]=p_(this.path);if(X&&typeof V==="string")this.path=V,Q=X}if(this.win32=!!$.win32||process.platform==="win32",this.win32)this.path=V3(this.path.replace(/\\/g,"/")),_=_.replace(/\\/g,"/");if(this.absolute=U($.absolute||K3.resolve(this.cwd,_)),this.path==="")this.path="./";if(Q)this.warn("TAR_ENTRY_INFO",`stripping ${Q} from absolute path`,{entry:this,path:Q+this.path});let x=this.statCache.get(this.absolute);if(x)this[g6](x);else this[M2]()}warn(_,q,$={}){return a0(this,_,q,$)}emit(_,...q){if(_==="error")this.#_=!0;return super.emit(_,...q)}[M2](){Z0.lstat(this.absolute,(_,q)=>{if(_)return this.emit("error",_);this[g6](q)})}[g6](_){if(this.statCache.set(this.absolute,_),this.stat=_,!_.isFile())_.size=0;this.type=y5(_),this.emit("stat",_),this[Z3]()}[Z3](){switch(this.type){case"File":return this[G3]();case"Directory":return this[Y3]();case"SymbolicLink":return this[z2]();default:return this.end()}}[y6](_){return W2(_,this.type==="Directory",this.portable)}[G0](_){return W3(_,this.prefix)}[s_](){if(!this.stat)throw Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.onWriteEntry?.(this),this.header=new p({path:this[G0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[G0](this.linkpath):this.linkpath,mode:this[y6](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax)super.write(new D0({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[G0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[G0](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let _=this.header?.block;if(!_)throw Error("failed to encode header");super.write(_)}[Y3](){if(!this.stat)throw Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[s_](),this.end()}[z2](){Z0.readlink(this.absolute,(_,q)=>{if(_)return this.emit("error",_);this[U2](q)})}[U2](_){this.linkpath=U(_),this[s_](),this.end()}[H3](_){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=U(K3.relative(this.cwd,_)),this.stat.size=0,this[s_](),this.end()}[G3](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let _=`${this.stat.dev}:${this.stat.ino}`,q=this.linkCache.get(_);if(q?.indexOf(this.cwd)===0)return this[H3](q);this.linkCache.set(_,this.absolute)}if(this[s_](),this.stat.size===0)return this.end();this[O2]()}[O2](){Z0.open(this.absolute,"r",(_,q)=>{if(_)return this.emit("error",_);this[j2](q)})}[j2](_){if(this.fd=_,this.#_)return this[u0]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[h6]()}[h6](){let{fd:_,buf:q,offset:$,length:Q,pos:x}=this;if(_===void 0||q===void 0)throw Error("cannot read file without first opening");Z0.read(_,q,$,Q,x,(X,V)=>{if(X)return this[u0](()=>this.emit("error",X));this[P2](V)})}[u0](_=()=>{}){if(this.fd!==void 0)Z0.close(this.fd,_)}[P2](_){if(_<=0&&this.remain>0){let Q=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[u0](()=>this.emit("error",Q))}if(_>this.remain){let Q=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[u0](()=>this.emit("error",Q))}if(!this.buf)throw Error("should have created buffer prior to reading");if(_===this.remain)for(let Q=_;Q<this.length&&_<this.blockRemain;Q++)this.buf[Q+this.offset]=0,_++,this.remain++;let q=this.offset===0&&_===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+_);if(!this.write(q))this[C2](()=>this[L2]());else this[L2]()}[C2](_){this.once("drain",_)}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");if(this.blockRemain<_.length){let Q=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",Q)}return this.remain-=_.length,this.blockRemain-=_.length,this.pos+=_.length,this.offset+=_.length,super.write(_,null,$)}[L2](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[u0]((_)=>_?this.emit("error",_):this.end())}if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");if(this.offset>=this.length)this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0;this.length=this.buf.length-this.offset,this[h6]()}}class B2 extends u6{sync=!0;[M2](){this[g6](Z0.lstatSync(this.absolute))}[z2](){this[U2](Z0.readlinkSync(this.absolute))}[O2](){this[j2](Z0.openSync(this.absolute,"r"))}[h6](){let _=!0;try{let{fd:q,buf:$,offset:Q,length:x,pos:X}=this;if(q===void 0||$===void 0)throw Error("fd and buf must be set in READ method");let V=Z0.readSync(q,$,Q,x,X);this[P2](V),_=!1}finally{if(_)try{this[u0](()=>{})}catch(q){}}}[C2](_){_()}[u0](_=()=>{}){if(this.fd!==void 0)Z0.closeSync(this.fd);_()}}class I2 extends c{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(_,q,$={}){return a0(this,_,q,$)}constructor(_,q={}){let $=c_(q);super();this.preservePaths=!!$.preservePaths,this.portable=!!$.portable,this.strict=!!$.strict,this.noPax=!!$.noPax,this.noMtime=!!$.noMtime,this.onWriteEntry=$.onWriteEntry,this.readEntry=_;let{type:Q}=_;if(Q==="Unsupported")throw Error("writing entry that should be ignored");if(this.type=Q,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=$.prefix,this.path=U(_.path),this.mode=_.mode!==void 0?this[y6](_.mode):void 0,this.uid=this.portable?void 0:_.uid,this.gid=this.portable?void 0:_.gid,this.uname=this.portable?void 0:_.uname,this.gname=this.portable?void 0:_.gname,this.size=_.size,this.mtime=this.noMtime?void 0:$.mtime||_.mtime,this.atime=this.portable?void 0:_.atime,this.ctime=this.portable?void 0:_.ctime,this.linkpath=_.linkpath!==void 0?U(_.linkpath):void 0,typeof $.onwarn==="function")this.on("warn",$.onwarn);let x=!1;if(!this.preservePaths){let[V,J]=p_(this.path);if(V&&typeof J==="string")this.path=J,x=V}if(this.remain=_.size,this.blockRemain=_.startBlockSize,this.onWriteEntry?.(this),this.header=new p({path:this[G0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[G0](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),x)this.warn("TAR_ENTRY_INFO",`stripping ${x} from absolute path`,{entry:this,path:x+this.path});if(this.header.encode()&&!this.noPax)super.write(new D0({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[G0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[G0](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let X=this.header?.block;if(!X)throw Error("failed to encode header");super.write(X),_.pipe(this)}[G0](_){return W3(_,this.prefix)}[y6](_){return W2(_,this.type==="Directory",this.portable)}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");let Q=_.length;if(Q>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=Q,super.write(_,$)}end(_,q,$){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,q??"utf8");if($)this.once("finish",$);return _?super.end(_,$):super.end($),this}}var y5=(_)=>_.isFile()?"File":_.isDirectory()?"Directory":_.isSymbolicLink()?"SymbolicLink":"Unsupported";class k0{tail;head;length=0;static create(_=[]){return new k0(_)}constructor(_=[]){for(let q of _)this.push(q)}*[Symbol.iterator](){for(let _=this.head;_;_=_.next)yield _.value}removeNode(_){if(_.list!==this)throw Error("removing node which does not belong to this list");let{next:q,prev:$}=_;if(q)q.prev=$;if($)$.next=q;if(_===this.head)this.head=q;if(_===this.tail)this.tail=$;return this.length--,_.next=void 0,_.prev=void 0,_.list=void 0,q}unshiftNode(_){if(_===this.head)return;if(_.list)_.list.removeNode(_);let q=this.head;if(_.list=this,_.next=q,q)q.prev=_;if(this.head=_,!this.tail)this.tail=_;this.length++}pushNode(_){if(_===this.tail)return;if(_.list)_.list.removeNode(_);let q=this.tail;if(_.list=this,_.prev=q,q)q.next=_;if(this.tail=_,!this.head)this.head=_;this.length++}push(..._){for(let q=0,$=_.length;q<$;q++)k5(this,_[q]);return this.length}unshift(..._){for(var q=0,$=_.length;q<$;q++)m5(this,_[q]);return this.length}pop(){if(!this.tail)return;let _=this.tail.value,q=this.tail;if(this.tail=this.tail.prev,this.tail)this.tail.next=void 0;else this.head=void 0;return q.list=void 0,this.length--,_}shift(){if(!this.head)return;let _=this.head.value,q=this.head;if(this.head=this.head.next,this.head)this.head.prev=void 0;else this.tail=void 0;return q.list=void 0,this.length--,_}forEach(_,q){q=q||this;for(let $=this.head,Q=0;$;Q++)_.call(q,$.value,Q,this),$=$.next}forEachReverse(_,q){q=q||this;for(let $=this.tail,Q=this.length-1;$;Q--)_.call(q,$.value,Q,this),$=$.prev}get(_){let q=0,$=this.head;for(;!!$&&q<_;q++)$=$.next;if(q===_&&!!$)return $.value}getReverse(_){let q=0,$=this.tail;for(;!!$&&q<_;q++)$=$.prev;if(q===_&&!!$)return $.value}map(_,q){q=q||this;let $=new k0;for(let Q=this.head;Q;)$.push(_.call(q,Q.value,this)),Q=Q.next;return $}mapReverse(_,q){q=q||this;var $=new k0;for(let Q=this.tail;Q;)$.push(_.call(q,Q.value,this)),Q=Q.prev;return $}reduce(_,q){let $,Q=this.head;if(arguments.length>1)$=q;else if(this.head)Q=this.head.next,$=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var x=0;Q;x++)$=_($,Q.value,x),Q=Q.next;return $}reduceReverse(_,q){let $,Q=this.tail;if(arguments.length>1)$=q;else if(this.tail)Q=this.tail.prev,$=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let x=this.length-1;Q;x--)$=_($,Q.value,x),Q=Q.prev;return $}toArray(){let _=Array(this.length);for(let q=0,$=this.head;$;q++)_[q]=$.value,$=$.next;return _}toArrayReverse(){let _=Array(this.length);for(let q=0,$=this.tail;$;q++)_[q]=$.value,$=$.prev;return _}slice(_=0,q=this.length){if(q<0)q+=this.length;if(_<0)_+=this.length;let $=new k0;if(q<_||q<0)return $;if(_<0)_=0;if(q>this.length)q=this.length;let Q=this.head,x=0;for(x=0;!!Q&&x<_;x++)Q=Q.next;for(;!!Q&&x<q;x++,Q=Q.next)$.push(Q.value);return $}sliceReverse(_=0,q=this.length){if(q<0)q+=this.length;if(_<0)_+=this.length;let $=new k0;if(q<_||q<0)return $;if(_<0)_=0;if(q>this.length)q=this.length;let Q=this.length,x=this.tail;for(;!!x&&Q>q;Q--)x=x.prev;for(;!!x&&Q>_;Q--,x=x.prev)$.push(x.value);return $}splice(_,q=0,...$){if(_>this.length)_=this.length-1;if(_<0)_=this.length+_;let Q=this.head;for(let X=0;!!Q&&X<_;X++)Q=Q.next;let x=[];for(let X=0;!!Q&&X<q;X++)x.push(Q.value),Q=this.removeNode(Q);if(!Q)Q=this.tail;else if(Q!==this.tail)Q=Q.prev;for(let X of $)Q=u5(this,Q,X);return x}reverse(){let _=this.head,q=this.tail;for(let $=_;$;$=$.prev){let Q=$.prev;$.prev=$.next,$.next=Q}return this.head=q,this.tail=_,this}}function u5(_,q,$){let Q=q,x=q?q.next:_.head,X=new k6($,Q,x,_);if(X.next===void 0)_.tail=X;if(X.prev===void 0)_.head=X;return _.length++,X}function k5(_,q){if(_.tail=new k6(q,_.tail,void 0,_),!_.head)_.head=_.tail;_.length++}function m5(_,q){if(_.head=new k6(q,void 0,_.head,_),!_.tail)_.tail=_.head;_.length++}class k6{list;next;prev;value;constructor(_,q,$,Q){if(this.list=Q,this.value=_,q)q.next=this,this.prev=q;else this.prev=void 0;if($)$.prev=this,this.next=$;else this.next=void 0}}import z3 from"path";class D2{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(_,q){this.path=_||"./",this.absolute=q}}var v3=Buffer.alloc(1024),m6=Symbol("onStat"),n_=Symbol("ended"),_0=Symbol("queue"),__=Symbol("current"),q_=Symbol("process"),a_=Symbol("processing"),A2=Symbol("processJob"),q0=Symbol("jobs"),T2=Symbol("jobDone"),E6=Symbol("addFSEntry"),w3=Symbol("addTarEntry"),S2=Symbol("stat"),N2=Symbol("readdir"),b6=Symbol("onreaddir"),c6=Symbol("pipe"),L3=Symbol("entry"),F2=Symbol("entryOpt"),l6=Symbol("writeEntryClass"),M3=Symbol("write"),R2=Symbol("ondrain");class $_ extends c{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[l6];onWriteEntry;[_0];[q0]=0;[a_]=!1;[n_]=!1;constructor(_={}){super();if(this.opt=_,this.file=_.file||"",this.cwd=_.cwd||process.cwd(),this.maxReadSize=_.maxReadSize,this.preservePaths=!!_.preservePaths,this.strict=!!_.strict,this.noPax=!!_.noPax,this.prefix=U(_.prefix||""),this.linkCache=_.linkCache||new Map,this.statCache=_.statCache||new Map,this.readdirCache=_.readdirCache||new Map,this.onWriteEntry=_.onWriteEntry,this[l6]=u6,typeof _.onwarn==="function")this.on("warn",_.onwarn);if(this.portable=!!_.portable,_.gzip||_.brotli||_.zstd){if((_.gzip?1:0)+(_.brotli?1:0)+(_.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(_.gzip){if(typeof _.gzip!=="object")_.gzip={};if(this.portable)_.gzip.portable=!0;this.zip=new o1(_.gzip)}if(_.brotli){if(typeof _.brotli!=="object")_.brotli={};this.zip=new e1(_.brotli)}if(_.zstd){if(typeof _.zstd!=="object")_.zstd={};this.zip=new $2(_.zstd)}if(!this.zip)throw Error("impossible");let q=this.zip;q.on("data",($)=>super.write($)),q.on("end",()=>super.end()),q.on("drain",()=>this[R2]()),this.on("resume",()=>q.resume())}else this.on("drain",this[R2]);if(this.noDirRecurse=!!_.noDirRecurse,this.follow=!!_.follow,this.noMtime=!!_.noMtime,_.mtime)this.mtime=_.mtime;this.filter=typeof _.filter==="function"?_.filter:()=>!0,this[_0]=new k0,this[q0]=0,this.jobs=Number(_.jobs)||4,this[a_]=!1,this[n_]=!1}[M3](_){return super.write(_)}add(_){return this.write(_),this}end(_,q,$){if(typeof _==="function")$=_,_=void 0;if(typeof q==="function")$=q,q=void 0;if(_)this.add(_);if(this[n_]=!0,this[q_](),$)$();return this}write(_){if(this[n_])throw Error("write after end");if(_ instanceof d_)this[w3](_);else this[E6](_);return this.flowing}[w3](_){let q=U(z3.resolve(this.cwd,_.path));if(!this.filter(_.path,_))_.resume();else{let $=new D2(_.path,q);$.entry=new I2(_,this[F2]($)),$.entry.on("end",()=>this[T2]($)),this[q0]+=1,this[_0].push($)}this[q_]()}[E6](_){let q=U(z3.resolve(this.cwd,_));this[_0].push(new D2(_,q)),this[q_]()}[S2](_){_.pending=!0,this[q0]+=1;let q=this.follow?"stat":"lstat";d6[q](_.absolute,($,Q)=>{if(_.pending=!1,this[q0]-=1,$)this.emit("error",$);else this[m6](_,Q)})}[m6](_,q){if(this.statCache.set(_.absolute,q),_.stat=q,!this.filter(_.path,q))_.ignore=!0;else if(q.isFile()&&q.nlink>1&&_===this[__]&&!this.linkCache.get(`${q.dev}:${q.ino}`)&&!this.sync)this[A2](_);this[q_]()}[N2](_){_.pending=!0,this[q0]+=1,d6.readdir(_.absolute,(q,$)=>{if(_.pending=!1,this[q0]-=1,q)return this.emit("error",q);this[b6](_,$)})}[b6](_,q){this.readdirCache.set(_.absolute,q),_.readdir=q,this[q_]()}[q_](){if(this[a_])return;this[a_]=!0;for(let _=this[_0].head;!!_&&this[q0]<this.jobs;_=_.next)if(this[A2](_.value),_.value.ignore){let q=_.next;this[_0].removeNode(_),_.next=q}if(this[a_]=!1,this[n_]&&!this[_0].length&&this[q0]===0)if(this.zip)this.zip.end(v3);else super.write(v3),super.end()}get[__](){return this[_0]&&this[_0].head&&this[_0].head.value}[T2](_){this[_0].shift(),this[q0]-=1,this[q_]()}[A2](_){if(_.pending)return;if(_.entry){if(_===this[__]&&!_.piped)this[c6](_);return}if(!_.stat){let q=this.statCache.get(_.absolute);if(q)this[m6](_,q);else this[S2](_)}if(!_.stat)return;if(_.ignore)return;if(!this.noDirRecurse&&_.stat.isDirectory()&&!_.readdir){let q=this.readdirCache.get(_.absolute);if(q)this[b6](_,q);else this[N2](_);if(!_.readdir)return}if(_.entry=this[L3](_),!_.entry){_.ignore=!0;return}if(_===this[__]&&!_.piped)this[c6](_)}[F2](_){return{onwarn:(q,$,Q)=>this.warn(q,$,Q),noPax:this.noPax,cwd:this.cwd,absolute:_.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[L3](_){this[q0]+=1;try{return new this[l6](_.path,this[F2](_)).on("end",()=>this[T2](_)).on("error",($)=>this.emit("error",$))}catch(q){this.emit("error",q)}}[R2](){if(this[__]&&this[__].entry)this[__].entry.resume()}[c6](_){if(_.piped=!0,_.readdir)_.readdir.forEach((Q)=>{let x=_.path,X=x==="./"?"":x.replace(/\/*$/,"/");this[E6](X+Q)});let q=_.entry,$=this.zip;if(!q)throw Error("cannot pipe without source");if($)q.on("data",(Q)=>{if(!$.write(Q))q.pause()});else q.on("data",(Q)=>{if(!super.write(Q))q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn(_,q,$={}){a0(this,_,q,$)}}class U_ extends $_{sync=!0;constructor(_){super(_);this[l6]=B2}pause(){}resume(){}[S2](_){let q=this.follow?"statSync":"lstatSync";this[m6](_,d6[q](_.absolute))}[N2](_){this[b6](_,d6.readdirSync(_.absolute))}[c6](_){let q=_.entry,$=this.zip;if(_.readdir)_.readdir.forEach((Q)=>{let x=_.path,X=x==="./"?"":x.replace(/\/*$/,"/");this[E6](X+Q)});if(!q)throw Error("Cannot pipe without source");if($)q.on("data",(Q)=>{$.write(Q)});else q.on("data",(Q)=>{super[M3](Q)})}}var E5=(_,q)=>{let $=new U_(_),Q=new b_(_.file,{mode:_.mode||438});$.pipe(Q),U3($,q)},b5=(_,q)=>{let $=new $_(_),Q=new T0(_.file,{mode:_.mode||438});$.pipe(Q);let x=new Promise((X,V)=>{Q.on("error",V),Q.on("close",X),$.on("error",V)});return O3($,q),x},U3=(_,q)=>{q.forEach(($)=>{if($.charAt(0)==="@")e0({file:P3.resolve(_.cwd,$.slice(1)),sync:!0,noResume:!0,onReadEntry:(Q)=>_.add(Q)});else _.add($)}),_.end()},O3=async(_,q)=>{for(let $=0;$<q.length;$++){let Q=String(q[$]);if(Q.charAt(0)==="@")await e0({file:P3.resolve(String(_.cwd),Q.slice(1)),noResume:!0,onReadEntry:(x)=>{_.add(x)}});else _.add(Q)}_.end()},c5=(_,q)=>{let $=new U_(_);return U3($,q),$},l5=(_,q)=>{let $=new $_(_);return O3($,q),$},d5=J0(E5,b5,c5,l5,(_,q)=>{if(!q?.length)throw TypeError("no paths specified to add to archive")});import m3 from"node:fs";import V7 from"node:assert";import{randomBytes as k3}from"node:crypto";import O from"node:fs";import n from"node:path";import j3 from"fs";var f5=process.env.__FAKE_PLATFORM__||process.platform,i5=f5==="win32",{O_CREAT:p5,O_TRUNC:s5,O_WRONLY:n5}=j3.constants,C3=Number(process.env.__FAKE_FS_O_FILENAME__)||j3.constants.UV_FS_O_FILEMAP||0,a5=i5&&!!C3,o5=524288,t5=C3|s5|p5|n5,h2=!a5?()=>"w":(_)=>_<o5?t5:"w";import i6 from"node:fs";import o_ from"node:path";var g2=(_,q,$)=>{try{return i6.lchownSync(_,q,$)}catch(Q){if(Q?.code!=="ENOENT")throw Q}},f6=(_,q,$,Q)=>{i6.lchown(_,q,$,(x)=>{Q(x&&x?.code!=="ENOENT"?x:null)})},r5=(_,q,$,Q,x)=>{if(q.isDirectory())y2(o_.resolve(_,q.name),$,Q,(X)=>{if(X)return x(X);let V=o_.resolve(_,q.name);f6(V,$,Q,x)});else{let X=o_.resolve(_,q.name);f6(X,$,Q,x)}},y2=(_,q,$,Q)=>{i6.readdir(_,{withFileTypes:!0},(x,X)=>{if(x){if(x.code==="ENOENT")return Q();else if(x.code!=="ENOTDIR"&&x.code!=="ENOTSUP")return Q(x)}if(x||!X.length)return f6(_,q,$,Q);let V=X.length,J=null,K=(G)=>{if(J)return;if(G)return Q(J=G);if(--V===0)return f6(_,q,$,Q)};for(let G of X)r5(_,G,q,$,K)})},e5=(_,q,$,Q)=>{if(q.isDirectory())u2(o_.resolve(_,q.name),$,Q);g2(o_.resolve(_,q.name),$,Q)},u2=(_,q,$)=>{let Q;try{Q=i6.readdirSync(_,{withFileTypes:!0})}catch(x){let X=x;if(X?.code==="ENOENT")return;else if(X?.code==="ENOTDIR"||X?.code==="ENOTSUP")return g2(_,q,$);else throw X}for(let x of Q)e5(_,x,q,$);return g2(_,q,$)};import l from"node:fs";import _7 from"node:fs/promises";import n6 from"node:path";class p6 extends Error{path;code;syscall="chdir";constructor(_,q){super(`${q}: Cannot cd into '${_}'`);this.path=_,this.code=q}get name(){return"CwdError"}}class s6 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(_,q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=_,this.path=q}get name(){return"SymlinkError"}}var q7=(_,q)=>{l.stat(_,($,Q)=>{if($||!Q.isDirectory())$=new p6(_,$?.code||"ENOTDIR");q($)})},B3=(_,q,$)=>{_=U(_);let Q=q.umask??18,x=q.mode|448,X=(x&Q)!==0,V=q.uid,J=q.gid,K=typeof V==="number"&&typeof J==="number"&&(V!==q.processUid||J!==q.processGid),G=q.preserve,Z=q.unlink,Y=U(q.cwd),H=(z,M)=>{if(z)$(z);else if(M&&K)y2(M,V,J,(u)=>H(u));else if(X)l.chmod(_,x,$);else $()};if(_===Y)return q7(_,H);if(G)return _7.mkdir(_,{mode:x,recursive:!0}).then((z)=>H(null,z??void 0),H);let L=U(n6.relative(Y,_)).split("/");k2(Y,L,x,Z,Y,void 0,H)},k2=(_,q,$,Q,x,X,V)=>{if(!q.length)return V(null,X);let J=q.shift(),K=U(n6.resolve(_+"/"+J));l.mkdir(K,$,I3(K,q,$,Q,x,X,V))},I3=(_,q,$,Q,x,X,V)=>(J)=>{if(J)l.lstat(_,(K,G)=>{if(K)K.path=K.path&&U(K.path),V(K);else if(G.isDirectory())k2(_,q,$,Q,x,X,V);else if(Q)l.unlink(_,(Z)=>{if(Z)return V(Z);l.mkdir(_,$,I3(_,q,$,Q,x,X,V))});else if(G.isSymbolicLink())return V(new s6(_,_+"/"+q.join("/")));else V(J)});else X=X||_,k2(_,q,$,Q,x,X,V)},$7=(_)=>{let q=!1,$=void 0;try{q=l.statSync(_).isDirectory()}catch(Q){$=Q?.code}finally{if(!q)throw new p6(_,$??"ENOTDIR")}},A3=(_,q)=>{_=U(_);let $=q.umask??18,Q=q.mode|448,x=(Q&$)!==0,X=q.uid,V=q.gid,J=typeof X==="number"&&typeof V==="number"&&(X!==q.processUid||V!==q.processGid),K=q.preserve,G=q.unlink,Z=U(q.cwd),Y=(z)=>{if(z&&J)u2(z,X,V);if(x)l.chmodSync(_,Q)};if(_===Z)return $7(Z),Y();if(K)return Y(l.mkdirSync(_,{mode:Q,recursive:!0})??void 0);let w=U(n6.relative(Z,_)).split("/"),L=void 0;for(let z=w.shift(),M=Z;z&&(M+="/"+z);z=w.shift()){M=U(n6.resolve(M));try{l.mkdirSync(M,Q),L=L||M}catch(u){let f=l.lstatSync(M);if(f.isDirectory())continue;else if(G){l.unlinkSync(M),l.mkdirSync(M,Q),L=L||M;continue}else if(f.isSymbolicLink())return new s6(M,M+"/"+w.join("/"))}}return Y(L)};import{join as F3}from"node:path";var m2=Object.create(null);var O_=new Set,T3=(_)=>{if(!O_.has(_))m2[_]=_.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en");else O_.delete(_);O_.add(_);let q=m2[_],$=O_.size-1e4;if($>1000){for(let Q of O_)if(O_.delete(Q),delete m2[Q],--$<=0)break}return q};var Q7=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,x7=Q7==="win32",X7=(_)=>{return _.split("/").slice(0,-1).reduce(($,Q)=>{let x=$[$.length-1];if(x!==void 0)Q=F3(x,Q);return $.push(Q||"/"),$},[])};class E2{#_=new Map;#$=new Map;#Q=new Set;reserve(_,q){_=x7?["win32 parallelization disabled"]:_.map((Q)=>{return y0(F3(T3(Q)))});let $=new Set(_.map((Q)=>X7(Q)).reduce((Q,x)=>Q.concat(x)));this.#$.set(q,{dirs:$,paths:_});for(let Q of _){let x=this.#_.get(Q);if(!x)this.#_.set(Q,[q]);else x.push(q)}for(let Q of $){let x=this.#_.get(Q);if(!x)this.#_.set(Q,[new Set([q])]);else{let X=x[x.length-1];if(X instanceof Set)X.add(q);else x.push(new Set([q]))}}return this.#x(q)}#X(_){let q=this.#$.get(_);if(!q)throw Error("function does not have any path reservations");return{paths:q.paths.map(($)=>this.#_.get($)),dirs:[...q.dirs].map(($)=>this.#_.get($))}}check(_){let{paths:q,dirs:$}=this.#X(_);return q.every((Q)=>Q&&Q[0]===_)&&$.every((Q)=>Q&&Q[0]instanceof Set&&Q[0].has(_))}#x(_){if(this.#Q.has(_)||!this.check(_))return!1;return this.#Q.add(_),_(()=>this.#q(_)),!0}#q(_){if(!this.#Q.has(_))return!1;let q=this.#$.get(_);if(!q)throw Error("invalid reservation");let{paths:$,dirs:Q}=q,x=new Set;for(let X of $){let V=this.#_.get(X);if(!V||V?.[0]!==_)continue;let J=V[1];if(!J){this.#_.delete(X);continue}if(V.shift(),typeof J==="function")x.add(J);else for(let K of J)x.add(K)}for(let X of Q){let V=this.#_.get(X),J=V?.[0];if(!V||!(J instanceof Set))continue;if(J.size===1&&V.length===1){this.#_.delete(X);continue}else if(J.size===1){V.shift();let K=V[0];if(typeof K==="function")x.add(K)}else J.delete(_)}return this.#Q.delete(_),x.forEach((X)=>this.#x(X)),!0}}var R3=Symbol("onEntry"),d2=Symbol("checkFs"),D3=Symbol("checkFs2"),f2=Symbol("isReusable"),a=Symbol("makeFs"),i2=Symbol("file"),p2=Symbol("directory"),t6=Symbol("link"),S3=Symbol("symlink"),N3=Symbol("hardlink"),h3=Symbol("unsupported"),g3=Symbol("checkPath"),b2=Symbol("stripAbsolutePath"),m0=Symbol("mkdir"),y=Symbol("onError"),a6=Symbol("pending"),y3=Symbol("pend"),j_=Symbol("unpend"),c2=Symbol("ended"),l2=Symbol("maybeClose"),s2=Symbol("skip"),t_=Symbol("doChown"),r_=Symbol("uid"),e_=Symbol("gid"),_6=Symbol("checkedCwd"),J7=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,q6=J7==="win32",K7=1024,Z7=(_,q)=>{if(!q6)return O.unlink(_,q);let $=_+".DELETE."+k3(16).toString("hex");O.rename(_,$,(Q)=>{if(Q)return q(Q);O.unlink($,q)})},G7=(_)=>{if(!q6)return O.unlinkSync(_);let q=_+".DELETE."+k3(16).toString("hex");O.renameSync(_,q),O.unlinkSync(q)},u3=(_,q,$)=>_!==void 0&&_===_>>>0?_:q!==void 0&&q===q>>>0?q:$;class $6 extends g0{[c2]=!1;[_6]=!1;[a6]=0;reservations=new E2;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(_={}){_.ondone=()=>{this[c2]=!0,this[l2]()};super(_);if(this.transform=_.transform,this.chmod=!!_.chmod,typeof _.uid==="number"||typeof _.gid==="number"){if(typeof _.uid!=="number"||typeof _.gid!=="number")throw TypeError("cannot set owner without number uid and gid");if(_.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=_.uid,this.gid=_.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if(_.preserveOwner===void 0&&typeof _.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!_.preserveOwner;this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof _.maxDepth==="number"?_.maxDepth:K7,this.forceChown=_.forceChown===!0,this.win32=!!_.win32||q6,this.newer=!!_.newer,this.keep=!!_.keep,this.noMtime=!!_.noMtime,this.preservePaths=!!_.preservePaths,this.unlink=!!_.unlink,this.cwd=U(n.resolve(_.cwd||process.cwd())),this.strip=Number(_.strip)||0,this.processUmask=!this.chmod?0:typeof _.processUmask==="number"?_.processUmask:process.umask(),this.umask=typeof _.umask==="number"?_.umask:this.processUmask,this.dmode=_.dmode||511&~this.umask,this.fmode=_.fmode||438&~this.umask,this.on("entry",(q)=>this[R3](q))}warn(_,q,$={}){if(_==="TAR_BAD_ARCHIVE"||_==="TAR_ABORT")$.recoverable=!1;return super.warn(_,q,$)}[l2](){if(this[c2]&&this[a6]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[b2](_,q){let $=_[q];if(!$||this.preservePaths)return!0;let Q=$.split("/");if(Q.includes("..")||q6&&/^[a-z]:\.\.$/i.test(Q[0]??""))if(q==="path")return this.warn("TAR_ENTRY_ERROR",`${q} contains '..'`,{entry:_,[q]:$}),!1;else{let V=n.posix.dirname(_.path),J=n.posix.normalize(n.posix.join(V,$));if(J.startsWith("../")||J==="..")return this.warn("TAR_ENTRY_ERROR",`${q} escapes extraction directory`,{entry:_,[q]:$}),!1}let[x,X]=p_($);if(x)_[q]=String(X),this.warn("TAR_ENTRY_INFO",`stripping ${x} from absolute ${q}`,{entry:_,[q]:$});return!0}[g3](_){let q=U(_.path),$=q.split("/");if(this.strip){if($.length<this.strip)return!1;if(_.type==="Link"){let Q=U(String(_.linkpath)).split("/");if(Q.length>=this.strip)_.linkpath=Q.slice(this.strip).join("/");else return!1}$.splice(0,this.strip),_.path=$.join("/")}if(isFinite(this.maxDepth)&&$.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:_,path:q,depth:$.length,maxDepth:this.maxDepth}),!1;if(!this[b2](_,"path")||!this[b2](_,"linkpath"))return!1;if(n.isAbsolute(_.path))_.absolute=U(n.resolve(_.path));else _.absolute=U(n.resolve(this.cwd,_.path));if(!this.preservePaths&&typeof _.absolute==="string"&&_.absolute.indexOf(this.cwd+"/")!==0&&_.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:_,path:U(_.path),resolvedPath:_.absolute,cwd:this.cwd}),!1;if(_.absolute===this.cwd&&_.type!=="Directory"&&_.type!=="GNUDumpDir")return!1;if(this.win32){let{root:Q}=n.win32.parse(String(_.absolute));_.absolute=Q+w2(String(_.absolute).slice(Q.length));let{root:x}=n.win32.parse(_.path);_.path=x+w2(_.path.slice(x.length))}return!0}[R3](_){if(!this[g3](_))return _.resume();switch(V7.equal(typeof _.absolute,"string"),_.type){case"Directory":case"GNUDumpDir":if(_.mode)_.mode=_.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[d2](_);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[h3](_)}}[y](_,q){if(_.name==="CwdError")this.emit("error",_);else this.warn("TAR_ENTRY_ERROR",_,{entry:q}),this[j_](),q.resume()}[m0](_,q,$){B3(U(_),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:q},$)}[t_](_){return this.forceChown||this.preserveOwner&&(typeof _.uid==="number"&&_.uid!==this.processUid||typeof _.gid==="number"&&_.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[r_](_){return u3(this.uid,_.uid,this.processUid)}[e_](_){return u3(this.gid,_.gid,this.processGid)}[i2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.fmode,Q=new T0(String(_.absolute),{flags:h2(_.size),mode:$,autoClose:!1});Q.on("error",(J)=>{if(Q.fd)O.close(Q.fd,()=>{});Q.write=()=>!0,this[y](J,_),q()});let x=1,X=(J)=>{if(J){if(Q.fd)O.close(Q.fd,()=>{});this[y](J,_),q();return}if(--x===0){if(Q.fd!==void 0)O.close(Q.fd,(K)=>{if(K)this[y](K,_);else this[j_]();q()})}};Q.on("finish",()=>{let J=String(_.absolute),K=Q.fd;if(typeof K==="number"&&_.mtime&&!this.noMtime){x++;let G=_.atime||new Date,Z=_.mtime;O.futimes(K,G,Z,(Y)=>Y?O.utimes(J,G,Z,(H)=>X(H&&Y)):X())}if(typeof K==="number"&&this[t_](_)){x++;let G=this[r_](_),Z=this[e_](_);if(typeof G==="number"&&typeof Z==="number")O.fchown(K,G,Z,(Y)=>Y?O.chown(J,G,Z,(H)=>X(H&&Y)):X())}X()});let V=this.transform?this.transform(_)||_:_;if(V!==_)V.on("error",(J)=>{this[y](J,_),q()}),_.pipe(V);V.pipe(Q)}[p2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.dmode;this[m0](String(_.absolute),$,(Q)=>{if(Q){this[y](Q,_),q();return}let x=1,X=()=>{if(--x===0)q(),this[j_](),_.resume()};if(_.mtime&&!this.noMtime)x++,O.utimes(String(_.absolute),_.atime||new Date,_.mtime,X);if(this[t_](_))x++,O.chown(String(_.absolute),Number(this[r_](_)),Number(this[e_](_)),X);X()})}[h3](_){_.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${_.type}`,{entry:_}),_.resume()}[S3](_,q){this[t6](_,String(_.linkpath),"symlink",q)}[N3](_,q){let $=U(n.resolve(this.cwd,String(_.linkpath)));this[t6](_,$,"link",q)}[y3](){this[a6]++}[j_](){this[a6]--,this[l2]()}[s2](_){this[j_](),_.resume()}[f2](_,q){return _.type==="File"&&!this.unlink&&q.isFile()&&q.nlink<=1&&!q6}[d2](_){this[y3]();let q=[_.path];if(_.linkpath)q.push(_.linkpath);this.reservations.reserve(q,($)=>this[D3](_,$))}[D3](_,q){let $=(V)=>{q(V)},Q=()=>{this[m0](this.cwd,this.dmode,(V)=>{if(V){this[y](V,_),$();return}this[_6]=!0,x()})},x=()=>{if(_.absolute!==this.cwd){let V=U(n.dirname(String(_.absolute)));if(V!==this.cwd)return this[m0](V,this.dmode,(J)=>{if(J){this[y](J,_),$();return}X()})}X()},X=()=>{O.lstat(String(_.absolute),(V,J)=>{if(J&&(this.keep||this.newer&&J.mtime>(_.mtime??J.mtime))){this[s2](_),$();return}if(V||this[f2](_,J))return this[a](null,_,$);if(J.isDirectory()){if(_.type==="Directory"){let K=this.chmod&&_.mode&&(J.mode&4095)!==_.mode,G=(Z)=>this[a](Z??null,_,$);if(!K)return G();return O.chmod(String(_.absolute),Number(_.mode),G)}if(_.absolute!==this.cwd)return O.rmdir(String(_.absolute),(K)=>this[a](K??null,_,$))}if(_.absolute===this.cwd)return this[a](null,_,$);Z7(String(_.absolute),(K)=>this[a](K??null,_,$))})};if(this[_6])x();else Q()}[a](_,q,$){if(_){this[y](_,q),$();return}switch(q.type){case"File":case"OldFile":case"ContiguousFile":return this[i2](q,$);case"Link":return this[N3](q,$);case"SymbolicLink":return this[S3](q,$);case"Directory":case"GNUDumpDir":return this[p2](q,$)}}[t6](_,q,$,Q){O[$](q,String(_.absolute),(x)=>{if(x)this[y](x,_);else this[j_](),_.resume();Q()})}}var o6=(_)=>{try{return[null,_()]}catch(q){return[q,null]}};class r6 extends $6{sync=!0;[a](_,q){return super[a](_,q,()=>{})}[d2](_){if(!this[_6]){let x=this[m0](this.cwd,this.dmode);if(x)return this[y](x,_);this[_6]=!0}if(_.absolute!==this.cwd){let x=U(n.dirname(String(_.absolute)));if(x!==this.cwd){let X=this[m0](x,this.dmode);if(X)return this[y](X,_)}}let[q,$]=o6(()=>O.lstatSync(String(_.absolute)));if($&&(this.keep||this.newer&&$.mtime>(_.mtime??$.mtime)))return this[s2](_);if(q||this[f2](_,$))return this[a](null,_);if($.isDirectory()){if(_.type==="Directory"){let X=this.chmod&&_.mode&&($.mode&4095)!==_.mode,[V]=X?o6(()=>{O.chmodSync(String(_.absolute),Number(_.mode))}):[];return this[a](V,_)}let[x]=o6(()=>O.rmdirSync(String(_.absolute)));this[a](x,_)}let[Q]=_.absolute===this.cwd?[]:o6(()=>G7(String(_.absolute)));this[a](Q,_)}[i2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.fmode,Q=(V)=>{let J;try{O.closeSync(x)}catch(K){J=K}if(V||J)this[y](V||J,_);q()},x;try{x=O.openSync(String(_.absolute),h2(_.size),$)}catch(V){return Q(V)}let X=this.transform?this.transform(_)||_:_;if(X!==_)X.on("error",(V)=>this[y](V,_)),_.pipe(X);X.on("data",(V)=>{try{O.writeSync(x,V,0,V.length)}catch(J){Q(J)}}),X.on("end",()=>{let V=null;if(_.mtime&&!this.noMtime){let J=_.atime||new Date,K=_.mtime;try{O.futimesSync(x,J,K)}catch(G){try{O.utimesSync(String(_.absolute),J,K)}catch(Z){V=G}}}if(this[t_](_)){let J=this[r_](_),K=this[e_](_);try{O.fchownSync(x,Number(J),Number(K))}catch(G){try{O.chownSync(String(_.absolute),Number(J),Number(K))}catch(Z){V=V||G}}}Q(V)})}[p2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.dmode,Q=this[m0](String(_.absolute),$);if(Q){this[y](Q,_),q();return}if(_.mtime&&!this.noMtime)try{O.utimesSync(String(_.absolute),_.atime||new Date,_.mtime)}catch(x){}if(this[t_](_))try{O.chownSync(String(_.absolute),Number(this[r_](_)),Number(this[e_](_)))}catch(x){}q(),_.resume()}[m0](_,q){try{return A3(U(_),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:q})}catch($){return $}}[t6](_,q,$,Q){let x=`${$}Sync`;try{O[x](q,String(_.absolute)),Q(),_.resume()}catch(X){return this[y](X,_)}}}var Y7=(_)=>{let q=new r6(_),$=_.file,Q=m3.statSync($),x=_.maxReadSize||16777216;new f1($,{readSize:x,size:Q.size}).pipe(q)},H7=(_,q)=>{let $=new $6(_),Q=_.maxReadSize||16777216,x=_.file;return new Promise((V,J)=>{$.on("error",J),$.on("close",V),m3.stat(x,(K,G)=>{if(K)J(K);else{let Z=new L_(x,{readSize:Q,size:G.size});Z.on("error",J),Z.pipe($)}})})},Q6=J0(Y7,H7,(_)=>new r6(_),(_)=>new $6(_),(_,q)=>{if(q?.length)H2(_,q)});import d from"node:fs";import E3 from"node:path";var W7=(_,q)=>{let $=new U_(_),Q=!0,x,X;try{try{x=d.openSync(_.file,"r+")}catch(K){if(K?.code==="ENOENT")x=d.openSync(_.file,"w+");else throw K}let V=d.fstatSync(x),J=Buffer.alloc(512);_:for(X=0;X<V.size;X+=512){for(let Z=0,Y=0;Z<512;Z+=Y){if(Y=d.readSync(x,J,Z,J.length-Z,X+Z),X===0&&J[0]===31&&J[1]===139)throw Error("cannot append to compressed archives");if(!Y)break _}let K=new p(J);if(!K.cksumValid)break;let G=512*Math.ceil((K.size||0)/512);if(X+G+512>V.size)break;if(X+=G,_.mtimeCache&&K.mtime)_.mtimeCache.set(String(K.path),K.mtime)}Q=!1,v7(_,$,X,x,q)}finally{if(Q)try{d.closeSync(x)}catch(V){}}},v7=(_,q,$,Q,x)=>{let X=new b_(_.file,{fd:Q,start:$});q.pipe(X),L7(q,x)},w7=(_,q)=>{q=Array.from(q);let $=new $_(_),Q=(X,V,J)=>{let K=(w,L)=>{if(w)d.close(X,(z)=>J(w));else J(null,L)},G=0;if(V===0)return K(null,0);let Z=0,Y=Buffer.alloc(512),H=(w,L)=>{if(w||typeof L>"u")return K(w);if(Z+=L,Z<512&&L)return d.read(X,Y,Z,Y.length-Z,G+Z,H);if(G===0&&Y[0]===31&&Y[1]===139)return K(Error("cannot append to compressed archives"));if(Z<512)return K(null,G);let z=new p(Y);if(!z.cksumValid)return K(null,G);let M=512*Math.ceil((z.size??0)/512);if(G+M+512>V)return K(null,G);if(G+=M+512,G>=V)return K(null,G);if(_.mtimeCache&&z.mtime)_.mtimeCache.set(String(z.path),z.mtime);Z=0,d.read(X,Y,0,512,G,H)};d.read(X,Y,0,512,G,H)};return new Promise((X,V)=>{$.on("error",V);let J="r+",K=(G,Z)=>{if(G&&G.code==="ENOENT"&&J==="r+")return J="w+",d.open(_.file,J,K);if(G||!Z)return V(G);d.fstat(Z,(Y,H)=>{if(Y)return d.close(Z,()=>V(Y));Q(Z,H.size,(w,L)=>{if(w)return V(w);let z=new T0(_.file,{fd:Z,start:L});$.pipe(z),z.on("error",V),z.on("close",X),z7($,q)})})};d.open(_.file,J,K)})},L7=(_,q)=>{q.forEach(($)=>{if($.charAt(0)==="@")e0({file:E3.resolve(_.cwd,$.slice(1)),sync:!0,noResume:!0,onReadEntry:(Q)=>_.add(Q)});else _.add($)}),_.end()},z7=async(_,q)=>{for(let $=0;$<q.length;$++){let Q=String(q[$]);if(Q.charAt(0)==="@")await e0({file:E3.resolve(String(_.cwd),Q.slice(1)),noResume:!0,onReadEntry:(x)=>_.add(x)});else _.add(Q)}_.end()},Q_=J0(W7,w7,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(_,q)=>{if(!i9(_))throw TypeError("file is required");if(_.gzip||_.brotli||_.zstd||_.file.endsWith(".br")||_.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!q?.length)throw TypeError("no paths specified to add/replace")});var M7=J0(Q_.syncFile,Q_.asyncFile,Q_.syncNoFile,Q_.asyncNoFile,(_,q=[])=>{Q_.validate?.(_,q),P7(_)}),P7=(_)=>{let q=_.filter;if(!_.mtimeCache)_.mtimeCache=new Map;_.filter=q?($,Q)=>q($,Q)&&!((_.mtimeCache?.get($)??Q.mtime??0)>(Q.mtime??0)):($,Q)=>!((_.mtimeCache?.get($)??Q.mtime??0)>(Q.mtime??0))};var A={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"};import B_,{join as O7}from"path";var b3={name:"@abacus-ai/cli",description:"AbacusAI's powerful CLI AI assistant with agentic browsing, listening, and coding capabilities.",appName:"AbacusAI",binName:"abacusai",version:"1.106.2805",nodeVersion:"22.19.0",author:{name:"Abacus AI"},license:"Proprietary",main:"./dist/index.js",module:"./dist/index.js",source:"./src/index.ts",type:"module",homepage:"https://desktop.abacus.ai/",files:["dist"],bugs:{url:"mailto:support@abacus.ai"},bin:{abacusai:"./dist/index.js"},scripts:{"build.tsc":"tsc --noEmit --pretty","build.bun":"bun build ./src/index.ts --minify --target=node --outdir=dist",build:"run-p build.*","watch.tsc":"tsc --watch --noEmit --pretty","watch.bun":"bun build ./src/index.ts --sourcemap --target=node --outdir=dist --watch --external=extract-zip --external=node-downloader-helper --external=semver --external=tar",watch:"run-p watch.*",test:"tsc -p ./test/tsconfig.json && bun test"},devDependencies:{"@inquirer/prompts":"^7.9.0","@tsconfig/strictest":"^2.0.7","@types/color-name":"^2.0.0","@types/glob":"^9.0.0","@types/minimatch":"^6.0.0","@types/node":"^24.9.2","@types/bun":"^1.2.2","@types/semver":"^7.7.1","extract-zip":"^2.0.1","node-downloader-helper":"^2.1.9",semver:"^7.7.3",tar:"^7.5.2",typescript:"^6.0.0-dev.20251031","npm-run-all2":"^8.0.4"},overrides:{yauzl:"3.2.0"}};import{fileURLToPath as j7}from"url";import _1 from"os";import C_ from"fs/promises";import C7 from"fs";var q1=B_.dirname(j7(import.meta.url)),e6=b3,n2=".abacusai-cli";async function $1(_){return B_.join(await l3(),`${_.binName}-${_.version}-${_1.platform()}-${_1.arch()}`)}async function l3(){let _=B_.join(q1,n2);if(await c3(_))return _;console.log(`Using home directory as ${_} is not writable.`);let q=B_.join(_1.homedir(),n2);if(await c3(q))return q;console.error(`No writable directory found under ${_} or ${q}. Using a temporary directory instead.`);let $=O7(_1.tmpdir(),n2);try{await C_.mkdir($,{recursive:!0})}catch{}return $}async function c3(_){let q=B_.join(_,`.writable-${process.pid}-${Date.now()}`);try{return await C_.mkdir(_,{recursive:!0}),await C_.writeFile(q,"true"),!0}catch($){return!1}finally{try{await C_.unlink(q)}catch{}}}async function d3(){try{let _=await f3(e6);if(!C7.existsSync(_))return await a2(e6,_),e6;return await B7(_)}catch{return e6}}async function a2(_,q){try{if(q===void 0)q=await f3(_);return await C_.writeFile(q,JSON.stringify(_,null,2)),q}catch($){return console.error(`Failed to write package data file ${q}: ${$ instanceof Error?$.message:String($)}`),null}}async function B7(_){return JSON.parse(await C_.readFile(_,"utf8"))}async function f3(_){return B_.join(await l3(),`${_.binName}-package.json`)}var x4=H6(E8(),1),X4=H6(R1(),1),V4=H6(Q4(),1);import M9 from"fs";import Z6 from"fs/promises";import J_ from"os";import P9 from"path";function R$(_){let q=process.versions.node;if(V4.default(q,_))return!1;return!0}function D$(_){let q=J_.platform(),$=J_.arch(),x={x64:"x64",arm64:"arm64",ia32:"x86"}[$]||$;if(q==="win32")return`https://nodejs.org/dist/v${_}/node-v${_}-win-${x}.${$==="x64"||$==="ia32"?"zip":"7z"}`;else if(q==="darwin")return`https://nodejs.org/dist/v${_}/node-v${_}-darwin-${x}.tar.gz`;else return`https://nodejs.org/dist/v${_}/node-v${_}-linux-${x}.tar.gz`}function S$(_){let q=J_.platform(),$=J_.arch(),x={x64:"x64",arm64:"arm64",ia32:"x86"}[$]||$;if(q==="win32")return`node-v${_}-win-${x}.${$==="x64"||$==="ia32"?"zip":"7z"}`;else if(q==="darwin")return`node-v${_}-darwin-${x}.tar.gz`;else return`node-v${_}-linux-${x}.tar.gz`}async function A1(_,q,$=!1){try{if(!$){if(R$(q))return process.execPath}let Q=J_.platform()==="win32"?"node.exe":"node",x=P9.join(_,Q);if(M9.existsSync(x))return x;let X=P9.join(J_.homedir(),`node-${q}`),V=P9.join(X,"bin",Q);if(M9.existsSync(V))return await Z6.copyFile(V,x),x;console.log(`${A.dim}Downloading Node.js ${q}...${A.reset}`);let J=D$(q),K=S$(q),G=new X4.DownloaderHelper(J,J_.tmpdir(),{fileName:K});G.on("error",async(Y)=>{console.error(`${A.red}Failed to download Node.js from ${J}: ${Y}${A.reset}`),await G.stop()}),await G.start();let Z=G.getDownloadPath();if(!M9.existsSync(X))await Z6.mkdir(X);if(console.log(`${A.dim}Extracting Node.js ${q} to ${X}...${A.reset}`),K.endsWith(".tar.gz"))await h$(Z,X);else await N$(Z,X);return await Z6.copyFile(V,x),x}catch(Q){return console.error(`${A.red}Failed to download Node.js: ${Q instanceof Error?Q.message:String(Q)}
9
- Please download and install Node.js ${q} from https://nodejs.org/`),process.execPath}}async function N$(_,q){await Z6.mkdir(q,{recursive:!0}),await x4.default(_,{dir:q})}async function h$(_,q){await Z6.mkdir(q,{recursive:!0}),await Q6({file:_,cwd:q,strip:1})}function u$(_){let{appName:q,binName:$,version:Q}=_,x=`${q.toLowerCase()}-agent-cli-${T1.platform()}-${T1.arch()}-${Q}.tar.gz`;return{url:`https://static.abacus.ai/${$}/releases/${Q}/${x}`,fileName:x}}async function Z4(_,q=!1){let{appName:$,binName:Q,version:x,homepage:X}=_;try{let{url:V,fileName:J}=u$(_),K=new J4.DownloaderHelper(V,T1.tmpdir(),{fileName:J});K.on("error",async(H)=>{console.error(`Failed to download ${V}: ${H}`),await K.stop()}),console.log(`${A.dim}Downloading ${$} ${x}...${A.reset}`),await K.start();let G=K.getDownloadPath(),Z=await $1(_);console.log(`${A.dim}Extracting ${$} ${x} to ${Z}...${A.reset}`),await k$(G,Z),await K4.rm(G);let Y=g$.join(Z,"bin",`${Q}${T1.platform()==="win32"?".cmd":""}`);if(!y$.existsSync(Y)){let H=`${$} command not found at ${Y}}`;throw console.error(H),Error(H)}return console.log(`${A.dim}${$} ${x} downloaded to ${Z}${A.reset}`),await A1(Z,_.nodeVersion,q),Y}catch(V){throw console.error(V instanceof Error?V.message:String(V)),Error(`Could not download ${$}. Please install ${$} from ${X} and re-run ${Q}.`)}}async function k$(_,q){await K4.mkdir(q,{recursive:!0}),await Q6({file:_,cwd:q,strip:1})}import O9 from"fs";import G4 from"fs/promises";import U9 from"os";import D from"path";var Y4="code-oss-dev";async function H4(_){try{let q=U9.platform(),$=[await E$(D.dirname(D.dirname(q1))),D.dirname(D.dirname(D.dirname(q1))),await $1(_),...m$(_.appName,q)].filter((Q)=>Q!==void 0);return await Promise.any($.map(async(Q)=>{try{let x=JSON.parse(await G4.readFile(D.join(Q,"package.json"),"utf8")),X=x.name===Y4;if(!X&&!(("version"in x)&&typeof x.version==="string"&&x.version===_.version))throw Error(`Invalid version in package.json: ${x.version} (expected ${_.version})`);let V=W4(Q);if(V!==void 0){let K=q==="win32"?"node.exe":"node";return{command:X?K:D.join(Q,K),args:X?[V,Q,"agent"]:[V,"agent"],directory:Q,isCommandNode:!X,env:X?{...process.env,NODE_ENV:"development",VSCODE_DEV:"1"}:process.env}}let J=D.join(Q,"bin",`${_.binName}${q==="win32"?".cmd":""}`);if(O9.existsSync(J))return{command:J,args:[],directory:Q,isCommandNode:!1,env:process.env};throw Error(`${_.appName} command not found: ${J}`)}catch(x){let X=x instanceof Error?x.message:String(x);throw Error(`${_.appName} not found in ${Q}: ${X}`)}}))}catch(q){if(!(q instanceof AggregateError)){let $=q instanceof Error?q.message:String(q);console.info(`${A.dim}Could not find installed ${_.appName}: ${$}${A.reset}`)}return}}function m$(_,q=U9.platform()){let $=U9.homedir();if(q==="darwin")return[`/Applications/${_}.app/Contents/Resources/app`,D.join($,`Applications/${_}.app/Contents/Resources/app`)];else if(q==="win32"){let Q=process.env.ProgramFiles||"C:\\Program Files",x=process.env["ProgramFiles(x86)"]||"C:\\Program Files (x86)",X=process.env.LOCALAPPDATA||D.join($,"AppData","Local"),V=process.env.APPDATA||D.join($,"AppData","Roaming");return[D.join(Q,_),D.join(x,_),D.join(X,"Programs",_),D.join(V,_)]}else return[`/usr/share/${_.toLowerCase()}`]}async function E$(_){let q=_;while(q!==D.parse(q).root){if(W4(q)!==void 0){let Q=await c$(q);if(Q!==void 0&&b$(Q))return q}q=D.dirname(q)}return}function W4(_){let q=D.join(_,"out","cli.js");if(O9.existsSync(q))return q;return}function b$(_){return _.name===Y4}async function c$(_){let q=D.join(_,"package.json");if(!O9.existsSync(q))return;let $=await G4.readFile(q,"utf8"),Q=JSON.parse($);if("name"in Q&&typeof Q.name==="string"&&"version"in Q&&typeof Q.version==="string")return Q;return}import{execFile as i$}from"child_process";import w4 from"process";import{promisify as p$}from"util";import l$ from"https";import F1 from"os";async function v4(_){return new Promise((q,$)=>{try{let Q=l$.get(`https://abacus.ai/api/v0/_getCodeLlmVersion?platform=${F1.platform()}-${F1.arch()}&quality=stable`,{headers:{"User-Agent":`AbacusAI CLI/${_??"unknown"}-${F1.platform()}-${F1.arch()}`}});if(Q.errored||Q.closed){$(Error("Failed to find latest version from API: request failed immediately"));return}Q.on("response",(x)=>{let X="";x.on("data",(V)=>{X+=V}),x.on("end",()=>{let{statusCode:V,statusMessage:J}=x;if(V!==200){$(Error(`API request ${Q.path} failed: ${V} ${J} ${X}`));return}try{let K=JSON.parse(X);q(K.result)}catch(K){let G=K instanceof Error?K.message:String(K);$(Error(`Failed to parse API response as JSON: ${G}`))}})})}catch(Q){let x=Q instanceof Error?Q.message:String(Q);$(Error(`Failed to find latest version from API: ${x}`))}})}function j9(){return d$(process.env.ABACUSAI_CLI_FORCE_NODE_DOWNLOAD)}function C9(){return f$(process.env.ABACUSAI_CLI_AUTO_UPDATE)}function d$(_){return _==="true"||_==="1"}function f$(_){return _!=="false"&&_!=="0"}var s$=p$(i$),n$="@abacus-ai/cli";async function L4(_){try{let q={..._,name:n$},$=await a$(q);if($!==null)await o$(q,$)}catch(q){throw Error(`Failed to auto upgrade ${_.appName}. To update, install the latest version from ${_.homepage}`)}}async function a$(_){try{if(!C9())return null;let q=await v4(_.version);if(q.productVersion!==_.version)return q.productVersion;return null}catch(q){return null}}async function o$(_,q="latest"){if(!C9())return;let $={..._,version:q};try{await a2($)}catch(Q){console.log(`Failed to update package data file: ${Q instanceof Error?Q.message:String(Q)}.`)}try{let{command:Q,args:x}=await t$($);console.log(`${A.dim}Upgrading ${$.appName} to ${$.version} via \`${Q} ${x.join(" ")}\`${A.reset}`);let{stdout:X,stderr:V}=await s$(Q,x);if(console.log(X),V)console.error(V);console.log(`${A.dim}${$.name}@${$.version} installed successfully${A.reset}`)}catch(Q){}}async function t$({name:_,version:q}){try{let $=w4.env.npm_package_json,Q=w4.env.npm_config_user_agent;if(Boolean(Q?.startsWith("npm"))||Boolean($?.endsWith("package.json")))return{command:"npm",args:["install","-g",`${_}@${q}`]};if(Boolean(Q?.startsWith("yarn")))return{command:"yarn",args:["global","add",`${_}@${q}`]};if(Boolean(Q?.startsWith("pnpm")))return{command:"pnpm",args:["install","-g",`${_}@${q}`]};if(Boolean(Q?.startsWith("bun")))return{command:"bun",args:["install","-g",`${_}@${q}`]}}catch($){}return{command:"npm",args:["install","-g",`${_}@${q}`]}}var B9=r$.platform();async function M4(){let _=await d3();L4(_).catch((Q)=>{console.error(Q)});let q=await H4(_);if(q!==void 0){let Q=await A1(q.directory,_.nodeVersion,j9()),x=q.isCommandNode?Q:q.command;return z4(_,x,q.args,void 0,q.env)}let $=await Z4(_,j9());return z4(_,$,[])}function z4(_,q,$,Q,x){let X=Q??process.argv.slice(2),V=[...$,...X],J=q;if(B9==="win32"&&q.includes(" "))J=`"${q}"`;let K=e$.spawn(J,V,{stdio:"inherit",shell:B9==="win32",windowsVerbatimArguments:B9==="win32",env:x??process.env});K.on("error",(G)=>{console.error(`Failed to start ${_.appName}:`,G),process.exit(1)}),K.on("exit",(G,Z)=>{if(Z)process.kill(process.pid,Z);else process.exit(G??1)})}M4().catch((_)=>{console.error(_),process.exit(1)});
4
+ `+X),_.push(x+"m+"+V1.exports.humanize(this.diff)+"\x1B[0m")}else _[0]=d7()+q+" "+_[0]}function d7(){if(p3.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function f7(..._){return process.stderr.write(X1.formatWithOptions(p3.inspectOpts,..._)+`
5
+ `)}function i7(_){if(_)process.env.DEBUG=_;else delete process.env.DEBUG}function p7(){return process.env.DEBUG}function s7(_){_.inspectOpts={};let q=Object.keys(p3.inspectOpts);for(let $=0;$<q.length;$++)_.inspectOpts[q[$]]=p3.inspectOpts[q[$]]}V1.exports=n2()(p3);var{formatters:i3}=V1.exports;i3.o=function(_){return this.inspectOpts.colors=this.useColors,X1.inspect(_,this.inspectOpts).split(`
6
+ `).map((q)=>q.trim()).join(" ")};i3.O=function(_){return this.inspectOpts.colors=this.useColors,X1.inspect(_,this.inspectOpts)}});var a3=A((uX,a2)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)a2.exports=f3();else a2.exports=n3()});var r3=A((yX,t3)=>{t3.exports=o3;function o3(_,q){if(_&&q)return o3(_)(q);if(typeof _!=="function")throw TypeError("need wrapper function");return Object.keys(_).forEach(function(Q){$[Q]=_[Q]}),$;function $(){var Q=Array(arguments.length);for(var x=0;x<Q.length;x++)Q[x]=arguments[x];var X=_.apply(this,Q),V=Q[Q.length-1];if(typeof X==="function"&&X!==V)Object.keys(V).forEach(function(J){X[J]=V[J]});return X}}});var t2=A((kX,o2)=>{var e3=r3();o2.exports=e3(J1);o2.exports.strict=e3(_8);J1.proto=J1(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return J1(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return _8(this)},configurable:!0})});function J1(_){var q=function(){if(q.called)return q.value;return q.called=!0,q.value=_.apply(this,arguments)};return q.called=!1,q}function _8(_){var q=function(){if(q.called)throw Error(q.onceError);return q.called=!0,q.value=_.apply(this,arguments)},$=_.name||"Function wrapped with `once`";return q.onceError=$+" shouldn't be called more than once",q.called=!1,q}});var Q8=A((mX,$8)=>{var qq=t2(),$q=function(){},Qq=global.Bare?queueMicrotask:process.nextTick.bind(process),xq=function(_){return _.setHeader&&typeof _.abort==="function"},Xq=function(_){return _.stdio&&Array.isArray(_.stdio)&&_.stdio.length===3},q8=function(_,q,$){if(typeof q==="function")return q8(_,null,q);if(!q)q={};$=qq($||$q);var{_writableState:Q,_readableState:x}=_,X=q.readable||q.readable!==!1&&_.readable,V=q.writable||q.writable!==!1&&_.writable,J=!1,K=function(){if(!_.writable)G()},G=function(){if(V=!1,!X)$.call(_)},Z=function(){if(X=!1,!V)$.call(_)},Y=function(P){$.call(_,P?Error("exited with error code: "+P):null)},H=function(P){$.call(_,P)},w=function(){Qq(L)},L=function(){if(J)return;if(X&&!(x&&(x.ended&&!x.destroyed)))return $.call(_,Error("premature close"));if(V&&!(Q&&(Q.ended&&!Q.destroyed)))return $.call(_,Error("premature close"))},z=function(){_.req.on("finish",G)};if(xq(_))if(_.on("complete",G),_.on("abort",w),_.req)z();else _.on("request",z);else if(V&&!Q)_.on("end",K),_.on("close",K);if(Xq(_))_.on("exit",Y);if(_.on("end",Z),_.on("finish",G),q.error!==!1)_.on("error",H);return _.on("close",w),function(){if(J=!0,_.removeListener("complete",G),_.removeListener("abort",w),_.removeListener("request",z),_.req)_.req.removeListener("finish",G);_.removeListener("end",K),_.removeListener("close",K),_.removeListener("finish",G),_.removeListener("exit",Y),_.removeListener("end",Z),_.removeListener("error",H),_.removeListener("close",w)}};$8.exports=q8});var V8=A((EX,X8)=>{var Vq=t2(),Jq=Q8(),K1;try{K1=j("fs")}catch(_){}var Q6=function(){},Kq=typeof process>"u"?!1:/^v?\.0/.test(process.version),Z1=function(_){return typeof _==="function"},Zq=function(_){if(!Kq)return!1;if(!K1)return!1;return(_ instanceof(K1.ReadStream||Q6)||_ instanceof(K1.WriteStream||Q6))&&Z1(_.close)},Gq=function(_){return _.setHeader&&Z1(_.abort)},Yq=function(_,q,$,Q){Q=Vq(Q);var x=!1;_.on("close",function(){x=!0}),Jq(_,{readable:q,writable:$},function(V){if(V)return Q(V);x=!0,Q()});var X=!1;return function(V){if(x)return;if(X)return;if(X=!0,Zq(_))return _.close(Q6);if(Gq(_))return _.abort();if(Z1(_.destroy))return _.destroy();Q(V||Error("stream was destroyed"))}},x8=function(_){_()},Hq=function(_,q){return _.pipe(q)},vq=function(){var _=Array.prototype.slice.call(arguments),q=Z1(_[_.length-1]||Q6)&&_.pop()||Q6;if(Array.isArray(_[0]))_=_[0];if(_.length<2)throw Error("pump requires two streams per minimum");var $,Q=_.map(function(x,X){var V=X<_.length-1,J=X>0;return Yq(x,V,J,function(K){if(!$)$=K;if(K)Q.forEach(x8);if(V)return;Q.forEach(x8),q($)})});return _.reduce(Hq)};X8.exports=vq});var K8=A((bX,J8)=>{var{PassThrough:Wq}=j("stream");J8.exports=(_)=>{_={..._};let{array:q}=_,{encoding:$}=_,Q=$==="buffer",x=!1;if(q)x=!($||Q);else $=$||"utf8";if(Q)$=null;let X=new Wq({objectMode:x});if($)X.setEncoding($);let V=0,J=[];return X.on("data",(K)=>{if(J.push(K),x)V=J.length;else V+=K.length}),X.getBufferedValue=()=>{if(q)return J;return Q?Buffer.concat(J,V):J.join("")},X.getBufferedLength=()=>V,X}});var Z8=A((cX,T_)=>{var{constants:wq}=j("buffer"),Lq=V8(),zq=K8();class r2 extends Error{constructor(){super("maxBuffer exceeded");this.name="MaxBufferError"}}async function G1(_,q){if(!_)return Promise.reject(Error("Expected a stream"));q={maxBuffer:1/0,...q};let{maxBuffer:$}=q,Q;return await new Promise((x,X)=>{let V=(J)=>{if(J&&Q.getBufferedLength()<=wq.MAX_LENGTH)J.bufferedData=Q.getBufferedValue();X(J)};Q=Lq(_,zq(q),(J)=>{if(J){V(J);return}x()}),Q.on("data",()=>{if(Q.getBufferedLength()>$)V(new r2)})}),Q.getBufferedValue()}T_.exports=G1;T_.exports.default=G1;T_.exports.buffer=(_,q)=>G1(_,{...q,encoding:"buffer"});T_.exports.array=(_,q)=>G1(_,{...q,array:!0});T_.exports.MaxBufferError=r2});var v8=A((lX,H8)=>{H8.exports=Y1;function Y1(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}Y1.prototype.go=function(_){if(this.pending<this.max)Y8(this,_);else this.waiting.push(_)};Y1.prototype.wait=function(_){if(this.pending===0)_(this.error);else this.listeners.push(_)};Y1.prototype.hold=function(){return G8(this)};function G8(_){_.pending+=1;var q=!1;return $;function $(x){if(q)throw Error("callback called twice");if(q=!0,_.error=_.error||x,_.pending-=1,_.waiting.length>0&&_.pending<_.max)Y8(_,_.waiting.shift());else if(_.pending===0){var X=_.listeners;_.listeners=[],X.forEach(Q)}}function Q(x){x(_.error)}}function Y8(_,q){q(G8(_))}});var w8=A((Oq)=>{var x6=j("fs"),H1=j("util"),e2=j("stream"),W8=e2.Readable,_9=e2.Writable,Pq=e2.PassThrough,Mq=v8(),v1=j("events").EventEmitter;Oq.createFromBuffer=Uq;Oq.createFromFd=Cq;Oq.BufferSlicer=M0;Oq.FdSlicer=P0;H1.inherits(P0,v1);function P0(_,q){q=q||{},v1.call(this),this.fd=_,this.pend=new Mq,this.pend.max=1,this.refCount=0,this.autoClose=!!q.autoClose}P0.prototype.read=function(_,q,$,Q,x){var X=this;X.pend.go(function(V){x6.read(X.fd,_,q,$,Q,function(J,K,G){V(),x(J,K,G)})})};P0.prototype.write=function(_,q,$,Q,x){var X=this;X.pend.go(function(V){x6.write(X.fd,_,q,$,Q,function(J,K,G){V(),x(J,K,G)})})};P0.prototype.createReadStream=function(_){return new W1(this,_)};P0.prototype.createWriteStream=function(_){return new w1(this,_)};P0.prototype.ref=function(){this.refCount+=1};P0.prototype.unref=function(){var _=this;if(_.refCount-=1,_.refCount>0)return;if(_.refCount<0)throw Error("invalid unref");if(_.autoClose)x6.close(_.fd,q);function q($){if($)_.emit("error",$);else _.emit("close")}};H1.inherits(W1,W8);function W1(_,q){q=q||{},W8.call(this,q),this.context=_,this.context.ref(),this.start=q.start||0,this.endOffset=q.end,this.pos=this.start,this.destroyed=!1}W1.prototype._read=function(_){var q=this;if(q.destroyed)return;var $=Math.min(q._readableState.highWaterMark,_);if(q.endOffset!=null)$=Math.min($,q.endOffset-q.pos);if($<=0){q.destroyed=!0,q.push(null),q.context.unref();return}q.context.pend.go(function(Q){if(q.destroyed)return Q();var x=Buffer.allocUnsafe($);x6.read(q.context.fd,x,0,$,q.pos,function(X,V){if(X)q.destroy(X);else if(V===0)q.destroyed=!0,q.push(null),q.context.unref();else q.pos+=V,q.push(x.slice(0,V));Q()})})};W1.prototype.destroy=function(_){if(this.destroyed)return;_=_||Error("stream destroyed"),this.destroyed=!0,this.emit("error",_),this.context.unref()};H1.inherits(w1,_9);function w1(_,q){q=q||{},_9.call(this,q),this.context=_,this.context.ref(),this.start=q.start||0,this.endOffset=q.end==null?1/0:+q.end,this.bytesWritten=0,this.pos=this.start,this.destroyed=!1,this.on("finish",this.destroy.bind(this))}w1.prototype._write=function(_,q,$){var Q=this;if(Q.destroyed)return;if(Q.pos+_.length>Q.endOffset){var x=Error("maximum file length exceeded");x.code="ETOOBIG",Q.destroy(),$(x);return}Q.context.pend.go(function(X){if(Q.destroyed)return X();x6.write(Q.context.fd,_,0,_.length,Q.pos,function(V,J){if(V)Q.destroy(),X(),$(V);else Q.bytesWritten+=J,Q.pos+=J,Q.emit("progress"),X(),$()})})};w1.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=!0,this.context.unref()};H1.inherits(M0,v1);function M0(_,q){v1.call(this),q=q||{},this.refCount=0,this.buffer=_,this.maxChunkSize=q.maxChunkSize||Number.MAX_SAFE_INTEGER}M0.prototype.read=function(_,q,$,Q,x){if(!(0<=q&&q<=_.length))throw RangeError("offset outside buffer: 0 <= "+q+" <= "+_.length);if(Q<0)throw RangeError("position is negative: "+Q);if(q+$>_.length)$=_.length-q;if(Q+$>this.buffer.length)$=this.buffer.length-Q;if($<=0){setImmediate(function(){x(null,0)});return}this.buffer.copy(_,q,Q,Q+$),setImmediate(function(){x(null,$)})};M0.prototype.write=function(_,q,$,Q,x){_.copy(this.buffer,Q,q,q+$),setImmediate(function(){x(null,$,_)})};M0.prototype.createReadStream=function(_){_=_||{};var q=new Pq(_);q.destroyed=!1,q.start=_.start||0,q.endOffset=_.end,q.pos=q.endOffset||this.buffer.length;var $=this.buffer.slice(q.start,q.pos),Q=0;while(!0){var x=Q+this.maxChunkSize;if(x>=$.length){if(Q<$.length)q.write($.slice(Q,$.length));break}q.write($.slice(Q,x)),Q=x}return q.end(),q.destroy=function(){q.destroyed=!0},q};M0.prototype.createWriteStream=function(_){var q=this;_=_||{};var $=new _9(_);return $.start=_.start||0,$.endOffset=_.end==null?this.buffer.length:+_.end,$.bytesWritten=0,$.pos=$.start,$.destroyed=!1,$._write=function(Q,x,X){if($.destroyed)return;var V=$.pos+Q.length;if(V>$.endOffset){var J=Error("maximum file length exceeded");J.code="ETOOBIG",$.destroyed=!0,X(J);return}Q.copy(q.buffer,$.pos,0,Q.length),$.bytesWritten+=Q.length,$.pos=V,$.emit("progress"),X()},$.destroy=function(){$.destroyed=!0},$};M0.prototype.ref=function(){this.refCount+=1};M0.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")};function Uq(_,q){return new M0(_,q)}function Cq(_,q){return new P0(_,q)}});var P8=A((fX,z8)=>{var m0=j("buffer").Buffer,q9=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];if(typeof Int32Array<"u")q9=new Int32Array(q9);function L8(_){if(m0.isBuffer(_))return _;var q=typeof m0.alloc==="function"&&typeof m0.from==="function";if(typeof _==="number")return q?m0.alloc(_):new m0(_);else if(typeof _==="string")return q?m0.from(_):new m0(_);else throw Error("input must be buffer, number, or string, received "+typeof _)}function Tq(_){var q=L8(4);return q.writeInt32BE(_,0),q}function $9(_,q){if(_=L8(_),m0.isBuffer(q))q=q.readUInt32BE(0);var $=~~q^-1;for(var Q=0;Q<_.length;Q++)$=q9[($^_[Q])&255]^$>>>8;return $^-1}function Q9(){return Tq($9.apply(null,arguments))}Q9.signed=function(){return $9.apply(null,arguments)};Q9.unsigned=function(){return $9.apply(null,arguments)>>>0};z8.exports=Q9});var F8=A((gq)=>{var x9=j("fs"),Fq=j("zlib"),M8=w8(),Rq=P8(),P1=j("util"),M1=j("events").EventEmitter,U8=j("stream").Transform,V9=j("stream").PassThrough,Sq=j("stream").Writable;gq.open=Dq;gq.fromFd=C8;gq.fromBuffer=Nq;gq.fromRandomAccessReader=J9;gq.dosDateTimeToDate=B8;gq.getFileNameLowLevel=I8;gq.validateFileName=A8;gq.parseExtraFields=T8;gq.ZipFile=G0;gq.Entry=X6;gq.LocalFileHeader=j8;gq.RandomAccessReader=E0;function Dq(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose==null)q.autoClose=!0;if(q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;if($==null)$=z1;x9.open(_,"r",function(Q,x){if(Q)return $(Q);C8(x,q,function(X,V){if(X)x9.close(x,z1);$(X,V)})})}function C8(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose==null)q.autoClose=!1;if(q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;if($==null)$=z1;x9.fstat(_,function(Q,x){if(Q)return $(Q);var X=M8.createFromFd(_,{autoClose:!0});J9(X,x.size,q,$)})}function Nq(_,q,$){if(typeof q==="function")$=q,q=null;if(q==null)q={};if(q.autoClose=!1,q.lazyEntries==null)q.lazyEntries=!1;if(q.decodeStrings==null)q.decodeStrings=!0;if(q.validateEntrySizes==null)q.validateEntrySizes=!0;if(q.strictFileNames==null)q.strictFileNames=!1;var Q=M8.createFromBuffer(_,{maxChunkSize:65536});J9(Q,_.length,q,$)}function J9(_,q,$,Q){if(typeof $==="function")Q=$,$=null;if($==null)$={};if($.autoClose==null)$.autoClose=!0;if($.lazyEntries==null)$.lazyEntries=!1;if($.decodeStrings==null)$.decodeStrings=!0;var x=!!$.decodeStrings;if($.validateEntrySizes==null)$.validateEntrySizes=!0;if($.strictFileNames==null)$.strictFileNames=!1;if(Q==null)Q=z1;if(typeof q!=="number")throw Error("expected totalSize parameter to be a number");if(q>Number.MAX_SAFE_INTEGER)throw Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");_.ref();var X=22,V=20,J=65535,K=Math.min(V+X+J,q),G=U0(K),Z=q-G.length;R_(_,G,0,K,Z,function(Y){if(Y)return Q(Y);for(var H=K-X;H>=0;H-=1){if(G.readUInt32LE(H)!==101010256)continue;var w=G.subarray(H),L=w.readUInt16LE(4),z=w.readUInt16LE(10),P=w.readUInt32LE(16),u=w.readUInt16LE(20),d=w.length-X;if(u!==d)return Q(Error("Invalid comment length. Expected: "+d+". Found: "+u+". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));var G6=x?L1(w.subarray(22),!1):w.subarray(22);if(H-V>=0&&G.readUInt32LE(H-V)===117853008){var J_=G.subarray(H-V,H-V+V),O9=F_(J_,8),$0=U0(56);return R_(_,$0,0,$0.length,O9,function(Y6){if(Y6)return Q(Y6);if($0.readUInt32LE(0)!==101075792)return Q(Error("invalid zip64 end of central directory record signature"));if(L=$0.readUInt32LE(16),L!==0)return Q(Error("multi-disk zip files are not supported: found disk number: "+L));return z=F_($0,32),P=F_($0,48),Q(null,new G0(_,P,q,z,G6,$.autoClose,$.lazyEntries,x,$.validateEntrySizes,$.strictFileNames))})}if(L!==0)return Q(Error("multi-disk zip files are not supported: found disk number: "+L));return Q(null,new G0(_,P,q,z,G6,$.autoClose,$.lazyEntries,x,$.validateEntrySizes,$.strictFileNames))}Q(Error("End of central directory record signature not found. Either not a zip file, or file is truncated."))})}P1.inherits(G0,M1);function G0(_,q,$,Q,x,X,V,J,K,G){var Z=this;if(M1.call(Z),Z.reader=_,Z.reader.on("error",function(Y){O8(Z,Y)}),Z.reader.once("close",function(){Z.emit("close")}),Z.readEntryCursor=q,Z.fileSize=$,Z.entryCount=Q,Z.comment=x,Z.entriesRead=0,Z.autoClose=!!X,Z.lazyEntries=!!V,Z.decodeStrings=!!J,Z.validateEntrySizes=!!K,Z.strictFileNames=!!G,Z.isOpen=!0,Z.emittedError=!1,!Z.lazyEntries)Z._readEntry()}G0.prototype.close=function(){if(!this.isOpen)return;this.isOpen=!1,this.reader.unref()};function Z0(_,q){if(_.autoClose)_.close();O8(_,q)}function O8(_,q){if(_.emittedError)return;_.emittedError=!0,_.emit("error",q)}G0.prototype.readEntry=function(){if(!this.lazyEntries)throw Error("readEntry() called without lazyEntries:true");this._readEntry()};G0.prototype._readEntry=function(){var _=this;if(_.entryCount===_.entriesRead){setImmediate(function(){if(_.autoClose)_.close();if(_.emittedError)return;_.emit("end")});return}if(_.emittedError)return;var q=U0(46);R_(_.reader,q,0,q.length,_.readEntryCursor,function($){if($)return Z0(_,$);if(_.emittedError)return;var Q=new X6,x=q.readUInt32LE(0);if(x!==33639248)return Z0(_,Error("invalid central directory file header signature: 0x"+x.toString(16)));if(Q.versionMadeBy=q.readUInt16LE(4),Q.versionNeededToExtract=q.readUInt16LE(6),Q.generalPurposeBitFlag=q.readUInt16LE(8),Q.compressionMethod=q.readUInt16LE(10),Q.lastModFileTime=q.readUInt16LE(12),Q.lastModFileDate=q.readUInt16LE(14),Q.crc32=q.readUInt32LE(16),Q.compressedSize=q.readUInt32LE(20),Q.uncompressedSize=q.readUInt32LE(24),Q.fileNameLength=q.readUInt16LE(28),Q.extraFieldLength=q.readUInt16LE(30),Q.fileCommentLength=q.readUInt16LE(32),Q.internalFileAttributes=q.readUInt16LE(36),Q.externalFileAttributes=q.readUInt32LE(38),Q.relativeOffsetOfLocalHeader=q.readUInt32LE(42),Q.generalPurposeBitFlag&64)return Z0(_,Error("strong encryption is not supported"));_.readEntryCursor+=46,q=U0(Q.fileNameLength+Q.extraFieldLength+Q.fileCommentLength),R_(_.reader,q,0,q.length,_.readEntryCursor,function(X){if(X)return Z0(_,X);if(_.emittedError)return;Q.fileNameRaw=q.subarray(0,Q.fileNameLength);var V=Q.fileNameLength+Q.extraFieldLength;Q.extraFieldRaw=q.subarray(Q.fileNameLength,V),Q.fileCommentRaw=q.subarray(V,V+Q.fileCommentLength);try{Q.extraFields=T8(Q.extraFieldRaw)}catch(z){return Z0(_,z)}if(_.decodeStrings){var J=(Q.generalPurposeBitFlag&2048)!==0;Q.fileComment=L1(Q.fileCommentRaw,J),Q.fileName=I8(Q.generalPurposeBitFlag,Q.fileNameRaw,Q.extraFields,_.strictFileNames);var K=A8(Q.fileName);if(K!=null)return Z0(_,Error(K))}else Q.fileComment=Q.fileCommentRaw,Q.fileName=Q.fileNameRaw;Q.comment=Q.fileComment,_.readEntryCursor+=q.length,_.entriesRead+=1;for(var G=0;G<Q.extraFields.length;G++){var Z=Q.extraFields[G];if(Z.id!==1)continue;var Y=Z.data,H=0;if(Q.uncompressedSize===4294967295){if(H+8>Y.length)return Z0(_,Error("zip64 extended information extra field does not include uncompressed size"));Q.uncompressedSize=F_(Y,H),H+=8}if(Q.compressedSize===4294967295){if(H+8>Y.length)return Z0(_,Error("zip64 extended information extra field does not include compressed size"));Q.compressedSize=F_(Y,H),H+=8}if(Q.relativeOffsetOfLocalHeader===4294967295){if(H+8>Y.length)return Z0(_,Error("zip64 extended information extra field does not include relative header offset"));Q.relativeOffsetOfLocalHeader=F_(Y,H),H+=8}break}if(_.validateEntrySizes&&Q.compressionMethod===0){var w=Q.uncompressedSize;if(Q.isEncrypted())w+=12;if(Q.compressedSize!==w){var L="compressed/uncompressed size mismatch for stored file: "+Q.compressedSize+" != "+Q.uncompressedSize;return Z0(_,Error(L))}}if(_.emit("entry",Q),!_.lazyEntries)_._readEntry()})})};G0.prototype.openReadStream=function(_,q,$){var Q=this,x=0,X=_.compressedSize;if($==null)$=q,q=null;if(q==null)q={};else{if(q.decrypt!=null){if(!_.isEncrypted())throw Error("options.decrypt can only be specified for encrypted entries");if(q.decrypt!==!1)throw Error("invalid options.decrypt value: "+q.decrypt);if(_.isCompressed()){if(q.decompress!==!1)throw Error("entry is encrypted and compressed, and options.decompress !== false")}}if(q.decompress!=null){if(!_.isCompressed())throw Error("options.decompress can only be specified for compressed entries");if(!(q.decompress===!1||q.decompress===!0))throw Error("invalid options.decompress value: "+q.decompress)}if(q.start!=null||q.end!=null){if(_.isCompressed()&&q.decompress!==!1)throw Error("start/end range not allowed for compressed entry without options.decompress === false");if(_.isEncrypted()&&q.decrypt!==!1)throw Error("start/end range not allowed for encrypted entry without options.decrypt === false")}if(q.start!=null){if(x=q.start,x<0)throw Error("options.start < 0");if(x>_.compressedSize)throw Error("options.start > entry.compressedSize")}if(q.end!=null){if(X=q.end,X<0)throw Error("options.end < 0");if(X>_.compressedSize)throw Error("options.end > entry.compressedSize");if(X<x)throw Error("options.end < options.start")}}if(!Q.isOpen)return $(Error("closed"));if(_.isEncrypted()){if(q.decrypt!==!1)return $(Error("entry is encrypted, and options.decrypt !== false"))}var V;if(_.compressionMethod===0)V=!1;else if(_.compressionMethod===8)V=q.decompress!=null?q.decompress:!0;else return $(Error("unsupported compression method: "+_.compressionMethod));Q.readLocalFileHeader(_,{minimal:!0},function(J,K){if(J)return $(J);Q.openReadStreamLowLevel(K.fileDataStart,_.compressedSize,x,X,V,_.uncompressedSize,$)})};G0.prototype.openReadStreamLowLevel=function(_,q,$,Q,x,X,V){var J=this,K=_+q,G=J.reader.createReadStream({start:_+$,end:_+Q}),Z=G;if(x){var Y=!1,H=Fq.createInflateRaw();if(G.on("error",function(w){setImmediate(function(){if(!Y)H.emit("error",w)})}),G.pipe(H),J.validateEntrySizes)Z=new V6(X),H.on("error",function(w){setImmediate(function(){if(!Y)Z.emit("error",w)})}),H.pipe(Z);else Z=H;X9(Z,function(){if(Y=!0,H!==Z)H.unpipe(Z);G.unpipe(H),G.destroy()})}V(null,Z)};G0.prototype.readLocalFileHeader=function(_,q,$){var Q=this;if($==null)$=q,q=null;if(q==null)q={};Q.reader.ref();var x=U0(30);R_(Q.reader,x,0,x.length,_.relativeOffsetOfLocalHeader,function(X){try{if(X)return $(X);var V=x.readUInt32LE(0);if(V!==67324752)return $(Error("invalid local file header signature: 0x"+V.toString(16)));var J=x.readUInt16LE(26),K=x.readUInt16LE(28),G=_.relativeOffsetOfLocalHeader+30+J+K;if(G+_.compressedSize>Q.fileSize)return $(Error("file data overflows file bounds: "+G+" + "+_.compressedSize+" > "+Q.fileSize));if(q.minimal)return $(null,{fileDataStart:G});var Z=new j8;Z.fileDataStart=G,Z.versionNeededToExtract=x.readUInt16LE(4),Z.generalPurposeBitFlag=x.readUInt16LE(6),Z.compressionMethod=x.readUInt16LE(8),Z.lastModFileTime=x.readUInt16LE(10),Z.lastModFileDate=x.readUInt16LE(12),Z.crc32=x.readUInt32LE(14),Z.compressedSize=x.readUInt32LE(18),Z.uncompressedSize=x.readUInt32LE(22),Z.fileNameLength=J,Z.extraFieldLength=K,x=U0(J+K),Q.reader.ref(),R_(Q.reader,x,0,x.length,_.relativeOffsetOfLocalHeader+30,function(Y){try{if(Y)return $(Y);return Z.fileName=x.subarray(0,J),Z.extraField=x.subarray(J),$(null,Z)}finally{Q.reader.unref()}})}finally{Q.reader.unref()}})};function X6(){}X6.prototype.getLastModDate=function(_){if(_==null)_={};if(!_.forceDosFormat)for(var q=0;q<this.extraFields.length;q++){var $=this.extraFields[q];if($.id===21589){var Q=$.data;if(Q.length<5)continue;var x=Q[0],X=1;if(!(x&X))continue;var V=Q.readInt32LE(1);return new Date(V*1000)}else if($.id===10){var Q=$.data,J=4;while(J<Q.length+4){var K=Q.readUInt16LE(J);J+=2;var G=Q.readUInt16LE(J);if(J+=2,K!==1){J+=G;continue}if(G<8||J+G>Q.length)break;var Z=4294967296*Q.readInt32LE(J+4)+Q.readUInt32LE(J),Y=Z/1e4-11644473600000;return new Date(Y)}}}return B8(this.lastModFileDate,this.lastModFileTime,_.timezone)};X6.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!==0};X6.prototype.isCompressed=function(){return this.compressionMethod===8};function j8(){}function B8(_,q,$){var Q=_&31,x=(_>>5&15)-1,X=(_>>9&127)+1980,V=0,J=(q&31)*2,K=q>>5&63,G=q>>11&31;if($==null||$==="local")return new Date(X,x,Q,G,K,J,V);else if($==="UTC")return new Date(Date.UTC(X,x,Q,G,K,J,V));else throw Error("unrecognized options.timezone: "+options.timezone)}function I8(_,q,$,Q){var x=null;for(var X=0;X<$.length;X++){var V=$[X];if(V.id===28789){if(V.data.length<6)continue;if(V.data.readUInt8(0)!==1)continue;var J=V.data.readUInt32LE(1);if(Rq.unsigned(q)!==J)continue;x=L1(V.data.subarray(5),!0);break}}if(x==null){var K=(_&2048)!==0;x=L1(q,K)}if(!Q)x=x.replace(/\\/g,"/");return x}function A8(_){if(_.indexOf("\\")!==-1)return"invalid characters in fileName: "+_;if(/^[a-zA-Z]:/.test(_)||/^\//.test(_))return"absolute path: "+_;if(_.split("/").indexOf("..")!==-1)return"invalid relative path: "+_;return null}function T8(_){var q=[],$=0;while($<_.length-3){var Q=_.readUInt16LE($+0),x=_.readUInt16LE($+2),X=$+4,V=X+x;if(V>_.length)throw Error("extra field length exceeds extra field buffer size");var J=_.subarray(X,V);q.push({id:Q,data:J}),$=V}return q}function R_(_,q,$,Q,x,X){if(Q===0)return setImmediate(function(){X(null,U0(0))});_.read(q,$,Q,x,function(V,J){if(V)return X(V);if(J<Q)return X(Error("unexpected EOF"));X()})}P1.inherits(V6,U8);function V6(_){U8.call(this),this.actualByteCount=0,this.expectedByteCount=_}V6.prototype._transform=function(_,q,$){if(this.actualByteCount+=_.length,this.actualByteCount>this.expectedByteCount){var Q="too many bytes in the stream. expected "+this.expectedByteCount+". got at least "+this.actualByteCount;return $(Error(Q))}$(null,_)};V6.prototype._flush=function(_){if(this.actualByteCount<this.expectedByteCount){var q="not enough bytes in the stream. expected "+this.expectedByteCount+". got only "+this.actualByteCount;return _(Error(q))}_()};P1.inherits(E0,M1);function E0(){M1.call(this),this.refCount=0}E0.prototype.ref=function(){this.refCount+=1};E0.prototype.unref=function(){var _=this;if(_.refCount-=1,_.refCount>0)return;if(_.refCount<0)throw Error("invalid unref");_.close(q);function q($){if($)return _.emit("error",$);_.emit("close")}};E0.prototype.createReadStream=function(_){if(_==null)_={};var{start:q,end:$}=_;if(q===$){var Q=new V9;return setImmediate(function(){Q.end()}),Q}var x=this._readStreamForRange(q,$),X=!1,V=new U1(this);x.on("error",function(K){setImmediate(function(){if(!X)V.emit("error",K)})}),X9(V,function(){x.unpipe(V),V.unref(),x.destroy()});var J=new V6($-q);return V.on("error",function(K){setImmediate(function(){if(!X)J.emit("error",K)})}),X9(J,function(){X=!0,V.unpipe(J),V.destroy()}),x.pipe(V).pipe(J)};E0.prototype._readStreamForRange=function(_,q){throw Error("not implemented")};E0.prototype.read=function(_,q,$,Q,x){var X=this.createReadStream({start:Q,end:Q+$}),V=new Sq,J=0;V._write=function(K,G,Z){K.copy(_,q+J,0,K.length),J+=K.length,Z()},V.on("finish",x),X.on("error",function(K){x(K)}),X.pipe(V)};E0.prototype.close=function(_){setImmediate(_)};P1.inherits(U1,V9);function U1(_){V9.call(this),this.context=_,this.context.ref(),this.unreffedYet=!1}U1.prototype._flush=function(_){this.unref(),_()};U1.prototype.unref=function(_){if(this.unreffedYet)return;this.unreffedYet=!0,this.context.unref()};var hq="\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";function L1(_,q){if(q)return _.toString("utf8");else{var $="";for(var Q=0;Q<_.length;Q++)$+=hq[_[Q]];return $}}function F_(_,q){var $=_.readUInt32LE(q),Q=_.readUInt32LE(q+4);return Q*4294967296+$}var U0;if(typeof Buffer.allocUnsafe==="function")U0=function(_){return Buffer.allocUnsafe(_)};else U0=function(_){return new Buffer(_)};function X9(_,q){if(typeof _.destroy==="function")_._destroy=function($,Q){if(q(),Q!=null)Q($)};else _.destroy=q}function z1(_){if(_)throw _}});var D8=A((pX,S8)=>{var _0=a3()("extract-zip"),{createWriteStream:sq,promises:S_}=j("fs"),nq=Z8(),X_=j("path"),{promisify:K9}=j("util"),aq=j("stream"),oq=F8(),tq=K9(oq.open),rq=K9(aq.pipeline);class R8{constructor(_,q){this.zipPath=_,this.opts=q}async extract(){return _0("opening",this.zipPath,"with opts",this.opts),this.zipfile=await tq(this.zipPath,{lazyEntries:!0}),this.canceled=!1,new Promise((_,q)=>{this.zipfile.on("error",($)=>{this.canceled=!0,q($)}),this.zipfile.readEntry(),this.zipfile.on("close",()=>{if(!this.canceled)_0("zip extraction complete"),_()}),this.zipfile.on("entry",async($)=>{if(this.canceled){_0("skipping entry",$.fileName,{cancelled:this.canceled});return}if(_0("zipfile entry",$.fileName),$.fileName.startsWith("__MACOSX/")){this.zipfile.readEntry();return}let Q=X_.dirname(X_.join(this.opts.dir,$.fileName));try{await S_.mkdir(Q,{recursive:!0});let x=await S_.realpath(Q);if(X_.relative(this.opts.dir,x).split(X_.sep).includes(".."))throw Error(`Out of bound path "${x}" found while processing file ${$.fileName}`);await this.extractEntry($),_0("finished processing",$.fileName),this.zipfile.readEntry()}catch(x){this.canceled=!0,this.zipfile.close(),q(x)}})})}async extractEntry(_){if(this.canceled){_0("skipping entry extraction",_.fileName,{cancelled:this.canceled});return}if(this.opts.onEntry)this.opts.onEntry(_,this.zipfile);let q=X_.join(this.opts.dir,_.fileName),$=_.externalFileAttributes>>16&65535,Q=61440,x=16384,X=40960,V=($&Q)===X,J=($&Q)===x;if(!J&&_.fileName.endsWith("/"))J=!0;let K=_.versionMadeBy>>8;if(!J)J=K===0&&_.externalFileAttributes===16;_0("extracting entry",{filename:_.fileName,isDir:J,isSymlink:V});let G=this.getExtractedMode($,J)&511,Z=J?q:X_.dirname(q),Y={recursive:!0};if(J)Y.mode=G;if(_0("mkdir",{dir:Z,...Y}),await S_.mkdir(Z,Y),J)return;_0("opening read stream",q);let H=await K9(this.zipfile.openReadStream.bind(this.zipfile))(_);if(V){let w=await nq(H);_0("creating symlink",w,q),await S_.symlink(w,q)}else await rq(H,sq(q,{mode:G}))}getExtractedMode(_,q){let $=_;if($===0)if(q){if(this.opts.defaultDirMode)$=parseInt(this.opts.defaultDirMode,10);if(!$)$=493}else{if(this.opts.defaultFileMode)$=parseInt(this.opts.defaultFileMode,10);if(!$)$=420}return $}}S8.exports=async function(_,q){if(_0("creating target directory",q.dir),!X_.isAbsolute(q.dir))throw Error("Target directory is expected to be absolute");return await S_.mkdir(q.dir,{recursive:!0}),q.dir=await S_.realpath(q.dir),new R8(_,q).extract()}});var Z9=A((sX,N8)=>{var eq=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(..._)=>console.error("SEMVER",..._):()=>{};N8.exports=eq});var G9=A((nX,h8)=>{var _$=Number.MAX_SAFE_INTEGER||9007199254740991,q$=["major","premajor","minor","preminor","patch","prepatch","prerelease"];h8.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:_$,RELEASE_TYPES:q$,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var u8=A((Y0,g8)=>{var{MAX_SAFE_COMPONENT_LENGTH:Y9,MAX_SAFE_BUILD_LENGTH:$$,MAX_LENGTH:Q$}=G9(),x$=Z9();Y0=g8.exports={};var X$=Y0.re=[],V$=Y0.safeRe=[],v=Y0.src=[],J$=Y0.safeSrc=[],W=Y0.t={},K$=0,H9="[a-zA-Z0-9-]",Z$=[["\\s",1],["\\d",Q$],[H9,$$]],G$=(_)=>{for(let[q,$]of Z$)_=_.split(`${q}*`).join(`${q}{0,${$}}`).split(`${q}+`).join(`${q}{1,${$}}`);return _},M=(_,q,$)=>{let Q=G$(q),x=K$++;x$(_,x,q),W[_]=x,v[x]=q,J$[x]=Q,X$[x]=new RegExp(q,$?"g":void 0),V$[x]=new RegExp(Q,$?"g":void 0)};M("NUMERICIDENTIFIER","0|[1-9]\\d*");M("NUMERICIDENTIFIERLOOSE","\\d+");M("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${H9}*`);M("MAINVERSION",`(${v[W.NUMERICIDENTIFIER]})\\.(${v[W.NUMERICIDENTIFIER]})\\.(${v[W.NUMERICIDENTIFIER]})`);M("MAINVERSIONLOOSE",`(${v[W.NUMERICIDENTIFIERLOOSE]})\\.(${v[W.NUMERICIDENTIFIERLOOSE]})\\.(${v[W.NUMERICIDENTIFIERLOOSE]})`);M("PRERELEASEIDENTIFIER",`(?:${v[W.NONNUMERICIDENTIFIER]}|${v[W.NUMERICIDENTIFIER]})`);M("PRERELEASEIDENTIFIERLOOSE",`(?:${v[W.NONNUMERICIDENTIFIER]}|${v[W.NUMERICIDENTIFIERLOOSE]})`);M("PRERELEASE",`(?:-(${v[W.PRERELEASEIDENTIFIER]}(?:\\.${v[W.PRERELEASEIDENTIFIER]})*))`);M("PRERELEASELOOSE",`(?:-?(${v[W.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${v[W.PRERELEASEIDENTIFIERLOOSE]})*))`);M("BUILDIDENTIFIER",`${H9}+`);M("BUILD",`(?:\\+(${v[W.BUILDIDENTIFIER]}(?:\\.${v[W.BUILDIDENTIFIER]})*))`);M("FULLPLAIN",`v?${v[W.MAINVERSION]}${v[W.PRERELEASE]}?${v[W.BUILD]}?`);M("FULL",`^${v[W.FULLPLAIN]}$`);M("LOOSEPLAIN",`[v=\\s]*${v[W.MAINVERSIONLOOSE]}${v[W.PRERELEASELOOSE]}?${v[W.BUILD]}?`);M("LOOSE",`^${v[W.LOOSEPLAIN]}$`);M("GTLT","((?:<|>)?=?)");M("XRANGEIDENTIFIERLOOSE",`${v[W.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);M("XRANGEIDENTIFIER",`${v[W.NUMERICIDENTIFIER]}|x|X|\\*`);M("XRANGEPLAIN",`[v=\\s]*(${v[W.XRANGEIDENTIFIER]})(?:\\.(${v[W.XRANGEIDENTIFIER]})(?:\\.(${v[W.XRANGEIDENTIFIER]})(?:${v[W.PRERELEASE]})?${v[W.BUILD]}?)?)?`);M("XRANGEPLAINLOOSE",`[v=\\s]*(${v[W.XRANGEIDENTIFIERLOOSE]})(?:\\.(${v[W.XRANGEIDENTIFIERLOOSE]})(?:\\.(${v[W.XRANGEIDENTIFIERLOOSE]})(?:${v[W.PRERELEASELOOSE]})?${v[W.BUILD]}?)?)?`);M("XRANGE",`^${v[W.GTLT]}\\s*${v[W.XRANGEPLAIN]}$`);M("XRANGELOOSE",`^${v[W.GTLT]}\\s*${v[W.XRANGEPLAINLOOSE]}$`);M("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Y9}})(?:\\.(\\d{1,${Y9}}))?(?:\\.(\\d{1,${Y9}}))?`);M("COERCE",`${v[W.COERCEPLAIN]}(?:$|[^\\d])`);M("COERCEFULL",v[W.COERCEPLAIN]+`(?:${v[W.PRERELEASE]})?(?:${v[W.BUILD]})?(?:$|[^\\d])`);M("COERCERTL",v[W.COERCE],!0);M("COERCERTLFULL",v[W.COERCEFULL],!0);M("LONETILDE","(?:~>?)");M("TILDETRIM",`(\\s*)${v[W.LONETILDE]}\\s+`,!0);Y0.tildeTrimReplace="$1~";M("TILDE",`^${v[W.LONETILDE]}${v[W.XRANGEPLAIN]}$`);M("TILDELOOSE",`^${v[W.LONETILDE]}${v[W.XRANGEPLAINLOOSE]}$`);M("LONECARET","(?:\\^)");M("CARETTRIM",`(\\s*)${v[W.LONECARET]}\\s+`,!0);Y0.caretTrimReplace="$1^";M("CARET",`^${v[W.LONECARET]}${v[W.XRANGEPLAIN]}$`);M("CARETLOOSE",`^${v[W.LONECARET]}${v[W.XRANGEPLAINLOOSE]}$`);M("COMPARATORLOOSE",`^${v[W.GTLT]}\\s*(${v[W.LOOSEPLAIN]})$|^$`);M("COMPARATOR",`^${v[W.GTLT]}\\s*(${v[W.FULLPLAIN]})$|^$`);M("COMPARATORTRIM",`(\\s*)${v[W.GTLT]}\\s*(${v[W.LOOSEPLAIN]}|${v[W.XRANGEPLAIN]})`,!0);Y0.comparatorTrimReplace="$1$2$3";M("HYPHENRANGE",`^\\s*(${v[W.XRANGEPLAIN]})\\s+-\\s+(${v[W.XRANGEPLAIN]})\\s*$`);M("HYPHENRANGELOOSE",`^\\s*(${v[W.XRANGEPLAINLOOSE]})\\s+-\\s+(${v[W.XRANGEPLAINLOOSE]})\\s*$`);M("STAR","(<|>)?=?\\s*\\*");M("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");M("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var k8=A((aX,y8)=>{var Y$=Object.freeze({loose:!0}),H$=Object.freeze({}),v$=(_)=>{if(!_)return H$;if(typeof _!=="object")return Y$;return _};y8.exports=v$});var c8=A((oX,b8)=>{var m8=/^[0-9]+$/,E8=(_,q)=>{if(typeof _==="number"&&typeof q==="number")return _===q?0:_<q?-1:1;let $=m8.test(_),Q=m8.test(q);if($&&Q)_=+_,q=+q;return _===q?0:$&&!Q?-1:Q&&!$?1:_<q?-1:1},W$=(_,q)=>E8(q,_);b8.exports={compareIdentifiers:E8,rcompareIdentifiers:W$}});var f8=A((tX,d8)=>{var C1=Z9(),{MAX_LENGTH:l8,MAX_SAFE_INTEGER:O1}=G9(),{safeRe:j1,t:B1}=u8(),w$=k8(),{compareIdentifiers:v9}=c8();class q0{constructor(_,q){if(q=w$(q),_ instanceof q0)if(_.loose===!!q.loose&&_.includePrerelease===!!q.includePrerelease)return _;else _=_.version;else if(typeof _!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof _}".`);if(_.length>l8)throw TypeError(`version is longer than ${l8} characters`);C1("SemVer",_,q),this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.includePrerelease;let $=_.trim().match(q.loose?j1[B1.LOOSE]:j1[B1.FULL]);if(!$)throw TypeError(`Invalid Version: ${_}`);if(this.raw=_,this.major=+$[1],this.minor=+$[2],this.patch=+$[3],this.major>O1||this.major<0)throw TypeError("Invalid major version");if(this.minor>O1||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>O1||this.patch<0)throw TypeError("Invalid patch version");if(!$[4])this.prerelease=[];else this.prerelease=$[4].split(".").map((Q)=>{if(/^[0-9]+$/.test(Q)){let x=+Q;if(x>=0&&x<O1)return x}return Q});this.build=$[5]?$[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(_){if(C1("SemVer.compare",this.version,this.options,_),!(_ instanceof q0)){if(typeof _==="string"&&_===this.version)return 0;_=new q0(_,this.options)}if(_.version===this.version)return 0;return this.compareMain(_)||this.comparePre(_)}compareMain(_){if(!(_ instanceof q0))_=new q0(_,this.options);if(this.major<_.major)return-1;if(this.major>_.major)return 1;if(this.minor<_.minor)return-1;if(this.minor>_.minor)return 1;if(this.patch<_.patch)return-1;if(this.patch>_.patch)return 1;return 0}comparePre(_){if(!(_ instanceof q0))_=new q0(_,this.options);if(this.prerelease.length&&!_.prerelease.length)return-1;else if(!this.prerelease.length&&_.prerelease.length)return 1;else if(!this.prerelease.length&&!_.prerelease.length)return 0;let q=0;do{let $=this.prerelease[q],Q=_.prerelease[q];if(C1("prerelease compare",q,$,Q),$===void 0&&Q===void 0)return 0;else if(Q===void 0)return 1;else if($===void 0)return-1;else if($===Q)continue;else return v9($,Q)}while(++q)}compareBuild(_){if(!(_ instanceof q0))_=new q0(_,this.options);let q=0;do{let $=this.build[q],Q=_.build[q];if(C1("build compare",q,$,Q),$===void 0&&Q===void 0)return 0;else if(Q===void 0)return 1;else if($===void 0)return-1;else if($===Q)continue;else return v9($,Q)}while(++q)}inc(_,q,$){if(_.startsWith("pre")){if(!q&&$===!1)throw Error("invalid increment argument: identifier is empty");if(q){let Q=`-${q}`.match(this.options.loose?j1[B1.PRERELEASELOOSE]:j1[B1.PRERELEASE]);if(!Q||Q[1]!==q)throw Error(`invalid identifier: ${q}`)}}switch(_){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",q,$);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",q,$);break;case"prepatch":this.prerelease.length=0,this.inc("patch",q,$),this.inc("pre",q,$);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",q,$);this.inc("pre",q,$);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let Q=Number($)?1:0;if(this.prerelease.length===0)this.prerelease=[Q];else{let x=this.prerelease.length;while(--x>=0)if(typeof this.prerelease[x]==="number")this.prerelease[x]++,x=-2;if(x===-1){if(q===this.prerelease.join(".")&&$===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(Q)}}if(q){let x=[q,Q];if($===!1)x=[q];if(v9(this.prerelease[0],q)===0){if(isNaN(this.prerelease[1]))this.prerelease=x}else this.prerelease=x}break}default:throw Error(`invalid increment argument: ${_}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}d8.exports=q0});var s8=A((rX,p8)=>{var i8=f8(),L$=(_,q,$)=>new i8(_,$).compare(new i8(q,$));p8.exports=L$});var a8=A((eX,n8)=>{var z$=s8(),P$=(_,q,$)=>z$(_,q,$)<0;n8.exports=P$});import b$ from"os";import c$ from"child_process";var e8=H6(F1(),1);import B$ from"path";import I$ from"fs";import _4 from"fs/promises";import A1 from"os";import l4 from"events";import m from"fs";import{EventEmitter as g1}from"node:events";import g9 from"node:stream";import{StringDecoder as N4}from"node:string_decoder";var S9=typeof process==="object"&&process?process:{stdout:null,stderr:null},h4=(_)=>!!_&&typeof _==="object"&&(_ instanceof b||_ instanceof g9||g4(_)||u4(_)),g4=(_)=>!!_&&typeof _==="object"&&_ instanceof g1&&typeof _.pipe==="function"&&_.pipe!==g9.Writable.prototype.pipe,u4=(_)=>!!_&&typeof _==="object"&&_ instanceof g1&&typeof _.write==="function"&&typeof _.end==="function",H0=Symbol("EOF"),v0=Symbol("maybeEmitEnd"),O0=Symbol("emittedEnd"),w6=Symbol("emittingEnd"),D_=Symbol("emittedError"),L6=Symbol("closed"),D9=Symbol("read"),z6=Symbol("flush"),N9=Symbol("flushChunk"),a=Symbol("encoding"),Z_=Symbol("decoder"),S=Symbol("flowing"),N_=Symbol("paused"),G_=Symbol("resume"),D=Symbol("buffer"),k=Symbol("pipes"),N=Symbol("bufferLength"),R1=Symbol("bufferPush"),P6=Symbol("bufferShift"),h=Symbol("objectMode"),T=Symbol("destroyed"),S1=Symbol("error"),D1=Symbol("emitData"),h9=Symbol("emitEnd"),N1=Symbol("emitEnd2"),Q0=Symbol("async"),h1=Symbol("abort"),M6=Symbol("aborted"),h_=Symbol("signal"),c0=Symbol("dataListeners"),E=Symbol("discarded"),g_=(_)=>Promise.resolve().then(_),y4=(_)=>_(),k4=(_)=>_==="end"||_==="finish"||_==="prefinish",m4=(_)=>_ instanceof ArrayBuffer||!!_&&typeof _==="object"&&_.constructor&&_.constructor.name==="ArrayBuffer"&&_.byteLength>=0,E4=(_)=>!Buffer.isBuffer(_)&&ArrayBuffer.isView(_);class u1{src;dest;opts;ondrain;constructor(_,q,$){this.src=_,this.dest=q,this.opts=$,this.ondrain=()=>_[G_](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(_){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class u9 extends u1{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(_,q,$){super(_,q,$);this.proxyErrors=(Q)=>q.emit("error",Q),_.on("error",this.proxyErrors)}}var b4=(_)=>!!_.objectMode,c4=(_)=>!_.objectMode&&!!_.encoding&&_.encoding!=="buffer";class b extends g1{[S]=!1;[N_]=!1;[k]=[];[D]=[];[h];[a];[Q0];[Z_];[H0]=!1;[O0]=!1;[w6]=!1;[L6]=!1;[D_]=null;[N]=0;[T]=!1;[h_];[M6]=!1;[c0]=0;[E]=!1;writable=!0;readable=!0;constructor(..._){let q=_[0]||{};super();if(q.objectMode&&typeof q.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(b4(q))this[h]=!0,this[a]=null;else if(c4(q))this[a]=q.encoding,this[h]=!1;else this[h]=!1,this[a]=null;if(this[Q0]=!!q.async,this[Z_]=this[a]?new N4(this[a]):null,q&&q.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[D]});if(q&&q.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[k]});let{signal:$}=q;if($)if(this[h_]=$,$.aborted)this[h1]();else $.addEventListener("abort",()=>this[h1]())}get bufferLength(){return this[N]}get encoding(){return this[a]}set encoding(_){throw Error("Encoding must be set at instantiation time")}setEncoding(_){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[h]}set objectMode(_){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[Q0]}set["async"](_){this[Q0]=this[Q0]||!!_}[h1](){this[M6]=!0,this.emit("abort",this[h_]?.reason),this.destroy(this[h_]?.reason)}get aborted(){return this[M6]}set aborted(_){}write(_,q,$){if(this[M6])return!1;if(this[H0])throw Error("write after end");if(this[T])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof q==="function")$=q,q="utf8";if(!q)q="utf8";let Q=this[Q0]?g_:y4;if(!this[h]&&!Buffer.isBuffer(_)){if(E4(_))_=Buffer.from(_.buffer,_.byteOffset,_.byteLength);else if(m4(_))_=Buffer.from(_);else if(typeof _!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[h]){if(this[S]&&this[N]!==0)this[z6](!0);if(this[S])this.emit("data",_);else this[R1](_);if(this[N]!==0)this.emit("readable");if($)Q($);return this[S]}if(!_.length){if(this[N]!==0)this.emit("readable");if($)Q($);return this[S]}if(typeof _==="string"&&!(q===this[a]&&!this[Z_]?.lastNeed))_=Buffer.from(_,q);if(Buffer.isBuffer(_)&&this[a])_=this[Z_].write(_);if(this[S]&&this[N]!==0)this[z6](!0);if(this[S])this.emit("data",_);else this[R1](_);if(this[N]!==0)this.emit("readable");if($)Q($);return this[S]}read(_){if(this[T])return null;if(this[E]=!1,this[N]===0||_===0||_&&_>this[N])return this[v0](),null;if(this[h])_=null;if(this[D].length>1&&!this[h])this[D]=[this[a]?this[D].join(""):Buffer.concat(this[D],this[N])];let q=this[D9](_||null,this[D][0]);return this[v0](),q}[D9](_,q){if(this[h])this[P6]();else{let $=q;if(_===$.length||_===null)this[P6]();else if(typeof $==="string")this[D][0]=$.slice(_),q=$.slice(0,_),this[N]-=_;else this[D][0]=$.subarray(_),q=$.subarray(0,_),this[N]-=_}if(this.emit("data",q),!this[D].length&&!this[H0])this.emit("drain");return q}end(_,q,$){if(typeof _==="function")$=_,_=void 0;if(typeof q==="function")$=q,q="utf8";if(_!==void 0)this.write(_,q);if($)this.once("end",$);if(this[H0]=!0,this.writable=!1,this[S]||!this[N_])this[v0]();return this}[G_](){if(this[T])return;if(!this[c0]&&!this[k].length)this[E]=!0;if(this[N_]=!1,this[S]=!0,this.emit("resume"),this[D].length)this[z6]();else if(this[H0])this[v0]();else this.emit("drain")}resume(){return this[G_]()}pause(){this[S]=!1,this[N_]=!0,this[E]=!1}get destroyed(){return this[T]}get flowing(){return this[S]}get paused(){return this[N_]}[R1](_){if(this[h])this[N]+=1;else this[N]+=_.length;this[D].push(_)}[P6](){if(this[h])this[N]-=1;else this[N]-=this[D][0].length;return this[D].shift()}[z6](_=!1){do;while(this[N9](this[P6]())&&this[D].length);if(!_&&!this[D].length&&!this[H0])this.emit("drain")}[N9](_){return this.emit("data",_),this[S]}pipe(_,q){if(this[T])return _;this[E]=!1;let $=this[O0];if(q=q||{},_===S9.stdout||_===S9.stderr)q.end=!1;else q.end=q.end!==!1;if(q.proxyErrors=!!q.proxyErrors,$){if(q.end)_.end()}else if(this[k].push(!q.proxyErrors?new u1(this,_,q):new u9(this,_,q)),this[Q0])g_(()=>this[G_]());else this[G_]();return _}unpipe(_){let q=this[k].find(($)=>$.dest===_);if(q){if(this[k].length===1){if(this[S]&&this[c0]===0)this[S]=!1;this[k]=[]}else this[k].splice(this[k].indexOf(q),1);q.unpipe()}}addListener(_,q){return this.on(_,q)}on(_,q){let $=super.on(_,q);if(_==="data"){if(this[E]=!1,this[c0]++,!this[k].length&&!this[S])this[G_]()}else if(_==="readable"&&this[N]!==0)super.emit("readable");else if(k4(_)&&this[O0])super.emit(_),this.removeAllListeners(_);else if(_==="error"&&this[D_]){let Q=q;if(this[Q0])g_(()=>Q.call(this,this[D_]));else Q.call(this,this[D_])}return $}removeListener(_,q){return this.off(_,q)}off(_,q){let $=super.off(_,q);if(_==="data"){if(this[c0]=this.listeners("data").length,this[c0]===0&&!this[E]&&!this[k].length)this[S]=!1}return $}removeAllListeners(_){let q=super.removeAllListeners(_);if(_==="data"||_===void 0){if(this[c0]=0,!this[E]&&!this[k].length)this[S]=!1}return q}get emittedEnd(){return this[O0]}[v0](){if(!this[w6]&&!this[O0]&&!this[T]&&this[D].length===0&&this[H0]){if(this[w6]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[L6])this.emit("close");this[w6]=!1}}emit(_,...q){let $=q[0];if(_!=="error"&&_!=="close"&&_!==T&&this[T])return!1;else if(_==="data")return!this[h]&&!$?!1:this[Q0]?(g_(()=>this[D1]($)),!0):this[D1]($);else if(_==="end")return this[h9]();else if(_==="close"){if(this[L6]=!0,!this[O0]&&!this[T])return!1;let x=super.emit("close");return this.removeAllListeners("close"),x}else if(_==="error"){this[D_]=$,super.emit(S1,$);let x=!this[h_]||this.listeners("error").length?super.emit("error",$):!1;return this[v0](),x}else if(_==="resume"){let x=super.emit("resume");return this[v0](),x}else if(_==="finish"||_==="prefinish"){let x=super.emit(_);return this.removeAllListeners(_),x}let Q=super.emit(_,...q);return this[v0](),Q}[D1](_){for(let $ of this[k])if($.dest.write(_)===!1)this.pause();let q=this[E]?!1:super.emit("data",_);return this[v0](),q}[h9](){if(this[O0])return!1;return this[O0]=!0,this.readable=!1,this[Q0]?(g_(()=>this[N1]()),!0):this[N1]()}[N1](){if(this[Z_]){let q=this[Z_].end();if(q){for(let $ of this[k])$.dest.write(q);if(!this[E])super.emit("data",q)}}for(let q of this[k])q.end();let _=super.emit("end");return this.removeAllListeners("end"),_}async collect(){let _=Object.assign([],{dataLength:0});if(!this[h])_.dataLength=0;let q=this.promise();return this.on("data",($)=>{if(_.push($),!this[h])_.dataLength+=$.length}),await q,_}async concat(){if(this[h])throw Error("cannot concat in objectMode");let _=await this.collect();return this[a]?_.join(""):Buffer.concat(_,_.dataLength)}async promise(){return new Promise((_,q)=>{this.on(T,()=>q(Error("stream destroyed"))),this.on("error",($)=>q($)),this.on("end",()=>_())})}[Symbol.asyncIterator](){this[E]=!1;let _=!1,q=async()=>{return this.pause(),_=!0,{value:void 0,done:!0}};return{next:()=>{if(_)return q();let Q=this.read();if(Q!==null)return Promise.resolve({done:!1,value:Q});if(this[H0])return q();let x,X,V=(Z)=>{this.off("data",J),this.off("end",K),this.off(T,G),q(),X(Z)},J=(Z)=>{this.off("error",V),this.off("end",K),this.off(T,G),this.pause(),x({value:Z,done:!!this[H0]})},K=()=>{this.off("error",V),this.off("data",J),this.off(T,G),q(),x({done:!0,value:void 0})},G=()=>V(Error("stream destroyed"));return new Promise((Z,Y)=>{X=Y,x=Z,this.once(T,G),this.once("error",V),this.once("end",K),this.once("data",J)})},throw:q,return:q,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[E]=!1;let _=!1,q=()=>{return this.pause(),this.off(S1,q),this.off(T,q),this.off("end",q),_=!0,{done:!0,value:void 0}},$=()=>{if(_)return q();let Q=this.read();return Q===null?q():{done:!1,value:Q}};return this.once("end",q),this.once(S1,q),this.once(T,q),{next:$,throw:q,return:q,[Symbol.iterator](){return this}}}destroy(_){if(this[T]){if(_)this.emit("error",_);else this.emit(T);return this}this[T]=!0,this[E]=!0,this[D].length=0,this[N]=0;let q=this;if(typeof q.close==="function"&&!this[L6])q.close();if(_)this.emit("error",_);else this.emit(T);return this}static get isStream(){return h4}}var d4=m.writev,B0=Symbol("_autoClose"),t=Symbol("_close"),u_=Symbol("_ended"),O=Symbol("_fd"),y1=Symbol("_finished"),w0=Symbol("_flags"),k1=Symbol("_flush"),c1=Symbol("_handleChunk"),l1=Symbol("_makeBuf"),k_=Symbol("_mode"),U6=Symbol("_needDrain"),v_=Symbol("_onerror"),W_=Symbol("_onopen"),m1=Symbol("_onread"),Y_=Symbol("_onwrite"),I0=Symbol("_open"),o=Symbol("_path"),j0=Symbol("_pos"),x0=Symbol("_queue"),H_=Symbol("_read"),E1=Symbol("_readSize"),W0=Symbol("_reading"),y_=Symbol("_remain"),b1=Symbol("_size"),C6=Symbol("_write"),l0=Symbol("_writing"),O6=Symbol("_defaultFlag"),d0=Symbol("_errored");class w_ extends b{[d0]=!1;[O];[o];[E1];[W0]=!1;[b1];[y_];[B0];constructor(_,q){q=q||{};super(q);if(this.readable=!0,this.writable=!1,typeof _!=="string")throw TypeError("path must be a string");if(this[d0]=!1,this[O]=typeof q.fd==="number"?q.fd:void 0,this[o]=_,this[E1]=q.readSize||16777216,this[W0]=!1,this[b1]=typeof q.size==="number"?q.size:1/0,this[y_]=this[b1],this[B0]=typeof q.autoClose==="boolean"?q.autoClose:!0,typeof this[O]==="number")this[H_]();else this[I0]()}get fd(){return this[O]}get path(){return this[o]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[I0](){m.open(this[o],"r",(_,q)=>this[W_](_,q))}[W_](_,q){if(_)this[v_](_);else this[O]=q,this.emit("open",q),this[H_]()}[l1](){return Buffer.allocUnsafe(Math.min(this[E1],this[y_]))}[H_](){if(!this[W0]){this[W0]=!0;let _=this[l1]();if(_.length===0)return process.nextTick(()=>this[m1](null,0,_));m.read(this[O],_,0,_.length,null,(q,$,Q)=>this[m1](q,$,Q))}}[m1](_,q,$){if(this[W0]=!1,_)this[v_](_);else if(this[c1](q,$))this[H_]()}[t](){if(this[B0]&&typeof this[O]==="number"){let _=this[O];this[O]=void 0,m.close(_,(q)=>q?this.emit("error",q):this.emit("close"))}}[v_](_){this[W0]=!0,this[t](),this.emit("error",_)}[c1](_,q){let $=!1;if(this[y_]-=_,_>0)$=super.write(_<q.length?q.subarray(0,_):q);if(_===0||this[y_]<=0)$=!1,this[t](),super.end();return $}emit(_,...q){switch(_){case"prefinish":case"finish":return!1;case"drain":if(typeof this[O]==="number")this[H_]();return!1;case"error":if(this[d0])return!1;return this[d0]=!0,super.emit(_,...q);default:return super.emit(_,...q)}}}class d1 extends w_{[I0](){let _=!0;try{this[W_](null,m.openSync(this[o],"r")),_=!1}finally{if(_)this[t]()}}[H_](){let _=!0;try{if(!this[W0]){this[W0]=!0;do{let q=this[l1](),$=q.length===0?0:m.readSync(this[O],q,0,q.length,null);if(!this[c1]($,q))break}while(!0);this[W0]=!1}_=!1}finally{if(_)this[t]()}}[t](){if(this[B0]&&typeof this[O]==="number"){let _=this[O];this[O]=void 0,m.closeSync(_),this.emit("close")}}}class A0 extends l4{readable=!1;writable=!0;[d0]=!1;[l0]=!1;[u_]=!1;[x0]=[];[U6]=!1;[o];[k_];[B0];[O];[O6];[w0];[y1]=!1;[j0];constructor(_,q){q=q||{};super(q);this[o]=_,this[O]=typeof q.fd==="number"?q.fd:void 0,this[k_]=q.mode===void 0?438:q.mode,this[j0]=typeof q.start==="number"?q.start:void 0,this[B0]=typeof q.autoClose==="boolean"?q.autoClose:!0;let $=this[j0]!==void 0?"r+":"w";if(this[O6]=q.flags===void 0,this[w0]=q.flags===void 0?$:q.flags,this[O]===void 0)this[I0]()}emit(_,...q){if(_==="error"){if(this[d0])return!1;this[d0]=!0}return super.emit(_,...q)}get fd(){return this[O]}get path(){return this[o]}[v_](_){this[t](),this[l0]=!0,this.emit("error",_)}[I0](){m.open(this[o],this[w0],this[k_],(_,q)=>this[W_](_,q))}[W_](_,q){if(this[O6]&&this[w0]==="r+"&&_&&_.code==="ENOENT")this[w0]="w",this[I0]();else if(_)this[v_](_);else if(this[O]=q,this.emit("open",q),!this[l0])this[k1]()}end(_,q){if(_)this.write(_,q);if(this[u_]=!0,!this[l0]&&!this[x0].length&&typeof this[O]==="number")this[Y_](null,0);return this}write(_,q){if(typeof _==="string")_=Buffer.from(_,q);if(this[u_])return this.emit("error",Error("write() after end()")),!1;if(this[O]===void 0||this[l0]||this[x0].length)return this[x0].push(_),this[U6]=!0,!1;return this[l0]=!0,this[C6](_),!0}[C6](_){m.write(this[O],_,0,_.length,this[j0],(q,$)=>this[Y_](q,$))}[Y_](_,q){if(_)this[v_](_);else{if(this[j0]!==void 0&&typeof q==="number")this[j0]+=q;if(this[x0].length)this[k1]();else if(this[l0]=!1,this[u_]&&!this[y1])this[y1]=!0,this[t](),this.emit("finish");else if(this[U6])this[U6]=!1,this.emit("drain")}}[k1](){if(this[x0].length===0){if(this[u_])this[Y_](null,0)}else if(this[x0].length===1)this[C6](this[x0].pop());else{let _=this[x0];this[x0]=[],d4(this[O],_,this[j0],(q,$)=>this[Y_](q,$))}}[t](){if(this[B0]&&typeof this[O]==="number"){let _=this[O];this[O]=void 0,m.close(_,(q)=>q?this.emit("error",q):this.emit("close"))}}}class m_ extends A0{[I0](){let _;if(this[O6]&&this[w0]==="r+")try{_=m.openSync(this[o],this[w0],this[k_])}catch(q){if(q?.code==="ENOENT")return this[w0]="w",this[I0]();else throw q}else _=m.openSync(this[o],this[w0],this[k_]);this[W_](null,_)}[t](){if(this[B0]&&typeof this[O]==="number"){let _=this[O];this[O]=void 0,m.closeSync(_),this.emit("close")}}[C6](_){let q=!0;try{this[Y_](null,m.writeSync(this[O],_,0,_.length,this[j0])),q=!1}finally{if(q)try{this[t]()}catch{}}}}import W3 from"node:path";import P_ from"node:fs";import{dirname as U5,parse as C5}from"path";var f4=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),y9=(_)=>!!_.sync&&!!_.file,k9=(_)=>!_.sync&&!!_.file,m9=(_)=>!!_.sync&&!_.file,E9=(_)=>!_.sync&&!_.file;var b9=(_)=>!!_.file;var i4=(_)=>{let q=f4.get(_);if(q)return q;return _},E_=(_={})=>{if(!_)return{};let q={};for(let[$,Q]of Object.entries(_)){let x=i4($);q[x]=Q}if(q.chmod===void 0&&q.noChmod===!1)q.chmod=!0;return delete q.noChmod,q};var X0=(_,q,$,Q,x)=>{return Object.assign((X=[],V,J)=>{if(Array.isArray(X))V=X,X={};if(typeof V==="function")J=V,V=void 0;if(!V)V=[];else V=Array.from(V);let K=E_(X);if(x?.(K,V),y9(K)){if(typeof J==="function")throw TypeError("callback not supported for sync tar functions");return _(K,V)}else if(k9(K)){let G=q(K,V),Z=J?J:void 0;return Z?G.then(()=>Z(),Z):G}else if(m9(K)){if(typeof J==="function")throw TypeError("callback not supported for sync tar functions");return $(K,V)}else if(E9(K)){if(typeof J==="function")throw TypeError("callback only supported with file option");return Q(K,V)}else throw Error("impossible options??")},{syncFile:_,asyncFile:q,syncNoFile:$,asyncNoFile:Q,validate:x})};import{EventEmitter as L5}from"events";import s1 from"assert";import{Buffer as f0}from"buffer";import*as c9 from"zlib";import p4 from"zlib";var s4=p4.constants||{ZLIB_VERNUM:4736},f=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},s4));var n4=f0.concat,l9=Object.getOwnPropertyDescriptor(f0,"concat"),a4=(_)=>_,i1=l9?.writable===!0||l9?.set!==void 0?(_)=>{f0.concat=_?a4:n4}:(_)=>{},i0=Symbol("_superWrite");class b_ extends Error{code;errno;constructor(_,q){super("zlib: "+_.message,{cause:_});if(this.code=_.code,this.errno=_.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+_.message,Error.captureStackTrace(this,q??this.constructor)}get name(){return"ZlibError"}}var p1=Symbol("flushFlag");class j6 extends b{#_=!1;#$=!1;#Q;#X;#x;#q;#V;get sawError(){return this.#_}get handle(){return this.#q}get flushFlag(){return this.#Q}constructor(_,q){if(!_||typeof _!=="object")throw TypeError("invalid options for ZlibBase constructor");super(_);if(this.#Q=_.flush??0,this.#X=_.finishFlush??0,this.#x=_.fullFlushFlag??0,typeof c9[q]!=="function")throw TypeError("Compression method not supported: "+q);try{this.#q=new c9[q](_)}catch($){throw new b_($,this.constructor)}this.#V=($)=>{if(this.#_)return;this.#_=!0,this.close(),this.emit("error",$)},this.#q?.on("error",($)=>this.#V(new b_($))),this.once("end",()=>this.close)}close(){if(this.#q)this.#q.close(),this.#q=void 0,this.emit("close")}reset(){if(!this.#_)return s1(this.#q,"zlib binding closed"),this.#q.reset?.()}flush(_){if(this.ended)return;if(typeof _!=="number")_=this.#x;this.write(Object.assign(f0.alloc(0),{[p1]:_}))}end(_,q,$){if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(_)if(q)this.write(_,q);else this.write(_);return this.flush(this.#X),this.#$=!0,super.end($)}get ended(){return this.#$}[i0](_){return super.write(_)}write(_,q,$){if(typeof q==="function")$=q,q="utf8";if(typeof _==="string")_=f0.from(_,q);if(this.#_)return;s1(this.#q,"zlib binding closed");let Q=this.#q._handle,x=Q.close;Q.close=()=>{};let X=this.#q.close;this.#q.close=()=>{},i1(!0);let V=void 0;try{let K=typeof _[p1]==="number"?_[p1]:this.#Q;V=this.#q._processChunk(_,K),i1(!1)}catch(K){i1(!1),this.#V(new b_(K,this.write))}finally{if(this.#q)this.#q._handle=Q,Q.close=x,this.#q.close=X,this.#q.removeAllListeners("error")}if(this.#q)this.#q.on("error",(K)=>this.#V(new b_(K,this.write)));let J;if(V)if(Array.isArray(V)&&V.length>0){let K=V[0];J=this[i0](f0.from(K));for(let G=1;G<V.length;G++)J=this[i0](V[G])}else J=this[i0](f0.from(V));if($)$();return J}}class n1 extends j6{#_;#$;constructor(_,q){_=_||{},_.flush=_.flush||f.Z_NO_FLUSH,_.finishFlush=_.finishFlush||f.Z_FINISH,_.fullFlushFlag=f.Z_FULL_FLUSH;super(_,q);this.#_=_.level,this.#$=_.strategy}params(_,q){if(this.sawError)return;if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#_!==_||this.#$!==q){this.flush(f.Z_SYNC_FLUSH),s1(this.handle,"zlib binding closed");let $=this.handle.flush;this.handle.flush=(Q,x)=>{if(typeof Q==="function")x=Q,Q=this.flushFlag;this.flush(Q),x?.()};try{this.handle.params(_,q)}finally{this.handle.flush=$}if(this.handle)this.#_=_,this.#$=q}}}class a1 extends n1{#_;constructor(_){super(_,"Gzip");this.#_=_&&!!_.portable}[i0](_){if(!this.#_)return super[i0](_);return this.#_=!1,_[9]=255,super[i0](_)}}class o1 extends n1{constructor(_){super(_,"Unzip")}}class t1 extends j6{constructor(_,q){_=_||{},_.flush=_.flush||f.BROTLI_OPERATION_PROCESS,_.finishFlush=_.finishFlush||f.BROTLI_OPERATION_FINISH,_.fullFlushFlag=f.BROTLI_OPERATION_FLUSH;super(_,q)}}class r1 extends t1{constructor(_){super(_,"BrotliCompress")}}class e1 extends t1{constructor(_){super(_,"BrotliDecompress")}}class _2 extends j6{constructor(_,q){_=_||{},_.flush=_.flush||f.ZSTD_e_continue,_.finishFlush=_.finishFlush||f.ZSTD_e_end,_.fullFlushFlag=f.ZSTD_e_flush;super(_,q)}}class q2 extends _2{constructor(_){super(_,"ZstdCompress")}}class $2 extends _2{constructor(_){super(_,"ZstdDecompress")}}import{posix as L_}from"node:path";var d9=(_,q)=>{if(!Number.isSafeInteger(_))throw Error("cannot encode number outside of javascript safe integer range");else if(_<0)r4(_,q);else t4(_,q);return q},t4=(_,q)=>{q[0]=128;for(var $=q.length;$>1;$--)q[$-1]=_&255,_=Math.floor(_/256)},r4=(_,q)=>{q[0]=255;var $=!1;_=_*-1;for(var Q=q.length;Q>1;Q--){var x=_&255;if(_=Math.floor(_/256),$)q[Q-1]=i9(x);else if(x===0)q[Q-1]=0;else $=!0,q[Q-1]=p9(x)}},f9=(_)=>{let q=_[0],$=q===128?_5(_.subarray(1,_.length)):q===255?e4(_):null;if($===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger($))throw Error("parsed number outside of javascript safe integer range");return $},e4=(_)=>{var q=_.length,$=0,Q=!1;for(var x=q-1;x>-1;x--){var X=Number(_[x]),V;if(Q)V=i9(X);else if(X===0)V=X;else Q=!0,V=p9(X);if(V!==0)$-=V*Math.pow(256,q-x-1)}return $},_5=(_)=>{var q=_.length,$=0;for(var Q=q-1;Q>-1;Q--){var x=Number(_[Q]);if(x!==0)$+=x*Math.pow(256,q-Q-1)}return $},i9=(_)=>(255^_)&255,p9=(_)=>(255^_)+1&255;var B6=(_)=>I6.has(_);var I6=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),s9=new Map(Array.from(I6).map((_)=>[_[1],_[0]]));class i{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#_="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(_,q=0,$,Q){if(Buffer.isBuffer(_))this.decode(_,q||0,$,Q);else if(_)this.#$(_)}decode(_,q,$,Q){if(!q)q=0;if(!_||!(_.length>=q+512))throw Error("need 512 bytes for header");if(this.path=$?.path??p0(_,q,100),this.mode=$?.mode??Q?.mode??T0(_,q+100,8),this.uid=$?.uid??Q?.uid??T0(_,q+108,8),this.gid=$?.gid??Q?.gid??T0(_,q+116,8),this.size=$?.size??Q?.size??T0(_,q+124,12),this.mtime=$?.mtime??Q?.mtime??Q2(_,q+136,12),this.cksum=T0(_,q+148,12),Q)this.#$(Q,!0);if($)this.#$($);let x=p0(_,q+156,1);if(B6(x))this.#_=x||"0";if(this.#_==="0"&&this.path.slice(-1)==="/")this.#_="5";if(this.#_==="5")this.size=0;if(this.linkpath=p0(_,q+157,100),_.subarray(q+257,q+265).toString()==="ustar\x0000")if(this.uname=$?.uname??Q?.uname??p0(_,q+265,32),this.gname=$?.gname??Q?.gname??p0(_,q+297,32),this.devmaj=$?.devmaj??Q?.devmaj??T0(_,q+329,8)??0,this.devmin=$?.devmin??Q?.devmin??T0(_,q+337,8)??0,_[q+475]!==0){let V=p0(_,q+345,155);this.path=V+"/"+this.path}else{let V=p0(_,q+345,130);if(V)this.path=V+"/"+this.path;this.atime=$?.atime??Q?.atime??Q2(_,q+476,12),this.ctime=$?.ctime??Q?.ctime??Q2(_,q+488,12)}let X=256;for(let V=q;V<q+148;V++)X+=_[V];for(let V=q+156;V<q+512;V++)X+=_[V];if(this.cksumValid=X===this.cksum,this.cksum===void 0&&X===256)this.nullBlock=!0}#$(_,q=!1){Object.assign(this,Object.fromEntries(Object.entries(_).filter(([$,Q])=>{return!(Q===null||Q===void 0||$==="path"&&q||$==="linkpath"&&q||$==="global")})))}encode(_,q=0){if(!_)_=this.block=Buffer.alloc(512);if(this.#_==="Unsupported")this.#_="0";if(!(_.length>=q+512))throw Error("need 512 bytes for header");let $=this.ctime||this.atime?130:155,Q=$5(this.path||"",$),x=Q[0],X=Q[1];if(this.needPax=!!Q[2],this.needPax=s0(_,q,100,x)||this.needPax,this.needPax=F0(_,q+100,8,this.mode)||this.needPax,this.needPax=F0(_,q+108,8,this.uid)||this.needPax,this.needPax=F0(_,q+116,8,this.gid)||this.needPax,this.needPax=F0(_,q+124,12,this.size)||this.needPax,this.needPax=x2(_,q+136,12,this.mtime)||this.needPax,_[q+156]=this.#_.charCodeAt(0),this.needPax=s0(_,q+157,100,this.linkpath)||this.needPax,_.write("ustar\x0000",q+257,8),this.needPax=s0(_,q+265,32,this.uname)||this.needPax,this.needPax=s0(_,q+297,32,this.gname)||this.needPax,this.needPax=F0(_,q+329,8,this.devmaj)||this.needPax,this.needPax=F0(_,q+337,8,this.devmin)||this.needPax,this.needPax=s0(_,q+345,$,X)||this.needPax,_[q+475]!==0)this.needPax=s0(_,q+345,155,X)||this.needPax;else this.needPax=s0(_,q+345,130,X)||this.needPax,this.needPax=x2(_,q+476,12,this.atime)||this.needPax,this.needPax=x2(_,q+488,12,this.ctime)||this.needPax;let V=256;for(let J=q;J<q+148;J++)V+=_[J];for(let J=q+156;J<q+512;J++)V+=_[J];return this.cksum=V,F0(_,q+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#_==="Unsupported"?this.#_:I6.get(this.#_)}get typeKey(){return this.#_}set type(_){let q=String(s9.get(_));if(B6(q)||q==="Unsupported")this.#_=q;else if(B6(_))this.#_=_;else throw TypeError("invalid entry type: "+_)}}var $5=(_,q)=>{let Q=_,x="",X=void 0,V=L_.parse(_).root||".";if(Buffer.byteLength(Q)<100)X=[Q,x,!1];else{x=L_.dirname(Q),Q=L_.basename(Q);do if(Buffer.byteLength(Q)<=100&&Buffer.byteLength(x)<=q)X=[Q,x,!1];else if(Buffer.byteLength(Q)>100&&Buffer.byteLength(x)<=q)X=[Q.slice(0,99),x,!0];else Q=L_.join(L_.basename(x),Q),x=L_.dirname(x);while(x!==V&&X===void 0);if(!X)X=[_.slice(0,99),"",!0]}return X},p0=(_,q,$)=>_.subarray(q,q+$).toString("utf8").replace(/\0.*/,""),Q2=(_,q,$)=>Q5(T0(_,q,$)),Q5=(_)=>_===void 0?void 0:new Date(_*1000),T0=(_,q,$)=>Number(_[q])&128?f9(_.subarray(q,q+$)):X5(_,q,$),x5=(_)=>isNaN(_)?void 0:_,X5=(_,q,$)=>x5(parseInt(_.subarray(q,q+$).toString("utf8").replace(/\0.*$/,"").trim(),8)),V5={12:8589934591,8:2097151},F0=(_,q,$,Q)=>Q===void 0?!1:Q>V5[$]||Q<0?(d9(Q,_.subarray(q,q+$)),!0):(J5(_,q,$,Q),!1),J5=(_,q,$,Q)=>_.write(K5(Q,$),q,$,"ascii"),K5=(_,q)=>Z5(Math.floor(_).toString(8),q),Z5=(_,q)=>(_.length===q-1?_:Array(q-_.length-1).join("0")+_+" ")+"\x00",x2=(_,q,$,Q)=>Q===void 0?!1:F0(_,q,$,Q.getTime()/1000),G5=Array(156).join("\x00"),s0=(_,q,$,Q)=>Q===void 0?!1:(_.write(Q+G5,q,$,"utf8"),Q.length!==Buffer.byteLength(Q)||Q.length>$);import{basename as Y5}from"node:path";class R0{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(_,q=!1){this.atime=_.atime,this.charset=_.charset,this.comment=_.comment,this.ctime=_.ctime,this.dev=_.dev,this.gid=_.gid,this.global=q,this.gname=_.gname,this.ino=_.ino,this.linkpath=_.linkpath,this.mtime=_.mtime,this.nlink=_.nlink,this.path=_.path,this.size=_.size,this.uid=_.uid,this.uname=_.uname}encode(){let _=this.encodeBody();if(_==="")return Buffer.allocUnsafe(0);let q=Buffer.byteLength(_),$=512*Math.ceil(1+q/512),Q=Buffer.allocUnsafe($);for(let x=0;x<512;x++)Q[x]=0;new i({path:("PaxHeader/"+Y5(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:q,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(Q),Q.write(_,512,q,"utf8");for(let x=q+512;x<Q.length;x++)Q[x]=0;return Q}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(_){if(this[_]===void 0)return"";let q=this[_],$=q instanceof Date?q.getTime()/1000:q,Q=" "+(_==="dev"||_==="ino"||_==="nlink"?"SCHILY.":"")+_+"="+$+`
7
+ `,x=Buffer.byteLength(Q),X=Math.floor(Math.log(x)/Math.log(10))+1;if(x+X>=Math.pow(10,X))X+=1;return X+x+Q}static parse(_,q,$=!1){return new R0(H5(v5(_),q),$)}}var H5=(_,q)=>q?Object.assign({},q,_):_,v5=(_)=>_.replace(/\n$/,"").split(`
8
+ `).reduce(W5,Object.create(null)),W5=(_,q)=>{let $=parseInt(q,10);if($!==Buffer.byteLength(q)+1)return _;q=q.slice(($+" ").length);let Q=q.split("="),x=Q.shift();if(!x)return _;let X=x.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),V=Q.join("=");return _[X]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(X)?new Date(Number(V)*1000):/^[0-9]+$/.test(V)?+V:V,_};var w5=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,U=w5!=="win32"?(_)=>_:(_)=>_&&_.replace(/\\/g,"/");class c_ extends b{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(_,q,$){super({});switch(this.pause(),this.extended=q,this.globalExtended=$,this.header=_,this.remain=_.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=_.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!_.path)throw Error("no path provided for tar.ReadEntry");if(this.path=U(_.path),this.mode=_.mode,this.mode)this.mode=this.mode&4095;if(this.uid=_.uid,this.gid=_.gid,this.uname=_.uname,this.gname=_.gname,this.size=this.remain,this.mtime=_.mtime,this.atime=_.atime,this.ctime=_.ctime,this.linkpath=_.linkpath?U(_.linkpath):void 0,this.uname=_.uname,this.gname=_.gname,q)this.#_(q);if($)this.#_($,!0)}write(_){let q=_.length;if(q>this.blockRemain)throw Error("writing more to entry than is appropriate");let $=this.remain,Q=this.blockRemain;if(this.remain=Math.max(0,$-q),this.blockRemain=Math.max(0,Q-q),this.ignore)return!0;if($>=q)return super.write(_);return super.write(_.subarray(0,$))}#_(_,q=!1){if(_.path)_.path=U(_.path);if(_.linkpath)_.linkpath=U(_.linkpath);Object.assign(this,Object.fromEntries(Object.entries(_).filter(([$,Q])=>{return!(Q===null||Q===void 0||$==="path"&&q)})))}}var n0=(_,q,$,Q={})=>{if(_.file)Q.file=_.file;if(_.cwd)Q.cwd=_.cwd;if(Q.code=$ instanceof Error&&$.code||q,Q.tarCode=q,!_.strict&&Q.recoverable!==!1){if($ instanceof Error)Q=Object.assign($,Q),$=$.message;_.emit("warn",q,$,Q)}else if($ instanceof Error)_.emit("error",Object.assign($,Q));else _.emit("error",Object.assign(Error(`${q}: ${$}`),Q))};var z5=1048576,Z2=Buffer.from([31,139]),G2=Buffer.from([40,181,47,253]),P5=Math.max(Z2.length,G2.length),p=Symbol("state"),a0=Symbol("writeEntry"),L0=Symbol("readEntry"),X2=Symbol("nextEntry"),a9=Symbol("processEntry"),V0=Symbol("extendedHeader"),l_=Symbol("globalExtendedHeader"),S0=Symbol("meta"),o9=Symbol("emitMeta"),I=Symbol("buffer"),z0=Symbol("queue"),D0=Symbol("ended"),V2=Symbol("emittedEnd"),o0=Symbol("emit"),F=Symbol("unzip"),A6=Symbol("consumeChunk"),T6=Symbol("consumeChunkSub"),J2=Symbol("consumeBody"),t9=Symbol("consumeMeta"),r9=Symbol("consumeHeader"),d_=Symbol("consuming"),K2=Symbol("bufferConcat"),F6=Symbol("maybeEnd"),z_=Symbol("writing"),N0=Symbol("aborted"),R6=Symbol("onDone"),t0=Symbol("sawValidEntry"),S6=Symbol("sawNullBlock"),D6=Symbol("sawEOF"),e9=Symbol("closeStream"),M5=()=>!0;class h0 extends L5{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[z0]=[];[I];[L0];[a0];[p]="begin";[S0]="";[V0];[l_];[D0]=!1;[F];[N0]=!1;[t0];[S6]=!1;[D6]=!1;[z_]=!1;[d_]=!1;[V2]=!1;constructor(_={}){super();if(this.file=_.file||"",this.on(R6,()=>{if(this[p]==="begin"||this[t0]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),_.ondone)this.on(R6,_.ondone);else this.on(R6,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")});this.strict=!!_.strict,this.maxMetaEntrySize=_.maxMetaEntrySize||z5,this.filter=typeof _.filter==="function"?_.filter:M5;let q=_.file&&(_.file.endsWith(".tar.br")||_.file.endsWith(".tbr"));this.brotli=!(_.gzip||_.zstd)&&_.brotli!==void 0?_.brotli:q?void 0:!1;let $=_.file&&(_.file.endsWith(".tar.zst")||_.file.endsWith(".tzst"));if(this.zstd=!(_.gzip||_.brotli)&&_.zstd!==void 0?_.zstd:$?!0:void 0,this.on("end",()=>this[e9]()),typeof _.onwarn==="function")this.on("warn",_.onwarn);if(typeof _.onReadEntry==="function")this.on("entry",_.onReadEntry)}warn(_,q,$={}){n0(this,_,q,$)}[r9](_,q){if(this[t0]===void 0)this[t0]=!1;let $;try{$=new i(_,q,this[V0],this[l_])}catch(Q){return this.warn("TAR_ENTRY_INVALID",Q)}if($.nullBlock)if(this[S6]){if(this[D6]=!0,this[p]==="begin")this[p]="header";this[o0]("eof")}else this[S6]=!0,this[o0]("nullBlock");else if(this[S6]=!1,!$.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:$});else if(!$.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:$});else{let Q=$.type;if(/^(Symbolic)?Link$/.test(Q)&&!$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:$});else if(!/^(Symbolic)?Link$/.test(Q)&&!/^(Global)?ExtendedHeader$/.test(Q)&&$.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:$});else{let x=this[a0]=new c_($,this[V0],this[l_]);if(!this[t0])if(x.remain){let X=()=>{if(!x.invalid)this[t0]=!0};x.on("end",X)}else this[t0]=!0;if(x.meta){if(x.size>this.maxMetaEntrySize)x.ignore=!0,this[o0]("ignoredEntry",x),this[p]="ignore",x.resume();else if(x.size>0)this[S0]="",x.on("data",(X)=>this[S0]+=X),this[p]="meta"}else if(this[V0]=void 0,x.ignore=x.ignore||!this.filter(x.path,x),x.ignore)this[o0]("ignoredEntry",x),this[p]=x.remain?"ignore":"header",x.resume();else{if(x.remain)this[p]="body";else this[p]="header",x.end();if(!this[L0])this[z0].push(x),this[X2]();else this[z0].push(x)}}}}[e9](){queueMicrotask(()=>this.emit("close"))}[a9](_){let q=!0;if(!_)this[L0]=void 0,q=!1;else if(Array.isArray(_)){let[$,...Q]=_;this.emit($,...Q)}else if(this[L0]=_,this.emit("entry",_),!_.emittedEnd)_.on("end",()=>this[X2]()),q=!1;return q}[X2](){do;while(this[a9](this[z0].shift()));if(!this[z0].length){let _=this[L0];if(!_||_.flowing||_.size===_.remain){if(!this[z_])this.emit("drain")}else _.once("drain",()=>this.emit("drain"))}}[J2](_,q){let $=this[a0];if(!$)throw Error("attempt to consume body without entry??");let Q=$.blockRemain??0,x=Q>=_.length&&q===0?_:_.subarray(q,q+Q);if($.write(x),!$.blockRemain)this[p]="header",this[a0]=void 0,$.end();return x.length}[t9](_,q){let $=this[a0],Q=this[J2](_,q);if(!this[a0]&&$)this[o9]($);return Q}[o0](_,q,$){if(!this[z0].length&&!this[L0])this.emit(_,q,$);else this[z0].push([_,q,$])}[o9](_){switch(this[o0]("meta",this[S0]),_.type){case"ExtendedHeader":case"OldExtendedHeader":this[V0]=R0.parse(this[S0],this[V0],!1);break;case"GlobalExtendedHeader":this[l_]=R0.parse(this[S0],this[l_],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let q=this[V0]??Object.create(null);this[V0]=q,q.path=this[S0].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let q=this[V0]||Object.create(null);this[V0]=q,q.linkpath=this[S0].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+_.type)}}abort(_){this[N0]=!0,this.emit("abort",_),this.warn("TAR_ABORT",_,{recoverable:!1})}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");if(this[N0])return $?.(),!1;if((this[F]===void 0||this.brotli===void 0&&this[F]===!1)&&_){if(this[I])_=Buffer.concat([this[I],_]),this[I]=void 0;if(_.length<P5)return this[I]=_,$?.(),!0;for(let J=0;this[F]===void 0&&J<Z2.length;J++)if(_[J]!==Z2[J])this[F]=!1;let X=!1;if(this[F]===!1&&this.zstd!==!1){X=!0;for(let J=0;J<G2.length;J++)if(_[J]!==G2[J]){X=!1;break}}let V=this.brotli===void 0&&!X;if(this[F]===!1&&V)if(_.length<512)if(this[D0])this.brotli=!0;else return this[I]=_,$?.(),!0;else try{new i(_.subarray(0,512)),this.brotli=!1}catch(J){this.brotli=!0}if(this[F]===void 0||this[F]===!1&&(this.brotli||X)){let J=this[D0];this[D0]=!1,this[F]=this[F]===void 0?new o1({}):X?new $2({}):new e1({}),this[F].on("data",(G)=>this[A6](G)),this[F].on("error",(G)=>this.abort(G)),this[F].on("end",()=>{this[D0]=!0,this[A6]()}),this[z_]=!0;let K=!!this[F][J?"end":"write"](_);return this[z_]=!1,$?.(),K}}if(this[z_]=!0,this[F])this[F].write(_);else this[A6](_);this[z_]=!1;let x=this[z0].length?!1:this[L0]?this[L0].flowing:!0;if(!x&&!this[z0].length)this[L0]?.once("drain",()=>this.emit("drain"));return $?.(),x}[K2](_){if(_&&!this[N0])this[I]=this[I]?Buffer.concat([this[I],_]):_}[F6](){if(this[D0]&&!this[V2]&&!this[N0]&&!this[d_]){this[V2]=!0;let _=this[a0];if(_&&_.blockRemain){let q=this[I]?this[I].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${_.blockRemain} more bytes, only ${q} available)`,{entry:_}),this[I])_.write(this[I]);_.end()}this[o0](R6)}}[A6](_){if(this[d_]&&_)this[K2](_);else if(!_&&!this[I])this[F6]();else if(_){if(this[d_]=!0,this[I]){this[K2](_);let q=this[I];this[I]=void 0,this[T6](q)}else this[T6](_);while(this[I]&&this[I]?.length>=512&&!this[N0]&&!this[D6]){let q=this[I];this[I]=void 0,this[T6](q)}this[d_]=!1}if(!this[I]||this[D0])this[F6]()}[T6](_){let q=0,$=_.length;while(q+512<=$&&!this[N0]&&!this[D6])switch(this[p]){case"begin":case"header":this[r9](_,q),q+=512;break;case"ignore":case"body":q+=this[J2](_,q);break;case"meta":q+=this[t9](_,q);break;default:throw Error("invalid state: "+this[p])}if(q<$)if(this[I])this[I]=Buffer.concat([_.subarray(q),this[I]]);else this[I]=_.subarray(q)}end(_,q,$){if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,q);if($)this.once("finish",$);if(!this[N0])if(this[F]){if(_)this[F].write(_);this[F].end()}else{if(this[D0]=!0,this.brotli===void 0||this.zstd===void 0)_=_||Buffer.alloc(0);if(_)this.write(_);this[F6]()}return this}}var g0=(_)=>{let q=_.length-1,$=-1;while(q>-1&&_.charAt(q)==="/")$=q,q--;return $===-1?_:_.slice(0,$)};var O5=(_)=>{let q=_.onReadEntry;_.onReadEntry=q?($)=>{q($),$.resume()}:($)=>$.resume()},Y2=(_,q)=>{let $=new Map(q.map((X)=>[g0(X),!0])),Q=_.filter,x=(X,V="")=>{let J=V||C5(X).root||".",K;if(X===J)K=!1;else{let G=$.get(X);if(G!==void 0)K=G;else K=x(U5(X),J)}return $.set(X,K),K};_.filter=Q?(X,V)=>Q(X,V)&&x(g0(X)):(X)=>x(g0(X))},j5=(_)=>{let q=new h0(_),$=_.file,Q;try{Q=P_.openSync($,"r");let x=P_.fstatSync(Q),X=_.maxReadSize||16777216;if(x.size<X){let V=Buffer.allocUnsafe(x.size),J=P_.readSync(Q,V,0,x.size,0);q.end(J===V.byteLength?V:V.subarray(0,J))}else{let V=0,J=Buffer.allocUnsafe(X);while(V<x.size){let K=P_.readSync(Q,J,0,X,V);if(K===0)break;V+=K,q.write(J.subarray(0,K))}q.end()}}finally{if(typeof Q==="number")try{P_.closeSync(Q)}catch(x){}}},B5=(_,q)=>{let $=new h0(_),Q=_.maxReadSize||16777216,x=_.file;return new Promise((V,J)=>{$.on("error",J),$.on("end",V),P_.stat(x,(K,G)=>{if(K)J(K);else{let Z=new w_(x,{readSize:Q,size:G.size});Z.on("error",J),Z.pipe($)}})})},r0=X0(j5,B5,(_)=>new h0(_),(_)=>new h0(_),(_,q)=>{if(q?.length)Y2(_,q);if(!_.noResume)O5(_)});import d6 from"fs";import J0 from"fs";import Q3 from"path";var H2=(_,q,$)=>{if(_&=4095,$)_=(_|384)&-19;if(q){if(_&256)_|=64;if(_&32)_|=8;if(_&4)_|=1}return _};import{win32 as I5}from"node:path";var{isAbsolute:A5,parse:_3}=I5,f_=(_)=>{let q="",$=_3(_);while(A5(_)||$.root){let Q=_.charAt(0)==="/"&&_.slice(0,4)!=="//?/"?"/":$.root;_=_.slice(Q.length),q+=Q,$=_3(_)}return[q,_]};var N6=["|","<",">","?",":"],v2=N6.map((_)=>String.fromCharCode(61440+_.charCodeAt(0))),T5=new Map(N6.map((_,q)=>[_,v2[q]])),F5=new Map(v2.map((_,q)=>[_,N6[q]])),W2=(_)=>N6.reduce((q,$)=>q.split($).join(T5.get($)),_),q3=(_)=>v2.reduce((q,$)=>q.split($).join(F5.get($)),_);var K3=(_,q)=>{if(!q)return U(_);return _=U(_).replace(/^\.(\/|$)/,""),g0(q)+"/"+_},R5=16777216,x3=Symbol("process"),X3=Symbol("file"),V3=Symbol("directory"),L2=Symbol("symlink"),J3=Symbol("hardlink"),i_=Symbol("header"),h6=Symbol("read"),z2=Symbol("lstat"),g6=Symbol("onlstat"),P2=Symbol("onread"),M2=Symbol("onreadlink"),U2=Symbol("openfile"),C2=Symbol("onopenfile"),u0=Symbol("close"),u6=Symbol("mode"),O2=Symbol("awaitDrain"),w2=Symbol("ondrain"),K0=Symbol("prefix");class y6 extends b{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#_=!1;constructor(_,q={}){let $=E_(q);super();if(this.path=U(_),this.portable=!!$.portable,this.maxReadSize=$.maxReadSize||R5,this.linkCache=$.linkCache||new Map,this.statCache=$.statCache||new Map,this.preservePaths=!!$.preservePaths,this.cwd=U($.cwd||process.cwd()),this.strict=!!$.strict,this.noPax=!!$.noPax,this.noMtime=!!$.noMtime,this.mtime=$.mtime,this.prefix=$.prefix?U($.prefix):void 0,this.onWriteEntry=$.onWriteEntry,typeof $.onwarn==="function")this.on("warn",$.onwarn);let Q=!1;if(!this.preservePaths){let[X,V]=f_(this.path);if(X&&typeof V==="string")this.path=V,Q=X}if(this.win32=!!$.win32||process.platform==="win32",this.win32)this.path=q3(this.path.replace(/\\/g,"/")),_=_.replace(/\\/g,"/");if(this.absolute=U($.absolute||Q3.resolve(this.cwd,_)),this.path==="")this.path="./";if(Q)this.warn("TAR_ENTRY_INFO",`stripping ${Q} from absolute path`,{entry:this,path:Q+this.path});let x=this.statCache.get(this.absolute);if(x)this[g6](x);else this[z2]()}warn(_,q,$={}){return n0(this,_,q,$)}emit(_,...q){if(_==="error")this.#_=!0;return super.emit(_,...q)}[z2](){J0.lstat(this.absolute,(_,q)=>{if(_)return this.emit("error",_);this[g6](q)})}[g6](_){if(this.statCache.set(this.absolute,_),this.stat=_,!_.isFile())_.size=0;this.type=S5(_),this.emit("stat",_),this[x3]()}[x3](){switch(this.type){case"File":return this[X3]();case"Directory":return this[V3]();case"SymbolicLink":return this[L2]();default:return this.end()}}[u6](_){return H2(_,this.type==="Directory",this.portable)}[K0](_){return K3(_,this.prefix)}[i_](){if(!this.stat)throw Error("cannot write header before stat");if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.onWriteEntry?.(this),this.header=new i({path:this[K0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[K0](this.linkpath):this.linkpath,mode:this[u6](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax)super.write(new R0({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[K0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[K0](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let _=this.header?.block;if(!_)throw Error("failed to encode header");super.write(_)}[V3](){if(!this.stat)throw Error("cannot create directory entry without stat");if(this.path.slice(-1)!=="/")this.path+="/";this.stat.size=0,this[i_](),this.end()}[L2](){J0.readlink(this.absolute,(_,q)=>{if(_)return this.emit("error",_);this[M2](q)})}[M2](_){this.linkpath=U(_),this[i_](),this.end()}[J3](_){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=U(Q3.relative(this.cwd,_)),this.stat.size=0,this[i_](),this.end()}[X3](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let _=`${this.stat.dev}:${this.stat.ino}`,q=this.linkCache.get(_);if(q?.indexOf(this.cwd)===0)return this[J3](q);this.linkCache.set(_,this.absolute)}if(this[i_](),this.stat.size===0)return this.end();this[U2]()}[U2](){J0.open(this.absolute,"r",(_,q)=>{if(_)return this.emit("error",_);this[C2](q)})}[C2](_){if(this.fd=_,this.#_)return this[u0]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let q=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(q),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[h6]()}[h6](){let{fd:_,buf:q,offset:$,length:Q,pos:x}=this;if(_===void 0||q===void 0)throw Error("cannot read file without first opening");J0.read(_,q,$,Q,x,(X,V)=>{if(X)return this[u0](()=>this.emit("error",X));this[P2](V)})}[u0](_=()=>{}){if(this.fd!==void 0)J0.close(this.fd,_)}[P2](_){if(_<=0&&this.remain>0){let Q=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[u0](()=>this.emit("error",Q))}if(_>this.remain){let Q=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[u0](()=>this.emit("error",Q))}if(!this.buf)throw Error("should have created buffer prior to reading");if(_===this.remain)for(let Q=_;Q<this.length&&_<this.blockRemain;Q++)this.buf[Q+this.offset]=0,_++,this.remain++;let q=this.offset===0&&_===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+_);if(!this.write(q))this[O2](()=>this[w2]());else this[w2]()}[O2](_){this.once("drain",_)}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");if(this.blockRemain<_.length){let Q=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",Q)}return this.remain-=_.length,this.blockRemain-=_.length,this.pos+=_.length,this.offset+=_.length,super.write(_,null,$)}[w2](){if(!this.remain){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));return this[u0]((_)=>_?this.emit("error",_):this.end())}if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");if(this.offset>=this.length)this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0;this.length=this.buf.length-this.offset,this[h6]()}}class j2 extends y6{sync=!0;[z2](){this[g6](J0.lstatSync(this.absolute))}[L2](){this[M2](J0.readlinkSync(this.absolute))}[U2](){this[C2](J0.openSync(this.absolute,"r"))}[h6](){let _=!0;try{let{fd:q,buf:$,offset:Q,length:x,pos:X}=this;if(q===void 0||$===void 0)throw Error("fd and buf must be set in READ method");let V=J0.readSync(q,$,Q,x,X);this[P2](V),_=!1}finally{if(_)try{this[u0](()=>{})}catch(q){}}}[O2](_){_()}[u0](_=()=>{}){if(this.fd!==void 0)J0.closeSync(this.fd);_()}}class B2 extends b{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(_,q,$={}){return n0(this,_,q,$)}constructor(_,q={}){let $=E_(q);super();this.preservePaths=!!$.preservePaths,this.portable=!!$.portable,this.strict=!!$.strict,this.noPax=!!$.noPax,this.noMtime=!!$.noMtime,this.onWriteEntry=$.onWriteEntry,this.readEntry=_;let{type:Q}=_;if(Q==="Unsupported")throw Error("writing entry that should be ignored");if(this.type=Q,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.prefix=$.prefix,this.path=U(_.path),this.mode=_.mode!==void 0?this[u6](_.mode):void 0,this.uid=this.portable?void 0:_.uid,this.gid=this.portable?void 0:_.gid,this.uname=this.portable?void 0:_.uname,this.gname=this.portable?void 0:_.gname,this.size=_.size,this.mtime=this.noMtime?void 0:$.mtime||_.mtime,this.atime=this.portable?void 0:_.atime,this.ctime=this.portable?void 0:_.ctime,this.linkpath=_.linkpath!==void 0?U(_.linkpath):void 0,typeof $.onwarn==="function")this.on("warn",$.onwarn);let x=!1;if(!this.preservePaths){let[V,J]=f_(this.path);if(V&&typeof J==="string")this.path=J,x=V}if(this.remain=_.size,this.blockRemain=_.startBlockSize,this.onWriteEntry?.(this),this.header=new i({path:this[K0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[K0](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),x)this.warn("TAR_ENTRY_INFO",`stripping ${x} from absolute path`,{entry:this,path:x+this.path});if(this.header.encode()&&!this.noPax)super.write(new R0({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[K0](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[K0](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let X=this.header?.block;if(!X)throw Error("failed to encode header");super.write(X),_.pipe(this)}[K0](_){return K3(_,this.prefix)}[u6](_){return H2(_,this.type==="Directory",this.portable)}write(_,q,$){if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,typeof q==="string"?q:"utf8");let Q=_.length;if(Q>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=Q,super.write(_,$)}end(_,q,$){if(this.blockRemain)super.write(Buffer.alloc(this.blockRemain));if(typeof _==="function")$=_,q=void 0,_=void 0;if(typeof q==="function")$=q,q=void 0;if(typeof _==="string")_=Buffer.from(_,q??"utf8");if($)this.once("finish",$);return _?super.end(_,$):super.end($),this}}var S5=(_)=>_.isFile()?"File":_.isDirectory()?"Directory":_.isSymbolicLink()?"SymbolicLink":"Unsupported";class y0{tail;head;length=0;static create(_=[]){return new y0(_)}constructor(_=[]){for(let q of _)this.push(q)}*[Symbol.iterator](){for(let _=this.head;_;_=_.next)yield _.value}removeNode(_){if(_.list!==this)throw Error("removing node which does not belong to this list");let{next:q,prev:$}=_;if(q)q.prev=$;if($)$.next=q;if(_===this.head)this.head=q;if(_===this.tail)this.tail=$;return this.length--,_.next=void 0,_.prev=void 0,_.list=void 0,q}unshiftNode(_){if(_===this.head)return;if(_.list)_.list.removeNode(_);let q=this.head;if(_.list=this,_.next=q,q)q.prev=_;if(this.head=_,!this.tail)this.tail=_;this.length++}pushNode(_){if(_===this.tail)return;if(_.list)_.list.removeNode(_);let q=this.tail;if(_.list=this,_.prev=q,q)q.next=_;if(this.tail=_,!this.head)this.head=_;this.length++}push(..._){for(let q=0,$=_.length;q<$;q++)N5(this,_[q]);return this.length}unshift(..._){for(var q=0,$=_.length;q<$;q++)h5(this,_[q]);return this.length}pop(){if(!this.tail)return;let _=this.tail.value,q=this.tail;if(this.tail=this.tail.prev,this.tail)this.tail.next=void 0;else this.head=void 0;return q.list=void 0,this.length--,_}shift(){if(!this.head)return;let _=this.head.value,q=this.head;if(this.head=this.head.next,this.head)this.head.prev=void 0;else this.tail=void 0;return q.list=void 0,this.length--,_}forEach(_,q){q=q||this;for(let $=this.head,Q=0;$;Q++)_.call(q,$.value,Q,this),$=$.next}forEachReverse(_,q){q=q||this;for(let $=this.tail,Q=this.length-1;$;Q--)_.call(q,$.value,Q,this),$=$.prev}get(_){let q=0,$=this.head;for(;!!$&&q<_;q++)$=$.next;if(q===_&&!!$)return $.value}getReverse(_){let q=0,$=this.tail;for(;!!$&&q<_;q++)$=$.prev;if(q===_&&!!$)return $.value}map(_,q){q=q||this;let $=new y0;for(let Q=this.head;Q;)$.push(_.call(q,Q.value,this)),Q=Q.next;return $}mapReverse(_,q){q=q||this;var $=new y0;for(let Q=this.tail;Q;)$.push(_.call(q,Q.value,this)),Q=Q.prev;return $}reduce(_,q){let $,Q=this.head;if(arguments.length>1)$=q;else if(this.head)Q=this.head.next,$=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var x=0;Q;x++)$=_($,Q.value,x),Q=Q.next;return $}reduceReverse(_,q){let $,Q=this.tail;if(arguments.length>1)$=q;else if(this.tail)Q=this.tail.prev,$=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let x=this.length-1;Q;x--)$=_($,Q.value,x),Q=Q.prev;return $}toArray(){let _=Array(this.length);for(let q=0,$=this.head;$;q++)_[q]=$.value,$=$.next;return _}toArrayReverse(){let _=Array(this.length);for(let q=0,$=this.tail;$;q++)_[q]=$.value,$=$.prev;return _}slice(_=0,q=this.length){if(q<0)q+=this.length;if(_<0)_+=this.length;let $=new y0;if(q<_||q<0)return $;if(_<0)_=0;if(q>this.length)q=this.length;let Q=this.head,x=0;for(x=0;!!Q&&x<_;x++)Q=Q.next;for(;!!Q&&x<q;x++,Q=Q.next)$.push(Q.value);return $}sliceReverse(_=0,q=this.length){if(q<0)q+=this.length;if(_<0)_+=this.length;let $=new y0;if(q<_||q<0)return $;if(_<0)_=0;if(q>this.length)q=this.length;let Q=this.length,x=this.tail;for(;!!x&&Q>q;Q--)x=x.prev;for(;!!x&&Q>_;Q--,x=x.prev)$.push(x.value);return $}splice(_,q=0,...$){if(_>this.length)_=this.length-1;if(_<0)_=this.length+_;let Q=this.head;for(let X=0;!!Q&&X<_;X++)Q=Q.next;let x=[];for(let X=0;!!Q&&X<q;X++)x.push(Q.value),Q=this.removeNode(Q);if(!Q)Q=this.tail;else if(Q!==this.tail)Q=Q.prev;for(let X of $)Q=D5(this,Q,X);return x}reverse(){let _=this.head,q=this.tail;for(let $=_;$;$=$.prev){let Q=$.prev;$.prev=$.next,$.next=Q}return this.head=q,this.tail=_,this}}function D5(_,q,$){let Q=q,x=q?q.next:_.head,X=new k6($,Q,x,_);if(X.next===void 0)_.tail=X;if(X.prev===void 0)_.head=X;return _.length++,X}function N5(_,q){if(_.tail=new k6(q,_.tail,void 0,_),!_.head)_.head=_.tail;_.length++}function h5(_,q){if(_.head=new k6(q,void 0,_.head,_),!_.tail)_.tail=_.head;_.length++}class k6{list;next;prev;value;constructor(_,q,$,Q){if(this.list=Q,this.value=_,q)q.next=this,this.prev=q;else this.prev=void 0;if($)$.prev=this,this.next=$;else this.next=void 0}}import H3 from"path";class R2{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(_,q){this.path=_||"./",this.absolute=q}}var Z3=Buffer.alloc(1024),m6=Symbol("onStat"),p_=Symbol("ended"),r=Symbol("queue"),e0=Symbol("current"),__=Symbol("process"),s_=Symbol("processing"),I2=Symbol("processJob"),e=Symbol("jobs"),A2=Symbol("jobDone"),E6=Symbol("addFSEntry"),G3=Symbol("addTarEntry"),S2=Symbol("stat"),D2=Symbol("readdir"),b6=Symbol("onreaddir"),c6=Symbol("pipe"),Y3=Symbol("entry"),T2=Symbol("entryOpt"),l6=Symbol("writeEntryClass"),v3=Symbol("write"),F2=Symbol("ondrain");class q_ extends b{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[l6];onWriteEntry;[r];[e]=0;[s_]=!1;[p_]=!1;constructor(_={}){super();if(this.opt=_,this.file=_.file||"",this.cwd=_.cwd||process.cwd(),this.maxReadSize=_.maxReadSize,this.preservePaths=!!_.preservePaths,this.strict=!!_.strict,this.noPax=!!_.noPax,this.prefix=U(_.prefix||""),this.linkCache=_.linkCache||new Map,this.statCache=_.statCache||new Map,this.readdirCache=_.readdirCache||new Map,this.onWriteEntry=_.onWriteEntry,this[l6]=y6,typeof _.onwarn==="function")this.on("warn",_.onwarn);if(this.portable=!!_.portable,_.gzip||_.brotli||_.zstd){if((_.gzip?1:0)+(_.brotli?1:0)+(_.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(_.gzip){if(typeof _.gzip!=="object")_.gzip={};if(this.portable)_.gzip.portable=!0;this.zip=new a1(_.gzip)}if(_.brotli){if(typeof _.brotli!=="object")_.brotli={};this.zip=new r1(_.brotli)}if(_.zstd){if(typeof _.zstd!=="object")_.zstd={};this.zip=new q2(_.zstd)}if(!this.zip)throw Error("impossible");let q=this.zip;q.on("data",($)=>super.write($)),q.on("end",()=>super.end()),q.on("drain",()=>this[F2]()),this.on("resume",()=>q.resume())}else this.on("drain",this[F2]);if(this.noDirRecurse=!!_.noDirRecurse,this.follow=!!_.follow,this.noMtime=!!_.noMtime,_.mtime)this.mtime=_.mtime;this.filter=typeof _.filter==="function"?_.filter:()=>!0,this[r]=new y0,this[e]=0,this.jobs=Number(_.jobs)||4,this[s_]=!1,this[p_]=!1}[v3](_){return super.write(_)}add(_){return this.write(_),this}end(_,q,$){if(typeof _==="function")$=_,_=void 0;if(typeof q==="function")$=q,q=void 0;if(_)this.add(_);if(this[p_]=!0,this[__](),$)$();return this}write(_){if(this[p_])throw Error("write after end");if(_ instanceof c_)this[G3](_);else this[E6](_);return this.flowing}[G3](_){let q=U(H3.resolve(this.cwd,_.path));if(!this.filter(_.path,_))_.resume();else{let $=new R2(_.path,q);$.entry=new B2(_,this[T2]($)),$.entry.on("end",()=>this[A2]($)),this[e]+=1,this[r].push($)}this[__]()}[E6](_){let q=U(H3.resolve(this.cwd,_));this[r].push(new R2(_,q)),this[__]()}[S2](_){_.pending=!0,this[e]+=1;let q=this.follow?"stat":"lstat";d6[q](_.absolute,($,Q)=>{if(_.pending=!1,this[e]-=1,$)this.emit("error",$);else this[m6](_,Q)})}[m6](_,q){if(this.statCache.set(_.absolute,q),_.stat=q,!this.filter(_.path,q))_.ignore=!0;else if(q.isFile()&&q.nlink>1&&_===this[e0]&&!this.linkCache.get(`${q.dev}:${q.ino}`)&&!this.sync)this[I2](_);this[__]()}[D2](_){_.pending=!0,this[e]+=1,d6.readdir(_.absolute,(q,$)=>{if(_.pending=!1,this[e]-=1,q)return this.emit("error",q);this[b6](_,$)})}[b6](_,q){this.readdirCache.set(_.absolute,q),_.readdir=q,this[__]()}[__](){if(this[s_])return;this[s_]=!0;for(let _=this[r].head;!!_&&this[e]<this.jobs;_=_.next)if(this[I2](_.value),_.value.ignore){let q=_.next;this[r].removeNode(_),_.next=q}if(this[s_]=!1,this[p_]&&!this[r].length&&this[e]===0)if(this.zip)this.zip.end(Z3);else super.write(Z3),super.end()}get[e0](){return this[r]&&this[r].head&&this[r].head.value}[A2](_){this[r].shift(),this[e]-=1,this[__]()}[I2](_){if(_.pending)return;if(_.entry){if(_===this[e0]&&!_.piped)this[c6](_);return}if(!_.stat){let q=this.statCache.get(_.absolute);if(q)this[m6](_,q);else this[S2](_)}if(!_.stat)return;if(_.ignore)return;if(!this.noDirRecurse&&_.stat.isDirectory()&&!_.readdir){let q=this.readdirCache.get(_.absolute);if(q)this[b6](_,q);else this[D2](_);if(!_.readdir)return}if(_.entry=this[Y3](_),!_.entry){_.ignore=!0;return}if(_===this[e0]&&!_.piped)this[c6](_)}[T2](_){return{onwarn:(q,$,Q)=>this.warn(q,$,Q),noPax:this.noPax,cwd:this.cwd,absolute:_.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Y3](_){this[e]+=1;try{return new this[l6](_.path,this[T2](_)).on("end",()=>this[A2](_)).on("error",($)=>this.emit("error",$))}catch(q){this.emit("error",q)}}[F2](){if(this[e0]&&this[e0].entry)this[e0].entry.resume()}[c6](_){if(_.piped=!0,_.readdir)_.readdir.forEach((Q)=>{let x=_.path,X=x==="./"?"":x.replace(/\/*$/,"/");this[E6](X+Q)});let q=_.entry,$=this.zip;if(!q)throw Error("cannot pipe without source");if($)q.on("data",(Q)=>{if(!$.write(Q))q.pause()});else q.on("data",(Q)=>{if(!super.write(Q))q.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}warn(_,q,$={}){n0(this,_,q,$)}}class M_ extends q_{sync=!0;constructor(_){super(_);this[l6]=j2}pause(){}resume(){}[S2](_){let q=this.follow?"statSync":"lstatSync";this[m6](_,d6[q](_.absolute))}[D2](_){this[b6](_,d6.readdirSync(_.absolute))}[c6](_){let q=_.entry,$=this.zip;if(_.readdir)_.readdir.forEach((Q)=>{let x=_.path,X=x==="./"?"":x.replace(/\/*$/,"/");this[E6](X+Q)});if(!q)throw Error("Cannot pipe without source");if($)q.on("data",(Q)=>{$.write(Q)});else q.on("data",(Q)=>{super[v3](Q)})}}var g5=(_,q)=>{let $=new M_(_),Q=new m_(_.file,{mode:_.mode||438});$.pipe(Q),w3($,q)},u5=(_,q)=>{let $=new q_(_),Q=new A0(_.file,{mode:_.mode||438});$.pipe(Q);let x=new Promise((X,V)=>{Q.on("error",V),Q.on("close",X),$.on("error",V)});return L3($,q),x},w3=(_,q)=>{q.forEach(($)=>{if($.charAt(0)==="@")r0({file:W3.resolve(_.cwd,$.slice(1)),sync:!0,noResume:!0,onReadEntry:(Q)=>_.add(Q)});else _.add($)}),_.end()},L3=async(_,q)=>{for(let $=0;$<q.length;$++){let Q=String(q[$]);if(Q.charAt(0)==="@")await r0({file:W3.resolve(String(_.cwd),Q.slice(1)),noResume:!0,onReadEntry:(x)=>{_.add(x)}});else _.add(Q)}_.end()},y5=(_,q)=>{let $=new M_(_);return w3($,q),$},k5=(_,q)=>{let $=new q_(_);return L3($,q),$},m5=X0(g5,u5,y5,k5,(_,q)=>{if(!q?.length)throw TypeError("no paths specified to add to archive")});import h3 from"node:fs";import q7 from"node:assert";import{randomBytes as N3}from"node:crypto";import C from"node:fs";import s from"node:path";import z3 from"fs";var E5=process.env.__FAKE_PLATFORM__||process.platform,b5=E5==="win32",{O_CREAT:c5,O_TRUNC:l5,O_WRONLY:d5}=z3.constants,P3=Number(process.env.__FAKE_FS_O_FILENAME__)||z3.constants.UV_FS_O_FILEMAP||0,f5=b5&&!!P3,i5=524288,p5=P3|l5|c5|d5,N2=!f5?()=>"w":(_)=>_<i5?p5:"w";import i6 from"node:fs";import n_ from"node:path";var h2=(_,q,$)=>{try{return i6.lchownSync(_,q,$)}catch(Q){if(Q?.code!=="ENOENT")throw Q}},f6=(_,q,$,Q)=>{i6.lchown(_,q,$,(x)=>{Q(x&&x?.code!=="ENOENT"?x:null)})},s5=(_,q,$,Q,x)=>{if(q.isDirectory())g2(n_.resolve(_,q.name),$,Q,(X)=>{if(X)return x(X);let V=n_.resolve(_,q.name);f6(V,$,Q,x)});else{let X=n_.resolve(_,q.name);f6(X,$,Q,x)}},g2=(_,q,$,Q)=>{i6.readdir(_,{withFileTypes:!0},(x,X)=>{if(x){if(x.code==="ENOENT")return Q();else if(x.code!=="ENOTDIR"&&x.code!=="ENOTSUP")return Q(x)}if(x||!X.length)return f6(_,q,$,Q);let V=X.length,J=null,K=(G)=>{if(J)return;if(G)return Q(J=G);if(--V===0)return f6(_,q,$,Q)};for(let G of X)s5(_,G,q,$,K)})},n5=(_,q,$,Q)=>{if(q.isDirectory())u2(n_.resolve(_,q.name),$,Q);h2(n_.resolve(_,q.name),$,Q)},u2=(_,q,$)=>{let Q;try{Q=i6.readdirSync(_,{withFileTypes:!0})}catch(x){let X=x;if(X?.code==="ENOENT")return;else if(X?.code==="ENOTDIR"||X?.code==="ENOTSUP")return h2(_,q,$);else throw X}for(let x of Q)n5(_,x,q,$);return h2(_,q,$)};import c from"node:fs";import a5 from"node:fs/promises";import n6 from"node:path";class p6 extends Error{path;code;syscall="chdir";constructor(_,q){super(`${q}: Cannot cd into '${_}'`);this.path=_,this.code=q}get name(){return"CwdError"}}class s6 extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(_,q){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=_,this.path=q}get name(){return"SymlinkError"}}var o5=(_,q)=>{c.stat(_,($,Q)=>{if($||!Q.isDirectory())$=new p6(_,$?.code||"ENOTDIR");q($)})},M3=(_,q,$)=>{_=U(_);let Q=q.umask??18,x=q.mode|448,X=(x&Q)!==0,V=q.uid,J=q.gid,K=typeof V==="number"&&typeof J==="number"&&(V!==q.processUid||J!==q.processGid),G=q.preserve,Z=q.unlink,Y=U(q.cwd),H=(z,P)=>{if(z)$(z);else if(P&&K)g2(P,V,J,(u)=>H(u));else if(X)c.chmod(_,x,$);else $()};if(_===Y)return o5(_,H);if(G)return a5.mkdir(_,{mode:x,recursive:!0}).then((z)=>H(null,z??void 0),H);let L=U(n6.relative(Y,_)).split("/");y2(Y,L,x,Z,Y,void 0,H)},y2=(_,q,$,Q,x,X,V)=>{if(!q.length)return V(null,X);let J=q.shift(),K=U(n6.resolve(_+"/"+J));c.mkdir(K,$,U3(K,q,$,Q,x,X,V))},U3=(_,q,$,Q,x,X,V)=>(J)=>{if(J)c.lstat(_,(K,G)=>{if(K)K.path=K.path&&U(K.path),V(K);else if(G.isDirectory())y2(_,q,$,Q,x,X,V);else if(Q)c.unlink(_,(Z)=>{if(Z)return V(Z);c.mkdir(_,$,U3(_,q,$,Q,x,X,V))});else if(G.isSymbolicLink())return V(new s6(_,_+"/"+q.join("/")));else V(J)});else X=X||_,y2(_,q,$,Q,x,X,V)},t5=(_)=>{let q=!1,$=void 0;try{q=c.statSync(_).isDirectory()}catch(Q){$=Q?.code}finally{if(!q)throw new p6(_,$??"ENOTDIR")}},C3=(_,q)=>{_=U(_);let $=q.umask??18,Q=q.mode|448,x=(Q&$)!==0,X=q.uid,V=q.gid,J=typeof X==="number"&&typeof V==="number"&&(X!==q.processUid||V!==q.processGid),K=q.preserve,G=q.unlink,Z=U(q.cwd),Y=(z)=>{if(z&&J)u2(z,X,V);if(x)c.chmodSync(_,Q)};if(_===Z)return t5(Z),Y();if(K)return Y(c.mkdirSync(_,{mode:Q,recursive:!0})??void 0);let w=U(n6.relative(Z,_)).split("/"),L=void 0;for(let z=w.shift(),P=Z;z&&(P+="/"+z);z=w.shift()){P=U(n6.resolve(P));try{c.mkdirSync(P,Q),L=L||P}catch(u){let d=c.lstatSync(P);if(d.isDirectory())continue;else if(G){c.unlinkSync(P),c.mkdirSync(P,Q),L=L||P;continue}else if(d.isSymbolicLink())return new s6(P,P+"/"+w.join("/"))}}return Y(L)};import{join as j3}from"node:path";var k2=Object.create(null);var U_=new Set,O3=(_)=>{if(!U_.has(_))k2[_]=_.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en");else U_.delete(_);U_.add(_);let q=k2[_],$=U_.size-1e4;if($>1000){for(let Q of U_)if(U_.delete(Q),delete k2[Q],--$<=0)break}return q};var r5=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,e5=r5==="win32",_7=(_)=>{return _.split("/").slice(0,-1).reduce(($,Q)=>{let x=$[$.length-1];if(x!==void 0)Q=j3(x,Q);return $.push(Q||"/"),$},[])};class m2{#_=new Map;#$=new Map;#Q=new Set;reserve(_,q){_=e5?["win32 parallelization disabled"]:_.map((Q)=>{return g0(j3(O3(Q)))});let $=new Set(_.map((Q)=>_7(Q)).reduce((Q,x)=>Q.concat(x)));this.#$.set(q,{dirs:$,paths:_});for(let Q of _){let x=this.#_.get(Q);if(!x)this.#_.set(Q,[q]);else x.push(q)}for(let Q of $){let x=this.#_.get(Q);if(!x)this.#_.set(Q,[new Set([q])]);else{let X=x[x.length-1];if(X instanceof Set)X.add(q);else x.push(new Set([q]))}}return this.#x(q)}#X(_){let q=this.#$.get(_);if(!q)throw Error("function does not have any path reservations");return{paths:q.paths.map(($)=>this.#_.get($)),dirs:[...q.dirs].map(($)=>this.#_.get($))}}check(_){let{paths:q,dirs:$}=this.#X(_);return q.every((Q)=>Q&&Q[0]===_)&&$.every((Q)=>Q&&Q[0]instanceof Set&&Q[0].has(_))}#x(_){if(this.#Q.has(_)||!this.check(_))return!1;return this.#Q.add(_),_(()=>this.#q(_)),!0}#q(_){if(!this.#Q.has(_))return!1;let q=this.#$.get(_);if(!q)throw Error("invalid reservation");let{paths:$,dirs:Q}=q,x=new Set;for(let X of $){let V=this.#_.get(X);if(!V||V?.[0]!==_)continue;let J=V[1];if(!J){this.#_.delete(X);continue}if(V.shift(),typeof J==="function")x.add(J);else for(let K of J)x.add(K)}for(let X of Q){let V=this.#_.get(X),J=V?.[0];if(!V||!(J instanceof Set))continue;if(J.size===1&&V.length===1){this.#_.delete(X);continue}else if(J.size===1){V.shift();let K=V[0];if(typeof K==="function")x.add(K)}else J.delete(_)}return this.#Q.delete(_),x.forEach((X)=>this.#x(X)),!0}}var B3=Symbol("onEntry"),l2=Symbol("checkFs"),I3=Symbol("checkFs2"),d2=Symbol("isReusable"),n=Symbol("makeFs"),f2=Symbol("file"),i2=Symbol("directory"),t6=Symbol("link"),A3=Symbol("symlink"),T3=Symbol("hardlink"),F3=Symbol("unsupported"),R3=Symbol("checkPath"),E2=Symbol("stripAbsolutePath"),k0=Symbol("mkdir"),g=Symbol("onError"),a6=Symbol("pending"),S3=Symbol("pend"),C_=Symbol("unpend"),b2=Symbol("ended"),c2=Symbol("maybeClose"),p2=Symbol("skip"),a_=Symbol("doChown"),o_=Symbol("uid"),t_=Symbol("gid"),r_=Symbol("checkedCwd"),$7=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,e_=$7==="win32",Q7=1024,x7=(_,q)=>{if(!e_)return C.unlink(_,q);let $=_+".DELETE."+N3(16).toString("hex");C.rename(_,$,(Q)=>{if(Q)return q(Q);C.unlink($,q)})},X7=(_)=>{if(!e_)return C.unlinkSync(_);let q=_+".DELETE."+N3(16).toString("hex");C.renameSync(_,q),C.unlinkSync(q)},D3=(_,q,$)=>_!==void 0&&_===_>>>0?_:q!==void 0&&q===q>>>0?q:$;class _6 extends h0{[b2]=!1;[r_]=!1;[a6]=0;reservations=new m2;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(_={}){_.ondone=()=>{this[b2]=!0,this[c2]()};super(_);if(this.transform=_.transform,this.chmod=!!_.chmod,typeof _.uid==="number"||typeof _.gid==="number"){if(typeof _.uid!=="number"||typeof _.gid!=="number")throw TypeError("cannot set owner without number uid and gid");if(_.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=_.uid,this.gid=_.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;if(_.preserveOwner===void 0&&typeof _.uid!=="number")this.preserveOwner=!!(process.getuid&&process.getuid()===0);else this.preserveOwner=!!_.preserveOwner;this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof _.maxDepth==="number"?_.maxDepth:Q7,this.forceChown=_.forceChown===!0,this.win32=!!_.win32||e_,this.newer=!!_.newer,this.keep=!!_.keep,this.noMtime=!!_.noMtime,this.preservePaths=!!_.preservePaths,this.unlink=!!_.unlink,this.cwd=U(s.resolve(_.cwd||process.cwd())),this.strip=Number(_.strip)||0,this.processUmask=!this.chmod?0:typeof _.processUmask==="number"?_.processUmask:process.umask(),this.umask=typeof _.umask==="number"?_.umask:this.processUmask,this.dmode=_.dmode||511&~this.umask,this.fmode=_.fmode||438&~this.umask,this.on("entry",(q)=>this[B3](q))}warn(_,q,$={}){if(_==="TAR_BAD_ARCHIVE"||_==="TAR_ABORT")$.recoverable=!1;return super.warn(_,q,$)}[c2](){if(this[b2]&&this[a6]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end")}[E2](_,q){let $=_[q];if(!$||this.preservePaths)return!0;let Q=$.split("/");if(Q.includes("..")||e_&&/^[a-z]:\.\.$/i.test(Q[0]??""))if(q==="path")return this.warn("TAR_ENTRY_ERROR",`${q} contains '..'`,{entry:_,[q]:$}),!1;else{let V=s.posix.dirname(_.path),J=s.posix.normalize(s.posix.join(V,$));if(J.startsWith("../")||J==="..")return this.warn("TAR_ENTRY_ERROR",`${q} escapes extraction directory`,{entry:_,[q]:$}),!1}let[x,X]=f_($);if(x)_[q]=String(X),this.warn("TAR_ENTRY_INFO",`stripping ${x} from absolute ${q}`,{entry:_,[q]:$});return!0}[R3](_){let q=U(_.path),$=q.split("/");if(this.strip){if($.length<this.strip)return!1;if(_.type==="Link"){let Q=U(String(_.linkpath)).split("/");if(Q.length>=this.strip)_.linkpath=Q.slice(this.strip).join("/");else return!1}$.splice(0,this.strip),_.path=$.join("/")}if(isFinite(this.maxDepth)&&$.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:_,path:q,depth:$.length,maxDepth:this.maxDepth}),!1;if(!this[E2](_,"path")||!this[E2](_,"linkpath"))return!1;if(s.isAbsolute(_.path))_.absolute=U(s.resolve(_.path));else _.absolute=U(s.resolve(this.cwd,_.path));if(!this.preservePaths&&typeof _.absolute==="string"&&_.absolute.indexOf(this.cwd+"/")!==0&&_.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:_,path:U(_.path),resolvedPath:_.absolute,cwd:this.cwd}),!1;if(_.absolute===this.cwd&&_.type!=="Directory"&&_.type!=="GNUDumpDir")return!1;if(this.win32){let{root:Q}=s.win32.parse(String(_.absolute));_.absolute=Q+W2(String(_.absolute).slice(Q.length));let{root:x}=s.win32.parse(_.path);_.path=x+W2(_.path.slice(x.length))}return!0}[B3](_){if(!this[R3](_))return _.resume();switch(q7.equal(typeof _.absolute,"string"),_.type){case"Directory":case"GNUDumpDir":if(_.mode)_.mode=_.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[l2](_);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[F3](_)}}[g](_,q){if(_.name==="CwdError")this.emit("error",_);else this.warn("TAR_ENTRY_ERROR",_,{entry:q}),this[C_](),q.resume()}[k0](_,q,$){M3(U(_),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:q},$)}[a_](_){return this.forceChown||this.preserveOwner&&(typeof _.uid==="number"&&_.uid!==this.processUid||typeof _.gid==="number"&&_.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[o_](_){return D3(this.uid,_.uid,this.processUid)}[t_](_){return D3(this.gid,_.gid,this.processGid)}[f2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.fmode,Q=new A0(String(_.absolute),{flags:N2(_.size),mode:$,autoClose:!1});Q.on("error",(J)=>{if(Q.fd)C.close(Q.fd,()=>{});Q.write=()=>!0,this[g](J,_),q()});let x=1,X=(J)=>{if(J){if(Q.fd)C.close(Q.fd,()=>{});this[g](J,_),q();return}if(--x===0){if(Q.fd!==void 0)C.close(Q.fd,(K)=>{if(K)this[g](K,_);else this[C_]();q()})}};Q.on("finish",()=>{let J=String(_.absolute),K=Q.fd;if(typeof K==="number"&&_.mtime&&!this.noMtime){x++;let G=_.atime||new Date,Z=_.mtime;C.futimes(K,G,Z,(Y)=>Y?C.utimes(J,G,Z,(H)=>X(H&&Y)):X())}if(typeof K==="number"&&this[a_](_)){x++;let G=this[o_](_),Z=this[t_](_);if(typeof G==="number"&&typeof Z==="number")C.fchown(K,G,Z,(Y)=>Y?C.chown(J,G,Z,(H)=>X(H&&Y)):X())}X()});let V=this.transform?this.transform(_)||_:_;if(V!==_)V.on("error",(J)=>{this[g](J,_),q()}),_.pipe(V);V.pipe(Q)}[i2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.dmode;this[k0](String(_.absolute),$,(Q)=>{if(Q){this[g](Q,_),q();return}let x=1,X=()=>{if(--x===0)q(),this[C_](),_.resume()};if(_.mtime&&!this.noMtime)x++,C.utimes(String(_.absolute),_.atime||new Date,_.mtime,X);if(this[a_](_))x++,C.chown(String(_.absolute),Number(this[o_](_)),Number(this[t_](_)),X);X()})}[F3](_){_.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${_.type}`,{entry:_}),_.resume()}[A3](_,q){this[t6](_,String(_.linkpath),"symlink",q)}[T3](_,q){let $=U(s.resolve(this.cwd,String(_.linkpath)));this[t6](_,$,"link",q)}[S3](){this[a6]++}[C_](){this[a6]--,this[c2]()}[p2](_){this[C_](),_.resume()}[d2](_,q){return _.type==="File"&&!this.unlink&&q.isFile()&&q.nlink<=1&&!e_}[l2](_){this[S3]();let q=[_.path];if(_.linkpath)q.push(_.linkpath);this.reservations.reserve(q,($)=>this[I3](_,$))}[I3](_,q){let $=(V)=>{q(V)},Q=()=>{this[k0](this.cwd,this.dmode,(V)=>{if(V){this[g](V,_),$();return}this[r_]=!0,x()})},x=()=>{if(_.absolute!==this.cwd){let V=U(s.dirname(String(_.absolute)));if(V!==this.cwd)return this[k0](V,this.dmode,(J)=>{if(J){this[g](J,_),$();return}X()})}X()},X=()=>{C.lstat(String(_.absolute),(V,J)=>{if(J&&(this.keep||this.newer&&J.mtime>(_.mtime??J.mtime))){this[p2](_),$();return}if(V||this[d2](_,J))return this[n](null,_,$);if(J.isDirectory()){if(_.type==="Directory"){let K=this.chmod&&_.mode&&(J.mode&4095)!==_.mode,G=(Z)=>this[n](Z??null,_,$);if(!K)return G();return C.chmod(String(_.absolute),Number(_.mode),G)}if(_.absolute!==this.cwd)return C.rmdir(String(_.absolute),(K)=>this[n](K??null,_,$))}if(_.absolute===this.cwd)return this[n](null,_,$);x7(String(_.absolute),(K)=>this[n](K??null,_,$))})};if(this[r_])x();else Q()}[n](_,q,$){if(_){this[g](_,q),$();return}switch(q.type){case"File":case"OldFile":case"ContiguousFile":return this[f2](q,$);case"Link":return this[T3](q,$);case"SymbolicLink":return this[A3](q,$);case"Directory":case"GNUDumpDir":return this[i2](q,$)}}[t6](_,q,$,Q){C[$](q,String(_.absolute),(x)=>{if(x)this[g](x,_);else this[C_](),_.resume();Q()})}}var o6=(_)=>{try{return[null,_()]}catch(q){return[q,null]}};class r6 extends _6{sync=!0;[n](_,q){return super[n](_,q,()=>{})}[l2](_){if(!this[r_]){let x=this[k0](this.cwd,this.dmode);if(x)return this[g](x,_);this[r_]=!0}if(_.absolute!==this.cwd){let x=U(s.dirname(String(_.absolute)));if(x!==this.cwd){let X=this[k0](x,this.dmode);if(X)return this[g](X,_)}}let[q,$]=o6(()=>C.lstatSync(String(_.absolute)));if($&&(this.keep||this.newer&&$.mtime>(_.mtime??$.mtime)))return this[p2](_);if(q||this[d2](_,$))return this[n](null,_);if($.isDirectory()){if(_.type==="Directory"){let X=this.chmod&&_.mode&&($.mode&4095)!==_.mode,[V]=X?o6(()=>{C.chmodSync(String(_.absolute),Number(_.mode))}):[];return this[n](V,_)}let[x]=o6(()=>C.rmdirSync(String(_.absolute)));this[n](x,_)}let[Q]=_.absolute===this.cwd?[]:o6(()=>X7(String(_.absolute)));this[n](Q,_)}[f2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.fmode,Q=(V)=>{let J;try{C.closeSync(x)}catch(K){J=K}if(V||J)this[g](V||J,_);q()},x;try{x=C.openSync(String(_.absolute),N2(_.size),$)}catch(V){return Q(V)}let X=this.transform?this.transform(_)||_:_;if(X!==_)X.on("error",(V)=>this[g](V,_)),_.pipe(X);X.on("data",(V)=>{try{C.writeSync(x,V,0,V.length)}catch(J){Q(J)}}),X.on("end",()=>{let V=null;if(_.mtime&&!this.noMtime){let J=_.atime||new Date,K=_.mtime;try{C.futimesSync(x,J,K)}catch(G){try{C.utimesSync(String(_.absolute),J,K)}catch(Z){V=G}}}if(this[a_](_)){let J=this[o_](_),K=this[t_](_);try{C.fchownSync(x,Number(J),Number(K))}catch(G){try{C.chownSync(String(_.absolute),Number(J),Number(K))}catch(Z){V=V||G}}}Q(V)})}[i2](_,q){let $=typeof _.mode==="number"?_.mode&4095:this.dmode,Q=this[k0](String(_.absolute),$);if(Q){this[g](Q,_),q();return}if(_.mtime&&!this.noMtime)try{C.utimesSync(String(_.absolute),_.atime||new Date,_.mtime)}catch(x){}if(this[a_](_))try{C.chownSync(String(_.absolute),Number(this[o_](_)),Number(this[t_](_)))}catch(x){}q(),_.resume()}[k0](_,q){try{return C3(U(_),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:q})}catch($){return $}}[t6](_,q,$,Q){let x=`${$}Sync`;try{C[x](q,String(_.absolute)),Q(),_.resume()}catch(X){return this[g](X,_)}}}var V7=(_)=>{let q=new r6(_),$=_.file,Q=h3.statSync($),x=_.maxReadSize||16777216;new d1($,{readSize:x,size:Q.size}).pipe(q)},J7=(_,q)=>{let $=new _6(_),Q=_.maxReadSize||16777216,x=_.file;return new Promise((V,J)=>{$.on("error",J),$.on("close",V),h3.stat(x,(K,G)=>{if(K)J(K);else{let Z=new w_(x,{readSize:Q,size:G.size});Z.on("error",J),Z.pipe($)}})})},q6=X0(V7,J7,(_)=>new r6(_),(_)=>new _6(_),(_,q)=>{if(q?.length)Y2(_,q)});import l from"node:fs";import g3 from"node:path";var K7=(_,q)=>{let $=new M_(_),Q=!0,x,X;try{try{x=l.openSync(_.file,"r+")}catch(K){if(K?.code==="ENOENT")x=l.openSync(_.file,"w+");else throw K}let V=l.fstatSync(x),J=Buffer.alloc(512);_:for(X=0;X<V.size;X+=512){for(let Z=0,Y=0;Z<512;Z+=Y){if(Y=l.readSync(x,J,Z,J.length-Z,X+Z),X===0&&J[0]===31&&J[1]===139)throw Error("cannot append to compressed archives");if(!Y)break _}let K=new i(J);if(!K.cksumValid)break;let G=512*Math.ceil((K.size||0)/512);if(X+G+512>V.size)break;if(X+=G,_.mtimeCache&&K.mtime)_.mtimeCache.set(String(K.path),K.mtime)}Q=!1,Z7(_,$,X,x,q)}finally{if(Q)try{l.closeSync(x)}catch(V){}}},Z7=(_,q,$,Q,x)=>{let X=new m_(_.file,{fd:Q,start:$});q.pipe(X),Y7(q,x)},G7=(_,q)=>{q=Array.from(q);let $=new q_(_),Q=(X,V,J)=>{let K=(w,L)=>{if(w)l.close(X,(z)=>J(w));else J(null,L)},G=0;if(V===0)return K(null,0);let Z=0,Y=Buffer.alloc(512),H=(w,L)=>{if(w||typeof L>"u")return K(w);if(Z+=L,Z<512&&L)return l.read(X,Y,Z,Y.length-Z,G+Z,H);if(G===0&&Y[0]===31&&Y[1]===139)return K(Error("cannot append to compressed archives"));if(Z<512)return K(null,G);let z=new i(Y);if(!z.cksumValid)return K(null,G);let P=512*Math.ceil((z.size??0)/512);if(G+P+512>V)return K(null,G);if(G+=P+512,G>=V)return K(null,G);if(_.mtimeCache&&z.mtime)_.mtimeCache.set(String(z.path),z.mtime);Z=0,l.read(X,Y,0,512,G,H)};l.read(X,Y,0,512,G,H)};return new Promise((X,V)=>{$.on("error",V);let J="r+",K=(G,Z)=>{if(G&&G.code==="ENOENT"&&J==="r+")return J="w+",l.open(_.file,J,K);if(G||!Z)return V(G);l.fstat(Z,(Y,H)=>{if(Y)return l.close(Z,()=>V(Y));Q(Z,H.size,(w,L)=>{if(w)return V(w);let z=new A0(_.file,{fd:Z,start:L});$.pipe(z),z.on("error",V),z.on("close",X),H7($,q)})})};l.open(_.file,J,K)})},Y7=(_,q)=>{q.forEach(($)=>{if($.charAt(0)==="@")r0({file:g3.resolve(_.cwd,$.slice(1)),sync:!0,noResume:!0,onReadEntry:(Q)=>_.add(Q)});else _.add($)}),_.end()},H7=async(_,q)=>{for(let $=0;$<q.length;$++){let Q=String(q[$]);if(Q.charAt(0)==="@")await r0({file:g3.resolve(String(_.cwd),Q.slice(1)),noResume:!0,onReadEntry:(x)=>_.add(x)});else _.add(Q)}_.end()},$_=X0(K7,G7,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(_,q)=>{if(!b9(_))throw TypeError("file is required");if(_.gzip||_.brotli||_.zstd||_.file.endsWith(".br")||_.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!q?.length)throw TypeError("no paths specified to add/replace")});var v7=X0($_.syncFile,$_.asyncFile,$_.syncNoFile,$_.asyncNoFile,(_,q=[])=>{$_.validate?.(_,q),W7(_)}),W7=(_)=>{let q=_.filter;if(!_.mtimeCache)_.mtimeCache=new Map;_.filter=q?($,Q)=>q($,Q)&&!((_.mtimeCache?.get($)??Q.mtime??0)>(Q.mtime??0)):($,Q)=>!((_.mtimeCache?.get($)??Q.mtime??0)>(Q.mtime??0))};var B={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m"};import j_,{join as L7}from"path";var u3={name:"@abacus-ai/cli",description:"AbacusAI's powerful CLI AI assistant with agentic browsing, listening, and coding capabilities.",appName:"AbacusAI",binName:"abacusai",version:"1.106.21000",nodeVersion:"22.19.0",author:{name:"Abacus AI"},license:"Proprietary",main:"./dist/index.js",module:"./dist/index.js",source:"./src/index.ts",type:"module",homepage:"https://desktop.abacus.ai/",files:["dist"],bugs:{url:"mailto:support@abacus.ai"},bin:{abacusai:"./dist/index.js"},scripts:{"build.tsc":"tsc --noEmit --pretty","build.bun":"bun build ./src/index.ts --minify --target=node --outdir=dist",build:"run-p build.*","watch.tsc":"tsc --watch --noEmit --pretty","watch.bun":"bun build ./src/index.ts --sourcemap --target=node --outdir=dist --watch --external=extract-zip --external=node-downloader-helper --external=semver --external=tar",watch:"run-p watch.*",test:"tsc -p ./test/tsconfig.json && bun test"},devDependencies:{"@inquirer/prompts":"^7.9.0","@tsconfig/strictest":"^2.0.7","@types/color-name":"^2.0.0","@types/glob":"^9.0.0","@types/minimatch":"^6.0.0","@types/node":"^24.9.2","@types/bun":"^1.2.2","@types/semver":"^7.7.1","extract-zip":"^2.0.1","node-downloader-helper":"^2.1.9",semver:"^7.7.3",tar:"^7.5.2",typescript:"^6.0.0-dev.20251031","npm-run-all2":"^8.0.4"},overrides:{yauzl:"3.2.0"}};import{fileURLToPath as z7}from"url";import _1 from"os";import O_ from"fs/promises";import P7 from"fs";var q1=j_.dirname(z7(import.meta.url)),e6=u3,s2=".abacusai-cli";async function $1(_){return j_.join(await k3(),`${_.binName}-${_.version}-${_1.platform()}-${_1.arch()}`)}async function k3(){let _=j_.join(q1,s2);if(await y3(_))return _;console.log(`Using home directory as ${_} is not writable.`);let q=j_.join(_1.homedir(),s2);if(await y3(q))return q;console.error(`No writable directory found under ${_} or ${q}. Using a temporary directory instead.`);let $=L7(_1.tmpdir(),s2);try{await O_.mkdir($,{recursive:!0})}catch{}return $}async function y3(_){let q=j_.join(_,`.writable-${process.pid}-${Date.now()}`);try{return await O_.mkdir(_,{recursive:!0}),await O_.writeFile(q,"true"),!0}catch($){return!1}finally{try{await O_.unlink(q)}catch{}}}async function m3(){try{let _=await E3(e6);if(!P7.existsSync(_))return await M7(e6,_),e6;return await U7(_)}catch{return e6}}async function M7(_,q){try{if(q===void 0)q=await E3(_);return await O_.writeFile(q,JSON.stringify(_,null,2)),q}catch($){return console.error(`Failed to write package data file ${q}: ${$ instanceof Error?$.message:String($)}`),null}}async function U7(_){return JSON.parse(await O_.readFile(_,"utf8"))}async function E3(_){return j_.join(await k3(),`${_.binName}-package.json`)}var o8=H6(D8(),1),t8=H6(F1(),1),r8=H6(a8(),1);import W9 from"fs";import J6 from"fs/promises";import V_ from"os";import w9 from"path";function M$(_){let q=process.versions.node;if(r8.default(q,_))return!1;return!0}function U$(_){let q=V_.platform(),$=V_.arch(),x={x64:"x64",arm64:"arm64",ia32:"x86"}[$]||$;if(q==="win32")return`https://nodejs.org/dist/v${_}/node-v${_}-win-${x}.${$==="x64"||$==="ia32"?"zip":"7z"}`;else if(q==="darwin")return`https://nodejs.org/dist/v${_}/node-v${_}-darwin-${x}.tar.gz`;else return`https://nodejs.org/dist/v${_}/node-v${_}-linux-${x}.tar.gz`}function C$(_){let q=V_.platform(),$=V_.arch(),x={x64:"x64",arm64:"arm64",ia32:"x86"}[$]||$;if(q==="win32")return`node-v${_}-win-${x}.${$==="x64"||$==="ia32"?"zip":"7z"}`;else if(q==="darwin")return`node-v${_}-darwin-${x}.tar.gz`;else return`node-v${_}-linux-${x}.tar.gz`}async function I1(_,q,$=!1){try{if(!$){if(M$(q))return process.execPath}let Q=V_.platform()==="win32"?"node.exe":"node",x=w9.join(_,Q);if(W9.existsSync(x))return x;let X=w9.join(V_.homedir(),`node-${q}`),V=w9.join(X,"bin",Q);if(W9.existsSync(V))return await J6.copyFile(V,x),x;console.log(`${B.dim}Downloading Node.js ${q}...${B.reset}`);let J=U$(q),K=C$(q),G=new t8.DownloaderHelper(J,V_.tmpdir(),{fileName:K});G.on("error",async(Y)=>{console.error(`${B.red}Failed to download Node.js from ${J}: ${Y}${B.reset}`),await G.stop()}),await G.start();let Z=G.getDownloadPath();if(!W9.existsSync(X))await J6.mkdir(X);if(console.log(`${B.dim}Extracting Node.js ${q} to ${X}...${B.reset}`),K.endsWith(".tar.gz"))await j$(Z,X);else await O$(Z,X);return await J6.copyFile(V,x),x}catch(Q){return console.error(`${B.red}Failed to download Node.js: ${Q instanceof Error?Q.message:String(Q)}
9
+ Please download and install Node.js ${q} from https://nodejs.org/`),process.execPath}}async function O$(_,q){await J6.mkdir(q,{recursive:!0}),await o8.default(_,{dir:q})}async function j$(_,q){await J6.mkdir(q,{recursive:!0}),await q6({file:_,cwd:q,strip:1})}function A$(_){let{appName:q,binName:$,version:Q}=_,x=`${q.toLowerCase()}-agent-cli-${A1.platform()}-${A1.arch()}-${Q}.tar.gz`;return{url:`https://static.abacus.ai/${$}/releases/${Q}/${x}`,fileName:x}}async function q4(_,q=!1){let{appName:$,binName:Q,version:x,homepage:X}=_;try{let{url:V,fileName:J}=A$(_),K=new e8.DownloaderHelper(V,A1.tmpdir(),{fileName:J});K.on("error",async(H)=>{console.error(`Failed to download ${V}: ${H}`),await K.stop()}),console.log(`${B.dim}Downloading ${$} ${x}...${B.reset}`),await K.start();let G=K.getDownloadPath(),Z=await $1(_);console.log(`${B.dim}Extracting ${$} ${x} to ${Z}...${B.reset}`),await T$(G,Z),await _4.rm(G);let Y=B$.join(Z,"bin",`${Q}${A1.platform()==="win32"?".cmd":""}`);if(!I$.existsSync(Y)){let H=`${$} command not found at ${Y}}`;throw console.error(H),Error(H)}return console.log(`${B.dim}${$} ${x} downloaded to ${Z}${B.reset}`),await I1(Z,_.nodeVersion,q),Y}catch(V){throw console.error(V instanceof Error?V.message:String(V)),Error(`Could not download ${$}. Please install ${$} from ${X} and re-run ${Q}.`)}}async function T$(_,q){await _4.mkdir(q,{recursive:!0}),await q6({file:_,cwd:q,strip:1})}import z9 from"fs";import $4 from"fs/promises";import L9 from"os";import R from"path";var Q4="code-oss-dev";async function x4(_){try{let q=L9.platform(),$=[await R$(R.dirname(R.dirname(q1))),R.dirname(R.dirname(R.dirname(q1))),await $1(_),...F$(_.appName,q)].filter((Q)=>Q!==void 0);return await Promise.any($.map(async(Q)=>{try{let x=JSON.parse(await $4.readFile(R.join(Q,"package.json"),"utf8")),X=x.name===Q4;if(!X&&!(("version"in x)&&typeof x.version==="string"&&x.version===_.version))throw Error(`Invalid version in package.json: ${x.version} (expected ${_.version})`);let V=X4(Q);if(V!==void 0){let K=q==="win32"?"node.exe":"node";return{command:X?K:R.join(Q,K),args:X?[V,Q,"agent"]:[V,"agent"],directory:Q,isCommandNode:!X,env:X?{...process.env,NODE_ENV:"development",VSCODE_DEV:"1"}:process.env}}let J=R.join(Q,"bin",`${_.binName}${q==="win32"?".cmd":""}`);if(z9.existsSync(J))return{command:J,args:[],directory:Q,isCommandNode:!1,env:process.env};throw Error(`${_.appName} command not found: ${J}`)}catch(x){let X=x instanceof Error?x.message:String(x);throw Error(`${_.appName} not found in ${Q}: ${X}`)}}))}catch(q){if(!(q instanceof AggregateError)){let $=q instanceof Error?q.message:String(q);console.info(`${B.dim}Could not find installed ${_.appName}: ${$}${B.reset}`)}return}}function F$(_,q=L9.platform()){let $=L9.homedir();if(q==="darwin")return[`/Applications/${_}.app/Contents/Resources/app`,R.join($,`Applications/${_}.app/Contents/Resources/app`)];else if(q==="win32"){let Q=process.env.ProgramFiles||"C:\\Program Files",x=process.env["ProgramFiles(x86)"]||"C:\\Program Files (x86)",X=process.env.LOCALAPPDATA||R.join($,"AppData","Local"),V=process.env.APPDATA||R.join($,"AppData","Roaming");return[R.join(Q,_),R.join(x,_),R.join(X,"Programs",_),R.join(V,_)]}else return[`/usr/share/${_.toLowerCase()}`]}async function R$(_){let q=_;while(q!==R.parse(q).root){if(X4(q)!==void 0){let Q=await D$(q);if(Q!==void 0&&S$(Q))return q}q=R.dirname(q)}return}function X4(_){let q=R.join(_,"out","cli.js");if(z9.existsSync(q))return q;return}function S$(_){return _.name===Q4}async function D$(_){let q=R.join(_,"package.json");if(!z9.existsSync(q))return;let $=await $4.readFile(q,"utf8"),Q=JSON.parse($);if("name"in Q&&typeof Q.name==="string"&&"version"in Q&&typeof Q.version==="string")return Q;return}import{execFile as u$,spawn as y$}from"child_process";import C0 from"process";import K6 from"path";import T1 from"fs";import M9 from"os";import{promisify as k$}from"util";import N$ from"https";async function V4(_){return new Promise((q,$)=>{try{let Q=N$.get(`https://registry.npmjs.org/${_}`,{headers:{Accept:"application/json","User-Agent":"abacusai-cli"},timeout:1e4});if(Q.errored||Q.closed){$(Error("Registry request failed immediately"));return}Q.on("response",(x)=>{let X="";x.on("data",(V)=>{X+=V}),x.on("end",()=>{if(x.statusCode!==200){$(Error(`Registry returned ${x.statusCode}`));return}try{let V=JSON.parse(X);q(V["dist-tags"]??{})}catch(V){$(Error("Failed to parse registry response"))}})}),Q.on("error",$),Q.on("timeout",()=>{Q.destroy(),$(Error("Registry request timed out"))})}catch(Q){let x=Q instanceof Error?Q.message:String(Q);$(Error(`Failed to fetch dist-tags: ${x}`))}})}function P9(){return h$(process.env.ABACUSAI_CLI_FORCE_NODE_DOWNLOAD)}function J4(){return g$(process.env.ABACUSAI_CLI_AUTO_UPDATE)}function K4(){return process.env.ABACUS_CLI_DIST_TAG||"latest"}function h$(_){return _==="true"||_==="1"}function g$(_){return _!=="false"&&_!=="0"}var Z6=k$(u$),U9="@abacus-ai/cli";async function Z4(_){if(!J4())return null;let q=K4(),Q=(await V4(U9))[q];if(!Q)return null;if(Q===_.version)return null;return{targetVersion:Q,distTag:q}}async function G4(_,q){let{command:$,args:Q}=await E$({..._,name:U9,version:q.targetVersion});console.log(`${B.dim}Updating ${_.appName} to ${q.targetVersion} (${q.distTag}) via \`${$} ${Q.join(" ")}\`${B.reset}`);try{let{stdout:J,stderr:K}=await Z6($,Q,{timeout:120000});if(J)console.log(J);if(K)console.error(K)}catch(J){return console.error(`${B.dim}Failed to install update: ${J instanceof Error?J.message:String(J)}${B.reset}`),!1}console.log(`${B.dim}${U9}@${q.targetVersion} installed successfully${B.reset}`);let x=await m$($);if(!x)return console.error(`${B.dim}Could not resolve updated CLI entry point. Continuing with current version.${B.reset}`),!1;let X=M9.platform(),V=y$(C0.execPath,[x,...C0.argv.slice(2)],{stdio:"inherit",shell:X==="win32",windowsVerbatimArguments:X==="win32",env:{...C0.env,ABACUSAI_CLI_AUTO_UPDATE:"false"}});return V.on("error",(J)=>{console.error(`Failed to start updated ${_.appName}:`,J),C0.exit(1)}),V.on("exit",(J,K)=>{if(K)C0.kill(C0.pid,K);else C0.exit(J??1)}),!0}async function m$(_){try{let Q;switch(_){case"pnpm":{let{stdout:X}=await Z6("pnpm",["root","-g"]);Q=X.trim();break}case"bun":{Q=K6.join(M9.homedir(),".bun","install","global","node_modules");break}case"yarn":{let{stdout:X}=await Z6("yarn",["global","dir"]);Q=K6.join(X.trim(),"node_modules");break}default:{let{stdout:X}=await Z6("npm",["root","-g"]);Q=X.trim();break}}let x=K6.join(Q,"@abacus-ai","cli","package.json");if(T1.existsSync(x)){let X=JSON.parse(T1.readFileSync(x,"utf8")),V=X.main||X.module;if(!V&&X.bin){let J=typeof X.bin==="string"?{default:X.bin}:X.bin;V=Object.values(J)[0]}if(V){let J=K6.resolve(K6.dirname(x),V);if(T1.existsSync(J))return J}}}catch{}let q=["abacusai","abacus"],$=M9.platform()==="win32"?"where":"which";for(let Q of q)try{let{stdout:x}=await Z6($,[Q]),X=x.trim().split(`
10
+ `)[0];if(X&&T1.existsSync(X))return X}catch{continue}return null}async function E$({name:_,version:q}){try{let $=C0.env.npm_package_json,Q=C0.env.npm_config_user_agent;if(Boolean(Q?.startsWith("npm"))||Boolean($?.endsWith("package.json")))return{command:"npm",args:["install","-g",`${_}@${q}`]};if(Boolean(Q?.startsWith("yarn")))return{command:"yarn",args:["global","add",`${_}@${q}`]};if(Boolean(Q?.startsWith("pnpm")))return{command:"pnpm",args:["install","-g",`${_}@${q}`]};if(Boolean(Q?.startsWith("bun")))return{command:"bun",args:["install","-g",`${_}@${q}`]}}catch($){}return{command:"npm",args:["install","-g",`${_}@${q}`]}}var C9=b$.platform();async function H4(){let _=await m3();try{let Q=await Z4(_);if(Q!==null){if(await G4(_,Q))return}}catch{}let q=await x4(_);if(q!==void 0){let Q=await I1(q.directory,_.nodeVersion,P9()),x=q.isCommandNode?Q:q.command;return Y4(_,x,q.args,void 0,q.env)}let $=await q4(_,P9());return Y4(_,$,[])}function Y4(_,q,$,Q,x){let X=Q??process.argv.slice(2),V=[...$,...X],J=q;if(C9==="win32"&&q.includes(" "))J=`"${q}"`;let K=c$.spawn(J,V,{stdio:"inherit",shell:C9==="win32",windowsVerbatimArguments:C9==="win32",env:x??process.env});K.on("error",(G)=>{console.error(`Failed to start ${_.appName}:`,G),process.exit(1)}),K.on("exit",(G,Z)=>{if(Z)process.kill(process.pid,Z);else process.exit(G??1)})}H4().catch((_)=>{console.error(_),process.exit(1)});
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "AbacusAI's powerful CLI AI assistant with agentic browsing, listening, and coding capabilities.",
4
4
  "appName": "AbacusAI",
5
5
  "binName": "abacusai",
6
- "version": "1.106.2805",
6
+ "version": "1.106.21000",
7
7
  "nodeVersion": "22.19.0",
8
8
  "author": {
9
9
  "name": "Abacus AI"