UNPKG

vue3-create-test-cli

Version:

1 lines 618 kB
"use strict";var e=require("node:events"),t=require("node:child_process"),n=require("node:path"),i=require("node:fs"),r=require("node:process"),o=require("node:buffer"),a=require("node:tty"),s=require("node:util"),c=require("node:os"),u=require("node:assert"),l=require("node:crypto"),p=require("node:constants"),d=require("node:stream"),f=require("node:http"),h=require("node:https"),m=require("node:url"),g=require("node:zlib"),v=require("node:readline"),b=require("node:async_hooks");function x(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var y=x(v);function _(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E={},k={},C={};let S=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}};C.CommanderError=S,C.InvalidArgumentError=class extends S{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};const{InvalidArgumentError:O}=C;k.Argument=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.length>3&&"..."===this._name.slice(-3)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new O(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},k.humanReadableArgName=function(e){const t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"};var F={},R={};const{humanReadableArgName:A}=k;function j(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,"")}R.Help=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){const t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){const n=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){const t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){const i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);i||r?n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description)):t.push(n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];const t=[];for(let n=e.parent;n;n=n.parent){const e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){const t=e.registeredArguments.map(e=>A(e)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let t=e.parent;t;t=t.parent)n=t.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue){(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`)}if(void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&t.push(`env: ${e.envVar}`),t.length>0){const n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){const t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){const n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return 0===t.length?[]:[n.styleTitle(e),...t,""]}groupItems(e,t,n){const i=new Map;return e.forEach(e=>{const t=n(e);i.has(t)||i.set(t,[])}),t.forEach(e=>{const t=n(e);i.has(t)||i.set(t,[]),i.get(t).push(e)}),i}formatHelp(e,t){const n=t.padWidth(e,t),i=t.helpWidth??80;function r(e,i){return t.formatItem(e,n,i,t)}let o=[`${t.styleTitle("Usage:")} ${t.styleUsage(t.commandUsage(e))}`,""];const a=t.commandDescription(e);a.length>0&&(o=o.concat([t.boxWrap(t.styleCommandDescription(a),i),""]));const s=t.visibleArguments(e).map(e=>r(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));o=o.concat(this.formatItemList("Arguments:",s,t));const c=this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??"Options:");if(c.forEach((e,n)=>{const i=e.map(e=>r(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));o=o.concat(this.formatItemList(n,i,t))}),t.showGlobalOptions){const n=t.visibleGlobalOptions(e).map(e=>r(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));o=o.concat(this.formatItemList("Global Options:",n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||"Commands:").forEach((e,n)=>{const i=e.map(e=>r(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));o=o.concat(this.formatItemList(n,i,t))}),o.join("\n")}displayWidth(e){return j(e).length}styleTitle(e){return e}styleUsage(e){return e.split(" ").map(e=>"[options]"===e?this.styleOptionText(e):"[command]"===e?this.styleSubcommandText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleCommandText(e)).join(" ")}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(" ").map(e=>"[options]"===e?this.styleOptionText(e):"["===e[0]||"<"===e[0]?this.styleArgumentText(e):this.styleSubcommandText(e)).join(" ")}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,i){const r=" ".repeat(2);if(!n)return r+e;const o=e.padEnd(t+e.length-i.displayWidth(e)),a=(this.helpWidth??80)-t-2-2;let s;if(a<this.minWidthToWrap||i.preformatted(n))s=n;else{s=i.boxWrap(n,a).replace(/\n/g,"\n"+" ".repeat(t+2))}return r+o+" ".repeat(2)+s.replace(/\n/g,`\n${r}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;const n=e.split(/\r\n|\n/),i=/[\s]*[^\s]+/g,r=[];return n.forEach(e=>{const n=e.match(i);if(null===n)return void r.push("");let o=[n.shift()],a=this.displayWidth(o[0]);n.forEach(e=>{const n=this.displayWidth(e);if(a+n<=t)return o.push(e),void(a+=n);r.push(o.join(""));const i=e.trimStart();o=[i],a=this.displayWidth(i)}),r.push(o.join(""))}),r.join("\n")}},R.stripColor=j;var T={};const{InvalidArgumentError:B}=C;function L(e){return e.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}T.Option=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;const n=function(e){let t,n;const i=/^-[^-]$/,r=/^--[^-]/,o=e.split(/[ |,]+/).concat("guard");i.test(o[0])&&(t=o.shift());r.test(o[0])&&(n=o.shift());!t&&i.test(o[0])&&(t=o.shift());!t&&r.test(o[0])&&(t=n,n=o.shift());if(o[0].startsWith("-")){const t=o[0],n=`option creation failed due to '${t}' in option flags '${e}'`;if(/^-[^-][^-]/.test(t))throw new Error(`${n}\n- a short flag is a single dash and a single character\n - either use a single dash and a single character (for a short flag)\n - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(i.test(t))throw new Error(`${n}\n- too many short flags`);if(r.test(t))throw new Error(`${n}\n- too many long flags`);throw new Error(`${n}\n- unrecognised flag format`)}if(void 0===t&&void 0===n)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}(e);this.short=n.shortFlag,this.long=n.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,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return"string"==typeof e&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t!==this.defaultValue&&Array.isArray(t)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new B(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?L(this.name().replace(/^no-/,"")):L(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},T.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){const n=t.attributeName();if(!this.dualOptions.has(n))return!0;const i=this.negativeOptions.get(n).presetArg,r=void 0!==i&&i;return t.negate===(r===e)}};var P={};P.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));const n=e.startsWith("--");n&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let i=[],r=3;return t.forEach(t=>{if(t.length<=1)return;const n=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);const n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let i=1;i<=t.length;i++)for(let r=1;r<=e.length;r++){let o=1;o=e[r-1]===t[i-1]?0:1,n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+o),r>1&&i>1&&e[r-1]===t[i-2]&&e[r-2]===t[i-1]&&(n[r][i]=Math.min(n[r][i],n[r-2][i-2]+1))}return n[e.length][t.length]}(e,t),o=Math.max(e.length,t.length);(o-n)/o>.4&&(n<r?(r=n,i=[t]):n===r&&i.push(t))}),i.sort((e,t)=>e.localeCompare(t)),n&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(", ")}?)`:1===i.length?`\n(Did you mean ${i[0]}?)`:""};const M=e.EventEmitter,I=t,N=n,U=i,$=r,{Argument:q,humanReadableArgName:z}=k,{CommanderError:W}=C,{Help:H,stripColor:G}=R,{Option:V,DualOptions:J}=T,{suggestSimilar:Y}=P;function K(e){return e.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n,i="127.0.0.1",r="9229";return null!==(n=e.match(/^(--inspect(-brk)?)$/))?t=n[1]:null!==(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=n[1],/^\d+$/.test(n[3])?r=n[3]:i=n[3]):null!==(n=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=n[1],i=n[3],r=n[4]),t&&"0"!==r?`${t}=${i}:${parseInt(r)+1}`:e})}function Z(){return!$.env.NO_COLOR&&"0"!==$.env.FORCE_COLOR&&"false"!==$.env.FORCE_COLOR&&(!(!$.env.FORCE_COLOR&&void 0===$.env.CLICOLOR_FORCE)||void 0)}F.Command=class e extends M{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",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._savedState=null,this._outputConfiguration={writeOut:e=>$.stdout.write(e),writeErr:e=>$.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>$.stdout.isTTY?$.stdout.columns:void 0,getErrHelpWidth:()=>$.stderr.isTTY?$.stderr.columns:void 0,getOutHasColors:()=>Z()??($.stdout.isTTY&&$.stdout.hasColors?.()),getErrHasColors:()=>Z()??($.stderr.isTTY&&$.stderr.hasColors?.()),stripColor:e=>G(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){const e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,r=n;"object"==typeof i&&null!==i&&(r=i,i=null),r=r||{};const[,o,a]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(o);return i&&(s.description(i),s._executableHandler=!0),r.isDefault&&(this._defaultCommandName=s._name),s._hidden=!(!r.noHelp&&!r.hidden),s._executableFile=r.executableFile||null,a&&s.arguments(a),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),i?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new H,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(this._outputConfiguration=Object.assign({},this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error("Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()");return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new q(e,t)}argument(e,t,n,i){const r=this.createArgument(e,t);return"function"==typeof n?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){const t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if("boolean"==typeof e)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;const n=e??"help [command]",[,i,r]=n.match(/([^ ]+) *(.*)/),o=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),r&&a.arguments(r),o&&a.description(o),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return"object"!=typeof e?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(void 0===this._helpCommand&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){const n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.\nExpecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if("commander.executeSubCommandAsync"!==e.code)throw e}),this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new W(e,t,n)),$.exit(e)}action(e){return this._actionHandler=t=>{const n=this.registeredArguments.length,i=t.slice(0,n);return this._storeOptionsAsProperties?i[n]=this:i[n]=this.opts(),i.push(this),e.apply(this,i)},this}createOption(e,t){return new V(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(e){if("commander.invalidArgument"===e.code){const t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){const t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){const n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'\n- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){const t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){const i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);const t=e.name(),n=e.attributeName();if(e.negate){const t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(n,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(n,e.defaultValue,"default");const i=(t,i,r)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);const o=this.getOptionValue(n);null!==t&&e.parseArg?t=this._callParseArg(e,t,o,i):null!==t&&e.variadic&&(t=e._concatValue(t,o)),null==t&&(t=!e.negate&&(!(!e.isBoolean()&&!e.optional)||"")),this.setOptionValueWithSource(n,t,r)};return this.on("option:"+t,t=>{const n=`error: option '${e.flags}' argument '${t}' is invalid.`;i(t,n,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{const n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;i(t,n,"env")}),this}_optionEx(e,t,n,i,r){if("object"==typeof t&&t instanceof V)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");const o=this.createOption(t,n);if(o.makeOptionMandatory(!!e.mandatory),"function"==typeof i)o.default(r).argParser(i);else if(i instanceof RegExp){const e=i;i=(t,n)=>{const i=e.exec(t);return i?i[0]:n},o.default(r).argParser(i)}else o.default(i);return this.addOption(o)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{void 0!==n.getOptionValueSource(e)&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(void 0!==e&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},void 0===e&&void 0===t.from){$.versions?.electron&&(t.from="electron");const e=$.execArgv??[];(e.includes("-e")||e.includes("--eval")||e.includes("-p")||e.includes("--print"))&&(t.from="eval")}let n;switch(void 0===e&&(e=$.argv),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":$.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;case"eval":n=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){this._prepareForParse();const n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();const n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){null===this._savedState?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error("Can not call parse again when storeOptionsAsProperties is true.\n- either make a new Command for each call to parse, or stop storing options as properties");this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(U.existsSync(e))return;throw new Error(`'${e}' does not exist\n - if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${t?`searched for local subcommand relative to directory '${t}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory"}`)}_executeSubCommand(e,t){t=t.slice();let n=!1;const i=[".js",".ts",".tsx",".mjs",".cjs"];function r(e,t){const n=N.resolve(e,t);if(U.existsSync(n))return n;if(i.includes(N.extname(t)))return;const r=i.find(e=>U.existsSync(`${n}${e}`));return r?`${n}${r}`:void 0}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o,a=e._executableFile||`${this._name}-${e._name}`,s=this._executableDir||"";if(this._scriptPath){let e;try{e=U.realpathSync(this._scriptPath)}catch{e=this._scriptPath}s=N.resolve(N.dirname(e),s)}if(s){let t=r(s,a);if(!t&&!e._executableFile&&this._scriptPath){const n=N.basename(this._scriptPath,N.extname(this._scriptPath));n!==this._name&&(t=r(s,`${n}-${e._name}`))}a=t||a}if(n=i.includes(N.extname(a)),"win32"!==$.platform?n?(t.unshift(a),t=K($.execArgv).concat(t),o=I.spawn($.argv[0],t,{stdio:"inherit"})):o=I.spawn(a,t,{stdio:"inherit"}):(this._checkForMissingExecutable(a,s,e._name),t.unshift(a),t=K($.execArgv).concat(t),o=I.spawn($.execPath,t,{stdio:"inherit"})),!o.killed){["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{$.on(e,()=>{!1===o.killed&&null===o.exitCode&&o.kill(e)})})}const c=this._exitCallback;o.on("close",e=>{e=e??1,c?c(new W(e,"commander.executeSubCommandAsync","(close)")):$.exit(e)}),o.on("error",t=>{if("ENOENT"===t.code)this._checkForMissingExecutable(a,s,e._name);else if("EACCES"===t.code)throw new Error(`'${a}' not executable`);if(c){const e=new W(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,c(e)}else $.exit(1)}),this.runningCommand=o}_dispatchSubcommand(e,t,n){const i=this._findCommand(e);let r;return i||this.help({error:!0}),i._prepareForParse(),r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(!i._executableHandler)return i._parseCommand(t,n);this._executeSubCommand(i,t.concat(n))}),r}_dispatchHelpCommand(e){e||this.help();const t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic||this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){const e=(e,t,n)=>{let i=t;if(null!==t&&e.parseArg){const r=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;i=this._callParseArg(e,t,n,r)}return i};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((t,i)=>e(n,i,t),n.defaultValue))):void 0===r&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e;const i=[];return this._getCommandAndAncestors().reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{i.push({hookedCommand:e,callback:t})})}),"postAction"===t&&i.reverse(),i.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return void 0!==this._lifeCycleHooks[n]&&this._lifeCycleHooks[n].forEach(e=>{i=this._chainOrCall(i,()=>e(this,t))}),i}_parseCommand(e,t){const n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();const i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){let n;return i(),this._processArguments(),n=this._chainOrCallHooks(n,"preAction"),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(r,e,t)})),n=this._chainOrCallHooks(n,"postAction"),n}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){const e=this.options.filter(e=>{const t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)}),t=e.filter(e=>e.conflictsWith.length>0);t.forEach(t=>{const n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){const t=[],n=[];let i=t;const r=e.slice();function o(e){return e.length>1&&"-"===e[0]}const a=e=>!!/^-\d*\.?\d+(e[+-]?\d+)?$/.test(e)&&!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e)));let s=null;for(;r.length;){const e=r.shift();if("--"===e){i===n&&i.push(e),i.push(...r);break}if(!s||o(e)&&!a(e)){if(s=null,o(e)){const t=this._findOption(e);if(t){if(t.required){const e=r.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;r.length>0&&(!o(r[0])||a(r[0]))&&(e=r.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);s=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){const t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),r.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){const t=e.indexOf("="),n=this._findOption(e.slice(0,t));if(n&&(n.required||n.optional)){this.emit(`option:${n.name()}`,e.slice(t+1));continue}}if(i!==t||!o(e)||0===this.commands.length&&a(e)||(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===n.length){if(this._findCommand(e)){t.push(e),r.length>0&&n.push(...r);break}if(this._getHelpCommand()&&e===this._getHelpCommand().name()){t.push(e),r.length>0&&t.push(...r);break}if(this._defaultCommandName){n.push(e),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(e),r.length>0&&i.push(...r);break}i.push(e)}else this.emit(`option:${s.name()}`,e)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){const e={},t=this.options.length;for(let n=0;n<t;n++){const t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));const n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in $.env){const t=e.attributeName();(void 0===this.getOptionValue(t)||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,$.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){const e=new J(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(n=>void 0!==n.implied&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],"implied")})})}missingArgument(e){const t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){const t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){const t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){const n=e=>{const t=e.attributeName(),n=this.getOptionValue(t),i=this.options.find(e=>e.negate&&t===e.attributeName()),r=this.options.find(e=>!e.negate&&t===e.attributeName());return i&&(void 0===i.presetArg&&!1===n||void 0!==i.presetArg&&n===i.presetArg)?i:r||e},i=e=>{const t=n(e),i=t.attributeName();return"env"===this.getOptionValueSource(i)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],i=this;do{const e=i.createHelp().visibleOptions(i).filter(e=>e.long).map(e=>e.long);n=n.concat(e),i=i.parent}while(i&&!i._enablePositionalOptions);t=Y(e,n)}const n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;const t=this.registeredArguments.length,n=1===t?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){const e=this.args[0];let t="";if(this._showSuggestionAfterError){const n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=Y(e,n)}const n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";const i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");const n=this.parent?._findCommand(e);if(n){const t=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;const e=this.registeredArguments.map(e=>z(e));return[].concat(this.options.length||null!==this._helpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}helpGroup(e){return void 0===e?this._helpGroupHeading??"":(this._helpGroupHeading=e,this)}commandsGroup(e){return void 0===e?this._defaultCommandGroup??"":(this._defaultCommandGroup=e,this)}optionsGroup(e){return void 0===e?this._defaultOptionGroup??"":(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=N.basename(e,N.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){const t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});const i=t.formatHelp(this,t);return n.hasColors?i:this._outputConfiguration.stripColor(i)}_getOutputContext(e){const t=!!(e=e||{}).error;let n,i,r;t?(n=e=>this._outputConfiguration.writeErr(e),i=this._outputConfiguration.getErrHasColors(),r=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),i=this._outputConfiguration.getOutHasColors(),r=this._outputConfiguration.getOutHelpWidth());return{error:t,write:e=>(i||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:i,helpWidth:r}}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);const n=this._getOutputContext(e),i={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let r=this.helpInformation({error:n.error});if(t&&(r=t(r),"string"!=typeof r&&!Buffer.isBuffer(r)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(r),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(e=>e.emit("afterAllHelp",i))}helpOption(e,t){return"boolean"==typeof e?(e?(null===this._helpOption&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??"-h, --help",t??"display help for command"),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return void 0===this._helpOption&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number($.exitCode??0);0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){const n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${n.join("', '")}'`);const i=`${e}Help`;return this.on(i,e=>{let n;n="function"==typeof t?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){const t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}},F.useColor=Z;const{Argument:X}=k,{Command:Q}=F,{CommanderError:ee,InvalidArgumentError:te}=C,{Help:ne}=R,{Option:ie}=T;E.program=new Q,E.createCommand=e=>new Q(e),E.createOption=(e,t)=>new ie(e,t),E.createArgument=(e,t)=>new X(e,t),E.Command=Q,E.Option=ie,E.Argument=X,E.Help=ne,E.CommanderError=ee,E.InvalidArgumentError=te,E.InvalidOptionArgumentError=te;const{program:re,createCommand:oe,createArgument:ae,createOption:se,CommanderError:ce,InvalidArgumentError:ue,InvalidOptionArgumentError:le,Command:pe,Argument:de,Option:fe,Help:he}=E;var me="vue3-create-test-cli",ge="0.1.4";const ve=e=>"up"===e.name||"k"===e.name||e.ctrl&&"p"===e.name,be=e=>"down"===e.name||"j"===e.name||e.ctrl&&"n"===e.name,xe=e=>"backspace"===e.name,ye=e=>"enter"===e.name||"return"===e.name;class _e extends Error{name="AbortPromptError";message="Prompt was aborted";constructor(e){super(),this.cause=e?.cause}}class De extends Error{name="CancelPromptError";message="Prompt was canceled"}class we extends Error{name="ExitPromptError"}class Ee extends Error{name="HookError"}class ke extends Error{name="ValidationError"}const Ce=new b.AsyncLocalStorage;function Se(){const e=Ce.getStore();if(!e)throw new Ee("[Inquirer] Hook functions can only be called from within a prompt");return e}function Oe(){return Se().rl}function Fe(e){return b.AsyncResource.bind((...t)=>{const n=Se();let i=!1;const r=n.handleChange;n.handleChange=()=>{i=!0};const o=e(...t);return i&&r(),n.handleChange=r,o})}function Re(e){const t=Se(),{index:n}=t,i=e({get:()=>t.hooks[n],set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,i}const Ae={queue(e){const t=Se(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();const i=e(Oe());if(null!=i&&"function"!=typeof i)throw new ke("useEffect return value must be a cleanup function or nothing.");t.hooksCleanup[n]=i})},run(){const e=Se();Fe(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){const e=Se();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function je(e){return Re(t=>{const n=b.AsyncResource.bind(function(e){t.get()!==e&&(t.set(e),Se().handleChange())});if(t.initialized)return[t.get(),n];const i="function"==typeof e?e():e;return t.set(i),[i,n]})}function Te(e,t){Re(n=>{const i=n.get();(!Array.isArray(i)||t.some((e,t)=>!Object.is(e,i[t])))&&Ae.queue(e),n.set(t)})}const Be=a,Le=Be?.WriteStream?.prototype?.hasColors?.()??!1,Pe=(e,t)=>{if(!Le)return e=>e;const n=`[${e}m`,i=`[${t}m`;return e=>{const t=e+"";let r=t.indexOf(i);if(-1===r)return n+t+i;let o=n,a=0;for(;-1!==r;)o+=t.slice(a,r)+n,a=r+i.length,r=t.indexOf(i,a);return o+=t.slice(a)+i,o}},Me={};Me.reset=Pe(0,0),Me.bold=Pe(1,22),Me.dim=Pe(2,22),Me.italic=Pe(3,23),Me.underline=Pe(4,24),Me.overline=Pe(53,55),Me.inverse=Pe(7,27),Me.hidden=Pe(8,28),Me.strikethrough=Pe(9,29),Me.black=Pe(30,39),Me.red=Pe(31,39),Me.green=Pe(32,39),Me.yellow=Pe(33,39),Me.blue=Pe(34,39),Me.magenta=Pe(35,39),Me.cyan=Pe(36,39),Me.white=Pe(37,39),Me.gray=Pe(90,39),Me.bgBlack=Pe(40,49),Me.bgRed=Pe(41,49),Me.bgGreen=Pe(42,49),Me.bgYellow=Pe(43,49),Me.bgBlue=Pe(44,49),Me.bgMagenta=Pe(45,49),Me.bgCyan=Pe(46,49),Me.bgWhite=Pe(47,49),Me.bgGray=Pe(100,49),Me.redBright=Pe(91,39),Me.greenBright=Pe(92,39),Me.yellowBright=Pe(93,39),Me.blueBright=Pe(94,39),Me.magentaBright=Pe(95,39),Me.cyanBright=Pe(96,39),Me.whiteBright=Pe(97,39),Me.bgRedBright=Pe(101,49),Me.bgGreenBright=Pe(102,49),Me.bgYellowBright=Pe(103,49),Me.bgBlueBright=Pe(104,49),Me.bgMagentaBright=Pe(105,49),Me.bgCyanBright=Pe(106,49),Me.bgWhiteBright=Pe(107,49);var Ie=w(Me);const Ne={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},Ue={...Ne,tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},$e={...Ne,tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"};var qe=("win32"!==r.platform?"linux"!==r.env.TERM:Boolean(r.env.WT_SESSION)||Boolean(r.env.TERMINUS_SUBLIME)||"{cmd::Cmder}"===r.env.ConEmuTask||"Terminus-Sublime"===r.env.TERM_PROGRAM||"vscode"===r.env.TERM_PROGRAM||"xterm-256color"===r.env.TERM||"alacritty"===r.env.