storybook 9.0.0-alpha.1 → 9.0.0-alpha.11

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 (267) 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/addon-controls-args-annotated.png +0 -0
  8. package/assets/docs/addon-controls-args-background-color.png +0 -0
  9. package/assets/docs/addon-controls-args-background-string.png +0 -0
  10. package/assets/docs/addon-controls-args-docs.png +0 -0
  11. package/assets/docs/addon-controls-args-logging.png +0 -0
  12. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  13. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  14. package/assets/docs/addon-controls-args-reflow.png +0 -0
  15. package/assets/docs/addon-controls-args-template.png +0 -0
  16. package/assets/docs/addon-controls-expanded.png +0 -0
  17. package/assets/docs/addon-controls-hero.gif +0 -0
  18. package/assets/docs/addon-controls-install.png +0 -0
  19. package/assets/docs/hero.gif +0 -0
  20. package/assets/docs/message-reference.png +0 -0
  21. package/assets/docs/viewport.png +0 -0
  22. package/assets/server/addon.tsconfig.json +6 -0
  23. package/assets/server/base-preview-body.html +119 -0
  24. package/assets/server/base-preview-head.html +451 -0
  25. package/assets/server/template.ejs +87 -0
  26. package/bin/index.cjs +1 -1
  27. package/dist/actions/decorator.d.ts +6 -0
  28. package/dist/actions/decorator.js +139 -0
  29. package/dist/actions/index.cjs +127 -0
  30. package/dist/actions/index.d.ts +105 -0
  31. package/dist/actions/index.js +112 -0
  32. package/dist/actions/manager.js +1196 -0
  33. package/dist/actions/preview.cjs +165 -0
  34. package/dist/actions/preview.d.ts +55 -0
  35. package/dist/actions/preview.js +156 -0
  36. package/dist/babel/index.cjs +54034 -0
  37. package/dist/babel/index.d.ts +7488 -0
  38. package/dist/babel/index.js +54044 -0
  39. package/dist/bin/index.cjs +118 -0
  40. package/dist/bin/index.js +112 -0
  41. package/dist/builder-manager/index.cjs +2140 -0
  42. package/dist/builder-manager/index.d.ts +19 -0
  43. package/dist/builder-manager/index.js +2162 -0
  44. package/dist/channels/index.cjs +1913 -0
  45. package/dist/channels/index.d.ts +108 -0
  46. package/dist/channels/index.js +1881 -0
  47. package/dist/cli/bin/index.cjs +2687 -0
  48. package/dist/cli/bin/index.d.ts +2 -0
  49. package/dist/cli/bin/index.js +2707 -0
  50. package/dist/cli/index.cjs +17327 -0
  51. package/dist/cli/index.d.ts +209 -0
  52. package/dist/cli/index.js +17349 -0
  53. package/dist/client-logger/index.cjs +80 -0
  54. package/dist/client-logger/index.d.ts +29 -0
  55. package/dist/client-logger/index.js +64 -0
  56. package/dist/common/index.cjs +20568 -0
  57. package/dist/common/index.d.ts +948 -0
  58. package/dist/common/index.js +20653 -0
  59. package/dist/component-testing/index.cjs +23 -0
  60. package/dist/component-testing/index.d.ts +3 -0
  61. package/dist/component-testing/index.js +5 -0
  62. package/dist/component-testing/manager.css +170 -0
  63. package/dist/component-testing/manager.js +3099 -0
  64. package/dist/component-testing/preview.cjs +40 -0
  65. package/dist/component-testing/preview.d.ts +5 -0
  66. package/dist/component-testing/preview.js +25 -0
  67. package/dist/components/index.cjs +27925 -0
  68. package/dist/components/index.d.ts +1423 -0
  69. package/dist/components/index.js +24674 -0
  70. package/dist/controls/decorator.d.ts +5 -0
  71. package/dist/controls/decorator.js +8 -0
  72. package/dist/controls/index.cjs +26 -0
  73. package/dist/controls/index.d.ts +39 -0
  74. package/dist/controls/index.js +6 -0
  75. package/dist/controls/manager.js +5545 -0
  76. package/dist/controls/preview.cjs +26 -0
  77. package/dist/controls/preview.d.ts +55 -0
  78. package/dist/controls/preview.js +9 -0
  79. package/dist/core-events/index.cjs +167 -0
  80. package/dist/core-events/index.d.ts +426 -0
  81. package/dist/core-events/index.js +149 -0
  82. package/dist/core-server/index.cjs +38183 -0
  83. package/dist/core-server/index.d.ts +720 -0
  84. package/dist/core-server/index.js +38272 -0
  85. package/dist/core-server/presets/common-manager.js +20 -0
  86. package/dist/core-server/presets/common-override-preset.cjs +4824 -0
  87. package/dist/core-server/presets/common-override-preset.js +4829 -0
  88. package/dist/core-server/presets/common-preset.cjs +10231 -0
  89. package/dist/core-server/presets/common-preset.js +10309 -0
  90. package/dist/csf/index.cjs +179 -0
  91. package/dist/csf/index.d.ts +750 -0
  92. package/dist/csf/index.js +172 -0
  93. package/dist/csf-tools/index.cjs +1422 -0
  94. package/dist/csf-tools/index.d.ts +250 -0
  95. package/dist/csf-tools/index.js +1439 -0
  96. package/dist/docs-tools/index.cjs +2891 -0
  97. package/dist/docs-tools/index.d.ts +162 -0
  98. package/dist/docs-tools/index.js +2876 -0
  99. package/dist/index.cjs +17 -1
  100. package/dist/index.d.ts +1 -1
  101. package/dist/index.js +2 -7
  102. package/dist/instrumenter/index.cjs +3492 -0
  103. package/dist/instrumenter/index.d.ts +104 -0
  104. package/dist/instrumenter/index.js +4964 -0
  105. package/dist/manager/globals-module-info.cjs +817 -0
  106. package/dist/manager/globals-module-info.d.ts +36 -0
  107. package/dist/manager/globals-module-info.js +804 -0
  108. package/dist/manager/globals-runtime.js +83389 -0
  109. package/dist/manager/globals.cjs +47 -0
  110. package/dist/manager/globals.d.ts +24 -0
  111. package/dist/manager/globals.js +34 -0
  112. package/dist/manager/runtime.js +12323 -0
  113. package/dist/manager-api/index.cjs +11074 -0
  114. package/dist/manager-api/index.d.ts +1512 -0
  115. package/dist/manager-api/index.js +4835 -0
  116. package/dist/manager-errors.d.ts +89 -0
  117. package/dist/manager-errors.js +99 -0
  118. package/dist/node-logger/index.cjs +1642 -0
  119. package/dist/node-logger/index.d.ts +117 -0
  120. package/dist/node-logger/index.js +1652 -0
  121. package/dist/preview/globals.cjs +38 -0
  122. package/dist/preview/globals.d.ts +15 -0
  123. package/dist/preview/globals.js +25 -0
  124. package/dist/preview/runtime.js +44921 -0
  125. package/dist/preview-api/index.cjs +5227 -0
  126. package/dist/preview-api/index.d.ts +1093 -0
  127. package/dist/preview-api/index.js +5295 -0
  128. package/dist/preview-errors.cjs +503 -0
  129. package/dist/preview-errors.d.ts +212 -0
  130. package/dist/preview-errors.js +449 -0
  131. package/dist/router/index.cjs +3296 -0
  132. package/dist/router/index.d.ts +385 -0
  133. package/dist/router/index.js +1843 -0
  134. package/dist/server-errors.cjs +727 -0
  135. package/dist/server-errors.d.ts +296 -0
  136. package/dist/server-errors.js +728 -0
  137. package/dist/telemetry/index.cjs +2756 -0
  138. package/dist/telemetry/index.d.ts +133 -0
  139. package/dist/telemetry/index.js +2797 -0
  140. package/dist/test/index.cjs +35685 -0
  141. package/dist/test/index.d.ts +186 -0
  142. package/dist/test/index.js +33751 -0
  143. package/dist/test/preview.cjs +15869 -0
  144. package/dist/test/preview.d.ts +54 -0
  145. package/dist/test/preview.js +14440 -0
  146. package/dist/test/spy.cjs +257 -0
  147. package/dist/test/spy.d.ts +66 -0
  148. package/dist/test/spy.js +239 -0
  149. package/dist/theming/create.cjs +232 -0
  150. package/dist/theming/create.d.ts +50 -0
  151. package/dist/theming/create.js +216 -0
  152. package/dist/theming/index.cjs +2665 -0
  153. package/dist/theming/index.d.ts +11939 -0
  154. package/dist/theming/index.js +2485 -0
  155. package/dist/types/index.cjs +27 -0
  156. package/dist/types/index.d.ts +2795 -0
  157. package/dist/types/index.js +7 -0
  158. package/dist/viewport/index.cjs +310 -0
  159. package/dist/viewport/index.d.ts +320 -0
  160. package/dist/viewport/index.js +290 -0
  161. package/dist/viewport/manager.js +400 -0
  162. package/dist/viewport/preview.cjs +35 -0
  163. package/dist/viewport/preview.d.ts +69 -0
  164. package/dist/viewport/preview.js +19 -0
  165. package/package.json +539 -209
  166. package/.eslintrc.cjs +0 -31
  167. package/__mocks__/@aw-web-design/x-default-browser.js +0 -2
  168. package/core/babel/index.cjs +0 -1
  169. package/core/babel/index.d.ts +0 -2
  170. package/core/babel/index.js +0 -1
  171. package/core/builder-manager/index.cjs +0 -1
  172. package/core/builder-manager/index.d.ts +0 -2
  173. package/core/builder-manager/index.js +0 -1
  174. package/core/channels/index.cjs +0 -1
  175. package/core/channels/index.d.ts +0 -2
  176. package/core/channels/index.js +0 -1
  177. package/core/cli/bin/index.cjs +0 -1
  178. package/core/cli/bin/index.d.ts +0 -2
  179. package/core/cli/bin/index.js +0 -1
  180. package/core/cli/index.cjs +0 -1
  181. package/core/cli/index.d.ts +0 -2
  182. package/core/cli/index.js +0 -1
  183. package/core/client-logger/index.cjs +0 -1
  184. package/core/client-logger/index.d.ts +0 -2
  185. package/core/client-logger/index.js +0 -1
  186. package/core/common/index.cjs +0 -1
  187. package/core/common/index.d.ts +0 -2
  188. package/core/common/index.js +0 -1
  189. package/core/components/index.cjs +0 -1
  190. package/core/components/index.d.ts +0 -2
  191. package/core/components/index.js +0 -1
  192. package/core/core-events/index.cjs +0 -1
  193. package/core/core-events/index.d.ts +0 -2
  194. package/core/core-events/index.js +0 -1
  195. package/core/core-server/index.cjs +0 -1
  196. package/core/core-server/index.d.ts +0 -2
  197. package/core/core-server/index.js +0 -1
  198. package/core/core-server/presets/common-manager.js +0 -1
  199. package/core/core-server/presets/common-override-preset.cjs +0 -1
  200. package/core/core-server/presets/common-override-preset.js +0 -1
  201. package/core/core-server/presets/common-preset.cjs +0 -1
  202. package/core/core-server/presets/common-preset.js +0 -1
  203. package/core/csf/index.cjs +0 -1
  204. package/core/csf/index.d.ts +0 -2
  205. package/core/csf/index.js +0 -1
  206. package/core/csf-tools/index.cjs +0 -1
  207. package/core/csf-tools/index.d.ts +0 -2
  208. package/core/csf-tools/index.js +0 -1
  209. package/core/docs-tools/index.cjs +0 -1
  210. package/core/docs-tools/index.d.ts +0 -2
  211. package/core/docs-tools/index.js +0 -1
  212. package/core/index.cjs +0 -1
  213. package/core/index.d.ts +0 -2
  214. package/core/index.js +0 -1
  215. package/core/manager/globals-module-info.cjs +0 -1
  216. package/core/manager/globals-module-info.d.ts +0 -2
  217. package/core/manager/globals-module-info.js +0 -1
  218. package/core/manager/globals-runtime.js +0 -1
  219. package/core/manager/globals.cjs +0 -1
  220. package/core/manager/globals.d.ts +0 -2
  221. package/core/manager/globals.js +0 -1
  222. package/core/manager-api/index.cjs +0 -1
  223. package/core/manager-api/index.d.ts +0 -2
  224. package/core/manager-api/index.js +0 -1
  225. package/core/manager-errors.d.ts +0 -2
  226. package/core/manager-errors.js +0 -1
  227. package/core/node-logger/index.cjs +0 -1
  228. package/core/node-logger/index.d.ts +0 -2
  229. package/core/node-logger/index.js +0 -1
  230. package/core/preview/globals.cjs +0 -1
  231. package/core/preview/globals.d.ts +0 -2
  232. package/core/preview/globals.js +0 -1
  233. package/core/preview/runtime.js +0 -1
  234. package/core/preview-api/index.cjs +0 -1
  235. package/core/preview-api/index.d.ts +0 -2
  236. package/core/preview-api/index.js +0 -1
  237. package/core/preview-errors.cjs +0 -1
  238. package/core/preview-errors.d.ts +0 -2
  239. package/core/preview-errors.js +0 -1
  240. package/core/router/index.cjs +0 -1
  241. package/core/router/index.d.ts +0 -2
  242. package/core/router/index.js +0 -1
  243. package/core/server-errors.cjs +0 -1
  244. package/core/server-errors.d.ts +0 -2
  245. package/core/server-errors.js +0 -1
  246. package/core/telemetry/index.cjs +0 -1
  247. package/core/telemetry/index.d.ts +0 -2
  248. package/core/telemetry/index.js +0 -1
  249. package/core/theming/create.cjs +0 -1
  250. package/core/theming/create.d.ts +0 -2
  251. package/core/theming/create.js +0 -1
  252. package/core/theming/index.cjs +0 -1
  253. package/core/theming/index.d.ts +0 -2
  254. package/core/theming/index.js +0 -1
  255. package/core/types/index.cjs +0 -1
  256. package/core/types/index.d.ts +0 -2
  257. package/core/types/index.js +0 -1
  258. package/core.cjs +0 -0
  259. package/core.d.ts +0 -0
  260. package/core.js +0 -1
  261. package/dist/chunk-OWLSIX54.js +0 -8
  262. package/dist/core-path.cjs +0 -1
  263. package/dist/core-path.d.ts +0 -3
  264. package/dist/core-path.js +0 -9
  265. package/dist/proxy.cjs +0 -1
  266. package/dist/proxy.d.ts +0 -2
  267. package/dist/proxy.js +0 -9
@@ -0,0 +1,2797 @@
1
+ import ESM_COMPAT_Module from "node:module";
2
+ import { fileURLToPath as ESM_COMPAT_fileURLToPath } from 'node:url';
3
+ import { dirname as ESM_COMPAT_dirname } from 'node:path';
4
+ const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
5
+ const __dirname = ESM_COMPAT_dirname(__filename);
6
+ const require = ESM_COMPAT_Module.createRequire(import.meta.url);
7
+ var ao = Object.create;
8
+ var ke = Object.defineProperty;
9
+ var co = Object.getOwnPropertyDescriptor;
10
+ var uo = Object.getOwnPropertyNames;
11
+ var fo = Object.getPrototypeOf, lo = Object.prototype.hasOwnProperty;
12
+ var o = (e, t) => ke(e, "name", { value: t, configurable: !0 }), S = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
13
+ "u" ? new Proxy(e, {
14
+ get: (t, r) => (typeof require < "u" ? require : t)[r]
15
+ }) : e)(function(e) {
16
+ if (typeof require < "u") return require.apply(this, arguments);
17
+ throw Error('Dynamic require of "' + e + '" is not supported');
18
+ });
19
+ var x = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
20
+ var po = (e, t, r, n) => {
21
+ if (t && typeof t == "object" || typeof t == "function")
22
+ for (let i of uo(t))
23
+ !lo.call(e, i) && i !== r && ke(e, i, { get: () => t[i], enumerable: !(n = co(t, i)) || n.enumerable });
24
+ return e;
25
+ };
26
+ var A = (e, t, r) => (r = e != null ? ao(fo(e)) : {}, po(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ t || !e || !e.__esModule ? ke(r, "default", { value: e, enumerable: !0 }) : r,
32
+ e
33
+ ));
34
+
35
+ // ../node_modules/picocolors/picocolors.js
36
+ var vt = x((ja, Ee) => {
37
+ var q = process || {}, Et = q.argv || [], V = q.env || {}, mo = !(V.NO_COLOR || Et.includes("--no-color")) && (!!V.FORCE_COLOR || Et.includes(
38
+ "--color") || q.platform === "win32" || (q.stdout || {}).isTTY && V.TERM !== "dumb" || !!V.CI), yo = /* @__PURE__ */ o((e, t, r = e) => (n) => {
39
+ let i = "" + n, s = i.indexOf(t, e.length);
40
+ return ~s ? e + ho(i, t, r, s) + t : e + i + t;
41
+ }, "formatter"), ho = /* @__PURE__ */ o((e, t, r, n) => {
42
+ let i = "", s = 0;
43
+ do
44
+ i += e.substring(s, n) + r, s = n + t.length, n = e.indexOf(t, s);
45
+ while (~n);
46
+ return i + e.substring(s);
47
+ }, "replaceClose"), Pt = /* @__PURE__ */ o((e = mo) => {
48
+ let t = e ? yo : () => String;
49
+ return {
50
+ isColorSupported: e,
51
+ reset: t("\x1B[0m", "\x1B[0m"),
52
+ bold: t("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
53
+ dim: t("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
54
+ italic: t("\x1B[3m", "\x1B[23m"),
55
+ underline: t("\x1B[4m", "\x1B[24m"),
56
+ inverse: t("\x1B[7m", "\x1B[27m"),
57
+ hidden: t("\x1B[8m", "\x1B[28m"),
58
+ strikethrough: t("\x1B[9m", "\x1B[29m"),
59
+ black: t("\x1B[30m", "\x1B[39m"),
60
+ red: t("\x1B[31m", "\x1B[39m"),
61
+ green: t("\x1B[32m", "\x1B[39m"),
62
+ yellow: t("\x1B[33m", "\x1B[39m"),
63
+ blue: t("\x1B[34m", "\x1B[39m"),
64
+ magenta: t("\x1B[35m", "\x1B[39m"),
65
+ cyan: t("\x1B[36m", "\x1B[39m"),
66
+ white: t("\x1B[37m", "\x1B[39m"),
67
+ gray: t("\x1B[90m", "\x1B[39m"),
68
+ bgBlack: t("\x1B[40m", "\x1B[49m"),
69
+ bgRed: t("\x1B[41m", "\x1B[49m"),
70
+ bgGreen: t("\x1B[42m", "\x1B[49m"),
71
+ bgYellow: t("\x1B[43m", "\x1B[49m"),
72
+ bgBlue: t("\x1B[44m", "\x1B[49m"),
73
+ bgMagenta: t("\x1B[45m", "\x1B[49m"),
74
+ bgCyan: t("\x1B[46m", "\x1B[49m"),
75
+ bgWhite: t("\x1B[47m", "\x1B[49m"),
76
+ blackBright: t("\x1B[90m", "\x1B[39m"),
77
+ redBright: t("\x1B[91m", "\x1B[39m"),
78
+ greenBright: t("\x1B[92m", "\x1B[39m"),
79
+ yellowBright: t("\x1B[93m", "\x1B[39m"),
80
+ blueBright: t("\x1B[94m", "\x1B[39m"),
81
+ magentaBright: t("\x1B[95m", "\x1B[39m"),
82
+ cyanBright: t("\x1B[96m", "\x1B[39m"),
83
+ whiteBright: t("\x1B[97m", "\x1B[39m"),
84
+ bgBlackBright: t("\x1B[100m", "\x1B[49m"),
85
+ bgRedBright: t("\x1B[101m", "\x1B[49m"),
86
+ bgGreenBright: t("\x1B[102m", "\x1B[49m"),
87
+ bgYellowBright: t("\x1B[103m", "\x1B[49m"),
88
+ bgBlueBright: t("\x1B[104m", "\x1B[49m"),
89
+ bgMagentaBright: t("\x1B[105m", "\x1B[49m"),
90
+ bgCyanBright: t("\x1B[106m", "\x1B[49m"),
91
+ bgWhiteBright: t("\x1B[107m", "\x1B[49m")
92
+ };
93
+ }, "createColors");
94
+ Ee.exports = Pt();
95
+ Ee.exports.createColors = Pt;
96
+ });
97
+
98
+ // ../node_modules/walk-up-path/dist/cjs/index.js
99
+ var Nt = x((K) => {
100
+ "use strict";
101
+ Object.defineProperty(K, "__esModule", { value: !0 });
102
+ K.walkUp = void 0;
103
+ var Rt = S("path"), go = /* @__PURE__ */ o(function* (e) {
104
+ for (e = (0, Rt.resolve)(e); e; ) {
105
+ yield e;
106
+ let t = (0, Rt.dirname)(e);
107
+ if (t === e)
108
+ break;
109
+ e = t;
110
+ }
111
+ }, "walkUp");
112
+ K.walkUp = go;
113
+ });
114
+
115
+ // ../node_modules/isexe/windows.js
116
+ var Wt = x((ac, $t) => {
117
+ $t.exports = Ut;
118
+ Ut.sync = Io;
119
+ var Bt = S("fs");
120
+ function Co(e, t) {
121
+ var r = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
122
+ if (!r || (r = r.split(";"), r.indexOf("") !== -1))
123
+ return !0;
124
+ for (var n = 0; n < r.length; n++) {
125
+ var i = r[n].toLowerCase();
126
+ if (i && e.substr(-i.length).toLowerCase() === i)
127
+ return !0;
128
+ }
129
+ return !1;
130
+ }
131
+ o(Co, "checkPathExt");
132
+ function Gt(e, t, r) {
133
+ return !e.isSymbolicLink() && !e.isFile() ? !1 : Co(t, r);
134
+ }
135
+ o(Gt, "checkStat");
136
+ function Ut(e, t, r) {
137
+ Bt.stat(e, function(n, i) {
138
+ r(n, n ? !1 : Gt(i, e, t));
139
+ });
140
+ }
141
+ o(Ut, "isexe");
142
+ function Io(e, t) {
143
+ return Gt(Bt.statSync(e), e, t);
144
+ }
145
+ o(Io, "sync");
146
+ });
147
+
148
+ // ../node_modules/isexe/mode.js
149
+ var zt = x((uc, qt) => {
150
+ qt.exports = Jt;
151
+ Jt.sync = Ao;
152
+ var Ht = S("fs");
153
+ function Jt(e, t, r) {
154
+ Ht.stat(e, function(n, i) {
155
+ r(n, n ? !1 : Vt(i, t));
156
+ });
157
+ }
158
+ o(Jt, "isexe");
159
+ function Ao(e, t) {
160
+ return Vt(Ht.statSync(e), t);
161
+ }
162
+ o(Ao, "sync");
163
+ function Vt(e, t) {
164
+ return e.isFile() && Oo(e, t);
165
+ }
166
+ o(Vt, "checkStat");
167
+ function Oo(e, t) {
168
+ var r = e.mode, n = e.uid, i = e.gid, s = t.uid !== void 0 ? t.uid : process.getuid && process.getuid(), a = t.gid !== void 0 ? t.gid : process.
169
+ getgid && process.getgid(), c = parseInt("100", 8), u = parseInt("010", 8), f = parseInt("001", 8), l = c | u, d = r & f || r & u && i ===
170
+ a || r & c && n === s || r & l && s === 0;
171
+ return d;
172
+ }
173
+ o(Oo, "checkMode");
174
+ });
175
+
176
+ // ../node_modules/isexe/index.js
177
+ var Kt = x((pc, Yt) => {
178
+ var lc = S("fs"), X;
179
+ process.platform === "win32" || global.TESTING_WINDOWS ? X = Wt() : X = zt();
180
+ Yt.exports = Ae;
181
+ Ae.sync = jo;
182
+ function Ae(e, t, r) {
183
+ if (typeof t == "function" && (r = t, t = {}), !r) {
184
+ if (typeof Promise != "function")
185
+ throw new TypeError("callback not provided");
186
+ return new Promise(function(n, i) {
187
+ Ae(e, t || {}, function(s, a) {
188
+ s ? i(s) : n(a);
189
+ });
190
+ });
191
+ }
192
+ X(e, t || {}, function(n, i) {
193
+ n && (n.code === "EACCES" || t && t.ignoreErrors) && (n = null, i = !1), r(n, i);
194
+ });
195
+ }
196
+ o(Ae, "isexe");
197
+ function jo(e, t) {
198
+ try {
199
+ return X.sync(e, t || {});
200
+ } catch (r) {
201
+ if (t && t.ignoreErrors || r.code === "EACCES")
202
+ return !1;
203
+ throw r;
204
+ }
205
+ }
206
+ o(jo, "sync");
207
+ });
208
+
209
+ // ../node_modules/cross-spawn/node_modules/which/which.js
210
+ var nr = x((dc, rr) => {
211
+ var j = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Xt = S("path"), Ro = j ? ";" : "\
212
+ :", Qt = Kt(), Zt = /* @__PURE__ */ o((e) => Object.assign(new Error(`not found: ${e}`), { code: "ENOENT" }), "getNotFoundError"), er = /* @__PURE__ */ o(
213
+ (e, t) => {
214
+ let r = t.colon || Ro, n = e.match(/\//) || j && e.match(/\\/) ? [""] : [
215
+ // windows always checks the cwd first
216
+ ...j ? [process.cwd()] : [],
217
+ ...(t.path || process.env.PATH || /* istanbul ignore next: very unusual */
218
+ "").split(r)
219
+ ], i = j ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", s = j ? i.split(r) : [""];
220
+ return j && e.indexOf(".") !== -1 && s[0] !== "" && s.unshift(""), {
221
+ pathEnv: n,
222
+ pathExt: s,
223
+ pathExtExe: i
224
+ };
225
+ }, "getPathInfo"), tr = /* @__PURE__ */ o((e, t, r) => {
226
+ typeof t == "function" && (r = t, t = {}), t || (t = {});
227
+ let { pathEnv: n, pathExt: i, pathExtExe: s } = er(e, t), a = [], c = /* @__PURE__ */ o((f) => new Promise((l, d) => {
228
+ if (f === n.length)
229
+ return t.all && a.length ? l(a) : d(Zt(e));
230
+ let h = n[f], y = /^".*"$/.test(h) ? h.slice(1, -1) : h, g = Xt.join(y, e), m = !y && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + g : g;
231
+ l(u(m, f, 0));
232
+ }), "step"), u = /* @__PURE__ */ o((f, l, d) => new Promise((h, y) => {
233
+ if (d === i.length)
234
+ return h(c(l + 1));
235
+ let g = i[d];
236
+ Qt(f + g, { pathExt: s }, (m, b) => {
237
+ if (!m && b)
238
+ if (t.all)
239
+ a.push(f + g);
240
+ else
241
+ return h(f + g);
242
+ return h(u(f, l, d + 1));
243
+ });
244
+ }), "subStep");
245
+ return r ? c(0).then((f) => r(null, f), r) : c(0);
246
+ }, "which"), No = /* @__PURE__ */ o((e, t) => {
247
+ t = t || {};
248
+ let { pathEnv: r, pathExt: n, pathExtExe: i } = er(e, t), s = [];
249
+ for (let a = 0; a < r.length; a++) {
250
+ let c = r[a], u = /^".*"$/.test(c) ? c.slice(1, -1) : c, f = Xt.join(u, e), l = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + f : f;
251
+ for (let d = 0; d < n.length; d++) {
252
+ let h = l + n[d];
253
+ try {
254
+ if (Qt.sync(h, { pathExt: i }))
255
+ if (t.all)
256
+ s.push(h);
257
+ else
258
+ return h;
259
+ } catch {
260
+ }
261
+ }
262
+ }
263
+ if (t.all && s.length)
264
+ return s;
265
+ if (t.nothrow)
266
+ return null;
267
+ throw Zt(e);
268
+ }, "whichSync");
269
+ rr.exports = tr;
270
+ tr.sync = No;
271
+ });
272
+
273
+ // ../node_modules/path-key/index.js
274
+ var ir = x((hc, Oe) => {
275
+ "use strict";
276
+ var or = /* @__PURE__ */ o((e = {}) => {
277
+ let t = e.env || process.env;
278
+ return (e.platform || process.platform) !== "win32" ? "PATH" : Object.keys(t).reverse().find((n) => n.toUpperCase() === "PATH") || "Path";
279
+ }, "pathKey");
280
+ Oe.exports = or;
281
+ Oe.exports.default = or;
282
+ });
283
+
284
+ // ../node_modules/cross-spawn/lib/util/resolveCommand.js
285
+ var ur = x((bc, cr) => {
286
+ "use strict";
287
+ var sr = S("path"), Do = nr(), _o = ir();
288
+ function ar(e, t) {
289
+ let r = e.options.env || process.env, n = process.cwd(), i = e.options.cwd != null, s = i && process.chdir !== void 0 && !process.chdir.
290
+ disabled;
291
+ if (s)
292
+ try {
293
+ process.chdir(e.options.cwd);
294
+ } catch {
295
+ }
296
+ let a;
297
+ try {
298
+ a = Do.sync(e.command, {
299
+ path: r[_o({ env: r })],
300
+ pathExt: t ? sr.delimiter : void 0
301
+ });
302
+ } catch {
303
+ } finally {
304
+ s && process.chdir(n);
305
+ }
306
+ return a && (a = sr.resolve(i ? e.options.cwd : "", a)), a;
307
+ }
308
+ o(ar, "resolveCommandAttempt");
309
+ function Mo(e) {
310
+ return ar(e) || ar(e, !0);
311
+ }
312
+ o(Mo, "resolveCommand");
313
+ cr.exports = Mo;
314
+ });
315
+
316
+ // ../node_modules/cross-spawn/lib/util/escape.js
317
+ var fr = x((wc, Re) => {
318
+ "use strict";
319
+ var je = /([()\][%!^"`<>&|;, *?])/g;
320
+ function Lo(e) {
321
+ return e = e.replace(je, "^$1"), e;
322
+ }
323
+ o(Lo, "escapeCommand");
324
+ function Fo(e, t) {
325
+ return e = `${e}`, e = e.replace(/(\\*)"/g, '$1$1\\"'), e = e.replace(/(\\*)$/, "$1$1"), e = `"${e}"`, e = e.replace(je, "^$1"), t && (e =
326
+ e.replace(je, "^$1")), e;
327
+ }
328
+ o(Fo, "escapeArgument");
329
+ Re.exports.command = Lo;
330
+ Re.exports.argument = Fo;
331
+ });
332
+
333
+ // ../node_modules/shebang-regex/index.js
334
+ var pr = x((kc, lr) => {
335
+ "use strict";
336
+ lr.exports = /^#!(.*)/;
337
+ });
338
+
339
+ // ../node_modules/shebang-command/index.js
340
+ var dr = x((Ec, mr) => {
341
+ "use strict";
342
+ var Bo = pr();
343
+ mr.exports = (e = "") => {
344
+ let t = e.match(Bo);
345
+ if (!t)
346
+ return null;
347
+ let [r, n] = t[0].replace(/#! ?/, "").split(" "), i = r.split("/").pop();
348
+ return i === "env" ? n : n ? `${i} ${n}` : i;
349
+ };
350
+ });
351
+
352
+ // ../node_modules/cross-spawn/lib/util/readShebang.js
353
+ var hr = x((Pc, yr) => {
354
+ "use strict";
355
+ var Ne = S("fs"), Go = dr();
356
+ function Uo(e) {
357
+ let r = Buffer.alloc(150), n;
358
+ try {
359
+ n = Ne.openSync(e, "r"), Ne.readSync(n, r, 0, 150, 0), Ne.closeSync(n);
360
+ } catch {
361
+ }
362
+ return Go(r.toString());
363
+ }
364
+ o(Uo, "readShebang");
365
+ yr.exports = Uo;
366
+ });
367
+
368
+ // ../node_modules/cross-spawn/lib/parse.js
369
+ var wr = x((Tc, xr) => {
370
+ "use strict";
371
+ var $o = S("path"), gr = ur(), br = fr(), Wo = hr(), Ho = process.platform === "win32", Jo = /\.(?:com|exe)$/i, Vo = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
372
+ function qo(e) {
373
+ e.file = gr(e);
374
+ let t = e.file && Wo(e.file);
375
+ return t ? (e.args.unshift(e.file), e.command = t, gr(e)) : e.file;
376
+ }
377
+ o(qo, "detectShebang");
378
+ function zo(e) {
379
+ if (!Ho)
380
+ return e;
381
+ let t = qo(e), r = !Jo.test(t);
382
+ if (e.options.forceShell || r) {
383
+ let n = Vo.test(t);
384
+ e.command = $o.normalize(e.command), e.command = br.command(e.command), e.args = e.args.map((s) => br.argument(s, n));
385
+ let i = [e.command].concat(e.args).join(" ");
386
+ e.args = ["/d", "/s", "/c", `"${i}"`], e.command = process.env.comspec || "cmd.exe", e.options.windowsVerbatimArguments = !0;
387
+ }
388
+ return e;
389
+ }
390
+ o(zo, "parseNonShell");
391
+ function Yo(e, t, r) {
392
+ t && !Array.isArray(t) && (r = t, t = null), t = t ? t.slice(0) : [], r = Object.assign({}, r);
393
+ let n = {
394
+ command: e,
395
+ args: t,
396
+ options: r,
397
+ file: void 0,
398
+ original: {
399
+ command: e,
400
+ args: t
401
+ }
402
+ };
403
+ return r.shell ? n : zo(n);
404
+ }
405
+ o(Yo, "parse");
406
+ xr.exports = Yo;
407
+ });
408
+
409
+ // ../node_modules/cross-spawn/lib/enoent.js
410
+ var Er = x((Ic, kr) => {
411
+ "use strict";
412
+ var De = process.platform === "win32";
413
+ function _e(e, t) {
414
+ return Object.assign(new Error(`${t} ${e.command} ENOENT`), {
415
+ code: "ENOENT",
416
+ errno: "ENOENT",
417
+ syscall: `${t} ${e.command}`,
418
+ path: e.command,
419
+ spawnargs: e.args
420
+ });
421
+ }
422
+ o(_e, "notFoundError");
423
+ function Ko(e, t) {
424
+ if (!De)
425
+ return;
426
+ let r = e.emit;
427
+ e.emit = function(n, i) {
428
+ if (n === "exit") {
429
+ let s = Sr(i, t, "spawn");
430
+ if (s)
431
+ return r.call(e, "error", s);
432
+ }
433
+ return r.apply(e, arguments);
434
+ };
435
+ }
436
+ o(Ko, "hookChildProcess");
437
+ function Sr(e, t) {
438
+ return De && e === 1 && !t.file ? _e(t.original, "spawn") : null;
439
+ }
440
+ o(Sr, "verifyENOENT");
441
+ function Xo(e, t) {
442
+ return De && e === 1 && !t.file ? _e(t.original, "spawnSync") : null;
443
+ }
444
+ o(Xo, "verifyENOENTSync");
445
+ kr.exports = {
446
+ hookChildProcess: Ko,
447
+ verifyENOENT: Sr,
448
+ verifyENOENTSync: Xo,
449
+ notFoundError: _e
450
+ };
451
+ });
452
+
453
+ // ../node_modules/cross-spawn/index.js
454
+ var Tr = x((Oc, R) => {
455
+ "use strict";
456
+ var Pr = S("child_process"), Me = wr(), Le = Er();
457
+ function vr(e, t, r) {
458
+ let n = Me(e, t, r), i = Pr.spawn(n.command, n.args, n.options);
459
+ return Le.hookChildProcess(i, n), i;
460
+ }
461
+ o(vr, "spawn");
462
+ function Qo(e, t, r) {
463
+ let n = Me(e, t, r), i = Pr.spawnSync(n.command, n.args, n.options);
464
+ return i.error = i.error || Le.verifyENOENTSync(i.status, n), i;
465
+ }
466
+ o(Qo, "spawnSync");
467
+ R.exports = vr;
468
+ R.exports.spawn = vr;
469
+ R.exports.sync = Qo;
470
+ R.exports._parse = Me;
471
+ R.exports._enoent = Le;
472
+ });
473
+
474
+ // ../node_modules/merge-stream/index.js
475
+ var Qr = x((rf, Xr) => {
476
+ "use strict";
477
+ var { PassThrough: Yi } = S("stream");
478
+ Xr.exports = function() {
479
+ var e = [], t = new Yi({ objectMode: !0 });
480
+ return t.setMaxListeners(0), t.add = r, t.isEmpty = n, t.on("unpipe", i), Array.prototype.slice.call(arguments).forEach(r), t;
481
+ function r(s) {
482
+ return Array.isArray(s) ? (s.forEach(r), this) : (e.push(s), s.once("end", i.bind(null, s)), s.once("error", t.emit.bind(t, "error")),
483
+ s.pipe(t, { end: !1 }), this);
484
+ }
485
+ o(r, "add");
486
+ function n() {
487
+ return e.length == 0;
488
+ }
489
+ o(n, "isEmpty");
490
+ function i(s) {
491
+ e = e.filter(function(a) {
492
+ return a !== s;
493
+ }), !e.length && t.readable && t.end();
494
+ }
495
+ o(i, "remove");
496
+ };
497
+ });
498
+
499
+ // ../node_modules/common-path-prefix/index.js
500
+ var vn = x((Zf, Pn) => {
501
+ "use strict";
502
+ var { sep: vs } = S("path"), Ts = /* @__PURE__ */ o((e) => {
503
+ for (let t of e) {
504
+ let r = /(\/|\\)/.exec(t);
505
+ if (r !== null) return r[0];
506
+ }
507
+ return vs;
508
+ }, "determineSeparator");
509
+ Pn.exports = /* @__PURE__ */ o(function(t, r = Ts(t)) {
510
+ let [n = "", ...i] = t;
511
+ if (n === "" || i.length === 0) return "";
512
+ let s = n.split(r), a = s.length;
513
+ for (let u of i) {
514
+ let f = u.split(r);
515
+ for (let l = 0; l < a; l++)
516
+ f[l] !== s[l] && (a = l);
517
+ if (a === 0) return "";
518
+ }
519
+ let c = s.slice(0, a).join(r);
520
+ return c.endsWith(r) ? c : c + r;
521
+ }, "commonPathPrefix");
522
+ });
523
+
524
+ // ../node_modules/fetch-retry/index.js
525
+ var Yn = x((Tm, zn) => {
526
+ "use strict";
527
+ zn.exports = function(e, t) {
528
+ if (t = t || {}, typeof e != "function")
529
+ throw new E("fetch must be a function");
530
+ if (typeof t != "object")
531
+ throw new E("defaults must be an object");
532
+ if (t.retries !== void 0 && !xe(t.retries))
533
+ throw new E("retries must be a positive integer");
534
+ if (t.retryDelay !== void 0 && !xe(t.retryDelay) && typeof t.retryDelay != "function")
535
+ throw new E("retryDelay must be a positive integer or a function returning a positive integer");
536
+ if (t.retryOn !== void 0 && !Array.isArray(t.retryOn) && typeof t.retryOn != "function")
537
+ throw new E("retryOn property expects an array or function");
538
+ var r = {
539
+ retries: 3,
540
+ retryDelay: 1e3,
541
+ retryOn: []
542
+ };
543
+ return t = Object.assign(r, t), /* @__PURE__ */ o(function(i, s) {
544
+ var a = t.retries, c = t.retryDelay, u = t.retryOn;
545
+ if (s && s.retries !== void 0)
546
+ if (xe(s.retries))
547
+ a = s.retries;
548
+ else
549
+ throw new E("retries must be a positive integer");
550
+ if (s && s.retryDelay !== void 0)
551
+ if (xe(s.retryDelay) || typeof s.retryDelay == "function")
552
+ c = s.retryDelay;
553
+ else
554
+ throw new E("retryDelay must be a positive integer or a function returning a positive integer");
555
+ if (s && s.retryOn)
556
+ if (Array.isArray(s.retryOn) || typeof s.retryOn == "function")
557
+ u = s.retryOn;
558
+ else
559
+ throw new E("retryOn property expects an array or function");
560
+ return new Promise(function(f, l) {
561
+ var d = /* @__PURE__ */ o(function(y) {
562
+ var g = typeof Request < "u" && i instanceof Request ? i.clone() : i;
563
+ e(g, s).then(function(m) {
564
+ if (Array.isArray(u) && u.indexOf(m.status) === -1)
565
+ f(m);
566
+ else if (typeof u == "function")
567
+ try {
568
+ return Promise.resolve(u(y, null, m)).then(function(b) {
569
+ b ? h(y, null, m) : f(m);
570
+ }).catch(l);
571
+ } catch (b) {
572
+ l(b);
573
+ }
574
+ else
575
+ y < a ? h(y, null, m) : f(m);
576
+ }).catch(function(m) {
577
+ if (typeof u == "function")
578
+ try {
579
+ Promise.resolve(u(y, m, null)).then(function(b) {
580
+ b ? h(y, m, null) : l(m);
581
+ }).catch(function(b) {
582
+ l(b);
583
+ });
584
+ } catch (b) {
585
+ l(b);
586
+ }
587
+ else y < a ? h(y, m, null) : l(m);
588
+ });
589
+ }, "wrappedFetch");
590
+ function h(y, g, m) {
591
+ var b = typeof c == "function" ? c(y, g, m) : c;
592
+ setTimeout(function() {
593
+ d(++y);
594
+ }, b);
595
+ }
596
+ o(h, "retry"), d(0);
597
+ });
598
+ }, "fetchRetry");
599
+ };
600
+ function xe(e) {
601
+ return Number.isInteger(e) && e >= 0;
602
+ }
603
+ o(xe, "isPositiveInteger");
604
+ function E(e) {
605
+ this.name = "ArgumentError", this.message = e;
606
+ }
607
+ o(E, "ArgumentError");
608
+ });
609
+
610
+ // src/telemetry/index.ts
611
+ import { logger as so } from "storybook/internal/node-logger";
612
+
613
+ // src/telemetry/notify.ts
614
+ var z = A(vt(), 1);
615
+ import { cache as Tt } from "storybook/internal/common";
616
+ var Ct = "telemetry-notification-date", O = console, It = /* @__PURE__ */ o(async () => {
617
+ await Tt.get(Ct, null) || (Tt.set(Ct, Date.now()), O.log(), O.log(
618
+ `${z.default.magenta(
619
+ z.default.bold("attention")
620
+ )} => Storybook now collects completely anonymous telemetry regarding usage.`
621
+ ), O.log("This information is used to shape Storybook's roadmap and prioritize features."), O.log(
622
+ "You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:"
623
+ ), O.log(z.default.cyan("https://storybook.js.org/telemetry")), O.log());
624
+ }, "notify");
625
+
626
+ // src/telemetry/sanitize.ts
627
+ import jt from "node:path";
628
+ function At(e) {
629
+ return e.replace(/[-[/{}()*+?.\\^$|]/g, "\\$&");
630
+ }
631
+ o(At, "regexpEscape");
632
+ function Ot(e = "") {
633
+ return e.replace(/\u001B\[[0-9;]*m/g, "");
634
+ }
635
+ o(Ot, "removeAnsiEscapeCodes");
636
+ function D(e, t = jt.sep) {
637
+ if (!e)
638
+ return e;
639
+ let r = process.cwd().split(t);
640
+ for (; r.length > 1; ) {
641
+ let n = r.join(t), i = new RegExp(At(n), "gi");
642
+ e = e.replace(i, "$SNIP");
643
+ let s = r.join(t + t), a = new RegExp(At(s), "gi");
644
+ e = e.replace(a, "$SNIP"), r.pop();
645
+ }
646
+ return e;
647
+ }
648
+ o(D, "cleanPaths");
649
+ function Y(e, t = jt.sep) {
650
+ try {
651
+ e = {
652
+ ...JSON.parse(JSON.stringify(e)),
653
+ message: Ot(e.message),
654
+ stack: Ot(e.stack),
655
+ cause: e.cause,
656
+ name: e.name
657
+ };
658
+ let r = D(JSON.stringify(e), t);
659
+ return JSON.parse(r);
660
+ } catch (r) {
661
+ return `Sanitization error: ${r?.message}`;
662
+ }
663
+ }
664
+ o(Y, "sanitizeError");
665
+
666
+ // src/telemetry/storybook-metadata.ts
667
+ import { dirname as ra } from "node:path";
668
+ import {
669
+ getProjectRoot as na,
670
+ getStorybookConfiguration as oa,
671
+ getStorybookInfo as ia,
672
+ loadMainConfig as sa,
673
+ versions as aa
674
+ } from "storybook/internal/common";
675
+ import { readConfig as ca } from "storybook/internal/csf-tools";
676
+
677
+ // ../node_modules/fd-package-json/dist/esm/main.js
678
+ var Dt = A(Nt(), 1);
679
+ import { resolve as bo } from "node:path";
680
+ import { stat as xo, readFile as wo } from "node:fs/promises";
681
+ import { statSync as Ha, readFileSync as Ja } from "node:fs";
682
+ async function So(e) {
683
+ try {
684
+ return (await xo(e)).isFile();
685
+ } catch {
686
+ return !1;
687
+ }
688
+ }
689
+ o(So, "fileExists");
690
+ async function Pe(e) {
691
+ for (let t of (0, Dt.walkUp)(e)) {
692
+ let r = bo(t, "package.json");
693
+ if (await So(r))
694
+ return r;
695
+ }
696
+ return null;
697
+ }
698
+ o(Pe, "findPackagePath");
699
+ async function _t(e) {
700
+ let t = await Pe(e);
701
+ if (!t)
702
+ return null;
703
+ try {
704
+ let r = await wo(t, { encoding: "utf8" });
705
+ return JSON.parse(r);
706
+ } catch {
707
+ return null;
708
+ }
709
+ }
710
+ o(_t, "findPackage");
711
+
712
+ // ../node_modules/package-manager-detector/dist/constants.mjs
713
+ var Mt = [
714
+ "npm",
715
+ "yarn",
716
+ "yarn@berry",
717
+ "pnpm",
718
+ "pnpm@6",
719
+ "bun",
720
+ "deno"
721
+ ], ve = {
722
+ "bun.lock": "bun",
723
+ "bun.lockb": "bun",
724
+ "deno.lock": "deno",
725
+ "pnpm-lock.yaml": "pnpm",
726
+ "yarn.lock": "yarn",
727
+ "package-lock.json": "npm",
728
+ "npm-shrinkwrap.json": "npm"
729
+ }, Te = {
730
+ "node_modules/.deno/": "deno",
731
+ "node_modules/.pnpm/": "pnpm",
732
+ "node_modules/.yarn-state.yml": "yarn",
733
+ // yarn v2+ (node-modules)
734
+ "node_modules/.yarn_integrity": "yarn",
735
+ // yarn v1
736
+ "node_modules/.package-lock.json": "npm",
737
+ ".pnp.cjs": "yarn",
738
+ // yarn v3+ (pnp)
739
+ ".pnp.js": "yarn",
740
+ // yarn v2 (pnp)
741
+ "bun.lock": "bun",
742
+ "bun.lockb": "bun"
743
+ };
744
+
745
+ // ../node_modules/package-manager-detector/dist/detect.mjs
746
+ import Ft from "node:fs/promises";
747
+ import P from "node:path";
748
+ import ko from "node:process";
749
+ async function Ce(e, t) {
750
+ try {
751
+ let r = await Ft.stat(e);
752
+ return t === "file" ? r.isFile() : r.isDirectory();
753
+ } catch {
754
+ return !1;
755
+ }
756
+ }
757
+ o(Ce, "pathExists");
758
+ function* Eo(e = ko.cwd()) {
759
+ let t = P.resolve(e), { root: r } = P.parse(t);
760
+ for (; t && t !== r; )
761
+ yield t, t = P.dirname(t);
762
+ }
763
+ o(Eo, "lookup");
764
+ async function Lt(e, t) {
765
+ return !e || !Ce(e, "file") ? null : await vo(e, t);
766
+ }
767
+ o(Lt, "parsePackageJson");
768
+ async function Ie(e = {}) {
769
+ let { cwd: t, strategies: r = ["lockfile", "packageManager-field", "devEngines-field"], onUnknown: n } = e;
770
+ for (let i of Eo(t))
771
+ for (let s of r)
772
+ switch (s) {
773
+ case "lockfile": {
774
+ for (let a of Object.keys(ve))
775
+ if (await Ce(P.join(i, a), "file")) {
776
+ let c = ve[a], u = await Lt(P.join(i, "package.json"), n);
777
+ return u || { name: c, agent: c };
778
+ }
779
+ break;
780
+ }
781
+ case "packageManager-field":
782
+ case "devEngines-field": {
783
+ let a = await Lt(P.join(i, "package.json"), n);
784
+ if (a)
785
+ return a;
786
+ break;
787
+ }
788
+ case "install-metadata": {
789
+ for (let a of Object.keys(Te)) {
790
+ let c = a.endsWith("/") ? "dir" : "file";
791
+ if (await Ce(P.join(i, a), c)) {
792
+ let u = Te[a], f = u === "yarn" ? To(a) ? "yarn" : "yarn@berry" : u;
793
+ return { name: u, agent: f };
794
+ }
795
+ }
796
+ break;
797
+ }
798
+ }
799
+ return null;
800
+ }
801
+ o(Ie, "detect");
802
+ function Po(e) {
803
+ let t = /* @__PURE__ */ o((r) => r?.match(/\d+(\.\d+){0,2}/)?.[0] ?? r, "handelVer");
804
+ if (typeof e.packageManager == "string") {
805
+ let [r, n] = e.packageManager.replace(/^\^/, "").split("@");
806
+ return { name: r, ver: t(n) };
807
+ }
808
+ if (typeof e.devEngines?.packageManager?.name == "string")
809
+ return {
810
+ name: e.devEngines.packageManager.name,
811
+ ver: t(e.devEngines.packageManager.version)
812
+ };
813
+ }
814
+ o(Po, "getNameAndVer");
815
+ async function vo(e, t) {
816
+ try {
817
+ let r = JSON.parse(await Ft.readFile(e, "utf8")), n, i = Po(r);
818
+ if (i) {
819
+ let s = i.name, a = i.ver, c = a;
820
+ return s === "yarn" && a && Number.parseInt(a) > 1 ? (n = "yarn@berry", c = "berry", { name: s, agent: n, version: c }) : s === "pnpm" &&
821
+ a && Number.parseInt(a) < 7 ? (n = "pnpm@6", { name: s, agent: n, version: c }) : Mt.includes(s) ? (n = s, { name: s, agent: n, version: c }) :
822
+ t?.(r.packageManager) ?? null;
823
+ }
824
+ } catch {
825
+ }
826
+ return null;
827
+ }
828
+ o(vo, "handlePackageManager");
829
+ function To(e) {
830
+ return e.endsWith(".yarn_integrity");
831
+ }
832
+ o(To, "isMetadataYarnClassic");
833
+
834
+ // ../node_modules/package-manager-detector/dist/index.mjs
835
+ import "node:fs/promises";
836
+ import "node:path";
837
+ import "node:process";
838
+
839
+ // src/telemetry/get-application-file-count.ts
840
+ import { sep as Us } from "node:path";
841
+
842
+ // src/telemetry/exec-command-count-lines.ts
843
+ import { createInterface as bs } from "node:readline";
844
+
845
+ // node_modules/execa/index.js
846
+ var dn = A(Tr(), 1);
847
+ import { Buffer as ps } from "node:buffer";
848
+ import ms from "node:path";
849
+ import ct from "node:child_process";
850
+ import le from "node:process";
851
+
852
+ // ../node_modules/strip-final-newline/index.js
853
+ function Fe(e) {
854
+ let t = typeof e == "string" ? `
855
+ ` : 10, r = typeof e == "string" ? "\r" : 13;
856
+ return e[e.length - 1] === t && (e = e.slice(0, -1)), e[e.length - 1] === r && (e = e.slice(0, -1)), e;
857
+ }
858
+ o(Fe, "stripFinalNewline");
859
+
860
+ // node_modules/npm-run-path/index.js
861
+ import Z from "node:process";
862
+ import _ from "node:path";
863
+ import Zo from "node:url";
864
+
865
+ // node_modules/path-key/index.js
866
+ function Q(e = {}) {
867
+ let {
868
+ env: t = process.env,
869
+ platform: r = process.platform
870
+ } = e;
871
+ return r !== "win32" ? "PATH" : Object.keys(t).reverse().find((n) => n.toUpperCase() === "PATH") || "Path";
872
+ }
873
+ o(Q, "pathKey");
874
+
875
+ // node_modules/npm-run-path/index.js
876
+ function ei(e = {}) {
877
+ let {
878
+ cwd: t = Z.cwd(),
879
+ path: r = Z.env[Q()],
880
+ execPath: n = Z.execPath
881
+ } = e, i, s = t instanceof URL ? Zo.fileURLToPath(t) : t, a = _.resolve(s), c = [];
882
+ for (; i !== a; )
883
+ c.push(_.join(a, "node_modules/.bin")), i = a, a = _.resolve(a, "..");
884
+ return c.push(_.resolve(s, n, "..")), [...c, r].join(_.delimiter);
885
+ }
886
+ o(ei, "npmRunPath");
887
+ function Cr({ env: e = Z.env, ...t } = {}) {
888
+ e = { ...e };
889
+ let r = Q({ env: e });
890
+ return t.path = e[r], e[r] = ei(t), e;
891
+ }
892
+ o(Cr, "npmRunPathEnv");
893
+
894
+ // node_modules/mimic-fn/index.js
895
+ var ti = /* @__PURE__ */ o((e, t, r, n) => {
896
+ if (r === "length" || r === "prototype" || r === "arguments" || r === "caller")
897
+ return;
898
+ let i = Object.getOwnPropertyDescriptor(e, r), s = Object.getOwnPropertyDescriptor(t, r);
899
+ !ri(i, s) && n || Object.defineProperty(e, r, s);
900
+ }, "copyProperty"), ri = /* @__PURE__ */ o(function(e, t) {
901
+ return e === void 0 || e.configurable || e.writable === t.writable && e.enumerable === t.enumerable && e.configurable === t.configurable &&
902
+ (e.writable || e.value === t.value);
903
+ }, "canCopyProperty"), ni = /* @__PURE__ */ o((e, t) => {
904
+ let r = Object.getPrototypeOf(t);
905
+ r !== Object.getPrototypeOf(e) && Object.setPrototypeOf(e, r);
906
+ }, "changePrototype"), oi = /* @__PURE__ */ o((e, t) => `/* Wrapped ${e}*/
907
+ ${t}`, "wrappedToString"), ii = Object.getOwnPropertyDescriptor(Function.prototype, "toString"), si = Object.getOwnPropertyDescriptor(Function.
908
+ prototype.toString, "name"), ai = /* @__PURE__ */ o((e, t, r) => {
909
+ let n = r === "" ? "" : `with ${r.trim()}() `, i = oi.bind(null, n, t.toString());
910
+ Object.defineProperty(i, "name", si), Object.defineProperty(e, "toString", { ...ii, value: i });
911
+ }, "changeToString");
912
+ function Be(e, t, { ignoreNonConfigurable: r = !1 } = {}) {
913
+ let { name: n } = e;
914
+ for (let i of Reflect.ownKeys(t))
915
+ ti(e, t, i, r);
916
+ return ni(e, t), ai(e, t, n), e;
917
+ }
918
+ o(Be, "mimicFunction");
919
+
920
+ // node_modules/onetime/index.js
921
+ var ee = /* @__PURE__ */ new WeakMap(), Ir = /* @__PURE__ */ o((e, t = {}) => {
922
+ if (typeof e != "function")
923
+ throw new TypeError("Expected a function");
924
+ let r, n = 0, i = e.displayName || e.name || "<anonymous>", s = /* @__PURE__ */ o(function(...a) {
925
+ if (ee.set(s, ++n), n === 1)
926
+ r = e.apply(this, a), e = null;
927
+ else if (t.throw === !0)
928
+ throw new Error(`Function \`${i}\` can only be called once`);
929
+ return r;
930
+ }, "onetime");
931
+ return Be(s, e), ee.set(s, n), s;
932
+ }, "onetime");
933
+ Ir.callCount = (e) => {
934
+ if (!ee.has(e))
935
+ throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);
936
+ return ee.get(e);
937
+ };
938
+ var Ar = Ir;
939
+
940
+ // node_modules/execa/lib/error.js
941
+ import gi from "node:process";
942
+
943
+ // node_modules/human-signals/build/src/main.js
944
+ import { constants as li } from "node:os";
945
+
946
+ // node_modules/human-signals/build/src/realtime.js
947
+ var Or = /* @__PURE__ */ o(() => {
948
+ let e = Ge - jr + 1;
949
+ return Array.from({ length: e }, ci);
950
+ }, "getRealtimeSignals"), ci = /* @__PURE__ */ o((e, t) => ({
951
+ name: `SIGRT${t + 1}`,
952
+ number: jr + t,
953
+ action: "terminate",
954
+ description: "Application-specific signal (realtime)",
955
+ standard: "posix"
956
+ }), "getRealtimeSignal"), jr = 34, Ge = 64;
957
+
958
+ // node_modules/human-signals/build/src/signals.js
959
+ import { constants as ui } from "node:os";
960
+
961
+ // node_modules/human-signals/build/src/core.js
962
+ var Rr = [
963
+ {
964
+ name: "SIGHUP",
965
+ number: 1,
966
+ action: "terminate",
967
+ description: "Terminal closed",
968
+ standard: "posix"
969
+ },
970
+ {
971
+ name: "SIGINT",
972
+ number: 2,
973
+ action: "terminate",
974
+ description: "User interruption with CTRL-C",
975
+ standard: "ansi"
976
+ },
977
+ {
978
+ name: "SIGQUIT",
979
+ number: 3,
980
+ action: "core",
981
+ description: "User interruption with CTRL-\\",
982
+ standard: "posix"
983
+ },
984
+ {
985
+ name: "SIGILL",
986
+ number: 4,
987
+ action: "core",
988
+ description: "Invalid machine instruction",
989
+ standard: "ansi"
990
+ },
991
+ {
992
+ name: "SIGTRAP",
993
+ number: 5,
994
+ action: "core",
995
+ description: "Debugger breakpoint",
996
+ standard: "posix"
997
+ },
998
+ {
999
+ name: "SIGABRT",
1000
+ number: 6,
1001
+ action: "core",
1002
+ description: "Aborted",
1003
+ standard: "ansi"
1004
+ },
1005
+ {
1006
+ name: "SIGIOT",
1007
+ number: 6,
1008
+ action: "core",
1009
+ description: "Aborted",
1010
+ standard: "bsd"
1011
+ },
1012
+ {
1013
+ name: "SIGBUS",
1014
+ number: 7,
1015
+ action: "core",
1016
+ description: "Bus error due to misaligned, non-existing address or paging error",
1017
+ standard: "bsd"
1018
+ },
1019
+ {
1020
+ name: "SIGEMT",
1021
+ number: 7,
1022
+ action: "terminate",
1023
+ description: "Command should be emulated but is not implemented",
1024
+ standard: "other"
1025
+ },
1026
+ {
1027
+ name: "SIGFPE",
1028
+ number: 8,
1029
+ action: "core",
1030
+ description: "Floating point arithmetic error",
1031
+ standard: "ansi"
1032
+ },
1033
+ {
1034
+ name: "SIGKILL",
1035
+ number: 9,
1036
+ action: "terminate",
1037
+ description: "Forced termination",
1038
+ standard: "posix",
1039
+ forced: !0
1040
+ },
1041
+ {
1042
+ name: "SIGUSR1",
1043
+ number: 10,
1044
+ action: "terminate",
1045
+ description: "Application-specific signal",
1046
+ standard: "posix"
1047
+ },
1048
+ {
1049
+ name: "SIGSEGV",
1050
+ number: 11,
1051
+ action: "core",
1052
+ description: "Segmentation fault",
1053
+ standard: "ansi"
1054
+ },
1055
+ {
1056
+ name: "SIGUSR2",
1057
+ number: 12,
1058
+ action: "terminate",
1059
+ description: "Application-specific signal",
1060
+ standard: "posix"
1061
+ },
1062
+ {
1063
+ name: "SIGPIPE",
1064
+ number: 13,
1065
+ action: "terminate",
1066
+ description: "Broken pipe or socket",
1067
+ standard: "posix"
1068
+ },
1069
+ {
1070
+ name: "SIGALRM",
1071
+ number: 14,
1072
+ action: "terminate",
1073
+ description: "Timeout or timer",
1074
+ standard: "posix"
1075
+ },
1076
+ {
1077
+ name: "SIGTERM",
1078
+ number: 15,
1079
+ action: "terminate",
1080
+ description: "Termination",
1081
+ standard: "ansi"
1082
+ },
1083
+ {
1084
+ name: "SIGSTKFLT",
1085
+ number: 16,
1086
+ action: "terminate",
1087
+ description: "Stack is empty or overflowed",
1088
+ standard: "other"
1089
+ },
1090
+ {
1091
+ name: "SIGCHLD",
1092
+ number: 17,
1093
+ action: "ignore",
1094
+ description: "Child process terminated, paused or unpaused",
1095
+ standard: "posix"
1096
+ },
1097
+ {
1098
+ name: "SIGCLD",
1099
+ number: 17,
1100
+ action: "ignore",
1101
+ description: "Child process terminated, paused or unpaused",
1102
+ standard: "other"
1103
+ },
1104
+ {
1105
+ name: "SIGCONT",
1106
+ number: 18,
1107
+ action: "unpause",
1108
+ description: "Unpaused",
1109
+ standard: "posix",
1110
+ forced: !0
1111
+ },
1112
+ {
1113
+ name: "SIGSTOP",
1114
+ number: 19,
1115
+ action: "pause",
1116
+ description: "Paused",
1117
+ standard: "posix",
1118
+ forced: !0
1119
+ },
1120
+ {
1121
+ name: "SIGTSTP",
1122
+ number: 20,
1123
+ action: "pause",
1124
+ description: 'Paused using CTRL-Z or "suspend"',
1125
+ standard: "posix"
1126
+ },
1127
+ {
1128
+ name: "SIGTTIN",
1129
+ number: 21,
1130
+ action: "pause",
1131
+ description: "Background process cannot read terminal input",
1132
+ standard: "posix"
1133
+ },
1134
+ {
1135
+ name: "SIGBREAK",
1136
+ number: 21,
1137
+ action: "terminate",
1138
+ description: "User interruption with CTRL-BREAK",
1139
+ standard: "other"
1140
+ },
1141
+ {
1142
+ name: "SIGTTOU",
1143
+ number: 22,
1144
+ action: "pause",
1145
+ description: "Background process cannot write to terminal output",
1146
+ standard: "posix"
1147
+ },
1148
+ {
1149
+ name: "SIGURG",
1150
+ number: 23,
1151
+ action: "ignore",
1152
+ description: "Socket received out-of-band data",
1153
+ standard: "bsd"
1154
+ },
1155
+ {
1156
+ name: "SIGXCPU",
1157
+ number: 24,
1158
+ action: "core",
1159
+ description: "Process timed out",
1160
+ standard: "bsd"
1161
+ },
1162
+ {
1163
+ name: "SIGXFSZ",
1164
+ number: 25,
1165
+ action: "core",
1166
+ description: "File too big",
1167
+ standard: "bsd"
1168
+ },
1169
+ {
1170
+ name: "SIGVTALRM",
1171
+ number: 26,
1172
+ action: "terminate",
1173
+ description: "Timeout or timer",
1174
+ standard: "bsd"
1175
+ },
1176
+ {
1177
+ name: "SIGPROF",
1178
+ number: 27,
1179
+ action: "terminate",
1180
+ description: "Timeout or timer",
1181
+ standard: "bsd"
1182
+ },
1183
+ {
1184
+ name: "SIGWINCH",
1185
+ number: 28,
1186
+ action: "ignore",
1187
+ description: "Terminal window size changed",
1188
+ standard: "bsd"
1189
+ },
1190
+ {
1191
+ name: "SIGIO",
1192
+ number: 29,
1193
+ action: "terminate",
1194
+ description: "I/O is available",
1195
+ standard: "other"
1196
+ },
1197
+ {
1198
+ name: "SIGPOLL",
1199
+ number: 29,
1200
+ action: "terminate",
1201
+ description: "Watched event",
1202
+ standard: "other"
1203
+ },
1204
+ {
1205
+ name: "SIGINFO",
1206
+ number: 29,
1207
+ action: "ignore",
1208
+ description: "Request for process information",
1209
+ standard: "other"
1210
+ },
1211
+ {
1212
+ name: "SIGPWR",
1213
+ number: 30,
1214
+ action: "terminate",
1215
+ description: "Device running out of power",
1216
+ standard: "systemv"
1217
+ },
1218
+ {
1219
+ name: "SIGSYS",
1220
+ number: 31,
1221
+ action: "core",
1222
+ description: "Invalid system call",
1223
+ standard: "other"
1224
+ },
1225
+ {
1226
+ name: "SIGUNUSED",
1227
+ number: 31,
1228
+ action: "terminate",
1229
+ description: "Invalid system call",
1230
+ standard: "other"
1231
+ }
1232
+ ];
1233
+
1234
+ // node_modules/human-signals/build/src/signals.js
1235
+ var Ue = /* @__PURE__ */ o(() => {
1236
+ let e = Or();
1237
+ return [...Rr, ...e].map(fi);
1238
+ }, "getSignals"), fi = /* @__PURE__ */ o(({
1239
+ name: e,
1240
+ number: t,
1241
+ description: r,
1242
+ action: n,
1243
+ forced: i = !1,
1244
+ standard: s
1245
+ }) => {
1246
+ let {
1247
+ signals: { [e]: a }
1248
+ } = ui, c = a !== void 0;
1249
+ return { name: e, number: c ? a : t, description: r, supported: c, action: n, forced: i, standard: s };
1250
+ }, "normalizeSignal");
1251
+
1252
+ // node_modules/human-signals/build/src/main.js
1253
+ var pi = /* @__PURE__ */ o(() => {
1254
+ let e = Ue();
1255
+ return Object.fromEntries(e.map(mi));
1256
+ }, "getSignalsByName"), mi = /* @__PURE__ */ o(({
1257
+ name: e,
1258
+ number: t,
1259
+ description: r,
1260
+ supported: n,
1261
+ action: i,
1262
+ forced: s,
1263
+ standard: a
1264
+ }) => [e, { name: e, number: t, description: r, supported: n, action: i, forced: s, standard: a }], "getSignalByName"), Nr = pi(), di = /* @__PURE__ */ o(
1265
+ () => {
1266
+ let e = Ue(), t = Ge + 1, r = Array.from(
1267
+ { length: t },
1268
+ (n, i) => yi(i, e)
1269
+ );
1270
+ return Object.assign({}, ...r);
1271
+ }, "getSignalsByNumber"), yi = /* @__PURE__ */ o((e, t) => {
1272
+ let r = hi(e, t);
1273
+ if (r === void 0)
1274
+ return {};
1275
+ let { name: n, description: i, supported: s, action: a, forced: c, standard: u } = r;
1276
+ return {
1277
+ [e]: {
1278
+ name: n,
1279
+ number: e,
1280
+ description: i,
1281
+ supported: s,
1282
+ action: a,
1283
+ forced: c,
1284
+ standard: u
1285
+ }
1286
+ };
1287
+ }, "getSignalByNumber"), hi = /* @__PURE__ */ o((e, t) => {
1288
+ let r = t.find(({ name: n }) => li.signals[n] === e);
1289
+ return r !== void 0 ? r : t.find((n) => n.number === e);
1290
+ }, "findSignalByNumber"), ou = di();
1291
+
1292
+ // node_modules/execa/lib/error.js
1293
+ var bi = /* @__PURE__ */ o(({ timedOut: e, timeout: t, errorCode: r, signal: n, signalDescription: i, exitCode: s, isCanceled: a }) => e ? `\
1294
+ timed out after ${t} milliseconds` : a ? "was canceled" : r !== void 0 ? `failed with ${r}` : n !== void 0 ? `was killed with ${n} (${i})` :
1295
+ s !== void 0 ? `failed with exit code ${s}` : "failed", "getErrorPrefix"), M = /* @__PURE__ */ o(({
1296
+ stdout: e,
1297
+ stderr: t,
1298
+ all: r,
1299
+ error: n,
1300
+ signal: i,
1301
+ exitCode: s,
1302
+ command: a,
1303
+ escapedCommand: c,
1304
+ timedOut: u,
1305
+ isCanceled: f,
1306
+ killed: l,
1307
+ parsed: { options: { timeout: d, cwd: h = gi.cwd() } }
1308
+ }) => {
1309
+ s = s === null ? void 0 : s, i = i === null ? void 0 : i;
1310
+ let y = i === void 0 ? void 0 : Nr[i].description, g = n && n.code, b = `Command ${bi({ timedOut: u, timeout: d, errorCode: g, signal: i, signalDescription: y,
1311
+ exitCode: s, isCanceled: f })}: ${a}`, C = Object.prototype.toString.call(n) === "[object Error]", k = C ? `${b}
1312
+ ${n.message}` : b, I = [k, t, e].filter(Boolean).join(`
1313
+ `);
1314
+ return C ? (n.originalMessage = n.message, n.message = I) : n = new Error(I), n.shortMessage = k, n.command = a, n.escapedCommand = c, n.exitCode =
1315
+ s, n.signal = i, n.signalDescription = y, n.stdout = e, n.stderr = t, n.cwd = h, r !== void 0 && (n.all = r), "bufferedData" in n && delete n.
1316
+ bufferedData, n.failed = !0, n.timedOut = !!u, n.isCanceled = f, n.killed = l && !u, n;
1317
+ }, "makeError");
1318
+
1319
+ // node_modules/execa/lib/stdio.js
1320
+ var te = ["stdin", "stdout", "stderr"], xi = /* @__PURE__ */ o((e) => te.some((t) => e[t] !== void 0), "hasAlias"), Dr = /* @__PURE__ */ o((e) => {
1321
+ if (!e)
1322
+ return;
1323
+ let { stdio: t } = e;
1324
+ if (t === void 0)
1325
+ return te.map((n) => e[n]);
1326
+ if (xi(e))
1327
+ throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${te.map((n) => `\`${n}\``).join(", ")}`);
1328
+ if (typeof t == "string")
1329
+ return t;
1330
+ if (!Array.isArray(t))
1331
+ throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);
1332
+ let r = Math.max(t.length, te.length);
1333
+ return Array.from({ length: r }, (n, i) => t[i]);
1334
+ }, "normalizeStdio");
1335
+
1336
+ // node_modules/execa/lib/kill.js
1337
+ import ki from "node:os";
1338
+
1339
+ // node_modules/signal-exit/dist/mjs/signals.js
1340
+ var v = [];
1341
+ v.push("SIGHUP", "SIGINT", "SIGTERM");
1342
+ process.platform !== "win32" && v.push(
1343
+ "SIGALRM",
1344
+ "SIGABRT",
1345
+ "SIGVTALRM",
1346
+ "SIGXCPU",
1347
+ "SIGXFSZ",
1348
+ "SIGUSR2",
1349
+ "SIGTRAP",
1350
+ "SIGSYS",
1351
+ "SIGQUIT",
1352
+ "SIGIOT"
1353
+ // should detect profiler and enable/disable accordingly.
1354
+ // see #21
1355
+ // 'SIGPROF'
1356
+ );
1357
+ process.platform === "linux" && v.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
1358
+
1359
+ // node_modules/signal-exit/dist/mjs/index.js
1360
+ var re = /* @__PURE__ */ o((e) => !!e && typeof e == "object" && typeof e.removeListener == "function" && typeof e.emit == "function" && typeof e.
1361
+ reallyExit == "function" && typeof e.listeners == "function" && typeof e.kill == "function" && typeof e.pid == "number" && typeof e.on == "f\
1362
+ unction", "processOk"), $e = Symbol.for("signal-exit emitter"), We = globalThis, wi = Object.defineProperty.bind(Object), He = class {
1363
+ static {
1364
+ o(this, "Emitter");
1365
+ }
1366
+ emitted = {
1367
+ afterExit: !1,
1368
+ exit: !1
1369
+ };
1370
+ listeners = {
1371
+ afterExit: [],
1372
+ exit: []
1373
+ };
1374
+ count = 0;
1375
+ id = Math.random();
1376
+ constructor() {
1377
+ if (We[$e])
1378
+ return We[$e];
1379
+ wi(We, $e, {
1380
+ value: this,
1381
+ writable: !1,
1382
+ enumerable: !1,
1383
+ configurable: !1
1384
+ });
1385
+ }
1386
+ on(t, r) {
1387
+ this.listeners[t].push(r);
1388
+ }
1389
+ removeListener(t, r) {
1390
+ let n = this.listeners[t], i = n.indexOf(r);
1391
+ i !== -1 && (i === 0 && n.length === 1 ? n.length = 0 : n.splice(i, 1));
1392
+ }
1393
+ emit(t, r, n) {
1394
+ if (this.emitted[t])
1395
+ return !1;
1396
+ this.emitted[t] = !0;
1397
+ let i = !1;
1398
+ for (let s of this.listeners[t])
1399
+ i = s(r, n) === !0 || i;
1400
+ return t === "exit" && (i = this.emit("afterExit", r, n) || i), i;
1401
+ }
1402
+ }, ne = class {
1403
+ static {
1404
+ o(this, "SignalExitBase");
1405
+ }
1406
+ }, Si = /* @__PURE__ */ o((e) => ({
1407
+ onExit(t, r) {
1408
+ return e.onExit(t, r);
1409
+ },
1410
+ load() {
1411
+ return e.load();
1412
+ },
1413
+ unload() {
1414
+ return e.unload();
1415
+ }
1416
+ }), "signalExitWrap"), Je = class extends ne {
1417
+ static {
1418
+ o(this, "SignalExitFallback");
1419
+ }
1420
+ onExit() {
1421
+ return () => {
1422
+ };
1423
+ }
1424
+ load() {
1425
+ }
1426
+ unload() {
1427
+ }
1428
+ }, Ve = class extends ne {
1429
+ static {
1430
+ o(this, "SignalExit");
1431
+ }
1432
+ // "SIGHUP" throws an `ENOSYS` error on Windows,
1433
+ // so use a supported signal instead
1434
+ /* c8 ignore start */
1435
+ #s = qe.platform === "win32" ? "SIGINT" : "SIGHUP";
1436
+ /* c8 ignore stop */
1437
+ #t = new He();
1438
+ #e;
1439
+ #o;
1440
+ #i;
1441
+ #n = {};
1442
+ #r = !1;
1443
+ constructor(t) {
1444
+ super(), this.#e = t, this.#n = {};
1445
+ for (let r of v)
1446
+ this.#n[r] = () => {
1447
+ let n = this.#e.listeners(r), { count: i } = this.#t, s = t;
1448
+ if (typeof s.__signal_exit_emitter__ == "object" && typeof s.__signal_exit_emitter__.count == "number" && (i += s.__signal_exit_emitter__.
1449
+ count), n.length === i) {
1450
+ this.unload();
1451
+ let a = this.#t.emit("exit", null, r), c = r === "SIGHUP" ? this.#s : r;
1452
+ a || t.kill(t.pid, c);
1453
+ }
1454
+ };
1455
+ this.#i = t.reallyExit, this.#o = t.emit;
1456
+ }
1457
+ onExit(t, r) {
1458
+ if (!re(this.#e))
1459
+ return () => {
1460
+ };
1461
+ this.#r === !1 && this.load();
1462
+ let n = r?.alwaysLast ? "afterExit" : "exit";
1463
+ return this.#t.on(n, t), () => {
1464
+ this.#t.removeListener(n, t), this.#t.listeners.exit.length === 0 && this.#t.listeners.afterExit.length === 0 && this.unload();
1465
+ };
1466
+ }
1467
+ load() {
1468
+ if (!this.#r) {
1469
+ this.#r = !0, this.#t.count += 1;
1470
+ for (let t of v)
1471
+ try {
1472
+ let r = this.#n[t];
1473
+ r && this.#e.on(t, r);
1474
+ } catch {
1475
+ }
1476
+ this.#e.emit = (t, ...r) => this.#c(t, ...r), this.#e.reallyExit = (t) => this.#a(t);
1477
+ }
1478
+ }
1479
+ unload() {
1480
+ this.#r && (this.#r = !1, v.forEach((t) => {
1481
+ let r = this.#n[t];
1482
+ if (!r)
1483
+ throw new Error("Listener not defined for signal: " + t);
1484
+ try {
1485
+ this.#e.removeListener(t, r);
1486
+ } catch {
1487
+ }
1488
+ }), this.#e.emit = this.#o, this.#e.reallyExit = this.#i, this.#t.count -= 1);
1489
+ }
1490
+ #a(t) {
1491
+ return re(this.#e) ? (this.#e.exitCode = t || 0, this.#t.emit("exit", this.#e.exitCode, null), this.#i.call(this.#e, this.#e.exitCode)) :
1492
+ 0;
1493
+ }
1494
+ #c(t, ...r) {
1495
+ let n = this.#o;
1496
+ if (t === "exit" && re(this.#e)) {
1497
+ typeof r[0] == "number" && (this.#e.exitCode = r[0]);
1498
+ let i = n.call(this.#e, t, ...r);
1499
+ return this.#t.emit("exit", this.#e.exitCode, null), i;
1500
+ } else
1501
+ return n.call(this.#e, t, ...r);
1502
+ }
1503
+ }, qe = globalThis.process, {
1504
+ /**
1505
+ * Called when the process is exiting, whether via signal, explicit
1506
+ * exit, or running out of stuff to do.
1507
+ *
1508
+ * If the global process object is not suitable for instrumentation,
1509
+ * then this will be a no-op.
1510
+ *
1511
+ * Returns a function that may be used to unload signal-exit.
1512
+ */
1513
+ onExit: _r,
1514
+ /**
1515
+ * Load the listeners. Likely you never need to call this, unless
1516
+ * doing a rather deep integration with signal-exit functionality.
1517
+ * Mostly exposed for the benefit of testing.
1518
+ *
1519
+ * @internal
1520
+ */
1521
+ load: yu,
1522
+ /**
1523
+ * Unload the listeners. Likely you never need to call this, unless
1524
+ * doing a rather deep integration with signal-exit functionality.
1525
+ * Mostly exposed for the benefit of testing.
1526
+ *
1527
+ * @internal
1528
+ */
1529
+ unload: hu
1530
+ } = Si(re(qe) ? new Ve(qe) : new Je());
1531
+
1532
+ // node_modules/execa/lib/kill.js
1533
+ var Ei = 1e3 * 5, Mr = /* @__PURE__ */ o((e, t = "SIGTERM", r = {}) => {
1534
+ let n = e(t);
1535
+ return Pi(e, t, r, n), n;
1536
+ }, "spawnedKill"), Pi = /* @__PURE__ */ o((e, t, r, n) => {
1537
+ if (!vi(t, r, n))
1538
+ return;
1539
+ let i = Ci(r), s = setTimeout(() => {
1540
+ e("SIGKILL");
1541
+ }, i);
1542
+ s.unref && s.unref();
1543
+ }, "setKillTimeout"), vi = /* @__PURE__ */ o((e, { forceKillAfterTimeout: t }, r) => Ti(e) && t !== !1 && r, "shouldForceKill"), Ti = /* @__PURE__ */ o(
1544
+ (e) => e === ki.constants.signals.SIGTERM || typeof e == "string" && e.toUpperCase() === "SIGTERM", "isSigterm"), Ci = /* @__PURE__ */ o(({ forceKillAfterTimeout: e = !0 }) => {
1545
+ if (e === !0)
1546
+ return Ei;
1547
+ if (!Number.isFinite(e) || e < 0)
1548
+ throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);
1549
+ return e;
1550
+ }, "getForceKillAfterTimeout"), Lr = /* @__PURE__ */ o((e, t) => {
1551
+ e.kill() && (t.isCanceled = !0);
1552
+ }, "spawnedCancel"), Ii = /* @__PURE__ */ o((e, t, r) => {
1553
+ e.kill(t), r(Object.assign(new Error("Timed out"), { timedOut: !0, signal: t }));
1554
+ }, "timeoutKill"), Fr = /* @__PURE__ */ o((e, { timeout: t, killSignal: r = "SIGTERM" }, n) => {
1555
+ if (t === 0 || t === void 0)
1556
+ return n;
1557
+ let i, s = new Promise((c, u) => {
1558
+ i = setTimeout(() => {
1559
+ Ii(e, r, u);
1560
+ }, t);
1561
+ }), a = n.finally(() => {
1562
+ clearTimeout(i);
1563
+ });
1564
+ return Promise.race([s, a]);
1565
+ }, "setupTimeout"), Br = /* @__PURE__ */ o(({ timeout: e }) => {
1566
+ if (e !== void 0 && (!Number.isFinite(e) || e < 0))
1567
+ throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);
1568
+ }, "validateTimeout"), Gr = /* @__PURE__ */ o(async (e, { cleanup: t, detached: r }, n) => {
1569
+ if (!t || r)
1570
+ return n;
1571
+ let i = _r(() => {
1572
+ e.kill();
1573
+ });
1574
+ return n.finally(() => {
1575
+ i();
1576
+ });
1577
+ }, "setExitHandler");
1578
+
1579
+ // node_modules/execa/lib/pipe.js
1580
+ import { createWriteStream as Ai } from "node:fs";
1581
+ import { ChildProcess as Oi } from "node:child_process";
1582
+
1583
+ // node_modules/is-stream/index.js
1584
+ function oe(e) {
1585
+ return e !== null && typeof e == "object" && typeof e.pipe == "function";
1586
+ }
1587
+ o(oe, "isStream");
1588
+ function ze(e) {
1589
+ return oe(e) && e.writable !== !1 && typeof e._write == "function" && typeof e._writableState == "object";
1590
+ }
1591
+ o(ze, "isWritableStream");
1592
+
1593
+ // node_modules/execa/lib/pipe.js
1594
+ var ji = /* @__PURE__ */ o((e) => e instanceof Oi && typeof e.then == "function", "isExecaChildProcess"), Ye = /* @__PURE__ */ o((e, t, r) => {
1595
+ if (typeof r == "string")
1596
+ return e[t].pipe(Ai(r)), e;
1597
+ if (ze(r))
1598
+ return e[t].pipe(r), e;
1599
+ if (!ji(r))
1600
+ throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
1601
+ if (!ze(r.stdin))
1602
+ throw new TypeError("The target child process's stdin must be available.");
1603
+ return e[t].pipe(r.stdin), r;
1604
+ }, "pipeToTarget"), Ur = /* @__PURE__ */ o((e) => {
1605
+ e.stdout !== null && (e.pipeStdout = Ye.bind(void 0, e, "stdout")), e.stderr !== null && (e.pipeStderr = Ye.bind(void 0, e, "stderr")), e.
1606
+ all !== void 0 && (e.pipeAll = Ye.bind(void 0, e, "all"));
1607
+ }, "addPipeMethods");
1608
+
1609
+ // node_modules/execa/lib/stream.js
1610
+ import { createReadStream as Ki, readFileSync as Xi } from "node:fs";
1611
+ import { setTimeout as Qi } from "node:timers/promises";
1612
+
1613
+ // node_modules/get-stream/source/contents.js
1614
+ var L = /* @__PURE__ */ o(async (e, { init: t, convertChunk: r, getSize: n, truncateChunk: i, addChunk: s, getFinalChunk: a, finalize: c }, {
1615
+ maxBuffer: u = Number.POSITIVE_INFINITY } = {}) => {
1616
+ if (!Ni(e))
1617
+ throw new Error("The first argument must be a Readable, a ReadableStream, or an async iterable.");
1618
+ let f = t();
1619
+ f.length = 0;
1620
+ try {
1621
+ for await (let l of e) {
1622
+ let d = Di(l), h = r[d](l, f);
1623
+ Hr({ convertedChunk: h, state: f, getSize: n, truncateChunk: i, addChunk: s, maxBuffer: u });
1624
+ }
1625
+ return Ri({ state: f, convertChunk: r, getSize: n, truncateChunk: i, addChunk: s, getFinalChunk: a, maxBuffer: u }), c(f);
1626
+ } catch (l) {
1627
+ throw l.bufferedData = c(f), l;
1628
+ }
1629
+ }, "getStreamContents"), Ri = /* @__PURE__ */ o(({ state: e, getSize: t, truncateChunk: r, addChunk: n, getFinalChunk: i, maxBuffer: s }) => {
1630
+ let a = i(e);
1631
+ a !== void 0 && Hr({ convertedChunk: a, state: e, getSize: t, truncateChunk: r, addChunk: n, maxBuffer: s });
1632
+ }, "appendFinalChunk"), Hr = /* @__PURE__ */ o(({ convertedChunk: e, state: t, getSize: r, truncateChunk: n, addChunk: i, maxBuffer: s }) => {
1633
+ let a = r(e), c = t.length + a;
1634
+ if (c <= s) {
1635
+ $r(e, t, i, c);
1636
+ return;
1637
+ }
1638
+ let u = n(e, s - t.length);
1639
+ throw u !== void 0 && $r(u, t, i, s), new ie();
1640
+ }, "appendChunk"), $r = /* @__PURE__ */ o((e, t, r, n) => {
1641
+ t.contents = r(e, t, n), t.length = n;
1642
+ }, "addNewChunk"), Ni = /* @__PURE__ */ o((e) => typeof e == "object" && e !== null && typeof e[Symbol.asyncIterator] == "function", "isAsyn\
1643
+ cIterable"), Di = /* @__PURE__ */ o((e) => {
1644
+ let t = typeof e;
1645
+ if (t === "string")
1646
+ return "string";
1647
+ if (t !== "object" || e === null)
1648
+ return "others";
1649
+ if (globalThis.Buffer?.isBuffer(e))
1650
+ return "buffer";
1651
+ let r = Wr.call(e);
1652
+ return r === "[object ArrayBuffer]" ? "arrayBuffer" : r === "[object DataView]" ? "dataView" : Number.isInteger(e.byteLength) && Number.isInteger(
1653
+ e.byteOffset) && Wr.call(e.buffer) === "[object ArrayBuffer]" ? "typedArray" : "others";
1654
+ }, "getChunkType"), { toString: Wr } = Object.prototype, ie = class extends Error {
1655
+ static {
1656
+ o(this, "MaxBufferError");
1657
+ }
1658
+ name = "MaxBufferError";
1659
+ constructor() {
1660
+ super("maxBuffer exceeded");
1661
+ }
1662
+ };
1663
+
1664
+ // node_modules/get-stream/source/utils.js
1665
+ var Ke = /* @__PURE__ */ o((e) => e, "identity"), Xe = /* @__PURE__ */ o(() => {
1666
+ }, "noop"), Qe = /* @__PURE__ */ o(({ contents: e }) => e, "getContentsProp"), se = /* @__PURE__ */ o((e) => {
1667
+ throw new Error(`Streams in object mode are not supported: ${String(e)}`);
1668
+ }, "throwObjectStream"), ae = /* @__PURE__ */ o((e) => e.length, "getLengthProp");
1669
+
1670
+ // node_modules/get-stream/source/array-buffer.js
1671
+ async function Ze(e, t) {
1672
+ return L(e, Wi, t);
1673
+ }
1674
+ o(Ze, "getStreamAsArrayBuffer");
1675
+ var _i = /* @__PURE__ */ o(() => ({ contents: new ArrayBuffer(0) }), "initArrayBuffer"), Mi = /* @__PURE__ */ o((e) => Li.encode(e), "useTex\
1676
+ tEncoder"), Li = new TextEncoder(), Jr = /* @__PURE__ */ o((e) => new Uint8Array(e), "useUint8Array"), Vr = /* @__PURE__ */ o((e) => new Uint8Array(
1677
+ e.buffer, e.byteOffset, e.byteLength), "useUint8ArrayWithOffset"), Fi = /* @__PURE__ */ o((e, t) => e.slice(0, t), "truncateArrayBufferChunk"),
1678
+ Bi = /* @__PURE__ */ o((e, { contents: t, length: r }, n) => {
1679
+ let i = Yr() ? Ui(t, n) : Gi(t, n);
1680
+ return new Uint8Array(i).set(e, r), i;
1681
+ }, "addArrayBufferChunk"), Gi = /* @__PURE__ */ o((e, t) => {
1682
+ if (t <= e.byteLength)
1683
+ return e;
1684
+ let r = new ArrayBuffer(zr(t));
1685
+ return new Uint8Array(r).set(new Uint8Array(e), 0), r;
1686
+ }, "resizeArrayBufferSlow"), Ui = /* @__PURE__ */ o((e, t) => {
1687
+ if (t <= e.maxByteLength)
1688
+ return e.resize(t), e;
1689
+ let r = new ArrayBuffer(t, { maxByteLength: zr(t) });
1690
+ return new Uint8Array(r).set(new Uint8Array(e), 0), r;
1691
+ }, "resizeArrayBuffer"), zr = /* @__PURE__ */ o((e) => qr ** Math.ceil(Math.log(e) / Math.log(qr)), "getNewContentsLength"), qr = 2, $i = /* @__PURE__ */ o(
1692
+ ({ contents: e, length: t }) => Yr() ? e : e.slice(0, t), "finalizeArrayBuffer"), Yr = /* @__PURE__ */ o(() => "resize" in ArrayBuffer.prototype,
1693
+ "hasArrayBufferResize"), Wi = {
1694
+ init: _i,
1695
+ convertChunk: {
1696
+ string: Mi,
1697
+ buffer: Jr,
1698
+ arrayBuffer: Jr,
1699
+ dataView: Vr,
1700
+ typedArray: Vr,
1701
+ others: se
1702
+ },
1703
+ getSize: ae,
1704
+ truncateChunk: Fi,
1705
+ addChunk: Bi,
1706
+ getFinalChunk: Xe,
1707
+ finalize: $i
1708
+ };
1709
+
1710
+ // node_modules/get-stream/source/buffer.js
1711
+ async function ce(e, t) {
1712
+ if (!("Buffer" in globalThis))
1713
+ throw new Error("getStreamAsBuffer() is only supported in Node.js");
1714
+ try {
1715
+ return Kr(await Ze(e, t));
1716
+ } catch (r) {
1717
+ throw r.bufferedData !== void 0 && (r.bufferedData = Kr(r.bufferedData)), r;
1718
+ }
1719
+ }
1720
+ o(ce, "getStreamAsBuffer");
1721
+ var Kr = /* @__PURE__ */ o((e) => globalThis.Buffer.from(e), "arrayBufferToNodeBuffer");
1722
+
1723
+ // node_modules/get-stream/source/string.js
1724
+ async function et(e, t) {
1725
+ return L(e, zi, t);
1726
+ }
1727
+ o(et, "getStreamAsString");
1728
+ var Hi = /* @__PURE__ */ o(() => ({ contents: "", textDecoder: new TextDecoder() }), "initString"), ue = /* @__PURE__ */ o((e, { textDecoder: t }) => t.
1729
+ decode(e, { stream: !0 }), "useTextDecoder"), Ji = /* @__PURE__ */ o((e, { contents: t }) => t + e, "addStringChunk"), Vi = /* @__PURE__ */ o(
1730
+ (e, t) => e.slice(0, t), "truncateStringChunk"), qi = /* @__PURE__ */ o(({ textDecoder: e }) => {
1731
+ let t = e.decode();
1732
+ return t === "" ? void 0 : t;
1733
+ }, "getFinalStringChunk"), zi = {
1734
+ init: Hi,
1735
+ convertChunk: {
1736
+ string: Ke,
1737
+ buffer: ue,
1738
+ arrayBuffer: ue,
1739
+ dataView: ue,
1740
+ typedArray: ue,
1741
+ others: se
1742
+ },
1743
+ getSize: ae,
1744
+ truncateChunk: Vi,
1745
+ addChunk: Ji,
1746
+ getFinalChunk: qi,
1747
+ finalize: Qe
1748
+ };
1749
+
1750
+ // node_modules/execa/lib/stream.js
1751
+ var Zr = A(Qr(), 1);
1752
+ var en = /* @__PURE__ */ o((e) => {
1753
+ if (e !== void 0)
1754
+ throw new TypeError("The `input` and `inputFile` options cannot be both set.");
1755
+ }, "validateInputOptions"), Zi = /* @__PURE__ */ o(({ input: e, inputFile: t }) => typeof t != "string" ? e : (en(e), Xi(t)), "getInputSync"),
1756
+ tn = /* @__PURE__ */ o((e) => {
1757
+ let t = Zi(e);
1758
+ if (oe(t))
1759
+ throw new TypeError("The `input` option cannot be a stream in sync mode");
1760
+ return t;
1761
+ }, "handleInputSync"), es = /* @__PURE__ */ o(({ input: e, inputFile: t }) => typeof t != "string" ? e : (en(e), Ki(t)), "getInput"), rn = /* @__PURE__ */ o(
1762
+ (e, t) => {
1763
+ let r = es(t);
1764
+ r !== void 0 && (oe(r) ? r.pipe(e.stdin) : e.stdin.end(r));
1765
+ }, "handleInput"), nn = /* @__PURE__ */ o((e, { all: t }) => {
1766
+ if (!t || !e.stdout && !e.stderr)
1767
+ return;
1768
+ let r = (0, Zr.default)();
1769
+ return e.stdout && r.add(e.stdout), e.stderr && r.add(e.stderr), r;
1770
+ }, "makeAllStream"), tt = /* @__PURE__ */ o(async (e, t) => {
1771
+ if (!(!e || t === void 0)) {
1772
+ await Qi(0), e.destroy();
1773
+ try {
1774
+ return await t;
1775
+ } catch (r) {
1776
+ return r.bufferedData;
1777
+ }
1778
+ }
1779
+ }, "getBufferedData"), rt = /* @__PURE__ */ o((e, { encoding: t, buffer: r, maxBuffer: n }) => {
1780
+ if (!(!e || !r))
1781
+ return t === "utf8" || t === "utf-8" ? et(e, { maxBuffer: n }) : t === null || t === "buffer" ? ce(e, { maxBuffer: n }) : ts(e, n, t);
1782
+ }, "getStreamPromise"), ts = /* @__PURE__ */ o(async (e, t, r) => (await ce(e, { maxBuffer: t })).toString(r), "applyEncoding"), on = /* @__PURE__ */ o(
1783
+ async ({ stdout: e, stderr: t, all: r }, { encoding: n, buffer: i, maxBuffer: s }, a) => {
1784
+ let c = rt(e, { encoding: n, buffer: i, maxBuffer: s }), u = rt(t, { encoding: n, buffer: i, maxBuffer: s }), f = rt(r, { encoding: n, buffer: i,
1785
+ maxBuffer: s * 2 });
1786
+ try {
1787
+ return await Promise.all([a, c, u, f]);
1788
+ } catch (l) {
1789
+ return Promise.all([
1790
+ { error: l, signal: l.signal, timedOut: l.timedOut },
1791
+ tt(e, c),
1792
+ tt(t, u),
1793
+ tt(r, f)
1794
+ ]);
1795
+ }
1796
+ }, "getSpawnedResult");
1797
+
1798
+ // node_modules/execa/lib/promise.js
1799
+ var rs = (async () => {
1800
+ })().constructor.prototype, ns = ["then", "catch", "finally"].map((e) => [
1801
+ e,
1802
+ Reflect.getOwnPropertyDescriptor(rs, e)
1803
+ ]), nt = /* @__PURE__ */ o((e, t) => {
1804
+ for (let [r, n] of ns) {
1805
+ let i = typeof t == "function" ? (...s) => Reflect.apply(n.value, t(), s) : n.value.bind(t);
1806
+ Reflect.defineProperty(e, r, { ...n, value: i });
1807
+ }
1808
+ }, "mergePromise"), sn = /* @__PURE__ */ o((e) => new Promise((t, r) => {
1809
+ e.on("exit", (n, i) => {
1810
+ t({ exitCode: n, signal: i });
1811
+ }), e.on("error", (n) => {
1812
+ r(n);
1813
+ }), e.stdin && e.stdin.on("error", (n) => {
1814
+ r(n);
1815
+ });
1816
+ }), "getSpawnedPromise");
1817
+
1818
+ // node_modules/execa/lib/command.js
1819
+ import { Buffer as os } from "node:buffer";
1820
+ import { ChildProcess as is } from "node:child_process";
1821
+ var un = /* @__PURE__ */ o((e, t = []) => Array.isArray(t) ? [e, ...t] : [e], "normalizeArgs"), ss = /^[\w.-]+$/, as = /* @__PURE__ */ o((e) => typeof e !=
1822
+ "string" || ss.test(e) ? e : `"${e.replaceAll('"', '\\"')}"`, "escapeArg"), ot = /* @__PURE__ */ o((e, t) => un(e, t).join(" "), "joinComman\
1823
+ d"), it = /* @__PURE__ */ o((e, t) => un(e, t).map((r) => as(r)).join(" "), "getEscapedCommand"), fn = / +/g, ln = /* @__PURE__ */ o((e) => {
1824
+ let t = [];
1825
+ for (let r of e.trim().split(fn)) {
1826
+ let n = t.at(-1);
1827
+ n && n.endsWith("\\") ? t[t.length - 1] = `${n.slice(0, -1)} ${r}` : t.push(r);
1828
+ }
1829
+ return t;
1830
+ }, "parseCommand"), an = /* @__PURE__ */ o((e) => {
1831
+ let t = typeof e;
1832
+ if (t === "string")
1833
+ return e;
1834
+ if (t === "number")
1835
+ return String(e);
1836
+ if (t === "object" && e !== null && !(e instanceof is) && "stdout" in e) {
1837
+ let r = typeof e.stdout;
1838
+ if (r === "string")
1839
+ return e.stdout;
1840
+ if (os.isBuffer(e.stdout))
1841
+ return e.stdout.toString();
1842
+ throw new TypeError(`Unexpected "${r}" stdout in template expression`);
1843
+ }
1844
+ throw new TypeError(`Unexpected "${t}" in template expression`);
1845
+ }, "parseExpression"), cn = /* @__PURE__ */ o((e, t, r) => r || e.length === 0 || t.length === 0 ? [...e, ...t] : [
1846
+ ...e.slice(0, -1),
1847
+ `${e.at(-1)}${t[0]}`,
1848
+ ...t.slice(1)
1849
+ ], "concatTokens"), cs = /* @__PURE__ */ o(({ templates: e, expressions: t, tokens: r, index: n, template: i }) => {
1850
+ let s = i ?? e.raw[n], a = s.split(fn).filter(Boolean), c = cn(
1851
+ r,
1852
+ a,
1853
+ s.startsWith(" ")
1854
+ );
1855
+ if (n === t.length)
1856
+ return c;
1857
+ let u = t[n], f = Array.isArray(u) ? u.map((l) => an(l)) : [an(u)];
1858
+ return cn(
1859
+ c,
1860
+ f,
1861
+ s.endsWith(" ")
1862
+ );
1863
+ }, "parseTemplate"), st = /* @__PURE__ */ o((e, t) => {
1864
+ let r = [];
1865
+ for (let [n, i] of e.entries())
1866
+ r = cs({ templates: e, expressions: t, tokens: r, index: n, template: i });
1867
+ return r;
1868
+ }, "parseTemplates");
1869
+
1870
+ // node_modules/execa/lib/verbose.js
1871
+ import { debuglog as us } from "node:util";
1872
+ import fs from "node:process";
1873
+ var pn = us("execa").enabled, fe = /* @__PURE__ */ o((e, t) => String(e).padStart(t, "0"), "padField"), ls = /* @__PURE__ */ o(() => {
1874
+ let e = /* @__PURE__ */ new Date();
1875
+ return `${fe(e.getHours(), 2)}:${fe(e.getMinutes(), 2)}:${fe(e.getSeconds(), 2)}.${fe(e.getMilliseconds(), 3)}`;
1876
+ }, "getTimestamp"), at = /* @__PURE__ */ o((e, { verbose: t }) => {
1877
+ t && fs.stderr.write(`[${ls()}] ${e}
1878
+ `);
1879
+ }, "logCommand");
1880
+
1881
+ // node_modules/execa/index.js
1882
+ var ds = 1e3 * 1e3 * 100, ys = /* @__PURE__ */ o(({ env: e, extendEnv: t, preferLocal: r, localDir: n, execPath: i }) => {
1883
+ let s = t ? { ...le.env, ...e } : e;
1884
+ return r ? Cr({ env: s, cwd: n, execPath: i }) : s;
1885
+ }, "getEnv"), yn = /* @__PURE__ */ o((e, t, r = {}) => {
1886
+ let n = dn.default._parse(e, t, r);
1887
+ return e = n.command, t = n.args, r = n.options, r = {
1888
+ maxBuffer: ds,
1889
+ buffer: !0,
1890
+ stripFinalNewline: !0,
1891
+ extendEnv: !0,
1892
+ preferLocal: !1,
1893
+ localDir: r.cwd || le.cwd(),
1894
+ execPath: le.execPath,
1895
+ encoding: "utf8",
1896
+ reject: !0,
1897
+ cleanup: !0,
1898
+ all: !1,
1899
+ windowsHide: !0,
1900
+ verbose: pn,
1901
+ ...r
1902
+ }, r.env = ys(r), r.stdio = Dr(r), le.platform === "win32" && ms.basename(e, ".exe") === "cmd" && t.unshift("/q"), { file: e, args: t, options: r,
1903
+ parsed: n };
1904
+ }, "handleArguments"), F = /* @__PURE__ */ o((e, t, r) => typeof t != "string" && !ps.isBuffer(t) ? r === void 0 ? void 0 : "" : e.stripFinalNewline ?
1905
+ Fe(t) : t, "handleOutput");
1906
+ function hn(e, t, r) {
1907
+ let n = yn(e, t, r), i = ot(e, t), s = it(e, t);
1908
+ at(s, n.options), Br(n.options);
1909
+ let a;
1910
+ try {
1911
+ a = ct.spawn(n.file, n.args, n.options);
1912
+ } catch (y) {
1913
+ let g = new ct.ChildProcess(), m = Promise.reject(M({
1914
+ error: y,
1915
+ stdout: "",
1916
+ stderr: "",
1917
+ all: "",
1918
+ command: i,
1919
+ escapedCommand: s,
1920
+ parsed: n,
1921
+ timedOut: !1,
1922
+ isCanceled: !1,
1923
+ killed: !1
1924
+ }));
1925
+ return nt(g, m), g;
1926
+ }
1927
+ let c = sn(a), u = Fr(a, n.options, c), f = Gr(a, n.options, u), l = { isCanceled: !1 };
1928
+ a.kill = Mr.bind(null, a.kill.bind(a)), a.cancel = Lr.bind(null, a, l);
1929
+ let h = Ar(/* @__PURE__ */ o(async () => {
1930
+ let [{ error: y, exitCode: g, signal: m, timedOut: b }, C, k, I] = await on(a, n.options, f), W = F(n.options, C), H = F(n.options, k), p = F(
1931
+ n.options, I);
1932
+ if (y || g !== 0 || m !== null) {
1933
+ let w = M({
1934
+ error: y,
1935
+ exitCode: g,
1936
+ signal: m,
1937
+ stdout: W,
1938
+ stderr: H,
1939
+ all: p,
1940
+ command: i,
1941
+ escapedCommand: s,
1942
+ parsed: n,
1943
+ timedOut: b,
1944
+ isCanceled: l.isCanceled || (n.options.signal ? n.options.signal.aborted : !1),
1945
+ killed: a.killed
1946
+ });
1947
+ if (!n.options.reject)
1948
+ return w;
1949
+ throw w;
1950
+ }
1951
+ return {
1952
+ command: i,
1953
+ escapedCommand: s,
1954
+ exitCode: 0,
1955
+ stdout: W,
1956
+ stderr: H,
1957
+ all: p,
1958
+ failed: !1,
1959
+ timedOut: !1,
1960
+ isCanceled: !1,
1961
+ killed: !1
1962
+ };
1963
+ }, "handlePromise"));
1964
+ return rn(a, n.options), a.all = nn(a, n.options), Ur(a), nt(a, h), a;
1965
+ }
1966
+ o(hn, "execa");
1967
+ function hs(e, t, r) {
1968
+ let n = yn(e, t, r), i = ot(e, t), s = it(e, t);
1969
+ at(s, n.options);
1970
+ let a = tn(n.options), c;
1971
+ try {
1972
+ c = ct.spawnSync(n.file, n.args, { ...n.options, input: a });
1973
+ } catch (l) {
1974
+ throw M({
1975
+ error: l,
1976
+ stdout: "",
1977
+ stderr: "",
1978
+ all: "",
1979
+ command: i,
1980
+ escapedCommand: s,
1981
+ parsed: n,
1982
+ timedOut: !1,
1983
+ isCanceled: !1,
1984
+ killed: !1
1985
+ });
1986
+ }
1987
+ let u = F(n.options, c.stdout, c.error), f = F(n.options, c.stderr, c.error);
1988
+ if (c.error || c.status !== 0 || c.signal !== null) {
1989
+ let l = M({
1990
+ stdout: u,
1991
+ stderr: f,
1992
+ error: c.error,
1993
+ signal: c.signal,
1994
+ exitCode: c.status,
1995
+ command: i,
1996
+ escapedCommand: s,
1997
+ parsed: n,
1998
+ timedOut: c.error && c.error.code === "ETIMEDOUT",
1999
+ isCanceled: !1,
2000
+ killed: c.signal !== null
2001
+ });
2002
+ if (!n.options.reject)
2003
+ return l;
2004
+ throw l;
2005
+ }
2006
+ return {
2007
+ command: i,
2008
+ escapedCommand: s,
2009
+ exitCode: 0,
2010
+ stdout: u,
2011
+ stderr: f,
2012
+ failed: !1,
2013
+ timedOut: !1,
2014
+ isCanceled: !1,
2015
+ killed: !1
2016
+ };
2017
+ }
2018
+ o(hs, "execaSync");
2019
+ var gs = /* @__PURE__ */ o(({ input: e, inputFile: t, stdio: r }) => e === void 0 && t === void 0 && r === void 0 ? { stdin: "inherit" } : {},
2020
+ "normalizeScriptStdin"), mn = /* @__PURE__ */ o((e = {}) => ({
2021
+ preferLocal: !0,
2022
+ ...gs(e),
2023
+ ...e
2024
+ }), "normalizeScriptOptions");
2025
+ function gn(e) {
2026
+ function t(r, ...n) {
2027
+ if (!Array.isArray(r))
2028
+ return gn({ ...e, ...r });
2029
+ let [i, ...s] = st(r, n);
2030
+ return hn(i, s, mn(e));
2031
+ }
2032
+ return o(t, "$"), t.sync = (r, ...n) => {
2033
+ if (!Array.isArray(r))
2034
+ throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
2035
+ let [i, ...s] = st(r, n);
2036
+ return hs(i, s, mn(e));
2037
+ }, t;
2038
+ }
2039
+ o(gn, "create$");
2040
+ var Lf = gn();
2041
+ function bn(e, t) {
2042
+ let [r, ...n] = ln(e);
2043
+ return hn(r, n, t);
2044
+ }
2045
+ o(bn, "execaCommand");
2046
+
2047
+ // src/telemetry/exec-command-count-lines.ts
2048
+ async function pe(e, t) {
2049
+ let r = bn(e, { shell: !0, buffer: !1, ...t });
2050
+ if (!r.stdout)
2051
+ throw new Error("Unexpected missing stdout");
2052
+ let n = 0, i = bs(r.stdout);
2053
+ return i.on("line", () => {
2054
+ n += 1;
2055
+ }), await r, i.close(), n;
2056
+ }
2057
+ o(pe, "execCommandCountLines");
2058
+
2059
+ // ../node_modules/slash/index.js
2060
+ function ut(e) {
2061
+ return e.startsWith("\\\\?\\") ? e : e.replace(/\\/g, "/");
2062
+ }
2063
+ o(ut, "slash");
2064
+
2065
+ // src/common/utils/file-cache.ts
2066
+ import { createHash as xn, randomBytes as xs } from "node:crypto";
2067
+ import { mkdirSync as ft, readFileSync as ws, readdirSync as Ss, rmSync as wn, writeFileSync as ks } from "node:fs";
2068
+ import { readFile as Sn, readdir as kn, rm as En, writeFile as Es } from "node:fs/promises";
2069
+ import { tmpdir as Ps } from "node:os";
2070
+ import { join as B } from "node:path";
2071
+ var me = class {
2072
+ static {
2073
+ o(this, "FileSystemCache");
2074
+ }
2075
+ constructor(t = {}) {
2076
+ this.prefix = (t.ns || t.prefix || "") + "-", this.hash_alg = t.hash_alg || "md5", this.cache_dir = t.basePath || B(Ps(), xs(15).toString(
2077
+ "base64").replace(/\//g, "-")), this.ttl = t.ttl || 0, xn(this.hash_alg), ft(this.cache_dir, { recursive: !0 });
2078
+ }
2079
+ generateHash(t) {
2080
+ return B(this.cache_dir, this.prefix + xn(this.hash_alg).update(t).digest("hex"));
2081
+ }
2082
+ isExpired(t, r) {
2083
+ return t.ttl != null && r > t.ttl;
2084
+ }
2085
+ parseCacheData(t, r) {
2086
+ let n = JSON.parse(t);
2087
+ return this.isExpired(n, Date.now()) ? r : n.content;
2088
+ }
2089
+ parseSetData(t, r, n = {}) {
2090
+ let i = n.ttl ?? this.ttl;
2091
+ return JSON.stringify({ key: t, content: r, ...i && { ttl: Date.now() + i * 1e3 } });
2092
+ }
2093
+ async get(t, r) {
2094
+ try {
2095
+ let n = await Sn(this.generateHash(t), "utf8");
2096
+ return this.parseCacheData(n, r);
2097
+ } catch {
2098
+ return r;
2099
+ }
2100
+ }
2101
+ getSync(t, r) {
2102
+ try {
2103
+ let n = ws(this.generateHash(t), "utf8");
2104
+ return this.parseCacheData(n, r);
2105
+ } catch {
2106
+ return r;
2107
+ }
2108
+ }
2109
+ async set(t, r, n = {}) {
2110
+ let i = typeof n == "number" ? { ttl: n } : n;
2111
+ ft(this.cache_dir, { recursive: !0 }), await Es(this.generateHash(t), this.parseSetData(t, r, i), {
2112
+ encoding: i.encoding || "utf8"
2113
+ });
2114
+ }
2115
+ setSync(t, r, n = {}) {
2116
+ let i = typeof n == "number" ? { ttl: n } : n;
2117
+ ft(this.cache_dir, { recursive: !0 }), ks(this.generateHash(t), this.parseSetData(t, r, i), {
2118
+ encoding: i.encoding || "utf8"
2119
+ });
2120
+ }
2121
+ async setMany(t, r) {
2122
+ await Promise.all(t.map((n) => this.set(n.key, n.content ?? n.value, r)));
2123
+ }
2124
+ setManySync(t, r) {
2125
+ t.forEach((n) => this.setSync(n.key, n.content ?? n.value, r));
2126
+ }
2127
+ async remove(t) {
2128
+ await En(this.generateHash(t), { force: !0 });
2129
+ }
2130
+ removeSync(t) {
2131
+ wn(this.generateHash(t), { force: !0 });
2132
+ }
2133
+ async clear() {
2134
+ let t = await kn(this.cache_dir);
2135
+ await Promise.all(
2136
+ t.filter((r) => r.startsWith(this.prefix)).map((r) => En(B(this.cache_dir, r), { force: !0 }))
2137
+ );
2138
+ }
2139
+ clearSync() {
2140
+ Ss(this.cache_dir).filter((t) => t.startsWith(this.prefix)).forEach((t) => wn(B(this.cache_dir, t), { force: !0 }));
2141
+ }
2142
+ async getAll() {
2143
+ let t = Date.now(), r = await kn(this.cache_dir);
2144
+ return (await Promise.all(
2145
+ r.filter((i) => i.startsWith(this.prefix)).map((i) => Sn(B(this.cache_dir, i), "utf8"))
2146
+ )).map((i) => JSON.parse(i)).filter((i) => i.content && !this.isExpired(i, t));
2147
+ }
2148
+ async load() {
2149
+ return {
2150
+ files: (await this.getAll()).map((r) => ({
2151
+ path: this.generateHash(r.key),
2152
+ value: r.content,
2153
+ key: r.key
2154
+ }))
2155
+ };
2156
+ }
2157
+ };
2158
+ function lt(e) {
2159
+ return new me(e);
2160
+ }
2161
+ o(lt, "createFileSystemCache");
2162
+
2163
+ // src/common/utils/resolve-path-in-sb-cache.ts
2164
+ import { join as Nn } from "node:path";
2165
+
2166
+ // ../node_modules/find-cache-dir/index.js
2167
+ var Rn = A(vn(), 1);
2168
+ import Fs from "node:process";
2169
+ import G from "node:path";
2170
+ import ye from "node:fs";
2171
+
2172
+ // ../node_modules/pkg-dir/index.js
2173
+ import Ls from "node:path";
2174
+
2175
+ // ../node_modules/pkg-dir/node_modules/find-up/index.js
2176
+ import de from "node:path";
2177
+ import { fileURLToPath as Ns } from "node:url";
2178
+
2179
+ // ../node_modules/locate-path/index.js
2180
+ import Cs from "node:process";
2181
+ import Is from "node:path";
2182
+ import Tn, { promises as ll } from "node:fs";
2183
+ import { fileURLToPath as As } from "node:url";
2184
+ var Cn = {
2185
+ directory: "isDirectory",
2186
+ file: "isFile"
2187
+ };
2188
+ function Os(e) {
2189
+ if (!Object.hasOwnProperty.call(Cn, e))
2190
+ throw new Error(`Invalid type specified: ${e}`);
2191
+ }
2192
+ o(Os, "checkType");
2193
+ var js = /* @__PURE__ */ o((e, t) => t[Cn[e]](), "matchType"), Rs = /* @__PURE__ */ o((e) => e instanceof URL ? As(e) : e, "toPath");
2194
+ function pt(e, {
2195
+ cwd: t = Cs.cwd(),
2196
+ type: r = "file",
2197
+ allowSymlinks: n = !0
2198
+ } = {}) {
2199
+ Os(r), t = Rs(t);
2200
+ let i = n ? Tn.statSync : Tn.lstatSync;
2201
+ for (let s of e)
2202
+ try {
2203
+ let a = i(Is.resolve(t, s), {
2204
+ throwIfNoEntry: !1
2205
+ });
2206
+ if (!a)
2207
+ continue;
2208
+ if (js(r, a))
2209
+ return s;
2210
+ } catch {
2211
+ }
2212
+ }
2213
+ o(pt, "locatePathSync");
2214
+
2215
+ // ../node_modules/pkg-dir/node_modules/path-exists/index.js
2216
+ import gl, { promises as bl } from "node:fs";
2217
+
2218
+ // ../node_modules/pkg-dir/node_modules/find-up/index.js
2219
+ var Ds = /* @__PURE__ */ o((e) => e instanceof URL ? Ns(e) : e, "toPath"), _s = Symbol("findUpStop");
2220
+ function Ms(e, t = {}) {
2221
+ let r = de.resolve(Ds(t.cwd) || ""), { root: n } = de.parse(r), i = t.stopAt || n, s = t.limit || Number.POSITIVE_INFINITY, a = [e].flat(),
2222
+ c = /* @__PURE__ */ o((f) => {
2223
+ if (typeof e != "function")
2224
+ return pt(a, f);
2225
+ let l = e(f.cwd);
2226
+ return typeof l == "string" ? pt([l], f) : l;
2227
+ }, "runMatcher"), u = [];
2228
+ for (; ; ) {
2229
+ let f = c({ ...t, cwd: r });
2230
+ if (f === _s || (f && u.push(de.resolve(r, f)), r === i || u.length >= s))
2231
+ break;
2232
+ r = de.dirname(r);
2233
+ }
2234
+ return u;
2235
+ }
2236
+ o(Ms, "findUpMultipleSync");
2237
+ function In(e, t = {}) {
2238
+ return Ms(e, { ...t, limit: 1 })[0];
2239
+ }
2240
+ o(In, "findUpSync");
2241
+
2242
+ // ../node_modules/pkg-dir/index.js
2243
+ function An({ cwd: e } = {}) {
2244
+ let t = In("package.json", { cwd: e });
2245
+ return t && Ls.dirname(t);
2246
+ }
2247
+ o(An, "packageDirectorySync");
2248
+
2249
+ // ../node_modules/find-cache-dir/index.js
2250
+ var { env: mt, cwd: Bs } = Fs, On = /* @__PURE__ */ o((e) => {
2251
+ try {
2252
+ return ye.accessSync(e, ye.constants.W_OK), !0;
2253
+ } catch {
2254
+ return !1;
2255
+ }
2256
+ }, "isWritable");
2257
+ function jn(e, t) {
2258
+ return t.create && ye.mkdirSync(e, { recursive: !0 }), e;
2259
+ }
2260
+ o(jn, "useDirectory");
2261
+ function Gs(e) {
2262
+ let t = G.join(e, "node_modules");
2263
+ if (!(!On(t) && (ye.existsSync(t) || !On(G.join(e)))))
2264
+ return t;
2265
+ }
2266
+ o(Gs, "getNodeModuleDirectory");
2267
+ function dt(e = {}) {
2268
+ if (mt.CACHE_DIR && !["true", "false", "1", "0"].includes(mt.CACHE_DIR))
2269
+ return jn(G.join(mt.CACHE_DIR, e.name), e);
2270
+ let { cwd: t = Bs(), files: r } = e;
2271
+ if (r) {
2272
+ if (!Array.isArray(r))
2273
+ throw new TypeError(`Expected \`files\` option to be an array, got \`${typeof r}\`.`);
2274
+ t = (0, Rn.default)(r.map((i) => G.resolve(t, i)));
2275
+ }
2276
+ if (t = An({ cwd: t }), !(!t || !Gs(t)))
2277
+ return jn(G.join(t, "node_modules", ".cache", e.name), e);
2278
+ }
2279
+ o(dt, "findCacheDirectory");
2280
+
2281
+ // src/common/utils/resolve-path-in-sb-cache.ts
2282
+ function Dn(e, t = "default") {
2283
+ let r = dt({ name: "storybook" });
2284
+ return r ||= Nn(process.cwd(), "node_modules", ".cache", "storybook"), Nn(r, t, e);
2285
+ }
2286
+ o(Dn, "resolvePathInStorybookCache");
2287
+
2288
+ // src/telemetry/run-telemetry-operation.ts
2289
+ var _n = lt({
2290
+ basePath: Dn("telemetry"),
2291
+ ns: "storybook",
2292
+ ttl: 24 * 60 * 60 * 1e3
2293
+ // 24h
2294
+ }), he = /* @__PURE__ */ o(async (e, t) => {
2295
+ let r = await _n.get(e);
2296
+ return r === void 0 && (r = await t(), r !== void 0 && await _n.set(e, r)), r;
2297
+ }, "runTelemetryOperation");
2298
+
2299
+ // src/telemetry/get-application-file-count.ts
2300
+ var $s = ["page", "screen"], Ws = ["js", "jsx", "ts", "tsx"], Hs = /* @__PURE__ */ o(async (e) => {
2301
+ let r = $s.flatMap((n) => [
2302
+ n,
2303
+ [n[0].toUpperCase(), ...n.slice(1)].join("")
2304
+ ]).flatMap(
2305
+ (n) => Ws.map((i) => `"${e}${Us}*${n}*.${i}"`)
2306
+ );
2307
+ try {
2308
+ let n = `git ls-files -- ${r.join(" ")}`;
2309
+ return await pe(n);
2310
+ } catch {
2311
+ return;
2312
+ }
2313
+ }, "getApplicationFilesCountUncached"), Mn = /* @__PURE__ */ o(async (e) => he(
2314
+ "applicationFiles",
2315
+ async () => Hs(e)
2316
+ ), "getApplicationFileCount");
2317
+
2318
+ // src/telemetry/get-chromatic-version.ts
2319
+ function Ln(e) {
2320
+ let t = e.dependencies?.chromatic || e.devDependencies?.chromatic || e.peerDependencies?.chromatic;
2321
+ return t || (e.scripts && Object.values(e.scripts).find((r) => r?.match(/chromatic/)) ? "latest" : void 0);
2322
+ }
2323
+ o(Ln, "getChromaticVersionSpecifier");
2324
+
2325
+ // src/telemetry/get-framework-info.ts
2326
+ import { normalize as qs } from "node:path";
2327
+ import { frameworkPackages as zs } from "storybook/internal/common";
2328
+
2329
+ // src/telemetry/package-json.ts
2330
+ import { readFile as Js } from "node:fs/promises";
2331
+ import { join as Vs } from "node:path";
2332
+ var yt = /* @__PURE__ */ o(async (e) => {
2333
+ let t = Object.keys(e);
2334
+ return Promise.all(t.map(ge));
2335
+ }, "getActualPackageVersions"), ge = /* @__PURE__ */ o(async (e) => {
2336
+ try {
2337
+ let t = await ht(e);
2338
+ return {
2339
+ name: e,
2340
+ version: t.version
2341
+ };
2342
+ } catch {
2343
+ return { name: e, version: null };
2344
+ }
2345
+ }, "getActualPackageVersion"), ht = /* @__PURE__ */ o(async (e) => {
2346
+ let t = S.resolve(Vs(e, "package.json"), {
2347
+ paths: [process.cwd()]
2348
+ });
2349
+ return JSON.parse(await Js(t, { encoding: "utf8" }));
2350
+ }, "getActualPackageJson");
2351
+
2352
+ // src/telemetry/get-framework-info.ts
2353
+ var Ys = [
2354
+ "html",
2355
+ "react",
2356
+ "svelte",
2357
+ "vue3",
2358
+ "preact",
2359
+ "server",
2360
+ "vue",
2361
+ "web-components",
2362
+ "angular",
2363
+ "ember"
2364
+ ], Ks = ["builder-webpack5", "builder-vite"];
2365
+ function Fn(e, t) {
2366
+ let { name: r = "", version: n, dependencies: i, devDependencies: s, peerDependencies: a } = e, c = {
2367
+ // We include the framework itself because it may be a renderer too (e.g. angular)
2368
+ [r]: n,
2369
+ ...i,
2370
+ ...s,
2371
+ ...a
2372
+ };
2373
+ return t.map((u) => `@storybook/${u}`).find((u) => c[u]);
2374
+ }
2375
+ o(Fn, "findMatchingPackage");
2376
+ var Xs = /* @__PURE__ */ o((e) => {
2377
+ let t = qs(e).replace(new RegExp(/\\/, "g"), "/");
2378
+ return Object.keys(zs).find((n) => t.endsWith(n)) || D(e).replace(/.*node_modules[\\/]/, "");
2379
+ }, "getFrameworkPackageName");
2380
+ async function Bn(e) {
2381
+ if (!e?.framework)
2382
+ return {};
2383
+ let t = typeof e.framework == "string" ? e.framework : e.framework?.name;
2384
+ if (!t)
2385
+ return {};
2386
+ let r = await ht(t);
2387
+ if (!r)
2388
+ return {};
2389
+ let n = Fn(r, Ks), i = Fn(r, Ys), s = Xs(t), a = typeof e.framework == "object" ? e.framework.options : {};
2390
+ return {
2391
+ framework: {
2392
+ name: s,
2393
+ options: a
2394
+ },
2395
+ builder: n,
2396
+ renderer: i
2397
+ };
2398
+ }
2399
+ o(Bn, "getFrameworkInfo");
2400
+
2401
+ // src/telemetry/get-has-router-package.ts
2402
+ var Qs = /* @__PURE__ */ new Set([
2403
+ "react-router",
2404
+ "react-router-dom",
2405
+ "remix",
2406
+ "@tanstack/react-router",
2407
+ "expo-router",
2408
+ "@reach/router",
2409
+ "react-easy-router",
2410
+ "@remix-run/router",
2411
+ "wouter",
2412
+ "wouter-preact",
2413
+ "preact-router",
2414
+ "vue-router",
2415
+ "unplugin-vue-router",
2416
+ "@angular/router",
2417
+ "@solidjs/router",
2418
+ // metaframeworks that imply routing
2419
+ "next",
2420
+ "react-scripts",
2421
+ "gatsby",
2422
+ "nuxt",
2423
+ "@sveltejs/kit"
2424
+ ]);
2425
+ function Gn(e) {
2426
+ return Object.keys(e?.dependencies ?? {}).some(
2427
+ (t) => Qs.has(t)
2428
+ );
2429
+ }
2430
+ o(Gn, "getHasRouterPackage");
2431
+
2432
+ // src/telemetry/get-monorepo-type.ts
2433
+ import { existsSync as Un, readFileSync as Zs } from "node:fs";
2434
+ import { join as gt } from "node:path";
2435
+ import { getProjectRoot as ea } from "storybook/internal/common";
2436
+ var $n = {
2437
+ Nx: "nx.json",
2438
+ Turborepo: "turbo.json",
2439
+ Lerna: "lerna.json",
2440
+ Rush: "rush.json",
2441
+ Lage: "lage.config.json"
2442
+ }, Wn = /* @__PURE__ */ o(() => {
2443
+ let e = ea();
2444
+ if (!e)
2445
+ return;
2446
+ let r = Object.keys($n).find((i) => {
2447
+ let s = gt(e, $n[i]);
2448
+ return Un(s);
2449
+ });
2450
+ if (r)
2451
+ return r;
2452
+ if (!Un(gt(e, "package.json")))
2453
+ return;
2454
+ if (JSON.parse(
2455
+ Zs(gt(e, "package.json"), { encoding: "utf8" })
2456
+ )?.workspaces)
2457
+ return "Workspaces";
2458
+ }, "getMonorepoType");
2459
+
2460
+ // src/telemetry/get-portable-stories-usage.ts
2461
+ var ta = /* @__PURE__ */ o(async (e) => {
2462
+ try {
2463
+ let t = "git grep -l composeStor" + (e ? ` -- ${e}` : "");
2464
+ return await pe(t);
2465
+ } catch (t) {
2466
+ return t.exitCode === 1 ? 0 : void 0;
2467
+ }
2468
+ }, "getPortableStoriesFileCountUncached"), Hn = /* @__PURE__ */ o(async (e) => he(
2469
+ "portableStories",
2470
+ async () => ta(e)
2471
+ ), "getPortableStoriesFileCount");
2472
+
2473
+ // src/telemetry/storybook-metadata.ts
2474
+ var Jn = {
2475
+ next: "Next",
2476
+ "react-scripts": "CRA",
2477
+ gatsby: "Gatsby",
2478
+ "@nuxtjs/storybook": "nuxt",
2479
+ "@nrwl/storybook": "nx",
2480
+ "@vue/cli-service": "vue-cli",
2481
+ "@sveltejs/kit": "sveltekit"
2482
+ }, Vn = /* @__PURE__ */ o((e) => D(e).replace(/\/dist\/.*/, "").replace(/\.[mc]?[tj]?s[x]?$/, "").replace(/\/register$/, "").replace(/\/manager$/,
2483
+ "").replace(/\/preset$/, ""), "sanitizeAddonName"), ua = /* @__PURE__ */ o(async ({
2484
+ packageJsonPath: e,
2485
+ packageJson: t,
2486
+ mainConfig: r
2487
+ }) => {
2488
+ let n = {
2489
+ generatedAt: (/* @__PURE__ */ new Date()).getTime(),
2490
+ hasCustomBabel: !1,
2491
+ hasCustomWebpack: !1,
2492
+ hasStaticDirs: !1,
2493
+ hasStorybookEslint: !1,
2494
+ refCount: 0
2495
+ }, i = {
2496
+ ...t?.dependencies,
2497
+ ...t?.devDependencies,
2498
+ ...t?.peerDependencies
2499
+ }, s = Object.keys(i).find((p) => !!Jn[p]);
2500
+ if (s) {
2501
+ let { version: p } = await ge(s);
2502
+ n.metaFramework = {
2503
+ name: Jn[s],
2504
+ packageName: s,
2505
+ version: p
2506
+ };
2507
+ }
2508
+ let a = [
2509
+ "playwright",
2510
+ "vitest",
2511
+ "jest",
2512
+ "cypress",
2513
+ "nightwatch",
2514
+ "webdriver",
2515
+ "@web/test-runner",
2516
+ "puppeteer",
2517
+ "karma",
2518
+ "jasmine",
2519
+ "chai",
2520
+ "testing-library",
2521
+ "@ngneat/spectator",
2522
+ "wdio",
2523
+ "msw",
2524
+ "miragejs",
2525
+ "sinon"
2526
+ ], c = Object.keys(i).filter(
2527
+ (p) => a.find((w) => p.includes(w))
2528
+ );
2529
+ n.testPackages = Object.fromEntries(
2530
+ await Promise.all(
2531
+ c.map(async (p) => [p, (await ge(p))?.version])
2532
+ )
2533
+ ), n.hasRouterPackage = Gn(t);
2534
+ let u = Wn();
2535
+ u && (n.monorepo = u);
2536
+ try {
2537
+ let p = await Ie({ cwd: na() });
2538
+ p && (n.packageManager = {
2539
+ type: p.name,
2540
+ version: p.version,
2541
+ agent: p.agent
2542
+ });
2543
+ } catch {
2544
+ }
2545
+ let f = i.typescript ? "typescript" : "javascript";
2546
+ if (!r)
2547
+ return {
2548
+ ...n,
2549
+ storybookVersionSpecifier: aa.storybook,
2550
+ language: f
2551
+ };
2552
+ n.hasCustomBabel = !!r.babel, n.hasCustomWebpack = !!r.webpackFinal, n.hasStaticDirs = !!r.staticDirs, typeof r.typescript == "object" && (n.
2553
+ typescriptOptions = r.typescript);
2554
+ let l = await Bn(r);
2555
+ typeof r.refs == "object" && (n.refCount = Object.keys(r.refs).length), typeof r.features == "object" && (n.features = r.features);
2556
+ let d = {};
2557
+ r.addons && r.addons.forEach((p) => {
2558
+ let w, J;
2559
+ typeof p == "string" ? w = Vn(p) : (p.name.includes("addon-essentials") && (J = p.options), w = Vn(p.name)), d[w] = {
2560
+ options: J,
2561
+ version: void 0
2562
+ };
2563
+ });
2564
+ let h = Ln(t);
2565
+ h && (d.chromatic = {
2566
+ version: void 0,
2567
+ versionSpecifier: h,
2568
+ options: void 0
2569
+ }), (await yt(d)).forEach(({ name: p, version: w }) => {
2570
+ d[p].version = w;
2571
+ });
2572
+ let g = Object.keys(d), m = Object.keys(i).filter((p) => p.includes("storybook") && !g.includes(p)).reduce((p, w) => ({
2573
+ ...p,
2574
+ [w]: { version: void 0 }
2575
+ }), {});
2576
+ (await yt(m)).forEach(({ name: p, version: w }) => {
2577
+ m[p].version = w;
2578
+ });
2579
+ let C = !!i["eslint-plugin-storybook"], k = ia(t);
2580
+ try {
2581
+ let { previewConfig: p } = k;
2582
+ if (p) {
2583
+ let w = await ca(p), J = !!(w.getFieldNode(["globals"]) || w.getFieldNode(["globalTypes"]));
2584
+ n.preview = { ...n.preview, usesGlobals: J };
2585
+ }
2586
+ } catch {
2587
+ }
2588
+ let I = m[k.frameworkPackage]?.version, W = await Hn(), H = await Mn(ra(e));
2589
+ return {
2590
+ ...n,
2591
+ ...l,
2592
+ portableStoriesFileCount: W,
2593
+ applicationFileCount: H,
2594
+ storybookVersion: I,
2595
+ storybookVersionSpecifier: k.version,
2596
+ language: f,
2597
+ storybookPackages: m,
2598
+ addons: d,
2599
+ hasStorybookEslint: C
2600
+ };
2601
+ }, "computeStorybookMetadata");
2602
+ async function fa() {
2603
+ let e = await Pe(process.cwd());
2604
+ return e ? {
2605
+ packageJsonPath: e,
2606
+ packageJson: await _t(e) || {}
2607
+ } : {
2608
+ packageJsonPath: process.cwd(),
2609
+ packageJson: {}
2610
+ };
2611
+ }
2612
+ o(fa, "getPackageJsonDetails");
2613
+ var be, qn = /* @__PURE__ */ o(async (e) => {
2614
+ if (be)
2615
+ return be;
2616
+ let { packageJson: t, packageJsonPath: r } = await fa(), n = (e || oa(
2617
+ String(t?.scripts?.storybook || ""),
2618
+ "-c",
2619
+ "--config-dir"
2620
+ )) ?? ".storybook", i = await sa({ configDir: n }).catch(() => {
2621
+ });
2622
+ return be = await ua({ mainConfig: i, packageJson: t, packageJsonPath: r }), be;
2623
+ }, "getStorybookMetadata");
2624
+
2625
+ // src/telemetry/telemetry.ts
2626
+ var oo = A(Yn(), 1);
2627
+ import * as no from "node:os";
2628
+
2629
+ // ../node_modules/nanoid/index.js
2630
+ import { randomFillSync as Xn } from "crypto";
2631
+
2632
+ // ../node_modules/nanoid/url-alphabet/index.js
2633
+ var Kn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
2634
+
2635
+ // ../node_modules/nanoid/index.js
2636
+ var la = 128, T, N, pa = /* @__PURE__ */ o((e) => {
2637
+ !T || T.length < e ? (T = Buffer.allocUnsafe(e * la), Xn(T), N = 0) : N + e > T.length && (Xn(T), N = 0), N += e;
2638
+ }, "fillPool");
2639
+ var U = /* @__PURE__ */ o((e = 21) => {
2640
+ pa(e -= 0);
2641
+ let t = "";
2642
+ for (let r = N - e; r < N; r++)
2643
+ t += Kn[T[r] & 63];
2644
+ return t;
2645
+ }, "nanoid");
2646
+
2647
+ // src/telemetry/anonymous-id.ts
2648
+ import { relative as da } from "node:path";
2649
+ import { getProjectRoot as ya } from "storybook/internal/common";
2650
+ import { execSync as ha } from "child_process";
2651
+
2652
+ // src/telemetry/one-way-hash.ts
2653
+ import { createHash as ma } from "crypto";
2654
+ var bt = /* @__PURE__ */ o((e) => {
2655
+ let t = ma("sha256");
2656
+ return t.update("storybook-telemetry-salt"), t.update(e), t.digest("hex");
2657
+ }, "oneWayHash");
2658
+
2659
+ // src/telemetry/anonymous-id.ts
2660
+ function ga(e) {
2661
+ let n = e.trim().replace(/#.*$/, "").replace(/^.*@/, "").replace(/^.*\/\//, "");
2662
+ return (n.endsWith(".git") ? n : `${n}.git`).replace(":", "/");
2663
+ }
2664
+ o(ga, "normalizeGitUrl");
2665
+ function ba(e, t) {
2666
+ return `${ga(e)}${ut(t)}`;
2667
+ }
2668
+ o(ba, "unhashedProjectId");
2669
+ var we, Qn = /* @__PURE__ */ o(() => {
2670
+ if (we)
2671
+ return we;
2672
+ try {
2673
+ let e = ya(), t = da(e, process.cwd()), r = ha("git config --local --get remote.origin.url", {
2674
+ timeout: 1e3,
2675
+ stdio: "pipe"
2676
+ });
2677
+ we = bt(ba(String(r), t));
2678
+ } catch {
2679
+ }
2680
+ return we;
2681
+ }, "getAnonymousProjectId");
2682
+
2683
+ // src/telemetry/event-cache.ts
2684
+ import { cache as wt } from "storybook/internal/common";
2685
+ var xt = Promise.resolve(), xa = /* @__PURE__ */ o(async (e, t) => {
2686
+ let r = await wt.get("lastEvents") || {};
2687
+ r[e] = { body: t, timestamp: Date.now() }, await wt.set("lastEvents", r);
2688
+ }, "setHelper"), eo = /* @__PURE__ */ o(async (e, t) => (await xt, xt = xa(e, t), xt), "set");
2689
+ var wa = /* @__PURE__ */ o((e) => {
2690
+ let { body: t, timestamp: r } = e;
2691
+ return {
2692
+ timestamp: r,
2693
+ eventType: t?.eventType,
2694
+ eventId: t?.eventId,
2695
+ sessionId: t?.sessionId
2696
+ };
2697
+ }, "upgradeFields"), Sa = ["init", "upgrade"], ka = ["build", "dev", "error"], Zn = /* @__PURE__ */ o((e, t) => {
2698
+ let r = t.map((n) => e?.[n]).filter(Boolean).sort((n, i) => i.timestamp - n.timestamp);
2699
+ return r.length > 0 ? r[0] : void 0;
2700
+ }, "lastEvent"), Ea = /* @__PURE__ */ o(async (e = void 0) => {
2701
+ let t = e || await wt.get("lastEvents") || {}, r = Zn(t, Sa), n = Zn(t, ka);
2702
+ if (r)
2703
+ return !n?.timestamp || r.timestamp > n.timestamp ? wa(r) : void 0;
2704
+ }, "getPrecedingUpgrade");
2705
+
2706
+ // src/telemetry/fetch.ts
2707
+ var to = global.fetch;
2708
+
2709
+ // src/telemetry/session-id.ts
2710
+ import { cache as ro } from "storybook/internal/common";
2711
+ var Pa = 1e3 * 60 * 60 * 2, $;
2712
+ var St = /* @__PURE__ */ o(async () => {
2713
+ let e = Date.now();
2714
+ if (!$) {
2715
+ let t = await ro.get("session");
2716
+ t && t.lastUsed >= e - Pa ? $ = t.id : $ = U();
2717
+ }
2718
+ return await ro.set("session", { id: $, lastUsed: e }), $;
2719
+ }, "getSessionId");
2720
+
2721
+ // src/telemetry/telemetry.ts
2722
+ var va = (0, oo.default)(to), Ta = process.env.STORYBOOK_TELEMETRY_URL || "https://storybook.js.org/event-log", Se = [], Ca = /* @__PURE__ */ o(
2723
+ (e, t) => {
2724
+ kt[e] = t;
2725
+ }, "addToGlobalContext"), Ia = /* @__PURE__ */ o(() => {
2726
+ try {
2727
+ let e = no.platform();
2728
+ return e === "win32" ? "Windows" : e === "darwin" ? "macOS" : e === "linux" ? "Linux" : `Other: ${e}`;
2729
+ } catch {
2730
+ return "Unknown";
2731
+ }
2732
+ }, "getOperatingSystem"), kt = {
2733
+ inCI: !!process.env.CI,
2734
+ isTTY: process.stdout.isTTY,
2735
+ platform: Ia(),
2736
+ nodeVersion: process.versions.node
2737
+ }, Aa = /* @__PURE__ */ o(async (e, t, r) => {
2738
+ let { eventType: n, payload: i, metadata: s, ...a } = e, c = await St(), u = U(), f = { ...a, eventType: n, eventId: u, sessionId: c, metadata: s,
2739
+ payload: i, context: t };
2740
+ return va(Ta, {
2741
+ method: "post",
2742
+ body: JSON.stringify(f),
2743
+ headers: { "Content-Type": "application/json" },
2744
+ retries: 3,
2745
+ retryOn: [503, 504],
2746
+ retryDelay: /* @__PURE__ */ o((l) => 2 ** l * (typeof r?.retryDelay == "number" && !Number.isNaN(r?.retryDelay) ? r.retryDelay : 1e3), "\
2747
+ retryDelay")
2748
+ });
2749
+ }, "prepareRequest");
2750
+ async function io(e, t = { retryDelay: 1e3, immediate: !1 }) {
2751
+ let { eventType: r, payload: n, metadata: i, ...s } = e, a = t.stripMetadata ? kt : {
2752
+ ...kt,
2753
+ anonymousId: Qn()
2754
+ }, c;
2755
+ try {
2756
+ c = Aa(e, a, t), Se.push(c), t.immediate ? await Promise.all(Se) : await c;
2757
+ let u = await St(), f = U(), l = { ...s, eventType: r, eventId: f, sessionId: u, metadata: i, payload: n, context: a };
2758
+ await eo(r, l);
2759
+ } catch {
2760
+ } finally {
2761
+ Se = Se.filter((u) => u !== c);
2762
+ }
2763
+ }
2764
+ o(io, "sendTelemetry");
2765
+
2766
+ // src/telemetry/index.ts
2767
+ var ud = /* @__PURE__ */ o((e) => e.startsWith("example-button--") || e.startsWith("example-header--") || e.startsWith("example-page--"), "i\
2768
+ sExampleStoryId"), fd = /* @__PURE__ */ o(async (e, t = {}, r = {}) => {
2769
+ e !== "boot" && r.notify !== !1 && await It();
2770
+ let n = {
2771
+ eventType: e,
2772
+ payload: t
2773
+ };
2774
+ try {
2775
+ r?.stripMetadata || (n.metadata = await qn(r?.configDir));
2776
+ } catch (i) {
2777
+ n.payload.metadataErrorMessage = Y(i).message, r?.enableCrashReports && (n.payload.metadataError = Y(i));
2778
+ } finally {
2779
+ let { error: i } = n.payload;
2780
+ i && (n.payload.error = Y(i)), (!n.payload.error || r?.enableCrashReports) && (process.env?.STORYBOOK_TELEMETRY_DEBUG && (so.info(`
2781
+ [telemetry]`), so.info(JSON.stringify(n, null, 2))), await io(n, r));
2782
+ }
2783
+ }, "telemetry");
2784
+ export {
2785
+ Ca as addToGlobalContext,
2786
+ D as cleanPaths,
2787
+ ua as computeStorybookMetadata,
2788
+ Ea as getPrecedingUpgrade,
2789
+ qn as getStorybookMetadata,
2790
+ ud as isExampleStoryId,
2791
+ Jn as metaFrameworks,
2792
+ bt as oneWayHash,
2793
+ Ot as removeAnsiEscapeCodes,
2794
+ Vn as sanitizeAddonName,
2795
+ Y as sanitizeError,
2796
+ fd as telemetry
2797
+ };