@storybook/react 10.1.0-alpha.1 → 10.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/preset.js CHANGED
@@ -1,16 +1,3414 @@
1
- import CJS_COMPAT_NODE_URL_55vyotyeq7b from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_55vyotyeq7b from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_55vyotyeq7b from "node:module";
1
+ import CJS_COMPAT_NODE_URL_1skdcz3rbd6 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_1skdcz3rbd6 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_1skdcz3rbd6 from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_55vyotyeq7b.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_55vyotyeq7b.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_55vyotyeq7b.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_1skdcz3rbd6.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_1skdcz3rbd6.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_1skdcz3rbd6.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
11
  // ------------------------------------------------------------
12
+ var __create = Object.create;
12
13
  var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __getOwnPropNames = Object.getOwnPropertyNames;
16
+ var __getProtoOf = Object.getPrototypeOf;
17
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
18
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
19
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
20
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
21
+ }) : x)(function(x) {
22
+ if (typeof require !== "undefined") return require.apply(this, arguments);
23
+ throw Error('Dynamic require of "' + x + '" is not supported');
24
+ });
25
+ var __commonJS = (cb, mod) => function __require2() {
26
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+
45
+ // ../../node_modules/tsconfig-paths/lib/filesystem.js
46
+ var require_filesystem = __commonJS({
47
+ "../../node_modules/tsconfig-paths/lib/filesystem.js"(exports) {
48
+ "use strict";
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.removeExtension = exports.fileExistsAsync = exports.readJsonFromDiskAsync = exports.readJsonFromDiskSync = exports.fileExistsSync = void 0;
51
+ var fs = __require("fs");
52
+ function fileExistsSync(path2) {
53
+ if (!fs.existsSync(path2)) {
54
+ return false;
55
+ }
56
+ try {
57
+ var stats = fs.statSync(path2);
58
+ return stats.isFile();
59
+ } catch (err) {
60
+ return false;
61
+ }
62
+ }
63
+ __name(fileExistsSync, "fileExistsSync");
64
+ exports.fileExistsSync = fileExistsSync;
65
+ function readJsonFromDiskSync(packageJsonPath) {
66
+ if (!fs.existsSync(packageJsonPath)) {
67
+ return void 0;
68
+ }
69
+ return __require(packageJsonPath);
70
+ }
71
+ __name(readJsonFromDiskSync, "readJsonFromDiskSync");
72
+ exports.readJsonFromDiskSync = readJsonFromDiskSync;
73
+ function readJsonFromDiskAsync(path2, callback) {
74
+ fs.readFile(path2, "utf8", function(err, result) {
75
+ if (err || !result) {
76
+ return callback();
77
+ }
78
+ var json = JSON.parse(result);
79
+ return callback(void 0, json);
80
+ });
81
+ }
82
+ __name(readJsonFromDiskAsync, "readJsonFromDiskAsync");
83
+ exports.readJsonFromDiskAsync = readJsonFromDiskAsync;
84
+ function fileExistsAsync(path2, callback2) {
85
+ fs.stat(path2, function(err, stats) {
86
+ if (err) {
87
+ return callback2(void 0, false);
88
+ }
89
+ callback2(void 0, stats ? stats.isFile() : false);
90
+ });
91
+ }
92
+ __name(fileExistsAsync, "fileExistsAsync");
93
+ exports.fileExistsAsync = fileExistsAsync;
94
+ function removeExtension(path2) {
95
+ return path2.substring(0, path2.lastIndexOf(".")) || path2;
96
+ }
97
+ __name(removeExtension, "removeExtension");
98
+ exports.removeExtension = removeExtension;
99
+ }
100
+ });
101
+
102
+ // ../../node_modules/tsconfig-paths/lib/mapping-entry.js
103
+ var require_mapping_entry = __commonJS({
104
+ "../../node_modules/tsconfig-paths/lib/mapping-entry.js"(exports) {
105
+ "use strict";
106
+ Object.defineProperty(exports, "__esModule", { value: true });
107
+ exports.getAbsoluteMappingEntries = void 0;
108
+ var path2 = __require("path");
109
+ function getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll) {
110
+ var sortedKeys = sortByLongestPrefix(Object.keys(paths));
111
+ var absolutePaths = [];
112
+ for (var _i = 0, sortedKeys_1 = sortedKeys; _i < sortedKeys_1.length; _i++) {
113
+ var key = sortedKeys_1[_i];
114
+ absolutePaths.push({
115
+ pattern: key,
116
+ paths: paths[key].map(function(pathToResolve) {
117
+ return path2.resolve(absoluteBaseUrl, pathToResolve);
118
+ })
119
+ });
120
+ }
121
+ if (!paths["*"] && addMatchAll) {
122
+ absolutePaths.push({
123
+ pattern: "*",
124
+ paths: ["".concat(absoluteBaseUrl.replace(/\/$/, ""), "/*")]
125
+ });
126
+ }
127
+ return absolutePaths;
128
+ }
129
+ __name(getAbsoluteMappingEntries, "getAbsoluteMappingEntries");
130
+ exports.getAbsoluteMappingEntries = getAbsoluteMappingEntries;
131
+ function sortByLongestPrefix(arr) {
132
+ return arr.concat().sort(function(a, b) {
133
+ return getPrefixLength(b) - getPrefixLength(a);
134
+ });
135
+ }
136
+ __name(sortByLongestPrefix, "sortByLongestPrefix");
137
+ function getPrefixLength(pattern) {
138
+ var prefixLength = pattern.indexOf("*");
139
+ return pattern.substr(0, prefixLength).length;
140
+ }
141
+ __name(getPrefixLength, "getPrefixLength");
142
+ }
143
+ });
144
+
145
+ // ../../node_modules/tsconfig-paths/lib/try-path.js
146
+ var require_try_path = __commonJS({
147
+ "../../node_modules/tsconfig-paths/lib/try-path.js"(exports) {
148
+ "use strict";
149
+ Object.defineProperty(exports, "__esModule", { value: true });
150
+ exports.exhaustiveTypeException = exports.getStrippedPath = exports.getPathsToTry = void 0;
151
+ var path2 = __require("path");
152
+ var path_1 = __require("path");
153
+ var filesystem_1 = require_filesystem();
154
+ function getPathsToTry(extensions, absolutePathMappings, requestedModule) {
155
+ if (!absolutePathMappings || !requestedModule || requestedModule[0] === ".") {
156
+ return void 0;
157
+ }
158
+ var pathsToTry = [];
159
+ for (var _i = 0, absolutePathMappings_1 = absolutePathMappings; _i < absolutePathMappings_1.length; _i++) {
160
+ var entry = absolutePathMappings_1[_i];
161
+ var starMatch = entry.pattern === requestedModule ? "" : matchStar(entry.pattern, requestedModule);
162
+ if (starMatch !== void 0) {
163
+ var _loop_1 = /* @__PURE__ */ __name(function(physicalPathPattern2) {
164
+ var physicalPath = physicalPathPattern2.replace("*", starMatch);
165
+ pathsToTry.push({ type: "file", path: physicalPath });
166
+ pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
167
+ return { type: "extension", path: physicalPath + e };
168
+ }));
169
+ pathsToTry.push({
170
+ type: "package",
171
+ path: path2.join(physicalPath, "/package.json")
172
+ });
173
+ var indexPath = path2.join(physicalPath, "/index");
174
+ pathsToTry.push.apply(pathsToTry, extensions.map(function(e) {
175
+ return { type: "index", path: indexPath + e };
176
+ }));
177
+ }, "_loop_1");
178
+ for (var _a = 0, _b = entry.paths; _a < _b.length; _a++) {
179
+ var physicalPathPattern = _b[_a];
180
+ _loop_1(physicalPathPattern);
181
+ }
182
+ }
183
+ }
184
+ return pathsToTry.length === 0 ? void 0 : pathsToTry;
185
+ }
186
+ __name(getPathsToTry, "getPathsToTry");
187
+ exports.getPathsToTry = getPathsToTry;
188
+ function getStrippedPath(tryPath) {
189
+ return tryPath.type === "index" ? (0, path_1.dirname)(tryPath.path) : tryPath.type === "file" ? tryPath.path : tryPath.type === "extension" ? (0, filesystem_1.removeExtension)(tryPath.path) : tryPath.type === "package" ? tryPath.path : exhaustiveTypeException(tryPath.type);
190
+ }
191
+ __name(getStrippedPath, "getStrippedPath");
192
+ exports.getStrippedPath = getStrippedPath;
193
+ function exhaustiveTypeException(check) {
194
+ throw new Error("Unknown type ".concat(check));
195
+ }
196
+ __name(exhaustiveTypeException, "exhaustiveTypeException");
197
+ exports.exhaustiveTypeException = exhaustiveTypeException;
198
+ function matchStar(pattern, search) {
199
+ if (search.length < pattern.length) {
200
+ return void 0;
201
+ }
202
+ if (pattern === "*") {
203
+ return search;
204
+ }
205
+ var star = pattern.indexOf("*");
206
+ if (star === -1) {
207
+ return void 0;
208
+ }
209
+ var part1 = pattern.substring(0, star);
210
+ var part2 = pattern.substring(star + 1);
211
+ if (search.substr(0, star) !== part1) {
212
+ return void 0;
213
+ }
214
+ if (search.substr(search.length - part2.length) !== part2) {
215
+ return void 0;
216
+ }
217
+ return search.substr(star, search.length - part2.length);
218
+ }
219
+ __name(matchStar, "matchStar");
220
+ }
221
+ });
222
+
223
+ // ../../node_modules/tsconfig-paths/lib/match-path-sync.js
224
+ var require_match_path_sync = __commonJS({
225
+ "../../node_modules/tsconfig-paths/lib/match-path-sync.js"(exports) {
226
+ "use strict";
227
+ Object.defineProperty(exports, "__esModule", { value: true });
228
+ exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
229
+ var path2 = __require("path");
230
+ var Filesystem = require_filesystem();
231
+ var MappingEntry = require_mapping_entry();
232
+ var TryPath = require_try_path();
233
+ function createMatchPath2(absoluteBaseUrl, paths, mainFields, addMatchAll) {
234
+ if (mainFields === void 0) {
235
+ mainFields = ["main"];
236
+ }
237
+ if (addMatchAll === void 0) {
238
+ addMatchAll = true;
239
+ }
240
+ var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
241
+ return function(requestedModule, readJson, fileExists, extensions) {
242
+ return matchFromAbsolutePaths(absolutePaths, requestedModule, readJson, fileExists, extensions, mainFields);
243
+ };
244
+ }
245
+ __name(createMatchPath2, "createMatchPath");
246
+ exports.createMatchPath = createMatchPath2;
247
+ function matchFromAbsolutePaths(absolutePathMappings, requestedModule, readJson, fileExists, extensions, mainFields) {
248
+ if (readJson === void 0) {
249
+ readJson = Filesystem.readJsonFromDiskSync;
250
+ }
251
+ if (fileExists === void 0) {
252
+ fileExists = Filesystem.fileExistsSync;
253
+ }
254
+ if (extensions === void 0) {
255
+ extensions = Object.keys(__require.extensions);
256
+ }
257
+ if (mainFields === void 0) {
258
+ mainFields = ["main"];
259
+ }
260
+ var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
261
+ if (!tryPaths) {
262
+ return void 0;
263
+ }
264
+ return findFirstExistingPath(tryPaths, readJson, fileExists, mainFields);
265
+ }
266
+ __name(matchFromAbsolutePaths, "matchFromAbsolutePaths");
267
+ exports.matchFromAbsolutePaths = matchFromAbsolutePaths;
268
+ function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExists) {
269
+ for (var index = 0; index < mainFields.length; index++) {
270
+ var mainFieldSelector = mainFields[index];
271
+ var candidateMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key) {
272
+ return obj[key];
273
+ }, packageJson);
274
+ if (candidateMapping && typeof candidateMapping === "string") {
275
+ var candidateFilePath = path2.join(path2.dirname(packageJsonPath), candidateMapping);
276
+ if (fileExists(candidateFilePath)) {
277
+ return candidateFilePath;
278
+ }
279
+ }
280
+ }
281
+ return void 0;
282
+ }
283
+ __name(findFirstExistingMainFieldMappedFile, "findFirstExistingMainFieldMappedFile");
284
+ function findFirstExistingPath(tryPaths, readJson, fileExists, mainFields) {
285
+ if (readJson === void 0) {
286
+ readJson = Filesystem.readJsonFromDiskSync;
287
+ }
288
+ if (mainFields === void 0) {
289
+ mainFields = ["main"];
290
+ }
291
+ for (var _i = 0, tryPaths_1 = tryPaths; _i < tryPaths_1.length; _i++) {
292
+ var tryPath = tryPaths_1[_i];
293
+ if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
294
+ if (fileExists(tryPath.path)) {
295
+ return TryPath.getStrippedPath(tryPath);
296
+ }
297
+ } else if (tryPath.type === "package") {
298
+ var packageJson = readJson(tryPath.path);
299
+ if (packageJson) {
300
+ var mainFieldMappedFile = findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists);
301
+ if (mainFieldMappedFile) {
302
+ return mainFieldMappedFile;
303
+ }
304
+ }
305
+ } else {
306
+ TryPath.exhaustiveTypeException(tryPath.type);
307
+ }
308
+ }
309
+ return void 0;
310
+ }
311
+ __name(findFirstExistingPath, "findFirstExistingPath");
312
+ }
313
+ });
314
+
315
+ // ../../node_modules/tsconfig-paths/lib/match-path-async.js
316
+ var require_match_path_async = __commonJS({
317
+ "../../node_modules/tsconfig-paths/lib/match-path-async.js"(exports) {
318
+ "use strict";
319
+ Object.defineProperty(exports, "__esModule", { value: true });
320
+ exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = void 0;
321
+ var path2 = __require("path");
322
+ var TryPath = require_try_path();
323
+ var MappingEntry = require_mapping_entry();
324
+ var Filesystem = require_filesystem();
325
+ function createMatchPathAsync(absoluteBaseUrl, paths, mainFields, addMatchAll) {
326
+ if (mainFields === void 0) {
327
+ mainFields = ["main"];
328
+ }
329
+ if (addMatchAll === void 0) {
330
+ addMatchAll = true;
331
+ }
332
+ var absolutePaths = MappingEntry.getAbsoluteMappingEntries(absoluteBaseUrl, paths, addMatchAll);
333
+ return function(requestedModule, readJson, fileExists, extensions, callback) {
334
+ return matchFromAbsolutePathsAsync(absolutePaths, requestedModule, readJson, fileExists, extensions, callback, mainFields);
335
+ };
336
+ }
337
+ __name(createMatchPathAsync, "createMatchPathAsync");
338
+ exports.createMatchPathAsync = createMatchPathAsync;
339
+ function matchFromAbsolutePathsAsync(absolutePathMappings, requestedModule, readJson, fileExists, extensions, callback, mainFields) {
340
+ if (readJson === void 0) {
341
+ readJson = Filesystem.readJsonFromDiskAsync;
342
+ }
343
+ if (fileExists === void 0) {
344
+ fileExists = Filesystem.fileExistsAsync;
345
+ }
346
+ if (extensions === void 0) {
347
+ extensions = Object.keys(__require.extensions);
348
+ }
349
+ if (mainFields === void 0) {
350
+ mainFields = ["main"];
351
+ }
352
+ var tryPaths = TryPath.getPathsToTry(extensions, absolutePathMappings, requestedModule);
353
+ if (!tryPaths) {
354
+ return callback();
355
+ }
356
+ findFirstExistingPath(tryPaths, readJson, fileExists, callback, 0, mainFields);
357
+ }
358
+ __name(matchFromAbsolutePathsAsync, "matchFromAbsolutePathsAsync");
359
+ exports.matchFromAbsolutePathsAsync = matchFromAbsolutePathsAsync;
360
+ function findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index) {
361
+ if (index === void 0) {
362
+ index = 0;
363
+ }
364
+ if (index >= mainFields.length) {
365
+ return doneCallback(void 0, void 0);
366
+ }
367
+ var tryNext = /* @__PURE__ */ __name(function() {
368
+ return findFirstExistingMainFieldMappedFile(packageJson, mainFields, packageJsonPath, fileExistsAsync, doneCallback, index + 1);
369
+ }, "tryNext");
370
+ var mainFieldSelector = mainFields[index];
371
+ var mainFieldMapping = typeof mainFieldSelector === "string" ? packageJson[mainFieldSelector] : mainFieldSelector.reduce(function(obj, key) {
372
+ return obj[key];
373
+ }, packageJson);
374
+ if (typeof mainFieldMapping !== "string") {
375
+ return tryNext();
376
+ }
377
+ var mappedFilePath = path2.join(path2.dirname(packageJsonPath), mainFieldMapping);
378
+ fileExistsAsync(mappedFilePath, function(err, exists) {
379
+ if (err) {
380
+ return doneCallback(err);
381
+ }
382
+ if (exists) {
383
+ return doneCallback(void 0, mappedFilePath);
384
+ }
385
+ return tryNext();
386
+ });
387
+ }
388
+ __name(findFirstExistingMainFieldMappedFile, "findFirstExistingMainFieldMappedFile");
389
+ function findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index, mainFields) {
390
+ if (index === void 0) {
391
+ index = 0;
392
+ }
393
+ if (mainFields === void 0) {
394
+ mainFields = ["main"];
395
+ }
396
+ var tryPath = tryPaths[index];
397
+ if (tryPath.type === "file" || tryPath.type === "extension" || tryPath.type === "index") {
398
+ fileExists(tryPath.path, function(err, exists) {
399
+ if (err) {
400
+ return doneCallback(err);
401
+ }
402
+ if (exists) {
403
+ return doneCallback(void 0, TryPath.getStrippedPath(tryPath));
404
+ }
405
+ if (index === tryPaths.length - 1) {
406
+ return doneCallback();
407
+ }
408
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
409
+ });
410
+ } else if (tryPath.type === "package") {
411
+ readJson(tryPath.path, function(err, packageJson) {
412
+ if (err) {
413
+ return doneCallback(err);
414
+ }
415
+ if (packageJson) {
416
+ return findFirstExistingMainFieldMappedFile(packageJson, mainFields, tryPath.path, fileExists, function(mainFieldErr, mainFieldMappedFile) {
417
+ if (mainFieldErr) {
418
+ return doneCallback(mainFieldErr);
419
+ }
420
+ if (mainFieldMappedFile) {
421
+ return doneCallback(void 0, mainFieldMappedFile);
422
+ }
423
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
424
+ });
425
+ }
426
+ return findFirstExistingPath(tryPaths, readJson, fileExists, doneCallback, index + 1, mainFields);
427
+ });
428
+ } else {
429
+ TryPath.exhaustiveTypeException(tryPath.type);
430
+ }
431
+ }
432
+ __name(findFirstExistingPath, "findFirstExistingPath");
433
+ }
434
+ });
435
+
436
+ // ../../node_modules/json5/lib/unicode.js
437
+ var require_unicode = __commonJS({
438
+ "../../node_modules/json5/lib/unicode.js"(exports, module) {
439
+ module.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
440
+ module.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
441
+ module.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
442
+ }
443
+ });
444
+
445
+ // ../../node_modules/json5/lib/util.js
446
+ var require_util = __commonJS({
447
+ "../../node_modules/json5/lib/util.js"(exports, module) {
448
+ var unicode = require_unicode();
449
+ module.exports = {
450
+ isSpaceSeparator(c) {
451
+ return typeof c === "string" && unicode.Space_Separator.test(c);
452
+ },
453
+ isIdStartChar(c) {
454
+ return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
455
+ },
456
+ isIdContinueChar(c) {
457
+ return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c));
458
+ },
459
+ isDigit(c) {
460
+ return typeof c === "string" && /[0-9]/.test(c);
461
+ },
462
+ isHexDigit(c) {
463
+ return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
464
+ }
465
+ };
466
+ }
467
+ });
468
+
469
+ // ../../node_modules/json5/lib/parse.js
470
+ var require_parse = __commonJS({
471
+ "../../node_modules/json5/lib/parse.js"(exports, module) {
472
+ var util = require_util();
473
+ var source;
474
+ var parseState;
475
+ var stack;
476
+ var pos;
477
+ var line;
478
+ var column;
479
+ var token;
480
+ var key;
481
+ var root;
482
+ module.exports = /* @__PURE__ */ __name(function parse4(text, reviver) {
483
+ source = String(text);
484
+ parseState = "start";
485
+ stack = [];
486
+ pos = 0;
487
+ line = 1;
488
+ column = 0;
489
+ token = void 0;
490
+ key = void 0;
491
+ root = void 0;
492
+ do {
493
+ token = lex();
494
+ parseStates[parseState]();
495
+ } while (token.type !== "eof");
496
+ if (typeof reviver === "function") {
497
+ return internalize({ "": root }, "", reviver);
498
+ }
499
+ return root;
500
+ }, "parse");
501
+ function internalize(holder, name, reviver) {
502
+ const value = holder[name];
503
+ if (value != null && typeof value === "object") {
504
+ if (Array.isArray(value)) {
505
+ for (let i = 0; i < value.length; i++) {
506
+ const key2 = String(i);
507
+ const replacement = internalize(value, key2, reviver);
508
+ if (replacement === void 0) {
509
+ delete value[key2];
510
+ } else {
511
+ Object.defineProperty(value, key2, {
512
+ value: replacement,
513
+ writable: true,
514
+ enumerable: true,
515
+ configurable: true
516
+ });
517
+ }
518
+ }
519
+ } else {
520
+ for (const key2 in value) {
521
+ const replacement = internalize(value, key2, reviver);
522
+ if (replacement === void 0) {
523
+ delete value[key2];
524
+ } else {
525
+ Object.defineProperty(value, key2, {
526
+ value: replacement,
527
+ writable: true,
528
+ enumerable: true,
529
+ configurable: true
530
+ });
531
+ }
532
+ }
533
+ }
534
+ }
535
+ return reviver.call(holder, name, value);
536
+ }
537
+ __name(internalize, "internalize");
538
+ var lexState;
539
+ var buffer;
540
+ var doubleQuote;
541
+ var sign;
542
+ var c;
543
+ function lex() {
544
+ lexState = "default";
545
+ buffer = "";
546
+ doubleQuote = false;
547
+ sign = 1;
548
+ for (; ; ) {
549
+ c = peek();
550
+ const token2 = lexStates[lexState]();
551
+ if (token2) {
552
+ return token2;
553
+ }
554
+ }
555
+ }
556
+ __name(lex, "lex");
557
+ function peek() {
558
+ if (source[pos]) {
559
+ return String.fromCodePoint(source.codePointAt(pos));
560
+ }
561
+ }
562
+ __name(peek, "peek");
563
+ function read() {
564
+ const c2 = peek();
565
+ if (c2 === "\n") {
566
+ line++;
567
+ column = 0;
568
+ } else if (c2) {
569
+ column += c2.length;
570
+ } else {
571
+ column++;
572
+ }
573
+ if (c2) {
574
+ pos += c2.length;
575
+ }
576
+ return c2;
577
+ }
578
+ __name(read, "read");
579
+ var lexStates = {
580
+ default() {
581
+ switch (c) {
582
+ case " ":
583
+ case "\v":
584
+ case "\f":
585
+ case " ":
586
+ case "\xA0":
587
+ case "\uFEFF":
588
+ case "\n":
589
+ case "\r":
590
+ case "\u2028":
591
+ case "\u2029":
592
+ read();
593
+ return;
594
+ case "/":
595
+ read();
596
+ lexState = "comment";
597
+ return;
598
+ case void 0:
599
+ read();
600
+ return newToken("eof");
601
+ }
602
+ if (util.isSpaceSeparator(c)) {
603
+ read();
604
+ return;
605
+ }
606
+ return lexStates[parseState]();
607
+ },
608
+ comment() {
609
+ switch (c) {
610
+ case "*":
611
+ read();
612
+ lexState = "multiLineComment";
613
+ return;
614
+ case "/":
615
+ read();
616
+ lexState = "singleLineComment";
617
+ return;
618
+ }
619
+ throw invalidChar(read());
620
+ },
621
+ multiLineComment() {
622
+ switch (c) {
623
+ case "*":
624
+ read();
625
+ lexState = "multiLineCommentAsterisk";
626
+ return;
627
+ case void 0:
628
+ throw invalidChar(read());
629
+ }
630
+ read();
631
+ },
632
+ multiLineCommentAsterisk() {
633
+ switch (c) {
634
+ case "*":
635
+ read();
636
+ return;
637
+ case "/":
638
+ read();
639
+ lexState = "default";
640
+ return;
641
+ case void 0:
642
+ throw invalidChar(read());
643
+ }
644
+ read();
645
+ lexState = "multiLineComment";
646
+ },
647
+ singleLineComment() {
648
+ switch (c) {
649
+ case "\n":
650
+ case "\r":
651
+ case "\u2028":
652
+ case "\u2029":
653
+ read();
654
+ lexState = "default";
655
+ return;
656
+ case void 0:
657
+ read();
658
+ return newToken("eof");
659
+ }
660
+ read();
661
+ },
662
+ value() {
663
+ switch (c) {
664
+ case "{":
665
+ case "[":
666
+ return newToken("punctuator", read());
667
+ case "n":
668
+ read();
669
+ literal("ull");
670
+ return newToken("null", null);
671
+ case "t":
672
+ read();
673
+ literal("rue");
674
+ return newToken("boolean", true);
675
+ case "f":
676
+ read();
677
+ literal("alse");
678
+ return newToken("boolean", false);
679
+ case "-":
680
+ case "+":
681
+ if (read() === "-") {
682
+ sign = -1;
683
+ }
684
+ lexState = "sign";
685
+ return;
686
+ case ".":
687
+ buffer = read();
688
+ lexState = "decimalPointLeading";
689
+ return;
690
+ case "0":
691
+ buffer = read();
692
+ lexState = "zero";
693
+ return;
694
+ case "1":
695
+ case "2":
696
+ case "3":
697
+ case "4":
698
+ case "5":
699
+ case "6":
700
+ case "7":
701
+ case "8":
702
+ case "9":
703
+ buffer = read();
704
+ lexState = "decimalInteger";
705
+ return;
706
+ case "I":
707
+ read();
708
+ literal("nfinity");
709
+ return newToken("numeric", Infinity);
710
+ case "N":
711
+ read();
712
+ literal("aN");
713
+ return newToken("numeric", NaN);
714
+ case '"':
715
+ case "'":
716
+ doubleQuote = read() === '"';
717
+ buffer = "";
718
+ lexState = "string";
719
+ return;
720
+ }
721
+ throw invalidChar(read());
722
+ },
723
+ identifierNameStartEscape() {
724
+ if (c !== "u") {
725
+ throw invalidChar(read());
726
+ }
727
+ read();
728
+ const u = unicodeEscape();
729
+ switch (u) {
730
+ case "$":
731
+ case "_":
732
+ break;
733
+ default:
734
+ if (!util.isIdStartChar(u)) {
735
+ throw invalidIdentifier();
736
+ }
737
+ break;
738
+ }
739
+ buffer += u;
740
+ lexState = "identifierName";
741
+ },
742
+ identifierName() {
743
+ switch (c) {
744
+ case "$":
745
+ case "_":
746
+ case "\u200C":
747
+ case "\u200D":
748
+ buffer += read();
749
+ return;
750
+ case "\\":
751
+ read();
752
+ lexState = "identifierNameEscape";
753
+ return;
754
+ }
755
+ if (util.isIdContinueChar(c)) {
756
+ buffer += read();
757
+ return;
758
+ }
759
+ return newToken("identifier", buffer);
760
+ },
761
+ identifierNameEscape() {
762
+ if (c !== "u") {
763
+ throw invalidChar(read());
764
+ }
765
+ read();
766
+ const u = unicodeEscape();
767
+ switch (u) {
768
+ case "$":
769
+ case "_":
770
+ case "\u200C":
771
+ case "\u200D":
772
+ break;
773
+ default:
774
+ if (!util.isIdContinueChar(u)) {
775
+ throw invalidIdentifier();
776
+ }
777
+ break;
778
+ }
779
+ buffer += u;
780
+ lexState = "identifierName";
781
+ },
782
+ sign() {
783
+ switch (c) {
784
+ case ".":
785
+ buffer = read();
786
+ lexState = "decimalPointLeading";
787
+ return;
788
+ case "0":
789
+ buffer = read();
790
+ lexState = "zero";
791
+ return;
792
+ case "1":
793
+ case "2":
794
+ case "3":
795
+ case "4":
796
+ case "5":
797
+ case "6":
798
+ case "7":
799
+ case "8":
800
+ case "9":
801
+ buffer = read();
802
+ lexState = "decimalInteger";
803
+ return;
804
+ case "I":
805
+ read();
806
+ literal("nfinity");
807
+ return newToken("numeric", sign * Infinity);
808
+ case "N":
809
+ read();
810
+ literal("aN");
811
+ return newToken("numeric", NaN);
812
+ }
813
+ throw invalidChar(read());
814
+ },
815
+ zero() {
816
+ switch (c) {
817
+ case ".":
818
+ buffer += read();
819
+ lexState = "decimalPoint";
820
+ return;
821
+ case "e":
822
+ case "E":
823
+ buffer += read();
824
+ lexState = "decimalExponent";
825
+ return;
826
+ case "x":
827
+ case "X":
828
+ buffer += read();
829
+ lexState = "hexadecimal";
830
+ return;
831
+ }
832
+ return newToken("numeric", sign * 0);
833
+ },
834
+ decimalInteger() {
835
+ switch (c) {
836
+ case ".":
837
+ buffer += read();
838
+ lexState = "decimalPoint";
839
+ return;
840
+ case "e":
841
+ case "E":
842
+ buffer += read();
843
+ lexState = "decimalExponent";
844
+ return;
845
+ }
846
+ if (util.isDigit(c)) {
847
+ buffer += read();
848
+ return;
849
+ }
850
+ return newToken("numeric", sign * Number(buffer));
851
+ },
852
+ decimalPointLeading() {
853
+ if (util.isDigit(c)) {
854
+ buffer += read();
855
+ lexState = "decimalFraction";
856
+ return;
857
+ }
858
+ throw invalidChar(read());
859
+ },
860
+ decimalPoint() {
861
+ switch (c) {
862
+ case "e":
863
+ case "E":
864
+ buffer += read();
865
+ lexState = "decimalExponent";
866
+ return;
867
+ }
868
+ if (util.isDigit(c)) {
869
+ buffer += read();
870
+ lexState = "decimalFraction";
871
+ return;
872
+ }
873
+ return newToken("numeric", sign * Number(buffer));
874
+ },
875
+ decimalFraction() {
876
+ switch (c) {
877
+ case "e":
878
+ case "E":
879
+ buffer += read();
880
+ lexState = "decimalExponent";
881
+ return;
882
+ }
883
+ if (util.isDigit(c)) {
884
+ buffer += read();
885
+ return;
886
+ }
887
+ return newToken("numeric", sign * Number(buffer));
888
+ },
889
+ decimalExponent() {
890
+ switch (c) {
891
+ case "+":
892
+ case "-":
893
+ buffer += read();
894
+ lexState = "decimalExponentSign";
895
+ return;
896
+ }
897
+ if (util.isDigit(c)) {
898
+ buffer += read();
899
+ lexState = "decimalExponentInteger";
900
+ return;
901
+ }
902
+ throw invalidChar(read());
903
+ },
904
+ decimalExponentSign() {
905
+ if (util.isDigit(c)) {
906
+ buffer += read();
907
+ lexState = "decimalExponentInteger";
908
+ return;
909
+ }
910
+ throw invalidChar(read());
911
+ },
912
+ decimalExponentInteger() {
913
+ if (util.isDigit(c)) {
914
+ buffer += read();
915
+ return;
916
+ }
917
+ return newToken("numeric", sign * Number(buffer));
918
+ },
919
+ hexadecimal() {
920
+ if (util.isHexDigit(c)) {
921
+ buffer += read();
922
+ lexState = "hexadecimalInteger";
923
+ return;
924
+ }
925
+ throw invalidChar(read());
926
+ },
927
+ hexadecimalInteger() {
928
+ if (util.isHexDigit(c)) {
929
+ buffer += read();
930
+ return;
931
+ }
932
+ return newToken("numeric", sign * Number(buffer));
933
+ },
934
+ string() {
935
+ switch (c) {
936
+ case "\\":
937
+ read();
938
+ buffer += escape();
939
+ return;
940
+ case '"':
941
+ if (doubleQuote) {
942
+ read();
943
+ return newToken("string", buffer);
944
+ }
945
+ buffer += read();
946
+ return;
947
+ case "'":
948
+ if (!doubleQuote) {
949
+ read();
950
+ return newToken("string", buffer);
951
+ }
952
+ buffer += read();
953
+ return;
954
+ case "\n":
955
+ case "\r":
956
+ throw invalidChar(read());
957
+ case "\u2028":
958
+ case "\u2029":
959
+ separatorChar(c);
960
+ break;
961
+ case void 0:
962
+ throw invalidChar(read());
963
+ }
964
+ buffer += read();
965
+ },
966
+ start() {
967
+ switch (c) {
968
+ case "{":
969
+ case "[":
970
+ return newToken("punctuator", read());
971
+ }
972
+ lexState = "value";
973
+ },
974
+ beforePropertyName() {
975
+ switch (c) {
976
+ case "$":
977
+ case "_":
978
+ buffer = read();
979
+ lexState = "identifierName";
980
+ return;
981
+ case "\\":
982
+ read();
983
+ lexState = "identifierNameStartEscape";
984
+ return;
985
+ case "}":
986
+ return newToken("punctuator", read());
987
+ case '"':
988
+ case "'":
989
+ doubleQuote = read() === '"';
990
+ lexState = "string";
991
+ return;
992
+ }
993
+ if (util.isIdStartChar(c)) {
994
+ buffer += read();
995
+ lexState = "identifierName";
996
+ return;
997
+ }
998
+ throw invalidChar(read());
999
+ },
1000
+ afterPropertyName() {
1001
+ if (c === ":") {
1002
+ return newToken("punctuator", read());
1003
+ }
1004
+ throw invalidChar(read());
1005
+ },
1006
+ beforePropertyValue() {
1007
+ lexState = "value";
1008
+ },
1009
+ afterPropertyValue() {
1010
+ switch (c) {
1011
+ case ",":
1012
+ case "}":
1013
+ return newToken("punctuator", read());
1014
+ }
1015
+ throw invalidChar(read());
1016
+ },
1017
+ beforeArrayValue() {
1018
+ if (c === "]") {
1019
+ return newToken("punctuator", read());
1020
+ }
1021
+ lexState = "value";
1022
+ },
1023
+ afterArrayValue() {
1024
+ switch (c) {
1025
+ case ",":
1026
+ case "]":
1027
+ return newToken("punctuator", read());
1028
+ }
1029
+ throw invalidChar(read());
1030
+ },
1031
+ end() {
1032
+ throw invalidChar(read());
1033
+ }
1034
+ };
1035
+ function newToken(type, value) {
1036
+ return {
1037
+ type,
1038
+ value,
1039
+ line,
1040
+ column
1041
+ };
1042
+ }
1043
+ __name(newToken, "newToken");
1044
+ function literal(s) {
1045
+ for (const c2 of s) {
1046
+ const p = peek();
1047
+ if (p !== c2) {
1048
+ throw invalidChar(read());
1049
+ }
1050
+ read();
1051
+ }
1052
+ }
1053
+ __name(literal, "literal");
1054
+ function escape() {
1055
+ const c2 = peek();
1056
+ switch (c2) {
1057
+ case "b":
1058
+ read();
1059
+ return "\b";
1060
+ case "f":
1061
+ read();
1062
+ return "\f";
1063
+ case "n":
1064
+ read();
1065
+ return "\n";
1066
+ case "r":
1067
+ read();
1068
+ return "\r";
1069
+ case "t":
1070
+ read();
1071
+ return " ";
1072
+ case "v":
1073
+ read();
1074
+ return "\v";
1075
+ case "0":
1076
+ read();
1077
+ if (util.isDigit(peek())) {
1078
+ throw invalidChar(read());
1079
+ }
1080
+ return "\0";
1081
+ case "x":
1082
+ read();
1083
+ return hexEscape();
1084
+ case "u":
1085
+ read();
1086
+ return unicodeEscape();
1087
+ case "\n":
1088
+ case "\u2028":
1089
+ case "\u2029":
1090
+ read();
1091
+ return "";
1092
+ case "\r":
1093
+ read();
1094
+ if (peek() === "\n") {
1095
+ read();
1096
+ }
1097
+ return "";
1098
+ case "1":
1099
+ case "2":
1100
+ case "3":
1101
+ case "4":
1102
+ case "5":
1103
+ case "6":
1104
+ case "7":
1105
+ case "8":
1106
+ case "9":
1107
+ throw invalidChar(read());
1108
+ case void 0:
1109
+ throw invalidChar(read());
1110
+ }
1111
+ return read();
1112
+ }
1113
+ __name(escape, "escape");
1114
+ function hexEscape() {
1115
+ let buffer2 = "";
1116
+ let c2 = peek();
1117
+ if (!util.isHexDigit(c2)) {
1118
+ throw invalidChar(read());
1119
+ }
1120
+ buffer2 += read();
1121
+ c2 = peek();
1122
+ if (!util.isHexDigit(c2)) {
1123
+ throw invalidChar(read());
1124
+ }
1125
+ buffer2 += read();
1126
+ return String.fromCodePoint(parseInt(buffer2, 16));
1127
+ }
1128
+ __name(hexEscape, "hexEscape");
1129
+ function unicodeEscape() {
1130
+ let buffer2 = "";
1131
+ let count = 4;
1132
+ while (count-- > 0) {
1133
+ const c2 = peek();
1134
+ if (!util.isHexDigit(c2)) {
1135
+ throw invalidChar(read());
1136
+ }
1137
+ buffer2 += read();
1138
+ }
1139
+ return String.fromCodePoint(parseInt(buffer2, 16));
1140
+ }
1141
+ __name(unicodeEscape, "unicodeEscape");
1142
+ var parseStates = {
1143
+ start() {
1144
+ if (token.type === "eof") {
1145
+ throw invalidEOF();
1146
+ }
1147
+ push();
1148
+ },
1149
+ beforePropertyName() {
1150
+ switch (token.type) {
1151
+ case "identifier":
1152
+ case "string":
1153
+ key = token.value;
1154
+ parseState = "afterPropertyName";
1155
+ return;
1156
+ case "punctuator":
1157
+ pop();
1158
+ return;
1159
+ case "eof":
1160
+ throw invalidEOF();
1161
+ }
1162
+ },
1163
+ afterPropertyName() {
1164
+ if (token.type === "eof") {
1165
+ throw invalidEOF();
1166
+ }
1167
+ parseState = "beforePropertyValue";
1168
+ },
1169
+ beforePropertyValue() {
1170
+ if (token.type === "eof") {
1171
+ throw invalidEOF();
1172
+ }
1173
+ push();
1174
+ },
1175
+ beforeArrayValue() {
1176
+ if (token.type === "eof") {
1177
+ throw invalidEOF();
1178
+ }
1179
+ if (token.type === "punctuator" && token.value === "]") {
1180
+ pop();
1181
+ return;
1182
+ }
1183
+ push();
1184
+ },
1185
+ afterPropertyValue() {
1186
+ if (token.type === "eof") {
1187
+ throw invalidEOF();
1188
+ }
1189
+ switch (token.value) {
1190
+ case ",":
1191
+ parseState = "beforePropertyName";
1192
+ return;
1193
+ case "}":
1194
+ pop();
1195
+ }
1196
+ },
1197
+ afterArrayValue() {
1198
+ if (token.type === "eof") {
1199
+ throw invalidEOF();
1200
+ }
1201
+ switch (token.value) {
1202
+ case ",":
1203
+ parseState = "beforeArrayValue";
1204
+ return;
1205
+ case "]":
1206
+ pop();
1207
+ }
1208
+ },
1209
+ end() {
1210
+ }
1211
+ };
1212
+ function push() {
1213
+ let value;
1214
+ switch (token.type) {
1215
+ case "punctuator":
1216
+ switch (token.value) {
1217
+ case "{":
1218
+ value = {};
1219
+ break;
1220
+ case "[":
1221
+ value = [];
1222
+ break;
1223
+ }
1224
+ break;
1225
+ case "null":
1226
+ case "boolean":
1227
+ case "numeric":
1228
+ case "string":
1229
+ value = token.value;
1230
+ break;
1231
+ }
1232
+ if (root === void 0) {
1233
+ root = value;
1234
+ } else {
1235
+ const parent = stack[stack.length - 1];
1236
+ if (Array.isArray(parent)) {
1237
+ parent.push(value);
1238
+ } else {
1239
+ Object.defineProperty(parent, key, {
1240
+ value,
1241
+ writable: true,
1242
+ enumerable: true,
1243
+ configurable: true
1244
+ });
1245
+ }
1246
+ }
1247
+ if (value !== null && typeof value === "object") {
1248
+ stack.push(value);
1249
+ if (Array.isArray(value)) {
1250
+ parseState = "beforeArrayValue";
1251
+ } else {
1252
+ parseState = "beforePropertyName";
1253
+ }
1254
+ } else {
1255
+ const current = stack[stack.length - 1];
1256
+ if (current == null) {
1257
+ parseState = "end";
1258
+ } else if (Array.isArray(current)) {
1259
+ parseState = "afterArrayValue";
1260
+ } else {
1261
+ parseState = "afterPropertyValue";
1262
+ }
1263
+ }
1264
+ }
1265
+ __name(push, "push");
1266
+ function pop() {
1267
+ stack.pop();
1268
+ const current = stack[stack.length - 1];
1269
+ if (current == null) {
1270
+ parseState = "end";
1271
+ } else if (Array.isArray(current)) {
1272
+ parseState = "afterArrayValue";
1273
+ } else {
1274
+ parseState = "afterPropertyValue";
1275
+ }
1276
+ }
1277
+ __name(pop, "pop");
1278
+ function invalidChar(c2) {
1279
+ if (c2 === void 0) {
1280
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
1281
+ }
1282
+ return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
1283
+ }
1284
+ __name(invalidChar, "invalidChar");
1285
+ function invalidEOF() {
1286
+ return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
1287
+ }
1288
+ __name(invalidEOF, "invalidEOF");
1289
+ function invalidIdentifier() {
1290
+ column -= 5;
1291
+ return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
1292
+ }
1293
+ __name(invalidIdentifier, "invalidIdentifier");
1294
+ function separatorChar(c2) {
1295
+ console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
1296
+ }
1297
+ __name(separatorChar, "separatorChar");
1298
+ function formatChar(c2) {
1299
+ const replacements = {
1300
+ "'": "\\'",
1301
+ '"': '\\"',
1302
+ "\\": "\\\\",
1303
+ "\b": "\\b",
1304
+ "\f": "\\f",
1305
+ "\n": "\\n",
1306
+ "\r": "\\r",
1307
+ " ": "\\t",
1308
+ "\v": "\\v",
1309
+ "\0": "\\0",
1310
+ "\u2028": "\\u2028",
1311
+ "\u2029": "\\u2029"
1312
+ };
1313
+ if (replacements[c2]) {
1314
+ return replacements[c2];
1315
+ }
1316
+ if (c2 < " ") {
1317
+ const hexString = c2.charCodeAt(0).toString(16);
1318
+ return "\\x" + ("00" + hexString).substring(hexString.length);
1319
+ }
1320
+ return c2;
1321
+ }
1322
+ __name(formatChar, "formatChar");
1323
+ function syntaxError(message) {
1324
+ const err = new SyntaxError(message);
1325
+ err.lineNumber = line;
1326
+ err.columnNumber = column;
1327
+ return err;
1328
+ }
1329
+ __name(syntaxError, "syntaxError");
1330
+ }
1331
+ });
1332
+
1333
+ // ../../node_modules/json5/lib/stringify.js
1334
+ var require_stringify = __commonJS({
1335
+ "../../node_modules/json5/lib/stringify.js"(exports, module) {
1336
+ var util = require_util();
1337
+ module.exports = /* @__PURE__ */ __name(function stringify2(value, replacer, space) {
1338
+ const stack = [];
1339
+ let indent2 = "";
1340
+ let propertyList;
1341
+ let replacerFunc;
1342
+ let gap = "";
1343
+ let quote;
1344
+ if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
1345
+ space = replacer.space;
1346
+ quote = replacer.quote;
1347
+ replacer = replacer.replacer;
1348
+ }
1349
+ if (typeof replacer === "function") {
1350
+ replacerFunc = replacer;
1351
+ } else if (Array.isArray(replacer)) {
1352
+ propertyList = [];
1353
+ for (const v of replacer) {
1354
+ let item;
1355
+ if (typeof v === "string") {
1356
+ item = v;
1357
+ } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
1358
+ item = String(v);
1359
+ }
1360
+ if (item !== void 0 && propertyList.indexOf(item) < 0) {
1361
+ propertyList.push(item);
1362
+ }
1363
+ }
1364
+ }
1365
+ if (space instanceof Number) {
1366
+ space = Number(space);
1367
+ } else if (space instanceof String) {
1368
+ space = String(space);
1369
+ }
1370
+ if (typeof space === "number") {
1371
+ if (space > 0) {
1372
+ space = Math.min(10, Math.floor(space));
1373
+ gap = " ".substr(0, space);
1374
+ }
1375
+ } else if (typeof space === "string") {
1376
+ gap = space.substr(0, 10);
1377
+ }
1378
+ return serializeProperty("", { "": value });
1379
+ function serializeProperty(key, holder) {
1380
+ let value2 = holder[key];
1381
+ if (value2 != null) {
1382
+ if (typeof value2.toJSON5 === "function") {
1383
+ value2 = value2.toJSON5(key);
1384
+ } else if (typeof value2.toJSON === "function") {
1385
+ value2 = value2.toJSON(key);
1386
+ }
1387
+ }
1388
+ if (replacerFunc) {
1389
+ value2 = replacerFunc.call(holder, key, value2);
1390
+ }
1391
+ if (value2 instanceof Number) {
1392
+ value2 = Number(value2);
1393
+ } else if (value2 instanceof String) {
1394
+ value2 = String(value2);
1395
+ } else if (value2 instanceof Boolean) {
1396
+ value2 = value2.valueOf();
1397
+ }
1398
+ switch (value2) {
1399
+ case null:
1400
+ return "null";
1401
+ case true:
1402
+ return "true";
1403
+ case false:
1404
+ return "false";
1405
+ }
1406
+ if (typeof value2 === "string") {
1407
+ return quoteString(value2, false);
1408
+ }
1409
+ if (typeof value2 === "number") {
1410
+ return String(value2);
1411
+ }
1412
+ if (typeof value2 === "object") {
1413
+ return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
1414
+ }
1415
+ return void 0;
1416
+ }
1417
+ __name(serializeProperty, "serializeProperty");
1418
+ function quoteString(value2) {
1419
+ const quotes = {
1420
+ "'": 0.1,
1421
+ '"': 0.2
1422
+ };
1423
+ const replacements = {
1424
+ "'": "\\'",
1425
+ '"': '\\"',
1426
+ "\\": "\\\\",
1427
+ "\b": "\\b",
1428
+ "\f": "\\f",
1429
+ "\n": "\\n",
1430
+ "\r": "\\r",
1431
+ " ": "\\t",
1432
+ "\v": "\\v",
1433
+ "\0": "\\0",
1434
+ "\u2028": "\\u2028",
1435
+ "\u2029": "\\u2029"
1436
+ };
1437
+ let product = "";
1438
+ for (let i = 0; i < value2.length; i++) {
1439
+ const c = value2[i];
1440
+ switch (c) {
1441
+ case "'":
1442
+ case '"':
1443
+ quotes[c]++;
1444
+ product += c;
1445
+ continue;
1446
+ case "\0":
1447
+ if (util.isDigit(value2[i + 1])) {
1448
+ product += "\\x00";
1449
+ continue;
1450
+ }
1451
+ }
1452
+ if (replacements[c]) {
1453
+ product += replacements[c];
1454
+ continue;
1455
+ }
1456
+ if (c < " ") {
1457
+ let hexString = c.charCodeAt(0).toString(16);
1458
+ product += "\\x" + ("00" + hexString).substring(hexString.length);
1459
+ continue;
1460
+ }
1461
+ product += c;
1462
+ }
1463
+ const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
1464
+ product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
1465
+ return quoteChar + product + quoteChar;
1466
+ }
1467
+ __name(quoteString, "quoteString");
1468
+ function serializeObject(value2) {
1469
+ if (stack.indexOf(value2) >= 0) {
1470
+ throw TypeError("Converting circular structure to JSON5");
1471
+ }
1472
+ stack.push(value2);
1473
+ let stepback = indent2;
1474
+ indent2 = indent2 + gap;
1475
+ let keys = propertyList || Object.keys(value2);
1476
+ let partial = [];
1477
+ for (const key of keys) {
1478
+ const propertyString = serializeProperty(key, value2);
1479
+ if (propertyString !== void 0) {
1480
+ let member = serializeKey(key) + ":";
1481
+ if (gap !== "") {
1482
+ member += " ";
1483
+ }
1484
+ member += propertyString;
1485
+ partial.push(member);
1486
+ }
1487
+ }
1488
+ let final;
1489
+ if (partial.length === 0) {
1490
+ final = "{}";
1491
+ } else {
1492
+ let properties;
1493
+ if (gap === "") {
1494
+ properties = partial.join(",");
1495
+ final = "{" + properties + "}";
1496
+ } else {
1497
+ let separator = ",\n" + indent2;
1498
+ properties = partial.join(separator);
1499
+ final = "{\n" + indent2 + properties + ",\n" + stepback + "}";
1500
+ }
1501
+ }
1502
+ stack.pop();
1503
+ indent2 = stepback;
1504
+ return final;
1505
+ }
1506
+ __name(serializeObject, "serializeObject");
1507
+ function serializeKey(key) {
1508
+ if (key.length === 0) {
1509
+ return quoteString(key, true);
1510
+ }
1511
+ const firstChar = String.fromCodePoint(key.codePointAt(0));
1512
+ if (!util.isIdStartChar(firstChar)) {
1513
+ return quoteString(key, true);
1514
+ }
1515
+ for (let i = firstChar.length; i < key.length; i++) {
1516
+ if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
1517
+ return quoteString(key, true);
1518
+ }
1519
+ }
1520
+ return key;
1521
+ }
1522
+ __name(serializeKey, "serializeKey");
1523
+ function serializeArray(value2) {
1524
+ if (stack.indexOf(value2) >= 0) {
1525
+ throw TypeError("Converting circular structure to JSON5");
1526
+ }
1527
+ stack.push(value2);
1528
+ let stepback = indent2;
1529
+ indent2 = indent2 + gap;
1530
+ let partial = [];
1531
+ for (let i = 0; i < value2.length; i++) {
1532
+ const propertyString = serializeProperty(String(i), value2);
1533
+ partial.push(propertyString !== void 0 ? propertyString : "null");
1534
+ }
1535
+ let final;
1536
+ if (partial.length === 0) {
1537
+ final = "[]";
1538
+ } else {
1539
+ if (gap === "") {
1540
+ let properties = partial.join(",");
1541
+ final = "[" + properties + "]";
1542
+ } else {
1543
+ let separator = ",\n" + indent2;
1544
+ let properties = partial.join(separator);
1545
+ final = "[\n" + indent2 + properties + ",\n" + stepback + "]";
1546
+ }
1547
+ }
1548
+ stack.pop();
1549
+ indent2 = stepback;
1550
+ return final;
1551
+ }
1552
+ __name(serializeArray, "serializeArray");
1553
+ }, "stringify");
1554
+ }
1555
+ });
1556
+
1557
+ // ../../node_modules/json5/lib/index.js
1558
+ var require_lib = __commonJS({
1559
+ "../../node_modules/json5/lib/index.js"(exports, module) {
1560
+ var parse4 = require_parse();
1561
+ var stringify2 = require_stringify();
1562
+ var JSON5 = {
1563
+ parse: parse4,
1564
+ stringify: stringify2
1565
+ };
1566
+ module.exports = JSON5;
1567
+ }
1568
+ });
1569
+
1570
+ // ../../node_modules/strip-bom/index.js
1571
+ var require_strip_bom = __commonJS({
1572
+ "../../node_modules/strip-bom/index.js"(exports, module) {
1573
+ "use strict";
1574
+ module.exports = (x) => {
1575
+ if (typeof x !== "string") {
1576
+ throw new TypeError("Expected a string, got " + typeof x);
1577
+ }
1578
+ if (x.charCodeAt(0) === 65279) {
1579
+ return x.slice(1);
1580
+ }
1581
+ return x;
1582
+ };
1583
+ }
1584
+ });
1585
+
1586
+ // ../../node_modules/tsconfig-paths/lib/tsconfig-loader.js
1587
+ var require_tsconfig_loader = __commonJS({
1588
+ "../../node_modules/tsconfig-paths/lib/tsconfig-loader.js"(exports) {
1589
+ "use strict";
1590
+ var __assign = exports && exports.__assign || function() {
1591
+ __assign = Object.assign || function(t4) {
1592
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1593
+ s = arguments[i];
1594
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
1595
+ t4[p] = s[p];
1596
+ }
1597
+ return t4;
1598
+ };
1599
+ return __assign.apply(this, arguments);
1600
+ };
1601
+ Object.defineProperty(exports, "__esModule", { value: true });
1602
+ exports.loadTsconfig = exports.walkForTsConfig = exports.tsConfigLoader = void 0;
1603
+ var path2 = __require("path");
1604
+ var fs = __require("fs");
1605
+ var JSON5 = require_lib();
1606
+ var StripBom = require_strip_bom();
1607
+ function tsConfigLoader(_a) {
1608
+ var getEnv = _a.getEnv, cwd2 = _a.cwd, _b = _a.loadSync, loadSync = _b === void 0 ? loadSyncDefault : _b;
1609
+ var TS_NODE_PROJECT = getEnv("TS_NODE_PROJECT");
1610
+ var TS_NODE_BASEURL = getEnv("TS_NODE_BASEURL");
1611
+ var loadResult = loadSync(cwd2, TS_NODE_PROJECT, TS_NODE_BASEURL);
1612
+ return loadResult;
1613
+ }
1614
+ __name(tsConfigLoader, "tsConfigLoader");
1615
+ exports.tsConfigLoader = tsConfigLoader;
1616
+ function loadSyncDefault(cwd2, filename, baseUrl) {
1617
+ var configPath = resolveConfigPath(cwd2, filename);
1618
+ if (!configPath) {
1619
+ return {
1620
+ tsConfigPath: void 0,
1621
+ baseUrl: void 0,
1622
+ paths: void 0
1623
+ };
1624
+ }
1625
+ var config = loadTsconfig(configPath);
1626
+ return {
1627
+ tsConfigPath: configPath,
1628
+ baseUrl: baseUrl || config && config.compilerOptions && config.compilerOptions.baseUrl,
1629
+ paths: config && config.compilerOptions && config.compilerOptions.paths
1630
+ };
1631
+ }
1632
+ __name(loadSyncDefault, "loadSyncDefault");
1633
+ function resolveConfigPath(cwd2, filename) {
1634
+ if (filename) {
1635
+ var absolutePath = fs.lstatSync(filename).isDirectory() ? path2.resolve(filename, "./tsconfig.json") : path2.resolve(cwd2, filename);
1636
+ return absolutePath;
1637
+ }
1638
+ if (fs.statSync(cwd2).isFile()) {
1639
+ return path2.resolve(cwd2);
1640
+ }
1641
+ var configAbsolutePath = walkForTsConfig(cwd2);
1642
+ return configAbsolutePath ? path2.resolve(configAbsolutePath) : void 0;
1643
+ }
1644
+ __name(resolveConfigPath, "resolveConfigPath");
1645
+ function walkForTsConfig(directory, readdirSync) {
1646
+ if (readdirSync === void 0) {
1647
+ readdirSync = fs.readdirSync;
1648
+ }
1649
+ var files = readdirSync(directory);
1650
+ var filesToCheck = ["tsconfig.json", "jsconfig.json"];
1651
+ for (var _i = 0, filesToCheck_1 = filesToCheck; _i < filesToCheck_1.length; _i++) {
1652
+ var fileToCheck = filesToCheck_1[_i];
1653
+ if (files.indexOf(fileToCheck) !== -1) {
1654
+ return path2.join(directory, fileToCheck);
1655
+ }
1656
+ }
1657
+ var parentDirectory = path2.dirname(directory);
1658
+ if (directory === parentDirectory) {
1659
+ return void 0;
1660
+ }
1661
+ return walkForTsConfig(parentDirectory, readdirSync);
1662
+ }
1663
+ __name(walkForTsConfig, "walkForTsConfig");
1664
+ exports.walkForTsConfig = walkForTsConfig;
1665
+ function loadTsconfig(configFilePath, existsSync3, readFileSync) {
1666
+ if (existsSync3 === void 0) {
1667
+ existsSync3 = fs.existsSync;
1668
+ }
1669
+ if (readFileSync === void 0) {
1670
+ readFileSync = /* @__PURE__ */ __name(function(filename) {
1671
+ return fs.readFileSync(filename, "utf8");
1672
+ }, "readFileSync");
1673
+ }
1674
+ if (!existsSync3(configFilePath)) {
1675
+ return void 0;
1676
+ }
1677
+ var configString = readFileSync(configFilePath);
1678
+ var cleanedJson = StripBom(configString);
1679
+ var config;
1680
+ try {
1681
+ config = JSON5.parse(cleanedJson);
1682
+ } catch (e) {
1683
+ throw new Error("".concat(configFilePath, " is malformed ").concat(e.message));
1684
+ }
1685
+ var extendedConfig = config.extends;
1686
+ if (extendedConfig) {
1687
+ var base = void 0;
1688
+ if (Array.isArray(extendedConfig)) {
1689
+ base = extendedConfig.reduce(function(currBase, extendedConfigElement) {
1690
+ return mergeTsconfigs(currBase, loadTsconfigFromExtends(configFilePath, extendedConfigElement, existsSync3, readFileSync));
1691
+ }, {});
1692
+ } else {
1693
+ base = loadTsconfigFromExtends(configFilePath, extendedConfig, existsSync3, readFileSync);
1694
+ }
1695
+ return mergeTsconfigs(base, config);
1696
+ }
1697
+ return config;
1698
+ }
1699
+ __name(loadTsconfig, "loadTsconfig");
1700
+ exports.loadTsconfig = loadTsconfig;
1701
+ function loadTsconfigFromExtends(configFilePath, extendedConfigValue, existsSync3, readFileSync) {
1702
+ var _a;
1703
+ if (typeof extendedConfigValue === "string" && extendedConfigValue.indexOf(".json") === -1) {
1704
+ extendedConfigValue += ".json";
1705
+ }
1706
+ var currentDir = path2.dirname(configFilePath);
1707
+ var extendedConfigPath = path2.join(currentDir, extendedConfigValue);
1708
+ if (extendedConfigValue.indexOf("/") !== -1 && extendedConfigValue.indexOf(".") !== -1 && !existsSync3(extendedConfigPath)) {
1709
+ extendedConfigPath = path2.join(currentDir, "node_modules", extendedConfigValue);
1710
+ }
1711
+ var config = loadTsconfig(extendedConfigPath, existsSync3, readFileSync) || {};
1712
+ if ((_a = config.compilerOptions) === null || _a === void 0 ? void 0 : _a.baseUrl) {
1713
+ var extendsDir = path2.dirname(extendedConfigValue);
1714
+ config.compilerOptions.baseUrl = path2.join(extendsDir, config.compilerOptions.baseUrl);
1715
+ }
1716
+ return config;
1717
+ }
1718
+ __name(loadTsconfigFromExtends, "loadTsconfigFromExtends");
1719
+ function mergeTsconfigs(base, config) {
1720
+ base = base || {};
1721
+ config = config || {};
1722
+ return __assign(__assign(__assign({}, base), config), { compilerOptions: __assign(__assign({}, base.compilerOptions), config.compilerOptions) });
1723
+ }
1724
+ __name(mergeTsconfigs, "mergeTsconfigs");
1725
+ }
1726
+ });
1727
+
1728
+ // ../../node_modules/tsconfig-paths/lib/config-loader.js
1729
+ var require_config_loader = __commonJS({
1730
+ "../../node_modules/tsconfig-paths/lib/config-loader.js"(exports) {
1731
+ "use strict";
1732
+ Object.defineProperty(exports, "__esModule", { value: true });
1733
+ exports.configLoader = exports.loadConfig = void 0;
1734
+ var TsConfigLoader2 = require_tsconfig_loader();
1735
+ var path2 = __require("path");
1736
+ function loadConfig2(cwd2) {
1737
+ if (cwd2 === void 0) {
1738
+ cwd2 = process.cwd();
1739
+ }
1740
+ return configLoader({ cwd: cwd2 });
1741
+ }
1742
+ __name(loadConfig2, "loadConfig");
1743
+ exports.loadConfig = loadConfig2;
1744
+ function configLoader(_a) {
1745
+ var cwd2 = _a.cwd, explicitParams = _a.explicitParams, _b = _a.tsConfigLoader, tsConfigLoader = _b === void 0 ? TsConfigLoader2.tsConfigLoader : _b;
1746
+ if (explicitParams) {
1747
+ var absoluteBaseUrl = path2.isAbsolute(explicitParams.baseUrl) ? explicitParams.baseUrl : path2.join(cwd2, explicitParams.baseUrl);
1748
+ return {
1749
+ resultType: "success",
1750
+ configFileAbsolutePath: "",
1751
+ baseUrl: explicitParams.baseUrl,
1752
+ absoluteBaseUrl,
1753
+ paths: explicitParams.paths,
1754
+ mainFields: explicitParams.mainFields,
1755
+ addMatchAll: explicitParams.addMatchAll
1756
+ };
1757
+ }
1758
+ var loadResult = tsConfigLoader({
1759
+ cwd: cwd2,
1760
+ getEnv: /* @__PURE__ */ __name(function(key) {
1761
+ return process.env[key];
1762
+ }, "getEnv")
1763
+ });
1764
+ if (!loadResult.tsConfigPath) {
1765
+ return {
1766
+ resultType: "failed",
1767
+ message: "Couldn't find tsconfig.json"
1768
+ };
1769
+ }
1770
+ return {
1771
+ resultType: "success",
1772
+ configFileAbsolutePath: loadResult.tsConfigPath,
1773
+ baseUrl: loadResult.baseUrl,
1774
+ absoluteBaseUrl: path2.resolve(path2.dirname(loadResult.tsConfigPath), loadResult.baseUrl || ""),
1775
+ paths: loadResult.paths || {},
1776
+ addMatchAll: loadResult.baseUrl !== void 0
1777
+ };
1778
+ }
1779
+ __name(configLoader, "configLoader");
1780
+ exports.configLoader = configLoader;
1781
+ }
1782
+ });
1783
+
1784
+ // ../../node_modules/minimist/index.js
1785
+ var require_minimist = __commonJS({
1786
+ "../../node_modules/minimist/index.js"(exports, module) {
1787
+ "use strict";
1788
+ function hasKey(obj, keys) {
1789
+ var o = obj;
1790
+ keys.slice(0, -1).forEach(function(key2) {
1791
+ o = o[key2] || {};
1792
+ });
1793
+ var key = keys[keys.length - 1];
1794
+ return key in o;
1795
+ }
1796
+ __name(hasKey, "hasKey");
1797
+ function isNumber(x) {
1798
+ if (typeof x === "number") {
1799
+ return true;
1800
+ }
1801
+ if (/^0x[0-9a-f]+$/i.test(x)) {
1802
+ return true;
1803
+ }
1804
+ return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
1805
+ }
1806
+ __name(isNumber, "isNumber");
1807
+ function isConstructorOrProto(obj, key) {
1808
+ return key === "constructor" && typeof obj[key] === "function" || key === "__proto__";
1809
+ }
1810
+ __name(isConstructorOrProto, "isConstructorOrProto");
1811
+ module.exports = function(args, opts) {
1812
+ if (!opts) {
1813
+ opts = {};
1814
+ }
1815
+ var flags = {
1816
+ bools: {},
1817
+ strings: {},
1818
+ unknownFn: null
1819
+ };
1820
+ if (typeof opts.unknown === "function") {
1821
+ flags.unknownFn = opts.unknown;
1822
+ }
1823
+ if (typeof opts.boolean === "boolean" && opts.boolean) {
1824
+ flags.allBools = true;
1825
+ } else {
1826
+ [].concat(opts.boolean).filter(Boolean).forEach(function(key2) {
1827
+ flags.bools[key2] = true;
1828
+ });
1829
+ }
1830
+ var aliases = {};
1831
+ function aliasIsBoolean(key2) {
1832
+ return aliases[key2].some(function(x) {
1833
+ return flags.bools[x];
1834
+ });
1835
+ }
1836
+ __name(aliasIsBoolean, "aliasIsBoolean");
1837
+ Object.keys(opts.alias || {}).forEach(function(key2) {
1838
+ aliases[key2] = [].concat(opts.alias[key2]);
1839
+ aliases[key2].forEach(function(x) {
1840
+ aliases[x] = [key2].concat(aliases[key2].filter(function(y) {
1841
+ return x !== y;
1842
+ }));
1843
+ });
1844
+ });
1845
+ [].concat(opts.string).filter(Boolean).forEach(function(key2) {
1846
+ flags.strings[key2] = true;
1847
+ if (aliases[key2]) {
1848
+ [].concat(aliases[key2]).forEach(function(k) {
1849
+ flags.strings[k] = true;
1850
+ });
1851
+ }
1852
+ });
1853
+ var defaults = opts.default || {};
1854
+ var argv = { _: [] };
1855
+ function argDefined(key2, arg2) {
1856
+ return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2];
1857
+ }
1858
+ __name(argDefined, "argDefined");
1859
+ function setKey(obj, keys, value2) {
1860
+ var o = obj;
1861
+ for (var i2 = 0; i2 < keys.length - 1; i2++) {
1862
+ var key2 = keys[i2];
1863
+ if (isConstructorOrProto(o, key2)) {
1864
+ return;
1865
+ }
1866
+ if (o[key2] === void 0) {
1867
+ o[key2] = {};
1868
+ }
1869
+ if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) {
1870
+ o[key2] = {};
1871
+ }
1872
+ if (o[key2] === Array.prototype) {
1873
+ o[key2] = [];
1874
+ }
1875
+ o = o[key2];
1876
+ }
1877
+ var lastKey = keys[keys.length - 1];
1878
+ if (isConstructorOrProto(o, lastKey)) {
1879
+ return;
1880
+ }
1881
+ if (o === Object.prototype || o === Number.prototype || o === String.prototype) {
1882
+ o = {};
1883
+ }
1884
+ if (o === Array.prototype) {
1885
+ o = [];
1886
+ }
1887
+ if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") {
1888
+ o[lastKey] = value2;
1889
+ } else if (Array.isArray(o[lastKey])) {
1890
+ o[lastKey].push(value2);
1891
+ } else {
1892
+ o[lastKey] = [o[lastKey], value2];
1893
+ }
1894
+ }
1895
+ __name(setKey, "setKey");
1896
+ function setArg(key2, val, arg2) {
1897
+ if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) {
1898
+ if (flags.unknownFn(arg2) === false) {
1899
+ return;
1900
+ }
1901
+ }
1902
+ var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val;
1903
+ setKey(argv, key2.split("."), value2);
1904
+ (aliases[key2] || []).forEach(function(x) {
1905
+ setKey(argv, x.split("."), value2);
1906
+ });
1907
+ }
1908
+ __name(setArg, "setArg");
1909
+ Object.keys(flags.bools).forEach(function(key2) {
1910
+ setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]);
1911
+ });
1912
+ var notFlags = [];
1913
+ if (args.indexOf("--") !== -1) {
1914
+ notFlags = args.slice(args.indexOf("--") + 1);
1915
+ args = args.slice(0, args.indexOf("--"));
1916
+ }
1917
+ for (var i = 0; i < args.length; i++) {
1918
+ var arg = args[i];
1919
+ var key;
1920
+ var next;
1921
+ if (/^--.+=/.test(arg)) {
1922
+ var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
1923
+ key = m[1];
1924
+ var value = m[2];
1925
+ if (flags.bools[key]) {
1926
+ value = value !== "false";
1927
+ }
1928
+ setArg(key, value, arg);
1929
+ } else if (/^--no-.+/.test(arg)) {
1930
+ key = arg.match(/^--no-(.+)/)[1];
1931
+ setArg(key, false, arg);
1932
+ } else if (/^--.+/.test(arg)) {
1933
+ key = arg.match(/^--(.+)/)[1];
1934
+ next = args[i + 1];
1935
+ if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) {
1936
+ setArg(key, next, arg);
1937
+ i += 1;
1938
+ } else if (/^(true|false)$/.test(next)) {
1939
+ setArg(key, next === "true", arg);
1940
+ i += 1;
1941
+ } else {
1942
+ setArg(key, flags.strings[key] ? "" : true, arg);
1943
+ }
1944
+ } else if (/^-[^-]+/.test(arg)) {
1945
+ var letters = arg.slice(1, -1).split("");
1946
+ var broken = false;
1947
+ for (var j = 0; j < letters.length; j++) {
1948
+ next = arg.slice(j + 2);
1949
+ if (next === "-") {
1950
+ setArg(letters[j], next, arg);
1951
+ continue;
1952
+ }
1953
+ if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") {
1954
+ setArg(letters[j], next.slice(1), arg);
1955
+ broken = true;
1956
+ break;
1957
+ }
1958
+ if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
1959
+ setArg(letters[j], next, arg);
1960
+ broken = true;
1961
+ break;
1962
+ }
1963
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
1964
+ setArg(letters[j], arg.slice(j + 2), arg);
1965
+ broken = true;
1966
+ break;
1967
+ } else {
1968
+ setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg);
1969
+ }
1970
+ }
1971
+ key = arg.slice(-1)[0];
1972
+ if (!broken && key !== "-") {
1973
+ if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) {
1974
+ setArg(key, args[i + 1], arg);
1975
+ i += 1;
1976
+ } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) {
1977
+ setArg(key, args[i + 1] === "true", arg);
1978
+ i += 1;
1979
+ } else {
1980
+ setArg(key, flags.strings[key] ? "" : true, arg);
1981
+ }
1982
+ }
1983
+ } else {
1984
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
1985
+ argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
1986
+ }
1987
+ if (opts.stopEarly) {
1988
+ argv._.push.apply(argv._, args.slice(i + 1));
1989
+ break;
1990
+ }
1991
+ }
1992
+ }
1993
+ Object.keys(defaults).forEach(function(k) {
1994
+ if (!hasKey(argv, k.split("."))) {
1995
+ setKey(argv, k.split("."), defaults[k]);
1996
+ (aliases[k] || []).forEach(function(x) {
1997
+ setKey(argv, x.split("."), defaults[k]);
1998
+ });
1999
+ }
2000
+ });
2001
+ if (opts["--"]) {
2002
+ argv["--"] = notFlags.slice();
2003
+ } else {
2004
+ notFlags.forEach(function(k) {
2005
+ argv._.push(k);
2006
+ });
2007
+ }
2008
+ return argv;
2009
+ };
2010
+ }
2011
+ });
2012
+
2013
+ // ../../node_modules/tsconfig-paths/lib/register.js
2014
+ var require_register = __commonJS({
2015
+ "../../node_modules/tsconfig-paths/lib/register.js"(exports) {
2016
+ "use strict";
2017
+ var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
2018
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
2019
+ if (ar || !(i in from)) {
2020
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
2021
+ ar[i] = from[i];
2022
+ }
2023
+ }
2024
+ return to.concat(ar || Array.prototype.slice.call(from));
2025
+ };
2026
+ Object.defineProperty(exports, "__esModule", { value: true });
2027
+ exports.register = void 0;
2028
+ var match_path_sync_1 = require_match_path_sync();
2029
+ var config_loader_1 = require_config_loader();
2030
+ var noOp = /* @__PURE__ */ __name(function() {
2031
+ return void 0;
2032
+ }, "noOp");
2033
+ function getCoreModules(builtinModules) {
2034
+ builtinModules = builtinModules || [
2035
+ "assert",
2036
+ "buffer",
2037
+ "child_process",
2038
+ "cluster",
2039
+ "crypto",
2040
+ "dgram",
2041
+ "dns",
2042
+ "domain",
2043
+ "events",
2044
+ "fs",
2045
+ "http",
2046
+ "https",
2047
+ "net",
2048
+ "os",
2049
+ "path",
2050
+ "punycode",
2051
+ "querystring",
2052
+ "readline",
2053
+ "stream",
2054
+ "string_decoder",
2055
+ "tls",
2056
+ "tty",
2057
+ "url",
2058
+ "util",
2059
+ "v8",
2060
+ "vm",
2061
+ "zlib"
2062
+ ];
2063
+ var coreModules = {};
2064
+ for (var _i = 0, builtinModules_1 = builtinModules; _i < builtinModules_1.length; _i++) {
2065
+ var module_1 = builtinModules_1[_i];
2066
+ coreModules[module_1] = true;
2067
+ }
2068
+ return coreModules;
2069
+ }
2070
+ __name(getCoreModules, "getCoreModules");
2071
+ function register(params) {
2072
+ var cwd2;
2073
+ var explicitParams;
2074
+ if (params) {
2075
+ cwd2 = params.cwd;
2076
+ if (params.baseUrl || params.paths) {
2077
+ explicitParams = params;
2078
+ }
2079
+ } else {
2080
+ var minimist = require_minimist();
2081
+ var argv = minimist(process.argv.slice(2), {
2082
+ // eslint-disable-next-line id-denylist
2083
+ string: ["project"],
2084
+ alias: {
2085
+ project: ["P"]
2086
+ }
2087
+ });
2088
+ cwd2 = argv.project;
2089
+ }
2090
+ var configLoaderResult = (0, config_loader_1.configLoader)({
2091
+ cwd: cwd2 !== null && cwd2 !== void 0 ? cwd2 : process.cwd(),
2092
+ explicitParams
2093
+ });
2094
+ if (configLoaderResult.resultType === "failed") {
2095
+ console.warn("".concat(configLoaderResult.message, ". tsconfig-paths will be skipped"));
2096
+ return noOp;
2097
+ }
2098
+ var matchPath = (0, match_path_sync_1.createMatchPath)(configLoaderResult.absoluteBaseUrl, configLoaderResult.paths, configLoaderResult.mainFields, configLoaderResult.addMatchAll);
2099
+ var Module = __require("module");
2100
+ var originalResolveFilename = Module._resolveFilename;
2101
+ var coreModules = getCoreModules(Module.builtinModules);
2102
+ Module._resolveFilename = function(request, _parent) {
2103
+ var isCoreModule = coreModules.hasOwnProperty(request);
2104
+ if (!isCoreModule) {
2105
+ var found = matchPath(request);
2106
+ if (found) {
2107
+ var modifiedArguments = __spreadArray([found], [].slice.call(arguments, 1), true);
2108
+ return originalResolveFilename.apply(this, modifiedArguments);
2109
+ }
2110
+ }
2111
+ return originalResolveFilename.apply(this, arguments);
2112
+ };
2113
+ return function() {
2114
+ Module._resolveFilename = originalResolveFilename;
2115
+ };
2116
+ }
2117
+ __name(register, "register");
2118
+ exports.register = register;
2119
+ }
2120
+ });
2121
+
2122
+ // ../../node_modules/tsconfig-paths/lib/index.js
2123
+ var require_lib2 = __commonJS({
2124
+ "../../node_modules/tsconfig-paths/lib/index.js"(exports) {
2125
+ "use strict";
2126
+ Object.defineProperty(exports, "__esModule", { value: true });
2127
+ exports.loadConfig = exports.register = exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
2128
+ var match_path_sync_1 = require_match_path_sync();
2129
+ Object.defineProperty(exports, "createMatchPath", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2130
+ return match_path_sync_1.createMatchPath;
2131
+ }, "get") });
2132
+ Object.defineProperty(exports, "matchFromAbsolutePaths", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2133
+ return match_path_sync_1.matchFromAbsolutePaths;
2134
+ }, "get") });
2135
+ var match_path_async_1 = require_match_path_async();
2136
+ Object.defineProperty(exports, "createMatchPathAsync", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2137
+ return match_path_async_1.createMatchPathAsync;
2138
+ }, "get") });
2139
+ Object.defineProperty(exports, "matchFromAbsolutePathsAsync", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2140
+ return match_path_async_1.matchFromAbsolutePathsAsync;
2141
+ }, "get") });
2142
+ var register_1 = require_register();
2143
+ Object.defineProperty(exports, "register", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2144
+ return register_1.register;
2145
+ }, "get") });
2146
+ var config_loader_1 = require_config_loader();
2147
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2148
+ return config_loader_1.loadConfig;
2149
+ }, "get") });
2150
+ }
2151
+ });
2152
+
2153
+ // ../../node_modules/resolve/lib/homedir.js
2154
+ var require_homedir = __commonJS({
2155
+ "../../node_modules/resolve/lib/homedir.js"(exports, module) {
2156
+ "use strict";
2157
+ var os = __require("os");
2158
+ module.exports = os.homedir || /* @__PURE__ */ __name(function homedir() {
2159
+ var home = process.env.HOME;
2160
+ var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
2161
+ if (process.platform === "win32") {
2162
+ return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
2163
+ }
2164
+ if (process.platform === "darwin") {
2165
+ return home || (user ? "/Users/" + user : null);
2166
+ }
2167
+ if (process.platform === "linux") {
2168
+ return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
2169
+ }
2170
+ return home || null;
2171
+ }, "homedir");
2172
+ }
2173
+ });
2174
+
2175
+ // ../../node_modules/resolve/lib/caller.js
2176
+ var require_caller = __commonJS({
2177
+ "../../node_modules/resolve/lib/caller.js"(exports, module) {
2178
+ module.exports = function() {
2179
+ var origPrepareStackTrace = Error.prepareStackTrace;
2180
+ Error.prepareStackTrace = function(_, stack2) {
2181
+ return stack2;
2182
+ };
2183
+ var stack = new Error().stack;
2184
+ Error.prepareStackTrace = origPrepareStackTrace;
2185
+ return stack[2].getFileName();
2186
+ };
2187
+ }
2188
+ });
2189
+
2190
+ // ../../node_modules/path-parse/index.js
2191
+ var require_path_parse = __commonJS({
2192
+ "../../node_modules/path-parse/index.js"(exports, module) {
2193
+ "use strict";
2194
+ var isWindows2 = process.platform === "win32";
2195
+ var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
2196
+ var win32 = {};
2197
+ function win32SplitPath(filename) {
2198
+ return splitWindowsRe.exec(filename).slice(1);
2199
+ }
2200
+ __name(win32SplitPath, "win32SplitPath");
2201
+ win32.parse = function(pathString) {
2202
+ if (typeof pathString !== "string") {
2203
+ throw new TypeError(
2204
+ "Parameter 'pathString' must be a string, not " + typeof pathString
2205
+ );
2206
+ }
2207
+ var allParts = win32SplitPath(pathString);
2208
+ if (!allParts || allParts.length !== 5) {
2209
+ throw new TypeError("Invalid path '" + pathString + "'");
2210
+ }
2211
+ return {
2212
+ root: allParts[1],
2213
+ dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
2214
+ base: allParts[2],
2215
+ ext: allParts[4],
2216
+ name: allParts[3]
2217
+ };
2218
+ };
2219
+ var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
2220
+ var posix = {};
2221
+ function posixSplitPath(filename) {
2222
+ return splitPathRe.exec(filename).slice(1);
2223
+ }
2224
+ __name(posixSplitPath, "posixSplitPath");
2225
+ posix.parse = function(pathString) {
2226
+ if (typeof pathString !== "string") {
2227
+ throw new TypeError(
2228
+ "Parameter 'pathString' must be a string, not " + typeof pathString
2229
+ );
2230
+ }
2231
+ var allParts = posixSplitPath(pathString);
2232
+ if (!allParts || allParts.length !== 5) {
2233
+ throw new TypeError("Invalid path '" + pathString + "'");
2234
+ }
2235
+ return {
2236
+ root: allParts[1],
2237
+ dir: allParts[0].slice(0, -1),
2238
+ base: allParts[2],
2239
+ ext: allParts[4],
2240
+ name: allParts[3]
2241
+ };
2242
+ };
2243
+ if (isWindows2)
2244
+ module.exports = win32.parse;
2245
+ else
2246
+ module.exports = posix.parse;
2247
+ module.exports.posix = posix.parse;
2248
+ module.exports.win32 = win32.parse;
2249
+ }
2250
+ });
2251
+
2252
+ // ../../node_modules/resolve/lib/node-modules-paths.js
2253
+ var require_node_modules_paths = __commonJS({
2254
+ "../../node_modules/resolve/lib/node-modules-paths.js"(exports, module) {
2255
+ var path2 = __require("path");
2256
+ var parse4 = path2.parse || require_path_parse();
2257
+ var getNodeModulesDirs = /* @__PURE__ */ __name(function getNodeModulesDirs2(absoluteStart, modules) {
2258
+ var prefix = "/";
2259
+ if (/^([A-Za-z]:)/.test(absoluteStart)) {
2260
+ prefix = "";
2261
+ } else if (/^\\\\/.test(absoluteStart)) {
2262
+ prefix = "\\\\";
2263
+ }
2264
+ var paths = [absoluteStart];
2265
+ var parsed = parse4(absoluteStart);
2266
+ while (parsed.dir !== paths[paths.length - 1]) {
2267
+ paths.push(parsed.dir);
2268
+ parsed = parse4(parsed.dir);
2269
+ }
2270
+ return paths.reduce(function(dirs, aPath) {
2271
+ return dirs.concat(modules.map(function(moduleDir) {
2272
+ return path2.resolve(prefix, aPath, moduleDir);
2273
+ }));
2274
+ }, []);
2275
+ }, "getNodeModulesDirs");
2276
+ module.exports = /* @__PURE__ */ __name(function nodeModulesPaths(start, opts, request) {
2277
+ var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
2278
+ if (opts && typeof opts.paths === "function") {
2279
+ return opts.paths(
2280
+ request,
2281
+ start,
2282
+ function() {
2283
+ return getNodeModulesDirs(start, modules);
2284
+ },
2285
+ opts
2286
+ );
2287
+ }
2288
+ var dirs = getNodeModulesDirs(start, modules);
2289
+ return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
2290
+ }, "nodeModulesPaths");
2291
+ }
2292
+ });
2293
+
2294
+ // ../../node_modules/resolve/lib/normalize-options.js
2295
+ var require_normalize_options = __commonJS({
2296
+ "../../node_modules/resolve/lib/normalize-options.js"(exports, module) {
2297
+ var path2 = __require("path");
2298
+ module.exports = function(_, opts) {
2299
+ opts = opts || {};
2300
+ if (opts.forceNodeResolution || !process.versions.pnp)
2301
+ return opts;
2302
+ const { findPnpApi } = __require("module");
2303
+ const runPnpResolution = /* @__PURE__ */ __name((request, basedir) => {
2304
+ const parts = request.match(/^((?:@[^/]+\/)?[^/]+)(\/.*)?/);
2305
+ if (!parts)
2306
+ throw new Error(`Assertion failed: Expected the "resolve" package to call the "paths" callback with package names only (got "${request}")`);
2307
+ if (basedir.charAt(basedir.length - 1) !== `/`)
2308
+ basedir = path2.join(basedir, `/`);
2309
+ const api = findPnpApi(basedir);
2310
+ if (api === null)
2311
+ return void 0;
2312
+ let manifestPath;
2313
+ try {
2314
+ manifestPath = api.resolveToUnqualified(`${parts[1]}/package.json`, basedir, { considerBuiltins: false });
2315
+ } catch (err) {
2316
+ return null;
2317
+ }
2318
+ if (manifestPath === null)
2319
+ throw new Error(`Assertion failed: The resolution thinks that "${parts[1]}" is a Node builtin`);
2320
+ const packagePath = path2.dirname(manifestPath);
2321
+ const unqualifiedPath = typeof parts[2] !== `undefined` ? path2.join(packagePath, parts[2]) : packagePath;
2322
+ return { packagePath, unqualifiedPath };
2323
+ }, "runPnpResolution");
2324
+ const runPnpResolutionOnArray = /* @__PURE__ */ __name((request, paths2) => {
2325
+ for (let i = 0; i < paths2.length; i++) {
2326
+ const resolution = runPnpResolution(request, paths2[i]);
2327
+ if (resolution || i === paths2.length - 1) {
2328
+ return resolution;
2329
+ }
2330
+ }
2331
+ return null;
2332
+ }, "runPnpResolutionOnArray");
2333
+ const originalPaths = Array.isArray(opts.paths) ? opts.paths : [];
2334
+ const packageIterator = /* @__PURE__ */ __name((request, basedir, getCandidates, opts2) => {
2335
+ const pathsToTest = [basedir].concat(originalPaths);
2336
+ const resolution = runPnpResolutionOnArray(request, pathsToTest);
2337
+ if (resolution == null)
2338
+ return getCandidates();
2339
+ return [resolution.unqualifiedPath];
2340
+ }, "packageIterator");
2341
+ const paths = /* @__PURE__ */ __name((request, basedir, getNodeModulePaths, opts2) => {
2342
+ const pathsToTest = [basedir].concat(originalPaths);
2343
+ const resolution = runPnpResolutionOnArray(request, pathsToTest);
2344
+ if (resolution == null)
2345
+ return getNodeModulePaths().concat(originalPaths);
2346
+ let nodeModules = path2.dirname(resolution.packagePath);
2347
+ if (request.match(/^@[^/]+\//))
2348
+ nodeModules = path2.dirname(nodeModules);
2349
+ return [nodeModules];
2350
+ }, "paths");
2351
+ let isInsideIterator = false;
2352
+ if (!opts.__skipPackageIterator) {
2353
+ opts.packageIterator = function(request, basedir, getCandidates, opts2) {
2354
+ isInsideIterator = true;
2355
+ try {
2356
+ return packageIterator(request, basedir, getCandidates, opts2);
2357
+ } finally {
2358
+ isInsideIterator = false;
2359
+ }
2360
+ };
2361
+ }
2362
+ opts.paths = function(request, basedir, getNodeModulePaths, opts2) {
2363
+ if (isInsideIterator)
2364
+ return getNodeModulePaths().concat(originalPaths);
2365
+ return paths(request, basedir, getNodeModulePaths, opts2);
2366
+ };
2367
+ return opts;
2368
+ };
2369
+ }
2370
+ });
2371
+
2372
+ // ../../node_modules/function-bind/implementation.js
2373
+ var require_implementation = __commonJS({
2374
+ "../../node_modules/function-bind/implementation.js"(exports, module) {
2375
+ "use strict";
2376
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
2377
+ var toStr = Object.prototype.toString;
2378
+ var max = Math.max;
2379
+ var funcType = "[object Function]";
2380
+ var concatty = /* @__PURE__ */ __name(function concatty2(a, b) {
2381
+ var arr = [];
2382
+ for (var i = 0; i < a.length; i += 1) {
2383
+ arr[i] = a[i];
2384
+ }
2385
+ for (var j = 0; j < b.length; j += 1) {
2386
+ arr[j + a.length] = b[j];
2387
+ }
2388
+ return arr;
2389
+ }, "concatty");
2390
+ var slicy = /* @__PURE__ */ __name(function slicy2(arrLike, offset) {
2391
+ var arr = [];
2392
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
2393
+ arr[j] = arrLike[i];
2394
+ }
2395
+ return arr;
2396
+ }, "slicy");
2397
+ var joiny = /* @__PURE__ */ __name(function(arr, joiner) {
2398
+ var str = "";
2399
+ for (var i = 0; i < arr.length; i += 1) {
2400
+ str += arr[i];
2401
+ if (i + 1 < arr.length) {
2402
+ str += joiner;
2403
+ }
2404
+ }
2405
+ return str;
2406
+ }, "joiny");
2407
+ module.exports = /* @__PURE__ */ __name(function bind(that) {
2408
+ var target = this;
2409
+ if (typeof target !== "function" || toStr.apply(target) !== funcType) {
2410
+ throw new TypeError(ERROR_MESSAGE + target);
2411
+ }
2412
+ var args = slicy(arguments, 1);
2413
+ var bound;
2414
+ var binder = /* @__PURE__ */ __name(function() {
2415
+ if (this instanceof bound) {
2416
+ var result = target.apply(
2417
+ this,
2418
+ concatty(args, arguments)
2419
+ );
2420
+ if (Object(result) === result) {
2421
+ return result;
2422
+ }
2423
+ return this;
2424
+ }
2425
+ return target.apply(
2426
+ that,
2427
+ concatty(args, arguments)
2428
+ );
2429
+ }, "binder");
2430
+ var boundLength = max(0, target.length - args.length);
2431
+ var boundArgs = [];
2432
+ for (var i = 0; i < boundLength; i++) {
2433
+ boundArgs[i] = "$" + i;
2434
+ }
2435
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
2436
+ if (target.prototype) {
2437
+ var Empty = /* @__PURE__ */ __name(function Empty2() {
2438
+ }, "Empty");
2439
+ Empty.prototype = target.prototype;
2440
+ bound.prototype = new Empty();
2441
+ Empty.prototype = null;
2442
+ }
2443
+ return bound;
2444
+ }, "bind");
2445
+ }
2446
+ });
2447
+
2448
+ // ../../node_modules/function-bind/index.js
2449
+ var require_function_bind = __commonJS({
2450
+ "../../node_modules/function-bind/index.js"(exports, module) {
2451
+ "use strict";
2452
+ var implementation = require_implementation();
2453
+ module.exports = Function.prototype.bind || implementation;
2454
+ }
2455
+ });
2456
+
2457
+ // ../../node_modules/hasown/index.js
2458
+ var require_hasown = __commonJS({
2459
+ "../../node_modules/hasown/index.js"(exports, module) {
2460
+ "use strict";
2461
+ var call = Function.prototype.call;
2462
+ var $hasOwn = Object.prototype.hasOwnProperty;
2463
+ var bind = require_function_bind();
2464
+ module.exports = bind.call(call, $hasOwn);
2465
+ }
2466
+ });
2467
+
2468
+ // ../../node_modules/is-core-module/core.json
2469
+ var require_core = __commonJS({
2470
+ "../../node_modules/is-core-module/core.json"(exports, module) {
2471
+ module.exports = {
2472
+ assert: true,
2473
+ "node:assert": [">= 14.18 && < 15", ">= 16"],
2474
+ "assert/strict": ">= 15",
2475
+ "node:assert/strict": ">= 16",
2476
+ async_hooks: ">= 8",
2477
+ "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
2478
+ buffer_ieee754: ">= 0.5 && < 0.9.7",
2479
+ buffer: true,
2480
+ "node:buffer": [">= 14.18 && < 15", ">= 16"],
2481
+ child_process: true,
2482
+ "node:child_process": [">= 14.18 && < 15", ">= 16"],
2483
+ cluster: ">= 0.5",
2484
+ "node:cluster": [">= 14.18 && < 15", ">= 16"],
2485
+ console: true,
2486
+ "node:console": [">= 14.18 && < 15", ">= 16"],
2487
+ constants: true,
2488
+ "node:constants": [">= 14.18 && < 15", ">= 16"],
2489
+ crypto: true,
2490
+ "node:crypto": [">= 14.18 && < 15", ">= 16"],
2491
+ _debug_agent: ">= 1 && < 8",
2492
+ _debugger: "< 8",
2493
+ dgram: true,
2494
+ "node:dgram": [">= 14.18 && < 15", ">= 16"],
2495
+ diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
2496
+ "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
2497
+ dns: true,
2498
+ "node:dns": [">= 14.18 && < 15", ">= 16"],
2499
+ "dns/promises": ">= 15",
2500
+ "node:dns/promises": ">= 16",
2501
+ domain: ">= 0.7.12",
2502
+ "node:domain": [">= 14.18 && < 15", ">= 16"],
2503
+ events: true,
2504
+ "node:events": [">= 14.18 && < 15", ">= 16"],
2505
+ freelist: "< 6",
2506
+ fs: true,
2507
+ "node:fs": [">= 14.18 && < 15", ">= 16"],
2508
+ "fs/promises": [">= 10 && < 10.1", ">= 14"],
2509
+ "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
2510
+ _http_agent: ">= 0.11.1",
2511
+ "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
2512
+ _http_client: ">= 0.11.1",
2513
+ "node:_http_client": [">= 14.18 && < 15", ">= 16"],
2514
+ _http_common: ">= 0.11.1",
2515
+ "node:_http_common": [">= 14.18 && < 15", ">= 16"],
2516
+ _http_incoming: ">= 0.11.1",
2517
+ "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
2518
+ _http_outgoing: ">= 0.11.1",
2519
+ "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
2520
+ _http_server: ">= 0.11.1",
2521
+ "node:_http_server": [">= 14.18 && < 15", ">= 16"],
2522
+ http: true,
2523
+ "node:http": [">= 14.18 && < 15", ">= 16"],
2524
+ http2: ">= 8.8",
2525
+ "node:http2": [">= 14.18 && < 15", ">= 16"],
2526
+ https: true,
2527
+ "node:https": [">= 14.18 && < 15", ">= 16"],
2528
+ inspector: ">= 8",
2529
+ "node:inspector": [">= 14.18 && < 15", ">= 16"],
2530
+ "inspector/promises": [">= 19"],
2531
+ "node:inspector/promises": [">= 19"],
2532
+ _linklist: "< 8",
2533
+ module: true,
2534
+ "node:module": [">= 14.18 && < 15", ">= 16"],
2535
+ net: true,
2536
+ "node:net": [">= 14.18 && < 15", ">= 16"],
2537
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
2538
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
2539
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
2540
+ os: true,
2541
+ "node:os": [">= 14.18 && < 15", ">= 16"],
2542
+ path: true,
2543
+ "node:path": [">= 14.18 && < 15", ">= 16"],
2544
+ "path/posix": ">= 15.3",
2545
+ "node:path/posix": ">= 16",
2546
+ "path/win32": ">= 15.3",
2547
+ "node:path/win32": ">= 16",
2548
+ perf_hooks: ">= 8.5",
2549
+ "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
2550
+ process: ">= 1",
2551
+ "node:process": [">= 14.18 && < 15", ">= 16"],
2552
+ punycode: ">= 0.5",
2553
+ "node:punycode": [">= 14.18 && < 15", ">= 16"],
2554
+ querystring: true,
2555
+ "node:querystring": [">= 14.18 && < 15", ">= 16"],
2556
+ readline: true,
2557
+ "node:readline": [">= 14.18 && < 15", ">= 16"],
2558
+ "readline/promises": ">= 17",
2559
+ "node:readline/promises": ">= 17",
2560
+ repl: true,
2561
+ "node:repl": [">= 14.18 && < 15", ">= 16"],
2562
+ "node:sea": [">= 20.12 && < 21", ">= 21.7"],
2563
+ smalloc: ">= 0.11.5 && < 3",
2564
+ "node:sqlite": [">= 22.13 && < 23", ">= 23.4"],
2565
+ _stream_duplex: ">= 0.9.4",
2566
+ "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
2567
+ _stream_transform: ">= 0.9.4",
2568
+ "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
2569
+ _stream_wrap: ">= 1.4.1",
2570
+ "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
2571
+ _stream_passthrough: ">= 0.9.4",
2572
+ "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
2573
+ _stream_readable: ">= 0.9.4",
2574
+ "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
2575
+ _stream_writable: ">= 0.9.4",
2576
+ "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
2577
+ stream: true,
2578
+ "node:stream": [">= 14.18 && < 15", ">= 16"],
2579
+ "stream/consumers": ">= 16.7",
2580
+ "node:stream/consumers": ">= 16.7",
2581
+ "stream/promises": ">= 15",
2582
+ "node:stream/promises": ">= 16",
2583
+ "stream/web": ">= 16.5",
2584
+ "node:stream/web": ">= 16.5",
2585
+ string_decoder: true,
2586
+ "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
2587
+ sys: [">= 0.4 && < 0.7", ">= 0.8"],
2588
+ "node:sys": [">= 14.18 && < 15", ">= 16"],
2589
+ "test/reporters": ">= 19.9 && < 20.2",
2590
+ "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
2591
+ "test/mock_loader": ">= 22.3 && < 22.7",
2592
+ "node:test/mock_loader": ">= 22.3 && < 22.7",
2593
+ "node:test": [">= 16.17 && < 17", ">= 18"],
2594
+ timers: true,
2595
+ "node:timers": [">= 14.18 && < 15", ">= 16"],
2596
+ "timers/promises": ">= 15",
2597
+ "node:timers/promises": ">= 16",
2598
+ _tls_common: ">= 0.11.13",
2599
+ "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
2600
+ _tls_legacy: ">= 0.11.3 && < 10",
2601
+ _tls_wrap: ">= 0.11.3",
2602
+ "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
2603
+ tls: true,
2604
+ "node:tls": [">= 14.18 && < 15", ">= 16"],
2605
+ trace_events: ">= 10",
2606
+ "node:trace_events": [">= 14.18 && < 15", ">= 16"],
2607
+ tty: true,
2608
+ "node:tty": [">= 14.18 && < 15", ">= 16"],
2609
+ url: true,
2610
+ "node:url": [">= 14.18 && < 15", ">= 16"],
2611
+ util: true,
2612
+ "node:util": [">= 14.18 && < 15", ">= 16"],
2613
+ "util/types": ">= 15.3",
2614
+ "node:util/types": ">= 16",
2615
+ "v8/tools/arguments": ">= 10 && < 12",
2616
+ "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2617
+ "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2618
+ "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2619
+ "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2620
+ "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2621
+ "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
2622
+ v8: ">= 1",
2623
+ "node:v8": [">= 14.18 && < 15", ">= 16"],
2624
+ vm: true,
2625
+ "node:vm": [">= 14.18 && < 15", ">= 16"],
2626
+ wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
2627
+ "node:wasi": [">= 18.17 && < 19", ">= 20"],
2628
+ worker_threads: ">= 11.7",
2629
+ "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
2630
+ zlib: ">= 0.5",
2631
+ "node:zlib": [">= 14.18 && < 15", ">= 16"]
2632
+ };
2633
+ }
2634
+ });
2635
+
2636
+ // ../../node_modules/is-core-module/index.js
2637
+ var require_is_core_module = __commonJS({
2638
+ "../../node_modules/is-core-module/index.js"(exports, module) {
2639
+ "use strict";
2640
+ var hasOwn = require_hasown();
2641
+ function specifierIncluded(current, specifier) {
2642
+ var nodeParts = current.split(".");
2643
+ var parts = specifier.split(" ");
2644
+ var op = parts.length > 1 ? parts[0] : "=";
2645
+ var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
2646
+ for (var i = 0; i < 3; ++i) {
2647
+ var cur = parseInt(nodeParts[i] || 0, 10);
2648
+ var ver = parseInt(versionParts[i] || 0, 10);
2649
+ if (cur === ver) {
2650
+ continue;
2651
+ }
2652
+ if (op === "<") {
2653
+ return cur < ver;
2654
+ }
2655
+ if (op === ">=") {
2656
+ return cur >= ver;
2657
+ }
2658
+ return false;
2659
+ }
2660
+ return op === ">=";
2661
+ }
2662
+ __name(specifierIncluded, "specifierIncluded");
2663
+ function matchesRange(current, range) {
2664
+ var specifiers = range.split(/ ?&& ?/);
2665
+ if (specifiers.length === 0) {
2666
+ return false;
2667
+ }
2668
+ for (var i = 0; i < specifiers.length; ++i) {
2669
+ if (!specifierIncluded(current, specifiers[i])) {
2670
+ return false;
2671
+ }
2672
+ }
2673
+ return true;
2674
+ }
2675
+ __name(matchesRange, "matchesRange");
2676
+ function versionIncluded(nodeVersion, specifierValue) {
2677
+ if (typeof specifierValue === "boolean") {
2678
+ return specifierValue;
2679
+ }
2680
+ var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
2681
+ if (typeof current !== "string") {
2682
+ throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
2683
+ }
2684
+ if (specifierValue && typeof specifierValue === "object") {
2685
+ for (var i = 0; i < specifierValue.length; ++i) {
2686
+ if (matchesRange(current, specifierValue[i])) {
2687
+ return true;
2688
+ }
2689
+ }
2690
+ return false;
2691
+ }
2692
+ return matchesRange(current, specifierValue);
2693
+ }
2694
+ __name(versionIncluded, "versionIncluded");
2695
+ var data = require_core();
2696
+ module.exports = /* @__PURE__ */ __name(function isCore(x, nodeVersion) {
2697
+ return hasOwn(data, x) && versionIncluded(nodeVersion, data[x]);
2698
+ }, "isCore");
2699
+ }
2700
+ });
2701
+
2702
+ // ../../node_modules/resolve/lib/async.js
2703
+ var require_async = __commonJS({
2704
+ "../../node_modules/resolve/lib/async.js"(exports, module) {
2705
+ var fs = __require("fs");
2706
+ var getHomedir = require_homedir();
2707
+ var path2 = __require("path");
2708
+ var caller = require_caller();
2709
+ var nodeModulesPaths = require_node_modules_paths();
2710
+ var normalizeOptions = require_normalize_options();
2711
+ var isCore = require_is_core_module();
2712
+ var realpathFS = process.platform !== "win32" && fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
2713
+ var homedir = getHomedir();
2714
+ var defaultPaths = /* @__PURE__ */ __name(function() {
2715
+ return [
2716
+ path2.join(homedir, ".node_modules"),
2717
+ path2.join(homedir, ".node_libraries")
2718
+ ];
2719
+ }, "defaultPaths");
2720
+ var defaultIsFile = /* @__PURE__ */ __name(function isFile(file, cb) {
2721
+ fs.stat(file, function(err, stat) {
2722
+ if (!err) {
2723
+ return cb(null, stat.isFile() || stat.isFIFO());
2724
+ }
2725
+ if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
2726
+ return cb(err);
2727
+ });
2728
+ }, "isFile");
2729
+ var defaultIsDir = /* @__PURE__ */ __name(function isDirectory(dir, cb) {
2730
+ fs.stat(dir, function(err, stat) {
2731
+ if (!err) {
2732
+ return cb(null, stat.isDirectory());
2733
+ }
2734
+ if (err.code === "ENOENT" || err.code === "ENOTDIR") return cb(null, false);
2735
+ return cb(err);
2736
+ });
2737
+ }, "isDirectory");
2738
+ var defaultRealpath = /* @__PURE__ */ __name(function realpath(x, cb) {
2739
+ realpathFS(x, function(realpathErr, realPath) {
2740
+ if (realpathErr && realpathErr.code !== "ENOENT") cb(realpathErr);
2741
+ else cb(null, realpathErr ? x : realPath);
2742
+ });
2743
+ }, "realpath");
2744
+ var maybeRealpath = /* @__PURE__ */ __name(function maybeRealpath2(realpath, x, opts, cb) {
2745
+ if (opts && opts.preserveSymlinks === false) {
2746
+ realpath(x, cb);
2747
+ } else {
2748
+ cb(null, x);
2749
+ }
2750
+ }, "maybeRealpath");
2751
+ var defaultReadPackage = /* @__PURE__ */ __name(function defaultReadPackage2(readFile2, pkgfile, cb) {
2752
+ readFile2(pkgfile, function(readFileErr, body) {
2753
+ if (readFileErr) cb(readFileErr);
2754
+ else {
2755
+ try {
2756
+ var pkg = JSON.parse(body);
2757
+ cb(null, pkg);
2758
+ } catch (jsonErr) {
2759
+ cb(null);
2760
+ }
2761
+ }
2762
+ });
2763
+ }, "defaultReadPackage");
2764
+ var getPackageCandidates = /* @__PURE__ */ __name(function getPackageCandidates2(x, start, opts) {
2765
+ var dirs = nodeModulesPaths(start, opts, x);
2766
+ for (var i = 0; i < dirs.length; i++) {
2767
+ dirs[i] = path2.join(dirs[i], x);
2768
+ }
2769
+ return dirs;
2770
+ }, "getPackageCandidates");
2771
+ module.exports = /* @__PURE__ */ __name(function resolve4(x, options, callback) {
2772
+ var cb = callback;
2773
+ var opts = options;
2774
+ if (typeof options === "function") {
2775
+ cb = opts;
2776
+ opts = {};
2777
+ }
2778
+ if (typeof x !== "string") {
2779
+ var err = new TypeError("Path must be a string.");
2780
+ return process.nextTick(function() {
2781
+ cb(err);
2782
+ });
2783
+ }
2784
+ opts = normalizeOptions(x, opts);
2785
+ var isFile = opts.isFile || defaultIsFile;
2786
+ var isDirectory = opts.isDirectory || defaultIsDir;
2787
+ var readFile2 = opts.readFile || fs.readFile;
2788
+ var realpath = opts.realpath || defaultRealpath;
2789
+ var readPackage = opts.readPackage || defaultReadPackage;
2790
+ if (opts.readFile && opts.readPackage) {
2791
+ var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
2792
+ return process.nextTick(function() {
2793
+ cb(conflictErr);
2794
+ });
2795
+ }
2796
+ var packageIterator = opts.packageIterator;
2797
+ var extensions = opts.extensions || [".js"];
2798
+ var includeCoreModules = opts.includeCoreModules !== false;
2799
+ var basedir = opts.basedir || path2.dirname(caller());
2800
+ var parent = opts.filename || basedir;
2801
+ opts.paths = opts.paths || defaultPaths();
2802
+ var absoluteStart = path2.resolve(basedir);
2803
+ maybeRealpath(
2804
+ realpath,
2805
+ absoluteStart,
2806
+ opts,
2807
+ function(err2, realStart) {
2808
+ if (err2) cb(err2);
2809
+ else init(realStart);
2810
+ }
2811
+ );
2812
+ var res;
2813
+ function init(basedir2) {
2814
+ if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
2815
+ res = path2.resolve(basedir2, x);
2816
+ if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
2817
+ if (/\/$/.test(x) && res === basedir2) {
2818
+ loadAsDirectory(res, opts.package, onfile);
2819
+ } else loadAsFile(res, opts.package, onfile);
2820
+ } else if (includeCoreModules && isCore(x)) {
2821
+ return cb(null, x);
2822
+ } else loadNodeModules(x, basedir2, function(err2, n, pkg) {
2823
+ if (err2) cb(err2);
2824
+ else if (n) {
2825
+ return maybeRealpath(realpath, n, opts, function(err3, realN) {
2826
+ if (err3) {
2827
+ cb(err3);
2828
+ } else {
2829
+ cb(null, realN, pkg);
2830
+ }
2831
+ });
2832
+ } else {
2833
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
2834
+ moduleError.code = "MODULE_NOT_FOUND";
2835
+ cb(moduleError);
2836
+ }
2837
+ });
2838
+ }
2839
+ __name(init, "init");
2840
+ function onfile(err2, m, pkg) {
2841
+ if (err2) cb(err2);
2842
+ else if (m) cb(null, m, pkg);
2843
+ else loadAsDirectory(res, function(err3, d, pkg2) {
2844
+ if (err3) cb(err3);
2845
+ else if (d) {
2846
+ maybeRealpath(realpath, d, opts, function(err4, realD) {
2847
+ if (err4) {
2848
+ cb(err4);
2849
+ } else {
2850
+ cb(null, realD, pkg2);
2851
+ }
2852
+ });
2853
+ } else {
2854
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
2855
+ moduleError.code = "MODULE_NOT_FOUND";
2856
+ cb(moduleError);
2857
+ }
2858
+ });
2859
+ }
2860
+ __name(onfile, "onfile");
2861
+ function loadAsFile(x2, thePackage, callback2) {
2862
+ var loadAsFilePackage = thePackage;
2863
+ var cb2 = callback2;
2864
+ if (typeof loadAsFilePackage === "function") {
2865
+ cb2 = loadAsFilePackage;
2866
+ loadAsFilePackage = void 0;
2867
+ }
2868
+ var exts = [""].concat(extensions);
2869
+ load(exts, x2, loadAsFilePackage);
2870
+ function load(exts2, x3, loadPackage) {
2871
+ if (exts2.length === 0) return cb2(null, void 0, loadPackage);
2872
+ var file = x3 + exts2[0];
2873
+ var pkg = loadPackage;
2874
+ if (pkg) onpkg(null, pkg);
2875
+ else loadpkg(path2.dirname(file), onpkg);
2876
+ function onpkg(err2, pkg_, dir) {
2877
+ pkg = pkg_;
2878
+ if (err2) return cb2(err2);
2879
+ if (dir && pkg && opts.pathFilter) {
2880
+ var rfile = path2.relative(dir, file);
2881
+ var rel = rfile.slice(0, rfile.length - exts2[0].length);
2882
+ var r = opts.pathFilter(pkg, x3, rel);
2883
+ if (r) return load(
2884
+ [""].concat(extensions.slice()),
2885
+ path2.resolve(dir, r),
2886
+ pkg
2887
+ );
2888
+ }
2889
+ isFile(file, onex);
2890
+ }
2891
+ __name(onpkg, "onpkg");
2892
+ function onex(err2, ex) {
2893
+ if (err2) return cb2(err2);
2894
+ if (ex) return cb2(null, file, pkg);
2895
+ load(exts2.slice(1), x3, pkg);
2896
+ }
2897
+ __name(onex, "onex");
2898
+ }
2899
+ __name(load, "load");
2900
+ }
2901
+ __name(loadAsFile, "loadAsFile");
2902
+ function loadpkg(dir, cb2) {
2903
+ if (dir === "" || dir === "/") return cb2(null);
2904
+ if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
2905
+ return cb2(null);
2906
+ }
2907
+ if (/[/\\]node_modules[/\\]*$/.test(dir)) return cb2(null);
2908
+ maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
2909
+ if (unwrapErr) return loadpkg(path2.dirname(dir), cb2);
2910
+ var pkgfile = path2.join(pkgdir, "package.json");
2911
+ isFile(pkgfile, function(err2, ex) {
2912
+ if (!ex) return loadpkg(path2.dirname(dir), cb2);
2913
+ readPackage(readFile2, pkgfile, function(err3, pkgParam) {
2914
+ if (err3) cb2(err3);
2915
+ var pkg = pkgParam;
2916
+ if (pkg && opts.packageFilter) {
2917
+ pkg = opts.packageFilter(pkg, pkgfile);
2918
+ }
2919
+ cb2(null, pkg, dir);
2920
+ });
2921
+ });
2922
+ });
2923
+ }
2924
+ __name(loadpkg, "loadpkg");
2925
+ function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
2926
+ var cb2 = callback2;
2927
+ var fpkg = loadAsDirectoryPackage;
2928
+ if (typeof fpkg === "function") {
2929
+ cb2 = fpkg;
2930
+ fpkg = opts.package;
2931
+ }
2932
+ maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
2933
+ if (unwrapErr) return cb2(unwrapErr);
2934
+ var pkgfile = path2.join(pkgdir, "package.json");
2935
+ isFile(pkgfile, function(err2, ex) {
2936
+ if (err2) return cb2(err2);
2937
+ if (!ex) return loadAsFile(path2.join(x2, "index"), fpkg, cb2);
2938
+ readPackage(readFile2, pkgfile, function(err3, pkgParam) {
2939
+ if (err3) return cb2(err3);
2940
+ var pkg = pkgParam;
2941
+ if (pkg && opts.packageFilter) {
2942
+ pkg = opts.packageFilter(pkg, pkgfile);
2943
+ }
2944
+ if (pkg && pkg.main) {
2945
+ if (typeof pkg.main !== "string") {
2946
+ var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
2947
+ mainError.code = "INVALID_PACKAGE_MAIN";
2948
+ return cb2(mainError);
2949
+ }
2950
+ if (pkg.main === "." || pkg.main === "./") {
2951
+ pkg.main = "index";
2952
+ }
2953
+ loadAsFile(path2.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
2954
+ if (err4) return cb2(err4);
2955
+ if (m) return cb2(null, m, pkg2);
2956
+ if (!pkg2) return loadAsFile(path2.join(x2, "index"), pkg2, cb2);
2957
+ var dir = path2.resolve(x2, pkg2.main);
2958
+ loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
2959
+ if (err5) return cb2(err5);
2960
+ if (n) return cb2(null, n, pkg3);
2961
+ loadAsFile(path2.join(x2, "index"), pkg3, cb2);
2962
+ });
2963
+ });
2964
+ return;
2965
+ }
2966
+ loadAsFile(path2.join(x2, "/index"), pkg, cb2);
2967
+ });
2968
+ });
2969
+ });
2970
+ }
2971
+ __name(loadAsDirectory, "loadAsDirectory");
2972
+ function processDirs(cb2, dirs) {
2973
+ if (dirs.length === 0) return cb2(null, void 0);
2974
+ var dir = dirs[0];
2975
+ isDirectory(path2.dirname(dir), isdir);
2976
+ function isdir(err2, isdir2) {
2977
+ if (err2) return cb2(err2);
2978
+ if (!isdir2) return processDirs(cb2, dirs.slice(1));
2979
+ loadAsFile(dir, opts.package, onfile2);
2980
+ }
2981
+ __name(isdir, "isdir");
2982
+ function onfile2(err2, m, pkg) {
2983
+ if (err2) return cb2(err2);
2984
+ if (m) return cb2(null, m, pkg);
2985
+ loadAsDirectory(dir, opts.package, ondir);
2986
+ }
2987
+ __name(onfile2, "onfile");
2988
+ function ondir(err2, n, pkg) {
2989
+ if (err2) return cb2(err2);
2990
+ if (n) return cb2(null, n, pkg);
2991
+ processDirs(cb2, dirs.slice(1));
2992
+ }
2993
+ __name(ondir, "ondir");
2994
+ }
2995
+ __name(processDirs, "processDirs");
2996
+ function loadNodeModules(x2, start, cb2) {
2997
+ var thunk = /* @__PURE__ */ __name(function() {
2998
+ return getPackageCandidates(x2, start, opts);
2999
+ }, "thunk");
3000
+ processDirs(
3001
+ cb2,
3002
+ packageIterator ? packageIterator(x2, start, thunk, opts) : thunk()
3003
+ );
3004
+ }
3005
+ __name(loadNodeModules, "loadNodeModules");
3006
+ }, "resolve");
3007
+ }
3008
+ });
3009
+
3010
+ // ../../node_modules/resolve/lib/core.json
3011
+ var require_core2 = __commonJS({
3012
+ "../../node_modules/resolve/lib/core.json"(exports, module) {
3013
+ module.exports = {
3014
+ assert: true,
3015
+ "node:assert": [">= 14.18 && < 15", ">= 16"],
3016
+ "assert/strict": ">= 15",
3017
+ "node:assert/strict": ">= 16",
3018
+ async_hooks: ">= 8",
3019
+ "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
3020
+ buffer_ieee754: ">= 0.5 && < 0.9.7",
3021
+ buffer: true,
3022
+ "node:buffer": [">= 14.18 && < 15", ">= 16"],
3023
+ child_process: true,
3024
+ "node:child_process": [">= 14.18 && < 15", ">= 16"],
3025
+ cluster: ">= 0.5",
3026
+ "node:cluster": [">= 14.18 && < 15", ">= 16"],
3027
+ console: true,
3028
+ "node:console": [">= 14.18 && < 15", ">= 16"],
3029
+ constants: true,
3030
+ "node:constants": [">= 14.18 && < 15", ">= 16"],
3031
+ crypto: true,
3032
+ "node:crypto": [">= 14.18 && < 15", ">= 16"],
3033
+ _debug_agent: ">= 1 && < 8",
3034
+ _debugger: "< 8",
3035
+ dgram: true,
3036
+ "node:dgram": [">= 14.18 && < 15", ">= 16"],
3037
+ diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
3038
+ "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
3039
+ dns: true,
3040
+ "node:dns": [">= 14.18 && < 15", ">= 16"],
3041
+ "dns/promises": ">= 15",
3042
+ "node:dns/promises": ">= 16",
3043
+ domain: ">= 0.7.12",
3044
+ "node:domain": [">= 14.18 && < 15", ">= 16"],
3045
+ events: true,
3046
+ "node:events": [">= 14.18 && < 15", ">= 16"],
3047
+ freelist: "< 6",
3048
+ fs: true,
3049
+ "node:fs": [">= 14.18 && < 15", ">= 16"],
3050
+ "fs/promises": [">= 10 && < 10.1", ">= 14"],
3051
+ "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
3052
+ _http_agent: ">= 0.11.1",
3053
+ "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
3054
+ _http_client: ">= 0.11.1",
3055
+ "node:_http_client": [">= 14.18 && < 15", ">= 16"],
3056
+ _http_common: ">= 0.11.1",
3057
+ "node:_http_common": [">= 14.18 && < 15", ">= 16"],
3058
+ _http_incoming: ">= 0.11.1",
3059
+ "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
3060
+ _http_outgoing: ">= 0.11.1",
3061
+ "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
3062
+ _http_server: ">= 0.11.1",
3063
+ "node:_http_server": [">= 14.18 && < 15", ">= 16"],
3064
+ http: true,
3065
+ "node:http": [">= 14.18 && < 15", ">= 16"],
3066
+ http2: ">= 8.8",
3067
+ "node:http2": [">= 14.18 && < 15", ">= 16"],
3068
+ https: true,
3069
+ "node:https": [">= 14.18 && < 15", ">= 16"],
3070
+ inspector: ">= 8",
3071
+ "node:inspector": [">= 14.18 && < 15", ">= 16"],
3072
+ "inspector/promises": [">= 19"],
3073
+ "node:inspector/promises": [">= 19"],
3074
+ _linklist: "< 8",
3075
+ module: true,
3076
+ "node:module": [">= 14.18 && < 15", ">= 16"],
3077
+ net: true,
3078
+ "node:net": [">= 14.18 && < 15", ">= 16"],
3079
+ "node-inspect/lib/_inspect": ">= 7.6 && < 12",
3080
+ "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
3081
+ "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
3082
+ os: true,
3083
+ "node:os": [">= 14.18 && < 15", ">= 16"],
3084
+ path: true,
3085
+ "node:path": [">= 14.18 && < 15", ">= 16"],
3086
+ "path/posix": ">= 15.3",
3087
+ "node:path/posix": ">= 16",
3088
+ "path/win32": ">= 15.3",
3089
+ "node:path/win32": ">= 16",
3090
+ perf_hooks: ">= 8.5",
3091
+ "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
3092
+ process: ">= 1",
3093
+ "node:process": [">= 14.18 && < 15", ">= 16"],
3094
+ punycode: ">= 0.5",
3095
+ "node:punycode": [">= 14.18 && < 15", ">= 16"],
3096
+ querystring: true,
3097
+ "node:querystring": [">= 14.18 && < 15", ">= 16"],
3098
+ readline: true,
3099
+ "node:readline": [">= 14.18 && < 15", ">= 16"],
3100
+ "readline/promises": ">= 17",
3101
+ "node:readline/promises": ">= 17",
3102
+ repl: true,
3103
+ "node:repl": [">= 14.18 && < 15", ">= 16"],
3104
+ "node:sea": [">= 20.12 && < 21", ">= 21.7"],
3105
+ smalloc: ">= 0.11.5 && < 3",
3106
+ "node:sqlite": ">= 23.4",
3107
+ _stream_duplex: ">= 0.9.4",
3108
+ "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
3109
+ _stream_transform: ">= 0.9.4",
3110
+ "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
3111
+ _stream_wrap: ">= 1.4.1",
3112
+ "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
3113
+ _stream_passthrough: ">= 0.9.4",
3114
+ "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
3115
+ _stream_readable: ">= 0.9.4",
3116
+ "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
3117
+ _stream_writable: ">= 0.9.4",
3118
+ "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
3119
+ stream: true,
3120
+ "node:stream": [">= 14.18 && < 15", ">= 16"],
3121
+ "stream/consumers": ">= 16.7",
3122
+ "node:stream/consumers": ">= 16.7",
3123
+ "stream/promises": ">= 15",
3124
+ "node:stream/promises": ">= 16",
3125
+ "stream/web": ">= 16.5",
3126
+ "node:stream/web": ">= 16.5",
3127
+ string_decoder: true,
3128
+ "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
3129
+ sys: [">= 0.4 && < 0.7", ">= 0.8"],
3130
+ "node:sys": [">= 14.18 && < 15", ">= 16"],
3131
+ "test/reporters": ">= 19.9 && < 20.2",
3132
+ "node:test/reporters": [">= 18.17 && < 19", ">= 19.9", ">= 20"],
3133
+ "test/mock_loader": ">= 22.3 && < 22.7",
3134
+ "node:test/mock_loader": ">= 22.3 && < 22.7",
3135
+ "node:test": [">= 16.17 && < 17", ">= 18"],
3136
+ timers: true,
3137
+ "node:timers": [">= 14.18 && < 15", ">= 16"],
3138
+ "timers/promises": ">= 15",
3139
+ "node:timers/promises": ">= 16",
3140
+ _tls_common: ">= 0.11.13",
3141
+ "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
3142
+ _tls_legacy: ">= 0.11.3 && < 10",
3143
+ _tls_wrap: ">= 0.11.3",
3144
+ "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
3145
+ tls: true,
3146
+ "node:tls": [">= 14.18 && < 15", ">= 16"],
3147
+ trace_events: ">= 10",
3148
+ "node:trace_events": [">= 14.18 && < 15", ">= 16"],
3149
+ tty: true,
3150
+ "node:tty": [">= 14.18 && < 15", ">= 16"],
3151
+ url: true,
3152
+ "node:url": [">= 14.18 && < 15", ">= 16"],
3153
+ util: true,
3154
+ "node:util": [">= 14.18 && < 15", ">= 16"],
3155
+ "util/types": ">= 15.3",
3156
+ "node:util/types": ">= 16",
3157
+ "v8/tools/arguments": ">= 10 && < 12",
3158
+ "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3159
+ "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3160
+ "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3161
+ "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3162
+ "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3163
+ "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
3164
+ v8: ">= 1",
3165
+ "node:v8": [">= 14.18 && < 15", ">= 16"],
3166
+ vm: true,
3167
+ "node:vm": [">= 14.18 && < 15", ">= 16"],
3168
+ wasi: [">= 13.4 && < 13.5", ">= 18.17 && < 19", ">= 20"],
3169
+ "node:wasi": [">= 18.17 && < 19", ">= 20"],
3170
+ worker_threads: ">= 11.7",
3171
+ "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
3172
+ zlib: ">= 0.5",
3173
+ "node:zlib": [">= 14.18 && < 15", ">= 16"]
3174
+ };
3175
+ }
3176
+ });
3177
+
3178
+ // ../../node_modules/resolve/lib/core.js
3179
+ var require_core3 = __commonJS({
3180
+ "../../node_modules/resolve/lib/core.js"(exports, module) {
3181
+ "use strict";
3182
+ var isCoreModule = require_is_core_module();
3183
+ var data = require_core2();
3184
+ var core = {};
3185
+ for (mod in data) {
3186
+ if (Object.prototype.hasOwnProperty.call(data, mod)) {
3187
+ core[mod] = isCoreModule(mod);
3188
+ }
3189
+ }
3190
+ var mod;
3191
+ module.exports = core;
3192
+ }
3193
+ });
3194
+
3195
+ // ../../node_modules/resolve/lib/is-core.js
3196
+ var require_is_core = __commonJS({
3197
+ "../../node_modules/resolve/lib/is-core.js"(exports, module) {
3198
+ var isCoreModule = require_is_core_module();
3199
+ module.exports = /* @__PURE__ */ __name(function isCore(x) {
3200
+ return isCoreModule(x);
3201
+ }, "isCore");
3202
+ }
3203
+ });
3204
+
3205
+ // ../../node_modules/resolve/lib/sync.js
3206
+ var require_sync = __commonJS({
3207
+ "../../node_modules/resolve/lib/sync.js"(exports, module) {
3208
+ var isCore = require_is_core_module();
3209
+ var fs = __require("fs");
3210
+ var path2 = __require("path");
3211
+ var getHomedir = require_homedir();
3212
+ var caller = require_caller();
3213
+ var nodeModulesPaths = require_node_modules_paths();
3214
+ var normalizeOptions = require_normalize_options();
3215
+ var realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
3216
+ var homedir = getHomedir();
3217
+ var defaultPaths = /* @__PURE__ */ __name(function() {
3218
+ return [
3219
+ path2.join(homedir, ".node_modules"),
3220
+ path2.join(homedir, ".node_libraries")
3221
+ ];
3222
+ }, "defaultPaths");
3223
+ var defaultIsFile = /* @__PURE__ */ __name(function isFile(file) {
3224
+ try {
3225
+ var stat = fs.statSync(file, { throwIfNoEntry: false });
3226
+ } catch (e) {
3227
+ if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
3228
+ throw e;
3229
+ }
3230
+ return !!stat && (stat.isFile() || stat.isFIFO());
3231
+ }, "isFile");
3232
+ var defaultIsDir = /* @__PURE__ */ __name(function isDirectory(dir) {
3233
+ try {
3234
+ var stat = fs.statSync(dir, { throwIfNoEntry: false });
3235
+ } catch (e) {
3236
+ if (e && (e.code === "ENOENT" || e.code === "ENOTDIR")) return false;
3237
+ throw e;
3238
+ }
3239
+ return !!stat && stat.isDirectory();
3240
+ }, "isDirectory");
3241
+ var defaultRealpathSync = /* @__PURE__ */ __name(function realpathSync(x) {
3242
+ try {
3243
+ return realpathFS(x);
3244
+ } catch (realpathErr) {
3245
+ if (realpathErr.code !== "ENOENT") {
3246
+ throw realpathErr;
3247
+ }
3248
+ }
3249
+ return x;
3250
+ }, "realpathSync");
3251
+ var maybeRealpathSync = /* @__PURE__ */ __name(function maybeRealpathSync2(realpathSync, x, opts) {
3252
+ if (opts && opts.preserveSymlinks === false) {
3253
+ return realpathSync(x);
3254
+ }
3255
+ return x;
3256
+ }, "maybeRealpathSync");
3257
+ var defaultReadPackageSync = /* @__PURE__ */ __name(function defaultReadPackageSync2(readFileSync, pkgfile) {
3258
+ var body = readFileSync(pkgfile);
3259
+ try {
3260
+ var pkg = JSON.parse(body);
3261
+ return pkg;
3262
+ } catch (jsonErr) {
3263
+ }
3264
+ }, "defaultReadPackageSync");
3265
+ var getPackageCandidates = /* @__PURE__ */ __name(function getPackageCandidates2(x, start, opts) {
3266
+ var dirs = nodeModulesPaths(start, opts, x);
3267
+ for (var i = 0; i < dirs.length; i++) {
3268
+ dirs[i] = path2.join(dirs[i], x);
3269
+ }
3270
+ return dirs;
3271
+ }, "getPackageCandidates");
3272
+ module.exports = /* @__PURE__ */ __name(function resolveSync(x, options) {
3273
+ if (typeof x !== "string") {
3274
+ throw new TypeError("Path must be a string.");
3275
+ }
3276
+ var opts = normalizeOptions(x, options);
3277
+ var isFile = opts.isFile || defaultIsFile;
3278
+ var readFileSync = opts.readFileSync || fs.readFileSync;
3279
+ var isDirectory = opts.isDirectory || defaultIsDir;
3280
+ var realpathSync = opts.realpathSync || defaultRealpathSync;
3281
+ var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
3282
+ if (opts.readFileSync && opts.readPackageSync) {
3283
+ throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
3284
+ }
3285
+ var packageIterator = opts.packageIterator;
3286
+ var extensions = opts.extensions || [".js"];
3287
+ var includeCoreModules = opts.includeCoreModules !== false;
3288
+ var basedir = opts.basedir || path2.dirname(caller());
3289
+ var parent = opts.filename || basedir;
3290
+ opts.paths = opts.paths || defaultPaths();
3291
+ var absoluteStart = maybeRealpathSync(realpathSync, path2.resolve(basedir), opts);
3292
+ if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
3293
+ var res = path2.resolve(absoluteStart, x);
3294
+ if (x === "." || x === ".." || x.slice(-1) === "/") res += "/";
3295
+ var m = loadAsFileSync(res) || loadAsDirectorySync(res);
3296
+ if (m) return maybeRealpathSync(realpathSync, m, opts);
3297
+ } else if (includeCoreModules && isCore(x)) {
3298
+ return x;
3299
+ } else {
3300
+ var n = loadNodeModulesSync(x, absoluteStart);
3301
+ if (n) return maybeRealpathSync(realpathSync, n, opts);
3302
+ }
3303
+ var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
3304
+ err.code = "MODULE_NOT_FOUND";
3305
+ throw err;
3306
+ function loadAsFileSync(x2) {
3307
+ var pkg = loadpkg(path2.dirname(x2));
3308
+ if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
3309
+ var rfile = path2.relative(pkg.dir, x2);
3310
+ var r = opts.pathFilter(pkg.pkg, x2, rfile);
3311
+ if (r) {
3312
+ x2 = path2.resolve(pkg.dir, r);
3313
+ }
3314
+ }
3315
+ if (isFile(x2)) {
3316
+ return x2;
3317
+ }
3318
+ for (var i = 0; i < extensions.length; i++) {
3319
+ var file = x2 + extensions[i];
3320
+ if (isFile(file)) {
3321
+ return file;
3322
+ }
3323
+ }
3324
+ }
3325
+ __name(loadAsFileSync, "loadAsFileSync");
3326
+ function loadpkg(dir) {
3327
+ if (dir === "" || dir === "/") return;
3328
+ if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
3329
+ return;
3330
+ }
3331
+ if (/[/\\]node_modules[/\\]*$/.test(dir)) return;
3332
+ var pkgfile = path2.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
3333
+ if (!isFile(pkgfile)) {
3334
+ return loadpkg(path2.dirname(dir));
3335
+ }
3336
+ var pkg = readPackageSync(readFileSync, pkgfile);
3337
+ if (pkg && opts.packageFilter) {
3338
+ pkg = opts.packageFilter(
3339
+ pkg,
3340
+ /*pkgfile,*/
3341
+ dir
3342
+ );
3343
+ }
3344
+ return { pkg, dir };
3345
+ }
3346
+ __name(loadpkg, "loadpkg");
3347
+ function loadAsDirectorySync(x2) {
3348
+ var pkgfile = path2.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
3349
+ if (isFile(pkgfile)) {
3350
+ try {
3351
+ var pkg = readPackageSync(readFileSync, pkgfile);
3352
+ } catch (e) {
3353
+ }
3354
+ if (pkg && opts.packageFilter) {
3355
+ pkg = opts.packageFilter(
3356
+ pkg,
3357
+ /*pkgfile,*/
3358
+ x2
3359
+ );
3360
+ }
3361
+ if (pkg && pkg.main) {
3362
+ if (typeof pkg.main !== "string") {
3363
+ var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
3364
+ mainError.code = "INVALID_PACKAGE_MAIN";
3365
+ throw mainError;
3366
+ }
3367
+ if (pkg.main === "." || pkg.main === "./") {
3368
+ pkg.main = "index";
3369
+ }
3370
+ try {
3371
+ var m2 = loadAsFileSync(path2.resolve(x2, pkg.main));
3372
+ if (m2) return m2;
3373
+ var n2 = loadAsDirectorySync(path2.resolve(x2, pkg.main));
3374
+ if (n2) return n2;
3375
+ } catch (e) {
3376
+ }
3377
+ }
3378
+ }
3379
+ return loadAsFileSync(path2.join(x2, "/index"));
3380
+ }
3381
+ __name(loadAsDirectorySync, "loadAsDirectorySync");
3382
+ function loadNodeModulesSync(x2, start) {
3383
+ var thunk = /* @__PURE__ */ __name(function() {
3384
+ return getPackageCandidates(x2, start, opts);
3385
+ }, "thunk");
3386
+ var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
3387
+ for (var i = 0; i < dirs.length; i++) {
3388
+ var dir = dirs[i];
3389
+ if (isDirectory(path2.dirname(dir))) {
3390
+ var m2 = loadAsFileSync(dir);
3391
+ if (m2) return m2;
3392
+ var n2 = loadAsDirectorySync(dir);
3393
+ if (n2) return n2;
3394
+ }
3395
+ }
3396
+ }
3397
+ __name(loadNodeModulesSync, "loadNodeModulesSync");
3398
+ }, "resolveSync");
3399
+ }
3400
+ });
3401
+
3402
+ // ../../node_modules/resolve/index.js
3403
+ var require_resolve = __commonJS({
3404
+ "../../node_modules/resolve/index.js"(exports, module) {
3405
+ var async = require_async();
3406
+ async.core = require_core3();
3407
+ async.isCore = require_is_core();
3408
+ async.sync = require_sync();
3409
+ module.exports = async;
3410
+ }
3411
+ });
14
3412
 
15
3413
  // src/preset.ts
16
3414
  import { fileURLToPath as fileURLToPath2 } from "node:url";
@@ -338,6 +3736,9 @@ __name(normalizeWindowsPath, "normalizeWindowsPath");
338
3736
  var _UNC_REGEX = /^[/\\]{2}/;
339
3737
  var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
340
3738
  var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
3739
+ var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
3740
+ var sep = "/";
3741
+ var delimiter = ":";
341
3742
  var normalize = /* @__PURE__ */ __name(function(path2) {
342
3743
  if (path2.length === 0) {
343
3744
  return ".";
@@ -384,8 +3785,33 @@ var join = /* @__PURE__ */ __name(function(...arguments_) {
384
3785
  if (joined === void 0) {
385
3786
  return ".";
386
3787
  }
387
- return normalize(joined.replace(/\/\/+/g, "/"));
388
- }, "join");
3788
+ return normalize(joined.replace(/\/\/+/g, "/"));
3789
+ }, "join");
3790
+ function cwd() {
3791
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
3792
+ return process.cwd().replace(/\\/g, "/");
3793
+ }
3794
+ return "/";
3795
+ }
3796
+ __name(cwd, "cwd");
3797
+ var resolve = /* @__PURE__ */ __name(function(...arguments_) {
3798
+ arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
3799
+ let resolvedPath = "";
3800
+ let resolvedAbsolute = false;
3801
+ for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
3802
+ const path2 = index >= 0 ? arguments_[index] : cwd();
3803
+ if (!path2 || path2.length === 0) {
3804
+ continue;
3805
+ }
3806
+ resolvedPath = `${path2}/${resolvedPath}`;
3807
+ resolvedAbsolute = isAbsolute(path2);
3808
+ }
3809
+ resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
3810
+ if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
3811
+ return `/${resolvedPath}`;
3812
+ }
3813
+ return resolvedPath.length > 0 ? resolvedPath : ".";
3814
+ }, "resolve");
389
3815
  function normalizeString(path2, allowAboveRoot) {
390
3816
  let res = "";
391
3817
  let lastSegmentLength = 0;
@@ -450,6 +3876,30 @@ __name(normalizeString, "normalizeString");
450
3876
  var isAbsolute = /* @__PURE__ */ __name(function(p) {
451
3877
  return _IS_ABSOLUTE_RE.test(p);
452
3878
  }, "isAbsolute");
3879
+ var toNamespacedPath = /* @__PURE__ */ __name(function(p) {
3880
+ return normalizeWindowsPath(p);
3881
+ }, "toNamespacedPath");
3882
+ var _EXTNAME_RE = /.(\.[^./]+)$/;
3883
+ var extname = /* @__PURE__ */ __name(function(p) {
3884
+ const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
3885
+ return match && match[1] || "";
3886
+ }, "extname");
3887
+ var relative = /* @__PURE__ */ __name(function(from, to) {
3888
+ const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
3889
+ const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
3890
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
3891
+ return _to.join("/");
3892
+ }
3893
+ const _fromCopy = [..._from];
3894
+ for (const segment of _fromCopy) {
3895
+ if (_to[0] !== segment) {
3896
+ break;
3897
+ }
3898
+ _from.shift();
3899
+ _to.shift();
3900
+ }
3901
+ return [..._from.map(() => ".."), ..._to].join("/");
3902
+ }, "relative");
453
3903
  var dirname = /* @__PURE__ */ __name(function(p) {
454
3904
  const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
455
3905
  if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
@@ -457,6 +3907,45 @@ var dirname = /* @__PURE__ */ __name(function(p) {
457
3907
  }
458
3908
  return segments.join("/") || (isAbsolute(p) ? "/" : ".");
459
3909
  }, "dirname");
3910
+ var format2 = /* @__PURE__ */ __name(function(p) {
3911
+ const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
3912
+ return normalizeWindowsPath(
3913
+ p.root ? resolve(...segments) : segments.join("/")
3914
+ );
3915
+ }, "format");
3916
+ var basename = /* @__PURE__ */ __name(function(p, extension) {
3917
+ const lastSegment = normalizeWindowsPath(p).split("/").pop();
3918
+ return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
3919
+ }, "basename");
3920
+ var parse = /* @__PURE__ */ __name(function(p) {
3921
+ const root = normalizeWindowsPath(p).split("/").shift() || "/";
3922
+ const base = basename(p);
3923
+ const extension = extname(base);
3924
+ return {
3925
+ root,
3926
+ dir: dirname(p),
3927
+ base,
3928
+ ext: extension,
3929
+ name: base.slice(0, base.length - extension.length)
3930
+ };
3931
+ }, "parse");
3932
+ var path = {
3933
+ __proto__: null,
3934
+ basename,
3935
+ delimiter,
3936
+ dirname,
3937
+ extname,
3938
+ format: format2,
3939
+ isAbsolute,
3940
+ join,
3941
+ normalize,
3942
+ normalizeString,
3943
+ parse,
3944
+ relative,
3945
+ resolve,
3946
+ sep,
3947
+ toNamespacedPath
3948
+ };
460
3949
 
461
3950
  // ../../core/src/shared/utils/module.ts
462
3951
  var importMetaResolve = /* @__PURE__ */ __name((...args) => {
@@ -472,6 +3961,1350 @@ var resolvePackageDir = /* @__PURE__ */ __name((pkg, parent) => {
472
3961
  return dirname(fileURLToPath(importMetaResolve(join(pkg, "package.json"), parent)));
473
3962
  }, "resolvePackageDir");
474
3963
 
3964
+ // src/componentManifest/generator.ts
3965
+ import { readFile } from "node:fs/promises";
3966
+ import { recast } from "storybook/internal/babel";
3967
+ import { loadCsf } from "storybook/internal/csf-tools";
3968
+ import { extractDescription } from "storybook/internal/csf-tools";
3969
+
3970
+ // src/componentManifest/generateCodeSnippet.ts
3971
+ import { types as t } from "storybook/internal/babel";
3972
+
3973
+ // src/componentManifest/utils.ts
3974
+ var groupBy = /* @__PURE__ */ __name((items, keySelector) => {
3975
+ return items.reduce((acc = {}, item, index) => {
3976
+ const key = keySelector(item, index);
3977
+ acc[key] ??= [];
3978
+ acc[key].push(item);
3979
+ return acc;
3980
+ }, {});
3981
+ }, "groupBy");
3982
+ function invariant(condition, message) {
3983
+ if (condition) {
3984
+ return;
3985
+ }
3986
+ throw new Error((typeof message === "function" ? message() : message) ?? "Invariant failed");
3987
+ }
3988
+ __name(invariant, "invariant");
3989
+
3990
+ // src/componentManifest/generateCodeSnippet.ts
3991
+ function getCodeSnippet(csf, storyName, componentName) {
3992
+ const storyDeclaration = csf._storyDeclarationPath[storyName];
3993
+ const metaObj = csf._metaNode;
3994
+ if (!storyDeclaration) {
3995
+ const message = "Expected story to be a function or variable declaration";
3996
+ throw csf._storyPaths[storyName]?.buildCodeFrameError(message) ?? message;
3997
+ }
3998
+ let storyPath;
3999
+ if (storyDeclaration.isFunctionDeclaration()) {
4000
+ storyPath = storyDeclaration;
4001
+ } else if (storyDeclaration.isVariableDeclarator()) {
4002
+ const init = storyDeclaration.get("init");
4003
+ invariant(
4004
+ init.isExpression(),
4005
+ () => storyDeclaration.buildCodeFrameError("Expected story initializer to be an expression").message
4006
+ );
4007
+ storyPath = init;
4008
+ } else {
4009
+ throw storyDeclaration.buildCodeFrameError(
4010
+ "Expected story to be a function or variable declaration"
4011
+ );
4012
+ }
4013
+ let normalizedPath = storyPath;
4014
+ if (storyPath.isCallExpression()) {
4015
+ const callee = storyPath.get("callee");
4016
+ if (callee.isMemberExpression()) {
4017
+ const obj = callee.get("object");
4018
+ const prop = callee.get("property");
4019
+ const isBind = prop.isIdentifier() && prop.node.name === "bind" || t.isStringLiteral(prop.node) && prop.node.value === "bind";
4020
+ if (obj.isIdentifier() && isBind) {
4021
+ const resolved = resolveBindIdentifierInit(storyDeclaration, obj);
4022
+ if (resolved) {
4023
+ normalizedPath = resolved;
4024
+ }
4025
+ }
4026
+ }
4027
+ if (storyPath === normalizedPath) {
4028
+ const args = storyPath.get("arguments");
4029
+ if (args.length === 0) {
4030
+ } else {
4031
+ invariant(
4032
+ args.length === 1,
4033
+ () => storyPath.buildCodeFrameError("Could not evaluate story expression").message
4034
+ );
4035
+ const storyArg = args[0];
4036
+ invariant(
4037
+ storyArg.isExpression(),
4038
+ () => storyPath.buildCodeFrameError("Could not evaluate story expression").message
4039
+ );
4040
+ normalizedPath = storyArg;
4041
+ }
4042
+ }
4043
+ }
4044
+ normalizedPath = normalizedPath.isTSSatisfiesExpression() ? normalizedPath.get("expression") : normalizedPath.isTSAsExpression() ? normalizedPath.get("expression") : normalizedPath;
4045
+ let storyFn;
4046
+ if (normalizedPath.isArrowFunctionExpression() || normalizedPath.isFunctionExpression() || normalizedPath.isFunctionDeclaration()) {
4047
+ storyFn = normalizedPath;
4048
+ } else if (!normalizedPath.isObjectExpression()) {
4049
+ if (normalizedPath.isCallExpression() && Array.isArray(normalizedPath.node.arguments) && normalizedPath.node.arguments.length === 0) {
4050
+ } else {
4051
+ throw normalizedPath.buildCodeFrameError(
4052
+ "Expected story to be csf factory, function or an object expression"
4053
+ );
4054
+ }
4055
+ }
4056
+ const storyProps = normalizedPath.isObjectExpression() ? normalizedPath.get("properties").filter((p) => p.isObjectProperty()) : [];
4057
+ const metaPath = pathForNode(csf._file.path, metaObj);
4058
+ const metaProps = metaPath?.isObjectExpression() ? metaPath.get("properties").filter((p) => p.isObjectProperty()) : [];
4059
+ const getRenderPath = /* @__PURE__ */ __name((object) => object.filter((p) => keyOf(p.node) === "render").map((p) => p.get("value")).find(
4060
+ (v) => v.isArrowFunctionExpression() || v.isFunctionExpression()
4061
+ ), "getRenderPath");
4062
+ const renderPath = getRenderPath(storyProps);
4063
+ const metaRenderPath = getRenderPath(metaProps);
4064
+ storyFn ??= renderPath ?? metaRenderPath;
4065
+ const metaArgs = metaArgsRecord(metaObj ?? null);
4066
+ const storyArgsPath = storyProps.filter((p) => keyOf(p.node) === "args").map((p) => p.get("value")).find((v) => v.isObjectExpression());
4067
+ const storyArgs = argsRecordFromObjectPath(storyArgsPath);
4068
+ const merged = { ...metaArgs, ...storyArgs };
4069
+ const entries = Object.entries(merged).filter(([k]) => k !== "children");
4070
+ const validEntries = entries.filter(([k, v]) => isValidJsxAttrName(k) && v != null);
4071
+ const invalidEntries = entries.filter(([k, v]) => !isValidJsxAttrName(k) && v != null);
4072
+ const injectedAttrs = validEntries.map(([k, v]) => toAttr(k, v)).filter((a) => a != null);
4073
+ if (storyFn) {
4074
+ const fn = storyFn.node;
4075
+ if (t.isArrowFunctionExpression(fn) && (t.isJSXElement(fn.body) || t.isJSXFragment(fn.body))) {
4076
+ const spreadRes = transformArgsSpreadsInJsx(fn.body, merged);
4077
+ const inlineRes = inlineArgsInJsx(spreadRes.node, merged);
4078
+ if (spreadRes.changed || inlineRes.changed) {
4079
+ const newFn = t.arrowFunctionExpression([], inlineRes.node, fn.async);
4080
+ return t.variableDeclaration("const", [
4081
+ t.variableDeclarator(t.identifier(storyName), newFn)
4082
+ ]);
4083
+ }
4084
+ }
4085
+ const stmts = t.isFunctionDeclaration(fn) ? fn.body.body : t.isArrowFunctionExpression(fn) && t.isBlockStatement(fn.body) ? fn.body.body : t.isFunctionExpression(fn) && t.isBlockStatement(fn.body) ? fn.body.body : void 0;
4086
+ if (stmts) {
4087
+ let changed = false;
4088
+ const newBody = stmts.map((stmt) => {
4089
+ if (t.isReturnStatement(stmt) && stmt.argument && (t.isJSXElement(stmt.argument) || t.isJSXFragment(stmt.argument))) {
4090
+ const spreadRes = transformArgsSpreadsInJsx(stmt.argument, merged);
4091
+ const inlineRes = inlineArgsInJsx(spreadRes.node, merged);
4092
+ if (spreadRes.changed || inlineRes.changed) {
4093
+ changed = true;
4094
+ return t.returnStatement(inlineRes.node);
4095
+ }
4096
+ }
4097
+ return stmt;
4098
+ });
4099
+ if (changed) {
4100
+ return t.isFunctionDeclaration(fn) ? t.functionDeclaration(fn.id, [], t.blockStatement(newBody), fn.generator, fn.async) : t.variableDeclaration("const", [
4101
+ t.variableDeclarator(
4102
+ t.identifier(storyName),
4103
+ t.arrowFunctionExpression([], t.blockStatement(newBody), fn.async)
4104
+ )
4105
+ ]);
4106
+ }
4107
+ }
4108
+ return t.isFunctionDeclaration(fn) ? fn : t.variableDeclaration("const", [t.variableDeclarator(t.identifier(storyName), fn)]);
4109
+ }
4110
+ invariant(componentName, "Could not generate snippet without component name.");
4111
+ const invalidSpread = buildInvalidSpread(invalidEntries);
4112
+ const name = t.jsxIdentifier(componentName);
4113
+ const openingElAttrs = invalidSpread ? [...injectedAttrs, invalidSpread] : injectedAttrs;
4114
+ const arrow = t.arrowFunctionExpression(
4115
+ [],
4116
+ t.jsxElement(
4117
+ t.jsxOpeningElement(name, openingElAttrs, false),
4118
+ t.jsxClosingElement(name),
4119
+ toJsxChildren(merged.children),
4120
+ false
4121
+ )
4122
+ );
4123
+ return t.variableDeclaration("const", [t.variableDeclarator(t.identifier(storyName), arrow)]);
4124
+ }
4125
+ __name(getCodeSnippet, "getCodeSnippet");
4126
+ function buildInvalidSpread(entries) {
4127
+ if (entries.length === 0) {
4128
+ return null;
4129
+ }
4130
+ const objectProps = entries.map(
4131
+ ([k, v]) => t.objectProperty(t.stringLiteral(k), t.isExpression(v) ? v : t.identifier("undefined"))
4132
+ );
4133
+ return t.jsxSpreadAttribute(t.objectExpression(objectProps));
4134
+ }
4135
+ __name(buildInvalidSpread, "buildInvalidSpread");
4136
+ var keyOf = /* @__PURE__ */ __name((p) => t.isIdentifier(p.key) ? p.key.name : t.isStringLiteral(p.key) ? p.key.value : null, "keyOf");
4137
+ var isValidJsxAttrName = /* @__PURE__ */ __name((n) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(n), "isValidJsxAttrName");
4138
+ var argsRecordFromObjectPath = /* @__PURE__ */ __name((objPath) => objPath ? Object.fromEntries(
4139
+ objPath.get("properties").filter((p) => p.isObjectProperty()).map((p) => [keyOf(p.node), p.get("value").node]).filter((e) => Boolean(e[0]))
4140
+ ) : {}, "argsRecordFromObjectPath");
4141
+ var argsRecordFromObjectNode = /* @__PURE__ */ __name((obj) => obj ? Object.fromEntries(
4142
+ obj.properties.filter((p) => t.isObjectProperty(p)).map((p) => [keyOf(p), p.value]).filter((e) => Boolean(e[0]))
4143
+ ) : {}, "argsRecordFromObjectNode");
4144
+ var metaArgsRecord = /* @__PURE__ */ __name((meta) => {
4145
+ if (!meta) {
4146
+ return {};
4147
+ }
4148
+ const argsProp = meta.properties.find(
4149
+ (p) => t.isObjectProperty(p) && keyOf(p) === "args"
4150
+ );
4151
+ return argsProp && t.isObjectExpression(argsProp.value) ? argsRecordFromObjectNode(argsProp.value) : {};
4152
+ }, "metaArgsRecord");
4153
+ var toAttr = /* @__PURE__ */ __name((key, value) => {
4154
+ if (t.isBooleanLiteral(value)) {
4155
+ return value.value ? t.jsxAttribute(t.jsxIdentifier(key), null) : t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(value));
4156
+ }
4157
+ if (t.isStringLiteral(value)) {
4158
+ return t.jsxAttribute(t.jsxIdentifier(key), t.stringLiteral(value.value));
4159
+ }
4160
+ if (t.isExpression(value)) {
4161
+ return t.jsxAttribute(t.jsxIdentifier(key), t.jsxExpressionContainer(value));
4162
+ }
4163
+ return null;
4164
+ }, "toAttr");
4165
+ var toJsxChildren = /* @__PURE__ */ __name((node) => !node ? [] : t.isStringLiteral(node) ? [t.jsxText(node.value)] : t.isJSXElement(node) || t.isJSXFragment(node) ? [node] : t.isExpression(node) ? [t.jsxExpressionContainer(node)] : [], "toJsxChildren");
4166
+ function getArgsMemberKey(expr) {
4167
+ if (t.isMemberExpression(expr) && t.isIdentifier(expr.object) && expr.object.name === "args") {
4168
+ if (t.isIdentifier(expr.property) && !expr.computed) {
4169
+ return expr.property.name;
4170
+ }
4171
+ if (t.isStringLiteral(expr.property) && expr.computed) {
4172
+ return expr.property.value;
4173
+ }
4174
+ }
4175
+ if (t.isOptionalMemberExpression?.(expr) && t.isIdentifier(expr.object) && expr.object.name === "args") {
4176
+ const prop = expr.property;
4177
+ if (t.isIdentifier(prop) && !expr.computed) {
4178
+ return prop.name;
4179
+ }
4180
+ if (t.isStringLiteral(prop) && expr.computed) {
4181
+ return prop.value;
4182
+ }
4183
+ }
4184
+ return null;
4185
+ }
4186
+ __name(getArgsMemberKey, "getArgsMemberKey");
4187
+ function inlineArgsInJsx(node, merged) {
4188
+ let changed = false;
4189
+ if (t.isJSXElement(node)) {
4190
+ const opening = node.openingElement;
4191
+ const newAttrs = opening.attributes.flatMap((a) => {
4192
+ if (!t.isJSXAttribute(a)) {
4193
+ return [a];
4194
+ }
4195
+ const name = t.isJSXIdentifier(a.name) ? a.name.name : null;
4196
+ if (!(name && a.value && t.isJSXExpressionContainer(a.value))) {
4197
+ return [a];
4198
+ }
4199
+ const key = getArgsMemberKey(a.value.expression);
4200
+ if (!(key && key in merged)) {
4201
+ return [a];
4202
+ }
4203
+ const repl = toAttr(name, merged[key]);
4204
+ changed = true;
4205
+ return repl ? [repl] : [];
4206
+ });
4207
+ const newChildren = node.children.flatMap((c) => {
4208
+ if (t.isJSXElement(c) || t.isJSXFragment(c)) {
4209
+ const res = inlineArgsInJsx(c, merged);
4210
+ changed ||= res.changed;
4211
+ return [res.node];
4212
+ }
4213
+ if (t.isJSXExpressionContainer(c)) {
4214
+ const key = getArgsMemberKey(c.expression);
4215
+ if (key === "children" && merged.children) {
4216
+ changed = true;
4217
+ return toJsxChildren(merged.children);
4218
+ }
4219
+ }
4220
+ return [c];
4221
+ });
4222
+ const selfClosing = opening.selfClosing && newChildren.length === 0;
4223
+ return {
4224
+ node: t.jsxElement(
4225
+ t.jsxOpeningElement(opening.name, newAttrs, selfClosing),
4226
+ selfClosing ? null : node.closingElement ?? t.jsxClosingElement(opening.name),
4227
+ newChildren,
4228
+ selfClosing
4229
+ ),
4230
+ changed
4231
+ };
4232
+ }
4233
+ const fragChildren = node.children.flatMap((c) => {
4234
+ if (t.isJSXElement(c) || t.isJSXFragment(c)) {
4235
+ const res = inlineArgsInJsx(c, merged);
4236
+ changed ||= res.changed;
4237
+ return [res.node];
4238
+ }
4239
+ if (t.isJSXExpressionContainer(c)) {
4240
+ const key = getArgsMemberKey(c.expression);
4241
+ if (key === "children" && "children" in merged) {
4242
+ changed = true;
4243
+ return toJsxChildren(merged.children);
4244
+ }
4245
+ }
4246
+ return [c];
4247
+ });
4248
+ return { node: t.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
4249
+ }
4250
+ __name(inlineArgsInJsx, "inlineArgsInJsx");
4251
+ function transformArgsSpreadsInJsx(node, merged) {
4252
+ let changed = false;
4253
+ const makeInjectedPieces = /* @__PURE__ */ __name((existing) => {
4254
+ const entries = Object.entries(merged).filter(([k, v]) => v != null && k !== "children");
4255
+ const validEntries = entries.filter(([k]) => isValidJsxAttrName(k));
4256
+ const invalidEntries = entries.filter(([k]) => !isValidJsxAttrName(k));
4257
+ const injectedAttrs = validEntries.map(([k, v]) => toAttr(k, v)).filter((a) => Boolean(a)).filter((a) => t.isJSXIdentifier(a.name) && !existing.has(a.name.name));
4258
+ const invalidSpread = buildInvalidSpread(invalidEntries.filter(([k]) => !existing.has(k)));
4259
+ return invalidSpread ? [...injectedAttrs, invalidSpread] : injectedAttrs;
4260
+ }, "makeInjectedPieces");
4261
+ if (t.isJSXElement(node)) {
4262
+ const opening = node.openingElement;
4263
+ const attrs = opening.attributes;
4264
+ const isArgsSpread = /* @__PURE__ */ __name((a) => t.isJSXSpreadAttribute(a) && t.isIdentifier(a.argument) && a.argument.name === "args", "isArgsSpread");
4265
+ const sawArgsSpread = attrs.some(isArgsSpread);
4266
+ const firstIdx = attrs.findIndex(isArgsSpread);
4267
+ const nonArgsAttrs = attrs.filter((a) => !isArgsSpread(a));
4268
+ const insertionIndex = sawArgsSpread ? attrs.slice(0, firstIdx).filter((a) => !isArgsSpread(a)).length : 0;
4269
+ const newAttrs = sawArgsSpread ? (() => {
4270
+ const existing = new Set(
4271
+ nonArgsAttrs.filter((a) => t.isJSXAttribute(a)).flatMap((a) => t.isJSXIdentifier(a.name) ? [a.name.name] : [])
4272
+ );
4273
+ const pieces = makeInjectedPieces(existing);
4274
+ changed = true;
4275
+ return [
4276
+ ...nonArgsAttrs.slice(0, insertionIndex),
4277
+ ...pieces,
4278
+ ...nonArgsAttrs.slice(insertionIndex)
4279
+ ];
4280
+ })() : nonArgsAttrs;
4281
+ const newChildren = node.children.flatMap((c) => {
4282
+ if (t.isJSXElement(c) || t.isJSXFragment(c)) {
4283
+ const res = transformArgsSpreadsInJsx(c, merged);
4284
+ changed ||= res.changed;
4285
+ return [res.node];
4286
+ }
4287
+ return [c];
4288
+ });
4289
+ const children = sawArgsSpread && newChildren.length === 0 && merged.children ? (changed = true, toJsxChildren(merged.children)) : newChildren;
4290
+ const selfClosing = children.length === 0;
4291
+ return {
4292
+ node: t.jsxElement(
4293
+ t.jsxOpeningElement(opening.name, newAttrs, selfClosing),
4294
+ selfClosing ? null : node.closingElement ?? t.jsxClosingElement(opening.name),
4295
+ children,
4296
+ selfClosing
4297
+ ),
4298
+ changed
4299
+ };
4300
+ }
4301
+ const fragChildren = node.children.flatMap((c) => {
4302
+ if (t.isJSXElement(c) || t.isJSXFragment(c)) {
4303
+ const res = transformArgsSpreadsInJsx(c, merged);
4304
+ changed ||= res.changed;
4305
+ return [res.node];
4306
+ }
4307
+ return [c];
4308
+ });
4309
+ return { node: t.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
4310
+ }
4311
+ __name(transformArgsSpreadsInJsx, "transformArgsSpreadsInJsx");
4312
+ function resolveBindIdentifierInit(storyPath, identifier) {
4313
+ const programPath = storyPath.findParent((p) => p.isProgram());
4314
+ if (!programPath) {
4315
+ return null;
4316
+ }
4317
+ const declarators = programPath.get("body").flatMap((stmt) => {
4318
+ if (stmt.isVariableDeclaration()) {
4319
+ return stmt.get("declarations");
4320
+ }
4321
+ if (stmt.isExportNamedDeclaration()) {
4322
+ const decl = stmt.get("declaration");
4323
+ if (decl && decl.isVariableDeclaration()) {
4324
+ return decl.get("declarations");
4325
+ }
4326
+ }
4327
+ return [];
4328
+ });
4329
+ const match = declarators.find((d) => {
4330
+ const id = d.get("id");
4331
+ return id.isIdentifier() && id.node.name === identifier.node.name;
4332
+ });
4333
+ if (!match) {
4334
+ return null;
4335
+ }
4336
+ const init = match.get("init");
4337
+ return init && init.isExpression() ? init : null;
4338
+ }
4339
+ __name(resolveBindIdentifierInit, "resolveBindIdentifierInit");
4340
+ function pathForNode(program, target) {
4341
+ if (!target) {
4342
+ return void 0;
4343
+ }
4344
+ let found;
4345
+ program.traverse({
4346
+ enter(p) {
4347
+ if (p.node && p.node === target) {
4348
+ found = p;
4349
+ p.stop();
4350
+ }
4351
+ }
4352
+ });
4353
+ return found;
4354
+ }
4355
+ __name(pathForNode, "pathForNode");
4356
+
4357
+ // ../../node_modules/comment-parser/es6/primitives.js
4358
+ var Markers;
4359
+ (function(Markers2) {
4360
+ Markers2["start"] = "/**";
4361
+ Markers2["nostart"] = "/***";
4362
+ Markers2["delim"] = "*";
4363
+ Markers2["end"] = "*/";
4364
+ })(Markers = Markers || (Markers = {}));
4365
+
4366
+ // ../../node_modules/comment-parser/es6/util.js
4367
+ function isSpace(source) {
4368
+ return /^\s+$/.test(source);
4369
+ }
4370
+ __name(isSpace, "isSpace");
4371
+ function splitCR(source) {
4372
+ const matches = source.match(/\r+$/);
4373
+ return matches == null ? ["", source] : [source.slice(-matches[0].length), source.slice(0, -matches[0].length)];
4374
+ }
4375
+ __name(splitCR, "splitCR");
4376
+ function splitSpace(source) {
4377
+ const matches = source.match(/^\s+/);
4378
+ return matches == null ? ["", source] : [source.slice(0, matches[0].length), source.slice(matches[0].length)];
4379
+ }
4380
+ __name(splitSpace, "splitSpace");
4381
+ function splitLines(source) {
4382
+ return source.split(/\n/);
4383
+ }
4384
+ __name(splitLines, "splitLines");
4385
+ function seedSpec(spec = {}) {
4386
+ return Object.assign({ tag: "", name: "", type: "", optional: false, description: "", problems: [], source: [] }, spec);
4387
+ }
4388
+ __name(seedSpec, "seedSpec");
4389
+ function seedTokens(tokens = {}) {
4390
+ return Object.assign({ start: "", delimiter: "", postDelimiter: "", tag: "", postTag: "", name: "", postName: "", type: "", postType: "", description: "", end: "", lineEnd: "" }, tokens);
4391
+ }
4392
+ __name(seedTokens, "seedTokens");
4393
+
4394
+ // ../../node_modules/comment-parser/es6/parser/block-parser.js
4395
+ var reTag = /^@\S+/;
4396
+ function getParser({ fence = "```" } = {}) {
4397
+ const fencer = getFencer(fence);
4398
+ const toggleFence = /* @__PURE__ */ __name((source, isFenced) => fencer(source) ? !isFenced : isFenced, "toggleFence");
4399
+ return /* @__PURE__ */ __name(function parseBlock(source) {
4400
+ const sections = [[]];
4401
+ let isFenced = false;
4402
+ for (const line of source) {
4403
+ if (reTag.test(line.tokens.description) && !isFenced) {
4404
+ sections.push([line]);
4405
+ } else {
4406
+ sections[sections.length - 1].push(line);
4407
+ }
4408
+ isFenced = toggleFence(line.tokens.description, isFenced);
4409
+ }
4410
+ return sections;
4411
+ }, "parseBlock");
4412
+ }
4413
+ __name(getParser, "getParser");
4414
+ function getFencer(fence) {
4415
+ if (typeof fence === "string")
4416
+ return (source) => source.split(fence).length % 2 === 0;
4417
+ return fence;
4418
+ }
4419
+ __name(getFencer, "getFencer");
4420
+
4421
+ // ../../node_modules/comment-parser/es6/parser/source-parser.js
4422
+ function getParser2({ startLine = 0, markers = Markers } = {}) {
4423
+ let block = null;
4424
+ let num = startLine;
4425
+ return /* @__PURE__ */ __name(function parseSource(source) {
4426
+ let rest = source;
4427
+ const tokens = seedTokens();
4428
+ [tokens.lineEnd, rest] = splitCR(rest);
4429
+ [tokens.start, rest] = splitSpace(rest);
4430
+ if (block === null && rest.startsWith(markers.start) && !rest.startsWith(markers.nostart)) {
4431
+ block = [];
4432
+ tokens.delimiter = rest.slice(0, markers.start.length);
4433
+ rest = rest.slice(markers.start.length);
4434
+ [tokens.postDelimiter, rest] = splitSpace(rest);
4435
+ }
4436
+ if (block === null) {
4437
+ num++;
4438
+ return null;
4439
+ }
4440
+ const isClosed = rest.trimRight().endsWith(markers.end);
4441
+ if (tokens.delimiter === "" && rest.startsWith(markers.delim) && !rest.startsWith(markers.end)) {
4442
+ tokens.delimiter = markers.delim;
4443
+ rest = rest.slice(markers.delim.length);
4444
+ [tokens.postDelimiter, rest] = splitSpace(rest);
4445
+ }
4446
+ if (isClosed) {
4447
+ const trimmed = rest.trimRight();
4448
+ tokens.end = rest.slice(trimmed.length - markers.end.length);
4449
+ rest = trimmed.slice(0, -markers.end.length);
4450
+ }
4451
+ tokens.description = rest;
4452
+ block.push({ number: num, source, tokens });
4453
+ num++;
4454
+ if (isClosed) {
4455
+ const result = block.slice();
4456
+ block = null;
4457
+ return result;
4458
+ }
4459
+ return null;
4460
+ }, "parseSource");
4461
+ }
4462
+ __name(getParser2, "getParser");
4463
+
4464
+ // ../../node_modules/comment-parser/es6/parser/spec-parser.js
4465
+ function getParser3({ tokenizers }) {
4466
+ return /* @__PURE__ */ __name(function parseSpec(source) {
4467
+ var _a;
4468
+ let spec = seedSpec({ source });
4469
+ for (const tokenize of tokenizers) {
4470
+ spec = tokenize(spec);
4471
+ if ((_a = spec.problems[spec.problems.length - 1]) === null || _a === void 0 ? void 0 : _a.critical)
4472
+ break;
4473
+ }
4474
+ return spec;
4475
+ }, "parseSpec");
4476
+ }
4477
+ __name(getParser3, "getParser");
4478
+
4479
+ // ../../node_modules/comment-parser/es6/parser/tokenizers/tag.js
4480
+ function tagTokenizer() {
4481
+ return (spec) => {
4482
+ const { tokens } = spec.source[0];
4483
+ const match = tokens.description.match(/\s*(@(\S+))(\s*)/);
4484
+ if (match === null) {
4485
+ spec.problems.push({
4486
+ code: "spec:tag:prefix",
4487
+ message: 'tag should start with "@" symbol',
4488
+ line: spec.source[0].number,
4489
+ critical: true
4490
+ });
4491
+ return spec;
4492
+ }
4493
+ tokens.tag = match[1];
4494
+ tokens.postTag = match[3];
4495
+ tokens.description = tokens.description.slice(match[0].length);
4496
+ spec.tag = match[2];
4497
+ return spec;
4498
+ };
4499
+ }
4500
+ __name(tagTokenizer, "tagTokenizer");
4501
+
4502
+ // ../../node_modules/comment-parser/es6/parser/tokenizers/type.js
4503
+ function typeTokenizer(spacing = "compact") {
4504
+ const join5 = getJoiner(spacing);
4505
+ return (spec) => {
4506
+ let curlies = 0;
4507
+ let lines = [];
4508
+ for (const [i, { tokens }] of spec.source.entries()) {
4509
+ let type = "";
4510
+ if (i === 0 && tokens.description[0] !== "{")
4511
+ return spec;
4512
+ for (const ch of tokens.description) {
4513
+ if (ch === "{")
4514
+ curlies++;
4515
+ if (ch === "}")
4516
+ curlies--;
4517
+ type += ch;
4518
+ if (curlies === 0)
4519
+ break;
4520
+ }
4521
+ lines.push([tokens, type]);
4522
+ if (curlies === 0)
4523
+ break;
4524
+ }
4525
+ if (curlies !== 0) {
4526
+ spec.problems.push({
4527
+ code: "spec:type:unpaired-curlies",
4528
+ message: "unpaired curlies",
4529
+ line: spec.source[0].number,
4530
+ critical: true
4531
+ });
4532
+ return spec;
4533
+ }
4534
+ const parts = [];
4535
+ const offset = lines[0][0].postDelimiter.length;
4536
+ for (const [i, [tokens, type]] of lines.entries()) {
4537
+ tokens.type = type;
4538
+ if (i > 0) {
4539
+ tokens.type = tokens.postDelimiter.slice(offset) + type;
4540
+ tokens.postDelimiter = tokens.postDelimiter.slice(0, offset);
4541
+ }
4542
+ [tokens.postType, tokens.description] = splitSpace(tokens.description.slice(type.length));
4543
+ parts.push(tokens.type);
4544
+ }
4545
+ parts[0] = parts[0].slice(1);
4546
+ parts[parts.length - 1] = parts[parts.length - 1].slice(0, -1);
4547
+ spec.type = join5(parts);
4548
+ return spec;
4549
+ };
4550
+ }
4551
+ __name(typeTokenizer, "typeTokenizer");
4552
+ var trim = /* @__PURE__ */ __name((x) => x.trim(), "trim");
4553
+ function getJoiner(spacing) {
4554
+ if (spacing === "compact")
4555
+ return (t4) => t4.map(trim).join("");
4556
+ else if (spacing === "preserve")
4557
+ return (t4) => t4.join("\n");
4558
+ else
4559
+ return spacing;
4560
+ }
4561
+ __name(getJoiner, "getJoiner");
4562
+
4563
+ // ../../node_modules/comment-parser/es6/parser/tokenizers/name.js
4564
+ var isQuoted = /* @__PURE__ */ __name((s) => s && s.startsWith('"') && s.endsWith('"'), "isQuoted");
4565
+ function nameTokenizer() {
4566
+ const typeEnd = /* @__PURE__ */ __name((num, { tokens }, i) => tokens.type === "" ? num : i, "typeEnd");
4567
+ return (spec) => {
4568
+ const { tokens } = spec.source[spec.source.reduce(typeEnd, 0)];
4569
+ const source = tokens.description.trimLeft();
4570
+ const quotedGroups = source.split('"');
4571
+ if (quotedGroups.length > 1 && quotedGroups[0] === "" && quotedGroups.length % 2 === 1) {
4572
+ spec.name = quotedGroups[1];
4573
+ tokens.name = `"${quotedGroups[1]}"`;
4574
+ [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
4575
+ return spec;
4576
+ }
4577
+ let brackets = 0;
4578
+ let name = "";
4579
+ let optional = false;
4580
+ let defaultValue;
4581
+ for (const ch of source) {
4582
+ if (brackets === 0 && isSpace(ch))
4583
+ break;
4584
+ if (ch === "[")
4585
+ brackets++;
4586
+ if (ch === "]")
4587
+ brackets--;
4588
+ name += ch;
4589
+ }
4590
+ if (brackets !== 0) {
4591
+ spec.problems.push({
4592
+ code: "spec:name:unpaired-brackets",
4593
+ message: "unpaired brackets",
4594
+ line: spec.source[0].number,
4595
+ critical: true
4596
+ });
4597
+ return spec;
4598
+ }
4599
+ const nameToken = name;
4600
+ if (name[0] === "[" && name[name.length - 1] === "]") {
4601
+ optional = true;
4602
+ name = name.slice(1, -1);
4603
+ const parts = name.split("=");
4604
+ name = parts[0].trim();
4605
+ if (parts[1] !== void 0)
4606
+ defaultValue = parts.slice(1).join("=").trim();
4607
+ if (name === "") {
4608
+ spec.problems.push({
4609
+ code: "spec:name:empty-name",
4610
+ message: "empty name",
4611
+ line: spec.source[0].number,
4612
+ critical: true
4613
+ });
4614
+ return spec;
4615
+ }
4616
+ if (defaultValue === "") {
4617
+ spec.problems.push({
4618
+ code: "spec:name:empty-default",
4619
+ message: "empty default value",
4620
+ line: spec.source[0].number,
4621
+ critical: true
4622
+ });
4623
+ return spec;
4624
+ }
4625
+ if (!isQuoted(defaultValue) && /=(?!>)/.test(defaultValue)) {
4626
+ spec.problems.push({
4627
+ code: "spec:name:invalid-default",
4628
+ message: "invalid default value syntax",
4629
+ line: spec.source[0].number,
4630
+ critical: true
4631
+ });
4632
+ return spec;
4633
+ }
4634
+ }
4635
+ spec.optional = optional;
4636
+ spec.name = name;
4637
+ tokens.name = nameToken;
4638
+ if (defaultValue !== void 0)
4639
+ spec.default = defaultValue;
4640
+ [tokens.postName, tokens.description] = splitSpace(source.slice(tokens.name.length));
4641
+ return spec;
4642
+ };
4643
+ }
4644
+ __name(nameTokenizer, "nameTokenizer");
4645
+
4646
+ // ../../node_modules/comment-parser/es6/parser/tokenizers/description.js
4647
+ function descriptionTokenizer(spacing = "compact", markers = Markers) {
4648
+ const join5 = getJoiner2(spacing);
4649
+ return (spec) => {
4650
+ spec.description = join5(spec.source, markers);
4651
+ return spec;
4652
+ };
4653
+ }
4654
+ __name(descriptionTokenizer, "descriptionTokenizer");
4655
+ function getJoiner2(spacing) {
4656
+ if (spacing === "compact")
4657
+ return compactJoiner;
4658
+ if (spacing === "preserve")
4659
+ return preserveJoiner;
4660
+ return spacing;
4661
+ }
4662
+ __name(getJoiner2, "getJoiner");
4663
+ function compactJoiner(lines, markers = Markers) {
4664
+ return lines.map(({ tokens: { description } }) => description.trim()).filter((description) => description !== "").join(" ");
4665
+ }
4666
+ __name(compactJoiner, "compactJoiner");
4667
+ var lineNo = /* @__PURE__ */ __name((num, { tokens }, i) => tokens.type === "" ? num : i, "lineNo");
4668
+ var getDescription = /* @__PURE__ */ __name(({ tokens }) => (tokens.delimiter === "" ? tokens.start : tokens.postDelimiter.slice(1)) + tokens.description, "getDescription");
4669
+ function preserveJoiner(lines, markers = Markers) {
4670
+ if (lines.length === 0)
4671
+ return "";
4672
+ if (lines[0].tokens.description === "" && lines[0].tokens.delimiter === markers.start)
4673
+ lines = lines.slice(1);
4674
+ const lastLine = lines[lines.length - 1];
4675
+ if (lastLine !== void 0 && lastLine.tokens.description === "" && lastLine.tokens.end.endsWith(markers.end))
4676
+ lines = lines.slice(0, -1);
4677
+ lines = lines.slice(lines.reduce(lineNo, 0));
4678
+ return lines.map(getDescription).join("\n");
4679
+ }
4680
+ __name(preserveJoiner, "preserveJoiner");
4681
+
4682
+ // ../../node_modules/comment-parser/es6/parser/index.js
4683
+ function getParser4({ startLine = 0, fence = "```", spacing = "compact", markers = Markers, tokenizers = [
4684
+ tagTokenizer(),
4685
+ typeTokenizer(spacing),
4686
+ nameTokenizer(),
4687
+ descriptionTokenizer(spacing)
4688
+ ] } = {}) {
4689
+ if (startLine < 0 || startLine % 1 > 0)
4690
+ throw new Error("Invalid startLine");
4691
+ const parseSource = getParser2({ startLine, markers });
4692
+ const parseBlock = getParser({ fence });
4693
+ const parseSpec = getParser3({ tokenizers });
4694
+ const joinDescription = getJoiner2(spacing);
4695
+ return function(source) {
4696
+ const blocks = [];
4697
+ for (const line of splitLines(source)) {
4698
+ const lines = parseSource(line);
4699
+ if (lines === null)
4700
+ continue;
4701
+ const sections = parseBlock(lines);
4702
+ const specs = sections.slice(1).map(parseSpec);
4703
+ blocks.push({
4704
+ description: joinDescription(sections[0], markers),
4705
+ tags: specs,
4706
+ source: lines,
4707
+ problems: specs.reduce((acc, spec) => acc.concat(spec.problems), [])
4708
+ });
4709
+ }
4710
+ return blocks;
4711
+ };
4712
+ }
4713
+ __name(getParser4, "getParser");
4714
+
4715
+ // ../../node_modules/comment-parser/es6/stringifier/index.js
4716
+ function join2(tokens) {
4717
+ return tokens.start + tokens.delimiter + tokens.postDelimiter + tokens.tag + tokens.postTag + tokens.type + tokens.postType + tokens.name + tokens.postName + tokens.description + tokens.end + tokens.lineEnd;
4718
+ }
4719
+ __name(join2, "join");
4720
+ function getStringifier() {
4721
+ return (block) => block.source.map(({ tokens }) => join2(tokens)).join("\n");
4722
+ }
4723
+ __name(getStringifier, "getStringifier");
4724
+
4725
+ // ../../node_modules/comment-parser/es6/stringifier/inspect.js
4726
+ var zeroWidth = {
4727
+ line: 0,
4728
+ start: 0,
4729
+ delimiter: 0,
4730
+ postDelimiter: 0,
4731
+ tag: 0,
4732
+ postTag: 0,
4733
+ name: 0,
4734
+ postName: 0,
4735
+ type: 0,
4736
+ postType: 0,
4737
+ description: 0,
4738
+ end: 0,
4739
+ lineEnd: 0
4740
+ };
4741
+ var fields = Object.keys(zeroWidth);
4742
+
4743
+ // ../../node_modules/comment-parser/es6/index.js
4744
+ function parse2(source, options = {}) {
4745
+ return getParser4(options)(source);
4746
+ }
4747
+ __name(parse2, "parse");
4748
+ var stringify = getStringifier();
4749
+
4750
+ // src/componentManifest/jsdocTags.ts
4751
+ function extractJSDocInfo(jsdocComment) {
4752
+ const lines = jsdocComment.split("\n");
4753
+ const jsDoc = ["/**", ...lines.map((line) => ` * ${line}`), " */"].join("\n");
4754
+ const parsed = parse2(jsDoc);
4755
+ return {
4756
+ description: parsed[0].description,
4757
+ tags: Object.fromEntries(
4758
+ Object.entries(groupBy(parsed[0].tags, (it) => it.tag)).map(([key, tags]) => [
4759
+ key,
4760
+ tags?.map((tag) => (tag.type ? `{${tag.type}} ` : "") + `${tag.name} ${tag.description}`) ?? []
4761
+ ])
4762
+ )
4763
+ };
4764
+ }
4765
+ __name(extractJSDocInfo, "extractJSDocInfo");
4766
+
4767
+ // src/componentManifest/reactDocgen.ts
4768
+ import { existsSync as existsSync2 } from "node:fs";
4769
+ import { sep as sep2 } from "node:path";
4770
+ import { types as t2 } from "storybook/internal/babel";
4771
+ import { getProjectRoot } from "storybook/internal/common";
4772
+
4773
+ // ../../node_modules/empathic/find.mjs
4774
+ import { join as join4 } from "node:path";
4775
+ import { existsSync, statSync } from "node:fs";
4776
+
4777
+ // ../../node_modules/empathic/walk.mjs
4778
+ import { dirname as dirname2 } from "node:path";
4779
+
4780
+ // ../../node_modules/empathic/resolve.mjs
4781
+ import { isAbsolute as isAbsolute2, join as join3, resolve as resolve2 } from "node:path";
4782
+ function absolute(input, root) {
4783
+ return isAbsolute2(input) ? input : resolve2(root || ".", input);
4784
+ }
4785
+ __name(absolute, "absolute");
4786
+
4787
+ // ../../node_modules/empathic/walk.mjs
4788
+ function up(base, options) {
4789
+ let { last, cwd: cwd2 } = options || {};
4790
+ let tmp = absolute(base, cwd2);
4791
+ let root = absolute(last || "/", cwd2);
4792
+ let prev, arr = [];
4793
+ while (prev !== root) {
4794
+ arr.push(tmp);
4795
+ tmp = dirname2(prev = tmp);
4796
+ if (tmp === prev) break;
4797
+ }
4798
+ return arr;
4799
+ }
4800
+ __name(up, "up");
4801
+
4802
+ // ../../node_modules/empathic/find.mjs
4803
+ function up2(name, options) {
4804
+ let dir, tmp;
4805
+ let start = options && options.cwd || "";
4806
+ for (dir of up(start, options)) {
4807
+ tmp = join4(dir, name);
4808
+ if (existsSync(tmp)) return tmp;
4809
+ }
4810
+ }
4811
+ __name(up2, "up");
4812
+
4813
+ // src/componentManifest/reactDocgen.ts
4814
+ var TsconfigPaths = __toESM(require_lib2(), 1);
4815
+ import { ERROR_CODES } from "react-docgen";
4816
+ import {
4817
+ builtinHandlers as docgenHandlers,
4818
+ builtinResolvers as docgenResolver,
4819
+ makeFsImporter,
4820
+ parse as parse3
4821
+ } from "react-docgen";
4822
+
4823
+ // src/componentManifest/reactDocgen/actualNameHandler.ts
4824
+ import { utils } from "react-docgen";
4825
+ var { getNameOrValue, isReactForwardRefCall } = utils;
4826
+ var actualNameHandler = /* @__PURE__ */ __name(function actualNameHandler2(documentation, componentDefinition) {
4827
+ documentation.set("definedInFile", componentDefinition.hub.file.opts.filename);
4828
+ if ((componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has("id")) {
4829
+ documentation.set(
4830
+ "actualName",
4831
+ getNameOrValue(componentDefinition.get("id"))
4832
+ );
4833
+ } else if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall(componentDefinition)) {
4834
+ let currentPath = componentDefinition;
4835
+ while (currentPath.parentPath) {
4836
+ if (currentPath.parentPath.isVariableDeclarator()) {
4837
+ documentation.set("actualName", getNameOrValue(currentPath.parentPath.get("id")));
4838
+ return;
4839
+ }
4840
+ if (currentPath.parentPath.isAssignmentExpression()) {
4841
+ const leftPath = currentPath.parentPath.get("left");
4842
+ if (leftPath.isIdentifier() || leftPath.isLiteral()) {
4843
+ documentation.set("actualName", getNameOrValue(leftPath));
4844
+ return;
4845
+ }
4846
+ }
4847
+ currentPath = currentPath.parentPath;
4848
+ }
4849
+ documentation.set("actualName", "");
4850
+ }
4851
+ }, "actualNameHandler");
4852
+ var actualNameHandler_default = actualNameHandler;
4853
+
4854
+ // src/componentManifest/reactDocgen/docgenResolver.ts
4855
+ var import_resolve2 = __toESM(require_resolve(), 1);
4856
+ import { extname as extname2 } from "node:path";
4857
+ var ReactDocgenResolveError = class extends Error {
4858
+ constructor(filename) {
4859
+ super(`'${filename}' was ignored by react-docgen.`);
4860
+ // the magic string that react-docgen uses to check if a module is ignored
4861
+ this.code = "MODULE_NOT_FOUND";
4862
+ }
4863
+ static {
4864
+ __name(this, "ReactDocgenResolveError");
4865
+ }
4866
+ };
4867
+ var RESOLVE_EXTENSIONS = [
4868
+ ".js",
4869
+ ".cts",
4870
+ // These were originally not in the code, I added them
4871
+ ".mts",
4872
+ // These were originally not in the code, I added them
4873
+ ".ctsx",
4874
+ // These were originally not in the code, I added them
4875
+ ".mtsx",
4876
+ // These were originally not in the code, I added them
4877
+ ".ts",
4878
+ ".tsx",
4879
+ ".mjs",
4880
+ ".cjs",
4881
+ ".mts",
4882
+ ".cts",
4883
+ ".jsx"
4884
+ ];
4885
+ function defaultLookupModule(filename, basedir) {
4886
+ const resolveOptions = {
4887
+ basedir,
4888
+ extensions: RESOLVE_EXTENSIONS,
4889
+ // we do not need to check core modules as we cannot import them anyway
4890
+ includeCoreModules: false
4891
+ };
4892
+ try {
4893
+ return import_resolve2.default.sync(filename, resolveOptions);
4894
+ } catch (error) {
4895
+ const ext = extname2(filename);
4896
+ let newFilename;
4897
+ switch (ext) {
4898
+ case ".js":
4899
+ case ".mjs":
4900
+ case ".cjs":
4901
+ newFilename = `${filename.slice(0, -2)}ts`;
4902
+ break;
4903
+ case ".jsx":
4904
+ newFilename = `${filename.slice(0, -3)}tsx`;
4905
+ break;
4906
+ default:
4907
+ throw error;
4908
+ }
4909
+ return import_resolve2.default.sync(newFilename, {
4910
+ ...resolveOptions,
4911
+ // we already know that there is an extension at this point, so no need to check other extensions
4912
+ extensions: []
4913
+ });
4914
+ }
4915
+ }
4916
+ __name(defaultLookupModule, "defaultLookupModule");
4917
+
4918
+ // src/componentManifest/reactDocgen/exportNameHandler.ts
4919
+ import { utils as utils2 } from "react-docgen";
4920
+ var { isReactForwardRefCall: isReactForwardRefCall2 } = utils2;
4921
+ function nameFromId(path2) {
4922
+ if (!path2) {
4923
+ return void 0;
4924
+ }
4925
+ if (path2.isIdentifier()) {
4926
+ return path2.node.name;
4927
+ }
4928
+ if (path2.isStringLiteral()) {
4929
+ return path2.node.value;
4930
+ }
4931
+ return void 0;
4932
+ }
4933
+ __name(nameFromId, "nameFromId");
4934
+ function isInlineDefaultExport(path2) {
4935
+ let p = path2;
4936
+ while (p && p.parentPath) {
4937
+ if (p.parentPath.isExportDefaultDeclaration()) {
4938
+ return true;
4939
+ }
4940
+ p = p.parentPath;
4941
+ }
4942
+ return false;
4943
+ }
4944
+ __name(isInlineDefaultExport, "isInlineDefaultExport");
4945
+ function findProgram(path2) {
4946
+ const found = path2.findParent((p) => p.isProgram());
4947
+ return found && found.isProgram() ? found : void 0;
4948
+ }
4949
+ __name(findProgram, "findProgram");
4950
+ function getLocalName(componentDefinition, fallback) {
4951
+ if (fallback) {
4952
+ return fallback;
4953
+ }
4954
+ if ((componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has("id")) {
4955
+ const idPath = componentDefinition.get("id");
4956
+ return nameFromId(idPath);
4957
+ }
4958
+ if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall2(componentDefinition)) {
4959
+ let p = componentDefinition;
4960
+ while (p && p.parentPath) {
4961
+ if (p.parentPath.isVariableDeclarator()) {
4962
+ const id = p.parentPath.get("id");
4963
+ return nameFromId(id);
4964
+ }
4965
+ if (p.parentPath.isAssignmentExpression()) {
4966
+ const left = p.parentPath.get("left");
4967
+ const lhs = nameFromId(left);
4968
+ if (lhs) {
4969
+ return lhs;
4970
+ }
4971
+ }
4972
+ p = p.parentPath;
4973
+ }
4974
+ }
4975
+ return void 0;
4976
+ }
4977
+ __name(getLocalName, "getLocalName");
4978
+ var exportNameHandler = /* @__PURE__ */ __name((documentation, componentDefinition) => {
4979
+ if (isInlineDefaultExport(componentDefinition)) {
4980
+ documentation.set("exportName", "default");
4981
+ return;
4982
+ }
4983
+ const actual = documentation.get("actualName");
4984
+ const actualName = typeof actual === "string" ? actual : void 0;
4985
+ const localName = getLocalName(componentDefinition, actualName);
4986
+ const programPath = findProgram(componentDefinition);
4987
+ if (!programPath) {
4988
+ documentation.set("exportName", void 0);
4989
+ return;
4990
+ }
4991
+ const body = programPath.get("body");
4992
+ for (const stmt of body) {
4993
+ if (stmt.isExportNamedDeclaration() && stmt.has("declaration")) {
4994
+ const decl = stmt.get("declaration");
4995
+ if (decl.isFunctionDeclaration() || decl.isClassDeclaration()) {
4996
+ const name = nameFromId(decl.get("id"));
4997
+ if (name && name === localName) {
4998
+ documentation.set("exportName", name);
4999
+ return;
5000
+ }
5001
+ }
5002
+ if (decl.isVariableDeclaration()) {
5003
+ const decls = decl.get("declarations");
5004
+ for (const d of decls) {
5005
+ if (d.isVariableDeclarator()) {
5006
+ const id = d.get("id");
5007
+ if (id.isIdentifier() && id.node.name === localName) {
5008
+ documentation.set("exportName", localName);
5009
+ return;
5010
+ }
5011
+ }
5012
+ }
5013
+ }
5014
+ }
5015
+ if (stmt.isExportNamedDeclaration() && stmt.has("specifiers")) {
5016
+ const specs = stmt.get("specifiers");
5017
+ for (const s of specs) {
5018
+ if (s.isExportSpecifier()) {
5019
+ const local = nameFromId(s.get("local"));
5020
+ const exported = nameFromId(s.get("exported"));
5021
+ if (local && local === localName) {
5022
+ documentation.set(
5023
+ "exportName",
5024
+ exported === "default" ? "default" : exported ?? local
5025
+ );
5026
+ return;
5027
+ }
5028
+ }
5029
+ }
5030
+ }
5031
+ if (stmt.isExportDefaultDeclaration()) {
5032
+ const decl = stmt.get("declaration");
5033
+ if (decl.isIdentifier() && decl.node.name === localName) {
5034
+ documentation.set("exportName", "default");
5035
+ return;
5036
+ }
5037
+ }
5038
+ }
5039
+ documentation.set("exportName", void 0);
5040
+ }, "exportNameHandler");
5041
+ var exportNameHandler_default = exportNameHandler;
5042
+
5043
+ // src/componentManifest/reactDocgen.ts
5044
+ var defaultHandlers = Object.values(docgenHandlers).map((handler) => handler);
5045
+ var defaultResolver = new docgenResolver.FindExportedDefinitionsResolver();
5046
+ var handlers = [...defaultHandlers, actualNameHandler_default, exportNameHandler_default];
5047
+ function getMatchingDocgen(docgens, csf) {
5048
+ const componentName = csf._meta?.component;
5049
+ if (docgens.length === 1) {
5050
+ return docgens[0];
5051
+ }
5052
+ const importSpecifier = csf._componentImportSpecifier;
5053
+ let importName;
5054
+ if (t2.isImportSpecifier(importSpecifier)) {
5055
+ const imported = importSpecifier.imported;
5056
+ importName = t2.isIdentifier(imported) ? imported.name : imported.value;
5057
+ } else if (t2.isImportDefaultSpecifier(importSpecifier)) {
5058
+ importName = "default";
5059
+ }
5060
+ const docgen = docgens.find((docgen2) => docgen2.exportName === importName);
5061
+ if (docgen || !componentName) {
5062
+ return docgen;
5063
+ }
5064
+ return docgens.find(
5065
+ (docgen2) => docgen2.displayName === componentName || docgen2.actualName === componentName
5066
+ );
5067
+ }
5068
+ __name(getMatchingDocgen, "getMatchingDocgen");
5069
+ async function parseWithReactDocgen({ code, filename }) {
5070
+ const tsconfigPath = up2("tsconfig.json", { cwd: process.cwd(), last: getProjectRoot() });
5071
+ const tsconfig = TsconfigPaths.loadConfig(tsconfigPath);
5072
+ let matchPath;
5073
+ if (tsconfig.resultType === "success") {
5074
+ matchPath = TsconfigPaths.createMatchPath(tsconfig.absoluteBaseUrl, tsconfig.paths, [
5075
+ "browser",
5076
+ "module",
5077
+ "main"
5078
+ ]);
5079
+ }
5080
+ try {
5081
+ return parse3(code, {
5082
+ resolver: defaultResolver,
5083
+ handlers,
5084
+ importer: getReactDocgenImporter(matchPath),
5085
+ filename
5086
+ });
5087
+ } catch (e) {
5088
+ if (!(e instanceof Error && "code" in e && e.code === ERROR_CODES.MISSING_DEFINITION)) {
5089
+ console.error(e);
5090
+ }
5091
+ return [];
5092
+ }
5093
+ }
5094
+ __name(parseWithReactDocgen, "parseWithReactDocgen");
5095
+ function getReactDocgenImporter(matchPath) {
5096
+ return makeFsImporter((filename, basedir) => {
5097
+ const mappedFilenameByPaths = (() => {
5098
+ if (matchPath) {
5099
+ const match = matchPath(filename);
5100
+ return match || filename;
5101
+ } else {
5102
+ return filename;
5103
+ }
5104
+ })();
5105
+ const result = defaultLookupModule(mappedFilenameByPaths, basedir);
5106
+ if (result.includes(`${sep2}react-native${sep2}index.js`)) {
5107
+ const replaced = result.replace(
5108
+ `${sep2}react-native${sep2}index.js`,
5109
+ `${sep2}react-native-web${sep2}dist${sep2}index.js`
5110
+ );
5111
+ if (existsSync2(replaced)) {
5112
+ if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
5113
+ return replaced;
5114
+ }
5115
+ }
5116
+ }
5117
+ if (RESOLVE_EXTENSIONS.find((ext) => result.endsWith(ext))) {
5118
+ return result;
5119
+ }
5120
+ throw new ReactDocgenResolveError(filename);
5121
+ });
5122
+ }
5123
+ __name(getReactDocgenImporter, "getReactDocgenImporter");
5124
+
5125
+ // src/componentManifest/generator.ts
5126
+ var componentManifestGenerator = /* @__PURE__ */ __name(async () => {
5127
+ return async (storyIndexGenerator) => {
5128
+ const index = await storyIndexGenerator.getIndex();
5129
+ const groupByComponentId = groupBy(
5130
+ Object.values(index.entries).filter((entry) => entry.type === "story").filter((entry) => entry.subtype === "story"),
5131
+ (it) => it.id.split("--")[0]
5132
+ );
5133
+ const singleEntryPerComponent = Object.values(groupByComponentId).flatMap(
5134
+ (group) => group && group?.length > 0 ? [group[0]] : []
5135
+ );
5136
+ const components = await Promise.all(
5137
+ singleEntryPerComponent.flatMap(async (entry) => {
5138
+ const storyFile = await readFile(path.join(process.cwd(), entry.importPath), "utf-8");
5139
+ const csf = loadCsf(storyFile, { makeTitle: /* @__PURE__ */ __name((title) => title ?? "No title", "makeTitle") }).parse();
5140
+ const name = csf._meta?.component ?? entry.title.split("/").at(-1);
5141
+ const id = entry.id.split("--")[0];
5142
+ const importPath = entry.importPath;
5143
+ const examples = Object.keys(csf._stories).map((storyName) => {
5144
+ try {
5145
+ return {
5146
+ name: storyName,
5147
+ snippet: recast.print(getCodeSnippet(csf, storyName, name)).code
5148
+ };
5149
+ } catch (e) {
5150
+ invariant(e instanceof Error);
5151
+ return {
5152
+ name: storyName,
5153
+ error: {
5154
+ message: e.message
5155
+ }
5156
+ };
5157
+ }
5158
+ }).filter(Boolean);
5159
+ const base = {
5160
+ id,
5161
+ name,
5162
+ path: importPath,
5163
+ examples,
5164
+ jsDocTags: {}
5165
+ };
5166
+ if (!entry.componentPath) {
5167
+ const message = `No component file found for the "${name}" component.`;
5168
+ return {
5169
+ ...base,
5170
+ name,
5171
+ examples,
5172
+ error: { message }
5173
+ };
5174
+ }
5175
+ let componentFile;
5176
+ try {
5177
+ componentFile = await readFile(path.join(process.cwd(), entry.componentPath), "utf-8");
5178
+ } catch (e) {
5179
+ invariant(e instanceof Error);
5180
+ return {
5181
+ ...base,
5182
+ name,
5183
+ examples,
5184
+ error: {
5185
+ message: `Could not read the component file located at ${entry.componentPath}`
5186
+ }
5187
+ };
5188
+ }
5189
+ const docgens = await parseWithReactDocgen({
5190
+ code: componentFile,
5191
+ filename: path.join(process.cwd(), entry.componentPath)
5192
+ });
5193
+ const docgen = getMatchingDocgen(docgens, csf);
5194
+ const error = !docgen ? {
5195
+ message: `Could not parse props information for the located at ${entry.componentPath}`
5196
+ } : void 0;
5197
+ const metaDescription = extractDescription(csf._metaStatement);
5198
+ const jsdocComment = metaDescription || docgen?.description;
5199
+ const { tags = {}, description } = jsdocComment ? extractJSDocInfo(jsdocComment) : {};
5200
+ const manifestDescription = (tags?.describe?.[0] || tags?.desc?.[0]) ?? description;
5201
+ return {
5202
+ ...base,
5203
+ name,
5204
+ description: manifestDescription?.trim(),
5205
+ summary: tags.summary?.[0],
5206
+ import: tags.import?.[0],
5207
+ reactDocgen: docgen,
5208
+ jsDocTags: tags,
5209
+ examples,
5210
+ error
5211
+ };
5212
+ })
5213
+ );
5214
+ return {
5215
+ v: 0,
5216
+ components: Object.fromEntries(
5217
+ components.filter((component) => component != null).map((component) => [component.id, component])
5218
+ )
5219
+ };
5220
+ };
5221
+ }, "componentManifestGenerator");
5222
+
5223
+ // src/enrichCsf.ts
5224
+ import { recast as recast2, types as t3 } from "storybook/internal/babel";
5225
+ import { getPrettier } from "storybook/internal/common";
5226
+ var enrichCsf = /* @__PURE__ */ __name(async (input, options) => {
5227
+ const features = await options.presets.apply("features");
5228
+ if (!features.experimentalCodeExamples) {
5229
+ return;
5230
+ }
5231
+ return async (csf, csfSource) => {
5232
+ const promises = Object.keys(csf._stories).map(async (key) => {
5233
+ if (!csfSource._meta?.component) {
5234
+ return;
5235
+ }
5236
+ const { format: format3 } = await getPrettier();
5237
+ let node;
5238
+ let snippet;
5239
+ try {
5240
+ node = getCodeSnippet(csfSource, key, csfSource._meta?.component);
5241
+ } catch (e) {
5242
+ if (!(e instanceof Error)) {
5243
+ return;
5244
+ }
5245
+ snippet = e.message;
5246
+ }
5247
+ try {
5248
+ if (!snippet && node) {
5249
+ snippet = await format3(recast2.print(node).code, {
5250
+ filepath: join(process.cwd(), "component.tsx")
5251
+ });
5252
+ }
5253
+ } catch (e) {
5254
+ if (!(e instanceof Error)) {
5255
+ return;
5256
+ }
5257
+ snippet = e.message;
5258
+ }
5259
+ if (!snippet) {
5260
+ return;
5261
+ }
5262
+ const originalParameters = t3.memberExpression(
5263
+ csf._metaIsFactory ? t3.memberExpression(t3.identifier(key), t3.identifier("input")) : t3.identifier(key),
5264
+ t3.identifier("parameters")
5265
+ );
5266
+ const docsParameter = t3.optionalMemberExpression(
5267
+ originalParameters,
5268
+ t3.identifier("docs"),
5269
+ false,
5270
+ true
5271
+ );
5272
+ csf._ast.program.body.push(
5273
+ t3.expressionStatement(
5274
+ t3.assignmentExpression(
5275
+ "=",
5276
+ originalParameters,
5277
+ t3.objectExpression([
5278
+ t3.spreadElement(originalParameters),
5279
+ t3.objectProperty(
5280
+ t3.identifier("docs"),
5281
+ t3.objectExpression([
5282
+ t3.spreadElement(docsParameter),
5283
+ t3.objectProperty(
5284
+ t3.identifier("source"),
5285
+ t3.objectExpression([
5286
+ t3.objectProperty(t3.identifier("code"), t3.stringLiteral(snippet)),
5287
+ t3.spreadElement(
5288
+ t3.optionalMemberExpression(
5289
+ docsParameter,
5290
+ t3.identifier("source"),
5291
+ false,
5292
+ true
5293
+ )
5294
+ )
5295
+ ])
5296
+ )
5297
+ ])
5298
+ )
5299
+ ])
5300
+ )
5301
+ )
5302
+ );
5303
+ });
5304
+ await Promise.all(promises);
5305
+ };
5306
+ }, "enrichCsf");
5307
+
475
5308
  // src/preset.ts
476
5309
  var addons = [
477
5310
  import.meta.resolve("@storybook/react-dom-shim/preset")
@@ -506,6 +5339,8 @@ var resolvedReact = /* @__PURE__ */ __name(async (existing) => {
506
5339
  }, "resolvedReact");
507
5340
  export {
508
5341
  addons,
5342
+ componentManifestGenerator as experimental_componentManifestGenerator,
5343
+ enrichCsf as experimental_enrichCsf,
509
5344
  previewAnnotations,
510
5345
  resolvedReact
511
5346
  };