js-diary
Version:
In browser interactive coding environment for JavaScript developers. Write JS code, execute it and write documentation using markdown!
27 lines • 892 kB
JavaScript
#!/usr/bin/env node
var om=Object.create,Ii=Object.defineProperty,cm=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,um=Object.getOwnPropertyNames,lm=Object.getOwnPropertyDescriptor,dm=t=>Ii(t,"__esModule",{value:!0}),v=(t,e)=>()=>(e||(e={exports:{}},t(e.exports,e)),e.exports),fm=(t,e,a)=>{if(dm(t),e&&typeof e=="object"||typeof e=="function")for(let i of um(e))!pm.call(t,i)&&i!=="default"&&Ii(t,i,{get:()=>e[i],enumerable:!(a=lm(e,i))||a.enumerable});return t},Ft=t=>t&&t.__esModule?t:fm(Ii(t!=null?om(cm(t)):{},"default",{value:t,enumerable:!0}),t),$t=v(Ni=>{var Bi=class extends Error{constructor(e,a,i){super(i);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=a,this.exitCode=e,this.nestedError=void 0}},rs=class extends Bi{constructor(e){super(1,"commander.invalidArgument",e);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};Ni.CommanderError=Bi;Ni.InvalidArgumentError=rs}),Sa=v(Fi=>{var{InvalidArgumentError:mm}=$t(),ss=class{constructor(e,a){this.description=a||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0;switch(e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,a){return a===this.defaultValue||!Array.isArray(a)?[e]:a.concat(e)}default(e,a){return this.defaultValue=e,this.defaultValueDescription=a,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e,this.parseArg=(a,i)=>{if(!e.includes(a))throw new mm(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(a,i):a},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function hm(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}Fi.Argument=ss;Fi.humanReadableArgName=hm}),$i=v(os=>{var{humanReadableArgName:vm}=Sa(),cs=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1}visibleCommands(e){let a=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),r=e.createCommand(i).helpOption(!1);r.description(e._helpCommandDescription),n&&r.arguments(n),a.push(r)}return this.sortSubcommands&&a.sort((i,n)=>i.name().localeCompare(n.name())),a}visibleOptions(e){let a=e.options.filter(r=>!r.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let r;i?n?r=e.createOption(e._helpFlags,e._helpDescription):r=e.createOption(e._helpShortFlag,e._helpDescription):r=e.createOption(e._helpLongFlag,e._helpDescription),a.push(r)}if(this.sortOptions){let r=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");a.sort((s,o)=>r(s).localeCompare(r(o)))}return a}visibleArguments(e){return e._argsDescription&&e._args.forEach(a=>{a.description=a.description||e._argsDescription[a.name()]||""}),e._args.find(a=>a.description)?e._args:[]}subcommandTerm(e){let a=e._args.map(i=>vm(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(a?" "+a:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,a){return a.visibleCommands(e).reduce((i,n)=>Math.max(i,a.subcommandTerm(n).length),0)}longestOptionTermLength(e,a){return a.visibleOptions(e).reduce((i,n)=>Math.max(i,a.optionTerm(n).length),0)}longestArgumentTermLength(e,a){return a.visibleArguments(e).reduce((i,n)=>Math.max(i,a.argumentTerm(n).length),0)}commandUsage(e){let a=e._name;e._aliases[0]&&(a=a+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+a+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.description()}optionDescription(e){if(e.negate)return e.description;let a=[];return e.argChoices&&a.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&a.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),a.length>0?`${e.description} (${a.join(", ")})`:e.description}argumentDescription(e){let a=[];if(e.argChoices&&a.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&a.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),a.length>0){let i=`(${a.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,a){let i=a.padWidth(e,a),n=a.helpWidth||80,r=2,s=2;function o(f,h){if(h){let x=`${f.padEnd(i+s)}${h}`;return a.wrap(x,n-r,i+s)}return f}function p(f){return f.join(`
`).replace(/^/gm," ".repeat(r))}let c=[`Usage: ${a.commandUsage(e)}`,""],u=a.commandDescription(e);u.length>0&&(c=c.concat([u,""]));let l=a.visibleArguments(e).map(f=>o(a.argumentTerm(f),a.argumentDescription(f)));l.length>0&&(c=c.concat(["Arguments:",p(l),""]));let d=a.visibleOptions(e).map(f=>o(a.optionTerm(f),a.optionDescription(f)));d.length>0&&(c=c.concat(["Options:",p(d),""]));let m=a.visibleCommands(e).map(f=>o(a.subcommandTerm(f),a.subcommandDescription(f)));return m.length>0&&(c=c.concat(["Commands:",p(m),""])),c.join(`
`)}padWidth(e,a){return Math.max(a.longestOptionTermLength(e,a),a.longestSubcommandTermLength(e,a),a.longestArgumentTermLength(e,a))}wrap(e,a,i,n=40){if(e.match(/[\n]\s+/))return e;let r=a-i;if(r<n)return e;let s=e.substr(0,i),o=e.substr(i),p=" ".repeat(i),c=new RegExp(".{1,"+(r-1)+"}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)","g"),u=o.match(c)||[];return s+u.map((l,d)=>(l.slice(-1)===`
`&&(l=l.slice(0,l.length-1)),(d>0?p:"")+l.trimRight())).join(`
`)}};os.Help=cs}),zi=v(Mi=>{var{InvalidArgumentError:xm}=$t(),ps=class{constructor(e,a){this.flags=e,this.description=a||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=us(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0}default(e,a){return this.defaultValue=e,this.defaultValueDescription=a,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,a){return a===this.defaultValue||!Array.isArray(a)?[e]:a.concat(e)}choices(e){return this.argChoices=e,this.parseArg=(a,i)=>{if(!e.includes(a))throw new xm(`Allowed choices are ${e.join(", ")}.`);return this.variadic?this._concatValue(a,i):a},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return gm(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}};function gm(t){return t.split("-").reduce((e,a)=>e+a[0].toUpperCase()+a.slice(1))}function us(t){let e,a,i=t.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),a=i.shift(),!e&&/^-[^-]$/.test(a)&&(e=a,a=void 0),{shortFlag:e,longFlag:a}}Mi.Option=ps;Mi.splitOptionFlags=us}),ms=v(ls=>{var bm=require("events").EventEmitter,Di=require("child_process"),We=require("path"),Ui=require("fs"),{Argument:ym,humanReadableArgName:wm}=Sa(),{CommanderError:Gi}=$t(),{Help:_m}=$i(),{Option:Em,splitOptionFlags:km}=zi(),Ra=class extends bm{constructor(e){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=e||"",this._optionValues={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._outputConfiguration={writeOut:a=>process.stdout.write(a),writeErr:a=>process.stderr.write(a),getOutHelpWidth:()=>process.stdout.isTTY?process.stdout.columns:void 0,getErrHelpWidth:()=>process.stderr.isTTY?process.stderr.columns:void 0,outputError:(a,i)=>i(a)},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(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this}command(e,a,i){let n=a,r=i;typeof n=="object"&&n!==null&&(r=n,n=null),r=r||{};let[,s,o]=e.match(/([^ ]+) *(.*)/),p=this.createCommand(s);return n&&(p.description(n),p._executableHandler=!0),r.isDefault&&(this._defaultCommandName=p._name),p._hidden=!!(r.noHelp||r.hidden),p._executableFile=r.executableFile||null,o&&p.arguments(o),this.commands.push(p),p.parent=this,p.copyInheritedSettings(this),n?this:p}createCommand(e){return new Ra(e)}createHelp(){return Object.assign(new _m,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}addCommand(e,a){if(!e._name)throw new Error("Command passed to .addCommand() must have a name");function i(n){n.forEach(r=>{if(r._executableHandler&&!r._executableFile)throw new Error(`Must specify executableFile for deeply nested executable: ${r.name()}`);i(r.commands)})}return i(e.commands),a=a||{},a.isDefault&&(this._defaultCommandName=e._name),(a.noHelp||a.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,a){return new ym(e,a)}argument(e,a,i,n){let r=this.createArgument(e,a);return typeof i=="function"?r.default(n).argParser(i):r.default(i),this.addArgument(r),this}arguments(e){return e.split(/ +/).forEach(a=>{this.argument(a)}),this}addArgument(e){let a=this._args.slice(-1)[0];if(a&&a.variadic)throw new Error(`only the last argument can be variadic '${a.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,a){return e===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof e=="string"&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=a||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,a){let i=["preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(a):this._lifeCycleHooks[e]=[a],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=a=>{if(a.code!=="commander.executeSubCommandAsync")throw a},this}_exit(e,a,i){this._exitCallback&&this._exitCallback(new Gi(e,a,i)),process.exit(e)}action(e){let a=i=>{let n=this._args.length,r=i.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=a,this}createOption(e,a){return new Em(e,a)}addOption(e){let a=e.name(),i=e.attributeName(),n=e.defaultValue;if(e.negate||e.optional||e.required||typeof n=="boolean"){if(e.negate){let r=e.long.replace(/^--no-/,"--");n=this._findOption(r)?this.getOptionValue(i):!0}n!==void 0&&this.setOptionValue(i,n)}return this.options.push(e),this.on("option:"+a,r=>{let s=this.getOptionValue(i);if(r!==null&&e.parseArg)try{r=e.parseArg(r,s===void 0?n:s)}catch(o){if(o.code==="commander.invalidArgument"){let p=`error: option '${e.flags}' argument '${r}' is invalid. ${o.message}`;this._displayError(o.exitCode,o.code,p)}throw o}else r!==null&&e.variadic&&(r=e._concatValue(r,s));typeof s=="boolean"||typeof s=="undefined"?r==null?this.setOptionValue(i,e.negate?!1:n||!0):this.setOptionValue(i,r):r!==null&&this.setOptionValue(i,e.negate?!1:r)}),this}_optionEx(e,a,i,n,r){let s=this.createOption(a,i);if(s.makeOptionMandatory(!!e.mandatory),typeof n=="function")s.default(r).argParser(n);else if(n instanceof RegExp){let o=n;n=(p,c)=>{let u=o.exec(p);return u?u[0]:c},s.default(r).argParser(n)}else s.default(n);return this.addOption(s)}option(e,a,i,n){return this._optionEx({},e,a,i,n)}requiredOption(e,a,i,n){return this._optionEx({mandatory:!0},e,a,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,!!this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,a){return this._storeOptionsAsProperties?this[e]=a:this._optionValues[e]=a,this}_prepareUserArgs(e,a){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");a=a||{},e===void 0&&(e=process.argv,process.versions&&process.versions.electron&&(a.from="electron")),this.rawArgs=e.slice();let i;switch(a.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":process.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${a.from}' }`)}return!this._scriptPath&&require.main&&(this._scriptPath=require.main.filename),this._name=this._name||this._scriptPath&&We.basename(this._scriptPath,We.extname(this._scriptPath)),i}parse(e,a){let i=this._prepareUserArgs(e,a);return this._parseCommand([],i),this}async parseAsync(e,a){let i=this._prepareUserArgs(e,a);return await this._parseCommand([],i),this}_executeSubCommand(e,a){a=a.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];this._checkForMissingMandatoryOptions();let r=this._scriptPath;!r&&require.main&&(r=require.main.filename);let s;try{let d=Ui.realpathSync(r);s=We.dirname(d)}catch(d){s="."}let o=We.basename(r,We.extname(r))+"-"+e._name;e._executableFile&&(o=e._executableFile);let p=We.join(s,o);Ui.existsSync(p)?o=p:n.forEach(d=>{Ui.existsSync(`${p}${d}`)&&(o=`${p}${d}`)}),i=n.includes(We.extname(o));let c;process.platform!=="win32"?i?(a.unshift(o),a=fs(process.execArgv).concat(a),c=Di.spawn(process.argv[0],a,{stdio:"inherit"})):c=Di.spawn(o,a,{stdio:"inherit"}):(a.unshift(o),a=fs(process.execArgv).concat(a),c=Di.spawn(process.execPath,a,{stdio:"inherit"}));let u=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];u.forEach(d=>{process.on(d,()=>{c.killed===!1&&c.exitCode===null&&c.kill(d)})});let l=this._exitCallback;l?c.on("close",()=>{l(new Gi(process.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):c.on("close",process.exit.bind(process)),c.on("error",d=>{if(d.code==="ENOENT"){let m=`'${o}' does not exist
- if '${e._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`;throw new Error(m)}else if(d.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)process.exit(1);else{let m=new Gi(1,"commander.executeSubCommandAsync","(error)");m.nestedError=d,l(m)}}),this.runningCommand=c}_dispatchSubcommand(e,a,i){let n=this._findCommand(e);if(n||this.help({error:!0}),n._executableHandler)this._executeSubCommand(n,a.concat(i));else return n._parseCommand(a,i)}_checkNumberOfArguments(){if(this._args.forEach((e,a)=>{e.required&&this.args[a]==null&&this.missingArgument(e.name())}),this._args.length>0&&this._args[this._args.length-1].variadic)return;this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,r)=>{let s=n;if(n!==null&&i.parseArg)try{s=i.parseArg(n,r)}catch(o){if(o.code==="commander.invalidArgument"){let p=`error: command-argument value '${n}' is invalid for argument '${i.name()}'. ${o.message}`;this._displayError(o.exitCode,o.code,p)}throw o}return s};this._checkNumberOfArguments();let a=[];this._args.forEach((i,n)=>{let r=i.defaultValue;i.variadic?n<this.args.length?(r=this.args.slice(n),i.parseArg&&(r=r.reduce((s,o)=>e(i,o,s),i.defaultValue))):r===void 0&&(r=[]):n<this.args.length&&(r=this.args[n],i.parseArg&&(r=e(i,r,i.defaultValue))),a[n]=r}),this.processedArgs=a}_chainOrCall(e,a){return e&&e.then&&typeof e.then=="function"?e.then(()=>a()):a()}_chainOrCallHooks(e,a){let i=e,n=[];return Vi(this).reverse().filter(r=>r._lifeCycleHooks[a]!==void 0).forEach(r=>{r._lifeCycleHooks[a].forEach(s=>{n.push({hookedCommand:r,callback:s})})}),a==="postAction"&&n.reverse(),n.forEach(r=>{i=this._chainOrCall(i,()=>r.callback(r.hookedCommand,this))}),i}_parseCommand(e,a){let i=this.parseOptions(a);if(e=e.concat(i.operands),a=i.unknown,this.args=e.concat(a),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),a);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return e.length===1&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return ds(this,a),this._dispatchSubcommand(this._defaultCommandName,e,a);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),ds(this,i.unknown),this._checkForMissingMandatoryOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&this.parent.emit(r,e,a),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(r))n(),this._processArguments(),this.parent.emit(r,e,a);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,a);this.listenerCount("command:*")?this.emit("command:*",e,a):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?this.help({error:!0}):(n(),this._processArguments())}_findCommand(e){return e?this.commands.find(a=>a._name===e||a._aliases.includes(e)):void 0}_findOption(e){return this.options.find(a=>a.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(a=>{a.mandatory&&e.getOptionValue(a.attributeName())===void 0&&e.missingMandatoryOptionValue(a)})}parseOptions(e){let a=[],i=[],n=a,r=e.slice();function s(p){return p.length>1&&p[0]==="-"}let o=null;for(;r.length;){let p=r.shift();if(p==="--"){n===i&&n.push(p),n.push(...r);break}if(o&&!s(p)){this.emit(`option:${o.name()}`,p);continue}if(o=null,s(p)){let c=this._findOption(p);if(c){if(c.required){let u=r.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;r.length>0&&!s(r[0])&&(u=r.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);o=c.variadic?c:null;continue}}if(p.length>2&&p[0]==="-"&&p[1]!=="-"){let c=this._findOption(`-${p[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,p.slice(2)):(this.emit(`option:${c.name()}`),r.unshift(`-${p.slice(2)}`));continue}}if(/^--[^=]+=/.test(p)){let c=p.indexOf("="),u=this._findOption(p.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,p.slice(c+1));continue}}if(s(p)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&a.length===0&&i.length===0){if(this._findCommand(p)){a.push(p),r.length>0&&i.push(...r);break}else if(p===this._helpCommandName&&this._hasImplicitHelpCommand()){a.push(p),r.length>0&&a.push(...r);break}else if(this._defaultCommandName){i.push(p),r.length>0&&i.push(...r);break}}if(this._passThroughOptions){n.push(p),r.length>0&&n.push(...r);break}n.push(p)}return{operands:a,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},a=this.options.length;for(let i=0;i<a;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}_displayError(e,a,i){this._outputConfiguration.outputError(`${i}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0})),this._exit(e,a,i)}missingArgument(e){let a=`error: missing required argument '${e}'`;this._displayError(1,"commander.missingArgument",a)}optionMissingArgument(e){let a=`error: option '${e.flags}' argument missing`;this._displayError(1,"commander.optionMissingArgument",a)}missingMandatoryOptionValue(e){let a=`error: required option '${e.flags}' not specified`;this._displayError(1,"commander.missingMandatoryOptionValue",a)}unknownOption(e){if(this._allowUnknownOption)return;let a=`error: unknown option '${e}'`;this._displayError(1,"commander.unknownOption",a)}_excessArguments(e){if(this._allowExcessArguments)return;let a=this._args.length,i=a===1?"":"s",n=this.parent?` for '${this.name()}'`:"",r=`error: too many arguments${n}. Expected ${a} argument${i} but got ${e.length}.`;this._displayError(1,"commander.excessArguments",r)}unknownCommand(){let e=`error: unknown command '${this.args[0]}'`;this._displayError(1,"commander.unknownCommand",e)}version(e,a,i){if(e===void 0)return this._version;this._version=e,a=a||"-V, --version",i=i||"output the version number";let n=this.createOption(a,i);return this._versionOptionName=n.attributeName(),this.options.push(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
`),this._exit(0,"commander.version",e)}),this}description(e,a){return e===void 0&&a===void 0?this._description:(this._description=e,a&&(this._argsDescription=a),this)}alias(e){if(e===void 0)return this._aliases[0];let a=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(a=this.commands[this.commands.length-1]),e===a._name)throw new Error("Command alias can't be the same as its name");return a._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(a=>this.alias(a)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let a=this._args.map(i=>wm(i));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?a:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpInformation(e){let a=this.createHelp();return a.helpWidth===void 0&&(a.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),a.formatHelp(this,a)}_getHelpContext(e){e=e||{};let a={error:!!e.error},i;return a.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),a.write=e.write||i,a.command=this,a}outputHelp(e){let a;typeof e=="function"&&(a=e,e=void 0);let i=this._getHelpContext(e);Vi(this).reverse().forEach(r=>r.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(a&&(n=a(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this.emit(this._helpLongFlag),this.emit("afterHelp",i),Vi(this).forEach(r=>r.emit("afterAllHelp",i))}helpOption(e,a){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=a||this._helpDescription;let i=km(this._helpFlags);return this._helpShortFlag=i.shortFlag,this._helpLongFlag=i.longFlag,this}help(e){this.outputHelp(e);let a=process.exitCode||0;a===0&&e&&typeof e!="function"&&e.error&&(a=1),this._exit(a,"commander.help","(outputHelp)")}addHelpText(e,a){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,r=>{let s;typeof a=="function"?s=a({error:r.error,command:r.command}):s=a,s&&r.write(`${s}
`)}),this}};function ds(t,e){let a=t._hasHelpOption&&e.find(i=>i===t._helpLongFlag||i===t._helpShortFlag);a&&(t.outputHelp(),t._exit(0,"commander.helpDisplayed","(outputHelp)"))}function fs(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let a,i="127.0.0.1",n="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?a=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(a=r[1],/^\d+$/.test(r[3])?n=r[3]:i=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(a=r[1],i=r[3],n=r[4]),a&&n!=="0"?`${a}=${i}:${parseInt(n)+1}`:e})}function Vi(t){let e=[];for(let a=t;a;a=a.parent)e.push(a);return e}ls.Command=Ra}),Xi=v((we,hs)=>{var{Argument:Am}=Sa(),{Command:vs}=ms(),{CommanderError:Cm,InvalidArgumentError:xs}=$t(),{Help:Sm}=$i(),{Option:Rm}=zi();we=hs.exports=new vs;we.program=we;we.Argument=Am;we.Command=vs;we.CommanderError=Cm;we.Help=Sm;we.InvalidArgumentError=xs;we.InvalidOptionArgumentError=xs;we.Option=Rm}),bs=v((y8,gs)=>{"use strict";gs.exports=jm;function Tm(t){var e,a="";if(t.isNative()?a="native":t.isEval()?(e=t.getScriptNameOrSourceURL(),e||(a=t.getEvalOrigin())):e=t.getFileName(),e){a+=e;var i=t.getLineNumber();if(i!=null){a+=":"+i;var n=t.getColumnNumber();n&&(a+=":"+n)}}return a||"unknown source"}function jm(t){var e=!0,a=Tm(t),i=t.getFunctionName(),n=t.isConstructor(),r=!(t.isToplevel()||n),s="";if(r){var o=t.getMethodName(),p=Om(t);i?(p&&i.indexOf(p)!==0&&(s+=p+"."),s+=i,o&&i.lastIndexOf("."+o)!==i.length-o.length-1&&(s+=" [as "+o+"]")):s+=p+"."+(o||"<anonymous>")}else n?s+="new "+(i||"<anonymous>"):i?s+=i:(e=!1,s+=a);return e&&(s+=" ("+a+")"),s}function Om(t){var e=t.receiver;return e.constructor&&e.constructor.name||null}}),ws=v((w8,ys)=>{"use strict";ys.exports=qm;function qm(t,e){return t.listeners(e).length}}),Ki=v((_8,Wi)=>{"use strict";var Pm=require("events").EventEmitter;_s(Wi.exports,"callSiteToString",function(){var e=Error.stackTraceLimit,a={},i=Error.prepareStackTrace;function n(s,o){return o}Error.prepareStackTrace=n,Error.stackTraceLimit=2,Error.captureStackTrace(a);var r=a.stack.slice();return Error.prepareStackTrace=i,Error.stackTraceLimit=e,r[0].toString?Hm:bs()});_s(Wi.exports,"eventListenerCount",function(){return Pm.listenerCount||ws()});function _s(t,e,a){function i(){var n=a();return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}),n}Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:i})}function Hm(t){return t.toString()}}),Ce=v((exports,module)=>{var callSiteToString=Ki().callSiteToString,eventListenerCount=Ki().eventListenerCount,relative=require("path").relative;module.exports=depd;var basePath=process.cwd();function containsNamespace(t,e){for(var a=t.split(/[ ,]+/),i=String(e).toLowerCase(),n=0;n<a.length;n++){var r=a[n];if(r&&(r==="*"||r.toLowerCase()===i))return!0}return!1}function convertDataDescriptorToAccessor(t,e,a){var i=Object.getOwnPropertyDescriptor(t,e),n=i.value;return i.get=function(){return n},i.writable&&(i.set=function(s){return n=s}),delete i.value,delete i.writable,Object.defineProperty(t,e,i),i}function createArgumentsString(t){for(var e="",a=0;a<t;a++)e+=", arg"+a;return e.substr(2)}function createStackString(t){var e=this.name+": "+this.namespace;this.message&&(e+=" deprecated "+this.message);for(var a=0;a<t.length;a++)e+=`
at `+callSiteToString(t[a]);return e}function depd(t){if(!t)throw new TypeError("argument namespace is required");var e=getStack(),a=callSiteLocation(e[1]),i=a[0];function n(r){log.call(n,r)}return n._file=i,n._ignored=isignored(t),n._namespace=t,n._traced=istraced(t),n._warned=Object.create(null),n.function=wrapfunction,n.property=wrapproperty,n}function isignored(t){if(process.noDeprecation)return!0;var e=process.env.NO_DEPRECATION||"";return containsNamespace(e,t)}function istraced(t){if(process.traceDeprecation)return!0;var e=process.env.TRACE_DEPRECATION||"";return containsNamespace(e,t)}function log(t,e){var a=eventListenerCount(process,"deprecation")!==0;if(!a&&this._ignored)return;var i,n,r,s,o=0,p=!1,c=getStack(),u=this._file;for(e?(s=e,r=callSiteLocation(c[1]),r.name=s.name,u=r[0]):(o=2,s=callSiteLocation(c[o]),r=s);o<c.length;o++)if(i=callSiteLocation(c[o]),n=i[0],n===u)p=!0;else if(n===this._file)u=this._file;else if(p)break;var l=i?s.join(":")+"__"+i.join(":"):void 0;if(l!==void 0&&l in this._warned)return;this._warned[l]=!0;var d=t;if(d||(d=r===s||!r.name?defaultMessage(s):defaultMessage(r)),a){var m=DeprecationError(this._namespace,d,c.slice(o));process.emit("deprecation",m);return}var f=process.stderr.isTTY?formatColor:formatPlain,h=f.call(this,d,i,c.slice(o));process.stderr.write(h+`
`,"utf8")}function callSiteLocation(t){var e=t.getFileName()||"<anonymous>",a=t.getLineNumber(),i=t.getColumnNumber();t.isEval()&&(e=t.getEvalOrigin()+", "+e);var n=[e,a,i];return n.callSite=t,n.name=t.getFunctionName(),n}function defaultMessage(t){var e=t.callSite,a=t.name;a||(a="<anonymous@"+formatLocation(t)+">");var i=e.getThis(),n=i&&e.getTypeName();return n==="Object"&&(n=void 0),n==="Function"&&(n=i.name||n),n&&e.getMethodName()?n+"."+a:a}function formatPlain(t,e,a){var i=new Date().toUTCString(),n=i+" "+this._namespace+" deprecated "+t;if(this._traced){for(var r=0;r<a.length;r++)n+=`
at `+callSiteToString(a[r]);return n}return e&&(n+=" at "+formatLocation(e)),n}function formatColor(t,e,a){var i="[36;1m"+this._namespace+"[22;39m [33;1mdeprecated[22;39m [0m"+t+"[39m";if(this._traced){for(var n=0;n<a.length;n++)i+=`
[36mat `+callSiteToString(a[n])+"[39m";return i}return e&&(i+=" [36m"+formatLocation(e)+"[39m"),i}function formatLocation(t){return relative(basePath,t[0])+":"+t[1]+":"+t[2]}function getStack(){var t=Error.stackTraceLimit,e={},a=Error.prepareStackTrace;Error.prepareStackTrace=prepareObjectStackTrace,Error.stackTraceLimit=Math.max(10,t),Error.captureStackTrace(e);var i=e.stack.slice(1);return Error.prepareStackTrace=a,Error.stackTraceLimit=t,i}function prepareObjectStackTrace(t,e){return e}function wrapfunction(fn,message){if(typeof fn!="function")throw new TypeError("argument fn must be a function");var args=createArgumentsString(fn.length),deprecate=this,stack=getStack(),site=callSiteLocation(stack[1]);site.name=fn.name;var deprecatedfn=eval("(function ("+args+`) {
"use strict"
log.call(deprecate, message, site)
return fn.apply(this, arguments)
})`);return deprecatedfn}function wrapproperty(t,e,a){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("argument obj must be object");var i=Object.getOwnPropertyDescriptor(t,e);if(!i)throw new TypeError("must call property on owner object");if(!i.configurable)throw new TypeError("property must be configurable");var n=this,r=getStack(),s=callSiteLocation(r[1]);s.name=e,"value"in i&&(i=convertDataDescriptorToAccessor(t,e,a));var o=i.get,p=i.set;typeof o=="function"&&(i.get=function(){return log.call(n,a,s),o.apply(this,arguments)}),typeof p=="function"&&(i.set=function(){return log.call(n,a,s),p.apply(this,arguments)}),Object.defineProperty(t,e,i)}function DeprecationError(t,e,a){var i=new Error,n;return Object.defineProperty(i,"constructor",{value:DeprecationError}),Object.defineProperty(i,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(i,"name",{enumerable:!1,configurable:!0,value:"DeprecationError",writable:!0}),Object.defineProperty(i,"namespace",{configurable:!0,enumerable:!1,value:t,writable:!0}),Object.defineProperty(i,"stack",{configurable:!0,enumerable:!1,get:function(){return n!==void 0?n:n=createStackString.call(this,a)},set:function(s){n=s}}),i}}),st=v((E8,ja)=>{"use strict";ja.exports=Lm;ja.exports.format=Es;ja.exports.parse=ks;var Im=/\B(?=(\d{3})+(?!\d))/g,Nm=/(?:\.0*|(\.[^0]+)0+)$/,Me={b:1,kb:1<<10,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},Bm=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function Lm(t,e){return typeof t=="string"?ks(t):typeof t=="number"?Es(t,e):null}function Es(t,e){if(!Number.isFinite(t))return null;var a=Math.abs(t),i=e&&e.thousandsSeparator||"",n=e&&e.unitSeparator||"",r=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,s=Boolean(e&&e.fixedDecimals),o=e&&e.unit||"";(!o||!Me[o.toLowerCase()])&&(a>=Me.pb?o="PB":a>=Me.tb?o="TB":a>=Me.gb?o="GB":a>=Me.mb?o="MB":a>=Me.kb?o="KB":o="B");var p=t/Me[o.toLowerCase()],c=p.toFixed(r);return s||(c=c.replace(Nm,"$1")),i&&(c=c.replace(Im,i)),c+n+o}function ks(t){if(typeof t=="number"&&!isNaN(t))return t;if(typeof t!="string")return null;var e=Bm.exec(t),a,i="b";return e?(a=parseFloat(e[1]),i=e[4].toLowerCase()):(a=parseInt(t,10),i="b"),Math.floor(Me[i]*a)}}),Mt=v(Qi=>{"use strict";var As=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Fm=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Cs=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,$m=/\\([\u000b\u0020-\u00ff])/g,Mm=/([\\"])/g,Ss=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Qi.format=zm;Qi.parse=Dm;function zm(t){if(!t||typeof t!="object")throw new TypeError("argument obj is required");var e=t.parameters,a=t.type;if(!a||!Ss.test(a))throw new TypeError("invalid type");var i=a;if(e&&typeof e=="object")for(var n,r=Object.keys(e).sort(),s=0;s<r.length;s++){if(n=r[s],!Cs.test(n))throw new TypeError("invalid parameter name");i+="; "+n+"="+Um(e[n])}return i}function Dm(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?Gm(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var a=e.indexOf(";"),i=a!==-1?e.substr(0,a).trim():e.trim();if(!Ss.test(i))throw new TypeError("invalid media type");var n=new Vm(i.toLowerCase());if(a!==-1){var r,s,o;for(As.lastIndex=a;s=As.exec(e);){if(s.index!==a)throw new TypeError("invalid parameter format");a+=s[0].length,r=s[1].toLowerCase(),o=s[2],o[0]==='"'&&(o=o.substr(1,o.length-2).replace($m,"$1")),n.parameters[r]=o}if(a!==e.length)throw new TypeError("invalid parameter format")}return n}function Gm(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function Um(t){var e=String(t);if(Cs.test(e))return e;if(e.length>0&&!Fm.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(Mm,"\\$1")+'"'}function Vm(t){this.parameters=Object.create(null),this.type=t}}),zt=v((A8,Rs)=>{"use strict";Rs.exports=Object.setPrototypeOf||({__proto__:[]}instanceof Array?Xm:Wm);function Xm(t,e){return t.__proto__=e,t}function Wm(t,e){for(var a in e)t.hasOwnProperty(a)||(t[a]=e[a]);return t}}),Ts=v((C8,js)=>{js.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","306":"(Unused)","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}}),Dt=v((S8,Os)=>{"use strict";var qs=Ts();Os.exports=Se;Se.STATUS_CODES=qs;Se.codes=Km(Se,qs);Se.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};Se.empty={204:!0,205:!0,304:!0};Se.retry={502:!0,503:!0,504:!0};function Km(t,e){var a=[];return Object.keys(e).forEach(function(n){var r=e[n],s=Number(n);t[s]=r,t[r]=s,t[r.toLowerCase()]=s,a.push(s)}),a}function Se(t){if(typeof t=="number"){if(!Se[t])throw new Error("invalid status code: "+t);return t}if(typeof t!="string")throw new TypeError("code must be a number or string");var e=parseInt(t,10);if(!isNaN(e)){if(!Se[e])throw new Error("invalid status code: "+e);return e}if(e=Se[t.toLowerCase()],!e)throw new Error('invalid status message: "'+t+'"');return e}}),Ps=v((R8,Zi)=>{typeof Object.create=="function"?Zi.exports=function(e,a){e.super_=a,e.prototype=Object.create(a.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:Zi.exports=function(e,a){e.super_=a;var i=function(){};i.prototype=a.prototype,e.prototype=new i,e.prototype.constructor=e}}),Hs=v((j8,Yi)=>{try{if(Ji=require("util"),typeof Ji.inherits!="function")throw"";Yi.exports=Ji.inherits}catch(t){Yi.exports=Ps()}var Ji}),Is=v((T8,Ls)=>{Ls.exports=Qm;function Qm(t){return t.split(" ").map(function(e){return e.slice(0,1).toUpperCase()+e.slice(1)}).join("").replace(/[^ _0-9a-z]/gi,"")}}),ct=v((O8,Ut)=>{"use strict";var en=Ce()("http-errors"),Ns=zt(),ot=Dt(),tn=Hs(),Zm=Is();Ut.exports=Ta;Ut.exports.HttpError=Ym();Jm(Ut.exports,ot.codes,Ut.exports.HttpError);function Bs(t){return Number(String(t).charAt(0)+"00")}function Ta(){for(var t,e,a=500,i={},n=0;n<arguments.length;n++){var r=arguments[n];if(r instanceof Error){t=r,a=t.status||t.statusCode||a;continue}switch(typeof r){case"string":e=r;break;case"number":a=r,n!==0&&en("non-first-argument status code; replace with createError("+r+", ...)");break;case"object":i=r;break}}typeof a=="number"&&(a<400||a>=600)&&en("non-error status code; use only 4xx or 5xx status codes"),(typeof a!="number"||!ot[a]&&(a<400||a>=600))&&(a=500);var s=Ta[a]||Ta[Bs(a)];t||(t=s?new s(e):new Error(e||ot[a]),Error.captureStackTrace(t,Ta)),(!s||!(t instanceof s)||t.status!==a)&&(t.expose=a<500,t.status=t.statusCode=a);for(var o in i)o!=="status"&&o!=="statusCode"&&(t[o]=i[o]);return t}function Ym(){function t(){throw new TypeError("cannot construct abstract class")}return tn(t,Error),t}function eh(t,e,a){var i=e.match(/Error$/)?e:e+"Error";function n(r){var s=r??ot[a],o=new Error(s);return Error.captureStackTrace(o,n),Ns(o,n.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:s,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:i,writable:!0}),o}return tn(n,t),Fs(n,i),n.prototype.status=a,n.prototype.statusCode=a,n.prototype.expose=!0,n}function th(t,e,a){var i=e.match(/Error$/)?e:e+"Error";function n(r){var s=r??ot[a],o=new Error(s);return Error.captureStackTrace(o,n),Ns(o,n.prototype),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,value:s,writable:!0}),Object.defineProperty(o,"name",{enumerable:!1,configurable:!0,value:i,writable:!0}),o}return tn(n,t),Fs(n,i),n.prototype.status=a,n.prototype.statusCode=a,n.prototype.expose=!1,n}function Fs(t,e){var a=Object.getOwnPropertyDescriptor(t,"name");a&&a.configurable&&(a.value=e,Object.defineProperty(t,"name",a))}function Jm(t,e,a){e.forEach(function(n){var r,s=Zm(ot[n]);switch(Bs(n)){case 400:r=eh(a,s,n);break;case 500:r=th(a,s,n);break}r&&(t[n]=r,t[s]=r)}),t["I'mateapot"]=en.function(t.ImATeapot,`"I'mateapot"; use "ImATeapot" instead`)}}),Ms=v((q8,$s)=>{var Gt=1e3,Vt=Gt*60,Xt=Vt*60,Wt=Xt*24,ah=Wt*365.25;$s.exports=function(t,e){e=e||{};var a=typeof t;if(a==="string"&&t.length>0)return ih(t);if(a==="number"&&isNaN(t)===!1)return e.long?rh(t):nh(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function ih(t){if(t=String(t),t.length>100)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return a*ah;case"days":case"day":case"d":return a*Wt;case"hours":case"hour":case"hrs":case"hr":case"h":return a*Xt;case"minutes":case"minute":case"mins":case"min":case"m":return a*Vt;case"seconds":case"second":case"secs":case"sec":case"s":return a*Gt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}function nh(t){return t>=Wt?Math.round(t/Wt)+"d":t>=Xt?Math.round(t/Xt)+"h":t>=Vt?Math.round(t/Vt)+"m":t>=Gt?Math.round(t/Gt)+"s":t+"ms"}function rh(t){return Oa(t,Wt,"day")||Oa(t,Xt,"hour")||Oa(t,Vt,"minute")||Oa(t,Gt,"second")||t+" ms"}function Oa(t,e,a){return t<e?void 0:t<e*1.5?Math.floor(t/e)+" "+a:Math.ceil(t/e)+" "+a+"s"}}),rn=v((H,zs)=>{H=zs.exports=an.debug=an.default=an;H.coerce=sh;H.disable=oh;H.enable=ch;H.enabled=ph;H.humanize=Ms();H.names=[];H.skips=[];H.formatters={};var nn;function uh(t){var e=0,a;for(a in t)e=(e<<5)-e+t.charCodeAt(a),e|=0;return H.colors[Math.abs(e)%H.colors.length]}function an(t){function e(){if(!e.enabled)return;var a=e,i=+new Date,n=i-(nn||i);a.diff=n,a.prev=nn,a.curr=i,nn=i;for(var r=new Array(arguments.length),s=0;s<r.length;s++)r[s]=arguments[s];r[0]=H.coerce(r[0]),typeof r[0]!="string"&&r.unshift("%O");var o=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,function(c,u){if(c==="%%")return c;o++;var l=H.formatters[u];if(typeof l=="function"){var d=r[o];c=l.call(a,d),r.splice(o,1),o--}return c}),H.formatArgs.call(a,r);var p=e.log||H.log||console.log.bind(console);p.apply(a,r)}return e.namespace=t,e.enabled=H.enabled(t),e.useColors=H.useColors(),e.color=uh(t),typeof H.init=="function"&&H.init(e),e}function ch(t){H.save(t),H.names=[],H.skips=[];for(var e=(typeof t=="string"?t:"").split(/[\s,]+/),a=e.length,i=0;i<a;i++){if(!e[i])continue;t=e[i].replace(/\*/g,".*?"),t[0]==="-"?H.skips.push(new RegExp("^"+t.substr(1)+"$")):H.names.push(new RegExp("^"+t+"$"))}}function oh(){H.enable("")}function ph(t){var e,a;for(e=0,a=H.skips.length;e<a;e++)if(H.skips[e].test(t))return!1;for(e=0,a=H.names.length;e<a;e++)if(H.names[e].test(t))return!0;return!1}function sh(t){return t instanceof Error?t.stack||t.message:t}}),Gs=v((re,Ds)=>{re=Ds.exports=rn();re.log=lh;re.formatArgs=dh;re.save=fh;re.load=Us;re.useColors=mh;re.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:hh();re.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function mh(){return typeof window!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}re.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}};function dh(t){var e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+re.humanize(this.diff),!e)return;var a="color: "+this.color;t.splice(1,0,a,"color: inherit");var i=0,n=0;t[0].replace(/%[a-zA-Z%]/g,function(r){if(r==="%%")return;i++,r==="%c"&&(n=i)}),t.splice(n,0,a)}function lh(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function fh(t){try{t==null?re.storage.removeItem("debug"):re.storage.debug=t}catch(e){}}function Us(){var t;try{t=re.storage.debug}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}re.enable(Us());function hh(){try{return window.localStorage}catch(t){}}}),Ks=v((Z,Vs)=>{var Xs=require("tty"),Kt=require("util");Z=Vs.exports=rn();Z.init=vh;Z.log=xh;Z.formatArgs=gh;Z.save=bh;Z.load=Ws;Z.useColors=yh;Z.colors=[6,2,3,4,5,1];Z.inspectOpts=Object.keys(process.env).filter(function(t){return/^debug_/i.test(t)}).reduce(function(t,e){var a=e.substring(6).toLowerCase().replace(/_([a-z])/g,function(n,r){return r.toUpperCase()}),i=process.env[e];return/^(yes|on|true|enabled)$/i.test(i)?i=!0:/^(no|off|false|disabled)$/i.test(i)?i=!1:i==="null"?i=null:i=Number(i),t[a]=i,t},{});var pt=parseInt(process.env.DEBUG_FD,10)||2;pt!==1&&pt!==2&&Kt.deprecate(function(){},"except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)")();var _h=pt===1?process.stdout:pt===2?process.stderr:wh(pt);function yh(){return"colors"in Z.inspectOpts?Boolean(Z.inspectOpts.colors):Xs.isatty(pt)}Z.formatters.o=function(t){return this.inspectOpts.colors=this.useColors,Kt.inspect(t,this.inspectOpts).split(`
`).map(function(e){return e.trim()}).join(" ")};Z.formatters.O=function(t){return this.inspectOpts.colors=this.useColors,Kt.inspect(t,this.inspectOpts)};function gh(t){var e=this.namespace,a=this.useColors;if(a){var i=this.color,n=" [3"+i+";1m"+e+" [0m";t[0]=n+t[0].split(`
`).join(`
`+n),t.push("[3"+i+"m+"+Z.humanize(this.diff)+"[0m")}else t[0]=new Date().toUTCString()+" "+e+" "+t[0]}function xh(){return _h.write(Kt.format.apply(Kt,arguments)+`
`)}function bh(t){t==null?delete process.env.DEBUG:process.env.DEBUG=t}function Ws(){return process.env.DEBUG}function wh(t){var e,a=process.binding("tty_wrap");switch(a.guessHandleType(t)){case"TTY":e=new Xs.WriteStream(t),e._type="tty",e._handle&&e._handle.unref&&e._handle.unref();break;case"FILE":var i=require("fs");e=new i.SyncWriteStream(t,{autoClose:!1}),e._type="fs";break;case"PIPE":case"TCP":var n=require("net");e=new n.Socket({fd:t,readable:!1,writable:!0}),e.readable=!1,e.read=null,e._type="pipe",e._handle&&e._handle.unref&&e._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return e.fd=t,e._isStdio=!0,e}function vh(t){t.inspectOpts={};for(var e=Object.keys(Z.inspectOpts),a=0;a<e.length;a++)t.inspectOpts[e[a]]=Z.inspectOpts[e[a]]}Z.enable(Ws())}),de=v((P8,sn)=>{typeof process!="undefined"&&process.type==="renderer"?sn.exports=Gs():sn.exports=Ks()}),Ke=v((H8,Qs)=>{"use strict";var qa=require("buffer"),ut=qa.Buffer,xe={},ge;for(ge in qa){if(!qa.hasOwnProperty(ge))continue;if(ge==="SlowBuffer"||ge==="Buffer")continue;xe[ge]=qa[ge]}var lt=xe.Buffer={};for(ge in ut){if(!ut.hasOwnProperty(ge))continue;if(ge==="allocUnsafe"||ge==="allocUnsafeSlow")continue;lt[ge]=ut[ge]}xe.Buffer.prototype=ut.prototype;(!lt.from||lt.from===Uint8Array.from)&&(lt.from=function(t,e,a){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length=="undefined")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return ut(t,e,a)});lt.alloc||(lt.alloc=function(t,e,a){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=ut(t);return!e||e.length===0?i.fill(0):typeof a=="string"?i.fill(e,a):i.fill(e),i});if(!xe.kStringMaxLength)try{xe.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(t){}xe.constants||(xe.constants={MAX_LENGTH:xe.kMaxLength},xe.kStringMaxLength&&(xe.constants.MAX_STRING_LENGTH=xe.kStringMaxLength));Qs.exports=xe}),Ys=v(on=>{"use strict";var Zs="\uFEFF";on.PrependBOM=cn;function cn(t,e){this.encoder=t,this.addBOM=!0}cn.prototype.write=function(t){return this.addBOM&&(t=Zs+t,this.addBOM=!1),this.encoder.write(