UNPKG

apifox-ts-gen

Version:

从 Apifox OpenAPI 规范生成 TypeScript 类型定义

26 lines 3.79 MB
#!/usr/bin/env node import {fileURLToPath,pathToFileURL}from'url';import Lyt,{dirname as dirname$1,resolve}from'path';import fM from'inquirer';import {mkdirSync,writeFileSync}from'node:fs';import {join,dirname}from'node:path';import lSt from'axios';import {readFileSync}from'fs';var wyt=Object.create;var rMe=Object.defineProperty;var Dyt=Object.getOwnPropertyDescriptor;var Pyt=Object.getOwnPropertyNames;var Ayt=Object.getPrototypeOf,Nyt=Object.prototype.hasOwnProperty;var sc=(v=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(v,{get:(w,j)=>(typeof require<"u"?require:w)[j]}):v)(function(v){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+v+'" is not supported')});var Iyt=(v,w)=>()=>(v&&(w=v(v=0)),w);var Ha=(v,w)=>()=>(w||v((w={exports:{}}).exports,w),w.exports);var Oyt=(v,w,j,H)=>{if(w&&typeof w=="object"||typeof w=="function")for(let ne of Pyt(w))!Nyt.call(v,ne)&&ne!==j&&rMe(v,ne,{get:()=>w[ne],enumerable:!(H=Dyt(w,ne))||H.enumerable});return v};var GL=(v,w,j)=>(j=v!=null?wyt(Ayt(v)):{},Oyt(w||!v||!v.__esModule?rMe(j,"default",{value:v,enumerable:!0}):j,v));var nMe,Myt,ha,ca,Wn=Iyt(()=>{nMe=()=>fileURLToPath(import.meta.url),Myt=()=>Lyt.dirname(nMe()),ha=Myt(),ca=nMe();});var FV=Ha(C1e=>{Wn();var Are=class extends Error{constructor(w,j,H){super(H),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=j,this.exitCode=w,this.nestedError=void 0;}},T1e=class extends Are{constructor(w){super(1,"commander.invalidArgument",w),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};C1e.CommanderError=Are;C1e.InvalidArgumentError=T1e;});var Nre=Ha(E1e=>{Wn();var{InvalidArgumentError:Ryt}=FV(),k1e=class{constructor(w,j){switch(this.description=j||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,w[0]){case"<":this.required=!0,this._name=w.slice(1,-1);break;case"[":this.required=!1,this._name=w.slice(1,-1);break;default:this.required=!0,this._name=w;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3));}name(){return this._name}_concatValue(w,j){return j===this.defaultValue||!Array.isArray(j)?[w]:j.concat(w)}default(w,j){return this.defaultValue=w,this.defaultValueDescription=j,this}argParser(w){return this.parseArg=w,this}choices(w){return this.argChoices=w.slice(),this.parseArg=(j,H)=>{if(!this.argChoices.includes(j))throw new Ryt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(j,H):j},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function jyt(v){let w=v.name()+(v.variadic===!0?"...":"");return v.required?"<"+w+">":"["+w+"]"}E1e.Argument=k1e;E1e.humanReadableArgName=jyt;});var D1e=Ha(iMe=>{Wn();var{humanReadableArgName:Byt}=Nre(),w1e=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1;}visibleCommands(w){let j=w.commands.filter(H=>!H._hidden);if(w._hasImplicitHelpCommand()){let[,H,ne]=w._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),Ce=w.createCommand(H).helpOption(!1);Ce.description(w._helpCommandDescription),ne&&Ce.arguments(ne),j.push(Ce);}return this.sortSubcommands&&j.sort((H,ne)=>H.name().localeCompare(ne.name())),j}compareOptions(w,j){let H=ne=>ne.short?ne.short.replace(/^-/,""):ne.long.replace(/^--/,"");return H(w).localeCompare(H(j))}visibleOptions(w){let j=w.options.filter(Ce=>!Ce.hidden),H=w._hasHelpOption&&w._helpShortFlag&&!w._findOption(w._helpShortFlag),ne=w._hasHelpOption&&!w._findOption(w._helpLongFlag);if(H||ne){let Ce;H?ne?Ce=w.createOption(w._helpFlags,w._helpDescription):Ce=w.createOption(w._helpShortFlag,w._helpDescription):Ce=w.createOption(w._helpLongFlag,w._helpDescription),j.push(Ce);}return this.sortOptions&&j.sort(this.compareOptions),j}visibleGlobalOptions(w){if(!this.showGlobalOptions)return [];let j=[];for(let H=w.parent;H;H=H.parent){let ne=H.options.filter(Ce=>!Ce.hidden);j.push(...ne);}return this.sortOptions&&j.sort(this.compareOptions),j}visibleArguments(w){return w._argsDescription&&w.registeredArguments.forEach(j=>{j.description=j.description||w._argsDescription[j.name()]||"";}),w.registeredArguments.find(j=>j.description)?w.registeredArguments:[]}subcommandTerm(w){let j=w.registeredArguments.map(H=>Byt(H)).join(" ");return w._name+(w._aliases[0]?"|"+w._aliases[0]:"")+(w.options.length?" [options]":"")+(j?" "+j:"")}optionTerm(w){return w.flags}argumentTerm(w){return w.name()}longestSubcommandTermLength(w,j){return j.visibleCommands(w).reduce((H,ne)=>Math.max(H,j.subcommandTerm(ne).length),0)}longestOptionTermLength(w,j){return j.visibleOptions(w).reduce((H,ne)=>Math.max(H,j.optionTerm(ne).length),0)}longestGlobalOptionTermLength(w,j){return j.visibleGlobalOptions(w).reduce((H,ne)=>Math.max(H,j.optionTerm(ne).length),0)}longestArgumentTermLength(w,j){return j.visibleArguments(w).reduce((H,ne)=>Math.max(H,j.argumentTerm(ne).length),0)}commandUsage(w){let j=w._name;w._aliases[0]&&(j=j+"|"+w._aliases[0]);let H="";for(let ne=w.parent;ne;ne=ne.parent)H=ne.name()+" "+H;return H+j+" "+w.usage()}commandDescription(w){return w.description()}subcommandDescription(w){return w.summary()||w.description()}optionDescription(w){let j=[];return w.argChoices&&j.push(`choices: ${w.argChoices.map(H=>JSON.stringify(H)).join(", ")}`),w.defaultValue!==void 0&&(w.required||w.optional||w.isBoolean()&&typeof w.defaultValue=="boolean")&&j.push(`default: ${w.defaultValueDescription||JSON.stringify(w.defaultValue)}`),w.presetArg!==void 0&&w.optional&&j.push(`preset: ${JSON.stringify(w.presetArg)}`),w.envVar!==void 0&&j.push(`env: ${w.envVar}`),j.length>0?`${w.description} (${j.join(", ")})`:w.description}argumentDescription(w){let j=[];if(w.argChoices&&j.push(`choices: ${w.argChoices.map(H=>JSON.stringify(H)).join(", ")}`),w.defaultValue!==void 0&&j.push(`default: ${w.defaultValueDescription||JSON.stringify(w.defaultValue)}`),j.length>0){let H=`(${j.join(", ")})`;return w.description?`${w.description} ${H}`:H}return w.description}formatHelp(w,j){let H=j.padWidth(w,j),ne=j.helpWidth||80,Ce=2,qe=2;function mt(jt,Rt){if(Rt){let hc=`${jt.padEnd(H+qe)}${Rt}`;return j.wrap(hc,ne-Ce,H+qe)}return jt}function yt(jt){return jt.join(` `).replace(/^/gm," ".repeat(Ce))}let mr=[`Usage: ${j.commandUsage(w)}`,""],Mr=j.commandDescription(w);Mr.length>0&&(mr=mr.concat([j.wrap(Mr,ne,0),""]));let fn=j.visibleArguments(w).map(jt=>mt(j.argumentTerm(jt),j.argumentDescription(jt)));fn.length>0&&(mr=mr.concat(["Arguments:",yt(fn),""]));let je=j.visibleOptions(w).map(jt=>mt(j.optionTerm(jt),j.optionDescription(jt)));if(je.length>0&&(mr=mr.concat(["Options:",yt(je),""])),this.showGlobalOptions){let jt=j.visibleGlobalOptions(w).map(Rt=>mt(j.optionTerm(Rt),j.optionDescription(Rt)));jt.length>0&&(mr=mr.concat(["Global Options:",yt(jt),""]));}let _i=j.visibleCommands(w).map(jt=>mt(j.subcommandTerm(jt),j.subcommandDescription(jt)));return _i.length>0&&(mr=mr.concat(["Commands:",yt(_i),""])),mr.join(` `)}padWidth(w,j){return Math.max(j.longestOptionTermLength(w,j),j.longestGlobalOptionTermLength(w,j),j.longestSubcommandTermLength(w,j),j.longestArgumentTermLength(w,j))}wrap(w,j,H,ne=40){let Ce=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",qe=new RegExp(`[\\n][${Ce}]+`);if(w.match(qe))return w;let mt=j-H;if(mt<ne)return w;let yt=w.slice(0,H),mr=w.slice(H).replace(`\r `,` `),Mr=" ".repeat(H),je="\\s\u200B",_i=new RegExp(` |.{1,${mt-1}}([${je}]|$)|[^${je}]+?([${je}]|$)`,"g"),jt=mr.match(_i)||[];return yt+jt.map((Rt,hc)=>Rt===` `?"":(hc>0?Mr:"")+Rt.trimEnd()).join(` `)}};iMe.Help=w1e;});var N1e=Ha(Ire=>{Wn();var{InvalidArgumentError:Jyt}=FV(),P1e=class{constructor(w,j){this.flags=w,this.description=j||"",this.required=w.includes("<"),this.optional=w.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(w),this.mandatory=!1;let H=sMe(w);this.short=H.shortFlag,this.long=H.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0;}default(w,j){return this.defaultValue=w,this.defaultValueDescription=j,this}preset(w){return this.presetArg=w,this}conflicts(w){return this.conflictsWith=this.conflictsWith.concat(w),this}implies(w){let j=w;return typeof w=="string"&&(j={[w]:!0}),this.implied=Object.assign(this.implied||{},j),this}env(w){return this.envVar=w,this}argParser(w){return this.parseArg=w,this}makeOptionMandatory(w=!0){return this.mandatory=!!w,this}hideHelp(w=!0){return this.hidden=!!w,this}_concatValue(w,j){return j===this.defaultValue||!Array.isArray(j)?[w]:j.concat(w)}choices(w){return this.argChoices=w.slice(),this.parseArg=(j,H)=>{if(!this.argChoices.includes(j))throw new Jyt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(j,H):j},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Wyt(this.name().replace(/^no-/,""))}is(w){return this.short===w||this.long===w}isBoolean(){return !this.required&&!this.optional&&!this.negate}},A1e=class{constructor(w){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,w.forEach(j=>{j.negate?this.negativeOptions.set(j.attributeName(),j):this.positiveOptions.set(j.attributeName(),j);}),this.negativeOptions.forEach((j,H)=>{this.positiveOptions.has(H)&&this.dualOptions.add(H);});}valueFromOption(w,j){let H=j.attributeName();if(!this.dualOptions.has(H))return !0;let ne=this.negativeOptions.get(H).presetArg,Ce=ne!==void 0?ne:!1;return j.negate===(Ce===w)}};function Wyt(v){return v.split("-").reduce((w,j)=>w+j[0].toUpperCase()+j.slice(1))}function sMe(v){let w,j,H=v.split(/[ |,]+/);return H.length>1&&!/^[[<]/.test(H[1])&&(w=H.shift()),j=H.shift(),!w&&/^-[^-]$/.test(j)&&(w=j,j=void 0),{shortFlag:w,longFlag:j}}Ire.Option=P1e;Ire.splitOptionFlags=sMe;Ire.DualOptions=A1e;});var oMe=Ha(aMe=>{Wn();function zyt(v,w){if(Math.abs(v.length-w.length)>3)return Math.max(v.length,w.length);let j=[];for(let H=0;H<=v.length;H++)j[H]=[H];for(let H=0;H<=w.length;H++)j[0][H]=H;for(let H=1;H<=w.length;H++)for(let ne=1;ne<=v.length;ne++){let Ce=1;v[ne-1]===w[H-1]?Ce=0:Ce=1,j[ne][H]=Math.min(j[ne-1][H]+1,j[ne][H-1]+1,j[ne-1][H-1]+Ce),ne>1&&H>1&&v[ne-1]===w[H-2]&&v[ne-2]===w[H-1]&&(j[ne][H]=Math.min(j[ne][H],j[ne-2][H-2]+1));}return j[v.length][w.length]}function Uyt(v,w){if(!w||w.length===0)return "";w=Array.from(new Set(w));let j=v.startsWith("--");j&&(v=v.slice(2),w=w.map(qe=>qe.slice(2)));let H=[],ne=3,Ce=.4;return w.forEach(qe=>{if(qe.length<=1)return;let mt=zyt(v,qe),yt=Math.max(v.length,qe.length);(yt-mt)/yt>Ce&&(mt<ne?(ne=mt,H=[qe]):mt===ne&&H.push(qe));}),H.sort((qe,mt)=>qe.localeCompare(mt)),j&&(H=H.map(qe=>`--${qe}`)),H.length>1?` (Did you mean one of ${H.join(", ")}?)`:H.length===1?` (Did you mean ${H[0]}?)`:""}aMe.suggestSimilar=Uyt;});var pMe=Ha(fMe=>{Wn();var Vyt=sc("events").EventEmitter,I1e=sc("child_process"),fD=sc("path"),O1e=sc("fs"),qp=sc("process"),{Argument:qyt,humanReadableArgName:$yt}=Nre(),{CommanderError:F1e}=FV(),{Help:Hyt}=D1e(),{Option:cMe,splitOptionFlags:Gyt,DualOptions:Xyt}=N1e(),{suggestSimilar:lMe}=oMe(),L1e=class v extends Vyt{constructor(w){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=w||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:j=>qp.stdout.write(j),writeErr:j=>qp.stderr.write(j),getOutHelpWidth:()=>qp.stdout.isTTY?qp.stdout.columns:void 0,getErrHelpWidth:()=>qp.stderr.isTTY?qp.stderr.columns:void 0,outputError:(j,H)=>H(j)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={};}copyInheritedSettings(w){return this._outputConfiguration=w._outputConfiguration,this._hasHelpOption=w._hasHelpOption,this._helpFlags=w._helpFlags,this._helpDescription=w._helpDescription,this._helpShortFlag=w._helpShortFlag,this._helpLongFlag=w._helpLongFlag,this._helpCommandName=w._helpCommandName,this._helpCommandnameAndArgs=w._helpCommandnameAndArgs,this._helpCommandDescription=w._helpCommandDescription,this._helpConfiguration=w._helpConfiguration,this._exitCallback=w._exitCallback,this._storeOptionsAsProperties=w._storeOptionsAsProperties,this._combineFlagAndOptionalValue=w._combineFlagAndOptionalValue,this._allowExcessArguments=w._allowExcessArguments,this._enablePositionalOptions=w._enablePositionalOptions,this._showHelpAfterError=w._showHelpAfterError,this._showSuggestionAfterError=w._showSuggestionAfterError,this}_getCommandAndAncestors(){let w=[];for(let j=this;j;j=j.parent)w.push(j);return w}command(w,j,H){let ne=j,Ce=H;typeof ne=="object"&&ne!==null&&(Ce=ne,ne=null),Ce=Ce||{};let[,qe,mt]=w.match(/([^ ]+) *(.*)/),yt=this.createCommand(qe);return ne&&(yt.description(ne),yt._executableHandler=!0),Ce.isDefault&&(this._defaultCommandName=yt._name),yt._hidden=!!(Ce.noHelp||Ce.hidden),yt._executableFile=Ce.executableFile||null,mt&&yt.arguments(mt),this.commands.push(yt),yt.parent=this,yt.copyInheritedSettings(this),ne?this:yt}createCommand(w){return new v(w)}createHelp(){return Object.assign(new Hyt,this.configureHelp())}configureHelp(w){return w===void 0?this._helpConfiguration:(this._helpConfiguration=w,this)}configureOutput(w){return w===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,w),this)}showHelpAfterError(w=!0){return typeof w!="string"&&(w=!!w),this._showHelpAfterError=w,this}showSuggestionAfterError(w=!0){return this._showSuggestionAfterError=!!w,this}addCommand(w,j){if(!w._name)throw new Error(`Command passed to .addCommand() must have a name - specify the name in Command constructor or using .name()`);return j=j||{},j.isDefault&&(this._defaultCommandName=w._name),(j.noHelp||j.hidden)&&(w._hidden=!0),this.commands.push(w),w.parent=this,this}createArgument(w,j){return new qyt(w,j)}argument(w,j,H,ne){let Ce=this.createArgument(w,j);return typeof H=="function"?Ce.default(ne).argParser(H):Ce.default(H),this.addArgument(Ce),this}arguments(w){return w.trim().split(/ +/).forEach(j=>{this.argument(j);}),this}addArgument(w){let j=this.registeredArguments.slice(-1)[0];if(j&&j.variadic)throw new Error(`only the last argument can be variadic '${j.name()}'`);if(w.required&&w.defaultValue!==void 0&&w.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${w.name()}'`);return this.registeredArguments.push(w),this}addHelpCommand(w,j){return w===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof w=="string"&&(this._helpCommandName=w.split(" ")[0],this._helpCommandnameAndArgs=w),this._helpCommandDescription=j||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(w,j){let H=["preSubcommand","preAction","postAction"];if(!H.includes(w))throw new Error(`Unexpected value for event passed to hook : '${w}'. Expecting one of '${H.join("', '")}'`);return this._lifeCycleHooks[w]?this._lifeCycleHooks[w].push(j):this._lifeCycleHooks[w]=[j],this}exitOverride(w){return w?this._exitCallback=w:this._exitCallback=j=>{if(j.code!=="commander.executeSubCommandAsync")throw j},this}_exit(w,j,H){this._exitCallback&&this._exitCallback(new F1e(w,j,H)),qp.exit(w);}action(w){let j=H=>{let ne=this.registeredArguments.length,Ce=H.slice(0,ne);return this._storeOptionsAsProperties?Ce[ne]=this:Ce[ne]=this.opts(),Ce.push(this),w.apply(this,Ce)};return this._actionHandler=j,this}createOption(w,j){return new cMe(w,j)}_callParseArg(w,j,H,ne){try{return w.parseArg(j,H)}catch(Ce){if(Ce.code==="commander.invalidArgument"){let qe=`${ne} ${Ce.message}`;this.error(qe,{exitCode:Ce.exitCode,code:Ce.code});}throw Ce}}addOption(w){let j=w.name(),H=w.attributeName();if(w.negate){let Ce=w.long.replace(/^--no-/,"--");this._findOption(Ce)||this.setOptionValueWithSource(H,w.defaultValue===void 0?!0:w.defaultValue,"default");}else w.defaultValue!==void 0&&this.setOptionValueWithSource(H,w.defaultValue,"default");this.options.push(w);let ne=(Ce,qe,mt)=>{Ce==null&&w.presetArg!==void 0&&(Ce=w.presetArg);let yt=this.getOptionValue(H);Ce!==null&&w.parseArg?Ce=this._callParseArg(w,Ce,yt,qe):Ce!==null&&w.variadic&&(Ce=w._concatValue(Ce,yt)),Ce==null&&(w.negate?Ce=!1:w.isBoolean()||w.optional?Ce=!0:Ce=""),this.setOptionValueWithSource(H,Ce,mt);};return this.on("option:"+j,Ce=>{let qe=`error: option '${w.flags}' argument '${Ce}' is invalid.`;ne(Ce,qe,"cli");}),w.envVar&&this.on("optionEnv:"+j,Ce=>{let qe=`error: option '${w.flags}' value '${Ce}' from env '${w.envVar}' is invalid.`;ne(Ce,qe,"env");}),this}_optionEx(w,j,H,ne,Ce){if(typeof j=="object"&&j instanceof cMe)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let qe=this.createOption(j,H);if(qe.makeOptionMandatory(!!w.mandatory),typeof ne=="function")qe.default(Ce).argParser(ne);else if(ne instanceof RegExp){let mt=ne;ne=(yt,mr)=>{let Mr=mt.exec(yt);return Mr?Mr[0]:mr},qe.default(Ce).argParser(ne);}else qe.default(ne);return this.addOption(qe)}option(w,j,H,ne){return this._optionEx({},w,j,H,ne)}requiredOption(w,j,H,ne){return this._optionEx({mandatory:!0},w,j,H,ne)}combineFlagAndOptionalValue(w=!0){return this._combineFlagAndOptionalValue=!!w,this}allowUnknownOption(w=!0){return this._allowUnknownOption=!!w,this}allowExcessArguments(w=!0){return this._allowExcessArguments=!!w,this}enablePositionalOptions(w=!0){return this._enablePositionalOptions=!!w,this}passThroughOptions(w=!0){if(this._passThroughOptions=!!w,this.parent&&w&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(w=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!w,this}getOptionValue(w){return this._storeOptionsAsProperties?this[w]:this._optionValues[w]}setOptionValue(w,j){return this.setOptionValueWithSource(w,j,void 0)}setOptionValueWithSource(w,j,H){return this._storeOptionsAsProperties?this[w]=j:this._optionValues[w]=j,this._optionValueSources[w]=H,this}getOptionValueSource(w){return this._optionValueSources[w]}getOptionValueSourceWithGlobals(w){let j;return this._getCommandAndAncestors().forEach(H=>{H.getOptionValueSource(w)!==void 0&&(j=H.getOptionValueSource(w));}),j}_prepareUserArgs(w,j){if(w!==void 0&&!Array.isArray(w))throw new Error("first parameter to parse must be array or undefined");j=j||{},w===void 0&&(w=qp.argv,qp.versions&&qp.versions.electron&&(j.from="electron")),this.rawArgs=w.slice();let H;switch(j.from){case void 0:case"node":this._scriptPath=w[1],H=w.slice(2);break;case"electron":qp.defaultApp?(this._scriptPath=w[1],H=w.slice(2)):H=w.slice(1);break;case"user":H=w.slice(0);break;default:throw new Error(`unexpected parse option { from: '${j.from}' }`)}return !this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",H}parse(w,j){let H=this._prepareUserArgs(w,j);return this._parseCommand([],H),this}async parseAsync(w,j){let H=this._prepareUserArgs(w,j);return await this._parseCommand([],H),this}_executeSubCommand(w,j){j=j.slice();let H=!1,ne=[".js",".ts",".tsx",".mjs",".cjs"];function Ce(Mr,fn){let je=fD.resolve(Mr,fn);if(O1e.existsSync(je))return je;if(ne.includes(fD.extname(fn)))return;let _i=ne.find(jt=>O1e.existsSync(`${je}${jt}`));if(_i)return `${je}${_i}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let qe=w._executableFile||`${this._name}-${w._name}`,mt=this._executableDir||"";if(this._scriptPath){let Mr;try{Mr=O1e.realpathSync(this._scriptPath);}catch{Mr=this._scriptPath;}mt=fD.resolve(fD.dirname(Mr),mt);}if(mt){let Mr=Ce(mt,qe);if(!Mr&&!w._executableFile&&this._scriptPath){let fn=fD.basename(this._scriptPath,fD.extname(this._scriptPath));fn!==this._name&&(Mr=Ce(mt,`${fn}-${w._name}`));}qe=Mr||qe;}H=ne.includes(fD.extname(qe));let yt;qp.platform!=="win32"?H?(j.unshift(qe),j=_Me(qp.execArgv).concat(j),yt=I1e.spawn(qp.argv[0],j,{stdio:"inherit"})):yt=I1e.spawn(qe,j,{stdio:"inherit"}):(j.unshift(qe),j=_Me(qp.execArgv).concat(j),yt=I1e.spawn(qp.execPath,j,{stdio:"inherit"})),yt.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(fn=>{qp.on(fn,()=>{yt.killed===!1&&yt.exitCode===null&&yt.kill(fn);});});let mr=this._exitCallback;mr?yt.on("close",()=>{mr(new F1e(qp.exitCode||0,"commander.executeSubCommandAsync","(close)"));}):yt.on("close",qp.exit.bind(qp)),yt.on("error",Mr=>{if(Mr.code==="ENOENT"){let fn=mt?`searched for local subcommand relative to directory '${mt}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",je=`'${qe}' does not exist - if '${w._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead - if the default executable name is not suitable, use the executableFile option to supply a custom name or path - ${fn}`;throw new Error(je)}else if(Mr.code==="EACCES")throw new Error(`'${qe}' not executable`);if(!mr)qp.exit(1);else {let fn=new F1e(1,"commander.executeSubCommandAsync","(error)");fn.nestedError=Mr,mr(fn);}}),this.runningCommand=yt;}_dispatchSubcommand(w,j,H){let ne=this._findCommand(w);ne||this.help({error:!0});let Ce;return Ce=this._chainOrCallSubCommandHook(Ce,ne,"preSubcommand"),Ce=this._chainOrCall(Ce,()=>{if(ne._executableHandler)this._executeSubCommand(ne,j.concat(H));else return ne._parseCommand(j,H)}),Ce}_dispatchHelpCommand(w){w||this.help();let j=this._findCommand(w);return j&&!j._executableHandler&&j.help(),this._dispatchSubcommand(w,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){this.registeredArguments.forEach((w,j)=>{w.required&&this.args[j]==null&&this.missingArgument(w.name());}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args);}_processArguments(){let w=(H,ne,Ce)=>{let qe=ne;if(ne!==null&&H.parseArg){let mt=`error: command-argument value '${ne}' is invalid for argument '${H.name()}'.`;qe=this._callParseArg(H,ne,Ce,mt);}return qe};this._checkNumberOfArguments();let j=[];this.registeredArguments.forEach((H,ne)=>{let Ce=H.defaultValue;H.variadic?ne<this.args.length?(Ce=this.args.slice(ne),H.parseArg&&(Ce=Ce.reduce((qe,mt)=>w(H,mt,qe),H.defaultValue))):Ce===void 0&&(Ce=[]):ne<this.args.length&&(Ce=this.args[ne],H.parseArg&&(Ce=w(H,Ce,H.defaultValue))),j[ne]=Ce;}),this.processedArgs=j;}_chainOrCall(w,j){return w&&w.then&&typeof w.then=="function"?w.then(()=>j()):j()}_chainOrCallHooks(w,j){let H=w,ne=[];return this._getCommandAndAncestors().reverse().filter(Ce=>Ce._lifeCycleHooks[j]!==void 0).forEach(Ce=>{Ce._lifeCycleHooks[j].forEach(qe=>{ne.push({hookedCommand:Ce,callback:qe});});}),j==="postAction"&&ne.reverse(),ne.forEach(Ce=>{H=this._chainOrCall(H,()=>Ce.callback(Ce.hookedCommand,this));}),H}_chainOrCallSubCommandHook(w,j,H){let ne=w;return this._lifeCycleHooks[H]!==void 0&&this._lifeCycleHooks[H].forEach(Ce=>{ne=this._chainOrCall(ne,()=>Ce(this,j));}),ne}_parseCommand(w,j){let H=this.parseOptions(j);if(this._parseOptionsEnv(),this._parseOptionsImplied(),w=w.concat(H.operands),j=H.unknown,this.args=w.concat(j),w&&this._findCommand(w[0]))return this._dispatchSubcommand(w[0],w.slice(1),j);if(this._hasImplicitHelpCommand()&&w[0]===this._helpCommandName)return this._dispatchHelpCommand(w[1]);if(this._defaultCommandName)return uMe(this,j),this._dispatchSubcommand(this._defaultCommandName,w,j);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),uMe(this,H.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let ne=()=>{H.unknown.length>0&&this.unknownOption(H.unknown[0]);},Ce=`command:${this.name()}`;if(this._actionHandler){ne(),this._processArguments();let qe;return qe=this._chainOrCallHooks(qe,"preAction"),qe=this._chainOrCall(qe,()=>this._actionHandler(this.processedArgs)),this.parent&&(qe=this._chainOrCall(qe,()=>{this.parent.emit(Ce,w,j);})),qe=this._chainOrCallHooks(qe,"postAction"),qe}if(this.parent&&this.parent.listenerCount(Ce))ne(),this._processArguments(),this.parent.emit(Ce,w,j);else if(w.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",w,j);this.listenerCount("command:*")?this.emit("command:*",w,j):this.commands.length?this.unknownCommand():(ne(),this._processArguments());}else this.commands.length?(ne(),this.help({error:!0})):(ne(),this._processArguments());}_findCommand(w){if(w)return this.commands.find(j=>j._name===w||j._aliases.includes(w))}_findOption(w){return this.options.find(j=>j.is(w))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(w=>{w.options.forEach(j=>{j.mandatory&&w.getOptionValue(j.attributeName())===void 0&&w.missingMandatoryOptionValue(j);});});}_checkForConflictingLocalOptions(){let w=this.options.filter(H=>{let ne=H.attributeName();return this.getOptionValue(ne)===void 0?!1:this.getOptionValueSource(ne)!=="default"});w.filter(H=>H.conflictsWith.length>0).forEach(H=>{let ne=w.find(Ce=>H.conflictsWith.includes(Ce.attributeName()));ne&&this._conflictingOption(H,ne);});}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(w=>{w._checkForConflictingLocalOptions();});}parseOptions(w){let j=[],H=[],ne=j,Ce=w.slice();function qe(yt){return yt.length>1&&yt[0]==="-"}let mt=null;for(;Ce.length;){let yt=Ce.shift();if(yt==="--"){ne===H&&ne.push(yt),ne.push(...Ce);break}if(mt&&!qe(yt)){this.emit(`option:${mt.name()}`,yt);continue}if(mt=null,qe(yt)){let mr=this._findOption(yt);if(mr){if(mr.required){let Mr=Ce.shift();Mr===void 0&&this.optionMissingArgument(mr),this.emit(`option:${mr.name()}`,Mr);}else if(mr.optional){let Mr=null;Ce.length>0&&!qe(Ce[0])&&(Mr=Ce.shift()),this.emit(`option:${mr.name()}`,Mr);}else this.emit(`option:${mr.name()}`);mt=mr.variadic?mr:null;continue}}if(yt.length>2&&yt[0]==="-"&&yt[1]!=="-"){let mr=this._findOption(`-${yt[1]}`);if(mr){mr.required||mr.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${mr.name()}`,yt.slice(2)):(this.emit(`option:${mr.name()}`),Ce.unshift(`-${yt.slice(2)}`));continue}}if(/^--[^=]+=/.test(yt)){let mr=yt.indexOf("="),Mr=this._findOption(yt.slice(0,mr));if(Mr&&(Mr.required||Mr.optional)){this.emit(`option:${Mr.name()}`,yt.slice(mr+1));continue}}if(qe(yt)&&(ne=H),(this._enablePositionalOptions||this._passThroughOptions)&&j.length===0&&H.length===0){if(this._findCommand(yt)){j.push(yt),Ce.length>0&&H.push(...Ce);break}else if(yt===this._helpCommandName&&this._hasImplicitHelpCommand()){j.push(yt),Ce.length>0&&j.push(...Ce);break}else if(this._defaultCommandName){H.push(yt),Ce.length>0&&H.push(...Ce);break}}if(this._passThroughOptions){ne.push(yt),Ce.length>0&&ne.push(...Ce);break}ne.push(yt);}return {operands:j,unknown:H}}opts(){if(this._storeOptionsAsProperties){let w={},j=this.options.length;for(let H=0;H<j;H++){let ne=this.options[H].attributeName();w[ne]=ne===this._versionOptionName?this._version:this[ne];}return w}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((w,j)=>Object.assign(w,j.opts()),{})}error(w,j){this._outputConfiguration.outputError(`${w} `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError} `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(` `),this.outputHelp({error:!0}));let H=j||{},ne=H.exitCode||1,Ce=H.code||"commander.error";this._exit(ne,Ce,w);}_parseOptionsEnv(){this.options.forEach(w=>{if(w.envVar&&w.envVar in qp.env){let j=w.attributeName();(this.getOptionValue(j)===void 0||["default","config","env"].includes(this.getOptionValueSource(j)))&&(w.required||w.optional?this.emit(`optionEnv:${w.name()}`,qp.env[w.envVar]):this.emit(`optionEnv:${w.name()}`));}});}_parseOptionsImplied(){let w=new Xyt(this.options),j=H=>this.getOptionValue(H)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(H));this.options.filter(H=>H.implied!==void 0&&j(H.attributeName())&&w.valueFromOption(this.getOptionValue(H.attributeName()),H)).forEach(H=>{Object.keys(H.implied).filter(ne=>!j(ne)).forEach(ne=>{this.setOptionValueWithSource(ne,H.implied[ne],"implied");});});}missingArgument(w){let j=`error: missing required argument '${w}'`;this.error(j,{code:"commander.missingArgument"});}optionMissingArgument(w){let j=`error: option '${w.flags}' argument missing`;this.error(j,{code:"commander.optionMissingArgument"});}missingMandatoryOptionValue(w){let j=`error: required option '${w.flags}' not specified`;this.error(j,{code:"commander.missingMandatoryOptionValue"});}_conflictingOption(w,j){let H=qe=>{let mt=qe.attributeName(),yt=this.getOptionValue(mt),mr=this.options.find(fn=>fn.negate&&mt===fn.attributeName()),Mr=this.options.find(fn=>!fn.negate&&mt===fn.attributeName());return mr&&(mr.presetArg===void 0&&yt===!1||mr.presetArg!==void 0&&yt===mr.presetArg)?mr:Mr||qe},ne=qe=>{let mt=H(qe),yt=mt.attributeName();return this.getOptionValueSource(yt)==="env"?`environment variable '${mt.envVar}'`:`option '${mt.flags}'`},Ce=`error: ${ne(w)} cannot be used with ${ne(j)}`;this.error(Ce,{code:"commander.conflictingOption"});}unknownOption(w){if(this._allowUnknownOption)return;let j="";if(w.startsWith("--")&&this._showSuggestionAfterError){let ne=[],Ce=this;do{let qe=Ce.createHelp().visibleOptions(Ce).filter(mt=>mt.long).map(mt=>mt.long);ne=ne.concat(qe),Ce=Ce.parent;}while(Ce&&!Ce._enablePositionalOptions);j=lMe(w,ne);}let H=`error: unknown option '${w}'${j}`;this.error(H,{code:"commander.unknownOption"});}_excessArguments(w){if(this._allowExcessArguments)return;let j=this.registeredArguments.length,H=j===1?"":"s",Ce=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${j} argument${H} but got ${w.length}.`;this.error(Ce,{code:"commander.excessArguments"});}unknownCommand(){let w=this.args[0],j="";if(this._showSuggestionAfterError){let ne=[];this.createHelp().visibleCommands(this).forEach(Ce=>{ne.push(Ce.name()),Ce.alias()&&ne.push(Ce.alias());}),j=lMe(w,ne);}let H=`error: unknown command '${w}'${j}`;this.error(H,{code:"commander.unknownCommand"});}version(w,j,H){if(w===void 0)return this._version;this._version=w,j=j||"-V, --version",H=H||"output the version number";let ne=this.createOption(j,H);return this._versionOptionName=ne.attributeName(),this.options.push(ne),this.on("option:"+ne.name(),()=>{this._outputConfiguration.writeOut(`${w} `),this._exit(0,"commander.version",w);}),this}description(w,j){return w===void 0&&j===void 0?this._description:(this._description=w,j&&(this._argsDescription=j),this)}summary(w){return w===void 0?this._summary:(this._summary=w,this)}alias(w){if(w===void 0)return this._aliases[0];let j=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(j=this.commands[this.commands.length-1]),w===j._name)throw new Error("Command alias can't be the same as its name");return j._aliases.push(w),this}aliases(w){return w===void 0?this._aliases:(w.forEach(j=>this.alias(j)),this)}usage(w){if(w===void 0){if(this._usage)return this._usage;let j=this.registeredArguments.map(H=>$yt(H));return [].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?j:[]).join(" ")}return this._usage=w,this}name(w){return w===void 0?this._name:(this._name=w,this)}nameFromFilename(w){return this._name=fD.basename(w,fD.extname(w)),this}executableDir(w){return w===void 0?this._executableDir:(this._executableDir=w,this)}helpInformation(w){let j=this.createHelp();return j.helpWidth===void 0&&(j.helpWidth=w&&w.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),j.formatHelp(this,j)}_getHelpContext(w){w=w||{};let j={error:!!w.error},H;return j.error?H=ne=>this._outputConfiguration.writeErr(ne):H=ne=>this._outputConfiguration.writeOut(ne),j.write=w.write||H,j.command=this,j}outputHelp(w){let j;typeof w=="function"&&(j=w,w=void 0);let H=this._getHelpContext(w);this._getCommandAndAncestors().reverse().forEach(Ce=>Ce.emit("beforeAllHelp",H)),this.emit("beforeHelp",H);let ne=this.helpInformation(H);if(j&&(ne=j(ne),typeof ne!="string"&&!Buffer.isBuffer(ne)))throw new Error("outputHelp callback must return a string or a Buffer");H.write(ne),this._helpLongFlag&&this.emit(this._helpLongFlag),this.emit("afterHelp",H),this._getCommandAndAncestors().forEach(Ce=>Ce.emit("afterAllHelp",H));}helpOption(w,j){if(typeof w=="boolean")return this._hasHelpOption=w,this;this._helpFlags=w||this._helpFlags,this._helpDescription=j||this._helpDescription;let H=Gyt(this._helpFlags);return this._helpShortFlag=H.shortFlag,this._helpLongFlag=H.longFlag,this}help(w){this.outputHelp(w);let j=qp.exitCode||0;j===0&&w&&typeof w!="function"&&w.error&&(j=1),this._exit(j,"commander.help","(outputHelp)");}addHelpText(w,j){let H=["beforeAll","before","after","afterAll"];if(!H.includes(w))throw new Error(`Unexpected value for position to addHelpText. Expecting one of '${H.join("', '")}'`);let ne=`${w}Help`;return this.on(ne,Ce=>{let qe;typeof j=="function"?qe=j({error:Ce.error,command:Ce.command}):qe=j,qe&&Ce.write(`${qe} `);}),this}};function uMe(v,w){v._hasHelpOption&&w.find(H=>H===v._helpLongFlag||H===v._helpShortFlag)&&(v.outputHelp(),v._exit(0,"commander.helpDisplayed","(outputHelp)"));}function _Me(v){return v.map(w=>{if(!w.startsWith("--inspect"))return w;let j,H="127.0.0.1",ne="9229",Ce;return (Ce=w.match(/^(--inspect(-brk)?)$/))!==null?j=Ce[1]:(Ce=w.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(j=Ce[1],/^\d+$/.test(Ce[3])?ne=Ce[3]:H=Ce[3]):(Ce=w.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(j=Ce[1],H=Ce[3],ne=Ce[4]),j&&ne!=="0"?`${j}=${H}:${parseInt(ne)+1}`:w})}fMe.Command=L1e;});var hMe=Ha((pC,gMe)=>{Wn();var{Argument:Qyt}=Nre(),{Command:dMe}=pMe(),{CommanderError:Yyt,InvalidArgumentError:mMe}=FV(),{Help:Kyt}=D1e(),{Option:Zyt}=N1e();pC=gMe.exports=new dMe;pC.program=pC;pC.Command=dMe;pC.Option=Zyt;pC.Argument=Qyt;pC.Help=Kyt;pC.CommanderError=Yyt;pC.InvalidArgumentError=mMe;pC.InvalidOptionArgumentError=mMe;});var TMe=Ha((sxt,M1e)=>{Wn();var bMe=sc("path"),SMe=sc("module"),e1t=sc("fs"),xMe=(v,w,j)=>{if(typeof v!="string")throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof v}\``);if(typeof w!="string")throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof w}\``);try{v=e1t.realpathSync(v);}catch(Ce){if(Ce.code==="ENOENT")v=bMe.resolve(v);else {if(j)return null;throw Ce}}let H=bMe.join(v,"noop.js"),ne=()=>SMe._resolveFilename(w,{id:H,filename:H,paths:SMe._nodeModulePaths(v)});if(j)try{return ne()}catch{return null}return ne()};M1e.exports=(v,w)=>xMe(v,w);M1e.exports.silent=(v,w)=>xMe(v,w,!0);});var kMe=Ha((oxt,R1e)=>{Wn();var CMe=()=>{let v=Error.prepareStackTrace;Error.prepareStackTrace=(j,H)=>H;let w=new Error().stack.slice(1);return Error.prepareStackTrace=v,w};R1e.exports=CMe;R1e.exports.default=CMe;});var wMe=Ha((lxt,EMe)=>{Wn();var t1t=kMe();EMe.exports=v=>{let w=t1t();if(!v)return w[2].getFileName();let j=!1;w.shift();for(let H of w){let ne=H.getFileName();if(typeof ne=="string"){if(ne===v){j=!0;continue}if(ne!=="module.js"&&j&&ne!==v)return ne}}};});var PMe=Ha((_xt,DMe)=>{Wn();var r1t=sc("path"),n1t=TMe(),i1t=wMe();DMe.exports=v=>{if(typeof v!="string")throw new TypeError("Expected a string");let w=i1t(ca),j=w?r1t.dirname(w):ha,H=n1t(j,v),ne=sc.cache[H];if(ne&&ne.parent){let qe=ne.parent.children.length;for(;qe--;)ne.parent.children[qe].id===H&&ne.parent.children.splice(qe,1);}delete sc.cache[H];let Ce=sc.cache[w];return Ce===void 0?sc(H):Ce.require(H)};});var NMe=Ha((dxt,AMe)=>{Wn();AMe.exports=function(w){return w?w instanceof Array||Array.isArray(w)||w.length>=0&&w.splice instanceof Function:!1};});var OMe=Ha((gxt,IMe)=>{Wn();var s1t=sc("util"),a1t=NMe(),j1e=function(w,j){(!w||w.constructor!==String)&&(j=w||{},w=Error.name);var H=function ne(Ce){if(!this)return new ne(Ce);Ce=Ce instanceof Error?Ce.message:Ce||this.message,Error.call(this,Ce),Error.captureStackTrace(this,H),this.name=w,Object.defineProperty(this,"message",{configurable:!0,enumerable:!1,get:function(){var Mr=Ce.split(/\r?\n/g);for(var fn in j)if(j.hasOwnProperty(fn)){var je=j[fn];"message"in je&&(Mr=je.message(this[fn],Mr)||Mr,a1t(Mr)||(Mr=[Mr]));}return Mr.join(` `)},set:function(Mr){Ce=Mr;}});var qe=null,mt=Object.getOwnPropertyDescriptor(this,"stack"),yt=mt.get,mr=mt.value;delete mt.value,delete mt.writable,mt.set=function(Mr){qe=Mr;},mt.get=function(){var Mr=(qe||(yt?yt.call(this):mr)).split(/\r?\n+/g);qe||(Mr[0]=this.name+": "+this.message);var fn=1;for(var je in j)if(j.hasOwnProperty(je)){var _i=j[je];if("line"in _i){var jt=_i.line(this[je]);jt&&Mr.splice(fn++,0," "+jt);}"stack"in _i&&_i.stack(this[je],Mr);}return Mr.join(` `)},Object.defineProperty(this,"stack",mt);};return Object.setPrototypeOf?(Object.setPrototypeOf(H.prototype,Error.prototype),Object.setPrototypeOf(H,Error)):s1t.inherits(H,Error),H};j1e.append=function(v,w){return {message:function(j,H){return j=j||w,j&&(H[0]+=" "+v.replace("%s",j.toString())),H}}};j1e.line=function(v,w){return {line:function(j){return j=j||w,j?v.replace("%s",j.toString()):null}}};IMe.exports=j1e;});var MMe=Ha((yxt,LMe)=>{Wn();var o1t=v=>{let w=v.charCodeAt(0).toString(16).toUpperCase();return "0x"+(w.length%2?"0":"")+w},c1t=(v,w,j)=>{if(!w)return {message:v.message+" while parsing empty string",position:0};let H=v.message.match(/^Unexpected token (.) .*position\s+(\d+)/i),ne=H?+H[2]:v.message.match(/^Unexpected end of JSON.*/i)?w.length-1:null,Ce=H?v.message.replace(/^Unexpected token ./,`Unexpected token ${JSON.stringify(H[1])} (${o1t(H[1])})`):v.message;if(ne!=null){let qe=ne<=j?0:ne-j,mt=ne+j>=w.length?w.length:ne+j,yt=(qe===0?"":"...")+w.slice(qe,mt)+(mt===w.length?"":"...");return {message:Ce+` while parsing ${w===yt?"":"near "}${JSON.stringify(yt)}`,position:ne}}else return {message:Ce+` while parsing '${w.slice(0,j*2)}'`,position:0}},Ore=class extends SyntaxError{constructor(w,j,H,ne){H=H||20;let Ce=c1t(w,j,H);super(Ce.message),Object.assign(this,Ce),this.code="EJSONPARSE",this.systemError=w,Error.captureStackTrace(this,ne||this.constructor);}get name(){return this.constructor.name}set name(w){}get[Symbol.toStringTag](){return this.constructor.name}},l1t=Symbol.for("indent"),u1t=Symbol.for("newline"),_1t=/^\s*[{\[]((?:\r?\n)+)([\s\t]*)/,f1t=/^(?:\{\}|\[\])((?:\r?\n)+)?$/,Fre=(v,w,j)=>{let H=FMe(v);j=j||20;try{let[,ne=` `,Ce=" "]=H.match(f1t)||H.match(_1t)||[,"",""],qe=JSON.parse(H,w);return qe&&typeof qe=="object"&&(qe[u1t]=ne,qe[l1t]=Ce),qe}catch(ne){if(typeof v!="string"&&!Buffer.isBuffer(v)){let Ce=Array.isArray(v)&&v.length===0;throw Object.assign(new TypeError(`Cannot parse ${Ce?"an empty array":String(v)}`),{code:"EJSONPARSE",systemError:ne})}throw new Ore(ne,H,j,Fre)}},FMe=v=>String(v).replace(/^\uFEFF/,"");LMe.exports=Fre;Fre.JSONParseError=Ore;Fre.noExceptions=(v,w)=>{try{return JSON.parse(FMe(v),w)}catch{}};});var BMe=Ha(LV=>{Wn();LV.__esModule=!0;LV.LinesAndColumns=void 0;var Lre=` `,RMe="\r",jMe=function(){function v(w){this.string=w;for(var j=[0],H=0;H<w.length;)switch(w[H]){case Lre:H+=Lre.length,j.push(H);break;case RMe:H+=RMe.length,w[H]===Lre&&(H+=Lre.length),j.push(H);break;default:H++;break}this.offsets=j;}return v.prototype.locationForIndex=function(w){if(w<0||w>this.string.length)return null;for(var j=0,H=this.offsets;H[j+1]<=w;)j++;var ne=w-H[j];return {line:j,column:ne}},v.prototype.indexForLocation=function(w){var j=w.line,H=w.column;return j<0||j>=this.offsets.length||H<0||H>this.lengthOfLine(j)?null:this.offsets[j]+H},v.prototype.lengthOfLine=function(w){var j=this.offsets[w],H=w===this.offsets.length-1?this.string.length:this.offsets[w+1];return H-j},v}();LV.LinesAndColumns=jMe;LV.default=jMe;});var zMe=Ha((xxt,B1e)=>{Wn();var Rre=process||{},JMe=Rre.argv||[],Mre=Rre.env||{},p1t=!(Mre.NO_COLOR||JMe.includes("--no-color"))&&(!!Mre.FORCE_COLOR||JMe.includes("--color")||Rre.platform==="win32"||(Rre.stdout||{}).isTTY&&Mre.TERM!=="dumb"||!!Mre.CI),d1t=(v,w,j=v)=>H=>{let ne=""+H,Ce=ne.indexOf(w,v.length);return ~Ce?v+m1t(ne,w,j,Ce)+w:v+ne+w},m1t=(v,w,j,H)=>{let ne="",Ce=0;do ne+=v.substring(Ce,H)+j,Ce=H+w.length,H=v.indexOf(w,Ce);while(~H);return ne+v.substring(Ce)},WMe=(v=p1t)=>{let w=v?d1t:()=>String;return {isColorSupported:v,reset:w("\x1B[0m","\x1B[0m"),bold:w("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:w("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:w("\x1B[3m","\x1B[23m"),underline:w("\x1B[4m","\x1B[24m"),inverse:w("\x1B[7m","\x1B[27m"),hidden:w("\x1B[8m","\x1B[28m"),strikethrough:w("\x1B[9m","\x1B[29m"),black:w("\x1B[30m","\x1B[39m"),red:w("\x1B[31m","\x1B[39m"),green:w("\x1B[32m","\x1B[39m"),yellow:w("\x1B[33m","\x1B[39m"),blue:w("\x1B[34m","\x1B[39m"),magenta:w("\x1B[35m","\x1B[39m"),cyan:w("\x1B[36m","\x1B[39m"),white:w("\x1B[37m","\x1B[39m"),gray:w("\x1B[90m","\x1B[39m"),bgBlack:w("\x1B[40m","\x1B[49m"),bgRed:w("\x1B[41m","\x1B[49m"),bgGreen:w("\x1B[42m","\x1B[49m"),bgYellow:w("\x1B[43m","\x1B[49m"),bgBlue:w("\x1B[44m","\x1B[49m"),bgMagenta:w("\x1B[45m","\x1B[49m"),bgCyan:w("\x1B[46m","\x1B[49m"),bgWhite:w("\x1B[47m","\x1B[49m"),blackBright:w("\x1B[90m","\x1B[39m"),redBright:w("\x1B[91m","\x1B[39m"),greenBright:w("\x1B[92m","\x1B[39m"),yellowBright:w("\x1B[93m","\x1B[39m"),blueBright:w("\x1B[94m","\x1B[39m"),magentaBright:w("\x1B[95m","\x1B[39m"),cyanBright:w("\x1B[96m","\x1B[39m"),whiteBright:w("\x1B[97m","\x1B[39m"),bgBlackBright:w("\x1B[100m","\x1B[49m"),bgRedBright:w("\x1B[101m","\x1B[49m"),bgGreenBright:w("\x1B[102m","\x1B[49m"),bgYellowBright:w("\x1B[103m","\x1B[49m"),bgBlueBright:w("\x1B[104m","\x1B[49m"),bgMagentaBright:w("\x1B[105m","\x1B[49m"),bgCyanBright:w("\x1B[106m","\x1B[49m"),bgWhiteBright:w("\x1B[107m","\x1B[49m")}};B1e.exports=WMe();B1e.exports.createColors=WMe;});var UMe=Ha(jre=>{Wn();Object.defineProperty(jre,"__esModule",{value:!0});jre.default=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;jre.matchToToken=function(v){var w={type:"invalid",value:v[0],closed:void 0};return v[1]?(w.type="string",w.closed=!!(v[3]||v[4])):v[5]?w.type="comment":v[6]?(w.type="comment",w.closed=!!v[7]):v[8]?w.type="regex":v[9]?w.type="number":v[10]?w.type="name":v[11]?w.type="punctuator":v[12]&&(w.type="whitespace"),w};});var GMe=Ha(MV=>{Wn();Object.defineProperty(MV,"__esModule",{value:!0});MV.isIdentifierChar=HMe;MV.isIdentifierName=v1t;MV.isIdentifierStart=$Me;var W1e="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",VMe="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F