relaycode
Version:
A developer assistant that automates applying code changes from LLMs.
23 lines • 3.9 MB
JavaScript
#!/usr/bin/env node
'use strict';var HP=require('fs'),KE=require('path'),mee=require('process'),OPt=require('os'),tze=require('tty'),buffer=require('buffer'),Vbe=require('child_process'),url=require('url'),promises=require('timers/promises'),util=require('util'),crypto=require('crypto'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var HP__default=/*#__PURE__*/_interopDefault(HP);var KE__default=/*#__PURE__*/_interopDefault(KE);var mee__default=/*#__PURE__*/_interopDefault(mee);var OPt__default=/*#__PURE__*/_interopDefault(OPt);var tze__default=/*#__PURE__*/_interopDefault(tze);var Vbe__default=/*#__PURE__*/_interopDefault(Vbe);var pCt=Object.create;var VK=Object.defineProperty;var dCt=Object.getOwnPropertyDescriptor;var mCt=Object.getOwnPropertyNames;var gCt=Object.getPrototypeOf,hCt=Object.prototype.hasOwnProperty;var iBe=p=>{throw TypeError(p)};var yCt=(p,m,S)=>m in p?VK(p,m,{enumerable:true,configurable:true,writable:true,value:S}):p[m]=S;var To=(p=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(p,{get:(m,S)=>(typeof require<"u"?require:m)[S]}):p)(function(p){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+p+'" is not supported')});var Ys=(p,m)=>()=>(m||p((m={exports:{}}).exports,m),m.exports),vCt=(p,m)=>{for(var S in m)VK(p,S,{get:m[S],enumerable:true});},bCt=(p,m,S,w)=>{if(m&&typeof m=="object"||typeof m=="function")for(let I of mCt(m))!hCt.call(p,I)&&I!==S&&VK(p,I,{get:()=>m[I],enumerable:!(w=dCt(m,I))||w.enumerable});return p};var wJ=(p,m,S)=>(S=p!=null?pCt(gCt(p)):{},bCt(VK(S,"default",{value:p,enumerable:true}),p));var F4=(p,m,S)=>yCt(p,typeof m!="symbol"?m+"":m,S),pve=(p,m,S)=>m.has(p)||iBe("Cannot "+S);var Sl=(p,m,S)=>(pve(p,m,"read from private field"),S?S.call(p):m.get(p)),$E=(p,m,S)=>m.has(p)?iBe("Cannot add the same private member more than once"):m instanceof WeakSet?m.add(p):m.set(p,S),L4=(p,m,S,w)=>(pve(p,m,"write to private field"),m.set(p,S),S),dve=(p,m,S)=>(pve(p,m,"access private method"),S);var DJ=Ys(gve=>{var qK=class extends Error{constructor(m,S,w){super(w),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=S,this.exitCode=m,this.nestedError=void 0;}},mve=class extends qK{constructor(m){super(1,"commander.invalidArgument",m),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name;}};gve.CommanderError=qK;gve.InvalidArgumentError=mve;});var $K=Ys(yve=>{var{InvalidArgumentError:SCt}=DJ(),hve=class{constructor(m,S){switch(this.description=S||"",this.variadic=false,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,m[0]){case "<":this.required=true,this._name=m.slice(1,-1);break;case "[":this.required=false,this._name=m.slice(1,-1);break;default:this.required=true,this._name=m;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=true,this._name=this._name.slice(0,-3));}name(){return this._name}_concatValue(m,S){return S===this.defaultValue||!Array.isArray(S)?[m]:S.concat(m)}default(m,S){return this.defaultValue=m,this.defaultValueDescription=S,this}argParser(m){return this.parseArg=m,this}choices(m){return this.argChoices=m.slice(),this.parseArg=(S,w)=>{if(!this.argChoices.includes(S))throw new SCt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(S,w):S},this}argRequired(){return this.required=true,this}argOptional(){return this.required=false,this}};function xCt(p){let m=p.name()+(p.variadic===true?"...":"");return p.required?"<"+m+">":"["+m+"]"}yve.Argument=hve;yve.humanReadableArgName=xCt;});var bve=Ys(sBe=>{var{humanReadableArgName:TCt}=$K(),vve=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=false,this.sortOptions=false,this.showGlobalOptions=false;}visibleCommands(m){let S=m.commands.filter(I=>!I._hidden),w=m._getHelpCommand();return w&&!w._hidden&&S.push(w),this.sortSubcommands&&S.sort((I,z)=>I.name().localeCompare(z.name())),S}compareOptions(m,S){let w=I=>I.short?I.short.replace(/^-/,""):I.long.replace(/^--/,"");return w(m).localeCompare(w(S))}visibleOptions(m){let S=m.options.filter(I=>!I.hidden),w=m._getHelpOption();if(w&&!w.hidden){let I=w.short&&m._findOption(w.short),z=w.long&&m._findOption(w.long);!I&&!z?S.push(w):w.long&&!z?S.push(m.createOption(w.long,w.description)):w.short&&!I&&S.push(m.createOption(w.short,w.description));}return this.sortOptions&&S.sort(this.compareOptions),S}visibleGlobalOptions(m){if(!this.showGlobalOptions)return [];let S=[];for(let w=m.parent;w;w=w.parent){let I=w.options.filter(z=>!z.hidden);S.push(...I);}return this.sortOptions&&S.sort(this.compareOptions),S}visibleArguments(m){return m._argsDescription&&m.registeredArguments.forEach(S=>{S.description=S.description||m._argsDescription[S.name()]||"";}),m.registeredArguments.find(S=>S.description)?m.registeredArguments:[]}subcommandTerm(m){let S=m.registeredArguments.map(w=>TCt(w)).join(" ");return m._name+(m._aliases[0]?"|"+m._aliases[0]:"")+(m.options.length?" [options]":"")+(S?" "+S:"")}optionTerm(m){return m.flags}argumentTerm(m){return m.name()}longestSubcommandTermLength(m,S){return S.visibleCommands(m).reduce((w,I)=>Math.max(w,S.subcommandTerm(I).length),0)}longestOptionTermLength(m,S){return S.visibleOptions(m).reduce((w,I)=>Math.max(w,S.optionTerm(I).length),0)}longestGlobalOptionTermLength(m,S){return S.visibleGlobalOptions(m).reduce((w,I)=>Math.max(w,S.optionTerm(I).length),0)}longestArgumentTermLength(m,S){return S.visibleArguments(m).reduce((w,I)=>Math.max(w,S.argumentTerm(I).length),0)}commandUsage(m){let S=m._name;m._aliases[0]&&(S=S+"|"+m._aliases[0]);let w="";for(let I=m.parent;I;I=I.parent)w=I.name()+" "+w;return w+S+" "+m.usage()}commandDescription(m){return m.description()}subcommandDescription(m){return m.summary()||m.description()}optionDescription(m){let S=[];return m.argChoices&&S.push(`choices: ${m.argChoices.map(w=>JSON.stringify(w)).join(", ")}`),m.defaultValue!==void 0&&(m.required||m.optional||m.isBoolean()&&typeof m.defaultValue=="boolean")&&S.push(`default: ${m.defaultValueDescription||JSON.stringify(m.defaultValue)}`),m.presetArg!==void 0&&m.optional&&S.push(`preset: ${JSON.stringify(m.presetArg)}`),m.envVar!==void 0&&S.push(`env: ${m.envVar}`),S.length>0?`${m.description} (${S.join(", ")})`:m.description}argumentDescription(m){let S=[];if(m.argChoices&&S.push(`choices: ${m.argChoices.map(w=>JSON.stringify(w)).join(", ")}`),m.defaultValue!==void 0&&S.push(`default: ${m.defaultValueDescription||JSON.stringify(m.defaultValue)}`),S.length>0){let w=`(${S.join(", ")})`;return m.description?`${m.description} ${w}`:w}return m.description}formatHelp(m,S){let w=S.padWidth(m,S),I=S.helpWidth||80,z=2,oe=2;function ke(Ft,Ct){if(Ct){let Wn=`${Ft.padEnd(w+oe)}${Ct}`;return S.wrap(Wn,I-z,w+oe)}return Ft}function Be(Ft){return Ft.join(`
`).replace(/^/gm," ".repeat(z))}let Ke=[`Usage: ${S.commandUsage(m)}`,""],ct=S.commandDescription(m);ct.length>0&&(Ke=Ke.concat([S.wrap(ct,I,0),""]));let Gt=S.visibleArguments(m).map(Ft=>ke(S.argumentTerm(Ft),S.argumentDescription(Ft)));Gt.length>0&&(Ke=Ke.concat(["Arguments:",Be(Gt),""]));let De=S.visibleOptions(m).map(Ft=>ke(S.optionTerm(Ft),S.optionDescription(Ft)));if(De.length>0&&(Ke=Ke.concat(["Options:",Be(De),""])),this.showGlobalOptions){let Ft=S.visibleGlobalOptions(m).map(Ct=>ke(S.optionTerm(Ct),S.optionDescription(Ct)));Ft.length>0&&(Ke=Ke.concat(["Global Options:",Be(Ft),""]));}let Ir=S.visibleCommands(m).map(Ft=>ke(S.subcommandTerm(Ft),S.subcommandDescription(Ft)));return Ir.length>0&&(Ke=Ke.concat(["Commands:",Be(Ir),""])),Ke.join(`
`)}padWidth(m,S){return Math.max(S.longestOptionTermLength(m,S),S.longestGlobalOptionTermLength(m,S),S.longestSubcommandTermLength(m,S),S.longestArgumentTermLength(m,S))}wrap(m,S,w,I=40){let z=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",oe=new RegExp(`[\\n][${z}]+`);if(m.match(oe))return m;let ke=S-w;if(ke<I)return m;let Be=m.slice(0,w),Ke=m.slice(w).replace(`\r
`,`
`),ct=" ".repeat(w),De="\\s\u200B",Ir=new RegExp(`
|.{1,${ke-1}}([${De}]|$)|[^${De}]+?([${De}]|$)`,"g"),Ft=Ke.match(Ir)||[];return Be+Ft.map((Ct,Wn)=>Ct===`
`?"":(Wn>0?ct:"")+Ct.trimEnd()).join(`
`)}};sBe.Help=vve;});var kve=Ys(Tve=>{var{InvalidArgumentError:kCt}=DJ(),Sve=class{constructor(m,S){this.flags=m,this.description=S||"",this.required=m.includes("<"),this.optional=m.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(m),this.mandatory=false;let w=ECt(m);this.short=w.shortFlag,this.long=w.longFlag,this.negate=false,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=false,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0;}default(m,S){return this.defaultValue=m,this.defaultValueDescription=S,this}preset(m){return this.presetArg=m,this}conflicts(m){return this.conflictsWith=this.conflictsWith.concat(m),this}implies(m){let S=m;return typeof m=="string"&&(S={[m]:true}),this.implied=Object.assign(this.implied||{},S),this}env(m){return this.envVar=m,this}argParser(m){return this.parseArg=m,this}makeOptionMandatory(m=true){return this.mandatory=!!m,this}hideHelp(m=true){return this.hidden=!!m,this}_concatValue(m,S){return S===this.defaultValue||!Array.isArray(S)?[m]:S.concat(m)}choices(m){return this.argChoices=m.slice(),this.parseArg=(S,w)=>{if(!this.argChoices.includes(S))throw new kCt(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(S,w):S},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return CCt(this.name().replace(/^no-/,""))}is(m){return this.short===m||this.long===m}isBoolean(){return !this.required&&!this.optional&&!this.negate}},xve=class{constructor(m){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,m.forEach(S=>{S.negate?this.negativeOptions.set(S.attributeName(),S):this.positiveOptions.set(S.attributeName(),S);}),this.negativeOptions.forEach((S,w)=>{this.positiveOptions.has(w)&&this.dualOptions.add(w);});}valueFromOption(m,S){let w=S.attributeName();if(!this.dualOptions.has(w))return true;let I=this.negativeOptions.get(w).presetArg,z=I!==void 0?I:false;return S.negate===(z===m)}};function CCt(p){return p.split("-").reduce((m,S)=>m+S[0].toUpperCase()+S.slice(1))}function ECt(p){let m,S,w=p.split(/[ |,]+/);return w.length>1&&!/^[[<]/.test(w[1])&&(m=w.shift()),S=w.shift(),!m&&/^-[^-]$/.test(S)&&(m=S,S=void 0),{shortFlag:m,longFlag:S}}Tve.Option=Sve;Tve.DualOptions=xve;});var oBe=Ys(aBe=>{function wCt(p,m){if(Math.abs(p.length-m.length)>3)return Math.max(p.length,m.length);let S=[];for(let w=0;w<=p.length;w++)S[w]=[w];for(let w=0;w<=m.length;w++)S[0][w]=w;for(let w=1;w<=m.length;w++)for(let I=1;I<=p.length;I++){let z=1;p[I-1]===m[w-1]?z=0:z=1,S[I][w]=Math.min(S[I-1][w]+1,S[I][w-1]+1,S[I-1][w-1]+z),I>1&&w>1&&p[I-1]===m[w-2]&&p[I-2]===m[w-1]&&(S[I][w]=Math.min(S[I][w],S[I-2][w-2]+1));}return S[p.length][m.length]}function DCt(p,m){if(!m||m.length===0)return "";m=Array.from(new Set(m));let S=p.startsWith("--");S&&(p=p.slice(2),m=m.map(oe=>oe.slice(2)));let w=[],I=3,z=.4;return m.forEach(oe=>{if(oe.length<=1)return;let ke=wCt(p,oe),Be=Math.max(p.length,oe.length);(Be-ke)/Be>z&&(ke<I?(I=ke,w=[oe]):ke===I&&w.push(oe));}),w.sort((oe,ke)=>oe.localeCompare(ke)),S&&(w=w.map(oe=>`--${oe}`)),w.length>1?`
(Did you mean one of ${w.join(", ")}?)`:w.length===1?`
(Did you mean ${w[0]}?)`:""}aBe.suggestSimilar=DCt;});var fBe=Ys(_Be=>{var PCt=To("events").EventEmitter,Cve=To("child_process"),HE=To("path"),Eve=To("fs"),gd=To("process"),{Argument:ACt,humanReadableArgName:NCt}=$K(),{CommanderError:wve}=DJ(),{Help:ICt}=bve(),{Option:cBe,DualOptions:OCt}=kve(),{suggestSimilar:lBe}=oBe(),Dve=class p extends PCt{constructor(m){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=false,this._allowExcessArguments=true,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=m||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=false,this._actionHandler=null,this._executableHandler=false,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=true,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=false,this._passThroughOptions=false,this._lifeCycleHooks={},this._showHelpAfterError=false,this._showSuggestionAfterError=true,this._outputConfiguration={writeOut:S=>gd.stdout.write(S),writeErr:S=>gd.stderr.write(S),getOutHelpWidth:()=>gd.stdout.isTTY?gd.stdout.columns:void 0,getErrHelpWidth:()=>gd.stderr.isTTY?gd.stderr.columns:void 0,outputError:(S,w)=>w(S)},this._hidden=false,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={};}copyInheritedSettings(m){return this._outputConfiguration=m._outputConfiguration,this._helpOption=m._helpOption,this._helpCommand=m._helpCommand,this._helpConfiguration=m._helpConfiguration,this._exitCallback=m._exitCallback,this._storeOptionsAsProperties=m._storeOptionsAsProperties,this._combineFlagAndOptionalValue=m._combineFlagAndOptionalValue,this._allowExcessArguments=m._allowExcessArguments,this._enablePositionalOptions=m._enablePositionalOptions,this._showHelpAfterError=m._showHelpAfterError,this._showSuggestionAfterError=m._showSuggestionAfterError,this}_getCommandAndAncestors(){let m=[];for(let S=this;S;S=S.parent)m.push(S);return m}command(m,S,w){let I=S,z=w;typeof I=="object"&&I!==null&&(z=I,I=null),z=z||{};let[,oe,ke]=m.match(/([^ ]+) *(.*)/),Be=this.createCommand(oe);return I&&(Be.description(I),Be._executableHandler=true),z.isDefault&&(this._defaultCommandName=Be._name),Be._hidden=!!(z.noHelp||z.hidden),Be._executableFile=z.executableFile||null,ke&&Be.arguments(ke),this._registerCommand(Be),Be.parent=this,Be.copyInheritedSettings(this),I?this:Be}createCommand(m){return new p(m)}createHelp(){return Object.assign(new ICt,this.configureHelp())}configureHelp(m){return m===void 0?this._helpConfiguration:(this._helpConfiguration=m,this)}configureOutput(m){return m===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,m),this)}showHelpAfterError(m=true){return typeof m!="string"&&(m=!!m),this._showHelpAfterError=m,this}showSuggestionAfterError(m=true){return this._showSuggestionAfterError=!!m,this}addCommand(m,S){if(!m._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);return S=S||{},S.isDefault&&(this._defaultCommandName=m._name),(S.noHelp||S.hidden)&&(m._hidden=true),this._registerCommand(m),m.parent=this,m._checkForBrokenPassThrough(),this}createArgument(m,S){return new ACt(m,S)}argument(m,S,w,I){let z=this.createArgument(m,S);return typeof w=="function"?z.default(I).argParser(w):z.default(w),this.addArgument(z),this}arguments(m){return m.trim().split(/ +/).forEach(S=>{this.argument(S);}),this}addArgument(m){let S=this.registeredArguments.slice(-1)[0];if(S&&S.variadic)throw new Error(`only the last argument can be variadic '${S.name()}'`);if(m.required&&m.defaultValue!==void 0&&m.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${m.name()}'`);return this.registeredArguments.push(m),this}helpCommand(m,S){if(typeof m=="boolean")return this._addImplicitHelpCommand=m,this;m=m??"help [command]";let[,w,I]=m.match(/([^ ]+) *(.*)/),z=S??"display help for command",oe=this.createCommand(w);return oe.helpOption(false),I&&oe.arguments(I),z&&oe.description(z),this._addImplicitHelpCommand=true,this._helpCommand=oe,this}addHelpCommand(m,S){return typeof m!="object"?(this.helpCommand(m,S),this):(this._addImplicitHelpCommand=true,this._helpCommand=m,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(m,S){let w=["preSubcommand","preAction","postAction"];if(!w.includes(m))throw new Error(`Unexpected value for event passed to hook : '${m}'.
Expecting one of '${w.join("', '")}'`);return this._lifeCycleHooks[m]?this._lifeCycleHooks[m].push(S):this._lifeCycleHooks[m]=[S],this}exitOverride(m){return m?this._exitCallback=m:this._exitCallback=S=>{if(S.code!=="commander.executeSubCommandAsync")throw S},this}_exit(m,S,w){this._exitCallback&&this._exitCallback(new wve(m,S,w)),gd.exit(m);}action(m){let S=w=>{let I=this.registeredArguments.length,z=w.slice(0,I);return this._storeOptionsAsProperties?z[I]=this:z[I]=this.opts(),z.push(this),m.apply(this,z)};return this._actionHandler=S,this}createOption(m,S){return new cBe(m,S)}_callParseArg(m,S,w,I){try{return m.parseArg(S,w)}catch(z){if(z.code==="commander.invalidArgument"){let oe=`${I} ${z.message}`;this.error(oe,{exitCode:z.exitCode,code:z.code});}throw z}}_registerOption(m){let S=m.short&&this._findOption(m.short)||m.long&&this._findOption(m.long);if(S){let w=m.long&&this._findOption(m.long)?m.long:m.short;throw new Error(`Cannot add option '${m.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${w}'
- already used by option '${S.flags}'`)}this.options.push(m);}_registerCommand(m){let S=I=>[I.name()].concat(I.aliases()),w=S(m).find(I=>this._findCommand(I));if(w){let I=S(this._findCommand(w)).join("|"),z=S(m).join("|");throw new Error(`cannot add command '${z}' as already have command '${I}'`)}this.commands.push(m);}addOption(m){this._registerOption(m);let S=m.name(),w=m.attributeName();if(m.negate){let z=m.long.replace(/^--no-/,"--");this._findOption(z)||this.setOptionValueWithSource(w,m.defaultValue===void 0?true:m.defaultValue,"default");}else m.defaultValue!==void 0&&this.setOptionValueWithSource(w,m.defaultValue,"default");let I=(z,oe,ke)=>{z==null&&m.presetArg!==void 0&&(z=m.presetArg);let Be=this.getOptionValue(w);z!==null&&m.parseArg?z=this._callParseArg(m,z,Be,oe):z!==null&&m.variadic&&(z=m._concatValue(z,Be)),z==null&&(m.negate?z=false:m.isBoolean()||m.optional?z=true:z=""),this.setOptionValueWithSource(w,z,ke);};return this.on("option:"+S,z=>{let oe=`error: option '${m.flags}' argument '${z}' is invalid.`;I(z,oe,"cli");}),m.envVar&&this.on("optionEnv:"+S,z=>{let oe=`error: option '${m.flags}' value '${z}' from env '${m.envVar}' is invalid.`;I(z,oe,"env");}),this}_optionEx(m,S,w,I,z){if(typeof S=="object"&&S instanceof cBe)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let oe=this.createOption(S,w);if(oe.makeOptionMandatory(!!m.mandatory),typeof I=="function")oe.default(z).argParser(I);else if(I instanceof RegExp){let ke=I;I=(Be,Ke)=>{let ct=ke.exec(Be);return ct?ct[0]:Ke},oe.default(z).argParser(I);}else oe.default(I);return this.addOption(oe)}option(m,S,w,I){return this._optionEx({},m,S,w,I)}requiredOption(m,S,w,I){return this._optionEx({mandatory:true},m,S,w,I)}combineFlagAndOptionalValue(m=true){return this._combineFlagAndOptionalValue=!!m,this}allowUnknownOption(m=true){return this._allowUnknownOption=!!m,this}allowExcessArguments(m=true){return this._allowExcessArguments=!!m,this}enablePositionalOptions(m=true){return this._enablePositionalOptions=!!m,this}passThroughOptions(m=true){return this._passThroughOptions=!!m,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(m=true){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=!!m,this}getOptionValue(m){return this._storeOptionsAsProperties?this[m]:this._optionValues[m]}setOptionValue(m,S){return this.setOptionValueWithSource(m,S,void 0)}setOptionValueWithSource(m,S,w){return this._storeOptionsAsProperties?this[m]=S:this._optionValues[m]=S,this._optionValueSources[m]=w,this}getOptionValueSource(m){return this._optionValueSources[m]}getOptionValueSourceWithGlobals(m){let S;return this._getCommandAndAncestors().forEach(w=>{w.getOptionValueSource(m)!==void 0&&(S=w.getOptionValueSource(m));}),S}_prepareUserArgs(m,S){if(m!==void 0&&!Array.isArray(m))throw new Error("first parameter to parse must be array or undefined");if(S=S||{},m===void 0&&S.from===void 0){gd.versions?.electron&&(S.from="electron");let I=gd.execArgv??[];(I.includes("-e")||I.includes("--eval")||I.includes("-p")||I.includes("--print"))&&(S.from="eval");}m===void 0&&(m=gd.argv),this.rawArgs=m.slice();let w;switch(S.from){case void 0:case "node":this._scriptPath=m[1],w=m.slice(2);break;case "electron":gd.defaultApp?(this._scriptPath=m[1],w=m.slice(2)):w=m.slice(1);break;case "user":w=m.slice(0);break;case "eval":w=m.slice(1);break;default:throw new Error(`unexpected parse option { from: '${S.from}' }`)}return !this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",w}parse(m,S){let w=this._prepareUserArgs(m,S);return this._parseCommand([],w),this}async parseAsync(m,S){let w=this._prepareUserArgs(m,S);return await this._parseCommand([],w),this}_executeSubCommand(m,S){S=S.slice();let w=false,I=[".js",".ts",".tsx",".mjs",".cjs"];function z(ct,Gt){let De=HE.resolve(ct,Gt);if(Eve.existsSync(De))return De;if(I.includes(HE.extname(Gt)))return;let Ir=I.find(Ft=>Eve.existsSync(`${De}${Ft}`));if(Ir)return `${De}${Ir}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let oe=m._executableFile||`${this._name}-${m._name}`,ke=this._executableDir||"";if(this._scriptPath){let ct;try{ct=Eve.realpathSync(this._scriptPath);}catch{ct=this._scriptPath;}ke=HE.resolve(HE.dirname(ct),ke);}if(ke){let ct=z(ke,oe);if(!ct&&!m._executableFile&&this._scriptPath){let Gt=HE.basename(this._scriptPath,HE.extname(this._scriptPath));Gt!==this._name&&(ct=z(ke,`${Gt}-${m._name}`));}oe=ct||oe;}w=I.includes(HE.extname(oe));let Be;gd.platform!=="win32"?w?(S.unshift(oe),S=uBe(gd.execArgv).concat(S),Be=Cve.spawn(gd.argv[0],S,{stdio:"inherit"})):Be=Cve.spawn(oe,S,{stdio:"inherit"}):(S.unshift(oe),S=uBe(gd.execArgv).concat(S),Be=Cve.spawn(gd.execPath,S,{stdio:"inherit"})),Be.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(Gt=>{gd.on(Gt,()=>{Be.killed===false&&Be.exitCode===null&&Be.kill(Gt);});});let Ke=this._exitCallback;Be.on("close",ct=>{ct=ct??1,Ke?Ke(new wve(ct,"commander.executeSubCommandAsync","(close)")):gd.exit(ct);}),Be.on("error",ct=>{if(ct.code==="ENOENT"){let Gt=ke?`searched for local subcommand relative to directory '${ke}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",De=`'${oe}' does not exist
- if '${m._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
- ${Gt}`;throw new Error(De)}else if(ct.code==="EACCES")throw new Error(`'${oe}' not executable`);if(!Ke)gd.exit(1);else {let Gt=new wve(1,"commander.executeSubCommandAsync","(error)");Gt.nestedError=ct,Ke(Gt);}}),this.runningCommand=Be;}_dispatchSubcommand(m,S,w){let I=this._findCommand(m);I||this.help({error:true});let z;return z=this._chainOrCallSubCommandHook(z,I,"preSubcommand"),z=this._chainOrCall(z,()=>{if(I._executableHandler)this._executeSubCommand(I,S.concat(w));else return I._parseCommand(S,w)}),z}_dispatchHelpCommand(m){m||this.help();let S=this._findCommand(m);return S&&!S._executableHandler&&S.help(),this._dispatchSubcommand(m,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((m,S)=>{m.required&&this.args[S]==null&&this.missingArgument(m.name());}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args);}_processArguments(){let m=(w,I,z)=>{let oe=I;if(I!==null&&w.parseArg){let ke=`error: command-argument value '${I}' is invalid for argument '${w.name()}'.`;oe=this._callParseArg(w,I,z,ke);}return oe};this._checkNumberOfArguments();let S=[];this.registeredArguments.forEach((w,I)=>{let z=w.defaultValue;w.variadic?I<this.args.length?(z=this.args.slice(I),w.parseArg&&(z=z.reduce((oe,ke)=>m(w,ke,oe),w.defaultValue))):z===void 0&&(z=[]):I<this.args.length&&(z=this.args[I],w.parseArg&&(z=m(w,z,w.defaultValue))),S[I]=z;}),this.processedArgs=S;}_chainOrCall(m,S){return m&&m.then&&typeof m.then=="function"?m.then(()=>S()):S()}_chainOrCallHooks(m,S){let w=m,I=[];return this._getCommandAndAncestors().reverse().filter(z=>z._lifeCycleHooks[S]!==void 0).forEach(z=>{z._lifeCycleHooks[S].forEach(oe=>{I.push({hookedCommand:z,callback:oe});});}),S==="postAction"&&I.reverse(),I.forEach(z=>{w=this._chainOrCall(w,()=>z.callback(z.hookedCommand,this));}),w}_chainOrCallSubCommandHook(m,S,w){let I=m;return this._lifeCycleHooks[w]!==void 0&&this._lifeCycleHooks[w].forEach(z=>{I=this._chainOrCall(I,()=>z(this,S));}),I}_parseCommand(m,S){let w=this.parseOptions(S);if(this._parseOptionsEnv(),this._parseOptionsImplied(),m=m.concat(w.operands),S=w.unknown,this.args=m.concat(S),m&&this._findCommand(m[0]))return this._dispatchSubcommand(m[0],m.slice(1),S);if(this._getHelpCommand()&&m[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(m[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(S),this._dispatchSubcommand(this._defaultCommandName,m,S);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:true}),this._outputHelpIfRequested(w.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let I=()=>{w.unknown.length>0&&this.unknownOption(w.unknown[0]);},z=`command:${this.name()}`;if(this._actionHandler){I(),this._processArguments();let oe;return oe=this._chainOrCallHooks(oe,"preAction"),oe=this._chainOrCall(oe,()=>this._actionHandler(this.processedArgs)),this.parent&&(oe=this._chainOrCall(oe,()=>{this.parent.emit(z,m,S);})),oe=this._chainOrCallHooks(oe,"postAction"),oe}if(this.parent&&this.parent.listenerCount(z))I(),this._processArguments(),this.parent.emit(z,m,S);else if(m.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",m,S);this.listenerCount("command:*")?this.emit("command:*",m,S):this.commands.length?this.unknownCommand():(I(),this._processArguments());}else this.commands.length?(I(),this.help({error:true})):(I(),this._processArguments());}_findCommand(m){if(m)return this.commands.find(S=>S._name===m||S._aliases.includes(m))}_findOption(m){return this.options.find(S=>S.is(m))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(m=>{m.options.forEach(S=>{S.mandatory&&m.getOptionValue(S.attributeName())===void 0&&m.missingMandatoryOptionValue(S);});});}_checkForConflictingLocalOptions(){let m=this.options.filter(w=>{let I=w.attributeName();return this.getOptionValue(I)===void 0?false:this.getOptionValueSource(I)!=="default"});m.filter(w=>w.conflictsWith.length>0).forEach(w=>{let I=m.find(z=>w.conflictsWith.includes(z.attributeName()));I&&this._conflictingOption(w,I);});}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(m=>{m._checkForConflictingLocalOptions();});}parseOptions(m){let S=[],w=[],I=S,z=m.slice();function oe(Be){return Be.length>1&&Be[0]==="-"}let ke=null;for(;z.length;){let Be=z.shift();if(Be==="--"){I===w&&I.push(Be),I.push(...z);break}if(ke&&!oe(Be)){this.emit(`option:${ke.name()}`,Be);continue}if(ke=null,oe(Be)){let Ke=this._findOption(Be);if(Ke){if(Ke.required){let ct=z.shift();ct===void 0&&this.optionMissingArgument(Ke),this.emit(`option:${Ke.name()}`,ct);}else if(Ke.optional){let ct=null;z.length>0&&!oe(z[0])&&(ct=z.shift()),this.emit(`option:${Ke.name()}`,ct);}else this.emit(`option:${Ke.name()}`);ke=Ke.variadic?Ke:null;continue}}if(Be.length>2&&Be[0]==="-"&&Be[1]!=="-"){let Ke=this._findOption(`-${Be[1]}`);if(Ke){Ke.required||Ke.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${Ke.name()}`,Be.slice(2)):(this.emit(`option:${Ke.name()}`),z.unshift(`-${Be.slice(2)}`));continue}}if(/^--[^=]+=/.test(Be)){let Ke=Be.indexOf("="),ct=this._findOption(Be.slice(0,Ke));if(ct&&(ct.required||ct.optional)){this.emit(`option:${ct.name()}`,Be.slice(Ke+1));continue}}if(oe(Be)&&(I=w),(this._enablePositionalOptions||this._passThroughOptions)&&S.length===0&&w.length===0){if(this._findCommand(Be)){S.push(Be),z.length>0&&w.push(...z);break}else if(this._getHelpCommand()&&Be===this._getHelpCommand().name()){S.push(Be),z.length>0&&S.push(...z);break}else if(this._defaultCommandName){w.push(Be),z.length>0&&w.push(...z);break}}if(this._passThroughOptions){I.push(Be),z.length>0&&I.push(...z);break}I.push(Be);}return {operands:S,unknown:w}}opts(){if(this._storeOptionsAsProperties){let m={},S=this.options.length;for(let w=0;w<S;w++){let I=this.options[w].attributeName();m[I]=I===this._versionOptionName?this._version:this[I];}return m}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((m,S)=>Object.assign(m,S.opts()),{})}error(m,S){this._outputConfiguration.outputError(`${m}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
`),this.outputHelp({error:true}));let w=S||{},I=w.exitCode||1,z=w.code||"commander.error";this._exit(I,z,m);}_parseOptionsEnv(){this.options.forEach(m=>{if(m.envVar&&m.envVar in gd.env){let S=m.attributeName();(this.getOptionValue(S)===void 0||["default","config","env"].includes(this.getOptionValueSource(S)))&&(m.required||m.optional?this.emit(`optionEnv:${m.name()}`,gd.env[m.envVar]):this.emit(`optionEnv:${m.name()}`));}});}_parseOptionsImplied(){let m=new OCt(this.options),S=w=>this.getOptionValue(w)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(w));this.options.filter(w=>w.implied!==void 0&&S(w.attributeName())&&m.valueFromOption(this.getOptionValue(w.attributeName()),w)).forEach(w=>{Object.keys(w.implied).filter(I=>!S(I)).forEach(I=>{this.setOptionValueWithSource(I,w.implied[I],"implied");});});}missingArgument(m){let S=`error: missing required argument '${m}'`;this.error(S,{code:"commander.missingArgument"});}optionMissingArgument(m){let S=`error: option '${m.flags}' argument missing`;this.error(S,{code:"commander.optionMissingArgument"});}missingMandatoryOptionValue(m){let S=`error: required option '${m.flags}' not specified`;this.error(S,{code:"commander.missingMandatoryOptionValue"});}_conflictingOption(m,S){let w=oe=>{let ke=oe.attributeName(),Be=this.getOptionValue(ke),Ke=this.options.find(Gt=>Gt.negate&&ke===Gt.attributeName()),ct=this.options.find(Gt=>!Gt.negate&&ke===Gt.attributeName());return Ke&&(Ke.presetArg===void 0&&Be===false||Ke.presetArg!==void 0&&Be===Ke.presetArg)?Ke:ct||oe},I=oe=>{let ke=w(oe),Be=ke.attributeName();return this.getOptionValueSource(Be)==="env"?`environment variable '${ke.envVar}'`:`option '${ke.flags}'`},z=`error: ${I(m)} cannot be used with ${I(S)}`;this.error(z,{code:"commander.conflictingOption"});}unknownOption(m){if(this._allowUnknownOption)return;let S="";if(m.startsWith("--")&&this._showSuggestionAfterError){let I=[],z=this;do{let oe=z.createHelp().visibleOptions(z).filter(ke=>ke.long).map(ke=>ke.long);I=I.concat(oe),z=z.parent;}while(z&&!z._enablePositionalOptions);S=lBe(m,I);}let w=`error: unknown option '${m}'${S}`;this.error(w,{code:"commander.unknownOption"});}_excessArguments(m){if(this._allowExcessArguments)return;let S=this.registeredArguments.length,w=S===1?"":"s",z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${S} argument${w} but got ${m.length}.`;this.error(z,{code:"commander.excessArguments"});}unknownCommand(){let m=this.args[0],S="";if(this._showSuggestionAfterError){let I=[];this.createHelp().visibleCommands(this).forEach(z=>{I.push(z.name()),z.alias()&&I.push(z.alias());}),S=lBe(m,I);}let w=`error: unknown command '${m}'${S}`;this.error(w,{code:"commander.unknownCommand"});}version(m,S,w){if(m===void 0)return this._version;this._version=m,S=S||"-V, --version",w=w||"output the version number";let I=this.createOption(S,w);return this._versionOptionName=I.attributeName(),this._registerOption(I),this.on("option:"+I.name(),()=>{this._outputConfiguration.writeOut(`${m}
`),this._exit(0,"commander.version",m);}),this}description(m,S){return m===void 0&&S===void 0?this._description:(this._description=m,S&&(this._argsDescription=S),this)}summary(m){return m===void 0?this._summary:(this._summary=m,this)}alias(m){if(m===void 0)return this._aliases[0];let S=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(S=this.commands[this.commands.length-1]),m===S._name)throw new Error("Command alias can't be the same as its name");let w=this.parent?._findCommand(m);if(w){let I=[w.name()].concat(w.aliases()).join("|");throw new Error(`cannot add alias '${m}' to command '${this.name()}' as already have command '${I}'`)}return S._aliases.push(m),this}aliases(m){return m===void 0?this._aliases:(m.forEach(S=>this.alias(S)),this)}usage(m){if(m===void 0){if(this._usage)return this._usage;let S=this.registeredArguments.map(w=>NCt(w));return [].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?S:[]).join(" ")}return this._usage=m,this}name(m){return m===void 0?this._name:(this._name=m,this)}nameFromFilename(m){return this._name=HE.basename(m,HE.extname(m)),this}executableDir(m){return m===void 0?this._executableDir:(this._executableDir=m,this)}helpInformation(m){let S=this.createHelp();return S.helpWidth===void 0&&(S.helpWidth=m&&m.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),S.formatHelp(this,S)}_getHelpContext(m){m=m||{};let S={error:!!m.error},w;return S.error?w=I=>this._outputConfiguration.writeErr(I):w=I=>this._outputConfiguration.writeOut(I),S.write=m.write||w,S.command=this,S}outputHelp(m){let S;typeof m=="function"&&(S=m,m=void 0);let w=this._getHelpContext(m);this._getCommandAndAncestors().reverse().forEach(z=>z.emit("beforeAllHelp",w)),this.emit("beforeHelp",w);let I=this.helpInformation(w);if(S&&(I=S(I),typeof I!="string"&&!Buffer.isBuffer(I)))throw new Error("outputHelp callback must return a string or a Buffer");w.write(I),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",w),this._getCommandAndAncestors().forEach(z=>z.emit("afterAllHelp",w));}helpOption(m,S){return typeof m=="boolean"?(m?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(m=m??"-h, --help",S=S??"display help for command",this._helpOption=this.createOption(m,S),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(m){return this._helpOption=m,this}help(m){this.outputHelp(m);let S=gd.exitCode||0;S===0&&m&&typeof m!="function"&&m.error&&(S=1),this._exit(S,"commander.help","(outputHelp)");}addHelpText(m,S){let w=["beforeAll","before","after","afterAll"];if(!w.includes(m))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${w.join("', '")}'`);let I=`${m}Help`;return this.on(I,z=>{let oe;typeof S=="function"?oe=S({error:z.error,command:z.command}):oe=S,oe&&z.write(`${oe}
`);}),this}_outputHelpIfRequested(m){let S=this._getHelpOption();S&&m.find(I=>S.is(I))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"));}};function uBe(p){return p.map(m=>{if(!m.startsWith("--inspect"))return m;let S,w="127.0.0.1",I="9229",z;return (z=m.match(/^(--inspect(-brk)?)$/))!==null?S=z[1]:(z=m.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(S=z[1],/^\d+$/.test(z[3])?I=z[3]:w=z[3]):(z=m.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(S=z[1],w=z[3],I=z[4]),S&&I!=="0"?`${S}=${w}:${parseInt(I)+1}`:m})}_Be.Command=Dve;});var gBe=Ys(CS=>{var{Argument:pBe}=$K(),{Command:Pve}=fBe(),{CommanderError:FCt,InvalidArgumentError:dBe}=DJ(),{Help:LCt}=bve(),{Option:mBe}=kve();CS.program=new Pve;CS.createCommand=p=>new Pve(p);CS.createOption=(p,m)=>new mBe(p,m);CS.createArgument=(p,m)=>new pBe(p,m);CS.Command=Pve;CS.Option=mBe;CS.Argument=pBe;CS.Help=LCt;CS.CommanderError=FCt;CS.InvalidArgumentError=dBe;CS.InvalidOptionArgumentError=dBe;});var Sze=Ys((w5t,bze)=>{bze.exports=vze;vze.sync=KPt;var hze=To("fs");function ZPt(p,m){var S=m.pathExt!==void 0?m.pathExt:process.env.PATHEXT;if(!S||(S=S.split(";"),S.indexOf("")!==-1))return true;for(var w=0;w<S.length;w++){var I=S[w].toLowerCase();if(I&&p.substr(-I.length).toLowerCase()===I)return true}return false}function yze(p,m,S){return !p.isSymbolicLink()&&!p.isFile()?false:ZPt(m,S)}function vze(p,m,S){hze.stat(p,function(w,I){S(w,w?false:yze(I,p,m));});}function KPt(p,m){return yze(hze.statSync(p),p,m)}});var Eze=Ys((D5t,Cze)=>{Cze.exports=Tze;Tze.sync=e6t;var xze=To("fs");function Tze(p,m,S){xze.stat(p,function(w,I){S(w,w?false:kze(I,m));});}function e6t(p,m){return kze(xze.statSync(p),m)}function kze(p,m){return p.isFile()&&t6t(p,m)}function t6t(p,m){var S=p.mode,w=p.uid,I=p.gid,z=m.uid!==void 0?m.uid:process.getuid&&process.getuid(),oe=m.gid!==void 0?m.gid:process.getgid&&process.getgid(),ke=parseInt("100",8),Be=parseInt("010",8),Ke=parseInt("001",8),ct=ke|Be,Gt=S&Ke||S&Be&&I===oe||S&ke&&w===z||S&ct&&z===0;return Gt}});var Dze=Ys((A5t,wze)=>{To("fs");var pee;process.platform==="win32"||global.TESTING_WINDOWS?pee=Sze():pee=Eze();wze.exports=_be;_be.sync=r6t;function _be(p,m,S){if(typeof m=="function"&&(S=m,m={}),!S){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(w,I){_be(p,m||{},function(z,oe){z?I(z):w(oe);});})}pee(p,m||{},function(w,I){w&&(w.code==="EACCES"||m&&m.ignoreErrors)&&(w=null,I=false),S(w,I);});}function r6t(p,m){try{return pee.sync(p,m||{})}catch(S){if(m&&m.ignoreErrors||S.code==="EACCES")return false;throw S}}});var fbe=Ys((N5t,Fze)=>{var z5=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Pze=To("path"),n6t=z5?";":":",Aze=Dze(),Nze=p=>Object.assign(new Error(`not found: ${p}`),{code:"ENOENT"}),Ize=(p,m)=>{let S=m.colon||n6t,w=p.match(/\//)||z5&&p.match(/\\/)?[""]:[...z5?[process.cwd()]:[],...(m.path||process.env.PATH||"").split(S)],I=z5?m.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",z=z5?I.split(S):[""];return z5&&p.indexOf(".")!==-1&&z[0]!==""&&z.unshift(""),{pathEnv:w,pathExt:z,pathExtExe:I}},Oze=(p,m,S)=>{typeof m=="function"&&(S=m,m={}),m||(m={});let{pathEnv:w,pathExt:I,pathExtExe:z}=Ize(p,m),oe=[],ke=Ke=>new Promise((ct,Gt)=>{if(Ke===w.length)return m.all&&oe.length?ct(oe):Gt(Nze(p));let De=w[Ke],Ir=/^".*"$/.test(De)?De.slice(1,-1):De,Ft=Pze.join(Ir,p),Ct=!Ir&&/^\.[\\\/]/.test(p)?p.slice(0,2)+Ft:Ft;ct(Be(Ct,Ke,0));}),Be=(Ke,ct,Gt)=>new Promise((De,Ir)=>{if(Gt===I.length)return De(ke(ct+1));let Ft=I[Gt];Aze(Ke+Ft,{pathExt:z},(Ct,Wn)=>{if(!Ct&&Wn)if(m.all)oe.push(Ke+Ft);else return De(Ke+Ft);return De(Be(Ke,ct,Gt+1))});});return S?ke(0).then(Ke=>S(null,Ke),S):ke(0)},i6t=(p,m)=>{m=m||{};let{pathEnv:S,pathExt:w,pathExtExe:I}=Ize(p,m),z=[];for(let oe=0;oe<S.length;oe++){let ke=S[oe],Be=/^".*"$/.test(ke)?ke.slice(1,-1):ke,Ke=Pze.join(Be,p),ct=!Be&&/^\.[\\\/]/.test(p)?p.slice(0,2)+Ke:Ke;for(let Gt=0;Gt<w.length;Gt++){let De=ct+w[Gt];try{if(Aze.sync(De,{pathExt:I}))if(m.all)z.push(De);else return De}catch{}}}if(m.all&&z.length)return z;if(m.nothrow)return null;throw Nze(p)};Fze.exports=Oze;Oze.sync=i6t;});var Rze=Ys((I5t,pbe)=>{var Lze=(p={})=>{let m=p.env||process.env;return (p.platform||process.platform)!=="win32"?"PATH":Object.keys(m).reverse().find(w=>w.toUpperCase()==="PATH")||"Path"};pbe.exports=Lze;pbe.exports.default=Lze;});var Jze=Ys((O5t,Bze)=>{var Mze=To("path"),s6t=fbe(),a6t=Rze();function jze(p,m){let S=p.options.env||process.env,w=process.cwd(),I=p.options.cwd!=null,z=I&&process.chdir!==void 0&&!process.chdir.disabled;if(z)try{process.chdir(p.options.cwd);}catch{}let oe;try{oe=s6t.sync(p.command,{path:S[a6t({env:S})],pathExt:m?Mze.delimiter:void 0});}catch{}finally{z&&process.chdir(w);}return oe&&(oe=Mze.resolve(I?p.options.cwd:"",oe)),oe}function o6t(p){return jze(p)||jze(p,true)}Bze.exports=o6t;});var zze=Ys((F5t,mbe)=>{var dbe=/([()\][%!^"`<>&|;, *?])/g;function c6t(p){return p=p.replace(dbe,"^$1"),p}function l6t(p,m){return p=`${p}`,p=p.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),p=p.replace(/(?=(\\+?)?)\1$/,"$1$1"),p=`"${p}"`,p=p.replace(dbe,"^$1"),m&&(p=p.replace(dbe,"^$1")),p}mbe.exports.command=c6t;mbe.exports.argument=l6t;});var Uze=Ys((L5t,Wze)=>{Wze.exports=/^#!(.*)/;});var qze=Ys((R5t,Vze)=>{var u6t=Uze();Vze.exports=(p="")=>{let m=p.match(u6t);if(!m)return null;let[S,w]=m[0].replace(/#! ?/,"").split(" "),I=S.split("/").pop();return I==="env"?w:w?`${I} ${w}`:I};});var Hze=Ys((M5t,$ze)=>{var gbe=To("fs"),_6t=qze();function f6t(p){let S=Buffer.alloc(150),w;try{w=gbe.openSync(p,"r"),gbe.readSync(w,S,0,150,0),gbe.closeSync(w);}catch{}return _6t(S.toString())}$ze.exports=f6t;});var Yze=Ys((j5t,Qze)=>{var p6t=To("path"),Gze=Jze(),Xze=zze(),d6t=Hze(),m6t=process.platform==="win32",g6t=/\.(?:com|exe)$/i,h6t=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function y6t(p){p.file=Gze(p);let m=p.file&&d6t(p.file);return m?(p.args.unshift(p.file),p.command=m,Gze(p)):p.file}function v6t(p){if(!m6t)return p;let m=y6t(p),S=!g6t.test(m);if(p.options.forceShell||S){let w=h6t.test(m);p.command=p6t.normalize(p.command),p.command=Xze.command(p.command),p.args=p.args.map(z=>Xze.argument(z,w));let I=[p.command].concat(p.args).join(" ");p.args=["/d","/s","/c",`"${I}"`],p.command=process.env.comspec||"cmd.exe",p.options.windowsVerbatimArguments=true;}return p}function b6t(p,m,S){m&&!Array.isArray(m)&&(S=m,m=null),m=m?m.slice(0):[],S=Object.assign({},S);let w={command:p,args:m,options:S,file:void 0,original:{command:p,args:m}};return S.shell?w:v6t(w)}Qze.exports=b6t;});var eWe=Ys((B5t,Kze)=>{var hbe=process.platform==="win32";function ybe(p,m){return Object.assign(new Error(`${m} ${p.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${m} ${p.command}`,path:p.command,spawnargs:p.args})}function S6t(p,m){if(!hbe)return;let S=p.emit;p.emit=function(w,I){if(w==="exit"){let z=Zze(I,m);if(z)return S.call(p,"error",z)}return S.apply(p,arguments)};}function Zze(p,m){return hbe&&p===1&&!m.file?ybe(m.original,"spawn"):null}function x6t(p,m){return hbe&&p===1&&!m.file?ybe(m.original,"spawnSync"):null}Kze.exports={hookChildProcess:S6t,verifyENOENT:Zze,verifyENOENTSync:x6t,notFoundError:ybe};});var nWe=Ys((J5t,W5)=>{var tWe=To("child_process"),vbe=Yze(),bbe=eWe();function rWe(p,m,S){let w=vbe(p,m,S),I=tWe.spawn(w.command,w.args,w.options);return bbe.hookChildProcess(I,w),I}function T6t(p,m,S){let w=vbe(p,m,S),I=tWe.spawnSync(w.command,w.args,w.options);return I.error=I.error||bbe.verifyENOENTSync(I.status,w),I}W5.exports=rWe;W5.exports.spawn=rWe;W5.exports.sync=T6t;W5.exports._parse=vbe;W5.exports._enoent=bbe;});var OWe=Ys(($Ft,IWe)=>{var{PassThrough:SAt}=To("stream");IWe.exports=function(){var p=[],m=new SAt({objectMode:true});return m.setMaxListeners(0),m.add=S,m.isEmpty=w,m.on("unpipe",I),Array.prototype.slice.call(arguments).forEach(S),m;function S(z){return Array.isArray(z)?(z.forEach(S),this):(p.push(z),z.once("end",I.bind(null,z)),z.once("error",m.emit.bind(m,"error")),z.pipe(m,{end:false}),this)}function w(){return p.length==0}function I(z){p=p.filter(function(oe){return oe!==z}),!p.length&&m.readable&&m.end();}};});var vUe=Ys((Z9t,Fee)=>{var _Ue={};(p=>{var m=Object.defineProperty,z=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:true});},ke=e=>e,Be={};z(Be,{ANONYMOUS:()=>rX,AccessFlags:()=>are,AssertionLevel:()=>gte,AssignmentDeclarationKind:()=>mre,AssignmentKind:()=>zie,Associativity:()=>Xie,BreakpointResolver:()=>eQ,BuilderFileEmit:()=>Vle,BuilderProgramKind:()=>Zle,BuilderState:()=>Em,CallHierarchy:()=>$C,CharacterCodes:()=>Ere,CheckFlags:()=>rre,CheckMode:()=>C$,ClassificationType:()=>pG,ClassificationTypeNames:()=>e_e,CommentDirectiveType:()=>zte,Comparison:()=>Gt,CompletionInfoFlags:()=>Hue,CompletionTriggerKind:()=>_G,Completions:()=>YC,ContainerFlags:()=>kce,ContextFlags:()=>Gte,Debug:()=>A,DiagnosticCategory:()=>uF,Diagnostics:()=>d,DocumentHighlights:()=>sj,ElementFlags:()=>sre,EmitFlags:()=>cW,EmitHint:()=>Are,EmitOnly:()=>Ute,EndOfLineState:()=>Que,ExitStatus:()=>Vte,ExportKind:()=>V_e,Extension:()=>wre,ExternalEmitHelpers:()=>Pre,FileIncludeKind:()=>Zz,FilePreprocessingDiagnosticsKind:()=>Wte,FileSystemEntryKind:()=>Bre,FileWatcherEventKind:()=>Rre,FindAllReferences:()=>Qo,FlattenLevel:()=>$ce,FlowFlags:()=>lF,ForegroundColorEscapeSequences:()=>Fle,FunctionFlags:()=>Hie,GeneratedIdentifierFlags:()=>Yz,GetLiteralTextFlags:()=>iie,GoToDefinition:()=>VD,HighlightSpanKind:()=>que,IdentifierNameMap:()=>bD,ImportKind:()=>U_e,ImportsNotUsedAsValues:()=>Sre,IndentStyle:()=>$ue,IndexFlags:()=>ore,IndexKind:()=>ure,InferenceFlags:()=>pre,InferencePriority:()=>fre,InlayHintKind:()=>Vue,InlayHints:()=>qQ,InternalEmitFlags:()=>Dre,InternalNodeBuilderFlags:()=>Qte,InternalSymbolName:()=>nre,IntersectionFlags:()=>Hte,InvalidatedProjectKind:()=>Sue,JSDocParsingMode:()=>Lre,JsDoc:()=>Rb,JsTyping:()=>av,JsxEmit:()=>bre,JsxFlags:()=>Mte,JsxReferenceKind:()=>cre,LanguageFeatureMinimumTarget:()=>su,LanguageServiceMode:()=>Wue,LanguageVariant:()=>kre,LexicalEnvironmentFlags:()=>Ire,ListFormat:()=>Ore,LogLevel:()=>Ete,MapCode:()=>$Q,MemberOverrideStatus:()=>qte,ModifierFlags:()=>Xz,ModuleDetectionKind:()=>gre,ModuleInstanceState:()=>xce,ModuleKind:()=>ow,ModuleResolutionKind:()=>aw,ModuleSpecifierEnding:()=>qse,NavigateTo:()=>dfe,NavigationBar:()=>gfe,NewLineKind:()=>xre,NodeBuilderFlags:()=>Xte,NodeCheckFlags:()=>tW,NodeFactoryFlags:()=>xae,NodeFlags:()=>Gz,NodeResolutionFeatures:()=>fce,ObjectFlags:()=>nW,OperationCanceledException:()=>o6,OperatorPrecedence:()=>Qie,OrganizeImports:()=>Mb,OrganizeImportsMode:()=>uG,OuterExpressionKinds:()=>Nre,OutliningElementsCollector:()=>GQ,OutliningSpanKind:()=>Gue,OutputFileType:()=>Xue,PackageJsonAutoImportPreference:()=>zue,PackageJsonDependencyGroup:()=>Jue,PatternMatchKind:()=>SX,PollingInterval:()=>lW,PollingWatchKind:()=>vre,PragmaKindFlags:()=>Fre,PredicateSemantics:()=>jte,PreparePasteEdits:()=>lY,PrivateIdentifierKind:()=>Iae,ProcessLevel:()=>Qce,ProgramUpdateLevel:()=>Ple,QuotePreference:()=>x_e,RegularExpressionFlags:()=>Bte,RelationComparisonResult:()=>Qz,Rename:()=>Wj,ScriptElementKind:()=>Zue,ScriptElementKindModifier:()=>Kue,ScriptKind:()=>sW,ScriptSnapshot:()=>hM,ScriptTarget:()=>Tre,SemanticClassificationFormat:()=>Uue,SemanticMeaning:()=>t_e,SemicolonPreference:()=>fG,SignatureCheckMode:()=>E$,SignatureFlags:()=>iW,SignatureHelp:()=>nO,SignatureInfo:()=>Ule,SignatureKind:()=>lre,SmartSelectionRange:()=>YQ,SnippetKind:()=>oW,StatisticType:()=>Aue,StructureIsReused:()=>Kz,SymbolAccessibility:()=>Kte,SymbolDisplay:()=>L0,SymbolDisplayPartKind:()=>vM,SymbolFlags:()=>eW,SymbolFormatFlags:()=>Zte,SyntaxKind:()=>Hz,Ternary:()=>dre,ThrottledCancellationToken:()=>kpe,TokenClass:()=>Yue,TokenFlags:()=>Jte,TransformFlags:()=>aW,TypeFacts:()=>k$,TypeFlags:()=>rW,TypeFormatFlags:()=>Yte,TypeMapKind:()=>_re,TypePredicateKind:()=>ere,TypeReferenceSerializationKind:()=>tre,UnionReduction:()=>$te,UpToDateStatusType:()=>due,VarianceFlags:()=>ire,Version:()=>pm,VersionRange:()=>cF,WatchDirectoryFlags:()=>Cre,WatchDirectoryKind:()=>yre,WatchFileKind:()=>hre,WatchLogLevel:()=>Nle,WatchType:()=>du,accessPrivateIdentifier:()=>qce,addEmitFlags:()=>cg,addEmitHelper:()=>pC,addEmitHelpers:()=>Mh,addInternalEmitFlags:()=>Jx,addNodeFactoryPatcher:()=>Ixe,addObjectAllocatorPatcher:()=>gxe,addRange:()=>Qn,addRelatedInfo:()=>ca,addSyntheticLeadingComment:()=>G1,addSyntheticTrailingComment:()=>TA,addToSeen:()=>wd,advancedAsyncSuperHelper:()=>DL,affectsDeclarationPathOptionDeclarations:()=>Moe,affectsEmitOptionDeclarations:()=>Roe,allKeysStartWithDot:()=>xR,altDirectorySeparator:()=>dF,and:()=>sF,append:()=>Jr,appendIfUnique:()=>fy,arrayFrom:()=>Ts,arrayIsEqualTo:()=>sp,arrayIsHomogeneous:()=>Kse,arrayOf:()=>fte,arrayReverseIterator:()=>Ez,arrayToMap:()=>rw,arrayToMultiMap:()=>mI,arrayToNumericMap:()=>dte,assertType:()=>$Se,assign:()=>fx,asyncSuperHelper:()=>wL,attachFileToDiagnostics:()=>iC,base64decode:()=>hse,base64encode:()=>gse,binarySearch:()=>y1,binarySearchKey:()=>Tk,bindSourceFile:()=>Cce,breakIntoCharacterSpans:()=>afe,breakIntoWordSpans:()=>ofe,buildLinkParts:()=>A_e,buildOpts:()=>A8,buildOverload:()=>yOe,bundlerModuleNameResolver:()=>pce,canBeConvertedToAsync:()=>wX,canHaveDecorators:()=>h2,canHaveExportModifier:()=>e8,canHaveFlowNode:()=>Nw,canHaveIllegalDecorators:()=>Fq,canHaveIllegalModifiers:()=>hoe,canHaveIllegalType:()=>iTe,canHaveIllegalTypeParameters:()=>goe,canHaveJSDoc:()=>x3,canHaveLocals:()=>jg,canHaveModifiers:()=>Nd,canHaveModuleSpecifier:()=>jie,canHaveSymbol:()=>gm,canIncludeBindAndCheckDiagnostics:()=>pA,canJsonReportNoInputFiles:()=>R8,canProduceDiagnostics:()=>$8,canUsePropertyAccess:()=>jV,canWatchAffectingLocation:()=>aue,canWatchAtTypes:()=>sue,canWatchDirectoryOrFile:()=>wH,canWatchDirectoryOrFilePath:()=>o7,cartesianProduct:()=>kte,cast:()=>_a,chainBundle:()=>Cm,chainDiagnosticMessages:()=>Js,changeAny