claude-intern
Version:
AI-powered task automation tool for JIRA and Linear. Automatically implement tasks using Claude Code with git integration and PR creation.
25 lines • 352 kB
JavaScript
#!/usr/bin/env node
import{createRequire as DQ}from"node:module";var UQ=Object.create;var{getPrototypeOf:KQ,defineProperty:BZ,getOwnPropertyNames:FQ}=Object;var SQ=Object.prototype.hasOwnProperty;var z8=($,Z,G)=>{G=$!=null?UQ(KQ($)):{};let Y=Z||!$||!$.__esModule?BZ(G,"default",{value:$,enumerable:!0}):G;for(let Q of FQ($))if(!SQ.call(Y,Q))BZ(Y,Q,{get:()=>$[Q],enumerable:!0});return Y};var w=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var T0=DQ(import.meta.url);var HZ=w((hW,IQ)=>{IQ.exports={name:"dotenv",version:"16.6.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var KZ=w((gW,G1)=>{var _9=T0("fs"),X8=T0("path"),OQ=T0("os"),AQ=T0("crypto"),MQ=HZ(),j9=MQ.version,LQ=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function PQ($){let Z={},G=$.toString();G=G.replace(/\r\n?/mg,`
`);let Y;while((Y=LQ.exec(G))!=null){let Q=Y[1],z=Y[2]||"";z=z.trim();let W=z[0];if(z=z.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),W==='"')z=z.replace(/\\n/g,`
`),z=z.replace(/\\r/g,"\r");Z[Q]=z}return Z}function RQ($){$=$||{};let Z=UZ($);$.path=Z;let G=H0.configDotenv($);if(!G.parsed){let W=new Error(`MISSING_DATA: Cannot parse ${Z} for an unknown reason`);throw W.code="MISSING_DATA",W}let Y=qZ($).split(","),Q=Y.length,z;for(let W=0;W<Q;W++)try{let V=Y[W].trim(),_=TQ(G,V);z=H0.decrypt(_.ciphertext,_.key);break}catch(V){if(W+1>=Q)throw V}return H0.parse(z)}function wQ($){console.log(`[dotenv@${j9}][WARN] ${$}`)}function q6($){console.log(`[dotenv@${j9}][DEBUG] ${$}`)}function jZ($){console.log(`[dotenv@${j9}] ${$}`)}function qZ($){if($&&$.DOTENV_KEY&&$.DOTENV_KEY.length>0)return $.DOTENV_KEY;if(process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0)return process.env.DOTENV_KEY;return""}function TQ($,Z){let G;try{G=new URL(Z)}catch(V){if(V.code==="ERR_INVALID_URL"){let _=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw _.code="INVALID_DOTENV_KEY",_}throw V}let Y=G.password;if(!Y){let V=new Error("INVALID_DOTENV_KEY: Missing key part");throw V.code="INVALID_DOTENV_KEY",V}let Q=G.searchParams.get("environment");if(!Q){let V=new Error("INVALID_DOTENV_KEY: Missing environment part");throw V.code="INVALID_DOTENV_KEY",V}let z=`DOTENV_VAULT_${Q.toUpperCase()}`,W=$.parsed[z];if(!W){let V=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${z} in your .env.vault file.`);throw V.code="NOT_FOUND_DOTENV_ENVIRONMENT",V}return{ciphertext:W,key:Y}}function UZ($){let Z=null;if($&&$.path&&$.path.length>0)if(Array.isArray($.path)){for(let G of $.path)if(_9.existsSync(G))Z=G.endsWith(".vault")?G:`${G}.vault`}else Z=$.path.endsWith(".vault")?$.path:`${$.path}.vault`;else Z=X8.resolve(process.cwd(),".env.vault");if(_9.existsSync(Z))return Z;return null}function _Z($){return $[0]==="~"?X8.join(OQ.homedir(),$.slice(1)):$}function CQ($){let Z=Boolean($&&$.debug),G=$&&"quiet"in $?$.quiet:!0;if(Z||!G)jZ("Loading env from encrypted .env.vault");let Y=H0._parseVault($),Q=process.env;if($&&$.processEnv!=null)Q=$.processEnv;return H0.populate(Q,Y,$),{parsed:Y}}function bQ($){let Z=X8.resolve(process.cwd(),".env"),G="utf8",Y=Boolean($&&$.debug),Q=$&&"quiet"in $?$.quiet:!0;if($&&$.encoding)G=$.encoding;else if(Y)q6("No encoding is specified. UTF-8 is used by default");let z=[Z];if($&&$.path)if(!Array.isArray($.path))z=[_Z($.path)];else{z=[];for(let q of $.path)z.push(_Z(q))}let W,V={};for(let q of z)try{let K=H0.parse(_9.readFileSync(q,{encoding:G}));H0.populate(V,K,$)}catch(K){if(Y)q6(`Failed to load ${q} ${K.message}`);W=K}let _=process.env;if($&&$.processEnv!=null)_=$.processEnv;if(H0.populate(_,V,$),Y||!Q){let q=Object.keys(V).length,K=[];for(let O of z)try{let R=X8.relative(process.cwd(),O);K.push(R)}catch(R){if(Y)q6(`Failed to load ${O} ${R.message}`);W=R}jZ(`injecting env (${q}) from ${K.join(",")}`)}if(W)return{parsed:V,error:W};else return{parsed:V}}function EQ($){if(qZ($).length===0)return H0.configDotenv($);let Z=UZ($);if(!Z)return wQ(`You set DOTENV_KEY but you are missing a .env.vault file at ${Z}. Did you forget to build it?`),H0.configDotenv($);return H0._configVault($)}function NQ($,Z){let G=Buffer.from(Z.slice(-64),"hex"),Y=Buffer.from($,"base64"),Q=Y.subarray(0,12),z=Y.subarray(-16);Y=Y.subarray(12,-16);try{let W=AQ.createDecipheriv("aes-256-gcm",G,Q);return W.setAuthTag(z),`${W.update(Y)}${W.final()}`}catch(W){let V=W instanceof RangeError,_=W.message==="Invalid key length",q=W.message==="Unsupported state or unable to authenticate data";if(V||_){let K=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw K.code="INVALID_DOTENV_KEY",K}else if(q){let K=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw K.code="DECRYPTION_FAILED",K}else throw W}}function yQ($,Z,G={}){let Y=Boolean(G&&G.debug),Q=Boolean(G&&G.override);if(typeof Z!=="object"){let z=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw z.code="OBJECT_REQUIRED",z}for(let z of Object.keys(Z))if(Object.prototype.hasOwnProperty.call($,z)){if(Q===!0)$[z]=Z[z];if(Y)if(Q===!0)q6(`"${z}" is already defined and WAS overwritten`);else q6(`"${z}" is already defined and was NOT overwritten`)}else $[z]=Z[z]}var H0={configDotenv:bQ,_configVault:CQ,_parseVault:RQ,config:EQ,decrypt:NQ,parse:PQ,populate:yQ};gW.configDotenv=H0.configDotenv;gW._configVault=H0._configVault;gW._parseVault=H0._parseVault;gW.config=H0.config;gW.decrypt=H0.decrypt;gW.parse=H0.parse;gW.populate=H0.populate;G1.exports=H0});var U6=w((pQ)=>{class q9 extends Error{constructor($,Z,G){super(G);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class FZ extends q9{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}pQ.CommanderError=q9;pQ.InvalidArgumentError=FZ});var J8=w((lQ)=>{var{InvalidArgumentError:dQ}=U6();class SZ{constructor($,Z){switch(this.description=Z||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.concat($)}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,G)=>{if(!this.argChoices.includes(Z))throw new dQ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(Z,G);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function iQ($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}lQ.Argument=SZ;lQ.humanReadableArgName=iQ});var U9=w((nQ)=>{var{humanReadableArgName:rQ}=J8();class DZ{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands($){let Z=$.commands.filter((G)=>!G._hidden);if($._hasImplicitHelpCommand()){let[,G,Y]=$._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),Q=$.createCommand(G).helpOption(!1);if(Q.description($._helpCommandDescription),Y)Q.arguments(Y);Z.push(Q)}if(this.sortSubcommands)Z.sort((G,Y)=>{return G.name().localeCompare(Y.name())});return Z}compareOptions($,Z){let G=(Y)=>{return Y.short?Y.short.replace(/^-/,""):Y.long.replace(/^--/,"")};return G($).localeCompare(G(Z))}visibleOptions($){let Z=$.options.filter((Q)=>!Q.hidden),G=$._hasHelpOption&&$._helpShortFlag&&!$._findOption($._helpShortFlag),Y=$._hasHelpOption&&!$._findOption($._helpLongFlag);if(G||Y){let Q;if(!G)Q=$.createOption($._helpLongFlag,$._helpDescription);else if(!Y)Q=$.createOption($._helpShortFlag,$._helpDescription);else Q=$.createOption($._helpFlags,$._helpDescription);Z.push(Q)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let G=$.parent;G;G=G.parent){let Y=G.options.filter((Q)=>!Q.hidden);Z.push(...Y)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((G)=>rQ(G)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((G,Y)=>{return Math.max(G,Z.subcommandTerm(Y).length)},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((G,Y)=>{return Math.max(G,Z.optionTerm(Y).length)},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((G,Y)=>{return Math.max(G,Z.optionTerm(Y).length)},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((G,Y)=>{return Math.max(G,Z.argumentTerm(Y).length)},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let G="";for(let Y=$.parent;Y;Y=Y.parent)G=Y.name()+" "+G;return G+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((G)=>JSON.stringify(G)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0)return`${$.description} (${Z.join(", ")})`;return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((G)=>JSON.stringify(G)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let G=`(${Z.join(", ")})`;if($.description)return`${$.description} ${G}`;return G}return $.description}formatHelp($,Z){let G=Z.padWidth($,Z),Y=Z.helpWidth||80,Q=2,z=2;function W(H,D){if(D){let S=`${H.padEnd(G+2)}${D}`;return Z.wrap(S,Y-2,G+2)}return H}function V(H){return H.join(`
`).replace(/^/gm," ".repeat(2))}let _=[`Usage: ${Z.commandUsage($)}`,""],q=Z.commandDescription($);if(q.length>0)_=_.concat([Z.wrap(q,Y,0),""]);let K=Z.visibleArguments($).map((H)=>{return W(Z.argumentTerm(H),Z.argumentDescription(H))});if(K.length>0)_=_.concat(["Arguments:",V(K),""]);let O=Z.visibleOptions($).map((H)=>{return W(Z.optionTerm(H),Z.optionDescription(H))});if(O.length>0)_=_.concat(["Options:",V(O),""]);if(this.showGlobalOptions){let H=Z.visibleGlobalOptions($).map((D)=>{return W(Z.optionTerm(D),Z.optionDescription(D))});if(H.length>0)_=_.concat(["Global Options:",V(H),""])}let R=Z.visibleCommands($).map((H)=>{return W(Z.subcommandTerm(H),Z.subcommandDescription(H))});if(R.length>0)_=_.concat(["Commands:",V(R),""]);return _.join(`
`)}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}wrap($,Z,G,Y=40){let z=new RegExp(`[\\n][${" \\f\\t\\v - \uFEFF"}]+`);if($.match(z))return $;let W=Z-G;if(W<Y)return $;let V=$.slice(0,G),_=$.slice(G).replace(`\r
`,`
`),q=" ".repeat(G),O=`\\s${""}`,R=new RegExp(`
|.{1,${W-1}}([${O}]|$)|[^${O}]+?([${O}]|$)`,"g"),H=_.match(R)||[];return V+H.map((D,S)=>{if(D===`
`)return"";return(S>0?q:"")+D.trimEnd()}).join(`
`)}}nQ.Help=DZ});var K9=w(($z)=>{var{InvalidArgumentError:tQ}=U6();class IZ{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let G=AZ($);if(this.short=G.shortFlag,this.long=G.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($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,G)=>{if(!this.argChoices.includes(Z))throw new tQ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(Z,G);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return eQ(this.name().replace(/^no-/,""))}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class OZ{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,G)=>{if(this.positiveOptions.has(G))this.dualOptions.add(G)})}valueFromOption($,Z){let G=Z.attributeName();if(!this.dualOptions.has(G))return!0;let Y=this.negativeOptions.get(G).presetArg,Q=Y!==void 0?Y:!1;return Z.negate===(Q===$)}}function eQ($){return $.split("-").reduce((Z,G)=>{return Z+G[0].toUpperCase()+G.slice(1)})}function AZ($){let Z,G,Y=$.split(/[ |,]+/);if(Y.length>1&&!/^[[<]/.test(Y[1]))Z=Y.shift();if(G=Y.shift(),!Z&&/^-[^-]$/.test(G))Z=G,G=void 0;return{shortFlag:Z,longFlag:G}}$z.Option=IZ;$z.splitOptionFlags=AZ;$z.DualOptions=OZ});var MZ=w((Xz)=>{function Qz($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let G=[];for(let Y=0;Y<=$.length;Y++)G[Y]=[Y];for(let Y=0;Y<=Z.length;Y++)G[0][Y]=Y;for(let Y=1;Y<=Z.length;Y++)for(let Q=1;Q<=$.length;Q++){let z=1;if($[Q-1]===Z[Y-1])z=0;else z=1;if(G[Q][Y]=Math.min(G[Q-1][Y]+1,G[Q][Y-1]+1,G[Q-1][Y-1]+z),Q>1&&Y>1&&$[Q-1]===Z[Y-2]&&$[Q-2]===Z[Y-1])G[Q][Y]=Math.min(G[Q][Y],G[Q-2][Y-2]+1)}return G[$.length][Z.length]}function zz($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let G=$.startsWith("--");if(G)$=$.slice(2),Z=Z.map((W)=>W.slice(2));let Y=[],Q=3,z=0.4;if(Z.forEach((W)=>{if(W.length<=1)return;let V=Qz($,W),_=Math.max($.length,W.length);if((_-V)/_>z){if(V<Q)Q=V,Y=[W];else if(V===Q)Y.push(W)}}),Y.sort((W,V)=>W.localeCompare(V)),G)Y=Y.map((W)=>`--${W}`);if(Y.length>1)return`
(Did you mean one of ${Y.join(", ")}?)`;if(Y.length===1)return`
(Did you mean ${Y[0]}?)`;return""}Xz.suggestSimilar=zz});var TZ=w((qz)=>{var Wz=T0("events").EventEmitter,F9=T0("child_process"),Y1=T0("path"),S9=T0("fs"),e=T0("process"),{Argument:Vz,humanReadableArgName:Bz}=J8(),{CommanderError:D9}=U6(),{Help:Hz}=U9(),{Option:LZ,splitOptionFlags:_z,DualOptions:jz}=K9(),{suggestSimilar:PZ}=MZ();class I9 extends Wz{constructor($){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=$||"",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:(Z)=>e.stdout.write(Z),writeErr:(Z)=>e.stderr.write(Z),getOutHelpWidth:()=>e.stdout.isTTY?e.stdout.columns:void 0,getErrHelpWidth:()=>e.stderr.isTTY?e.stderr.columns:void 0,outputError:(Z,G)=>G(Z)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._hasHelpOption=$._hasHelpOption,this._helpFlags=$._helpFlags,this._helpDescription=$._helpDescription,this._helpShortFlag=$._helpShortFlag,this._helpLongFlag=$._helpLongFlag,this._helpCommandName=$._helpCommandName,this._helpCommandnameAndArgs=$._helpCommandnameAndArgs,this._helpCommandDescription=$._helpCommandDescription,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,G){let Y=Z,Q=G;if(typeof Y==="object"&&Y!==null)Q=Y,Y=null;Q=Q||{};let[,z,W]=$.match(/([^ ]+) *(.*)/),V=this.createCommand(z);if(Y)V.description(Y),V._executableHandler=!0;if(Q.isDefault)this._defaultCommandName=V._name;if(V._hidden=!!(Q.noHelp||Q.hidden),V._executableFile=Q.executableFile||null,W)V.arguments(W);if(this.commands.push(V),V.parent=this,V.copyInheritedSettings(this),Y)return this;return V}createCommand($){return new I9($)}createHelp(){return Object.assign(new Hz,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,Z){if(!$._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this.commands.push($),$.parent=this,this}createArgument($,Z){return new Vz($,Z)}argument($,Z,G,Y){let Q=this.createArgument($,Z);if(typeof G==="function")Q.default(Y).argParser(G);else Q.default(G);return this.addArgument(Q),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z&&Z.variadic)throw new Error(`only the last argument can be variadic '${Z.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}addHelpCommand($,Z){if($===!1)this._addImplicitHelpCommand=!1;else{if(this._addImplicitHelpCommand=!0,typeof $==="string")this._helpCommandName=$.split(" ")[0],this._helpCommandnameAndArgs=$;this._helpCommandDescription=Z||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===void 0)return this.commands.length&&!this._actionHandler&&!this._findCommand("help");return this._addImplicitHelpCommand}hook($,Z){let G=["preSubcommand","preAction","postAction"];if(!G.includes($))throw new Error(`Unexpected value for event passed to hook : '${$}'.
Expecting one of '${G.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,G){if(this._exitCallback)this._exitCallback(new D9($,Z,G));e.exit($)}action($){let Z=(G)=>{let Y=this.registeredArguments.length,Q=G.slice(0,Y);if(this._storeOptionsAsProperties)Q[Y]=this;else Q[Y]=this.opts();return Q.push(this),$.apply(this,Q)};return this._actionHandler=Z,this}createOption($,Z){return new LZ($,Z)}_callParseArg($,Z,G,Y){try{return $.parseArg(Z,G)}catch(Q){if(Q.code==="commander.invalidArgument"){let z=`${Y} ${Q.message}`;this.error(z,{exitCode:Q.exitCode,code:Q.code})}throw Q}}addOption($){let Z=$.name(),G=$.attributeName();if($.negate){let Q=$.long.replace(/^--no-/,"--");if(!this._findOption(Q))this.setOptionValueWithSource(G,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(G,$.defaultValue,"default");this.options.push($);let Y=(Q,z,W)=>{if(Q==null&&$.presetArg!==void 0)Q=$.presetArg;let V=this.getOptionValue(G);if(Q!==null&&$.parseArg)Q=this._callParseArg($,Q,V,z);else if(Q!==null&&$.variadic)Q=$._concatValue(Q,V);if(Q==null)if($.negate)Q=!1;else if($.isBoolean()||$.optional)Q=!0;else Q="";this.setOptionValueWithSource(G,Q,W)};if(this.on("option:"+Z,(Q)=>{let z=`error: option '${$.flags}' argument '${Q}' is invalid.`;Y(Q,z,"cli")}),$.envVar)this.on("optionEnv:"+Z,(Q)=>{let z=`error: option '${$.flags}' value '${Q}' from env '${$.envVar}' is invalid.`;Y(Q,z,"env")});return this}_optionEx($,Z,G,Y,Q){if(typeof Z==="object"&&Z instanceof LZ)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption(Z,G);if(z.makeOptionMandatory(!!$.mandatory),typeof Y==="function")z.default(Q).argParser(Y);else if(Y instanceof RegExp){let W=Y;Y=(V,_)=>{let q=W.exec(V);return q?q[0]:_},z.default(Q).argParser(Y)}else z.default(Y);return this.addOption(z)}option($,Z,G,Y){return this._optionEx({},$,Z,G,Y)}requiredOption($,Z,G,Y){return this._optionEx({mandatory:!0},$,Z,G,Y)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){if(this._passThroughOptions=!!$,!!this.parent&&$&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties($=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,G){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=G,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((G)=>{if(G.getOptionValueSource($)!==void 0)Z=G.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw new Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0){if($=e.argv,e.versions&&e.versions.electron)Z.from="electron"}this.rawArgs=$.slice();let G;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],G=$.slice(2);break;case"electron":if(e.defaultApp)this._scriptPath=$[1],G=$.slice(2);else G=$.slice(1);break;case"user":G=$.slice(0);break;default:throw new Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",G}parse($,Z){let G=this._prepareUserArgs($,Z);return this._parseCommand([],G),this}async parseAsync($,Z){let G=this._prepareUserArgs($,Z);return await this._parseCommand([],G),this}_executeSubCommand($,Z){Z=Z.slice();let G=!1,Y=[".js",".ts",".tsx",".mjs",".cjs"];function Q(q,K){let O=Y1.resolve(q,K);if(S9.existsSync(O))return O;if(Y.includes(Y1.extname(K)))return;let R=Y.find((H)=>S9.existsSync(`${O}${H}`));if(R)return`${O}${R}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=$._executableFile||`${this._name}-${$._name}`,W=this._executableDir||"";if(this._scriptPath){let q;try{q=S9.realpathSync(this._scriptPath)}catch(K){q=this._scriptPath}W=Y1.resolve(Y1.dirname(q),W)}if(W){let q=Q(W,z);if(!q&&!$._executableFile&&this._scriptPath){let K=Y1.basename(this._scriptPath,Y1.extname(this._scriptPath));if(K!==this._name)q=Q(W,`${K}-${$._name}`)}z=q||z}G=Y.includes(Y1.extname(z));let V;if(e.platform!=="win32")if(G)Z.unshift(z),Z=wZ(e.execArgv).concat(Z),V=F9.spawn(e.argv[0],Z,{stdio:"inherit"});else V=F9.spawn(z,Z,{stdio:"inherit"});else Z.unshift(z),Z=wZ(e.execArgv).concat(Z),V=F9.spawn(e.execPath,Z,{stdio:"inherit"});if(!V.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((K)=>{e.on(K,()=>{if(V.killed===!1&&V.exitCode===null)V.kill(K)})});let _=this._exitCallback;if(!_)V.on("close",e.exit.bind(e));else V.on("close",()=>{_(new D9(e.exitCode||0,"commander.executeSubCommandAsync","(close)"))});V.on("error",(q)=>{if(q.code==="ENOENT"){let K=W?`searched for local subcommand relative to directory '${W}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",O=`'${z}' does not exist
- if '${$._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
- ${K}`;throw new Error(O)}else if(q.code==="EACCES")throw new Error(`'${z}' not executable`);if(!_)e.exit(1);else{let K=new D9(1,"commander.executeSubCommandAsync","(error)");K.nestedError=q,_(K)}}),this.runningCommand=V}_dispatchSubcommand($,Z,G){let Y=this._findCommand($);if(!Y)this.help({error:!0});let Q;return Q=this._chainOrCallSubCommandHook(Q,Y,"preSubcommand"),Q=this._chainOrCall(Q,()=>{if(Y._executableHandler)this._executeSubCommand(Y,Z.concat(G));else return Y._parseCommand(Z,G)}),Q}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(G,Y,Q)=>{let z=Y;if(Y!==null&&G.parseArg){let W=`error: command-argument value '${Y}' is invalid for argument '${G.name()}'.`;z=this._callParseArg(G,Y,Q,W)}return z};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((G,Y)=>{let Q=G.defaultValue;if(G.variadic){if(Y<this.args.length){if(Q=this.args.slice(Y),G.parseArg)Q=Q.reduce((z,W)=>{return $(G,W,z)},G.defaultValue)}else if(Q===void 0)Q=[]}else if(Y<this.args.length){if(Q=this.args[Y],G.parseArg)Q=$(G,Q,G.defaultValue)}Z[Y]=Q}),this.processedArgs=Z}_chainOrCall($,Z){if($&&$.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let G=$,Y=[];if(this._getCommandAndAncestors().reverse().filter((Q)=>Q._lifeCycleHooks[Z]!==void 0).forEach((Q)=>{Q._lifeCycleHooks[Z].forEach((z)=>{Y.push({hookedCommand:Q,callback:z})})}),Z==="postAction")Y.reverse();return Y.forEach((Q)=>{G=this._chainOrCall(G,()=>{return Q.callback(Q.hookedCommand,this)})}),G}_chainOrCallSubCommandHook($,Z,G){let Y=$;if(this._lifeCycleHooks[G]!==void 0)this._lifeCycleHooks[G].forEach((Q)=>{Y=this._chainOrCall(Y,()=>{return Q(this,Z)})});return Y}_parseCommand($,Z){let G=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(G.operands),Z=G.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._hasImplicitHelpCommand()&&$[0]===this._helpCommandName)return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return RZ(this,Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});RZ(this,G.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let Y=()=>{if(G.unknown.length>0)this.unknownOption(G.unknown[0])},Q=`command:${this.name()}`;if(this._actionHandler){Y(),this._processArguments();let z;if(z=this._chainOrCallHooks(z,"preAction"),z=this._chainOrCall(z,()=>this._actionHandler(this.processedArgs)),this.parent)z=this._chainOrCall(z,()=>{this.parent.emit(Q,$,Z)});return z=this._chainOrCallHooks(z,"postAction"),z}if(this.parent&&this.parent.listenerCount(Q))Y(),this._processArguments(),this.parent.emit(Q,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);else if(this.commands.length)this.unknownCommand();else Y(),this._processArguments()}else if(this.commands.length)Y(),this.help({error:!0});else Y(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((G)=>{let Y=G.attributeName();if(this.getOptionValue(Y)===void 0)return!1;return this.getOptionValueSource(Y)!=="default"});$.filter((G)=>G.conflictsWith.length>0).forEach((G)=>{let Y=$.find((Q)=>G.conflictsWith.includes(Q.attributeName()));if(Y)this._conflictingOption(G,Y)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],G=[],Y=Z,Q=$.slice();function z(V){return V.length>1&&V[0]==="-"}let W=null;while(Q.length){let V=Q.shift();if(V==="--"){if(Y===G)Y.push(V);Y.push(...Q);break}if(W&&!z(V)){this.emit(`option:${W.name()}`,V);continue}if(W=null,z(V)){let _=this._findOption(V);if(_){if(_.required){let q=Q.shift();if(q===void 0)this.optionMissingArgument(_);this.emit(`option:${_.name()}`,q)}else if(_.optional){let q=null;if(Q.length>0&&!z(Q[0]))q=Q.shift();this.emit(`option:${_.name()}`,q)}else this.emit(`option:${_.name()}`);W=_.variadic?_:null;continue}}if(V.length>2&&V[0]==="-"&&V[1]!=="-"){let _=this._findOption(`-${V[1]}`);if(_){if(_.required||_.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${_.name()}`,V.slice(2));else this.emit(`option:${_.name()}`),Q.unshift(`-${V.slice(2)}`);continue}}if(/^--[^=]+=/.test(V)){let _=V.indexOf("="),q=this._findOption(V.slice(0,_));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,V.slice(_+1));continue}}if(z(V))Y=G;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&G.length===0){if(this._findCommand(V)){if(Z.push(V),Q.length>0)G.push(...Q);break}else if(V===this._helpCommandName&&this._hasImplicitHelpCommand()){if(Z.push(V),Q.length>0)Z.push(...Q);break}else if(this._defaultCommandName){if(G.push(V),Q.length>0)G.push(...Q);break}}if(this._passThroughOptions){if(Y.push(V),Q.length>0)Y.push(...Q);break}Y.push(V)}return{operands:Z,unknown:G}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let G=0;G<Z;G++){let Y=this.options[G].attributeName();$[Y]=Y===this._versionOptionName?this._version:this[Y]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0});let G=Z||{},Y=G.exitCode||1,Q=G.code||"commander.error";this._exit(Y,Q,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in e.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,e.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new jz(this.options),Z=(G)=>{return this.getOptionValue(G)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(G))};this.options.filter((G)=>G.implied!==void 0&&Z(G.attributeName())&&$.valueFromOption(this.getOptionValue(G.attributeName()),G)).forEach((G)=>{Object.keys(G.implied).filter((Y)=>!Z(Y)).forEach((Y)=>{this.setOptionValueWithSource(Y,G.implied[Y],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let G=(z)=>{let W=z.attributeName(),V=this.getOptionValue(W),_=this.options.find((K)=>K.negate&&W===K.attributeName()),q=this.options.find((K)=>!K.negate&&W===K.attributeName());if(_&&(_.presetArg===void 0&&V===!1||_.presetArg!==void 0&&V===_.presetArg))return _;return q||z},Y=(z)=>{let W=G(z),V=W.attributeName();if(this.getOptionValueSource(V)==="env")return`environment variable '${W.envVar}'`;return`option '${W.flags}'`},Q=`error: ${Y($)} cannot be used with ${Y(Z)}`;this.error(Q,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Y=[],Q=this;do{let z=Q.createHelp().visibleOptions(Q).filter((W)=>W.long).map((W)=>W.long);Y=Y.concat(z),Q=Q.parent}while(Q&&!Q._enablePositionalOptions);Z=PZ($,Y)}let G=`error: unknown option '${$}'${Z}`;this.error(G,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,G=Z===1?"":"s",Q=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${G} but got ${$.length}.`;this.error(Q,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let Y=[];this.createHelp().visibleCommands(this).forEach((Q)=>{if(Y.push(Q.name()),Q.alias())Y.push(Q.alias())}),Z=PZ($,Y)}let G=`error: unknown command '${$}'${Z}`;this.error(G,{code:"commander.unknownCommand"})}version($,Z,G){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",G=G||"output the version number";let Y=this.createOption(Z,G);return this._versionOptionName=Y.attributeName(),this.options.push(Y),this.on("option:"+Y.name(),()=>{this._outputConfiguration.writeOut(`${$}
`),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw new Error("Command alias can't be the same as its name");return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((G)=>{return Bz(G)});return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=Y1.basename($,Y1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp();if(Z.helpWidth===void 0)Z.helpWidth=$&&$.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return Z.formatHelp(this,Z)}_getHelpContext($){$=$||{};let Z={error:!!$.error},G;if(Z.error)G=(Y)=>this._outputConfiguration.writeErr(Y);else G=(Y)=>this._outputConfiguration.writeOut(Y);return Z.write=$.write||G,Z.command=this,Z}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let G=this._getHelpContext($);this._getCommandAndAncestors().reverse().forEach((Q)=>Q.emit("beforeAllHelp",G)),this.emit("beforeHelp",G);let Y=this.helpInformation(G);if(Z){if(Y=Z(Y),typeof Y!=="string"&&!Buffer.isBuffer(Y))throw new Error("outputHelp callback must return a string or a Buffer")}if(G.write(Y),this._helpLongFlag)this.emit(this._helpLongFlag);this.emit("afterHelp",G),this._getCommandAndAncestors().forEach((Q)=>Q.emit("afterAllHelp",G))}helpOption($,Z){if(typeof $==="boolean")return this._hasHelpOption=$,this;this._helpFlags=$||this._helpFlags,this._helpDescription=Z||this._helpDescription;let G=_z(this._helpFlags);return this._helpShortFlag=G.shortFlag,this._helpLongFlag=G.longFlag,this}help($){this.outputHelp($);let Z=e.exitCode||0;if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let G=["beforeAll","before","after","afterAll"];if(!G.includes($))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${G.join("', '")}'`);let Y=`${$}Help`;return this.on(Y,(Q)=>{let z;if(typeof Z==="function")z=Z({error:Q.error,command:Q.command});else z=Z;if(z)Q.write(`${z}
`)}),this}}function RZ($,Z){if($._hasHelpOption&&Z.find((Y)=>Y===$._helpLongFlag||Y===$._helpShortFlag))$.outputHelp(),$._exit(0,"commander.helpDisplayed","(outputHelp)")}function wZ($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let G,Y="127.0.0.1",Q="9229",z;if((z=Z.match(/^(--inspect(-brk)?)$/))!==null)G=z[1];else if((z=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(G=z[1],/^\d+$/.test(z[3]))Q=z[3];else Y=z[3];else if((z=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)G=z[1],Y=z[3],Q=z[4];if(G&&Q!=="0")return`${G}=${Y}:${parseInt(Q)+1}`;return Z})}qz.Command=I9});var NZ=w((v0,EZ)=>{var{Argument:Kz}=J8(),{Command:CZ}=TZ(),{CommanderError:Fz,InvalidArgumentError:bZ}=U6(),{Help:Sz}=U9(),{Option:Dz}=K9();v0=EZ.exports=new CZ;v0.program=v0;v0.Command=CZ;v0.Option=Dz;v0.Argument=Kz;v0.Help=Sz;v0.CommanderError=Fz;v0.InvalidArgumentError=bZ;v0.InvalidOptionArgumentError=bZ});var p1=w((VV,kZ)=>{kZ.exports=b1;b1.CAPTURING_PHASE=1;b1.AT_TARGET=2;b1.BUBBLING_PHASE=3;function b1($,Z){if(this.type="",this.target=null,this.currentTarget=null,this.eventPhase=b1.AT_TARGET,this.bubbles=!1,this.cancelable=!1,this.isTrusted=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this._propagationStopped=!1,this._immediatePropagationStopped=!1,this._initialized=!0,this._dispatching=!1,$)this.type=$;if(Z)for(var G in Z)this[G]=Z[G]}b1.prototype=Object.create(Object.prototype,{constructor:{value:b1},stopPropagation:{value:function $(){this._propagationStopped=!0}},stopImmediatePropagation:{value:function $(){this._propagationStopped=!0,this._immediatePropagationStopped=!0}},preventDefault:{value:function $(){if(this.cancelable)this.defaultPrevented=!0}},initEvent:{value:function $(Z,G,Y){if(this._initialized=!0,this._dispatching)return;this._propagationStopped=!1,this._immediatePropagationStopped=!1,this.defaultPrevented=!1,this.isTrusted=!1,this.target=null,this.type=Z,this.bubbles=G,this.cancelable=Y}}})});var A9=w((BV,fZ)=>{var xZ=p1();fZ.exports=O9;function O9(){xZ.call(this),this.view=null,this.detail=0}O9.prototype=Object.create(xZ.prototype,{constructor:{value:O9},initUIEvent:{value:function($,Z,G,Y,Q){this.initEvent($,Z,G),this.view=Y,this.detail=Q}}})});var L9=w((HV,gZ)=>{var hZ=A9();gZ.exports=M9;function M9(){hZ.call(this),this.screenX=this.screenY=this.clientX=this.clientY=0,this.ctrlKey=this.altKey=this.shiftKey=this.metaKey=!1,this.button=0,this.buttons=1,this.relatedTarget=null}M9.prototype=Object.create(hZ.prototype,{constructor:{value:M9},initMouseEvent:{value:function($,Z,G,Y,Q,z,W,V,_,q,K,O,R,H,D){switch(this.initEvent($,Z,G,Y,Q),this.screenX=z,this.screenY=W,this.clientX=V,this.clientY=_,this.ctrlKey=q,this.altKey=K,this.shiftKey=O,this.metaKey=R,this.button=H,H){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2;break;default:this.buttons=0;break}this.relatedTarget=D}},getModifierState:{value:function($){switch($){case"Alt":return this.altKey;case"Control":return this.ctrlKey;case"Shift":return this.shiftKey;case"Meta":return this.metaKey;default:return!1}}}})});var H8=w((_V,mZ)=>{mZ.exports=B8;var Mz=1,Lz=3,Pz=4,Rz=5,wz=7,Tz=8,Cz=9,bz=11,Ez=12,Nz=13,yz=14,kz=15,xz=17,fz=18,hz=19,gz=20,vz=21,mz=22,pz=23,uz=24,cz=25,dz=[null,"INDEX_SIZE_ERR",null,"HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR",null,"NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR",null,"TYPE_MISMATCH_ERR","SECURITY_ERR","NETWORK_ERR","ABORT_ERR","URL_MISMATCH_ERR","QUOTA_EXCEEDED_ERR","TIMEOUT_ERR","INVALID_NODE_TYPE_ERR","DATA_CLONE_ERR"],iz=[null,"INDEX_SIZE_ERR (1): the index is not in the allowed range",null,"HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model","WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required","INVALID_CHARACTER_ERR (5): the string contains invalid characters",null,"NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified","NOT_FOUND_ERR (8): the object can not be found here","NOT_SUPPORTED_ERR (9): this operation is not supported","INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute","INVALID_STATE_ERR (11): the object is in an invalid state","SYNTAX_ERR (12): the string did not match the expected pattern","INVALID_MODIFICATION_ERR (13): the object can not be modified in this way","NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML","INVALID_ACCESS_ERR (15): the object does not support the operation or argument",null,"TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type","SECURITY_ERR (18): the operation is insecure","NETWORK_ERR (19): a network error occurred","ABORT_ERR (20): the user aborted an operation","URL_MISMATCH_ERR (21): the given URL does not match another URL","QUOTA_EXCEEDED_ERR (22): the quota has been exceeded","TIMEOUT_ERR (23): a timeout occurred","INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation","DATA_CLONE_ERR (25): the object can not be cloned."],vZ={INDEX_SIZE_ERR:Mz,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:Lz,WRONG_DOCUMENT_ERR:Pz,INVALID_CHARACTER_ERR:Rz,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:wz,NOT_FOUND_ERR:Tz,NOT_SUPPORTED_ERR:Cz,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:bz,SYNTAX_ERR:Ez,INVALID_MODIFICATION_ERR:Nz,NAMESPACE_ERR:yz,INVALID_ACCESS_ERR:kz,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:xz,SECURITY_ERR:fz,NETWORK_ERR:hz,ABORT_ERR:gz,URL_MISMATCH_ERR:vz,QUOTA_EXCEEDED_ERR:mz,TIMEOUT_ERR:pz,INVALID_NODE_TYPE_ERR:uz,DATA_CLONE_ERR:cz};function B8($){Error.call(this),Error.captureStackTrace(this,this.constructor),this.code=$,this.message=iz[$],this.name=dz[$]}B8.prototype.__proto__=Error.prototype;for(F6 in vZ)V8={value:vZ[F6]},Object.defineProperty(B8,F6,V8),Object.defineProperty(B8.prototype,F6,V8);var V8,F6});var _8=w((lz)=>{lz.isApiWritable=!globalThis.__domino_frozen__});var X0=w((rz)=>{var z0=H8(),V0=z0,oz=_8().isApiWritable;rz.NAMESPACE={HTML:"http://www.w3.org/1999/xhtml",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink"};rz.IndexSizeError=function(){throw new z0(V0.INDEX_SIZE_ERR)};rz.HierarchyRequestError=function(){throw new z0(V0.HIERARCHY_REQUEST_ERR)};rz.WrongDocumentError=function(){throw new z0(V0.WRONG_DOCUMENT_ERR)};rz.InvalidCharacterError=function(){throw new z0(V0.INVALID_CHARACTER_ERR)};rz.NoModificationAllowedError=function(){throw new z0(V0.NO_MODIFICATION_ALLOWED_ERR)};rz.NotFoundError=function(){throw new z0(V0.NOT_FOUND_ERR)};rz.NotSupportedError=function(){throw new z0(V0.NOT_SUPPORTED_ERR)};rz.InvalidStateError=function(){throw new z0(V0.INVALID_STATE_ERR)};rz.SyntaxError=function(){throw new z0(V0.SYNTAX_ERR)};rz.InvalidModificationError=function(){throw new z0(V0.INVALID_MODIFICATION_ERR)};rz.NamespaceError=function(){throw new z0(V0.NAMESPACE_ERR)};rz.InvalidAccessError=function(){throw new z0(V0.INVALID_ACCESS_ERR)};rz.TypeMismatchError=function(){throw new z0(V0.TYPE_MISMATCH_ERR)};rz.SecurityError=function(){throw new z0(V0.SECURITY_ERR)};rz.NetworkError=function(){throw new z0(V0.NETWORK_ERR)};rz.AbortError=function(){throw new z0(V0.ABORT_ERR)};rz.UrlMismatchError=function(){throw new z0(V0.URL_MISMATCH_ERR)};rz.QuotaExceededError=function(){throw new z0(V0.QUOTA_EXCEEDED_ERR)};rz.TimeoutError=function(){throw new z0(V0.TIMEOUT_ERR)};rz.InvalidNodeTypeError=function(){throw new z0(V0.INVALID_NODE_TYPE_ERR)};rz.DataCloneError=function(){throw new z0(V0.DATA_CLONE_ERR)};rz.nyi=function(){throw new Error("NotYetImplemented")};rz.shouldOverride=function(){throw new Error("Abstract function; should be overriding in subclass.")};rz.assert=function($,Z){if(!$)throw new Error("Assertion failed: "+(Z||"")+`
`+new Error().stack)};rz.expose=function($,Z){for(var G in $)Object.defineProperty(Z.prototype,G,{value:$[G],writable:oz})};rz.merge=function($,Z){for(var G in Z)$[G]=Z[G]};rz.documentOrder=function($,Z){return 3-($.compareDocumentPosition(Z)&6)};rz.toASCIILowerCase=function($){return $.replace(/[A-Z]+/g,function(Z){return Z.toLowerCase()})};rz.toASCIIUpperCase=function($){return $.replace(/[a-z]+/g,function(Z){return Z.toUpperCase()})}});var P9=w((UV,uZ)=>{var E1=p1(),RX=L9(),wX=X0();uZ.exports=pZ;function pZ(){}pZ.prototype={addEventListener:function $(Z,G,Y){if(!G)return;if(Y===void 0)Y=!1;if(!this._listeners)this._listeners=Object.create(null);if(!this._listeners[Z])this._listeners[Z]=[];var Q=this._listeners[Z];for(var z=0,W=Q.length;z<W;z++){var V=Q[z];if(V.listener===G&&V.capture===Y)return}var _={listener:G,capture:Y};if(typeof G==="function")_.f=G;Q.push(_)},removeEventListener:function $(Z,G,Y){if(Y===void 0)Y=!1;if(this._listeners){var Q=this._listeners[Z];if(Q)for(var z=0,W=Q.length;z<W;z++){var V=Q[z];if(V.listener===G&&V.capture===Y){if(Q.length===1)this._listeners[Z]=void 0;else Q.splice(z,1);return}}}},dispatchEvent:function $(Z){return this._dispatchEvent(Z,!1)},_dispatchEvent:function $(Z,G){if(typeof G!=="boolean")G=!1;function Y(q,K){var{type:O,eventPhase:R}=K;if(K.currentTarget=q,R!==E1.CAPTURING_PHASE&&q._handlers&&q._handlers[O]){var H=q._handlers[O],D;if(typeof H==="function")D=H.call(K.currentTarget,K);else{var S=H.handleEvent;if(typeof S!=="function")throw new TypeError("handleEvent property of event handler object isnot a function.");D=S.call(H,K)}switch(K.type){case"mouseover":if(D===!0)K.preventDefault();break;case"beforeunload":default:if(D===!1)K.preventDefault();break}}var M=q._listeners&&q._listeners[O];if(!M)return;M=M.slice();for(var N=0,T=M.length;N<T;N++){if(K._immediatePropagationStopped)return;var a=M[N];if(R===E1.CAPTURING_PHASE&&!a.capture||R===E1.BUBBLING_PHASE&&a.capture)continue;if(a.f)a.f.call(K.currentTarget,K);else{var B0=a.lis