powerplatform-review-tool
Version:
Evaluate Power Platform solution zip files based on best practice patterns
22 lines • 542 kB
JavaScript
#!/usr/bin/env node
"use strict";var dw=Object.create;var _h=Object.defineProperty;var mw=Object.getOwnPropertyDescriptor;var gw=Object.getOwnPropertyNames;var yw=Object.getPrototypeOf,vw=Object.prototype.hasOwnProperty;var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ew=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gw(t))!vw.call(e,i)&&i!==r&&_h(e,i,{get:()=>t[i],enumerable:!(n=mw(t,i))||n.enumerable});return e};var gs=(e,t,r)=>(r=e!=null?dw(yw(e)):{},Ew(t||!e||!e.__esModule?_h(r,"default",{value:e,enumerable:!0}):r,e));var $i=N(lu=>{var ys=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}},uu=class extends ys{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};lu.CommanderError=ys;lu.InvalidArgumentError=uu});var vs=N(fu=>{var{InvalidArgumentError:ww}=$i(),cu=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 ww(`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 bw(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}fu.Argument=cu;fu.humanReadableArgName=bw});var pu=N(xh=>{var{humanReadableArgName:Aw}=vs(),hu=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,i]=t._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),o=t.createCommand(n).helpOption(!1);o.description(t._helpCommandDescription),i&&o.arguments(i),r.push(o)}return this.sortSubcommands&&r.sort((n,i)=>n.name().localeCompare(i.name())),r}compareOptions(t,r){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(o=>!o.hidden),n=t._hasHelpOption&&t._helpShortFlag&&!t._findOption(t._helpShortFlag),i=t._hasHelpOption&&!t._findOption(t._helpLongFlag);if(n||i){let o;n?i?o=t.createOption(t._helpFlags,t._helpDescription):o=t.createOption(t._helpShortFlag,t._helpDescription):o=t.createOption(t._helpLongFlag,t._helpDescription),r.push(o)}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 i=n.options.filter(o=>!o.hidden);r.push(...i)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>Aw(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,i)=>Math.max(n,r.subcommandTerm(i).length),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,i)=>Math.max(n,r.optionTerm(i).length),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,i)=>Math.max(n,r.optionTerm(i).length),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,i)=>Math.max(n,r.argumentTerm(i).length),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let i=t.parent;i;i=i.parent)n=i.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),i=r.helpWidth||80,o=2,a=2;function u(d,w){if(w){let v=`${d.padEnd(n+a)}${w}`;return r.wrap(v,i-o,n+a)}return d}function l(d){return d.join(`
`).replace(/^/gm," ".repeat(o))}let c=[`Usage: ${r.commandUsage(t)}`,""],f=r.commandDescription(t);f.length>0&&(c=c.concat([r.wrap(f,i,0),""]));let p=r.visibleArguments(t).map(d=>u(r.argumentTerm(d),r.argumentDescription(d)));p.length>0&&(c=c.concat(["Arguments:",l(p),""]));let g=r.visibleOptions(t).map(d=>u(r.optionTerm(d),r.optionDescription(d)));if(g.length>0&&(c=c.concat(["Options:",l(g),""])),this.showGlobalOptions){let d=r.visibleGlobalOptions(t).map(w=>u(r.optionTerm(w),r.optionDescription(w)));d.length>0&&(c=c.concat(["Global Options:",l(d),""]))}let m=r.visibleCommands(t).map(d=>u(r.subcommandTerm(d),r.subcommandDescription(d)));return m.length>0&&(c=c.concat(["Commands:",l(m),""])),c.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,i=40){let o=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",a=new RegExp(`[\\n][${o}]+`);if(t.match(a))return t;let u=r-n;if(u<i)return t;let l=t.slice(0,n),c=t.slice(n).replace(`\r
`,`
`),f=" ".repeat(n),g="\\s\u200B",m=new RegExp(`
|.{1,${u-1}}([${g}]|$)|[^${g}]+?([${g}]|$)`,"g"),d=c.match(m)||[];return l+d.map((w,v)=>w===`
`?"":(v>0?f:"")+w.trimEnd()).join(`
`)}};xh.Help=hu});var gu=N(Es=>{var{InvalidArgumentError:_w}=$i(),du=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=Ch(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){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),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 _w(`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 xw(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},mu=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 i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===t)}};function xw(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function Ch(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}}Es.Option=du;Es.splitOptionFlags=Ch;Es.DualOptions=mu});var Sh=N(Dh=>{function Cw(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 i=1;i<=e.length;i++){let o=1;e[i-1]===t[n-1]?o=0:o=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+o),i>1&&n>1&&e[i-1]===t[n-2]&&e[i-2]===t[n-1]&&(r[i][n]=Math.min(r[i][n],r[i-2][n-2]+1))}return r[e.length][t.length]}function Dw(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=[],i=3,o=.4;return t.forEach(a=>{if(a.length<=1)return;let u=Cw(e,a),l=Math.max(e.length,a.length);(l-u)/l>o&&(u<i?(i=u,n=[a]):u===i&&n.push(a))}),n.sort((a,u)=>a.localeCompare(u)),r&&(n=n.map(a=>`--${a}`)),n.length>1?`
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
(Did you mean ${n[0]}?)`:""}Dh.suggestSimilar=Dw});var Fh=N(Rh=>{var Sw=require("events").EventEmitter,yu=require("child_process"),_r=require("path"),vu=require("fs"),Re=require("process"),{Argument:Nw,humanReadableArgName:Tw}=vs(),{CommanderError:Eu}=$i(),{Help:Ow}=pu(),{Option:Nh,splitOptionFlags:Iw,DualOptions:Rw}=gu(),{suggestSimilar:Th}=Sh(),wu=class e extends Sw{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:r=>Re.stdout.write(r),writeErr:r=>Re.stderr.write(r),getOutHelpWidth:()=>Re.stdout.isTTY?Re.stdout.columns:void 0,getErrHelpWidth:()=>Re.stderr.isTTY?Re.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}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,n){let i=r,o=n;typeof i=="object"&&i!==null&&(o=i,i=null),o=o||{};let[,a,u]=t.match(/([^ ]+) *(.*)/),l=this.createCommand(a);return i&&(l.description(i),l._executableHandler=!0),o.isDefault&&(this._defaultCommandName=l._name),l._hidden=!!(o.noHelp||o.hidden),l._executableFile=o.executableFile||null,u&&l.arguments(u),this.commands.push(l),l.parent=this,l.copyInheritedSettings(this),i?this:l}createCommand(t){return new e(t)}createHelp(){return Object.assign(new Ow,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 Nw(t,r)}argument(t,r,n,i){let o=this.createArgument(t,r);return typeof n=="function"?o.default(i).argParser(n):o.default(n),this.addArgument(o),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.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.registeredArguments.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 Eu(t,r,n)),Re.exit(t)}action(t){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),t.apply(this,o)};return this._actionHandler=r,this}createOption(t,r){return new Nh(t,r)}_callParseArg(t,r,n,i){try{return t.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let a=`${i} ${o.message}`;this.error(a,{exitCode:o.exitCode,code:o.code})}throw o}}addOption(t){let r=t.name(),n=t.attributeName();if(t.negate){let o=t.long.replace(/^--no-/,"--");this._findOption(o)||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 i=(o,a,u)=>{o==null&&t.presetArg!==void 0&&(o=t.presetArg);let l=this.getOptionValue(n);o!==null&&t.parseArg?o=this._callParseArg(t,o,l,a):o!==null&&t.variadic&&(o=t._concatValue(o,l)),o==null&&(t.negate?o=!1:t.isBoolean()||t.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,u)};return this.on("option:"+r,o=>{let a=`error: option '${t.flags}' argument '${o}' is invalid.`;i(o,a,"cli")}),t.envVar&&this.on("optionEnv:"+r,o=>{let a=`error: option '${t.flags}' value '${o}' from env '${t.envVar}' is invalid.`;i(o,a,"env")}),this}_optionEx(t,r,n,i,o){if(typeof r=="object"&&r instanceof Nh)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 i=="function")a.default(o).argParser(i);else if(i instanceof RegExp){let u=i;i=(l,c)=>{let f=u.exec(l);return f?f[0]:c},a.default(o).argParser(i)}else a.default(i);return this.addOption(a)}option(t,r,n,i){return this._optionEx({},t,r,n,i)}requiredOption(t,r,n,i){return this._optionEx({mandatory:!0},t,r,n,i)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){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.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!t,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 this._getCommandAndAncestors().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=Re.argv,Re.versions&&Re.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":Re.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,i=[".js",".ts",".tsx",".mjs",".cjs"];function o(f,p){let g=_r.resolve(f,p);if(vu.existsSync(g))return g;if(i.includes(_r.extname(p)))return;let m=i.find(d=>vu.existsSync(`${g}${d}`));if(m)return`${g}${m}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=t._executableFile||`${this._name}-${t._name}`,u=this._executableDir||"";if(this._scriptPath){let f;try{f=vu.realpathSync(this._scriptPath)}catch{f=this._scriptPath}u=_r.resolve(_r.dirname(f),u)}if(u){let f=o(u,a);if(!f&&!t._executableFile&&this._scriptPath){let p=_r.basename(this._scriptPath,_r.extname(this._scriptPath));p!==this._name&&(f=o(u,`${p}-${t._name}`))}a=f||a}n=i.includes(_r.extname(a));let l;Re.platform!=="win32"?n?(r.unshift(a),r=Ih(Re.execArgv).concat(r),l=yu.spawn(Re.argv[0],r,{stdio:"inherit"})):l=yu.spawn(a,r,{stdio:"inherit"}):(r.unshift(a),r=Ih(Re.execArgv).concat(r),l=yu.spawn(Re.execPath,r,{stdio:"inherit"})),l.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{Re.on(p,()=>{l.killed===!1&&l.exitCode===null&&l.kill(p)})});let c=this._exitCallback;c?l.on("close",()=>{c(new Eu(Re.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):l.on("close",Re.exit.bind(Re)),l.on("error",f=>{if(f.code==="ENOENT"){let p=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",g=`'${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
- ${p}`;throw new Error(g)}else if(f.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)Re.exit(1);else{let p=new Eu(1,"commander.executeSubCommandAsync","(error)");p.nestedError=f,c(p)}}),this.runningCommand=l}_dispatchSubcommand(t,r,n){let i=this._findCommand(t);i||this.help({error:!0});let o;return o=this._chainOrCallSubCommandHook(o,i,"preSubcommand"),o=this._chainOrCall(o,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),o}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,i,o)=>{let a=i;if(i!==null&&n.parseArg){let u=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;a=this._callParseArg(n,i,o,u)}return a};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let o=n.defaultValue;n.variadic?i<this.args.length?(o=this.args.slice(i),n.parseArg&&(o=o.reduce((a,u)=>t(n,u,a),n.defaultValue))):o===void 0&&(o=[]):i<this.args.length&&(o=this.args[i],n.parseArg&&(o=t(n,o,n.defaultValue))),r[i]=o}),this.processedArgs=r}_chainOrCall(t,r){return t&&t.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,i=[];return this._getCommandAndAncestors().reverse().filter(o=>o._lifeCycleHooks[r]!==void 0).forEach(o=>{o._lifeCycleHooks[r].forEach(a=>{i.push({hookedCommand:o,callback:a})})}),r==="postAction"&&i.reverse(),i.forEach(o=>{n=this._chainOrCall(n,()=>o.callback(o.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let i=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(o=>{i=this._chainOrCall(i,()=>o(this,r))}),i}_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 this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return Oh(this,r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),Oh(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},o=`command:${this.name()}`;if(this._actionHandler){i(),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(o,t,r)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(o))i(),this._processArguments(),this.parent.emit(o,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():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),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(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=t.find(o=>n.conflictsWith.includes(o.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],n=[],i=r,o=t.slice();function a(l){return l.length>1&&l[0]==="-"}let u=null;for(;o.length;){let l=o.shift();if(l==="--"){i===n&&i.push(l),i.push(...o);break}if(u&&!a(l)){this.emit(`option:${u.name()}`,l);continue}if(u=null,a(l)){let c=this._findOption(l);if(c){if(c.required){let f=o.shift();f===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,f)}else if(c.optional){let f=null;o.length>0&&!a(o[0])&&(f=o.shift()),this.emit(`option:${c.name()}`,f)}else this.emit(`option:${c.name()}`);u=c.variadic?c:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let c=this._findOption(`-${l[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,l.slice(2)):(this.emit(`option:${c.name()}`),o.unshift(`-${l.slice(2)}`));continue}}if(/^--[^=]+=/.test(l)){let c=l.indexOf("="),f=this._findOption(l.slice(0,c));if(f&&(f.required||f.optional)){this.emit(`option:${f.name()}`,l.slice(c+1));continue}}if(a(l)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),o.length>0&&n.push(...o);break}else if(l===this._helpCommandName&&this._hasImplicitHelpCommand()){r.push(l),o.length>0&&r.push(...o);break}else if(this._defaultCommandName){n.push(l),o.length>0&&n.push(...o);break}}if(this._passThroughOptions){i.push(l),o.length>0&&i.push(...o);break}i.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let i=this.options[n].attributeName();t[i]=i===this._versionOptionName?this._version:this[i]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().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||{},i=n.exitCode||1,o=n.code||"commander.error";this._exit(i,o,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in Re.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()}`,Re.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new Rw(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(i=>!r(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"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 u=a.attributeName(),l=this.getOptionValue(u),c=this.options.find(p=>p.negate&&u===p.attributeName()),f=this.options.find(p=>!p.negate&&u===p.attributeName());return c&&(c.presetArg===void 0&&l===!1||c.presetArg!==void 0&&l===c.presetArg)?c:f||a},i=a=>{let u=n(a),l=u.attributeName();return this.getOptionValueSource(l)==="env"?`environment variable '${u.envVar}'`:`option '${u.flags}'`},o=`error: ${i(t)} cannot be used with ${i(r)}`;this.error(o,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[],o=this;do{let a=o.createHelp().visibleOptions(o).filter(u=>u.long).map(u=>u.long);i=i.concat(a),o=o.parent}while(o&&!o._enablePositionalOptions);r=Th(t,i)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",o=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(o,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(o=>{i.push(o.name()),o.alias()&&i.push(o.alias())}),r=Th(t,i)}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 i=this.createOption(r,n);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.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.registeredArguments.map(n=>Tw(n));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.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=_r.basename(t,_r.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=i=>this._outputConfiguration.writeErr(i):n=i=>this._outputConfiguration.writeOut(i),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);this._getCommandAndAncestors().reverse().forEach(o=>o.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation(n);if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._helpLongFlag&&this.emit(this._helpLongFlag),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(o=>o.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=Iw(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(t){this.outputHelp(t);let r=Re.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 i=`${t}Help`;return this.on(i,o=>{let a;typeof r=="function"?a=r({error:o.error,command:o.command}):a=r,a&&o.write(`${a}
`)}),this}};function Oh(e,t){e._hasHelpOption&&t.find(n=>n===e._helpLongFlag||n===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function Ih(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",i="9229",o;return(o=t.match(/^(--inspect(-brk)?)$/))!==null?r=o[1]:(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=o[1],/^\d+$/.test(o[3])?i=o[3]:n=o[3]):(o=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=o[1],n=o[3],i=o[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:t})}Rh.Command=wu});var Bh=N((zt,Lh)=>{var{Argument:Fw}=vs(),{Command:Ph}=Fh(),{CommanderError:Pw,InvalidArgumentError:kh}=$i(),{Help:kw}=pu(),{Option:Lw}=gu();zt=Lh.exports=new Ph;zt.program=zt;zt.Command=Ph;zt.Option=Lw;zt.Argument=Fw;zt.Help=kw;zt.CommanderError=Pw;zt.InvalidArgumentError=kh;zt.InvalidOptionArgumentError=kh});var Wi=N((hL,bu)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?bu.exports={nextTick:Bw}:bu.exports=process;function Bw(e,t,r,n){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,o,a;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,n)});default:for(o=new Array(i-1),a=0;a<o.length;)o[a++]=arguments[a];return process.nextTick(function(){e.apply(null,o)})}}});var Vh=N((pL,qh)=>{var Mw={}.toString;qh.exports=Array.isArray||function(e){return Mw.call(e)=="[object Array]"}});var Au=N((dL,zh)=>{zh.exports=require("stream")});var Gi=N((_u,Hh)=>{var ws=require("buffer"),xr=ws.Buffer;function jh(e,t){for(var r in e)t[r]=e[r]}xr.from&&xr.alloc&&xr.allocUnsafe&&xr.allocUnsafeSlow?Hh.exports=ws:(jh(ws,_u),_u.Buffer=Hn);function Hn(e,t,r){return xr(e,t,r)}jh(xr,Hn);Hn.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return xr(e,t,r)};Hn.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var n=xr(e);return t!==void 0?typeof r=="string"?n.fill(t,r):n.fill(t):n.fill(0),n};Hn.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return xr(e)};Hn.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return ws.SlowBuffer(e)}});var $n=N(rt=>{function Uw(e){return Array.isArray?Array.isArray(e):bs(e)==="[object Array]"}rt.isArray=Uw;function qw(e){return typeof e=="boolean"}rt.isBoolean=qw;function Vw(e){return e===null}rt.isNull=Vw;function zw(e){return e==null}rt.isNullOrUndefined=zw;function jw(e){return typeof e=="number"}rt.isNumber=jw;function Hw(e){return typeof e=="string"}rt.isString=Hw;function $w(e){return typeof e=="symbol"}rt.isSymbol=$w;function Ww(e){return e===void 0}rt.isUndefined=Ww;function Gw(e){return bs(e)==="[object RegExp]"}rt.isRegExp=Gw;function Yw(e){return typeof e=="object"&&e!==null}rt.isObject=Yw;function Xw(e){return bs(e)==="[object Date]"}rt.isDate=Xw;function Zw(e){return bs(e)==="[object Error]"||e instanceof Error}rt.isError=Zw;function Kw(e){return typeof e=="function"}rt.isFunction=Kw;function Qw(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}rt.isPrimitive=Qw;rt.isBuffer=require("buffer").Buffer.isBuffer;function bs(e){return Object.prototype.toString.call(e)}});var $h=N((gL,xu)=>{typeof Object.create=="function"?xu.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:xu.exports=function(t,r){if(r){t.super_=r;var n=function(){};n.prototype=r.prototype,t.prototype=new n,t.prototype.constructor=t}}});var Wn=N((yL,Du)=>{try{if(Cu=require("util"),typeof Cu.inherits!="function")throw"";Du.exports=Cu.inherits}catch{Du.exports=$h()}var Cu});var Gh=N((vL,Su)=>{"use strict";function Jw(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Wh=Gi().Buffer,Yi=require("util");function eb(e,t,r){e.copy(t,r)}Su.exports=function(){function e(){Jw(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var n={data:r,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length},e.prototype.unshift=function(r){var n={data:r,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var n=this.head,i=""+n.data;n=n.next;)i+=r+n.data;return i},e.prototype.concat=function(r){if(this.length===0)return Wh.alloc(0);for(var n=Wh.allocUnsafe(r>>>0),i=this.head,o=0;i;)eb(i.data,n,o),o+=i.data.length,i=i.next;return n},e}();Yi&&Yi.inspect&&Yi.inspect.custom&&(Su.exports.prototype[Yi.inspect.custom]=function(){var e=Yi.inspect({length:this.length});return this.constructor.name+" "+e})});var Nu=N((EL,Yh)=>{"use strict";var As=Wi();function tb(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,As.nextTick(_s,this,e)):As.nextTick(_s,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,As.nextTick(_s,r,o)):As.nextTick(_s,r,o):t&&t(o)}),this)}function rb(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function _s(e,t){e.emit("error",t)}Yh.exports={destroy:tb,undestroy:rb}});var Zh=N((wL,Xh)=>{Xh.exports=require("util").deprecate});var Ou=N((bL,ip)=>{"use strict";var ln=Wi();ip.exports=ze;function Qh(e){var t=this;this.next=null,this.entry=null,this.finish=function(){wb(t,e)}}var nb=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:ln.nextTick,Gn;ze.WritableState=Zi;var Jh=Object.create($n());Jh.inherits=Wn();var ib={deprecate:Zh()},ep=Au(),Cs=Gi().Buffer,ob=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function sb(e){return Cs.from(e)}function ab(e){return Cs.isBuffer(e)||e instanceof ob}var tp=Nu();Jh.inherits(ze,ep);function ub(){}function Zi(e,t){Gn=Gn||cn(),e=e||{};var r=t instanceof Gn;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var n=e.highWaterMark,i=e.writableHighWaterMark,o=this.objectMode?16:16*1024;n||n===0?this.highWaterMark=n:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=e.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(u){mb(t,u)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Qh(this)}Zi.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Zi.prototype,"buffer",{get:ib.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var xs;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(xs=Function.prototype[Symbol.hasInstance],Object.defineProperty(ze,Symbol.hasInstance,{value:function(e){return xs.call(this,e)?!0:this!==ze?!1:e&&e._writableState instanceof Zi}})):xs=function(e){return e instanceof this};function ze(e){if(Gn=Gn||cn(),!xs.call(ze,this)&&!(this instanceof Gn))return new ze(e);this._writableState=new Zi(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),ep.call(this)}ze.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function lb(e,t){var r=new Error("write after end");e.emit("error",r),ln.nextTick(t,r)}function cb(e,t,r,n){var i=!0,o=!1;return r===null?o=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),ln.nextTick(n,o),i=!1),i}ze.prototype.write=function(e,t,r){var n=this._writableState,i=!1,o=!n.objectMode&&ab(e);return o&&!Cs.isBuffer(e)&&(e=sb(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=n.defaultEncoding),typeof r!="function"&&(r=ub),n.ended?lb(this,r):(o||cb(this,n,e,r))&&(n.pendingcb++,i=hb(this,n,o,e,t,r)),i};ze.prototype.cork=function(){var e=this._writableState;e.corked++};ze.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&rp(this,e))};ze.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function fb(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Cs.from(t,r)),t}Object.defineProperty(ze.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function hb(e,t,r,n,i,o){if(!r){var a=fb(t,n,i);n!==a&&(r=!0,i="buffer",n=a)}var u=t.objectMode?1:n.length;t.length+=u;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else Tu(e,t,!1,u,n,i,o);return l}function Tu(e,t,r,n,i,o,a){t.writelen=n,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function pb(e,t,r,n,i){--t.pendingcb,r?(ln.nextTick(i,n),ln.nextTick(Xi,e,t),e._writableState.errorEmitted=!0,e.emit("error",n)):(i(n),e._writableState.errorEmitted=!0,e.emit("error",n),Xi(e,t))}function db(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function mb(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(db(r),t)pb(e,r,n,t,i);else{var o=np(r);!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&rp(e,r),n?nb(Kh,e,r,o,i):Kh(e,r,o,i)}}function Kh(e,t,r,n){r||gb(e,t),t.pendingcb--,n(),Xi(e,t)}function gb(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function rp(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,u=!0;r;)i[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;i.allBuffers=u,Tu(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new Qh(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,c=r.encoding,f=r.callback,p=t.objectMode?1:l.length;if(Tu(e,t,!1,p,l,c,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}ze.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};ze.prototype._writev=null;ze.prototype.end=function(e,t,r){var n=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||Eb(this,n,r)};function np(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function yb(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Xi(e,t)})}function vb(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,ln.nextTick(yb,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Xi(e,t){var r=np(t);return r&&(vb(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function Eb(e,t,r){t.ending=!0,Xi(e,t),r&&(t.finished?ln.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function wb(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}Object.defineProperty(ze.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});ze.prototype.destroy=tp.destroy;ze.prototype._undestroy=tp.undestroy;ze.prototype._destroy=function(e,t){this.end(),t(e)}});var cn=N((AL,up)=>{"use strict";var op=Wi(),bb=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};up.exports=Cr;var sp=Object.create($n());sp.inherits=Wn();var ap=Fu(),Ru=Ou();sp.inherits(Cr,ap);for(Iu=bb(Ru.prototype),Ds=0;Ds<Iu.length;Ds++)Ss=Iu[Ds],Cr.prototype[Ss]||(Cr.prototype[Ss]=Ru.prototype[Ss]);var Iu,Ss,Ds;function Cr(e){if(!(this instanceof Cr))return new Cr(e);ap.call(this,e),Ru.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",Ab)}Object.defineProperty(Cr.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Ab(){this.allowHalfOpen||this._writableState.ended||op.nextTick(_b,this)}function _b(e){e.end()}Object.defineProperty(Cr.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});Cr.prototype._destroy=function(e,t){this.push(null),this.end(),op.nextTick(t,e)}});var Lu=N(cp=>{"use strict";var ku=Gi().Buffer,lp=ku.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function xb(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function Cb(e){var t=xb(e);if(typeof t!="string"&&(ku.isEncoding===lp||!lp(e)))throw new Error("Unknown encoding: "+e);return t||e}cp.StringDecoder=Ki;function Ki(e){this.encoding=Cb(e);var t;switch(this.encoding){case"utf16le":this.text=Ib,this.end=Rb,t=4;break;case"utf8":this.fillLast=Nb,t=4;break;case"base64":this.text=Fb,this.end=Pb,t=3;break;default:this.write=kb,this.end=Lb;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=ku.allocUnsafe(t)}Ki.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};Ki.prototype.end=Ob;Ki.prototype.text=Tb;Ki.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function Pu(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function Db(e,t,r){var n=t.length-1;if(n<r)return 0;var i=Pu(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||i===-2?0:(i=Pu(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||i===-2?0:(i=Pu(t[n]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function Sb(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t