storybook 9.0.0-alpha.1 → 9.0.0-alpha.3

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 (214) hide show
  1. package/README.md +31 -29
  2. package/assets/browser/favicon.svg +1 -0
  3. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  4. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  5. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  6. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  7. package/assets/docs/message-reference.png +0 -0
  8. package/assets/server/addon.tsconfig.json +6 -0
  9. package/assets/server/base-preview-body.html +119 -0
  10. package/assets/server/base-preview-head.html +451 -0
  11. package/assets/server/template.ejs +87 -0
  12. package/bin/index.cjs +1 -1
  13. package/dist/babel/index.cjs +54034 -0
  14. package/dist/babel/index.d.ts +7488 -0
  15. package/dist/babel/index.js +54044 -0
  16. package/dist/bin/index.cjs +123 -0
  17. package/dist/bin/index.js +117 -0
  18. package/dist/builder-manager/index.cjs +2167 -0
  19. package/dist/builder-manager/index.d.ts +19 -0
  20. package/dist/builder-manager/index.js +2189 -0
  21. package/dist/channels/index.cjs +1936 -0
  22. package/dist/channels/index.d.ts +108 -0
  23. package/dist/channels/index.js +1883 -0
  24. package/dist/cli/bin/index.cjs +2687 -0
  25. package/dist/cli/bin/index.d.ts +2 -0
  26. package/dist/cli/bin/index.js +2707 -0
  27. package/dist/cli/index.cjs +17327 -0
  28. package/dist/cli/index.d.ts +209 -0
  29. package/dist/cli/index.js +17349 -0
  30. package/dist/client-logger/index.cjs +112 -0
  31. package/dist/client-logger/index.d.ts +29 -0
  32. package/dist/client-logger/index.js +70 -0
  33. package/dist/common/index.cjs +20560 -0
  34. package/dist/common/index.d.ts +954 -0
  35. package/dist/common/index.js +20645 -0
  36. package/dist/components/index.cjs +30056 -0
  37. package/dist/components/index.d.ts +1423 -0
  38. package/dist/components/index.js +25416 -0
  39. package/dist/core-events/index.cjs +167 -0
  40. package/dist/core-events/index.d.ts +313 -0
  41. package/dist/core-events/index.js +149 -0
  42. package/dist/core-server/index.cjs +37870 -0
  43. package/dist/core-server/index.d.ts +462 -0
  44. package/dist/core-server/index.js +37964 -0
  45. package/dist/core-server/presets/common-manager.js +28 -0
  46. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  47. package/dist/core-server/presets/common-override-preset.js +4829 -0
  48. package/dist/core-server/presets/common-preset.cjs +10228 -0
  49. package/dist/core-server/presets/common-preset.js +10306 -0
  50. package/dist/csf/index.cjs +223 -0
  51. package/dist/csf/index.d.ts +752 -0
  52. package/dist/csf/index.js +216 -0
  53. package/dist/csf-tools/index.cjs +1422 -0
  54. package/dist/csf-tools/index.d.ts +250 -0
  55. package/dist/csf-tools/index.js +1439 -0
  56. package/dist/docs-tools/index.cjs +923 -0
  57. package/dist/docs-tools/index.d.ts +162 -0
  58. package/dist/docs-tools/index.js +909 -0
  59. package/dist/index.cjs +17 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +2 -7
  62. package/dist/instrumenter/index.cjs +3273 -0
  63. package/dist/instrumenter/index.d.ts +104 -0
  64. package/dist/instrumenter/index.js +4800 -0
  65. package/dist/manager/globals-module-info.cjs +666 -0
  66. package/dist/manager/globals-module-info.d.ts +36 -0
  67. package/dist/manager/globals-module-info.js +653 -0
  68. package/dist/manager/globals-runtime.js +41565 -0
  69. package/dist/manager/globals.cjs +43 -0
  70. package/dist/manager/globals.d.ts +21 -0
  71. package/dist/manager/globals.js +30 -0
  72. package/dist/manager/runtime.js +12043 -0
  73. package/dist/manager-api/index.cjs +10770 -0
  74. package/dist/manager-api/index.d.ts +1211 -0
  75. package/dist/manager-api/index.js +4545 -0
  76. package/dist/manager-errors.d.ts +65 -0
  77. package/dist/manager-errors.js +83 -0
  78. package/dist/node-logger/index.cjs +1642 -0
  79. package/dist/node-logger/index.d.ts +117 -0
  80. package/dist/node-logger/index.js +1652 -0
  81. package/dist/preview/globals.cjs +34 -0
  82. package/dist/preview/globals.d.ts +12 -0
  83. package/dist/preview/globals.js +21 -0
  84. package/dist/preview/runtime.js +7721 -0
  85. package/dist/preview-api/index.cjs +5656 -0
  86. package/dist/preview-api/index.d.ts +1356 -0
  87. package/dist/preview-api/index.js +5663 -0
  88. package/dist/preview-errors.cjs +486 -0
  89. package/dist/preview-errors.d.ts +188 -0
  90. package/dist/preview-errors.js +433 -0
  91. package/dist/router/index.cjs +3320 -0
  92. package/dist/router/index.d.ts +385 -0
  93. package/dist/router/index.js +1849 -0
  94. package/dist/server-errors.cjs +710 -0
  95. package/dist/server-errors.d.ts +272 -0
  96. package/dist/server-errors.js +711 -0
  97. package/dist/telemetry/index.cjs +3683 -0
  98. package/dist/telemetry/index.d.ts +112 -0
  99. package/dist/telemetry/index.js +3720 -0
  100. package/dist/test/index.cjs +34915 -0
  101. package/dist/test/index.d.ts +186 -0
  102. package/dist/test/index.js +32798 -0
  103. package/dist/theming/create.cjs +2422 -0
  104. package/dist/theming/create.d.ts +50 -0
  105. package/dist/theming/create.js +990 -0
  106. package/dist/theming/index.cjs +4832 -0
  107. package/dist/theming/index.d.ts +11939 -0
  108. package/dist/theming/index.js +3253 -0
  109. package/dist/types/index.cjs +27 -0
  110. package/dist/types/index.d.ts +2541 -0
  111. package/dist/types/index.js +7 -0
  112. package/package.json +329 -212
  113. package/.eslintrc.cjs +0 -31
  114. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  115. package/core/babel/index.cjs +0 -1
  116. package/core/babel/index.d.ts +0 -2
  117. package/core/babel/index.js +0 -1
  118. package/core/builder-manager/index.cjs +0 -1
  119. package/core/builder-manager/index.d.ts +0 -2
  120. package/core/builder-manager/index.js +0 -1
  121. package/core/channels/index.cjs +0 -1
  122. package/core/channels/index.d.ts +0 -2
  123. package/core/channels/index.js +0 -1
  124. package/core/cli/bin/index.cjs +0 -1
  125. package/core/cli/bin/index.d.ts +0 -2
  126. package/core/cli/bin/index.js +0 -1
  127. package/core/cli/index.cjs +0 -1
  128. package/core/cli/index.d.ts +0 -2
  129. package/core/cli/index.js +0 -1
  130. package/core/client-logger/index.cjs +0 -1
  131. package/core/client-logger/index.d.ts +0 -2
  132. package/core/client-logger/index.js +0 -1
  133. package/core/common/index.cjs +0 -1
  134. package/core/common/index.d.ts +0 -2
  135. package/core/common/index.js +0 -1
  136. package/core/components/index.cjs +0 -1
  137. package/core/components/index.d.ts +0 -2
  138. package/core/components/index.js +0 -1
  139. package/core/core-events/index.cjs +0 -1
  140. package/core/core-events/index.d.ts +0 -2
  141. package/core/core-events/index.js +0 -1
  142. package/core/core-server/index.cjs +0 -1
  143. package/core/core-server/index.d.ts +0 -2
  144. package/core/core-server/index.js +0 -1
  145. package/core/core-server/presets/common-manager.js +0 -1
  146. package/core/core-server/presets/common-override-preset.cjs +0 -1
  147. package/core/core-server/presets/common-override-preset.js +0 -1
  148. package/core/core-server/presets/common-preset.cjs +0 -1
  149. package/core/core-server/presets/common-preset.js +0 -1
  150. package/core/csf/index.cjs +0 -1
  151. package/core/csf/index.d.ts +0 -2
  152. package/core/csf/index.js +0 -1
  153. package/core/csf-tools/index.cjs +0 -1
  154. package/core/csf-tools/index.d.ts +0 -2
  155. package/core/csf-tools/index.js +0 -1
  156. package/core/docs-tools/index.cjs +0 -1
  157. package/core/docs-tools/index.d.ts +0 -2
  158. package/core/docs-tools/index.js +0 -1
  159. package/core/index.cjs +0 -1
  160. package/core/index.d.ts +0 -2
  161. package/core/index.js +0 -1
  162. package/core/manager/globals-module-info.cjs +0 -1
  163. package/core/manager/globals-module-info.d.ts +0 -2
  164. package/core/manager/globals-module-info.js +0 -1
  165. package/core/manager/globals-runtime.js +0 -1
  166. package/core/manager/globals.cjs +0 -1
  167. package/core/manager/globals.d.ts +0 -2
  168. package/core/manager/globals.js +0 -1
  169. package/core/manager-api/index.cjs +0 -1
  170. package/core/manager-api/index.d.ts +0 -2
  171. package/core/manager-api/index.js +0 -1
  172. package/core/manager-errors.d.ts +0 -2
  173. package/core/manager-errors.js +0 -1
  174. package/core/node-logger/index.cjs +0 -1
  175. package/core/node-logger/index.d.ts +0 -2
  176. package/core/node-logger/index.js +0 -1
  177. package/core/preview/globals.cjs +0 -1
  178. package/core/preview/globals.d.ts +0 -2
  179. package/core/preview/globals.js +0 -1
  180. package/core/preview/runtime.js +0 -1
  181. package/core/preview-api/index.cjs +0 -1
  182. package/core/preview-api/index.d.ts +0 -2
  183. package/core/preview-api/index.js +0 -1
  184. package/core/preview-errors.cjs +0 -1
  185. package/core/preview-errors.d.ts +0 -2
  186. package/core/preview-errors.js +0 -1
  187. package/core/router/index.cjs +0 -1
  188. package/core/router/index.d.ts +0 -2
  189. package/core/router/index.js +0 -1
  190. package/core/server-errors.cjs +0 -1
  191. package/core/server-errors.d.ts +0 -2
  192. package/core/server-errors.js +0 -1
  193. package/core/telemetry/index.cjs +0 -1
  194. package/core/telemetry/index.d.ts +0 -2
  195. package/core/telemetry/index.js +0 -1
  196. package/core/theming/create.cjs +0 -1
  197. package/core/theming/create.d.ts +0 -2
  198. package/core/theming/create.js +0 -1
  199. package/core/theming/index.cjs +0 -1
  200. package/core/theming/index.d.ts +0 -2
  201. package/core/theming/index.js +0 -1
  202. package/core/types/index.cjs +0 -1
  203. package/core/types/index.d.ts +0 -2
  204. package/core/types/index.js +0 -1
  205. package/core.cjs +0 -0
  206. package/core.d.ts +0 -0
  207. package/core.js +0 -1
  208. package/dist/chunk-OWLSIX54.js +0 -8
  209. package/dist/core-path.cjs +0 -1
  210. package/dist/core-path.d.ts +0 -3
  211. package/dist/core-path.js +0 -9
  212. package/dist/proxy.cjs +0 -1
  213. package/dist/proxy.d.ts +0 -2
  214. package/dist/proxy.js +0 -9
@@ -0,0 +1,4824 @@
1
+ "use strict";
2
+ var vs = Object.create;
3
+ var pt = Object.defineProperty;
4
+ var Ts = Object.getOwnPropertyDescriptor;
5
+ var Cs = Object.getOwnPropertyNames;
6
+ var ks = Object.getPrototypeOf, As = Object.prototype.hasOwnProperty;
7
+ var l = (n, t) => pt(n, "name", { value: t, configurable: !0 });
8
+ var Se = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports), Rs = (n, t) => {
9
+ for (var e in t)
10
+ pt(n, e, { get: t[e], enumerable: !0 });
11
+ }, Ee = (n, t, e, s) => {
12
+ if (t && typeof t == "object" || typeof t == "function")
13
+ for (let i of Cs(t))
14
+ !As.call(n, i) && i !== e && pt(n, i, { get: () => t[i], enumerable: !(s = Ts(t, i)) || s.enumerable });
15
+ return n;
16
+ };
17
+ var Qt = (n, t, e) => (e = n != null ? vs(ks(n)) : {}, Ee(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
22
+ t || !n || !n.__esModule ? pt(e, "default", { value: n, enumerable: !0 }) : e,
23
+ n
24
+ )), Ds = (n) => Ee(pt({}, "__esModule", { value: !0 }), n);
25
+
26
+ // ../node_modules/balanced-match/index.js
27
+ var ke = Se((Ji, Ce) => {
28
+ "use strict";
29
+ Ce.exports = ve;
30
+ function ve(n, t, e) {
31
+ n instanceof RegExp && (n = xe(n, e)), t instanceof RegExp && (t = xe(t, e));
32
+ var s = Te(n, t, e);
33
+ return s && {
34
+ start: s[0],
35
+ end: s[1],
36
+ pre: e.slice(0, s[0]),
37
+ body: e.slice(s[0] + n.length, s[1]),
38
+ post: e.slice(s[1] + t.length)
39
+ };
40
+ }
41
+ l(ve, "balanced");
42
+ function xe(n, t) {
43
+ var e = t.match(n);
44
+ return e ? e[0] : null;
45
+ }
46
+ l(xe, "maybeMatch");
47
+ ve.range = Te;
48
+ function Te(n, t, e) {
49
+ var s, i, r, o, h, a = e.indexOf(n), c = e.indexOf(t, a + 1), f = a;
50
+ if (a >= 0 && c > 0) {
51
+ if (n === t)
52
+ return [a, c];
53
+ for (s = [], r = e.length; f >= 0 && !h; )
54
+ f == a ? (s.push(f), a = e.indexOf(n, f + 1)) : s.length == 1 ? h = [s.pop(), c] : (i = s.pop(), i < r && (r = i, o = c), c = e.indexOf(
55
+ t, f + 1)), f = a < c && a >= 0 ? a : c;
56
+ s.length && (h = [r, o]);
57
+ }
58
+ return h;
59
+ }
60
+ l(Te, "range");
61
+ });
62
+
63
+ // ../node_modules/brace-expansion/index.js
64
+ var Ne = Se((Qi, _e) => {
65
+ var Ae = ke();
66
+ _e.exports = Ms;
67
+ var Re = "\0SLASH" + Math.random() + "\0", De = "\0OPEN" + Math.random() + "\0", ee = "\0CLOSE" + Math.random() + "\0", Oe = "\0COMMA" + Math.
68
+ random() + "\0", Fe = "\0PERIOD" + Math.random() + "\0";
69
+ function te(n) {
70
+ return parseInt(n, 10) == n ? parseInt(n, 10) : n.charCodeAt(0);
71
+ }
72
+ l(te, "numeric");
73
+ function Os(n) {
74
+ return n.split("\\\\").join(Re).split("\\{").join(De).split("\\}").join(ee).split("\\,").join(Oe).split("\\.").join(Fe);
75
+ }
76
+ l(Os, "escapeBraces");
77
+ function Fs(n) {
78
+ return n.split(Re).join("\\").split(De).join("{").split(ee).join("}").split(Oe).join(",").split(Fe).join(".");
79
+ }
80
+ l(Fs, "unescapeBraces");
81
+ function Me(n) {
82
+ if (!n)
83
+ return [""];
84
+ var t = [], e = Ae("{", "}", n);
85
+ if (!e)
86
+ return n.split(",");
87
+ var s = e.pre, i = e.body, r = e.post, o = s.split(",");
88
+ o[o.length - 1] += "{" + i + "}";
89
+ var h = Me(r);
90
+ return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
91
+ }
92
+ l(Me, "parseCommaParts");
93
+ function Ms(n) {
94
+ return n ? (n.substr(0, 2) === "{}" && (n = "\\{\\}" + n.substr(2)), mt(Os(n), !0).map(Fs)) : [];
95
+ }
96
+ l(Ms, "expandTop");
97
+ function _s(n) {
98
+ return "{" + n + "}";
99
+ }
100
+ l(_s, "embrace");
101
+ function Ns(n) {
102
+ return /^-?0\d/.test(n);
103
+ }
104
+ l(Ns, "isPadded");
105
+ function Ls(n, t) {
106
+ return n <= t;
107
+ }
108
+ l(Ls, "lte");
109
+ function Ps(n, t) {
110
+ return n >= t;
111
+ }
112
+ l(Ps, "gte");
113
+ function mt(n, t) {
114
+ var e = [], s = Ae("{", "}", n);
115
+ if (!s) return [n];
116
+ var i = s.pre, r = s.post.length ? mt(s.post, !1) : [""];
117
+ if (/\$$/.test(s.pre))
118
+ for (var o = 0; o < r.length; o++) {
119
+ var h = i + "{" + s.body + "}" + r[o];
120
+ e.push(h);
121
+ }
122
+ else {
123
+ var a = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(s.body), c = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(s.body), f = a || c, u = s.body.
124
+ indexOf(",") >= 0;
125
+ if (!f && !u)
126
+ return s.post.match(/,.*\}/) ? (n = s.pre + "{" + s.body + ee + s.post, mt(n)) : [n];
127
+ var d;
128
+ if (f)
129
+ d = s.body.split(/\.\./);
130
+ else if (d = Me(s.body), d.length === 1 && (d = mt(d[0], !1).map(_s), d.length === 1))
131
+ return r.map(function(Ft) {
132
+ return s.pre + d[0] + Ft;
133
+ });
134
+ var p;
135
+ if (f) {
136
+ var w = te(d[0]), m = te(d[1]), y = Math.max(d[0].length, d[1].length), g = d.length == 3 ? Math.abs(te(d[2])) : 1, E = Ls, S = m < w;
137
+ S && (g *= -1, E = Ps);
138
+ var b = d.some(Ns);
139
+ p = [];
140
+ for (var x = w; E(x, m); x += g) {
141
+ var T;
142
+ if (c)
143
+ T = String.fromCharCode(x), T === "\\" && (T = "");
144
+ else if (T = String(x), b) {
145
+ var j = y - T.length;
146
+ if (j > 0) {
147
+ var tt = new Array(j + 1).join("0");
148
+ x < 0 ? T = "-" + tt + T.slice(1) : T = tt + T;
149
+ }
150
+ }
151
+ p.push(T);
152
+ }
153
+ } else {
154
+ p = [];
155
+ for (var I = 0; I < d.length; I++)
156
+ p.push.apply(p, mt(d[I], !1));
157
+ }
158
+ for (var I = 0; I < p.length; I++)
159
+ for (var o = 0; o < r.length; o++) {
160
+ var h = i + p[I] + r[o];
161
+ (!t || f || h) && e.push(h);
162
+ }
163
+ }
164
+ return e;
165
+ }
166
+ l(mt, "expand");
167
+ });
168
+
169
+ // src/core-server/presets/common-override-preset.ts
170
+ var Xi = {};
171
+ Rs(Xi, {
172
+ build: () => Vi,
173
+ docs: () => Ki,
174
+ framework: () => Gi,
175
+ stories: () => Hi,
176
+ typescript: () => qi
177
+ });
178
+ module.exports = Ds(Xi);
179
+
180
+ // src/core-server/utils/remove-mdx-entries.ts
181
+ var X = require("node:path"), Zt = require("storybook/internal/common");
182
+
183
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/index.js
184
+ var Ue = Qt(Ne(), 1);
185
+
186
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
187
+ var gt = /* @__PURE__ */ l((n) => {
188
+ if (typeof n != "string")
189
+ throw new TypeError("invalid pattern");
190
+ if (n.length > 65536)
191
+ throw new TypeError("pattern is too long");
192
+ }, "assertValidPattern");
193
+
194
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/brace-expressions.js
195
+ var Ws = {
196
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
197
+ "[:alpha:]": ["\\p{L}\\p{Nl}", !0],
198
+ "[:ascii:]": ["\\x00-\\x7f", !1],
199
+ "[:blank:]": ["\\p{Zs}\\t", !0],
200
+ "[:cntrl:]": ["\\p{Cc}", !0],
201
+ "[:digit:]": ["\\p{Nd}", !0],
202
+ "[:graph:]": ["\\p{Z}\\p{C}", !0, !0],
203
+ "[:lower:]": ["\\p{Ll}", !0],
204
+ "[:print:]": ["\\p{C}", !0],
205
+ "[:punct:]": ["\\p{P}", !0],
206
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
207
+ "[:upper:]": ["\\p{Lu}", !0],
208
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
209
+ "[:xdigit:]": ["A-Fa-f0-9", !1]
210
+ }, wt = /* @__PURE__ */ l((n) => n.replace(/[[\]\\-]/g, "\\$&"), "braceEscape"), js = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
211
+ "\\$&"), "regexpEscape"), Le = /* @__PURE__ */ l((n) => n.join(""), "rangesToString"), Pe = /* @__PURE__ */ l((n, t) => {
212
+ let e = t;
213
+ if (n.charAt(e) !== "[")
214
+ throw new Error("not in a brace expression");
215
+ let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, c = !1, f = e, u = "";
216
+ t: for (; r < n.length; ) {
217
+ let m = n.charAt(r);
218
+ if ((m === "!" || m === "^") && r === e + 1) {
219
+ c = !0, r++;
220
+ continue;
221
+ }
222
+ if (m === "]" && o && !a) {
223
+ f = r + 1;
224
+ break;
225
+ }
226
+ if (o = !0, m === "\\" && !a) {
227
+ a = !0, r++;
228
+ continue;
229
+ }
230
+ if (m === "[" && !a) {
231
+ for (let [y, [g, E, S]] of Object.entries(Ws))
232
+ if (n.startsWith(y, r)) {
233
+ if (u)
234
+ return ["$.", !1, n.length - e, !0];
235
+ r += y.length, S ? i.push(g) : s.push(g), h = h || E;
236
+ continue t;
237
+ }
238
+ }
239
+ if (a = !1, u) {
240
+ m > u ? s.push(wt(u) + "-" + wt(m)) : m === u && s.push(wt(m)), u = "", r++;
241
+ continue;
242
+ }
243
+ if (n.startsWith("-]", r + 1)) {
244
+ s.push(wt(m + "-")), r += 2;
245
+ continue;
246
+ }
247
+ if (n.startsWith("-", r + 1)) {
248
+ u = m, r += 2;
249
+ continue;
250
+ }
251
+ s.push(wt(m)), r++;
252
+ }
253
+ if (f < r)
254
+ return ["", !1, 0, !1];
255
+ if (!s.length && !i.length)
256
+ return ["$.", !1, n.length - e, !0];
257
+ if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !c) {
258
+ let m = s[0].length === 2 ? s[0].slice(-1) : s[0];
259
+ return [js(m), !1, f - e, !1];
260
+ }
261
+ let d = "[" + (c ? "^" : "") + Le(s) + "]", p = "[" + (c ? "" : "^") + Le(i) + "]";
262
+ return [s.length && i.length ? "(" + d + "|" + p + ")" : s.length ? d : p, h, f - e, !0];
263
+ }, "parseClass");
264
+
265
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/unescape.js
266
+ var z = /* @__PURE__ */ l((n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g,
267
+ "$1$2").replace(/\\([^\/])/g, "$1"), "unescape");
268
+
269
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/ast.js
270
+ var Is = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), We = /* @__PURE__ */ l((n) => Is.has(n), "isExtglobType"), zs = "(?!(?:^|/)\\.\\.\
271
+ ?(?:$|/))", Mt = "(?!\\.)", Bs = /* @__PURE__ */ new Set(["[", "."]), Us = /* @__PURE__ */ new Set(["..", "."]), $s = new Set("().*{}+?[]^$\\\
272
+ !"), Gs = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape"), se = "[^/]", je = se + "*?", Ie = se + "+\
273
+ ?", it = class n {
274
+ static {
275
+ l(this, "AST");
276
+ }
277
+ type;
278
+ #t;
279
+ #e;
280
+ #n = !1;
281
+ #i = [];
282
+ #o;
283
+ #S;
284
+ #l;
285
+ #f = !1;
286
+ #h;
287
+ #a;
288
+ // set to true if it's an extglob with no children
289
+ // (which really means one child of '')
290
+ #r = !1;
291
+ constructor(t, e, s = {}) {
292
+ this.type = t, t && (this.#e = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#l =
293
+ this.#t === this ? [] : this.#t.#l, t === "!" && !this.#t.#f && this.#l.push(this), this.#S = this.#o ? this.#o.#i.length : 0;
294
+ }
295
+ get hasMagic() {
296
+ if (this.#e !== void 0)
297
+ return this.#e;
298
+ for (let t of this.#i)
299
+ if (typeof t != "string" && (t.type || t.hasMagic))
300
+ return this.#e = !0;
301
+ return this.#e;
302
+ }
303
+ // reconstructs the pattern
304
+ toString() {
305
+ return this.#a !== void 0 ? this.#a : this.type ? this.#a = this.type + "(" + this.#i.map((t) => String(t)).join("|") + ")" : this.#a = this.#i.
306
+ map((t) => String(t)).join("");
307
+ }
308
+ #g() {
309
+ if (this !== this.#t)
310
+ throw new Error("should only call on root");
311
+ if (this.#f)
312
+ return this;
313
+ this.toString(), this.#f = !0;
314
+ let t;
315
+ for (; t = this.#l.pop(); ) {
316
+ if (t.type !== "!")
317
+ continue;
318
+ let e = t, s = e.#o;
319
+ for (; s; ) {
320
+ for (let i = e.#S + 1; !s.type && i < s.#i.length; i++)
321
+ for (let r of t.#i) {
322
+ if (typeof r == "string")
323
+ throw new Error("string part in extglob AST??");
324
+ r.copyIn(s.#i[i]);
325
+ }
326
+ e = s, s = e.#o;
327
+ }
328
+ }
329
+ return this;
330
+ }
331
+ push(...t) {
332
+ for (let e of t)
333
+ if (e !== "") {
334
+ if (typeof e != "string" && !(e instanceof n && e.#o === this))
335
+ throw new Error("invalid part: " + e);
336
+ this.#i.push(e);
337
+ }
338
+ }
339
+ toJSON() {
340
+ let t = this.type === null ? this.#i.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#i.map((e) => e.toJSON())];
341
+ return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#f && this.#o?.type === "!") && t.push(
342
+ {}), t;
343
+ }
344
+ isStart() {
345
+ if (this.#t === this)
346
+ return !0;
347
+ if (!this.#o?.isStart())
348
+ return !1;
349
+ if (this.#S === 0)
350
+ return !0;
351
+ let t = this.#o;
352
+ for (let e = 0; e < this.#S; e++) {
353
+ let s = t.#i[e];
354
+ if (!(s instanceof n && s.type === "!"))
355
+ return !1;
356
+ }
357
+ return !0;
358
+ }
359
+ isEnd() {
360
+ if (this.#t === this || this.#o?.type === "!")
361
+ return !0;
362
+ if (!this.#o?.isEnd())
363
+ return !1;
364
+ if (!this.type)
365
+ return this.#o?.isEnd();
366
+ let t = this.#o ? this.#o.#i.length : 0;
367
+ return this.#S === t - 1;
368
+ }
369
+ copyIn(t) {
370
+ typeof t == "string" ? this.push(t) : this.push(t.clone(this));
371
+ }
372
+ clone(t) {
373
+ let e = new n(this.type, t);
374
+ for (let s of this.#i)
375
+ e.copyIn(s);
376
+ return e;
377
+ }
378
+ static #w(t, e, s, i) {
379
+ let r = !1, o = !1, h = -1, a = !1;
380
+ if (e.type === null) {
381
+ let p = s, w = "";
382
+ for (; p < t.length; ) {
383
+ let m = t.charAt(p++);
384
+ if (r || m === "\\") {
385
+ r = !r, w += m;
386
+ continue;
387
+ }
388
+ if (o) {
389
+ p === h + 1 ? (m === "^" || m === "!") && (a = !0) : m === "]" && !(p === h + 2 && a) && (o = !1), w += m;
390
+ continue;
391
+ } else if (m === "[") {
392
+ o = !0, h = p, a = !1, w += m;
393
+ continue;
394
+ }
395
+ if (!i.noext && We(m) && t.charAt(p) === "(") {
396
+ e.push(w), w = "";
397
+ let y = new n(m, e);
398
+ p = n.#w(t, y, p, i), e.push(y);
399
+ continue;
400
+ }
401
+ w += m;
402
+ }
403
+ return e.push(w), p;
404
+ }
405
+ let c = s + 1, f = new n(null, e), u = [], d = "";
406
+ for (; c < t.length; ) {
407
+ let p = t.charAt(c++);
408
+ if (r || p === "\\") {
409
+ r = !r, d += p;
410
+ continue;
411
+ }
412
+ if (o) {
413
+ c === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(c === h + 2 && a) && (o = !1), d += p;
414
+ continue;
415
+ } else if (p === "[") {
416
+ o = !0, h = c, a = !1, d += p;
417
+ continue;
418
+ }
419
+ if (We(p) && t.charAt(c) === "(") {
420
+ f.push(d), d = "";
421
+ let w = new n(p, f);
422
+ f.push(w), c = n.#w(t, w, c, i);
423
+ continue;
424
+ }
425
+ if (p === "|") {
426
+ f.push(d), d = "", u.push(f), f = new n(null, e);
427
+ continue;
428
+ }
429
+ if (p === ")")
430
+ return d === "" && e.#i.length === 0 && (e.#r = !0), f.push(d), d = "", e.push(...u, f), c;
431
+ d += p;
432
+ }
433
+ return e.type = null, e.#e = void 0, e.#i = [t.substring(s - 1)], c;
434
+ }
435
+ static fromGlob(t, e = {}) {
436
+ let s = new n(null, void 0, e);
437
+ return n.#w(t, s, 0, e), s;
438
+ }
439
+ // returns the regular expression if there's magic, or the unescaped
440
+ // string if not.
441
+ toMMPattern() {
442
+ if (this !== this.#t)
443
+ return this.#t.toMMPattern();
444
+ let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
445
+ if (!(i || this.#e || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase()))
446
+ return s;
447
+ let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
448
+ return Object.assign(new RegExp(`^${e}$`, h), {
449
+ _src: e,
450
+ _glob: t
451
+ });
452
+ }
453
+ get options() {
454
+ return this.#h;
455
+ }
456
+ // returns the string match, the regexp source, whether there's magic
457
+ // in the regexp (so a regular expression is required) and whether or
458
+ // not the uflag is needed for the regular expression (for posix classes)
459
+ // TODO: instead of injecting the start/end at this point, just return
460
+ // the BODY of the regexp, along with the start/end portions suitable
461
+ // for binding the start/end in either a joined full-path makeRe context
462
+ // (where we bind to (^|/), or a standalone matchPart context (where
463
+ // we bind to ^, and not /). Otherwise slashes get duped!
464
+ //
465
+ // In part-matching mode, the start is:
466
+ // - if not isStart: nothing
467
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
468
+ // - if dots allowed or not possible: ^
469
+ // - if dots possible and not allowed: ^(?!\.)
470
+ // end is:
471
+ // - if not isEnd(): nothing
472
+ // - else: $
473
+ //
474
+ // In full-path matching mode, we put the slash at the START of the
475
+ // pattern, so start is:
476
+ // - if first pattern: same as part-matching mode
477
+ // - if not isStart(): nothing
478
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
479
+ // - if dots allowed or not possible: /
480
+ // - if dots possible and not allowed: /(?!\.)
481
+ // end is:
482
+ // - if last pattern, same as part-matching mode
483
+ // - else nothing
484
+ //
485
+ // Always put the (?:$|/) on negated tails, though, because that has to be
486
+ // there to bind the end of the negated pattern portion, and it's easier to
487
+ // just stick it in now rather than try to inject it later in the middle of
488
+ // the pattern.
489
+ //
490
+ // We can just always return the same end, and leave it up to the caller
491
+ // to know whether it's going to be used joined or in parts.
492
+ // And, if the start is adjusted slightly, can do the same there:
493
+ // - if not isStart: nothing
494
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
495
+ // - if dots allowed or not possible: (?:/|^)
496
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
497
+ //
498
+ // But it's better to have a simpler binding without a conditional, for
499
+ // performance, so probably better to return both start options.
500
+ //
501
+ // Then the caller just ignores the end if it's not the first pattern,
502
+ // and the start always gets applied.
503
+ //
504
+ // But that's always going to be $ if it's the ending pattern, or nothing,
505
+ // so the caller can just attach $ at the end of the pattern when building.
506
+ //
507
+ // So the todo is:
508
+ // - better detect what kind of start is needed
509
+ // - return both flavors of starting pattern
510
+ // - attach $ at the end of the pattern when creating the actual RegExp
511
+ //
512
+ // Ah, but wait, no, that all only applies to the root when the first pattern
513
+ // is not an extglob. If the first pattern IS an extglob, then we need all
514
+ // that dot prevention biz to live in the extglob portions, because eg
515
+ // +(*|.x*) can match .xy but not .yx.
516
+ //
517
+ // So, return the two flavors if it's #root and the first child is not an
518
+ // AST, otherwise leave it to the child AST to handle it, and there,
519
+ // use the (?:^|/) style of start binding.
520
+ //
521
+ // Even simplified further:
522
+ // - Since the start for a join is eg /(?!\.) and the start for a part
523
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
524
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
525
+ toRegExpSource(t) {
526
+ let e = t ?? !!this.#h.dot;
527
+ if (this.#t === this && this.#g(), !this.type) {
528
+ let a = this.isStart() && this.isEnd(), c = this.#i.map((p) => {
529
+ let [w, m, y, g] = typeof p == "string" ? n.#u(p, this.#e, a) : p.toRegExpSource(t);
530
+ return this.#e = this.#e || y, this.#n = this.#n || g, w;
531
+ }).join(""), f = "";
532
+ if (this.isStart() && typeof this.#i[0] == "string" && !(this.#i.length === 1 && Us.has(this.#i[0]))) {
533
+ let w = Bs, m = (
534
+ // dots are allowed, and the pattern starts with [ or .
535
+ e && w.has(c.charAt(0)) || // the pattern starts with \., and then [ or .
536
+ c.startsWith("\\.") && w.has(c.charAt(2)) || // the pattern starts with \.\., and then [ or .
537
+ c.startsWith("\\.\\.") && w.has(c.charAt(4))
538
+ ), y = !e && !t && w.has(c.charAt(0));
539
+ f = m ? zs : y ? Mt : "";
540
+ }
541
+ let u = "";
542
+ return this.isEnd() && this.#t.#f && this.#o?.type === "!" && (u = "(?:$|\\/)"), [
543
+ f + c + u,
544
+ z(c),
545
+ this.#e = !!this.#e,
546
+ this.#n
547
+ ];
548
+ }
549
+ let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
550
+ if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
551
+ let a = this.toString();
552
+ return this.#i = [a], this.type = null, this.#e = void 0, [a, z(this.toString()), !1, !1];
553
+ }
554
+ let o = !s || t || e || !Mt ? "" : this.#d(!0);
555
+ o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
556
+ let h = "";
557
+ if (this.type === "!" && this.#r)
558
+ h = (this.isStart() && !e ? Mt : "") + Ie;
559
+ else {
560
+ let a = this.type === "!" ? (
561
+ // !() must match something,but !(x) can match ''
562
+ "))" + (this.isStart() && !e && !t ? Mt : "") + je + ")"
563
+ ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
564
+ h = i + r + a;
565
+ }
566
+ return [
567
+ h,
568
+ z(r),
569
+ this.#e = !!this.#e,
570
+ this.#n
571
+ ];
572
+ }
573
+ #d(t) {
574
+ return this.#i.map((e) => {
575
+ if (typeof e == "string")
576
+ throw new Error("string type in extglob ast??");
577
+ let [s, i, r, o] = e.toRegExpSource(t);
578
+ return this.#n = this.#n || o, s;
579
+ }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
580
+ }
581
+ static #u(t, e, s = !1) {
582
+ let i = !1, r = "", o = !1;
583
+ for (let h = 0; h < t.length; h++) {
584
+ let a = t.charAt(h);
585
+ if (i) {
586
+ i = !1, r += ($s.has(a) ? "\\" : "") + a;
587
+ continue;
588
+ }
589
+ if (a === "\\") {
590
+ h === t.length - 1 ? r += "\\\\" : i = !0;
591
+ continue;
592
+ }
593
+ if (a === "[") {
594
+ let [c, f, u, d] = Pe(t, h);
595
+ if (u) {
596
+ r += c, o = o || f, h += u - 1, e = e || d;
597
+ continue;
598
+ }
599
+ }
600
+ if (a === "*") {
601
+ s && t === "*" ? r += Ie : r += je, e = !0;
602
+ continue;
603
+ }
604
+ if (a === "?") {
605
+ r += se, e = !0;
606
+ continue;
607
+ }
608
+ r += Gs(a);
609
+ }
610
+ return [r, z(t), !!e, o];
611
+ }
612
+ };
613
+
614
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/escape.js
615
+ var rt = /* @__PURE__ */ l((n, { windowsPathsNoEscape: t = !1 } = {}) => t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$\
616
+ &"), "escape");
617
+
618
+ // ../node_modules/glob/node_modules/minimatch/dist/esm/index.js
619
+ var F = /* @__PURE__ */ l((n, t, e = {}) => (gt(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new _(t, e).match(n)), "minimatch"), Hs = /^\*+([^+@!?\*\[\(]*)$/,
620
+ qs = /* @__PURE__ */ l((n) => (t) => !t.startsWith(".") && t.endsWith(n), "starDotExtTest"), Ks = /* @__PURE__ */ l((n) => (t) => t.endsWith(
621
+ n), "starDotExtTestDot"), Vs = /* @__PURE__ */ l((n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), "st\
622
+ arDotExtTestNocase"), Xs = /* @__PURE__ */ l((n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), "starDotExtTestNocaseDot"), Ys = /^\*+\.\*+$/,
623
+ Js = /* @__PURE__ */ l((n) => !n.startsWith(".") && n.includes("."), "starDotStarTest"), Zs = /* @__PURE__ */ l((n) => n !== "." && n !== ".\
624
+ ." && n.includes("."), "starDotStarTestDot"), Qs = /^\.\*+$/, ti = /* @__PURE__ */ l((n) => n !== "." && n !== ".." && n.startsWith("."), "d\
625
+ otStarTest"), ei = /^\*+$/, si = /* @__PURE__ */ l((n) => n.length !== 0 && !n.startsWith("."), "starTest"), ii = /* @__PURE__ */ l((n) => n.
626
+ length !== 0 && n !== "." && n !== "..", "starTestDot"), ri = /^\?+([^+@!?\*\[\(]*)?$/, ni = /* @__PURE__ */ l(([n, t = ""]) => {
627
+ let e = $e([n]);
628
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
629
+ }, "qmarksTestNocase"), oi = /* @__PURE__ */ l(([n, t = ""]) => {
630
+ let e = Ge([n]);
631
+ return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
632
+ }, "qmarksTestNocaseDot"), hi = /* @__PURE__ */ l(([n, t = ""]) => {
633
+ let e = Ge([n]);
634
+ return t ? (s) => e(s) && s.endsWith(t) : e;
635
+ }, "qmarksTestDot"), ai = /* @__PURE__ */ l(([n, t = ""]) => {
636
+ let e = $e([n]);
637
+ return t ? (s) => e(s) && s.endsWith(t) : e;
638
+ }, "qmarksTest"), $e = /* @__PURE__ */ l(([n]) => {
639
+ let t = n.length;
640
+ return (e) => e.length === t && !e.startsWith(".");
641
+ }, "qmarksTestNoExt"), Ge = /* @__PURE__ */ l(([n]) => {
642
+ let t = n.length;
643
+ return (e) => e.length === t && e !== "." && e !== "..";
644
+ }, "qmarksTestNoExtDot"), He = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ ||
645
+ process.platform : "posix", ze = {
646
+ win32: { sep: "\\" },
647
+ posix: { sep: "/" }
648
+ }, li = He === "win32" ? ze.win32.sep : ze.posix.sep;
649
+ F.sep = li;
650
+ var R = Symbol("globstar **");
651
+ F.GLOBSTAR = R;
652
+ var ci = "[^/]", fi = ci + "*?", ui = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", di = "(?:(?!(?:\\/|^)\\.).)*?", pi = /* @__PURE__ */ l((n, t = {}) => (e) => F(
653
+ e, n, t), "filter");
654
+ F.filter = pi;
655
+ var L = /* @__PURE__ */ l((n, t = {}) => Object.assign({}, n, t), "ext"), mi = /* @__PURE__ */ l((n) => {
656
+ if (!n || typeof n != "object" || !Object.keys(n).length)
657
+ return F;
658
+ let t = F;
659
+ return Object.assign(/* @__PURE__ */ l((s, i, r = {}) => t(s, i, L(n, r)), "m"), {
660
+ Minimatch: class extends t.Minimatch {
661
+ static {
662
+ l(this, "Minimatch");
663
+ }
664
+ constructor(i, r = {}) {
665
+ super(i, L(n, r));
666
+ }
667
+ static defaults(i) {
668
+ return t.defaults(L(n, i)).Minimatch;
669
+ }
670
+ },
671
+ AST: class extends t.AST {
672
+ static {
673
+ l(this, "AST");
674
+ }
675
+ /* c8 ignore start */
676
+ constructor(i, r, o = {}) {
677
+ super(i, r, L(n, o));
678
+ }
679
+ /* c8 ignore stop */
680
+ static fromGlob(i, r = {}) {
681
+ return t.AST.fromGlob(i, L(n, r));
682
+ }
683
+ },
684
+ unescape: /* @__PURE__ */ l((s, i = {}) => t.unescape(s, L(n, i)), "unescape"),
685
+ escape: /* @__PURE__ */ l((s, i = {}) => t.escape(s, L(n, i)), "escape"),
686
+ filter: /* @__PURE__ */ l((s, i = {}) => t.filter(s, L(n, i)), "filter"),
687
+ defaults: /* @__PURE__ */ l((s) => t.defaults(L(n, s)), "defaults"),
688
+ makeRe: /* @__PURE__ */ l((s, i = {}) => t.makeRe(s, L(n, i)), "makeRe"),
689
+ braceExpand: /* @__PURE__ */ l((s, i = {}) => t.braceExpand(s, L(n, i)), "braceExpand"),
690
+ match: /* @__PURE__ */ l((s, i, r = {}) => t.match(s, i, L(n, r)), "match"),
691
+ sep: t.sep,
692
+ GLOBSTAR: R
693
+ });
694
+ }, "defaults");
695
+ F.defaults = mi;
696
+ var qe = /* @__PURE__ */ l((n, t = {}) => (gt(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Ue.default)(n)), "braceExpand");
697
+ F.braceExpand = qe;
698
+ var gi = /* @__PURE__ */ l((n, t = {}) => new _(n, t).makeRe(), "makeRe");
699
+ F.makeRe = gi;
700
+ var wi = /* @__PURE__ */ l((n, t, e = {}) => {
701
+ let s = new _(t, e);
702
+ return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
703
+ }, "match");
704
+ F.match = wi;
705
+ var Be = /[?*]|[+@!]\(.*?\)|\[|\]/, yi = /* @__PURE__ */ l((n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "regExpEscape"), _ = class {
706
+ static {
707
+ l(this, "Minimatch");
708
+ }
709
+ options;
710
+ set;
711
+ pattern;
712
+ windowsPathsNoEscape;
713
+ nonegate;
714
+ negate;
715
+ comment;
716
+ empty;
717
+ preserveMultipleSlashes;
718
+ partial;
719
+ globSet;
720
+ globParts;
721
+ nocase;
722
+ isWindows;
723
+ platform;
724
+ windowsNoMagicRoot;
725
+ regexp;
726
+ constructor(t, e = {}) {
727
+ gt(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || He, this.isWindows = this.platform === "win32", this.
728
+ windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.
729
+ replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.
730
+ nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot =
731
+ e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.
732
+ set = [], this.make();
733
+ }
734
+ hasMagic() {
735
+ if (this.options.magicalBraces && this.set.length > 1)
736
+ return !0;
737
+ for (let t of this.set)
738
+ for (let e of t)
739
+ if (typeof e != "string")
740
+ return !0;
741
+ return !1;
742
+ }
743
+ debug(...t) {
744
+ }
745
+ make() {
746
+ let t = this.pattern, e = this.options;
747
+ if (!e.nocomment && t.charAt(0) === "#") {
748
+ this.comment = !0;
749
+ return;
750
+ }
751
+ if (!t) {
752
+ this.empty = !0;
753
+ return;
754
+ }
755
+ this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(
756
+ this.pattern, this.globSet);
757
+ let s = this.globSet.map((r) => this.slashSplit(r));
758
+ this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
759
+ let i = this.globParts.map((r, o, h) => {
760
+ if (this.isWindows && this.windowsNoMagicRoot) {
761
+ let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !Be.test(r[2])) && !Be.test(r[3]), c = /^[a-z]:/i.test(r[0]);
762
+ if (a)
763
+ return [...r.slice(0, 4), ...r.slice(4).map((f) => this.parse(f))];
764
+ if (c)
765
+ return [r[0], ...r.slice(1).map((f) => this.parse(f))];
766
+ }
767
+ return r.map((a) => this.parse(a));
768
+ });
769
+ if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows)
770
+ for (let r = 0; r < this.set.length; r++) {
771
+ let o = this.set[r];
772
+ o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
773
+ }
774
+ this.debug(this.pattern, this.set);
775
+ }
776
+ // various transforms to equivalent pattern sets that are
777
+ // faster to process in a filesystem walk. The goal is to
778
+ // eliminate what we can, and push all ** patterns as far
779
+ // to the right as possible, even if it increases the number
780
+ // of patterns that we have to process.
781
+ preprocess(t) {
782
+ if (this.options.noglobstar)
783
+ for (let s = 0; s < t.length; s++)
784
+ for (let i = 0; i < t[s].length; i++)
785
+ t[s][i] === "**" && (t[s][i] = "*");
786
+ let { optimizationLevel: e = 1 } = this.options;
787
+ return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.
788
+ adjascentGlobstarOptimize(t), t;
789
+ }
790
+ // just get rid of adjascent ** portions
791
+ adjascentGlobstarOptimize(t) {
792
+ return t.map((e) => {
793
+ let s = -1;
794
+ for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
795
+ let i = s;
796
+ for (; e[i + 1] === "**"; )
797
+ i++;
798
+ i !== s && e.splice(s, i - s);
799
+ }
800
+ return e;
801
+ });
802
+ }
803
+ // get rid of adjascent ** and resolve .. portions
804
+ levelOneOptimize(t) {
805
+ return t.map((e) => (e = e.reduce((s, i) => {
806
+ let r = s[s.length - 1];
807
+ return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
808
+ }, []), e.length === 0 ? [""] : e));
809
+ }
810
+ levelTwoFileOptimize(t) {
811
+ Array.isArray(t) || (t = this.slashSplit(t));
812
+ let e = !1;
813
+ do {
814
+ if (e = !1, !this.preserveMultipleSlashes) {
815
+ for (let i = 1; i < t.length - 1; i++) {
816
+ let r = t[i];
817
+ i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
818
+ }
819
+ t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
820
+ }
821
+ let s = 0;
822
+ for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
823
+ let i = t[s - 1];
824
+ i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
825
+ }
826
+ } while (e);
827
+ return t.length === 0 ? [""] : t;
828
+ }
829
+ // First phase: single-pattern processing
830
+ // <pre> is 1 or more portions
831
+ // <rest> is 1 or more portions
832
+ // <p> is any portion other than ., .., '', or **
833
+ // <e> is . or ''
834
+ //
835
+ // **/.. is *brutal* for filesystem walking performance, because
836
+ // it effectively resets the recursive walk each time it occurs,
837
+ // and ** cannot be reduced out by a .. pattern part like a regexp
838
+ // or most strings (other than .., ., and '') can be.
839
+ //
840
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
841
+ // <pre>/<e>/<rest> -> <pre>/<rest>
842
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
843
+ // **/**/<rest> -> **/<rest>
844
+ //
845
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
846
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
847
+ firstPhasePreProcess(t) {
848
+ let e = !1;
849
+ do {
850
+ e = !1;
851
+ for (let s of t) {
852
+ let i = -1;
853
+ for (; (i = s.indexOf("**", i + 1)) !== -1; ) {
854
+ let o = i;
855
+ for (; s[o + 1] === "**"; )
856
+ o++;
857
+ o > i && s.splice(i + 1, o - i);
858
+ let h = s[i + 1], a = s[i + 2], c = s[i + 3];
859
+ if (h !== ".." || !a || a === "." || a === ".." || !c || c === "." || c === "..")
860
+ continue;
861
+ e = !0, s.splice(i, 1);
862
+ let f = s.slice(0);
863
+ f[i] = "**", t.push(f), i--;
864
+ }
865
+ if (!this.preserveMultipleSlashes) {
866
+ for (let o = 1; o < s.length - 1; o++) {
867
+ let h = s[o];
868
+ o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(o, 1), o--);
869
+ }
870
+ s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
871
+ }
872
+ let r = 0;
873
+ for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
874
+ let o = s[r - 1];
875
+ if (o && o !== "." && o !== ".." && o !== "**") {
876
+ e = !0;
877
+ let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
878
+ s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
879
+ }
880
+ }
881
+ }
882
+ } while (e);
883
+ return t;
884
+ }
885
+ // second phase: multi-pattern dedupes
886
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
887
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
888
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
889
+ //
890
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
891
+ // ^-- not valid because ** doens't follow symlinks
892
+ secondPhasePreProcess(t) {
893
+ for (let e = 0; e < t.length - 1; e++)
894
+ for (let s = e + 1; s < t.length; s++) {
895
+ let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
896
+ if (i) {
897
+ t[e] = [], t[s] = i;
898
+ break;
899
+ }
900
+ }
901
+ return t.filter((e) => e.length);
902
+ }
903
+ partsMatch(t, e, s = !1) {
904
+ let i = 0, r = 0, o = [], h = "";
905
+ for (; i < t.length && r < e.length; )
906
+ if (t[i] === e[r])
907
+ o.push(h === "b" ? e[r] : t[i]), i++, r++;
908
+ else if (s && t[i] === "**" && e[r] === t[i + 1])
909
+ o.push(t[i]), i++;
910
+ else if (s && e[r] === "**" && t[i] === e[r + 1])
911
+ o.push(e[r]), r++;
912
+ else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
913
+ if (h === "b")
914
+ return !1;
915
+ h = "a", o.push(t[i]), i++, r++;
916
+ } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
917
+ if (h === "a")
918
+ return !1;
919
+ h = "b", o.push(e[r]), i++, r++;
920
+ } else
921
+ return !1;
922
+ return t.length === e.length && o;
923
+ }
924
+ parseNegate() {
925
+ if (this.nonegate)
926
+ return;
927
+ let t = this.pattern, e = !1, s = 0;
928
+ for (let i = 0; i < t.length && t.charAt(i) === "!"; i++)
929
+ e = !e, s++;
930
+ s && (this.pattern = t.slice(s)), this.negate = e;
931
+ }
932
+ // set partial to true to test if, for example,
933
+ // "/a/b" matches the start of "/*/b/*/d"
934
+ // Partial means, if you run out of file before you run
935
+ // out of pattern, then that's fine, as long as all
936
+ // the parts match.
937
+ matchOne(t, e, s = !1) {
938
+ let i = this.options;
939
+ if (this.isWindows) {
940
+ let m = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), y = !m && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]),
941
+ g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), E = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" &&
942
+ /^[a-z]:$/i.test(e[3]), S = y ? 3 : m ? 0 : void 0, b = E ? 3 : g ? 0 : void 0;
943
+ if (typeof S == "number" && typeof b == "number") {
944
+ let [x, T] = [t[S], e[b]];
945
+ x.toLowerCase() === T.toLowerCase() && (e[b] = x, b > S ? e = e.slice(b) : S > b && (t = t.slice(S)));
946
+ }
947
+ }
948
+ let { optimizationLevel: r = 1 } = this.options;
949
+ r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.
950
+ length);
951
+ for (var o = 0, h = 0, a = t.length, c = e.length; o < a && h < c; o++, h++) {
952
+ this.debug("matchOne loop");
953
+ var f = e[h], u = t[o];
954
+ if (this.debug(e, f, u), f === !1)
955
+ return !1;
956
+ if (f === R) {
957
+ this.debug("GLOBSTAR", [e, f, u]);
958
+ var d = o, p = h + 1;
959
+ if (p === c) {
960
+ for (this.debug("** at the end"); o < a; o++)
961
+ if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".")
962
+ return !1;
963
+ return !0;
964
+ }
965
+ for (; d < a; ) {
966
+ var w = t[d];
967
+ if (this.debug(`
968
+ globstar while`, t, d, e, p, w), this.matchOne(t.slice(d), e.slice(p), s))
969
+ return this.debug("globstar found match!", d, a, w), !0;
970
+ if (w === "." || w === ".." || !i.dot && w.charAt(0) === ".") {
971
+ this.debug("dot detected!", t, d, e, p);
972
+ break;
973
+ }
974
+ this.debug("globstar swallow a segment, and continue"), d++;
975
+ }
976
+ return !!(s && (this.debug(`
977
+ >>> no match, partial?`, t, d, e, p), d === a));
978
+ }
979
+ let m;
980
+ if (typeof f == "string" ? (m = u === f, this.debug("string match", f, u, m)) : (m = f.test(u), this.debug("pattern match", f, u, m)),
981
+ !m)
982
+ return !1;
983
+ }
984
+ if (o === a && h === c)
985
+ return !0;
986
+ if (o === a)
987
+ return s;
988
+ if (h === c)
989
+ return o === a - 1 && t[o] === "";
990
+ throw new Error("wtf?");
991
+ }
992
+ braceExpand() {
993
+ return qe(this.pattern, this.options);
994
+ }
995
+ parse(t) {
996
+ gt(t);
997
+ let e = this.options;
998
+ if (t === "**")
999
+ return R;
1000
+ if (t === "")
1001
+ return "";
1002
+ let s, i = null;
1003
+ (s = t.match(ei)) ? i = e.dot ? ii : si : (s = t.match(Hs)) ? i = (e.nocase ? e.dot ? Xs : Vs : e.dot ? Ks : qs)(s[1]) : (s = t.match(ri)) ?
1004
+ i = (e.nocase ? e.dot ? oi : ni : e.dot ? hi : ai)(s) : (s = t.match(Ys)) ? i = e.dot ? Zs : Js : (s = t.match(Qs)) && (i = ti);
1005
+ let r = it.fromGlob(t, this.options).toMMPattern();
1006
+ return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
1007
+ }
1008
+ makeRe() {
1009
+ if (this.regexp || this.regexp === !1)
1010
+ return this.regexp;
1011
+ let t = this.set;
1012
+ if (!t.length)
1013
+ return this.regexp = !1, this.regexp;
1014
+ let e = this.options, s = e.noglobstar ? fi : e.dot ? ui : di, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
1015
+ let c = a.map((f) => {
1016
+ if (f instanceof RegExp)
1017
+ for (let u of f.flags.split(""))
1018
+ i.add(u);
1019
+ return typeof f == "string" ? yi(f) : f === R ? R : f._src;
1020
+ });
1021
+ return c.forEach((f, u) => {
1022
+ let d = c[u + 1], p = c[u - 1];
1023
+ f !== R || p === R || (p === void 0 ? d !== void 0 && d !== R ? c[u + 1] = "(?:\\/|" + s + "\\/)?" + d : c[u] = s : d === void 0 ? c[u -
1024
+ 1] = p + "(?:\\/|" + s + ")?" : d !== R && (c[u - 1] = p + "(?:\\/|\\/" + s + "\\/)" + d, c[u + 1] = R));
1025
+ }), c.filter((f) => f !== R).join("/");
1026
+ }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1027
+ r = "^" + o + r + h + "$", this.negate && (r = "^(?!" + r + ").+$");
1028
+ try {
1029
+ this.regexp = new RegExp(r, [...i].join(""));
1030
+ } catch {
1031
+ this.regexp = !1;
1032
+ }
1033
+ return this.regexp;
1034
+ }
1035
+ slashSplit(t) {
1036
+ return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
1037
+ }
1038
+ match(t, e = this.partial) {
1039
+ if (this.debug("match", t, this.pattern), this.comment)
1040
+ return !1;
1041
+ if (this.empty)
1042
+ return t === "";
1043
+ if (t === "/" && e)
1044
+ return !0;
1045
+ let s = this.options;
1046
+ this.isWindows && (t = t.split("\\").join("/"));
1047
+ let i = this.slashSplit(t);
1048
+ this.debug(this.pattern, "split", i);
1049
+ let r = this.set;
1050
+ this.debug(this.pattern, "set", r);
1051
+ let o = i[i.length - 1];
1052
+ if (!o)
1053
+ for (let h = i.length - 2; !o && h >= 0; h--)
1054
+ o = i[h];
1055
+ for (let h = 0; h < r.length; h++) {
1056
+ let a = r[h], c = i;
1057
+ if (s.matchBase && a.length === 1 && (c = [o]), this.matchOne(c, a, e))
1058
+ return s.flipNegate ? !0 : !this.negate;
1059
+ }
1060
+ return s.flipNegate ? !1 : this.negate;
1061
+ }
1062
+ static defaults(t) {
1063
+ return F.defaults(t).Minimatch;
1064
+ }
1065
+ };
1066
+ F.AST = it;
1067
+ F.Minimatch = _;
1068
+ F.escape = rt;
1069
+ F.unescape = z;
1070
+
1071
+ // ../node_modules/glob/dist/esm/glob.js
1072
+ var gs = require("node:url");
1073
+
1074
+ // ../node_modules/lru-cache/dist/esm/index.js
1075
+ var nt = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Ve = /* @__PURE__ */ new Set(),
1076
+ ie = typeof process == "object" && process ? process : {}, Xe = /* @__PURE__ */ l((n, t, e, s) => {
1077
+ typeof ie.emitWarning == "function" ? ie.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
1078
+ }, "emitWarning"), _t = globalThis.AbortController, Ke = globalThis.AbortSignal;
1079
+ if (typeof _t > "u") {
1080
+ Ke = class {
1081
+ static {
1082
+ l(this, "AbortSignal");
1083
+ }
1084
+ onabort;
1085
+ _onabort = [];
1086
+ reason;
1087
+ aborted = !1;
1088
+ addEventListener(s, i) {
1089
+ this._onabort.push(i);
1090
+ }
1091
+ }, _t = class {
1092
+ static {
1093
+ l(this, "AbortController");
1094
+ }
1095
+ constructor() {
1096
+ t();
1097
+ }
1098
+ signal = new Ke();
1099
+ abort(s) {
1100
+ if (!this.signal.aborted) {
1101
+ this.signal.reason = s, this.signal.aborted = !0;
1102
+ for (let i of this.signal._onabort)
1103
+ i(s);
1104
+ this.signal.onabort?.(s);
1105
+ }
1106
+ }
1107
+ };
1108
+ let n = ie.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = /* @__PURE__ */ l(() => {
1109
+ n && (n = !1, Xe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-c\
1110
+ ontroller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, pass\
1111
+ ing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WAR\
1112
+ NING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
1113
+ }, "warnACPolyfill");
1114
+ }
1115
+ var bi = /* @__PURE__ */ l((n) => !Ve.has(n), "shouldWarn"), kr = Symbol("type"), Y = /* @__PURE__ */ l((n) => n && n === Math.floor(n) && n >
1116
+ 0 && isFinite(n), "isPosInt"), Ye = /* @__PURE__ */ l((n) => Y(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <=
1117
+ Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? ot : null : null, "getUintArray"), ot = class extends Array {
1118
+ static {
1119
+ l(this, "ZeroArray");
1120
+ }
1121
+ constructor(t) {
1122
+ super(t), this.fill(0);
1123
+ }
1124
+ }, re = class n {
1125
+ static {
1126
+ l(this, "Stack");
1127
+ }
1128
+ heap;
1129
+ length;
1130
+ // private constructor
1131
+ static #t = !1;
1132
+ static create(t) {
1133
+ let e = Ye(t);
1134
+ if (!e)
1135
+ return [];
1136
+ n.#t = !0;
1137
+ let s = new n(t, e);
1138
+ return n.#t = !1, s;
1139
+ }
1140
+ constructor(t, e) {
1141
+ if (!n.#t)
1142
+ throw new TypeError("instantiate Stack using Stack.create(n)");
1143
+ this.heap = new e(t), this.length = 0;
1144
+ }
1145
+ push(t) {
1146
+ this.heap[this.length++] = t;
1147
+ }
1148
+ pop() {
1149
+ return this.heap[--this.length];
1150
+ }
1151
+ }, yt = class n {
1152
+ static {
1153
+ l(this, "LRUCache");
1154
+ }
1155
+ // options that cannot be changed without disaster
1156
+ #t;
1157
+ #e;
1158
+ #n;
1159
+ #i;
1160
+ #o;
1161
+ #S;
1162
+ /**
1163
+ * {@link LRUCache.OptionsBase.ttl}
1164
+ */
1165
+ ttl;
1166
+ /**
1167
+ * {@link LRUCache.OptionsBase.ttlResolution}
1168
+ */
1169
+ ttlResolution;
1170
+ /**
1171
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
1172
+ */
1173
+ ttlAutopurge;
1174
+ /**
1175
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
1176
+ */
1177
+ updateAgeOnGet;
1178
+ /**
1179
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
1180
+ */
1181
+ updateAgeOnHas;
1182
+ /**
1183
+ * {@link LRUCache.OptionsBase.allowStale}
1184
+ */
1185
+ allowStale;
1186
+ /**
1187
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
1188
+ */
1189
+ noDisposeOnSet;
1190
+ /**
1191
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
1192
+ */
1193
+ noUpdateTTL;
1194
+ /**
1195
+ * {@link LRUCache.OptionsBase.maxEntrySize}
1196
+ */
1197
+ maxEntrySize;
1198
+ /**
1199
+ * {@link LRUCache.OptionsBase.sizeCalculation}
1200
+ */
1201
+ sizeCalculation;
1202
+ /**
1203
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
1204
+ */
1205
+ noDeleteOnFetchRejection;
1206
+ /**
1207
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
1208
+ */
1209
+ noDeleteOnStaleGet;
1210
+ /**
1211
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
1212
+ */
1213
+ allowStaleOnFetchAbort;
1214
+ /**
1215
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
1216
+ */
1217
+ allowStaleOnFetchRejection;
1218
+ /**
1219
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
1220
+ */
1221
+ ignoreFetchAbort;
1222
+ // computed properties
1223
+ #l;
1224
+ #f;
1225
+ #h;
1226
+ #a;
1227
+ #r;
1228
+ #g;
1229
+ #w;
1230
+ #d;
1231
+ #u;
1232
+ #v;
1233
+ #m;
1234
+ #T;
1235
+ #C;
1236
+ #b;
1237
+ #E;
1238
+ #x;
1239
+ #p;
1240
+ /**
1241
+ * Do not call this method unless you need to inspect the
1242
+ * inner workings of the cache. If anything returned by this
1243
+ * object is modified in any way, strange breakage may occur.
1244
+ *
1245
+ * These fields are private for a reason!
1246
+ *
1247
+ * @internal
1248
+ */
1249
+ static unsafeExposeInternals(t) {
1250
+ return {
1251
+ // properties
1252
+ starts: t.#C,
1253
+ ttls: t.#b,
1254
+ sizes: t.#T,
1255
+ keyMap: t.#h,
1256
+ keyList: t.#a,
1257
+ valList: t.#r,
1258
+ next: t.#g,
1259
+ prev: t.#w,
1260
+ get head() {
1261
+ return t.#d;
1262
+ },
1263
+ get tail() {
1264
+ return t.#u;
1265
+ },
1266
+ free: t.#v,
1267
+ // methods
1268
+ isBackgroundFetch: /* @__PURE__ */ l((e) => t.#c(e), "isBackgroundFetch"),
1269
+ backgroundFetch: /* @__PURE__ */ l((e, s, i, r) => t.#j(e, s, i, r), "backgroundFetch"),
1270
+ moveToTail: /* @__PURE__ */ l((e) => t.#z(e), "moveToTail"),
1271
+ indexes: /* @__PURE__ */ l((e) => t.#A(e), "indexes"),
1272
+ rindexes: /* @__PURE__ */ l((e) => t.#R(e), "rindexes"),
1273
+ isStale: /* @__PURE__ */ l((e) => t.#y(e), "isStale")
1274
+ };
1275
+ }
1276
+ // Protected read-only members
1277
+ /**
1278
+ * {@link LRUCache.OptionsBase.max} (read-only)
1279
+ */
1280
+ get max() {
1281
+ return this.#t;
1282
+ }
1283
+ /**
1284
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
1285
+ */
1286
+ get maxSize() {
1287
+ return this.#e;
1288
+ }
1289
+ /**
1290
+ * The total computed size of items in the cache (read-only)
1291
+ */
1292
+ get calculatedSize() {
1293
+ return this.#f;
1294
+ }
1295
+ /**
1296
+ * The number of items stored in the cache (read-only)
1297
+ */
1298
+ get size() {
1299
+ return this.#l;
1300
+ }
1301
+ /**
1302
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
1303
+ */
1304
+ get fetchMethod() {
1305
+ return this.#o;
1306
+ }
1307
+ get memoMethod() {
1308
+ return this.#S;
1309
+ }
1310
+ /**
1311
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
1312
+ */
1313
+ get dispose() {
1314
+ return this.#n;
1315
+ }
1316
+ /**
1317
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
1318
+ */
1319
+ get disposeAfter() {
1320
+ return this.#i;
1321
+ }
1322
+ constructor(t) {
1323
+ let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: c, disposeAfter: f,
1324
+ noDisposeOnSet: u, noUpdateTTL: d, maxSize: p = 0, maxEntrySize: w = 0, sizeCalculation: m, fetchMethod: y, memoMethod: g, noDeleteOnFetchRejection: E,
1325
+ noDeleteOnStaleGet: S, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: x, ignoreFetchAbort: T } = t;
1326
+ if (e !== 0 && !Y(e))
1327
+ throw new TypeError("max option must be a nonnegative integer");
1328
+ let j = e ? Ye(e) : Array;
1329
+ if (!j)
1330
+ throw new Error("invalid max value: " + e);
1331
+ if (this.#t = e, this.#e = p, this.maxEntrySize = w || this.#e, this.sizeCalculation = m, this.sizeCalculation) {
1332
+ if (!this.#e && !this.maxEntrySize)
1333
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1334
+ if (typeof this.sizeCalculation != "function")
1335
+ throw new TypeError("sizeCalculation set to non-function");
1336
+ }
1337
+ if (g !== void 0 && typeof g != "function")
1338
+ throw new TypeError("memoMethod must be a function if defined");
1339
+ if (this.#S = g, y !== void 0 && typeof y != "function")
1340
+ throw new TypeError("fetchMethod must be a function if specified");
1341
+ if (this.#o = y, this.#x = !!y, this.#h = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#r = new Array(e).fill(void 0),
1342
+ this.#g = new j(e), this.#w = new j(e), this.#d = 0, this.#u = 0, this.#v = re.create(e), this.#l = 0, this.#f = 0, typeof c == "functio\
1343
+ n" && (this.#n = c), typeof f == "function" ? (this.#i = f, this.#m = []) : (this.#i = void 0, this.#m = void 0), this.#E = !!this.#n, this.#p =
1344
+ !!this.#i, this.noDisposeOnSet = !!u, this.noUpdateTTL = !!d, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b,
1345
+ this.allowStaleOnFetchAbort = !!x, this.ignoreFetchAbort = !!T, this.maxEntrySize !== 0) {
1346
+ if (this.#e !== 0 && !Y(this.#e))
1347
+ throw new TypeError("maxSize must be a positive integer if specified");
1348
+ if (!Y(this.maxEntrySize))
1349
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
1350
+ this.#O();
1351
+ }
1352
+ if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!S, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = Y(i) ||
1353
+ i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
1354
+ if (!Y(this.ttl))
1355
+ throw new TypeError("ttl must be a positive integer if specified");
1356
+ this.#D();
1357
+ }
1358
+ if (this.#t === 0 && this.ttl === 0 && this.#e === 0)
1359
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
1360
+ if (!this.ttlAutopurge && !this.#t && !this.#e) {
1361
+ let tt = "LRU_CACHE_UNBOUNDED";
1362
+ bi(tt) && (Ve.add(tt), Xe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedC\
1363
+ acheWarning", tt, n));
1364
+ }
1365
+ }
1366
+ /**
1367
+ * Return the number of ms left in the item's TTL. If item is not in cache,
1368
+ * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
1369
+ */
1370
+ getRemainingTTL(t) {
1371
+ return this.#h.has(t) ? 1 / 0 : 0;
1372
+ }
1373
+ #D() {
1374
+ let t = new ot(this.#t), e = new ot(this.#t);
1375
+ this.#b = t, this.#C = e, this.#M = (r, o, h = nt.now()) => {
1376
+ if (e[r] = o !== 0 ? h : 0, t[r] = o, o !== 0 && this.ttlAutopurge) {
1377
+ let a = setTimeout(() => {
1378
+ this.#y(r) && this.#F(this.#a[r], "expire");
1379
+ }, o + 1);
1380
+ a.unref && a.unref();
1381
+ }
1382
+ }, this.#k = (r) => {
1383
+ e[r] = t[r] !== 0 ? nt.now() : 0;
1384
+ }, this.#s = (r, o) => {
1385
+ if (t[o]) {
1386
+ let h = t[o], a = e[o];
1387
+ if (!h || !a)
1388
+ return;
1389
+ r.ttl = h, r.start = a, r.now = s || i();
1390
+ let c = r.now - a;
1391
+ r.remainingTTL = h - c;
1392
+ }
1393
+ };
1394
+ let s = 0, i = /* @__PURE__ */ l(() => {
1395
+ let r = nt.now();
1396
+ if (this.ttlResolution > 0) {
1397
+ s = r;
1398
+ let o = setTimeout(() => s = 0, this.ttlResolution);
1399
+ o.unref && o.unref();
1400
+ }
1401
+ return r;
1402
+ }, "getNow");
1403
+ this.getRemainingTTL = (r) => {
1404
+ let o = this.#h.get(r);
1405
+ if (o === void 0)
1406
+ return 0;
1407
+ let h = t[o], a = e[o];
1408
+ if (!h || !a)
1409
+ return 1 / 0;
1410
+ let c = (s || i()) - a;
1411
+ return h - c;
1412
+ }, this.#y = (r) => {
1413
+ let o = e[r], h = t[r];
1414
+ return !!h && !!o && (s || i()) - o > h;
1415
+ };
1416
+ }
1417
+ // conditionally set private methods related to TTL
1418
+ #k = /* @__PURE__ */ l(() => {
1419
+ }, "#updateItemAge");
1420
+ #s = /* @__PURE__ */ l(() => {
1421
+ }, "#statusTTL");
1422
+ #M = /* @__PURE__ */ l(() => {
1423
+ }, "#setItemTTL");
1424
+ /* c8 ignore stop */
1425
+ #y = /* @__PURE__ */ l(() => !1, "#isStale");
1426
+ #O() {
1427
+ let t = new ot(this.#t);
1428
+ this.#f = 0, this.#T = t, this.#_ = (e) => {
1429
+ this.#f -= t[e], t[e] = 0;
1430
+ }, this.#L = (e, s, i, r) => {
1431
+ if (this.#c(s))
1432
+ return 0;
1433
+ if (!Y(i))
1434
+ if (r) {
1435
+ if (typeof r != "function")
1436
+ throw new TypeError("sizeCalculation must be a function");
1437
+ if (i = r(s, e), !Y(i))
1438
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1439
+ } else
1440
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size \
1441
+ must be set.");
1442
+ return i;
1443
+ }, this.#N = (e, s, i) => {
1444
+ if (t[e] = s, this.#e) {
1445
+ let r = this.#e - t[e];
1446
+ for (; this.#f > r; )
1447
+ this.#W(!0);
1448
+ }
1449
+ this.#f += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#f);
1450
+ };
1451
+ }
1452
+ #_ = /* @__PURE__ */ l((t) => {
1453
+ }, "#removeItemSize");
1454
+ #N = /* @__PURE__ */ l((t, e, s) => {
1455
+ }, "#addItemSize");
1456
+ #L = /* @__PURE__ */ l((t, e, s, i) => {
1457
+ if (s || i)
1458
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1459
+ return 0;
1460
+ }, "#requireSize");
1461
+ *#A({ allowStale: t = this.allowStale } = {}) {
1462
+ if (this.#l)
1463
+ for (let e = this.#u; !(!this.#P(e) || ((t || !this.#y(e)) && (yield e), e === this.#d)); )
1464
+ e = this.#w[e];
1465
+ }
1466
+ *#R({ allowStale: t = this.allowStale } = {}) {
1467
+ if (this.#l)
1468
+ for (let e = this.#d; !(!this.#P(e) || ((t || !this.#y(e)) && (yield e), e === this.#u)); )
1469
+ e = this.#g[e];
1470
+ }
1471
+ #P(t) {
1472
+ return t !== void 0 && this.#h.get(this.#a[t]) === t;
1473
+ }
1474
+ /**
1475
+ * Return a generator yielding `[key, value]` pairs,
1476
+ * in order from most recently used to least recently used.
1477
+ */
1478
+ *entries() {
1479
+ for (let t of this.#A())
1480
+ this.#r[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#r[t]) && (yield [this.#a[t], this.#r[t]]);
1481
+ }
1482
+ /**
1483
+ * Inverse order version of {@link LRUCache.entries}
1484
+ *
1485
+ * Return a generator yielding `[key, value]` pairs,
1486
+ * in order from least recently used to most recently used.
1487
+ */
1488
+ *rentries() {
1489
+ for (let t of this.#R())
1490
+ this.#r[t] !== void 0 && this.#a[t] !== void 0 && !this.#c(this.#r[t]) && (yield [this.#a[t], this.#r[t]]);
1491
+ }
1492
+ /**
1493
+ * Return a generator yielding the keys in the cache,
1494
+ * in order from most recently used to least recently used.
1495
+ */
1496
+ *keys() {
1497
+ for (let t of this.#A()) {
1498
+ let e = this.#a[t];
1499
+ e !== void 0 && !this.#c(this.#r[t]) && (yield e);
1500
+ }
1501
+ }
1502
+ /**
1503
+ * Inverse order version of {@link LRUCache.keys}
1504
+ *
1505
+ * Return a generator yielding the keys in the cache,
1506
+ * in order from least recently used to most recently used.
1507
+ */
1508
+ *rkeys() {
1509
+ for (let t of this.#R()) {
1510
+ let e = this.#a[t];
1511
+ e !== void 0 && !this.#c(this.#r[t]) && (yield e);
1512
+ }
1513
+ }
1514
+ /**
1515
+ * Return a generator yielding the values in the cache,
1516
+ * in order from most recently used to least recently used.
1517
+ */
1518
+ *values() {
1519
+ for (let t of this.#A())
1520
+ this.#r[t] !== void 0 && !this.#c(this.#r[t]) && (yield this.#r[t]);
1521
+ }
1522
+ /**
1523
+ * Inverse order version of {@link LRUCache.values}
1524
+ *
1525
+ * Return a generator yielding the values in the cache,
1526
+ * in order from least recently used to most recently used.
1527
+ */
1528
+ *rvalues() {
1529
+ for (let t of this.#R())
1530
+ this.#r[t] !== void 0 && !this.#c(this.#r[t]) && (yield this.#r[t]);
1531
+ }
1532
+ /**
1533
+ * Iterating over the cache itself yields the same results as
1534
+ * {@link LRUCache.entries}
1535
+ */
1536
+ [Symbol.iterator]() {
1537
+ return this.entries();
1538
+ }
1539
+ /**
1540
+ * A String value that is used in the creation of the default string
1541
+ * description of an object. Called by the built-in method
1542
+ * `Object.prototype.toString`.
1543
+ */
1544
+ [Symbol.toStringTag] = "LRUCache";
1545
+ /**
1546
+ * Find a value for which the supplied fn method returns a truthy value,
1547
+ * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
1548
+ */
1549
+ find(t, e = {}) {
1550
+ for (let s of this.#A()) {
1551
+ let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
1552
+ if (r !== void 0 && t(r, this.#a[s], this))
1553
+ return this.get(this.#a[s], e);
1554
+ }
1555
+ }
1556
+ /**
1557
+ * Call the supplied function on each item in the cache, in order from most
1558
+ * recently used to least recently used.
1559
+ *
1560
+ * `fn` is called as `fn(value, key, cache)`.
1561
+ *
1562
+ * If `thisp` is provided, function will be called in the `this`-context of
1563
+ * the provided object, or the cache if no `thisp` object is provided.
1564
+ *
1565
+ * Does not update age or recenty of use, or iterate over stale values.
1566
+ */
1567
+ forEach(t, e = this) {
1568
+ for (let s of this.#A()) {
1569
+ let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
1570
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1571
+ }
1572
+ }
1573
+ /**
1574
+ * The same as {@link LRUCache.forEach} but items are iterated over in
1575
+ * reverse order. (ie, less recently used items are iterated over first.)
1576
+ */
1577
+ rforEach(t, e = this) {
1578
+ for (let s of this.#R()) {
1579
+ let i = this.#r[s], r = this.#c(i) ? i.__staleWhileFetching : i;
1580
+ r !== void 0 && t.call(e, r, this.#a[s], this);
1581
+ }
1582
+ }
1583
+ /**
1584
+ * Delete any stale entries. Returns true if anything was removed,
1585
+ * false otherwise.
1586
+ */
1587
+ purgeStale() {
1588
+ let t = !1;
1589
+ for (let e of this.#R({ allowStale: !0 }))
1590
+ this.#y(e) && (this.#F(this.#a[e], "expire"), t = !0);
1591
+ return t;
1592
+ }
1593
+ /**
1594
+ * Get the extended info about a given entry, to get its value, size, and
1595
+ * TTL info simultaneously. Returns `undefined` if the key is not present.
1596
+ *
1597
+ * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
1598
+ * serialization, the `start` value is always the current timestamp, and the
1599
+ * `ttl` is a calculated remaining time to live (negative if expired).
1600
+ *
1601
+ * Always returns stale values, if their info is found in the cache, so be
1602
+ * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
1603
+ * if relevant.
1604
+ */
1605
+ info(t) {
1606
+ let e = this.#h.get(t);
1607
+ if (e === void 0)
1608
+ return;
1609
+ let s = this.#r[e], i = this.#c(s) ? s.__staleWhileFetching : s;
1610
+ if (i === void 0)
1611
+ return;
1612
+ let r = { value: i };
1613
+ if (this.#b && this.#C) {
1614
+ let o = this.#b[e], h = this.#C[e];
1615
+ if (o && h) {
1616
+ let a = o - (nt.now() - h);
1617
+ r.ttl = a, r.start = Date.now();
1618
+ }
1619
+ }
1620
+ return this.#T && (r.size = this.#T[e]), r;
1621
+ }
1622
+ /**
1623
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
1624
+ * passed to {@link LRLUCache#load}.
1625
+ *
1626
+ * The `start` fields are calculated relative to a portable `Date.now()`
1627
+ * timestamp, even if `performance.now()` is available.
1628
+ *
1629
+ * Stale entries are always included in the `dump`, even if
1630
+ * {@link LRUCache.OptionsBase.allowStale} is false.
1631
+ *
1632
+ * Note: this returns an actual array, not a generator, so it can be more
1633
+ * easily passed around.
1634
+ */
1635
+ dump() {
1636
+ let t = [];
1637
+ for (let e of this.#A({ allowStale: !0 })) {
1638
+ let s = this.#a[e], i = this.#r[e], r = this.#c(i) ? i.__staleWhileFetching : i;
1639
+ if (r === void 0 || s === void 0)
1640
+ continue;
1641
+ let o = { value: r };
1642
+ if (this.#b && this.#C) {
1643
+ o.ttl = this.#b[e];
1644
+ let h = nt.now() - this.#C[e];
1645
+ o.start = Math.floor(Date.now() - h);
1646
+ }
1647
+ this.#T && (o.size = this.#T[e]), t.unshift([s, o]);
1648
+ }
1649
+ return t;
1650
+ }
1651
+ /**
1652
+ * Reset the cache and load in the items in entries in the order listed.
1653
+ *
1654
+ * The shape of the resulting cache may be different if the same options are
1655
+ * not used in both caches.
1656
+ *
1657
+ * The `start` fields are assumed to be calculated relative to a portable
1658
+ * `Date.now()` timestamp, even if `performance.now()` is available.
1659
+ */
1660
+ load(t) {
1661
+ this.clear();
1662
+ for (let [e, s] of t) {
1663
+ if (s.start) {
1664
+ let i = Date.now() - s.start;
1665
+ s.start = nt.now() - i;
1666
+ }
1667
+ this.set(e, s.value, s);
1668
+ }
1669
+ }
1670
+ /**
1671
+ * Add a value to the cache.
1672
+ *
1673
+ * Note: if `undefined` is specified as a value, this is an alias for
1674
+ * {@link LRUCache#delete}
1675
+ *
1676
+ * Fields on the {@link LRUCache.SetOptions} options param will override
1677
+ * their corresponding values in the constructor options for the scope
1678
+ * of this single `set()` operation.
1679
+ *
1680
+ * If `start` is provided, then that will set the effective start
1681
+ * time for the TTL calculation. Note that this must be a previous
1682
+ * value of `performance.now()` if supported, or a previous value of
1683
+ * `Date.now()` if not.
1684
+ *
1685
+ * Options object may also include `size`, which will prevent
1686
+ * calling the `sizeCalculation` function and just use the specified
1687
+ * number if it is a positive integer, and `noDisposeOnSet` which
1688
+ * will prevent calling a `dispose` function in the case of
1689
+ * overwrites.
1690
+ *
1691
+ * If the `size` (or return value of `sizeCalculation`) for a given
1692
+ * entry is greater than `maxEntrySize`, then the item will not be
1693
+ * added to the cache.
1694
+ *
1695
+ * Will update the recency of the entry.
1696
+ *
1697
+ * If the value is `undefined`, then this is an alias for
1698
+ * `cache.delete(key)`. `undefined` is never stored in the cache.
1699
+ */
1700
+ set(t, e, s = {}) {
1701
+ if (e === void 0)
1702
+ return this.delete(t), this;
1703
+ let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, {
1704
+ noUpdateTTL: c = this.noUpdateTTL } = s, f = this.#L(t, e, s.size || 0, h);
1705
+ if (this.maxEntrySize && f > this.maxEntrySize)
1706
+ return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.#F(t, "set"), this;
1707
+ let u = this.#l === 0 ? void 0 : this.#h.get(t);
1708
+ if (u === void 0)
1709
+ u = this.#l === 0 ? this.#u : this.#v.length !== 0 ? this.#v.pop() : this.#l === this.#t ? this.#W(!1) : this.#l, this.#a[u] = t, this.#r[u] =
1710
+ e, this.#h.set(t, u), this.#g[this.#u] = u, this.#w[u] = this.#u, this.#u = u, this.#l++, this.#N(u, f, a), a && (a.set = "add"), c = !1;
1711
+ else {
1712
+ this.#z(u);
1713
+ let d = this.#r[u];
1714
+ if (e !== d) {
1715
+ if (this.#x && this.#c(d)) {
1716
+ d.__abortController.abort(new Error("replaced"));
1717
+ let { __staleWhileFetching: p } = d;
1718
+ p !== void 0 && !o && (this.#E && this.#n?.(p, t, "set"), this.#p && this.#m?.push([p, t, "set"]));
1719
+ } else o || (this.#E && this.#n?.(d, t, "set"), this.#p && this.#m?.push([d, t, "set"]));
1720
+ if (this.#_(u), this.#N(u, f, a), this.#r[u] = e, a) {
1721
+ a.set = "replace";
1722
+ let p = d && this.#c(d) ? d.__staleWhileFetching : d;
1723
+ p !== void 0 && (a.oldValue = p);
1724
+ }
1725
+ } else a && (a.set = "update");
1726
+ }
1727
+ if (i !== 0 && !this.#b && this.#D(), this.#b && (c || this.#M(u, i, r), a && this.#s(a, u)), !o && this.#p && this.#m) {
1728
+ let d = this.#m, p;
1729
+ for (; p = d?.shift(); )
1730
+ this.#i?.(...p);
1731
+ }
1732
+ return this;
1733
+ }
1734
+ /**
1735
+ * Evict the least recently used item, returning its value or
1736
+ * `undefined` if cache is empty.
1737
+ */
1738
+ pop() {
1739
+ try {
1740
+ for (; this.#l; ) {
1741
+ let t = this.#r[this.#d];
1742
+ if (this.#W(!0), this.#c(t)) {
1743
+ if (t.__staleWhileFetching)
1744
+ return t.__staleWhileFetching;
1745
+ } else if (t !== void 0)
1746
+ return t;
1747
+ }
1748
+ } finally {
1749
+ if (this.#p && this.#m) {
1750
+ let t = this.#m, e;
1751
+ for (; e = t?.shift(); )
1752
+ this.#i?.(...e);
1753
+ }
1754
+ }
1755
+ }
1756
+ #W(t) {
1757
+ let e = this.#d, s = this.#a[e], i = this.#r[e];
1758
+ return this.#x && this.#c(i) ? i.__abortController.abort(new Error("evicted")) : (this.#E || this.#p) && (this.#E && this.#n?.(i, s, "ev\
1759
+ ict"), this.#p && this.#m?.push([i, s, "evict"])), this.#_(e), t && (this.#a[e] = void 0, this.#r[e] = void 0, this.#v.push(e)), this.#l ===
1760
+ 1 ? (this.#d = this.#u = 0, this.#v.length = 0) : this.#d = this.#g[e], this.#h.delete(s), this.#l--, e;
1761
+ }
1762
+ /**
1763
+ * Check if a key is in the cache, without updating the recency of use.
1764
+ * Will return false if the item is stale, even though it is technically
1765
+ * in the cache.
1766
+ *
1767
+ * Check if a key is in the cache, without updating the recency of
1768
+ * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
1769
+ * to `true` in either the options or the constructor.
1770
+ *
1771
+ * Will return `false` if the item is stale, even though it is technically in
1772
+ * the cache. The difference can be determined (if it matters) by using a
1773
+ * `status` argument, and inspecting the `has` field.
1774
+ *
1775
+ * Will not update item age unless
1776
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
1777
+ */
1778
+ has(t, e = {}) {
1779
+ let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#h.get(t);
1780
+ if (r !== void 0) {
1781
+ let o = this.#r[r];
1782
+ if (this.#c(o) && o.__staleWhileFetching === void 0)
1783
+ return !1;
1784
+ if (this.#y(r))
1785
+ i && (i.has = "stale", this.#s(i, r));
1786
+ else return s && this.#k(r), i && (i.has = "hit", this.#s(i, r)), !0;
1787
+ } else i && (i.has = "miss");
1788
+ return !1;
1789
+ }
1790
+ /**
1791
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
1792
+ * items.
1793
+ *
1794
+ * Returns `undefined` if the item is stale, unless
1795
+ * {@link LRUCache.OptionsBase.allowStale} is set.
1796
+ */
1797
+ peek(t, e = {}) {
1798
+ let { allowStale: s = this.allowStale } = e, i = this.#h.get(t);
1799
+ if (i === void 0 || !s && this.#y(i))
1800
+ return;
1801
+ let r = this.#r[i];
1802
+ return this.#c(r) ? r.__staleWhileFetching : r;
1803
+ }
1804
+ #j(t, e, s, i) {
1805
+ let r = e === void 0 ? void 0 : this.#r[e];
1806
+ if (this.#c(r))
1807
+ return r;
1808
+ let o = new _t(), { signal: h } = s;
1809
+ h?.addEventListener("abort", () => o.abort(h.reason), {
1810
+ signal: o.signal
1811
+ });
1812
+ let a = {
1813
+ signal: o.signal,
1814
+ options: s,
1815
+ context: i
1816
+ }, c = /* @__PURE__ */ l((m, y = !1) => {
1817
+ let { aborted: g } = o.signal, E = s.ignoreFetchAbort && m !== void 0;
1818
+ if (s.status && (g && !y ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, E && (s.status.fetchAbortIgnored = !0)) :
1819
+ s.status.fetchResolved = !0), g && !E && !y)
1820
+ return u(o.signal.reason);
1821
+ let S = p;
1822
+ return this.#r[e] === p && (m === void 0 ? S.__staleWhileFetching ? this.#r[e] = S.__staleWhileFetching : this.#F(t, "fetch") : (s.status &&
1823
+ (s.status.fetchUpdated = !0), this.set(t, m, a.options))), m;
1824
+ }, "cb"), f = /* @__PURE__ */ l((m) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = m), u(m)), "eb"), u = /* @__PURE__ */ l(
1825
+ (m) => {
1826
+ let { aborted: y } = o.signal, g = y && s.allowStaleOnFetchAbort, E = g || s.allowStaleOnFetchRejection, S = E || s.noDeleteOnFetchRejection,
1827
+ b = p;
1828
+ if (this.#r[e] === p && (!S || b.__staleWhileFetching === void 0 ? this.#F(t, "fetch") : g || (this.#r[e] = b.__staleWhileFetching)), E)
1829
+ return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), b.__staleWhileFetching;
1830
+ if (b.__returned === b)
1831
+ throw m;
1832
+ }, "fetchFail"), d = /* @__PURE__ */ l((m, y) => {
1833
+ let g = this.#o?.(t, r, a);
1834
+ g && g instanceof Promise && g.then((E) => m(E === void 0 ? void 0 : E), y), o.signal.addEventListener("abort", () => {
1835
+ (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (m(void 0), s.allowStaleOnFetchAbort && (m = /* @__PURE__ */ l((E) => c(E, !0),
1836
+ "res")));
1837
+ });
1838
+ }, "pcall");
1839
+ s.status && (s.status.fetchDispatched = !0);
1840
+ let p = new Promise(d).then(c, f), w = Object.assign(p, {
1841
+ __abortController: o,
1842
+ __staleWhileFetching: r,
1843
+ __returned: void 0
1844
+ });
1845
+ return e === void 0 ? (this.set(t, w, { ...a.options, status: void 0 }), e = this.#h.get(t)) : this.#r[e] = w, w;
1846
+ }
1847
+ #c(t) {
1848
+ if (!this.#x)
1849
+ return !1;
1850
+ let e = t;
1851
+ return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof _t;
1852
+ }
1853
+ async fetch(t, e = {}) {
1854
+ let {
1855
+ // get options
1856
+ allowStale: s = this.allowStale,
1857
+ updateAgeOnGet: i = this.updateAgeOnGet,
1858
+ noDeleteOnStaleGet: r = this.noDeleteOnStaleGet,
1859
+ // set options
1860
+ ttl: o = this.ttl,
1861
+ noDisposeOnSet: h = this.noDisposeOnSet,
1862
+ size: a = 0,
1863
+ sizeCalculation: c = this.sizeCalculation,
1864
+ noUpdateTTL: f = this.noUpdateTTL,
1865
+ // fetch exclusive options
1866
+ noDeleteOnFetchRejection: u = this.noDeleteOnFetchRejection,
1867
+ allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection,
1868
+ ignoreFetchAbort: p = this.ignoreFetchAbort,
1869
+ allowStaleOnFetchAbort: w = this.allowStaleOnFetchAbort,
1870
+ context: m,
1871
+ forceRefresh: y = !1,
1872
+ status: g,
1873
+ signal: E
1874
+ } = e;
1875
+ if (!this.#x)
1876
+ return g && (g.fetch = "get"), this.get(t, {
1877
+ allowStale: s,
1878
+ updateAgeOnGet: i,
1879
+ noDeleteOnStaleGet: r,
1880
+ status: g
1881
+ });
1882
+ let S = {
1883
+ allowStale: s,
1884
+ updateAgeOnGet: i,
1885
+ noDeleteOnStaleGet: r,
1886
+ ttl: o,
1887
+ noDisposeOnSet: h,
1888
+ size: a,
1889
+ sizeCalculation: c,
1890
+ noUpdateTTL: f,
1891
+ noDeleteOnFetchRejection: u,
1892
+ allowStaleOnFetchRejection: d,
1893
+ allowStaleOnFetchAbort: w,
1894
+ ignoreFetchAbort: p,
1895
+ status: g,
1896
+ signal: E
1897
+ }, b = this.#h.get(t);
1898
+ if (b === void 0) {
1899
+ g && (g.fetch = "miss");
1900
+ let x = this.#j(t, b, S, m);
1901
+ return x.__returned = x;
1902
+ } else {
1903
+ let x = this.#r[b];
1904
+ if (this.#c(x)) {
1905
+ let Ft = s && x.__staleWhileFetching !== void 0;
1906
+ return g && (g.fetch = "inflight", Ft && (g.returnedStale = !0)), Ft ? x.__staleWhileFetching : x.__returned = x;
1907
+ }
1908
+ let T = this.#y(b);
1909
+ if (!y && !T)
1910
+ return g && (g.fetch = "hit"), this.#z(b), i && this.#k(b), g && this.#s(g, b), x;
1911
+ let j = this.#j(t, b, S, m), I = j.__staleWhileFetching !== void 0 && s;
1912
+ return g && (g.fetch = T ? "stale" : "refresh", I && T && (g.returnedStale = !0)), I ? j.__staleWhileFetching : j.__returned = j;
1913
+ }
1914
+ }
1915
+ async forceFetch(t, e = {}) {
1916
+ let s = await this.fetch(t, e);
1917
+ if (s === void 0)
1918
+ throw new Error("fetch() returned undefined");
1919
+ return s;
1920
+ }
1921
+ memo(t, e = {}) {
1922
+ let s = this.#S;
1923
+ if (!s)
1924
+ throw new Error("no memoMethod provided to constructor");
1925
+ let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
1926
+ if (!r && h !== void 0)
1927
+ return h;
1928
+ let a = s(t, h, {
1929
+ options: o,
1930
+ context: i
1931
+ });
1932
+ return this.set(t, a, o), a;
1933
+ }
1934
+ /**
1935
+ * Return a value from the cache. Will update the recency of the cache
1936
+ * entry found.
1937
+ *
1938
+ * If the key is not found, get() will return `undefined`.
1939
+ */
1940
+ get(t, e = {}) {
1941
+ let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e,
1942
+ h = this.#h.get(t);
1943
+ if (h !== void 0) {
1944
+ let a = this.#r[h], c = this.#c(a);
1945
+ return o && this.#s(o, h), this.#y(h) ? (o && (o.get = "stale"), c ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale =
1946
+ !0), s ? a.__staleWhileFetching : void 0) : (r || this.#F(t, "expire"), o && s && (o.returnedStale = !0), s ? a : void 0)) : (o && (o.
1947
+ get = "hit"), c ? a.__staleWhileFetching : (this.#z(h), i && this.#k(h), a));
1948
+ } else o && (o.get = "miss");
1949
+ }
1950
+ #I(t, e) {
1951
+ this.#w[e] = t, this.#g[t] = e;
1952
+ }
1953
+ #z(t) {
1954
+ t !== this.#u && (t === this.#d ? this.#d = this.#g[t] : this.#I(this.#w[t], this.#g[t]), this.#I(this.#u, t), this.#u = t);
1955
+ }
1956
+ /**
1957
+ * Deletes a key out of the cache.
1958
+ *
1959
+ * Returns true if the key was deleted, false otherwise.
1960
+ */
1961
+ delete(t) {
1962
+ return this.#F(t, "delete");
1963
+ }
1964
+ #F(t, e) {
1965
+ let s = !1;
1966
+ if (this.#l !== 0) {
1967
+ let i = this.#h.get(t);
1968
+ if (i !== void 0)
1969
+ if (s = !0, this.#l === 1)
1970
+ this.#B(e);
1971
+ else {
1972
+ this.#_(i);
1973
+ let r = this.#r[i];
1974
+ if (this.#c(r) ? r.__abortController.abort(new Error("deleted")) : (this.#E || this.#p) && (this.#E && this.#n?.(r, t, e), this.#p &&
1975
+ this.#m?.push([r, t, e])), this.#h.delete(t), this.#a[i] = void 0, this.#r[i] = void 0, i === this.#u)
1976
+ this.#u = this.#w[i];
1977
+ else if (i === this.#d)
1978
+ this.#d = this.#g[i];
1979
+ else {
1980
+ let o = this.#w[i];
1981
+ this.#g[o] = this.#g[i];
1982
+ let h = this.#g[i];
1983
+ this.#w[h] = this.#w[i];
1984
+ }
1985
+ this.#l--, this.#v.push(i);
1986
+ }
1987
+ }
1988
+ if (this.#p && this.#m?.length) {
1989
+ let i = this.#m, r;
1990
+ for (; r = i?.shift(); )
1991
+ this.#i?.(...r);
1992
+ }
1993
+ return s;
1994
+ }
1995
+ /**
1996
+ * Clear the cache entirely, throwing away all values.
1997
+ */
1998
+ clear() {
1999
+ return this.#B("delete");
2000
+ }
2001
+ #B(t) {
2002
+ for (let e of this.#R({ allowStale: !0 })) {
2003
+ let s = this.#r[e];
2004
+ if (this.#c(s))
2005
+ s.__abortController.abort(new Error("deleted"));
2006
+ else {
2007
+ let i = this.#a[e];
2008
+ this.#E && this.#n?.(s, i, t), this.#p && this.#m?.push([s, i, t]);
2009
+ }
2010
+ }
2011
+ if (this.#h.clear(), this.#r.fill(void 0), this.#a.fill(void 0), this.#b && this.#C && (this.#b.fill(0), this.#C.fill(0)), this.#T && this.#T.
2012
+ fill(0), this.#d = 0, this.#u = 0, this.#v.length = 0, this.#f = 0, this.#l = 0, this.#p && this.#m) {
2013
+ let e = this.#m, s;
2014
+ for (; s = e?.shift(); )
2015
+ this.#i?.(...s);
2016
+ }
2017
+ }
2018
+ };
2019
+
2020
+ // ../node_modules/path-scurry/dist/esm/index.js
2021
+ var lt = require("node:path"), os = require("node:url"), q = require("fs"), Di = Qt(require("node:fs"), 1), Q = require("node:fs/promises");
2022
+
2023
+ // ../node_modules/minipass/dist/esm/index.js
2024
+ var zt = require("node:events"), fe = Qt(require("node:stream"), 1), es = require("node:string_decoder");
2025
+ var Je = typeof process == "object" && process ? process : {
2026
+ stdout: null,
2027
+ stderr: null
2028
+ }, Si = /* @__PURE__ */ l((n) => !!n && typeof n == "object" && (n instanceof Z || n instanceof fe.default || Ei(n) || xi(n)), "isStream"), Ei = /* @__PURE__ */ l(
2029
+ (n) => !!n && typeof n == "object" && n instanceof zt.EventEmitter && typeof n.pipe == "function" && // node core Writable streams have a pipe() method, but it throws
2030
+ n.pipe !== fe.default.Writable.prototype.pipe, "isReadable"), xi = /* @__PURE__ */ l((n) => !!n && typeof n == "object" && n instanceof zt.EventEmitter &&
2031
+ typeof n.write == "function" && typeof n.end == "function", "isWritable"), K = Symbol("EOF"), V = Symbol("maybeEmitEnd"), J = Symbol("emitte\
2032
+ dEnd"), Nt = Symbol("emittingEnd"), bt = Symbol("emittedError"), Lt = Symbol("closed"), Ze = Symbol("read"), Pt = Symbol("flush"), Qe = Symbol(
2033
+ "flushChunk"), B = Symbol("encoding"), ht = Symbol("decoder"), C = Symbol("flowing"), St = Symbol("paused"), at = Symbol("resume"), k = Symbol(
2034
+ "buffer"), M = Symbol("pipes"), A = Symbol("bufferLength"), ne = Symbol("bufferPush"), Wt = Symbol("bufferShift"), D = Symbol("objectMode"),
2035
+ v = Symbol("destroyed"), oe = Symbol("error"), he = Symbol("emitData"), ts = Symbol("emitEnd"), ae = Symbol("emitEnd2"), G = Symbol("async"),
2036
+ le = Symbol("abort"), jt = Symbol("aborted"), Et = Symbol("signal"), et = Symbol("dataListeners"), N = Symbol("discarded"), xt = /* @__PURE__ */ l(
2037
+ (n) => Promise.resolve().then(n), "defer"), vi = /* @__PURE__ */ l((n) => n(), "nodefer"), Ti = /* @__PURE__ */ l((n) => n === "end" || n ===
2038
+ "finish" || n === "prefinish", "isEndish"), Ci = /* @__PURE__ */ l((n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor &&
2039
+ n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, "isArrayBufferLike"), ki = /* @__PURE__ */ l((n) => !Buffer.isBuffer(n) && ArrayBuffer.
2040
+ isView(n), "isArrayBufferView"), It = class {
2041
+ static {
2042
+ l(this, "Pipe");
2043
+ }
2044
+ src;
2045
+ dest;
2046
+ opts;
2047
+ ondrain;
2048
+ constructor(t, e, s) {
2049
+ this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[at](), this.dest.on("drain", this.ondrain);
2050
+ }
2051
+ unpipe() {
2052
+ this.dest.removeListener("drain", this.ondrain);
2053
+ }
2054
+ // only here for the prototype
2055
+ /* c8 ignore start */
2056
+ proxyErrors(t) {
2057
+ }
2058
+ /* c8 ignore stop */
2059
+ end() {
2060
+ this.unpipe(), this.opts.end && this.dest.end();
2061
+ }
2062
+ }, ce = class extends It {
2063
+ static {
2064
+ l(this, "PipeProxyErrors");
2065
+ }
2066
+ unpipe() {
2067
+ this.src.removeListener("error", this.proxyErrors), super.unpipe();
2068
+ }
2069
+ constructor(t, e, s) {
2070
+ super(t, e, s), this.proxyErrors = (i) => e.emit("error", i), t.on("error", this.proxyErrors);
2071
+ }
2072
+ }, Ai = /* @__PURE__ */ l((n) => !!n.objectMode, "isObjectModeOptions"), Ri = /* @__PURE__ */ l((n) => !n.objectMode && !!n.encoding && n.encoding !==
2073
+ "buffer", "isEncodingOptions"), Z = class extends zt.EventEmitter {
2074
+ static {
2075
+ l(this, "Minipass");
2076
+ }
2077
+ [C] = !1;
2078
+ [St] = !1;
2079
+ [M] = [];
2080
+ [k] = [];
2081
+ [D];
2082
+ [B];
2083
+ [G];
2084
+ [ht];
2085
+ [K] = !1;
2086
+ [J] = !1;
2087
+ [Nt] = !1;
2088
+ [Lt] = !1;
2089
+ [bt] = null;
2090
+ [A] = 0;
2091
+ [v] = !1;
2092
+ [Et];
2093
+ [jt] = !1;
2094
+ [et] = 0;
2095
+ [N] = !1;
2096
+ /**
2097
+ * true if the stream can be written
2098
+ */
2099
+ writable = !0;
2100
+ /**
2101
+ * true if the stream can be read
2102
+ */
2103
+ readable = !0;
2104
+ /**
2105
+ * If `RType` is Buffer, then options do not need to be provided.
2106
+ * Otherwise, an options object must be provided to specify either
2107
+ * {@link Minipass.SharedOptions.objectMode} or
2108
+ * {@link Minipass.SharedOptions.encoding}, as appropriate.
2109
+ */
2110
+ constructor(...t) {
2111
+ let e = t[0] || {};
2112
+ if (super(), e.objectMode && typeof e.encoding == "string")
2113
+ throw new TypeError("Encoding and objectMode may not be used together");
2114
+ Ai(e) ? (this[D] = !0, this[B] = null) : Ri(e) ? (this[B] = e.encoding, this[D] = !1) : (this[D] = !1, this[B] = null), this[G] = !!e.async,
2115
+ this[ht] = this[B] ? new es.StringDecoder(this[B]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: /* @__PURE__ */ l(
2116
+ () => this[k], "get") }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: /* @__PURE__ */ l(() => this[M],
2117
+ "get") });
2118
+ let { signal: s } = e;
2119
+ s && (this[Et] = s, s.aborted ? this[le]() : s.addEventListener("abort", () => this[le]()));
2120
+ }
2121
+ /**
2122
+ * The amount of data stored in the buffer waiting to be read.
2123
+ *
2124
+ * For Buffer strings, this will be the total byte length.
2125
+ * For string encoding streams, this will be the string character length,
2126
+ * according to JavaScript's `string.length` logic.
2127
+ * For objectMode streams, this is a count of the items waiting to be
2128
+ * emitted.
2129
+ */
2130
+ get bufferLength() {
2131
+ return this[A];
2132
+ }
2133
+ /**
2134
+ * The `BufferEncoding` currently in use, or `null`
2135
+ */
2136
+ get encoding() {
2137
+ return this[B];
2138
+ }
2139
+ /**
2140
+ * @deprecated - This is a read only property
2141
+ */
2142
+ set encoding(t) {
2143
+ throw new Error("Encoding must be set at instantiation time");
2144
+ }
2145
+ /**
2146
+ * @deprecated - Encoding may only be set at instantiation time
2147
+ */
2148
+ setEncoding(t) {
2149
+ throw new Error("Encoding must be set at instantiation time");
2150
+ }
2151
+ /**
2152
+ * True if this is an objectMode stream
2153
+ */
2154
+ get objectMode() {
2155
+ return this[D];
2156
+ }
2157
+ /**
2158
+ * @deprecated - This is a read-only property
2159
+ */
2160
+ set objectMode(t) {
2161
+ throw new Error("objectMode must be set at instantiation time");
2162
+ }
2163
+ /**
2164
+ * true if this is an async stream
2165
+ */
2166
+ get async() {
2167
+ return this[G];
2168
+ }
2169
+ /**
2170
+ * Set to true to make this stream async.
2171
+ *
2172
+ * Once set, it cannot be unset, as this would potentially cause incorrect
2173
+ * behavior. Ie, a sync stream can be made async, but an async stream
2174
+ * cannot be safely made sync.
2175
+ */
2176
+ set async(t) {
2177
+ this[G] = this[G] || !!t;
2178
+ }
2179
+ // drop everything and get out of the flow completely
2180
+ [le]() {
2181
+ this[jt] = !0, this.emit("abort", this[Et]?.reason), this.destroy(this[Et]?.reason);
2182
+ }
2183
+ /**
2184
+ * True if the stream has been aborted.
2185
+ */
2186
+ get aborted() {
2187
+ return this[jt];
2188
+ }
2189
+ /**
2190
+ * No-op setter. Stream aborted status is set via the AbortSignal provided
2191
+ * in the constructor options.
2192
+ */
2193
+ set aborted(t) {
2194
+ }
2195
+ write(t, e, s) {
2196
+ if (this[jt])
2197
+ return !1;
2198
+ if (this[K])
2199
+ throw new Error("write after end");
2200
+ if (this[v])
2201
+ return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })),
2202
+ !0;
2203
+ typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
2204
+ let i = this[G] ? xt : vi;
2205
+ if (!this[D] && !Buffer.isBuffer(t)) {
2206
+ if (ki(t))
2207
+ t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
2208
+ else if (Ci(t))
2209
+ t = Buffer.from(t);
2210
+ else if (typeof t != "string")
2211
+ throw new Error("Non-contiguous data written to non-objectMode stream");
2212
+ }
2213
+ return this[D] ? (this[C] && this[A] !== 0 && this[Pt](!0), this[C] ? this.emit("data", t) : this[ne](t), this[A] !== 0 && this.emit("re\
2214
+ adable"), s && i(s), this[C]) : t.length ? (typeof t == "string" && // unless it is a string already ready for us to use
2215
+ !(e === this[B] && !this[ht]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[B] && (t = this[ht].write(t)), this[C] &&
2216
+ this[A] !== 0 && this[Pt](!0), this[C] ? this.emit("data", t) : this[ne](t), this[A] !== 0 && this.emit("readable"), s && i(s), this[C]) :
2217
+ (this[A] !== 0 && this.emit("readable"), s && i(s), this[C]);
2218
+ }
2219
+ /**
2220
+ * Low-level explicit read method.
2221
+ *
2222
+ * In objectMode, the argument is ignored, and one item is returned if
2223
+ * available.
2224
+ *
2225
+ * `n` is the number of bytes (or in the case of encoding streams,
2226
+ * characters) to consume. If `n` is not provided, then the entire buffer
2227
+ * is returned, or `null` is returned if no data is available.
2228
+ *
2229
+ * If `n` is greater that the amount of data in the internal buffer,
2230
+ * then `null` is returned.
2231
+ */
2232
+ read(t) {
2233
+ if (this[v])
2234
+ return null;
2235
+ if (this[N] = !1, this[A] === 0 || t === 0 || t && t > this[A])
2236
+ return this[V](), null;
2237
+ this[D] && (t = null), this[k].length > 1 && !this[D] && (this[k] = [
2238
+ this[B] ? this[k].join("") : Buffer.concat(this[k], this[A])
2239
+ ]);
2240
+ let e = this[Ze](t || null, this[k][0]);
2241
+ return this[V](), e;
2242
+ }
2243
+ [Ze](t, e) {
2244
+ if (this[D])
2245
+ this[Wt]();
2246
+ else {
2247
+ let s = e;
2248
+ t === s.length || t === null ? this[Wt]() : typeof s == "string" ? (this[k][0] = s.slice(t), e = s.slice(0, t), this[A] -= t) : (this[k][0] =
2249
+ s.subarray(t), e = s.subarray(0, t), this[A] -= t);
2250
+ }
2251
+ return this.emit("data", e), !this[k].length && !this[K] && this.emit("drain"), e;
2252
+ }
2253
+ end(t, e, s) {
2254
+ return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s &&
2255
+ this.once("end", s), this[K] = !0, this.writable = !1, (this[C] || !this[St]) && this[V](), this;
2256
+ }
2257
+ // don't let the internal resume be overwritten
2258
+ [at]() {
2259
+ this[v] || (!this[et] && !this[M].length && (this[N] = !0), this[St] = !1, this[C] = !0, this.emit("resume"), this[k].length ? this[Pt]() :
2260
+ this[K] ? this[V]() : this.emit("drain"));
2261
+ }
2262
+ /**
2263
+ * Resume the stream if it is currently in a paused state
2264
+ *
2265
+ * If called when there are no pipe destinations or `data` event listeners,
2266
+ * this will place the stream in a "discarded" state, where all data will
2267
+ * be thrown away. The discarded state is removed if a pipe destination or
2268
+ * data handler is added, if pause() is called, or if any synchronous or
2269
+ * asynchronous iteration is started.
2270
+ */
2271
+ resume() {
2272
+ return this[at]();
2273
+ }
2274
+ /**
2275
+ * Pause the stream
2276
+ */
2277
+ pause() {
2278
+ this[C] = !1, this[St] = !0, this[N] = !1;
2279
+ }
2280
+ /**
2281
+ * true if the stream has been forcibly destroyed
2282
+ */
2283
+ get destroyed() {
2284
+ return this[v];
2285
+ }
2286
+ /**
2287
+ * true if the stream is currently in a flowing state, meaning that
2288
+ * any writes will be immediately emitted.
2289
+ */
2290
+ get flowing() {
2291
+ return this[C];
2292
+ }
2293
+ /**
2294
+ * true if the stream is currently in a paused state
2295
+ */
2296
+ get paused() {
2297
+ return this[St];
2298
+ }
2299
+ [ne](t) {
2300
+ this[D] ? this[A] += 1 : this[A] += t.length, this[k].push(t);
2301
+ }
2302
+ [Wt]() {
2303
+ return this[D] ? this[A] -= 1 : this[A] -= this[k][0].length, this[k].shift();
2304
+ }
2305
+ [Pt](t = !1) {
2306
+ do
2307
+ ;
2308
+ while (this[Qe](this[Wt]()) && this[k].length);
2309
+ !t && !this[k].length && !this[K] && this.emit("drain");
2310
+ }
2311
+ [Qe](t) {
2312
+ return this.emit("data", t), this[C];
2313
+ }
2314
+ /**
2315
+ * Pipe all data emitted by this stream into the destination provided.
2316
+ *
2317
+ * Triggers the flow of data.
2318
+ */
2319
+ pipe(t, e) {
2320
+ if (this[v])
2321
+ return t;
2322
+ this[N] = !1;
2323
+ let s = this[J];
2324
+ return e = e || {}, t === Je.stdout || t === Je.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end &&
2325
+ t.end() : (this[M].push(e.proxyErrors ? new ce(this, t, e) : new It(this, t, e)), this[G] ? xt(() => this[at]()) : this[at]()), t;
2326
+ }
2327
+ /**
2328
+ * Fully unhook a piped destination stream.
2329
+ *
2330
+ * If the destination stream was the only consumer of this stream (ie,
2331
+ * there are no other piped destinations or `'data'` event listeners)
2332
+ * then the flow of data will stop until there is another consumer or
2333
+ * {@link Minipass#resume} is explicitly called.
2334
+ */
2335
+ unpipe(t) {
2336
+ let e = this[M].find((s) => s.dest === t);
2337
+ e && (this[M].length === 1 ? (this[C] && this[et] === 0 && (this[C] = !1), this[M] = []) : this[M].splice(this[M].indexOf(e), 1), e.unpipe());
2338
+ }
2339
+ /**
2340
+ * Alias for {@link Minipass#on}
2341
+ */
2342
+ addListener(t, e) {
2343
+ return this.on(t, e);
2344
+ }
2345
+ /**
2346
+ * Mostly identical to `EventEmitter.on`, with the following
2347
+ * behavior differences to prevent data loss and unnecessary hangs:
2348
+ *
2349
+ * - Adding a 'data' event handler will trigger the flow of data
2350
+ *
2351
+ * - Adding a 'readable' event handler when there is data waiting to be read
2352
+ * will cause 'readable' to be emitted immediately.
2353
+ *
2354
+ * - Adding an 'endish' event handler ('end', 'finish', etc.) which has
2355
+ * already passed will cause the event to be emitted immediately and all
2356
+ * handlers removed.
2357
+ *
2358
+ * - Adding an 'error' event handler after an error has been emitted will
2359
+ * cause the event to be re-emitted immediately with the error previously
2360
+ * raised.
2361
+ */
2362
+ on(t, e) {
2363
+ let s = super.on(t, e);
2364
+ if (t === "data")
2365
+ this[N] = !1, this[et]++, !this[M].length && !this[C] && this[at]();
2366
+ else if (t === "readable" && this[A] !== 0)
2367
+ super.emit("readable");
2368
+ else if (Ti(t) && this[J])
2369
+ super.emit(t), this.removeAllListeners(t);
2370
+ else if (t === "error" && this[bt]) {
2371
+ let i = e;
2372
+ this[G] ? xt(() => i.call(this, this[bt])) : i.call(this, this[bt]);
2373
+ }
2374
+ return s;
2375
+ }
2376
+ /**
2377
+ * Alias for {@link Minipass#off}
2378
+ */
2379
+ removeListener(t, e) {
2380
+ return this.off(t, e);
2381
+ }
2382
+ /**
2383
+ * Mostly identical to `EventEmitter.off`
2384
+ *
2385
+ * If a 'data' event handler is removed, and it was the last consumer
2386
+ * (ie, there are no pipe destinations or other 'data' event listeners),
2387
+ * then the flow of data will stop until there is another consumer or
2388
+ * {@link Minipass#resume} is explicitly called.
2389
+ */
2390
+ off(t, e) {
2391
+ let s = super.off(t, e);
2392
+ return t === "data" && (this[et] = this.listeners("data").length, this[et] === 0 && !this[N] && !this[M].length && (this[C] = !1)), s;
2393
+ }
2394
+ /**
2395
+ * Mostly identical to `EventEmitter.removeAllListeners`
2396
+ *
2397
+ * If all 'data' event handlers are removed, and they were the last consumer
2398
+ * (ie, there are no pipe destinations), then the flow of data will stop
2399
+ * until there is another consumer or {@link Minipass#resume} is explicitly
2400
+ * called.
2401
+ */
2402
+ removeAllListeners(t) {
2403
+ let e = super.removeAllListeners(t);
2404
+ return (t === "data" || t === void 0) && (this[et] = 0, !this[N] && !this[M].length && (this[C] = !1)), e;
2405
+ }
2406
+ /**
2407
+ * true if the 'end' event has been emitted
2408
+ */
2409
+ get emittedEnd() {
2410
+ return this[J];
2411
+ }
2412
+ [V]() {
2413
+ !this[Nt] && !this[J] && !this[v] && this[k].length === 0 && this[K] && (this[Nt] = !0, this.emit("end"), this.emit("prefinish"), this.emit(
2414
+ "finish"), this[Lt] && this.emit("close"), this[Nt] = !1);
2415
+ }
2416
+ /**
2417
+ * Mostly identical to `EventEmitter.emit`, with the following
2418
+ * behavior differences to prevent data loss and unnecessary hangs:
2419
+ *
2420
+ * If the stream has been destroyed, and the event is something other
2421
+ * than 'close' or 'error', then `false` is returned and no handlers
2422
+ * are called.
2423
+ *
2424
+ * If the event is 'end', and has already been emitted, then the event
2425
+ * is ignored. If the stream is in a paused or non-flowing state, then
2426
+ * the event will be deferred until data flow resumes. If the stream is
2427
+ * async, then handlers will be called on the next tick rather than
2428
+ * immediately.
2429
+ *
2430
+ * If the event is 'close', and 'end' has not yet been emitted, then
2431
+ * the event will be deferred until after 'end' is emitted.
2432
+ *
2433
+ * If the event is 'error', and an AbortSignal was provided for the stream,
2434
+ * and there are no listeners, then the event is ignored, matching the
2435
+ * behavior of node core streams in the presense of an AbortSignal.
2436
+ *
2437
+ * If the event is 'finish' or 'prefinish', then all listeners will be
2438
+ * removed after emitting the event, to prevent double-firing.
2439
+ */
2440
+ emit(t, ...e) {
2441
+ let s = e[0];
2442
+ if (t !== "error" && t !== "close" && t !== v && this[v])
2443
+ return !1;
2444
+ if (t === "data")
2445
+ return !this[D] && !s ? !1 : this[G] ? (xt(() => this[he](s)), !0) : this[he](s);
2446
+ if (t === "end")
2447
+ return this[ts]();
2448
+ if (t === "close") {
2449
+ if (this[Lt] = !0, !this[J] && !this[v])
2450
+ return !1;
2451
+ let r = super.emit("close");
2452
+ return this.removeAllListeners("close"), r;
2453
+ } else if (t === "error") {
2454
+ this[bt] = s, super.emit(oe, s);
2455
+ let r = !this[Et] || this.listeners("error").length ? super.emit("error", s) : !1;
2456
+ return this[V](), r;
2457
+ } else if (t === "resume") {
2458
+ let r = super.emit("resume");
2459
+ return this[V](), r;
2460
+ } else if (t === "finish" || t === "prefinish") {
2461
+ let r = super.emit(t);
2462
+ return this.removeAllListeners(t), r;
2463
+ }
2464
+ let i = super.emit(t, ...e);
2465
+ return this[V](), i;
2466
+ }
2467
+ [he](t) {
2468
+ for (let s of this[M])
2469
+ s.dest.write(t) === !1 && this.pause();
2470
+ let e = this[N] ? !1 : super.emit("data", t);
2471
+ return this[V](), e;
2472
+ }
2473
+ [ts]() {
2474
+ return this[J] ? !1 : (this[J] = !0, this.readable = !1, this[G] ? (xt(() => this[ae]()), !0) : this[ae]());
2475
+ }
2476
+ [ae]() {
2477
+ if (this[ht]) {
2478
+ let e = this[ht].end();
2479
+ if (e) {
2480
+ for (let s of this[M])
2481
+ s.dest.write(e);
2482
+ this[N] || super.emit("data", e);
2483
+ }
2484
+ }
2485
+ for (let e of this[M])
2486
+ e.end();
2487
+ let t = super.emit("end");
2488
+ return this.removeAllListeners("end"), t;
2489
+ }
2490
+ /**
2491
+ * Return a Promise that resolves to an array of all emitted data once
2492
+ * the stream ends.
2493
+ */
2494
+ async collect() {
2495
+ let t = Object.assign([], {
2496
+ dataLength: 0
2497
+ });
2498
+ this[D] || (t.dataLength = 0);
2499
+ let e = this.promise();
2500
+ return this.on("data", (s) => {
2501
+ t.push(s), this[D] || (t.dataLength += s.length);
2502
+ }), await e, t;
2503
+ }
2504
+ /**
2505
+ * Return a Promise that resolves to the concatenation of all emitted data
2506
+ * once the stream ends.
2507
+ *
2508
+ * Not allowed on objectMode streams.
2509
+ */
2510
+ async concat() {
2511
+ if (this[D])
2512
+ throw new Error("cannot concat in objectMode");
2513
+ let t = await this.collect();
2514
+ return this[B] ? t.join("") : Buffer.concat(t, t.dataLength);
2515
+ }
2516
+ /**
2517
+ * Return a void Promise that resolves once the stream ends.
2518
+ */
2519
+ async promise() {
2520
+ return new Promise((t, e) => {
2521
+ this.on(v, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
2522
+ });
2523
+ }
2524
+ /**
2525
+ * Asynchronous `for await of` iteration.
2526
+ *
2527
+ * This will continue emitting all chunks until the stream terminates.
2528
+ */
2529
+ [Symbol.asyncIterator]() {
2530
+ this[N] = !1;
2531
+ let t = !1, e = /* @__PURE__ */ l(async () => (this.pause(), t = !0, { value: void 0, done: !0 }), "stop");
2532
+ return {
2533
+ next: /* @__PURE__ */ l(() => {
2534
+ if (t)
2535
+ return e();
2536
+ let i = this.read();
2537
+ if (i !== null)
2538
+ return Promise.resolve({ done: !1, value: i });
2539
+ if (this[K])
2540
+ return e();
2541
+ let r, o, h = /* @__PURE__ */ l((u) => {
2542
+ this.off("data", a), this.off("end", c), this.off(v, f), e(), o(u);
2543
+ }, "onerr"), a = /* @__PURE__ */ l((u) => {
2544
+ this.off("error", h), this.off("end", c), this.off(v, f), this.pause(), r({ value: u, done: !!this[K] });
2545
+ }, "ondata"), c = /* @__PURE__ */ l(() => {
2546
+ this.off("error", h), this.off("data", a), this.off(v, f), e(), r({ done: !0, value: void 0 });
2547
+ }, "onend"), f = /* @__PURE__ */ l(() => h(new Error("stream destroyed")), "ondestroy");
2548
+ return new Promise((u, d) => {
2549
+ o = d, r = u, this.once(v, f), this.once("error", h), this.once("end", c), this.once("data", a);
2550
+ });
2551
+ }, "next"),
2552
+ throw: e,
2553
+ return: e,
2554
+ [Symbol.asyncIterator]() {
2555
+ return this;
2556
+ }
2557
+ };
2558
+ }
2559
+ /**
2560
+ * Synchronous `for of` iteration.
2561
+ *
2562
+ * The iteration will terminate when the internal buffer runs out, even
2563
+ * if the stream has not yet terminated.
2564
+ */
2565
+ [Symbol.iterator]() {
2566
+ this[N] = !1;
2567
+ let t = !1, e = /* @__PURE__ */ l(() => (this.pause(), this.off(oe, e), this.off(v, e), this.off("end", e), t = !0, { done: !0, value: void 0 }),
2568
+ "stop"), s = /* @__PURE__ */ l(() => {
2569
+ if (t)
2570
+ return e();
2571
+ let i = this.read();
2572
+ return i === null ? e() : { done: !1, value: i };
2573
+ }, "next");
2574
+ return this.once("end", e), this.once(oe, e), this.once(v, e), {
2575
+ next: s,
2576
+ throw: e,
2577
+ return: e,
2578
+ [Symbol.iterator]() {
2579
+ return this;
2580
+ }
2581
+ };
2582
+ }
2583
+ /**
2584
+ * Destroy a stream, preventing it from being used for any further purpose.
2585
+ *
2586
+ * If the stream has a `close()` method, then it will be called on
2587
+ * destruction.
2588
+ *
2589
+ * After destruction, any attempt to write data, read data, or emit most
2590
+ * events will be ignored.
2591
+ *
2592
+ * If an error argument is provided, then it will be emitted in an
2593
+ * 'error' event.
2594
+ */
2595
+ destroy(t) {
2596
+ if (this[v])
2597
+ return t ? this.emit("error", t) : this.emit(v), this;
2598
+ this[v] = !0, this[N] = !0, this[k].length = 0, this[A] = 0;
2599
+ let e = this;
2600
+ return typeof e.close == "function" && !this[Lt] && e.close(), t ? this.emit("error", t) : this.emit(v), this;
2601
+ }
2602
+ /**
2603
+ * Alias for {@link isStream}
2604
+ *
2605
+ * Former export location, maintained for backwards compatibility.
2606
+ *
2607
+ * @deprecated
2608
+ */
2609
+ static get isStream() {
2610
+ return Si;
2611
+ }
2612
+ };
2613
+
2614
+ // ../node_modules/path-scurry/dist/esm/index.js
2615
+ var Oi = q.realpathSync.native, Tt = {
2616
+ lstatSync: q.lstatSync,
2617
+ readdir: q.readdir,
2618
+ readdirSync: q.readdirSync,
2619
+ readlinkSync: q.readlinkSync,
2620
+ realpathSync: Oi,
2621
+ promises: {
2622
+ lstat: Q.lstat,
2623
+ readdir: Q.readdir,
2624
+ readlink: Q.readlink,
2625
+ realpath: Q.realpath
2626
+ }
2627
+ }, hs = /* @__PURE__ */ l((n) => !n || n === Tt || n === Di ? Tt : {
2628
+ ...Tt,
2629
+ ...n,
2630
+ promises: {
2631
+ ...Tt.promises,
2632
+ ...n.promises || {}
2633
+ }
2634
+ }, "fsFromOption"), as = /^\\\\\?\\([a-z]:)\\?$/i, Fi = /* @__PURE__ */ l((n) => n.replace(/\//g, "\\").replace(as, "$1\\"), "uncToDrive"), Mi = /[\\\/]/,
2635
+ W = 0, ls = 1, cs = 2, H = 4, fs = 6, us = 8, st = 10, ds = 12, P = 15, vt = ~P, ue = 16, ss = 32, Ct = 64, U = 128, Bt = 256, $t = 512, is = Ct |
2636
+ U | $t, _i = 1023, de = /* @__PURE__ */ l((n) => n.isFile() ? us : n.isDirectory() ? H : n.isSymbolicLink() ? st : n.isCharacterDevice() ? cs :
2637
+ n.isBlockDevice() ? fs : n.isSocket() ? ds : n.isFIFO() ? ls : W, "entToType"), rs = /* @__PURE__ */ new Map(), kt = /* @__PURE__ */ l((n) => {
2638
+ let t = rs.get(n);
2639
+ if (t)
2640
+ return t;
2641
+ let e = n.normalize("NFKD");
2642
+ return rs.set(n, e), e;
2643
+ }, "normalize"), ns = /* @__PURE__ */ new Map(), Ut = /* @__PURE__ */ l((n) => {
2644
+ let t = ns.get(n);
2645
+ if (t)
2646
+ return t;
2647
+ let e = kt(n.toLowerCase());
2648
+ return ns.set(n, e), e;
2649
+ }, "normalizeNocase"), Gt = class extends yt {
2650
+ static {
2651
+ l(this, "ResolveCache");
2652
+ }
2653
+ constructor() {
2654
+ super({ max: 256 });
2655
+ }
2656
+ }, pe = class extends yt {
2657
+ static {
2658
+ l(this, "ChildrenCache");
2659
+ }
2660
+ constructor(t = 16 * 1024) {
2661
+ super({
2662
+ maxSize: t,
2663
+ // parent + children
2664
+ sizeCalculation: /* @__PURE__ */ l((e) => e.length + 1, "sizeCalculation")
2665
+ });
2666
+ }
2667
+ }, ps = Symbol("PathScurry setAsCwd"), O = class {
2668
+ static {
2669
+ l(this, "PathBase");
2670
+ }
2671
+ /**
2672
+ * the basename of this path
2673
+ *
2674
+ * **Important**: *always* test the path name against any test string
2675
+ * usingthe {@link isNamed} method, and not by directly comparing this
2676
+ * string. Otherwise, unicode path strings that the system sees as identical
2677
+ * will not be properly treated as the same path, leading to incorrect
2678
+ * behavior and possible security issues.
2679
+ */
2680
+ name;
2681
+ /**
2682
+ * the Path entry corresponding to the path root.
2683
+ *
2684
+ * @internal
2685
+ */
2686
+ root;
2687
+ /**
2688
+ * All roots found within the current PathScurry family
2689
+ *
2690
+ * @internal
2691
+ */
2692
+ roots;
2693
+ /**
2694
+ * a reference to the parent path, or undefined in the case of root entries
2695
+ *
2696
+ * @internal
2697
+ */
2698
+ parent;
2699
+ /**
2700
+ * boolean indicating whether paths are compared case-insensitively
2701
+ * @internal
2702
+ */
2703
+ nocase;
2704
+ /**
2705
+ * boolean indicating that this path is the current working directory
2706
+ * of the PathScurry collection that contains it.
2707
+ */
2708
+ isCWD = !1;
2709
+ // potential default fs override
2710
+ #t;
2711
+ // Stats fields
2712
+ #e;
2713
+ get dev() {
2714
+ return this.#e;
2715
+ }
2716
+ #n;
2717
+ get mode() {
2718
+ return this.#n;
2719
+ }
2720
+ #i;
2721
+ get nlink() {
2722
+ return this.#i;
2723
+ }
2724
+ #o;
2725
+ get uid() {
2726
+ return this.#o;
2727
+ }
2728
+ #S;
2729
+ get gid() {
2730
+ return this.#S;
2731
+ }
2732
+ #l;
2733
+ get rdev() {
2734
+ return this.#l;
2735
+ }
2736
+ #f;
2737
+ get blksize() {
2738
+ return this.#f;
2739
+ }
2740
+ #h;
2741
+ get ino() {
2742
+ return this.#h;
2743
+ }
2744
+ #a;
2745
+ get size() {
2746
+ return this.#a;
2747
+ }
2748
+ #r;
2749
+ get blocks() {
2750
+ return this.#r;
2751
+ }
2752
+ #g;
2753
+ get atimeMs() {
2754
+ return this.#g;
2755
+ }
2756
+ #w;
2757
+ get mtimeMs() {
2758
+ return this.#w;
2759
+ }
2760
+ #d;
2761
+ get ctimeMs() {
2762
+ return this.#d;
2763
+ }
2764
+ #u;
2765
+ get birthtimeMs() {
2766
+ return this.#u;
2767
+ }
2768
+ #v;
2769
+ get atime() {
2770
+ return this.#v;
2771
+ }
2772
+ #m;
2773
+ get mtime() {
2774
+ return this.#m;
2775
+ }
2776
+ #T;
2777
+ get ctime() {
2778
+ return this.#T;
2779
+ }
2780
+ #C;
2781
+ get birthtime() {
2782
+ return this.#C;
2783
+ }
2784
+ #b;
2785
+ #E;
2786
+ #x;
2787
+ #p;
2788
+ #D;
2789
+ #k;
2790
+ #s;
2791
+ #M;
2792
+ #y;
2793
+ #O;
2794
+ /**
2795
+ * This property is for compatibility with the Dirent class as of
2796
+ * Node v20, where Dirent['parentPath'] refers to the path of the
2797
+ * directory that was passed to readdir. For root entries, it's the path
2798
+ * to the entry itself.
2799
+ */
2800
+ get parentPath() {
2801
+ return (this.parent || this).fullpath();
2802
+ }
2803
+ /**
2804
+ * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
2805
+ * this property refers to the *parent* path, not the path object itself.
2806
+ */
2807
+ get path() {
2808
+ return this.parentPath;
2809
+ }
2810
+ /**
2811
+ * Do not create new Path objects directly. They should always be accessed
2812
+ * via the PathScurry class or other methods on the Path class.
2813
+ *
2814
+ * @internal
2815
+ */
2816
+ constructor(t, e = W, s, i, r, o, h) {
2817
+ this.name = t, this.#b = r ? Ut(t) : kt(t), this.#s = e & _i, this.nocase = r, this.roots = i, this.root = s || this, this.#M = o, this.#x =
2818
+ h.fullpath, this.#D = h.relative, this.#k = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = hs(
2819
+ h.fs);
2820
+ }
2821
+ /**
2822
+ * Returns the depth of the Path object from its root.
2823
+ *
2824
+ * For example, a path at `/foo/bar` would have a depth of 2.
2825
+ */
2826
+ depth() {
2827
+ return this.#E !== void 0 ? this.#E : this.parent ? this.#E = this.parent.depth() + 1 : this.#E = 0;
2828
+ }
2829
+ /**
2830
+ * @internal
2831
+ */
2832
+ childrenCache() {
2833
+ return this.#M;
2834
+ }
2835
+ /**
2836
+ * Get the Path object referenced by the string path, resolved from this Path
2837
+ */
2838
+ resolve(t) {
2839
+ if (!t)
2840
+ return this;
2841
+ let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
2842
+ return e ? this.getRoot(e).#_(i) : this.#_(i);
2843
+ }
2844
+ #_(t) {
2845
+ let e = this;
2846
+ for (let s of t)
2847
+ e = e.child(s);
2848
+ return e;
2849
+ }
2850
+ /**
2851
+ * Returns the cached children Path objects, if still available. If they
2852
+ * have fallen out of the cache, then returns an empty array, and resets the
2853
+ * READDIR_CALLED bit, so that future calls to readdir() will require an fs
2854
+ * lookup.
2855
+ *
2856
+ * @internal
2857
+ */
2858
+ children() {
2859
+ let t = this.#M.get(this);
2860
+ if (t)
2861
+ return t;
2862
+ let e = Object.assign([], { provisional: 0 });
2863
+ return this.#M.set(this, e), this.#s &= ~ue, e;
2864
+ }
2865
+ /**
2866
+ * Resolves a path portion and returns or creates the child Path.
2867
+ *
2868
+ * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is
2869
+ * `'..'`.
2870
+ *
2871
+ * This should not be called directly. If `pathPart` contains any path
2872
+ * separators, it will lead to unsafe undefined behavior.
2873
+ *
2874
+ * Use `Path.resolve()` instead.
2875
+ *
2876
+ * @internal
2877
+ */
2878
+ child(t, e) {
2879
+ if (t === "" || t === ".")
2880
+ return this;
2881
+ if (t === "..")
2882
+ return this.parent || this;
2883
+ let s = this.children(), i = this.nocase ? Ut(t) : kt(t);
2884
+ for (let a of s)
2885
+ if (a.#b === i)
2886
+ return a;
2887
+ let r = this.parent ? this.sep : "", o = this.#x ? this.#x + r + t : void 0, h = this.newChild(t, W, {
2888
+ ...e,
2889
+ parent: this,
2890
+ fullpath: o
2891
+ });
2892
+ return this.canReaddir() || (h.#s |= U), s.push(h), h;
2893
+ }
2894
+ /**
2895
+ * The relative path from the cwd. If it does not share an ancestor with
2896
+ * the cwd, then this ends up being equivalent to the fullpath()
2897
+ */
2898
+ relative() {
2899
+ if (this.isCWD)
2900
+ return "";
2901
+ if (this.#D !== void 0)
2902
+ return this.#D;
2903
+ let t = this.name, e = this.parent;
2904
+ if (!e)
2905
+ return this.#D = this.name;
2906
+ let s = e.relative();
2907
+ return s + (!s || !e.parent ? "" : this.sep) + t;
2908
+ }
2909
+ /**
2910
+ * The relative path from the cwd, using / as the path separator.
2911
+ * If it does not share an ancestor with
2912
+ * the cwd, then this ends up being equivalent to the fullpathPosix()
2913
+ * On posix systems, this is identical to relative().
2914
+ */
2915
+ relativePosix() {
2916
+ if (this.sep === "/")
2917
+ return this.relative();
2918
+ if (this.isCWD)
2919
+ return "";
2920
+ if (this.#k !== void 0)
2921
+ return this.#k;
2922
+ let t = this.name, e = this.parent;
2923
+ if (!e)
2924
+ return this.#k = this.fullpathPosix();
2925
+ let s = e.relativePosix();
2926
+ return s + (!s || !e.parent ? "" : "/") + t;
2927
+ }
2928
+ /**
2929
+ * The fully resolved path string for this Path entry
2930
+ */
2931
+ fullpath() {
2932
+ if (this.#x !== void 0)
2933
+ return this.#x;
2934
+ let t = this.name, e = this.parent;
2935
+ if (!e)
2936
+ return this.#x = this.name;
2937
+ let i = e.fullpath() + (e.parent ? this.sep : "") + t;
2938
+ return this.#x = i;
2939
+ }
2940
+ /**
2941
+ * On platforms other than windows, this is identical to fullpath.
2942
+ *
2943
+ * On windows, this is overridden to return the forward-slash form of the
2944
+ * full UNC path.
2945
+ */
2946
+ fullpathPosix() {
2947
+ if (this.#p !== void 0)
2948
+ return this.#p;
2949
+ if (this.sep === "/")
2950
+ return this.#p = this.fullpath();
2951
+ if (!this.parent) {
2952
+ let i = this.fullpath().replace(/\\/g, "/");
2953
+ return /^[a-z]:\//i.test(i) ? this.#p = `//?/${i}` : this.#p = i;
2954
+ }
2955
+ let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
2956
+ return this.#p = s;
2957
+ }
2958
+ /**
2959
+ * Is the Path of an unknown type?
2960
+ *
2961
+ * Note that we might know *something* about it if there has been a previous
2962
+ * filesystem operation, for example that it does not exist, or is not a
2963
+ * link, or whether it has child entries.
2964
+ */
2965
+ isUnknown() {
2966
+ return (this.#s & P) === W;
2967
+ }
2968
+ isType(t) {
2969
+ return this[`is${t}`]();
2970
+ }
2971
+ getType() {
2972
+ return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" :
2973
+ this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : (
2974
+ /* c8 ignore start */
2975
+ this.isSocket() ? "Socket" : "Unknown"
2976
+ );
2977
+ }
2978
+ /**
2979
+ * Is the Path a regular file?
2980
+ */
2981
+ isFile() {
2982
+ return (this.#s & P) === us;
2983
+ }
2984
+ /**
2985
+ * Is the Path a directory?
2986
+ */
2987
+ isDirectory() {
2988
+ return (this.#s & P) === H;
2989
+ }
2990
+ /**
2991
+ * Is the path a character device?
2992
+ */
2993
+ isCharacterDevice() {
2994
+ return (this.#s & P) === cs;
2995
+ }
2996
+ /**
2997
+ * Is the path a block device?
2998
+ */
2999
+ isBlockDevice() {
3000
+ return (this.#s & P) === fs;
3001
+ }
3002
+ /**
3003
+ * Is the path a FIFO pipe?
3004
+ */
3005
+ isFIFO() {
3006
+ return (this.#s & P) === ls;
3007
+ }
3008
+ /**
3009
+ * Is the path a socket?
3010
+ */
3011
+ isSocket() {
3012
+ return (this.#s & P) === ds;
3013
+ }
3014
+ /**
3015
+ * Is the path a symbolic link?
3016
+ */
3017
+ isSymbolicLink() {
3018
+ return (this.#s & st) === st;
3019
+ }
3020
+ /**
3021
+ * Return the entry if it has been subject of a successful lstat, or
3022
+ * undefined otherwise.
3023
+ *
3024
+ * Does not read the filesystem, so an undefined result *could* simply
3025
+ * mean that we haven't called lstat on it.
3026
+ */
3027
+ lstatCached() {
3028
+ return this.#s & ss ? this : void 0;
3029
+ }
3030
+ /**
3031
+ * Return the cached link target if the entry has been the subject of a
3032
+ * successful readlink, or undefined otherwise.
3033
+ *
3034
+ * Does not read the filesystem, so an undefined result *could* just mean we
3035
+ * don't have any cached data. Only use it if you are very sure that a
3036
+ * readlink() has been called at some point.
3037
+ */
3038
+ readlinkCached() {
3039
+ return this.#y;
3040
+ }
3041
+ /**
3042
+ * Returns the cached realpath target if the entry has been the subject
3043
+ * of a successful realpath, or undefined otherwise.
3044
+ *
3045
+ * Does not read the filesystem, so an undefined result *could* just mean we
3046
+ * don't have any cached data. Only use it if you are very sure that a
3047
+ * realpath() has been called at some point.
3048
+ */
3049
+ realpathCached() {
3050
+ return this.#O;
3051
+ }
3052
+ /**
3053
+ * Returns the cached child Path entries array if the entry has been the
3054
+ * subject of a successful readdir(), or [] otherwise.
3055
+ *
3056
+ * Does not read the filesystem, so an empty array *could* just mean we
3057
+ * don't have any cached data. Only use it if you are very sure that a
3058
+ * readdir() has been called recently enough to still be valid.
3059
+ */
3060
+ readdirCached() {
3061
+ let t = this.children();
3062
+ return t.slice(0, t.provisional);
3063
+ }
3064
+ /**
3065
+ * Return true if it's worth trying to readlink. Ie, we don't (yet) have
3066
+ * any indication that readlink will definitely fail.
3067
+ *
3068
+ * Returns false if the path is known to not be a symlink, if a previous
3069
+ * readlink failed, or if the entry does not exist.
3070
+ */
3071
+ canReadlink() {
3072
+ if (this.#y)
3073
+ return !0;
3074
+ if (!this.parent)
3075
+ return !1;
3076
+ let t = this.#s & P;
3077
+ return !(t !== W && t !== st || this.#s & Bt || this.#s & U);
3078
+ }
3079
+ /**
3080
+ * Return true if readdir has previously been successfully called on this
3081
+ * path, indicating that cachedReaddir() is likely valid.
3082
+ */
3083
+ calledReaddir() {
3084
+ return !!(this.#s & ue);
3085
+ }
3086
+ /**
3087
+ * Returns true if the path is known to not exist. That is, a previous lstat
3088
+ * or readdir failed to verify its existence when that would have been
3089
+ * expected, or a parent entry was marked either enoent or enotdir.
3090
+ */
3091
+ isENOENT() {
3092
+ return !!(this.#s & U);
3093
+ }
3094
+ /**
3095
+ * Return true if the path is a match for the given path name. This handles
3096
+ * case sensitivity and unicode normalization.
3097
+ *
3098
+ * Note: even on case-sensitive systems, it is **not** safe to test the
3099
+ * equality of the `.name` property to determine whether a given pathname
3100
+ * matches, due to unicode normalization mismatches.
3101
+ *
3102
+ * Always use this method instead of testing the `path.name` property
3103
+ * directly.
3104
+ */
3105
+ isNamed(t) {
3106
+ return this.nocase ? this.#b === Ut(t) : this.#b === kt(t);
3107
+ }
3108
+ /**
3109
+ * Return the Path object corresponding to the target of a symbolic link.
3110
+ *
3111
+ * If the Path is not a symbolic link, or if the readlink call fails for any
3112
+ * reason, `undefined` is returned.
3113
+ *
3114
+ * Result is cached, and thus may be outdated if the filesystem is mutated.
3115
+ */
3116
+ async readlink() {
3117
+ let t = this.#y;
3118
+ if (t)
3119
+ return t;
3120
+ if (this.canReadlink() && this.parent)
3121
+ try {
3122
+ let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
3123
+ if (s)
3124
+ return this.#y = s;
3125
+ } catch (e) {
3126
+ this.#c(e.code);
3127
+ return;
3128
+ }
3129
+ }
3130
+ /**
3131
+ * Synchronous {@link PathBase.readlink}
3132
+ */
3133
+ readlinkSync() {
3134
+ let t = this.#y;
3135
+ if (t)
3136
+ return t;
3137
+ if (this.canReadlink() && this.parent)
3138
+ try {
3139
+ let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
3140
+ if (s)
3141
+ return this.#y = s;
3142
+ } catch (e) {
3143
+ this.#c(e.code);
3144
+ return;
3145
+ }
3146
+ }
3147
+ #N(t) {
3148
+ this.#s |= ue;
3149
+ for (let e = t.provisional; e < t.length; e++) {
3150
+ let s = t[e];
3151
+ s && s.#L();
3152
+ }
3153
+ }
3154
+ #L() {
3155
+ this.#s & U || (this.#s = (this.#s | U) & vt, this.#A());
3156
+ }
3157
+ #A() {
3158
+ let t = this.children();
3159
+ t.provisional = 0;
3160
+ for (let e of t)
3161
+ e.#L();
3162
+ }
3163
+ #R() {
3164
+ this.#s |= $t, this.#P();
3165
+ }
3166
+ // save the information when we know the entry is not a dir
3167
+ #P() {
3168
+ if (this.#s & Ct)
3169
+ return;
3170
+ let t = this.#s;
3171
+ (t & P) === H && (t &= vt), this.#s = t | Ct, this.#A();
3172
+ }
3173
+ #W(t = "") {
3174
+ t === "ENOTDIR" || t === "EPERM" ? this.#P() : t === "ENOENT" ? this.#L() : this.children().provisional = 0;
3175
+ }
3176
+ #j(t = "") {
3177
+ t === "ENOTDIR" ? this.parent.#P() : t === "ENOENT" && this.#L();
3178
+ }
3179
+ #c(t = "") {
3180
+ let e = this.#s;
3181
+ e |= Bt, t === "ENOENT" && (e |= U), (t === "EINVAL" || t === "UNKNOWN") && (e &= vt), this.#s = e, t === "ENOTDIR" && this.parent && this.
3182
+ parent.#P();
3183
+ }
3184
+ #I(t, e) {
3185
+ return this.#F(t, e) || this.#z(t, e);
3186
+ }
3187
+ #z(t, e) {
3188
+ let s = de(t), i = this.newChild(t.name, s, { parent: this }), r = i.#s & P;
3189
+ return r !== H && r !== st && r !== W && (i.#s |= Ct), e.unshift(i), e.provisional++, i;
3190
+ }
3191
+ #F(t, e) {
3192
+ for (let s = e.provisional; s < e.length; s++) {
3193
+ let i = e[s];
3194
+ if ((this.nocase ? Ut(t.name) : kt(t.name)) === i.#b)
3195
+ return this.#B(t, i, s, e);
3196
+ }
3197
+ }
3198
+ #B(t, e, s, i) {
3199
+ let r = e.name;
3200
+ return e.#s = e.#s & vt | de(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1),
3201
+ i.unshift(e)), i.provisional++, e;
3202
+ }
3203
+ /**
3204
+ * Call lstat() on this Path, and update all known information that can be
3205
+ * determined.
3206
+ *
3207
+ * Note that unlike `fs.lstat()`, the returned value does not contain some
3208
+ * information, such as `mode`, `dev`, `nlink`, and `ino`. If that
3209
+ * information is required, you will need to call `fs.lstat` yourself.
3210
+ *
3211
+ * If the Path refers to a nonexistent file, or if the lstat call fails for
3212
+ * any reason, `undefined` is returned. Otherwise the updated Path object is
3213
+ * returned.
3214
+ *
3215
+ * Results are cached, and thus may be out of date if the filesystem is
3216
+ * mutated.
3217
+ */
3218
+ async lstat() {
3219
+ if ((this.#s & U) === 0)
3220
+ try {
3221
+ return this.#H(await this.#t.promises.lstat(this.fullpath())), this;
3222
+ } catch (t) {
3223
+ this.#j(t.code);
3224
+ }
3225
+ }
3226
+ /**
3227
+ * synchronous {@link PathBase.lstat}
3228
+ */
3229
+ lstatSync() {
3230
+ if ((this.#s & U) === 0)
3231
+ try {
3232
+ return this.#H(this.#t.lstatSync(this.fullpath())), this;
3233
+ } catch (t) {
3234
+ this.#j(t.code);
3235
+ }
3236
+ }
3237
+ #H(t) {
3238
+ let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: c, dev: f, gid: u, ino: d, mode: p, mtime: w,
3239
+ mtimeMs: m, nlink: y, rdev: g, size: E, uid: S } = t;
3240
+ this.#v = e, this.#g = s, this.#C = i, this.#u = r, this.#f = o, this.#r = h, this.#T = a, this.#d = c, this.#e = f, this.#S = u, this.#h =
3241
+ d, this.#n = p, this.#m = w, this.#w = m, this.#i = y, this.#l = g, this.#a = E, this.#o = S;
3242
+ let b = de(t);
3243
+ this.#s = this.#s & vt | b | ss, b !== W && b !== H && b !== st && (this.#s |= Ct);
3244
+ }
3245
+ #$ = [];
3246
+ #G = !1;
3247
+ #q(t) {
3248
+ this.#G = !1;
3249
+ let e = this.#$.slice();
3250
+ this.#$.length = 0, e.forEach((s) => s(null, t));
3251
+ }
3252
+ /**
3253
+ * Standard node-style callback interface to get list of directory entries.
3254
+ *
3255
+ * If the Path cannot or does not contain any children, then an empty array
3256
+ * is returned.
3257
+ *
3258
+ * Results are cached, and thus may be out of date if the filesystem is
3259
+ * mutated.
3260
+ *
3261
+ * @param cb The callback called with (er, entries). Note that the `er`
3262
+ * param is somewhat extraneous, as all readdir() errors are handled and
3263
+ * simply result in an empty set of entries being returned.
3264
+ * @param allowZalgo Boolean indicating that immediately known results should
3265
+ * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release
3266
+ * zalgo at your peril, the dark pony lord is devious and unforgiving.
3267
+ */
3268
+ readdirCB(t, e = !1) {
3269
+ if (!this.canReaddir()) {
3270
+ e ? t(null, []) : queueMicrotask(() => t(null, []));
3271
+ return;
3272
+ }
3273
+ let s = this.children();
3274
+ if (this.calledReaddir()) {
3275
+ let r = s.slice(0, s.provisional);
3276
+ e ? t(null, r) : queueMicrotask(() => t(null, r));
3277
+ return;
3278
+ }
3279
+ if (this.#$.push(t), this.#G)
3280
+ return;
3281
+ this.#G = !0;
3282
+ let i = this.fullpath();
3283
+ this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
3284
+ if (r)
3285
+ this.#W(r.code), s.provisional = 0;
3286
+ else {
3287
+ for (let h of o)
3288
+ this.#I(h, s);
3289
+ this.#N(s);
3290
+ }
3291
+ this.#q(s.slice(0, s.provisional));
3292
+ });
3293
+ }
3294
+ #U;
3295
+ /**
3296
+ * Return an array of known child entries.
3297
+ *
3298
+ * If the Path cannot or does not contain any children, then an empty array
3299
+ * is returned.
3300
+ *
3301
+ * Results are cached, and thus may be out of date if the filesystem is
3302
+ * mutated.
3303
+ */
3304
+ async readdir() {
3305
+ if (!this.canReaddir())
3306
+ return [];
3307
+ let t = this.children();
3308
+ if (this.calledReaddir())
3309
+ return t.slice(0, t.provisional);
3310
+ let e = this.fullpath();
3311
+ if (this.#U)
3312
+ await this.#U;
3313
+ else {
3314
+ let s = /* @__PURE__ */ l(() => {
3315
+ }, "resolve");
3316
+ this.#U = new Promise((i) => s = i);
3317
+ try {
3318
+ for (let i of await this.#t.promises.readdir(e, {
3319
+ withFileTypes: !0
3320
+ }))
3321
+ this.#I(i, t);
3322
+ this.#N(t);
3323
+ } catch (i) {
3324
+ this.#W(i.code), t.provisional = 0;
3325
+ }
3326
+ this.#U = void 0, s();
3327
+ }
3328
+ return t.slice(0, t.provisional);
3329
+ }
3330
+ /**
3331
+ * synchronous {@link PathBase.readdir}
3332
+ */
3333
+ readdirSync() {
3334
+ if (!this.canReaddir())
3335
+ return [];
3336
+ let t = this.children();
3337
+ if (this.calledReaddir())
3338
+ return t.slice(0, t.provisional);
3339
+ let e = this.fullpath();
3340
+ try {
3341
+ for (let s of this.#t.readdirSync(e, {
3342
+ withFileTypes: !0
3343
+ }))
3344
+ this.#I(s, t);
3345
+ this.#N(t);
3346
+ } catch (s) {
3347
+ this.#W(s.code), t.provisional = 0;
3348
+ }
3349
+ return t.slice(0, t.provisional);
3350
+ }
3351
+ canReaddir() {
3352
+ if (this.#s & is)
3353
+ return !1;
3354
+ let t = P & this.#s;
3355
+ return t === W || t === H || t === st;
3356
+ }
3357
+ shouldWalk(t, e) {
3358
+ return (this.#s & H) === H && !(this.#s & is) && !t.has(this) && (!e || e(this));
3359
+ }
3360
+ /**
3361
+ * Return the Path object corresponding to path as resolved
3362
+ * by realpath(3).
3363
+ *
3364
+ * If the realpath call fails for any reason, `undefined` is returned.
3365
+ *
3366
+ * Result is cached, and thus may be outdated if the filesystem is mutated.
3367
+ * On success, returns a Path object.
3368
+ */
3369
+ async realpath() {
3370
+ if (this.#O)
3371
+ return this.#O;
3372
+ if (!(($t | Bt | U) & this.#s))
3373
+ try {
3374
+ let t = await this.#t.promises.realpath(this.fullpath());
3375
+ return this.#O = this.resolve(t);
3376
+ } catch {
3377
+ this.#R();
3378
+ }
3379
+ }
3380
+ /**
3381
+ * Synchronous {@link realpath}
3382
+ */
3383
+ realpathSync() {
3384
+ if (this.#O)
3385
+ return this.#O;
3386
+ if (!(($t | Bt | U) & this.#s))
3387
+ try {
3388
+ let t = this.#t.realpathSync(this.fullpath());
3389
+ return this.#O = this.resolve(t);
3390
+ } catch {
3391
+ this.#R();
3392
+ }
3393
+ }
3394
+ /**
3395
+ * Internal method to mark this Path object as the scurry cwd,
3396
+ * called by {@link PathScurry#chdir}
3397
+ *
3398
+ * @internal
3399
+ */
3400
+ [ps](t) {
3401
+ if (t === this)
3402
+ return;
3403
+ t.isCWD = !1, this.isCWD = !0;
3404
+ let e = /* @__PURE__ */ new Set([]), s = [], i = this;
3405
+ for (; i && i.parent; )
3406
+ e.add(i), i.#D = s.join(this.sep), i.#k = s.join("/"), i = i.parent, s.push("..");
3407
+ for (i = t; i && i.parent && !e.has(i); )
3408
+ i.#D = void 0, i.#k = void 0, i = i.parent;
3409
+ }
3410
+ }, Ht = class n extends O {
3411
+ static {
3412
+ l(this, "PathWin32");
3413
+ }
3414
+ /**
3415
+ * Separator for generating path strings.
3416
+ */
3417
+ sep = "\\";
3418
+ /**
3419
+ * Separator for parsing path strings.
3420
+ */
3421
+ splitSep = Mi;
3422
+ /**
3423
+ * Do not create new Path objects directly. They should always be accessed
3424
+ * via the PathScurry class or other methods on the Path class.
3425
+ *
3426
+ * @internal
3427
+ */
3428
+ constructor(t, e = W, s, i, r, o, h) {
3429
+ super(t, e, s, i, r, o, h);
3430
+ }
3431
+ /**
3432
+ * @internal
3433
+ */
3434
+ newChild(t, e = W, s = {}) {
3435
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3436
+ }
3437
+ /**
3438
+ * @internal
3439
+ */
3440
+ getRootString(t) {
3441
+ return lt.win32.parse(t).root;
3442
+ }
3443
+ /**
3444
+ * @internal
3445
+ */
3446
+ getRoot(t) {
3447
+ if (t = Fi(t.toUpperCase()), t === this.root.name)
3448
+ return this.root;
3449
+ for (let [e, s] of Object.entries(this.roots))
3450
+ if (this.sameRoot(t, e))
3451
+ return this.roots[t] = s;
3452
+ return this.roots[t] = new ct(t, this).root;
3453
+ }
3454
+ /**
3455
+ * @internal
3456
+ */
3457
+ sameRoot(t, e = this.root.name) {
3458
+ return t = t.toUpperCase().replace(/\//g, "\\").replace(as, "$1\\"), t === e;
3459
+ }
3460
+ }, qt = class n extends O {
3461
+ static {
3462
+ l(this, "PathPosix");
3463
+ }
3464
+ /**
3465
+ * separator for parsing path strings
3466
+ */
3467
+ splitSep = "/";
3468
+ /**
3469
+ * separator for generating path strings
3470
+ */
3471
+ sep = "/";
3472
+ /**
3473
+ * Do not create new Path objects directly. They should always be accessed
3474
+ * via the PathScurry class or other methods on the Path class.
3475
+ *
3476
+ * @internal
3477
+ */
3478
+ constructor(t, e = W, s, i, r, o, h) {
3479
+ super(t, e, s, i, r, o, h);
3480
+ }
3481
+ /**
3482
+ * @internal
3483
+ */
3484
+ getRootString(t) {
3485
+ return t.startsWith("/") ? "/" : "";
3486
+ }
3487
+ /**
3488
+ * @internal
3489
+ */
3490
+ getRoot(t) {
3491
+ return this.root;
3492
+ }
3493
+ /**
3494
+ * @internal
3495
+ */
3496
+ newChild(t, e = W, s = {}) {
3497
+ return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3498
+ }
3499
+ }, Kt = class {
3500
+ static {
3501
+ l(this, "PathScurryBase");
3502
+ }
3503
+ /**
3504
+ * The root Path entry for the current working directory of this Scurry
3505
+ */
3506
+ root;
3507
+ /**
3508
+ * The string path for the root of this Scurry's current working directory
3509
+ */
3510
+ rootPath;
3511
+ /**
3512
+ * A collection of all roots encountered, referenced by rootPath
3513
+ */
3514
+ roots;
3515
+ /**
3516
+ * The Path entry corresponding to this PathScurry's current working directory.
3517
+ */
3518
+ cwd;
3519
+ #t;
3520
+ #e;
3521
+ #n;
3522
+ /**
3523
+ * Perform path comparisons case-insensitively.
3524
+ *
3525
+ * Defaults true on Darwin and Windows systems, false elsewhere.
3526
+ */
3527
+ nocase;
3528
+ #i;
3529
+ /**
3530
+ * This class should not be instantiated directly.
3531
+ *
3532
+ * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry
3533
+ *
3534
+ * @internal
3535
+ */
3536
+ constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = Tt } = {}) {
3537
+ this.#i = hs(o), (t instanceof URL || t.startsWith("file://")) && (t = (0, os.fileURLToPath)(t));
3538
+ let h = e.resolve(t);
3539
+ this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Gt(), this.#e = new Gt(), this.#n =
3540
+ new pe(r);
3541
+ let a = h.substring(this.rootPath.length).split(s);
3542
+ if (a.length === 1 && !a[0] && a.pop(), i === void 0)
3543
+ throw new TypeError("must provide nocase setting to PathScurryBase ctor");
3544
+ this.nocase = i, this.root = this.newRoot(this.#i), this.roots[this.rootPath] = this.root;
3545
+ let c = this.root, f = a.length - 1, u = e.sep, d = this.rootPath, p = !1;
3546
+ for (let w of a) {
3547
+ let m = f--;
3548
+ c = c.child(w, {
3549
+ relative: new Array(m).fill("..").join(u),
3550
+ relativePosix: new Array(m).fill("..").join("/"),
3551
+ fullpath: d += (p ? "" : u) + w
3552
+ }), p = !0;
3553
+ }
3554
+ this.cwd = c;
3555
+ }
3556
+ /**
3557
+ * Get the depth of a provided path, string, or the cwd
3558
+ */
3559
+ depth(t = this.cwd) {
3560
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
3561
+ }
3562
+ /**
3563
+ * Return the cache of child entries. Exposed so subclasses can create
3564
+ * child Path objects in a platform-specific way.
3565
+ *
3566
+ * @internal
3567
+ */
3568
+ childrenCache() {
3569
+ return this.#n;
3570
+ }
3571
+ /**
3572
+ * Resolve one or more path strings to a resolved string
3573
+ *
3574
+ * Same interface as require('path').resolve.
3575
+ *
3576
+ * Much faster than path.resolve() when called multiple times for the same
3577
+ * path, because the resolved Path objects are cached. Much slower
3578
+ * otherwise.
3579
+ */
3580
+ resolve(...t) {
3581
+ let e = "";
3582
+ for (let r = t.length - 1; r >= 0; r--) {
3583
+ let o = t[r];
3584
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
3585
+ break;
3586
+ }
3587
+ let s = this.#t.get(e);
3588
+ if (s !== void 0)
3589
+ return s;
3590
+ let i = this.cwd.resolve(e).fullpath();
3591
+ return this.#t.set(e, i), i;
3592
+ }
3593
+ /**
3594
+ * Resolve one or more path strings to a resolved string, returning
3595
+ * the posix path. Identical to .resolve() on posix systems, but on
3596
+ * windows will return a forward-slash separated UNC path.
3597
+ *
3598
+ * Same interface as require('path').resolve.
3599
+ *
3600
+ * Much faster than path.resolve() when called multiple times for the same
3601
+ * path, because the resolved Path objects are cached. Much slower
3602
+ * otherwise.
3603
+ */
3604
+ resolvePosix(...t) {
3605
+ let e = "";
3606
+ for (let r = t.length - 1; r >= 0; r--) {
3607
+ let o = t[r];
3608
+ if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o)))
3609
+ break;
3610
+ }
3611
+ let s = this.#e.get(e);
3612
+ if (s !== void 0)
3613
+ return s;
3614
+ let i = this.cwd.resolve(e).fullpathPosix();
3615
+ return this.#e.set(e, i), i;
3616
+ }
3617
+ /**
3618
+ * find the relative path from the cwd to the supplied path string or entry
3619
+ */
3620
+ relative(t = this.cwd) {
3621
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
3622
+ }
3623
+ /**
3624
+ * find the relative path from the cwd to the supplied path string or
3625
+ * entry, using / as the path delimiter, even on Windows.
3626
+ */
3627
+ relativePosix(t = this.cwd) {
3628
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
3629
+ }
3630
+ /**
3631
+ * Return the basename for the provided string or Path object
3632
+ */
3633
+ basename(t = this.cwd) {
3634
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
3635
+ }
3636
+ /**
3637
+ * Return the dirname for the provided string or Path object
3638
+ */
3639
+ dirname(t = this.cwd) {
3640
+ return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
3641
+ }
3642
+ async readdir(t = this.cwd, e = {
3643
+ withFileTypes: !0
3644
+ }) {
3645
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3646
+ let { withFileTypes: s } = e;
3647
+ if (t.canReaddir()) {
3648
+ let i = await t.readdir();
3649
+ return s ? i : i.map((r) => r.name);
3650
+ } else
3651
+ return [];
3652
+ }
3653
+ readdirSync(t = this.cwd, e = {
3654
+ withFileTypes: !0
3655
+ }) {
3656
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3657
+ let { withFileTypes: s = !0 } = e;
3658
+ return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
3659
+ }
3660
+ /**
3661
+ * Call lstat() on the string or Path object, and update all known
3662
+ * information that can be determined.
3663
+ *
3664
+ * Note that unlike `fs.lstat()`, the returned value does not contain some
3665
+ * information, such as `mode`, `dev`, `nlink`, and `ino`. If that
3666
+ * information is required, you will need to call `fs.lstat` yourself.
3667
+ *
3668
+ * If the Path refers to a nonexistent file, or if the lstat call fails for
3669
+ * any reason, `undefined` is returned. Otherwise the updated Path object is
3670
+ * returned.
3671
+ *
3672
+ * Results are cached, and thus may be out of date if the filesystem is
3673
+ * mutated.
3674
+ */
3675
+ async lstat(t = this.cwd) {
3676
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3677
+ }
3678
+ /**
3679
+ * synchronous {@link PathScurryBase.lstat}
3680
+ */
3681
+ lstatSync(t = this.cwd) {
3682
+ return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3683
+ }
3684
+ async readlink(t = this.cwd, { withFileTypes: e } = {
3685
+ withFileTypes: !1
3686
+ }) {
3687
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
3688
+ let s = await t.readlink();
3689
+ return e ? s : s?.fullpath();
3690
+ }
3691
+ readlinkSync(t = this.cwd, { withFileTypes: e } = {
3692
+ withFileTypes: !1
3693
+ }) {
3694
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
3695
+ let s = t.readlinkSync();
3696
+ return e ? s : s?.fullpath();
3697
+ }
3698
+ async realpath(t = this.cwd, { withFileTypes: e } = {
3699
+ withFileTypes: !1
3700
+ }) {
3701
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
3702
+ let s = await t.realpath();
3703
+ return e ? s : s?.fullpath();
3704
+ }
3705
+ realpathSync(t = this.cwd, { withFileTypes: e } = {
3706
+ withFileTypes: !1
3707
+ }) {
3708
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t.withFileTypes, t = this.cwd);
3709
+ let s = t.realpathSync();
3710
+ return e ? s : s?.fullpath();
3711
+ }
3712
+ async walk(t = this.cwd, e = {}) {
3713
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3714
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3715
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3716
+ let a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ l((u, d) => {
3717
+ a.add(u), u.readdirCB((p, w) => {
3718
+ if (p)
3719
+ return d(p);
3720
+ let m = w.length;
3721
+ if (!m)
3722
+ return d();
3723
+ let y = /* @__PURE__ */ l(() => {
3724
+ --m === 0 && d();
3725
+ }, "next");
3726
+ for (let g of w)
3727
+ (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((E) => E?.isUnknown() ? E.lstat() : E).then(
3728
+ (E) => E?.shouldWalk(a, o) ? c(E, y) : y()) : g.shouldWalk(a, o) ? c(g, y) : y();
3729
+ }, !0);
3730
+ }, "walk"), f = t;
3731
+ return new Promise((u, d) => {
3732
+ c(f, (p) => {
3733
+ if (p)
3734
+ return d(p);
3735
+ u(h);
3736
+ });
3737
+ });
3738
+ }
3739
+ walkSync(t = this.cwd, e = {}) {
3740
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3741
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
3742
+ (!r || r(t)) && h.push(s ? t : t.fullpath());
3743
+ let a = /* @__PURE__ */ new Set([t]);
3744
+ for (let c of a) {
3745
+ let f = c.readdirSync();
3746
+ for (let u of f) {
3747
+ (!r || r(u)) && h.push(s ? u : u.fullpath());
3748
+ let d = u;
3749
+ if (u.isSymbolicLink()) {
3750
+ if (!(i && (d = u.realpathSync())))
3751
+ continue;
3752
+ d.isUnknown() && d.lstatSync();
3753
+ }
3754
+ d.shouldWalk(a, o) && a.add(d);
3755
+ }
3756
+ }
3757
+ return h;
3758
+ }
3759
+ /**
3760
+ * Support for `for await`
3761
+ *
3762
+ * Alias for {@link PathScurryBase.iterate}
3763
+ *
3764
+ * Note: As of Node 19, this is very slow, compared to other methods of
3765
+ * walking. Consider using {@link PathScurryBase.stream} if memory overhead
3766
+ * and backpressure are concerns, or {@link PathScurryBase.walk} if not.
3767
+ */
3768
+ [Symbol.asyncIterator]() {
3769
+ return this.iterate();
3770
+ }
3771
+ iterate(t = this.cwd, e = {}) {
3772
+ return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3773
+ }
3774
+ /**
3775
+ * Iterating over a PathScurry performs a synchronous walk.
3776
+ *
3777
+ * Alias for {@link PathScurryBase.iterateSync}
3778
+ */
3779
+ [Symbol.iterator]() {
3780
+ return this.iterateSync();
3781
+ }
3782
+ *iterateSync(t = this.cwd, e = {}) {
3783
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3784
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
3785
+ (!r || r(t)) && (yield s ? t : t.fullpath());
3786
+ let h = /* @__PURE__ */ new Set([t]);
3787
+ for (let a of h) {
3788
+ let c = a.readdirSync();
3789
+ for (let f of c) {
3790
+ (!r || r(f)) && (yield s ? f : f.fullpath());
3791
+ let u = f;
3792
+ if (f.isSymbolicLink()) {
3793
+ if (!(i && (u = f.realpathSync())))
3794
+ continue;
3795
+ u.isUnknown() && u.lstatSync();
3796
+ }
3797
+ u.shouldWalk(h, o) && h.add(u);
3798
+ }
3799
+ }
3800
+ }
3801
+ stream(t = this.cwd, e = {}) {
3802
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3803
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new Z({ objectMode: !0 });
3804
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3805
+ let a = /* @__PURE__ */ new Set(), c = [t], f = 0, u = /* @__PURE__ */ l(() => {
3806
+ let d = !1;
3807
+ for (; !d; ) {
3808
+ let p = c.shift();
3809
+ if (!p) {
3810
+ f === 0 && h.end();
3811
+ return;
3812
+ }
3813
+ f++, a.add(p);
3814
+ let w = /* @__PURE__ */ l((y, g, E = !1) => {
3815
+ if (y)
3816
+ return h.emit("error", y);
3817
+ if (i && !E) {
3818
+ let S = [];
3819
+ for (let b of g)
3820
+ b.isSymbolicLink() && S.push(b.realpath().then((x) => x?.isUnknown() ? x.lstat() : x));
3821
+ if (S.length) {
3822
+ Promise.all(S).then(() => w(null, g, !0));
3823
+ return;
3824
+ }
3825
+ }
3826
+ for (let S of g)
3827
+ S && (!r || r(S)) && (h.write(s ? S : S.fullpath()) || (d = !0));
3828
+ f--;
3829
+ for (let S of g) {
3830
+ let b = S.realpathCached() || S;
3831
+ b.shouldWalk(a, o) && c.push(b);
3832
+ }
3833
+ d && !h.flowing ? h.once("drain", u) : m || u();
3834
+ }, "onReaddir"), m = !0;
3835
+ p.readdirCB(w, !0), m = !1;
3836
+ }
3837
+ }, "process");
3838
+ return u(), h;
3839
+ }
3840
+ streamSync(t = this.cwd, e = {}) {
3841
+ typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof O || (e = t, t = this.cwd);
3842
+ let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new Z({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
3843
+ (!r || r(t)) && h.write(s ? t : t.fullpath());
3844
+ let c = [t], f = 0, u = /* @__PURE__ */ l(() => {
3845
+ let d = !1;
3846
+ for (; !d; ) {
3847
+ let p = c.shift();
3848
+ if (!p) {
3849
+ f === 0 && h.end();
3850
+ return;
3851
+ }
3852
+ f++, a.add(p);
3853
+ let w = p.readdirSync();
3854
+ for (let m of w)
3855
+ (!r || r(m)) && (h.write(s ? m : m.fullpath()) || (d = !0));
3856
+ f--;
3857
+ for (let m of w) {
3858
+ let y = m;
3859
+ if (m.isSymbolicLink()) {
3860
+ if (!(i && (y = m.realpathSync())))
3861
+ continue;
3862
+ y.isUnknown() && y.lstatSync();
3863
+ }
3864
+ y.shouldWalk(a, o) && c.push(y);
3865
+ }
3866
+ }
3867
+ d && !h.flowing && h.once("drain", u);
3868
+ }, "process");
3869
+ return u(), h;
3870
+ }
3871
+ chdir(t = this.cwd) {
3872
+ let e = this.cwd;
3873
+ this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[ps](e);
3874
+ }
3875
+ }, ct = class extends Kt {
3876
+ static {
3877
+ l(this, "PathScurryWin32");
3878
+ }
3879
+ /**
3880
+ * separator for generating path strings
3881
+ */
3882
+ sep = "\\";
3883
+ constructor(t = process.cwd(), e = {}) {
3884
+ let { nocase: s = !0 } = e;
3885
+ super(t, lt.win32, "\\", { ...e, nocase: s }), this.nocase = s;
3886
+ for (let i = this.cwd; i; i = i.parent)
3887
+ i.nocase = this.nocase;
3888
+ }
3889
+ /**
3890
+ * @internal
3891
+ */
3892
+ parseRootPath(t) {
3893
+ return lt.win32.parse(t).root.toUpperCase();
3894
+ }
3895
+ /**
3896
+ * @internal
3897
+ */
3898
+ newRoot(t) {
3899
+ return new Ht(this.rootPath, H, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3900
+ }
3901
+ /**
3902
+ * Return true if the provided path string is an absolute path
3903
+ */
3904
+ isAbsolute(t) {
3905
+ return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3906
+ }
3907
+ }, ft = class extends Kt {
3908
+ static {
3909
+ l(this, "PathScurryPosix");
3910
+ }
3911
+ /**
3912
+ * separator for generating path strings
3913
+ */
3914
+ sep = "/";
3915
+ constructor(t = process.cwd(), e = {}) {
3916
+ let { nocase: s = !1 } = e;
3917
+ super(t, lt.posix, "/", { ...e, nocase: s }), this.nocase = s;
3918
+ }
3919
+ /**
3920
+ * @internal
3921
+ */
3922
+ parseRootPath(t) {
3923
+ return "/";
3924
+ }
3925
+ /**
3926
+ * @internal
3927
+ */
3928
+ newRoot(t) {
3929
+ return new qt(this.rootPath, H, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3930
+ }
3931
+ /**
3932
+ * Return true if the provided path string is an absolute path
3933
+ */
3934
+ isAbsolute(t) {
3935
+ return t.startsWith("/");
3936
+ }
3937
+ }, At = class extends ft {
3938
+ static {
3939
+ l(this, "PathScurryDarwin");
3940
+ }
3941
+ constructor(t = process.cwd(), e = {}) {
3942
+ let { nocase: s = !0 } = e;
3943
+ super(t, { ...e, nocase: s });
3944
+ }
3945
+ }, _r = process.platform === "win32" ? Ht : qt, ms = process.platform === "win32" ? ct : process.platform === "darwin" ? At : ft;
3946
+
3947
+ // ../node_modules/glob/dist/esm/pattern.js
3948
+ var Ni = /* @__PURE__ */ l((n) => n.length >= 1, "isPatternList"), Li = /* @__PURE__ */ l((n) => n.length >= 1, "isGlobList"), ut = class n {
3949
+ static {
3950
+ l(this, "Pattern");
3951
+ }
3952
+ #t;
3953
+ #e;
3954
+ #n;
3955
+ length;
3956
+ #i;
3957
+ #o;
3958
+ #S;
3959
+ #l;
3960
+ #f;
3961
+ #h;
3962
+ #a = !0;
3963
+ constructor(t, e, s, i) {
3964
+ if (!Ni(t))
3965
+ throw new TypeError("empty pattern list");
3966
+ if (!Li(e))
3967
+ throw new TypeError("empty glob list");
3968
+ if (e.length !== t.length)
3969
+ throw new TypeError("mismatched pattern list and glob list lengths");
3970
+ if (this.length = t.length, s < 0 || s >= this.length)
3971
+ throw new TypeError("index out of range");
3972
+ if (this.#t = t, this.#e = e, this.#n = s, this.#i = i, this.#n === 0) {
3973
+ if (this.isUNC()) {
3974
+ let [r, o, h, a, ...c] = this.#t, [f, u, d, p, ...w] = this.#e;
3975
+ c[0] === "" && (c.shift(), w.shift());
3976
+ let m = [r, o, h, a, ""].join("/"), y = [f, u, d, p, ""].join("/");
3977
+ this.#t = [m, ...c], this.#e = [y, ...w], this.length = this.#t.length;
3978
+ } else if (this.isDrive() || this.isAbsolute()) {
3979
+ let [r, ...o] = this.#t, [h, ...a] = this.#e;
3980
+ o[0] === "" && (o.shift(), a.shift());
3981
+ let c = r + "/", f = h + "/";
3982
+ this.#t = [c, ...o], this.#e = [f, ...a], this.length = this.#t.length;
3983
+ }
3984
+ }
3985
+ }
3986
+ /**
3987
+ * The first entry in the parsed list of patterns
3988
+ */
3989
+ pattern() {
3990
+ return this.#t[this.#n];
3991
+ }
3992
+ /**
3993
+ * true of if pattern() returns a string
3994
+ */
3995
+ isString() {
3996
+ return typeof this.#t[this.#n] == "string";
3997
+ }
3998
+ /**
3999
+ * true of if pattern() returns GLOBSTAR
4000
+ */
4001
+ isGlobstar() {
4002
+ return this.#t[this.#n] === R;
4003
+ }
4004
+ /**
4005
+ * true if pattern() returns a regexp
4006
+ */
4007
+ isRegExp() {
4008
+ return this.#t[this.#n] instanceof RegExp;
4009
+ }
4010
+ /**
4011
+ * The /-joined set of glob parts that make up this pattern
4012
+ */
4013
+ globString() {
4014
+ return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#e[0] + this.#e.slice(1).join("/") : this.#e.join("/") : this.#e.slice(
4015
+ this.#n).join("/"));
4016
+ }
4017
+ /**
4018
+ * true if there are more pattern parts after this one
4019
+ */
4020
+ hasMore() {
4021
+ return this.length > this.#n + 1;
4022
+ }
4023
+ /**
4024
+ * The rest of the pattern after this part, or null if this is the end
4025
+ */
4026
+ rest() {
4027
+ return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#e, this.#n + 1, this.#i), this.#o.#h = this.#h, this.#o.#f =
4028
+ this.#f, this.#o.#l = this.#l, this.#o) : this.#o = null;
4029
+ }
4030
+ /**
4031
+ * true if the pattern represents a //unc/path/ on windows
4032
+ */
4033
+ isUNC() {
4034
+ let t = this.#t;
4035
+ return this.#f !== void 0 ? this.#f : this.#f = this.#i === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "st\
4036
+ ring" && !!t[2] && typeof t[3] == "string" && !!t[3];
4037
+ }
4038
+ // pattern like C:/...
4039
+ // split = ['C:', ...]
4040
+ // XXX: would be nice to handle patterns like `c:*` to test the cwd
4041
+ // in c: for *, but I don't know of a way to even figure out what that
4042
+ // cwd is without actually chdir'ing into it?
4043
+ /**
4044
+ * True if the pattern starts with a drive letter on Windows
4045
+ */
4046
+ isDrive() {
4047
+ let t = this.#t;
4048
+ return this.#l !== void 0 ? this.#l : this.#l = this.#i === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.
4049
+ test(t[0]);
4050
+ }
4051
+ // pattern = '/' or '/...' or '/x/...'
4052
+ // split = ['', ''] or ['', ...] or ['', 'x', ...]
4053
+ // Drive and UNC both considered absolute on windows
4054
+ /**
4055
+ * True if the pattern is rooted on an absolute path
4056
+ */
4057
+ isAbsolute() {
4058
+ let t = this.#t;
4059
+ return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
4060
+ }
4061
+ /**
4062
+ * consume the root of the pattern, and return it
4063
+ */
4064
+ root() {
4065
+ let t = this.#t[0];
4066
+ return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
4067
+ }
4068
+ /**
4069
+ * Check to see if the current globstar pattern is allowed to follow
4070
+ * a symbolic link.
4071
+ */
4072
+ checkFollowGlobstar() {
4073
+ return !(this.#n === 0 || !this.isGlobstar() || !this.#a);
4074
+ }
4075
+ /**
4076
+ * Mark that the current globstar pattern is following a symbolic link
4077
+ */
4078
+ markFollowGlobstar() {
4079
+ return this.#n === 0 || !this.isGlobstar() || !this.#a ? !1 : (this.#a = !1, !0);
4080
+ }
4081
+ };
4082
+
4083
+ // ../node_modules/glob/dist/esm/ignore.js
4084
+ var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", dt = class {
4085
+ static {
4086
+ l(this, "Ignore");
4087
+ }
4088
+ relative;
4089
+ relativeChildren;
4090
+ absolute;
4091
+ absoluteChildren;
4092
+ platform;
4093
+ mmopts;
4094
+ constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = Pi }) {
4095
+ this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
4096
+ dot: !0,
4097
+ nobrace: e,
4098
+ nocase: s,
4099
+ noext: i,
4100
+ noglobstar: r,
4101
+ optimizationLevel: 2,
4102
+ platform: o,
4103
+ nocomment: !0,
4104
+ nonegate: !0
4105
+ };
4106
+ for (let h of t)
4107
+ this.add(h);
4108
+ }
4109
+ add(t) {
4110
+ let e = new _(t, this.mmopts);
4111
+ for (let s = 0; s < e.set.length; s++) {
4112
+ let i = e.set[s], r = e.globParts[s];
4113
+ if (!i || !r)
4114
+ throw new Error("invalid pattern object");
4115
+ for (; i[0] === "." && r[0] === "."; )
4116
+ i.shift(), r.shift();
4117
+ let o = new ut(i, r, 0, this.platform), h = new _(o.globString(), this.mmopts), a = r[r.length - 1] === "**", c = o.isAbsolute();
4118
+ c ? this.absolute.push(h) : this.relative.push(h), a && (c ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
4119
+ }
4120
+ }
4121
+ ignored(t) {
4122
+ let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
4123
+ for (let o of this.relative)
4124
+ if (o.match(i) || o.match(r))
4125
+ return !0;
4126
+ for (let o of this.absolute)
4127
+ if (o.match(e) || o.match(s))
4128
+ return !0;
4129
+ return !1;
4130
+ }
4131
+ childrenIgnored(t) {
4132
+ let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
4133
+ for (let i of this.relativeChildren)
4134
+ if (i.match(s))
4135
+ return !0;
4136
+ for (let i of this.absoluteChildren)
4137
+ if (i.match(e))
4138
+ return !0;
4139
+ return !1;
4140
+ }
4141
+ };
4142
+
4143
+ // ../node_modules/glob/dist/esm/processor.js
4144
+ var me = class n {
4145
+ static {
4146
+ l(this, "HasWalkedCache");
4147
+ }
4148
+ store;
4149
+ constructor(t = /* @__PURE__ */ new Map()) {
4150
+ this.store = t;
4151
+ }
4152
+ copy() {
4153
+ return new n(new Map(this.store));
4154
+ }
4155
+ hasWalked(t, e) {
4156
+ return this.store.get(t.fullpath())?.has(e.globString());
4157
+ }
4158
+ storeWalked(t, e) {
4159
+ let s = t.fullpath(), i = this.store.get(s);
4160
+ i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
4161
+ }
4162
+ }, ge = class {
4163
+ static {
4164
+ l(this, "MatchRecord");
4165
+ }
4166
+ store = /* @__PURE__ */ new Map();
4167
+ add(t, e, s) {
4168
+ let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
4169
+ this.store.set(t, r === void 0 ? i : i & r);
4170
+ }
4171
+ // match, absolute, ifdir
4172
+ entries() {
4173
+ return [...this.store.entries()].map(([t, e]) => [
4174
+ t,
4175
+ !!(e & 2),
4176
+ !!(e & 1)
4177
+ ]);
4178
+ }
4179
+ }, we = class {
4180
+ static {
4181
+ l(this, "SubWalks");
4182
+ }
4183
+ store = /* @__PURE__ */ new Map();
4184
+ add(t, e) {
4185
+ if (!t.canReaddir())
4186
+ return;
4187
+ let s = this.store.get(t);
4188
+ s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
4189
+ }
4190
+ get(t) {
4191
+ let e = this.store.get(t);
4192
+ if (!e)
4193
+ throw new Error("attempting to walk unknown path");
4194
+ return e;
4195
+ }
4196
+ entries() {
4197
+ return this.keys().map((t) => [t, this.store.get(t)]);
4198
+ }
4199
+ keys() {
4200
+ return [...this.store.keys()].filter((t) => t.canReaddir());
4201
+ }
4202
+ }, Rt = class n {
4203
+ static {
4204
+ l(this, "Processor");
4205
+ }
4206
+ hasWalkedCache;
4207
+ matches = new ge();
4208
+ subwalks = new we();
4209
+ patterns;
4210
+ follow;
4211
+ dot;
4212
+ opts;
4213
+ constructor(t, e) {
4214
+ this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new me();
4215
+ }
4216
+ processPatterns(t, e) {
4217
+ this.patterns = e;
4218
+ let s = e.map((i) => [t, i]);
4219
+ for (let [i, r] of s) {
4220
+ this.hasWalkedCache.storeWalked(i, r);
4221
+ let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
4222
+ if (o) {
4223
+ i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
4224
+ let u = r.rest();
4225
+ if (u)
4226
+ r = u;
4227
+ else {
4228
+ this.matches.add(i, !0, !1);
4229
+ continue;
4230
+ }
4231
+ }
4232
+ if (i.isENOENT())
4233
+ continue;
4234
+ let a, c, f = !1;
4235
+ for (; typeof (a = r.pattern()) == "string" && (c = r.rest()); )
4236
+ i = i.resolve(a), r = c, f = !0;
4237
+ if (a = r.pattern(), c = r.rest(), f) {
4238
+ if (this.hasWalkedCache.hasWalked(i, r))
4239
+ continue;
4240
+ this.hasWalkedCache.storeWalked(i, r);
4241
+ }
4242
+ if (typeof a == "string") {
4243
+ let u = a === ".." || a === "" || a === ".";
4244
+ this.matches.add(i.resolve(a), h, u);
4245
+ continue;
4246
+ } else if (a === R) {
4247
+ (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
4248
+ let u = c?.pattern(), d = c?.rest();
4249
+ if (!c || (u === "" || u === ".") && !d)
4250
+ this.matches.add(i, h, u === "" || u === ".");
4251
+ else if (u === "..") {
4252
+ let p = i.parent || i;
4253
+ d ? this.hasWalkedCache.hasWalked(p, d) || this.subwalks.add(p, d) : this.matches.add(p, h, !0);
4254
+ }
4255
+ } else a instanceof RegExp && this.subwalks.add(i, r);
4256
+ }
4257
+ return this;
4258
+ }
4259
+ subwalkTargets() {
4260
+ return this.subwalks.keys();
4261
+ }
4262
+ child() {
4263
+ return new n(this.opts, this.hasWalkedCache);
4264
+ }
4265
+ // return a new Processor containing the subwalks for each
4266
+ // child entry, and a set of matches, and
4267
+ // a hasWalkedCache that's a copy of this one
4268
+ // then we're going to call
4269
+ filterEntries(t, e) {
4270
+ let s = this.subwalks.get(t), i = this.child();
4271
+ for (let r of e)
4272
+ for (let o of s) {
4273
+ let h = o.isAbsolute(), a = o.pattern(), c = o.rest();
4274
+ a === R ? i.testGlobstar(r, o, c, h) : a instanceof RegExp ? i.testRegExp(r, a, c, h) : i.testString(r, a, c, h);
4275
+ }
4276
+ return i;
4277
+ }
4278
+ testGlobstar(t, e, s, i) {
4279
+ if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ?
4280
+ this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.
4281
+ subwalks.add(t, e)))), s) {
4282
+ let r = s.pattern();
4283
+ if (typeof r == "string" && // dots and empty were handled already
4284
+ r !== ".." && r !== "" && r !== ".")
4285
+ this.testString(t, r, s.rest(), i);
4286
+ else if (r === "..") {
4287
+ let o = t.parent || t;
4288
+ this.subwalks.add(o, s);
4289
+ } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
4290
+ }
4291
+ }
4292
+ testRegExp(t, e, s, i) {
4293
+ e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
4294
+ }
4295
+ testString(t, e, s, i) {
4296
+ t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
4297
+ }
4298
+ };
4299
+
4300
+ // ../node_modules/glob/dist/esm/walker.js
4301
+ var Wi = /* @__PURE__ */ l((n, t) => typeof n == "string" ? new dt([n], t) : Array.isArray(n) ? new dt(n, t) : n, "makeIgnore"), Vt = class {
4302
+ static {
4303
+ l(this, "GlobUtil");
4304
+ }
4305
+ path;
4306
+ patterns;
4307
+ opts;
4308
+ seen = /* @__PURE__ */ new Set();
4309
+ paused = !1;
4310
+ aborted = !1;
4311
+ #t = [];
4312
+ #e;
4313
+ #n;
4314
+ signal;
4315
+ maxDepth;
4316
+ includeChildMatches;
4317
+ constructor(t, e, s) {
4318
+ if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches =
4319
+ s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#e = Wi(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#e.
4320
+ add != "function")) {
4321
+ let i = "cannot ignore child matches, ignore lacks add() method.";
4322
+ throw new Error(i);
4323
+ }
4324
+ this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
4325
+ this.#t.length = 0;
4326
+ }));
4327
+ }
4328
+ #i(t) {
4329
+ return this.seen.has(t) || !!this.#e?.ignored?.(t);
4330
+ }
4331
+ #o(t) {
4332
+ return !!this.#e?.childrenIgnored?.(t);
4333
+ }
4334
+ // backpressure mechanism
4335
+ pause() {
4336
+ this.paused = !0;
4337
+ }
4338
+ resume() {
4339
+ if (this.signal?.aborted)
4340
+ return;
4341
+ this.paused = !1;
4342
+ let t;
4343
+ for (; !this.paused && (t = this.#t.shift()); )
4344
+ t();
4345
+ }
4346
+ onResume(t) {
4347
+ this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
4348
+ }
4349
+ // do the requisite realpath/stat checking, and return the path
4350
+ // to add or undefined to filter it out.
4351
+ async matchCheck(t, e) {
4352
+ if (e && this.opts.nodir)
4353
+ return;
4354
+ let s;
4355
+ if (this.opts.realpath) {
4356
+ if (s = t.realpathCached() || await t.realpath(), !s)
4357
+ return;
4358
+ t = s;
4359
+ }
4360
+ let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
4361
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
4362
+ let o = await r.realpath();
4363
+ o && (o.isUnknown() || this.opts.stat) && await o.lstat();
4364
+ }
4365
+ return this.matchCheckTest(r, e);
4366
+ }
4367
+ matchCheckTest(t, e) {
4368
+ return t && (this.maxDepth === 1 / 0 || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) &&
4369
+ (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#i(t) ? t : void 0;
4370
+ }
4371
+ matchCheckSync(t, e) {
4372
+ if (e && this.opts.nodir)
4373
+ return;
4374
+ let s;
4375
+ if (this.opts.realpath) {
4376
+ if (s = t.realpathCached() || t.realpathSync(), !s)
4377
+ return;
4378
+ t = s;
4379
+ }
4380
+ let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
4381
+ if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
4382
+ let o = r.realpathSync();
4383
+ o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
4384
+ }
4385
+ return this.matchCheckTest(r, e);
4386
+ }
4387
+ matchFinish(t, e) {
4388
+ if (this.#i(t))
4389
+ return;
4390
+ if (!this.includeChildMatches && this.#e?.add) {
4391
+ let r = `${t.relativePosix()}/**`;
4392
+ this.#e.add(r);
4393
+ }
4394
+ let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
4395
+ this.seen.add(t);
4396
+ let i = this.opts.mark && t.isDirectory() ? this.#n : "";
4397
+ if (this.opts.withFileTypes)
4398
+ this.matchEmit(t);
4399
+ else if (s) {
4400
+ let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
4401
+ this.matchEmit(r + i);
4402
+ } else {
4403
+ let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n :
4404
+ "";
4405
+ this.matchEmit(r ? o + r + i : "." + i);
4406
+ }
4407
+ }
4408
+ async match(t, e, s) {
4409
+ let i = await this.matchCheck(t, s);
4410
+ i && this.matchFinish(i, e);
4411
+ }
4412
+ matchSync(t, e, s) {
4413
+ let i = this.matchCheckSync(t, s);
4414
+ i && this.matchFinish(i, e);
4415
+ }
4416
+ walkCB(t, e, s) {
4417
+ this.signal?.aborted && s(), this.walkCB2(t, e, new Rt(this.opts), s);
4418
+ }
4419
+ walkCB2(t, e, s, i) {
4420
+ if (this.#o(t))
4421
+ return i();
4422
+ if (this.signal?.aborted && i(), this.paused) {
4423
+ this.onResume(() => this.walkCB2(t, e, s, i));
4424
+ return;
4425
+ }
4426
+ s.processPatterns(t, e);
4427
+ let r = 1, o = /* @__PURE__ */ l(() => {
4428
+ --r === 0 && i();
4429
+ }, "next");
4430
+ for (let [h, a, c] of s.matches.entries())
4431
+ this.#i(h) || (r++, this.match(h, a, c).then(() => o()));
4432
+ for (let h of s.subwalkTargets()) {
4433
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
4434
+ continue;
4435
+ r++;
4436
+ let a = h.readdirCached();
4437
+ h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((c, f) => this.walkCB3(h, f, s, o), !0);
4438
+ }
4439
+ o();
4440
+ }
4441
+ walkCB3(t, e, s, i) {
4442
+ s = s.filterEntries(t, e);
4443
+ let r = 1, o = /* @__PURE__ */ l(() => {
4444
+ --r === 0 && i();
4445
+ }, "next");
4446
+ for (let [h, a, c] of s.matches.entries())
4447
+ this.#i(h) || (r++, this.match(h, a, c).then(() => o()));
4448
+ for (let [h, a] of s.subwalks.entries())
4449
+ r++, this.walkCB2(h, a, s.child(), o);
4450
+ o();
4451
+ }
4452
+ walkCBSync(t, e, s) {
4453
+ this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Rt(this.opts), s);
4454
+ }
4455
+ walkCB2Sync(t, e, s, i) {
4456
+ if (this.#o(t))
4457
+ return i();
4458
+ if (this.signal?.aborted && i(), this.paused) {
4459
+ this.onResume(() => this.walkCB2Sync(t, e, s, i));
4460
+ return;
4461
+ }
4462
+ s.processPatterns(t, e);
4463
+ let r = 1, o = /* @__PURE__ */ l(() => {
4464
+ --r === 0 && i();
4465
+ }, "next");
4466
+ for (let [h, a, c] of s.matches.entries())
4467
+ this.#i(h) || this.matchSync(h, a, c);
4468
+ for (let h of s.subwalkTargets()) {
4469
+ if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth)
4470
+ continue;
4471
+ r++;
4472
+ let a = h.readdirSync();
4473
+ this.walkCB3Sync(h, a, s, o);
4474
+ }
4475
+ o();
4476
+ }
4477
+ walkCB3Sync(t, e, s, i) {
4478
+ s = s.filterEntries(t, e);
4479
+ let r = 1, o = /* @__PURE__ */ l(() => {
4480
+ --r === 0 && i();
4481
+ }, "next");
4482
+ for (let [h, a, c] of s.matches.entries())
4483
+ this.#i(h) || this.matchSync(h, a, c);
4484
+ for (let [h, a] of s.subwalks.entries())
4485
+ r++, this.walkCB2Sync(h, a, s.child(), o);
4486
+ o();
4487
+ }
4488
+ }, Dt = class extends Vt {
4489
+ static {
4490
+ l(this, "GlobWalker");
4491
+ }
4492
+ matches = /* @__PURE__ */ new Set();
4493
+ constructor(t, e, s) {
4494
+ super(t, e, s);
4495
+ }
4496
+ matchEmit(t) {
4497
+ this.matches.add(t);
4498
+ }
4499
+ async walk() {
4500
+ if (this.signal?.aborted)
4501
+ throw this.signal.reason;
4502
+ return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
4503
+ this.walkCB(this.path, this.patterns, () => {
4504
+ this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
4505
+ });
4506
+ }), this.matches;
4507
+ }
4508
+ walkSync() {
4509
+ if (this.signal?.aborted)
4510
+ throw this.signal.reason;
4511
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
4512
+ if (this.signal?.aborted)
4513
+ throw this.signal.reason;
4514
+ }), this.matches;
4515
+ }
4516
+ }, Ot = class extends Vt {
4517
+ static {
4518
+ l(this, "GlobStream");
4519
+ }
4520
+ results;
4521
+ constructor(t, e, s) {
4522
+ super(t, e, s), this.results = new Z({
4523
+ signal: this.signal,
4524
+ objectMode: !0
4525
+ }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
4526
+ }
4527
+ matchEmit(t) {
4528
+ this.results.write(t), this.results.flowing || this.pause();
4529
+ }
4530
+ stream() {
4531
+ let t = this.path;
4532
+ return t.isUnknown() ? t.lstat().then(() => {
4533
+ this.walkCB(t, this.patterns, () => this.results.end());
4534
+ }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
4535
+ }
4536
+ streamSync() {
4537
+ return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
4538
+ }
4539
+ };
4540
+
4541
+ // ../node_modules/glob/dist/esm/glob.js
4542
+ var ji = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", $ = class {
4543
+ static {
4544
+ l(this, "Glob");
4545
+ }
4546
+ absolute;
4547
+ cwd;
4548
+ root;
4549
+ dot;
4550
+ dotRelative;
4551
+ follow;
4552
+ ignore;
4553
+ magicalBraces;
4554
+ mark;
4555
+ matchBase;
4556
+ maxDepth;
4557
+ nobrace;
4558
+ nocase;
4559
+ nodir;
4560
+ noext;
4561
+ noglobstar;
4562
+ pattern;
4563
+ platform;
4564
+ realpath;
4565
+ scurry;
4566
+ stat;
4567
+ signal;
4568
+ windowsPathsNoEscape;
4569
+ withFileTypes;
4570
+ includeChildMatches;
4571
+ /**
4572
+ * The options provided to the constructor.
4573
+ */
4574
+ opts;
4575
+ /**
4576
+ * An array of parsed immutable {@link Pattern} objects.
4577
+ */
4578
+ patterns;
4579
+ /**
4580
+ * All options are stored as properties on the `Glob` object.
4581
+ *
4582
+ * See {@link GlobOptions} for full options descriptions.
4583
+ *
4584
+ * Note that a previous `Glob` object can be passed as the
4585
+ * `GlobOptions` to another `Glob` instantiation to re-use settings
4586
+ * and caches with a new pattern.
4587
+ *
4588
+ * Traversal functions can be called multiple times to run the walk
4589
+ * again.
4590
+ */
4591
+ constructor(t, e) {
4592
+ if (!e)
4593
+ throw new TypeError("glob options required");
4594
+ if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.
4595
+ dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = (0, gs.fileURLToPath)(
4596
+ e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace,
4597
+ this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1,
4598
+ this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.
4599
+ stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0)
4600
+ throw new Error("cannot set absolute and withFileTypes:true");
4601
+ if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape &&
4602
+ (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
4603
+ if (e.noglobstar)
4604
+ throw new TypeError("base matching requires globstar");
4605
+ t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
4606
+ }
4607
+ if (this.pattern = t, this.platform = e.platform || ji, this.opts = { ...e, platform: this.platform }, e.scurry) {
4608
+ if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase)
4609
+ throw new Error("nocase option contradicts provided scurry option");
4610
+ } else {
4611
+ let a = e.platform === "win32" ? ct : e.platform === "darwin" ? At : e.platform ? ft : ms;
4612
+ this.scurry = new a(this.cwd, {
4613
+ nocase: e.nocase,
4614
+ fs: e.fs
4615
+ });
4616
+ }
4617
+ this.nocase = this.scurry.nocase;
4618
+ let s = this.platform === "darwin" || this.platform === "win32", i = {
4619
+ // default nocase based on platform
4620
+ ...e,
4621
+ dot: this.dot,
4622
+ matchBase: this.matchBase,
4623
+ nobrace: this.nobrace,
4624
+ nocase: this.nocase,
4625
+ nocaseMagicOnly: s,
4626
+ nocomment: !0,
4627
+ noext: this.noext,
4628
+ nonegate: !0,
4629
+ optimizationLevel: 2,
4630
+ platform: this.platform,
4631
+ windowsPathsNoEscape: this.windowsPathsNoEscape,
4632
+ debug: !!this.opts.debug
4633
+ }, r = this.pattern.map((a) => new _(a, i)), [o, h] = r.reduce((a, c) => (a[0].push(...c.set), a[1].push(...c.globParts), a), [[], []]);
4634
+ this.patterns = o.map((a, c) => {
4635
+ let f = h[c];
4636
+ if (!f)
4637
+ throw new Error("invalid pattern object");
4638
+ return new ut(a, f, 0, this.platform);
4639
+ });
4640
+ }
4641
+ async walk() {
4642
+ return [
4643
+ ...await new Dt(this.patterns, this.scurry.cwd, {
4644
+ ...this.opts,
4645
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4646
+ platform: this.platform,
4647
+ nocase: this.nocase,
4648
+ includeChildMatches: this.includeChildMatches
4649
+ }).walk()
4650
+ ];
4651
+ }
4652
+ walkSync() {
4653
+ return [
4654
+ ...new Dt(this.patterns, this.scurry.cwd, {
4655
+ ...this.opts,
4656
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4657
+ platform: this.platform,
4658
+ nocase: this.nocase,
4659
+ includeChildMatches: this.includeChildMatches
4660
+ }).walkSync()
4661
+ ];
4662
+ }
4663
+ stream() {
4664
+ return new Ot(this.patterns, this.scurry.cwd, {
4665
+ ...this.opts,
4666
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4667
+ platform: this.platform,
4668
+ nocase: this.nocase,
4669
+ includeChildMatches: this.includeChildMatches
4670
+ }).stream();
4671
+ }
4672
+ streamSync() {
4673
+ return new Ot(this.patterns, this.scurry.cwd, {
4674
+ ...this.opts,
4675
+ maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0,
4676
+ platform: this.platform,
4677
+ nocase: this.nocase,
4678
+ includeChildMatches: this.includeChildMatches
4679
+ }).streamSync();
4680
+ }
4681
+ /**
4682
+ * Default sync iteration function. Returns a Generator that
4683
+ * iterates over the results.
4684
+ */
4685
+ iterateSync() {
4686
+ return this.streamSync()[Symbol.iterator]();
4687
+ }
4688
+ [Symbol.iterator]() {
4689
+ return this.iterateSync();
4690
+ }
4691
+ /**
4692
+ * Default async iteration function. Returns an AsyncGenerator that
4693
+ * iterates over the results.
4694
+ */
4695
+ iterate() {
4696
+ return this.stream()[Symbol.asyncIterator]();
4697
+ }
4698
+ [Symbol.asyncIterator]() {
4699
+ return this.iterate();
4700
+ }
4701
+ };
4702
+
4703
+ // ../node_modules/glob/dist/esm/has-magic.js
4704
+ var ye = /* @__PURE__ */ l((n, t = {}) => {
4705
+ Array.isArray(n) || (n = [n]);
4706
+ for (let e of n)
4707
+ if (new _(e, t).hasMagic())
4708
+ return !0;
4709
+ return !1;
4710
+ }, "hasMagic");
4711
+
4712
+ // ../node_modules/glob/dist/esm/index.js
4713
+ function Yt(n, t = {}) {
4714
+ return new $(n, t).streamSync();
4715
+ }
4716
+ l(Yt, "globStreamSync");
4717
+ function ys(n, t = {}) {
4718
+ return new $(n, t).stream();
4719
+ }
4720
+ l(ys, "globStream");
4721
+ function bs(n, t = {}) {
4722
+ return new $(n, t).walkSync();
4723
+ }
4724
+ l(bs, "globSync");
4725
+ async function ws(n, t = {}) {
4726
+ return new $(n, t).walk();
4727
+ }
4728
+ l(ws, "glob_");
4729
+ function Jt(n, t = {}) {
4730
+ return new $(n, t).iterateSync();
4731
+ }
4732
+ l(Jt, "globIterateSync");
4733
+ function Ss(n, t = {}) {
4734
+ return new $(n, t).iterate();
4735
+ }
4736
+ l(Ss, "globIterate");
4737
+ var Ii = Yt, zi = Object.assign(ys, { sync: Yt }), Bi = Jt, Ui = Object.assign(Ss, {
4738
+ sync: Jt
4739
+ }), $i = Object.assign(bs, {
4740
+ stream: Yt,
4741
+ iterate: Jt
4742
+ }), Xt = Object.assign(ws, {
4743
+ glob: ws,
4744
+ globSync: bs,
4745
+ sync: $i,
4746
+ globStream: ys,
4747
+ stream: zi,
4748
+ globStreamSync: Yt,
4749
+ streamSync: Ii,
4750
+ globIterate: Ss,
4751
+ iterate: Ui,
4752
+ globIterateSync: Jt,
4753
+ iterateSync: Bi,
4754
+ Glob: $,
4755
+ hasMagic: ye,
4756
+ escape: rt,
4757
+ unescape: z
4758
+ });
4759
+ Xt.glob = Xt;
4760
+
4761
+ // ../node_modules/slash/index.js
4762
+ function be(n) {
4763
+ return n.startsWith("\\\\?\\") ? n : n.replace(/\\/g, "/");
4764
+ }
4765
+ l(be, "slash");
4766
+
4767
+ // src/core-server/utils/remove-mdx-entries.ts
4768
+ async function Es(n, t) {
4769
+ let e = (0, Zt.normalizeStories)(n, {
4770
+ configDir: t.configDir,
4771
+ workingDir: t.configDir,
4772
+ defaultFilesPattern: "**/*.@(stories.@(js|jsx|mjs|ts|tsx))"
4773
+ });
4774
+ return (await Promise.all(
4775
+ e.map(async ({ directory: i, files: r, titlePrefix: o }) => {
4776
+ let h = (0, X.join)(i, r), a = (0, X.isAbsolute)(h) ? h : (0, X.join)(t.configDir, h), c = (0, X.isAbsolute)(i) ? i : (0, X.join)(t.configDir,
4777
+ i);
4778
+ return {
4779
+ files: (await Xt(be(a), {
4780
+ ...(0, Zt.commonGlobOptions)(a),
4781
+ follow: !0
4782
+ })).map((f) => (0, X.relative)(c, f)),
4783
+ directory: i,
4784
+ titlePrefix: o
4785
+ };
4786
+ })
4787
+ )).flatMap(({ directory: i, files: r, titlePrefix: o }, h) => {
4788
+ let a = r.filter((f) => !f.endsWith(".mdx")), c = [];
4789
+ return a.length < r.length ? c = a.map((f) => ({
4790
+ directory: i,
4791
+ titlePrefix: o,
4792
+ files: `**/${f}`
4793
+ })) : c = [
4794
+ { directory: e[h].directory, titlePrefix: e[h].titlePrefix, files: e[h].files }
4795
+ ], c;
4796
+ });
4797
+ }
4798
+ l(Es, "removeMDXEntries");
4799
+
4800
+ // src/core-server/presets/common-override-preset.ts
4801
+ var Gi = /* @__PURE__ */ l(async (n) => {
4802
+ let t = typeof n == "string" ? n : n?.name, e = typeof n == "string" ? {} : n?.options || {};
4803
+ return {
4804
+ name: t,
4805
+ options: e
4806
+ };
4807
+ }, "framework"), Hi = /* @__PURE__ */ l(async (n, t) => t?.build?.test?.disableMDXEntries ? Es(n, t) : n, "stories"), qi = /* @__PURE__ */ l(
4808
+ async (n, t) => t?.build?.test?.disableDocgen ? { ...n ?? {}, reactDocgen: !1, check: !1 } : n, "typescript"), Ki = /* @__PURE__ */ l(async (n, t) => t?.
4809
+ build?.test?.disableAutoDocs ? {} : n, "docs"), xs = /* @__PURE__ */ l((n) => ({
4810
+ disableBlocks: n,
4811
+ disabledAddons: n ? ["@storybook/addon-docs", "@storybook/addon-essentials/docs", "@storybook/addon-coverage"] : [],
4812
+ disableMDXEntries: n,
4813
+ disableAutoDocs: n,
4814
+ disableDocgen: n,
4815
+ disableSourcemaps: n,
4816
+ disableTreeShaking: n,
4817
+ esbuildMinify: n
4818
+ }), "createTestBuildFeatures"), Vi = /* @__PURE__ */ l(async (n, t) => ({
4819
+ ...n,
4820
+ test: t.test ? {
4821
+ ...xs(!!t.test),
4822
+ ...n?.test
4823
+ } : xs(!1)
4824
+ }), "build");