@tencent-ai/codebuddy-code 1.14.0 → 1.15.0-next.0b681d3.20251020

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,77 @@ CodeBuddy Code 的所有重要更新都会记录在这里。
4
4
 
5
5
  我们遵循 [语义化版本](https://semver.org/spec/v2.0.0.html) 规范。
6
6
 
7
+
8
+ ## [未发布版本]
9
+
10
+ ### ✨ 新功能
11
+ - **沙箱类型扩展**:新增多种沙箱执行环境支持,提供更灵活的隔离执行方案
12
+ - **沙箱配置增强**:新增沙箱配置文件支持,允许用户自定义沙箱行为和安全策略
13
+
14
+ ### ♻️ 架构重构
15
+ - **沙箱架构简化**:重构沙箱系统为基于启动器模式的统一架构,移除编排中间件层,简化代码结构并提升可维护性
16
+ - **CLI 策略优化**:简化命令行分发策略,移除冗余的客户端连接和工作节点策略,统一为沙箱模式和服务器模式
17
+ - **沙箱启动器重构**:重命名和优化沙箱启动器实现,提升代码可读性和可维护性
18
+
19
+ ### 📚 文档更新
20
+ - **沙箱使用指南**:完善沙箱使用文档,新增多种沙箱类型的详细说明、配置选项和使用示例
21
+ - **CLI 参考文档**:更新沙箱相关参数说明,提供更清晰的使用示例和配置指南
22
+ - **架构文档优化**:更新架构文档,补充沙箱系统和编排器相关内容
23
+
24
+ ### 🐛 问题修复
25
+ - **流式输出优化**:优化沙箱环境下的流式输出处理,提升非交互模式下的用户体验
26
+
27
+
28
+ ## [1.15.0] - 2025-10-17
29
+
30
+ ### ✨ 新功能
31
+ - **HTTP 服务器模式**:新增 `--serve` 选项,支持以 HTTP 服务器模式启动,提供非交互式 API 服务能力
32
+ - **企业域登录支持**:新增企业域登录方式,支持自定义企业端点配置,满足企业级部署需求
33
+ - **自定义端点配置**:新增端点配置功能,支持用户自定义服务端点地址和环境路由模式
34
+ - **配置文件兼容性增强**:支持自动检测并使用 AGENTS.md 作为项目级记忆文件,兼容多种配置文件命名约定
35
+ - **云托管环境支持**:新增专享版云托管环境配置支持,支持通配符域名匹配和环境自动识别
36
+
37
+ ### 🔧 功能改进
38
+ - **终端检测能力增强**:大幅扩展终端检测支持范围,新增对30+种终端和IDE的识别能力,包括:
39
+ - IDE终端: Cursor, Windsurf, VSCodium, Android Studio, Visual Studio, PyCharm及所有JetBrains IDE
40
+ - 现代终端模拟器: Kitty, Alacritty, Hyper, Tabby, Warp
41
+ - Linux终端: Konsole, GNOME Terminal, XTerm, Terminator, Tilix, Rxvt, Termite
42
+ - Windows终端: Windows Terminal, ConEmu, Cygwin
43
+ - 终端复用器: Screen, Tmux
44
+ - 特殊环境: SSH会话检测, 非交互式终端识别
45
+ - **终端检测API优化**:新增 `detectAsType()` 方法返回类型化的终端枚举值,新增 `getTerminalName()` 返回用户友好的终端名称,优化 `detect()` 方法支持更精确的终端识别逻辑
46
+ - **统计信息展示优化**:重构成本统计信息格式化逻辑,在退出时展示详细的使用统计信息
47
+ - **发布说明优化**:改进版本发布说明展示,默认仅显示最近版本更新内容,提升阅读体验
48
+ - **键盘输入处理增强**:优化终端输入序列处理逻辑,改进Home/End键跳转和分词导航体验,提升跨平台兼容性
49
+ - **MCP服务器支持优化**:扩展代理管理器的MCP服务器支持范围,子代理和自定义代理现在也能获取MCP服务器功能
50
+ - **搜索服务优化**:优化搜索服务的稳定性和可用性,提升搜索功能的用户体验
51
+ - **多代理编排系统**:新增多代理编排器功能,支持通过 `--orchestrator` 选项启动编排模式,实现多代理协作和任务分配
52
+ - **沙箱环境支持**:新增本地沙箱和 E2B 沙箱支持,提供隔离的代理执行环境,提升安全性和可扩展性
53
+ - **远程连接模式**:新增 `--connect` 选项,支持连接到远程编排服务器,实现分布式代理协作
54
+ - **HTTP 服务器模式**:新增 `--serve` 选项,支持以 HTTP 服务器模式启动,提供非交互式 API 服务能力
55
+ - **企业域登录支持**:新增企业域登录方式,支持自定义企业端点配置,满足企业级部署需求
56
+ - **自定义端点配置**:新增端点配置功能,支持用户自定义服务端点地址和环境路由模式
57
+ - **配置文件兼容性增强**:支持自动检测并使用 AGENTS.md 作为项目级记忆文件,兼容多种配置文件命名约定
58
+ - **云托管环境支持**:新增专享版云托管环境配置支持,支持通配符域名匹配和环境自动识别
59
+
60
+ ### 🔧 功能改进
61
+ - **CLI架构重构**:重构命令行分发器为基于策略模式的责任链架构,提升代码可维护性和扩展性
62
+ - **请求处理优化**:提取请求构建和执行逻辑为独立组件,提供更清晰的关注点分离
63
+ - **模型推理配置优化**:调整推理摘要模式默认值,提升推理性能和用户体验
64
+ - **统计信息展示优化**:重构成本统计信息格式化逻辑,在退出时展示详细的使用统计信息
65
+ - **发布说明优化**:改进版本发布说明展示,默认仅显示最近版本更新内容,提升阅读体验
66
+ - **键盘输入处理增强**:优化终端输入序列处理逻辑,改进Home/End键跳转和分词导航体验,提升跨平台兼容性
67
+ - **MCP服务器支持优化**:扩展代理管理器的MCP服务器支持范围,子代理和自定义代理现在也能获取MCP服务器功能
68
+ - **搜索服务优化**:优化搜索服务的稳定性和可用性,提升搜索功能的用户体验
69
+
70
+ ### 🐛 问题修复
71
+ - **终端设置面板优化**:修复终端设置面板中终端类型显示问题,改进错误消息处理,避免在未知终端环境中显示 undefined
72
+ - **错误处理增强**:改进错误信息提取逻辑,优化上下文截断触发条件,提升错误处理准确性
73
+ - **指令参数丢失**:修改自定义指令参数丢失问题
74
+ - **认证配置增强**:改进域名匹配算法,支持通配符模式和多环境配置,提升企业级部署灵活性
75
+ - **统计数据展示**:修复初始化时统计数据未正确显示的问题
76
+ - **工具调用匹配优化**:修复会话中断服务和历史工具的重复调用匹配问题,提升工具执行稳定性
77
+
7
78
  ## [1.14.0] - 2025-10-15
8
79
 
9
80
  ### ✨ 新功能
@@ -0,0 +1 @@
1
+ "use strict";exports.id=293,exports.ids=[293],exports.modules={28293:(t,e,s)=>{s.d(e,{n_:()=>Minipass});var i=s(78474),r=s(57075),n=s(46193);const h="object"==typeof process&&process?process:{stdout:null,stderr:null},isStream=t=>!!t&&"object"==typeof t&&(t instanceof Minipass||t instanceof r||isReadable(t)||isWritable(t)),isReadable=t=>!!t&&"object"==typeof t&&t instanceof i.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==r.Writable.prototype.pipe,isWritable=t=>!!t&&"object"==typeof t&&t instanceof i.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,o=Symbol("EOF"),a=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),f=Symbol("emittingEnd"),d=Symbol("emittedError"),l=Symbol("closed"),c=Symbol("read"),m=Symbol("flush"),p=Symbol("flushChunk"),b=Symbol("encoding"),y=Symbol("decoder"),g=Symbol("flowing"),E=Symbol("paused"),w=Symbol("resume"),S=Symbol("buffer"),v=Symbol("pipes"),j=Symbol("bufferLength"),L=Symbol("bufferPush"),x=Symbol("bufferShift"),B=Symbol("objectMode"),P=Symbol("destroyed"),M=Symbol("error"),A=Symbol("emitData"),O=Symbol("emitEnd"),D=Symbol("emitEnd2"),R=Symbol("async"),T=Symbol("abort"),_=Symbol("aborted"),C=Symbol("signal"),I=Symbol("dataListeners"),N=Symbol("discarded"),defer=t=>Promise.resolve().then(t),nodefer=t=>t();class Pipe{src;dest;opts;ondrain;constructor(t,e,s){this.src=t,this.dest=e,this.opts=s,this.ondrain=()=>t[w](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,s){super(t,e,s),this.proxyErrors=t=>e.emit("error",t),t.on("error",this.proxyErrors)}}class Minipass extends i.EventEmitter{[g]=!1;[E]=!1;[v]=[];[S]=[];[B];[b];[R];[y];[o]=!1;[u]=!1;[f]=!1;[l]=!1;[d]=null;[j]=0;[P]=!1;[C];[_]=!1;[I]=0;[N]=!1;writable=!0;readable=!0;constructor(...t){const e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw new TypeError("Encoding and objectMode may not be used together");e.objectMode?(this[B]=!0,this[b]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[b]=e.encoding,this[B]=!1):(this[B]=!1,this[b]=null),this[R]=!!e.async,this[y]=this[b]?new n.StringDecoder(this[b]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[S]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[v]});const{signal:s}=e;s&&(this[C]=s,s.aborted?this[T]():s.addEventListener("abort",(()=>this[T]())))}get bufferLength(){return this[j]}get encoding(){return this[b]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[B]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[R]}set async(t){this[R]=this[R]||!!t}[T](){this[_]=!0,this.emit("abort",this[C]?.reason),this.destroy(this[C]?.reason)}get aborted(){return this[_]}set aborted(t){}write(t,e,s){if(this[_])return!1;if(this[o])throw new Error("write after end");if(this[P])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(s=e,e="utf8"),e||(e="utf8");const i=this[R]?defer:nodefer;if(!this[B]&&!Buffer.isBuffer(t))if(r=t,!Buffer.isBuffer(r)&&ArrayBuffer.isView(r))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if((t=>t instanceof ArrayBuffer||!!t&&"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t))t=Buffer.from(t);else if("string"!=typeof t)throw new Error("Non-contiguous data written to non-objectMode stream");var r;return this[B]?(this[g]&&0!==this[j]&&this[m](!0),this[g]?this.emit("data",t):this[L](t),0!==this[j]&&this.emit("readable"),s&&i(s),this[g]):t.length?("string"!=typeof t||e===this[b]&&!this[y]?.lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[b]&&(t=this[y].write(t)),this[g]&&0!==this[j]&&this[m](!0),this[g]?this.emit("data",t):this[L](t),0!==this[j]&&this.emit("readable"),s&&i(s),this[g]):(0!==this[j]&&this.emit("readable"),s&&i(s),this[g])}read(t){if(this[P])return null;if(this[N]=!1,0===this[j]||0===t||t&&t>this[j])return this[a](),null;this[B]&&(t=null),this[S].length>1&&!this[B]&&(this[S]=[this[b]?this[S].join(""):Buffer.concat(this[S],this[j])]);const e=this[c](t||null,this[S][0]);return this[a](),e}[c](t,e){if(this[B])this[x]();else{const s=e;t===s.length||null===t?this[x]():"string"==typeof s?(this[S][0]=s.slice(t),e=s.slice(0,t),this[j]-=t):(this[S][0]=s.subarray(t),e=s.subarray(0,t),this[j]-=t)}return this.emit("data",e),this[S].length||this[o]||this.emit("drain"),e}end(t,e,s){return"function"==typeof t&&(s=t,t=void 0),"function"==typeof e&&(s=e,e="utf8"),void 0!==t&&this.write(t,e),s&&this.once("end",s),this[o]=!0,this.writable=!1,!this[g]&&this[E]||this[a](),this}[w](){this[P]||(this[I]||this[v].length||(this[N]=!0),this[E]=!1,this[g]=!0,this.emit("resume"),this[S].length?this[m]():this[o]?this[a]():this.emit("drain"))}resume(){return this[w]()}pause(){this[g]=!1,this[E]=!0,this[N]=!1}get destroyed(){return this[P]}get flowing(){return this[g]}get paused(){return this[E]}[L](t){this[B]?this[j]+=1:this[j]+=t.length,this[S].push(t)}[x](){return this[B]?this[j]-=1:this[j]-=this[S][0].length,this[S].shift()}[m](t=!1){do{}while(this[p](this[x]())&&this[S].length);t||this[S].length||this[o]||this.emit("drain")}[p](t){return this.emit("data",t),this[g]}pipe(t,e){if(this[P])return t;this[N]=!1;const s=this[u];return e=e||{},t===h.stdout||t===h.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,s?e.end&&t.end():(this[v].push(e.proxyErrors?new PipeProxyErrors(this,t,e):new Pipe(this,t,e)),this[R]?defer((()=>this[w]())):this[w]()),t}unpipe(t){const e=this[v].find((e=>e.dest===t));e&&(1===this[v].length?(this[g]&&0===this[I]&&(this[g]=!1),this[v]=[]):this[v].splice(this[v].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){const s=super.on(t,e);if("data"===t)this[N]=!1,this[I]++,this[v].length||this[g]||this[w]();else if("readable"===t&&0!==this[j])super.emit("readable");else if((t=>"end"===t||"finish"===t||"prefinish"===t)(t)&&this[u])super.emit(t),this.removeAllListeners(t);else if("error"===t&&this[d]){const t=e;this[R]?defer((()=>t.call(this,this[d]))):t.call(this,this[d])}return s}removeListener(t,e){return this.off(t,e)}off(t,e){const s=super.off(t,e);return"data"===t&&(this[I]=this.listeners("data").length,0!==this[I]||this[N]||this[v].length||(this[g]=!1)),s}removeAllListeners(t){const e=super.removeAllListeners(t);return"data"!==t&&void 0!==t||(this[I]=0,this[N]||this[v].length||(this[g]=!1)),e}get emittedEnd(){return this[u]}[a](){this[f]||this[u]||this[P]||0!==this[S].length||!this[o]||(this[f]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[l]&&this.emit("close"),this[f]=!1)}emit(t,...e){const s=e[0];if("error"!==t&&"close"!==t&&t!==P&&this[P])return!1;if("data"===t)return!(!this[B]&&!s)&&(this[R]?(defer((()=>this[A](s))),!0):this[A](s));if("end"===t)return this[O]();if("close"===t){if(this[l]=!0,!this[u]&&!this[P])return!1;const t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[d]=s,super.emit(M,s);const t=!(this[C]&&!this.listeners("error").length)&&super.emit("error",s);return this[a](),t}if("resume"===t){const t=super.emit("resume");return this[a](),t}if("finish"===t||"prefinish"===t){const e=super.emit(t);return this.removeAllListeners(t),e}const i=super.emit(t,...e);return this[a](),i}[A](t){for(const e of this[v])!1===e.dest.write(t)&&this.pause();const e=!this[N]&&super.emit("data",t);return this[a](),e}[O](){return!this[u]&&(this[u]=!0,this.readable=!1,this[R]?(defer((()=>this[D]())),!0):this[D]())}[D](){if(this[y]){const t=this[y].end();if(t){for(const e of this[v])e.dest.write(t);this[N]||super.emit("data",t)}}for(const t of this[v])t.end();const t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){const t=Object.assign([],{dataLength:0});this[B]||(t.dataLength=0);const e=this.promise();return this.on("data",(e=>{t.push(e),this[B]||(t.dataLength+=e.length)})),await e,t}async concat(){if(this[B])throw new Error("cannot concat in objectMode");const t=await this.collect();return this[b]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(P,(()=>e(new Error("stream destroyed")))),this.on("error",(t=>e(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[N]=!1;let t=!1;const stop=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return stop();const e=this.read();if(null!==e)return Promise.resolve({done:!1,value:e});if(this[o])return stop();let s,i;const onerr=t=>{this.off("data",ondata),this.off("end",onend),this.off(P,ondestroy),stop(),i(t)},ondata=t=>{this.off("error",onerr),this.off("end",onend),this.off(P,ondestroy),this.pause(),s({value:t,done:!!this[o]})},onend=()=>{this.off("error",onerr),this.off("data",ondata),this.off(P,ondestroy),stop(),s({done:!0,value:void 0})},ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{i=e,s=t,this.once(P,ondestroy),this.once("error",onerr),this.once("end",onend),this.once("data",ondata)}))},throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[N]=!1;let t=!1;const stop=()=>(this.pause(),this.off(M,stop),this.off(P,stop),this.off("end",stop),t=!0,{done:!0,value:void 0});return this.once("end",stop),this.once(M,stop),this.once(P,stop),{next:()=>{if(t)return stop();const e=this.read();return null===e?stop():{done:!1,value:e}},throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[P])return t?this.emit("error",t):this.emit(P),this;this[P]=!0,this[N]=!0,this[S].length=0,this[j]=0;return"function"!=typeof this.close||this[l]||this.close(),t?this.emit("error",t):this.emit(P),this}static get isStream(){return isStream}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=33,exports.ids=[33],exports.modules={53033:(t,e,i)=>{i.r(e),i.d(e,{Header:()=>Header,Pack:()=>Pack,PackJob:()=>PackJob,PackSync:()=>PackSync,Parser:()=>Parser,Pax:()=>Pax,ReadEntry:()=>ReadEntry,Unpack:()=>Unpack,UnpackSync:()=>UnpackSync,WriteEntry:()=>WriteEntry,WriteEntrySync:()=>WriteEntrySync,WriteEntryTar:()=>WriteEntryTar,c:()=>hi,create:()=>hi,extract:()=>Qi,filesFilter:()=>filesFilter,list:()=>pe,r:()=>ts,replace:()=>ts,t:()=>pe,types:()=>s,u:()=>es,update:()=>es,x:()=>Qi});var s={};i.r(s),i.d(s,{code:()=>It,isCode:()=>isCode,isName:()=>isName,name:()=>xt});var r=i(24434),n=i(79896),h=i(78474),o=i(57075),a=i(46193);const l="object"==typeof process&&process?process:{stdout:null,stderr:null},isStream=t=>!!t&&"object"==typeof t&&(t instanceof Minipass||t instanceof o||isReadable(t)||isWritable(t)),isReadable=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.pipe&&t.pipe!==o.Writable.prototype.pipe,isWritable=t=>!!t&&"object"==typeof t&&t instanceof h.EventEmitter&&"function"==typeof t.write&&"function"==typeof t.end,c=Symbol("EOF"),d=Symbol("maybeEmitEnd"),u=Symbol("emittedEnd"),m=Symbol("emittingEnd"),p=Symbol("emittedError"),f=Symbol("closed"),y=Symbol("read"),b=Symbol("flush"),E=Symbol("flushChunk"),w=Symbol("encoding"),g=Symbol("decoder"),S=Symbol("flowing"),R=Symbol("paused"),_=Symbol("resume"),v=Symbol("buffer"),O=Symbol("pipes"),k=Symbol("bufferLength"),T=Symbol("bufferPush"),L=Symbol("bufferShift"),A=Symbol("objectMode"),N=Symbol("destroyed"),D=Symbol("error"),x=Symbol("emitData"),I=Symbol("emitEnd"),P=Symbol("emitEnd2"),B=Symbol("async"),F=Symbol("abort"),C=Symbol("aborted"),M=Symbol("signal"),z=Symbol("dataListeners"),U=Symbol("discarded"),defer=t=>Promise.resolve().then(t),nodefer=t=>t();class Pipe{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[_](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=t=>e.emit("error",t),t.on("error",this.proxyErrors)}}class Minipass extends h.EventEmitter{[S]=!1;[R]=!1;[O]=[];[v]=[];[A];[w];[B];[g];[c]=!1;[u]=!1;[m]=!1;[f]=!1;[p]=null;[k]=0;[N]=!1;[M];[C]=!1;[z]=0;[U]=!1;writable=!0;readable=!0;constructor(...t){const e=t[0]||{};if(super(),e.objectMode&&"string"==typeof e.encoding)throw new TypeError("Encoding and objectMode may not be used together");e.objectMode?(this[A]=!0,this[w]=null):(t=>!t.objectMode&&!!t.encoding&&"buffer"!==t.encoding)(e)?(this[w]=e.encoding,this[A]=!1):(this[A]=!1,this[w]=null),this[B]=!!e.async,this[g]=this[w]?new a.StringDecoder(this[w]):null,e&&!0===e.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[v]}),e&&!0===e.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[O]});const{signal:i}=e;i&&(this[M]=i,i.aborted?this[F]():i.addEventListener("abort",(()=>this[F]())))}get bufferLength(){return this[k]}get encoding(){return this[w]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get async(){return this[B]}set async(t){this[B]=this[B]||!!t}[F](){this[C]=!0,this.emit("abort",this[M]?.reason),this.destroy(this[M]?.reason)}get aborted(){return this[C]}set aborted(t){}write(t,e,i){if(this[C])return!1;if(this[c])throw new Error("write after end");if(this[N])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof e&&(i=e,e="utf8"),e||(e="utf8");const s=this[B]?defer:nodefer;if(!this[A]&&!Buffer.isBuffer(t))if(r=t,!Buffer.isBuffer(r)&&ArrayBuffer.isView(r))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if((t=>t instanceof ArrayBuffer||!!t&&"object"==typeof t&&t.constructor&&"ArrayBuffer"===t.constructor.name&&t.byteLength>=0)(t))t=Buffer.from(t);else if("string"!=typeof t)throw new Error("Non-contiguous data written to non-objectMode stream");var r;return this[A]?(this[S]&&0!==this[k]&&this[b](!0),this[S]?this.emit("data",t):this[T](t),0!==this[k]&&this.emit("readable"),i&&s(i),this[S]):t.length?("string"!=typeof t||e===this[w]&&!this[g]?.lastNeed||(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[w]&&(t=this[g].write(t)),this[S]&&0!==this[k]&&this[b](!0),this[S]?this.emit("data",t):this[T](t),0!==this[k]&&this.emit("readable"),i&&s(i),this[S]):(0!==this[k]&&this.emit("readable"),i&&s(i),this[S])}read(t){if(this[N])return null;if(this[U]=!1,0===this[k]||0===t||t&&t>this[k])return this[d](),null;this[A]&&(t=null),this[v].length>1&&!this[A]&&(this[v]=[this[w]?this[v].join(""):Buffer.concat(this[v],this[k])]);const e=this[y](t||null,this[v][0]);return this[d](),e}[y](t,e){if(this[A])this[L]();else{const i=e;t===i.length||null===t?this[L]():"string"==typeof i?(this[v][0]=i.slice(t),e=i.slice(0,t),this[k]-=t):(this[v][0]=i.subarray(t),e=i.subarray(0,t),this[k]-=t)}return this.emit("data",e),this[v].length||this[c]||this.emit("drain"),e}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e="utf8"),void 0!==t&&this.write(t,e),i&&this.once("end",i),this[c]=!0,this.writable=!1,!this[S]&&this[R]||this[d](),this}[_](){this[N]||(this[z]||this[O].length||(this[U]=!0),this[R]=!1,this[S]=!0,this.emit("resume"),this[v].length?this[b]():this[c]?this[d]():this.emit("drain"))}resume(){return this[_]()}pause(){this[S]=!1,this[R]=!0,this[U]=!1}get destroyed(){return this[N]}get flowing(){return this[S]}get paused(){return this[R]}[T](t){this[A]?this[k]+=1:this[k]+=t.length,this[v].push(t)}[L](){return this[A]?this[k]-=1:this[k]-=this[v][0].length,this[v].shift()}[b](t=!1){do{}while(this[E](this[L]())&&this[v].length);t||this[v].length||this[c]||this.emit("drain")}[E](t){return this.emit("data",t),this[S]}pipe(t,e){if(this[N])return t;this[U]=!1;const i=this[u];return e=e||{},t===l.stdout||t===l.stderr?e.end=!1:e.end=!1!==e.end,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[O].push(e.proxyErrors?new PipeProxyErrors(this,t,e):new Pipe(this,t,e)),this[B]?defer((()=>this[_]())):this[_]()),t}unpipe(t){const e=this[O].find((e=>e.dest===t));e&&(1===this[O].length?(this[S]&&0===this[z]&&(this[S]=!1),this[O]=[]):this[O].splice(this[O].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){const i=super.on(t,e);if("data"===t)this[U]=!1,this[z]++,this[O].length||this[S]||this[_]();else if("readable"===t&&0!==this[k])super.emit("readable");else if((t=>"end"===t||"finish"===t||"prefinish"===t)(t)&&this[u])super.emit(t),this.removeAllListeners(t);else if("error"===t&&this[p]){const t=e;this[B]?defer((()=>t.call(this,this[p]))):t.call(this,this[p])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){const i=super.off(t,e);return"data"===t&&(this[z]=this.listeners("data").length,0!==this[z]||this[U]||this[O].length||(this[S]=!1)),i}removeAllListeners(t){const e=super.removeAllListeners(t);return"data"!==t&&void 0!==t||(this[z]=0,this[U]||this[O].length||(this[S]=!1)),e}get emittedEnd(){return this[u]}[d](){this[m]||this[u]||this[N]||0!==this[v].length||!this[c]||(this[m]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[f]&&this.emit("close"),this[m]=!1)}emit(t,...e){const i=e[0];if("error"!==t&&"close"!==t&&t!==N&&this[N])return!1;if("data"===t)return!(!this[A]&&!i)&&(this[B]?(defer((()=>this[x](i))),!0):this[x](i));if("end"===t)return this[I]();if("close"===t){if(this[f]=!0,!this[u]&&!this[N])return!1;const t=super.emit("close");return this.removeAllListeners("close"),t}if("error"===t){this[p]=i,super.emit(D,i);const t=!(this[M]&&!this.listeners("error").length)&&super.emit("error",i);return this[d](),t}if("resume"===t){const t=super.emit("resume");return this[d](),t}if("finish"===t||"prefinish"===t){const e=super.emit(t);return this.removeAllListeners(t),e}const s=super.emit(t,...e);return this[d](),s}[x](t){for(const e of this[O])!1===e.dest.write(t)&&this.pause();const e=!this[U]&&super.emit("data",t);return this[d](),e}[I](){return!this[u]&&(this[u]=!0,this.readable=!1,this[B]?(defer((()=>this[P]())),!0):this[P]())}[P](){if(this[g]){const t=this[g].end();if(t){for(const e of this[O])e.dest.write(t);this[U]||super.emit("data",t)}}for(const t of this[O])t.end();const t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){const t=Object.assign([],{dataLength:0});this[A]||(t.dataLength=0);const e=this.promise();return this.on("data",(e=>{t.push(e),this[A]||(t.dataLength+=e.length)})),await e,t}async concat(){if(this[A])throw new Error("cannot concat in objectMode");const t=await this.collect();return this[w]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,e)=>{this.on(N,(()=>e(new Error("stream destroyed")))),this.on("error",(t=>e(t))),this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[U]=!1;let t=!1;const stop=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return stop();const e=this.read();if(null!==e)return Promise.resolve({done:!1,value:e});if(this[c])return stop();let i,s;const onerr=t=>{this.off("data",ondata),this.off("end",onend),this.off(N,ondestroy),stop(),s(t)},ondata=t=>{this.off("error",onerr),this.off("end",onend),this.off(N,ondestroy),this.pause(),i({value:t,done:!!this[c]})},onend=()=>{this.off("error",onerr),this.off("data",ondata),this.off(N,ondestroy),stop(),i({done:!0,value:void 0})},ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,e)=>{s=e,i=t,this.once(N,ondestroy),this.once("error",onerr),this.once("end",onend),this.once("data",ondata)}))},throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[U]=!1;let t=!1;const stop=()=>(this.pause(),this.off(D,stop),this.off(N,stop),this.off("end",stop),t=!0,{done:!0,value:void 0});return this.once("end",stop),this.once(D,stop),this.once(N,stop),{next:()=>{if(t)return stop();const e=this.read();return null===e?stop():{done:!1,value:e}},throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[N])return t?this.emit("error",t):this.emit(N),this;this[N]=!0,this[U]=!0,this[v].length=0,this[k]=0;return"function"!=typeof this.close||this[f]||this.close(),t?this.emit("error",t):this.emit(N),this}static get isStream(){return isStream}}const j=n.writev,W=Symbol("_autoClose"),H=Symbol("_close"),Z=Symbol("_ended"),G=Symbol("_fd"),Y=Symbol("_finished"),V=Symbol("_flags"),$=Symbol("_flush"),K=Symbol("_handleChunk"),q=Symbol("_makeBuf"),X=Symbol("_mode"),J=Symbol("_needDrain"),Q=Symbol("_onerror"),tt=Symbol("_onopen"),et=Symbol("_onread"),it=Symbol("_onwrite"),st=Symbol("_open"),rt=Symbol("_path"),nt=Symbol("_pos"),ht=Symbol("_queue"),ot=Symbol("_read"),at=Symbol("_readSize"),lt=Symbol("_reading"),ct=Symbol("_remain"),dt=Symbol("_size"),ut=Symbol("_write"),mt=Symbol("_writing"),pt=Symbol("_defaultFlag"),ft=Symbol("_errored");class ReadStream extends Minipass{[ft]=!1;[G];[rt];[at];[lt]=!1;[dt];[ct];[W];constructor(t,e){if(super(e=e||{}),this.readable=!0,this.writable=!1,"string"!=typeof t)throw new TypeError("path must be a string");this[ft]=!1,this[G]="number"==typeof e.fd?e.fd:void 0,this[rt]=t,this[at]=e.readSize||16777216,this[lt]=!1,this[dt]="number"==typeof e.size?e.size:1/0,this[ct]=this[dt],this[W]="boolean"!=typeof e.autoClose||e.autoClose,"number"==typeof this[G]?this[ot]():this[st]()}get fd(){return this[G]}get path(){return this[rt]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[st](){n.open(this[rt],"r",((t,e)=>this[tt](t,e)))}[tt](t,e){t?this[Q](t):(this[G]=e,this.emit("open",e),this[ot]())}[q](){return Buffer.allocUnsafe(Math.min(this[at],this[ct]))}[ot](){if(!this[lt]){this[lt]=!0;const t=this[q]();if(0===t.length)return process.nextTick((()=>this[et](null,0,t)));n.read(this[G],t,0,t.length,null,((t,e,i)=>this[et](t,e,i)))}}[et](t,e,i){this[lt]=!1,t?this[Q](t):this[K](e,i)&&this[ot]()}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[Q](t){this[lt]=!0,this[H](),this.emit("error",t)}[K](t,e){let i=!1;return this[ct]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(0===t||this[ct]<=0)&&(i=!1,this[H](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return"number"==typeof this[G]&&this[ot](),!1;case"error":return!this[ft]&&(this[ft]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}}class ReadStreamSync extends ReadStream{[st](){let t=!0;try{this[tt](null,n.openSync(this[rt],"r")),t=!1}finally{t&&this[H]()}}[ot](){let t=!0;try{if(!this[lt]){for(this[lt]=!0;;){const t=this[q](),e=0===t.length?0:n.readSync(this[G],t,0,t.length,null);if(!this[K](e,t))break}this[lt]=!1}t=!1}finally{t&&this[H]()}}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.closeSync(t),this.emit("close")}}}class WriteStream extends r{readable=!1;writable=!0;[ft]=!1;[mt]=!1;[Z]=!1;[ht]=[];[J]=!1;[rt];[X];[W];[G];[pt];[V];[Y]=!1;[nt];constructor(t,e){super(e=e||{}),this[rt]=t,this[G]="number"==typeof e.fd?e.fd:void 0,this[X]=void 0===e.mode?438:e.mode,this[nt]="number"==typeof e.start?e.start:void 0,this[W]="boolean"!=typeof e.autoClose||e.autoClose;const i=void 0!==this[nt]?"r+":"w";this[pt]=void 0===e.flags,this[V]=void 0===e.flags?i:e.flags,void 0===this[G]&&this[st]()}emit(t,...e){if("error"===t){if(this[ft])return!1;this[ft]=!0}return super.emit(t,...e)}get fd(){return this[G]}get path(){return this[rt]}[Q](t){this[H](),this[mt]=!0,this.emit("error",t)}[st](){n.open(this[rt],this[V],this[X],((t,e)=>this[tt](t,e)))}[tt](t,e){this[pt]&&"r+"===this[V]&&t&&"ENOENT"===t.code?(this[V]="w",this[st]()):t?this[Q](t):(this[G]=e,this.emit("open",e),this[mt]||this[$]())}end(t,e){return t&&this.write(t,e),this[Z]=!0,this[mt]||this[ht].length||"number"!=typeof this[G]||this[it](null,0),this}write(t,e){return"string"==typeof t&&(t=Buffer.from(t,e)),this[Z]?(this.emit("error",new Error("write() after end()")),!1):void 0===this[G]||this[mt]||this[ht].length?(this[ht].push(t),this[J]=!0,!1):(this[mt]=!0,this[ut](t),!0)}[ut](t){n.write(this[G],t,0,t.length,this[nt],((t,e)=>this[it](t,e)))}[it](t,e){t?this[Q](t):(void 0!==this[nt]&&"number"==typeof e&&(this[nt]+=e),this[ht].length?this[$]():(this[mt]=!1,this[Z]&&!this[Y]?(this[Y]=!0,this[H](),this.emit("finish")):this[J]&&(this[J]=!1,this.emit("drain"))))}[$](){if(0===this[ht].length)this[Z]&&this[it](null,0);else if(1===this[ht].length)this[ut](this[ht].pop());else{const t=this[ht];this[ht]=[],j(this[G],t,this[nt],((t,e)=>this[it](t,e)))}}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[st](){let t;if(this[pt]&&"r+"===this[V])try{t=n.openSync(this[rt],this[V],this[X])}catch(t){if("ENOENT"===t?.code)return this[V]="w",this[st]();throw t}else t=n.openSync(this[rt],this[V],this[X]);this[tt](null,t)}[H](){if(this[W]&&"number"==typeof this[G]){const t=this[G];this[G]=void 0,n.closeSync(t),this.emit("close")}}[ut](t){let e=!0;try{this[it](null,n.writeSync(this[G],t,0,t.length,this[nt])),e=!1}finally{if(e)try{this[H]()}catch{}}}}var yt=i(76760),bt=i(73024),Et=i(16928);const wt=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"]]),dealiasKey=t=>{const e=wt.get(t);return e||t},dealias=(t={})=>{if(!t)return{};const e={};for(const[i,s]of Object.entries(t)){e[dealiasKey(i)]=s}return void 0===e.chmod&&!1===e.noChmod&&(e.chmod=!0),delete e.noChmod,e},makeCommand=(t,e,i,s,r)=>Object.assign(((n=[],h,o)=>{Array.isArray(n)&&(h=n,n={}),"function"==typeof h&&(o=h,h=void 0),h=h?Array.from(h):[];const a=dealias(n);if(r?.(a,h),(l=a).sync&&l.file){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return t(a,h)}if((t=>!t.sync&&!!t.file)(a)){const t=e(a,h),i=o||void 0;return i?t.then((()=>i()),i):t}if((t=>!!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback not supported for sync tar functions");return i(a,h)}if((t=>!t.sync&&!t.file)(a)){if("function"==typeof o)throw new TypeError("callback only supported with file option");return s(a,h)}throw new Error("impossible options??");var l}),{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r});var gt=i(42613),St=i(20181),Rt=i(28293),_t=i(43106),vt=i.t(_t,2);const Ot=_t.constants||{ZLIB_VERNUM:4736},kt=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},Ot)),Tt=St.Buffer.concat,Lt=Object.getOwnPropertyDescriptor(St.Buffer,"concat"),noop=t=>t,At=!0===Lt?.writable||void 0!==Lt?.set?t=>{St.Buffer.concat=t?noop:Tt}:t=>{},Nt=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message),this.code=t.code,this.errno=t.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+t.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const Dt=Symbol("flushFlag");class ZlibBase extends Rt.n_{#t=!1;#e=!1;#i;#s;#r;#n;#h;get sawError(){return this.#t}get handle(){return this.#n}get flushFlag(){return this.#i}constructor(t,e){if(!t||"object"!=typeof t)throw new TypeError("invalid options for ZlibBase constructor");super(t),this.#i=t.flush??0,this.#s=t.finishFlush??0,this.#r=t.fullFlushFlag??0;try{this.#n=new vt[e](t)}catch(t){throw new ZlibError(t)}this.#h=t=>{this.#t||(this.#t=!0,this.close(),this.emit("error",t))},this.#n?.on("error",(t=>this.#h(new ZlibError(t)))),this.once("end",(()=>this.close))}close(){this.#n&&(this.#n.close(),this.#n=void 0,this.emit("close"))}reset(){if(!this.#t)return gt(this.#n,"zlib binding closed"),this.#n.reset?.()}flush(t){this.ended||("number"!=typeof t&&(t=this.#r),this.write(Object.assign(St.Buffer.alloc(0),{[Dt]:t})))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#s),this.#e=!0,super.end(i)}get ended(){return this.#e}[Nt](t){return super.write(t)}write(t,e,i){if("function"==typeof e&&(i=e,e="utf8"),"string"==typeof t&&(t=St.Buffer.from(t,e)),this.#t)return;gt(this.#n,"zlib binding closed");const s=this.#n._handle,r=s.close;s.close=()=>{};const n=this.#n.close;let h,o;this.#n.close=()=>{},At(!0);try{const e="number"==typeof t[Dt]?t[Dt]:this.#i;h=this.#n._processChunk(t,e),At(!1)}catch(t){At(!1),this.#h(new ZlibError(t))}finally{this.#n&&(this.#n._handle=s,s.close=r,this.#n.close=n,this.#n.removeAllListeners("error"))}if(this.#n&&this.#n.on("error",(t=>this.#h(new ZlibError(t)))),h)if(Array.isArray(h)&&h.length>0){const t=h[0];o=this[Nt](St.Buffer.from(t));for(let t=1;t<h.length;t++)o=this[Nt](h[t])}else o=this[Nt](St.Buffer.from(h));return i&&i(),o}}class Zlib extends ZlibBase{#o;#a;constructor(t,e){(t=t||{}).flush=t.flush||kt.Z_NO_FLUSH,t.finishFlush=t.finishFlush||kt.Z_FINISH,t.fullFlushFlag=kt.Z_FULL_FLUSH,super(t,e),this.#o=t.level,this.#a=t.strategy}params(t,e){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#o!==t||this.#a!==e){this.flush(kt.Z_SYNC_FLUSH),gt(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,e)=>{"function"==typeof t&&(e=t,t=this.flushFlag),this.flush(t),e?.()};try{this.handle.params(t,e)}finally{this.handle.flush=i}this.handle&&(this.#o=t,this.#a=e)}}}}class Gzip extends Zlib{#l;constructor(t){super(t,"Gzip"),this.#l=t&&!!t.portable}[Nt](t){return this.#l?(this.#l=!1,t[9]=255,super[Nt](t)):super[Nt](t)}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,e){(t=t||{}).flush=t.flush||kt.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||kt.BROTLI_OPERATION_FINISH,t.fullFlushFlag=kt.BROTLI_OPERATION_FLUSH,super(t,e)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const e of t)this.push(e)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");const e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,e}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);const e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);const e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}push(...t){for(let e=0,i=t.length;e<i;e++)push(this,t[e]);return this.length}unshift(...t){for(var e=0,i=t.length;e<i;e++)unshift(this,t[e]);return this.length}pop(){if(!this.tail)return;const t=this.tail.value,e=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,e.list=void 0,this.length--,t}shift(){if(!this.head)return;const t=this.head.value,e=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,e.list=void 0,this.length--,t}forEach(t,e){e=e||this;for(let i=this.head,s=0;i;s++)t.call(e,i.value,s,this),i=i.next}forEachReverse(t,e){e=e||this;for(let i=this.tail,s=this.length-1;i;s--)t.call(e,i.value,s,this),i=i.prev}get(t){let e=0,i=this.head;for(;i&&e<t;e++)i=i.next;if(e===t&&i)return i.value}getReverse(t){let e=0,i=this.tail;for(;i&&e<t;e++)i=i.prev;if(e===t&&i)return i.value}map(t,e){e=e||this;const i=new Yallist;for(let s=this.head;s;)i.push(t.call(e,s.value,this)),s=s.next;return i}mapReverse(t,e){e=e||this;var i=new Yallist;for(let s=this.tail;s;)i.push(t.call(e,s.value,this)),s=s.prev;return i}reduce(t,e){let i,s=this.head;if(arguments.length>1)i=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");s=this.head.next,i=this.head.value}for(var r=0;s;r++)i=t(i,s.value,r),s=s.next;return i}reduceReverse(t,e){let i,s=this.tail;if(arguments.length>1)i=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");s=this.tail.prev,i=this.tail.value}for(let e=this.length-1;s;e--)i=t(i,s.value,e),s=s.prev;return i}toArray(){const t=new Array(this.length);for(let e=0,i=this.head;i;e++)t[e]=i.value,i=i.next;return t}toArrayReverse(){const t=new Array(this.length);for(let e=0,i=this.tail;i;e++)t[e]=i.value,i=i.prev;return t}slice(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.head,r=0;for(r=0;s&&r<t;r++)s=s.next;for(;s&&r<e;r++,s=s.next)i.push(s.value);return i}sliceReverse(t=0,e=this.length){e<0&&(e+=this.length),t<0&&(t+=this.length);const i=new Yallist;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);let s=this.length,r=this.tail;for(;r&&s>e;s--)r=r.prev;for(;r&&s>t;s--,r=r.prev)i.push(r.value);return i}splice(t,e=0,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let s=this.head;for(let e=0;s&&e<t;e++)s=s.next;const r=[];for(let t=0;s&&t<e;t++)r.push(s.value),s=this.removeNode(s);s?s!==this.tail&&(s=s.prev):s=this.tail;for(const t of i)s=insertAfter(this,s,t);return r}reverse(){const t=this.head,e=this.tail;for(let e=t;e;e=e.prev){const t=e.prev;e.prev=e.next,e.next=t}return this.head=e,this.tail=t,this}}function insertAfter(t,e,i){const s=e,r=e?e.next:t.head,n=new Node(i,s,r,t);return void 0===n.next&&(t.tail=n),void 0===n.prev&&(t.head=n),t.length++,n}function push(t,e){t.tail=new Node(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function unshift(t,e){t.head=new Node(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}class Node{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}}const encodePositive=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=255&t,t=Math.floor(t/256)},encodeNegative=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=255&t;t=Math.floor(t/256),i?e[s-1]=onesComp(r):0===r?e[s-1]=0:(i=!0,e[s-1]=twosComp(r))}},twos=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var n,h=Number(t[r]);s?n=onesComp(h):0===h?n=h:(s=!0,n=twosComp(h)),0!==n&&(i-=n*Math.pow(256,e-r-1))}return i},pos=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);0!==r&&(i+=r*Math.pow(256,e-s-1))}return i},onesComp=t=>255&(255^t),twosComp=t=>1+(255^t)&255,isCode=t=>xt.has(t),isName=t=>It.has(t),xt=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"]]),It=new Map(Array.from(xt).map((t=>[t[1],t[0]])));class Header{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#c="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#d(t)}decode(t,e,i,s){if(e||(e=0),!(t&&t.length>=e+512))throw new Error("need 512 bytes for header");this.path=decString(t,e,100),this.mode=decNumber(t,e+100,8),this.uid=decNumber(t,e+108,8),this.gid=decNumber(t,e+116,8),this.size=decNumber(t,e+124,12),this.mtime=decDate(t,e+136,12),this.cksum=decNumber(t,e+148,12),s&&this.#d(s,!0),i&&this.#d(i);const r=decString(t,e+156,1);if(isCode(r)&&(this.#c=r||"0"),"0"===this.#c&&"/"===this.path.slice(-1)&&(this.#c="5"),"5"===this.#c&&(this.size=0),this.linkpath=decString(t,e+157,100),"ustar\x0000"===t.subarray(e+257,e+265).toString())if(this.uname=decString(t,e+265,32),this.gname=decString(t,e+297,32),this.devmaj=decNumber(t,e+329,8)??0,this.devmin=decNumber(t,e+337,8)??0,0!==t[e+475]){const i=decString(t,e+345,155);this.path=i+"/"+this.path}else{const i=decString(t,e+345,130);i&&(this.path=i+"/"+this.path),this.atime=decDate(t,e+476,12),this.ctime=decDate(t,e+488,12)}let n=256;for(let i=e;i<e+148;i++)n+=t[i];for(let i=e+156;i<e+512;i++)n+=t[i];this.cksumValid=n===this.cksum,void 0===this.cksum&&256===n&&(this.nullBlock=!0)}#d(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e||"linkpath"===t&&e||"global"===t)))))}encode(t,e=0){if(t||(t=this.block=Buffer.alloc(512)),"Unsupported"===this.#c&&(this.#c="0"),!(t.length>=e+512))throw new Error("need 512 bytes for header");const i=this.ctime||this.atime?130:155,s=splitPrefix(this.path||"",i),r=s[0],n=s[1];this.needPax=!!s[2],this.needPax=encString(t,e,100,r)||this.needPax,this.needPax=encNumber(t,e+100,8,this.mode)||this.needPax,this.needPax=encNumber(t,e+108,8,this.uid)||this.needPax,this.needPax=encNumber(t,e+116,8,this.gid)||this.needPax,this.needPax=encNumber(t,e+124,12,this.size)||this.needPax,this.needPax=encDate(t,e+136,12,this.mtime)||this.needPax,t[e+156]=this.#c.charCodeAt(0),this.needPax=encString(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=encString(t,e+265,32,this.uname)||this.needPax,this.needPax=encString(t,e+297,32,this.gname)||this.needPax,this.needPax=encNumber(t,e+329,8,this.devmaj)||this.needPax,this.needPax=encNumber(t,e+337,8,this.devmin)||this.needPax,this.needPax=encString(t,e+345,i,n)||this.needPax,0!==t[e+475]?this.needPax=encString(t,e+345,155,n)||this.needPax:(this.needPax=encString(t,e+345,130,n)||this.needPax,this.needPax=encDate(t,e+476,12,this.atime)||this.needPax,this.needPax=encDate(t,e+488,12,this.ctime)||this.needPax);let h=256;for(let i=e;i<e+148;i++)h+=t[i];for(let i=e+156;i<e+512;i++)h+=t[i];return this.cksum=h,encNumber(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return"Unsupported"===this.#c?this.#c:xt.get(this.#c)}get typeKey(){return this.#c}set type(t){const e=String(It.get(t));if(isCode(e)||"Unsupported"===e)this.#c=e;else{if(!isCode(t))throw new TypeError("invalid entry type: "+t);this.#c=t}}}const splitPrefix=(t,e)=>{const i=100;let s,r=t,n="";const h=yt.posix.parse(t).root||".";if(Buffer.byteLength(r)<i)s=[r,n,!1];else{n=yt.posix.dirname(r),r=yt.posix.basename(r);do{Buffer.byteLength(r)<=i&&Buffer.byteLength(n)<=e?s=[r,n,!1]:Buffer.byteLength(r)>i&&Buffer.byteLength(n)<=e?s=[r.slice(0,99),n,!0]:(r=yt.posix.join(yt.posix.basename(n),r),n=yt.posix.dirname(n))}while(n!==h&&void 0===s);s||(s=[t.slice(0,99),"",!0])}return s},decString=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),decDate=(t,e,i)=>numToDate(decNumber(t,e,i)),numToDate=t=>void 0===t?void 0:new Date(1e3*t),decNumber=(t,e,i)=>128&Number(t[e])?(t=>{const e=t[0],i=128===e?pos(t.subarray(1,t.length)):255===e?twos(t):null;if(null===i)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i})(t.subarray(e,e+i)):decSmallNumber(t,e,i),decSmallNumber=(t,e,i)=>{return s=parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8),isNaN(s)?void 0:s;var s},Pt={12:8589934591,8:2097151},encNumber=(t,e,i,s)=>void 0!==s&&(s>Pt[i]||s<0?(((t,e)=>{if(!Number.isSafeInteger(t))throw Error("cannot encode number outside of javascript safe integer range");t<0?encodeNegative(t,e):encodePositive(t,e)})(s,t.subarray(e,e+i)),!0):(encSmallNumber(t,e,i,s),!1)),encSmallNumber=(t,e,i,s)=>t.write(octalString(s,i),e,i,"ascii"),octalString=(t,e)=>padOctal(Math.floor(t).toString(8),e),padOctal=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",encDate=(t,e,i,s)=>void 0!==s&&encNumber(t,e,i,s.getTime()/1e3),Bt=new Array(156).join("\0"),encString=(t,e,i,s)=>void 0!==s&&(t.write(s+Bt,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,e=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=e,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){const t=this.encodeBody();if(""===t)return Buffer.allocUnsafe(0);const e=Buffer.byteLength(t),i=512*Math.ceil(1+e/512),s=Buffer.allocUnsafe(i);for(let t=0;t<512;t++)s[t]=0;new Header({path:("PaxHeader/"+(0,yt.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:e,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(s),s.write(t,512,e,"utf8");for(let t=e+512;t<s.length;t++)s[t]=0;return s}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(t){if(void 0===this[t])return"";const e=this[t],i=" "+("dev"===t||"ino"===t||"nlink"===t?"SCHILY.":"")+t+"="+(e instanceof Date?e.getTime()/1e3:e)+"\n",s=Buffer.byteLength(i);let r=Math.floor(Math.log(s)/Math.log(10))+1;s+r>=Math.pow(10,r)&&(r+=1);return r+s+i}static parse(t,e,i=!1){return new Pax(merge(parseKV(t),e),i)}}const merge=(t,e)=>e?Object.assign({},e,t):t,parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null)),parseKVLine=(t,e)=>{const i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;const s=(e=e.slice((i+" ").length)).split("="),r=s.shift();if(!r)return t;const n=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),h=s.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(1e3*Number(h)):/^[0-9]+$/.test(h)?+h:h,t},Ft="win32"!==(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Rt.n_{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(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.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(!t.path)throw new Error("no path provided for tar.ReadEntry");this.path=Ft(t.path),this.mode=t.mode,this.mode&&(this.mode=4095&this.mode),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?Ft(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#d(e),i&&this.#d(i,!0)}write(t){const e=t.length;if(e>this.blockRemain)throw new Error("writing more to entry than is appropriate");const i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-e),this.blockRemain=Math.max(0,s-e),!!this.ignore||(i>=e?super.write(t):super.write(t.subarray(0,i)))}#d(t,e=!1){t.path&&(t.path=Ft(t.path)),t.linkpath&&(t.linkpath=Ft(t.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(null==i||"path"===t&&e)))))}}const warnMethod=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,t.strict||!1===s.recoverable?i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),s)):(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s))},Ct=Buffer.from([31,139]),Mt=Symbol("state"),zt=Symbol("writeEntry"),Ut=Symbol("readEntry"),jt=Symbol("nextEntry"),Wt=Symbol("processEntry"),Ht=Symbol("extendedHeader"),Zt=Symbol("globalExtendedHeader"),Gt=Symbol("meta"),Yt=Symbol("emitMeta"),Vt=Symbol("buffer"),$t=Symbol("queue"),Kt=Symbol("ended"),qt=Symbol("emittedEnd"),Xt=Symbol("emit"),Jt=Symbol("unzip"),Qt=Symbol("consumeChunk"),te=Symbol("consumeChunkSub"),ee=Symbol("consumeBody"),ie=Symbol("consumeMeta"),se=Symbol("consumeHeader"),re=Symbol("consuming"),ne=Symbol("bufferConcat"),he=Symbol("maybeEnd"),oe=Symbol("writing"),ae=Symbol("aborted"),le=Symbol("onDone"),ce=Symbol("sawValidEntry"),de=Symbol("sawNullBlock"),ue=Symbol("sawEOF"),me=Symbol("closeStream"),parse_noop=()=>!0;class Parser extends r.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=!0;readable=!1;[$t]=new Yallist;[Vt];[Ut];[zt];[Mt]="begin";[Gt]="";[Ht];[Zt];[Kt]=!1;[Jt];[ae]=!1;[ce];[de]=!1;[ue]=!1;[oe]=!1;[re]=!1;[qt]=!1;constructor(t={}){super(),this.file=t.file||"",this.on(le,(()=>{"begin"!==this[Mt]&&!1!==this[ce]||this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")})),t.ondone?this.on(le,t.ondone):this.on(le,(()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")})),this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||1048576,this.filter="function"==typeof t.filter?t.filter:parse_noop;const e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=t.gzip||void 0===t.brotli?!!e&&void 0:t.brotli,this.on("end",(()=>this[me]())),"function"==typeof t.onwarn&&this.on("warn",t.onwarn),"function"==typeof t.onReadEntry&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){warnMethod(this,t,e,i)}[se](t,e){let i;void 0===this[ce]&&(this[ce]=!1);try{i=new Header(t,e,this[Ht],this[Zt])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock)this[de]?(this[ue]=!0,"begin"===this[Mt]&&(this[Mt]="header"),this[Xt]("eof")):(this[de]=!0,this[Xt]("nullBlock"));else if(this[de]=!1,i.cksumValid)if(i.path){const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(/^(Symbolic)?Link$/.test(t)||/^(Global)?ExtendedHeader$/.test(t)||!i.linkpath){const t=this[zt]=new ReadEntry(i,this[Ht],this[Zt]);if(!this[ce])if(t.remain){const onend=()=>{t.invalid||(this[ce]=!0)};t.on("end",onend)}else this[ce]=!0;t.meta?t.size>this.maxMetaEntrySize?(t.ignore=!0,this[Xt]("ignoredEntry",t),this[Mt]="ignore",t.resume()):t.size>0&&(this[Gt]="",t.on("data",(t=>this[Gt]+=t)),this[Mt]="meta"):(this[Ht]=void 0,t.ignore=t.ignore||!this.filter(t.path,t),t.ignore?(this[Xt]("ignoredEntry",t),this[Mt]=t.remain?"ignore":"header",t.resume()):(t.remain?this[Mt]="body":(this[Mt]="header",t.end()),this[Ut]?this[$t].push(t):(this[$t].push(t),this[jt]())))}else this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}[me](){queueMicrotask((()=>this.emit("close")))}[Wt](t){let e=!0;if(t)if(Array.isArray(t)){const[e,...i]=t;this.emit(e,...i)}else this[Ut]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",(()=>this[jt]())),e=!1);else this[Ut]=void 0,e=!1;return e}[jt](){do{}while(this[Wt](this[$t].shift()));if(!this[$t].length){const t=this[Ut];!t||t.flowing||t.size===t.remain?this[oe]||this.emit("drain"):t.once("drain",(()=>this.emit("drain")))}}[ee](t,e){const i=this[zt];if(!i)throw new Error("attempt to consume body without entry??");const s=i.blockRemain??0,r=s>=t.length&&0===e?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[Mt]="header",this[zt]=void 0,i.end()),r.length}[ie](t,e){const i=this[zt],s=this[ee](t,e);return!this[zt]&&i&&this[Yt](i),s}[Xt](t,e,i){this[$t].length||this[Ut]?this[$t].push([t,e,i]):this.emit(t,e,i)}[Yt](t){switch(this[Xt]("meta",this[Gt]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[Ht]=Pax.parse(this[Gt],this[Ht],!1);break;case"GlobalExtendedHeader":this[Zt]=Pax.parse(this[Gt],this[Zt],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[Ht]??Object.create(null);this[Ht]=t,t.path=this[Gt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[Ht]||Object.create(null);this[Ht]=t,t.linkpath=this[Gt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[ae]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this[ae])return i?.(),!1;if((void 0===this[Jt]||void 0===this.brotli&&!1===this[Jt])&&t){if(this[Vt]&&(t=Buffer.concat([this[Vt],t]),this[Vt]=void 0),t.length<Ct.length)return this[Vt]=t,i?.(),!0;for(let e=0;void 0===this[Jt]&&e<Ct.length;e++)t[e]!==Ct[e]&&(this[Jt]=!1);const e=void 0===this.brotli;if(!1===this[Jt]&&e)if(t.length<512){if(!this[Kt])return this[Vt]=t,i?.(),!0;this.brotli=!0}else try{new Header(t.subarray(0,512)),this.brotli=!1}catch(t){this.brotli=!0}if(void 0===this[Jt]||!1===this[Jt]&&this.brotli){const e=this[Kt];this[Kt]=!1,this[Jt]=void 0===this[Jt]?new Unzip({}):new BrotliDecompress({}),this[Jt].on("data",(t=>this[Qt](t))),this[Jt].on("error",(t=>this.abort(t))),this[Jt].on("end",(()=>{this[Kt]=!0,this[Qt]()})),this[oe]=!0;const s=!!this[Jt][e?"end":"write"](t);return this[oe]=!1,i?.(),s}}this[oe]=!0,this[Jt]?this[Jt].write(t):this[Qt](t),this[oe]=!1;const s=!this[$t].length&&(!this[Ut]||this[Ut].flowing);return s||this[$t].length||this[Ut]?.once("drain",(()=>this.emit("drain"))),i?.(),s}[ne](t){t&&!this[ae]&&(this[Vt]=this[Vt]?Buffer.concat([this[Vt],t]):t)}[he](){if(this[Kt]&&!this[qt]&&!this[ae]&&!this[re]){this[qt]=!0;const t=this[zt];if(t&&t.blockRemain){const e=this[Vt]?this[Vt].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[Vt]&&t.write(this[Vt]),t.end()}this[Xt](le)}}[Qt](t){if(this[re]&&t)this[ne](t);else if(t||this[Vt]){if(t){if(this[re]=!0,this[Vt]){this[ne](t);const e=this[Vt];this[Vt]=void 0,this[te](e)}else this[te](t);for(;this[Vt]&&this[Vt]?.length>=512&&!this[ae]&&!this[ue];){const t=this[Vt];this[Vt]=void 0,this[te](t)}this[re]=!1}}else this[he]();this[Vt]&&!this[Kt]||this[he]()}[te](t){let e=0;const i=t.length;for(;e+512<=i&&!this[ae]&&!this[ue];)switch(this[Mt]){case"begin":case"header":this[se](t,e),e+=512;break;case"ignore":case"body":e+=this[ee](t,e);break;case"meta":e+=this[ie](t,e);break;default:throw new Error("invalid state: "+this[Mt])}e<i&&(this[Vt]?this[Vt]=Buffer.concat([t.subarray(e),this[Vt]]):this[Vt]=t.subarray(e))}end(t,e,i){return"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[ae]||(this[Jt]?(t&&this[Jt].write(t),this[Jt].end()):(this[Kt]=!0,void 0===this.brotli&&(t=t||Buffer.alloc(0)),t&&this.write(t),this[he]())),this}}const stripTrailingSlashes=t=>{let e=t.length-1,i=-1;for(;e>-1&&"/"===t.charAt(e);)i=e,e--;return-1===i?t:t.slice(0,i)},filesFilter=(t,e)=>{const i=new Map(e.map((t=>[stripTrailingSlashes(t),!0]))),s=t.filter,mapHas=(t,e="")=>{const s=e||(0,Et.parse)(t).root||".";let r;if(t===s)r=!1;else{const e=i.get(t);r=void 0!==e?e:mapHas((0,Et.dirname)(t),s)}return i.set(t,r),r};t.filter=s?(t,e)=>s(t,e)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))},pe=makeCommand((t=>{const e=new Parser(t),i=t.file;let s;try{const r=bt.statSync(i),n=t.maxReadSize||16777216;if(r.size<n)e.end(bt.readFileSync(i));else{let t=0;const h=Buffer.allocUnsafe(n);for(s=bt.openSync(i,"r");t<r.size;){const i=bt.readSync(s,h,0,n,t);t+=i,e.write(h.subarray(0,i))}e.end()}}finally{if("number"==typeof s)try{bt.closeSync(s)}catch(t){}}}),((t,e)=>{const i=new Parser(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("end",t),bt.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new Parser(t)),(t=>new Parser(t)),((t,e)=>{e?.length&&filesFilter(t,e),t.noResume||(t=>{const e=t.onReadEntry;t.onReadEntry=e?t=>{e(t),t.resume()}:t=>t.resume()})(t)})),modeFix=(t,e,i)=>(t&=4095,i&&(t=-19&t|384),e&&(256&t&&(t|=64),32&t&&(t|=8),4&t&&(t|=1)),t),{isAbsolute:fe,parse:ye}=yt.win32,stripAbsolutePath=t=>{let e="",i=ye(t);for(;fe(t)||i.root;){const s="/"===t.charAt(0)&&"//?/"!==t.slice(0,4)?"/":i.root;t=t.slice(s.length),e+=s,i=ye(t)}return[e,t]},be=["|","<",">","?",":"],Ee=be.map((t=>String.fromCharCode(61440+t.charCodeAt(0)))),we=new Map(be.map(((t,e)=>[t,Ee[e]]))),ge=new Map(Ee.map(((t,e)=>[t,be[e]]))),winchars_encode=t=>be.reduce(((t,e)=>t.split(e).join(we.get(e))),t),prefixPath=(t,e)=>e?(t=Ft(t).replace(/^\.(\/|$)/,""),stripTrailingSlashes(e)+"/"+t):Ft(t),Se=Symbol("process"),Re=Symbol("file"),_e=Symbol("directory"),ve=Symbol("symlink"),Oe=Symbol("hardlink"),ke=Symbol("header"),Te=Symbol("read"),Le=Symbol("lstat"),Ae=Symbol("onlstat"),Ne=Symbol("onread"),De=Symbol("onreadlink"),xe=Symbol("openfile"),Ie=Symbol("onopenfile"),Pe=Symbol("close"),Be=Symbol("mode"),Fe=Symbol("awaitDrain"),Ce=Symbol("ondrain"),Me=Symbol("prefix");class WriteEntry extends Rt.n_{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;#u=!1;constructor(t,e={}){const i=dealias(e);super(),this.path=Ft(t),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||16777216,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=Ft(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?Ft(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,s=t)}var r;this.win32=!!i.win32||"win32"===process.platform,this.win32&&(this.path=(r=this.path.replace(/\\/g,"/"),Ee.reduce(((t,e)=>t.split(e).join(ge.get(e))),r)),t=t.replace(/\\/g,"/")),this.absolute=Ft(i.absolute||Et.resolve(this.cwd,t)),""===this.path&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});const n=this.statCache.get(this.absolute);n?this[Ae](n):this[Le]()}warn(t,e,i={}){return warnMethod(this,t,e,i)}emit(t,...e){return"error"===t&&(this.#u=!0),super.emit(t,...e)}[Le](){n.lstat(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[Ae](e)}))}[Ae](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=getType(t),this.emit("stat",t),this[Se]()}[Se](){switch(this.type){case"File":return this[Re]();case"Directory":return this[_e]();case"SymbolicLink":return this[ve]();default:return this.end()}}[Be](t){return modeFix(t,"Directory"===this.type,this.portable)}[Me](t){return prefixPath(t,this.prefix)}[ke](){if(!this.stat)throw new Error("cannot write header before stat");"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new Header({path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](this.linkpath):this.linkpath,mode:this[Be](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:"Unsupported"===this.type?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 Pax({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[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](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());const t=this.header?.block;if(!t)throw new Error("failed to encode header");super.write(t)}[_e](){if(!this.stat)throw new Error("cannot create directory entry without stat");"/"!==this.path.slice(-1)&&(this.path+="/"),this.stat.size=0,this[ke](),this.end()}[ve](){n.readlink(this.absolute,((t,e)=>{if(t)return this.emit("error",t);this[De](e)}))}[De](t){this.linkpath=Ft(t),this[ke](),this.end()}[Oe](t){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=Ft(Et.relative(this.cwd,t)),this.stat.size=0,this[ke](),this.end()}[Re](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(0===e?.indexOf(this.cwd))return this[Oe](e);this.linkCache.set(t,this.absolute)}if(this[ke](),0===this.stat.size)return this.end();this[xe]()}[xe](){n.open(this.absolute,"r",((t,e)=>{if(t)return this.emit("error",t);this[Ie](e)}))}[Ie](t){if(this.fd=t,this.#u)return this[Pe]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;const e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Te]()}[Te](){const{fd:t,buf:e,offset:i,length:s,pos:r}=this;if(void 0===t||void 0===e)throw new Error("cannot read file without first opening");n.read(t,e,i,s,r,((t,e)=>{if(t)return this[Pe]((()=>this.emit("error",t)));this[Ne](e)}))}[Pe](t=()=>{}){void 0!==this.fd&&n.close(this.fd,t)}[Ne](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Pe]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Pe]((()=>this.emit("error",t)))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(t===this.remain)for(let e=t;e<this.length&&t<this.blockRemain;e++)this.buf[e+this.offset]=0,t++,this.remain++;const e=0===this.offset&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[Ce]():this[Fe]((()=>this[Ce]()))}[Fe](t){this.once("drain",t)}write(t,e,i){if("function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8")),this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[Ce](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Pe]((t=>t?this.emit("error",t):this.end()));if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");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[Te]()}}class WriteEntrySync extends WriteEntry{sync=!0;[Le](){this[Ae](n.lstatSync(this.absolute))}[ve](){this[De](n.readlinkSync(this.absolute))}[xe](){this[Ie](n.openSync(this.absolute,"r"))}[Te](){let t=!0;try{const{fd:e,buf:i,offset:s,length:r,pos:h}=this;if(void 0===e||void 0===i)throw new Error("fd and buf must be set in READ method");const o=n.readSync(e,i,s,r,h);this[Ne](o),t=!1}finally{if(t)try{this[Pe]((()=>{}))}catch(t){}}}[Fe](t){t()}[Pe](t=()=>{}){void 0!==this.fd&&n.closeSync(this.fd),t()}}class WriteEntryTar extends Rt.n_{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(t,e,i={}){return warnMethod(this,t,e,i)}constructor(t,e={}){const i=dealias(e);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=t;const{type:s}=t;if("Unsupported"===s)throw new Error("writing entry that should be ignored");this.type=s,"Directory"===this.type&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=Ft(t.path),this.mode=void 0!==t.mode?this[Be](t.mode):void 0,this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=void 0!==t.linkpath?Ft(t.linkpath):void 0,"function"==typeof i.onwarn&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){const[t,e]=stripAbsolutePath(this.path);t&&"string"==typeof e&&(this.path=e,r=t)}this.remain=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new Header({path:this[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](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}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new Pax({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[Me](this.path),linkpath:"Link"===this.type&&void 0!==this.linkpath?this[Me](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());const n=this.header?.block;if(!n)throw new Error("failed to encode header");super.write(n),t.pipe(this)}[Me](t){return prefixPath(t,this.prefix)}[Be](t){return modeFix(t,"Directory"===this.type,this.portable)}write(t,e,i){"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,"string"==typeof e?e:"utf8"));const s=t.length;if(s>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),"function"==typeof t&&(i=t,e=void 0,t=void 0),"function"==typeof e&&(i=e,e=void 0),"string"==typeof t&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}}const ze=Buffer.alloc(1024),Ue=Symbol("onStat"),je=Symbol("ended"),We=Symbol("queue"),He=Symbol("current"),Ze=Symbol("process"),Ge=Symbol("processing"),Ye=Symbol("processJob"),Ve=Symbol("jobs"),$e=Symbol("jobDone"),Ke=Symbol("addFSEntry"),qe=Symbol("addTarEntry"),Xe=Symbol("stat"),Je=Symbol("readdir"),Qe=Symbol("onreaddir"),ti=Symbol("pipe"),ei=Symbol("entry"),ii=Symbol("entryOpt"),si=Symbol("writeEntryClass"),ri=Symbol("write"),ni=Symbol("ondrain");class Pack extends Rt.n_{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[si];onWriteEntry;[We];[Ve]=0;[Ge]=!1;[je]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=Ft(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[si]=WriteEntry,"function"==typeof t.onwarn&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli){if(t.gzip&&t.brotli)throw new TypeError("gzip and brotli are mutually exclusive");if(t.gzip&&("object"!=typeof t.gzip&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new Gzip(t.gzip)),t.brotli&&("object"!=typeof t.brotli&&(t.brotli={}),this.zip=new BrotliCompress(t.brotli)),!this.zip)throw new Error("impossible");const e=this.zip;e.on("data",(t=>super.write(t))),e.on("end",(()=>super.end())),e.on("drain",(()=>this[ni]())),this.on("resume",(()=>e.resume()))}else this.on("drain",this[ni]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter="function"==typeof t.filter?t.filter:()=>!0,this[We]=new Yallist,this[Ve]=0,this.jobs=Number(t.jobs)||4,this[Ge]=!1,this[je]=!1}[ri](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return"function"==typeof t&&(i=t,t=void 0),"function"==typeof e&&(i=e,e=void 0),t&&this.add(t),this[je]=!0,this[Ze](),i&&i(),this}write(t){if(this[je])throw new Error("write after end");return t instanceof ReadEntry?this[qe](t):this[Ke](t),this.flowing}[qe](t){const e=Ft(Et.resolve(this.cwd,t.path));if(this.filter(t.path,t)){const i=new PackJob(t.path,e);i.entry=new WriteEntryTar(t,this[ii](i)),i.entry.on("end",(()=>this[$e](i))),this[Ve]+=1,this[We].push(i)}else t.resume();this[Ze]()}[Ke](t){const e=Ft(Et.resolve(this.cwd,t));this[We].push(new PackJob(t,e)),this[Ze]()}[Xe](t){t.pending=!0,this[Ve]+=1;const e=this.follow?"stat":"lstat";n[e](t.absolute,((e,i)=>{t.pending=!1,this[Ve]-=1,e?this.emit("error",e):this[Ue](t,i)}))}[Ue](t,e){this.statCache.set(t.absolute,e),t.stat=e,this.filter(t.path,e)||(t.ignore=!0),this[Ze]()}[Je](t){t.pending=!0,this[Ve]+=1,n.readdir(t.absolute,((e,i)=>{if(t.pending=!1,this[Ve]-=1,e)return this.emit("error",e);this[Qe](t,i)}))}[Qe](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[Ze]()}[Ze](){if(!this[Ge]){this[Ge]=!0;for(let t=this[We].head;t&&this[Ve]<this.jobs;t=t.next)if(this[Ye](t.value),t.value.ignore){const e=t.next;this[We].removeNode(t),t.next=e}this[Ge]=!1,this[je]&&!this[We].length&&0===this[Ve]&&(this.zip?this.zip.end(ze):(super.write(ze),super.end()))}}get[He](){return this[We]&&this[We].head&&this[We].head.value}[$e](t){this[We].shift(),this[Ve]-=1,this[Ze]()}[Ye](t){if(!t.pending)if(t.entry)t!==this[He]||t.piped||this[ti](t);else{if(!t.stat){const e=this.statCache.get(t.absolute);e?this[Ue](t,e):this[Xe](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const e=this.readdirCache.get(t.absolute);if(e?this[Qe](t,e):this[Je](t),!t.readdir)return}t.entry=this[ei](t),t.entry?t!==this[He]||t.piped||this[ti](t):t.ignore=!0}}}[ii](t){return{onwarn:(t,e,i)=>this.warn(t,e,i),noPax:this.noPax,cwd:this.cwd,absolute:t.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}}[ei](t){this[Ve]+=1;try{return new this[si](t.path,this[ii](t)).on("end",(()=>this[$e](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[ni](){this[He]&&this[He].entry&&this[He].entry.resume()}[ti](t){t.piped=!0,t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[Ke](s+e)}));const e=t.entry,i=this.zip;if(!e)throw new Error("cannot pipe without source");i?e.on("data",(t=>{i.write(t)||e.pause()})):e.on("data",(t=>{super.write(t)||e.pause()}))}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){warnMethod(this,t,e,i)}}class PackSync extends Pack{sync=!0;constructor(t){super(t),this[si]=WriteEntrySync}pause(){}resume(){}[Xe](t){const e=this.follow?"statSync":"lstatSync";this[Ue](t,n[e](t.absolute))}[Je](t){this[Qe](t,n.readdirSync(t.absolute))}[ti](t){const e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach((e=>{const i=t.path,s="./"===i?"":i.replace(/\/*$/,"/");this[Ke](s+e)})),!e)throw new Error("Cannot pipe without source");i?e.on("data",(t=>{i.write(t)})):e.on("data",(t=>{super[ri](t)}))}}const addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?pe({file:yt.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await pe({file:yt.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>{t.add(e)}}):t.add(s)}t.end()},hi=makeCommand(((t,e)=>{const i=new PackSync(t),s=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(s),addFilesSync(i,e)}),((t,e)=>{const i=new Pack(t),s=new WriteStream(t.file,{mode:t.mode||438});i.pipe(s);const r=new Promise(((t,e)=>{s.on("error",e),s.on("close",t),i.on("error",e)}));return addFilesAsync(i,e),r}),((t,e)=>{const i=new PackSync(t);return addFilesSync(i,e),i}),((t,e)=>{const i=new Pack(t);return addFilesAsync(i,e),i}),((t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")}));var oi=i(34589),ai=i(77598);const li="win32"===(process.env.__FAKE_PLATFORM__||process.platform),{O_CREAT:ci,O_TRUNC:di,O_WRONLY:ui}=n.constants,mi=Number(process.env.__FAKE_FS_O_FILENAME__)||n.constants.UV_FS_O_FILEMAP||0,pi=mi|di|ci|ui,fi=li&&!!mi?t=>t<524288?pi:"w":()=>"w",lchownSync=(t,e,i)=>{try{return bt.lchownSync(t,e,i)}catch(t){if("ENOENT"!==t?.code)throw t}},chown=(t,e,i,s)=>{bt.lchown(t,e,i,(t=>{s(t&&"ENOENT"!==t?.code?t:null)}))},chownrKid=(t,e,i,s,r)=>{if(e.isDirectory())chownr(yt.resolve(t,e.name),i,s,(n=>{if(n)return r(n);const h=yt.resolve(t,e.name);chown(h,i,s,r)}));else{const n=yt.resolve(t,e.name);chown(n,i,s,r)}},chownr=(t,e,i,s)=>{bt.readdir(t,{withFileTypes:!0},((r,n)=>{if(r){if("ENOENT"===r.code)return s();if("ENOTDIR"!==r.code&&"ENOTSUP"!==r.code)return s(r)}if(r||!n.length)return chown(t,e,i,s);let h=n.length,o=null;const then=r=>{if(!o)return r?s(o=r):0==--h?chown(t,e,i,s):void 0};for(const s of n)chownrKid(t,s,e,i,then)}))},chownrKidSync=(t,e,i,s)=>{e.isDirectory()&&chownrSync(yt.resolve(t,e.name),i,s),lchownSync(yt.resolve(t,e.name),i,s)},chownrSync=(t,e,i)=>{let s;try{s=bt.readdirSync(t,{withFileTypes:!0})}catch(s){const r=s;if("ENOENT"===r?.code)return;if("ENOTDIR"===r?.code||"ENOTSUP"===r?.code)return lchownSync(t,e,i);throw r}for(const r of s)chownrKidSync(t,r,e,i);return lchownSync(t,e,i)},optsArg=t=>{if(t)if("object"==typeof t)t={mode:511,...t};else if("number"==typeof t)t={mode:t};else{if("string"!=typeof t)throw new TypeError("invalid options argument");t={mode:parseInt(t,8)}}else t={mode:511};const e=t,i=t.fs||{};return t.mkdir=t.mkdir||i.mkdir||n.mkdir,t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((s,r)=>e.mkdir(t,i,((t,e)=>t?r(t):s(e))))),t.stat=t.stat||i.stat||n.stat,t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,s)=>e.stat(t,((t,e)=>t?s(t):i(e))))),t.statSync=t.statSync||i.statSync||n.statSync,t.mkdirSync=t.mkdirSync||i.mkdirSync||n.mkdirSync,e},mkdirp_manual_mkdirpManualSync=(t,e,i)=>{const s=(0,Et.dirname)(t),r={...optsArg(e),recursive:!1};if(s===t)try{return r.mkdirSync(t,r)}catch(t){if(t&&"EISDIR"!==t.code)throw t;return}try{return r.mkdirSync(t,r),i||t}catch(e){const n=e;if(n&&"ENOENT"===n.code)return mkdirp_manual_mkdirpManualSync(t,r,mkdirp_manual_mkdirpManualSync(s,r,i));if(n&&"EEXIST"!==n.code&&n&&"EROFS"!==n.code)throw e;try{if(!r.statSync(t).isDirectory())throw e}catch(t){throw e}}},yi=Object.assign((async(t,e,i)=>{const s=optsArg(e);s.recursive=!1;const r=(0,Et.dirname)(t);return r===t?s.mkdirAsync(t,s).catch((t=>{if(t&&"EISDIR"!==t.code)throw t})):s.mkdirAsync(t,s).then((()=>i||t),(async e=>{const n=e;if(n&&"ENOENT"===n.code)return yi(r,s).then((e=>yi(t,s,e)));if(n&&"EEXIST"!==n.code&&"EROFS"!==n.code)throw e;return s.statAsync(t).then((t=>{if(t.isDirectory())return i;throw e}),(()=>{throw e}))}))}),{sync:mkdirp_manual_mkdirpManualSync}),findMade=async(t,e,i)=>{if(i!==e)return t.statAsync(e).then((t=>t.isDirectory()?i:void 0),(i=>i&&"ENOENT"===i.code?findMade(t,(0,Et.dirname)(e),e):void 0))},findMadeSync=(t,e,i)=>{if(i!==e)try{return t.statSync(e).isDirectory()?i:void 0}catch(i){return i&&"ENOENT"===i.code?findMadeSync(t,(0,Et.dirname)(e),e):void 0}},mkdirp_native_mkdirpNativeSync=(t,e)=>{const i=optsArg(e);i.recursive=!0;if((0,Et.dirname)(t)===t)return i.mkdirSync(t,i);const s=findMadeSync(i,t);try{return i.mkdirSync(t,i),s}catch(e){if(e&&"ENOENT"===e.code)return mkdirp_manual_mkdirpManualSync(t,i);throw e}},bi=Object.assign((async(t,e)=>{const i={...optsArg(e),recursive:!0};return(0,Et.dirname)(t)===t?await i.mkdirAsync(t,i):findMade(i,t).then((e=>i.mkdirAsync(t,i).then((t=>e||t)).catch((e=>{if(e&&"ENOENT"===e.code)return yi(t,i);throw e}))))}),{sync:mkdirp_native_mkdirpNativeSync}),Ei=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,pathArg=t=>{if(/\0/.test(t))throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"});if(t=(0,Et.resolve)(t),"win32"===Ei){const e=/[*|"<>?:]/,{root:i}=(0,Et.parse)(t);if(e.test(t.substring(i.length)))throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}return t},wi=(process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version).replace(/^v/,"").split("."),gi=+wi[0]>10||10==+wi[0]&&+wi[1]>=12,Si=gi?t=>optsArg(t).mkdirSync===n.mkdirSync:()=>!1,Ri=Object.assign(gi?t=>optsArg(t).mkdir===n.mkdir:()=>!1,{sync:Si}),mkdirpSync=(t,e)=>{t=pathArg(t);const i=optsArg(e);return Si(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)},_i=Object.assign((async(t,e)=>{t=pathArg(t);const i=optsArg(e);return Ri(i)?bi(t,i):yi(t,i)}),{mkdirpSync,mkdirpNative:bi,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:yi,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:bi,nativeSync:mkdirp_native_mkdirpNativeSync,manual:yi,manualSync:mkdirp_manual_mkdirpManualSync,useNative:Ri,useNativeSync:Si});class CwdError extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}}const cGet=(t,e)=>t.get(Ft(e)),cSet=(t,e,i)=>t.set(Ft(e),i),mkdir=(t,e,i)=>{t=Ft(t);const s=e.umask??18,r=448|e.mode,h=!!(r&s),o=e.uid,a=e.gid,l="number"==typeof o&&"number"==typeof a&&(o!==e.processUid||a!==e.processGid),c=e.preserve,d=e.unlink,u=e.cache,m=Ft(e.cwd),done=(e,s)=>{e?i(e):(cSet(u,t,!0),s&&l?chownr(s,o,a,(t=>done(t))):h?n.chmod(t,r,i):i())};if(u&&!0===cGet(u,t))return done();if(t===m)return((t,e)=>{n.stat(t,((i,s)=>{!i&&s.isDirectory()||(i=new CwdError(t,i?.code||"ENOTDIR")),e(i)}))})(t,done);if(c)return _i(t,{mode:r}).then((t=>done(null,t??void 0)),done);const p=Ft(yt.relative(m,t)).split("/");mkdir_(m,p,r,u,d,m,void 0,done)},mkdir_=(t,e,i,s,r,h,o,a)=>{if(!e.length)return a(null,o);const l=e.shift(),c=Ft(yt.resolve(t+"/"+l));if(cGet(s,c))return mkdir_(c,e,i,s,r,h,o,a);n.mkdir(c,i,onmkdir(c,e,i,s,r,h,o,a))},onmkdir=(t,e,i,s,r,h,o,a)=>l=>{l?n.lstat(t,((c,d)=>{if(c)c.path=c.path&&Ft(c.path),a(c);else if(d.isDirectory())mkdir_(t,e,i,s,r,h,o,a);else if(r)n.unlink(t,(l=>{if(l)return a(l);n.mkdir(t,i,onmkdir(t,e,i,s,r,h,o,a))}));else{if(d.isSymbolicLink())return a(new SymlinkError(t,t+"/"+e.join("/")));a(l)}})):mkdir_(t,e,i,s,r,h,o=o||t,a)},mkdirSync=(t,e)=>{t=Ft(t);const i=e.umask??18,s=448|e.mode,r=!!(s&i),h=e.uid,o=e.gid,a="number"==typeof h&&"number"==typeof o&&(h!==e.processUid||o!==e.processGid),l=e.preserve,c=e.unlink,d=e.cache,u=Ft(e.cwd),done=e=>{cSet(d,t,!0),e&&a&&chownrSync(e,h,o),r&&n.chmodSync(t,s)};if(d&&!0===cGet(d,t))return done();if(t===u)return(t=>{let e,i=!1;try{i=n.statSync(t).isDirectory()}catch(t){e=t?.code}finally{if(!i)throw new CwdError(t,e??"ENOTDIR")}})(u),done();if(l)return done(mkdirpSync(t,s)??void 0);const m=Ft(yt.relative(u,t)).split("/");let p;for(let t=m.shift(),e=u;t&&(e+="/"+t);t=m.shift())if(e=Ft(yt.resolve(e)),!cGet(d,e))try{n.mkdirSync(e,s),p=p||e,cSet(d,e,!0)}catch(t){const i=n.lstatSync(e);if(i.isDirectory()){cSet(d,e,!0);continue}if(c){n.unlinkSync(e),n.mkdirSync(e,s),p=p||e,cSet(d,e,!0);continue}if(i.isSymbolicLink())return new SymlinkError(e,e+"/"+m.join("/"))}return done(p)},vi=Object.create(null),{hasOwnProperty:Oi}=Object.prototype,normalizeUnicode=t=>(Oi.call(vi,t)||(vi[t]=t.normalize("NFD")),vi[t]),ki="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform);class PathReservations{#m=new Map;#p=new Map;#f=new Set;reserve(t,e){t=ki?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,yt.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>(t=>{const e=t.split("/").slice(0,-1).reduce(((t,e)=>{const i=t[t.length-1];return void 0!==i&&(e=(0,yt.join)(i,e)),t.push(e||"/"),t}),[]);return e})(t))).reduce(((t,e)=>t.concat(e))));this.#p.set(e,{dirs:i,paths:t});for(const i of t){const t=this.#m.get(i);t?t.push(e):this.#m.set(i,[e])}for(const t of i){const i=this.#m.get(t);if(i){const t=i[i.length-1];t instanceof Set?t.add(e):i.push(new Set([e]))}else this.#m.set(t,[new Set([e])])}return this.#y(e)}#b(t){const e=this.#p.get(t);if(!e)throw new Error("function does not have any path reservations");return{paths:e.paths.map((t=>this.#m.get(t))),dirs:[...e.dirs].map((t=>this.#m.get(t)))}}check(t){const{paths:e,dirs:i}=this.#b(t);return e.every((e=>e&&e[0]===t))&&i.every((e=>e&&e[0]instanceof Set&&e[0].has(t)))}#y(t){return!(this.#f.has(t)||!this.check(t))&&(this.#f.add(t),t((()=>this.#E(t))),!0)}#E(t){if(!this.#f.has(t))return!1;const e=this.#p.get(t);if(!e)throw new Error("invalid reservation");const{paths:i,dirs:s}=e,r=new Set;for(const e of i){const i=this.#m.get(e);if(!i||i?.[0]!==t)continue;const s=i[1];if(s)if(i.shift(),"function"==typeof s)r.add(s);else for(const t of s)r.add(t);else this.#m.delete(e)}for(const e of s){const i=this.#m.get(e),s=i?.[0];if(i&&s instanceof Set)if(1!==s.size||1!==i.length)if(1===s.size){i.shift();const t=i[0];"function"==typeof t&&r.add(t)}else s.delete(t);else this.#m.delete(e)}return this.#f.delete(t),r.forEach((t=>this.#y(t))),!0}}const Ti=Symbol("onEntry"),Li=Symbol("checkFs"),Ai=Symbol("checkFs2"),Ni=Symbol("pruneCache"),Di=Symbol("isReusable"),xi=Symbol("makeFs"),Ii=Symbol("file"),Pi=Symbol("directory"),Bi=Symbol("link"),Fi=Symbol("symlink"),Ci=Symbol("hardlink"),Mi=Symbol("unsupported"),zi=Symbol("checkPath"),Ui=Symbol("mkdir"),ji=Symbol("onError"),Wi=Symbol("pending"),Hi=Symbol("pend"),Zi=Symbol("unpend"),Gi=Symbol("ended"),Yi=Symbol("maybeClose"),Vi=Symbol("skip"),$i=Symbol("doChown"),Ki=Symbol("uid"),qi=Symbol("gid"),Xi=Symbol("checkedCwd"),Ji="win32"===(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform),uint32=(t,e,i)=>void 0!==t&&t===t>>>0?t:void 0!==e&&e===e>>>0?e:i,cacheKeyNormalize=t=>stripTrailingSlashes(Ft(normalizeUnicode(t))).toLowerCase();class Unpack extends Parser{[Gi]=!1;[Xi]=!1;[Wi]=0;reservations=new PathReservations;transform;writable=!0;readable=!1;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){if(t.ondone=()=>{this[Gi]=!0,this[Yi]()},super(t),this.transform=t.transform,this.dirCache=t.dirCache||new Map,this.chmod=!!t.chmod,"number"==typeof t.uid||"number"==typeof t.gid){if("number"!=typeof t.uid||"number"!=typeof t.gid)throw new TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;void 0===t.preserveOwner&&"number"!=typeof t.uid?this.preserveOwner=!(!process.getuid||0!==process.getuid()):this.preserveOwner=!!t.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="number"==typeof t.maxDepth?t.maxDepth:1024,this.forceChown=!0===t.forceChown,this.win32=!!t.win32||Ji,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=Ft(yt.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?"number"==typeof t.processUmask?t.processUmask:process.umask():0,this.umask="number"==typeof t.umask?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",(t=>this[Ti](t)))}warn(t,e,i={}){return"TAR_BAD_ARCHIVE"!==t&&"TAR_ABORT"!==t||(i.recoverable=!1),super.warn(t,e,i)}[Yi](){this[Gi]&&0===this[Wi]&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[zi](t){const e=Ft(t.path),i=e.split("/");if(this.strip){if(i.length<this.strip)return!1;if("Link"===t.type){const e=Ft(String(t.linkpath)).split("/");if(!(e.length>=this.strip))return!1;t.linkpath=e.slice(this.strip).join("/")}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(i.includes("..")||Ji&&/^[a-z]:\.\.$/i.test(i[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:t,path:e}),!1;const[s,r]=stripAbsolutePath(e);s&&(t.path=String(r),this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:t,path:e}))}if(yt.isAbsolute(t.path)?t.absolute=Ft(yt.resolve(t.path)):t.absolute=Ft(yt.resolve(this.cwd,t.path)),!this.preservePaths&&"string"==typeof t.absolute&&0!==t.absolute.indexOf(this.cwd+"/")&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:Ft(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&"Directory"!==t.type&&"GNUDumpDir"!==t.type)return!1;if(this.win32){const{root:e}=yt.win32.parse(String(t.absolute));t.absolute=e+winchars_encode(String(t.absolute).slice(e.length));const{root:i}=yt.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return!0}[Ti](t){if(!this[zi](t))return t.resume();switch(oi.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode=448|t.mode);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Li](t);default:return this[Mi](t)}}[ji](t,e){"CwdError"===t.name?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[Zi](),e.resume())}[Ui](t,e,i){mkdir(Ft(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e},i)}[$i](t){return this.forceChown||this.preserveOwner&&("number"==typeof t.uid&&t.uid!==this.processUid||"number"==typeof t.gid&&t.gid!==this.processGid)||"number"==typeof this.uid&&this.uid!==this.processUid||"number"==typeof this.gid&&this.gid!==this.processGid}[Ki](t){return uint32(this.uid,t.uid,this.processUid)}[qi](t){return uint32(this.gid,t.gid,this.processGid)}[Ii](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,s=new WriteStream(String(t.absolute),{flags:fi(t.size),mode:i,autoClose:!1});s.on("error",(i=>{s.fd&&bt.close(s.fd,(()=>{})),s.write=()=>!0,this[ji](i,t),e()}));let r=1;const done=i=>{if(i)return s.fd&&bt.close(s.fd,(()=>{})),this[ji](i,t),void e();0==--r&&void 0!==s.fd&&bt.close(s.fd,(i=>{i?this[ji](i,t):this[Zi](),e()}))};s.on("finish",(()=>{const e=String(t.absolute),i=s.fd;if("number"==typeof i&&t.mtime&&!this.noMtime){r++;const s=t.atime||new Date,n=t.mtime;bt.futimes(i,s,n,(t=>t?bt.utimes(e,s,n,(e=>done(e&&t))):done()))}if("number"==typeof i&&this[$i](t)){r++;const s=this[Ki](t),n=this[qi](t);"number"==typeof s&&"number"==typeof n&&bt.fchown(i,s,n,(t=>t?bt.chown(e,s,n,(e=>done(e&&t))):done()))}done()}));const n=this.transform&&this.transform(t)||t;n!==t&&(n.on("error",(i=>{this[ji](i,t),e()})),t.pipe(n)),n.pipe(s)}[Pi](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode;this[Ui](String(t.absolute),i,(i=>{if(i)return this[ji](i,t),void e();let s=1;const done=()=>{0==--s&&(e(),this[Zi](),t.resume())};t.mtime&&!this.noMtime&&(s++,bt.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)),this[$i](t)&&(s++,bt.chown(String(t.absolute),Number(this[Ki](t)),Number(this[qi](t)),done)),done()}))}[Mi](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Fi](t,e){this[Bi](t,String(t.linkpath),"symlink",e)}[Ci](t,e){const i=Ft(yt.resolve(this.cwd,String(t.linkpath)));this[Bi](t,i,"link",e)}[Hi](){this[Wi]++}[Zi](){this[Wi]--,this[Yi]()}[Vi](t){this[Zi](),t.resume()}[Di](t,e){return"File"===t.type&&!this.unlink&&e.isFile()&&e.nlink<=1&&!Ji}[Li](t){this[Hi]();const e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,(e=>this[Ai](t,e)))}[Ni](t){"SymbolicLink"===t.type?(t=>{for(const e of t.keys())t.delete(e)})(this.dirCache):"Directory"!==t.type&&((t,e)=>{e=cacheKeyNormalize(e);for(const i of t.keys()){const s=cacheKeyNormalize(i);s!==e&&0!==s.indexOf(e+"/")||t.delete(i)}})(this.dirCache,String(t.absolute))}[Ai](t,e){this[Ni](t);const done=i=>{this[Ni](t),e(i)},checkCwd=()=>{this[Ui](this.cwd,this.dmode,(e=>{if(e)return this[ji](e,t),void done();this[Xi]=!0,start()}))},start=()=>{if(t.absolute!==this.cwd){const e=Ft(yt.dirname(String(t.absolute)));if(e!==this.cwd)return this[Ui](e,this.dmode,(e=>{if(e)return this[ji](e,t),void done();afterMakeParent()}))}afterMakeParent()},afterMakeParent=()=>{bt.lstat(String(t.absolute),((e,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Vi](t),void done();if(e||this[Di](t,i))return this[xi](null,t,done);if(i.isDirectory()){if("Directory"===t.type){const afterChmod=e=>this[xi](e??null,t,done);return this.chmod&&t.mode&&(4095&i.mode)!==t.mode?bt.chmod(String(t.absolute),Number(t.mode),afterChmod):afterChmod()}if(t.absolute!==this.cwd)return bt.rmdir(String(t.absolute),(e=>this[xi](e??null,t,done)))}if(t.absolute===this.cwd)return this[xi](null,t,done);((t,e)=>{if(!Ji)return bt.unlink(t,e);const i=t+".DELETE."+(0,ai.randomBytes)(16).toString("hex");bt.rename(t,i,(t=>{if(t)return e(t);bt.unlink(i,e)}))})(String(t.absolute),(e=>this[xi](e??null,t,done)))}))};this[Xi]?start():checkCwd()}[xi](t,e,i){if(t)return this[ji](t,e),void i();switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Ii](e,i);case"Link":return this[Ci](e,i);case"SymbolicLink":return this[Fi](e,i);case"Directory":case"GNUDumpDir":return this[Pi](e,i)}}[Bi](t,e,i,s){bt[i](e,String(t.absolute),(e=>{e?this[ji](e,t):(this[Zi](),t.resume()),s()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=!0;[xi](t,e){return super[xi](t,e,(()=>{}))}[Li](t){if(this[Ni](t),!this[Xi]){const e=this[Ui](this.cwd,this.dmode);if(e)return this[ji](e,t);this[Xi]=!0}if(t.absolute!==this.cwd){const e=Ft(yt.dirname(String(t.absolute)));if(e!==this.cwd){const i=this[Ui](e,this.dmode);if(i)return this[ji](i,t)}}const[e,i]=callSync((()=>bt.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Vi](t);if(e||this[Di](t,i))return this[xi](null,t);if(i.isDirectory()){if("Directory"===t.type){const e=this.chmod&&t.mode&&(4095&i.mode)!==t.mode,[s]=e?callSync((()=>{bt.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[xi](s,t)}const[e]=callSync((()=>bt.rmdirSync(String(t.absolute))));this[xi](e,t)}const[s]=t.absolute===this.cwd?[]:callSync((()=>(t=>{if(!Ji)return bt.unlinkSync(t);const e=t+".DELETE."+(0,ai.randomBytes)(16).toString("hex");bt.renameSync(t,e),bt.unlinkSync(e)})(String(t.absolute))));this[xi](s,t)}[Ii](t,e){const i="number"==typeof t.mode?4095&t.mode:this.fmode,oner=i=>{let r;try{bt.closeSync(s)}catch(t){r=t}(i||r)&&this[ji](i||r,t),e()};let s;try{s=bt.openSync(String(t.absolute),fi(t.size),i)}catch(t){return oner(t)}const r=this.transform&&this.transform(t)||t;r!==t&&(r.on("error",(e=>this[ji](e,t))),t.pipe(r)),r.on("data",(t=>{try{bt.writeSync(s,t,0,t.length)}catch(t){oner(t)}})),r.on("end",(()=>{let e=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date,r=t.mtime;try{bt.futimesSync(s,i,r)}catch(s){try{bt.utimesSync(String(t.absolute),i,r)}catch(t){e=s}}}if(this[$i](t)){const i=this[Ki](t),r=this[qi](t);try{bt.fchownSync(s,Number(i),Number(r))}catch(s){try{bt.chownSync(String(t.absolute),Number(i),Number(r))}catch(t){e=e||s}}}oner(e)}))}[Pi](t,e){const i="number"==typeof t.mode?4095&t.mode:this.dmode,s=this[Ui](String(t.absolute),i);if(s)return this[ji](s,t),void e();if(t.mtime&&!this.noMtime)try{bt.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(s){}if(this[$i](t))try{bt.chownSync(String(t.absolute),Number(this[Ki](t)),Number(this[qi](t)))}catch(s){}e(),t.resume()}[Ui](t,e){try{return mkdirSync(Ft(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:e})}catch(t){return t}}[Bi](t,e,i,s){const r=`${i}Sync`;try{bt[r](e,String(t.absolute)),s(),t.resume()}catch(e){return this[ji](e,t)}}}const Qi=makeCommand((t=>{const e=new UnpackSync(t),i=t.file,s=bt.statSync(i),r=t.maxReadSize||16777216;new ReadStreamSync(i,{readSize:r,size:s.size}).pipe(e)}),((t,e)=>{const i=new Unpack(t),s=t.maxReadSize||16777216,r=t.file;return new Promise(((t,e)=>{i.on("error",e),i.on("close",t),bt.stat(r,((t,n)=>{if(t)e(t);else{const t=new ReadStream(r,{readSize:s,size:n.size});t.on("error",e),t.pipe(i)}}))}))}),(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,e)=>{e?.length&&filesFilter(t,e)})),streamSync=(t,e,i,s,r)=>{const n=new WriteStreamSync(t.file,{fd:s,start:i});e.pipe(n),replace_addFilesSync(e,r)},replace_addFilesSync=(t,e)=>{e.forEach((e=>{"@"===e.charAt(0)?pe({file:yt.resolve(t.cwd,e.slice(1)),sync:!0,noResume:!0,onReadEntry:e=>t.add(e)}):t.add(e)})),t.end()},replace_addFilesAsync=async(t,e)=>{for(let i=0;i<e.length;i++){const s=String(e[i]);"@"===s.charAt(0)?await pe({file:yt.resolve(String(t.cwd),s.slice(1)),noResume:!0,onReadEntry:e=>t.add(e)}):t.add(s)}t.end()},ts=makeCommand(((t,e)=>{const i=new PackSync(t);let s,r,n=!0;try{try{s=bt.openSync(t.file,"r+")}catch(e){if("ENOENT"!==e?.code)throw e;s=bt.openSync(t.file,"w+")}const h=bt.fstatSync(s),o=Buffer.alloc(512);t:for(r=0;r<h.size;r+=512){for(let t=0,e=0;t<512;t+=e){if(e=bt.readSync(s,o,t,o.length-t,r+t),0===r&&31===o[0]&&139===o[1])throw new Error("cannot append to compressed archives");if(!e)break t}const e=new Header(o);if(!e.cksumValid)break;const i=512*Math.ceil((e.size||0)/512);if(r+i+512>h.size)break;r+=i,t.mtimeCache&&e.mtime&&t.mtimeCache.set(String(e.path),e.mtime)}n=!1,streamSync(t,i,r,s,e)}finally{if(n)try{bt.closeSync(s)}catch(t){}}}),((t,e)=>{e=Array.from(e);const i=new Pack(t),s=new Promise(((s,r)=>{i.on("error",r);let n="r+";const onopen=(h,o)=>h&&"ENOENT"===h.code&&"r+"===n?(n="w+",bt.open(t.file,n,onopen)):h||!o?r(h):void bt.fstat(o,((n,h)=>{if(n)return bt.close(o,(()=>r(n)));((e,i,s)=>{const cb=(t,i)=>{t?bt.close(e,(e=>s(t))):s(null,i)};let r=0;if(0===i)return cb(null,0);let n=0;const h=Buffer.alloc(512),onread=(s,o)=>{if(s||void 0===o)return cb(s);if(n+=o,n<512&&o)return bt.read(e,h,n,h.length-n,r+n,onread);if(0===r&&31===h[0]&&139===h[1])return cb(new Error("cannot append to compressed archives"));if(n<512)return cb(null,r);const a=new Header(h);if(!a.cksumValid)return cb(null,r);const l=512*Math.ceil((a.size??0)/512);return r+l+512>i?cb(null,r):(r+=l+512,r>=i?cb(null,r):(t.mtimeCache&&a.mtime&&t.mtimeCache.set(String(a.path),a.mtime),n=0,void bt.read(e,h,0,512,r,onread)))};bt.read(e,h,0,512,r,onread)})(o,h.size,((n,h)=>{if(n)return r(n);const a=new WriteStream(t.file,{fd:o,start:h});i.pipe(a),a.on("error",r),a.on("close",s),replace_addFilesAsync(i,e)}))}));bt.open(t.file,n,onopen)}));return s}),(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,e)=>{if(!t.file)throw new TypeError("file is required");if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")})),es=makeCommand(ts.syncFile,ts.asyncFile,ts.syncNoFile,ts.asyncNoFile,((t,e=[])=>{ts.validate?.(t,e),mtimeFilter(t)})),mtimeFilter=t=>{const e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(e,i)=>!((t.mtimeCache?.get(e)??i.mtime??0)>(i.mtime??0))}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=344,exports.ids=[344],exports.modules={45344:(t,e,s)=>{s.r(e),s.d(e,{Glob:()=>Glob,Ignore:()=>Ignore,escape:()=>escape_escape,glob:()=>tt,globIterate:()=>globIterate,globIterateSync:()=>globIterateSync,globStream:()=>globStream,globStreamSync:()=>globStreamSync,globSync:()=>globSync,hasMagic:()=>hasMagic,iterate:()=>Y,iterateSync:()=>X,stream:()=>K,streamSync:()=>J,sync:()=>Q,unescape:()=>unescape_unescape});var i=s(14213);const assertValidPattern=t=>{if("string"!=typeof t)throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")},r={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},braceEscape=t=>t.replace(/[[\]\\-]/g,"\\$&"),rangesToString=t=>t.join(""),parseClass=(t,e)=>{const s=e;if("["!==t.charAt(s))throw new Error("not in a brace expression");const i=[],n=[];let h=s+1,o=!1,a=!1,l=!1,c=!1,p=s,d="";t:for(;h<t.length;){const e=t.charAt(h);if("!"!==e&&"^"!==e||h!==s+1){if("]"===e&&o&&!l){p=h+1;break}if(o=!0,"\\"!==e||l){if("["===e&&!l)for(const[e,[o,l,c]]of Object.entries(r))if(t.startsWith(e,h)){if(d)return["$.",!1,t.length-s,!0];h+=e.length,c?n.push(o):i.push(o),a=a||l;continue t}l=!1,d?(e>d?i.push(braceEscape(d)+"-"+braceEscape(e)):e===d&&i.push(braceEscape(e)),d="",h++):t.startsWith("-]",h+1)?(i.push(braceEscape(e+"-")),h+=2):t.startsWith("-",h+1)?(d=e,h+=2):(i.push(braceEscape(e)),h++)}else l=!0,h++}else c=!0,h++}if(p<h)return["",!1,0,!1];if(!i.length&&!n.length)return["$.",!1,t.length-s,!0];if(0===n.length&&1===i.length&&/^\\?.$/.test(i[0])&&!c){const t=2===i[0].length?i[0].slice(-1):i[0];return[(u=t,u.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")),!1,p-s,!1]}var u;const f="["+(c?"^":"")+rangesToString(i)+"]",g="["+(c?"":"^")+rangesToString(n)+"]";return[i.length&&n.length?"("+f+"|"+g+")":i.length?f:g,a,p-s,!0]},unescape_unescape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),n=new Set(["!","?","+","*","@"]),isExtglobType=t=>n.has(t),h="(?!\\.)",o=new Set(["[","."]),a=new Set(["..","."]),l=new Set("().*{}+?[]^$\\!"),c="[^/]",p=c+"*?",d=c+"+?";class AST{type;#t;#e;#s=!1;#i=[];#r;#n;#h;#o=!1;#a;#l;#c=!1;constructor(t,e,s={}){this.type=t,t&&(this.#e=!0),this.#r=e,this.#t=this.#r?this.#r.#t:this,this.#a=this.#t===this?s:this.#t.#a,this.#h=this.#t===this?[]:this.#t.#h,"!"!==t||this.#t.#o||this.#h.push(this),this.#n=this.#r?this.#r.#i.length:0}get hasMagic(){if(void 0!==this.#e)return this.#e;for(const t of this.#i)if("string"!=typeof t&&(t.type||t.hasMagic))return this.#e=!0;return this.#e}toString(){return void 0!==this.#l?this.#l:this.type?this.#l=this.type+"("+this.#i.map((t=>String(t))).join("|")+")":this.#l=this.#i.map((t=>String(t))).join("")}#p(){if(this!==this.#t)throw new Error("should only call on root");if(this.#o)return this;let t;for(this.toString(),this.#o=!0;t=this.#h.pop();){if("!"!==t.type)continue;let e=t,s=e.#r;for(;s;){for(let i=e.#n+1;!s.type&&i<s.#i.length;i++)for(const e of t.#i){if("string"==typeof e)throw new Error("string part in extglob AST??");e.copyIn(s.#i[i])}e=s,s=e.#r}}return this}push(...t){for(const e of t)if(""!==e){if("string"!=typeof e&&!(e instanceof AST&&e.#r===this))throw new Error("invalid part: "+e);this.#i.push(e)}}toJSON(){const t=null===this.type?this.#i.slice().map((t=>"string"==typeof t?t:t.toJSON())):[this.type,...this.#i.map((t=>t.toJSON()))];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#t||this.#t.#o&&"!"===this.#r?.type)&&t.push({}),t}isStart(){if(this.#t===this)return!0;if(!this.#r?.isStart())return!1;if(0===this.#n)return!0;const t=this.#r;for(let e=0;e<this.#n;e++){const s=t.#i[e];if(!(s instanceof AST&&"!"===s.type))return!1}return!0}isEnd(){if(this.#t===this)return!0;if("!"===this.#r?.type)return!0;if(!this.#r?.isEnd())return!1;if(!this.type)return this.#r?.isEnd();const t=this.#r?this.#r.#i.length:0;return this.#n===t-1}copyIn(t){"string"==typeof t?this.push(t):this.push(t.clone(this))}clone(t){const e=new AST(this.type,t);for(const t of this.#i)e.copyIn(t);return e}static#d(t,e,s,i){let r=!1,n=!1,h=-1,o=!1;if(null===e.type){let a=s,l="";for(;a<t.length;){const s=t.charAt(a++);if(r||"\\"===s)r=!r,l+=s;else if(n)a===h+1?"^"!==s&&"!"!==s||(o=!0):"]"!==s||a===h+2&&o||(n=!1),l+=s;else if("["!==s)if(i.noext||!isExtglobType(s)||"("!==t.charAt(a))l+=s;else{e.push(l),l="";const r=new AST(s,e);a=AST.#d(t,r,a,i),e.push(r)}else n=!0,h=a,o=!1,l+=s}return e.push(l),a}let a=s+1,l=new AST(null,e);const c=[];let p="";for(;a<t.length;){const s=t.charAt(a++);if(r||"\\"===s)r=!r,p+=s;else if(n)a===h+1?"^"!==s&&"!"!==s||(o=!0):"]"!==s||a===h+2&&o||(n=!1),p+=s;else if("["!==s)if(isExtglobType(s)&&"("===t.charAt(a)){l.push(p),p="";const e=new AST(s,l);l.push(e),a=AST.#d(t,e,a,i)}else if("|"!==s){if(")"===s)return""===p&&0===e.#i.length&&(e.#c=!0),l.push(p),p="",e.push(...c,l),a;p+=s}else l.push(p),p="",c.push(l),l=new AST(null,e);else n=!0,h=a,o=!1,p+=s}return e.type=null,e.#e=void 0,e.#i=[t.substring(s-1)],a}static fromGlob(t,e={}){const s=new AST(null,void 0,e);return AST.#d(t,s,0,e),s}toMMPattern(){if(this!==this.#t)return this.#t.toMMPattern();const t=this.toString(),[e,s,i,r]=this.toRegExpSource();if(!(i||this.#e||this.#a.nocase&&!this.#a.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return s;const n=(this.#a.nocase?"i":"")+(r?"u":"");return Object.assign(new RegExp(`^${e}$`,n),{_src:e,_glob:t})}get options(){return this.#a}toRegExpSource(t){const e=t??!!this.#a.dot;if(this.#t===this&&this.#p(),!this.type){const s=this.isStart()&&this.isEnd(),i=this.#i.map((e=>{const[i,r,n,h]="string"==typeof e?AST.#u(e,this.#e,s):e.toRegExpSource(t);return this.#e=this.#e||n,this.#s=this.#s||h,i})).join("");let r="";if(this.isStart()&&"string"==typeof this.#i[0]){if(!(1===this.#i.length&&a.has(this.#i[0]))){const s=o,n=e&&s.has(i.charAt(0))||i.startsWith("\\.")&&s.has(i.charAt(2))||i.startsWith("\\.\\.")&&s.has(i.charAt(4)),a=!e&&!t&&s.has(i.charAt(0));r=n?"(?!(?:^|/)\\.\\.?(?:$|/))":a?h:""}}let n="";this.isEnd()&&this.#t.#o&&"!"===this.#r?.type&&(n="(?:$|\\/)");return[r+i+n,unescape_unescape(i),this.#e=!!this.#e,this.#s]}const s="*"===this.type||"+"===this.type,i="!"===this.type?"(?:(?!(?:":"(?:";let r=this.#f(e);if(this.isStart()&&this.isEnd()&&!r&&"!"!==this.type){const t=this.toString();return this.#i=[t],this.type=null,this.#e=void 0,[t,unescape_unescape(this.toString()),!1,!1]}let n=!s||t||e?"":this.#f(!0);n===r&&(n=""),n&&(r=`(?:${r})(?:${n})*?`);let l="";if("!"===this.type&&this.#c)l=(this.isStart()&&!e?h:"")+d;else{l=i+r+("!"===this.type?"))"+(!this.isStart()||e||t?"":h)+p+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&n?")":"*"===this.type&&n?")?":`)${this.type}`)}return[l,unescape_unescape(r),this.#e=!!this.#e,this.#s]}#f(t){return this.#i.map((e=>{if("string"==typeof e)throw new Error("string type in extglob ast??");const[s,i,r,n]=e.toRegExpSource(t);return this.#s=this.#s||n,s})).filter((t=>!(this.isStart()&&this.isEnd()&&!t))).join("|")}static#u(t,e,s=!1){let i=!1,r="",n=!1;for(let h=0;h<t.length;h++){const o=t.charAt(h);if(i)i=!1,r+=(l.has(o)?"\\":"")+o;else if("\\"!==o){if("["===o){const[s,i,o,a]=parseClass(t,h);if(o){r+=s,n=n||i,h+=o-1,e=e||a;continue}}"*"!==o?"?"!==o?r+=o.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):(r+=c,e=!0):(r+=s&&"*"===t?d:p,e=!0)}else h===t.length-1?r+="\\\\":i=!0}return[r,unescape_unescape(t),!!e,n]}}const escape_escape=(t,{windowsPathsNoEscape:e=!1}={})=>e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&"),minimatch=(t,e,s={})=>(assertValidPattern(e),!(!s.nocomment&&"#"===e.charAt(0))&&new Minimatch(e,s).match(t)),u=/^\*+([^+@!?\*\[\(]*)$/,starDotExtTest=t=>e=>!e.startsWith(".")&&e.endsWith(t),starDotExtTestDot=t=>e=>e.endsWith(t),starDotExtTestNocase=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),starDotExtTestNocaseDot=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),f=/^\*+\.\*+$/,starDotStarTest=t=>!t.startsWith(".")&&t.includes("."),starDotStarTestDot=t=>"."!==t&&".."!==t&&t.includes("."),g=/^\.\*+$/,dotStarTest=t=>"."!==t&&".."!==t&&t.startsWith("."),m=/^\*+$/,starTest=t=>0!==t.length&&!t.startsWith("."),starTestDot=t=>0!==t.length&&"."!==t&&".."!==t,w=/^\?+([^+@!?\*\[\(]*)?$/,qmarksTestNocase=([t,e=""])=>{const s=qmarksTestNoExt([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},qmarksTestNocaseDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);return e?(e=e.toLowerCase(),t=>s(t)&&t.toLowerCase().endsWith(e)):s},qmarksTestDot=([t,e=""])=>{const s=qmarksTestNoExtDot([t]);return e?t=>s(t)&&t.endsWith(e):s},qmarksTest=([t,e=""])=>{const s=qmarksTestNoExt([t]);return e?t=>s(t)&&t.endsWith(e):s},qmarksTestNoExt=([t])=>{const e=t.length;return t=>t.length===e&&!t.startsWith(".")},qmarksTestNoExtDot=([t])=>{const e=t.length;return t=>t.length===e&&"."!==t&&".."!==t},y="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix";minimatch.sep="win32"===y?{sep:"\\"}.sep:{sep:"/"}.sep;const S=Symbol("globstar **");minimatch.GLOBSTAR=S;minimatch.filter=(t,e={})=>s=>minimatch(s,t,e);const ext=(t,e={})=>Object.assign({},t,e);minimatch.defaults=t=>{if(!t||"object"!=typeof t||!Object.keys(t).length)return minimatch;const e=minimatch;return Object.assign(((s,i,r={})=>e(s,i,ext(t,r))),{Minimatch:class Minimatch extends e.Minimatch{constructor(e,s={}){super(e,ext(t,s))}static defaults(s){return e.defaults(ext(t,s)).Minimatch}},AST:class AST extends e.AST{constructor(e,s,i={}){super(e,s,ext(t,i))}static fromGlob(s,i={}){return e.AST.fromGlob(s,ext(t,i))}},unescape:(s,i={})=>e.unescape(s,ext(t,i)),escape:(s,i={})=>e.escape(s,ext(t,i)),filter:(s,i={})=>e.filter(s,ext(t,i)),defaults:s=>e.defaults(ext(t,s)),makeRe:(s,i={})=>e.makeRe(s,ext(t,i)),braceExpand:(s,i={})=>e.braceExpand(s,ext(t,i)),match:(s,i,r={})=>e.match(s,i,ext(t,r)),sep:e.sep,GLOBSTAR:S})};const braceExpand=(t,e={})=>(assertValidPattern(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:(0,i.f)(t));minimatch.braceExpand=braceExpand;minimatch.makeRe=(t,e={})=>new Minimatch(t,e).makeRe();minimatch.match=(t,e,s={})=>{const i=new Minimatch(e,s);return t=t.filter((t=>i.match(t))),i.options.nonull&&!t.length&&t.push(e),t};const b=/[?*]|[+@!]\(.*?\)|\[|\]/;class Minimatch{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(t,e={}){assertValidPattern(t),e=e||{},this.options=e,this.pattern=t,this.platform=e.platform||y,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!e.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!e.nonegate,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==e.windowsNoMagicRoot?e.windowsNoMagicRoot:!(!this.isWindows||!this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(const t of this.set)for(const e of t)if("string"!=typeof e)return!0;return!1}debug(...t){}make(){const t=this.pattern,e=this.options;if(!e.nocomment&&"#"===t.charAt(0))return void(this.comment=!0);if(!t)return void(this.empty=!0);this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],e.debug&&(this.debug=(...t)=>console.error(...t)),this.debug(this.pattern,this.globSet);const s=this.globSet.map((t=>this.slashSplit(t)));this.globParts=this.preprocess(s),this.debug(this.pattern,this.globParts);let i=this.globParts.map(((t,e,s)=>{if(this.isWindows&&this.windowsNoMagicRoot){const e=!(""!==t[0]||""!==t[1]||"?"!==t[2]&&b.test(t[2])||b.test(t[3])),s=/^[a-z]:/i.test(t[0]);if(e)return[...t.slice(0,4),...t.slice(4).map((t=>this.parse(t)))];if(s)return[t[0],...t.slice(1).map((t=>this.parse(t)))]}return t.map((t=>this.parse(t)))}));if(this.debug(this.pattern,i),this.set=i.filter((t=>-1===t.indexOf(!1))),this.isWindows)for(let t=0;t<this.set.length;t++){const e=this.set[t];""===e[0]&&""===e[1]&&"?"===this.globParts[t][2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])&&(e[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let e=0;e<t.length;e++)for(let s=0;s<t[e].length;s++)"**"===t[e][s]&&(t[e][s]="*");const{optimizationLevel:e=1}=this.options;return e>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):t=e>=1?this.levelOneOptimize(t):this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map((t=>{let e=-1;for(;-1!==(e=t.indexOf("**",e+1));){let s=e;for(;"**"===t[s+1];)s++;s!==e&&t.splice(e,s-e)}return t}))}levelOneOptimize(t){return t.map((t=>0===(t=t.reduce(((t,e)=>{const s=t[t.length-1];return"**"===e&&"**"===s?t:".."===e&&s&&".."!==s&&"."!==s&&"**"!==s?(t.pop(),t):(t.push(e),t)}),[])).length?[""]:t))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let e=!1;do{if(e=!1,!this.preserveMultipleSlashes){for(let s=1;s<t.length-1;s++){const i=t[s];1===s&&""===i&&""===t[0]||("."!==i&&""!==i||(e=!0,t.splice(s,1),s--))}"."!==t[0]||2!==t.length||"."!==t[1]&&""!==t[1]||(e=!0,t.pop())}let s=0;for(;-1!==(s=t.indexOf("..",s+1));){const i=t[s-1];i&&"."!==i&&".."!==i&&"**"!==i&&(e=!0,t.splice(s-1,2),s-=2)}}while(e);return 0===t.length?[""]:t}firstPhasePreProcess(t){let e=!1;do{e=!1;for(let s of t){let i=-1;for(;-1!==(i=s.indexOf("**",i+1));){let r=i;for(;"**"===s[r+1];)r++;r>i&&s.splice(i+1,r-i);let n=s[i+1];const h=s[i+2],o=s[i+3];if(".."!==n)continue;if(!h||"."===h||".."===h||!o||"."===o||".."===o)continue;e=!0,s.splice(i,1);const a=s.slice(0);a[i]="**",t.push(a),i--}if(!this.preserveMultipleSlashes){for(let t=1;t<s.length-1;t++){const i=s[t];1===t&&""===i&&""===s[0]||("."!==i&&""!==i||(e=!0,s.splice(t,1),t--))}"."!==s[0]||2!==s.length||"."!==s[1]&&""!==s[1]||(e=!0,s.pop())}let r=0;for(;-1!==(r=s.indexOf("..",r+1));){const t=s[r-1];if(t&&"."!==t&&".."!==t&&"**"!==t){e=!0;const t=1===r&&"**"===s[r+1]?["."]:[];s.splice(r-1,2,...t),0===s.length&&s.push(""),r-=2}}}}while(e);return t}secondPhasePreProcess(t){for(let e=0;e<t.length-1;e++)for(let s=e+1;s<t.length;s++){const i=this.partsMatch(t[e],t[s],!this.preserveMultipleSlashes);if(i){t[e]=[],t[s]=i;break}}return t.filter((t=>t.length))}partsMatch(t,e,s=!1){let i=0,r=0,n=[],h="";for(;i<t.length&&r<e.length;)if(t[i]===e[r])n.push("b"===h?e[r]:t[i]),i++,r++;else if(s&&"**"===t[i]&&e[r]===t[i+1])n.push(t[i]),i++;else if(s&&"**"===e[r]&&t[i]===e[r+1])n.push(e[r]),r++;else if("*"!==t[i]||!e[r]||!this.options.dot&&e[r].startsWith(".")||"**"===e[r]){if("*"!==e[r]||!t[i]||!this.options.dot&&t[i].startsWith(".")||"**"===t[i])return!1;if("a"===h)return!1;h="b",n.push(e[r]),i++,r++}else{if("b"===h)return!1;h="a",n.push(t[i]),i++,r++}return t.length===e.length&&n}parseNegate(){if(this.nonegate)return;const t=this.pattern;let e=!1,s=0;for(let i=0;i<t.length&&"!"===t.charAt(i);i++)e=!e,s++;s&&(this.pattern=t.slice(s)),this.negate=e}matchOne(t,e,s=!1){const i=this.options;if(this.isWindows){const s="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),i=!s&&""===t[0]&&""===t[1]&&"?"===t[2]&&/^[a-z]:$/i.test(t[3]),r="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),n=i?3:s?0:void 0,h=!r&&""===e[0]&&""===e[1]&&"?"===e[2]&&"string"==typeof e[3]&&/^[a-z]:$/i.test(e[3])?3:r?0:void 0;if("number"==typeof n&&"number"==typeof h){const[s,i]=[t[n],e[h]];s.toLowerCase()===i.toLowerCase()&&(e[h]=s,h>n?e=e.slice(h):n>h&&(t=t.slice(n)))}}const{optimizationLevel:r=1}=this.options;r>=2&&(t=this.levelTwoFileOptimize(t)),this.debug("matchOne",this,{file:t,pattern:e}),this.debug("matchOne",t.length,e.length);for(var n=0,h=0,o=t.length,a=e.length;n<o&&h<a;n++,h++){this.debug("matchOne loop");var l=e[h],c=t[n];if(this.debug(e,l,c),!1===l)return!1;if(l===S){this.debug("GLOBSTAR",[e,l,c]);var p=n,d=h+1;if(d===a){for(this.debug("** at the end");n<o;n++)if("."===t[n]||".."===t[n]||!i.dot&&"."===t[n].charAt(0))return!1;return!0}for(;p<o;){var u=t[p];if(this.debug("\nglobstar while",t,p,e,d,u),this.matchOne(t.slice(p),e.slice(d),s))return this.debug("globstar found match!",p,o,u),!0;if("."===u||".."===u||!i.dot&&"."===u.charAt(0)){this.debug("dot detected!",t,p,e,d);break}this.debug("globstar swallow a segment, and continue"),p++}return!(!s||(this.debug("\n>>> no match, partial?",t,p,e,d),p!==o))}let r;if("string"==typeof l?(r=c===l,this.debug("string match",l,c,r)):(r=l.test(c),this.debug("pattern match",l,c,r)),!r)return!1}if(n===o&&h===a)return!0;if(n===o)return s;if(h===a)return n===o-1&&""===t[n];throw new Error("wtf?")}braceExpand(){return braceExpand(this.pattern,this.options)}parse(t){assertValidPattern(t);const e=this.options;if("**"===t)return S;if(""===t)return"";let s,i=null;(s=t.match(m))?i=e.dot?starTestDot:starTest:(s=t.match(u))?i=(e.nocase?e.dot?starDotExtTestNocaseDot:starDotExtTestNocase:e.dot?starDotExtTestDot:starDotExtTest)(s[1]):(s=t.match(w))?i=(e.nocase?e.dot?qmarksTestNocaseDot:qmarksTestNocase:e.dot?qmarksTestDot:qmarksTest)(s):(s=t.match(f))?i=e.dot?starDotStarTestDot:starDotStarTest:(s=t.match(g))&&(i=dotStarTest);const r=AST.fromGlob(t,this.options).toMMPattern();return i&&"object"==typeof r&&Reflect.defineProperty(r,"test",{value:i}),r}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;const t=this.set;if(!t.length)return this.regexp=!1,this.regexp;const e=this.options,s=e.noglobstar?"[^/]*?":e.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(e.nocase?["i"]:[]);let r=t.map((t=>{const e=t.map((t=>{if(t instanceof RegExp)for(const e of t.flags.split(""))i.add(e);return"string"==typeof t?t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):t===S?S:t._src}));return e.forEach(((t,i)=>{const r=e[i+1],n=e[i-1];t===S&&n!==S&&(void 0===n?void 0!==r&&r!==S?e[i+1]="(?:\\/|"+s+"\\/)?"+r:e[i]=s:void 0===r?e[i-1]=n+"(?:\\/|"+s+")?":r!==S&&(e[i-1]=n+"(?:\\/|\\/"+s+"\\/)"+r,e[i+1]=S))})),e.filter((t=>t!==S)).join("/")})).join("|");const[n,h]=t.length>1?["(?:",")"]:["",""];r="^"+n+r+h+"$",this.negate&&(r="^(?!"+r+").+$");try{this.regexp=new RegExp(r,[...i].join(""))}catch(t){this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,e=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return""===t;if("/"===t&&e)return!0;const s=this.options;this.isWindows&&(t=t.split("\\").join("/"));const i=this.slashSplit(t);this.debug(this.pattern,"split",i);const r=this.set;this.debug(this.pattern,"set",r);let n=i[i.length-1];if(!n)for(let t=i.length-2;!n&&t>=0;t--)n=i[t];for(let t=0;t<r.length;t++){const h=r[t];let o=i;s.matchBase&&1===h.length&&(o=[n]);if(this.matchOne(o,h,e))return!!s.flipNegate||!this.negate}return!s.flipNegate&&this.negate}static defaults(t){return minimatch.defaults(t).Minimatch}}minimatch.AST=AST,minimatch.Minimatch=Minimatch,minimatch.escape=escape_escape,minimatch.unescape=unescape_unescape;var v=s(73136);const k="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,x=new Set,C="object"==typeof process&&process?process:{},emitWarning=(t,e,s,i)=>{"function"==typeof C.emitWarning?C.emitWarning(t,e,s,i):console.error(`[${s}] ${e}: ${t}`)};let T=globalThis.AbortController,A=globalThis.AbortSignal;if(void 0===T){A=class AbortSignal{onabort;_onabort=[];reason;aborted=!1;addEventListener(t,e){this._onabort.push(e)}},T=class AbortController{constructor(){warnACPolyfill()}signal=new A;abort(t){if(!this.signal.aborted){this.signal.reason=t,this.signal.aborted=!0;for(const e of this.signal._onabort)e(t);this.signal.onabort?.(t)}}};let t="1"!==C.env?.LRU_CACHE_IGNORE_AC_WARNING;const warnACPolyfill=()=>{t&&(t=!1,emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",warnACPolyfill))}}Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),getUintArray=t=>isPosInt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null:null;class ZeroArray extends Array{constructor(t){super(t),this.fill(0)}}class Stack{heap;length;static#g=!1;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#g=!0;const s=new Stack(t,e);return Stack.#g=!1,s}constructor(t,e){if(!Stack.#g)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#m;#w;#y;#S;#b;#v;#k;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#x;#C;#T;#A;#L;#E;#F;#M;#P;#R;#z;#O;#D;#N;#W;#_;#I;#B;static unsafeExposeInternals(t){return{starts:t.#D,ttls:t.#N,sizes:t.#O,keyMap:t.#T,keyList:t.#A,valList:t.#L,next:t.#E,prev:t.#F,get head(){return t.#M},get tail(){return t.#P},free:t.#R,isBackgroundFetch:e=>t.#G(e),backgroundFetch:(e,s,i,r)=>t.#U(e,s,i,r),moveToTail:e=>t.#j(e),indexes:e=>t.#$(e),rindexes:e=>t.#H(e),isStale:e=>t.#q(e)}}get max(){return this.#m}get maxSize(){return this.#w}get calculatedSize(){return this.#C}get size(){return this.#x}get fetchMethod(){return this.#v}get memoMethod(){return this.#k}get dispose(){return this.#y}get onInsert(){return this.#S}get disposeAfter(){return this.#b}constructor(t){const{max:e=0,ttl:s,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:n,updateAgeOnHas:h,allowStale:o,dispose:a,onInsert:l,disposeAfter:c,noDisposeOnSet:p,noUpdateTTL:d,maxSize:u=0,maxEntrySize:f=0,sizeCalculation:g,fetchMethod:m,memoMethod:w,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:b,allowStaleOnFetchAbort:v,ignoreFetchAbort:k}=t;if(0!==e&&!isPosInt(e))throw new TypeError("max option must be a nonnegative integer");const C=e?getUintArray(e):Array;if(!C)throw new Error("invalid max value: "+e);if(this.#m=e,this.#w=u,this.maxEntrySize=f||this.#w,this.sizeCalculation=g,this.sizeCalculation){if(!this.#w&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==w&&"function"!=typeof w)throw new TypeError("memoMethod must be a function if defined");if(this.#k=w,void 0!==m&&"function"!=typeof m)throw new TypeError("fetchMethod must be a function if specified");if(this.#v=m,this.#_=!!m,this.#T=new Map,this.#A=new Array(e).fill(void 0),this.#L=new Array(e).fill(void 0),this.#E=new C(e),this.#F=new C(e),this.#M=0,this.#P=0,this.#R=Stack.create(e),this.#x=0,this.#C=0,"function"==typeof a&&(this.#y=a),"function"==typeof l&&(this.#S=l),"function"==typeof c?(this.#b=c,this.#z=[]):(this.#b=void 0,this.#z=void 0),this.#W=!!this.#y,this.#B=!!this.#S,this.#I=!!this.#b,this.noDisposeOnSet=!!p,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!b,this.allowStaleOnFetchAbort=!!v,this.ignoreFetchAbort=!!k,0!==this.maxEntrySize){if(0!==this.#w&&!isPosInt(this.#w))throw new TypeError("maxSize must be a positive integer if specified");if(!isPosInt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#Z()}if(this.allowStale=!!o,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!h,this.ttlResolution=isPosInt(i)||0===i?i:1,this.ttlAutopurge=!!r,this.ttl=s||0,this.ttl){if(!isPosInt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#V()}if(0===this.#m&&0===this.ttl&&0===this.#w)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#m&&!this.#w){const t="LRU_CACHE_UNBOUNDED";if((t=>!x.has(t))(t)){x.add(t);emitWarning("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#T.has(t)?1/0:0}#V(){const t=new ZeroArray(this.#m),e=new ZeroArray(this.#m);this.#N=t,this.#D=e,this.#J=(s,i,r=k.now())=>{if(e[s]=0!==i?r:0,t[s]=i,0!==i&&this.ttlAutopurge){const t=setTimeout((()=>{this.#q(s)&&this.#K(this.#A[s],"expire")}),i+1);t.unref&&t.unref()}},this.#X=s=>{e[s]=0!==t[s]?k.now():0},this.#Y=(i,r)=>{if(t[r]){const n=t[r],h=e[r];if(!n||!h)return;i.ttl=n,i.start=h,i.now=s||getNow();const o=i.now-h;i.remainingTTL=n-o}};let s=0;const getNow=()=>{const t=k.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{const r=this.#T.get(i);if(void 0===r)return 0;const n=t[r],h=e[r];if(!n||!h)return 1/0;return n-((s||getNow())-h)},this.#q=i=>{const r=e[i],n=t[i];return!!n&&!!r&&(s||getNow())-r>n}}#X=()=>{};#Y=()=>{};#J=()=>{};#q=()=>!1;#Z(){const t=new ZeroArray(this.#m);this.#C=0,this.#O=t,this.#Q=e=>{this.#C-=t[e],t[e]=0},this.#tt=(t,e,s,i)=>{if(this.#G(e))return 0;if(!isPosInt(s)){if(!i)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof i)throw new TypeError("sizeCalculation must be a function");if(s=i(e,t),!isPosInt(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return s},this.#et=(e,s,i)=>{if(t[e]=s,this.#w){const s=this.#w-t[e];for(;this.#C>s;)this.#st(!0)}this.#C+=t[e],i&&(i.entrySize=s,i.totalCalculatedSize=this.#C)}}#Q=t=>{};#et=(t,e,s)=>{};#tt=(t,e,s,i)=>{if(s||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#$({allowStale:t=this.allowStale}={}){if(this.#x)for(let e=this.#P;this.#it(e)&&(!t&&this.#q(e)||(yield e),e!==this.#M);)e=this.#F[e]}*#H({allowStale:t=this.allowStale}={}){if(this.#x)for(let e=this.#M;this.#it(e)&&(!t&&this.#q(e)||(yield e),e!==this.#P);)e=this.#E[e]}#it(t){return void 0!==t&&this.#T.get(this.#A[t])===t}*entries(){for(const t of this.#$())void 0===this.#L[t]||void 0===this.#A[t]||this.#G(this.#L[t])||(yield[this.#A[t],this.#L[t]])}*rentries(){for(const t of this.#H())void 0===this.#L[t]||void 0===this.#A[t]||this.#G(this.#L[t])||(yield[this.#A[t],this.#L[t]])}*keys(){for(const t of this.#$()){const e=this.#A[t];void 0===e||this.#G(this.#L[t])||(yield e)}}*rkeys(){for(const t of this.#H()){const e=this.#A[t];void 0===e||this.#G(this.#L[t])||(yield e)}}*values(){for(const t of this.#$()){void 0===this.#L[t]||this.#G(this.#L[t])||(yield this.#L[t])}}*rvalues(){for(const t of this.#H()){void 0===this.#L[t]||this.#G(this.#L[t])||(yield this.#L[t])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(const s of this.#$()){const i=this.#L[s],r=this.#G(i)?i.__staleWhileFetching:i;if(void 0!==r&&t(r,this.#A[s],this))return this.get(this.#A[s],e)}}forEach(t,e=this){for(const s of this.#$()){const i=this.#L[s],r=this.#G(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#A[s],this)}}rforEach(t,e=this){for(const s of this.#H()){const i=this.#L[s],r=this.#G(i)?i.__staleWhileFetching:i;void 0!==r&&t.call(e,r,this.#A[s],this)}}purgeStale(){let t=!1;for(const e of this.#H({allowStale:!0}))this.#q(e)&&(this.#K(this.#A[e],"expire"),t=!0);return t}info(t){const e=this.#T.get(t);if(void 0===e)return;const s=this.#L[e],i=this.#G(s)?s.__staleWhileFetching:s;if(void 0===i)return;const r={value:i};if(this.#N&&this.#D){const t=this.#N[e],s=this.#D[e];if(t&&s){const e=t-(k.now()-s);r.ttl=e,r.start=Date.now()}}return this.#O&&(r.size=this.#O[e]),r}dump(){const t=[];for(const e of this.#$({allowStale:!0})){const s=this.#A[e],i=this.#L[e],r=this.#G(i)?i.__staleWhileFetching:i;if(void 0===r||void 0===s)continue;const n={value:r};if(this.#N&&this.#D){n.ttl=this.#N[e];const t=k.now()-this.#D[e];n.start=Math.floor(Date.now()-t)}this.#O&&(n.size=this.#O[e]),t.unshift([s,n])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=k.now()-t}this.set(e,s.value,s)}}set(t,e,s={}){if(void 0===e)return this.delete(t),this;const{ttl:i=this.ttl,start:r,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:o}=s;let{noUpdateTTL:a=this.noUpdateTTL}=s;const l=this.#tt(t,e,s.size||0,h);if(this.maxEntrySize&&l>this.maxEntrySize)return o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this.#K(t,"set"),this;let c=0===this.#x?void 0:this.#T.get(t);if(void 0===c)c=0===this.#x?this.#P:0!==this.#R.length?this.#R.pop():this.#x===this.#m?this.#st(!1):this.#x,this.#A[c]=t,this.#L[c]=e,this.#T.set(t,c),this.#E[this.#P]=c,this.#F[c]=this.#P,this.#P=c,this.#x++,this.#et(c,l,o),o&&(o.set="add"),a=!1,this.#B&&this.#S?.(e,t,"add");else{this.#j(c);const s=this.#L[c];if(e!==s){if(this.#_&&this.#G(s)){s.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:e}=s;void 0===e||n||(this.#W&&this.#y?.(e,t,"set"),this.#I&&this.#z?.push([e,t,"set"]))}else n||(this.#W&&this.#y?.(s,t,"set"),this.#I&&this.#z?.push([s,t,"set"]));if(this.#Q(c),this.#et(c,l,o),this.#L[c]=e,o){o.set="replace";const t=s&&this.#G(s)?s.__staleWhileFetching:s;void 0!==t&&(o.oldValue=t)}}else o&&(o.set="update");this.#B&&this.onInsert?.(e,t,e===s?"update":"replace")}if(0===i||this.#N||this.#V(),this.#N&&(a||this.#J(c,i,r),o&&this.#Y(o,c)),!n&&this.#I&&this.#z){const t=this.#z;let e;for(;e=t?.shift();)this.#b?.(...e)}return this}pop(){try{for(;this.#x;){const t=this.#L[this.#M];if(this.#st(!0),this.#G(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(void 0!==t)return t}}finally{if(this.#I&&this.#z){const t=this.#z;let e;for(;e=t?.shift();)this.#b?.(...e)}}}#st(t){const e=this.#M,s=this.#A[e],i=this.#L[e];return this.#_&&this.#G(i)?i.__abortController.abort(new Error("evicted")):(this.#W||this.#I)&&(this.#W&&this.#y?.(i,s,"evict"),this.#I&&this.#z?.push([i,s,"evict"])),this.#Q(e),t&&(this.#A[e]=void 0,this.#L[e]=void 0,this.#R.push(e)),1===this.#x?(this.#M=this.#P=0,this.#R.length=0):this.#M=this.#E[e],this.#T.delete(s),this.#x--,e}has(t,e={}){const{updateAgeOnHas:s=this.updateAgeOnHas,status:i}=e,r=this.#T.get(t);if(void 0!==r){const t=this.#L[r];if(this.#G(t)&&void 0===t.__staleWhileFetching)return!1;if(!this.#q(r))return s&&this.#X(r),i&&(i.has="hit",this.#Y(i,r)),!0;i&&(i.has="stale",this.#Y(i,r))}else i&&(i.has="miss");return!1}peek(t,e={}){const{allowStale:s=this.allowStale}=e,i=this.#T.get(t);if(void 0===i||!s&&this.#q(i))return;const r=this.#L[i];return this.#G(r)?r.__staleWhileFetching:r}#U(t,e,s,i){const r=void 0===e?void 0:this.#L[e];if(this.#G(r))return r;const n=new T,{signal:h}=s;h?.addEventListener("abort",(()=>n.abort(h.reason)),{signal:n.signal});const o={signal:n.signal,options:s,context:i},cb=(i,r=!1)=>{const{aborted:h}=n.signal,l=s.ignoreFetchAbort&&void 0!==i;if(s.status&&(h&&!r?(s.status.fetchAborted=!0,s.status.fetchError=n.signal.reason,l&&(s.status.fetchAbortIgnored=!0)):s.status.fetchResolved=!0),h&&!l&&!r)return fetchFail(n.signal.reason);const c=a;return this.#L[e]===a&&(void 0===i?c.__staleWhileFetching?this.#L[e]=c.__staleWhileFetching:this.#K(t,"fetch"):(s.status&&(s.status.fetchUpdated=!0),this.set(t,i,o.options))),i},fetchFail=i=>{const{aborted:r}=n.signal,h=r&&s.allowStaleOnFetchAbort,o=h||s.allowStaleOnFetchRejection,l=o||s.noDeleteOnFetchRejection,c=a;if(this.#L[e]===a){!l||void 0===c.__staleWhileFetching?this.#K(t,"fetch"):h||(this.#L[e]=c.__staleWhileFetching)}if(o)return s.status&&void 0!==c.__staleWhileFetching&&(s.status.returnedStale=!0),c.__staleWhileFetching;if(c.__returned===c)throw i};s.status&&(s.status.fetchDispatched=!0);const a=new Promise(((e,i)=>{const h=this.#v?.(t,r,o);h&&h instanceof Promise&&h.then((t=>e(void 0===t?void 0:t)),i),n.signal.addEventListener("abort",(()=>{s.ignoreFetchAbort&&!s.allowStaleOnFetchAbort||(e(void 0),s.allowStaleOnFetchAbort&&(e=t=>cb(t,!0)))}))})).then(cb,(t=>(s.status&&(s.status.fetchRejected=!0,s.status.fetchError=t),fetchFail(t)))),l=Object.assign(a,{__abortController:n,__staleWhileFetching:r,__returned:void 0});return void 0===e?(this.set(t,l,{...o.options,status:void 0}),e=this.#T.get(t)):this.#L[e]=l,l}#G(t){if(!this.#_)return!1;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof T}async fetch(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:o=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:f,forceRefresh:g=!1,status:m,signal:w}=e;if(!this.#_)return m&&(m.fetch="get"),this.get(t,{allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:m});const y={allowStale:s,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:n,noDisposeOnSet:h,size:o,sizeCalculation:a,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,status:m,signal:w};let S=this.#T.get(t);if(void 0===S){m&&(m.fetch="miss");const e=this.#U(t,S,y,f);return e.__returned=e}{const e=this.#L[S];if(this.#G(e)){const t=s&&void 0!==e.__staleWhileFetching;return m&&(m.fetch="inflight",t&&(m.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}const r=this.#q(S);if(!g&&!r)return m&&(m.fetch="hit"),this.#j(S),i&&this.#X(S),m&&this.#Y(m,S),e;const n=this.#U(t,S,y,f),h=void 0!==n.__staleWhileFetching&&s;return m&&(m.fetch=r?"stale":"refresh",h&&r&&(m.returnedStale=!0)),h?n.__staleWhileFetching:n.__returned=n}}async forceFetch(t,e={}){const s=await this.fetch(t,e);if(void 0===s)throw new Error("fetch() returned undefined");return s}memo(t,e={}){const s=this.#k;if(!s)throw new Error("no memoMethod provided to constructor");const{context:i,forceRefresh:r,...n}=e,h=this.get(t,n);if(!r&&void 0!==h)return h;const o=s(t,h,{options:n,context:i});return this.set(t,o,n),o}get(t,e={}){const{allowStale:s=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:n}=e,h=this.#T.get(t);if(void 0!==h){const e=this.#L[h],o=this.#G(e);return n&&this.#Y(n,h),this.#q(h)?(n&&(n.get="stale"),o?(n&&s&&void 0!==e.__staleWhileFetching&&(n.returnedStale=!0),s?e.__staleWhileFetching:void 0):(r||this.#K(t,"expire"),n&&s&&(n.returnedStale=!0),s?e:void 0)):(n&&(n.get="hit"),o?e.__staleWhileFetching:(this.#j(h),i&&this.#X(h),e))}n&&(n.get="miss")}#rt(t,e){this.#F[e]=t,this.#E[t]=e}#j(t){t!==this.#P&&(t===this.#M?this.#M=this.#E[t]:this.#rt(this.#F[t],this.#E[t]),this.#rt(this.#P,t),this.#P=t)}delete(t){return this.#K(t,"delete")}#K(t,e){let s=!1;if(0!==this.#x){const i=this.#T.get(t);if(void 0!==i)if(s=!0,1===this.#x)this.#nt(e);else{this.#Q(i);const s=this.#L[i];if(this.#G(s)?s.__abortController.abort(new Error("deleted")):(this.#W||this.#I)&&(this.#W&&this.#y?.(s,t,e),this.#I&&this.#z?.push([s,t,e])),this.#T.delete(t),this.#A[i]=void 0,this.#L[i]=void 0,i===this.#P)this.#P=this.#F[i];else if(i===this.#M)this.#M=this.#E[i];else{const t=this.#F[i];this.#E[t]=this.#E[i];const e=this.#E[i];this.#F[e]=this.#F[i]}this.#x--,this.#R.push(i)}}if(this.#I&&this.#z?.length){const t=this.#z;let e;for(;e=t?.shift();)this.#b?.(...e)}return s}clear(){return this.#nt("delete")}#nt(t){for(const e of this.#H({allowStale:!0})){const s=this.#L[e];if(this.#G(s))s.__abortController.abort(new Error("deleted"));else{const i=this.#A[e];this.#W&&this.#y?.(s,i,t),this.#I&&this.#z?.push([s,i,t])}}if(this.#T.clear(),this.#L.fill(void 0),this.#A.fill(void 0),this.#N&&this.#D&&(this.#N.fill(0),this.#D.fill(0)),this.#O&&this.#O.fill(0),this.#M=0,this.#P=0,this.#R.length=0,this.#C=0,this.#x=0,this.#I&&this.#z){const t=this.#z;let e;for(;e=t?.shift();)this.#b?.(...e)}}}var L=s(76760),E=s(79896),F=s(73024),M=s.t(F,2),P=s(51455),R=s(28293);const z=E.realpathSync.native,O={lstatSync:E.lstatSync,readdir:E.readdir,readdirSync:E.readdirSync,readlinkSync:E.readlinkSync,realpathSync:z,promises:{lstat:P.lstat,readdir:P.readdir,readlink:P.readlink,realpath:P.realpath}},fsFromOption=t=>t&&t!==O&&t!==M?{...O,...t,promises:{...O.promises,...t.promises||{}}}:O,D=/^\\\\\?\\([a-z]:)\\?$/i,N=/[\\\/]/,W=10,_=15,I=-16,B=128,G=256,U=512,entToType=t=>t.isFile()?8:t.isDirectory()?4:t.isSymbolicLink()?W:t.isCharacterDevice()?2:t.isBlockDevice()?6:t.isSocket()?12:t.isFIFO()?1:0,j=new Map,normalize=t=>{const e=j.get(t);if(e)return e;const s=t.normalize("NFKD");return j.set(t,s),s},$=new Map,normalizeNocase=t=>{const e=$.get(t);if(e)return e;const s=normalize(t.toLowerCase());return $.set(t,s),s};class ResolveCache extends LRUCache{constructor(){super({max:256})}}class ChildrenCache extends LRUCache{constructor(t=16384){super({maxSize:t,sizeCalculation:t=>t.length+1})}}const H=Symbol("PathScurry setAsCwd");class PathBase{name;root;roots;parent;nocase;isCWD=!1;#ht;#ot;get dev(){return this.#ot}#at;get mode(){return this.#at}#lt;get nlink(){return this.#lt}#ct;get uid(){return this.#ct}#pt;get gid(){return this.#pt}#dt;get rdev(){return this.#dt}#ut;get blksize(){return this.#ut}#ft;get ino(){return this.#ft}#x;get size(){return this.#x}#gt;get blocks(){return this.#gt}#mt;get atimeMs(){return this.#mt}#wt;get mtimeMs(){return this.#wt}#yt;get ctimeMs(){return this.#yt}#St;get birthtimeMs(){return this.#St}#bt;get atime(){return this.#bt}#vt;get mtime(){return this.#vt}#kt;get ctime(){return this.#kt}#xt;get birthtime(){return this.#xt}#Ct;#Tt;#At;#Lt;#Et;#Ft;#Mt;#Pt;#Rt;#zt;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(t,e=0,s,i,r,n,h){this.name=t,this.#Ct=r?normalizeNocase(t):normalize(t),this.#Mt=1023&e,this.nocase=r,this.roots=i,this.root=s||this,this.#Pt=n,this.#At=h.fullpath,this.#Et=h.relative,this.#Ft=h.relativePosix,this.parent=h.parent,this.parent?this.#ht=this.parent.#ht:this.#ht=fsFromOption(h.fs)}depth(){return void 0!==this.#Tt?this.#Tt:this.parent?this.#Tt=this.parent.depth()+1:this.#Tt=0}childrenCache(){return this.#Pt}resolve(t){if(!t)return this;const e=this.getRootString(t),s=t.substring(e.length).split(this.splitSep);return e?this.getRoot(e).#Ot(s):this.#Ot(s)}#Ot(t){let e=this;for(const s of t)e=e.child(s);return e}children(){const t=this.#Pt.get(this);if(t)return t;const e=Object.assign([],{provisional:0});return this.#Pt.set(this,e),this.#Mt&=-17,e}child(t,e){if(""===t||"."===t)return this;if(".."===t)return this.parent||this;const s=this.children(),i=this.nocase?normalizeNocase(t):normalize(t);for(const t of s)if(t.#Ct===i)return t;const r=this.parent?this.sep:"",n=this.#At?this.#At+r+t:void 0,h=this.newChild(t,0,{...e,parent:this,fullpath:n});return this.canReaddir()||(h.#Mt|=B),s.push(h),h}relative(){if(this.isCWD)return"";if(void 0!==this.#Et)return this.#Et;const t=this.name,e=this.parent;if(!e)return this.#Et=this.name;const s=e.relative();return s+(s&&e.parent?this.sep:"")+t}relativePosix(){if("/"===this.sep)return this.relative();if(this.isCWD)return"";if(void 0!==this.#Ft)return this.#Ft;const t=this.name,e=this.parent;if(!e)return this.#Ft=this.fullpathPosix();const s=e.relativePosix();return s+(s&&e.parent?"/":"")+t}fullpath(){if(void 0!==this.#At)return this.#At;const t=this.name,e=this.parent;if(!e)return this.#At=this.name;const s=e.fullpath()+(e.parent?this.sep:"")+t;return this.#At=s}fullpathPosix(){if(void 0!==this.#Lt)return this.#Lt;if("/"===this.sep)return this.#Lt=this.fullpath();if(!this.parent){const t=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(t)?this.#Lt=`//?/${t}`:this.#Lt=t}const t=this.parent,e=t.fullpathPosix(),s=e+(e&&t.parent?"/":"")+this.name;return this.#Lt=s}isUnknown(){return!(this.#Mt&_)}isType(t){return this[`is${t}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return 8==(this.#Mt&_)}isDirectory(){return 4==(this.#Mt&_)}isCharacterDevice(){return 2==(this.#Mt&_)}isBlockDevice(){return 6==(this.#Mt&_)}isFIFO(){return 1==(this.#Mt&_)}isSocket(){return 12==(this.#Mt&_)}isSymbolicLink(){return(this.#Mt&W)===W}lstatCached(){return 32&this.#Mt?this:void 0}readlinkCached(){return this.#Rt}realpathCached(){return this.#zt}readdirCached(){const t=this.children();return t.slice(0,t.provisional)}canReadlink(){if(this.#Rt)return!0;if(!this.parent)return!1;const t=this.#Mt&_;return!(0!==t&&t!==W||this.#Mt&G||this.#Mt&B)}calledReaddir(){return!!(16&this.#Mt)}isENOENT(){return!!(this.#Mt&B)}isNamed(t){return this.nocase?this.#Ct===normalizeNocase(t):this.#Ct===normalize(t)}async readlink(){const t=this.#Rt;if(t)return t;if(this.canReadlink()&&this.parent)try{const t=await this.#ht.promises.readlink(this.fullpath()),e=(await this.parent.realpath())?.resolve(t);if(e)return this.#Rt=e}catch(t){return void this.#Dt(t.code)}}readlinkSync(){const t=this.#Rt;if(t)return t;if(this.canReadlink()&&this.parent)try{const t=this.#ht.readlinkSync(this.fullpath()),e=this.parent.realpathSync()?.resolve(t);if(e)return this.#Rt=e}catch(t){return void this.#Dt(t.code)}}#Nt(t){this.#Mt|=16;for(let e=t.provisional;e<t.length;e++){const s=t[e];s&&s.#Wt()}}#Wt(){this.#Mt&B||(this.#Mt=(this.#Mt|B)&I,this.#_t())}#_t(){const t=this.children();t.provisional=0;for(const e of t)e.#Wt()}#It(){this.#Mt|=U,this.#Bt()}#Bt(){if(64&this.#Mt)return;let t=this.#Mt;4==(t&_)&&(t&=I),this.#Mt=64|t,this.#_t()}#Gt(t=""){"ENOTDIR"===t||"EPERM"===t?this.#Bt():"ENOENT"===t?this.#Wt():this.children().provisional=0}#Ut(t=""){if("ENOTDIR"===t){this.parent.#Bt()}else"ENOENT"===t&&this.#Wt()}#Dt(t=""){let e=this.#Mt;e|=G,"ENOENT"===t&&(e|=B),"EINVAL"!==t&&"UNKNOWN"!==t||(e&=I),this.#Mt=e,"ENOTDIR"===t&&this.parent&&this.parent.#Bt()}#jt(t,e){return this.#$t(t,e)||this.#Ht(t,e)}#Ht(t,e){const s=entToType(t),i=this.newChild(t.name,s,{parent:this}),r=i.#Mt&_;return 4!==r&&r!==W&&0!==r&&(i.#Mt|=64),e.unshift(i),e.provisional++,i}#$t(t,e){for(let s=e.provisional;s<e.length;s++){const i=e[s];if((this.nocase?normalizeNocase(t.name):normalize(t.name))===i.#Ct)return this.#qt(t,i,s,e)}}#qt(t,e,s,i){const r=e.name;return e.#Mt=e.#Mt&I|entToType(t),r!==t.name&&(e.name=t.name),s!==i.provisional&&(s===i.length-1?i.pop():i.splice(s,1),i.unshift(e)),i.provisional++,e}async lstat(){if(!(this.#Mt&B))try{return this.#Zt(await this.#ht.promises.lstat(this.fullpath())),this}catch(t){this.#Ut(t.code)}}lstatSync(){if(!(this.#Mt&B))try{return this.#Zt(this.#ht.lstatSync(this.fullpath())),this}catch(t){this.#Ut(t.code)}}#Zt(t){const{atime:e,atimeMs:s,birthtime:i,birthtimeMs:r,blksize:n,blocks:h,ctime:o,ctimeMs:a,dev:l,gid:c,ino:p,mode:d,mtime:u,mtimeMs:f,nlink:g,rdev:m,size:w,uid:y}=t;this.#bt=e,this.#mt=s,this.#xt=i,this.#St=r,this.#ut=n,this.#gt=h,this.#kt=o,this.#yt=a,this.#ot=l,this.#pt=c,this.#ft=p,this.#at=d,this.#vt=u,this.#wt=f,this.#lt=g,this.#dt=m,this.#x=w,this.#ct=y;const S=entToType(t);this.#Mt=this.#Mt&I|S|32,0!==S&&4!==S&&S!==W&&(this.#Mt|=64)}#Vt=[];#Jt=!1;#Kt(t){this.#Jt=!1;const e=this.#Vt.slice();this.#Vt.length=0,e.forEach((e=>e(null,t)))}readdirCB(t,e=!1){if(!this.canReaddir())return void(e?t(null,[]):queueMicrotask((()=>t(null,[]))));const s=this.children();if(this.calledReaddir()){const i=s.slice(0,s.provisional);return void(e?t(null,i):queueMicrotask((()=>t(null,i))))}if(this.#Vt.push(t),this.#Jt)return;this.#Jt=!0;const i=this.fullpath();this.#ht.readdir(i,{withFileTypes:!0},((t,e)=>{if(t)this.#Gt(t.code),s.provisional=0;else{for(const t of e)this.#jt(t,s);this.#Nt(s)}this.#Kt(s.slice(0,s.provisional))}))}#Xt;async readdir(){if(!this.canReaddir())return[];const t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);const e=this.fullpath();if(this.#Xt)await this.#Xt;else{let resolve=()=>{};this.#Xt=new Promise((t=>resolve=t));try{for(const s of await this.#ht.promises.readdir(e,{withFileTypes:!0}))this.#jt(s,t);this.#Nt(t)}catch(e){this.#Gt(e.code),t.provisional=0}this.#Xt=void 0,resolve()}return t.slice(0,t.provisional)}readdirSync(){if(!this.canReaddir())return[];const t=this.children();if(this.calledReaddir())return t.slice(0,t.provisional);const e=this.fullpath();try{for(const s of this.#ht.readdirSync(e,{withFileTypes:!0}))this.#jt(s,t);this.#Nt(t)}catch(e){this.#Gt(e.code),t.provisional=0}return t.slice(0,t.provisional)}canReaddir(){if(704&this.#Mt)return!1;const t=_&this.#Mt;return 0===t||4===t||t===W}shouldWalk(t,e){return!(4&~this.#Mt)&&!(704&this.#Mt)&&!t.has(this)&&(!e||e(this))}async realpath(){if(this.#zt)return this.#zt;if(!(896&this.#Mt))try{const t=await this.#ht.promises.realpath(this.fullpath());return this.#zt=this.resolve(t)}catch(t){this.#It()}}realpathSync(){if(this.#zt)return this.#zt;if(!(896&this.#Mt))try{const t=this.#ht.realpathSync(this.fullpath());return this.#zt=this.resolve(t)}catch(t){this.#It()}}[H](t){if(t===this)return;t.isCWD=!1,this.isCWD=!0;const e=new Set([]);let s=[],i=this;for(;i&&i.parent;)e.add(i),i.#Et=s.join(this.sep),i.#Ft=s.join("/"),i=i.parent,s.push("..");for(i=t;i&&i.parent&&!e.has(i);)i.#Et=void 0,i.#Ft=void 0,i=i.parent}}class PathWin32 extends PathBase{sep="\\";splitSep=N;constructor(t,e=0,s,i,r,n,h){super(t,e,s,i,r,n,h)}newChild(t,e=0,s={}){return new PathWin32(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}getRootString(t){return L.win32.parse(t).root}getRoot(t){if((t=(t=>t.replace(/\//g,"\\").replace(D,"$1\\"))(t.toUpperCase()))===this.root.name)return this.root;for(const[e,s]of Object.entries(this.roots))if(this.sameRoot(t,e))return this.roots[t]=s;return this.roots[t]=new PathScurryWin32(t,this).root}sameRoot(t,e=this.root.name){return(t=t.toUpperCase().replace(/\//g,"\\").replace(D,"$1\\"))===e}}class PathPosix extends PathBase{splitSep="/";sep="/";constructor(t,e=0,s,i,r,n,h){super(t,e,s,i,r,n,h)}getRootString(t){return t.startsWith("/")?"/":""}getRoot(t){return this.root}newChild(t,e=0,s={}){return new PathPosix(t,e,this.root,this.roots,this.nocase,this.childrenCache(),s)}}class PathScurryBase{root;rootPath;roots;cwd;#Yt;#Qt;#Pt;nocase;#ht;constructor(t=process.cwd(),e,s,{nocase:i,childrenCacheSize:r=16384,fs:n=O}={}){this.#ht=fsFromOption(n),(t instanceof URL||t.startsWith("file://"))&&(t=(0,v.fileURLToPath)(t));const h=e.resolve(t);this.roots=Object.create(null),this.rootPath=this.parseRootPath(h),this.#Yt=new ResolveCache,this.#Qt=new ResolveCache,this.#Pt=new ChildrenCache(r);const o=h.substring(this.rootPath.length).split(s);if(1!==o.length||o[0]||o.pop(),void 0===i)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#ht),this.roots[this.rootPath]=this.root;let a=this.root,l=o.length-1;const c=e.sep;let p=this.rootPath,d=!1;for(const t of o){const e=l--;a=a.child(t,{relative:new Array(e).fill("..").join(c),relativePosix:new Array(e).fill("..").join("/"),fullpath:p+=(d?"":c)+t}),d=!0}this.cwd=a}depth(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.depth()}childrenCache(){return this.#Pt}resolve(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(i&&"."!==i&&(e=e?`${i}/${e}`:i,this.isAbsolute(i)))break}const s=this.#Yt.get(e);if(void 0!==s)return s;const i=this.cwd.resolve(e).fullpath();return this.#Yt.set(e,i),i}resolvePosix(...t){let e="";for(let s=t.length-1;s>=0;s--){const i=t[s];if(i&&"."!==i&&(e=e?`${i}/${e}`:i,this.isAbsolute(i)))break}const s=this.#Qt.get(e);if(void 0!==s)return s;const i=this.cwd.resolve(e).fullpathPosix();return this.#Qt.set(e,i),i}relative(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relative()}relativePosix(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.relativePosix()}basename(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.name}dirname(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),(t.parent||t).fullpath()}async readdir(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s}=e;if(t.canReaddir()){const e=await t.readdir();return s?e:e.map((t=>t.name))}return[]}readdirSync(t=this.cwd,e={withFileTypes:!0}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0}=e;return t.canReaddir()?s?t.readdirSync():t.readdirSync().map((t=>t.name)):[]}async lstat(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstat()}lstatSync(t=this.cwd){return"string"==typeof t&&(t=this.cwd.resolve(t)),t.lstatSync()}async readlink(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t.withFileTypes,t=this.cwd);const s=await t.readlink();return e?s:s?.fullpath()}readlinkSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t.withFileTypes,t=this.cwd);const s=t.readlinkSync();return e?s:s?.fullpath()}async realpath(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t.withFileTypes,t=this.cwd);const s=await t.realpath();return e?s:s?.fullpath()}realpathSync(t=this.cwd,{withFileTypes:e}={withFileTypes:!1}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t.withFileTypes,t=this.cwd);const s=t.realpathSync();return e?s:s?.fullpath()}async walk(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,h=[];r&&!r(t)||h.push(s?t:t.fullpath());const o=new Set,walk=(t,e)=>{o.add(t),t.readdirCB(((t,a)=>{if(t)return e(t);let l=a.length;if(!l)return e();const next=()=>{0==--l&&e()};for(const t of a)r&&!r(t)||h.push(s?t:t.fullpath()),i&&t.isSymbolicLink()?t.realpath().then((t=>t?.isUnknown()?t.lstat():t)).then((t=>t?.shouldWalk(o,n)?walk(t,next):next())):t.shouldWalk(o,n)?walk(t,next):next()}),!0)},a=t;return new Promise(((t,e)=>{walk(a,(s=>{if(s)return e(s);t(h)}))}))}walkSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,h=[];r&&!r(t)||h.push(s?t:t.fullpath());const o=new Set([t]);for(const t of o){const e=t.readdirSync();for(const t of e){r&&!r(t)||h.push(s?t:t.fullpath());let e=t;if(t.isSymbolicLink()){if(!i||!(e=t.realpathSync()))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(o,n)&&o.add(e)}}return h}[Symbol.asyncIterator](){return this.iterate()}iterate(t=this.cwd,e={}){return"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd),this.stream(t,e)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e;r&&!r(t)||(yield s?t:t.fullpath());const h=new Set([t]);for(const t of h){const e=t.readdirSync();for(const t of e){r&&!r(t)||(yield s?t:t.fullpath());let e=t;if(t.isSymbolicLink()){if(!i||!(e=t.realpathSync()))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(h,n)&&h.add(e)}}}stream(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,h=new R.n_({objectMode:!0});r&&!r(t)||h.write(s?t:t.fullpath());const o=new Set,a=[t];let l=0;const process=()=>{let t=!1;for(;!t;){const e=a.shift();if(!e)return void(0===l&&h.end());l++,o.add(e);const onReaddir=(e,p,d=!1)=>{if(e)return h.emit("error",e);if(i&&!d){const t=[];for(const e of p)e.isSymbolicLink()&&t.push(e.realpath().then((t=>t?.isUnknown()?t.lstat():t)));if(t.length)return void Promise.all(t).then((()=>onReaddir(null,p,!0)))}for(const e of p)!e||r&&!r(e)||h.write(s?e:e.fullpath())||(t=!0);l--;for(const t of p){const e=t.realpathCached()||t;e.shouldWalk(o,n)&&a.push(e)}t&&!h.flowing?h.once("drain",process):c||process()};let c=!0;e.readdirCB(onReaddir,!0),c=!1}};return process(),h}streamSync(t=this.cwd,e={}){"string"==typeof t?t=this.cwd.resolve(t):t instanceof PathBase||(e=t,t=this.cwd);const{withFileTypes:s=!0,follow:i=!1,filter:r,walkFilter:n}=e,h=new R.n_({objectMode:!0}),o=new Set;r&&!r(t)||h.write(s?t:t.fullpath());const a=[t];let l=0;const process=()=>{let t=!1;for(;!t;){const e=a.shift();if(!e)return void(0===l&&h.end());l++,o.add(e);const c=e.readdirSync();for(const e of c)r&&!r(e)||h.write(s?e:e.fullpath())||(t=!0);l--;for(const t of c){let e=t;if(t.isSymbolicLink()){if(!i||!(e=t.realpathSync()))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(o,n)&&a.push(e)}}t&&!h.flowing&&h.once("drain",process)};return process(),h}chdir(t=this.cwd){const e=this.cwd;this.cwd="string"==typeof t?this.cwd.resolve(t):t,this.cwd[H](e)}}class PathScurryWin32 extends PathScurryBase{sep="\\";constructor(t=process.cwd(),e={}){const{nocase:s=!0}=e;super(t,L.win32,"\\",{...e,nocase:s}),this.nocase=s;for(let t=this.cwd;t;t=t.parent)t.nocase=this.nocase}parseRootPath(t){return L.win32.parse(t).root.toUpperCase()}newRoot(t){return new PathWin32(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")||t.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(t)}}class PathScurryPosix extends PathScurryBase{sep="/";constructor(t=process.cwd(),e={}){const{nocase:s=!1}=e;super(t,L.posix,"/",{...e,nocase:s}),this.nocase=s}parseRootPath(t){return"/"}newRoot(t){return new PathPosix(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:t})}isAbsolute(t){return t.startsWith("/")}}class PathScurryDarwin extends PathScurryPosix{constructor(t=process.cwd(),e={}){const{nocase:s=!0}=e;super(t,{...e,nocase:s})}}process.platform;const q="win32"===process.platform?PathScurryWin32:"darwin"===process.platform?PathScurryDarwin:PathScurryPosix;class Pattern{#te;#ee;#se;length;#ie;#re;#ne;#he;#oe;#ae;#le=!0;constructor(t,e,s,i){if(!(t.length>=1))throw new TypeError("empty pattern list");if(!(e.length>=1))throw new TypeError("empty glob list");if(e.length!==t.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=t.length,s<0||s>=this.length)throw new TypeError("index out of range");if(this.#te=t,this.#ee=e,this.#se=s,this.#ie=i,0===this.#se)if(this.isUNC()){const[t,e,s,i,...r]=this.#te,[n,h,o,a,...l]=this.#ee;""===r[0]&&(r.shift(),l.shift());const c=[t,e,s,i,""].join("/"),p=[n,h,o,a,""].join("/");this.#te=[c,...r],this.#ee=[p,...l],this.length=this.#te.length}else if(this.isDrive()||this.isAbsolute()){const[t,...e]=this.#te,[s,...i]=this.#ee;""===e[0]&&(e.shift(),i.shift());const r=t+"/",n=s+"/";this.#te=[r,...e],this.#ee=[n,...i],this.length=this.#te.length}}pattern(){return this.#te[this.#se]}isString(){return"string"==typeof this.#te[this.#se]}isGlobstar(){return this.#te[this.#se]===S}isRegExp(){return this.#te[this.#se]instanceof RegExp}globString(){return this.#ne=this.#ne||(0===this.#se?this.isAbsolute()?this.#ee[0]+this.#ee.slice(1).join("/"):this.#ee.join("/"):this.#ee.slice(this.#se).join("/"))}hasMore(){return this.length>this.#se+1}rest(){return void 0!==this.#re?this.#re:this.hasMore()?(this.#re=new Pattern(this.#te,this.#ee,this.#se+1,this.#ie),this.#re.#ae=this.#ae,this.#re.#oe=this.#oe,this.#re.#he=this.#he,this.#re):this.#re=null}isUNC(){const t=this.#te;return void 0!==this.#oe?this.#oe:this.#oe="win32"===this.#ie&&0===this.#se&&""===t[0]&&""===t[1]&&"string"==typeof t[2]&&!!t[2]&&"string"==typeof t[3]&&!!t[3]}isDrive(){const t=this.#te;return void 0!==this.#he?this.#he:this.#he="win32"===this.#ie&&0===this.#se&&this.length>1&&"string"==typeof t[0]&&/^[a-z]:$/i.test(t[0])}isAbsolute(){const t=this.#te;return void 0!==this.#ae?this.#ae:this.#ae=""===t[0]&&t.length>1||this.isDrive()||this.isUNC()}root(){const t=this.#te[0];return"string"==typeof t&&this.isAbsolute()&&0===this.#se?t:""}checkFollowGlobstar(){return!(0===this.#se||!this.isGlobstar()||!this.#le)}markFollowGlobstar(){return!(0===this.#se||!this.isGlobstar()||!this.#le)&&(this.#le=!1,!0)}}const Z="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class Ignore{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(t,{nobrace:e,nocase:s,noext:i,noglobstar:r,platform:n=Z}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=n,this.mmopts={dot:!0,nobrace:e,nocase:s,noext:i,noglobstar:r,optimizationLevel:2,platform:n,nocomment:!0,nonegate:!0};for(const e of t)this.add(e)}add(t){const e=new Minimatch(t,this.mmopts);for(let t=0;t<e.set.length;t++){const s=e.set[t],i=e.globParts[t];if(!s||!i)throw new Error("invalid pattern object");for(;"."===s[0]&&"."===i[0];)s.shift(),i.shift();const r=new Pattern(s,i,0,this.platform),n=new Minimatch(r.globString(),this.mmopts),h="**"===i[i.length-1],o=r.isAbsolute();o?this.absolute.push(n):this.relative.push(n),h&&(o?this.absoluteChildren.push(n):this.relativeChildren.push(n))}}ignored(t){const e=t.fullpath(),s=`${e}/`,i=t.relative()||".",r=`${i}/`;for(const t of this.relative)if(t.match(i)||t.match(r))return!0;for(const t of this.absolute)if(t.match(e)||t.match(s))return!0;return!1}childrenIgnored(t){const e=t.fullpath()+"/",s=(t.relative()||".")+"/";for(const t of this.relativeChildren)if(t.match(s))return!0;for(const t of this.absoluteChildren)if(t.match(e))return!0;return!1}}class HasWalkedCache{store;constructor(t=new Map){this.store=t}copy(){return new HasWalkedCache(new Map(this.store))}hasWalked(t,e){return this.store.get(t.fullpath())?.has(e.globString())}storeWalked(t,e){const s=t.fullpath(),i=this.store.get(s);i?i.add(e.globString()):this.store.set(s,new Set([e.globString()]))}}class MatchRecord{store=new Map;add(t,e,s){const i=(e?2:0)|(s?1:0),r=this.store.get(t);this.store.set(t,void 0===r?i:i&r)}entries(){return[...this.store.entries()].map((([t,e])=>[t,!!(2&e),!!(1&e)]))}}class SubWalks{store=new Map;add(t,e){if(!t.canReaddir())return;const s=this.store.get(t);s?s.find((t=>t.globString()===e.globString()))||s.push(e):this.store.set(t,[e])}get(t){const e=this.store.get(t);if(!e)throw new Error("attempting to walk unknown path");return e}entries(){return this.keys().map((t=>[t,this.store.get(t)]))}keys(){return[...this.store.keys()].filter((t=>t.canReaddir()))}}class Processor{hasWalkedCache;matches=new MatchRecord;subwalks=new SubWalks;patterns;follow;dot;opts;constructor(t,e){this.opts=t,this.follow=!!t.follow,this.dot=!!t.dot,this.hasWalkedCache=e?e.copy():new HasWalkedCache}processPatterns(t,e){this.patterns=e;const s=e.map((e=>[t,e]));for(let[t,e]of s){this.hasWalkedCache.storeWalked(t,e);const s=e.root(),i=e.isAbsolute()&&!1!==this.opts.absolute;if(s){t=t.resolve("/"===s&&void 0!==this.opts.root?this.opts.root:s);const i=e.rest();if(!i){this.matches.add(t,!0,!1);continue}e=i}if(t.isENOENT())continue;let r,n,h=!1;for(;"string"==typeof(r=e.pattern())&&(n=e.rest());){const s=t.resolve(r);t=s,e=n,h=!0}if(r=e.pattern(),n=e.rest(),h){if(this.hasWalkedCache.hasWalked(t,e))continue;this.hasWalkedCache.storeWalked(t,e)}if("string"!=typeof r)if(r===S){(!t.isSymbolicLink()||this.follow||e.checkFollowGlobstar())&&this.subwalks.add(t,e);const s=n?.pattern(),r=n?.rest();if(n&&(""!==s&&"."!==s||r)){if(".."===s){const e=t.parent||t;r?this.hasWalkedCache.hasWalked(e,r)||this.subwalks.add(e,r):this.matches.add(e,i,!0)}}else this.matches.add(t,i,""===s||"."===s)}else r instanceof RegExp&&this.subwalks.add(t,e);else{const e=".."===r||""===r||"."===r;this.matches.add(t.resolve(r),i,e)}}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new Processor(this.opts,this.hasWalkedCache)}filterEntries(t,e){const s=this.subwalks.get(t),i=this.child();for(const t of e)for(const e of s){const s=e.isAbsolute(),r=e.pattern(),n=e.rest();r===S?i.testGlobstar(t,e,n,s):r instanceof RegExp?i.testRegExp(t,r,n,s):i.testString(t,r,n,s)}return i}testGlobstar(t,e,s,i){if(!this.dot&&t.name.startsWith(".")||(e.hasMore()||this.matches.add(t,i,!1),t.canReaddir()&&(this.follow||!t.isSymbolicLink()?this.subwalks.add(t,e):t.isSymbolicLink()&&(s&&e.checkFollowGlobstar()?this.subwalks.add(t,s):e.markFollowGlobstar()&&this.subwalks.add(t,e)))),s){const e=s.pattern();if("string"==typeof e&&".."!==e&&""!==e&&"."!==e)this.testString(t,e,s.rest(),i);else if(".."===e){const e=t.parent||t;this.subwalks.add(e,s)}else e instanceof RegExp&&this.testRegExp(t,e,s.rest(),i)}}testRegExp(t,e,s,i){e.test(t.name)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}testString(t,e,s,i){t.isNamed(e)&&(s?this.subwalks.add(t,s):this.matches.add(t,i,!1))}}class GlobUtil{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#ce=[];#pe;#de;signal;maxDepth;includeChildMatches;constructor(t,e,s){if(this.patterns=t,this.path=e,this.opts=s,this.#de=s.posix||"win32"!==s.platform?"/":"\\",this.includeChildMatches=!1!==s.includeChildMatches,(s.ignore||!this.includeChildMatches)&&(this.#pe=((t,e)=>"string"==typeof t?new Ignore([t],e):Array.isArray(t)?new Ignore(t,e):t)(s.ignore??[],s),!this.includeChildMatches&&"function"!=typeof this.#pe.add)){throw new Error("cannot ignore child matches, ignore lacks add() method.")}this.maxDepth=s.maxDepth||1/0,s.signal&&(this.signal=s.signal,this.signal.addEventListener("abort",(()=>{this.#ce.length=0})))}#ue(t){return this.seen.has(t)||!!this.#pe?.ignored?.(t)}#fe(t){return!!this.#pe?.childrenIgnored?.(t)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;let t;for(this.paused=!1;!this.paused&&(t=this.#ce.shift());)t()}onResume(t){this.signal?.aborted||(this.paused?this.#ce.push(t):t())}async matchCheck(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||await t.realpath(),!s)return;t=s}const i=t.isUnknown()||this.opts.stat?await t.lstat():t;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){const t=await i.realpath();t&&(t.isUnknown()||this.opts.stat)&&await t.lstat()}return this.matchCheckTest(i,e)}matchCheckTest(t,e){return!t||!(this.maxDepth===1/0||t.depth()<=this.maxDepth)||e&&!t.canReaddir()||this.opts.nodir&&t.isDirectory()||this.opts.nodir&&this.opts.follow&&t.isSymbolicLink()&&t.realpathCached()?.isDirectory()||this.#ue(t)?void 0:t}matchCheckSync(t,e){if(e&&this.opts.nodir)return;let s;if(this.opts.realpath){if(s=t.realpathCached()||t.realpathSync(),!s)return;t=s}const i=t.isUnknown()||this.opts.stat?t.lstatSync():t;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){const t=i.realpathSync();t&&(t?.isUnknown()||this.opts.stat)&&t.lstatSync()}return this.matchCheckTest(i,e)}matchFinish(t,e){if(this.#ue(t))return;if(!this.includeChildMatches&&this.#pe?.add){const e=`${t.relativePosix()}/**`;this.#pe.add(e)}const s=void 0===this.opts.absolute?e:this.opts.absolute;this.seen.add(t);const i=this.opts.mark&&t.isDirectory()?this.#de:"";if(this.opts.withFileTypes)this.matchEmit(t);else if(s){const e=this.opts.posix?t.fullpathPosix():t.fullpath();this.matchEmit(e+i)}else{const e=this.opts.posix?t.relativePosix():t.relative(),s=this.opts.dotRelative&&!e.startsWith(".."+this.#de)?"."+this.#de:"";this.matchEmit(e?s+e+i:"."+i)}}async match(t,e,s){const i=await this.matchCheck(t,s);i&&this.matchFinish(i,e)}matchSync(t,e,s){const i=this.matchCheckSync(t,s);i&&this.matchFinish(i,e)}walkCB(t,e,s){this.signal?.aborted&&s(),this.walkCB2(t,e,new Processor(this.opts),s)}walkCB2(t,e,s,i){if(this.#fe(t))return i();if(this.signal?.aborted&&i(),this.paused)return void this.onResume((()=>this.walkCB2(t,e,s,i)));s.processPatterns(t,e);let r=1;const next=()=>{0==--r&&i()};for(const[t,e,i]of s.matches.entries())this.#ue(t)||(r++,this.match(t,e,i).then((()=>next())));for(const t of s.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;const e=t.readdirCached();t.calledReaddir()?this.walkCB3(t,e,s,next):t.readdirCB(((e,i)=>this.walkCB3(t,i,s,next)),!0)}next()}walkCB3(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{0==--r&&i()};for(const[t,e,i]of s.matches.entries())this.#ue(t)||(r++,this.match(t,e,i).then((()=>next())));for(const[t,e]of s.subwalks.entries())r++,this.walkCB2(t,e,s.child(),next);next()}walkCBSync(t,e,s){this.signal?.aborted&&s(),this.walkCB2Sync(t,e,new Processor(this.opts),s)}walkCB2Sync(t,e,s,i){if(this.#fe(t))return i();if(this.signal?.aborted&&i(),this.paused)return void this.onResume((()=>this.walkCB2Sync(t,e,s,i)));s.processPatterns(t,e);let r=1;const next=()=>{0==--r&&i()};for(const[t,e,i]of s.matches.entries())this.#ue(t)||this.matchSync(t,e,i);for(const t of s.subwalkTargets()){if(this.maxDepth!==1/0&&t.depth()>=this.maxDepth)continue;r++;const e=t.readdirSync();this.walkCB3Sync(t,e,s,next)}next()}walkCB3Sync(t,e,s,i){s=s.filterEntries(t,e);let r=1;const next=()=>{0==--r&&i()};for(const[t,e,i]of s.matches.entries())this.#ue(t)||this.matchSync(t,e,i);for(const[t,e]of s.subwalks.entries())r++,this.walkCB2Sync(t,e,s.child(),next);next()}}class GlobWalker extends GlobUtil{matches=new Set;constructor(t,e,s){super(t,e,s)}matchEmit(t){this.matches.add(t)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise(((t,e)=>{this.walkCB(this.path,this.patterns,(()=>{this.signal?.aborted?e(this.signal.reason):t(this.matches)}))})),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,(()=>{if(this.signal?.aborted)throw this.signal.reason})),this.matches}}class GlobStream extends GlobUtil{results;constructor(t,e,s){super(t,e,s),this.results=new R.n_({signal:this.signal,objectMode:!0}),this.results.on("drain",(()=>this.resume())),this.results.on("resume",(()=>this.resume()))}matchEmit(t){this.results.write(t),this.results.flowing||this.pause()}stream(){const t=this.path;return t.isUnknown()?t.lstat().then((()=>{this.walkCB(t,this.patterns,(()=>this.results.end()))})):this.walkCB(t,this.patterns,(()=>this.results.end())),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,(()=>this.results.end())),this.results}}const V="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class Glob{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(t,e){if(!e)throw new TypeError("glob options required");if(this.withFileTypes=!!e.withFileTypes,this.signal=e.signal,this.follow=!!e.follow,this.dot=!!e.dot,this.dotRelative=!!e.dotRelative,this.nodir=!!e.nodir,this.mark=!!e.mark,e.cwd?(e.cwd instanceof URL||e.cwd.startsWith("file://"))&&(e.cwd=(0,v.fileURLToPath)(e.cwd)):this.cwd="",this.cwd=e.cwd||"",this.root=e.root,this.magicalBraces=!!e.magicalBraces,this.nobrace=!!e.nobrace,this.noext=!!e.noext,this.realpath=!!e.realpath,this.absolute=e.absolute,this.includeChildMatches=!1!==e.includeChildMatches,this.noglobstar=!!e.noglobstar,this.matchBase=!!e.matchBase,this.maxDepth="number"==typeof e.maxDepth?e.maxDepth:1/0,this.stat=!!e.stat,this.ignore=e.ignore,this.withFileTypes&&void 0!==this.absolute)throw new Error("cannot set absolute and withFileTypes:true");if("string"==typeof t&&(t=[t]),this.windowsPathsNoEscape=!!e.windowsPathsNoEscape||!1===e.allowWindowsEscape,this.windowsPathsNoEscape&&(t=t.map((t=>t.replace(/\\/g,"/")))),this.matchBase){if(e.noglobstar)throw new TypeError("base matching requires globstar");t=t.map((t=>t.includes("/")?t:`./**/${t}`))}if(this.pattern=t,this.platform=e.platform||V,this.opts={...e,platform:this.platform},e.scurry){if(this.scurry=e.scurry,void 0!==e.nocase&&e.nocase!==e.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{const t="win32"===e.platform?PathScurryWin32:"darwin"===e.platform?PathScurryDarwin:e.platform?PathScurryPosix:q;this.scurry=new t(this.cwd,{nocase:e.nocase,fs:e.fs})}this.nocase=this.scurry.nocase;const s="darwin"===this.platform||"win32"===this.platform,i={...e,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},r=this.pattern.map((t=>new Minimatch(t,i))),[n,h]=r.reduce(((t,e)=>(t[0].push(...e.set),t[1].push(...e.globParts),t)),[[],[]]);this.patterns=n.map(((t,e)=>{const s=h[e];if(!s)throw new Error("invalid pattern object");return new Pattern(t,s,0,this.platform)}))}async walk(){return[...await new GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}const hasMagic=(t,e={})=>{Array.isArray(t)||(t=[t]);for(const s of t)if(new Minimatch(s,e).hasMagic())return!0;return!1};function globStreamSync(t,e={}){return new Glob(t,e).streamSync()}function globStream(t,e={}){return new Glob(t,e).stream()}function globSync(t,e={}){return new Glob(t,e).walkSync()}async function glob_(t,e={}){return new Glob(t,e).walk()}function globIterateSync(t,e={}){return new Glob(t,e).iterateSync()}function globIterate(t,e={}){return new Glob(t,e).iterate()}const J=globStreamSync,K=Object.assign(globStream,{sync:globStreamSync}),X=globIterateSync,Y=Object.assign(globIterate,{sync:globIterateSync}),Q=Object.assign(globSync,{stream:globStreamSync,iterate:globIterateSync}),tt=Object.assign(glob_,{glob:glob_,globSync,sync:Q,globStream,stream:K,globStreamSync,streamSync:J,globIterate,iterate:Y,globIterateSync,iterateSync:X,Glob,hasMagic,escape:escape_escape,unescape:unescape_unescape});tt.glob=tt}};