@weirdscience/quicklaunch
Version:
A streamlined CLI tool for deploying Node.js applications to remote servers with automated SSH, PM2, Nginx, and SSL configuration.
23 lines • 817 kB
JavaScript
#!/usr/bin/env node
"use strict";var e2=Object.create;var Wu=Object.defineProperty;var t2=Object.getOwnPropertyDescriptor;var u2=Object.getOwnPropertyNames;var r2=Object.getPrototypeOf,n2=Object.prototype.hasOwnProperty;var rt=(e,t)=>()=>(e&&(t=e(e=0)),t);var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),i2=(e,t)=>{for(var u in t)Wu(e,u,{get:t[u],enumerable:!0})},D2=(e,t,u,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u2(t))!n2.call(e,i)&&i!==u&&Wu(e,i,{get:()=>t[i],enumerable:!(r=t2(t,i))||r.enumerable});return e};var w=(e,t,u)=>(u=e!=null?e2(r2(e)):{},D2(t||!e||!e.__esModule?Wu(u,"default",{value:e,enumerable:!0}):u,e));var nt=b(Yu=>{var Nt=class extends Error{constructor(t,u,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=u,this.exitCode=t,this.nestedError=void 0}},Ku=class extends Nt{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Yu.CommanderError=Nt;Yu.InvalidArgumentError=Ku});var Pt=b(Xu=>{var{InvalidArgumentError:s2}=nt(),zu=class{constructor(t,u){switch(this.description=u||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,u){return u===this.defaultValue||!Array.isArray(u)?[t]:u.concat(t)}default(t,u){return this.defaultValue=t,this.defaultValueDescription=u,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(u,r)=>{if(!this.argChoices.includes(u))throw new s2(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,r):u},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function o2(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}Xu.Argument=zu;Xu.humanReadableArgName=o2});var Zu=b(Oi=>{var{humanReadableArgName:a2}=Pt(),Ju=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){let u=t.commands.filter(i=>!i._hidden),r=t._getHelpCommand();return r&&!r._hidden&&u.push(r),this.sortSubcommands&&u.sort((i,D)=>i.name().localeCompare(D.name())),u}compareOptions(t,u){let r=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return r(t).localeCompare(r(u))}visibleOptions(t){let u=t.options.filter(i=>!i.hidden),r=t._getHelpOption();if(r&&!r.hidden){let i=r.short&&t._findOption(r.short),D=r.long&&t._findOption(r.long);!i&&!D?u.push(r):r.long&&!D?u.push(t.createOption(r.long,r.description)):r.short&&!i&&u.push(t.createOption(r.short,r.description))}return this.sortOptions&&u.sort(this.compareOptions),u}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let u=[];for(let r=t.parent;r;r=r.parent){let i=r.options.filter(D=>!D.hidden);u.push(...i)}return this.sortOptions&&u.sort(this.compareOptions),u}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(u=>{u.description=u.description||t._argsDescription[u.name()]||""}),t.registeredArguments.find(u=>u.description)?t.registeredArguments:[]}subcommandTerm(t){let u=t.registeredArguments.map(r=>a2(r)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(u?" "+u:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,u){return u.visibleCommands(t).reduce((r,i)=>Math.max(r,u.subcommandTerm(i).length),0)}longestOptionTermLength(t,u){return u.visibleOptions(t).reduce((r,i)=>Math.max(r,u.optionTerm(i).length),0)}longestGlobalOptionTermLength(t,u){return u.visibleGlobalOptions(t).reduce((r,i)=>Math.max(r,u.optionTerm(i).length),0)}longestArgumentTermLength(t,u){return u.visibleArguments(t).reduce((r,i)=>Math.max(r,u.argumentTerm(i).length),0)}commandUsage(t){let u=t._name;t._aliases[0]&&(u=u+"|"+t._aliases[0]);let r="";for(let i=t.parent;i;i=i.parent)r=i.name()+" "+r;return r+u+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let u=[];return t.argChoices&&u.push(`choices: ${t.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&u.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&u.push(`env: ${t.envVar}`),u.length>0?`${t.description} (${u.join(", ")})`:t.description}argumentDescription(t){let u=[];if(t.argChoices&&u.push(`choices: ${t.argChoices.map(r=>JSON.stringify(r)).join(", ")}`),t.defaultValue!==void 0&&u.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),u.length>0){let r=`(${u.join(", ")})`;return t.description?`${t.description} ${r}`:r}return t.description}formatHelp(t,u){let r=u.padWidth(t,u),i=u.helpWidth||80,D=2,n=2;function s(p,h){if(h){let C=`${p.padEnd(r+n)}${h}`;return u.wrap(C,i-D,r+n)}return p}function o(p){return p.join(`
`).replace(/^/gm," ".repeat(D))}let a=[`Usage: ${u.commandUsage(t)}`,""],c=u.commandDescription(t);c.length>0&&(a=a.concat([u.wrap(c,i,0),""]));let x=u.visibleArguments(t).map(p=>s(u.argumentTerm(p),u.argumentDescription(p)));x.length>0&&(a=a.concat(["Arguments:",o(x),""]));let l=u.visibleOptions(t).map(p=>s(u.optionTerm(p),u.optionDescription(p)));if(l.length>0&&(a=a.concat(["Options:",o(l),""])),this.showGlobalOptions){let p=u.visibleGlobalOptions(t).map(h=>s(u.optionTerm(h),u.optionDescription(h)));p.length>0&&(a=a.concat(["Global Options:",o(p),""]))}let F=u.visibleCommands(t).map(p=>s(u.subcommandTerm(p),u.subcommandDescription(p)));return F.length>0&&(a=a.concat(["Commands:",o(F),""])),a.join(`
`)}padWidth(t,u){return Math.max(u.longestOptionTermLength(t,u),u.longestGlobalOptionTermLength(t,u),u.longestSubcommandTermLength(t,u),u.longestArgumentTermLength(t,u))}wrap(t,u,r,i=40){let D=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",n=new RegExp(`[\\n][${D}]+`);if(t.match(n))return t;let s=u-r;if(s<i)return t;let o=t.slice(0,r),a=t.slice(r).replace(`\r
`,`
`),c=" ".repeat(r),l="\\s\u200B",F=new RegExp(`
|.{1,${s-1}}([${l}]|$)|[^${l}]+?([${l}]|$)`,"g"),p=a.match(F)||[];return o+p.map((h,C)=>h===`
`?"":(C>0?c:"")+h.trimEnd()).join(`
`)}};Oi.Help=Ju});var ur=b(tr=>{var{InvalidArgumentError:c2}=nt(),Qu=class{constructor(t,u){this.flags=t,this.description=u||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let r=l2(t);this.short=r.shortFlag,this.long=r.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(t,u){return this.defaultValue=t,this.defaultValueDescription=u,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let u=t;return typeof t=="string"&&(u={[t]:!0}),this.implied=Object.assign(this.implied||{},u),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,u){return u===this.defaultValue||!Array.isArray(u)?[t]:u.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(u,r)=>{if(!this.argChoices.includes(u))throw new c2(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(u,r):u},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return x2(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},er=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(u=>{u.negate?this.negativeOptions.set(u.attributeName(),u):this.positiveOptions.set(u.attributeName(),u)}),this.negativeOptions.forEach((u,r)=>{this.positiveOptions.has(r)&&this.dualOptions.add(r)})}valueFromOption(t,u){let r=u.attributeName();if(!this.dualOptions.has(r))return!0;let i=this.negativeOptions.get(r).presetArg,D=i!==void 0?i:!1;return u.negate===(D===t)}};function x2(e){return e.split("-").reduce((t,u)=>t+u[0].toUpperCase()+u.slice(1))}function l2(e){let t,u,r=e.split(/[ |,]+/);return r.length>1&&!/^[[<]/.test(r[1])&&(t=r.shift()),u=r.shift(),!t&&/^-[^-]$/.test(u)&&(t=u,u=void 0),{shortFlag:t,longFlag:u}}tr.Option=Qu;tr.DualOptions=er});var Ii=b(Ti=>{function f2(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let u=[];for(let r=0;r<=e.length;r++)u[r]=[r];for(let r=0;r<=t.length;r++)u[0][r]=r;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let D=1;e[i-1]===t[r-1]?D=0:D=1,u[i][r]=Math.min(u[i-1][r]+1,u[i][r-1]+1,u[i-1][r-1]+D),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(u[i][r]=Math.min(u[i][r],u[i-2][r-2]+1))}return u[e.length][t.length]}function F2(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let u=e.startsWith("--");u&&(e=e.slice(2),t=t.map(n=>n.slice(2)));let r=[],i=3,D=.4;return t.forEach(n=>{if(n.length<=1)return;let s=f2(e,n),o=Math.max(e.length,n.length);(o-s)/o>D&&(s<i?(i=s,r=[n]):s===i&&r.push(n))}),r.sort((n,s)=>n.localeCompare(s)),u&&(r=r.map(n=>`--${n}`)),r.length>1?`
(Did you mean one of ${r.join(", ")}?)`:r.length===1?`
(Did you mean ${r[0]}?)`:""}Ti.suggestSimilar=F2});var Ni=b(ki=>{var E2=require("node:events").EventEmitter,rr=require("node:child_process"),Xe=require("node:path"),nr=require("node:fs"),ue=require("node:process"),{Argument:h2,humanReadableArgName:d2}=Pt(),{CommanderError:ir}=nt(),{Help:p2}=Zu(),{Option:Ri,DualOptions:C2}=ur(),{suggestSimilar:Li}=Ii(),Dr=class e extends E2{constructor(t){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=t||"",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:u=>ue.stdout.write(u),writeErr:u=>ue.stderr.write(u),getOutHelpWidth:()=>ue.stdout.isTTY?ue.stdout.columns:void 0,getErrHelpWidth:()=>ue.stderr.isTTY?ue.stderr.columns:void 0,outputError:(u,r)=>r(u)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let u=this;u;u=u.parent)t.push(u);return t}command(t,u,r){let i=u,D=r;typeof i=="object"&&i!==null&&(D=i,i=null),D=D||{};let[,n,s]=t.match(/([^ ]+) *(.*)/),o=this.createCommand(n);return i&&(o.description(i),o._executableHandler=!0),D.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(D.noHelp||D.hidden),o._executableFile=D.executableFile||null,s&&o.arguments(s),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),i?this:o}createCommand(t){return new e(t)}createHelp(){return Object.assign(new p2,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,u){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);return u=u||{},u.isDefault&&(this._defaultCommandName=t._name),(u.noHelp||u.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,u){return new h2(t,u)}argument(t,u,r,i){let D=this.createArgument(t,u);return typeof r=="function"?D.default(i).argParser(r):D.default(r),this.addArgument(D),this}arguments(t){return t.trim().split(/ +/).forEach(u=>{this.argument(u)}),this}addArgument(t){let u=this.registeredArguments.slice(-1)[0];if(u&&u.variadic)throw new Error(`only the last argument can be variadic '${u.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,u){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,this;t=t??"help [command]";let[,r,i]=t.match(/([^ ]+) *(.*)/),D=u??"display help for command",n=this.createCommand(r);return n.helpOption(!1),i&&n.arguments(i),D&&n.description(D),this._addImplicitHelpCommand=!0,this._helpCommand=n,this}addHelpCommand(t,u){return typeof t!="object"?(this.helpCommand(t,u),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,u){let r=["preSubcommand","preAction","postAction"];if(!r.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(u):this._lifeCycleHooks[t]=[u],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=u=>{if(u.code!=="commander.executeSubCommandAsync")throw u},this}_exit(t,u,r){this._exitCallback&&this._exitCallback(new ir(t,u,r)),ue.exit(t)}action(t){let u=r=>{let i=this.registeredArguments.length,D=r.slice(0,i);return this._storeOptionsAsProperties?D[i]=this:D[i]=this.opts(),D.push(this),t.apply(this,D)};return this._actionHandler=u,this}createOption(t,u){return new Ri(t,u)}_callParseArg(t,u,r,i){try{return t.parseArg(u,r)}catch(D){if(D.code==="commander.invalidArgument"){let n=`${i} ${D.message}`;this.error(n,{exitCode:D.exitCode,code:D.code})}throw D}}_registerOption(t){let u=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(u){let r=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${r}'
- already used by option '${u.flags}'`)}this.options.push(t)}_registerCommand(t){let u=i=>[i.name()].concat(i.aliases()),r=u(t).find(i=>this._findCommand(i));if(r){let i=u(this._findCommand(r)).join("|"),D=u(t).join("|");throw new Error(`cannot add command '${D}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);let u=t.name(),r=t.attributeName();if(t.negate){let D=t.long.replace(/^--no-/,"--");this._findOption(D)||this.setOptionValueWithSource(r,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(r,t.defaultValue,"default");let i=(D,n,s)=>{D==null&&t.presetArg!==void 0&&(D=t.presetArg);let o=this.getOptionValue(r);D!==null&&t.parseArg?D=this._callParseArg(t,D,o,n):D!==null&&t.variadic&&(D=t._concatValue(D,o)),D==null&&(t.negate?D=!1:t.isBoolean()||t.optional?D=!0:D=""),this.setOptionValueWithSource(r,D,s)};return this.on("option:"+u,D=>{let n=`error: option '${t.flags}' argument '${D}' is invalid.`;i(D,n,"cli")}),t.envVar&&this.on("optionEnv:"+u,D=>{let n=`error: option '${t.flags}' value '${D}' from env '${t.envVar}' is invalid.`;i(D,n,"env")}),this}_optionEx(t,u,r,i,D){if(typeof u=="object"&&u instanceof Ri)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let n=this.createOption(u,r);if(n.makeOptionMandatory(!!t.mandatory),typeof i=="function")n.default(D).argParser(i);else if(i instanceof RegExp){let s=i;i=(o,a)=>{let c=s.exec(o);return c?c[0]:a},n.default(D).argParser(i)}else n.default(i);return this.addOption(n)}option(t,u,r,i){return this._optionEx({},t,u,r,i)}requiredOption(t,u,r,i){return this._optionEx({mandatory:!0},t,u,r,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,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(t=!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=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,u){return this.setOptionValueWithSource(t,u,void 0)}setOptionValueWithSource(t,u,r){return this._storeOptionsAsProperties?this[t]=u:this._optionValues[t]=u,this._optionValueSources[t]=r,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let u;return this._getCommandAndAncestors().forEach(r=>{r.getOptionValueSource(t)!==void 0&&(u=r.getOptionValueSource(t))}),u}_prepareUserArgs(t,u){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(u=u||{},t===void 0&&u.from===void 0){ue.versions?.electron&&(u.from="electron");let i=ue.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(u.from="eval")}t===void 0&&(t=ue.argv),this.rawArgs=t.slice();let r;switch(u.from){case void 0:case"node":this._scriptPath=t[1],r=t.slice(2);break;case"electron":ue.defaultApp?(this._scriptPath=t[1],r=t.slice(2)):r=t.slice(1);break;case"user":r=t.slice(0);break;case"eval":r=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${u.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(t,u){let r=this._prepareUserArgs(t,u);return this._parseCommand([],r),this}async parseAsync(t,u){let r=this._prepareUserArgs(t,u);return await this._parseCommand([],r),this}_executeSubCommand(t,u){u=u.slice();let r=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function D(c,x){let l=Xe.resolve(c,x);if(nr.existsSync(l))return l;if(i.includes(Xe.extname(x)))return;let F=i.find(p=>nr.existsSync(`${l}${p}`));if(F)return`${l}${F}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=t._executableFile||`${this._name}-${t._name}`,s=this._executableDir||"";if(this._scriptPath){let c;try{c=nr.realpathSync(this._scriptPath)}catch{c=this._scriptPath}s=Xe.resolve(Xe.dirname(c),s)}if(s){let c=D(s,n);if(!c&&!t._executableFile&&this._scriptPath){let x=Xe.basename(this._scriptPath,Xe.extname(this._scriptPath));x!==this._name&&(c=D(s,`${x}-${t._name}`))}n=c||n}r=i.includes(Xe.extname(n));let o;ue.platform!=="win32"?r?(u.unshift(n),u=$i(ue.execArgv).concat(u),o=rr.spawn(ue.argv[0],u,{stdio:"inherit"})):o=rr.spawn(n,u,{stdio:"inherit"}):(u.unshift(n),u=$i(ue.execArgv).concat(u),o=rr.spawn(ue.execPath,u,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(x=>{ue.on(x,()=>{o.killed===!1&&o.exitCode===null&&o.kill(x)})});let a=this._exitCallback;o.on("close",c=>{c=c??1,a?a(new ir(c,"commander.executeSubCommandAsync","(close)")):ue.exit(c)}),o.on("error",c=>{if(c.code==="ENOENT"){let x=s?`searched for local subcommand relative to directory '${s}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",l=`'${n}' does not exist
- if '${t._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
- ${x}`;throw new Error(l)}else if(c.code==="EACCES")throw new Error(`'${n}' not executable`);if(!a)ue.exit(1);else{let x=new ir(1,"commander.executeSubCommandAsync","(error)");x.nestedError=c,a(x)}}),this.runningCommand=o}_dispatchSubcommand(t,u,r){let i=this._findCommand(t);i||this.help({error:!0});let D;return D=this._chainOrCallSubCommandHook(D,i,"preSubcommand"),D=this._chainOrCall(D,()=>{if(i._executableHandler)this._executeSubCommand(i,u.concat(r));else return i._parseCommand(u,r)}),D}_dispatchHelpCommand(t){t||this.help();let u=this._findCommand(t);return u&&!u._executableHandler&&u.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,u)=>{t.required&&this.args[u]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(r,i,D)=>{let n=i;if(i!==null&&r.parseArg){let s=`error: command-argument value '${i}' is invalid for argument '${r.name()}'.`;n=this._callParseArg(r,i,D,s)}return n};this._checkNumberOfArguments();let u=[];this.registeredArguments.forEach((r,i)=>{let D=r.defaultValue;r.variadic?i<this.args.length?(D=this.args.slice(i),r.parseArg&&(D=D.reduce((n,s)=>t(r,s,n),r.defaultValue))):D===void 0&&(D=[]):i<this.args.length&&(D=this.args[i],r.parseArg&&(D=t(r,D,r.defaultValue))),u[i]=D}),this.processedArgs=u}_chainOrCall(t,u){return t&&t.then&&typeof t.then=="function"?t.then(()=>u()):u()}_chainOrCallHooks(t,u){let r=t,i=[];return this._getCommandAndAncestors().reverse().filter(D=>D._lifeCycleHooks[u]!==void 0).forEach(D=>{D._lifeCycleHooks[u].forEach(n=>{i.push({hookedCommand:D,callback:n})})}),u==="postAction"&&i.reverse(),i.forEach(D=>{r=this._chainOrCall(r,()=>D.callback(D.hookedCommand,this))}),r}_chainOrCallSubCommandHook(t,u,r){let i=t;return this._lifeCycleHooks[r]!==void 0&&this._lifeCycleHooks[r].forEach(D=>{i=this._chainOrCall(i,()=>D(this,u))}),i}_parseCommand(t,u){let r=this.parseOptions(u);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(r.operands),u=r.unknown,this.args=t.concat(u),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),u);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(u),this._dispatchSubcommand(this._defaultCommandName,t,u);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},D=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let n;return n=this._chainOrCallHooks(n,"preAction"),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(D,t,u)})),n=this._chainOrCallHooks(n,"postAction"),n}if(this.parent&&this.parent.listenerCount(D))i(),this._processArguments(),this.parent.emit(D,t,u);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,u);this.listenerCount("command:*")?this.emit("command:*",t,u):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(u=>u._name===t||u._aliases.includes(t))}_findOption(t){return this.options.find(u=>u.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(u=>{u.mandatory&&t.getOptionValue(u.attributeName())===void 0&&t.missingMandatoryOptionValue(u)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(r=>{let i=r.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(r=>r.conflictsWith.length>0).forEach(r=>{let i=t.find(D=>r.conflictsWith.includes(D.attributeName()));i&&this._conflictingOption(r,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let u=[],r=[],i=u,D=t.slice();function n(o){return o.length>1&&o[0]==="-"}let s=null;for(;D.length;){let o=D.shift();if(o==="--"){i===r&&i.push(o),i.push(...D);break}if(s&&!n(o)){this.emit(`option:${s.name()}`,o);continue}if(s=null,n(o)){let a=this._findOption(o);if(a){if(a.required){let c=D.shift();c===void 0&&this.optionMissingArgument(a),this.emit(`option:${a.name()}`,c)}else if(a.optional){let c=null;D.length>0&&!n(D[0])&&(c=D.shift()),this.emit(`option:${a.name()}`,c)}else this.emit(`option:${a.name()}`);s=a.variadic?a:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let a=this._findOption(`-${o[1]}`);if(a){a.required||a.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${a.name()}`,o.slice(2)):(this.emit(`option:${a.name()}`),D.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let a=o.indexOf("="),c=this._findOption(o.slice(0,a));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,o.slice(a+1));continue}}if(n(o)&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&u.length===0&&r.length===0){if(this._findCommand(o)){u.push(o),D.length>0&&r.push(...D);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){u.push(o),D.length>0&&u.push(...D);break}else if(this._defaultCommandName){r.push(o),D.length>0&&r.push(...D);break}}if(this._passThroughOptions){i.push(o),D.length>0&&i.push(...D);break}i.push(o)}return{operands:u,unknown:r}}opts(){if(this._storeOptionsAsProperties){let t={},u=this.options.length;for(let r=0;r<u;r++){let i=this.options[r].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,u)=>Object.assign(t,u.opts()),{})}error(t,u){this._outputConfiguration.outputError(`${t}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0}));let r=u||{},i=r.exitCode||1,D=r.code||"commander.error";this._exit(i,D,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in ue.env){let u=t.attributeName();(this.getOptionValue(u)===void 0||["default","config","env"].includes(this.getOptionValueSource(u)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,ue.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new C2(this.options),u=r=>this.getOptionValue(r)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(r));this.options.filter(r=>r.implied!==void 0&&u(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r)).forEach(r=>{Object.keys(r.implied).filter(i=>!u(i)).forEach(i=>{this.setOptionValueWithSource(i,r.implied[i],"implied")})})}missingArgument(t){let u=`error: missing required argument '${t}'`;this.error(u,{code:"commander.missingArgument"})}optionMissingArgument(t){let u=`error: option '${t.flags}' argument missing`;this.error(u,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let u=`error: required option '${t.flags}' not specified`;this.error(u,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,u){let r=n=>{let s=n.attributeName(),o=this.getOptionValue(s),a=this.options.find(x=>x.negate&&s===x.attributeName()),c=this.options.find(x=>!x.negate&&s===x.attributeName());return a&&(a.presetArg===void 0&&o===!1||a.presetArg!==void 0&&o===a.presetArg)?a:c||n},i=n=>{let s=r(n),o=s.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${s.envVar}'`:`option '${s.flags}'`},D=`error: ${i(t)} cannot be used with ${i(u)}`;this.error(D,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let u="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],D=this;do{let n=D.createHelp().visibleOptions(D).filter(s=>s.long).map(s=>s.long);i=i.concat(n),D=D.parent}while(D&&!D._enablePositionalOptions);u=Li(t,i)}let r=`error: unknown option '${t}'${u}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let u=this.registeredArguments.length,r=u===1?"":"s",D=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${u} argument${r} but got ${t.length}.`;this.error(D,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],u="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(D=>{i.push(D.name()),D.alias()&&i.push(D.alias())}),u=Li(t,i)}let r=`error: unknown command '${t}'${u}`;this.error(r,{code:"commander.unknownCommand"})}version(t,u,r){if(t===void 0)return this._version;this._version=t,u=u||"-V, --version",r=r||"output the version number";let i=this.createOption(u,r);return this._versionOptionName=i.attributeName(),this._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${t}
`),this._exit(0,"commander.version",t)}),this}description(t,u){return t===void 0&&u===void 0?this._description:(this._description=t,u&&(this._argsDescription=u),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let u=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(u=this.commands[this.commands.length-1]),t===u._name)throw new Error("Command alias can't be the same as its name");let r=this.parent?._findCommand(t);if(r){let i=[r.name()].concat(r.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${i}'`)}return u._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(u=>this.alias(u)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let u=this.registeredArguments.map(r=>d2(r));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?u:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=Xe.basename(t,Xe.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let u=this.createHelp();return u.helpWidth===void 0&&(u.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),u.formatHelp(this,u)}_getHelpContext(t){t=t||{};let u={error:!!t.error},r;return u.error?r=i=>this._outputConfiguration.writeErr(i):r=i=>this._outputConfiguration.writeOut(i),u.write=t.write||r,u.command=this,u}outputHelp(t){let u;typeof t=="function"&&(u=t,t=void 0);let r=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach(D=>D.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let i=this.helpInformation(r);if(u&&(i=u(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");r.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",r),this._getCommandAndAncestors().forEach(D=>D.emit("afterAllHelp",r))}helpOption(t,u){return typeof t=="boolean"?(t?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(t=t??"-h, --help",u=u??"display help for command",this._helpOption=this.createOption(t,u),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this}help(t){this.outputHelp(t);let u=ue.exitCode||0;u===0&&t&&typeof t!="function"&&t.error&&(u=1),this._exit(u,"commander.help","(outputHelp)")}addHelpText(t,u){let r=["beforeAll","before","after","afterAll"];if(!r.includes(t))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${r.join("', '")}'`);let i=`${t}Help`;return this.on(i,D=>{let n;typeof u=="function"?n=u({error:D.error,command:D.command}):n=u,n&&D.write(`${n}
`)}),this}_outputHelpIfRequested(t){let u=this._getHelpOption();u&&t.find(i=>u.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function $i(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let u,r="127.0.0.1",i="9229",D;return(D=t.match(/^(--inspect(-brk)?)$/))!==null?u=D[1]:(D=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(u=D[1],/^\d+$/.test(D[3])?i=D[3]:r=D[3]):(D=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(u=D[1],r=D[3],i=D[4]),u&&i!=="0"?`${u}=${r}:${parseInt(i)+1}`:t})}ki.Command=Dr});var Ui=b(Be=>{var{Argument:Pi}=Pt(),{Command:sr}=Ni(),{CommanderError:m2,InvalidArgumentError:Mi}=nt(),{Help:g2}=Zu(),{Option:ji}=ur();Be.program=new sr;Be.createCommand=e=>new sr(e);Be.createOption=(e,t)=>new ji(e,t);Be.createArgument=(e,t)=>new Pi(e,t);Be.Command=sr;Be.Option=ji;Be.Argument=Pi;Be.Help=g2;Be.CommanderError=m2;Be.InvalidArgumentError=Mi;Be.InvalidOptionArgumentError=Mi});var Hi=b((gf,Vi)=>{"use strict";var Ue=e=>e!==null&&typeof e=="object"&&typeof e.pipe=="function";Ue.writable=e=>Ue(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object";Ue.readable=e=>Ue(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object";Ue.duplex=e=>Ue.writable(e)&&Ue.readable(e);Ue.transform=e=>Ue.duplex(e)&&typeof e._transform=="function";Vi.exports=Ue});var Xi=b((v,zi)=>{v=zi.exports=$;var V;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?V=function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:V=function(){};v.SEMVER_SPEC_VERSION="2.0.0";var it=256,Mt=Number.MAX_SAFE_INTEGER||9007199254740991,or=16,b2=it-6,O0=v.re=[],q=v.safeRe=[],E=v.src=[],f=v.tokens={},Ki=0;function N(e){f[e]=Ki++}var cr="[a-zA-Z0-9-]",ar=[["\\s",1],["\\d",it],[cr,b2]];function st(e){for(var t=0;t<ar.length;t++){var u=ar[t][0],r=ar[t][1];e=e.split(u+"*").join(u+"{0,"+r+"}").split(u+"+").join(u+"{1,"+r+"}")}return e}N("NUMERICIDENTIFIER");E[f.NUMERICIDENTIFIER]="0|[1-9]\\d*";N("NUMERICIDENTIFIERLOOSE");E[f.NUMERICIDENTIFIERLOOSE]="\\d+";N("NONNUMERICIDENTIFIER");E[f.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-]"+cr+"*";N("MAINVERSION");E[f.MAINVERSION]="("+E[f.NUMERICIDENTIFIER]+")\\.("+E[f.NUMERICIDENTIFIER]+")\\.("+E[f.NUMERICIDENTIFIER]+")";N("MAINVERSIONLOOSE");E[f.MAINVERSIONLOOSE]="("+E[f.NUMERICIDENTIFIERLOOSE]+")\\.("+E[f.NUMERICIDENTIFIERLOOSE]+")\\.("+E[f.NUMERICIDENTIFIERLOOSE]+")";N("PRERELEASEIDENTIFIER");E[f.PRERELEASEIDENTIFIER]="(?:"+E[f.NUMERICIDENTIFIER]+"|"+E[f.NONNUMERICIDENTIFIER]+")";N("PRERELEASEIDENTIFIERLOOSE");E[f.PRERELEASEIDENTIFIERLOOSE]="(?:"+E[f.NUMERICIDENTIFIERLOOSE]+"|"+E[f.NONNUMERICIDENTIFIER]+")";N("PRERELEASE");E[f.PRERELEASE]="(?:-("+E[f.PRERELEASEIDENTIFIER]+"(?:\\."+E[f.PRERELEASEIDENTIFIER]+")*))";N("PRERELEASELOOSE");E[f.PRERELEASELOOSE]="(?:-?("+E[f.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+E[f.PRERELEASEIDENTIFIERLOOSE]+")*))";N("BUILDIDENTIFIER");E[f.BUILDIDENTIFIER]=cr+"+";N("BUILD");E[f.BUILD]="(?:\\+("+E[f.BUILDIDENTIFIER]+"(?:\\."+E[f.BUILDIDENTIFIER]+")*))";N("FULL");N("FULLPLAIN");E[f.FULLPLAIN]="v?"+E[f.MAINVERSION]+E[f.PRERELEASE]+"?"+E[f.BUILD]+"?";E[f.FULL]="^"+E[f.FULLPLAIN]+"$";N("LOOSEPLAIN");E[f.LOOSEPLAIN]="[v=\\s]*"+E[f.MAINVERSIONLOOSE]+E[f.PRERELEASELOOSE]+"?"+E[f.BUILD]+"?";N("LOOSE");E[f.LOOSE]="^"+E[f.LOOSEPLAIN]+"$";N("GTLT");E[f.GTLT]="((?:<|>)?=?)";N("XRANGEIDENTIFIERLOOSE");E[f.XRANGEIDENTIFIERLOOSE]=E[f.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";N("XRANGEIDENTIFIER");E[f.XRANGEIDENTIFIER]=E[f.NUMERICIDENTIFIER]+"|x|X|\\*";N("XRANGEPLAIN");E[f.XRANGEPLAIN]="[v=\\s]*("+E[f.XRANGEIDENTIFIER]+")(?:\\.("+E[f.XRANGEIDENTIFIER]+")(?:\\.("+E[f.XRANGEIDENTIFIER]+")(?:"+E[f.PRERELEASE]+")?"+E[f.BUILD]+"?)?)?";N("XRANGEPLAINLOOSE");E[f.XRANGEPLAINLOOSE]="[v=\\s]*("+E[f.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+E[f.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+E[f.XRANGEIDENTIFIERLOOSE]+")(?:"+E[f.PRERELEASELOOSE]+")?"+E[f.BUILD]+"?)?)?";N("XRANGE");E[f.XRANGE]="^"+E[f.GTLT]+"\\s*"+E[f.XRANGEPLAIN]+"$";N("XRANGELOOSE");E[f.XRANGELOOSE]="^"+E[f.GTLT]+"\\s*"+E[f.XRANGEPLAINLOOSE]+"$";N("COERCE");E[f.COERCE]="(^|[^\\d])(\\d{1,"+or+"})(?:\\.(\\d{1,"+or+"}))?(?:\\.(\\d{1,"+or+"}))?(?:$|[^\\d])";N("COERCERTL");O0[f.COERCERTL]=new RegExp(E[f.COERCE],"g");q[f.COERCERTL]=new RegExp(st(E[f.COERCE]),"g");N("LONETILDE");E[f.LONETILDE]="(?:~>?)";N("TILDETRIM");E[f.TILDETRIM]="(\\s*)"+E[f.LONETILDE]+"\\s+";O0[f.TILDETRIM]=new RegExp(E[f.TILDETRIM],"g");q[f.TILDETRIM]=new RegExp(st(E[f.TILDETRIM]),"g");var B2="$1~";N("TILDE");E[f.TILDE]="^"+E[f.LONETILDE]+E[f.XRANGEPLAIN]+"$";N("TILDELOOSE");E[f.TILDELOOSE]="^"+E[f.LONETILDE]+E[f.XRANGEPLAINLOOSE]+"$";N("LONECARET");E[f.LONECARET]="(?:\\^)";N("CARETTRIM");E[f.CARETTRIM]="(\\s*)"+E[f.LONECARET]+"\\s+";O0[f.CARETTRIM]=new RegExp(E[f.CARETTRIM],"g");q[f.CARETTRIM]=new RegExp(st(E[f.CARETTRIM]),"g");var A2="$1^";N("CARET");E[f.CARET]="^"+E[f.LONECARET]+E[f.XRANGEPLAIN]+"$";N("CARETLOOSE");E[f.CARETLOOSE]="^"+E[f.LONECARET]+E[f.XRANGEPLAINLOOSE]+"$";N("COMPARATORLOOSE");E[f.COMPARATORLOOSE]="^"+E[f.GTLT]+"\\s*("+E[f.LOOSEPLAIN]+")$|^$";N("COMPARATOR");E[f.COMPARATOR]="^"+E[f.GTLT]+"\\s*("+E[f.FULLPLAIN]+")$|^$";N("COMPARATORTRIM");E[f.COMPARATORTRIM]="(\\s*)"+E[f.GTLT]+"\\s*("+E[f.LOOSEPLAIN]+"|"+E[f.XRANGEPLAIN]+")";O0[f.COMPARATORTRIM]=new RegExp(E[f.COMPARATORTRIM],"g");q[f.COMPARATORTRIM]=new RegExp(st(E[f.COMPARATORTRIM]),"g");var y2="$1$2$3";N("HYPHENRANGE");E[f.HYPHENRANGE]="^\\s*("+E[f.XRANGEPLAIN]+")\\s+-\\s+("+E[f.XRANGEPLAIN]+")\\s*$";N("HYPHENRANGELOOSE");E[f.HYPHENRANGELOOSE]="^\\s*("+E[f.XRANGEPLAINLOOSE]+")\\s+-\\s+("+E[f.XRANGEPLAINLOOSE]+")\\s*$";N("STAR");E[f.STAR]="(<|>)?=?\\s*\\*";for(qe=0;qe<Ki;qe++)V(qe,E[qe]),O0[qe]||(O0[qe]=new RegExp(E[qe]),q[qe]=new RegExp(st(E[qe])));var qe;v.parse=E0;function E0(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof $)return e;if(typeof e!="string"||e.length>it)return null;var u=t.loose?q[f.LOOSE]:q[f.FULL];if(!u.test(e))return null;try{return new $(e,t)}catch{return null}}v.valid=w2;function w2(e,t){var u=E0(e,t);return u?u.version:null}v.clean=_2;function _2(e,t){var u=E0(e.trim().replace(/^[=v]+/,""),t);return u?u.version:null}v.SemVer=$;function $(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof $){if(e.loose===t.loose)return e;e=e.version}else if(typeof e!="string")throw new TypeError("Invalid Version: "+e);if(e.length>it)throw new TypeError("version is longer than "+it+" characters");if(!(this instanceof $))return new $(e,t);V("SemVer",e,t),this.options=t,this.loose=!!t.loose;var u=e.trim().match(t.loose?q[f.LOOSE]:q[f.FULL]);if(!u)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+u[1],this.minor=+u[2],this.patch=+u[3],this.major>Mt||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Mt||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Mt||this.patch<0)throw new TypeError("Invalid patch version");u[4]?this.prerelease=u[4].split(".").map(function(r){if(/^[0-9]+$/.test(r)){var i=+r;if(i>=0&&i<Mt)return i}return r}):this.prerelease=[],this.build=u[5]?u[5].split("."):[],this.format()}$.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version};$.prototype.toString=function(){return this.version};$.prototype.compare=function(e){return V("SemVer.compare",this.version,this.options,e),e instanceof $||(e=new $(e,this.options)),this.compareMain(e)||this.comparePre(e)};$.prototype.compareMain=function(e){return e instanceof $||(e=new $(e,this.options)),F0(this.major,e.major)||F0(this.minor,e.minor)||F0(this.patch,e.patch)};$.prototype.comparePre=function(e){if(e instanceof $||(e=new $(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var u=this.prerelease[t],r=e.prerelease[t];if(V("prerelease compare",t,u,r),u===void 0&&r===void 0)return 0;if(r===void 0)return 1;if(u===void 0)return-1;if(u===r)continue;return F0(u,r)}while(++t)};$.prototype.compareBuild=function(e){e instanceof $||(e=new $(e,this.options));var t=0;do{var u=this.build[t],r=e.build[t];if(V("prerelease compare",t,u,r),u===void 0&&r===void 0)return 0;if(r===void 0)return 1;if(u===void 0)return-1;if(u===r)continue;return F0(u,r)}while(++t)};$.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",t),this.inc("pre",t);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var u=this.prerelease.length;--u>=0;)typeof this.prerelease[u]=="number"&&(this.prerelease[u]++,u=-2);u===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this};v.inc=v2;function v2(e,t,u,r){typeof u=="string"&&(r=u,u=void 0);try{return new $(e,u).inc(t,r).version}catch{return null}}v.diff=S2;function S2(e,t){if(xr(e,t))return null;var u=E0(e),r=E0(t),i="";if(u.prerelease.length||r.prerelease.length){i="pre";var D="prerelease"}for(var n in u)if((n==="major"||n==="minor"||n==="patch")&&u[n]!==r[n])return i+n;return D}v.compareIdentifiers=F0;var Gi=/^[0-9]+$/;function F0(e,t){var u=Gi.test(e),r=Gi.test(t);return u&&r&&(e=+e,t=+t),e===t?0:u&&!r?-1:r&&!u?1:e<t?-1:1}v.rcompareIdentifiers=O2;function O2(e,t){return F0(t,e)}v.major=T2;function T2(e,t){return new $(e,t).major}v.minor=I2;function I2(e,t){return new $(e,t).minor}v.patch=R2;function R2(e,t){return new $(e,t).patch}v.compare=Je;function Je(e,t,u){return new $(e,u).compare(new $(t,u))}v.compareLoose=L2;function L2(e,t){return Je(e,t,!0)}v.compareBuild=$2;function $2(e,t,u){var r=new $(e,u),i=new $(t,u);return r.compare(i)||r.compareBuild(i)}v.rcompare=k2;function k2(e,t,u){return Je(t,e,u)}v.sort=N2;function N2(e,t){return e.sort(function(u,r){return v.compareBuild(u,r,t)})}v.rsort=P2;function P2(e,t){return e.sort(function(u,r){return v.compareBuild(r,u,t)})}v.gt=Dt;function Dt(e,t,u){return Je(e,t,u)>0}v.lt=jt;function jt(e,t,u){return Je(e,t,u)<0}v.eq=xr;function xr(e,t,u){return Je(e,t,u)===0}v.neq=Yi;function Yi(e,t,u){return Je(e,t,u)!==0}v.gte=lr;function lr(e,t,u){return Je(e,t,u)>=0}v.lte=fr;function fr(e,t,u){return Je(e,t,u)<=0}v.cmp=Ut;function Ut(e,t,u,r){switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof u=="object"&&(u=u.version),e===u;case"!==":return typeof e=="object"&&(e=e.version),typeof u=="object"&&(u=u.version),e!==u;case"":case"=":case"==":return xr(e,u,r);case"!=":return Yi(e,u,r);case">":return Dt(e,u,r);case">=":return lr(e,u,r);case"<":return jt(e,u,r);case"<=":return fr(e,u,r);default:throw new TypeError("Invalid operator: "+t)}}v.Comparator=Ae;function Ae(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof Ae){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof Ae))return new Ae(e,t);e=e.trim().split(/\s+/).join(" "),V("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===T0?this.value="":this.value=this.operator+this.semver.version,V("comp",this)}var T0={};Ae.prototype.parse=function(e){var t=this.options.loose?q[f.COMPARATORLOOSE]:q[f.COMPARATOR],u=e.match(t);if(!u)throw new TypeError("Invalid comparator: "+e);this.operator=u[1]!==void 0?u[1]:"",this.operator==="="&&(this.operator=""),u[2]?this.semver=new $(u[2],this.options.loose):this.semver=T0};Ae.prototype.toString=function(){return this.value};Ae.prototype.test=function(e){if(V("Comparator.test",e,this.options.loose),this.semver===T0||e===T0)return!0;if(typeof e=="string")try{e=new $(e,this.options)}catch{return!1}return Ut(e,this.operator,this.semver,this.options)};Ae.prototype.intersects=function(e,t){if(!(e instanceof Ae))throw new TypeError("a Comparator is required");(!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1});var u;if(this.operator==="")return this.value===""?!0:(u=new J(e.value,t),qt(this.value,u,t));if(e.operator==="")return e.value===""?!0:(u=new J(this.value,t),qt(e.semver,u,t));var r=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),i=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),D=this.semver.version===e.semver.version,n=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),s=Ut(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),o=Ut(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return r||i||D&&n||s||o};v.Range=J;function J(e,t){if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),e instanceof J)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new J(e.raw,t);if(e instanceof Ae)return new J(e.value,t);if(!(this instanceof J))return new J(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(function(u){return this.parseRange(u.trim())},this).filter(function(u){return u.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+this.raw);this.format()}J.prototype.format=function(){return this.range=this.set.map(function(e){return e.join(" ").trim()}).join("||").trim(),this.range};J.prototype.toString=function(){return this.range};J.prototype.parseRange=function(e){var t=this.options.loose,u=t?q[f.HYPHENRANGELOOSE]:q[f.HYPHENRANGE];e=e.replace(u,Y2),V("hyphen replace",e),e=e.replace(q[f.COMPARATORTRIM],y2),V("comparator trim",e,q[f.COMPARATORTRIM]),e=e.replace(q[f.TILDETRIM],B2),e=e.replace(q[f.CARETTRIM],A2),e=e.split(/\s+/).join(" ");var r=t?q[f.COMPARATORLOOSE]:q[f.COMPARATOR],i=e.split(" ").map(function(D){return j2(D,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(i=i.filter(function(D){return!!D.match(r)})),i=i.map(function(D){return new Ae(D,this.options)},this),i};J.prototype.intersects=function(e,t){if(!(e instanceof J))throw new TypeError("a Range is required");return this.set.some(function(u){return Wi(u,t)&&e.set.some(function(r){return Wi(r,t)&&u.every(function(i){return r.every(function(D){return i.intersects(D,t)})})})})};function Wi(e,t){for(var u=!0,r=e.slice(),i=r.pop();u&&r.length;)u=r.every(function(D){return i.intersects(D,t)}),i=r.pop();return u}v.toComparators=M2;function M2(e,t){return new J(e,t).set.map(function(u){return u.map(function(r){return r.value}).join(" ").trim().split(" ")})}function j2(e,t){return V("comp",e,t),e=V2(e,t),V("caret",e),e=U2(e,t),V("tildes",e),e=G2(e,t),V("xrange",e),e=K2(e,t),V("stars",e),e}function de(e){return!e||e.toLowerCase()==="x"||e==="*"}function U2(e,t){return e.trim().split(/\s+/).map(function(u){return q2(u,t)}).join(" ")}function q2(e,t){var u=t.loose?q[f.TILDELOOSE]:q[f.TILDE];return e.replace(u,function(r,i,D,n,s){V("tilde",e,r,i,D,n,s);var o;return de(i)?o="":de(D)?o=">="+i+".0.0 <"+(+i+1)+".0.0":de(n)?o=">="+i+"."+D+".0 <"+i+"."+(+D+1)+".0":s?(V("replaceTilde pr",s),o=">="+i+"."+D+"."+n+"-"+s+" <"+i+"."+(+D+1)+".0"):o=">="+i+"."+D+"."+n+" <"+i+"."+(+D+1