@apocaliss92/addon-series-scraper 0.0.0-stage → 0.1.21

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.
@@ -0,0 +1,2867 @@
1
+ import { createRequire as __scraperCreateRequire, createRequire as __createRequire } from "node:module";
2
+ __scraperCreateRequire(import.meta.url);
3
+ import { n as __esmMin } from "./rolldown-runtime-cIwnrN2i.js";
4
+ import { c as init_yerror, n as init_esm, s as YError, t as esm_default } from "./esm-BaRSigns.js";
5
+ function __require() {
6
+ const require = __createRequire(import.meta.url);
7
+ __require = () => require;
8
+ return require;
9
+ }
10
+ // node_modules/yargs/build/lib/utils/apply-extends.js
11
+ function applyExtends(config, cwd, mergeExtends, _shim) {
12
+ shim = _shim;
13
+ let defaultConfig = {};
14
+ if (Object.prototype.hasOwnProperty.call(config, "extends")) {
15
+ if (typeof config.extends !== "string") return defaultConfig;
16
+ const isPath = /\.json|\..*rc$/.test(config.extends);
17
+ let pathToDefault = null;
18
+ if (!isPath) try {
19
+ pathToDefault = (/* @__PURE__ */ __require()).resolve(config.extends);
20
+ } catch (_err) {
21
+ return config;
22
+ }
23
+ else pathToDefault = getPathToDefaultConfig(cwd, config.extends);
24
+ checkForCircularExtends(pathToDefault);
25
+ previouslyVisitedConfigs.push(pathToDefault);
26
+ defaultConfig = isPath ? JSON.parse(shim.readFileSync(pathToDefault, "utf8")) : (/* @__PURE__ */ __require())(config.extends);
27
+ delete config.extends;
28
+ defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
29
+ }
30
+ previouslyVisitedConfigs = [];
31
+ return mergeExtends ? mergeDeep(defaultConfig, config) : Object.assign({}, defaultConfig, config);
32
+ }
33
+ function checkForCircularExtends(cfgPath) {
34
+ if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) throw new YError(`Circular extended configurations: '${cfgPath}'.`);
35
+ }
36
+ function getPathToDefaultConfig(cwd, pathToExtend) {
37
+ return shim.path.resolve(cwd, pathToExtend);
38
+ }
39
+ function mergeDeep(config1, config2) {
40
+ const target = {};
41
+ function isObject(obj) {
42
+ return obj && typeof obj === "object" && !Array.isArray(obj);
43
+ }
44
+ Object.assign(target, config1);
45
+ for (const key of Object.keys(config2)) if (isObject(config2[key]) && isObject(target[key])) target[key] = mergeDeep(config1[key], config2[key]);
46
+ else target[key] = config2[key];
47
+ return target;
48
+ }
49
+ var previouslyVisitedConfigs, shim;
50
+ var init_apply_extends = __esmMin((() => {
51
+ init_yerror();
52
+ previouslyVisitedConfigs = [];
53
+ }));
54
+ // node_modules/yargs/build/lib/typings/common-types.js
55
+ function assertNotStrictEqual(actual, expected, shim, message) {
56
+ shim.assert.notStrictEqual(actual, expected, message);
57
+ }
58
+ function assertSingleKey(actual, shim) {
59
+ shim.assert.strictEqual(typeof actual, "string");
60
+ }
61
+ function objectKeys(object) {
62
+ return Object.keys(object);
63
+ }
64
+ __esmMin((() => {}));
65
+ // node_modules/yargs/build/lib/utils/is-promise.js
66
+ function isPromise(maybePromise) {
67
+ return !!maybePromise && !!maybePromise.then && typeof maybePromise.then === "function";
68
+ }
69
+ __esmMin((() => {}));
70
+ // node_modules/yargs/build/lib/parse-command.js
71
+ function parseCommand(cmd) {
72
+ const splitCommand = cmd.replace(/\s{2,}/g, " ").split(/\s+(?![^[]*]|[^<]*>)/);
73
+ const bregex = /\.*[\][<>]/g;
74
+ const firstCommand = splitCommand.shift();
75
+ if (!firstCommand) throw new Error(`No command found in: ${cmd}`);
76
+ const parsedCommand = {
77
+ cmd: firstCommand.replace(bregex, ""),
78
+ demanded: [],
79
+ optional: []
80
+ };
81
+ splitCommand.forEach((cmd, i) => {
82
+ let variadic = false;
83
+ cmd = cmd.replace(/\s/g, "");
84
+ if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1) variadic = true;
85
+ if (/^\[/.test(cmd)) parsedCommand.optional.push({
86
+ cmd: cmd.replace(bregex, "").split("|"),
87
+ variadic
88
+ });
89
+ else parsedCommand.demanded.push({
90
+ cmd: cmd.replace(bregex, "").split("|"),
91
+ variadic
92
+ });
93
+ });
94
+ return parsedCommand;
95
+ }
96
+ __esmMin((() => {}));
97
+ // node_modules/yargs/build/lib/argsert.js
98
+ function argsert(arg1, arg2, arg3) {
99
+ function parseArgs() {
100
+ return typeof arg1 === "object" ? [
101
+ {
102
+ demanded: [],
103
+ optional: []
104
+ },
105
+ arg1,
106
+ arg2
107
+ ] : [
108
+ parseCommand(`cmd ${arg1}`),
109
+ arg2,
110
+ arg3
111
+ ];
112
+ }
113
+ try {
114
+ let position = 0;
115
+ const [parsed, callerArguments, _length] = parseArgs();
116
+ const args = [].slice.call(callerArguments);
117
+ while (args.length && args[args.length - 1] === void 0) args.pop();
118
+ const length = _length || args.length;
119
+ if (length < parsed.demanded.length) throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
120
+ const totalCommands = parsed.demanded.length + parsed.optional.length;
121
+ if (length > totalCommands) throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
122
+ parsed.demanded.forEach((demanded) => {
123
+ const observedType = guessType(args.shift());
124
+ if (demanded.cmd.filter((type) => type === observedType || type === "*").length === 0) argumentTypeError(observedType, demanded.cmd, position);
125
+ position += 1;
126
+ });
127
+ parsed.optional.forEach((optional) => {
128
+ if (args.length === 0) return;
129
+ const observedType = guessType(args.shift());
130
+ if (optional.cmd.filter((type) => type === observedType || type === "*").length === 0) argumentTypeError(observedType, optional.cmd, position);
131
+ position += 1;
132
+ });
133
+ } catch (err) {
134
+ console.warn(err.stack);
135
+ }
136
+ }
137
+ function guessType(arg) {
138
+ if (Array.isArray(arg)) return "array";
139
+ else if (arg === null) return "null";
140
+ return typeof arg;
141
+ }
142
+ function argumentTypeError(observedType, allowedTypes, position) {
143
+ throw new YError(`Invalid ${positionName[position] || "manyith"} argument. Expected ${allowedTypes.join(" or ")} but received ${observedType}.`);
144
+ }
145
+ var positionName;
146
+ var init_argsert = __esmMin((() => {
147
+ init_yerror();
148
+ positionName = [
149
+ "first",
150
+ "second",
151
+ "third",
152
+ "fourth",
153
+ "fifth",
154
+ "sixth"
155
+ ];
156
+ }));
157
+ // node_modules/yargs/build/lib/middleware.js
158
+ function commandMiddlewareFactory(commandMiddleware) {
159
+ if (!commandMiddleware) return [];
160
+ return commandMiddleware.map((middleware) => {
161
+ middleware.applyBeforeValidation = false;
162
+ return middleware;
163
+ });
164
+ }
165
+ function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
166
+ return middlewares.reduce((acc, middleware) => {
167
+ if (middleware.applyBeforeValidation !== beforeValidation) return acc;
168
+ if (middleware.mutates) {
169
+ if (middleware.applied) return acc;
170
+ middleware.applied = true;
171
+ }
172
+ if (isPromise(acc)) return acc.then((initialObj) => Promise.all([initialObj, middleware(initialObj, yargs)])).then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
173
+ else {
174
+ const result = middleware(acc, yargs);
175
+ return isPromise(result) ? result.then((middlewareObj) => Object.assign(acc, middlewareObj)) : Object.assign(acc, result);
176
+ }
177
+ }, argv);
178
+ }
179
+ var GlobalMiddleware;
180
+ var init_middleware = __esmMin((() => {
181
+ init_argsert();
182
+ GlobalMiddleware = class {
183
+ constructor(yargs) {
184
+ this.globalMiddleware = [];
185
+ this.frozens = [];
186
+ this.yargs = yargs;
187
+ }
188
+ addMiddleware(callback, applyBeforeValidation, global = true, mutates = false) {
189
+ argsert("<array|function> [boolean] [boolean] [boolean]", [
190
+ callback,
191
+ applyBeforeValidation,
192
+ global
193
+ ], arguments.length);
194
+ if (Array.isArray(callback)) {
195
+ for (let i = 0; i < callback.length; i++) {
196
+ if (typeof callback[i] !== "function") throw Error("middleware must be a function");
197
+ const m = callback[i];
198
+ m.applyBeforeValidation = applyBeforeValidation;
199
+ m.global = global;
200
+ }
201
+ Array.prototype.push.apply(this.globalMiddleware, callback);
202
+ } else if (typeof callback === "function") {
203
+ const m = callback;
204
+ m.applyBeforeValidation = applyBeforeValidation;
205
+ m.global = global;
206
+ m.mutates = mutates;
207
+ this.globalMiddleware.push(callback);
208
+ }
209
+ return this.yargs;
210
+ }
211
+ addCoerceMiddleware(callback, option) {
212
+ const aliases = this.yargs.getAliases();
213
+ this.globalMiddleware = this.globalMiddleware.filter((m) => {
214
+ const toCheck = [...aliases[option] || [], option];
215
+ if (!m.option) return true;
216
+ else return !toCheck.includes(m.option);
217
+ });
218
+ callback.option = option;
219
+ return this.addMiddleware(callback, true, true, true);
220
+ }
221
+ getMiddleware() {
222
+ return this.globalMiddleware;
223
+ }
224
+ freeze() {
225
+ this.frozens.push([...this.globalMiddleware]);
226
+ }
227
+ unfreeze() {
228
+ const frozen = this.frozens.pop();
229
+ if (frozen !== void 0) this.globalMiddleware = frozen;
230
+ }
231
+ reset() {
232
+ this.globalMiddleware = this.globalMiddleware.filter((m) => m.global);
233
+ }
234
+ };
235
+ }));
236
+ // node_modules/yargs/build/lib/utils/maybe-async-result.js
237
+ function maybeAsyncResult(getResult, resultHandler, errorHandler = (err) => {
238
+ throw err;
239
+ }) {
240
+ try {
241
+ const result = isFunction(getResult) ? getResult() : getResult;
242
+ return isPromise(result) ? result.then((result) => resultHandler(result)) : resultHandler(result);
243
+ } catch (err) {
244
+ return errorHandler(err);
245
+ }
246
+ }
247
+ function isFunction(arg) {
248
+ return typeof arg === "function";
249
+ }
250
+ var init_maybe_async_result = __esmMin((() => {}));
251
+ // node_modules/yargs/build/lib/utils/which-module.js
252
+ function whichModule(exported) {
253
+ if (typeof /* @__PURE__ */ __require() === "undefined") return null;
254
+ for (let i = 0, files = Object.keys((/* @__PURE__ */ __require()).cache), mod; i < files.length; i++) {
255
+ mod = (/* @__PURE__ */ __require()).cache[files[i]];
256
+ if (mod.exports === exported) return mod;
257
+ }
258
+ return null;
259
+ }
260
+ var init_which_module = __esmMin((() => {}));
261
+ // node_modules/yargs/build/lib/command.js
262
+ function command(usage, validation, globalMiddleware, shim) {
263
+ return new CommandInstance(usage, validation, globalMiddleware, shim);
264
+ }
265
+ function isCommandBuilderDefinition(builder) {
266
+ return typeof builder === "object" && !!builder.builder && typeof builder.handler === "function";
267
+ }
268
+ function isCommandAndAliases(cmd) {
269
+ return cmd.every((c) => typeof c === "string");
270
+ }
271
+ function isCommandBuilderCallback(builder) {
272
+ return typeof builder === "function";
273
+ }
274
+ function isCommandBuilderOptionDefinitions(builder) {
275
+ return typeof builder === "object";
276
+ }
277
+ function isCommandHandlerDefinition(cmd) {
278
+ return typeof cmd === "object" && !Array.isArray(cmd);
279
+ }
280
+ var DEFAULT_MARKER, CommandInstance;
281
+ var init_command = __esmMin((() => {
282
+ init_middleware();
283
+ init_yargs_factory();
284
+ init_maybe_async_result();
285
+ init_which_module();
286
+ DEFAULT_MARKER = /(^\*)|(^\$0)/;
287
+ CommandInstance = class {
288
+ constructor(usage, validation, globalMiddleware, shim) {
289
+ this.requireCache = /* @__PURE__ */ new Set();
290
+ this.handlers = {};
291
+ this.aliasMap = {};
292
+ this.frozens = [];
293
+ this.shim = shim;
294
+ this.usage = usage;
295
+ this.globalMiddleware = globalMiddleware;
296
+ this.validation = validation;
297
+ }
298
+ addDirectory(dir, req, callerFile, opts) {
299
+ opts = opts || {};
300
+ if (typeof opts.recurse !== "boolean") opts.recurse = false;
301
+ if (!Array.isArray(opts.extensions)) opts.extensions = ["js"];
302
+ const parentVisit = typeof opts.visit === "function" ? opts.visit : (o) => o;
303
+ opts.visit = (obj, joined, filename) => {
304
+ const visited = parentVisit(obj, joined, filename);
305
+ if (visited) {
306
+ if (this.requireCache.has(joined)) return visited;
307
+ else this.requireCache.add(joined);
308
+ this.addHandler(visited);
309
+ }
310
+ return visited;
311
+ };
312
+ this.shim.requireDirectory({
313
+ require: req,
314
+ filename: callerFile
315
+ }, dir, opts);
316
+ }
317
+ addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
318
+ let aliases = [];
319
+ const middlewares = commandMiddlewareFactory(commandMiddleware);
320
+ handler = handler || (() => {});
321
+ if (Array.isArray(cmd)) {
322
+ if (isCommandAndAliases(cmd)) [cmd, ...aliases] = cmd;
323
+ else for (const command of cmd) this.addHandler(command);
324
+ } else if (isCommandHandlerDefinition(cmd)) {
325
+ let command = Array.isArray(cmd.command) || typeof cmd.command === "string" ? cmd.command : this.moduleName(cmd);
326
+ if (cmd.aliases) command = [].concat(command).concat(cmd.aliases);
327
+ this.addHandler(command, this.extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
328
+ return;
329
+ } else if (isCommandBuilderDefinition(builder)) {
330
+ this.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
331
+ return;
332
+ }
333
+ if (typeof cmd === "string") {
334
+ const parsedCommand = parseCommand(cmd);
335
+ aliases = aliases.map((alias) => parseCommand(alias).cmd);
336
+ let isDefault = false;
337
+ const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => {
338
+ if (DEFAULT_MARKER.test(c)) {
339
+ isDefault = true;
340
+ return false;
341
+ }
342
+ return true;
343
+ });
344
+ if (parsedAliases.length === 0 && isDefault) parsedAliases.push("$0");
345
+ if (isDefault) {
346
+ parsedCommand.cmd = parsedAliases[0];
347
+ aliases = parsedAliases.slice(1);
348
+ cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
349
+ }
350
+ aliases.forEach((alias) => {
351
+ this.aliasMap[alias] = parsedCommand.cmd;
352
+ });
353
+ if (description !== false) this.usage.command(cmd, description, isDefault, aliases, deprecated);
354
+ this.handlers[parsedCommand.cmd] = {
355
+ original: cmd,
356
+ description,
357
+ handler,
358
+ builder: builder || {},
359
+ middlewares,
360
+ deprecated,
361
+ demanded: parsedCommand.demanded,
362
+ optional: parsedCommand.optional
363
+ };
364
+ if (isDefault) this.defaultCommand = this.handlers[parsedCommand.cmd];
365
+ }
366
+ }
367
+ getCommandHandlers() {
368
+ return this.handlers;
369
+ }
370
+ getCommands() {
371
+ return Object.keys(this.handlers).concat(Object.keys(this.aliasMap));
372
+ }
373
+ hasDefaultCommand() {
374
+ return !!this.defaultCommand;
375
+ }
376
+ runCommand(command, yargs, parsed, commandIndex, helpOnly, helpOrVersionSet) {
377
+ const commandHandler = this.handlers[command] || this.handlers[this.aliasMap[command]] || this.defaultCommand;
378
+ const currentContext = yargs.getInternalMethods().getContext();
379
+ const parentCommands = currentContext.commands.slice();
380
+ const isDefaultCommand = !command;
381
+ if (command) {
382
+ currentContext.commands.push(command);
383
+ currentContext.fullCommands.push(commandHandler.original);
384
+ }
385
+ const builderResult = this.applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, parsed.aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet);
386
+ return isPromise(builderResult) ? builderResult.then((result) => this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, result.innerArgv, currentContext, helpOnly, result.aliases, yargs)) : this.applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, builderResult.innerArgv, currentContext, helpOnly, builderResult.aliases, yargs);
387
+ }
388
+ applyBuilderUpdateUsageAndParse(isDefaultCommand, commandHandler, yargs, aliases, parentCommands, commandIndex, helpOnly, helpOrVersionSet) {
389
+ const builder = commandHandler.builder;
390
+ let innerYargs = yargs;
391
+ if (isCommandBuilderCallback(builder)) {
392
+ yargs.getInternalMethods().getUsageInstance().freeze();
393
+ const builderOutput = builder(yargs.getInternalMethods().reset(aliases), helpOrVersionSet);
394
+ if (isPromise(builderOutput)) return builderOutput.then((output) => {
395
+ innerYargs = isYargsInstance(output) ? output : yargs;
396
+ return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
397
+ });
398
+ } else if (isCommandBuilderOptionDefinitions(builder)) {
399
+ yargs.getInternalMethods().getUsageInstance().freeze();
400
+ innerYargs = yargs.getInternalMethods().reset(aliases);
401
+ Object.keys(commandHandler.builder).forEach((key) => {
402
+ innerYargs.option(key, builder[key]);
403
+ });
404
+ }
405
+ return this.parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly);
406
+ }
407
+ parseAndUpdateUsage(isDefaultCommand, commandHandler, innerYargs, parentCommands, commandIndex, helpOnly) {
408
+ if (isDefaultCommand) innerYargs.getInternalMethods().getUsageInstance().unfreeze(true);
409
+ if (this.shouldUpdateUsage(innerYargs)) innerYargs.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
410
+ const innerArgv = innerYargs.getInternalMethods().runYargsParserAndExecuteCommands(null, void 0, true, commandIndex, helpOnly);
411
+ return isPromise(innerArgv) ? innerArgv.then((argv) => ({
412
+ aliases: innerYargs.parsed.aliases,
413
+ innerArgv: argv
414
+ })) : {
415
+ aliases: innerYargs.parsed.aliases,
416
+ innerArgv
417
+ };
418
+ }
419
+ shouldUpdateUsage(yargs) {
420
+ return !yargs.getInternalMethods().getUsageInstance().getUsageDisabled() && yargs.getInternalMethods().getUsageInstance().getUsage().length === 0;
421
+ }
422
+ usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
423
+ const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, "").trim() : commandHandler.original;
424
+ const pc = parentCommands.filter((c) => {
425
+ return !DEFAULT_MARKER.test(c);
426
+ });
427
+ pc.push(c);
428
+ return `$0 ${pc.join(" ")}`;
429
+ }
430
+ handleValidationAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, aliases, yargs, middlewares, positionalMap) {
431
+ if (!yargs.getInternalMethods().getHasOutput()) {
432
+ const validation = yargs.getInternalMethods().runValidation(aliases, positionalMap, yargs.parsed.error, isDefaultCommand);
433
+ innerArgv = maybeAsyncResult(innerArgv, (result) => {
434
+ validation(result);
435
+ return result;
436
+ });
437
+ }
438
+ if (commandHandler.handler && !yargs.getInternalMethods().getHasOutput()) {
439
+ yargs.getInternalMethods().setHasOutput();
440
+ const populateDoubleDash = !!yargs.getOptions().configuration["populate--"];
441
+ yargs.getInternalMethods().postProcess(innerArgv, populateDoubleDash, false, false);
442
+ innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
443
+ innerArgv = maybeAsyncResult(innerArgv, (result) => {
444
+ const handlerResult = commandHandler.handler(result);
445
+ return isPromise(handlerResult) ? handlerResult.then(() => result) : result;
446
+ });
447
+ if (!isDefaultCommand) yargs.getInternalMethods().getUsageInstance().cacheHelpMessage();
448
+ if (isPromise(innerArgv) && !yargs.getInternalMethods().hasParseCallback()) innerArgv.catch((error) => {
449
+ try {
450
+ yargs.getInternalMethods().getUsageInstance().fail(null, error);
451
+ } catch (_err) {}
452
+ });
453
+ }
454
+ if (!isDefaultCommand) {
455
+ currentContext.commands.pop();
456
+ currentContext.fullCommands.pop();
457
+ }
458
+ return innerArgv;
459
+ }
460
+ applyMiddlewareAndGetResult(isDefaultCommand, commandHandler, innerArgv, currentContext, helpOnly, aliases, yargs) {
461
+ let positionalMap = {};
462
+ if (helpOnly) return innerArgv;
463
+ if (!yargs.getInternalMethods().getHasOutput()) positionalMap = this.populatePositionals(commandHandler, innerArgv, currentContext, yargs);
464
+ const middlewares = this.globalMiddleware.getMiddleware().slice(0).concat(commandHandler.middlewares);
465
+ const maybePromiseArgv = applyMiddleware(innerArgv, yargs, middlewares, true);
466
+ return isPromise(maybePromiseArgv) ? maybePromiseArgv.then((resolvedInnerArgv) => this.handleValidationAndGetResult(isDefaultCommand, commandHandler, resolvedInnerArgv, currentContext, aliases, yargs, middlewares, positionalMap)) : this.handleValidationAndGetResult(isDefaultCommand, commandHandler, maybePromiseArgv, currentContext, aliases, yargs, middlewares, positionalMap);
467
+ }
468
+ populatePositionals(commandHandler, argv, context, yargs) {
469
+ argv._ = argv._.slice(context.commands.length);
470
+ const demanded = commandHandler.demanded.slice(0);
471
+ const optional = commandHandler.optional.slice(0);
472
+ const positionalMap = {};
473
+ this.validation.positionalCount(demanded.length, argv._.length);
474
+ while (demanded.length) {
475
+ const demand = demanded.shift();
476
+ this.populatePositional(demand, argv, positionalMap);
477
+ }
478
+ while (optional.length) {
479
+ const maybe = optional.shift();
480
+ this.populatePositional(maybe, argv, positionalMap);
481
+ }
482
+ argv._ = context.commands.concat(argv._.map((a) => "" + a));
483
+ this.postProcessPositionals(argv, positionalMap, this.cmdToParseOptions(commandHandler.original), yargs);
484
+ return positionalMap;
485
+ }
486
+ populatePositional(positional, argv, positionalMap) {
487
+ const cmd = positional.cmd[0];
488
+ if (positional.variadic) positionalMap[cmd] = argv._.splice(0).map(String);
489
+ else if (argv._.length) positionalMap[cmd] = [String(argv._.shift())];
490
+ }
491
+ cmdToParseOptions(cmdString) {
492
+ const parseOptions = {
493
+ array: [],
494
+ default: {},
495
+ alias: {},
496
+ demand: {}
497
+ };
498
+ const parsed = parseCommand(cmdString);
499
+ parsed.demanded.forEach((d) => {
500
+ const [cmd, ...aliases] = d.cmd;
501
+ if (d.variadic) {
502
+ parseOptions.array.push(cmd);
503
+ parseOptions.default[cmd] = [];
504
+ }
505
+ parseOptions.alias[cmd] = aliases;
506
+ parseOptions.demand[cmd] = true;
507
+ });
508
+ parsed.optional.forEach((o) => {
509
+ const [cmd, ...aliases] = o.cmd;
510
+ if (o.variadic) {
511
+ parseOptions.array.push(cmd);
512
+ parseOptions.default[cmd] = [];
513
+ }
514
+ parseOptions.alias[cmd] = aliases;
515
+ });
516
+ return parseOptions;
517
+ }
518
+ postProcessPositionals(argv, positionalMap, parseOptions, yargs) {
519
+ const options = Object.assign({}, yargs.getOptions());
520
+ options.default = Object.assign(parseOptions.default, options.default);
521
+ for (const key of Object.keys(parseOptions.alias)) options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
522
+ options.array = options.array.concat(parseOptions.array);
523
+ options.config = {};
524
+ const unparsed = [];
525
+ Object.keys(positionalMap).forEach((key) => {
526
+ positionalMap[key].map((value) => {
527
+ if (options.configuration["unknown-options-as-args"]) options.key[key] = true;
528
+ unparsed.push(`--${key}`);
529
+ unparsed.push(value);
530
+ });
531
+ });
532
+ if (!unparsed.length) return;
533
+ const config = Object.assign({}, options.configuration, { "populate--": false });
534
+ const parsed = this.shim.Parser.detailed(unparsed, Object.assign({}, options, { configuration: config }));
535
+ if (parsed.error) yargs.getInternalMethods().getUsageInstance().fail(parsed.error.message, parsed.error);
536
+ else {
537
+ const positionalKeys = Object.keys(positionalMap);
538
+ Object.keys(positionalMap).forEach((key) => {
539
+ positionalKeys.push(...parsed.aliases[key]);
540
+ });
541
+ Object.keys(parsed.argv).forEach((key) => {
542
+ if (positionalKeys.includes(key)) {
543
+ if (!positionalMap[key]) positionalMap[key] = parsed.argv[key];
544
+ if (!this.isInConfigs(yargs, key) && !this.isDefaulted(yargs, key) && Object.prototype.hasOwnProperty.call(argv, key) && Object.prototype.hasOwnProperty.call(parsed.argv, key) && (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))) argv[key] = [].concat(argv[key], parsed.argv[key]);
545
+ else argv[key] = parsed.argv[key];
546
+ }
547
+ });
548
+ }
549
+ }
550
+ isDefaulted(yargs, key) {
551
+ const { default: defaults } = yargs.getOptions();
552
+ return Object.prototype.hasOwnProperty.call(defaults, key) || Object.prototype.hasOwnProperty.call(defaults, this.shim.Parser.camelCase(key));
553
+ }
554
+ isInConfigs(yargs, key) {
555
+ const { configObjects } = yargs.getOptions();
556
+ return configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, key)) || configObjects.some((c) => Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key)));
557
+ }
558
+ runDefaultBuilderOn(yargs) {
559
+ if (!this.defaultCommand) return;
560
+ if (this.shouldUpdateUsage(yargs)) {
561
+ const commandString = DEFAULT_MARKER.test(this.defaultCommand.original) ? this.defaultCommand.original : this.defaultCommand.original.replace(/^[^[\]<>]*/, "$0 ");
562
+ yargs.getInternalMethods().getUsageInstance().usage(commandString, this.defaultCommand.description);
563
+ }
564
+ const builder = this.defaultCommand.builder;
565
+ if (isCommandBuilderCallback(builder)) return builder(yargs, true);
566
+ else if (!isCommandBuilderDefinition(builder)) Object.keys(builder).forEach((key) => {
567
+ yargs.option(key, builder[key]);
568
+ });
569
+ }
570
+ moduleName(obj) {
571
+ const mod = whichModule(obj);
572
+ if (!mod) throw new Error(`No command name given for module: ${this.shim.inspect(obj)}`);
573
+ return this.commandFromFilename(mod.filename);
574
+ }
575
+ commandFromFilename(filename) {
576
+ return this.shim.path.basename(filename, this.shim.path.extname(filename));
577
+ }
578
+ extractDesc({ describe, description, desc }) {
579
+ for (const test of [
580
+ describe,
581
+ description,
582
+ desc
583
+ ]) {
584
+ if (typeof test === "string" || test === false) return test;
585
+ assertNotStrictEqual(test, true, this.shim);
586
+ }
587
+ return false;
588
+ }
589
+ freeze() {
590
+ this.frozens.push({
591
+ handlers: this.handlers,
592
+ aliasMap: this.aliasMap,
593
+ defaultCommand: this.defaultCommand
594
+ });
595
+ }
596
+ unfreeze() {
597
+ const frozen = this.frozens.pop();
598
+ assertNotStrictEqual(frozen, void 0, this.shim);
599
+ ({handlers: this.handlers, aliasMap: this.aliasMap, defaultCommand: this.defaultCommand} = frozen);
600
+ }
601
+ reset() {
602
+ this.handlers = {};
603
+ this.aliasMap = {};
604
+ this.defaultCommand = void 0;
605
+ this.requireCache = /* @__PURE__ */ new Set();
606
+ return this;
607
+ }
608
+ };
609
+ }));
610
+ // node_modules/yargs/build/lib/utils/obj-filter.js
611
+ function objFilter(original = {}, filter = () => true) {
612
+ const obj = {};
613
+ objectKeys(original).forEach((key) => {
614
+ if (filter(key, original[key])) obj[key] = original[key];
615
+ });
616
+ return obj;
617
+ }
618
+ var init_obj_filter = __esmMin((() => {}));
619
+ // node_modules/yargs/build/lib/utils/set-blocking.js
620
+ function setBlocking(blocking) {
621
+ if (typeof process === "undefined") return;
622
+ [process.stdout, process.stderr].forEach((_stream) => {
623
+ const stream = _stream;
624
+ if (stream._handle && stream.isTTY && typeof stream._handle.setBlocking === "function") stream._handle.setBlocking(blocking);
625
+ });
626
+ }
627
+ var init_set_blocking = __esmMin((() => {}));
628
+ // node_modules/yargs/build/lib/usage.js
629
+ function isBoolean(fail) {
630
+ return typeof fail === "boolean";
631
+ }
632
+ function usage(yargs, shim) {
633
+ const __ = shim.y18n.__;
634
+ const self = {};
635
+ const fails = [];
636
+ self.failFn = function failFn(f) {
637
+ fails.push(f);
638
+ };
639
+ let failMessage = null;
640
+ let globalFailMessage = null;
641
+ let showHelpOnFail = true;
642
+ self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
643
+ const [enabled, message] = typeof arg1 === "string" ? [true, arg1] : [arg1, arg2];
644
+ if (yargs.getInternalMethods().isGlobalContext()) globalFailMessage = message;
645
+ failMessage = message;
646
+ showHelpOnFail = enabled;
647
+ return self;
648
+ };
649
+ let failureOutput = false;
650
+ self.fail = function fail(msg, err) {
651
+ const logger = yargs.getInternalMethods().getLoggerInstance();
652
+ if (fails.length) for (let i = fails.length - 1; i >= 0; --i) {
653
+ const fail = fails[i];
654
+ if (isBoolean(fail)) {
655
+ if (err) throw err;
656
+ else if (msg) throw Error(msg);
657
+ } else fail(msg, err, self);
658
+ }
659
+ else {
660
+ if (yargs.getExitProcess()) setBlocking(true);
661
+ if (!failureOutput) {
662
+ failureOutput = true;
663
+ if (showHelpOnFail) {
664
+ yargs.showHelp("error");
665
+ logger.error();
666
+ }
667
+ if (msg || err) logger.error(msg || err);
668
+ const globalOrCommandFailMessage = failMessage || globalFailMessage;
669
+ if (globalOrCommandFailMessage) {
670
+ if (msg || err) logger.error("");
671
+ logger.error(globalOrCommandFailMessage);
672
+ }
673
+ }
674
+ err = err || new YError(msg);
675
+ if (yargs.getExitProcess()) return yargs.exit(1);
676
+ else if (yargs.getInternalMethods().hasParseCallback()) return yargs.exit(1, err);
677
+ else throw err;
678
+ }
679
+ };
680
+ let usages = [];
681
+ let usageDisabled = false;
682
+ self.usage = (msg, description) => {
683
+ if (msg === null) {
684
+ usageDisabled = true;
685
+ usages = [];
686
+ return self;
687
+ }
688
+ usageDisabled = false;
689
+ usages.push([msg, description || ""]);
690
+ return self;
691
+ };
692
+ self.getUsage = () => {
693
+ return usages;
694
+ };
695
+ self.getUsageDisabled = () => {
696
+ return usageDisabled;
697
+ };
698
+ self.getPositionalGroupName = () => {
699
+ return __("Positionals:");
700
+ };
701
+ let examples = [];
702
+ self.example = (cmd, description) => {
703
+ examples.push([cmd, description || ""]);
704
+ };
705
+ let commands = [];
706
+ self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
707
+ if (isDefault) commands = commands.map((cmdArray) => {
708
+ cmdArray[2] = false;
709
+ return cmdArray;
710
+ });
711
+ commands.push([
712
+ cmd,
713
+ description || "",
714
+ isDefault,
715
+ aliases,
716
+ deprecated
717
+ ]);
718
+ };
719
+ self.getCommands = () => commands;
720
+ let descriptions = {};
721
+ self.describe = function describe(keyOrKeys, desc) {
722
+ if (Array.isArray(keyOrKeys)) keyOrKeys.forEach((k) => {
723
+ self.describe(k, desc);
724
+ });
725
+ else if (typeof keyOrKeys === "object") Object.keys(keyOrKeys).forEach((k) => {
726
+ self.describe(k, keyOrKeys[k]);
727
+ });
728
+ else descriptions[keyOrKeys] = desc;
729
+ };
730
+ self.getDescriptions = () => descriptions;
731
+ let epilogs = [];
732
+ self.epilog = (msg) => {
733
+ epilogs.push(msg);
734
+ };
735
+ let wrapSet = false;
736
+ let wrap;
737
+ self.wrap = (cols) => {
738
+ wrapSet = true;
739
+ wrap = cols;
740
+ };
741
+ self.getWrap = () => {
742
+ if (shim.getEnv("YARGS_DISABLE_WRAP")) return null;
743
+ if (!wrapSet) {
744
+ wrap = windowWidth();
745
+ wrapSet = true;
746
+ }
747
+ return wrap;
748
+ };
749
+ const deferY18nLookupPrefix = "__yargsString__:";
750
+ self.deferY18nLookup = (str) => deferY18nLookupPrefix + str;
751
+ self.help = function help() {
752
+ if (cachedHelpMessage) return cachedHelpMessage;
753
+ normalizeAliases();
754
+ const base$0 = yargs.customScriptName ? yargs.$0 : shim.path.basename(yargs.$0);
755
+ const demandedOptions = yargs.getDemandedOptions();
756
+ const demandedCommands = yargs.getDemandedCommands();
757
+ const deprecatedOptions = yargs.getDeprecatedOptions();
758
+ const groups = yargs.getGroups();
759
+ const options = yargs.getOptions();
760
+ let keys = [];
761
+ keys = keys.concat(Object.keys(descriptions));
762
+ keys = keys.concat(Object.keys(demandedOptions));
763
+ keys = keys.concat(Object.keys(demandedCommands));
764
+ keys = keys.concat(Object.keys(options.default));
765
+ keys = keys.filter(filterHiddenOptions);
766
+ keys = Object.keys(keys.reduce((acc, key) => {
767
+ if (key !== "_") acc[key] = true;
768
+ return acc;
769
+ }, {}));
770
+ const theWrap = self.getWrap();
771
+ const ui = shim.cliui({
772
+ width: theWrap,
773
+ wrap: !!theWrap
774
+ });
775
+ if (!usageDisabled) {
776
+ if (usages.length) {
777
+ usages.forEach((usage) => {
778
+ ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` });
779
+ if (usage[1]) ui.div({
780
+ text: `${usage[1]}`,
781
+ padding: [
782
+ 1,
783
+ 0,
784
+ 0,
785
+ 0
786
+ ]
787
+ });
788
+ });
789
+ ui.div();
790
+ } else if (commands.length) {
791
+ let u = null;
792
+ if (demandedCommands._) u = `${base$0} <${__("command")}>\n`;
793
+ else u = `${base$0} [${__("command")}]\n`;
794
+ ui.div(`${u}`);
795
+ }
796
+ }
797
+ if (commands.length > 1 || commands.length === 1 && !commands[0][2]) {
798
+ ui.div(__("Commands:"));
799
+ const context = yargs.getInternalMethods().getContext();
800
+ const parentCommands = context.commands.length ? `${context.commands.join(" ")} ` : "";
801
+ if (yargs.getInternalMethods().getParserConfiguration()["sort-commands"] === true) commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
802
+ const prefix = base$0 ? `${base$0} ` : "";
803
+ commands.forEach((command) => {
804
+ const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, "")}`;
805
+ ui.span({
806
+ text: commandString,
807
+ padding: [
808
+ 0,
809
+ 2,
810
+ 0,
811
+ 2
812
+ ],
813
+ width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
814
+ }, { text: command[1] });
815
+ const hints = [];
816
+ if (command[2]) hints.push(`[${__("default")}]`);
817
+ if (command[3] && command[3].length) hints.push(`[${__("aliases:")} ${command[3].join(", ")}]`);
818
+ if (command[4]) {
819
+ if (typeof command[4] === "string") hints.push(`[${__("deprecated: %s", command[4])}]`);
820
+ else hints.push(`[${__("deprecated")}]`);
821
+ }
822
+ if (hints.length) ui.div({
823
+ text: hints.join(" "),
824
+ padding: [
825
+ 0,
826
+ 0,
827
+ 0,
828
+ 2
829
+ ],
830
+ align: "right"
831
+ });
832
+ else ui.div();
833
+ });
834
+ ui.div();
835
+ }
836
+ const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
837
+ keys = keys.filter((key) => !yargs.parsed.newAliases[key] && aliasKeys.every((alias) => (options.alias[alias] || []).indexOf(key) === -1));
838
+ const defaultGroup = __("Options:");
839
+ if (!groups[defaultGroup]) groups[defaultGroup] = [];
840
+ addUngroupedKeys(keys, options.alias, groups, defaultGroup);
841
+ const isLongSwitch = (sw) => /^--/.test(getText(sw));
842
+ const displayedGroups = Object.keys(groups).filter((groupName) => groups[groupName].length > 0).map((groupName) => {
843
+ return {
844
+ groupName,
845
+ normalizedKeys: groups[groupName].filter(filterHiddenOptions).map((key) => {
846
+ if (aliasKeys.includes(key)) return key;
847
+ for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== void 0; i++) if ((options.alias[aliasKey] || []).includes(key)) return aliasKey;
848
+ return key;
849
+ })
850
+ };
851
+ }).filter(({ normalizedKeys }) => normalizedKeys.length > 0).map(({ groupName, normalizedKeys }) => {
852
+ return {
853
+ groupName,
854
+ normalizedKeys,
855
+ switches: normalizedKeys.reduce((acc, key) => {
856
+ acc[key] = [key].concat(options.alias[key] || []).map((sw) => {
857
+ if (groupName === self.getPositionalGroupName()) return sw;
858
+ else return (/^[0-9]$/.test(sw) ? options.boolean.includes(key) ? "-" : "--" : sw.length > 1 ? "--" : "-") + sw;
859
+ }).sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2) ? 0 : isLongSwitch(sw1) ? 1 : -1).join(", ");
860
+ return acc;
861
+ }, {})
862
+ };
863
+ });
864
+ if (displayedGroups.filter(({ groupName }) => groupName !== self.getPositionalGroupName()).some(({ normalizedKeys, switches }) => !normalizedKeys.every((key) => isLongSwitch(switches[key])))) displayedGroups.filter(({ groupName }) => groupName !== self.getPositionalGroupName()).forEach(({ normalizedKeys, switches }) => {
865
+ normalizedKeys.forEach((key) => {
866
+ if (isLongSwitch(switches[key])) switches[key] = addIndentation(switches[key], 4);
867
+ });
868
+ });
869
+ displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
870
+ ui.div(groupName);
871
+ normalizedKeys.forEach((key) => {
872
+ const kswitch = switches[key];
873
+ let desc = descriptions[key] || "";
874
+ let type = null;
875
+ if (desc.includes(deferY18nLookupPrefix)) desc = __(desc.substring(16));
876
+ if (options.boolean.includes(key)) type = `[${__("boolean")}]`;
877
+ if (options.count.includes(key)) type = `[${__("count")}]`;
878
+ if (options.string.includes(key)) type = `[${__("string")}]`;
879
+ if (options.normalize.includes(key)) type = `[${__("string")}]`;
880
+ if (options.array.includes(key)) type = `[${__("array")}]`;
881
+ if (options.number.includes(key)) type = `[${__("number")}]`;
882
+ const deprecatedExtra = (deprecated) => typeof deprecated === "string" ? `[${__("deprecated: %s", deprecated)}]` : `[${__("deprecated")}]`;
883
+ const extra = [
884
+ key in deprecatedOptions ? deprecatedExtra(deprecatedOptions[key]) : null,
885
+ type,
886
+ key in demandedOptions ? `[${__("required")}]` : null,
887
+ options.choices && options.choices[key] ? `[${__("choices:")} ${self.stringifiedValues(options.choices[key])}]` : null,
888
+ defaultString(options.default[key], options.defaultDescription[key])
889
+ ].filter(Boolean).join(" ");
890
+ ui.span({
891
+ text: getText(kswitch),
892
+ padding: [
893
+ 0,
894
+ 2,
895
+ 0,
896
+ 2 + getIndentation(kswitch)
897
+ ],
898
+ width: maxWidth(switches, theWrap) + 4
899
+ }, desc);
900
+ const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()["hide-types"] === true;
901
+ if (extra && !shouldHideOptionExtras) ui.div({
902
+ text: extra,
903
+ padding: [
904
+ 0,
905
+ 0,
906
+ 0,
907
+ 2
908
+ ],
909
+ align: "right"
910
+ });
911
+ else ui.div();
912
+ });
913
+ ui.div();
914
+ });
915
+ if (examples.length) {
916
+ ui.div(__("Examples:"));
917
+ examples.forEach((example) => {
918
+ example[0] = example[0].replace(/\$0/g, base$0);
919
+ });
920
+ examples.forEach((example) => {
921
+ if (example[1] === "") ui.div({
922
+ text: example[0],
923
+ padding: [
924
+ 0,
925
+ 2,
926
+ 0,
927
+ 2
928
+ ]
929
+ });
930
+ else ui.div({
931
+ text: example[0],
932
+ padding: [
933
+ 0,
934
+ 2,
935
+ 0,
936
+ 2
937
+ ],
938
+ width: maxWidth(examples, theWrap) + 4
939
+ }, { text: example[1] });
940
+ });
941
+ ui.div();
942
+ }
943
+ if (epilogs.length > 0) {
944
+ const e = epilogs.map((epilog) => epilog.replace(/\$0/g, base$0)).join("\n");
945
+ ui.div(`${e}\n`);
946
+ }
947
+ return ui.toString().replace(/\s*$/, "");
948
+ };
949
+ function maxWidth(table, theWrap, modifier) {
950
+ let width = 0;
951
+ if (!Array.isArray(table)) table = Object.values(table).map((v) => [v]);
952
+ table.forEach((v) => {
953
+ width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
954
+ });
955
+ if (theWrap) width = Math.min(width, parseInt((theWrap * .5).toString(), 10));
956
+ return width;
957
+ }
958
+ function normalizeAliases() {
959
+ const demandedOptions = yargs.getDemandedOptions();
960
+ const options = yargs.getOptions();
961
+ (Object.keys(options.alias) || []).forEach((key) => {
962
+ options.alias[key].forEach((alias) => {
963
+ if (descriptions[alias]) self.describe(key, descriptions[alias]);
964
+ if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias]);
965
+ if (options.boolean.includes(alias)) yargs.boolean(key);
966
+ if (options.count.includes(alias)) yargs.count(key);
967
+ if (options.string.includes(alias)) yargs.string(key);
968
+ if (options.normalize.includes(alias)) yargs.normalize(key);
969
+ if (options.array.includes(alias)) yargs.array(key);
970
+ if (options.number.includes(alias)) yargs.number(key);
971
+ });
972
+ });
973
+ }
974
+ let cachedHelpMessage;
975
+ self.cacheHelpMessage = function() {
976
+ cachedHelpMessage = this.help();
977
+ };
978
+ self.clearCachedHelpMessage = function() {
979
+ cachedHelpMessage = void 0;
980
+ };
981
+ self.hasCachedHelpMessage = function() {
982
+ return !!cachedHelpMessage;
983
+ };
984
+ function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
985
+ let groupedKeys = [];
986
+ let toCheck = null;
987
+ Object.keys(groups).forEach((group) => {
988
+ groupedKeys = groupedKeys.concat(groups[group]);
989
+ });
990
+ keys.forEach((key) => {
991
+ toCheck = [key].concat(aliases[key]);
992
+ if (!toCheck.some((k) => groupedKeys.indexOf(k) !== -1)) groups[defaultGroup].push(key);
993
+ });
994
+ return groupedKeys;
995
+ }
996
+ function filterHiddenOptions(key) {
997
+ return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt];
998
+ }
999
+ self.showHelp = (level) => {
1000
+ const logger = yargs.getInternalMethods().getLoggerInstance();
1001
+ if (!level) level = "error";
1002
+ (typeof level === "function" ? level : logger[level])(self.help());
1003
+ };
1004
+ self.functionDescription = (fn) => {
1005
+ return [
1006
+ "(",
1007
+ fn.name ? shim.Parser.decamelize(fn.name, "-") : __("generated-value"),
1008
+ ")"
1009
+ ].join("");
1010
+ };
1011
+ self.stringifiedValues = function stringifiedValues(values, separator) {
1012
+ let string = "";
1013
+ const sep = separator || ", ";
1014
+ const array = [].concat(values);
1015
+ if (!values || !array.length) return string;
1016
+ array.forEach((value) => {
1017
+ if (string.length) string += sep;
1018
+ string += JSON.stringify(value);
1019
+ });
1020
+ return string;
1021
+ };
1022
+ function defaultString(value, defaultDescription) {
1023
+ let string = `[${__("default:")} `;
1024
+ if (value === void 0 && !defaultDescription) return null;
1025
+ if (defaultDescription) string += defaultDescription;
1026
+ else switch (typeof value) {
1027
+ case "string":
1028
+ string += `"${value}"`;
1029
+ break;
1030
+ case "object":
1031
+ string += JSON.stringify(value);
1032
+ break;
1033
+ default: string += value;
1034
+ }
1035
+ return `${string}]`;
1036
+ }
1037
+ function windowWidth() {
1038
+ const maxWidth = 80;
1039
+ if (shim.process.stdColumns) return Math.min(maxWidth, shim.process.stdColumns);
1040
+ else return maxWidth;
1041
+ }
1042
+ let version = null;
1043
+ self.version = (ver) => {
1044
+ version = ver;
1045
+ };
1046
+ self.showVersion = (level) => {
1047
+ const logger = yargs.getInternalMethods().getLoggerInstance();
1048
+ if (!level) level = "error";
1049
+ (typeof level === "function" ? level : logger[level])(version);
1050
+ };
1051
+ self.reset = function reset(localLookup) {
1052
+ failMessage = null;
1053
+ failureOutput = false;
1054
+ usages = [];
1055
+ usageDisabled = false;
1056
+ epilogs = [];
1057
+ examples = [];
1058
+ commands = [];
1059
+ descriptions = objFilter(descriptions, (k) => !localLookup[k]);
1060
+ return self;
1061
+ };
1062
+ const frozens = [];
1063
+ self.freeze = function freeze() {
1064
+ frozens.push({
1065
+ failMessage,
1066
+ failureOutput,
1067
+ usages,
1068
+ usageDisabled,
1069
+ epilogs,
1070
+ examples,
1071
+ commands,
1072
+ descriptions
1073
+ });
1074
+ };
1075
+ self.unfreeze = function unfreeze(defaultCommand = false) {
1076
+ const frozen = frozens.pop();
1077
+ if (!frozen) return;
1078
+ if (defaultCommand) {
1079
+ descriptions = {
1080
+ ...frozen.descriptions,
1081
+ ...descriptions
1082
+ };
1083
+ commands = [...frozen.commands, ...commands];
1084
+ usages = [...frozen.usages, ...usages];
1085
+ examples = [...frozen.examples, ...examples];
1086
+ epilogs = [...frozen.epilogs, ...epilogs];
1087
+ } else ({failMessage, failureOutput, usages, usageDisabled, epilogs, examples, commands, descriptions} = frozen);
1088
+ };
1089
+ return self;
1090
+ }
1091
+ function isIndentedText(text) {
1092
+ return typeof text === "object";
1093
+ }
1094
+ function addIndentation(text, indent) {
1095
+ return isIndentedText(text) ? {
1096
+ text: text.text,
1097
+ indentation: text.indentation + indent
1098
+ } : {
1099
+ text,
1100
+ indentation: indent
1101
+ };
1102
+ }
1103
+ function getIndentation(text) {
1104
+ return isIndentedText(text) ? text.indentation : 0;
1105
+ }
1106
+ function getText(text) {
1107
+ return isIndentedText(text) ? text.text : text;
1108
+ }
1109
+ var init_usage = __esmMin((() => {
1110
+ init_obj_filter();
1111
+ init_yerror();
1112
+ init_set_blocking();
1113
+ }));
1114
+ // node_modules/yargs/build/lib/completion-templates.js
1115
+ var completionShTemplate, completionZshTemplate;
1116
+ var init_completion_templates = __esmMin((() => {
1117
+ completionShTemplate = `###-begin-{{app_name}}-completions-###
1118
+ #
1119
+ # yargs command completion script
1120
+ #
1121
+ # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
1122
+ # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
1123
+ #
1124
+ _{{app_name}}_yargs_completions()
1125
+ {
1126
+ local cur_word args type_list
1127
+
1128
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
1129
+ args=("\${COMP_WORDS[@]}")
1130
+
1131
+ # ask yargs to generate completions.
1132
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
1133
+
1134
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
1135
+
1136
+ # if no match was found, fall back to filename completion
1137
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
1138
+ COMPREPLY=()
1139
+ fi
1140
+
1141
+ return 0
1142
+ }
1143
+ complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
1144
+ ###-end-{{app_name}}-completions-###
1145
+ `;
1146
+ completionZshTemplate = `#compdef {{app_name}}
1147
+ ###-begin-{{app_name}}-completions-###
1148
+ #
1149
+ # yargs command completion script
1150
+ #
1151
+ # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
1152
+ # or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
1153
+ #
1154
+ _{{app_name}}_yargs_completions()
1155
+ {
1156
+ local reply
1157
+ local si=$IFS
1158
+ IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
1159
+ IFS=$si
1160
+ _describe 'values' reply
1161
+ }
1162
+ compdef _{{app_name}}_yargs_completions {{app_name}}
1163
+ ###-end-{{app_name}}-completions-###
1164
+ `;
1165
+ }));
1166
+ // node_modules/yargs/build/lib/completion.js
1167
+ function completion(yargs, usage, command, shim) {
1168
+ return new Completion(yargs, usage, command, shim);
1169
+ }
1170
+ function isSyncCompletionFunction(completionFunction) {
1171
+ return completionFunction.length < 3;
1172
+ }
1173
+ function isFallbackCompletionFunction(completionFunction) {
1174
+ return completionFunction.length > 3;
1175
+ }
1176
+ var Completion;
1177
+ var init_completion = __esmMin((() => {
1178
+ init_command();
1179
+ init_completion_templates();
1180
+ Completion = class {
1181
+ constructor(yargs, usage, command, shim) {
1182
+ var _a, _b, _c;
1183
+ this.yargs = yargs;
1184
+ this.usage = usage;
1185
+ this.command = command;
1186
+ this.shim = shim;
1187
+ this.completionKey = "get-yargs-completions";
1188
+ this.aliases = null;
1189
+ this.customCompletionFunction = null;
1190
+ this.indexAfterLastReset = 0;
1191
+ this.zshShell = (_c = ((_a = this.shim.getEnv("SHELL")) === null || _a === void 0 ? void 0 : _a.includes("zsh")) || ((_b = this.shim.getEnv("ZSH_NAME")) === null || _b === void 0 ? void 0 : _b.includes("zsh"))) !== null && _c !== void 0 ? _c : false;
1192
+ }
1193
+ defaultCompletion(args, argv, current, done) {
1194
+ const handlers = this.command.getCommandHandlers();
1195
+ for (let i = 0, ii = args.length; i < ii; ++i) if (handlers[args[i]] && handlers[args[i]].builder) {
1196
+ const builder = handlers[args[i]].builder;
1197
+ if (isCommandBuilderCallback(builder)) {
1198
+ this.indexAfterLastReset = i + 1;
1199
+ const y = this.yargs.getInternalMethods().reset();
1200
+ builder(y, true);
1201
+ return y.argv;
1202
+ }
1203
+ }
1204
+ const completions = [];
1205
+ this.commandCompletions(completions, args, current);
1206
+ this.optionCompletions(completions, args, argv, current);
1207
+ this.choicesFromOptionsCompletions(completions, args, argv, current);
1208
+ this.choicesFromPositionalsCompletions(completions, args, argv, current);
1209
+ done(null, completions);
1210
+ }
1211
+ commandCompletions(completions, args, current) {
1212
+ const parentCommands = this.yargs.getInternalMethods().getContext().commands;
1213
+ if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current && !this.previousArgHasChoices(args)) this.usage.getCommands().forEach((usageCommand) => {
1214
+ const commandName = parseCommand(usageCommand[0]).cmd;
1215
+ if (args.indexOf(commandName) === -1) {
1216
+ if (!this.zshShell) completions.push(commandName);
1217
+ else {
1218
+ const desc = usageCommand[1] || "";
1219
+ completions.push(commandName.replace(/:/g, "\\:") + ":" + desc);
1220
+ }
1221
+ }
1222
+ });
1223
+ }
1224
+ optionCompletions(completions, args, argv, current) {
1225
+ if ((current.match(/^-/) || current === "" && completions.length === 0) && !this.previousArgHasChoices(args)) {
1226
+ const options = this.yargs.getOptions();
1227
+ const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
1228
+ Object.keys(options.key).forEach((key) => {
1229
+ const negable = !!options.configuration["boolean-negation"] && options.boolean.includes(key);
1230
+ if (!positionalKeys.includes(key) && !options.hiddenOptions.includes(key) && !this.argsContainKey(args, key, negable)) this.completeOptionKey(key, completions, current, negable && !!options.default[key]);
1231
+ });
1232
+ }
1233
+ }
1234
+ choicesFromOptionsCompletions(completions, args, argv, current) {
1235
+ if (this.previousArgHasChoices(args)) {
1236
+ const choices = this.getPreviousArgChoices(args);
1237
+ if (choices && choices.length > 0) completions.push(...choices.map((c) => c.replace(/:/g, "\\:")));
1238
+ }
1239
+ }
1240
+ choicesFromPositionalsCompletions(completions, args, argv, current) {
1241
+ if (current === "" && completions.length > 0 && this.previousArgHasChoices(args)) return;
1242
+ const positionalKeys = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
1243
+ const offset = Math.max(this.indexAfterLastReset, this.yargs.getInternalMethods().getContext().commands.length + 1);
1244
+ const positionalKey = positionalKeys[argv._.length - offset - 1];
1245
+ if (!positionalKey) return;
1246
+ const choices = this.yargs.getOptions().choices[positionalKey] || [];
1247
+ for (const choice of choices) if (choice.startsWith(current)) completions.push(choice.replace(/:/g, "\\:"));
1248
+ }
1249
+ getPreviousArgChoices(args) {
1250
+ if (args.length < 1) return;
1251
+ let previousArg = args[args.length - 1];
1252
+ let filter = "";
1253
+ if (!previousArg.startsWith("-") && args.length > 1) {
1254
+ filter = previousArg;
1255
+ previousArg = args[args.length - 2];
1256
+ }
1257
+ if (!previousArg.startsWith("-")) return;
1258
+ const previousArgKey = previousArg.replace(/^-+/, "");
1259
+ const options = this.yargs.getOptions();
1260
+ const possibleAliases = [previousArgKey, ...this.yargs.getAliases()[previousArgKey] || []];
1261
+ let choices;
1262
+ for (const possibleAlias of possibleAliases) if (Object.prototype.hasOwnProperty.call(options.key, possibleAlias) && Array.isArray(options.choices[possibleAlias])) {
1263
+ choices = options.choices[possibleAlias];
1264
+ break;
1265
+ }
1266
+ if (choices) return choices.filter((choice) => !filter || choice.startsWith(filter));
1267
+ }
1268
+ previousArgHasChoices(args) {
1269
+ const choices = this.getPreviousArgChoices(args);
1270
+ return choices !== void 0 && choices.length > 0;
1271
+ }
1272
+ argsContainKey(args, key, negable) {
1273
+ const argsContains = (s) => args.indexOf((/^[^0-9]$/.test(s) ? "-" : "--") + s) !== -1;
1274
+ if (argsContains(key)) return true;
1275
+ if (negable && argsContains(`no-${key}`)) return true;
1276
+ if (this.aliases) {
1277
+ for (const alias of this.aliases[key]) if (argsContains(alias)) return true;
1278
+ }
1279
+ return false;
1280
+ }
1281
+ completeOptionKey(key, completions, current, negable) {
1282
+ var _a, _b, _c, _d;
1283
+ let keyWithDesc = key;
1284
+ if (this.zshShell) {
1285
+ const descs = this.usage.getDescriptions();
1286
+ const aliasKey = (_b = (_a = this === null || this === void 0 ? void 0 : this.aliases) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.find((alias) => {
1287
+ const desc = descs[alias];
1288
+ return typeof desc === "string" && desc.length > 0;
1289
+ });
1290
+ const descFromAlias = aliasKey ? descs[aliasKey] : void 0;
1291
+ const desc = (_d = (_c = descs[key]) !== null && _c !== void 0 ? _c : descFromAlias) !== null && _d !== void 0 ? _d : "";
1292
+ keyWithDesc = `${key.replace(/:/g, "\\:")}:${desc.replace("__yargsString__:", "").replace(/(\r\n|\n|\r)/gm, " ")}`;
1293
+ }
1294
+ const startsByTwoDashes = (s) => /^--/.test(s);
1295
+ const isShortOption = (s) => /^[^0-9]$/.test(s);
1296
+ const dashes = !startsByTwoDashes(current) && isShortOption(key) ? "-" : "--";
1297
+ completions.push(dashes + keyWithDesc);
1298
+ if (negable) completions.push(dashes + "no-" + keyWithDesc);
1299
+ }
1300
+ customCompletion(args, argv, current, done) {
1301
+ assertNotStrictEqual(this.customCompletionFunction, null, this.shim);
1302
+ if (isSyncCompletionFunction(this.customCompletionFunction)) {
1303
+ const result = this.customCompletionFunction(current, argv);
1304
+ if (isPromise(result)) return result.then((list) => {
1305
+ this.shim.process.nextTick(() => {
1306
+ done(null, list);
1307
+ });
1308
+ }).catch((err) => {
1309
+ this.shim.process.nextTick(() => {
1310
+ done(err, void 0);
1311
+ });
1312
+ });
1313
+ return done(null, result);
1314
+ } else if (isFallbackCompletionFunction(this.customCompletionFunction)) return this.customCompletionFunction(current, argv, (onCompleted = done) => this.defaultCompletion(args, argv, current, onCompleted), (completions) => {
1315
+ done(null, completions);
1316
+ });
1317
+ else return this.customCompletionFunction(current, argv, (completions) => {
1318
+ done(null, completions);
1319
+ });
1320
+ }
1321
+ getCompletion(args, done) {
1322
+ const current = args.length ? args[args.length - 1] : "";
1323
+ const argv = this.yargs.parse(args, true);
1324
+ const completionFunction = this.customCompletionFunction ? (argv) => this.customCompletion(args, argv, current, done) : (argv) => this.defaultCompletion(args, argv, current, done);
1325
+ return isPromise(argv) ? argv.then(completionFunction) : completionFunction(argv);
1326
+ }
1327
+ generateCompletionScript($0, cmd) {
1328
+ let script = this.zshShell ? completionZshTemplate : completionShTemplate;
1329
+ const name = this.shim.path.basename($0);
1330
+ if ($0.match(/\.js$/)) $0 = `./${$0}`;
1331
+ script = script.replace(/{{app_name}}/g, name);
1332
+ script = script.replace(/{{completion_command}}/g, cmd);
1333
+ return script.replace(/{{app_path}}/g, $0);
1334
+ }
1335
+ registerFunction(fn) {
1336
+ this.customCompletionFunction = fn;
1337
+ }
1338
+ setParsed(parsed) {
1339
+ this.aliases = parsed.aliases;
1340
+ }
1341
+ };
1342
+ }));
1343
+ // node_modules/yargs/build/lib/utils/levenshtein.js
1344
+ function levenshtein(a, b) {
1345
+ if (a.length === 0) return b.length;
1346
+ if (b.length === 0) return a.length;
1347
+ const matrix = [];
1348
+ let i = 0;
1349
+ for (; i <= b.length; i++) matrix[i] = [i];
1350
+ let j = 0;
1351
+ for (; j <= a.length; j++) matrix[0][j] = j;
1352
+ for (i = 1; i <= b.length; i++) for (j = 1; j <= a.length; j++) if (b.charAt(i - 1) === a.charAt(j - 1)) matrix[i][j] = matrix[i - 1][j - 1];
1353
+ else if (i > 1 && j > 1 && b.charAt(i - 2) === a.charAt(j - 1) && b.charAt(i - 1) === a.charAt(j - 2)) matrix[i][j] = matrix[i - 2][j - 2] + 1;
1354
+ else matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
1355
+ return matrix[b.length][a.length];
1356
+ }
1357
+ __esmMin((() => {}));
1358
+ // node_modules/yargs/build/lib/validation.js
1359
+ function validation(yargs, usage, shim) {
1360
+ const __ = shim.y18n.__;
1361
+ const __n = shim.y18n.__n;
1362
+ const self = {};
1363
+ self.nonOptionCount = function nonOptionCount(argv) {
1364
+ const demandedCommands = yargs.getDemandedCommands();
1365
+ const _s = argv._.length + (argv["--"] ? argv["--"].length : 0) - yargs.getInternalMethods().getContext().commands.length;
1366
+ if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
1367
+ if (_s < demandedCommands._.min) {
1368
+ if (demandedCommands._.minMsg !== void 0) usage.fail(demandedCommands._.minMsg ? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString()) : null);
1369
+ else usage.fail(__n("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", _s, _s.toString(), demandedCommands._.min.toString()));
1370
+ } else if (_s > demandedCommands._.max) {
1371
+ if (demandedCommands._.maxMsg !== void 0) usage.fail(demandedCommands._.maxMsg ? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString()) : null);
1372
+ else usage.fail(__n("Too many non-option arguments: got %s, maximum of %s", "Too many non-option arguments: got %s, maximum of %s", _s, _s.toString(), demandedCommands._.max.toString()));
1373
+ }
1374
+ }
1375
+ };
1376
+ self.positionalCount = function positionalCount(required, observed) {
1377
+ if (observed < required) usage.fail(__n("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", observed, observed + "", required + ""));
1378
+ };
1379
+ self.requiredArguments = function requiredArguments(argv, demandedOptions) {
1380
+ let missing = null;
1381
+ for (const key of Object.keys(demandedOptions)) if (!Object.prototype.hasOwnProperty.call(argv, key) || typeof argv[key] === "undefined") {
1382
+ missing = missing || {};
1383
+ missing[key] = demandedOptions[key];
1384
+ }
1385
+ if (missing) {
1386
+ const customMsgs = [];
1387
+ for (const key of Object.keys(missing)) {
1388
+ const msg = missing[key];
1389
+ if (msg && customMsgs.indexOf(msg) < 0) customMsgs.push(msg);
1390
+ }
1391
+ const customMsg = customMsgs.length ? `\n${customMsgs.join("\n")}` : "";
1392
+ usage.fail(__n("Missing required argument: %s", "Missing required arguments: %s", Object.keys(missing).length, Object.keys(missing).join(", ") + customMsg));
1393
+ }
1394
+ };
1395
+ self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
1396
+ var _a;
1397
+ const commandKeys = yargs.getInternalMethods().getCommandInstance().getCommands();
1398
+ const unknown = [];
1399
+ const currentContext = yargs.getInternalMethods().getContext();
1400
+ Object.keys(argv).forEach((key) => {
1401
+ if (!specialKeys.includes(key) && !Object.prototype.hasOwnProperty.call(positionalMap, key) && !Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) && !self.isValidAndSomeAliasIsNotNew(key, aliases)) unknown.push(key);
1402
+ });
1403
+ if (checkPositionals && (currentContext.commands.length > 0 || commandKeys.length > 0 || isDefaultCommand)) argv._.slice(currentContext.commands.length).forEach((key) => {
1404
+ if (!commandKeys.includes("" + key)) unknown.push("" + key);
1405
+ });
1406
+ if (checkPositionals) {
1407
+ const maxNonOptDemanded = ((_a = yargs.getDemandedCommands()._) === null || _a === void 0 ? void 0 : _a.max) || 0;
1408
+ const expected = currentContext.commands.length + maxNonOptDemanded;
1409
+ if (expected < argv._.length) argv._.slice(expected).forEach((key) => {
1410
+ key = String(key);
1411
+ if (!currentContext.commands.includes(key) && !unknown.includes(key)) unknown.push(key);
1412
+ });
1413
+ }
1414
+ if (unknown.length) usage.fail(__n("Unknown argument: %s", "Unknown arguments: %s", unknown.length, unknown.map((s) => s.trim() ? s : `"${s}"`).join(", ")));
1415
+ };
1416
+ self.unknownCommands = function unknownCommands(argv) {
1417
+ const commandKeys = yargs.getInternalMethods().getCommandInstance().getCommands();
1418
+ const unknown = [];
1419
+ const currentContext = yargs.getInternalMethods().getContext();
1420
+ if (currentContext.commands.length > 0 || commandKeys.length > 0) argv._.slice(currentContext.commands.length).forEach((key) => {
1421
+ if (!commandKeys.includes("" + key)) unknown.push("" + key);
1422
+ });
1423
+ if (unknown.length > 0) {
1424
+ usage.fail(__n("Unknown command: %s", "Unknown commands: %s", unknown.length, unknown.join(", ")));
1425
+ return true;
1426
+ } else return false;
1427
+ };
1428
+ self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
1429
+ if (!Object.prototype.hasOwnProperty.call(aliases, key)) return false;
1430
+ const newAliases = yargs.parsed.newAliases;
1431
+ return [key, ...aliases[key]].some((a) => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]);
1432
+ };
1433
+ self.limitedChoices = function limitedChoices(argv) {
1434
+ const options = yargs.getOptions();
1435
+ const invalid = {};
1436
+ if (!Object.keys(options.choices).length) return;
1437
+ Object.keys(argv).forEach((key) => {
1438
+ if (specialKeys.indexOf(key) === -1 && Object.prototype.hasOwnProperty.call(options.choices, key)) [].concat(argv[key]).forEach((value) => {
1439
+ if (options.choices[key].indexOf(value) === -1 && value !== void 0) invalid[key] = (invalid[key] || []).concat(value);
1440
+ });
1441
+ });
1442
+ const invalidKeys = Object.keys(invalid);
1443
+ if (!invalidKeys.length) return;
1444
+ let msg = __("Invalid values:");
1445
+ invalidKeys.forEach((key) => {
1446
+ msg += `\n ${__("Argument: %s, Given: %s, Choices: %s", key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
1447
+ });
1448
+ usage.fail(msg);
1449
+ };
1450
+ let implied = {};
1451
+ self.implies = function implies(key, value) {
1452
+ argsert("<string|object> [array|number|string]", [key, value], arguments.length);
1453
+ if (typeof key === "object") Object.keys(key).forEach((k) => {
1454
+ self.implies(k, key[k]);
1455
+ });
1456
+ else {
1457
+ yargs.global(key);
1458
+ if (!implied[key]) implied[key] = [];
1459
+ if (Array.isArray(value)) value.forEach((i) => self.implies(key, i));
1460
+ else {
1461
+ assertNotStrictEqual(value, void 0, shim);
1462
+ implied[key].push(value);
1463
+ }
1464
+ }
1465
+ };
1466
+ self.getImplied = function getImplied() {
1467
+ return implied;
1468
+ };
1469
+ function keyExists(argv, val) {
1470
+ const num = Number(val);
1471
+ val = isNaN(num) ? val : num;
1472
+ if (typeof val === "number") val = argv._.length >= val;
1473
+ else if (val.match(/^--no-.+/)) {
1474
+ val = val.match(/^--no-(.+)/)[1];
1475
+ val = !Object.prototype.hasOwnProperty.call(argv, val);
1476
+ } else val = Object.prototype.hasOwnProperty.call(argv, val);
1477
+ return val;
1478
+ }
1479
+ self.implications = function implications(argv) {
1480
+ const implyFail = [];
1481
+ Object.keys(implied).forEach((key) => {
1482
+ const origKey = key;
1483
+ (implied[key] || []).forEach((value) => {
1484
+ let key = origKey;
1485
+ const origValue = value;
1486
+ key = keyExists(argv, key);
1487
+ value = keyExists(argv, value);
1488
+ if (key && !value) implyFail.push(` ${origKey} -> ${origValue}`);
1489
+ });
1490
+ });
1491
+ if (implyFail.length) {
1492
+ let msg = `${__("Implications failed:")}\n`;
1493
+ implyFail.forEach((value) => {
1494
+ msg += value;
1495
+ });
1496
+ usage.fail(msg);
1497
+ }
1498
+ };
1499
+ let conflicting = {};
1500
+ self.conflicts = function conflicts(key, value) {
1501
+ argsert("<string|object> [array|string]", [key, value], arguments.length);
1502
+ if (typeof key === "object") Object.keys(key).forEach((k) => {
1503
+ self.conflicts(k, key[k]);
1504
+ });
1505
+ else {
1506
+ yargs.global(key);
1507
+ if (!conflicting[key]) conflicting[key] = [];
1508
+ if (Array.isArray(value)) value.forEach((i) => self.conflicts(key, i));
1509
+ else conflicting[key].push(value);
1510
+ }
1511
+ };
1512
+ self.getConflicting = () => conflicting;
1513
+ self.conflicting = function conflictingFn(argv) {
1514
+ Object.keys(argv).forEach((key) => {
1515
+ if (conflicting[key]) conflicting[key].forEach((value) => {
1516
+ if (value && argv[key] !== void 0 && argv[value] !== void 0) usage.fail(__("Arguments %s and %s are mutually exclusive", key, value));
1517
+ });
1518
+ });
1519
+ if (yargs.getInternalMethods().getParserConfiguration()["strip-dashed"]) Object.keys(conflicting).forEach((key) => {
1520
+ conflicting[key].forEach((value) => {
1521
+ if (value && argv[shim.Parser.camelCase(key)] !== void 0 && argv[shim.Parser.camelCase(value)] !== void 0) usage.fail(__("Arguments %s and %s are mutually exclusive", key, value));
1522
+ });
1523
+ });
1524
+ };
1525
+ self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
1526
+ const threshold = 3;
1527
+ potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
1528
+ let recommended = null;
1529
+ let bestDistance = 1e400;
1530
+ for (let i = 0, candidate; (candidate = potentialCommands[i]) !== void 0; i++) {
1531
+ const d = levenshtein(cmd, candidate);
1532
+ if (d <= threshold && d < bestDistance) {
1533
+ bestDistance = d;
1534
+ recommended = candidate;
1535
+ }
1536
+ }
1537
+ if (recommended) usage.fail(__("Did you mean %s?", recommended));
1538
+ };
1539
+ self.reset = function reset(localLookup) {
1540
+ implied = objFilter(implied, (k) => !localLookup[k]);
1541
+ conflicting = objFilter(conflicting, (k) => !localLookup[k]);
1542
+ return self;
1543
+ };
1544
+ const frozens = [];
1545
+ self.freeze = function freeze() {
1546
+ frozens.push({
1547
+ implied,
1548
+ conflicting
1549
+ });
1550
+ };
1551
+ self.unfreeze = function unfreeze() {
1552
+ const frozen = frozens.pop();
1553
+ assertNotStrictEqual(frozen, void 0, shim);
1554
+ ({implied, conflicting} = frozen);
1555
+ };
1556
+ return self;
1557
+ }
1558
+ var specialKeys;
1559
+ var init_validation = __esmMin((() => {
1560
+ init_argsert();
1561
+ init_obj_filter();
1562
+ specialKeys = [
1563
+ "$0",
1564
+ "--",
1565
+ "_"
1566
+ ];
1567
+ }));
1568
+ // node_modules/yargs/build/lib/yargs-factory.js
1569
+ function YargsFactory(_shim) {
1570
+ return (processArgs = [], cwd = _shim.process.cwd(), parentRequire) => {
1571
+ const yargs = new YargsInstance(processArgs, cwd, parentRequire, _shim);
1572
+ Object.defineProperty(yargs, "argv", {
1573
+ get: () => {
1574
+ return yargs.parse();
1575
+ },
1576
+ enumerable: true
1577
+ });
1578
+ yargs.help();
1579
+ yargs.version();
1580
+ return yargs;
1581
+ };
1582
+ }
1583
+ function isYargsInstance(y) {
1584
+ return !!y && typeof y.getInternalMethods === "function";
1585
+ }
1586
+ var __classPrivateFieldSet, __classPrivateFieldGet, _YargsInstance_command, _YargsInstance_cwd, _YargsInstance_context, _YargsInstance_completion, _YargsInstance_completionCommand, _YargsInstance_defaultShowHiddenOpt, _YargsInstance_exitError, _YargsInstance_detectLocale, _YargsInstance_emittedWarnings, _YargsInstance_exitProcess, _YargsInstance_frozens, _YargsInstance_globalMiddleware, _YargsInstance_groups, _YargsInstance_hasOutput, _YargsInstance_helpOpt, _YargsInstance_isGlobalContext, _YargsInstance_logger, _YargsInstance_output, _YargsInstance_options, _YargsInstance_parentRequire, _YargsInstance_parserConfig, _YargsInstance_parseFn, _YargsInstance_parseContext, _YargsInstance_pkgs, _YargsInstance_preservedGroups, _YargsInstance_processArgs, _YargsInstance_recommendCommands, _YargsInstance_shim, _YargsInstance_strict, _YargsInstance_strictCommands, _YargsInstance_strictOptions, _YargsInstance_usage, _YargsInstance_usageConfig, _YargsInstance_versionOpt, _YargsInstance_validation, kCopyDoubleDash, kCreateLogger, kDeleteFromParserHintObject, kEmitWarning, kFreeze, kGetDollarZero, kGetParserConfiguration, kGetUsageConfiguration, kGuessLocale, kGuessVersion, kParsePositionalNumbers, kPkgUp, kPopulateParserHintArray, kPopulateParserHintSingleValueDictionary, kPopulateParserHintArrayDictionary, kPopulateParserHintDictionary, kSanitizeKey, kSetKey, kUnfreeze, kValidateAsync, kGetCommandInstance, kGetContext, kGetHasOutput, kGetLoggerInstance, kGetParseContext, kGetUsageInstance, kGetValidationInstance, kHasParseCallback, kIsGlobalContext, kPostProcess, kRebase, kReset, kRunYargsParserAndExecuteCommands, kRunValidation, kSetHasOutput, kTrackManuallySetKeys, YargsInstance;
1587
+ var init_yargs_factory = __esmMin((() => {
1588
+ init_command();
1589
+ init_yerror();
1590
+ init_usage();
1591
+ init_argsert();
1592
+ init_completion();
1593
+ init_validation();
1594
+ init_obj_filter();
1595
+ init_apply_extends();
1596
+ init_middleware();
1597
+ init_maybe_async_result();
1598
+ init_set_blocking();
1599
+ __classPrivateFieldSet = function(receiver, state, value, kind, f) {
1600
+ if (kind === "m") throw new TypeError("Private method is not writable");
1601
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1602
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1603
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1604
+ };
1605
+ __classPrivateFieldGet = function(receiver, state, kind, f) {
1606
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1607
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1608
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1609
+ };
1610
+ kCopyDoubleDash = Symbol("copyDoubleDash");
1611
+ kCreateLogger = Symbol("copyDoubleDash");
1612
+ kDeleteFromParserHintObject = Symbol("deleteFromParserHintObject");
1613
+ kEmitWarning = Symbol("emitWarning");
1614
+ kFreeze = Symbol("freeze");
1615
+ kGetDollarZero = Symbol("getDollarZero");
1616
+ kGetParserConfiguration = Symbol("getParserConfiguration");
1617
+ kGetUsageConfiguration = Symbol("getUsageConfiguration");
1618
+ kGuessLocale = Symbol("guessLocale");
1619
+ kGuessVersion = Symbol("guessVersion");
1620
+ kParsePositionalNumbers = Symbol("parsePositionalNumbers");
1621
+ kPkgUp = Symbol("pkgUp");
1622
+ kPopulateParserHintArray = Symbol("populateParserHintArray");
1623
+ kPopulateParserHintSingleValueDictionary = Symbol("populateParserHintSingleValueDictionary");
1624
+ kPopulateParserHintArrayDictionary = Symbol("populateParserHintArrayDictionary");
1625
+ kPopulateParserHintDictionary = Symbol("populateParserHintDictionary");
1626
+ kSanitizeKey = Symbol("sanitizeKey");
1627
+ kSetKey = Symbol("setKey");
1628
+ kUnfreeze = Symbol("unfreeze");
1629
+ kValidateAsync = Symbol("validateAsync");
1630
+ kGetCommandInstance = Symbol("getCommandInstance");
1631
+ kGetContext = Symbol("getContext");
1632
+ kGetHasOutput = Symbol("getHasOutput");
1633
+ kGetLoggerInstance = Symbol("getLoggerInstance");
1634
+ kGetParseContext = Symbol("getParseContext");
1635
+ kGetUsageInstance = Symbol("getUsageInstance");
1636
+ kGetValidationInstance = Symbol("getValidationInstance");
1637
+ kHasParseCallback = Symbol("hasParseCallback");
1638
+ kIsGlobalContext = Symbol("isGlobalContext");
1639
+ kPostProcess = Symbol("postProcess");
1640
+ kRebase = Symbol("rebase");
1641
+ kReset = Symbol("reset");
1642
+ kRunYargsParserAndExecuteCommands = Symbol("runYargsParserAndExecuteCommands");
1643
+ kRunValidation = Symbol("runValidation");
1644
+ kSetHasOutput = Symbol("setHasOutput");
1645
+ kTrackManuallySetKeys = Symbol("kTrackManuallySetKeys");
1646
+ YargsInstance = class {
1647
+ constructor(processArgs = [], cwd, parentRequire, shim) {
1648
+ this.customScriptName = false;
1649
+ this.parsed = false;
1650
+ _YargsInstance_command.set(this, void 0);
1651
+ _YargsInstance_cwd.set(this, void 0);
1652
+ _YargsInstance_context.set(this, {
1653
+ commands: [],
1654
+ fullCommands: []
1655
+ });
1656
+ _YargsInstance_completion.set(this, null);
1657
+ _YargsInstance_completionCommand.set(this, null);
1658
+ _YargsInstance_defaultShowHiddenOpt.set(this, "show-hidden");
1659
+ _YargsInstance_exitError.set(this, null);
1660
+ _YargsInstance_detectLocale.set(this, true);
1661
+ _YargsInstance_emittedWarnings.set(this, {});
1662
+ _YargsInstance_exitProcess.set(this, true);
1663
+ _YargsInstance_frozens.set(this, []);
1664
+ _YargsInstance_globalMiddleware.set(this, void 0);
1665
+ _YargsInstance_groups.set(this, {});
1666
+ _YargsInstance_hasOutput.set(this, false);
1667
+ _YargsInstance_helpOpt.set(this, null);
1668
+ _YargsInstance_isGlobalContext.set(this, true);
1669
+ _YargsInstance_logger.set(this, void 0);
1670
+ _YargsInstance_output.set(this, "");
1671
+ _YargsInstance_options.set(this, void 0);
1672
+ _YargsInstance_parentRequire.set(this, void 0);
1673
+ _YargsInstance_parserConfig.set(this, {});
1674
+ _YargsInstance_parseFn.set(this, null);
1675
+ _YargsInstance_parseContext.set(this, null);
1676
+ _YargsInstance_pkgs.set(this, {});
1677
+ _YargsInstance_preservedGroups.set(this, {});
1678
+ _YargsInstance_processArgs.set(this, void 0);
1679
+ _YargsInstance_recommendCommands.set(this, false);
1680
+ _YargsInstance_shim.set(this, void 0);
1681
+ _YargsInstance_strict.set(this, false);
1682
+ _YargsInstance_strictCommands.set(this, false);
1683
+ _YargsInstance_strictOptions.set(this, false);
1684
+ _YargsInstance_usage.set(this, void 0);
1685
+ _YargsInstance_usageConfig.set(this, {});
1686
+ _YargsInstance_versionOpt.set(this, null);
1687
+ _YargsInstance_validation.set(this, void 0);
1688
+ __classPrivateFieldSet(this, _YargsInstance_shim, shim, "f");
1689
+ __classPrivateFieldSet(this, _YargsInstance_processArgs, processArgs, "f");
1690
+ __classPrivateFieldSet(this, _YargsInstance_cwd, cwd, "f");
1691
+ __classPrivateFieldSet(this, _YargsInstance_parentRequire, parentRequire, "f");
1692
+ __classPrivateFieldSet(this, _YargsInstance_globalMiddleware, new GlobalMiddleware(this), "f");
1693
+ this.$0 = this[kGetDollarZero]();
1694
+ this[kReset]();
1695
+ __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f"), "f");
1696
+ __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), "f");
1697
+ __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f"), "f");
1698
+ __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f"), "f");
1699
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
1700
+ __classPrivateFieldSet(this, _YargsInstance_logger, this[kCreateLogger](), "f");
1701
+ }
1702
+ addHelpOpt(opt, msg) {
1703
+ const defaultHelpOpt = "help";
1704
+ argsert("[string|boolean] [string]", [opt, msg], arguments.length);
1705
+ if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) {
1706
+ this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
1707
+ __classPrivateFieldSet(this, _YargsInstance_helpOpt, null, "f");
1708
+ }
1709
+ if (opt === false && msg === void 0) return this;
1710
+ __classPrivateFieldSet(this, _YargsInstance_helpOpt, typeof opt === "string" ? opt : defaultHelpOpt, "f");
1711
+ this.boolean(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"));
1712
+ this.describe(__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f"), msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup("Show help"));
1713
+ return this;
1714
+ }
1715
+ help(opt, msg) {
1716
+ return this.addHelpOpt(opt, msg);
1717
+ }
1718
+ addShowHiddenOpt(opt, msg) {
1719
+ argsert("[string|boolean] [string]", [opt, msg], arguments.length);
1720
+ if (opt === false && msg === void 0) return this;
1721
+ const showHiddenOpt = typeof opt === "string" ? opt : __classPrivateFieldGet(this, _YargsInstance_defaultShowHiddenOpt, "f");
1722
+ this.boolean(showHiddenOpt);
1723
+ this.describe(showHiddenOpt, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup("Show hidden options"));
1724
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").showHiddenOpt = showHiddenOpt;
1725
+ return this;
1726
+ }
1727
+ showHidden(opt, msg) {
1728
+ return this.addShowHiddenOpt(opt, msg);
1729
+ }
1730
+ alias(key, value) {
1731
+ argsert("<object|string|array> [string|array]", [key, value], arguments.length);
1732
+ this[kPopulateParserHintArrayDictionary](this.alias.bind(this), "alias", key, value);
1733
+ return this;
1734
+ }
1735
+ array(keys) {
1736
+ argsert("<array|string>", [keys], arguments.length);
1737
+ this[kPopulateParserHintArray]("array", keys);
1738
+ this[kTrackManuallySetKeys](keys);
1739
+ return this;
1740
+ }
1741
+ boolean(keys) {
1742
+ argsert("<array|string>", [keys], arguments.length);
1743
+ this[kPopulateParserHintArray]("boolean", keys);
1744
+ this[kTrackManuallySetKeys](keys);
1745
+ return this;
1746
+ }
1747
+ check(f, global) {
1748
+ argsert("<function> [boolean]", [f, global], arguments.length);
1749
+ this.middleware((argv, _yargs) => {
1750
+ return maybeAsyncResult(() => {
1751
+ return f(argv, _yargs.getOptions());
1752
+ }, (result) => {
1753
+ if (!result) __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(__classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__("Argument check failed: %s", f.toString()));
1754
+ else if (typeof result === "string" || result instanceof Error) __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(result.toString(), result);
1755
+ return argv;
1756
+ }, (err) => {
1757
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message ? err.message : err.toString(), err);
1758
+ return argv;
1759
+ });
1760
+ }, false, global);
1761
+ return this;
1762
+ }
1763
+ choices(key, value) {
1764
+ argsert("<object|string|array> [string|array]", [key, value], arguments.length);
1765
+ this[kPopulateParserHintArrayDictionary](this.choices.bind(this), "choices", key, value);
1766
+ return this;
1767
+ }
1768
+ coerce(keys, value) {
1769
+ argsert("<object|string|array> [function]", [keys, value], arguments.length);
1770
+ if (Array.isArray(keys)) {
1771
+ if (!value) throw new YError("coerce callback must be provided");
1772
+ for (const key of keys) this.coerce(key, value);
1773
+ return this;
1774
+ } else if (typeof keys === "object") {
1775
+ for (const key of Object.keys(keys)) this.coerce(key, keys[key]);
1776
+ return this;
1777
+ }
1778
+ if (!value) throw new YError("coerce callback must be provided");
1779
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
1780
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addCoerceMiddleware((argv, yargs) => {
1781
+ let aliases;
1782
+ if (!Object.prototype.hasOwnProperty.call(argv, keys)) return argv;
1783
+ return maybeAsyncResult(() => {
1784
+ aliases = yargs.getAliases();
1785
+ return value(argv[keys]);
1786
+ }, (result) => {
1787
+ argv[keys] = result;
1788
+ const stripAliased = yargs.getInternalMethods().getParserConfiguration()["strip-aliased"];
1789
+ if (aliases[keys] && stripAliased !== true) for (const alias of aliases[keys]) argv[alias] = result;
1790
+ return argv;
1791
+ }, (err) => {
1792
+ throw new YError(err.message);
1793
+ });
1794
+ }, keys);
1795
+ return this;
1796
+ }
1797
+ conflicts(key1, key2) {
1798
+ argsert("<string|object> [string|array]", [key1, key2], arguments.length);
1799
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicts(key1, key2);
1800
+ return this;
1801
+ }
1802
+ config(key = "config", msg, parseFn) {
1803
+ argsert("[object|string] [string|function] [function]", [
1804
+ key,
1805
+ msg,
1806
+ parseFn
1807
+ ], arguments.length);
1808
+ if (typeof key === "object" && !Array.isArray(key)) {
1809
+ key = applyExtends(key, __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()["deep-merge-config"] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1810
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(key);
1811
+ return this;
1812
+ }
1813
+ if (typeof msg === "function") {
1814
+ parseFn = msg;
1815
+ msg = void 0;
1816
+ }
1817
+ this.describe(key, msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup("Path to JSON config file"));
1818
+ (Array.isArray(key) ? key : [key]).forEach((k) => {
1819
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").config[k] = parseFn || true;
1820
+ });
1821
+ return this;
1822
+ }
1823
+ completion(cmd, desc, fn) {
1824
+ argsert("[string] [string|boolean|function] [function]", [
1825
+ cmd,
1826
+ desc,
1827
+ fn
1828
+ ], arguments.length);
1829
+ if (typeof desc === "function") {
1830
+ fn = desc;
1831
+ desc = void 0;
1832
+ }
1833
+ __classPrivateFieldSet(this, _YargsInstance_completionCommand, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || "completion", "f");
1834
+ if (!desc && desc !== false) desc = "generate completion script";
1835
+ this.command(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"), desc);
1836
+ if (fn) __classPrivateFieldGet(this, _YargsInstance_completion, "f").registerFunction(fn);
1837
+ return this;
1838
+ }
1839
+ command(cmd, description, builder, handler, middlewares, deprecated) {
1840
+ argsert("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]", [
1841
+ cmd,
1842
+ description,
1843
+ builder,
1844
+ handler,
1845
+ middlewares,
1846
+ deprecated
1847
+ ], arguments.length);
1848
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").addHandler(cmd, description, builder, handler, middlewares, deprecated);
1849
+ return this;
1850
+ }
1851
+ commands(cmd, description, builder, handler, middlewares, deprecated) {
1852
+ return this.command(cmd, description, builder, handler, middlewares, deprecated);
1853
+ }
1854
+ commandDir(dir, opts) {
1855
+ argsert("<string> [object]", [dir, opts], arguments.length);
1856
+ const req = __classPrivateFieldGet(this, _YargsInstance_parentRequire, "f") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").require;
1857
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").addDirectory(dir, req, __classPrivateFieldGet(this, _YargsInstance_shim, "f").getCallerFile(), opts);
1858
+ return this;
1859
+ }
1860
+ count(keys) {
1861
+ argsert("<array|string>", [keys], arguments.length);
1862
+ this[kPopulateParserHintArray]("count", keys);
1863
+ this[kTrackManuallySetKeys](keys);
1864
+ return this;
1865
+ }
1866
+ default(key, value, defaultDescription) {
1867
+ argsert("<object|string|array> [*] [string]", [
1868
+ key,
1869
+ value,
1870
+ defaultDescription
1871
+ ], arguments.length);
1872
+ if (defaultDescription) {
1873
+ assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1874
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = defaultDescription;
1875
+ }
1876
+ if (typeof value === "function") {
1877
+ assertSingleKey(key, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1878
+ if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key]) __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = __classPrivateFieldGet(this, _YargsInstance_usage, "f").functionDescription(value);
1879
+ value = value.call();
1880
+ }
1881
+ this[kPopulateParserHintSingleValueDictionary](this.default.bind(this), "default", key, value);
1882
+ return this;
1883
+ }
1884
+ defaults(key, value, defaultDescription) {
1885
+ return this.default(key, value, defaultDescription);
1886
+ }
1887
+ demandCommand(min = 1, max, minMsg, maxMsg) {
1888
+ argsert("[number] [number|string] [string|null|undefined] [string|null|undefined]", [
1889
+ min,
1890
+ max,
1891
+ minMsg,
1892
+ maxMsg
1893
+ ], arguments.length);
1894
+ if (typeof max !== "number") {
1895
+ minMsg = max;
1896
+ max = 1e400;
1897
+ }
1898
+ this.global("_", false);
1899
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands._ = {
1900
+ min,
1901
+ max,
1902
+ minMsg,
1903
+ maxMsg
1904
+ };
1905
+ return this;
1906
+ }
1907
+ demand(keys, max, msg) {
1908
+ if (Array.isArray(max)) {
1909
+ max.forEach((key) => {
1910
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1911
+ this.demandOption(key, msg);
1912
+ });
1913
+ max = 1e400;
1914
+ } else if (typeof max !== "number") {
1915
+ msg = max;
1916
+ max = 1e400;
1917
+ }
1918
+ if (typeof keys === "number") {
1919
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1920
+ this.demandCommand(keys, max, msg, msg);
1921
+ } else if (Array.isArray(keys)) keys.forEach((key) => {
1922
+ assertNotStrictEqual(msg, true, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
1923
+ this.demandOption(key, msg);
1924
+ });
1925
+ else if (typeof msg === "string") this.demandOption(keys, msg);
1926
+ else if (msg === true || typeof msg === "undefined") this.demandOption(keys);
1927
+ return this;
1928
+ }
1929
+ demandOption(keys, msg) {
1930
+ argsert("<object|string|array> [string]", [keys, msg], arguments.length);
1931
+ this[kPopulateParserHintSingleValueDictionary](this.demandOption.bind(this), "demandedOptions", keys, msg);
1932
+ return this;
1933
+ }
1934
+ deprecateOption(option, message) {
1935
+ argsert("<string> [string|boolean]", [option, message], arguments.length);
1936
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions[option] = message;
1937
+ return this;
1938
+ }
1939
+ describe(keys, description) {
1940
+ argsert("<object|string|array> [string]", [keys, description], arguments.length);
1941
+ this[kSetKey](keys, true);
1942
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").describe(keys, description);
1943
+ return this;
1944
+ }
1945
+ detectLocale(detect) {
1946
+ argsert("<boolean>", [detect], arguments.length);
1947
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, detect, "f");
1948
+ return this;
1949
+ }
1950
+ env(prefix) {
1951
+ argsert("[string|boolean]", [prefix], arguments.length);
1952
+ if (prefix === false) delete __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix;
1953
+ else __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix = prefix || "";
1954
+ return this;
1955
+ }
1956
+ epilogue(msg) {
1957
+ argsert("<string>", [msg], arguments.length);
1958
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").epilog(msg);
1959
+ return this;
1960
+ }
1961
+ epilog(msg) {
1962
+ return this.epilogue(msg);
1963
+ }
1964
+ example(cmd, description) {
1965
+ argsert("<string|array> [string]", [cmd, description], arguments.length);
1966
+ if (Array.isArray(cmd)) cmd.forEach((exampleParams) => this.example(...exampleParams));
1967
+ else __classPrivateFieldGet(this, _YargsInstance_usage, "f").example(cmd, description);
1968
+ return this;
1969
+ }
1970
+ exit(code, err) {
1971
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
1972
+ __classPrivateFieldSet(this, _YargsInstance_exitError, err, "f");
1973
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.exit(code);
1974
+ }
1975
+ exitProcess(enabled = true) {
1976
+ argsert("[boolean]", [enabled], arguments.length);
1977
+ __classPrivateFieldSet(this, _YargsInstance_exitProcess, enabled, "f");
1978
+ return this;
1979
+ }
1980
+ fail(f) {
1981
+ argsert("<function|boolean>", [f], arguments.length);
1982
+ if (typeof f === "boolean" && f !== false) throw new YError("Invalid first argument. Expected function or boolean 'false'");
1983
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").failFn(f);
1984
+ return this;
1985
+ }
1986
+ getAliases() {
1987
+ return this.parsed ? this.parsed.aliases : {};
1988
+ }
1989
+ async getCompletion(args, done) {
1990
+ argsert("<array> [function]", [args, done], arguments.length);
1991
+ if (!done) return new Promise((resolve, reject) => {
1992
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, (err, completions) => {
1993
+ if (err) reject(err);
1994
+ else resolve(completions);
1995
+ });
1996
+ });
1997
+ else return __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(args, done);
1998
+ }
1999
+ getDemandedOptions() {
2000
+ argsert([], 0);
2001
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedOptions;
2002
+ }
2003
+ getDemandedCommands() {
2004
+ argsert([], 0);
2005
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").demandedCommands;
2006
+ }
2007
+ getDeprecatedOptions() {
2008
+ argsert([], 0);
2009
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f").deprecatedOptions;
2010
+ }
2011
+ getDetectLocale() {
2012
+ return __classPrivateFieldGet(this, _YargsInstance_detectLocale, "f");
2013
+ }
2014
+ getExitProcess() {
2015
+ return __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f");
2016
+ }
2017
+ getGroups() {
2018
+ return Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_groups, "f"), __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f"));
2019
+ }
2020
+ getHelp() {
2021
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
2022
+ if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
2023
+ if (!this.parsed) {
2024
+ const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), void 0, void 0, 0, true);
2025
+ if (isPromise(parse)) return parse.then(() => {
2026
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help();
2027
+ });
2028
+ }
2029
+ const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this);
2030
+ if (isPromise(builderResponse)) return builderResponse.then(() => {
2031
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f").help();
2032
+ });
2033
+ }
2034
+ return Promise.resolve(__classPrivateFieldGet(this, _YargsInstance_usage, "f").help());
2035
+ }
2036
+ getOptions() {
2037
+ return __classPrivateFieldGet(this, _YargsInstance_options, "f");
2038
+ }
2039
+ getStrict() {
2040
+ return __classPrivateFieldGet(this, _YargsInstance_strict, "f");
2041
+ }
2042
+ getStrictCommands() {
2043
+ return __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f");
2044
+ }
2045
+ getStrictOptions() {
2046
+ return __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f");
2047
+ }
2048
+ global(globals, global) {
2049
+ argsert("<string|array> [boolean]", [globals, global], arguments.length);
2050
+ globals = [].concat(globals);
2051
+ if (global !== false) __classPrivateFieldGet(this, _YargsInstance_options, "f").local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local.filter((l) => globals.indexOf(l) === -1);
2052
+ else globals.forEach((g) => {
2053
+ if (!__classPrivateFieldGet(this, _YargsInstance_options, "f").local.includes(g)) __classPrivateFieldGet(this, _YargsInstance_options, "f").local.push(g);
2054
+ });
2055
+ return this;
2056
+ }
2057
+ group(opts, groupName) {
2058
+ argsert("<string|array> <string>", [opts, groupName], arguments.length);
2059
+ const existing = __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName] || __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName];
2060
+ if (__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName]) delete __classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f")[groupName];
2061
+ const seen = {};
2062
+ __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName] = (existing || []).concat(opts).filter((key) => {
2063
+ if (seen[key]) return false;
2064
+ return seen[key] = true;
2065
+ });
2066
+ return this;
2067
+ }
2068
+ hide(key) {
2069
+ argsert("<string>", [key], arguments.length);
2070
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").hiddenOptions.push(key);
2071
+ return this;
2072
+ }
2073
+ implies(key, value) {
2074
+ argsert("<string|object> [number|string|array]", [key, value], arguments.length);
2075
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").implies(key, value);
2076
+ return this;
2077
+ }
2078
+ locale(locale) {
2079
+ argsert("[string]", [locale], arguments.length);
2080
+ if (locale === void 0) {
2081
+ this[kGuessLocale]();
2082
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.getLocale();
2083
+ }
2084
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f");
2085
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.setLocale(locale);
2086
+ return this;
2087
+ }
2088
+ middleware(callback, applyBeforeValidation, global) {
2089
+ return __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").addMiddleware(callback, !!applyBeforeValidation, global);
2090
+ }
2091
+ nargs(key, value) {
2092
+ argsert("<string|object|array> [number]", [key, value], arguments.length);
2093
+ this[kPopulateParserHintSingleValueDictionary](this.nargs.bind(this), "narg", key, value);
2094
+ return this;
2095
+ }
2096
+ normalize(keys) {
2097
+ argsert("<array|string>", [keys], arguments.length);
2098
+ this[kPopulateParserHintArray]("normalize", keys);
2099
+ return this;
2100
+ }
2101
+ number(keys) {
2102
+ argsert("<array|string>", [keys], arguments.length);
2103
+ this[kPopulateParserHintArray]("number", keys);
2104
+ this[kTrackManuallySetKeys](keys);
2105
+ return this;
2106
+ }
2107
+ option(key, opt) {
2108
+ argsert("<string|object> [object]", [key, opt], arguments.length);
2109
+ if (typeof key === "object") Object.keys(key).forEach((k) => {
2110
+ this.options(k, key[k]);
2111
+ });
2112
+ else {
2113
+ if (typeof opt !== "object") opt = {};
2114
+ this[kTrackManuallySetKeys](key);
2115
+ if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && (key === "version" || (opt === null || opt === void 0 ? void 0 : opt.alias) === "version")) this[kEmitWarning]([
2116
+ "\"version\" is a reserved word.",
2117
+ "Please do one of the following:",
2118
+ "- Disable version with `yargs.version(false)` if using \"version\" as an option",
2119
+ "- Use the built-in `yargs.version` method instead (if applicable)",
2120
+ "- Use a different option key",
2121
+ "https://yargs.js.org/docs/#api-reference-version"
2122
+ ].join("\n"), void 0, "versionWarning");
2123
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").key[key] = true;
2124
+ if (opt.alias) this.alias(key, opt.alias);
2125
+ const deprecate = opt.deprecate || opt.deprecated;
2126
+ if (deprecate) this.deprecateOption(key, deprecate);
2127
+ const demand = opt.demand || opt.required || opt.require;
2128
+ if (demand) this.demand(key, demand);
2129
+ if (opt.demandOption) this.demandOption(key, typeof opt.demandOption === "string" ? opt.demandOption : void 0);
2130
+ if (opt.conflicts) this.conflicts(key, opt.conflicts);
2131
+ if ("default" in opt) this.default(key, opt.default);
2132
+ if (opt.implies !== void 0) this.implies(key, opt.implies);
2133
+ if (opt.nargs !== void 0) this.nargs(key, opt.nargs);
2134
+ if (opt.config) this.config(key, opt.configParser);
2135
+ if (opt.normalize) this.normalize(key);
2136
+ if (opt.choices) this.choices(key, opt.choices);
2137
+ if (opt.coerce) this.coerce(key, opt.coerce);
2138
+ if (opt.group) this.group(key, opt.group);
2139
+ if (opt.boolean || opt.type === "boolean") {
2140
+ this.boolean(key);
2141
+ if (opt.alias) this.boolean(opt.alias);
2142
+ }
2143
+ if (opt.array || opt.type === "array") {
2144
+ this.array(key);
2145
+ if (opt.alias) this.array(opt.alias);
2146
+ }
2147
+ if (opt.number || opt.type === "number") {
2148
+ this.number(key);
2149
+ if (opt.alias) this.number(opt.alias);
2150
+ }
2151
+ if (opt.string || opt.type === "string") {
2152
+ this.string(key);
2153
+ if (opt.alias) this.string(opt.alias);
2154
+ }
2155
+ if (opt.count || opt.type === "count") this.count(key);
2156
+ if (typeof opt.global === "boolean") this.global(key, opt.global);
2157
+ if (opt.defaultDescription) __classPrivateFieldGet(this, _YargsInstance_options, "f").defaultDescription[key] = opt.defaultDescription;
2158
+ if (opt.skipValidation) this.skipValidation(key);
2159
+ const desc = opt.describe || opt.description || opt.desc;
2160
+ const descriptions = __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions();
2161
+ if (!Object.prototype.hasOwnProperty.call(descriptions, key) || typeof desc === "string") this.describe(key, desc);
2162
+ if (opt.hidden) this.hide(key);
2163
+ if (opt.requiresArg) this.requiresArg(key);
2164
+ }
2165
+ return this;
2166
+ }
2167
+ options(key, opt) {
2168
+ return this.option(key, opt);
2169
+ }
2170
+ parse(args, shortCircuit, _parseFn) {
2171
+ argsert("[string|array] [function|boolean|object] [function]", [
2172
+ args,
2173
+ shortCircuit,
2174
+ _parseFn
2175
+ ], arguments.length);
2176
+ this[kFreeze]();
2177
+ if (typeof args === "undefined") args = __classPrivateFieldGet(this, _YargsInstance_processArgs, "f");
2178
+ if (typeof shortCircuit === "object") {
2179
+ __classPrivateFieldSet(this, _YargsInstance_parseContext, shortCircuit, "f");
2180
+ shortCircuit = _parseFn;
2181
+ }
2182
+ if (typeof shortCircuit === "function") {
2183
+ __classPrivateFieldSet(this, _YargsInstance_parseFn, shortCircuit, "f");
2184
+ shortCircuit = false;
2185
+ }
2186
+ if (!shortCircuit) __classPrivateFieldSet(this, _YargsInstance_processArgs, args, "f");
2187
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) __classPrivateFieldSet(this, _YargsInstance_exitProcess, false, "f");
2188
+ const parsed = this[kRunYargsParserAndExecuteCommands](args, !!shortCircuit);
2189
+ const tmpParsed = this.parsed;
2190
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").setParsed(this.parsed);
2191
+ if (isPromise(parsed)) return parsed.then((argv) => {
2192
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), argv, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
2193
+ return argv;
2194
+ }).catch((err) => {
2195
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) __classPrivateFieldGet(this, _YargsInstance_parseFn, "f")(err, this.parsed.argv, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
2196
+ throw err;
2197
+ }).finally(() => {
2198
+ this[kUnfreeze]();
2199
+ this.parsed = tmpParsed;
2200
+ });
2201
+ else {
2202
+ if (__classPrivateFieldGet(this, _YargsInstance_parseFn, "f")) __classPrivateFieldGet(this, _YargsInstance_parseFn, "f").call(this, __classPrivateFieldGet(this, _YargsInstance_exitError, "f"), parsed, __classPrivateFieldGet(this, _YargsInstance_output, "f"));
2203
+ this[kUnfreeze]();
2204
+ this.parsed = tmpParsed;
2205
+ }
2206
+ return parsed;
2207
+ }
2208
+ parseAsync(args, shortCircuit, _parseFn) {
2209
+ const maybePromise = this.parse(args, shortCircuit, _parseFn);
2210
+ return !isPromise(maybePromise) ? Promise.resolve(maybePromise) : maybePromise;
2211
+ }
2212
+ parseSync(args, shortCircuit, _parseFn) {
2213
+ const maybePromise = this.parse(args, shortCircuit, _parseFn);
2214
+ if (isPromise(maybePromise)) throw new YError(".parseSync() must not be used with asynchronous builders, handlers, or middleware");
2215
+ return maybePromise;
2216
+ }
2217
+ parserConfiguration(config) {
2218
+ argsert("<object>", [config], arguments.length);
2219
+ __classPrivateFieldSet(this, _YargsInstance_parserConfig, config, "f");
2220
+ return this;
2221
+ }
2222
+ pkgConf(key, rootPath) {
2223
+ argsert("<string> [string]", [key, rootPath], arguments.length);
2224
+ let conf = null;
2225
+ const obj = this[kPkgUp](rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f"));
2226
+ if (obj[key] && typeof obj[key] === "object") {
2227
+ conf = applyExtends(obj[key], rootPath || __classPrivateFieldGet(this, _YargsInstance_cwd, "f"), this[kGetParserConfiguration]()["deep-merge-config"] || false, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
2228
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = (__classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || []).concat(conf);
2229
+ }
2230
+ return this;
2231
+ }
2232
+ positional(key, opts) {
2233
+ argsert("<string> <object>", [key, opts], arguments.length);
2234
+ const supportedOpts = [
2235
+ "default",
2236
+ "defaultDescription",
2237
+ "implies",
2238
+ "normalize",
2239
+ "choices",
2240
+ "conflicts",
2241
+ "coerce",
2242
+ "type",
2243
+ "describe",
2244
+ "desc",
2245
+ "description",
2246
+ "alias"
2247
+ ];
2248
+ opts = objFilter(opts, (k, v) => {
2249
+ if (k === "type" && ![
2250
+ "string",
2251
+ "number",
2252
+ "boolean"
2253
+ ].includes(v)) return false;
2254
+ return supportedOpts.includes(k);
2255
+ });
2256
+ const fullCommand = __classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands[__classPrivateFieldGet(this, _YargsInstance_context, "f").fullCommands.length - 1];
2257
+ const parseOptions = fullCommand ? __classPrivateFieldGet(this, _YargsInstance_command, "f").cmdToParseOptions(fullCommand) : {
2258
+ array: [],
2259
+ alias: {},
2260
+ default: {},
2261
+ demand: {}
2262
+ };
2263
+ objectKeys(parseOptions).forEach((pk) => {
2264
+ const parseOption = parseOptions[pk];
2265
+ if (Array.isArray(parseOption)) {
2266
+ if (parseOption.indexOf(key) !== -1) opts[pk] = true;
2267
+ } else if (parseOption[key] && !(pk in opts)) opts[pk] = parseOption[key];
2268
+ });
2269
+ this.group(key, __classPrivateFieldGet(this, _YargsInstance_usage, "f").getPositionalGroupName());
2270
+ return this.option(key, opts);
2271
+ }
2272
+ recommendCommands(recommend = true) {
2273
+ argsert("[boolean]", [recommend], arguments.length);
2274
+ __classPrivateFieldSet(this, _YargsInstance_recommendCommands, recommend, "f");
2275
+ return this;
2276
+ }
2277
+ required(keys, max, msg) {
2278
+ return this.demand(keys, max, msg);
2279
+ }
2280
+ require(keys, max, msg) {
2281
+ return this.demand(keys, max, msg);
2282
+ }
2283
+ requiresArg(keys) {
2284
+ argsert("<array|string|object> [number]", [keys], arguments.length);
2285
+ if (typeof keys === "string" && __classPrivateFieldGet(this, _YargsInstance_options, "f").narg[keys]) return this;
2286
+ else this[kPopulateParserHintSingleValueDictionary](this.requiresArg.bind(this), "narg", keys, NaN);
2287
+ return this;
2288
+ }
2289
+ showCompletionScript($0, cmd) {
2290
+ argsert("[string] [string]", [$0, cmd], arguments.length);
2291
+ $0 = $0 || this.$0;
2292
+ __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(__classPrivateFieldGet(this, _YargsInstance_completion, "f").generateCompletionScript($0, cmd || __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") || "completion"));
2293
+ return this;
2294
+ }
2295
+ showHelp(level) {
2296
+ argsert("[string|function]", [level], arguments.length);
2297
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
2298
+ if (!__classPrivateFieldGet(this, _YargsInstance_usage, "f").hasCachedHelpMessage()) {
2299
+ if (!this.parsed) {
2300
+ const parse = this[kRunYargsParserAndExecuteCommands](__classPrivateFieldGet(this, _YargsInstance_processArgs, "f"), void 0, void 0, 0, true);
2301
+ if (isPromise(parse)) {
2302
+ parse.then(() => {
2303
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
2304
+ });
2305
+ return this;
2306
+ }
2307
+ }
2308
+ const builderResponse = __classPrivateFieldGet(this, _YargsInstance_command, "f").runDefaultBuilderOn(this);
2309
+ if (isPromise(builderResponse)) {
2310
+ builderResponse.then(() => {
2311
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
2312
+ });
2313
+ return this;
2314
+ }
2315
+ }
2316
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelp(level);
2317
+ return this;
2318
+ }
2319
+ scriptName(scriptName) {
2320
+ this.customScriptName = true;
2321
+ this.$0 = scriptName;
2322
+ return this;
2323
+ }
2324
+ showHelpOnFail(enabled, message) {
2325
+ argsert("[boolean|string] [string]", [enabled, message], arguments.length);
2326
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showHelpOnFail(enabled, message);
2327
+ return this;
2328
+ }
2329
+ showVersion(level) {
2330
+ argsert("[string|function]", [level], arguments.length);
2331
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion(level);
2332
+ return this;
2333
+ }
2334
+ skipValidation(keys) {
2335
+ argsert("<array|string>", [keys], arguments.length);
2336
+ this[kPopulateParserHintArray]("skipValidation", keys);
2337
+ return this;
2338
+ }
2339
+ strict(enabled) {
2340
+ argsert("[boolean]", [enabled], arguments.length);
2341
+ __classPrivateFieldSet(this, _YargsInstance_strict, enabled !== false, "f");
2342
+ return this;
2343
+ }
2344
+ strictCommands(enabled) {
2345
+ argsert("[boolean]", [enabled], arguments.length);
2346
+ __classPrivateFieldSet(this, _YargsInstance_strictCommands, enabled !== false, "f");
2347
+ return this;
2348
+ }
2349
+ strictOptions(enabled) {
2350
+ argsert("[boolean]", [enabled], arguments.length);
2351
+ __classPrivateFieldSet(this, _YargsInstance_strictOptions, enabled !== false, "f");
2352
+ return this;
2353
+ }
2354
+ string(keys) {
2355
+ argsert("<array|string>", [keys], arguments.length);
2356
+ this[kPopulateParserHintArray]("string", keys);
2357
+ this[kTrackManuallySetKeys](keys);
2358
+ return this;
2359
+ }
2360
+ terminalWidth() {
2361
+ argsert([], 0);
2362
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.stdColumns;
2363
+ }
2364
+ updateLocale(obj) {
2365
+ return this.updateStrings(obj);
2366
+ }
2367
+ updateStrings(obj) {
2368
+ argsert("<object>", [obj], arguments.length);
2369
+ __classPrivateFieldSet(this, _YargsInstance_detectLocale, false, "f");
2370
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.updateLocale(obj);
2371
+ return this;
2372
+ }
2373
+ usage(msg, description, builder, handler) {
2374
+ argsert("<string|null|undefined> [string|boolean] [function|object] [function]", [
2375
+ msg,
2376
+ description,
2377
+ builder,
2378
+ handler
2379
+ ], arguments.length);
2380
+ if (description !== void 0) {
2381
+ assertNotStrictEqual(msg, null, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
2382
+ if ((msg || "").match(/^\$0( |$)/)) return this.command(msg, description, builder, handler);
2383
+ else throw new YError(".usage() description must start with $0 if being used as alias for .command()");
2384
+ } else {
2385
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").usage(msg);
2386
+ return this;
2387
+ }
2388
+ }
2389
+ usageConfiguration(config) {
2390
+ argsert("<object>", [config], arguments.length);
2391
+ __classPrivateFieldSet(this, _YargsInstance_usageConfig, config, "f");
2392
+ return this;
2393
+ }
2394
+ version(opt, msg, ver) {
2395
+ const defaultVersionOpt = "version";
2396
+ argsert("[boolean|string] [string] [string]", [
2397
+ opt,
2398
+ msg,
2399
+ ver
2400
+ ], arguments.length);
2401
+ if (__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f")) {
2402
+ this[kDeleteFromParserHintObject](__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"));
2403
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(void 0);
2404
+ __classPrivateFieldSet(this, _YargsInstance_versionOpt, null, "f");
2405
+ }
2406
+ if (arguments.length === 0) {
2407
+ ver = this[kGuessVersion]();
2408
+ opt = defaultVersionOpt;
2409
+ } else if (arguments.length === 1) {
2410
+ if (opt === false) return this;
2411
+ ver = opt;
2412
+ opt = defaultVersionOpt;
2413
+ } else if (arguments.length === 2) {
2414
+ ver = msg;
2415
+ msg = void 0;
2416
+ }
2417
+ __classPrivateFieldSet(this, _YargsInstance_versionOpt, typeof opt === "string" ? opt : defaultVersionOpt, "f");
2418
+ msg = msg || __classPrivateFieldGet(this, _YargsInstance_usage, "f").deferY18nLookup("Show version number");
2419
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").version(ver || void 0);
2420
+ this.boolean(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"));
2421
+ this.describe(__classPrivateFieldGet(this, _YargsInstance_versionOpt, "f"), msg);
2422
+ return this;
2423
+ }
2424
+ wrap(cols) {
2425
+ argsert("<number|null|undefined>", [cols], arguments.length);
2426
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").wrap(cols);
2427
+ return this;
2428
+ }
2429
+ [(_YargsInstance_command = /* @__PURE__ */ new WeakMap(), _YargsInstance_cwd = /* @__PURE__ */ new WeakMap(), _YargsInstance_context = /* @__PURE__ */ new WeakMap(), _YargsInstance_completion = /* @__PURE__ */ new WeakMap(), _YargsInstance_completionCommand = /* @__PURE__ */ new WeakMap(), _YargsInstance_defaultShowHiddenOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitError = /* @__PURE__ */ new WeakMap(), _YargsInstance_detectLocale = /* @__PURE__ */ new WeakMap(), _YargsInstance_emittedWarnings = /* @__PURE__ */ new WeakMap(), _YargsInstance_exitProcess = /* @__PURE__ */ new WeakMap(), _YargsInstance_frozens = /* @__PURE__ */ new WeakMap(), _YargsInstance_globalMiddleware = /* @__PURE__ */ new WeakMap(), _YargsInstance_groups = /* @__PURE__ */ new WeakMap(), _YargsInstance_hasOutput = /* @__PURE__ */ new WeakMap(), _YargsInstance_helpOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_isGlobalContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_logger = /* @__PURE__ */ new WeakMap(), _YargsInstance_output = /* @__PURE__ */ new WeakMap(), _YargsInstance_options = /* @__PURE__ */ new WeakMap(), _YargsInstance_parentRequire = /* @__PURE__ */ new WeakMap(), _YargsInstance_parserConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseFn = /* @__PURE__ */ new WeakMap(), _YargsInstance_parseContext = /* @__PURE__ */ new WeakMap(), _YargsInstance_pkgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_preservedGroups = /* @__PURE__ */ new WeakMap(), _YargsInstance_processArgs = /* @__PURE__ */ new WeakMap(), _YargsInstance_recommendCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_shim = /* @__PURE__ */ new WeakMap(), _YargsInstance_strict = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictCommands = /* @__PURE__ */ new WeakMap(), _YargsInstance_strictOptions = /* @__PURE__ */ new WeakMap(), _YargsInstance_usage = /* @__PURE__ */ new WeakMap(), _YargsInstance_usageConfig = /* @__PURE__ */ new WeakMap(), _YargsInstance_versionOpt = /* @__PURE__ */ new WeakMap(), _YargsInstance_validation = /* @__PURE__ */ new WeakMap(), kCopyDoubleDash)](argv) {
2430
+ if (!argv._ || !argv["--"]) return argv;
2431
+ argv._.push.apply(argv._, argv["--"]);
2432
+ try {
2433
+ delete argv["--"];
2434
+ } catch (_err) {}
2435
+ return argv;
2436
+ }
2437
+ [kCreateLogger]() {
2438
+ return {
2439
+ log: (...args) => {
2440
+ if (!this[kHasParseCallback]()) console.log(...args);
2441
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
2442
+ if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length) __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + "\n", "f");
2443
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(" "), "f");
2444
+ },
2445
+ error: (...args) => {
2446
+ if (!this[kHasParseCallback]()) console.error(...args);
2447
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
2448
+ if (__classPrivateFieldGet(this, _YargsInstance_output, "f").length) __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + "\n", "f");
2449
+ __classPrivateFieldSet(this, _YargsInstance_output, __classPrivateFieldGet(this, _YargsInstance_output, "f") + args.join(" "), "f");
2450
+ }
2451
+ };
2452
+ }
2453
+ [kDeleteFromParserHintObject](optionKey) {
2454
+ objectKeys(__classPrivateFieldGet(this, _YargsInstance_options, "f")).forEach((hintKey) => {
2455
+ if (((key) => key === "configObjects")(hintKey)) return;
2456
+ const hint = __classPrivateFieldGet(this, _YargsInstance_options, "f")[hintKey];
2457
+ if (Array.isArray(hint)) {
2458
+ if (hint.includes(optionKey)) hint.splice(hint.indexOf(optionKey), 1);
2459
+ } else if (typeof hint === "object") delete hint[optionKey];
2460
+ });
2461
+ delete __classPrivateFieldGet(this, _YargsInstance_usage, "f").getDescriptions()[optionKey];
2462
+ }
2463
+ [kEmitWarning](warning, type, deduplicationId) {
2464
+ if (!__classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId]) {
2465
+ __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.emitWarning(warning, type);
2466
+ __classPrivateFieldGet(this, _YargsInstance_emittedWarnings, "f")[deduplicationId] = true;
2467
+ }
2468
+ }
2469
+ [kFreeze]() {
2470
+ __classPrivateFieldGet(this, _YargsInstance_frozens, "f").push({
2471
+ options: __classPrivateFieldGet(this, _YargsInstance_options, "f"),
2472
+ configObjects: __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects.slice(0),
2473
+ exitProcess: __classPrivateFieldGet(this, _YargsInstance_exitProcess, "f"),
2474
+ groups: __classPrivateFieldGet(this, _YargsInstance_groups, "f"),
2475
+ strict: __classPrivateFieldGet(this, _YargsInstance_strict, "f"),
2476
+ strictCommands: __classPrivateFieldGet(this, _YargsInstance_strictCommands, "f"),
2477
+ strictOptions: __classPrivateFieldGet(this, _YargsInstance_strictOptions, "f"),
2478
+ completionCommand: __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f"),
2479
+ output: __classPrivateFieldGet(this, _YargsInstance_output, "f"),
2480
+ exitError: __classPrivateFieldGet(this, _YargsInstance_exitError, "f"),
2481
+ hasOutput: __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f"),
2482
+ parsed: this.parsed,
2483
+ parseFn: __classPrivateFieldGet(this, _YargsInstance_parseFn, "f"),
2484
+ parseContext: __classPrivateFieldGet(this, _YargsInstance_parseContext, "f")
2485
+ });
2486
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").freeze();
2487
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").freeze();
2488
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").freeze();
2489
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").freeze();
2490
+ }
2491
+ [kGetDollarZero]() {
2492
+ let $0 = "";
2493
+ let default$0;
2494
+ if (/\b(node|iojs|electron)(\.exe)?$/.test(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv()[0])) default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(1, 2);
2495
+ else default$0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").process.argv().slice(0, 1);
2496
+ $0 = default$0.map((x) => {
2497
+ const b = this[kRebase](__classPrivateFieldGet(this, _YargsInstance_cwd, "f"), x);
2498
+ return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x;
2499
+ }).join(" ").trim();
2500
+ if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("_") && __classPrivateFieldGet(this, _YargsInstance_shim, "f").getProcessArgvBin() === __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("_")) $0 = __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("_").replace(`${__classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(__classPrivateFieldGet(this, _YargsInstance_shim, "f").process.execPath())}/`, "");
2501
+ return $0;
2502
+ }
2503
+ [kGetParserConfiguration]() {
2504
+ return __classPrivateFieldGet(this, _YargsInstance_parserConfig, "f");
2505
+ }
2506
+ [kGetUsageConfiguration]() {
2507
+ return __classPrivateFieldGet(this, _YargsInstance_usageConfig, "f");
2508
+ }
2509
+ [kGuessLocale]() {
2510
+ if (!__classPrivateFieldGet(this, _YargsInstance_detectLocale, "f")) return;
2511
+ const locale = __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("LC_ALL") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("LC_MESSAGES") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("LANG") || __classPrivateFieldGet(this, _YargsInstance_shim, "f").getEnv("LANGUAGE") || "en_US";
2512
+ this.locale(locale.replace(/[.:].*/, ""));
2513
+ }
2514
+ [kGuessVersion]() {
2515
+ return this[kPkgUp]().version || "unknown";
2516
+ }
2517
+ [kParsePositionalNumbers](argv) {
2518
+ const args = argv["--"] ? argv["--"] : argv._;
2519
+ for (let i = 0, arg; (arg = args[i]) !== void 0; i++) if (__classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.looksLikeNumber(arg) && Number.isSafeInteger(Math.floor(parseFloat(`${arg}`)))) args[i] = Number(arg);
2520
+ return argv;
2521
+ }
2522
+ [kPkgUp](rootPath) {
2523
+ const npath = rootPath || "*";
2524
+ if (__classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath]) return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
2525
+ let obj = {};
2526
+ try {
2527
+ let startDir = rootPath || __classPrivateFieldGet(this, _YargsInstance_shim, "f").mainFilename;
2528
+ if (!rootPath && __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.extname(startDir)) startDir = __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.dirname(startDir);
2529
+ const pkgJsonPath = __classPrivateFieldGet(this, _YargsInstance_shim, "f").findUp(startDir, (dir, names) => {
2530
+ if (names.includes("package.json")) return "package.json";
2531
+ else return;
2532
+ });
2533
+ assertNotStrictEqual(pkgJsonPath, void 0, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
2534
+ obj = JSON.parse(__classPrivateFieldGet(this, _YargsInstance_shim, "f").readFileSync(pkgJsonPath, "utf8"));
2535
+ } catch (_noop) {}
2536
+ __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {};
2537
+ return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
2538
+ }
2539
+ [kPopulateParserHintArray](type, keys) {
2540
+ keys = [].concat(keys);
2541
+ keys.forEach((key) => {
2542
+ key = this[kSanitizeKey](key);
2543
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type].push(key);
2544
+ });
2545
+ }
2546
+ [kPopulateParserHintSingleValueDictionary](builder, type, key, value) {
2547
+ this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => {
2548
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = value;
2549
+ });
2550
+ }
2551
+ [kPopulateParserHintArrayDictionary](builder, type, key, value) {
2552
+ this[kPopulateParserHintDictionary](builder, type, key, value, (type, key, value) => {
2553
+ __classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[type][key] || []).concat(value);
2554
+ });
2555
+ }
2556
+ [kPopulateParserHintDictionary](builder, type, key, value, singleKeyHandler) {
2557
+ if (Array.isArray(key)) key.forEach((k) => {
2558
+ builder(k, value);
2559
+ });
2560
+ else if (((key) => typeof key === "object")(key)) for (const k of objectKeys(key)) builder(k, key[k]);
2561
+ else singleKeyHandler(type, this[kSanitizeKey](key), value);
2562
+ }
2563
+ [kSanitizeKey](key) {
2564
+ if (key === "__proto__") return "___proto___";
2565
+ return key;
2566
+ }
2567
+ [kSetKey](key, set) {
2568
+ this[kPopulateParserHintSingleValueDictionary](this[kSetKey].bind(this), "key", key, set);
2569
+ return this;
2570
+ }
2571
+ [kUnfreeze]() {
2572
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2573
+ const frozen = __classPrivateFieldGet(this, _YargsInstance_frozens, "f").pop();
2574
+ assertNotStrictEqual(frozen, void 0, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
2575
+ let configObjects;
2576
+ _a = this, _b = this, _c = this, _d = this, _e = this, _f = this, _g = this, _h = this, _j = this, _k = this, _l = this, _m = this, {options: { set value(_o) {
2577
+ __classPrivateFieldSet(_a, _YargsInstance_options, _o, "f");
2578
+ } }.value, configObjects, exitProcess: { set value(_o) {
2579
+ __classPrivateFieldSet(_b, _YargsInstance_exitProcess, _o, "f");
2580
+ } }.value, groups: { set value(_o) {
2581
+ __classPrivateFieldSet(_c, _YargsInstance_groups, _o, "f");
2582
+ } }.value, output: { set value(_o) {
2583
+ __classPrivateFieldSet(_d, _YargsInstance_output, _o, "f");
2584
+ } }.value, exitError: { set value(_o) {
2585
+ __classPrivateFieldSet(_e, _YargsInstance_exitError, _o, "f");
2586
+ } }.value, hasOutput: { set value(_o) {
2587
+ __classPrivateFieldSet(_f, _YargsInstance_hasOutput, _o, "f");
2588
+ } }.value, parsed: this.parsed, strict: { set value(_o) {
2589
+ __classPrivateFieldSet(_g, _YargsInstance_strict, _o, "f");
2590
+ } }.value, strictCommands: { set value(_o) {
2591
+ __classPrivateFieldSet(_h, _YargsInstance_strictCommands, _o, "f");
2592
+ } }.value, strictOptions: { set value(_o) {
2593
+ __classPrivateFieldSet(_j, _YargsInstance_strictOptions, _o, "f");
2594
+ } }.value, completionCommand: { set value(_o) {
2595
+ __classPrivateFieldSet(_k, _YargsInstance_completionCommand, _o, "f");
2596
+ } }.value, parseFn: { set value(_o) {
2597
+ __classPrivateFieldSet(_l, _YargsInstance_parseFn, _o, "f");
2598
+ } }.value, parseContext: { set value(_o) {
2599
+ __classPrivateFieldSet(_m, _YargsInstance_parseContext, _o, "f");
2600
+ } }.value} = frozen;
2601
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects = configObjects;
2602
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").unfreeze();
2603
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").unfreeze();
2604
+ __classPrivateFieldGet(this, _YargsInstance_command, "f").unfreeze();
2605
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").unfreeze();
2606
+ }
2607
+ [kValidateAsync](validation, argv) {
2608
+ return maybeAsyncResult(argv, (result) => {
2609
+ validation(result);
2610
+ return result;
2611
+ });
2612
+ }
2613
+ getInternalMethods() {
2614
+ return {
2615
+ getCommandInstance: this[kGetCommandInstance].bind(this),
2616
+ getContext: this[kGetContext].bind(this),
2617
+ getHasOutput: this[kGetHasOutput].bind(this),
2618
+ getLoggerInstance: this[kGetLoggerInstance].bind(this),
2619
+ getParseContext: this[kGetParseContext].bind(this),
2620
+ getParserConfiguration: this[kGetParserConfiguration].bind(this),
2621
+ getUsageConfiguration: this[kGetUsageConfiguration].bind(this),
2622
+ getUsageInstance: this[kGetUsageInstance].bind(this),
2623
+ getValidationInstance: this[kGetValidationInstance].bind(this),
2624
+ hasParseCallback: this[kHasParseCallback].bind(this),
2625
+ isGlobalContext: this[kIsGlobalContext].bind(this),
2626
+ postProcess: this[kPostProcess].bind(this),
2627
+ reset: this[kReset].bind(this),
2628
+ runValidation: this[kRunValidation].bind(this),
2629
+ runYargsParserAndExecuteCommands: this[kRunYargsParserAndExecuteCommands].bind(this),
2630
+ setHasOutput: this[kSetHasOutput].bind(this)
2631
+ };
2632
+ }
2633
+ [kGetCommandInstance]() {
2634
+ return __classPrivateFieldGet(this, _YargsInstance_command, "f");
2635
+ }
2636
+ [kGetContext]() {
2637
+ return __classPrivateFieldGet(this, _YargsInstance_context, "f");
2638
+ }
2639
+ [kGetHasOutput]() {
2640
+ return __classPrivateFieldGet(this, _YargsInstance_hasOutput, "f");
2641
+ }
2642
+ [kGetLoggerInstance]() {
2643
+ return __classPrivateFieldGet(this, _YargsInstance_logger, "f");
2644
+ }
2645
+ [kGetParseContext]() {
2646
+ return __classPrivateFieldGet(this, _YargsInstance_parseContext, "f") || {};
2647
+ }
2648
+ [kGetUsageInstance]() {
2649
+ return __classPrivateFieldGet(this, _YargsInstance_usage, "f");
2650
+ }
2651
+ [kGetValidationInstance]() {
2652
+ return __classPrivateFieldGet(this, _YargsInstance_validation, "f");
2653
+ }
2654
+ [kHasParseCallback]() {
2655
+ return !!__classPrivateFieldGet(this, _YargsInstance_parseFn, "f");
2656
+ }
2657
+ [kIsGlobalContext]() {
2658
+ return __classPrivateFieldGet(this, _YargsInstance_isGlobalContext, "f");
2659
+ }
2660
+ [kPostProcess](argv, populateDoubleDash, calledFromCommand, runGlobalMiddleware) {
2661
+ if (calledFromCommand) return argv;
2662
+ if (isPromise(argv)) return argv;
2663
+ if (!populateDoubleDash) argv = this[kCopyDoubleDash](argv);
2664
+ if (this[kGetParserConfiguration]()["parse-positional-numbers"] || this[kGetParserConfiguration]()["parse-positional-numbers"] === void 0) argv = this[kParsePositionalNumbers](argv);
2665
+ if (runGlobalMiddleware) argv = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false);
2666
+ return argv;
2667
+ }
2668
+ [kReset](aliases = {}) {
2669
+ __classPrivateFieldSet(this, _YargsInstance_options, __classPrivateFieldGet(this, _YargsInstance_options, "f") || {}, "f");
2670
+ const tmpOptions = {};
2671
+ tmpOptions.local = __classPrivateFieldGet(this, _YargsInstance_options, "f").local || [];
2672
+ tmpOptions.configObjects = __classPrivateFieldGet(this, _YargsInstance_options, "f").configObjects || [];
2673
+ const localLookup = {};
2674
+ tmpOptions.local.forEach((l) => {
2675
+ localLookup[l] = true;
2676
+ (aliases[l] || []).forEach((a) => {
2677
+ localLookup[a] = true;
2678
+ });
2679
+ });
2680
+ Object.assign(__classPrivateFieldGet(this, _YargsInstance_preservedGroups, "f"), Object.keys(__classPrivateFieldGet(this, _YargsInstance_groups, "f")).reduce((acc, groupName) => {
2681
+ const keys = __classPrivateFieldGet(this, _YargsInstance_groups, "f")[groupName].filter((key) => !(key in localLookup));
2682
+ if (keys.length > 0) acc[groupName] = keys;
2683
+ return acc;
2684
+ }, {}));
2685
+ __classPrivateFieldSet(this, _YargsInstance_groups, {}, "f");
2686
+ const arrayOptions = [
2687
+ "array",
2688
+ "boolean",
2689
+ "string",
2690
+ "skipValidation",
2691
+ "count",
2692
+ "normalize",
2693
+ "number",
2694
+ "hiddenOptions"
2695
+ ];
2696
+ const objectOptions = [
2697
+ "narg",
2698
+ "key",
2699
+ "alias",
2700
+ "default",
2701
+ "defaultDescription",
2702
+ "config",
2703
+ "choices",
2704
+ "demandedOptions",
2705
+ "demandedCommands",
2706
+ "deprecatedOptions"
2707
+ ];
2708
+ arrayOptions.forEach((k) => {
2709
+ tmpOptions[k] = (__classPrivateFieldGet(this, _YargsInstance_options, "f")[k] || []).filter((k) => !localLookup[k]);
2710
+ });
2711
+ objectOptions.forEach((k) => {
2712
+ tmpOptions[k] = objFilter(__classPrivateFieldGet(this, _YargsInstance_options, "f")[k], (k) => !localLookup[k]);
2713
+ });
2714
+ tmpOptions.envPrefix = __classPrivateFieldGet(this, _YargsInstance_options, "f").envPrefix;
2715
+ __classPrivateFieldSet(this, _YargsInstance_options, tmpOptions, "f");
2716
+ __classPrivateFieldSet(this, _YargsInstance_usage, __classPrivateFieldGet(this, _YargsInstance_usage, "f") ? __classPrivateFieldGet(this, _YargsInstance_usage, "f").reset(localLookup) : usage(this, __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
2717
+ __classPrivateFieldSet(this, _YargsInstance_validation, __classPrivateFieldGet(this, _YargsInstance_validation, "f") ? __classPrivateFieldGet(this, _YargsInstance_validation, "f").reset(localLookup) : validation(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
2718
+ __classPrivateFieldSet(this, _YargsInstance_command, __classPrivateFieldGet(this, _YargsInstance_command, "f") ? __classPrivateFieldGet(this, _YargsInstance_command, "f").reset() : command(__classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_validation, "f"), __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
2719
+ if (!__classPrivateFieldGet(this, _YargsInstance_completion, "f")) __classPrivateFieldSet(this, _YargsInstance_completion, completion(this, __classPrivateFieldGet(this, _YargsInstance_usage, "f"), __classPrivateFieldGet(this, _YargsInstance_command, "f"), __classPrivateFieldGet(this, _YargsInstance_shim, "f")), "f");
2720
+ __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").reset();
2721
+ __classPrivateFieldSet(this, _YargsInstance_completionCommand, null, "f");
2722
+ __classPrivateFieldSet(this, _YargsInstance_output, "", "f");
2723
+ __classPrivateFieldSet(this, _YargsInstance_exitError, null, "f");
2724
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, false, "f");
2725
+ this.parsed = false;
2726
+ return this;
2727
+ }
2728
+ [kRebase](base, dir) {
2729
+ return __classPrivateFieldGet(this, _YargsInstance_shim, "f").path.relative(base, dir);
2730
+ }
2731
+ [kRunYargsParserAndExecuteCommands](args, shortCircuit, calledFromCommand, commandIndex = 0, helpOnly = false) {
2732
+ let skipValidation = !!calledFromCommand || helpOnly;
2733
+ args = args || __classPrivateFieldGet(this, _YargsInstance_processArgs, "f");
2734
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").__ = __classPrivateFieldGet(this, _YargsInstance_shim, "f").y18n.__;
2735
+ __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration = this[kGetParserConfiguration]();
2736
+ const populateDoubleDash = !!__classPrivateFieldGet(this, _YargsInstance_options, "f").configuration["populate--"];
2737
+ const config = Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f").configuration, { "populate--": true });
2738
+ const parsed = __classPrivateFieldGet(this, _YargsInstance_shim, "f").Parser.detailed(args, Object.assign({}, __classPrivateFieldGet(this, _YargsInstance_options, "f"), { configuration: {
2739
+ "parse-positional-numbers": false,
2740
+ ...config
2741
+ } }));
2742
+ const argv = Object.assign(parsed.argv, __classPrivateFieldGet(this, _YargsInstance_parseContext, "f"));
2743
+ let argvPromise = void 0;
2744
+ const aliases = parsed.aliases;
2745
+ let helpOptSet = false;
2746
+ let versionOptSet = false;
2747
+ Object.keys(argv).forEach((key) => {
2748
+ if (key === __classPrivateFieldGet(this, _YargsInstance_helpOpt, "f") && argv[key]) helpOptSet = true;
2749
+ else if (key === __classPrivateFieldGet(this, _YargsInstance_versionOpt, "f") && argv[key]) versionOptSet = true;
2750
+ });
2751
+ argv.$0 = this.$0;
2752
+ this.parsed = parsed;
2753
+ if (commandIndex === 0) __classPrivateFieldGet(this, _YargsInstance_usage, "f").clearCachedHelpMessage();
2754
+ try {
2755
+ this[kGuessLocale]();
2756
+ if (shortCircuit) return this[kPostProcess](argv, populateDoubleDash, !!calledFromCommand, false);
2757
+ if (__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")) {
2758
+ if ([__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")].concat(aliases[__classPrivateFieldGet(this, _YargsInstance_helpOpt, "f")] || []).filter((k) => k.length > 1).includes("" + argv._[argv._.length - 1])) {
2759
+ argv._.pop();
2760
+ helpOptSet = true;
2761
+ }
2762
+ }
2763
+ __classPrivateFieldSet(this, _YargsInstance_isGlobalContext, false, "f");
2764
+ const handlerKeys = __classPrivateFieldGet(this, _YargsInstance_command, "f").getCommands();
2765
+ const requestCompletions = __classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey in argv;
2766
+ const skipRecommendation = helpOptSet || requestCompletions || helpOnly;
2767
+ if (argv._.length) {
2768
+ if (handlerKeys.length) {
2769
+ let firstUnknownCommand;
2770
+ for (let i = commandIndex || 0, cmd; argv._[i] !== void 0; i++) {
2771
+ cmd = String(argv._[i]);
2772
+ if (handlerKeys.includes(cmd) && cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) {
2773
+ const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(cmd, this, parsed, i + 1, helpOnly, helpOptSet || versionOptSet || helpOnly);
2774
+ return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false);
2775
+ } else if (!firstUnknownCommand && cmd !== __classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) {
2776
+ firstUnknownCommand = cmd;
2777
+ break;
2778
+ }
2779
+ }
2780
+ if (!__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() && __classPrivateFieldGet(this, _YargsInstance_recommendCommands, "f") && firstUnknownCommand && !skipRecommendation) __classPrivateFieldGet(this, _YargsInstance_validation, "f").recommendCommands(firstUnknownCommand, handlerKeys);
2781
+ }
2782
+ if (__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f") && argv._.includes(__classPrivateFieldGet(this, _YargsInstance_completionCommand, "f")) && !requestCompletions) {
2783
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) setBlocking(true);
2784
+ this.showCompletionScript();
2785
+ this.exit(0);
2786
+ }
2787
+ }
2788
+ if (__classPrivateFieldGet(this, _YargsInstance_command, "f").hasDefaultCommand() && !skipRecommendation) {
2789
+ const innerArgv = __classPrivateFieldGet(this, _YargsInstance_command, "f").runCommand(null, this, parsed, 0, helpOnly, helpOptSet || versionOptSet || helpOnly);
2790
+ return this[kPostProcess](innerArgv, populateDoubleDash, !!calledFromCommand, false);
2791
+ }
2792
+ if (requestCompletions) {
2793
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) setBlocking(true);
2794
+ args = [].concat(args);
2795
+ const completionArgs = args.slice(args.indexOf(`--${__classPrivateFieldGet(this, _YargsInstance_completion, "f").completionKey}`) + 1);
2796
+ __classPrivateFieldGet(this, _YargsInstance_completion, "f").getCompletion(completionArgs, (err, completions) => {
2797
+ if (err) throw new YError(err.message);
2798
+ (completions || []).forEach((completion) => {
2799
+ __classPrivateFieldGet(this, _YargsInstance_logger, "f").log(completion);
2800
+ });
2801
+ this.exit(0);
2802
+ });
2803
+ return this[kPostProcess](argv, !populateDoubleDash, !!calledFromCommand, false);
2804
+ }
2805
+ if (!__classPrivateFieldGet(this, _YargsInstance_hasOutput, "f")) {
2806
+ if (helpOptSet) {
2807
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) setBlocking(true);
2808
+ skipValidation = true;
2809
+ this.showHelp("log");
2810
+ this.exit(0);
2811
+ } else if (versionOptSet) {
2812
+ if (__classPrivateFieldGet(this, _YargsInstance_exitProcess, "f")) setBlocking(true);
2813
+ skipValidation = true;
2814
+ __classPrivateFieldGet(this, _YargsInstance_usage, "f").showVersion("log");
2815
+ this.exit(0);
2816
+ }
2817
+ }
2818
+ if (!skipValidation && __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.length > 0) skipValidation = Object.keys(argv).some((key) => __classPrivateFieldGet(this, _YargsInstance_options, "f").skipValidation.indexOf(key) >= 0 && argv[key] === true);
2819
+ if (!skipValidation) {
2820
+ if (parsed.error) throw new YError(parsed.error.message);
2821
+ if (!requestCompletions) {
2822
+ const validation = this[kRunValidation](aliases, {}, parsed.error);
2823
+ if (!calledFromCommand) argvPromise = applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), true);
2824
+ argvPromise = this[kValidateAsync](validation, argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv);
2825
+ if (isPromise(argvPromise) && !calledFromCommand) argvPromise = argvPromise.then(() => {
2826
+ return applyMiddleware(argv, this, __classPrivateFieldGet(this, _YargsInstance_globalMiddleware, "f").getMiddleware(), false);
2827
+ });
2828
+ }
2829
+ }
2830
+ } catch (err) {
2831
+ if (err instanceof YError) __classPrivateFieldGet(this, _YargsInstance_usage, "f").fail(err.message, err);
2832
+ else throw err;
2833
+ }
2834
+ return this[kPostProcess](argvPromise !== null && argvPromise !== void 0 ? argvPromise : argv, populateDoubleDash, !!calledFromCommand, true);
2835
+ }
2836
+ [kRunValidation](aliases, positionalMap, parseErrors, isDefaultCommand) {
2837
+ const demandedOptions = { ...this.getDemandedOptions() };
2838
+ return (argv) => {
2839
+ if (parseErrors) throw new YError(parseErrors.message);
2840
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").nonOptionCount(argv);
2841
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").requiredArguments(argv, demandedOptions);
2842
+ let failedStrictCommands = false;
2843
+ if (__classPrivateFieldGet(this, _YargsInstance_strictCommands, "f")) failedStrictCommands = __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownCommands(argv);
2844
+ if (__classPrivateFieldGet(this, _YargsInstance_strict, "f") && !failedStrictCommands) __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, positionalMap, !!isDefaultCommand);
2845
+ else if (__classPrivateFieldGet(this, _YargsInstance_strictOptions, "f")) __classPrivateFieldGet(this, _YargsInstance_validation, "f").unknownArguments(argv, aliases, {}, false, false);
2846
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").limitedChoices(argv);
2847
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").implications(argv);
2848
+ __classPrivateFieldGet(this, _YargsInstance_validation, "f").conflicting(argv);
2849
+ };
2850
+ }
2851
+ [kSetHasOutput]() {
2852
+ __classPrivateFieldSet(this, _YargsInstance_hasOutput, true, "f");
2853
+ }
2854
+ [kTrackManuallySetKeys](keys) {
2855
+ if (typeof keys === "string") __classPrivateFieldGet(this, _YargsInstance_options, "f").key[keys] = true;
2856
+ else for (const k of keys) __classPrivateFieldGet(this, _YargsInstance_options, "f").key[k] = true;
2857
+ }
2858
+ };
2859
+ }));
2860
+ // node_modules/yargs/index.mjs
2861
+ var Yargs;
2862
+ __esmMin((() => {
2863
+ init_esm();
2864
+ init_yargs_factory();
2865
+ Yargs = YargsFactory(esm_default);
2866
+ }))();
2867
+ export { Yargs as default };