to-where-cli
Version:
> If you want to know more about the usage, please refer to the [documentation](https://skypesky.gitbook.io/to-where-cli/).
20 lines • 341 kB
JavaScript
#! /usr/bin/env node
var HE=Object.create;var Xd=Object.defineProperty;var BE=Object.getOwnPropertyDescriptor;var UE=Object.getOwnPropertyNames;var jE=Object.getPrototypeOf,GE=Object.prototype.hasOwnProperty;var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zE=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of UE(t))!GE.call(e,o)&&o!==r&&Xd(e,o,{get:()=>t[o],enumerable:!(n=BE(t,o))||n.enumerable});return e};var Ze=(e,t,r)=>(r=e!=null?HE(jE(e)):{},zE(t||!e||!e.__esModule?Xd(r,"default",{value:e,enumerable:!0}):r,e));var Zd=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Nr=(e,t,r)=>(Zd(e,t,"read from private field"),r?r.call(e):t.get(e)),Di=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)};var Me=(e,t,r)=>(Zd(e,t,"access private method"),r);var Fn=C(Il=>{var io=class extends Error{constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},Fl=class extends io{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Il.CommanderError=io;Il.InvalidArgumentError=Fl});var no=C($l=>{var{InvalidArgumentError:YE}=Fn(),kl=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new YE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function VE(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}$l.Argument=kl;$l.humanReadableArgName=VE});var Ll=C(Qd=>{var{humanReadableArgName:KE}=no(),Pl=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(t){let r=t.commands.filter(n=>!n._hidden);if(t._hasImplicitHelpCommand()){let[,n,o]=t._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),u=t.createCommand(n).helpOption(!1);u.description(t._helpCommandDescription),o&&u.arguments(o),r.push(u)}return this.sortSubcommands&&r.sort((n,o)=>n.name().localeCompare(o.name())),r}compareOptions(t,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(u=>!u.hidden),n=t._hasHelpOption&&t._helpShortFlag&&!t._findOption(t._helpShortFlag),o=t._hasHelpOption&&!t._findOption(t._helpLongFlag);if(n||o){let u;n?o?u=t.createOption(t._helpFlags,t._helpDescription):u=t.createOption(t._helpShortFlag,t._helpDescription):u=t.createOption(t._helpLongFlag,t._helpDescription),r.push(u)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let o=n.options.filter(u=>!u.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t._args.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t._args.find(r=>r.description)?t._args:[]}subcommandTerm(t){let r=t._args.map(n=>KE(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,o)=>Math.max(n,r.subcommandTerm(o).length),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,o)=>Math.max(n,r.optionTerm(o).length),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,o)=>Math.max(n,r.optionTerm(o).length),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,o)=>Math.max(n,r.argumentTerm(o).length),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let o=t.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];return t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0?`${t.description} (${r.join(", ")})`:t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatHelp(t,r){let n=r.padWidth(t,r),o=r.helpWidth||80,u=2,a=2;function h(E,$){if($){let k=`${E.padEnd(n+a)}${$}`;return r.wrap(k,o-u,n+a)}return E}function f(E){return E.join(`
`).replace(/^/gm," ".repeat(u))}let m=[`Usage: ${r.commandUsage(t)}`,""],y=r.commandDescription(t);y.length>0&&(m=m.concat([y,""]));let w=r.visibleArguments(t).map(E=>h(r.argumentTerm(E),r.argumentDescription(E)));w.length>0&&(m=m.concat(["Arguments:",f(w),""]));let S=r.visibleOptions(t).map(E=>h(r.optionTerm(E),r.optionDescription(E)));if(S.length>0&&(m=m.concat(["Options:",f(S),""])),this.showGlobalOptions){let E=r.visibleGlobalOptions(t).map($=>h(r.optionTerm($),r.optionDescription($)));E.length>0&&(m=m.concat(["Global Options:",f(E),""]))}let A=r.visibleCommands(t).map(E=>h(r.subcommandTerm(E),r.subcommandDescription(E)));return A.length>0&&(m=m.concat(["Commands:",f(A),""])),m.join(`
`)}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,n,o=40){if(t.match(/[\n]\s+/))return t;let u=r-n;if(u<o)return t;let a=t.slice(0,n),h=t.slice(n),f=" ".repeat(n),m=new RegExp(".{1,"+(u-1)+"}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)","g"),y=h.match(m)||[];return a+y.map((w,S)=>(w.slice(-1)===`
`&&(w=w.slice(0,w.length-1)),(S>0?f:"")+w.trimRight())).join(`
`)}};Qd.Help=Pl});var Rl=C(so=>{var{InvalidArgumentError:JE}=Fn(),Dl=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=ep(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){return this.implied=Object.assign(this.implied||{},t),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_concatValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:r.concat(t)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new JE(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return XE(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Ml=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,u=o!==void 0?o:!1;return r.negate===(u===t)}};function XE(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function ep(e){let t,r,n=e.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(t=n.shift()),r=n.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}so.Option=Dl;so.splitOptionFlags=ep;so.DualOptions=Ml});var rp=C(tp=>{function ZE(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let u=1;e[o-1]===t[n-1]?u=0:u=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+u),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[e.length][t.length]}function QE(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(a=>a.slice(2)));let n=[],o=3,u=.4;return t.forEach(a=>{if(a.length<=1)return;let h=ZE(e,a),f=Math.max(e.length,a.length);(f-h)/f>u&&(h<o?(o=h,n=[a]):h===o&&n.push(a))}),n.sort((a,h)=>a.localeCompare(h)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
(Did you mean ${n[0]}?)`:""}tp.suggestSimilar=QE});var lp=C(up=>{var eT=require("events").EventEmitter,ql=require("child_process"),yr=require("path"),Nl=require("fs"),we=require("process"),{Argument:tT,humanReadableArgName:rT}=no(),{CommanderError:Wl}=Fn(),{Help:iT}=Ll(),{Option:ip,splitOptionFlags:nT,DualOptions:sT}=Rl(),{suggestSimilar:np}=rp(),kn=class extends eT{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:r=>we.stdout.write(r),writeErr:r=>we.stderr.write(r),getOutHelpWidth:()=>we.stdout.isTTY?we.stdout.columns:void 0,getErrHelpWidth:()=>we.stderr.isTTY?we.stderr.columns:void 0,outputError:(r,n)=>n(r)},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(t){return this._outputConfiguration=t._outputConfiguration,this._hasHelpOption=t._hasHelpOption,this._helpFlags=t._helpFlags,this._helpDescription=t._helpDescription,this._helpShortFlag=t._helpShortFlag,this._helpLongFlag=t._helpLongFlag,this._helpCommandName=t._helpCommandName,this._helpCommandnameAndArgs=t._helpCommandnameAndArgs,this._helpCommandDescription=t._helpCommandDescription,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}command(t,r,n){let o=r,u=n;typeof o=="object"&&o!==null&&(u=o,o=null),u=u||{};let[,a,h]=t.match(/([^ ]+) *(.*)/),f=this.createCommand(a);return o&&(f.description(o),f._executableHandler=!0),u.isDefault&&(this._defaultCommandName=f._name),f._hidden=!!(u.noHelp||u.hidden),f._executableFile=u.executableFile||null,h&&f.arguments(h),this.commands.push(f),f.parent=this,f.copyInheritedSettings(this),o?this:f}createCommand(t){return new kn(t)}createHelp(){return Object.assign(new iT,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,t),this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this.commands.push(t),t.parent=this,this}createArgument(t,r){return new tT(t,r)}argument(t,r,n,o){let u=this.createArgument(t,r);return typeof n=="function"?u.default(o).argParser(n):u.default(n),this.addArgument(u),this}arguments(t){return t.split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this._args.slice(-1)[0];if(r&&r.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this._args.push(t),this}addHelpCommand(t,r){return t===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof t=="string"&&(this._helpCommandName=t.split(" ")[0],this._helpCommandnameAndArgs=t),this._helpCommandDescription=r||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(t,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,n){this._exitCallback&&this._exitCallback(new Wl(t,r,n)),we.exit(t)}action(t){let r=n=>{let o=this._args.length,u=n.slice(0,o);return this._storeOptionsAsProperties?u[o]=this:u[o]=this.opts(),u.push(this),t.apply(this,u)};return this._actionHandler=r,this}createOption(t,r){return new ip(t,r)}addOption(t){let r=t.name(),n=t.attributeName();if(t.negate){let u=t.long.replace(/^--no-/,"--");this._findOption(u)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");this.options.push(t);let o=(u,a,h)=>{u==null&&t.presetArg!==void 0&&(u=t.presetArg);let f=this.getOptionValue(n);if(u!==null&&t.parseArg)try{u=t.parseArg(u,f)}catch(m){if(m.code==="commander.invalidArgument"){let y=`${a} ${m.message}`;this.error(y,{exitCode:m.exitCode,code:m.code})}throw m}else u!==null&&t.variadic&&(u=t._concatValue(u,f));u==null&&(t.negate?u=!1:t.isBoolean()||t.optional?u=!0:u=""),this.setOptionValueWithSource(n,u,h)};return this.on("option:"+r,u=>{let a=`error: option '${t.flags}' argument '${u}' is invalid.`;o(u,a,"cli")}),t.envVar&&this.on("optionEnv:"+r,u=>{let a=`error: option '${t.flags}' value '${u}' from env '${t.envVar}' is invalid.`;o(u,a,"env")}),this}_optionEx(t,r,n,o,u){if(typeof r=="object"&&r instanceof ip)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(r,n);if(a.makeOptionMandatory(!!t.mandatory),typeof o=="function")a.default(u).argParser(o);else if(o instanceof RegExp){let h=o;o=(f,m)=>{let y=h.exec(f);return y?y[0]:m},a.default(u).argParser(o)}else a.default(o);return this.addOption(a)}option(t,r,n,o){return this._optionEx({},t,r,n,o)}requiredOption(t,r,n,o){return this._optionEx({mandatory:!0},t,r,n,o)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){if(this._passThroughOptions=!!t,this.parent&&t&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(t=!0){if(this._storeOptionsAsProperties=!!t,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,n){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return In(this).forEach(n=>{n.getOptionValueSource(t)!==void 0&&(r=n.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");r=r||{},t===void 0&&(t=we.argv,we.versions&&we.versions.electron&&(r.from="electron")),this.rawArgs=t.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":we.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,r){let n=this._prepareUserArgs(t,r);return this._parseCommand([],n),this}async parseAsync(t,r){let n=this._prepareUserArgs(t,r);return await this._parseCommand([],n),this}_executeSubCommand(t,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function u(y,w){let S=yr.resolve(y,w);if(Nl.existsSync(S))return S;if(o.includes(yr.extname(w)))return;let A=o.find(E=>Nl.existsSync(`${S}${E}`));if(A)return`${S}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,h=this._executableDir||"";if(this._scriptPath){let y;try{y=Nl.realpathSync(this._scriptPath)}catch{y=this._scriptPath}h=yr.resolve(yr.dirname(y),h)}if(h){let y=u(h,a);if(!y&&!t._executableFile&&this._scriptPath){let w=yr.basename(this._scriptPath,yr.extname(this._scriptPath));w!==this._name&&(y=u(h,`${w}-${t._name}`))}a=y||a}n=o.includes(yr.extname(a));let f;we.platform!=="win32"?n?(r.unshift(a),r=op(we.execArgv).concat(r),f=ql.spawn(we.argv[0],r,{stdio:"inherit"})):f=ql.spawn(a,r,{stdio:"inherit"}):(r.unshift(a),r=op(we.execArgv).concat(r),f=ql.spawn(we.execPath,r,{stdio:"inherit"})),f.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(w=>{we.on(w,()=>{f.killed===!1&&f.exitCode===null&&f.kill(w)})});let m=this._exitCallback;m?f.on("close",()=>{m(new Wl(we.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):f.on("close",we.exit.bind(we)),f.on("error",y=>{if(y.code==="ENOENT"){let w=h?`searched for local subcommand relative to directory '${h}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",S=`'${a}' does not exist
- if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- ${w}`;throw new Error(S)}else if(y.code==="EACCES")throw new Error(`'${a}' not executable`);if(!m)we.exit(1);else{let w=new Wl(1,"commander.executeSubCommandAsync","(error)");w.nestedError=y,m(w)}}),this.runningCommand=f}_dispatchSubcommand(t,r,n){let o=this._findCommand(t);o||this.help({error:!0});let u;return u=this._chainOrCallSubCommandHook(u,o,"preSubcommand"),u=this._chainOrCall(u,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),u}_checkNumberOfArguments(){this._args.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,o,u)=>{let a=o;if(o!==null&&n.parseArg)try{a=n.parseArg(o,u)}catch(h){if(h.code==="commander.invalidArgument"){let f=`error: command-argument value '${o}' is invalid for argument '${n.name()}'. ${h.message}`;this.error(f,{exitCode:h.exitCode,code:h.code})}throw h}return a};this._checkNumberOfArguments();let r=[];this._args.forEach((n,o)=>{let u=n.defaultValue;n.variadic?o<this.args.length?(u=this.args.slice(o),n.parseArg&&(u=u.reduce((a,h)=>t(n,h,a),n.defaultValue))):u===void 0&&(u=[]):o<this.args.length&&(u=this.args[o],n.parseArg&&(u=t(n,u,n.defaultValue))),r[o]=u}),this.processedArgs=r}_chainOrCall(t,r){return t&&t.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,o=[];return In(this).reverse().filter(u=>u._lifeCycleHooks[r]!==void 0).forEach(u=>{u._lifeCycleHooks[r].forEach(a=>{o.push({hookedCommand:u,callback:a})})}),r==="postAction"&&o.reverse(),o.forEach(u=>{n=this._chainOrCall(n,()=>u.callback(u.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let o=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(u=>{o=this._chainOrCall(o,()=>u(this,r))}),o}_parseCommand(t,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),r=n.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._hasImplicitHelpCommand()&&t[0]===this._helpCommandName)return t.length===1&&this.help(),this._dispatchSubcommand(t[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return sp(this,r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),sp(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},u=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(u,t,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(u))o(),this._processArguments(),this.parent.emit(u,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){for(let t=this;t;t=t.parent)t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=t.find(u=>n.conflictsWith.includes(u.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){for(let t=this;t;t=t.parent)t._checkForConflictingLocalOptions()}parseOptions(t){let r=[],n=[],o=r,u=t.slice();function a(f){return f.length>1&&f[0]==="-"}let h=null;for(;u.length;){let f=u.shift();if(f==="--"){o===n&&o.push(f),o.push(...u);break}if(h&&!a(f)){this.emit(`option:${h.name()}`,f);continue}if(h=null,a(f)){let m=this._findOption(f);if(m){if(m.required){let y=u.shift();y===void 0&&this.optionMissingArgument(m),this.emit(`option:${m.name()}`,y)}else if(m.optional){let y=null;u.length>0&&!a(u[0])&&(y=u.shift()),this.emit(`option:${m.name()}`,y)}else this.emit(`option:${m.name()}`);h=m.variadic?m:null;continue}}if(f.length>2&&f[0]==="-"&&f[1]!=="-"){let m=this._findOption(`-${f[1]}`);if(m){m.required||m.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${m.name()}`,f.slice(2)):(this.emit(`option:${m.name()}`),u.unshift(`-${f.slice(2)}`));continue}}if(/^--[^=]+=/.test(f)){let m=f.indexOf("="),y=this._findOption(f.slice(0,m));if(y&&(y.required||y.optional)){this.emit(`option:${y.name()}`,f.slice(m+1));continue}}if(a(f)&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(f)){r.push(f),u.length>0&&n.push(...u);break}else if(f===this._helpCommandName&&this._hasImplicitHelpCommand()){r.push(f),u.length>0&&r.push(...u);break}else if(this._defaultCommandName){n.push(f),u.length>0&&n.push(...u);break}}if(this._passThroughOptions){o.push(f),u.length>0&&o.push(...u);break}o.push(f)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();t[o]=o===this._versionOptionName?this._version:this[o]}return t}return this._optionValues}optsWithGlobals(){return In(this).reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,u=n.code||"commander.error";this._exit(o,u,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in we.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,we.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new sT(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let n=a=>{let h=a.attributeName(),f=this.getOptionValue(h),m=this.options.find(w=>w.negate&&h===w.attributeName()),y=this.options.find(w=>!w.negate&&h===w.attributeName());return m&&(m.presetArg===void 0&&f===!1||m.presetArg!==void 0&&f===m.presetArg)?m:y||a},o=a=>{let h=n(a),f=h.attributeName();return this.getOptionValueSource(f)==="env"?`environment variable '${h.envVar}'`:`option '${h.flags}'`},u=`error: ${o(t)} cannot be used with ${o(r)}`;this.error(u,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let o=[],u=this;do{let a=u.createHelp().visibleOptions(u).filter(h=>h.long).map(h=>h.long);o=o.concat(a),u=u.parent}while(u&&!u._enablePositionalOptions);r=np(t,o)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this._args.length,n=r===1?"":"s",u=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(u,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(u=>{o.push(u.name()),u.alias()&&o.push(u.alias())}),r=np(t,o)}let n=`error: unknown command '${t}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(t,r,n){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this.options.push(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${t}
`),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this._args.map(n=>rT(n));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}nameFromFilename(t){return this._name=yr.basename(t,yr.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp();return r.helpWidth===void 0&&(r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),r.formatHelp(this,r)}_getHelpContext(t){t=t||{};let r={error:!!t.error},n;return r.error?n=o=>this._outputConfiguration.writeErr(o):n=o=>this._outputConfiguration.writeOut(o),r.write=t.write||n,r.command=this,r}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let n=this._getHelpContext(t);In(this).reverse().forEach(u=>u.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let o=this.helpInformation(n);if(r&&(o=r(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(o),this.emit(this._helpLongFlag),this.emit("afterHelp",n),In(this).forEach(u=>u.emit("afterAllHelp",n))}helpOption(t,r){if(typeof t=="boolean")return this._hasHelpOption=t,this;this._helpFlags=t||this._helpFlags,this._helpDescription=r||this._helpDescription;let n=nT(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(t){this.outputHelp(t);let r=we.exitCode||0;r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${n.join("', '")}'`);let o=`${t}Help`;return this.on(o,u=>{let a;typeof r=="function"?a=r({error:u.error,command:u.command}):a=r,a&&u.write(`${a}
`)}),this}};function sp(e,t){e._hasHelpOption&&t.find(n=>n===e._helpLongFlag||n===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function op(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",u;return(u=t.match(/^(--inspect(-brk)?)$/))!==null?r=u[1]:(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=u[1],/^\d+$/.test(u[3])?o=u[3]:n=u[3]):(u=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=u[1],n=u[3],o=u[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:t})}function In(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}up.Command=kn});var fp=C((Gt,hp)=>{var{Argument:oT}=no(),{Command:ap}=lp(),{CommanderError:uT,InvalidArgumentError:cp}=Fn(),{Help:lT}=Ll(),{Option:aT}=Rl();Gt=hp.exports=new ap;Gt.program=Gt;Gt.Argument=oT;Gt.Command=ap;Gt.CommanderError=uT;Gt.Help=lT;Gt.InvalidArgumentError=cp;Gt.InvalidOptionArgumentError=cp;Gt.Option=aT});var mp=C((kM,pp)=>{var Hl=require("os");pp.exports=new function(){function t(){return Hl.type()==="Windows_NT"}function r(){return Hl.type()==="Darwin"}function n(){return Hl.type()==="Linux"}this.isWindows=t(),this.isOSX=r(),this.isLinux=n()}});var Ul=C(($M,yp)=>{"use strict";var gp=require("fs"),Bl;function cT(){try{return gp.statSync("/.dockerenv"),!0}catch{return!1}}function hT(){try{return gp.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}yp.exports=()=>(Bl===void 0&&(Bl=cT()||hT()),Bl)});var _p=C((PM,jl)=>{"use strict";var fT=require("os"),dT=require("fs"),vp=Ul(),wp=()=>{if(process.platform!=="linux")return!1;if(fT.release().toLowerCase().includes("microsoft"))return!vp();try{return dT.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!vp():!1}catch{return!1}};process.env.__IS_WSL_TEST__?jl.exports=wp:jl.exports=wp()});var bp=C((LM,xp)=>{"use strict";xp.exports=(e,t,r)=>{let n=o=>Object.defineProperty(e,t,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),e}});var Fp=C((DM,Tp)=>{var pT=require("path"),mT=require("child_process"),{promises:uo,constants:Ep}=require("fs"),oo=_p(),gT=Ul(),zl=bp(),Sp=pT.join(__dirname,"xdg-open"),{platform:Mi,arch:Ap}=process,yT=()=>{try{return uo.statSync("/run/.containerenv"),!0}catch{return!1}},Gl;function vT(){return Gl===void 0&&(Gl=yT()||gT()),Gl}var wT=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let r="/etc/wsl.conf",n=!1;try{await uo.access(r,Ep.F_OK),n=!0}catch{}if(!n)return e;let o=await uo.readFile(r,{encoding:"utf8"}),u=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return u?(t=u.groups.mountPoint.trim(),t=t.endsWith("/")?t:`${t}/`,t):e}})(),Op=async(e,t)=>{let r;for(let n of e)try{return await t(n)}catch(o){r=o}throw r},lo=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return Op(e.app,h=>lo({...e,app:h}));let{name:t,arguments:r=[]}=e.app||{};if(r=[...r],Array.isArray(t))return Op(t,h=>lo({...e,app:{name:h,arguments:r}}));let n,o=[],u={};if(Mi==="darwin")n="open",e.wait&&o.push("--wait-apps"),e.background&&o.push("--background"),e.newInstance&&o.push("--new"),t&&o.push("-a",t);else if(Mi==="win32"||oo&&!vT()&&!t){let h=await wT();n=oo?`${h}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,o.push("-NoProfile","-NonInteractive","\u2013ExecutionPolicy","Bypass","-EncodedCommand"),oo||(u.windowsVerbatimArguments=!0);let f=["Start"];e.wait&&f.push("-Wait"),t?(f.push(`"\`"${t}\`""`,"-ArgumentList"),e.target&&r.unshift(e.target)):e.target&&f.push(`"${e.target}"`),r.length>0&&(r=r.map(m=>`"\`"${m}\`""`),f.push(r.join(","))),e.target=Buffer.from(f.join(" "),"utf16le").toString("base64")}else{if(t)n=t;else{let h=!__dirname||__dirname==="/",f=!1;try{await uo.access(Sp,Ep.X_OK),f=!0}catch{}n=process.versions.electron||Mi==="android"||h||!f?"xdg-open":Sp}r.length>0&&o.push(...r),e.wait||(u.stdio="ignore",u.detached=!0)}e.target&&o.push(e.target),Mi==="darwin"&&r.length>0&&o.push("--args",...r);let a=mT.spawn(n,o,u);return e.wait?new Promise((h,f)=>{a.once("error",f),a.once("close",m=>{if(!e.allowNonzeroExitCode&&m>0){f(new Error(`Exited with code ${m}`));return}h(a)})}):(a.unref(),a)},Yl=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return lo({...t,target:e})},_T=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `name`");let{arguments:r=[]}=t||{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return lo({...t,app:{name:e,arguments:r}})};function Cp(e){if(typeof e=="string"||Array.isArray(e))return e;let{[Ap]:t}=e;if(!t)throw new Error(`${Ap} is not supported`);return t}function Vl({[Mi]:e},{wsl:t}){if(t&&oo)return Cp(t);if(!e)throw new Error(`${Mi} is not supported`);return Cp(e)}var ao={};zl(ao,"chrome",()=>Vl({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));zl(ao,"firefox",()=>Vl({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));zl(ao,"edge",()=>Vl({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Yl.apps=ao;Yl.openApp=_T;Tp.exports=Yl});var kp=C((MM,Ip)=>{"use strict";Ip.exports=Object.freeze({encoding:"utf8",silent:!1})});var Pp=C((RM,$p)=>{"use strict";function xT(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function bT(e){return e==="false"&&(e=!1),!!e}function ST(e){var t=kp();return xT(e)?typeof e.silent<"u"&&(e.silent=bT(e.silent)):e={},e=Object.assign({},t,e),e.silent&&typeof e.stdio>"u"&&(e.stdio="pipe"),e}$p.exports=ST});var Kl=C((qM,Lp)=>{"use strict";var AT=require("child_process"),OT=Pp();function CT(e,t){t=OT(t);var r,n,o,u,a;try{r=null,n=AT.execSync(e,t),o="",u=0,a=!0}catch(h){r=h,n=h.stdout,o=h.stderr,u=h.status||1,a=!1}return{error:r,stdout:n,stderr:o,code:u,ok:a}}Lp.exports=CT});var mt=C(ha=>{"use strict";ha.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]=="function")e.apply(this,t);else return new Promise((r,n)=>{t.push((o,u)=>o!=null?n(o):r(u)),e.apply(this,t)})},"name",{value:e.name})};ha.fromPromise=function(e){return Object.defineProperty(function(...t){let r=t[t.length-1];if(typeof r!="function")return e.apply(this,t);t.pop(),e.apply(this,t).then(n=>r(null,n),r)},"name",{value:e.name})}});var Hm=C((UM,Wm)=>{var Br=require("constants"),YI=process.cwd,yo=null,VI=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return yo||(yo=YI.call(process)),yo};try{process.cwd()}catch{}typeof process.chdir=="function"&&(fa=process.chdir,process.chdir=function(e){yo=null,fa.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,fa));var fa;Wm.exports=KI;function KI(e){Br.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||r(e),e.chown=u(e.chown),e.fchown=u(e.fchown),e.lchown=u(e.lchown),e.chmod=n(e.chmod),e.fchmod=n(e.fchmod),e.lchmod=n(e.lchmod),e.chownSync=a(e.chownSync),e.fchownSync=a(e.fchownSync),e.lchownSync=a(e.lchownSync),e.chmodSync=o(e.chmodSync),e.fchmodSync=o(e.fchmodSync),e.lchmodSync=o(e.lchmodSync),e.stat=h(e.stat),e.fstat=h(e.fstat),e.lstat=h(e.lstat),e.statSync=f(e.statSync),e.fstatSync=f(e.fstatSync),e.lstatSync=f(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(y,w,S){S&&process.nextTick(S)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(y,w,S,A){A&&process.nextTick(A)},e.lchownSync=function(){}),VI==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(y){function w(S,A,E){var $=Date.now(),k=0;y(S,A,function L(D){if(D&&(D.code==="EACCES"||D.code==="EPERM"||D.code==="EBUSY")&&Date.now()-$<6e4){setTimeout(function(){e.stat(A,function(W,ye){W&&W.code==="ENOENT"?y(S,A,L):E(D)})},k),k<100&&(k+=10);return}E&&E(D)})}return Object.setPrototypeOf&&Object.setPrototypeOf(w,y),w}(e.rename)),e.read=typeof e.read!="function"?e.read:function(y){function w(S,A,E,$,k,L){var D;if(L&&typeof L=="function"){var W=0;D=function(ye,Ne,rt){if(ye&&ye.code==="EAGAIN"&&W<10)return W++,y.call(e,S,A,E,$,k,D);L.apply(this,arguments)}}return y.call(e,S,A,E,$,k,D)}return Object.setPrototypeOf&&Object.setPrototypeOf(w,y),w}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(y){return function(w,S,A,E,$){for(var k=0;;)try{return y.call(e,w,S,A,E,$)}catch(L){if(L.code==="EAGAIN"&&k<10){k++;continue}throw L}}}(e.readSync);function t(y){y.lchmod=function(w,S,A){y.open(w,Br.O_WRONLY|Br.O_SYMLINK,S,function(E,$){if(E){A&&A(E);return}y.fchmod($,S,function(k){y.close($,function(L){A&&A(k||L)})})})},y.lchmodSync=function(w,S){var A=y.openSync(w,Br.O_WRONLY|Br.O_SYMLINK,S),E=!0,$;try{$=y.fchmodSync(A,S),E=!1}finally{if(E)try{y.closeSync(A)}catch{}else y.closeSync(A)}return $}}function r(y){Br.hasOwnProperty("O_SYMLINK")&&y.futimes?(y.lutimes=function(w,S,A,E){y.open(w,Br.O_SYMLINK,function($,k){if($){E&&E($);return}y.futimes(k,S,A,function(L){y.close(k,function(D){E&&E(L||D)})})})},y.lutimesSync=function(w,S,A){var E=y.openSync(w,Br.O_SYMLINK),$,k=!0;try{$=y.futimesSync(E,S,A),k=!1}finally{if(k)try{y.closeSync(E)}catch{}else y.closeSync(E)}return $}):y.futimes&&(y.lutimes=function(w,S,A,E){E&&process.nextTick(E)},y.lutimesSync=function(){})}function n(y){return y&&function(w,S,A){return y.call(e,w,S,function(E){m(E)&&(E=null),A&&A.apply(this,arguments)})}}function o(y){return y&&function(w,S){try{return y.call(e,w,S)}catch(A){if(!m(A))throw A}}}function u(y){return y&&function(w,S,A,E){return y.call(e,w,S,A,function($){m($)&&($=null),E&&E.apply(this,arguments)})}}function a(y){return y&&function(w,S,A){try{return y.call(e,w,S,A)}catch(E){if(!m(E))throw E}}}function h(y){return y&&function(w,S,A){typeof S=="function"&&(A=S,S=null);function E($,k){k&&(k.uid<0&&(k.uid+=4294967296),k.gid<0&&(k.gid+=4294967296)),A&&A.apply(this,arguments)}return S?y.call(e,w,S,E):y.call(e,w,E)}}function f(y){return y&&function(w,S){var A=S?y.call(e,w,S):y.call(e,w);return A&&(A.uid<0&&(A.uid+=4294967296),A.gid<0&&(A.gid+=4294967296)),A}}function m(y){if(!y||y.code==="ENOSYS")return!0;var w=!process.getuid||process.getuid()!==0;return!!(w&&(y.code==="EINVAL"||y.code==="EPERM"))}}});var jm=C((jM,Um)=>{var Bm=require("stream").Stream;Um.exports=JI;function JI(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);Bm.call(this);var u=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,o=o||{};for(var a=Object.keys(o),h=0,f=a.length;h<f;h++){var m=a[h];this[m]=o[m]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){u._read()});return}e.open(this.path,this.flags,this.mode,function(y,w){if(y){u.emit("error",y),u.readable=!1;return}u.fd=w,u.emit("open",w),u._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);Bm.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};for(var u=Object.keys(o),a=0,h=u.length;a<h;a++){var f=u[a];this[f]=o[f]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var zm=C((GM,Gm)=>{"use strict";Gm.exports=ZI;var XI=Object.getPrototypeOf||function(e){return e.__proto__};function ZI(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:XI(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}});var ut=C((zM,ma)=>{var xe=require("fs"),QI=Hm(),ek=jm(),tk=zm(),vo=require("util"),Ve,_o;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Ve=Symbol.for("graceful-fs.queue"),_o=Symbol.for("graceful-fs.previous")):(Ve="___graceful-fs.queue",_o="___graceful-fs.previous");function rk(){}function Km(e,t){Object.defineProperty(e,Ve,{get:function(){return t}})}var pi=rk;vo.debuglog?pi=vo.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(pi=function(){var e=vo.format.apply(vo,arguments);e="GFS4: "+e.split(/\n/).join(`
GFS4: `),console.error(e)});xe[Ve]||(Ym=global[Ve]||[],Km(xe,Ym),xe.close=function(e){function t(r,n){return e.call(xe,r,function(o){o||Vm(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(t,_o,{value:e}),t}(xe.close),xe.closeSync=function(e){function t(r){e.apply(xe,arguments),Vm()}return Object.defineProperty(t,_o,{value:e}),t}(xe.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){pi(xe[Ve]),require("assert").equal(xe[Ve].length,0)}));var Ym;global[Ve]||Km(global,xe[Ve]);ma.exports=da(tk(xe));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xe.__patched&&(ma.exports=da(xe),xe.__patched=!0);function da(e){QI(e),e.gracefulify=da,e.createReadStream=Ne,e.createWriteStream=rt;var t=e.readFile;e.readFile=r;function r(B,ee,X){return typeof ee=="function"&&(X=ee,ee=null),Ee(B,ee,X);function Ee(Pe,Ie,se,oe){return t(Pe,Ie,function(he){he&&(he.code==="EMFILE"||he.code==="ENFILE")?Hi([Ee,[Pe,Ie,se],he,oe||Date.now(),Date.now()]):typeof se=="function"&&se.apply(this,arguments)})}}var n=e.writeFile;e.writeFile=o;function o(B,ee,X,Ee){return typeof X=="function"&&(Ee=X,X=null),Pe(B,ee,X,Ee);function Pe(Ie,se,oe,he,Oe){return n(Ie,se,oe,function(te){te&&(te.code==="EMFILE"||te.code==="ENFILE")?Hi([Pe,[Ie,se,oe,he],te,Oe||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var u=e.appendFile;u&&(e.appendFile=a);function a(B,ee,X,Ee){return typeof X=="function"&&(Ee=X,X=null),Pe(B,ee,X,Ee);function Pe(Ie,se,oe,he,Oe){return u(Ie,se,oe,function(te){te&&(te.code==="EMFILE"||te.code==="ENFILE")?Hi([Pe,[Ie,se,oe,he],te,Oe||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var h=e.copyFile;h&&(e.copyFile=f);function f(B,ee,X,Ee){return typeof X=="function"&&(Ee=X,X=0),Pe(B,ee,X,Ee);function Pe(Ie,se,oe,he,Oe){return h(Ie,se,oe,function(te){te&&(te.code==="EMFILE"||te.code==="ENFILE")?Hi([Pe,[Ie,se,oe,he],te,Oe||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}var m=e.readdir;e.readdir=w;var y=/^v[0-5]\./;function w(B,ee,X){typeof ee=="function"&&(X=ee,ee=null);var Ee=y.test(process.version)?function(se,oe,he,Oe){return m(se,Pe(se,oe,he,Oe))}:function(se,oe,he,Oe){return m(se,oe,Pe(se,oe,he,Oe))};return Ee(B,ee,X);function Pe(Ie,se,oe,he){return function(Oe,te){Oe&&(Oe.code==="EMFILE"||Oe.code==="ENFILE")?Hi([Ee,[Ie,se,oe],Oe,he||Date.now(),Date.now()]):(te&&te.sort&&te.sort(),typeof oe=="function"&&oe.call(this,Oe,te))}}}if(process.version.substr(0,4)==="v0.8"){var S=ek(e);L=S.ReadStream,W=S.WriteStream}var A=e.ReadStream;A&&(L.prototype=Object.create(A.prototype),L.prototype.open=D);var E=e.WriteStream;E&&(W.prototype=Object.create(E.prototype),W.prototype.open=ye),Object.defineProperty(e,"ReadStream",{get:function(){return L},set:function(B){L=B},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return W},set:function(B){W=B},enumerable:!0,configurable:!0});var $=L;Object.defineProperty(e,"FileReadStream",{get:function(){return $},set:function(B){$=B},enumerable:!0,configurable:!0});var k=W;Object.defineProperty(e,"FileWriteStream",{get:function(){return k},set:function(B){k=B},enumerable:!0,configurable:!0});function L(B,ee){return this instanceof L?(A.apply(this,arguments),this):L.apply(Object.create(L.prototype),arguments)}function D(){var B=this;qt(B.path,B.flags,B.mode,function(ee,X){ee?(B.autoClose&&B.destroy(),B.emit("error",ee)):(B.fd=X,B.emit("open",X),B.read())})}function W(B,ee){return this instanceof W?(E.apply(this,arguments),this):W.apply(Object.create(W.prototype),arguments)}function ye(){var B=this;qt(B.path,B.flags,B.mode,function(ee,X){ee?(B.destroy(),B.emit("error",ee)):(B.fd=X,B.emit("open",X))})}function Ne(B,ee){return new e.ReadStream(B,ee)}function rt(B,ee){return new e.WriteStream(B,ee)}var Rt=e.open;e.open=qt;function qt(B,ee,X,Ee){return typeof X=="function"&&(Ee=X,X=null),Pe(B,ee,X,Ee);function Pe(Ie,se,oe,he,Oe){return Rt(Ie,se,oe,function(te,vh){te&&(te.code==="EMFILE"||te.code==="ENFILE")?Hi([Pe,[Ie,se,oe,he],te,Oe||Date.now(),Date.now()]):typeof he=="function"&&he.apply(this,arguments)})}}return e}function Hi(e){pi("ENQUEUE",e[0].name,e[1]),xe[Ve].push(e),pa()}var wo;function Vm(){for(var e=Date.now(),t=0;t<xe[Ve].length;++t)xe[Ve][t].length>2&&(xe[Ve][t][3]=e,xe[Ve][t][4]=e)