nitro-nightly 3.0.1-20260119-145349-d0c4950f → 3.0.1-20260120-020848-6786d069

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/_build/rolldown.mjs +13 -8
  2. package/dist/_build/vite.build.mjs +1 -1
  3. package/dist/_chunks/dev.mjs +5 -3
  4. package/dist/_chunks/nitro.mjs +24 -1183
  5. package/dist/_chunks/nitro2.mjs +248 -91
  6. package/dist/_chunks/nitro3.mjs +2696 -0
  7. package/dist/_chunks/nitro4.mjs +176 -0
  8. package/dist/_chunks/nitro5.mjs +733 -0
  9. package/dist/_chunks/nitro6.mjs +1458 -0
  10. package/dist/_chunks/nitro7.mjs +7561 -0
  11. package/dist/_chunks/nitro8.mjs +3524 -0
  12. package/dist/_chunks/nitro9.mjs +1729 -0
  13. package/dist/_libs/_.mjs +3 -0
  14. package/dist/_libs/_2.mjs +3 -0
  15. package/dist/_libs/_3.mjs +4 -0
  16. package/dist/_libs/_4.mjs +6 -0
  17. package/dist/_libs/_5.mjs +3 -0
  18. package/dist/_libs/_6.mjs +3 -0
  19. package/dist/_libs/acorn+confbox+js-tokens+magic-string+mlly+pkg-types+sourcemap-codec+strip-literal+unimport.mjs +8900 -0
  20. package/dist/_libs/{c12.mjs → c12+dotenv+rc9.mjs} +12 -105
  21. package/dist/_libs/{chokidar.mjs → chokidar+readdirp.mjs} +2 -9
  22. package/dist/_libs/confbox+exsolve+pkg-types.mjs +1249 -0
  23. package/dist/_libs/confbox.mjs +70 -2488
  24. package/dist/_libs/confbox2.mjs +786 -0
  25. package/dist/_libs/confbox3.mjs +404 -0
  26. package/dist/_libs/confbox4.mjs +3 -0
  27. package/dist/_libs/estree-walker+unimport.mjs +378 -0
  28. package/dist/_libs/fdir+picomatch+tinyglobby.mjs +2471 -0
  29. package/dist/_libs/gen-mapping+remapping+resolve-uri+trace-mapping+unimport+unplugin+unplugin-utils+webpack-virtual-modules.mjs +2150 -0
  30. package/dist/_libs/giget+node-fetch-native.mjs +2692 -0
  31. package/dist/_libs/httpxy.mjs +1 -6
  32. package/dist/_libs/local-pkg+quansync+unimport.mjs +1526 -0
  33. package/dist/_libs/nypm+tinyexec.mjs +858 -0
  34. package/dist/_libs/pathe.mjs +164 -0
  35. package/dist/_libs/perfect-debounce.mjs +89 -0
  36. package/dist/_libs/{@rollup/plugin-inject.mjs → plugin-alias+plugin-inject.mjs} +65 -2
  37. package/dist/_libs/std-env.mjs +158 -0
  38. package/dist/_libs/unimport.mjs +5 -1781
  39. package/dist/_libs/vite-plugin-fullstack.mjs +26 -0
  40. package/dist/_presets.mjs +8 -3
  41. package/dist/builder.mjs +8 -6
  42. package/dist/cli/_chunks/build.mjs +1 -1
  43. package/dist/cli/_chunks/dev.mjs +3 -2
  44. package/dist/cli/_chunks/list.mjs +1 -1
  45. package/dist/cli/_chunks/prepare.mjs +1 -1
  46. package/dist/cli/_chunks/run.mjs +1 -1
  47. package/dist/cli/index.mjs +1 -1
  48. package/dist/types/index.d.mts +2410 -1174
  49. package/dist/vite.d.mts +13 -13
  50. package/dist/vite.mjs +640 -16
  51. package/package.json +9 -9
  52. package/dist/_build/common.mjs +0 -24931
  53. package/dist/_build/rollup.mjs +0 -201
  54. package/dist/_chunks/utils.mjs +0 -254
  55. package/dist/_common.mjs +0 -45
  56. package/dist/_libs/@hiogawa/vite-plugin-fullstack.mjs +0 -652
  57. package/dist/_libs/@jridgewell/gen-mapping.mjs +0 -448
  58. package/dist/_libs/@jridgewell/remapping.mjs +0 -117
  59. package/dist/_libs/@rollup/plugin-alias.mjs +0 -64
  60. package/dist/_libs/@rollup/plugin-commonjs.mjs +0 -1300
  61. package/dist/_libs/@rollup/plugin-json.mjs +0 -36
  62. package/dist/_libs/@rollup/plugin-node-resolve.mjs +0 -1972
  63. package/dist/_libs/escape-string-regexp.mjs +0 -8
  64. package/dist/_libs/estree-walker.mjs +0 -187
  65. package/dist/_libs/giget.mjs +0 -3550
  66. package/dist/_libs/klona.mjs +0 -38
  67. package/dist/_libs/rou3.mjs +0 -322
  68. package/dist/_libs/tsconfck.mjs +0 -832
  69. package/dist/_libs/ultrahtml.mjs +0 -138
  70. package/dist/cli/_chunks/task.mjs +0 -16
@@ -0,0 +1,2692 @@
1
+ import { n as dirname$1, t as basename$1, u as resolve$1 } from "./pathe.mjs";
2
+ import { t as installDependencies } from "./nypm+tinyexec.mjs";
3
+ import { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
4
+ import nativeFs from "fs";
5
+ import path from "path";
6
+ import Ds from "crypto";
7
+ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
8
+ import { homedir, tmpdir } from "node:os";
9
+ import { promisify } from "node:util";
10
+ import { defu } from "defu";
11
+ import { pipeline } from "node:stream";
12
+ import "node:child_process";
13
+ import j$1 from "assert";
14
+ import nt from "events";
15
+ import ot from "stream";
16
+ import ht from "string_decoder";
17
+ import P from "buffer";
18
+ import O$2 from "zlib";
19
+ import nt$1 from "process";
20
+ import a$a from "util";
21
+
22
+ //#region node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/native.mjs
23
+ const e$6 = globalThis.Blob, o$5 = globalThis.File, a$10 = globalThis.FormData, s$7 = globalThis.Headers, t$6 = globalThis.Request, h = globalThis.Response, i$7 = globalThis.AbortController, l$1 = globalThis.fetch || (() => {
24
+ throw new Error("[node-fetch-native] Failed to fetch: `globalThis.fetch` is not available!");
25
+ });
26
+
27
+ //#endregion
28
+ //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs
29
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
30
+ function getDefaultExportFromCjs(x) {
31
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
32
+ }
33
+ var i$6, t$5;
34
+ function s$6() {
35
+ if (t$5) return i$6;
36
+ t$5 = 1;
37
+ const n$4 = new Map([
38
+ ["C", "cwd"],
39
+ ["f", "file"],
40
+ ["z", "gzip"],
41
+ ["P", "preservePaths"],
42
+ ["U", "unlink"],
43
+ ["strip-components", "strip"],
44
+ ["stripComponents", "strip"],
45
+ ["keep-newer", "newer"],
46
+ ["keepNewer", "newer"],
47
+ ["keep-newer-files", "newer"],
48
+ ["keepNewerFiles", "newer"],
49
+ ["k", "keep"],
50
+ ["keep-existing", "keep"],
51
+ ["keepExisting", "keep"],
52
+ ["m", "noMtime"],
53
+ ["no-mtime", "noMtime"],
54
+ ["p", "preserveOwner"],
55
+ ["L", "follow"],
56
+ ["h", "follow"]
57
+ ]);
58
+ return i$6 = (r) => r ? Object.keys(r).map((e$7) => [n$4.has(e$7) ? n$4.get(e$7) : e$7, r[e$7]]).reduce((e$7, p$1) => (e$7[p$1[0]] = p$1[1], e$7), Object.create(null)) : {}, i$6;
59
+ }
60
+ var e$5, t$4;
61
+ function c$4() {
62
+ return t$4 || (t$4 = 1, e$5 = (o$6) => class extends o$6 {
63
+ warn(n$4, i$8, r = {}) {
64
+ this.file && (r.file = this.file), this.cwd && (r.cwd = this.cwd), r.code = i$8 instanceof Error && i$8.code || n$4, r.tarCode = n$4, !this.strict && r.recoverable !== false ? (i$8 instanceof Error && (r = Object.assign(i$8, r), i$8 = i$8.message), this.emit("warn", r.tarCode, i$8, r)) : i$8 instanceof Error ? this.emit("error", Object.assign(i$8, r)) : this.emit("error", Object.assign(/* @__PURE__ */ new Error(`${n$4}: ${i$8}`), r));
65
+ }
66
+ }), e$5;
67
+ }
68
+ var e$4 = {};
69
+ var a$9;
70
+ function n$3() {
71
+ return a$9 ? e$4 : (a$9 = 1, function(e$7) {
72
+ e$7.name = new Map([
73
+ ["0", "File"],
74
+ ["", "OldFile"],
75
+ ["1", "Link"],
76
+ ["2", "SymbolicLink"],
77
+ ["3", "CharacterDevice"],
78
+ ["4", "BlockDevice"],
79
+ ["5", "Directory"],
80
+ ["6", "FIFO"],
81
+ ["7", "ContiguousFile"],
82
+ ["g", "GlobalExtendedHeader"],
83
+ ["x", "ExtendedHeader"],
84
+ ["A", "SolarisACL"],
85
+ ["D", "GNUDumpDir"],
86
+ ["I", "Inode"],
87
+ ["K", "NextFileHasLongLinkpath"],
88
+ ["L", "NextFileHasLongPath"],
89
+ ["M", "ContinuationFile"],
90
+ ["N", "OldGnuLongPath"],
91
+ ["S", "SparseFile"],
92
+ ["V", "TapeVolumeHeader"],
93
+ ["X", "OldExtendedHeader"]
94
+ ]), e$7.code = new Map(Array.from(e$7.name).map((i$8) => [i$8[1], i$8[0]]));
95
+ }(e$4), e$4);
96
+ }
97
+ var f$3, i$5;
98
+ function w$1() {
99
+ if (i$5) return f$3;
100
+ i$5 = 1;
101
+ const v$2 = (e$7, r) => {
102
+ if (Number.isSafeInteger(e$7)) e$7 < 0 ? g(e$7, r) : p$1(e$7, r);
103
+ else throw Error("cannot encode number outside of javascript safe integer range");
104
+ return r;
105
+ }, p$1 = (e$7, r) => {
106
+ r[0] = 128;
107
+ for (var o$6 = r.length; o$6 > 1; o$6--) r[o$6 - 1] = e$7 & 255, e$7 = Math.floor(e$7 / 256);
108
+ }, g = (e$7, r) => {
109
+ r[0] = 255;
110
+ var o$6 = false;
111
+ e$7 = e$7 * -1;
112
+ for (var s$8 = r.length; s$8 > 1; s$8--) {
113
+ var a$11 = e$7 & 255;
114
+ e$7 = Math.floor(e$7 / 256), o$6 ? r[s$8 - 1] = l$2(a$11) : a$11 === 0 ? r[s$8 - 1] = 0 : (o$6 = true, r[s$8 - 1] = c$5(a$11));
115
+ }
116
+ }, h$1 = (e$7) => {
117
+ const r = e$7[0], o$6 = r === 128 ? d(e$7.slice(1, e$7.length)) : r === 255 ? x(e$7) : null;
118
+ if (o$6 === null) throw Error("invalid base256 encoding");
119
+ if (!Number.isSafeInteger(o$6)) throw Error("parsed number outside of javascript safe integer range");
120
+ return o$6;
121
+ }, x = (e$7) => {
122
+ for (var r = e$7.length, o$6 = 0, s$8 = false, a$11 = r - 1; a$11 > -1; a$11--) {
123
+ var n$4 = e$7[a$11], t$7;
124
+ s$8 ? t$7 = l$2(n$4) : n$4 === 0 ? t$7 = n$4 : (s$8 = true, t$7 = c$5(n$4)), t$7 !== 0 && (o$6 -= t$7 * Math.pow(256, r - a$11 - 1));
125
+ }
126
+ return o$6;
127
+ }, d = (e$7) => {
128
+ for (var r = e$7.length, o$6 = 0, s$8 = r - 1; s$8 > -1; s$8--) {
129
+ var a$11 = e$7[s$8];
130
+ a$11 !== 0 && (o$6 += a$11 * Math.pow(256, r - s$8 - 1));
131
+ }
132
+ return o$6;
133
+ }, l$2 = (e$7) => (255 ^ e$7) & 255, c$5 = (e$7) => (255 ^ e$7) + 1 & 255;
134
+ return f$3 = {
135
+ encode: v$2,
136
+ parse: h$1
137
+ }, f$3;
138
+ }
139
+ var k, w;
140
+ function E() {
141
+ if (w) return k;
142
+ w = 1;
143
+ const u$5 = n$3(), x = path.posix, y$3 = w$1(), P$1 = Symbol("slurp"), a$11 = Symbol("type");
144
+ class B {
145
+ constructor(e$7, t$7, i$8, h$1) {
146
+ this.cksumValid = false, this.needPax = false, this.nullBlock = false, this.block = null, this.path = null, this.mode = null, this.uid = null, this.gid = null, this.size = null, this.mtime = null, this.cksum = null, this[a$11] = "0", this.linkpath = null, this.uname = null, this.gname = null, this.devmaj = 0, this.devmin = 0, this.atime = null, this.ctime = null, Buffer.isBuffer(e$7) ? this.decode(e$7, t$7 || 0, i$8, h$1) : e$7 && this.set(e$7);
147
+ }
148
+ decode(e$7, t$7, i$8, h$1) {
149
+ if (t$7 || (t$7 = 0), !e$7 || !(e$7.length >= t$7 + 512)) throw new Error("need 512 bytes for header");
150
+ if (this.path = d(e$7, t$7, 100), this.mode = r(e$7, t$7 + 100, 8), this.uid = r(e$7, t$7 + 108, 8), this.gid = r(e$7, t$7 + 116, 8), this.size = r(e$7, t$7 + 124, 12), this.mtime = o$6(e$7, t$7 + 136, 12), this.cksum = r(e$7, t$7 + 148, 12), this[P$1](i$8), this[P$1](h$1, true), this[a$11] = d(e$7, t$7 + 156, 1), this[a$11] === "" && (this[a$11] = "0"), this[a$11] === "0" && this.path.slice(-1) === "/" && (this[a$11] = "5"), this[a$11] === "5" && (this.size = 0), this.linkpath = d(e$7, t$7 + 157, 100), e$7.slice(t$7 + 257, t$7 + 265).toString() === "ustar\x0000") if (this.uname = d(e$7, t$7 + 265, 32), this.gname = d(e$7, t$7 + 297, 32), this.devmaj = r(e$7, t$7 + 329, 8), this.devmin = r(e$7, t$7 + 337, 8), e$7[t$7 + 475] !== 0) this.path = d(e$7, t$7 + 345, 155) + "/" + this.path;
151
+ else {
152
+ const n$4 = d(e$7, t$7 + 345, 130);
153
+ n$4 && (this.path = n$4 + "/" + this.path), this.atime = o$6(e$7, t$7 + 476, 12), this.ctime = o$6(e$7, t$7 + 488, 12);
154
+ }
155
+ let l$2 = 256;
156
+ for (let n$4 = t$7; n$4 < t$7 + 148; n$4++) l$2 += e$7[n$4];
157
+ for (let n$4 = t$7 + 156; n$4 < t$7 + 512; n$4++) l$2 += e$7[n$4];
158
+ this.cksumValid = l$2 === this.cksum, this.cksum === null && l$2 === 256 && (this.nullBlock = true);
159
+ }
160
+ [P$1](e$7, t$7) {
161
+ for (const i$8 in e$7) e$7[i$8] !== null && e$7[i$8] !== void 0 && !(t$7 && i$8 === "path") && (this[i$8] = e$7[i$8]);
162
+ }
163
+ encode(e$7, t$7) {
164
+ if (e$7 || (e$7 = this.block = Buffer.alloc(512), t$7 = 0), t$7 || (t$7 = 0), !(e$7.length >= t$7 + 512)) throw new Error("need 512 bytes for header");
165
+ const i$8 = this.ctime || this.atime ? 130 : 155, h$1 = L(this.path || "", i$8), l$2 = h$1[0], n$4 = h$1[1];
166
+ this.needPax = h$1[2], this.needPax = m$3(e$7, t$7, 100, l$2) || this.needPax, this.needPax = c$5(e$7, t$7 + 100, 8, this.mode) || this.needPax, this.needPax = c$5(e$7, t$7 + 108, 8, this.uid) || this.needPax, this.needPax = c$5(e$7, t$7 + 116, 8, this.gid) || this.needPax, this.needPax = c$5(e$7, t$7 + 124, 12, this.size) || this.needPax, this.needPax = g(e$7, t$7 + 136, 12, this.mtime) || this.needPax, e$7[t$7 + 156] = this[a$11].charCodeAt(0), this.needPax = m$3(e$7, t$7 + 157, 100, this.linkpath) || this.needPax, e$7.write("ustar\x0000", t$7 + 257, 8), this.needPax = m$3(e$7, t$7 + 265, 32, this.uname) || this.needPax, this.needPax = m$3(e$7, t$7 + 297, 32, this.gname) || this.needPax, this.needPax = c$5(e$7, t$7 + 329, 8, this.devmaj) || this.needPax, this.needPax = c$5(e$7, t$7 + 337, 8, this.devmin) || this.needPax, this.needPax = m$3(e$7, t$7 + 345, i$8, n$4) || this.needPax, e$7[t$7 + 475] !== 0 ? this.needPax = m$3(e$7, t$7 + 345, 155, n$4) || this.needPax : (this.needPax = m$3(e$7, t$7 + 345, 130, n$4) || this.needPax, this.needPax = g(e$7, t$7 + 476, 12, this.atime) || this.needPax, this.needPax = g(e$7, t$7 + 488, 12, this.ctime) || this.needPax);
167
+ let S$1 = 256;
168
+ for (let p$1 = t$7; p$1 < t$7 + 148; p$1++) S$1 += e$7[p$1];
169
+ for (let p$1 = t$7 + 156; p$1 < t$7 + 512; p$1++) S$1 += e$7[p$1];
170
+ return this.cksum = S$1, c$5(e$7, t$7 + 148, 8, this.cksum), this.cksumValid = true, this.needPax;
171
+ }
172
+ set(e$7) {
173
+ for (const t$7 in e$7) e$7[t$7] !== null && e$7[t$7] !== void 0 && (this[t$7] = e$7[t$7]);
174
+ }
175
+ get type() {
176
+ return u$5.name.get(this[a$11]) || this[a$11];
177
+ }
178
+ get typeKey() {
179
+ return this[a$11];
180
+ }
181
+ set type(e$7) {
182
+ u$5.code.has(e$7) ? this[a$11] = u$5.code.get(e$7) : this[a$11] = e$7;
183
+ }
184
+ }
185
+ const L = (s$8, e$7) => {
186
+ let i$8 = s$8, h$1 = "", l$2;
187
+ const n$4 = x.parse(s$8).root || ".";
188
+ if (Buffer.byteLength(i$8) < 100) l$2 = [
189
+ i$8,
190
+ h$1,
191
+ false
192
+ ];
193
+ else {
194
+ h$1 = x.dirname(i$8), i$8 = x.basename(i$8);
195
+ do
196
+ Buffer.byteLength(i$8) <= 100 && Buffer.byteLength(h$1) <= e$7 ? l$2 = [
197
+ i$8,
198
+ h$1,
199
+ false
200
+ ] : Buffer.byteLength(i$8) > 100 && Buffer.byteLength(h$1) <= e$7 ? l$2 = [
201
+ i$8.slice(0, 99),
202
+ h$1,
203
+ true
204
+ ] : (i$8 = x.join(x.basename(h$1), i$8), h$1 = x.dirname(h$1));
205
+ while (h$1 !== n$4 && !l$2);
206
+ l$2 || (l$2 = [
207
+ s$8.slice(0, 99),
208
+ "",
209
+ true
210
+ ]);
211
+ }
212
+ return l$2;
213
+ }, d = (s$8, e$7, t$7) => s$8.slice(e$7, e$7 + t$7).toString("utf8").replace(/\0.*/, ""), o$6 = (s$8, e$7, t$7) => N(r(s$8, e$7, t$7)), N = (s$8) => s$8 === null ? null : /* @__PURE__ */ new Date(s$8 * 1e3), r = (s$8, e$7, t$7) => s$8[e$7] & 128 ? y$3.parse(s$8.slice(e$7, e$7 + t$7)) : j$2(s$8, e$7, t$7), q$1 = (s$8) => isNaN(s$8) ? null : s$8, j$2 = (s$8, e$7, t$7) => q$1(parseInt(s$8.slice(e$7, e$7 + t$7).toString("utf8").replace(/\0.*$/, "").trim(), 8)), v$2 = {
214
+ 12: 8589934591,
215
+ 8: 2097151
216
+ }, c$5 = (s$8, e$7, t$7, i$8) => i$8 === null ? false : i$8 > v$2[t$7] || i$8 < 0 ? (y$3.encode(i$8, s$8.slice(e$7, e$7 + t$7)), true) : ($(s$8, e$7, t$7, i$8), false), $ = (s$8, e$7, t$7, i$8) => s$8.write(_$1(i$8, t$7), e$7, t$7, "ascii"), _$1 = (s$8, e$7) => z$1(Math.floor(s$8).toString(8), e$7), z$1 = (s$8, e$7) => (s$8.length === e$7 - 1 ? s$8 : new Array(e$7 - s$8.length - 1).join("0") + s$8 + " ") + "\0", g = (s$8, e$7, t$7, i$8) => i$8 === null ? false : c$5(s$8, e$7, t$7, i$8.getTime() / 1e3), A = new Array(156).join("\0"), m$3 = (s$8, e$7, t$7, i$8) => i$8 === null ? false : (s$8.write(i$8 + A, e$7, t$7, "utf8"), i$8.length !== Buffer.byteLength(i$8) || i$8.length > t$7);
217
+ return k = B, k;
218
+ }
219
+ var e$3, t$3;
220
+ function i$4() {
221
+ return t$3 || (t$3 = 1, e$3 = function(o$6) {
222
+ o$6.prototype[Symbol.iterator] = function* () {
223
+ for (let r = this.head; r; r = r.next) yield r.value;
224
+ };
225
+ }), e$3;
226
+ }
227
+ var u$4, a$8;
228
+ function c$3() {
229
+ if (a$8) return u$4;
230
+ a$8 = 1, u$4 = r, r.Node = s$8, r.create = r;
231
+ function r(t$7) {
232
+ var i$8 = this;
233
+ if (i$8 instanceof r || (i$8 = new r()), i$8.tail = null, i$8.head = null, i$8.length = 0, t$7 && typeof t$7.forEach == "function") t$7.forEach(function(n$4) {
234
+ i$8.push(n$4);
235
+ });
236
+ else if (arguments.length > 0) for (var e$7 = 0, h$1 = arguments.length; e$7 < h$1; e$7++) i$8.push(arguments[e$7]);
237
+ return i$8;
238
+ }
239
+ r.prototype.removeNode = function(t$7) {
240
+ if (t$7.list !== this) throw new Error("removing node which does not belong to this list");
241
+ var i$8 = t$7.next, e$7 = t$7.prev;
242
+ return i$8 && (i$8.prev = e$7), e$7 && (e$7.next = i$8), t$7 === this.head && (this.head = i$8), t$7 === this.tail && (this.tail = e$7), t$7.list.length--, t$7.next = null, t$7.prev = null, t$7.list = null, i$8;
243
+ }, r.prototype.unshiftNode = function(t$7) {
244
+ if (t$7 !== this.head) {
245
+ t$7.list && t$7.list.removeNode(t$7);
246
+ var i$8 = this.head;
247
+ t$7.list = this, t$7.next = i$8, i$8 && (i$8.prev = t$7), this.head = t$7, this.tail || (this.tail = t$7), this.length++;
248
+ }
249
+ }, r.prototype.pushNode = function(t$7) {
250
+ if (t$7 !== this.tail) {
251
+ t$7.list && t$7.list.removeNode(t$7);
252
+ var i$8 = this.tail;
253
+ t$7.list = this, t$7.prev = i$8, i$8 && (i$8.next = t$7), this.tail = t$7, this.head || (this.head = t$7), this.length++;
254
+ }
255
+ }, r.prototype.push = function() {
256
+ for (var t$7 = 0, i$8 = arguments.length; t$7 < i$8; t$7++) f$4(this, arguments[t$7]);
257
+ return this.length;
258
+ }, r.prototype.unshift = function() {
259
+ for (var t$7 = 0, i$8 = arguments.length; t$7 < i$8; t$7++) o$6(this, arguments[t$7]);
260
+ return this.length;
261
+ }, r.prototype.pop = function() {
262
+ if (this.tail) {
263
+ var t$7 = this.tail.value;
264
+ return this.tail = this.tail.prev, this.tail ? this.tail.next = null : this.head = null, this.length--, t$7;
265
+ }
266
+ }, r.prototype.shift = function() {
267
+ if (this.head) {
268
+ var t$7 = this.head.value;
269
+ return this.head = this.head.next, this.head ? this.head.prev = null : this.tail = null, this.length--, t$7;
270
+ }
271
+ }, r.prototype.forEach = function(t$7, i$8) {
272
+ i$8 = i$8 || this;
273
+ for (var e$7 = this.head, h$1 = 0; e$7 !== null; h$1++) t$7.call(i$8, e$7.value, h$1, this), e$7 = e$7.next;
274
+ }, r.prototype.forEachReverse = function(t$7, i$8) {
275
+ i$8 = i$8 || this;
276
+ for (var e$7 = this.tail, h$1 = this.length - 1; e$7 !== null; h$1--) t$7.call(i$8, e$7.value, h$1, this), e$7 = e$7.prev;
277
+ }, r.prototype.get = function(t$7) {
278
+ for (var i$8 = 0, e$7 = this.head; e$7 !== null && i$8 < t$7; i$8++) e$7 = e$7.next;
279
+ if (i$8 === t$7 && e$7 !== null) return e$7.value;
280
+ }, r.prototype.getReverse = function(t$7) {
281
+ for (var i$8 = 0, e$7 = this.tail; e$7 !== null && i$8 < t$7; i$8++) e$7 = e$7.prev;
282
+ if (i$8 === t$7 && e$7 !== null) return e$7.value;
283
+ }, r.prototype.map = function(t$7, i$8) {
284
+ i$8 = i$8 || this;
285
+ for (var e$7 = new r(), h$1 = this.head; h$1 !== null;) e$7.push(t$7.call(i$8, h$1.value, this)), h$1 = h$1.next;
286
+ return e$7;
287
+ }, r.prototype.mapReverse = function(t$7, i$8) {
288
+ i$8 = i$8 || this;
289
+ for (var e$7 = new r(), h$1 = this.tail; h$1 !== null;) e$7.push(t$7.call(i$8, h$1.value, this)), h$1 = h$1.prev;
290
+ return e$7;
291
+ }, r.prototype.reduce = function(t$7, i$8) {
292
+ var e$7, h$1 = this.head;
293
+ if (arguments.length > 1) e$7 = i$8;
294
+ else if (this.head) h$1 = this.head.next, e$7 = this.head.value;
295
+ else throw new TypeError("Reduce of empty list with no initial value");
296
+ for (var n$4 = 0; h$1 !== null; n$4++) e$7 = t$7(e$7, h$1.value, n$4), h$1 = h$1.next;
297
+ return e$7;
298
+ }, r.prototype.reduceReverse = function(t$7, i$8) {
299
+ var e$7, h$1 = this.tail;
300
+ if (arguments.length > 1) e$7 = i$8;
301
+ else if (this.tail) h$1 = this.tail.prev, e$7 = this.tail.value;
302
+ else throw new TypeError("Reduce of empty list with no initial value");
303
+ for (var n$4 = this.length - 1; h$1 !== null; n$4--) e$7 = t$7(e$7, h$1.value, n$4), h$1 = h$1.prev;
304
+ return e$7;
305
+ }, r.prototype.toArray = function() {
306
+ for (var t$7 = new Array(this.length), i$8 = 0, e$7 = this.head; e$7 !== null; i$8++) t$7[i$8] = e$7.value, e$7 = e$7.next;
307
+ return t$7;
308
+ }, r.prototype.toArrayReverse = function() {
309
+ for (var t$7 = new Array(this.length), i$8 = 0, e$7 = this.tail; e$7 !== null; i$8++) t$7[i$8] = e$7.value, e$7 = e$7.prev;
310
+ return t$7;
311
+ }, r.prototype.slice = function(t$7, i$8) {
312
+ i$8 = i$8 || this.length, i$8 < 0 && (i$8 += this.length), t$7 = t$7 || 0, t$7 < 0 && (t$7 += this.length);
313
+ var e$7 = new r();
314
+ if (i$8 < t$7 || i$8 < 0) return e$7;
315
+ t$7 < 0 && (t$7 = 0), i$8 > this.length && (i$8 = this.length);
316
+ for (var h$1 = 0, n$4 = this.head; n$4 !== null && h$1 < t$7; h$1++) n$4 = n$4.next;
317
+ for (; n$4 !== null && h$1 < i$8; h$1++, n$4 = n$4.next) e$7.push(n$4.value);
318
+ return e$7;
319
+ }, r.prototype.sliceReverse = function(t$7, i$8) {
320
+ i$8 = i$8 || this.length, i$8 < 0 && (i$8 += this.length), t$7 = t$7 || 0, t$7 < 0 && (t$7 += this.length);
321
+ var e$7 = new r();
322
+ if (i$8 < t$7 || i$8 < 0) return e$7;
323
+ t$7 < 0 && (t$7 = 0), i$8 > this.length && (i$8 = this.length);
324
+ for (var h$1 = this.length, n$4 = this.tail; n$4 !== null && h$1 > i$8; h$1--) n$4 = n$4.prev;
325
+ for (; n$4 !== null && h$1 > t$7; h$1--, n$4 = n$4.prev) e$7.push(n$4.value);
326
+ return e$7;
327
+ }, r.prototype.splice = function(t$7, i$8, ...e$7) {
328
+ t$7 > this.length && (t$7 = this.length - 1), t$7 < 0 && (t$7 = this.length + t$7);
329
+ for (var h$1 = 0, n$4 = this.head; n$4 !== null && h$1 < t$7; h$1++) n$4 = n$4.next;
330
+ for (var l$2 = [], h$1 = 0; n$4 && h$1 < i$8; h$1++) l$2.push(n$4.value), n$4 = this.removeNode(n$4);
331
+ n$4 === null && (n$4 = this.tail), n$4 !== this.head && n$4 !== this.tail && (n$4 = n$4.prev);
332
+ for (var h$1 = 0; h$1 < e$7.length; h$1++) n$4 = v$2(this, n$4, e$7[h$1]);
333
+ return l$2;
334
+ }, r.prototype.reverse = function() {
335
+ for (var t$7 = this.head, i$8 = this.tail, e$7 = t$7; e$7 !== null; e$7 = e$7.prev) {
336
+ var h$1 = e$7.prev;
337
+ e$7.prev = e$7.next, e$7.next = h$1;
338
+ }
339
+ return this.head = i$8, this.tail = t$7, this;
340
+ };
341
+ function v$2(t$7, i$8, e$7) {
342
+ var h$1 = i$8 === t$7.head ? new s$8(e$7, null, i$8, t$7) : new s$8(e$7, i$8, i$8.next, t$7);
343
+ return h$1.next === null && (t$7.tail = h$1), h$1.prev === null && (t$7.head = h$1), t$7.length++, h$1;
344
+ }
345
+ function f$4(t$7, i$8) {
346
+ t$7.tail = new s$8(i$8, t$7.tail, null, t$7), t$7.head || (t$7.head = t$7.tail), t$7.length++;
347
+ }
348
+ function o$6(t$7, i$8) {
349
+ t$7.head = new s$8(i$8, null, t$7.head, t$7), t$7.tail || (t$7.tail = t$7.head), t$7.length++;
350
+ }
351
+ function s$8(t$7, i$8, e$7, h$1) {
352
+ if (!(this instanceof s$8)) return new s$8(t$7, i$8, e$7, h$1);
353
+ this.list = h$1, this.value = t$7, i$8 ? (i$8.next = this, this.prev = i$8) : this.prev = null, e$7 ? (e$7.prev = this, this.next = e$7) : this.next = null;
354
+ }
355
+ try {
356
+ i$4()(r);
357
+ } catch {}
358
+ return u$4;
359
+ }
360
+ var s$5 = {};
361
+ var X$1;
362
+ function ft() {
363
+ if (X$1) return s$5;
364
+ X$1 = 1;
365
+ const H$2 = typeof process == "object" && process ? process : {
366
+ stdout: null,
367
+ stderr: null
368
+ }, Z = nt, q$1 = ot, G$1 = ht.StringDecoder, m$3 = Symbol("EOF"), d = Symbol("maybeEmitEnd"), y$3 = Symbol("emittedEnd"), R$2 = Symbol("emittingEnd"), g = Symbol("emittedError"), B = Symbol("closed"), Y = Symbol("read"), T$1 = Symbol("flush"), $ = Symbol("flushChunk"), f$4 = Symbol("encoding"), c$5 = Symbol("decoder"), M = Symbol("flowing"), S$1 = Symbol("paused"), b = Symbol("resume"), i$8 = Symbol("buffer"), a$11 = Symbol("pipes"), n$4 = Symbol("bufferLength"), j$2 = Symbol("bufferPush"), I = Symbol("bufferShift"), o$6 = Symbol("objectMode"), r = Symbol("destroyed"), P$1 = Symbol("error"), x = Symbol("emitData"), V = Symbol("emitEnd"), N = Symbol("emitEnd2"), p$1 = Symbol("async"), _$1 = Symbol("abort"), O$3 = Symbol("aborted"), E$1 = Symbol("signal"), w$2 = (h$1) => Promise.resolve().then(h$1), J$1 = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", K = J$1 && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), W = J$1 && Symbol.iterator || Symbol("iterator not implemented"), k$1 = (h$1) => h$1 === "end" || h$1 === "finish" || h$1 === "prefinish", tt$1 = (h$1) => h$1 instanceof ArrayBuffer || typeof h$1 == "object" && h$1.constructor && h$1.constructor.name === "ArrayBuffer" && h$1.byteLength >= 0, et = (h$1) => !Buffer.isBuffer(h$1) && ArrayBuffer.isView(h$1);
369
+ class z$1 {
370
+ constructor(t$7, e$7, s$8) {
371
+ this.src = t$7, this.dest = e$7, this.opts = s$8, this.ondrain = () => t$7[b](), e$7.on("drain", this.ondrain);
372
+ }
373
+ unpipe() {
374
+ this.dest.removeListener("drain", this.ondrain);
375
+ }
376
+ proxyErrors() {}
377
+ end() {
378
+ this.unpipe(), this.opts.end && this.dest.end();
379
+ }
380
+ }
381
+ class st extends z$1 {
382
+ unpipe() {
383
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
384
+ }
385
+ constructor(t$7, e$7, s$8) {
386
+ super(t$7, e$7, s$8), this.proxyErrors = (l$2) => e$7.emit("error", l$2), t$7.on("error", this.proxyErrors);
387
+ }
388
+ }
389
+ class F$3 extends q$1 {
390
+ constructor(t$7) {
391
+ super(), this[M] = false, this[S$1] = false, this[a$11] = [], this[i$8] = [], this[o$6] = t$7 && t$7.objectMode || false, this[o$6] ? this[f$4] = null : this[f$4] = t$7 && t$7.encoding || null, this[f$4] === "buffer" && (this[f$4] = null), this[p$1] = t$7 && !!t$7.async || false, this[c$5] = this[f$4] ? new G$1(this[f$4]) : null, this[m$3] = false, this[y$3] = false, this[R$2] = false, this[B] = false, this[g] = null, this.writable = true, this.readable = true, this[n$4] = 0, this[r] = false, t$7 && t$7.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[i$8] }), t$7 && t$7.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[a$11] }), this[E$1] = t$7 && t$7.signal, this[O$3] = false, this[E$1] && (this[E$1].addEventListener("abort", () => this[_$1]()), this[E$1].aborted && this[_$1]());
392
+ }
393
+ get bufferLength() {
394
+ return this[n$4];
395
+ }
396
+ get encoding() {
397
+ return this[f$4];
398
+ }
399
+ set encoding(t$7) {
400
+ if (this[o$6]) throw new Error("cannot set encoding in objectMode");
401
+ if (this[f$4] && t$7 !== this[f$4] && (this[c$5] && this[c$5].lastNeed || this[n$4])) throw new Error("cannot change encoding");
402
+ this[f$4] !== t$7 && (this[c$5] = t$7 ? new G$1(t$7) : null, this[i$8].length && (this[i$8] = this[i$8].map((e$7) => this[c$5].write(e$7)))), this[f$4] = t$7;
403
+ }
404
+ setEncoding(t$7) {
405
+ this.encoding = t$7;
406
+ }
407
+ get objectMode() {
408
+ return this[o$6];
409
+ }
410
+ set objectMode(t$7) {
411
+ this[o$6] = this[o$6] || !!t$7;
412
+ }
413
+ get async() {
414
+ return this[p$1];
415
+ }
416
+ set async(t$7) {
417
+ this[p$1] = this[p$1] || !!t$7;
418
+ }
419
+ [_$1]() {
420
+ this[O$3] = true, this.emit("abort", this[E$1].reason), this.destroy(this[E$1].reason);
421
+ }
422
+ get aborted() {
423
+ return this[O$3];
424
+ }
425
+ set aborted(t$7) {}
426
+ write(t$7, e$7, s$8) {
427
+ if (this[O$3]) return false;
428
+ if (this[m$3]) throw new Error("write after end");
429
+ if (this[r]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
430
+ typeof e$7 == "function" && (s$8 = e$7, e$7 = "utf8"), e$7 || (e$7 = "utf8");
431
+ const l$2 = this[p$1] ? w$2 : (u$5) => u$5();
432
+ return !this[o$6] && !Buffer.isBuffer(t$7) && (et(t$7) ? t$7 = Buffer.from(t$7.buffer, t$7.byteOffset, t$7.byteLength) : tt$1(t$7) ? t$7 = Buffer.from(t$7) : typeof t$7 != "string" && (this.objectMode = true)), this[o$6] ? (this.flowing && this[n$4] !== 0 && this[T$1](true), this.flowing ? this.emit("data", t$7) : this[j$2](t$7), this[n$4] !== 0 && this.emit("readable"), s$8 && l$2(s$8), this.flowing) : t$7.length ? (typeof t$7 == "string" && !(e$7 === this[f$4] && !this[c$5].lastNeed) && (t$7 = Buffer.from(t$7, e$7)), Buffer.isBuffer(t$7) && this[f$4] && (t$7 = this[c$5].write(t$7)), this.flowing && this[n$4] !== 0 && this[T$1](true), this.flowing ? this.emit("data", t$7) : this[j$2](t$7), this[n$4] !== 0 && this.emit("readable"), s$8 && l$2(s$8), this.flowing) : (this[n$4] !== 0 && this.emit("readable"), s$8 && l$2(s$8), this.flowing);
433
+ }
434
+ read(t$7) {
435
+ if (this[r]) return null;
436
+ if (this[n$4] === 0 || t$7 === 0 || t$7 > this[n$4]) return this[d](), null;
437
+ this[o$6] && (t$7 = null), this[i$8].length > 1 && !this[o$6] && (this.encoding ? this[i$8] = [this[i$8].join("")] : this[i$8] = [Buffer.concat(this[i$8], this[n$4])]);
438
+ const e$7 = this[Y](t$7 || null, this[i$8][0]);
439
+ return this[d](), e$7;
440
+ }
441
+ [Y](t$7, e$7) {
442
+ return t$7 === e$7.length || t$7 === null ? this[I]() : (this[i$8][0] = e$7.slice(t$7), e$7 = e$7.slice(0, t$7), this[n$4] -= t$7), this.emit("data", e$7), !this[i$8].length && !this[m$3] && this.emit("drain"), e$7;
443
+ }
444
+ end(t$7, e$7, s$8) {
445
+ return typeof t$7 == "function" && (s$8 = t$7, t$7 = null), typeof e$7 == "function" && (s$8 = e$7, e$7 = "utf8"), t$7 && this.write(t$7, e$7), s$8 && this.once("end", s$8), this[m$3] = true, this.writable = false, (this.flowing || !this[S$1]) && this[d](), this;
446
+ }
447
+ [b]() {
448
+ this[r] || (this[S$1] = false, this[M] = true, this.emit("resume"), this[i$8].length ? this[T$1]() : this[m$3] ? this[d]() : this.emit("drain"));
449
+ }
450
+ resume() {
451
+ return this[b]();
452
+ }
453
+ pause() {
454
+ this[M] = false, this[S$1] = true;
455
+ }
456
+ get destroyed() {
457
+ return this[r];
458
+ }
459
+ get flowing() {
460
+ return this[M];
461
+ }
462
+ get paused() {
463
+ return this[S$1];
464
+ }
465
+ [j$2](t$7) {
466
+ this[o$6] ? this[n$4] += 1 : this[n$4] += t$7.length, this[i$8].push(t$7);
467
+ }
468
+ [I]() {
469
+ return this[o$6] ? this[n$4] -= 1 : this[n$4] -= this[i$8][0].length, this[i$8].shift();
470
+ }
471
+ [T$1](t$7) {
472
+ do ;
473
+ while (this[$](this[I]()) && this[i$8].length);
474
+ !t$7 && !this[i$8].length && !this[m$3] && this.emit("drain");
475
+ }
476
+ [$](t$7) {
477
+ return this.emit("data", t$7), this.flowing;
478
+ }
479
+ pipe(t$7, e$7) {
480
+ if (this[r]) return;
481
+ const s$8 = this[y$3];
482
+ return e$7 = e$7 || {}, t$7 === H$2.stdout || t$7 === H$2.stderr ? e$7.end = false : e$7.end = e$7.end !== false, e$7.proxyErrors = !!e$7.proxyErrors, s$8 ? e$7.end && t$7.end() : (this[a$11].push(e$7.proxyErrors ? new st(this, t$7, e$7) : new z$1(this, t$7, e$7)), this[p$1] ? w$2(() => this[b]()) : this[b]()), t$7;
483
+ }
484
+ unpipe(t$7) {
485
+ const e$7 = this[a$11].find((s$8) => s$8.dest === t$7);
486
+ e$7 && (this[a$11].splice(this[a$11].indexOf(e$7), 1), e$7.unpipe());
487
+ }
488
+ addListener(t$7, e$7) {
489
+ return this.on(t$7, e$7);
490
+ }
491
+ on(t$7, e$7) {
492
+ const s$8 = super.on(t$7, e$7);
493
+ return t$7 === "data" && !this[a$11].length && !this.flowing ? this[b]() : t$7 === "readable" && this[n$4] !== 0 ? super.emit("readable") : k$1(t$7) && this[y$3] ? (super.emit(t$7), this.removeAllListeners(t$7)) : t$7 === "error" && this[g] && (this[p$1] ? w$2(() => e$7.call(this, this[g])) : e$7.call(this, this[g])), s$8;
494
+ }
495
+ get emittedEnd() {
496
+ return this[y$3];
497
+ }
498
+ [d]() {
499
+ !this[R$2] && !this[y$3] && !this[r] && this[i$8].length === 0 && this[m$3] && (this[R$2] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[B] && this.emit("close"), this[R$2] = false);
500
+ }
501
+ emit(t$7, e$7, ...s$8) {
502
+ if (t$7 !== "error" && t$7 !== "close" && t$7 !== r && this[r]) return;
503
+ if (t$7 === "data") return !this[o$6] && !e$7 ? false : this[p$1] ? w$2(() => this[x](e$7)) : this[x](e$7);
504
+ if (t$7 === "end") return this[V]();
505
+ if (t$7 === "close") {
506
+ if (this[B] = true, !this[y$3] && !this[r]) return;
507
+ const u$5 = super.emit("close");
508
+ return this.removeAllListeners("close"), u$5;
509
+ } else if (t$7 === "error") {
510
+ this[g] = e$7, super.emit(P$1, e$7);
511
+ const u$5 = !this[E$1] || this.listeners("error").length ? super.emit("error", e$7) : false;
512
+ return this[d](), u$5;
513
+ } else if (t$7 === "resume") {
514
+ const u$5 = super.emit("resume");
515
+ return this[d](), u$5;
516
+ } else if (t$7 === "finish" || t$7 === "prefinish") {
517
+ const u$5 = super.emit(t$7);
518
+ return this.removeAllListeners(t$7), u$5;
519
+ }
520
+ const l$2 = super.emit(t$7, e$7, ...s$8);
521
+ return this[d](), l$2;
522
+ }
523
+ [x](t$7) {
524
+ for (const s$8 of this[a$11]) s$8.dest.write(t$7) === false && this.pause();
525
+ const e$7 = super.emit("data", t$7);
526
+ return this[d](), e$7;
527
+ }
528
+ [V]() {
529
+ this[y$3] || (this[y$3] = true, this.readable = false, this[p$1] ? w$2(() => this[N]()) : this[N]());
530
+ }
531
+ [N]() {
532
+ if (this[c$5]) {
533
+ const e$7 = this[c$5].end();
534
+ if (e$7) {
535
+ for (const s$8 of this[a$11]) s$8.dest.write(e$7);
536
+ super.emit("data", e$7);
537
+ }
538
+ }
539
+ for (const e$7 of this[a$11]) e$7.end();
540
+ const t$7 = super.emit("end");
541
+ return this.removeAllListeners("end"), t$7;
542
+ }
543
+ collect() {
544
+ const t$7 = [];
545
+ this[o$6] || (t$7.dataLength = 0);
546
+ const e$7 = this.promise();
547
+ return this.on("data", (s$8) => {
548
+ t$7.push(s$8), this[o$6] || (t$7.dataLength += s$8.length);
549
+ }), e$7.then(() => t$7);
550
+ }
551
+ concat() {
552
+ return this[o$6] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t$7) => this[o$6] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[f$4] ? t$7.join("") : Buffer.concat(t$7, t$7.dataLength));
553
+ }
554
+ promise() {
555
+ return new Promise((t$7, e$7) => {
556
+ this.on(r, () => e$7(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s$8) => e$7(s$8)), this.on("end", () => t$7());
557
+ });
558
+ }
559
+ [K]() {
560
+ let t$7 = false;
561
+ const e$7 = () => (this.pause(), t$7 = true, Promise.resolve({ done: true }));
562
+ return {
563
+ next: () => {
564
+ if (t$7) return e$7();
565
+ const l$2 = this.read();
566
+ if (l$2 !== null) return Promise.resolve({
567
+ done: false,
568
+ value: l$2
569
+ });
570
+ if (this[m$3]) return e$7();
571
+ let u$5 = null, Q = null;
572
+ const A = (L) => {
573
+ this.removeListener("data", U), this.removeListener("end", C$1), this.removeListener(r, D), e$7(), Q(L);
574
+ }, U = (L) => {
575
+ this.removeListener("error", A), this.removeListener("end", C$1), this.removeListener(r, D), this.pause(), u$5({
576
+ value: L,
577
+ done: !!this[m$3]
578
+ });
579
+ }, C$1 = () => {
580
+ this.removeListener("error", A), this.removeListener("data", U), this.removeListener(r, D), e$7(), u$5({ done: true });
581
+ }, D = () => A(/* @__PURE__ */ new Error("stream destroyed"));
582
+ return new Promise((L, it) => {
583
+ Q = it, u$5 = L, this.once(r, D), this.once("error", A), this.once("end", C$1), this.once("data", U);
584
+ });
585
+ },
586
+ throw: e$7,
587
+ return: e$7,
588
+ [K]() {
589
+ return this;
590
+ }
591
+ };
592
+ }
593
+ [W]() {
594
+ let t$7 = false;
595
+ const e$7 = () => (this.pause(), this.removeListener(P$1, e$7), this.removeListener(r, e$7), this.removeListener("end", e$7), t$7 = true, { done: true }), s$8 = () => {
596
+ if (t$7) return e$7();
597
+ const l$2 = this.read();
598
+ return l$2 === null ? e$7() : { value: l$2 };
599
+ };
600
+ return this.once("end", e$7), this.once(P$1, e$7), this.once(r, e$7), {
601
+ next: s$8,
602
+ throw: e$7,
603
+ return: e$7,
604
+ [W]() {
605
+ return this;
606
+ }
607
+ };
608
+ }
609
+ destroy(t$7) {
610
+ return this[r] ? (t$7 ? this.emit("error", t$7) : this.emit(r), this) : (this[r] = true, this[i$8].length = 0, this[n$4] = 0, typeof this.close == "function" && !this[B] && this.close(), t$7 ? this.emit("error", t$7) : this.emit(r), this);
611
+ }
612
+ static isStream(t$7) {
613
+ return !!t$7 && (t$7 instanceof F$3 || t$7 instanceof q$1 || t$7 instanceof Z && (typeof t$7.pipe == "function" || typeof t$7.write == "function" && typeof t$7.end == "function"));
614
+ }
615
+ }
616
+ return s$5.Minipass = F$3, s$5;
617
+ }
618
+ var e$2, o$4;
619
+ function a$7() {
620
+ return o$4 || (o$4 = 1, e$2 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) !== "win32" ? (r) => r : (r) => r && r.replace(/\\/g, "/")), e$2;
621
+ }
622
+ var n$2, a$6;
623
+ function u$3() {
624
+ if (a$6) return n$2;
625
+ a$6 = 1;
626
+ const { Minipass: o$6 } = ft(), s$8 = a$7(), r = Symbol("slurp");
627
+ return n$2 = class extends o$6 {
628
+ constructor(t$7, e$7, i$8) {
629
+ switch (super(), this.pause(), this.extended = e$7, this.globalExtended = i$8, this.header = t$7, this.startBlockSize = 512 * Math.ceil(t$7.size / 512), this.blockRemain = this.startBlockSize, this.remain = t$7.size, this.type = t$7.type, this.meta = false, this.ignore = false, this.type) {
630
+ case "File":
631
+ case "OldFile":
632
+ case "Link":
633
+ case "SymbolicLink":
634
+ case "CharacterDevice":
635
+ case "BlockDevice":
636
+ case "Directory":
637
+ case "FIFO":
638
+ case "ContiguousFile":
639
+ case "GNUDumpDir": break;
640
+ case "NextFileHasLongLinkpath":
641
+ case "NextFileHasLongPath":
642
+ case "OldGnuLongPath":
643
+ case "GlobalExtendedHeader":
644
+ case "ExtendedHeader":
645
+ case "OldExtendedHeader":
646
+ this.meta = true;
647
+ break;
648
+ default: this.ignore = true;
649
+ }
650
+ this.path = s$8(t$7.path), this.mode = t$7.mode, this.mode && (this.mode = this.mode & 4095), this.uid = t$7.uid, this.gid = t$7.gid, this.uname = t$7.uname, this.gname = t$7.gname, this.size = t$7.size, this.mtime = t$7.mtime, this.atime = t$7.atime, this.ctime = t$7.ctime, this.linkpath = s$8(t$7.linkpath), this.uname = t$7.uname, this.gname = t$7.gname, e$7 && this[r](e$7), i$8 && this[r](i$8, true);
651
+ }
652
+ write(t$7) {
653
+ const e$7 = t$7.length;
654
+ if (e$7 > this.blockRemain) throw new Error("writing more to entry than is appropriate");
655
+ const i$8 = this.remain, c$5 = this.blockRemain;
656
+ return this.remain = Math.max(0, i$8 - e$7), this.blockRemain = Math.max(0, c$5 - e$7), this.ignore ? true : i$8 >= e$7 ? super.write(t$7) : super.write(t$7.slice(0, i$8));
657
+ }
658
+ [r](t$7, e$7) {
659
+ for (const i$8 in t$7) t$7[i$8] !== null && t$7[i$8] !== void 0 && !(e$7 && i$8 === "path") && (this[i$8] = i$8 === "path" || i$8 === "linkpath" ? s$8(t$7[i$8]) : t$7[i$8]);
660
+ }
661
+ }, n$2;
662
+ }
663
+ var r$2, a$5;
664
+ function f$2() {
665
+ if (a$5) return r$2;
666
+ a$5 = 1;
667
+ const c$5 = E(), d = path;
668
+ class h$1 {
669
+ constructor(e$7, n$4) {
670
+ this.atime = e$7.atime || null, this.charset = e$7.charset || null, this.comment = e$7.comment || null, this.ctime = e$7.ctime || null, this.gid = e$7.gid || null, this.gname = e$7.gname || null, this.linkpath = e$7.linkpath || null, this.mtime = e$7.mtime || null, this.path = e$7.path || null, this.size = e$7.size || null, this.uid = e$7.uid || null, this.uname = e$7.uname || null, this.dev = e$7.dev || null, this.ino = e$7.ino || null, this.nlink = e$7.nlink || null, this.global = n$4 || false;
671
+ }
672
+ encode() {
673
+ const e$7 = this.encodeBody();
674
+ if (e$7 === "") return null;
675
+ const n$4 = Buffer.byteLength(e$7), l$2 = 512 * Math.ceil(1 + n$4 / 512), i$8 = Buffer.allocUnsafe(l$2);
676
+ for (let t$7 = 0; t$7 < 512; t$7++) i$8[t$7] = 0;
677
+ new c$5({
678
+ path: ("PaxHeader/" + d.basename(this.path)).slice(0, 99),
679
+ mode: this.mode || 420,
680
+ uid: this.uid || null,
681
+ gid: this.gid || null,
682
+ size: n$4,
683
+ mtime: this.mtime || null,
684
+ type: this.global ? "GlobalExtendedHeader" : "ExtendedHeader",
685
+ linkpath: "",
686
+ uname: this.uname || "",
687
+ gname: this.gname || "",
688
+ devmaj: 0,
689
+ devmin: 0,
690
+ atime: this.atime || null,
691
+ ctime: this.ctime || null
692
+ }).encode(i$8), i$8.write(e$7, 512, n$4, "utf8");
693
+ for (let t$7 = n$4 + 512; t$7 < i$8.length; t$7++) i$8[t$7] = 0;
694
+ return i$8;
695
+ }
696
+ encodeBody() {
697
+ 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");
698
+ }
699
+ encodeField(e$7) {
700
+ if (this[e$7] === null || this[e$7] === void 0) return "";
701
+ const n$4 = this[e$7] instanceof Date ? this[e$7].getTime() / 1e3 : this[e$7], l$2 = " " + (e$7 === "dev" || e$7 === "ino" || e$7 === "nlink" ? "SCHILY." : "") + e$7 + "=" + n$4 + `
702
+ `, i$8 = Buffer.byteLength(l$2);
703
+ let t$7 = Math.floor(Math.log(i$8) / Math.log(10)) + 1;
704
+ return i$8 + t$7 >= Math.pow(10, t$7) && (t$7 += 1), t$7 + i$8 + l$2;
705
+ }
706
+ }
707
+ h$1.parse = (s$8, e$7, n$4) => new h$1(o$6(u$5(s$8), e$7), n$4);
708
+ const o$6 = (s$8, e$7) => e$7 ? Object.keys(s$8).reduce((n$4, l$2) => (n$4[l$2] = s$8[l$2], n$4), e$7) : s$8, u$5 = (s$8) => s$8.replace(/\n$/, "").split(`
709
+ `).reduce(m$3, Object.create(null)), m$3 = (s$8, e$7) => {
710
+ const n$4 = parseInt(e$7, 10);
711
+ if (n$4 !== Buffer.byteLength(e$7) + 1) return s$8;
712
+ e$7 = e$7.slice((n$4 + " ").length);
713
+ const l$2 = e$7.split("="), i$8 = l$2.shift().replace(/^SCHILY\.(dev|ino|nlink)/, "$1");
714
+ if (!i$8) return s$8;
715
+ const t$7 = l$2.join("=");
716
+ return s$8[i$8] = /^([A-Z]+\.)?([mac]|birth|creation)time$/.test(i$8) ? /* @__PURE__ */ new Date(t$7 * 1e3) : /^[0-9]+$/.test(t$7) ? +t$7 : t$7, s$8;
717
+ };
718
+ return r$2 = h$1, r$2;
719
+ }
720
+ var i$3 = {};
721
+ var _, R$1;
722
+ function T() {
723
+ if (R$1) return _;
724
+ R$1 = 1;
725
+ const E$1 = O$2.constants || { ZLIB_VERNUM: 4736 };
726
+ return _ = Object.freeze(Object.assign(Object.create(null), {
727
+ Z_NO_FLUSH: 0,
728
+ Z_PARTIAL_FLUSH: 1,
729
+ Z_SYNC_FLUSH: 2,
730
+ Z_FULL_FLUSH: 3,
731
+ Z_FINISH: 4,
732
+ Z_BLOCK: 5,
733
+ Z_OK: 0,
734
+ Z_STREAM_END: 1,
735
+ Z_NEED_DICT: 2,
736
+ Z_ERRNO: -1,
737
+ Z_STREAM_ERROR: -2,
738
+ Z_DATA_ERROR: -3,
739
+ Z_MEM_ERROR: -4,
740
+ Z_BUF_ERROR: -5,
741
+ Z_VERSION_ERROR: -6,
742
+ Z_NO_COMPRESSION: 0,
743
+ Z_BEST_SPEED: 1,
744
+ Z_BEST_COMPRESSION: 9,
745
+ Z_DEFAULT_COMPRESSION: -1,
746
+ Z_FILTERED: 1,
747
+ Z_HUFFMAN_ONLY: 2,
748
+ Z_RLE: 3,
749
+ Z_FIXED: 4,
750
+ Z_DEFAULT_STRATEGY: 0,
751
+ DEFLATE: 1,
752
+ INFLATE: 2,
753
+ GZIP: 3,
754
+ GUNZIP: 4,
755
+ DEFLATERAW: 5,
756
+ INFLATERAW: 6,
757
+ UNZIP: 7,
758
+ BROTLI_DECODE: 8,
759
+ BROTLI_ENCODE: 9,
760
+ Z_MIN_WINDOWBITS: 8,
761
+ Z_MAX_WINDOWBITS: 15,
762
+ Z_DEFAULT_WINDOWBITS: 15,
763
+ Z_MIN_CHUNK: 64,
764
+ Z_MAX_CHUNK: Infinity,
765
+ Z_DEFAULT_CHUNK: 16384,
766
+ Z_MIN_MEMLEVEL: 1,
767
+ Z_MAX_MEMLEVEL: 9,
768
+ Z_DEFAULT_MEMLEVEL: 8,
769
+ Z_MIN_LEVEL: -1,
770
+ Z_MAX_LEVEL: 9,
771
+ Z_DEFAULT_LEVEL: -1,
772
+ BROTLI_OPERATION_PROCESS: 0,
773
+ BROTLI_OPERATION_FLUSH: 1,
774
+ BROTLI_OPERATION_FINISH: 2,
775
+ BROTLI_OPERATION_EMIT_METADATA: 3,
776
+ BROTLI_MODE_GENERIC: 0,
777
+ BROTLI_MODE_TEXT: 1,
778
+ BROTLI_MODE_FONT: 2,
779
+ BROTLI_DEFAULT_MODE: 0,
780
+ BROTLI_MIN_QUALITY: 0,
781
+ BROTLI_MAX_QUALITY: 11,
782
+ BROTLI_DEFAULT_QUALITY: 11,
783
+ BROTLI_MIN_WINDOW_BITS: 10,
784
+ BROTLI_MAX_WINDOW_BITS: 24,
785
+ BROTLI_LARGE_MAX_WINDOW_BITS: 30,
786
+ BROTLI_DEFAULT_WINDOW: 22,
787
+ BROTLI_MIN_INPUT_BLOCK_BITS: 16,
788
+ BROTLI_MAX_INPUT_BLOCK_BITS: 24,
789
+ BROTLI_PARAM_MODE: 0,
790
+ BROTLI_PARAM_QUALITY: 1,
791
+ BROTLI_PARAM_LGWIN: 2,
792
+ BROTLI_PARAM_LGBLOCK: 3,
793
+ BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
794
+ BROTLI_PARAM_SIZE_HINT: 5,
795
+ BROTLI_PARAM_LARGE_WINDOW: 6,
796
+ BROTLI_PARAM_NPOSTFIX: 7,
797
+ BROTLI_PARAM_NDIRECT: 8,
798
+ BROTLI_DECODER_RESULT_ERROR: 0,
799
+ BROTLI_DECODER_RESULT_SUCCESS: 1,
800
+ BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
801
+ BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
802
+ BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
803
+ BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
804
+ BROTLI_DECODER_NO_ERROR: 0,
805
+ BROTLI_DECODER_SUCCESS: 1,
806
+ BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
807
+ BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
808
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
809
+ BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
810
+ BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
811
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
812
+ BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
813
+ BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
814
+ BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
815
+ BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
816
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
817
+ BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
818
+ BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
819
+ BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
820
+ BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
821
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
822
+ BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
823
+ BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
824
+ BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
825
+ BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
826
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
827
+ BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
828
+ BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
829
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
830
+ BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
831
+ BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
832
+ BROTLI_DECODER_ERROR_UNREACHABLE: -31
833
+ }, E$1)), _;
834
+ }
835
+ var j, H$1;
836
+ function tt() {
837
+ if (H$1) return j;
838
+ H$1 = 1;
839
+ const I = typeof process == "object" && process ? process : {
840
+ stdout: null,
841
+ stderr: null
842
+ }, Y = nt, x = ot, N = ht.StringDecoder, u$5 = Symbol("EOF"), a$11 = Symbol("maybeEmitEnd"), c$5 = Symbol("emittedEnd"), S$1 = Symbol("emittingEnd"), E$1 = Symbol("emittedError"), w$2 = Symbol("closed"), P$1 = Symbol("read"), L = Symbol("flush"), _$1 = Symbol("flushChunk"), h$1 = Symbol("encoding"), m$3 = Symbol("decoder"), M = Symbol("flowing"), y$3 = Symbol("paused"), p$1 = Symbol("resume"), s$8 = Symbol("bufferLength"), T$1 = Symbol("bufferPush"), B = Symbol("bufferShift"), r = Symbol("objectMode"), n$4 = Symbol("destroyed"), D = Symbol("emitData"), F$3 = Symbol("emitEnd"), R$2 = Symbol("emitEnd2"), d = Symbol("async"), b = (o$6) => Promise.resolve().then(o$6), C$1 = commonjsGlobal._MP_NO_ITERATOR_SYMBOLS_ !== "1", $ = C$1 && Symbol.asyncIterator || Symbol("asyncIterator not implemented"), G$1 = C$1 && Symbol.iterator || Symbol("iterator not implemented"), V = (o$6) => o$6 === "end" || o$6 === "finish" || o$6 === "prefinish", v$2 = (o$6) => o$6 instanceof ArrayBuffer || typeof o$6 == "object" && o$6.constructor && o$6.constructor.name === "ArrayBuffer" && o$6.byteLength >= 0, J$1 = (o$6) => !Buffer.isBuffer(o$6) && ArrayBuffer.isView(o$6);
843
+ class U {
844
+ constructor(t$7, e$7, i$8) {
845
+ this.src = t$7, this.dest = e$7, this.opts = i$8, this.ondrain = () => t$7[p$1](), e$7.on("drain", this.ondrain);
846
+ }
847
+ unpipe() {
848
+ this.dest.removeListener("drain", this.ondrain);
849
+ }
850
+ proxyErrors() {}
851
+ end() {
852
+ this.unpipe(), this.opts.end && this.dest.end();
853
+ }
854
+ }
855
+ class K extends U {
856
+ unpipe() {
857
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
858
+ }
859
+ constructor(t$7, e$7, i$8) {
860
+ super(t$7, e$7, i$8), this.proxyErrors = (l$2) => e$7.emit("error", l$2), t$7.on("error", this.proxyErrors);
861
+ }
862
+ }
863
+ return j = class q$1 extends x {
864
+ constructor(t$7) {
865
+ super(), this[M] = false, this[y$3] = false, this.pipes = [], this.buffer = [], this[r] = t$7 && t$7.objectMode || false, this[r] ? this[h$1] = null : this[h$1] = t$7 && t$7.encoding || null, this[h$1] === "buffer" && (this[h$1] = null), this[d] = t$7 && !!t$7.async || false, this[m$3] = this[h$1] ? new N(this[h$1]) : null, this[u$5] = false, this[c$5] = false, this[S$1] = false, this[w$2] = false, this[E$1] = null, this.writable = true, this.readable = true, this[s$8] = 0, this[n$4] = false;
866
+ }
867
+ get bufferLength() {
868
+ return this[s$8];
869
+ }
870
+ get encoding() {
871
+ return this[h$1];
872
+ }
873
+ set encoding(t$7) {
874
+ if (this[r]) throw new Error("cannot set encoding in objectMode");
875
+ if (this[h$1] && t$7 !== this[h$1] && (this[m$3] && this[m$3].lastNeed || this[s$8])) throw new Error("cannot change encoding");
876
+ this[h$1] !== t$7 && (this[m$3] = t$7 ? new N(t$7) : null, this.buffer.length && (this.buffer = this.buffer.map((e$7) => this[m$3].write(e$7)))), this[h$1] = t$7;
877
+ }
878
+ setEncoding(t$7) {
879
+ this.encoding = t$7;
880
+ }
881
+ get objectMode() {
882
+ return this[r];
883
+ }
884
+ set objectMode(t$7) {
885
+ this[r] = this[r] || !!t$7;
886
+ }
887
+ get async() {
888
+ return this[d];
889
+ }
890
+ set async(t$7) {
891
+ this[d] = this[d] || !!t$7;
892
+ }
893
+ write(t$7, e$7, i$8) {
894
+ if (this[u$5]) throw new Error("write after end");
895
+ if (this[n$4]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
896
+ typeof e$7 == "function" && (i$8 = e$7, e$7 = "utf8"), e$7 || (e$7 = "utf8");
897
+ const l$2 = this[d] ? b : (f$4) => f$4();
898
+ return !this[r] && !Buffer.isBuffer(t$7) && (J$1(t$7) ? t$7 = Buffer.from(t$7.buffer, t$7.byteOffset, t$7.byteLength) : v$2(t$7) ? t$7 = Buffer.from(t$7) : typeof t$7 != "string" && (this.objectMode = true)), this[r] ? (this.flowing && this[s$8] !== 0 && this[L](true), this.flowing ? this.emit("data", t$7) : this[T$1](t$7), this[s$8] !== 0 && this.emit("readable"), i$8 && l$2(i$8), this.flowing) : t$7.length ? (typeof t$7 == "string" && !(e$7 === this[h$1] && !this[m$3].lastNeed) && (t$7 = Buffer.from(t$7, e$7)), Buffer.isBuffer(t$7) && this[h$1] && (t$7 = this[m$3].write(t$7)), this.flowing && this[s$8] !== 0 && this[L](true), this.flowing ? this.emit("data", t$7) : this[T$1](t$7), this[s$8] !== 0 && this.emit("readable"), i$8 && l$2(i$8), this.flowing) : (this[s$8] !== 0 && this.emit("readable"), i$8 && l$2(i$8), this.flowing);
899
+ }
900
+ read(t$7) {
901
+ if (this[n$4]) return null;
902
+ if (this[s$8] === 0 || t$7 === 0 || t$7 > this[s$8]) return this[a$11](), null;
903
+ this[r] && (t$7 = null), this.buffer.length > 1 && !this[r] && (this.encoding ? this.buffer = [this.buffer.join("")] : this.buffer = [Buffer.concat(this.buffer, this[s$8])]);
904
+ const e$7 = this[P$1](t$7 || null, this.buffer[0]);
905
+ return this[a$11](), e$7;
906
+ }
907
+ [P$1](t$7, e$7) {
908
+ return t$7 === e$7.length || t$7 === null ? this[B]() : (this.buffer[0] = e$7.slice(t$7), e$7 = e$7.slice(0, t$7), this[s$8] -= t$7), this.emit("data", e$7), !this.buffer.length && !this[u$5] && this.emit("drain"), e$7;
909
+ }
910
+ end(t$7, e$7, i$8) {
911
+ return typeof t$7 == "function" && (i$8 = t$7, t$7 = null), typeof e$7 == "function" && (i$8 = e$7, e$7 = "utf8"), t$7 && this.write(t$7, e$7), i$8 && this.once("end", i$8), this[u$5] = true, this.writable = false, (this.flowing || !this[y$3]) && this[a$11](), this;
912
+ }
913
+ [p$1]() {
914
+ this[n$4] || (this[y$3] = false, this[M] = true, this.emit("resume"), this.buffer.length ? this[L]() : this[u$5] ? this[a$11]() : this.emit("drain"));
915
+ }
916
+ resume() {
917
+ return this[p$1]();
918
+ }
919
+ pause() {
920
+ this[M] = false, this[y$3] = true;
921
+ }
922
+ get destroyed() {
923
+ return this[n$4];
924
+ }
925
+ get flowing() {
926
+ return this[M];
927
+ }
928
+ get paused() {
929
+ return this[y$3];
930
+ }
931
+ [T$1](t$7) {
932
+ this[r] ? this[s$8] += 1 : this[s$8] += t$7.length, this.buffer.push(t$7);
933
+ }
934
+ [B]() {
935
+ return this.buffer.length && (this[r] ? this[s$8] -= 1 : this[s$8] -= this.buffer[0].length), this.buffer.shift();
936
+ }
937
+ [L](t$7) {
938
+ do ;
939
+ while (this[_$1](this[B]()));
940
+ !t$7 && !this.buffer.length && !this[u$5] && this.emit("drain");
941
+ }
942
+ [_$1](t$7) {
943
+ return t$7 ? (this.emit("data", t$7), this.flowing) : false;
944
+ }
945
+ pipe(t$7, e$7) {
946
+ if (this[n$4]) return;
947
+ const i$8 = this[c$5];
948
+ return e$7 = e$7 || {}, t$7 === I.stdout || t$7 === I.stderr ? e$7.end = false : e$7.end = e$7.end !== false, e$7.proxyErrors = !!e$7.proxyErrors, i$8 ? e$7.end && t$7.end() : (this.pipes.push(e$7.proxyErrors ? new K(this, t$7, e$7) : new U(this, t$7, e$7)), this[d] ? b(() => this[p$1]()) : this[p$1]()), t$7;
949
+ }
950
+ unpipe(t$7) {
951
+ const e$7 = this.pipes.find((i$8) => i$8.dest === t$7);
952
+ e$7 && (this.pipes.splice(this.pipes.indexOf(e$7), 1), e$7.unpipe());
953
+ }
954
+ addListener(t$7, e$7) {
955
+ return this.on(t$7, e$7);
956
+ }
957
+ on(t$7, e$7) {
958
+ const i$8 = super.on(t$7, e$7);
959
+ return t$7 === "data" && !this.pipes.length && !this.flowing ? this[p$1]() : t$7 === "readable" && this[s$8] !== 0 ? super.emit("readable") : V(t$7) && this[c$5] ? (super.emit(t$7), this.removeAllListeners(t$7)) : t$7 === "error" && this[E$1] && (this[d] ? b(() => e$7.call(this, this[E$1])) : e$7.call(this, this[E$1])), i$8;
960
+ }
961
+ get emittedEnd() {
962
+ return this[c$5];
963
+ }
964
+ [a$11]() {
965
+ !this[S$1] && !this[c$5] && !this[n$4] && this.buffer.length === 0 && this[u$5] && (this[S$1] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[w$2] && this.emit("close"), this[S$1] = false);
966
+ }
967
+ emit(t$7, e$7, ...i$8) {
968
+ if (t$7 !== "error" && t$7 !== "close" && t$7 !== n$4 && this[n$4]) return;
969
+ if (t$7 === "data") return e$7 ? this[d] ? b(() => this[D](e$7)) : this[D](e$7) : false;
970
+ if (t$7 === "end") return this[F$3]();
971
+ if (t$7 === "close") {
972
+ if (this[w$2] = true, !this[c$5] && !this[n$4]) return;
973
+ const f$4 = super.emit("close");
974
+ return this.removeAllListeners("close"), f$4;
975
+ } else if (t$7 === "error") {
976
+ this[E$1] = e$7;
977
+ const f$4 = super.emit("error", e$7);
978
+ return this[a$11](), f$4;
979
+ } else if (t$7 === "resume") {
980
+ const f$4 = super.emit("resume");
981
+ return this[a$11](), f$4;
982
+ } else if (t$7 === "finish" || t$7 === "prefinish") {
983
+ const f$4 = super.emit(t$7);
984
+ return this.removeAllListeners(t$7), f$4;
985
+ }
986
+ const l$2 = super.emit(t$7, e$7, ...i$8);
987
+ return this[a$11](), l$2;
988
+ }
989
+ [D](t$7) {
990
+ for (const i$8 of this.pipes) i$8.dest.write(t$7) === false && this.pause();
991
+ const e$7 = super.emit("data", t$7);
992
+ return this[a$11](), e$7;
993
+ }
994
+ [F$3]() {
995
+ this[c$5] || (this[c$5] = true, this.readable = false, this[d] ? b(() => this[R$2]()) : this[R$2]());
996
+ }
997
+ [R$2]() {
998
+ if (this[m$3]) {
999
+ const e$7 = this[m$3].end();
1000
+ if (e$7) {
1001
+ for (const i$8 of this.pipes) i$8.dest.write(e$7);
1002
+ super.emit("data", e$7);
1003
+ }
1004
+ }
1005
+ for (const e$7 of this.pipes) e$7.end();
1006
+ const t$7 = super.emit("end");
1007
+ return this.removeAllListeners("end"), t$7;
1008
+ }
1009
+ collect() {
1010
+ const t$7 = [];
1011
+ this[r] || (t$7.dataLength = 0);
1012
+ const e$7 = this.promise();
1013
+ return this.on("data", (i$8) => {
1014
+ t$7.push(i$8), this[r] || (t$7.dataLength += i$8.length);
1015
+ }), e$7.then(() => t$7);
1016
+ }
1017
+ concat() {
1018
+ return this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this.collect().then((t$7) => this[r] ? Promise.reject(/* @__PURE__ */ new Error("cannot concat in objectMode")) : this[h$1] ? t$7.join("") : Buffer.concat(t$7, t$7.dataLength));
1019
+ }
1020
+ promise() {
1021
+ return new Promise((t$7, e$7) => {
1022
+ this.on(n$4, () => e$7(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (i$8) => e$7(i$8)), this.on("end", () => t$7());
1023
+ });
1024
+ }
1025
+ [$]() {
1026
+ return { next: () => {
1027
+ const e$7 = this.read();
1028
+ if (e$7 !== null) return Promise.resolve({
1029
+ done: false,
1030
+ value: e$7
1031
+ });
1032
+ if (this[u$5]) return Promise.resolve({ done: true });
1033
+ let i$8 = null, l$2 = null;
1034
+ const f$4 = (g) => {
1035
+ this.removeListener("data", A), this.removeListener("end", O$3), l$2(g);
1036
+ }, A = (g) => {
1037
+ this.removeListener("error", f$4), this.removeListener("end", O$3), this.pause(), i$8({
1038
+ value: g,
1039
+ done: !!this[u$5]
1040
+ });
1041
+ }, O$3 = () => {
1042
+ this.removeListener("error", f$4), this.removeListener("data", A), i$8({ done: true });
1043
+ }, W = () => f$4(/* @__PURE__ */ new Error("stream destroyed"));
1044
+ return new Promise((g, z$1) => {
1045
+ l$2 = z$1, i$8 = g, this.once(n$4, W), this.once("error", f$4), this.once("end", O$3), this.once("data", A);
1046
+ });
1047
+ } };
1048
+ }
1049
+ [G$1]() {
1050
+ return { next: () => {
1051
+ const e$7 = this.read();
1052
+ return {
1053
+ value: e$7,
1054
+ done: e$7 === null
1055
+ };
1056
+ } };
1057
+ }
1058
+ destroy(t$7) {
1059
+ return this[n$4] ? (t$7 ? this.emit("error", t$7) : this.emit(n$4), this) : (this[n$4] = true, this.buffer.length = 0, this[s$8] = 0, typeof this.close == "function" && !this[w$2] && this.close(), t$7 ? this.emit("error", t$7) : this.emit(n$4), this);
1060
+ }
1061
+ static isStream(t$7) {
1062
+ return !!t$7 && (t$7 instanceof q$1 || t$7 instanceof x || t$7 instanceof Y && (typeof t$7.pipe == "function" || typeof t$7.write == "function" && typeof t$7.end == "function"));
1063
+ }
1064
+ }, j;
1065
+ }
1066
+ var C;
1067
+ function J() {
1068
+ if (C) return i$3;
1069
+ C = 1;
1070
+ const w$2 = j$1, n$4 = P.Buffer, z$1 = O$2, u$5 = i$3.constants = T(), L = tt(), E$1 = n$4.concat, c$5 = Symbol("_superWrite");
1071
+ class d extends Error {
1072
+ constructor(s$8) {
1073
+ super("zlib: " + s$8.message), this.code = s$8.code, this.errno = s$8.errno, this.code || (this.code = "ZLIB_ERROR"), this.message = "zlib: " + s$8.message, Error.captureStackTrace(this, this.constructor);
1074
+ }
1075
+ get name() {
1076
+ return "ZlibError";
1077
+ }
1078
+ }
1079
+ const Z = Symbol("opts"), p$1 = Symbol("flushFlag"), I = Symbol("finishFlushFlag"), y$3 = Symbol("fullFlushFlag"), t$7 = Symbol("handle"), _$1 = Symbol("onError"), f$4 = Symbol("sawError"), F$3 = Symbol("level"), S$1 = Symbol("strategy"), g = Symbol("ended");
1080
+ class x extends L {
1081
+ constructor(s$8, e$7) {
1082
+ if (!s$8 || typeof s$8 != "object") throw new TypeError("invalid options for ZlibBase constructor");
1083
+ super(s$8), this[f$4] = false, this[g] = false, this[Z] = s$8, this[p$1] = s$8.flush, this[I] = s$8.finishFlush;
1084
+ try {
1085
+ this[t$7] = new z$1[e$7](s$8);
1086
+ } catch (i$8) {
1087
+ throw new d(i$8);
1088
+ }
1089
+ this[_$1] = (i$8) => {
1090
+ this[f$4] || (this[f$4] = true, this.close(), this.emit("error", i$8));
1091
+ }, this[t$7].on("error", (i$8) => this[_$1](new d(i$8))), this.once("end", () => this.close);
1092
+ }
1093
+ close() {
1094
+ this[t$7] && (this[t$7].close(), this[t$7] = null, this.emit("close"));
1095
+ }
1096
+ reset() {
1097
+ if (!this[f$4]) return w$2(this[t$7], "zlib binding closed"), this[t$7].reset();
1098
+ }
1099
+ flush(s$8) {
1100
+ this.ended || (typeof s$8 != "number" && (s$8 = this[y$3]), this.write(Object.assign(n$4.alloc(0), { [p$1]: s$8 })));
1101
+ }
1102
+ end(s$8, e$7, i$8) {
1103
+ return s$8 && this.write(s$8, e$7), this.flush(this[I]), this[g] = true, super.end(null, null, i$8);
1104
+ }
1105
+ get ended() {
1106
+ return this[g];
1107
+ }
1108
+ write(s$8, e$7, i$8) {
1109
+ if (typeof e$7 == "function" && (i$8 = e$7, e$7 = "utf8"), typeof s$8 == "string" && (s$8 = n$4.from(s$8, e$7)), this[f$4]) return;
1110
+ w$2(this[t$7], "zlib binding closed");
1111
+ const m$3 = this[t$7]._handle, R$2 = m$3.close;
1112
+ m$3.close = () => {};
1113
+ const G$1 = this[t$7].close;
1114
+ this[t$7].close = () => {}, n$4.concat = (l$2) => l$2;
1115
+ let h$1;
1116
+ try {
1117
+ const l$2 = typeof s$8[p$1] == "number" ? s$8[p$1] : this[p$1];
1118
+ h$1 = this[t$7]._processChunk(s$8, l$2), n$4.concat = E$1;
1119
+ } catch (l$2) {
1120
+ n$4.concat = E$1, this[_$1](new d(l$2));
1121
+ } finally {
1122
+ this[t$7] && (this[t$7]._handle = m$3, m$3.close = R$2, this[t$7].close = G$1, this[t$7].removeAllListeners("error"));
1123
+ }
1124
+ this[t$7] && this[t$7].on("error", (l$2) => this[_$1](new d(l$2)));
1125
+ let b;
1126
+ if (h$1) if (Array.isArray(h$1) && h$1.length > 0) {
1127
+ b = this[c$5](n$4.from(h$1[0]));
1128
+ for (let l$2 = 1; l$2 < h$1.length; l$2++) b = this[c$5](h$1[l$2]);
1129
+ } else b = this[c$5](n$4.from(h$1));
1130
+ return i$8 && i$8(), b;
1131
+ }
1132
+ [c$5](s$8) {
1133
+ return super.write(s$8);
1134
+ }
1135
+ }
1136
+ class a$11 extends x {
1137
+ constructor(s$8, e$7) {
1138
+ s$8 = s$8 || {}, s$8.flush = s$8.flush || u$5.Z_NO_FLUSH, s$8.finishFlush = s$8.finishFlush || u$5.Z_FINISH, super(s$8, e$7), this[y$3] = u$5.Z_FULL_FLUSH, this[F$3] = s$8.level, this[S$1] = s$8.strategy;
1139
+ }
1140
+ params(s$8, e$7) {
1141
+ if (!this[f$4]) {
1142
+ if (!this[t$7]) throw new Error("cannot switch params when binding is closed");
1143
+ if (!this[t$7].params) throw new Error("not supported in this implementation");
1144
+ if (this[F$3] !== s$8 || this[S$1] !== e$7) {
1145
+ this.flush(u$5.Z_SYNC_FLUSH), w$2(this[t$7], "zlib binding closed");
1146
+ const i$8 = this[t$7].flush;
1147
+ this[t$7].flush = (m$3, R$2) => {
1148
+ this.flush(m$3), R$2();
1149
+ };
1150
+ try {
1151
+ this[t$7].params(s$8, e$7);
1152
+ } finally {
1153
+ this[t$7].flush = i$8;
1154
+ }
1155
+ this[t$7] && (this[F$3] = s$8, this[S$1] = e$7);
1156
+ }
1157
+ }
1158
+ }
1159
+ }
1160
+ class q$1 extends a$11 {
1161
+ constructor(s$8) {
1162
+ super(s$8, "Deflate");
1163
+ }
1164
+ }
1165
+ class D extends a$11 {
1166
+ constructor(s$8) {
1167
+ super(s$8, "Inflate");
1168
+ }
1169
+ }
1170
+ const B = Symbol("_portable");
1171
+ class $ extends a$11 {
1172
+ constructor(s$8) {
1173
+ super(s$8, "Gzip"), this[B] = s$8 && !!s$8.portable;
1174
+ }
1175
+ [c$5](s$8) {
1176
+ return this[B] ? (this[B] = false, s$8[9] = 255, super[c$5](s$8)) : super[c$5](s$8);
1177
+ }
1178
+ }
1179
+ class N extends a$11 {
1180
+ constructor(s$8) {
1181
+ super(s$8, "Gunzip");
1182
+ }
1183
+ }
1184
+ class H$2 extends a$11 {
1185
+ constructor(s$8) {
1186
+ super(s$8, "DeflateRaw");
1187
+ }
1188
+ }
1189
+ let T$1 = class T$2 extends a$11 {
1190
+ constructor(s$8) {
1191
+ super(s$8, "InflateRaw");
1192
+ }
1193
+ };
1194
+ class U extends a$11 {
1195
+ constructor(s$8) {
1196
+ super(s$8, "Unzip");
1197
+ }
1198
+ }
1199
+ class O$3 extends x {
1200
+ constructor(s$8, e$7) {
1201
+ s$8 = s$8 || {}, s$8.flush = s$8.flush || u$5.BROTLI_OPERATION_PROCESS, s$8.finishFlush = s$8.finishFlush || u$5.BROTLI_OPERATION_FINISH, super(s$8, e$7), this[y$3] = u$5.BROTLI_OPERATION_FLUSH;
1202
+ }
1203
+ }
1204
+ class v$2 extends O$3 {
1205
+ constructor(s$8) {
1206
+ super(s$8, "BrotliCompress");
1207
+ }
1208
+ }
1209
+ class A extends O$3 {
1210
+ constructor(s$8) {
1211
+ super(s$8, "BrotliDecompress");
1212
+ }
1213
+ }
1214
+ return i$3.Deflate = q$1, i$3.Inflate = D, i$3.Gzip = $, i$3.Gunzip = N, i$3.DeflateRaw = H$2, i$3.InflateRaw = T$1, i$3.Unzip = U, typeof z$1.BrotliCompress == "function" ? (i$3.BrotliCompress = v$2, i$3.BrotliDecompress = A) : i$3.BrotliCompress = i$3.BrotliDecompress = class {
1215
+ constructor() {
1216
+ throw new Error("Brotli is not supported in this version of Node.js");
1217
+ }
1218
+ }, i$3;
1219
+ }
1220
+ var O$1, F$2;
1221
+ function rt() {
1222
+ if (F$2) return O$1;
1223
+ F$2 = 1;
1224
+ const P$1 = c$4(), $ = E(), v$2 = nt, W = c$3(), G$1 = 1024 * 1024, k$1 = u$3(), C$1 = f$2(), x = J(), { nextTick: j$2 } = nt$1, B = Buffer.from([31, 139]), h$1 = Symbol("state"), d = Symbol("writeEntry"), a$11 = Symbol("readEntry"), I = Symbol("nextEntry"), U = Symbol("processEntry"), l$2 = Symbol("extendedHeader"), y$3 = Symbol("globalExtendedHeader"), c$5 = Symbol("meta"), H$2 = Symbol("emitMeta"), n$4 = Symbol("buffer"), f$4 = Symbol("queue"), u$5 = Symbol("ended"), L = Symbol("emittedEnd"), b = Symbol("emit"), r = Symbol("unzip"), _$1 = Symbol("consumeChunk"), g = Symbol("consumeChunkSub"), q$1 = Symbol("consumeBody"), z$1 = Symbol("consumeMeta"), Y = Symbol("consumeHeader"), N = Symbol("consuming"), D = Symbol("bufferConcat"), M = Symbol("maybeEnd"), S$1 = Symbol("writing"), m$3 = Symbol("aborted"), T$1 = Symbol("onDone"), E$1 = Symbol("sawValidEntry"), R$2 = Symbol("sawNullBlock"), A = Symbol("sawEOF"), V = Symbol("closeStream"), K = (X$2) => true;
1225
+ return O$1 = P$1(class extends v$2 {
1226
+ constructor(t$7) {
1227
+ t$7 = t$7 || {}, super(t$7), this.file = t$7.file || "", this[E$1] = null, this.on(T$1, (s$8) => {
1228
+ (this[h$1] === "begin" || this[E$1] === false) && this.warn("TAR_BAD_ARCHIVE", "Unrecognized archive format");
1229
+ }), t$7.ondone ? this.on(T$1, t$7.ondone) : this.on(T$1, (s$8) => {
1230
+ this.emit("prefinish"), this.emit("finish"), this.emit("end");
1231
+ }), this.strict = !!t$7.strict, this.maxMetaEntrySize = t$7.maxMetaEntrySize || G$1, this.filter = typeof t$7.filter == "function" ? t$7.filter : K;
1232
+ const i$8 = t$7.file && (t$7.file.endsWith(".tar.br") || t$7.file.endsWith(".tbr"));
1233
+ this.brotli = !t$7.gzip && t$7.brotli !== void 0 ? t$7.brotli : i$8 ? void 0 : false, this.writable = true, this.readable = false, this[f$4] = new W(), this[n$4] = null, this[a$11] = null, this[d] = null, this[h$1] = "begin", this[c$5] = "", this[l$2] = null, this[y$3] = null, this[u$5] = false, this[r] = null, this[m$3] = false, this[R$2] = false, this[A] = false, this.on("end", () => this[V]()), typeof t$7.onwarn == "function" && this.on("warn", t$7.onwarn), typeof t$7.onentry == "function" && this.on("entry", t$7.onentry);
1234
+ }
1235
+ [Y](t$7, i$8) {
1236
+ this[E$1] === null && (this[E$1] = false);
1237
+ let s$8;
1238
+ try {
1239
+ s$8 = new $(t$7, i$8, this[l$2], this[y$3]);
1240
+ } catch (o$6) {
1241
+ return this.warn("TAR_ENTRY_INVALID", o$6);
1242
+ }
1243
+ if (s$8.nullBlock) this[R$2] ? (this[A] = true, this[h$1] === "begin" && (this[h$1] = "header"), this[b]("eof")) : (this[R$2] = true, this[b]("nullBlock"));
1244
+ else if (this[R$2] = false, !s$8.cksumValid) this.warn("TAR_ENTRY_INVALID", "checksum failure", { header: s$8 });
1245
+ else if (!s$8.path) this.warn("TAR_ENTRY_INVALID", "path is required", { header: s$8 });
1246
+ else {
1247
+ const o$6 = s$8.type;
1248
+ if (/^(Symbolic)?Link$/.test(o$6) && !s$8.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath required", { header: s$8 });
1249
+ else if (!/^(Symbolic)?Link$/.test(o$6) && s$8.linkpath) this.warn("TAR_ENTRY_INVALID", "linkpath forbidden", { header: s$8 });
1250
+ else {
1251
+ const e$7 = this[d] = new k$1(s$8, this[l$2], this[y$3]);
1252
+ if (!this[E$1]) if (e$7.remain) {
1253
+ const w$2 = () => {
1254
+ e$7.invalid || (this[E$1] = true);
1255
+ };
1256
+ e$7.on("end", w$2);
1257
+ } else this[E$1] = true;
1258
+ e$7.meta ? e$7.size > this.maxMetaEntrySize ? (e$7.ignore = true, this[b]("ignoredEntry", e$7), this[h$1] = "ignore", e$7.resume()) : e$7.size > 0 && (this[c$5] = "", e$7.on("data", (w$2) => this[c$5] += w$2), this[h$1] = "meta") : (this[l$2] = null, e$7.ignore = e$7.ignore || !this.filter(e$7.path, e$7), e$7.ignore ? (this[b]("ignoredEntry", e$7), this[h$1] = e$7.remain ? "ignore" : "header", e$7.resume()) : (e$7.remain ? this[h$1] = "body" : (this[h$1] = "header", e$7.end()), this[a$11] ? this[f$4].push(e$7) : (this[f$4].push(e$7), this[I]())));
1259
+ }
1260
+ }
1261
+ }
1262
+ [V]() {
1263
+ j$2(() => this.emit("close"));
1264
+ }
1265
+ [U](t$7) {
1266
+ let i$8 = true;
1267
+ return t$7 ? Array.isArray(t$7) ? this.emit.apply(this, t$7) : (this[a$11] = t$7, this.emit("entry", t$7), t$7.emittedEnd || (t$7.on("end", (s$8) => this[I]()), i$8 = false)) : (this[a$11] = null, i$8 = false), i$8;
1268
+ }
1269
+ [I]() {
1270
+ do ;
1271
+ while (this[U](this[f$4].shift()));
1272
+ if (!this[f$4].length) {
1273
+ const t$7 = this[a$11];
1274
+ !t$7 || t$7.flowing || t$7.size === t$7.remain ? this[S$1] || this.emit("drain") : t$7.once("drain", (s$8) => this.emit("drain"));
1275
+ }
1276
+ }
1277
+ [q$1](t$7, i$8) {
1278
+ const s$8 = this[d], o$6 = s$8.blockRemain, e$7 = o$6 >= t$7.length && i$8 === 0 ? t$7 : t$7.slice(i$8, i$8 + o$6);
1279
+ return s$8.write(e$7), s$8.blockRemain || (this[h$1] = "header", this[d] = null, s$8.end()), e$7.length;
1280
+ }
1281
+ [z$1](t$7, i$8) {
1282
+ const s$8 = this[d], o$6 = this[q$1](t$7, i$8);
1283
+ return this[d] || this[H$2](s$8), o$6;
1284
+ }
1285
+ [b](t$7, i$8, s$8) {
1286
+ !this[f$4].length && !this[a$11] ? this.emit(t$7, i$8, s$8) : this[f$4].push([
1287
+ t$7,
1288
+ i$8,
1289
+ s$8
1290
+ ]);
1291
+ }
1292
+ [H$2](t$7) {
1293
+ switch (this[b]("meta", this[c$5]), t$7.type) {
1294
+ case "ExtendedHeader":
1295
+ case "OldExtendedHeader":
1296
+ this[l$2] = C$1.parse(this[c$5], this[l$2], false);
1297
+ break;
1298
+ case "GlobalExtendedHeader":
1299
+ this[y$3] = C$1.parse(this[c$5], this[y$3], true);
1300
+ break;
1301
+ case "NextFileHasLongPath":
1302
+ case "OldGnuLongPath":
1303
+ this[l$2] = this[l$2] || Object.create(null), this[l$2].path = this[c$5].replace(/\0.*/, "");
1304
+ break;
1305
+ case "NextFileHasLongLinkpath":
1306
+ this[l$2] = this[l$2] || Object.create(null), this[l$2].linkpath = this[c$5].replace(/\0.*/, "");
1307
+ break;
1308
+ default: throw new Error("unknown meta: " + t$7.type);
1309
+ }
1310
+ }
1311
+ abort(t$7) {
1312
+ this[m$3] = true, this.emit("abort", t$7), this.warn("TAR_ABORT", t$7, { recoverable: false });
1313
+ }
1314
+ write(t$7) {
1315
+ if (this[m$3]) return;
1316
+ if ((this[r] === null || this.brotli === void 0 && this[r] === false) && t$7) {
1317
+ if (this[n$4] && (t$7 = Buffer.concat([this[n$4], t$7]), this[n$4] = null), t$7.length < B.length) return this[n$4] = t$7, true;
1318
+ for (let e$7 = 0; this[r] === null && e$7 < B.length; e$7++) t$7[e$7] !== B[e$7] && (this[r] = false);
1319
+ const o$6 = this.brotli === void 0;
1320
+ if (this[r] === false && o$6) if (t$7.length < 512) if (this[u$5]) this.brotli = true;
1321
+ else return this[n$4] = t$7, true;
1322
+ else try {
1323
+ new $(t$7.slice(0, 512)), this.brotli = !1;
1324
+ } catch {
1325
+ this.brotli = true;
1326
+ }
1327
+ if (this[r] === null || this[r] === false && this.brotli) {
1328
+ const e$7 = this[u$5];
1329
+ this[u$5] = false, this[r] = this[r] === null ? new x.Unzip() : new x.BrotliDecompress(), this[r].on("data", (p$1) => this[_$1](p$1)), this[r].on("error", (p$1) => this.abort(p$1)), this[r].on("end", (p$1) => {
1330
+ this[u$5] = true, this[_$1]();
1331
+ }), this[S$1] = true;
1332
+ const w$2 = this[r][e$7 ? "end" : "write"](t$7);
1333
+ return this[S$1] = false, w$2;
1334
+ }
1335
+ }
1336
+ this[S$1] = true, this[r] ? this[r].write(t$7) : this[_$1](t$7), this[S$1] = false;
1337
+ const s$8 = this[f$4].length ? false : this[a$11] ? this[a$11].flowing : true;
1338
+ return !s$8 && !this[f$4].length && this[a$11].once("drain", (o$6) => this.emit("drain")), s$8;
1339
+ }
1340
+ [D](t$7) {
1341
+ t$7 && !this[m$3] && (this[n$4] = this[n$4] ? Buffer.concat([this[n$4], t$7]) : t$7);
1342
+ }
1343
+ [M]() {
1344
+ if (this[u$5] && !this[L] && !this[m$3] && !this[N]) {
1345
+ this[L] = true;
1346
+ const t$7 = this[d];
1347
+ if (t$7 && t$7.blockRemain) {
1348
+ const i$8 = this[n$4] ? this[n$4].length : 0;
1349
+ this.warn("TAR_BAD_ARCHIVE", `Truncated input (needed ${t$7.blockRemain} more bytes, only ${i$8} available)`, { entry: t$7 }), this[n$4] && t$7.write(this[n$4]), t$7.end();
1350
+ }
1351
+ this[b](T$1);
1352
+ }
1353
+ }
1354
+ [_$1](t$7) {
1355
+ if (this[N]) this[D](t$7);
1356
+ else if (!t$7 && !this[n$4]) this[M]();
1357
+ else {
1358
+ if (this[N] = true, this[n$4]) {
1359
+ this[D](t$7);
1360
+ const i$8 = this[n$4];
1361
+ this[n$4] = null, this[g](i$8);
1362
+ } else this[g](t$7);
1363
+ for (; this[n$4] && this[n$4].length >= 512 && !this[m$3] && !this[A];) {
1364
+ const i$8 = this[n$4];
1365
+ this[n$4] = null, this[g](i$8);
1366
+ }
1367
+ this[N] = false;
1368
+ }
1369
+ (!this[n$4] || this[u$5]) && this[M]();
1370
+ }
1371
+ [g](t$7) {
1372
+ let i$8 = 0;
1373
+ const s$8 = t$7.length;
1374
+ for (; i$8 + 512 <= s$8 && !this[m$3] && !this[A];) switch (this[h$1]) {
1375
+ case "begin":
1376
+ case "header":
1377
+ this[Y](t$7, i$8), i$8 += 512;
1378
+ break;
1379
+ case "ignore":
1380
+ case "body":
1381
+ i$8 += this[q$1](t$7, i$8);
1382
+ break;
1383
+ case "meta":
1384
+ i$8 += this[z$1](t$7, i$8);
1385
+ break;
1386
+ default: throw new Error("invalid state: " + this[h$1]);
1387
+ }
1388
+ i$8 < s$8 && (this[n$4] ? this[n$4] = Buffer.concat([t$7.slice(i$8), this[n$4]]) : this[n$4] = t$7.slice(i$8));
1389
+ }
1390
+ end(t$7) {
1391
+ this[m$3] || (this[r] ? this[r].end(t$7) : (this[u$5] = true, this.brotli === void 0 && (t$7 = t$7 || Buffer.alloc(0)), this.write(t$7)));
1392
+ }
1393
+ }), O$1;
1394
+ }
1395
+ var s$4 = {};
1396
+ var v$1;
1397
+ function X() {
1398
+ if (v$1) return s$4;
1399
+ v$1 = 1;
1400
+ const H$2 = tt(), I = nt.EventEmitter, r = nativeFs;
1401
+ let R$2 = r.writev;
1402
+ if (!R$2) {
1403
+ const c$5 = process.binding("fs"), t$7 = c$5.FSReqWrap || c$5.FSReqCallback;
1404
+ R$2 = (e$7, i$8, $, A) => {
1405
+ const G$1 = (J$1, K) => A(J$1, K, i$8), j$2 = new t$7();
1406
+ j$2.oncomplete = G$1, c$5.writeBuffers(e$7, i$8, $, j$2);
1407
+ };
1408
+ }
1409
+ const m$3 = Symbol("_autoClose"), h$1 = Symbol("_close"), g = Symbol("_ended"), s$8 = Symbol("_fd"), B = Symbol("_finished"), o$6 = Symbol("_flags"), x = Symbol("_flush"), z$1 = Symbol("_handleChunk"), T$1 = Symbol("_makeBuf"), q$1 = Symbol("_mode"), E$1 = Symbol("_needDrain"), d = Symbol("_onerror"), y$3 = Symbol("_onopen"), W = Symbol("_onread"), _$1 = Symbol("_onwrite"), a$11 = Symbol("_open"), l$2 = Symbol("_path"), u$5 = Symbol("_pos"), n$4 = Symbol("_queue"), S$1 = Symbol("_read"), M = Symbol("_readSize"), f$4 = Symbol("_reading"), k$1 = Symbol("_remain"), N = Symbol("_size"), C$1 = Symbol("_write"), b = Symbol("_writing"), F$3 = Symbol("_defaultFlag"), p$1 = Symbol("_errored");
1410
+ class D extends H$2 {
1411
+ constructor(t$7, e$7) {
1412
+ if (e$7 = e$7 || {}, super(e$7), this.readable = true, this.writable = false, typeof t$7 != "string") throw new TypeError("path must be a string");
1413
+ this[p$1] = false, this[s$8] = typeof e$7.fd == "number" ? e$7.fd : null, this[l$2] = t$7, this[M] = e$7.readSize || 16 * 1024 * 1024, this[f$4] = false, this[N] = typeof e$7.size == "number" ? e$7.size : Infinity, this[k$1] = this[N], this[m$3] = typeof e$7.autoClose == "boolean" ? e$7.autoClose : true, typeof this[s$8] == "number" ? this[S$1]() : this[a$11]();
1414
+ }
1415
+ get fd() {
1416
+ return this[s$8];
1417
+ }
1418
+ get path() {
1419
+ return this[l$2];
1420
+ }
1421
+ write() {
1422
+ throw new TypeError("this is a readable stream");
1423
+ }
1424
+ end() {
1425
+ throw new TypeError("this is a readable stream");
1426
+ }
1427
+ [a$11]() {
1428
+ r.open(this[l$2], "r", (t$7, e$7) => this[y$3](t$7, e$7));
1429
+ }
1430
+ [y$3](t$7, e$7) {
1431
+ t$7 ? this[d](t$7) : (this[s$8] = e$7, this.emit("open", e$7), this[S$1]());
1432
+ }
1433
+ [T$1]() {
1434
+ return Buffer.allocUnsafe(Math.min(this[M], this[k$1]));
1435
+ }
1436
+ [S$1]() {
1437
+ if (!this[f$4]) {
1438
+ this[f$4] = true;
1439
+ const t$7 = this[T$1]();
1440
+ if (t$7.length === 0) return process.nextTick(() => this[W](null, 0, t$7));
1441
+ r.read(this[s$8], t$7, 0, t$7.length, null, (e$7, i$8, $) => this[W](e$7, i$8, $));
1442
+ }
1443
+ }
1444
+ [W](t$7, e$7, i$8) {
1445
+ this[f$4] = false, t$7 ? this[d](t$7) : this[z$1](e$7, i$8) && this[S$1]();
1446
+ }
1447
+ [h$1]() {
1448
+ if (this[m$3] && typeof this[s$8] == "number") {
1449
+ const t$7 = this[s$8];
1450
+ this[s$8] = null, r.close(t$7, (e$7) => e$7 ? this.emit("error", e$7) : this.emit("close"));
1451
+ }
1452
+ }
1453
+ [d](t$7) {
1454
+ this[f$4] = true, this[h$1](), this.emit("error", t$7);
1455
+ }
1456
+ [z$1](t$7, e$7) {
1457
+ let i$8 = false;
1458
+ return this[k$1] -= t$7, t$7 > 0 && (i$8 = super.write(t$7 < e$7.length ? e$7.slice(0, t$7) : e$7)), (t$7 === 0 || this[k$1] <= 0) && (i$8 = false, this[h$1](), super.end()), i$8;
1459
+ }
1460
+ emit(t$7, e$7) {
1461
+ switch (t$7) {
1462
+ case "prefinish":
1463
+ case "finish": break;
1464
+ case "drain":
1465
+ typeof this[s$8] == "number" && this[S$1]();
1466
+ break;
1467
+ case "error": return this[p$1] ? void 0 : (this[p$1] = true, super.emit(t$7, e$7));
1468
+ default: return super.emit(t$7, e$7);
1469
+ }
1470
+ }
1471
+ }
1472
+ class P$1 extends D {
1473
+ [a$11]() {
1474
+ let t$7 = true;
1475
+ try {
1476
+ this[y$3](null, r.openSync(this[l$2], "r")), t$7 = !1;
1477
+ } finally {
1478
+ t$7 && this[h$1]();
1479
+ }
1480
+ }
1481
+ [S$1]() {
1482
+ let t$7 = true;
1483
+ try {
1484
+ if (!this[f$4]) {
1485
+ this[f$4] = !0;
1486
+ do {
1487
+ const e$7 = this[T$1](), i$8 = e$7.length === 0 ? 0 : r.readSync(this[s$8], e$7, 0, e$7.length, null);
1488
+ if (!this[z$1](i$8, e$7)) break;
1489
+ } while (!0);
1490
+ this[f$4] = !1;
1491
+ }
1492
+ t$7 = !1;
1493
+ } finally {
1494
+ t$7 && this[h$1]();
1495
+ }
1496
+ }
1497
+ [h$1]() {
1498
+ if (this[m$3] && typeof this[s$8] == "number") {
1499
+ const t$7 = this[s$8];
1500
+ this[s$8] = null, r.closeSync(t$7), this.emit("close");
1501
+ }
1502
+ }
1503
+ }
1504
+ class O$3 extends I {
1505
+ constructor(t$7, e$7) {
1506
+ e$7 = e$7 || {}, super(e$7), this.readable = false, this.writable = true, this[p$1] = false, this[b] = false, this[g] = false, this[E$1] = false, this[n$4] = [], this[l$2] = t$7, this[s$8] = typeof e$7.fd == "number" ? e$7.fd : null, this[q$1] = e$7.mode === void 0 ? 438 : e$7.mode, this[u$5] = typeof e$7.start == "number" ? e$7.start : null, this[m$3] = typeof e$7.autoClose == "boolean" ? e$7.autoClose : true;
1507
+ const i$8 = this[u$5] !== null ? "r+" : "w";
1508
+ this[F$3] = e$7.flags === void 0, this[o$6] = this[F$3] ? i$8 : e$7.flags, this[s$8] === null && this[a$11]();
1509
+ }
1510
+ emit(t$7, e$7) {
1511
+ if (t$7 === "error") {
1512
+ if (this[p$1]) return;
1513
+ this[p$1] = true;
1514
+ }
1515
+ return super.emit(t$7, e$7);
1516
+ }
1517
+ get fd() {
1518
+ return this[s$8];
1519
+ }
1520
+ get path() {
1521
+ return this[l$2];
1522
+ }
1523
+ [d](t$7) {
1524
+ this[h$1](), this[b] = true, this.emit("error", t$7);
1525
+ }
1526
+ [a$11]() {
1527
+ r.open(this[l$2], this[o$6], this[q$1], (t$7, e$7) => this[y$3](t$7, e$7));
1528
+ }
1529
+ [y$3](t$7, e$7) {
1530
+ this[F$3] && this[o$6] === "r+" && t$7 && t$7.code === "ENOENT" ? (this[o$6] = "w", this[a$11]()) : t$7 ? this[d](t$7) : (this[s$8] = e$7, this.emit("open", e$7), this[x]());
1531
+ }
1532
+ end(t$7, e$7) {
1533
+ return t$7 && this.write(t$7, e$7), this[g] = true, !this[b] && !this[n$4].length && typeof this[s$8] == "number" && this[_$1](null, 0), this;
1534
+ }
1535
+ write(t$7, e$7) {
1536
+ return typeof t$7 == "string" && (t$7 = Buffer.from(t$7, e$7)), this[g] ? (this.emit("error", /* @__PURE__ */ new Error("write() after end()")), false) : this[s$8] === null || this[b] || this[n$4].length ? (this[n$4].push(t$7), this[E$1] = true, false) : (this[b] = true, this[C$1](t$7), true);
1537
+ }
1538
+ [C$1](t$7) {
1539
+ r.write(this[s$8], t$7, 0, t$7.length, this[u$5], (e$7, i$8) => this[_$1](e$7, i$8));
1540
+ }
1541
+ [_$1](t$7, e$7) {
1542
+ t$7 ? this[d](t$7) : (this[u$5] !== null && (this[u$5] += e$7), this[n$4].length ? this[x]() : (this[b] = false, this[g] && !this[B] ? (this[B] = true, this[h$1](), this.emit("finish")) : this[E$1] && (this[E$1] = false, this.emit("drain"))));
1543
+ }
1544
+ [x]() {
1545
+ if (this[n$4].length === 0) this[g] && this[_$1](null, 0);
1546
+ else if (this[n$4].length === 1) this[C$1](this[n$4].pop());
1547
+ else {
1548
+ const t$7 = this[n$4];
1549
+ this[n$4] = [], R$2(this[s$8], t$7, this[u$5], (e$7, i$8) => this[_$1](e$7, i$8));
1550
+ }
1551
+ }
1552
+ [h$1]() {
1553
+ if (this[m$3] && typeof this[s$8] == "number") {
1554
+ const t$7 = this[s$8];
1555
+ this[s$8] = null, r.close(t$7, (e$7) => e$7 ? this.emit("error", e$7) : this.emit("close"));
1556
+ }
1557
+ }
1558
+ }
1559
+ class U extends O$3 {
1560
+ [a$11]() {
1561
+ let t$7;
1562
+ if (this[F$3] && this[o$6] === "r+") try {
1563
+ t$7 = r.openSync(this[l$2], this[o$6], this[q$1]);
1564
+ } catch (e$7) {
1565
+ if (e$7.code === "ENOENT") return this[o$6] = "w", this[a$11]();
1566
+ throw e$7;
1567
+ }
1568
+ else t$7 = r.openSync(this[l$2], this[o$6], this[q$1]);
1569
+ this[y$3](null, t$7);
1570
+ }
1571
+ [h$1]() {
1572
+ if (this[m$3] && typeof this[s$8] == "number") {
1573
+ const t$7 = this[s$8];
1574
+ this[s$8] = null, r.closeSync(t$7), this.emit("close");
1575
+ }
1576
+ }
1577
+ [C$1](t$7) {
1578
+ let e$7 = true;
1579
+ try {
1580
+ this[_$1](null, r.writeSync(this[s$8], t$7, 0, t$7.length, this[u$5])), e$7 = !1;
1581
+ } finally {
1582
+ if (e$7) try {
1583
+ this[h$1]();
1584
+ } catch {}
1585
+ }
1586
+ }
1587
+ }
1588
+ return s$4.ReadStream = D, s$4.ReadStreamSync = P$1, s$4.WriteStream = O$3, s$4.WriteStreamSync = U, s$4;
1589
+ }
1590
+ var r$1 = { exports: {} };
1591
+ var i$2, m$2;
1592
+ function t$2() {
1593
+ if (m$2) return i$2;
1594
+ m$2 = 1;
1595
+ const { promisify: n$4 } = a$a, e$7 = nativeFs;
1596
+ return i$2 = (r) => {
1597
+ if (!r) r = {
1598
+ mode: 511,
1599
+ fs: e$7
1600
+ };
1601
+ else if (typeof r == "object") r = {
1602
+ mode: 511,
1603
+ fs: e$7,
1604
+ ...r
1605
+ };
1606
+ else if (typeof r == "number") r = {
1607
+ mode: r,
1608
+ fs: e$7
1609
+ };
1610
+ else if (typeof r == "string") r = {
1611
+ mode: parseInt(r, 8),
1612
+ fs: e$7
1613
+ };
1614
+ else throw new TypeError("invalid options argument");
1615
+ return r.mkdir = r.mkdir || r.fs.mkdir || e$7.mkdir, r.mkdirAsync = n$4(r.mkdir), r.stat = r.stat || r.fs.stat || e$7.stat, r.statAsync = n$4(r.stat), r.statSync = r.statSync || r.fs.statSync || e$7.statSync, r.mkdirSync = r.mkdirSync || r.fs.mkdirSync || e$7.mkdirSync, r;
1616
+ }, i$2;
1617
+ }
1618
+ var e$1, t$1;
1619
+ function u$2() {
1620
+ if (t$1) return e$1;
1621
+ t$1 = 1;
1622
+ const s$8 = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform, { resolve: o$6, parse: n$4 } = path;
1623
+ return e$1 = (r) => {
1624
+ if (/\0/.test(r)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
1625
+ path: r,
1626
+ code: "ERR_INVALID_ARG_VALUE"
1627
+ });
1628
+ if (r = o$6(r), s$8 === "win32") {
1629
+ const i$8 = /[*|"<>?:]/, { root: a$11 } = n$4(r);
1630
+ if (i$8.test(r.substr(a$11.length))) throw Object.assign(/* @__PURE__ */ new Error("Illegal characters in path."), {
1631
+ path: r,
1632
+ code: "EINVAL"
1633
+ });
1634
+ }
1635
+ return r;
1636
+ }, e$1;
1637
+ }
1638
+ var i$1, c$2;
1639
+ function t() {
1640
+ if (c$2) return i$1;
1641
+ c$2 = 1;
1642
+ const { dirname: u$5 } = path, f$4 = (r, e$7, n$4 = void 0) => n$4 === e$7 ? Promise.resolve() : r.statAsync(e$7).then((d) => d.isDirectory() ? n$4 : void 0, (d) => d.code === "ENOENT" ? f$4(r, u$5(e$7), e$7) : void 0), o$6 = (r, e$7, n$4 = void 0) => {
1643
+ if (n$4 !== e$7) try {
1644
+ return r.statSync(e$7).isDirectory() ? n$4 : void 0;
1645
+ } catch (d) {
1646
+ return d.code === "ENOENT" ? o$6(r, u$5(e$7), e$7) : void 0;
1647
+ }
1648
+ };
1649
+ return i$1 = {
1650
+ findMade: f$4,
1651
+ findMadeSync: o$6
1652
+ }, i$1;
1653
+ }
1654
+ var o$3, a$4;
1655
+ function y$2() {
1656
+ if (a$4) return o$3;
1657
+ a$4 = 1;
1658
+ const { dirname: f$4 } = path, t$7 = (n$4, e$7, c$5) => {
1659
+ e$7.recursive = false;
1660
+ const i$8 = f$4(n$4);
1661
+ return i$8 === n$4 ? e$7.mkdirAsync(n$4, e$7).catch((r) => {
1662
+ if (r.code !== "EISDIR") throw r;
1663
+ }) : e$7.mkdirAsync(n$4, e$7).then(() => c$5 || n$4, (r) => {
1664
+ if (r.code === "ENOENT") return t$7(i$8, e$7).then((u$5) => t$7(n$4, e$7, u$5));
1665
+ if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
1666
+ return e$7.statAsync(n$4).then((u$5) => {
1667
+ if (u$5.isDirectory()) return c$5;
1668
+ throw r;
1669
+ }, () => {
1670
+ throw r;
1671
+ });
1672
+ });
1673
+ }, d = (n$4, e$7, c$5) => {
1674
+ const i$8 = f$4(n$4);
1675
+ if (e$7.recursive = false, i$8 === n$4) try {
1676
+ return e$7.mkdirSync(n$4, e$7);
1677
+ } catch (r) {
1678
+ if (r.code !== "EISDIR") throw r;
1679
+ return;
1680
+ }
1681
+ try {
1682
+ return e$7.mkdirSync(n$4, e$7), c$5 || n$4;
1683
+ } catch (r) {
1684
+ if (r.code === "ENOENT") return d(n$4, e$7, d(i$8, e$7, c$5));
1685
+ if (r.code !== "EEXIST" && r.code !== "EROFS") throw r;
1686
+ try {
1687
+ if (!e$7.statSync(n$4).isDirectory()) throw r;
1688
+ } catch {
1689
+ throw r;
1690
+ }
1691
+ }
1692
+ };
1693
+ return o$3 = {
1694
+ mkdirpManual: t$7,
1695
+ mkdirpManualSync: d
1696
+ }, o$3;
1697
+ }
1698
+ var c$1, m$1;
1699
+ function s$3() {
1700
+ if (m$1) return c$1;
1701
+ m$1 = 1;
1702
+ const { dirname: u$5 } = path, { findMade: d, findMadeSync: t$1$1 } = t(), { mkdirpManual: a$11, mkdirpManualSync: k$1 } = y$2();
1703
+ return c$1 = {
1704
+ mkdirpNative: (e$7, r) => (r.recursive = true, u$5(e$7) === e$7 ? r.mkdirAsync(e$7, r) : d(r, e$7).then((n$4) => r.mkdirAsync(e$7, r).then(() => n$4).catch((i$8) => {
1705
+ if (i$8.code === "ENOENT") return a$11(e$7, r);
1706
+ throw i$8;
1707
+ }))),
1708
+ mkdirpNativeSync: (e$7, r) => {
1709
+ if (r.recursive = true, u$5(e$7) === e$7) return r.mkdirSync(e$7, r);
1710
+ const n$4 = t$1$1(r, e$7);
1711
+ try {
1712
+ return r.mkdirSync(e$7, r), n$4;
1713
+ } catch (i$8) {
1714
+ if (i$8.code === "ENOENT") return k$1(e$7, r);
1715
+ throw i$8;
1716
+ }
1717
+ }
1718
+ }, c$1;
1719
+ }
1720
+ var s$2, n$1;
1721
+ function a$3() {
1722
+ if (n$1) return s$2;
1723
+ n$1 = 1;
1724
+ const i$8 = nativeFs, e$7 = (process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version).replace(/^v/, "").split("."), t$7 = +e$7[0] > 10 || +e$7[0] == 10 && +e$7[1] >= 12;
1725
+ return s$2 = {
1726
+ useNative: t$7 ? (r) => r.mkdir === i$8.mkdir : () => false,
1727
+ useNativeSync: t$7 ? (r) => r.mkdirSync === i$8.mkdirSync : () => false
1728
+ }, s$2;
1729
+ }
1730
+ var m, s$1;
1731
+ function S() {
1732
+ if (s$1) return m;
1733
+ s$1 = 1;
1734
+ const i$8 = t$2(), u$5 = u$2(), { mkdirpNative: a$11, mkdirpNativeSync: c$5 } = s$3(), { mkdirpManual: o$6, mkdirpManualSync: q$1 } = y$2(), { useNative: t$7, useNativeSync: _$1 } = a$3(), n$4 = (e$7, r) => (e$7 = u$5(e$7), r = i$8(r), t$7(r) ? a$11(e$7, r) : o$6(e$7, r)), d = (e$7, r) => (e$7 = u$5(e$7), r = i$8(r), _$1(r) ? c$5(e$7, r) : q$1(e$7, r));
1735
+ return n$4.sync = d, n$4.native = (e$7, r) => a$11(u$5(e$7), i$8(r)), n$4.manual = (e$7, r) => o$6(u$5(e$7), i$8(r)), n$4.nativeSync = (e$7, r) => c$5(u$5(e$7), i$8(r)), n$4.manualSync = (e$7, r) => q$1(u$5(e$7), i$8(r)), m = n$4, m;
1736
+ }
1737
+ var y$1, O;
1738
+ function F$1() {
1739
+ if (O) return y$1;
1740
+ O = 1;
1741
+ const c$5 = nativeFs, a$11 = path, T$1 = c$5.lchown ? "lchown" : "chown", I = c$5.lchownSync ? "lchownSync" : "chownSync", i$8 = c$5.lchown && !process.version.match(/v1[1-9]+\./) && !process.version.match(/v10\.[6-9]/), u$5 = (r, e$7, n$4) => {
1742
+ try {
1743
+ return c$5[I](r, e$7, n$4);
1744
+ } catch (t$7) {
1745
+ if (t$7.code !== "ENOENT") throw t$7;
1746
+ }
1747
+ }, D = (r, e$7, n$4) => {
1748
+ try {
1749
+ return c$5.chownSync(r, e$7, n$4);
1750
+ } catch (t$7) {
1751
+ if (t$7.code !== "ENOENT") throw t$7;
1752
+ }
1753
+ }, _$1 = i$8 ? (r, e$7, n$4, t$7) => (o$6) => {
1754
+ !o$6 || o$6.code !== "EISDIR" ? t$7(o$6) : c$5.chown(r, e$7, n$4, t$7);
1755
+ } : (r, e$7, n$4, t$7) => t$7, w$2 = i$8 ? (r, e$7, n$4) => {
1756
+ try {
1757
+ return u$5(r, e$7, n$4);
1758
+ } catch (t$7) {
1759
+ if (t$7.code !== "EISDIR") throw t$7;
1760
+ D(r, e$7, n$4);
1761
+ }
1762
+ } : (r, e$7, n$4) => u$5(r, e$7, n$4), R$2 = process.version;
1763
+ let N = (r, e$7, n$4) => c$5.readdir(r, e$7, n$4), q$1 = (r, e$7) => c$5.readdirSync(r, e$7);
1764
+ /^v4\./.test(R$2) && (N = (r, e$7, n$4) => c$5.readdir(r, n$4));
1765
+ const h$1 = (r, e$7, n$4, t$7) => {
1766
+ c$5[T$1](r, e$7, n$4, _$1(r, e$7, n$4, (o$6) => {
1767
+ t$7(o$6 && o$6.code !== "ENOENT" ? o$6 : null);
1768
+ }));
1769
+ }, S$1 = (r, e$7, n$4, t$7, o$6) => {
1770
+ if (typeof e$7 == "string") return c$5.lstat(a$11.resolve(r, e$7), (s$8, f$4) => {
1771
+ if (s$8) return o$6(s$8.code !== "ENOENT" ? s$8 : null);
1772
+ f$4.name = e$7, S$1(r, f$4, n$4, t$7, o$6);
1773
+ });
1774
+ if (e$7.isDirectory()) E$1(a$11.resolve(r, e$7.name), n$4, t$7, (s$8) => {
1775
+ if (s$8) return o$6(s$8);
1776
+ h$1(a$11.resolve(r, e$7.name), n$4, t$7, o$6);
1777
+ });
1778
+ else h$1(a$11.resolve(r, e$7.name), n$4, t$7, o$6);
1779
+ }, E$1 = (r, e$7, n$4, t$7) => {
1780
+ N(r, { withFileTypes: true }, (o$6, s$8) => {
1781
+ if (o$6) {
1782
+ if (o$6.code === "ENOENT") return t$7();
1783
+ if (o$6.code !== "ENOTDIR" && o$6.code !== "ENOTSUP") return t$7(o$6);
1784
+ }
1785
+ if (o$6 || !s$8.length) return h$1(r, e$7, n$4, t$7);
1786
+ let f$4 = s$8.length, v$2 = null;
1787
+ const H$2 = (l$2) => {
1788
+ if (!v$2) {
1789
+ if (l$2) return t$7(v$2 = l$2);
1790
+ if (--f$4 === 0) return h$1(r, e$7, n$4, t$7);
1791
+ }
1792
+ };
1793
+ s$8.forEach((l$2) => S$1(r, l$2, e$7, n$4, H$2));
1794
+ });
1795
+ }, C$1 = (r, e$7, n$4, t$7) => {
1796
+ if (typeof e$7 == "string") try {
1797
+ const o$6 = c$5.lstatSync(a$11.resolve(r, e$7));
1798
+ o$6.name = e$7, e$7 = o$6;
1799
+ } catch (o$6) {
1800
+ if (o$6.code === "ENOENT") return;
1801
+ throw o$6;
1802
+ }
1803
+ e$7.isDirectory() && m$3(a$11.resolve(r, e$7.name), n$4, t$7), w$2(a$11.resolve(r, e$7.name), n$4, t$7);
1804
+ }, m$3 = (r, e$7, n$4) => {
1805
+ let t$7;
1806
+ try {
1807
+ t$7 = q$1(r, { withFileTypes: !0 });
1808
+ } catch (o$6) {
1809
+ if (o$6.code === "ENOENT") return;
1810
+ if (o$6.code === "ENOTDIR" || o$6.code === "ENOTSUP") return w$2(r, e$7, n$4);
1811
+ throw o$6;
1812
+ }
1813
+ return t$7 && t$7.length && t$7.forEach((o$6) => C$1(r, o$6, e$7, n$4)), w$2(r, e$7, n$4);
1814
+ };
1815
+ return y$1 = E$1, E$1.sync = m$3, y$1;
1816
+ }
1817
+ var R;
1818
+ function H() {
1819
+ if (R) return r$1.exports;
1820
+ R = 1;
1821
+ const g = S(), l$2 = nativeFs, p$1 = path, x = F$1(), y$3 = a$7();
1822
+ class D extends Error {
1823
+ constructor(e$7, s$8) {
1824
+ super("Cannot extract through symbolic link"), this.path = s$8, this.symlink = e$7;
1825
+ }
1826
+ get name() {
1827
+ return "SylinkError";
1828
+ }
1829
+ }
1830
+ class E$1 extends Error {
1831
+ constructor(e$7, s$8) {
1832
+ super(s$8 + ": Cannot cd into '" + e$7 + "'"), this.path = e$7, this.code = s$8;
1833
+ }
1834
+ get name() {
1835
+ return "CwdError";
1836
+ }
1837
+ }
1838
+ const v$2 = (n$4, e$7) => n$4.get(y$3(e$7)), q$1 = (n$4, e$7, s$8) => n$4.set(y$3(e$7), s$8), I = (n$4, e$7) => {
1839
+ l$2.stat(n$4, (s$8, r) => {
1840
+ (s$8 || !r.isDirectory()) && (s$8 = new E$1(n$4, s$8 && s$8.code || "ENOTDIR")), e$7(s$8);
1841
+ });
1842
+ };
1843
+ r$1.exports = (n$4, e$7, s$8) => {
1844
+ n$4 = y$3(n$4);
1845
+ const r = e$7.umask, c$5 = e$7.mode | 448, f$4 = (c$5 & r) !== 0, t$7 = e$7.uid, i$8 = e$7.gid, a$11 = typeof t$7 == "number" && typeof i$8 == "number" && (t$7 !== e$7.processUid || i$8 !== e$7.processGid), u$5 = e$7.preserve, m$3 = e$7.unlink, h$1 = e$7.cache, d = y$3(e$7.cwd), w$2 = (k$1, o$6) => {
1846
+ k$1 ? s$8(k$1) : (q$1(h$1, n$4, true), o$6 && a$11 ? x(o$6, t$7, i$8, (G$1) => w$2(G$1)) : f$4 ? l$2.chmod(n$4, c$5, s$8) : s$8());
1847
+ };
1848
+ if (h$1 && v$2(h$1, n$4) === true) return w$2();
1849
+ if (n$4 === d) return I(n$4, w$2);
1850
+ if (u$5) return g(n$4, { mode: c$5 }).then((k$1) => w$2(null, k$1), w$2);
1851
+ C$1(d, y$3(p$1.relative(d, n$4)).split("/"), c$5, h$1, m$3, d, null, w$2);
1852
+ };
1853
+ const C$1 = (n$4, e$7, s$8, r, c$5, f$4, t$7, i$8) => {
1854
+ if (!e$7.length) return i$8(null, t$7);
1855
+ const a$11 = e$7.shift(), u$5 = y$3(p$1.resolve(n$4 + "/" + a$11));
1856
+ if (v$2(r, u$5)) return C$1(u$5, e$7, s$8, r, c$5, f$4, t$7, i$8);
1857
+ l$2.mkdir(u$5, s$8, j$2(u$5, e$7, s$8, r, c$5, f$4, t$7, i$8));
1858
+ }, j$2 = (n$4, e$7, s$8, r, c$5, f$4, t$7, i$8) => (a$11) => {
1859
+ a$11 ? l$2.lstat(n$4, (u$5, m$3) => {
1860
+ if (u$5) u$5.path = u$5.path && y$3(u$5.path), i$8(u$5);
1861
+ else if (m$3.isDirectory()) C$1(n$4, e$7, s$8, r, c$5, f$4, t$7, i$8);
1862
+ else if (c$5) l$2.unlink(n$4, (h$1) => {
1863
+ if (h$1) return i$8(h$1);
1864
+ l$2.mkdir(n$4, s$8, j$2(n$4, e$7, s$8, r, c$5, f$4, t$7, i$8));
1865
+ });
1866
+ else {
1867
+ if (m$3.isSymbolicLink()) return i$8(new D(n$4, n$4 + "/" + e$7.join("/")));
1868
+ i$8(a$11);
1869
+ }
1870
+ }) : (t$7 = t$7 || n$4, C$1(n$4, e$7, s$8, r, c$5, f$4, t$7, i$8));
1871
+ }, L = (n$4) => {
1872
+ let e$7 = false, s$8 = "ENOTDIR";
1873
+ try {
1874
+ e$7 = l$2.statSync(n$4).isDirectory();
1875
+ } catch (r) {
1876
+ s$8 = r.code;
1877
+ } finally {
1878
+ if (!e$7) throw new E$1(n$4, s$8);
1879
+ }
1880
+ };
1881
+ return r$1.exports.sync = (n$4, e$7) => {
1882
+ n$4 = y$3(n$4);
1883
+ const s$8 = e$7.umask, r = e$7.mode | 448, c$5 = (r & s$8) !== 0, f$4 = e$7.uid, t$7 = e$7.gid, i$8 = typeof f$4 == "number" && typeof t$7 == "number" && (f$4 !== e$7.processUid || t$7 !== e$7.processGid), a$11 = e$7.preserve, u$5 = e$7.unlink, m$3 = e$7.cache, h$1 = y$3(e$7.cwd), d = (k$1) => {
1884
+ q$1(m$3, n$4, true), k$1 && i$8 && x.sync(k$1, f$4, t$7), c$5 && l$2.chmodSync(n$4, r);
1885
+ };
1886
+ if (m$3 && v$2(m$3, n$4) === true) return d();
1887
+ if (n$4 === h$1) return L(h$1), d();
1888
+ if (a$11) return d(g.sync(n$4, r));
1889
+ const $ = y$3(p$1.relative(h$1, n$4)).split("/");
1890
+ let S$1 = null;
1891
+ for (let k$1 = $.shift(), o$6 = h$1; k$1 && (o$6 += "/" + k$1); k$1 = $.shift()) if (o$6 = y$3(p$1.resolve(o$6)), !v$2(m$3, o$6)) try {
1892
+ l$2.mkdirSync(o$6, r), S$1 = S$1 || o$6, q$1(m$3, o$6, !0);
1893
+ } catch {
1894
+ const M = l$2.lstatSync(o$6);
1895
+ if (M.isDirectory()) {
1896
+ q$1(m$3, o$6, true);
1897
+ continue;
1898
+ } else if (u$5) {
1899
+ l$2.unlinkSync(o$6), l$2.mkdirSync(o$6, r), S$1 = S$1 || o$6, q$1(m$3, o$6, true);
1900
+ continue;
1901
+ } else if (M.isSymbolicLink()) return new D(o$6, o$6 + "/" + $.join("/"));
1902
+ }
1903
+ return d(S$1);
1904
+ }, r$1.exports;
1905
+ }
1906
+ var a$2, i;
1907
+ function p() {
1908
+ if (i) return a$2;
1909
+ i = 1;
1910
+ const o$6 = [
1911
+ "|",
1912
+ "<",
1913
+ ">",
1914
+ "?",
1915
+ ":"
1916
+ ], t$7 = o$6.map((e$7) => String.fromCharCode(61440 + e$7.charCodeAt(0))), s$8 = new Map(o$6.map((e$7, r) => [e$7, t$7[r]])), c$5 = new Map(t$7.map((e$7, r) => [e$7, o$6[r]]));
1917
+ return a$2 = {
1918
+ encode: (e$7) => o$6.reduce((r, n$4) => r.split(n$4).join(s$8.get(n$4)), e$7),
1919
+ decode: (e$7) => t$7.reduce((r, n$4) => r.split(n$4).join(c$5.get(n$4)), e$7)
1920
+ }, a$2;
1921
+ }
1922
+ var o$2, n;
1923
+ function a$1() {
1924
+ if (n) return o$2;
1925
+ n = 1;
1926
+ const r = Object.create(null), { hasOwnProperty: i$8 } = Object.prototype;
1927
+ return o$2 = (e$7) => (i$8.call(r, e$7) || (r[e$7] = e$7.normalize("NFD")), r[e$7]), o$2;
1928
+ }
1929
+ var a, l;
1930
+ function s() {
1931
+ return l || (l = 1, a = (r) => {
1932
+ let e$7 = r.length - 1, i$8 = -1;
1933
+ for (; e$7 > -1 && r.charAt(e$7) === "/";) i$8 = e$7, e$7--;
1934
+ return i$8 === -1 ? r : r.slice(0, i$8);
1935
+ }), a;
1936
+ }
1937
+ var u$1, f$1;
1938
+ function z() {
1939
+ if (f$1) return u$1;
1940
+ f$1 = 1;
1941
+ const l$2 = j$1, m$3 = a$1(), g = s(), { join: d } = path, q$1 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
1942
+ return u$1 = () => {
1943
+ const i$8 = /* @__PURE__ */ new Map(), c$5 = /* @__PURE__ */ new Map(), v$2 = (e$7) => e$7.split("/").slice(0, -1).reduce((o$6, r) => (o$6.length && (r = d(o$6[o$6.length - 1], r)), o$6.push(r || "/"), o$6), []), a$11 = /* @__PURE__ */ new Set(), w$2 = (e$7) => {
1944
+ const s$8 = c$5.get(e$7);
1945
+ if (!s$8) throw new Error("function does not have any path reservations");
1946
+ return {
1947
+ paths: s$8.paths.map((o$6) => i$8.get(o$6)),
1948
+ dirs: [...s$8.dirs].map((o$6) => i$8.get(o$6))
1949
+ };
1950
+ }, h$1 = (e$7) => {
1951
+ const { paths: s$8, dirs: o$6 } = w$2(e$7);
1952
+ return s$8.every((r) => r[0] === e$7) && o$6.every((r) => r[0] instanceof Set && r[0].has(e$7));
1953
+ }, p$1 = (e$7) => a$11.has(e$7) || !h$1(e$7) ? false : (a$11.add(e$7), e$7(() => S$1(e$7)), true), S$1 = (e$7) => {
1954
+ if (!a$11.has(e$7)) return false;
1955
+ const { paths: s$8, dirs: o$6 } = c$5.get(e$7), r = /* @__PURE__ */ new Set();
1956
+ return s$8.forEach((t$7) => {
1957
+ const n$4 = i$8.get(t$7);
1958
+ l$2.equal(n$4[0], e$7), n$4.length === 1 ? i$8.delete(t$7) : (n$4.shift(), typeof n$4[0] == "function" ? r.add(n$4[0]) : n$4[0].forEach((E$1) => r.add(E$1)));
1959
+ }), o$6.forEach((t$7) => {
1960
+ const n$4 = i$8.get(t$7);
1961
+ l$2(n$4[0] instanceof Set), n$4[0].size === 1 && n$4.length === 1 ? i$8.delete(t$7) : n$4[0].size === 1 ? (n$4.shift(), r.add(n$4[0])) : n$4[0].delete(e$7);
1962
+ }), a$11.delete(e$7), r.forEach((t$7) => p$1(t$7)), true;
1963
+ };
1964
+ return {
1965
+ check: h$1,
1966
+ reserve: (e$7, s$8) => {
1967
+ e$7 = q$1 ? ["win32 parallelization disabled"] : e$7.map((r) => g(d(m$3(r))).toLowerCase());
1968
+ const o$6 = new Set(e$7.map((r) => v$2(r)).reduce((r, t$7) => r.concat(t$7)));
1969
+ return c$5.set(s$8, {
1970
+ dirs: o$6,
1971
+ paths: e$7
1972
+ }), e$7.forEach((r) => {
1973
+ const t$7 = i$8.get(r);
1974
+ t$7 ? t$7.push(s$8) : i$8.set(r, [s$8]);
1975
+ }), o$6.forEach((r) => {
1976
+ const t$7 = i$8.get(r);
1977
+ t$7 ? t$7[t$7.length - 1] instanceof Set ? t$7[t$7.length - 1].add(s$8) : t$7.push(new Set([s$8])) : i$8.set(r, [new Set([s$8])]);
1978
+ }), p$1(s$8);
1979
+ }
1980
+ };
1981
+ }, u$1;
1982
+ }
1983
+ var o$1, u;
1984
+ function c() {
1985
+ if (u) return o$1;
1986
+ u = 1;
1987
+ const { isAbsolute: l$2, parse: t$7 } = path.win32;
1988
+ return o$1 = (r) => {
1989
+ let s$8 = "", e$7 = t$7(r);
1990
+ for (; l$2(r) || e$7.root;) {
1991
+ const i$8 = r.charAt(0) === "/" && r.slice(0, 4) !== "//?/" ? "/" : e$7.root;
1992
+ r = r.slice(i$8.length), s$8 += i$8, e$7 = t$7(r);
1993
+ }
1994
+ return [s$8, r];
1995
+ }, o$1;
1996
+ }
1997
+ var e, o;
1998
+ function F() {
1999
+ if (o) return e;
2000
+ o = 1;
2001
+ const t$7 = process.env.__FAKE_PLATFORM__ || process.platform, s$8 = typeof Bun < "u" ? false : t$7 === "win32", { O_CREAT: _$1, O_TRUNC: a$11, O_WRONLY: i$8, UV_FS_O_FILEMAP: r = 0 } = (commonjsGlobal.__FAKE_TESTING_FS__ || nativeFs).constants, c$5 = s$8 && !!r, f$4 = 512 * 1024, p$1 = r | a$11 | _$1 | i$8;
2002
+ return e = c$5 ? (l$2) => l$2 < f$4 ? p$1 : "w" : () => "w", e;
2003
+ }
2004
+ var G, y;
2005
+ function Os() {
2006
+ if (y) return G;
2007
+ y = 1;
2008
+ const ss = j$1, is = rt(), r = nativeFs, es = X(), w$2 = path, M = H(), K = p(), ts = z(), os$1 = c(), l$2 = a$7(), rs = s(), hs = a$1(), H$1$1 = Symbol("onEntry"), q$1 = Symbol("checkFs"), Y = Symbol("checkFs2"), v$2 = Symbol("pruneCache"), N = Symbol("isReusable"), d = Symbol("makeFs"), U = Symbol("file"), F$1$1 = Symbol("directory"), O$3 = Symbol("link"), B = Symbol("symlink"), z$1 = Symbol("hardlink"), W = Symbol("unsupported"), j$2 = Symbol("checkPath"), b = Symbol("mkdir"), m$3 = Symbol("onError"), $ = Symbol("pending"), V$1 = Symbol("pend"), S$1 = Symbol("unpend"), P$1 = Symbol("ended"), A = Symbol("maybeClose"), x = Symbol("skip"), E$1 = Symbol("doChown"), R$2 = Symbol("uid"), _$1 = Symbol("gid"), g = Symbol("checkedCwd"), X$1$1 = Ds, J$1 = F(), C$1 = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32", cs = 1024, as = (a$11, s$8) => {
2009
+ if (!C$1) return r.unlink(a$11, s$8);
2010
+ const i$8 = a$11 + ".DELETE." + X$1$1.randomBytes(16).toString("hex");
2011
+ r.rename(a$11, i$8, (e$7) => {
2012
+ if (e$7) return s$8(e$7);
2013
+ r.unlink(i$8, s$8);
2014
+ });
2015
+ }, us = (a$11) => {
2016
+ if (!C$1) return r.unlinkSync(a$11);
2017
+ const s$8 = a$11 + ".DELETE." + X$1$1.randomBytes(16).toString("hex");
2018
+ r.renameSync(a$11, s$8), r.unlinkSync(s$8);
2019
+ }, Q = (a$11, s$8, i$8) => a$11 === a$11 >>> 0 ? a$11 : s$8 === s$8 >>> 0 ? s$8 : i$8, Z = (a$11) => rs(l$2(hs(a$11))).toLowerCase(), ns = (a$11, s$8) => {
2020
+ s$8 = Z(s$8);
2021
+ for (const i$8 of a$11.keys()) {
2022
+ const e$7 = Z(i$8);
2023
+ (e$7 === s$8 || e$7.indexOf(s$8 + "/") === 0) && a$11.delete(i$8);
2024
+ }
2025
+ }, ms = (a$11) => {
2026
+ for (const s$8 of a$11.keys()) a$11.delete(s$8);
2027
+ };
2028
+ class L extends is {
2029
+ constructor(s$8) {
2030
+ if (s$8 || (s$8 = {}), s$8.ondone = (i$8) => {
2031
+ this[P$1] = true, this[A]();
2032
+ }, super(s$8), this[g] = false, this.reservations = ts(), this.transform = typeof s$8.transform == "function" ? s$8.transform : null, this.writable = true, this.readable = false, this[$] = 0, this[P$1] = false, this.dirCache = s$8.dirCache || /* @__PURE__ */ new Map(), typeof s$8.uid == "number" || typeof s$8.gid == "number") {
2033
+ if (typeof s$8.uid != "number" || typeof s$8.gid != "number") throw new TypeError("cannot set owner without number uid and gid");
2034
+ if (s$8.preserveOwner) throw new TypeError("cannot preserve owner in archive and also set owner explicitly");
2035
+ this.uid = s$8.uid, this.gid = s$8.gid, this.setOwner = true;
2036
+ } else this.uid = null, this.gid = null, this.setOwner = false;
2037
+ s$8.preserveOwner === void 0 && typeof s$8.uid != "number" ? this.preserveOwner = process.getuid && process.getuid() === 0 : this.preserveOwner = !!s$8.preserveOwner, this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ? process.getuid() : null, this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ? process.getgid() : null, this.maxDepth = typeof s$8.maxDepth == "number" ? s$8.maxDepth : cs, this.forceChown = s$8.forceChown === true, this.win32 = !!s$8.win32 || C$1, this.newer = !!s$8.newer, this.keep = !!s$8.keep, this.noMtime = !!s$8.noMtime, this.preservePaths = !!s$8.preservePaths, this.unlink = !!s$8.unlink, this.cwd = l$2(w$2.resolve(s$8.cwd || process.cwd())), this.strip = +s$8.strip || 0, this.processUmask = s$8.noChmod ? 0 : process.umask(), this.umask = typeof s$8.umask == "number" ? s$8.umask : this.processUmask, this.dmode = s$8.dmode || 511 & ~this.umask, this.fmode = s$8.fmode || 438 & ~this.umask, this.on("entry", (i$8) => this[H$1$1](i$8));
2038
+ }
2039
+ warn(s$8, i$8, e$7 = {}) {
2040
+ return (s$8 === "TAR_BAD_ARCHIVE" || s$8 === "TAR_ABORT") && (e$7.recoverable = false), super.warn(s$8, i$8, e$7);
2041
+ }
2042
+ [A]() {
2043
+ this[P$1] && this[$] === 0 && (this.emit("prefinish"), this.emit("finish"), this.emit("end"));
2044
+ }
2045
+ [j$2](s$8) {
2046
+ const i$8 = l$2(s$8.path), e$7 = i$8.split("/");
2047
+ if (this.strip) {
2048
+ if (e$7.length < this.strip) return false;
2049
+ if (s$8.type === "Link") {
2050
+ const t$7 = l$2(s$8.linkpath).split("/");
2051
+ if (t$7.length >= this.strip) s$8.linkpath = t$7.slice(this.strip).join("/");
2052
+ else return false;
2053
+ }
2054
+ e$7.splice(0, this.strip), s$8.path = e$7.join("/");
2055
+ }
2056
+ if (isFinite(this.maxDepth) && e$7.length > this.maxDepth) return this.warn("TAR_ENTRY_ERROR", "path excessively deep", {
2057
+ entry: s$8,
2058
+ path: i$8,
2059
+ depth: e$7.length,
2060
+ maxDepth: this.maxDepth
2061
+ }), false;
2062
+ if (!this.preservePaths) {
2063
+ if (e$7.includes("..") || C$1 && /^[a-z]:\.\.$/i.test(e$7[0])) return this.warn("TAR_ENTRY_ERROR", "path contains '..'", {
2064
+ entry: s$8,
2065
+ path: i$8
2066
+ }), false;
2067
+ const [t$7, o$6] = os$1(i$8);
2068
+ t$7 && (s$8.path = o$6, this.warn("TAR_ENTRY_INFO", `stripping ${t$7} from absolute path`, {
2069
+ entry: s$8,
2070
+ path: i$8
2071
+ }));
2072
+ }
2073
+ if (w$2.isAbsolute(s$8.path) ? s$8.absolute = l$2(w$2.resolve(s$8.path)) : s$8.absolute = l$2(w$2.resolve(this.cwd, s$8.path)), !this.preservePaths && s$8.absolute.indexOf(this.cwd + "/") !== 0 && s$8.absolute !== this.cwd) return this.warn("TAR_ENTRY_ERROR", "path escaped extraction target", {
2074
+ entry: s$8,
2075
+ path: l$2(s$8.path),
2076
+ resolvedPath: s$8.absolute,
2077
+ cwd: this.cwd
2078
+ }), false;
2079
+ if (s$8.absolute === this.cwd && s$8.type !== "Directory" && s$8.type !== "GNUDumpDir") return false;
2080
+ if (this.win32) {
2081
+ const { root: t$7 } = w$2.win32.parse(s$8.absolute);
2082
+ s$8.absolute = t$7 + K.encode(s$8.absolute.slice(t$7.length));
2083
+ const { root: o$6 } = w$2.win32.parse(s$8.path);
2084
+ s$8.path = o$6 + K.encode(s$8.path.slice(o$6.length));
2085
+ }
2086
+ return true;
2087
+ }
2088
+ [H$1$1](s$8) {
2089
+ if (!this[j$2](s$8)) return s$8.resume();
2090
+ switch (ss.equal(typeof s$8.absolute, "string"), s$8.type) {
2091
+ case "Directory":
2092
+ case "GNUDumpDir": s$8.mode && (s$8.mode = s$8.mode | 448);
2093
+ case "File":
2094
+ case "OldFile":
2095
+ case "ContiguousFile":
2096
+ case "Link":
2097
+ case "SymbolicLink": return this[q$1](s$8);
2098
+ case "CharacterDevice":
2099
+ case "BlockDevice":
2100
+ case "FIFO":
2101
+ default: return this[W](s$8);
2102
+ }
2103
+ }
2104
+ [m$3](s$8, i$8) {
2105
+ s$8.name === "CwdError" ? this.emit("error", s$8) : (this.warn("TAR_ENTRY_ERROR", s$8, { entry: i$8 }), this[S$1](), i$8.resume());
2106
+ }
2107
+ [b](s$8, i$8, e$7) {
2108
+ M(l$2(s$8), {
2109
+ uid: this.uid,
2110
+ gid: this.gid,
2111
+ processUid: this.processUid,
2112
+ processGid: this.processGid,
2113
+ umask: this.processUmask,
2114
+ preserve: this.preservePaths,
2115
+ unlink: this.unlink,
2116
+ cache: this.dirCache,
2117
+ cwd: this.cwd,
2118
+ mode: i$8,
2119
+ noChmod: this.noChmod
2120
+ }, e$7);
2121
+ }
2122
+ [E$1](s$8) {
2123
+ return this.forceChown || this.preserveOwner && (typeof s$8.uid == "number" && s$8.uid !== this.processUid || typeof s$8.gid == "number" && s$8.gid !== this.processGid) || typeof this.uid == "number" && this.uid !== this.processUid || typeof this.gid == "number" && this.gid !== this.processGid;
2124
+ }
2125
+ [R$2](s$8) {
2126
+ return Q(this.uid, s$8.uid, this.processUid);
2127
+ }
2128
+ [_$1](s$8) {
2129
+ return Q(this.gid, s$8.gid, this.processGid);
2130
+ }
2131
+ [U](s$8, i$8) {
2132
+ const e$7 = s$8.mode & 4095 || this.fmode, t$7 = new es.WriteStream(s$8.absolute, {
2133
+ flags: J$1(s$8.size),
2134
+ mode: e$7,
2135
+ autoClose: false
2136
+ });
2137
+ t$7.on("error", (c$5) => {
2138
+ t$7.fd && r.close(t$7.fd, () => {}), t$7.write = () => true, this[m$3](c$5, s$8), i$8();
2139
+ });
2140
+ let o$6 = 1;
2141
+ const u$5 = (c$5) => {
2142
+ if (c$5) {
2143
+ t$7.fd && r.close(t$7.fd, () => {}), this[m$3](c$5, s$8), i$8();
2144
+ return;
2145
+ }
2146
+ --o$6 === 0 && r.close(t$7.fd, (n$4) => {
2147
+ n$4 ? this[m$3](n$4, s$8) : this[S$1](), i$8();
2148
+ });
2149
+ };
2150
+ t$7.on("finish", (c$5) => {
2151
+ const n$4 = s$8.absolute, p$1 = t$7.fd;
2152
+ if (s$8.mtime && !this.noMtime) {
2153
+ o$6++;
2154
+ const f$4 = s$8.atime || /* @__PURE__ */ new Date(), k$1 = s$8.mtime;
2155
+ r.futimes(p$1, f$4, k$1, (D) => D ? r.utimes(n$4, f$4, k$1, (I) => u$5(I && D)) : u$5());
2156
+ }
2157
+ if (this[E$1](s$8)) {
2158
+ o$6++;
2159
+ const f$4 = this[R$2](s$8), k$1 = this[_$1](s$8);
2160
+ r.fchown(p$1, f$4, k$1, (D) => D ? r.chown(n$4, f$4, k$1, (I) => u$5(I && D)) : u$5());
2161
+ }
2162
+ u$5();
2163
+ });
2164
+ const h$1 = this.transform && this.transform(s$8) || s$8;
2165
+ h$1 !== s$8 && (h$1.on("error", (c$5) => {
2166
+ this[m$3](c$5, s$8), i$8();
2167
+ }), s$8.pipe(h$1)), h$1.pipe(t$7);
2168
+ }
2169
+ [F$1$1](s$8, i$8) {
2170
+ const e$7 = s$8.mode & 4095 || this.dmode;
2171
+ this[b](s$8.absolute, e$7, (t$7) => {
2172
+ if (t$7) {
2173
+ this[m$3](t$7, s$8), i$8();
2174
+ return;
2175
+ }
2176
+ let o$6 = 1;
2177
+ const u$5 = (h$1) => {
2178
+ --o$6 === 0 && (i$8(), this[S$1](), s$8.resume());
2179
+ };
2180
+ s$8.mtime && !this.noMtime && (o$6++, r.utimes(s$8.absolute, s$8.atime || /* @__PURE__ */ new Date(), s$8.mtime, u$5)), this[E$1](s$8) && (o$6++, r.chown(s$8.absolute, this[R$2](s$8), this[_$1](s$8), u$5)), u$5();
2181
+ });
2182
+ }
2183
+ [W](s$8) {
2184
+ s$8.unsupported = true, this.warn("TAR_ENTRY_UNSUPPORTED", `unsupported entry type: ${s$8.type}`, { entry: s$8 }), s$8.resume();
2185
+ }
2186
+ [B](s$8, i$8) {
2187
+ this[O$3](s$8, s$8.linkpath, "symlink", i$8);
2188
+ }
2189
+ [z$1](s$8, i$8) {
2190
+ const e$7 = l$2(w$2.resolve(this.cwd, s$8.linkpath));
2191
+ this[O$3](s$8, e$7, "link", i$8);
2192
+ }
2193
+ [V$1]() {
2194
+ this[$]++;
2195
+ }
2196
+ [S$1]() {
2197
+ this[$]--, this[A]();
2198
+ }
2199
+ [x](s$8) {
2200
+ this[S$1](), s$8.resume();
2201
+ }
2202
+ [N](s$8, i$8) {
2203
+ return s$8.type === "File" && !this.unlink && i$8.isFile() && i$8.nlink <= 1 && !C$1;
2204
+ }
2205
+ [q$1](s$8) {
2206
+ this[V$1]();
2207
+ const i$8 = [s$8.path];
2208
+ s$8.linkpath && i$8.push(s$8.linkpath), this.reservations.reserve(i$8, (e$7) => this[Y](s$8, e$7));
2209
+ }
2210
+ [v$2](s$8) {
2211
+ s$8.type === "SymbolicLink" ? ms(this.dirCache) : s$8.type !== "Directory" && ns(this.dirCache, s$8.absolute);
2212
+ }
2213
+ [Y](s$8, i$8) {
2214
+ this[v$2](s$8);
2215
+ const e$7 = (h$1) => {
2216
+ this[v$2](s$8), i$8(h$1);
2217
+ }, t$7 = () => {
2218
+ this[b](this.cwd, this.dmode, (h$1) => {
2219
+ if (h$1) {
2220
+ this[m$3](h$1, s$8), e$7();
2221
+ return;
2222
+ }
2223
+ this[g] = true, o$6();
2224
+ });
2225
+ }, o$6 = () => {
2226
+ if (s$8.absolute !== this.cwd) {
2227
+ const h$1 = l$2(w$2.dirname(s$8.absolute));
2228
+ if (h$1 !== this.cwd) return this[b](h$1, this.dmode, (c$5) => {
2229
+ if (c$5) {
2230
+ this[m$3](c$5, s$8), e$7();
2231
+ return;
2232
+ }
2233
+ u$5();
2234
+ });
2235
+ }
2236
+ u$5();
2237
+ }, u$5 = () => {
2238
+ r.lstat(s$8.absolute, (h$1, c$5) => {
2239
+ if (c$5 && (this.keep || this.newer && c$5.mtime > s$8.mtime)) {
2240
+ this[x](s$8), e$7();
2241
+ return;
2242
+ }
2243
+ if (h$1 || this[N](s$8, c$5)) return this[d](null, s$8, e$7);
2244
+ if (c$5.isDirectory()) {
2245
+ if (s$8.type === "Directory") {
2246
+ const n$4 = !this.noChmod && s$8.mode && (c$5.mode & 4095) !== s$8.mode, p$1 = (f$4) => this[d](f$4, s$8, e$7);
2247
+ return n$4 ? r.chmod(s$8.absolute, s$8.mode, p$1) : p$1();
2248
+ }
2249
+ if (s$8.absolute !== this.cwd) return r.rmdir(s$8.absolute, (n$4) => this[d](n$4, s$8, e$7));
2250
+ }
2251
+ if (s$8.absolute === this.cwd) return this[d](null, s$8, e$7);
2252
+ as(s$8.absolute, (n$4) => this[d](n$4, s$8, e$7));
2253
+ });
2254
+ };
2255
+ this[g] ? o$6() : t$7();
2256
+ }
2257
+ [d](s$8, i$8, e$7) {
2258
+ if (s$8) {
2259
+ this[m$3](s$8, i$8), e$7();
2260
+ return;
2261
+ }
2262
+ switch (i$8.type) {
2263
+ case "File":
2264
+ case "OldFile":
2265
+ case "ContiguousFile": return this[U](i$8, e$7);
2266
+ case "Link": return this[z$1](i$8, e$7);
2267
+ case "SymbolicLink": return this[B](i$8, e$7);
2268
+ case "Directory":
2269
+ case "GNUDumpDir": return this[F$1$1](i$8, e$7);
2270
+ }
2271
+ }
2272
+ [O$3](s$8, i$8, e$7, t$7) {
2273
+ r[e$7](i$8, s$8.absolute, (o$6) => {
2274
+ o$6 ? this[m$3](o$6, s$8) : (this[S$1](), s$8.resume()), t$7();
2275
+ });
2276
+ }
2277
+ }
2278
+ const T$1 = (a$11) => {
2279
+ try {
2280
+ return [null, a$11()];
2281
+ } catch (s$8) {
2282
+ return [s$8, null];
2283
+ }
2284
+ };
2285
+ class ls extends L {
2286
+ [d](s$8, i$8) {
2287
+ return super[d](s$8, i$8, () => {});
2288
+ }
2289
+ [q$1](s$8) {
2290
+ if (this[v$2](s$8), !this[g]) {
2291
+ const o$6 = this[b](this.cwd, this.dmode);
2292
+ if (o$6) return this[m$3](o$6, s$8);
2293
+ this[g] = true;
2294
+ }
2295
+ if (s$8.absolute !== this.cwd) {
2296
+ const o$6 = l$2(w$2.dirname(s$8.absolute));
2297
+ if (o$6 !== this.cwd) {
2298
+ const u$5 = this[b](o$6, this.dmode);
2299
+ if (u$5) return this[m$3](u$5, s$8);
2300
+ }
2301
+ }
2302
+ const [i$8, e$7] = T$1(() => r.lstatSync(s$8.absolute));
2303
+ if (e$7 && (this.keep || this.newer && e$7.mtime > s$8.mtime)) return this[x](s$8);
2304
+ if (i$8 || this[N](s$8, e$7)) return this[d](null, s$8);
2305
+ if (e$7.isDirectory()) {
2306
+ if (s$8.type === "Directory") {
2307
+ const [h$1] = !this.noChmod && s$8.mode && (e$7.mode & 4095) !== s$8.mode ? T$1(() => {
2308
+ r.chmodSync(s$8.absolute, s$8.mode);
2309
+ }) : [];
2310
+ return this[d](h$1, s$8);
2311
+ }
2312
+ const [o$6] = T$1(() => r.rmdirSync(s$8.absolute));
2313
+ this[d](o$6, s$8);
2314
+ }
2315
+ const [t$7] = s$8.absolute === this.cwd ? [] : T$1(() => us(s$8.absolute));
2316
+ this[d](t$7, s$8);
2317
+ }
2318
+ [U](s$8, i$8) {
2319
+ const e$7 = s$8.mode & 4095 || this.fmode, t$7 = (h$1) => {
2320
+ let c$5;
2321
+ try {
2322
+ r.closeSync(o$6);
2323
+ } catch (n$4) {
2324
+ c$5 = n$4;
2325
+ }
2326
+ (h$1 || c$5) && this[m$3](h$1 || c$5, s$8), i$8();
2327
+ };
2328
+ let o$6;
2329
+ try {
2330
+ o$6 = r.openSync(s$8.absolute, J$1(s$8.size), e$7);
2331
+ } catch (h$1) {
2332
+ return t$7(h$1);
2333
+ }
2334
+ const u$5 = this.transform && this.transform(s$8) || s$8;
2335
+ u$5 !== s$8 && (u$5.on("error", (h$1) => this[m$3](h$1, s$8)), s$8.pipe(u$5)), u$5.on("data", (h$1) => {
2336
+ try {
2337
+ r.writeSync(o$6, h$1, 0, h$1.length);
2338
+ } catch (c$5) {
2339
+ t$7(c$5);
2340
+ }
2341
+ }), u$5.on("end", (h$1) => {
2342
+ let c$5 = null;
2343
+ if (s$8.mtime && !this.noMtime) {
2344
+ const n$4 = s$8.atime || /* @__PURE__ */ new Date(), p$1 = s$8.mtime;
2345
+ try {
2346
+ r.futimesSync(o$6, n$4, p$1);
2347
+ } catch (f$4) {
2348
+ try {
2349
+ r.utimesSync(s$8.absolute, n$4, p$1);
2350
+ } catch {
2351
+ c$5 = f$4;
2352
+ }
2353
+ }
2354
+ }
2355
+ if (this[E$1](s$8)) {
2356
+ const n$4 = this[R$2](s$8), p$1 = this[_$1](s$8);
2357
+ try {
2358
+ r.fchownSync(o$6, n$4, p$1);
2359
+ } catch (f$4) {
2360
+ try {
2361
+ r.chownSync(s$8.absolute, n$4, p$1);
2362
+ } catch {
2363
+ c$5 = c$5 || f$4;
2364
+ }
2365
+ }
2366
+ }
2367
+ t$7(c$5);
2368
+ });
2369
+ }
2370
+ [F$1$1](s$8, i$8) {
2371
+ const e$7 = s$8.mode & 4095 || this.dmode, t$7 = this[b](s$8.absolute, e$7);
2372
+ if (t$7) {
2373
+ this[m$3](t$7, s$8), i$8();
2374
+ return;
2375
+ }
2376
+ if (s$8.mtime && !this.noMtime) try {
2377
+ r.utimesSync(s$8.absolute, s$8.atime || /* @__PURE__ */ new Date(), s$8.mtime);
2378
+ } catch {}
2379
+ if (this[E$1](s$8)) try {
2380
+ r.chownSync(s$8.absolute, this[R$2](s$8), this[_$1](s$8));
2381
+ } catch {}
2382
+ i$8(), s$8.resume();
2383
+ }
2384
+ [b](s$8, i$8) {
2385
+ try {
2386
+ return M.sync(l$2(s$8), {
2387
+ uid: this.uid,
2388
+ gid: this.gid,
2389
+ processUid: this.processUid,
2390
+ processGid: this.processGid,
2391
+ umask: this.processUmask,
2392
+ preserve: this.preservePaths,
2393
+ unlink: this.unlink,
2394
+ cache: this.dirCache,
2395
+ cwd: this.cwd,
2396
+ mode: i$8
2397
+ });
2398
+ } catch (e$7) {
2399
+ return e$7;
2400
+ }
2401
+ }
2402
+ [O$3](s$8, i$8, e$7, t$7) {
2403
+ try {
2404
+ r[e$7 + "Sync"](i$8, s$8.absolute), t$7(), s$8.resume();
2405
+ } catch (o$6) {
2406
+ return this[m$3](o$6, s$8);
2407
+ }
2408
+ }
2409
+ }
2410
+ return L.Sync = ls, G = L, G;
2411
+ }
2412
+ var f, q;
2413
+ function v() {
2414
+ if (q) return f;
2415
+ q = 1;
2416
+ const w$2 = s$6(), u$5 = Os(), p$1 = nativeFs, y$3 = X(), l$2 = path, m$3 = s();
2417
+ f = (r, e$7, o$6) => {
2418
+ typeof r == "function" ? (o$6 = r, e$7 = null, r = {}) : Array.isArray(r) && (e$7 = r, r = {}), typeof e$7 == "function" && (o$6 = e$7, e$7 = null), e$7 ? e$7 = Array.from(e$7) : e$7 = [];
2419
+ const t$7 = w$2(r);
2420
+ if (t$7.sync && typeof o$6 == "function") throw new TypeError("callback not supported for sync tar functions");
2421
+ if (!t$7.file && typeof o$6 == "function") throw new TypeError("callback only supported with file option");
2422
+ return e$7.length && d(t$7, e$7), t$7.file && t$7.sync ? $(t$7) : t$7.file ? h$1(t$7, o$6) : t$7.sync ? x(t$7) : z$1(t$7);
2423
+ };
2424
+ const d = (r, e$7) => {
2425
+ const o$6 = new Map(e$7.map((n$4) => [m$3(n$4), true])), t$7 = r.filter, s$8 = (n$4, i$8) => {
2426
+ const a$11 = i$8 || l$2.parse(n$4).root || ".", c$5 = n$4 === a$11 ? false : o$6.has(n$4) ? o$6.get(n$4) : s$8(l$2.dirname(n$4), a$11);
2427
+ return o$6.set(n$4, c$5), c$5;
2428
+ };
2429
+ r.filter = t$7 ? (n$4, i$8) => t$7(n$4, i$8) && s$8(m$3(n$4)) : (n$4) => s$8(m$3(n$4));
2430
+ }, $ = (r) => {
2431
+ const e$7 = new u$5.Sync(r), o$6 = r.file, t$7 = p$1.statSync(o$6), s$8 = r.maxReadSize || 16 * 1024 * 1024;
2432
+ new y$3.ReadStreamSync(o$6, {
2433
+ readSize: s$8,
2434
+ size: t$7.size
2435
+ }).pipe(e$7);
2436
+ }, h$1 = (r, e$7) => {
2437
+ const o$6 = new u$5(r), t$7 = r.maxReadSize || 16 * 1024 * 1024, s$8 = r.file, n$4 = new Promise((i$8, a$11) => {
2438
+ o$6.on("error", a$11), o$6.on("close", i$8), p$1.stat(s$8, (c$5, R$2) => {
2439
+ if (c$5) a$11(c$5);
2440
+ else {
2441
+ const S$1 = new y$3.ReadStream(s$8, {
2442
+ readSize: t$7,
2443
+ size: R$2.size
2444
+ });
2445
+ S$1.on("error", a$11), S$1.pipe(o$6);
2446
+ }
2447
+ });
2448
+ });
2449
+ return e$7 ? n$4.then(e$7, e$7) : n$4;
2450
+ }, x = (r) => new u$5.Sync(r), z$1 = (r) => new u$5(r);
2451
+ return f;
2452
+ }
2453
+ const tarExtract = getDefaultExportFromCjs(v());
2454
+ async function download(url, filePath, options = {}) {
2455
+ const infoPath = filePath + ".json";
2456
+ const info = JSON.parse(await readFile(infoPath, "utf8").catch(() => "{}"));
2457
+ const etag = (await sendFetch(url, {
2458
+ method: "HEAD",
2459
+ headers: options.headers
2460
+ }).catch(() => void 0))?.headers.get("etag");
2461
+ if (info.etag === etag && existsSync(filePath)) return;
2462
+ if (typeof etag === "string") info.etag = etag;
2463
+ const response = await sendFetch(url, { headers: options.headers });
2464
+ if (response.status >= 400) throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
2465
+ const stream = createWriteStream(filePath);
2466
+ await promisify(pipeline)(response.body, stream);
2467
+ await writeFile(infoPath, JSON.stringify(info), "utf8");
2468
+ }
2469
+ const inputRegex = /^(?<repo>[\w.-]+\/[\w.-]+)(?<subdir>[^#]+)?(?<ref>#[\w./@-]+)?/;
2470
+ function parseGitURI(input) {
2471
+ const m$3 = input.match(inputRegex)?.groups || {};
2472
+ return {
2473
+ repo: m$3.repo,
2474
+ subdir: m$3.subdir || "/",
2475
+ ref: m$3.ref ? m$3.ref.slice(1) : "main"
2476
+ };
2477
+ }
2478
+ function debug(...args) {
2479
+ if (process.env.DEBUG) console.debug("[giget]", ...args);
2480
+ }
2481
+ async function sendFetch(url, options = {}) {
2482
+ if (options.headers?.["sec-fetch-mode"]) options.mode = options.headers["sec-fetch-mode"];
2483
+ const res = await l$1(url, {
2484
+ ...options,
2485
+ headers: normalizeHeaders(options.headers)
2486
+ }).catch((error) => {
2487
+ throw new Error(`Failed to download ${url}: ${error}`, { cause: error });
2488
+ });
2489
+ if (options.validateStatus && res.status >= 400) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
2490
+ return res;
2491
+ }
2492
+ function cacheDirectory() {
2493
+ const cacheDir = process.env.XDG_CACHE_HOME ? resolve$1(process.env.XDG_CACHE_HOME, "giget") : resolve$1(homedir(), ".cache/giget");
2494
+ if (process.platform === "win32") {
2495
+ const windowsCacheDir = resolve$1(tmpdir(), "giget");
2496
+ if (!existsSync(windowsCacheDir) && existsSync(cacheDir)) try {
2497
+ renameSync(cacheDir, windowsCacheDir);
2498
+ } catch {}
2499
+ return windowsCacheDir;
2500
+ }
2501
+ return cacheDir;
2502
+ }
2503
+ function normalizeHeaders(headers = {}) {
2504
+ const normalized = {};
2505
+ for (const [key, value] of Object.entries(headers)) {
2506
+ if (!value) continue;
2507
+ normalized[key.toLowerCase()] = value;
2508
+ }
2509
+ return normalized;
2510
+ }
2511
+ const http = async (input, options) => {
2512
+ if (input.endsWith(".json")) return await _httpJSON(input, options);
2513
+ const url = new URL(input);
2514
+ let name = basename$1(url.pathname);
2515
+ try {
2516
+ const head = await sendFetch(url.href, {
2517
+ method: "HEAD",
2518
+ validateStatus: true,
2519
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2520
+ });
2521
+ if ((head.headers.get("content-type") || "").includes("application/json")) return await _httpJSON(input, options);
2522
+ const filename = head.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];
2523
+ if (filename) name = filename.split(".")[0];
2524
+ } catch (error) {
2525
+ debug(`Failed to fetch HEAD for ${url.href}:`, error);
2526
+ }
2527
+ return {
2528
+ name: `${name}-${url.href.slice(0, 8)}`,
2529
+ version: "",
2530
+ subdir: "",
2531
+ tar: url.href,
2532
+ defaultDir: name,
2533
+ headers: { Authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2534
+ };
2535
+ };
2536
+ const _httpJSON = async (input, options) => {
2537
+ const info = await (await sendFetch(input, {
2538
+ validateStatus: true,
2539
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 }
2540
+ })).json();
2541
+ if (!info.tar || !info.name) throw new Error(`Invalid template info from ${input}. name or tar fields are missing!`);
2542
+ return info;
2543
+ };
2544
+ const github = (input, options) => {
2545
+ const parsed = parseGitURI(input);
2546
+ const githubAPIURL = process.env.GIGET_GITHUB_URL || "https://api.github.com";
2547
+ return {
2548
+ name: parsed.repo.replace("/", "-"),
2549
+ version: parsed.ref,
2550
+ subdir: parsed.subdir,
2551
+ headers: {
2552
+ Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2553
+ Accept: "application/vnd.github+json",
2554
+ "X-GitHub-Api-Version": "2022-11-28"
2555
+ },
2556
+ url: `${githubAPIURL.replace("api.github.com", "github.com")}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
2557
+ tar: `${githubAPIURL}/repos/${parsed.repo}/tarball/${parsed.ref}`
2558
+ };
2559
+ };
2560
+ const gitlab = (input, options) => {
2561
+ const parsed = parseGitURI(input);
2562
+ const gitlab2 = process.env.GIGET_GITLAB_URL || "https://gitlab.com";
2563
+ return {
2564
+ name: parsed.repo.replace("/", "-"),
2565
+ version: parsed.ref,
2566
+ subdir: parsed.subdir,
2567
+ headers: {
2568
+ authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2569
+ "sec-fetch-mode": "same-origin"
2570
+ },
2571
+ url: `${gitlab2}/${parsed.repo}/tree/${parsed.ref}${parsed.subdir}`,
2572
+ tar: `${gitlab2}/${parsed.repo}/-/archive/${parsed.ref}.tar.gz`
2573
+ };
2574
+ };
2575
+ const bitbucket = (input, options) => {
2576
+ const parsed = parseGitURI(input);
2577
+ return {
2578
+ name: parsed.repo.replace("/", "-"),
2579
+ version: parsed.ref,
2580
+ subdir: parsed.subdir,
2581
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
2582
+ url: `https://bitbucket.com/${parsed.repo}/src/${parsed.ref}${parsed.subdir}`,
2583
+ tar: `https://bitbucket.org/${parsed.repo}/get/${parsed.ref}.tar.gz`
2584
+ };
2585
+ };
2586
+ const sourcehut = (input, options) => {
2587
+ const parsed = parseGitURI(input);
2588
+ return {
2589
+ name: parsed.repo.replace("/", "-"),
2590
+ version: parsed.ref,
2591
+ subdir: parsed.subdir,
2592
+ headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 },
2593
+ url: `https://git.sr.ht/~${parsed.repo}/tree/${parsed.ref}/item${parsed.subdir}`,
2594
+ tar: `https://git.sr.ht/~${parsed.repo}/archive/${parsed.ref}.tar.gz`
2595
+ };
2596
+ };
2597
+ const providers = {
2598
+ http,
2599
+ https: http,
2600
+ github,
2601
+ gh: github,
2602
+ gitlab,
2603
+ bitbucket,
2604
+ sourcehut
2605
+ };
2606
+ const DEFAULT_REGISTRY = "https://raw.githubusercontent.com/unjs/giget/main/templates";
2607
+ const registryProvider = (registryEndpoint = DEFAULT_REGISTRY, options = {}) => {
2608
+ return async (input) => {
2609
+ const start = Date.now();
2610
+ const registryURL = `${registryEndpoint}/${input}.json`;
2611
+ const result = await sendFetch(registryURL, { headers: { authorization: options.auth ? `Bearer ${options.auth}` : void 0 } });
2612
+ if (result.status >= 400) throw new Error(`Failed to download ${input} template info from ${registryURL}: ${result.status} ${result.statusText}`);
2613
+ const info = await result.json();
2614
+ if (!info.tar || !info.name) throw new Error(`Invalid template info from ${registryURL}. name or tar fields are missing!`);
2615
+ debug(`Fetched ${input} template info from ${registryURL} in ${Date.now() - start}ms`);
2616
+ return info;
2617
+ };
2618
+ };
2619
+ const sourceProtoRe = /^([\w-.]+):/;
2620
+ async function downloadTemplate(input, options = {}) {
2621
+ options = defu({
2622
+ registry: process.env.GIGET_REGISTRY,
2623
+ auth: process.env.GIGET_AUTH
2624
+ }, options);
2625
+ const registry = options.registry === false ? void 0 : registryProvider(options.registry, { auth: options.auth });
2626
+ let providerName = options.provider || (registry ? "registry" : "github");
2627
+ let source = input;
2628
+ const sourceProviderMatch = input.match(sourceProtoRe);
2629
+ if (sourceProviderMatch) {
2630
+ providerName = sourceProviderMatch[1];
2631
+ source = input.slice(sourceProviderMatch[0].length);
2632
+ if (providerName === "http" || providerName === "https") source = input;
2633
+ }
2634
+ const provider = options.providers?.[providerName] || providers[providerName] || registry;
2635
+ if (!provider) throw new Error(`Unsupported provider: ${providerName}`);
2636
+ const template = await Promise.resolve().then(() => provider(source, { auth: options.auth })).catch((error) => {
2637
+ throw new Error(`Failed to download template from ${providerName}: ${error.message}`);
2638
+ });
2639
+ if (!template) throw new Error(`Failed to resolve template from ${providerName}`);
2640
+ template.name = (template.name || "template").replace(/[^\da-z-]/gi, "-");
2641
+ template.defaultDir = (template.defaultDir || template.name).replace(/[^\da-z-]/gi, "-");
2642
+ const tarPath = resolve$1(resolve$1(cacheDirectory(), providerName, template.name), (template.version || template.name) + ".tar.gz");
2643
+ if (options.preferOffline && existsSync(tarPath)) options.offline = true;
2644
+ if (!options.offline) {
2645
+ await mkdir(dirname$1(tarPath), { recursive: true });
2646
+ const s2 = Date.now();
2647
+ await download(template.tar, tarPath, { headers: {
2648
+ Authorization: options.auth ? `Bearer ${options.auth}` : void 0,
2649
+ ...normalizeHeaders(template.headers)
2650
+ } }).catch((error) => {
2651
+ if (!existsSync(tarPath)) throw error;
2652
+ debug("Download error. Using cached version:", error);
2653
+ options.offline = true;
2654
+ });
2655
+ debug(`Downloaded ${template.tar} to ${tarPath} in ${Date.now() - s2}ms`);
2656
+ }
2657
+ if (!existsSync(tarPath)) throw new Error(`Tarball not found: ${tarPath} (offline: ${options.offline})`);
2658
+ const extractPath = resolve$1(resolve$1(options.cwd || "."), options.dir || template.defaultDir);
2659
+ if (options.forceClean) await rm(extractPath, {
2660
+ recursive: true,
2661
+ force: true
2662
+ });
2663
+ if (!options.force && existsSync(extractPath) && readdirSync(extractPath).length > 0) throw new Error(`Destination ${extractPath} already exists.`);
2664
+ await mkdir(extractPath, { recursive: true });
2665
+ const s$8 = Date.now();
2666
+ const subdir = template.subdir?.replace(/^\//, "") || "";
2667
+ await tarExtract({
2668
+ file: tarPath,
2669
+ cwd: extractPath,
2670
+ onentry(entry) {
2671
+ entry.path = entry.path.split("/").splice(1).join("/");
2672
+ if (subdir) if (entry.path.startsWith(subdir + "/")) entry.path = entry.path.slice(subdir.length);
2673
+ else entry.path = "";
2674
+ }
2675
+ });
2676
+ debug(`Extracted to ${extractPath} in ${Date.now() - s$8}ms`);
2677
+ if (options.install) {
2678
+ debug("Installing dependencies...");
2679
+ await installDependencies({
2680
+ cwd: extractPath,
2681
+ silent: options.silent
2682
+ });
2683
+ }
2684
+ return {
2685
+ ...template,
2686
+ source,
2687
+ dir: extractPath
2688
+ };
2689
+ }
2690
+
2691
+ //#endregion
2692
+ export { downloadTemplate };